@ibgib/space-gib 0.0.6 → 0.0.7
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/README.md +20 -0
- package/dist/client/bootstrap.mjs +31 -31
- package/dist/client/bootstrap.mjs.map +3 -3
- package/dist/client/chunk-RXFIBFRK.mjs +42 -0
- package/dist/client/chunk-RXFIBFRK.mjs.map +7 -0
- package/dist/client/chunk-ULFNE26Y.mjs +2216 -0
- package/dist/client/chunk-ULFNE26Y.mjs.map +7 -0
- package/dist/client/index.mjs +1 -1
- package/dist/client/script.mjs +1 -1
- package/dist/server/server.mjs +1346 -245
- package/dist/server/server.mjs.map +4 -4
- package/package.json +5 -5
- package/space-gib.localhost-1783713259760.log +45 -0
- package/src/client/AUTO-GENERATED-version.mts +1 -1
- package/src/client/bootstrap.mts +9 -0
- package/src/client/components/identity-header/identity-header.mts +43 -26
- package/src/client/components/identity-manager/identity-manager.css +57 -392
- package/src/client/components/identity-manager/identity-manager.html +0 -114
- package/src/client/components/identity-manager/identity-manager.mts +356 -543
- package/src/client/components/keystone-creator/keystone-creator.mts +4 -3
- package/src/client/components/keystone-details/keystone-details.css +472 -0
- package/src/client/components/keystone-details/keystone-details.html +99 -0
- package/src/client/components/keystone-details/keystone-details.mts +821 -0
- package/src/client/components/keystone-scrubber/SCRUBBER_IMPLEMENTATION.md +33 -0
- package/src/client/components/keystone-scrubber/keystone-scrubber.css +46 -0
- package/src/client/components/keystone-scrubber/keystone-scrubber.html +15 -0
- package/src/client/components/keystone-scrubber/keystone-scrubber.mts +356 -0
- package/src/client/ui/shell/space-gib-shell-service.mts +4 -0
- package/src/server/path-constants.mts +12 -0
- package/src/server/serve-gib/handlers/api/keystone/sso-config.handler.mts +66 -0
- package/src/server/serve-gib/handlers/api/keystone/sso-link.handler.mts +119 -0
- package/src/server/serve-gib/handlers/api/keystone/sso-login.handler.mts +189 -0
- package/src/server/server.mts +6 -0
- package/dist/client/chunk-734MMI4C.mjs +0 -42
- package/dist/client/chunk-734MMI4C.mjs.map +0 -7
- package/dist/client/chunk-SMOZ2D5E.mjs +0 -2049
- package/dist/client/chunk-SMOZ2D5E.mjs.map +0 -7
|
@@ -1,2049 +0,0 @@
|
|
|
1
|
-
import{$b as cr,Aa as Vi,B as ye,C as Di,D as Ue,E as Qe,Fb as ji,G as Li,Gb as er,H as ki,Hb as tr,I as Q,Ib as nr,Jb as or,La as Dt,Mb as ir,Sa as Hi,Sb as ae,Ua as qi,Ub as Ze,Vb as rr,W as Ui,Wb as sr,X as Fi,Xb as ar,Yb as lr,_b as Fe,a as f,ab as On,b as Nt,bb as Bi,bc as dr,c as Y,cc as we,d as Rt,db as le,dc as ur,e as $t,eb as re,ec as je,f as $i,fb as V,fc as fr,g as D,h as K,hb as Oi,i as y,ib as zi,jb as Ji,k as ke,kb as Wi,kc as pr,lb as Ki,lc as Jn,m as ht,mc as Wn,n as Ye,nb as se,nc as W,o as Mt,ob as Xi,p as Gt,pb as yt,q as gt,qb as Yi,rb as Pe,sb as Et,t as q,tb as Qi,u as x,ub as Zi,v as de,vb as Lt,w as Mi,wb as zn,y as Gi,yb as Ee,z as bt,zb as kt}from"./chunk-734MMI4C.mjs";var ue=V,Kn=class n{static{f(this,"IbGibComponentService")}lc=`[${n.name}]`;_registeredComponentsMeta=[];initialized;constructor(){this.initialized=this.initialize()}async initialize(){let e=`[${this.initialize.name}]`;try{ue&&console.log(`${e} starting... (I: 1cf04e8d768f4b5c55e7c3861e2d2225)`),console.log(`${e} does nothing atow (I: 65bb46c88c82b637ad928b8bf1a07225)`)}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{ue&&console.log(`${e} complete.`)}}registerComponentMeta(e){this._registeredComponentsMeta.push(e),ue&&console.log(`${this.lc}[registerComponentMeta] component meta registered: ${e.constructor.name} (I: 88ddcbd0c8caa2342af0e7348f171225)`)}unregisterComponentMeta(e){this._registeredComponentsMeta=this._registeredComponentsMeta.filter(t=>t!==e),ue&&console.log(`${this.lc}[unregisterComponentMeta] component meta unregistered: ${e.constructor.name} (I: 4e84b5274de688248984896a90f5cc25)`)}async getComponentInstance({useRegExpPrefilter:e,path:t,ibGibAddr:o}){let i=`${this.lc}[${this.getComponentInstance.name}]`;try{ue&&console.log(`${i} starting... (I: 684ef316cbdb4a3b1fdc96096c273b25)`);let s,l=It.getRegisteredComponentsMeta(),c=e?l.filter(d=>{let u=d.routeRegExp?d.routeRegExp.test(t):!1;return ue&&console.log(`${i} ${d.componentName} ${d.routeRegExp} componentMatchesPath: ${u} (I: 3758520e6a4a57f218396c8649283425)`),u}):l.concat();for(let d of c)if(d.fnHandleRoute?await d.fnHandleRoute({path:t,ibGibAddr:o}):!0){s=await d.createInstance({path:t,ibGibAddr:o});break}return s}catch(s){throw console.error(`${i} ${y(s)}`),s}finally{ue&&console.log(`${i} complete.`)}}async inject({parentEl:e,componentToInject:t}){let o=`${this.lc}[${this.inject.name}]`;try{if(ue&&console.log(`${o} starting... (I: 6844cf07eaf8a5b1b106784f7db17125)`),!e)throw new Error(`${o} parentEl required. (E: 6f4eb2d682856ef47d173b970ec3c825)`);if(!t)throw new Error(`${o} componentToInject required. (E: decf0b51ad49257ce44fecbcf84c3a25)`);if(!t.meta)throw new Error(`${o} componentToInject.meta required. (E: f8827c0602ca7b0e030d0b3e2c4a4825)`);if(!t.meta.componentName)throw new Error(`${o} componentToInject.meta.componentName required. (E: 5dcae244ae32690f7b73ce27a32a3c25)`);e.innerHTML="",e.appendChild(t),e.classList.remove("fade-out")}catch(i){console.error(`${o} ${y(i)}`),e.innerHTML=`<p class="error">Error loading component for route. error:</p><br /><br /><p>${i.message}</p>`}finally{ue&&console.log(`${o} complete.`)}}getRegisteredComponentsMeta(){return[...this._registeredComponentsMeta]}},It;async function _e(){let n=`[${_e.name}]`;try{return ue&&console.log(`${n} starting... (I: 853694c88223381339103a3765129925)`),It||(It=new Kn,await It.initialized),It}catch(e){throw console.error(`${n} ${y(e)}`),e}finally{ue&&console.log(`${n} complete.`)}}f(_e,"getComponentSvc");var mr="left-panel";var hr="right-panel";var gr="left-resizer",br="right-resizer",yr="footer-resizer",Er="btn-left-panel-toggle",Ir="btn-right-panel-toggle",vr="btn-create-keystone",Xn="center-panel-content";var Tr=`:host {
|
|
2
|
-
display: block;
|
|
3
|
-
width: 100%;
|
|
4
|
-
max-width: 600px;
|
|
5
|
-
margin: 2rem auto;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
h2 {
|
|
9
|
-
margin-top: 0;
|
|
10
|
-
font-size: 1.5rem;
|
|
11
|
-
color: var(--clr-accent);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.content {
|
|
15
|
-
margin-top: 1.5rem;
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
gap: 1.5rem;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.input-group {
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
gap: 0.5rem;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.input-group label {
|
|
28
|
-
font-size: 0.85rem;
|
|
29
|
-
color: var(--clr-text-secondary);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.status-area {
|
|
33
|
-
margin-top: 0.5rem;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.status-area.hidden {
|
|
37
|
-
display: none;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.result-area {
|
|
41
|
-
padding: 1.5rem;
|
|
42
|
-
background: rgba(255, 255, 255, 0.03);
|
|
43
|
-
border: 1px solid var(--clr-border);
|
|
44
|
-
border-radius: var(--radius-md);
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-direction: column;
|
|
47
|
-
gap: 0.75rem;
|
|
48
|
-
transition: opacity var(--t-med);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.result-area.collapsed {
|
|
52
|
-
display: none;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.address-label {
|
|
56
|
-
font-size: 0.8rem;
|
|
57
|
-
color: var(--clr-text-secondary);
|
|
58
|
-
margin: 0;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.warning {
|
|
62
|
-
font-size: 0.8rem;
|
|
63
|
-
color: var(--clr-warn);
|
|
64
|
-
margin: 0.5rem 0 0;
|
|
65
|
-
}`;var wr=`<div id="container" class="component-container">\r
|
|
66
|
-
<h2 id="title">Keystone Creator</h2>\r
|
|
67
|
-
<div class="content">\r
|
|
68
|
-
<p>This will generate a new root keystone (identity) for your space.</p>\r
|
|
69
|
-
\r
|
|
70
|
-
<div class="input-group">\r
|
|
71
|
-
<label for="input-username">Username</label>\r
|
|
72
|
-
<input type="text" id="input-username" placeholder="Enter your username..." class="text-input">\r
|
|
73
|
-
</div>\r
|
|
74
|
-
\r
|
|
75
|
-
<div class="input-group">\r
|
|
76
|
-
<label for="input-description">Description (Optional)</label>\r
|
|
77
|
-
<input type="text" id="input-description" placeholder="Enter an optional description..." class="text-input">\r
|
|
78
|
-
</div>\r
|
|
79
|
-
\r
|
|
80
|
-
<div class="input-group">\r
|
|
81
|
-
<label for="input-secret">Master Secret (Keep this private!)</label>\r
|
|
82
|
-
<input type="password" id="input-secret" placeholder="Enter your master secret..." class="secret-input">\r
|
|
83
|
-
</div>\r
|
|
84
|
-
\r
|
|
85
|
-
<div class="checkbox-group" style="margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.5rem;">\r
|
|
86
|
-
<input type="checkbox" id="checkbox-make-active" checked style="cursor: pointer; width: 1rem; height: 1rem;">\r
|
|
87
|
-
<label for="checkbox-make-active" style="cursor: pointer; font-size: 0.9rem; user-select: none;">Make this the active identity</label>\r
|
|
88
|
-
</div>\r
|
|
89
|
-
\r
|
|
90
|
-
<div class="action-row">\r
|
|
91
|
-
<button id="btn-generate" class="action-btn">Generate Identity Keystone</button>\r
|
|
92
|
-
</div>\r
|
|
93
|
-
\r
|
|
94
|
-
<div id="status-area" class="status-area hidden">\r
|
|
95
|
-
<p id="status-text" class="status-msg"></p>\r
|
|
96
|
-
</div>\r
|
|
97
|
-
\r
|
|
98
|
-
<div id="result-area" class="result-area collapsed">\r
|
|
99
|
-
<h3>New Keystone Generated!</h3>\r
|
|
100
|
-
<p class="address-label">Address:</p>\r
|
|
101
|
-
<code id="keystone-addr" class="keystone-addr"></code>\r
|
|
102
|
-
<p class="warning">\u26A0\uFE0F Store this address safely. It is your root identity for this space.</p>\r
|
|
103
|
-
</div>\r
|
|
104
|
-
</div>\r
|
|
105
|
-
</div>`;var et=`/* =========================================================================
|
|
106
|
-
space-gib \u2014 style.css
|
|
107
|
-
Dark-first, glassmorphism, premium design.
|
|
108
|
-
========================================================================= */
|
|
109
|
-
|
|
110
|
-
/* \u2500\u2500 Custom properties \u2500\u2500 */
|
|
111
|
-
:root {
|
|
112
|
-
/* Palette */
|
|
113
|
-
--clr-bg-deep: #05080f;
|
|
114
|
-
--clr-bg-surface: #0b1120;
|
|
115
|
-
--clr-bg-glass: rgba(11, 17, 32, 0.7);
|
|
116
|
-
--clr-border: rgba(120, 248, 126, 0.12);
|
|
117
|
-
--clr-border-hover: rgba(120, 248, 126, 0.32);
|
|
118
|
-
|
|
119
|
-
--clr-accent: #78f87e;
|
|
120
|
-
--clr-accent-dim: rgba(120, 248, 126, 0.35);
|
|
121
|
-
--clr-accent-glow: rgba(120, 248, 126, 0.15);
|
|
122
|
-
|
|
123
|
-
--clr-text-primary: #e8f0e8;
|
|
124
|
-
--clr-text-secondary: #8fa08f;
|
|
125
|
-
--clr-text-muted: #4a604a;
|
|
126
|
-
|
|
127
|
-
--clr-danger: #ff5b5b;
|
|
128
|
-
--clr-warn: #ffcc44;
|
|
129
|
-
--clr-info: #44aaff;
|
|
130
|
-
|
|
131
|
-
/* Typography */
|
|
132
|
-
--font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
|
133
|
-
--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
134
|
-
|
|
135
|
-
/* Spacing / Layout */
|
|
136
|
-
--header-h: 60px;
|
|
137
|
-
--footer-h: 48px;
|
|
138
|
-
--radius-sm: 6px;
|
|
139
|
-
--radius-md: 12px;
|
|
140
|
-
--radius-lg: 20px;
|
|
141
|
-
|
|
142
|
-
/* Shadows */
|
|
143
|
-
--shadow-card: 0 4px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--clr-border);
|
|
144
|
-
--shadow-glow: 0 0 32px var(--clr-accent-glow);
|
|
145
|
-
--shadow-dialog: 0 8px 48px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--clr-border);
|
|
146
|
-
|
|
147
|
-
/* Panel Dimensions */
|
|
148
|
-
--left-panel-width: 250px;
|
|
149
|
-
--right-panel-width: 250px;
|
|
150
|
-
--footer-panel-height: 48px;
|
|
151
|
-
|
|
152
|
-
/* Transition */
|
|
153
|
-
--t-fast: 120ms ease;
|
|
154
|
-
--t-med: 240ms ease;
|
|
155
|
-
--t-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
156
|
-
|
|
157
|
-
/* Tab Component Properties */
|
|
158
|
-
--tab-padding: 0.55rem 1.25rem;
|
|
159
|
-
--tab-background-color: rgba(255, 255, 255, 0.03);
|
|
160
|
-
--tab-background-color-hover: rgba(255, 255, 255, 0.08);
|
|
161
|
-
--tab-background-color-active: rgba(120, 248, 126, 0.1);
|
|
162
|
-
--tab-border-radius: var(--radius-sm) var(--radius-sm) 0 0;
|
|
163
|
-
--tab-border-width: 1px;
|
|
164
|
-
--tab-border-color: rgba(255, 255, 255, 0.05);
|
|
165
|
-
--tab-border-color-active: var(--clr-accent-dim);
|
|
166
|
-
--tab-text-color: var(--clr-text-secondary);
|
|
167
|
-
--tab-text-color-active: var(--clr-accent);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/* \u2500\u2500 Reset \u2500\u2500 */
|
|
171
|
-
*,
|
|
172
|
-
*::before,
|
|
173
|
-
*::after {
|
|
174
|
-
box-sizing: border-box;
|
|
175
|
-
margin: 0;
|
|
176
|
-
padding: 0;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
html {
|
|
180
|
-
font-size: 16px;
|
|
181
|
-
-webkit-text-size-adjust: 100%;
|
|
182
|
-
height: 100%;
|
|
183
|
-
overflow: hidden;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
body {
|
|
187
|
-
font-family: var(--font-sans);
|
|
188
|
-
background: var(--clr-bg-deep);
|
|
189
|
-
color: var(--clr-text-primary);
|
|
190
|
-
height: 100dvh;
|
|
191
|
-
overflow: hidden;
|
|
192
|
-
line-height: 1.6;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/* \u2500\u2500 Global Scrollbar Customization \u2500\u2500 */
|
|
196
|
-
/* Custom scrollbar properties for Firefox */
|
|
197
|
-
* {
|
|
198
|
-
scrollbar-width: thin;
|
|
199
|
-
scrollbar-color: var(--clr-accent-dim) transparent;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/* Chrome, Safari, Edge, Opera */
|
|
203
|
-
::-webkit-scrollbar {
|
|
204
|
-
width: 6px;
|
|
205
|
-
height: 6px;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
::-webkit-scrollbar-track {
|
|
209
|
-
background: transparent;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
::-webkit-scrollbar-thumb {
|
|
213
|
-
background: var(--clr-accent-dim);
|
|
214
|
-
border-radius: var(--radius-sm);
|
|
215
|
-
background-clip: padding-box;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
::-webkit-scrollbar-thumb:hover {
|
|
219
|
-
background: var(--clr-accent);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/* Subtle animated background gradient */
|
|
223
|
-
body::before {
|
|
224
|
-
content: '';
|
|
225
|
-
position: fixed;
|
|
226
|
-
inset: 0;
|
|
227
|
-
background:
|
|
228
|
-
radial-gradient(ellipse 80% 60% at 10% 5%, rgba(120, 248, 126, 0.06) 0%, transparent 60%),
|
|
229
|
-
radial-gradient(ellipse 60% 50% at 90% 95%, rgba(68, 170, 255, 0.05) 0%, transparent 55%);
|
|
230
|
-
pointer-events: none;
|
|
231
|
-
z-index: 0;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/* \u2500\u2500 Fullscreen dialog (required by @ibgib/web-gib) \u2500\u2500 */
|
|
235
|
-
.fullscreen-dialog {
|
|
236
|
-
border: 1px solid var(--clr-border);
|
|
237
|
-
border-radius: var(--radius-lg);
|
|
238
|
-
background: var(--clr-bg-surface);
|
|
239
|
-
color: var(--clr-text-primary);
|
|
240
|
-
box-shadow: var(--shadow-dialog);
|
|
241
|
-
max-width: min(520px, 92vw);
|
|
242
|
-
width: 100%;
|
|
243
|
-
padding: 0;
|
|
244
|
-
outline: none;
|
|
245
|
-
margin: auto;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.fullscreen-dialog::backdrop {
|
|
249
|
-
background: rgba(0, 0, 0, 0.72);
|
|
250
|
-
backdrop-filter: blur(4px);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.fullscreen-dialog-content {
|
|
254
|
-
display: flex;
|
|
255
|
-
flex-direction: column;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
.fullscreen-dialog-header {
|
|
259
|
-
padding: 1.5rem 1.5rem 0.5rem;
|
|
260
|
-
border-bottom: 1px solid var(--clr-border);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.fullscreen-dialog-header h2 {
|
|
264
|
-
font-size: 1.1rem;
|
|
265
|
-
font-weight: 600;
|
|
266
|
-
color: var(--clr-accent);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
.fullscreen-dialog-body {
|
|
270
|
-
padding: 1rem 1.5rem;
|
|
271
|
-
display: flex;
|
|
272
|
-
flex-direction: column;
|
|
273
|
-
gap: 0.75rem;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
.fullscreen-dialog-message {
|
|
277
|
-
font-size: 0.9375rem;
|
|
278
|
-
color: var(--clr-text-primary);
|
|
279
|
-
white-space: pre-wrap;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
#fullscreen-dialog-prompt-input {
|
|
283
|
-
background: rgba(255, 255, 255, 0.04);
|
|
284
|
-
border: 1px solid var(--clr-border);
|
|
285
|
-
border-radius: var(--radius-sm);
|
|
286
|
-
padding: 0.6rem 0.75rem;
|
|
287
|
-
color: var(--clr-text-primary);
|
|
288
|
-
font-family: var(--font-sans);
|
|
289
|
-
font-size: 0.9375rem;
|
|
290
|
-
outline: none;
|
|
291
|
-
transition: border-color var(--t-fast), box-shadow var(--t-fast);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
#fullscreen-dialog-prompt-input:focus {
|
|
295
|
-
border-color: var(--clr-accent);
|
|
296
|
-
box-shadow: 0 0 0 3px var(--clr-accent-glow);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
#fullscreen-dialog-prompt-input.collapsed {
|
|
300
|
-
display: none;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.fullscreen-dialog-footer {
|
|
304
|
-
display: flex;
|
|
305
|
-
justify-content: flex-end;
|
|
306
|
-
gap: 0.5rem;
|
|
307
|
-
padding: 0.75rem 1.5rem 1.25rem;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
.dialog-button {
|
|
311
|
-
padding: 0.5rem 1.25rem;
|
|
312
|
-
border-radius: var(--radius-sm);
|
|
313
|
-
border: 1px solid var(--clr-border);
|
|
314
|
-
background: transparent;
|
|
315
|
-
color: var(--clr-text-primary);
|
|
316
|
-
font-family: var(--font-sans);
|
|
317
|
-
font-size: 0.875rem;
|
|
318
|
-
cursor: pointer;
|
|
319
|
-
transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
.dialog-button:first-child {
|
|
323
|
-
background: var(--clr-accent);
|
|
324
|
-
border-color: var(--clr-accent);
|
|
325
|
-
color: var(--clr-bg-deep);
|
|
326
|
-
font-weight: 600;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
.dialog-button:first-child:hover {
|
|
330
|
-
background: #9fffa5;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
.dialog-button:last-child:hover {
|
|
334
|
-
border-color: var(--clr-border-hover);
|
|
335
|
-
background: rgba(255, 255, 255, 0.04);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/* \u2500\u2500 App root layout \u2500\u2500 */
|
|
339
|
-
.app-root {
|
|
340
|
-
position: relative;
|
|
341
|
-
z-index: 1;
|
|
342
|
-
display: flex;
|
|
343
|
-
flex-direction: column;
|
|
344
|
-
height: 100dvh;
|
|
345
|
-
overflow: hidden;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
.middle-row {
|
|
349
|
-
display: flex;
|
|
350
|
-
flex: 1;
|
|
351
|
-
overflow: hidden;
|
|
352
|
-
position: relative;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/* \u2500\u2500 Header \u2500\u2500 */
|
|
356
|
-
.header-panel {
|
|
357
|
-
position: sticky;
|
|
358
|
-
top: 0;
|
|
359
|
-
z-index: 100;
|
|
360
|
-
height: var(--header-h);
|
|
361
|
-
background: var(--clr-bg-glass);
|
|
362
|
-
border-bottom: 1px solid var(--clr-border);
|
|
363
|
-
backdrop-filter: blur(16px);
|
|
364
|
-
-webkit-backdrop-filter: blur(16px);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
.header-content {
|
|
368
|
-
margin: 0 auto;
|
|
369
|
-
height: 100%;
|
|
370
|
-
display: flex;
|
|
371
|
-
align-items: center;
|
|
372
|
-
padding: 0 1.5rem;
|
|
373
|
-
gap: 1rem;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
.brand-link {
|
|
377
|
-
text-decoration: none;
|
|
378
|
-
display: flex;
|
|
379
|
-
align-items: center;
|
|
380
|
-
gap: 0.4rem;
|
|
381
|
-
font-size: 1.2rem;
|
|
382
|
-
font-weight: 700;
|
|
383
|
-
color: var(--clr-text-primary);
|
|
384
|
-
letter-spacing: -0.02em;
|
|
385
|
-
transition: color var(--t-fast);
|
|
386
|
-
margin-right: auto;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
.brand-link:hover {
|
|
390
|
-
color: var(--clr-accent);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
.brand-icon {
|
|
394
|
-
color: var(--clr-accent);
|
|
395
|
-
font-size: 1.4rem;
|
|
396
|
-
animation: spin-slow 12s linear infinite;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
.brand-accent {
|
|
400
|
-
color: var(--clr-accent);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
@keyframes spin-slow {
|
|
404
|
-
from {
|
|
405
|
-
transform: rotate(0deg);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
to {
|
|
409
|
-
transform: rotate(360deg);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
.header-nav {
|
|
414
|
-
display: flex;
|
|
415
|
-
gap: 0.25rem;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
.nav-link {
|
|
419
|
-
text-decoration: none;
|
|
420
|
-
color: var(--clr-text-secondary);
|
|
421
|
-
font-size: 0.875rem;
|
|
422
|
-
font-weight: 500;
|
|
423
|
-
padding: 0.35rem 0.75rem;
|
|
424
|
-
border-radius: var(--radius-sm);
|
|
425
|
-
transition: color var(--t-fast), background var(--t-fast);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
.nav-link:hover {
|
|
429
|
-
color: var(--clr-text-primary);
|
|
430
|
-
background: rgba(255, 255, 255, 0.04);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
.config-btn {
|
|
434
|
-
background: none;
|
|
435
|
-
border: 1px solid var(--clr-border);
|
|
436
|
-
border-radius: var(--radius-sm);
|
|
437
|
-
padding: 0.3rem 0.6rem;
|
|
438
|
-
color: var(--clr-text-secondary);
|
|
439
|
-
cursor: pointer;
|
|
440
|
-
font-size: 1rem;
|
|
441
|
-
transition: border-color var(--t-fast), color var(--t-fast);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
.config-btn:hover {
|
|
445
|
-
border-color: var(--clr-border-hover);
|
|
446
|
-
color: var(--clr-text-primary);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
.config-popover {
|
|
450
|
-
position: absolute;
|
|
451
|
-
top: var(--header-h);
|
|
452
|
-
right: 1rem;
|
|
453
|
-
background: var(--clr-bg-surface);
|
|
454
|
-
border: 1px solid var(--clr-border);
|
|
455
|
-
border-radius: var(--radius-md);
|
|
456
|
-
box-shadow: var(--shadow-card);
|
|
457
|
-
padding: 0.5rem;
|
|
458
|
-
min-width: 200px;
|
|
459
|
-
margin: 0;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
.config-popover-option {
|
|
463
|
-
display: block;
|
|
464
|
-
width: 100%;
|
|
465
|
-
text-align: left;
|
|
466
|
-
padding: 0.6rem 0.9rem;
|
|
467
|
-
border: none;
|
|
468
|
-
border-radius: var(--radius-sm);
|
|
469
|
-
background: transparent;
|
|
470
|
-
color: var(--clr-text-primary);
|
|
471
|
-
font-family: var(--font-sans);
|
|
472
|
-
font-size: 0.875rem;
|
|
473
|
-
cursor: pointer;
|
|
474
|
-
transition: background var(--t-fast);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
.config-popover-option:hover {
|
|
478
|
-
background: rgba(120, 248, 126, 0.08);
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/* \u2500\u2500 Header Toggle Buttons \u2500\u2500 */
|
|
482
|
-
.panel-toggle-btn {
|
|
483
|
-
background: none;
|
|
484
|
-
border: none;
|
|
485
|
-
color: var(--clr-text-secondary);
|
|
486
|
-
font-size: 1.4rem;
|
|
487
|
-
cursor: pointer;
|
|
488
|
-
padding: 0.2rem 0.5rem;
|
|
489
|
-
transition: color var(--t-fast);
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
.panel-toggle-btn:hover {
|
|
493
|
-
color: var(--clr-accent);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/* \u2500\u2500 Center panel / main \u2500\u2500 */
|
|
497
|
-
.center-panel {
|
|
498
|
-
flex: 1;
|
|
499
|
-
display: flex;
|
|
500
|
-
flex-direction: column;
|
|
501
|
-
overflow: hidden;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
.center-panel-content {
|
|
505
|
-
flex: 1;
|
|
506
|
-
overflow-y: auto;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
/* \u2500\u2500 Side Panels \u2500\u2500 */
|
|
510
|
-
.side-panel {
|
|
511
|
-
background: var(--clr-bg-glass);
|
|
512
|
-
overflow: hidden;
|
|
513
|
-
transition: width var(--t-fast);
|
|
514
|
-
z-index: 5;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
.left-panel {
|
|
518
|
-
width: var(--left-panel-width);
|
|
519
|
-
border-right: 1px solid var(--clr-border);
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
.left-panel.collapsed {
|
|
523
|
-
width: 0 !important;
|
|
524
|
-
border: none;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
.right-panel {
|
|
528
|
-
width: var(--right-panel-width);
|
|
529
|
-
border-left: 1px solid var(--clr-border);
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
.right-panel.collapsed {
|
|
533
|
-
width: 0 !important;
|
|
534
|
-
border: none;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
.panel-content-inner {
|
|
538
|
-
padding: 1rem;
|
|
539
|
-
width: 100%;
|
|
540
|
-
min-width: 150px;
|
|
541
|
-
height: 100%;
|
|
542
|
-
overflow-y: auto;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
.placeholder-text {
|
|
546
|
-
color: var(--clr-text-muted);
|
|
547
|
-
font-size: 0.9rem;
|
|
548
|
-
font-style: italic;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
/* \u2500\u2500 Resizers \u2500\u2500 */
|
|
552
|
-
.resizer {
|
|
553
|
-
background: transparent;
|
|
554
|
-
transition: background var(--t-fast);
|
|
555
|
-
z-index: 10;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
.resizer:hover,
|
|
559
|
-
.resizer:active {
|
|
560
|
-
background: var(--clr-accent-dim);
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
.resizer-v {
|
|
564
|
-
width: 6px;
|
|
565
|
-
cursor: col-resize;
|
|
566
|
-
margin-left: -3px;
|
|
567
|
-
margin-right: -3px;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
.resizer-h {
|
|
571
|
-
height: 6px;
|
|
572
|
-
cursor: row-resize;
|
|
573
|
-
margin-top: -3px;
|
|
574
|
-
margin-bottom: -3px;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
/* \u2500\u2500 Hero section \u2500\u2500 */
|
|
578
|
-
.hero-section {
|
|
579
|
-
max-width: 720px;
|
|
580
|
-
margin: 0 auto;
|
|
581
|
-
padding: 6rem 1.5rem 4rem;
|
|
582
|
-
text-align: center;
|
|
583
|
-
display: flex;
|
|
584
|
-
flex-direction: column;
|
|
585
|
-
align-items: center;
|
|
586
|
-
gap: 1.25rem;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
.hero-glyph {
|
|
590
|
-
font-size: 4rem;
|
|
591
|
-
color: var(--clr-accent);
|
|
592
|
-
animation: pulse-glyph 3s ease-in-out infinite;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
@keyframes pulse-glyph {
|
|
596
|
-
|
|
597
|
-
0%,
|
|
598
|
-
100% {
|
|
599
|
-
text-shadow: 0 0 0 transparent;
|
|
600
|
-
opacity: 1;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
50% {
|
|
604
|
-
text-shadow: 0 0 30px var(--clr-accent-glow);
|
|
605
|
-
opacity: 0.85;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
.hero-title {
|
|
610
|
-
font-size: clamp(2.5rem, 6vw, 4rem);
|
|
611
|
-
font-weight: 700;
|
|
612
|
-
letter-spacing: -0.03em;
|
|
613
|
-
background: linear-gradient(135deg, var(--clr-accent) 0%, #44aaff 100%);
|
|
614
|
-
-webkit-background-clip: text;
|
|
615
|
-
-webkit-text-fill-color: transparent;
|
|
616
|
-
background-clip: text;
|
|
617
|
-
line-height: 1.1;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
.hero-tagline {
|
|
621
|
-
font-size: 1.125rem;
|
|
622
|
-
color: var(--clr-text-secondary);
|
|
623
|
-
max-width: 480px;
|
|
624
|
-
line-height: 1.7;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
.cta-row {
|
|
628
|
-
display: flex;
|
|
629
|
-
gap: 0.75rem;
|
|
630
|
-
flex-wrap: wrap;
|
|
631
|
-
justify-content: center;
|
|
632
|
-
margin-top: 0.5rem;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
.cta-btn {
|
|
636
|
-
padding: 0.75rem 1.75rem;
|
|
637
|
-
border-radius: var(--radius-md);
|
|
638
|
-
font-family: var(--font-sans);
|
|
639
|
-
font-size: 0.9375rem;
|
|
640
|
-
font-weight: 600;
|
|
641
|
-
cursor: pointer;
|
|
642
|
-
text-decoration: none;
|
|
643
|
-
transition: all var(--t-med);
|
|
644
|
-
display: inline-flex;
|
|
645
|
-
align-items: center;
|
|
646
|
-
gap: 0.4rem;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
.cta-primary {
|
|
650
|
-
background: var(--clr-accent);
|
|
651
|
-
color: var(--clr-bg-deep);
|
|
652
|
-
border: none;
|
|
653
|
-
box-shadow: 0 0 20px var(--clr-accent-glow);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
.cta-primary:hover {
|
|
657
|
-
background: #9fffa5;
|
|
658
|
-
box-shadow: 0 0 32px rgba(120, 248, 126, 0.35);
|
|
659
|
-
transform: translateY(-1px);
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
.cta-secondary {
|
|
663
|
-
background: transparent;
|
|
664
|
-
color: var(--clr-text-primary);
|
|
665
|
-
border: 1px solid var(--clr-border);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
.cta-secondary:hover {
|
|
669
|
-
border-color: var(--clr-border-hover);
|
|
670
|
-
background: rgba(255, 255, 255, 0.04);
|
|
671
|
-
transform: translateY(-1px);
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
/* \u2500\u2500 Features section \u2500\u2500 */
|
|
675
|
-
.features-section {
|
|
676
|
-
max-width: 1000px;
|
|
677
|
-
margin: 0 auto;
|
|
678
|
-
padding: 0 1.5rem 5rem;
|
|
679
|
-
display: grid;
|
|
680
|
-
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
|
|
681
|
-
gap: 1.25rem;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
.feature-card {
|
|
685
|
-
background: var(--clr-bg-glass);
|
|
686
|
-
border: 1px solid var(--clr-border);
|
|
687
|
-
border-radius: var(--radius-lg);
|
|
688
|
-
padding: 1.75rem;
|
|
689
|
-
backdrop-filter: blur(12px);
|
|
690
|
-
transition: border-color var(--t-med), box-shadow var(--t-med), transform var(--t-med);
|
|
691
|
-
display: flex;
|
|
692
|
-
flex-direction: column;
|
|
693
|
-
gap: 0.75rem;
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
.feature-card:hover {
|
|
697
|
-
border-color: var(--clr-border-hover);
|
|
698
|
-
box-shadow: var(--shadow-glow);
|
|
699
|
-
transform: translateY(-3px);
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
.feature-icon {
|
|
703
|
-
font-size: 1.75rem;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
.feature-title {
|
|
707
|
-
font-size: 1.1rem;
|
|
708
|
-
font-weight: 600;
|
|
709
|
-
color: var(--clr-text-primary);
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
.feature-desc {
|
|
713
|
-
font-size: 0.9rem;
|
|
714
|
-
color: var(--clr-text-secondary);
|
|
715
|
-
line-height: 1.65;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
.feature-desc code {
|
|
719
|
-
font-family: var(--font-mono);
|
|
720
|
-
font-size: 0.8rem;
|
|
721
|
-
background: rgba(120, 248, 126, 0.1);
|
|
722
|
-
color: var(--clr-accent);
|
|
723
|
-
padding: 0.1em 0.35em;
|
|
724
|
-
border-radius: 3px;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
/* \u2500\u2500 Status section \u2500\u2500 */
|
|
728
|
-
.status-section {
|
|
729
|
-
max-width: 400px;
|
|
730
|
-
margin: 0 auto;
|
|
731
|
-
padding: 0 1.5rem 4rem;
|
|
732
|
-
display: flex;
|
|
733
|
-
justify-content: center;
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
.status-badge {
|
|
737
|
-
display: inline-flex;
|
|
738
|
-
align-items: center;
|
|
739
|
-
gap: 0.5rem;
|
|
740
|
-
padding: 0.5rem 1rem;
|
|
741
|
-
border-radius: 999px;
|
|
742
|
-
font-size: 0.85rem;
|
|
743
|
-
font-weight: 500;
|
|
744
|
-
border: 1px solid var(--clr-border);
|
|
745
|
-
background: var(--clr-bg-glass);
|
|
746
|
-
backdrop-filter: blur(8px);
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
.status-loading {
|
|
750
|
-
color: var(--clr-text-secondary);
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
.status-ready {
|
|
754
|
-
color: var(--clr-accent);
|
|
755
|
-
border-color: var(--clr-accent-dim);
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
.status-error {
|
|
759
|
-
color: var(--clr-danger);
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
/* \u2500\u2500 Footer \u2500\u2500 */
|
|
763
|
-
.footer-panel {
|
|
764
|
-
height: var(--footer-panel-height);
|
|
765
|
-
display: flex;
|
|
766
|
-
align-items: center;
|
|
767
|
-
justify-content: center;
|
|
768
|
-
border-top: 1px solid var(--clr-border);
|
|
769
|
-
background: var(--clr-bg-glass);
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
.footer-text {
|
|
773
|
-
font-size: 0.8rem;
|
|
774
|
-
color: var(--clr-text-muted);
|
|
775
|
-
display: flex;
|
|
776
|
-
gap: 0.5rem;
|
|
777
|
-
flex-wrap: wrap;
|
|
778
|
-
justify-content: center;
|
|
779
|
-
align-items: center;
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
.footer-link {
|
|
783
|
-
color: var(--clr-text-secondary);
|
|
784
|
-
text-decoration: none;
|
|
785
|
-
transition: color var(--t-fast);
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
.footer-link:hover {
|
|
789
|
-
color: var(--clr-accent);
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
/* \u2500\u2500 Responsive \u2500\u2500 */
|
|
793
|
-
@media (max-width: 600px) {
|
|
794
|
-
.header-nav {
|
|
795
|
-
display: none;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
.hero-section {
|
|
799
|
-
padding: 3rem 1rem 2.5rem;
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
.features-section {
|
|
803
|
-
padding: 0 1rem 3rem;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
/* \u2500\u2500 Dev Tools Panel (diagnostic only \u2014 remove when WS sync confirmed) \u2500\u2500 */
|
|
808
|
-
.dev-panel {
|
|
809
|
-
max-width: 100%;
|
|
810
|
-
width: 100%;
|
|
811
|
-
margin: 0 auto;
|
|
812
|
-
padding: 1.5rem;
|
|
813
|
-
border: 1px dashed rgba(255, 204, 68, 0.35);
|
|
814
|
-
border-radius: var(--radius-md);
|
|
815
|
-
background: rgba(255, 204, 68, 0.04);
|
|
816
|
-
display: flex;
|
|
817
|
-
flex-direction: column;
|
|
818
|
-
gap: 1rem;
|
|
819
|
-
margin-bottom: 3rem;
|
|
820
|
-
max-height: none;
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
.dev-panel-title {
|
|
824
|
-
font-size: 0.8rem;
|
|
825
|
-
font-weight: 600;
|
|
826
|
-
text-transform: uppercase;
|
|
827
|
-
letter-spacing: 0.12em;
|
|
828
|
-
color: var(--clr-warn);
|
|
829
|
-
opacity: 0.7;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
.dev-panel-select-container {
|
|
833
|
-
display: flex;
|
|
834
|
-
align-items: center;
|
|
835
|
-
gap: 0.75rem;
|
|
836
|
-
margin-bottom: 0.5rem;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
.dev-select {
|
|
840
|
-
background: var(--clr-bg-surface);
|
|
841
|
-
color: var(--clr-text-primary);
|
|
842
|
-
border: 1px solid rgba(255, 204, 68, 0.4);
|
|
843
|
-
padding: 0.5rem 1rem;
|
|
844
|
-
border-radius: var(--radius-sm);
|
|
845
|
-
font-family: var(--font-sans);
|
|
846
|
-
outline: none;
|
|
847
|
-
cursor: pointer;
|
|
848
|
-
font-size: 0.9rem;
|
|
849
|
-
transition: border-color var(--t-fast);
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
.dev-select:hover {
|
|
853
|
-
border-color: rgba(255, 204, 68, 0.7);
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
.dev-panel-row {
|
|
857
|
-
display: flex;
|
|
858
|
-
gap: 0.75rem;
|
|
859
|
-
flex-wrap: wrap;
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
.dev-btn {
|
|
863
|
-
padding: 0.55rem 1.25rem;
|
|
864
|
-
border-radius: var(--radius-sm);
|
|
865
|
-
background: transparent;
|
|
866
|
-
border: 1px solid rgba(255, 204, 68, 0.4);
|
|
867
|
-
color: var(--clr-warn);
|
|
868
|
-
font-family: var(--font-sans);
|
|
869
|
-
font-size: 0.875rem;
|
|
870
|
-
font-weight: 500;
|
|
871
|
-
cursor: pointer;
|
|
872
|
-
transition: background var(--t-fast), border-color var(--t-fast);
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
.dev-btn:hover:not(:disabled) {
|
|
876
|
-
background: rgba(255, 204, 68, 0.08);
|
|
877
|
-
border-color: rgba(255, 204, 68, 0.7);
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
.dev-btn:disabled {
|
|
881
|
-
opacity: 0.5;
|
|
882
|
-
cursor: not-allowed;
|
|
883
|
-
border-color: rgba(255, 204, 68, 0.2);
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
.dev-panel-log {
|
|
887
|
-
font-family: var(--font-mono);
|
|
888
|
-
font-size: 0.75rem;
|
|
889
|
-
color: var(--clr-text-secondary);
|
|
890
|
-
background: rgba(0, 0, 0, 0.35);
|
|
891
|
-
border: 1px solid var(--clr-border);
|
|
892
|
-
border-radius: var(--radius-sm);
|
|
893
|
-
padding: 0.75rem 1rem;
|
|
894
|
-
max-height: 800px;
|
|
895
|
-
overflow-y: auto;
|
|
896
|
-
white-space: pre-wrap;
|
|
897
|
-
word-break: break-all;
|
|
898
|
-
min-height: 10rem;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
/* dev tools row styles */
|
|
902
|
-
.dev-panel-row-container {
|
|
903
|
-
display: flex;
|
|
904
|
-
align-items: center;
|
|
905
|
-
gap: 1.25rem;
|
|
906
|
-
border-bottom: 1px solid rgba(255, 204, 68, 0.08);
|
|
907
|
-
padding-bottom: 0.85rem;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
.dev-panel-row-container:last-of-type {
|
|
911
|
-
border-bottom: none;
|
|
912
|
-
padding-bottom: 0;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
.dev-panel-row-label {
|
|
916
|
-
font-family: var(--font-mono);
|
|
917
|
-
font-size: 0.85rem;
|
|
918
|
-
font-weight: 700;
|
|
919
|
-
color: var(--clr-warn);
|
|
920
|
-
min-width: 2.2rem;
|
|
921
|
-
text-align: center;
|
|
922
|
-
border: 1px solid rgba(255, 204, 68, 0.25);
|
|
923
|
-
border-radius: var(--radius-sm);
|
|
924
|
-
padding: 0.25rem 0.45rem;
|
|
925
|
-
background: rgba(255, 204, 68, 0.06);
|
|
926
|
-
user-select: none;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
@keyframes spin-bounce {
|
|
930
|
-
0% {
|
|
931
|
-
transform: translate(0, 0) scale(1);
|
|
932
|
-
}
|
|
933
|
-
25% {
|
|
934
|
-
transform: translate(10px, -6px) scale(1.05);
|
|
935
|
-
}
|
|
936
|
-
50% {
|
|
937
|
-
transform: translate(0, -12px) scale(1.1);
|
|
938
|
-
}
|
|
939
|
-
75% {
|
|
940
|
-
transform: translate(-10px, -6px) scale(1.05);
|
|
941
|
-
}
|
|
942
|
-
100% {
|
|
943
|
-
transform: translate(0, 0) scale(1);
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
/* \u2500\u2500 Common Component Tab Styling \u2500\u2500 */
|
|
948
|
-
.tabs-row {
|
|
949
|
-
display: flex;
|
|
950
|
-
align-items: center;
|
|
951
|
-
gap: 0.5rem;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
.tabs-list {
|
|
955
|
-
display: flex;
|
|
956
|
-
gap: 0.25rem;
|
|
957
|
-
overflow-x: auto;
|
|
958
|
-
flex-grow: 1;
|
|
959
|
-
padding-bottom: 5px; /* Leave space for the thin scrollbar */
|
|
960
|
-
margin-bottom: -5px; /* Offset the padding in layout */
|
|
961
|
-
|
|
962
|
-
/* Custom scrollbar properties for Firefox */
|
|
963
|
-
scrollbar-width: thin;
|
|
964
|
-
scrollbar-color: var(--clr-accent-dim) transparent;
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
/* Chrome, Safari, Edge, Opera */
|
|
968
|
-
.tabs-list::-webkit-scrollbar {
|
|
969
|
-
height: 5px; /* Thin horizontal scrollbar */
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
.tabs-list::-webkit-scrollbar-track {
|
|
973
|
-
background: transparent;
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
.tabs-list::-webkit-scrollbar-thumb {
|
|
977
|
-
background: var(--clr-accent-dim);
|
|
978
|
-
border-radius: var(--radius-sm);
|
|
979
|
-
border: 1px solid transparent; /* Avoid thumb touching edges */
|
|
980
|
-
background-clip: padding-box;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
.tabs-list::-webkit-scrollbar-thumb:hover {
|
|
984
|
-
background: var(--clr-accent);
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
/* Tab button styling (.tab-btn is TS default, .panel-tab-button for backwards compatibility) */
|
|
988
|
-
.tab-btn,
|
|
989
|
-
.panel-tab-button {
|
|
990
|
-
padding: var(--tab-padding);
|
|
991
|
-
background: var(--tab-background-color);
|
|
992
|
-
border-radius: var(--tab-border-radius);
|
|
993
|
-
border: var(--tab-border-width) solid var(--tab-border-color);
|
|
994
|
-
border-bottom: none;
|
|
995
|
-
color: var(--tab-text-color);
|
|
996
|
-
font-family: var(--font-sans);
|
|
997
|
-
font-size: 0.85rem;
|
|
998
|
-
font-weight: 500;
|
|
999
|
-
cursor: pointer;
|
|
1000
|
-
white-space: nowrap;
|
|
1001
|
-
transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
|
|
1002
|
-
outline: none;
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
.tab-btn:hover,
|
|
1006
|
-
.panel-tab-button:hover {
|
|
1007
|
-
background: var(--tab-background-color-hover);
|
|
1008
|
-
color: var(--clr-text-primary);
|
|
1009
|
-
border-color: var(--clr-border-hover);
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
.tab-btn.active,
|
|
1013
|
-
.panel-tab-button.active {
|
|
1014
|
-
background: var(--tab-background-color-active);
|
|
1015
|
-
color: var(--tab-text-color-active);
|
|
1016
|
-
border-color: var(--tab-border-color-active);
|
|
1017
|
-
border-bottom: var(--tab-border-width) solid transparent;
|
|
1018
|
-
font-weight: 600;
|
|
1019
|
-
box-shadow: inset 0 2px 0 0 var(--clr-accent);
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
.tab-btn.global-active::after {
|
|
1023
|
-
content: " \u2022";
|
|
1024
|
-
color: var(--clr-accent);
|
|
1025
|
-
font-size: 1.2rem;
|
|
1026
|
-
line-height: 0;
|
|
1027
|
-
vertical-align: middle;
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
.action-btn.active-primary:disabled {
|
|
1031
|
-
opacity: 0.85;
|
|
1032
|
-
background: rgba(120, 248, 126, 0.15) !important;
|
|
1033
|
-
color: var(--clr-accent) !important;
|
|
1034
|
-
border: 1px solid var(--clr-accent) !important;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
/* \u2500\u2500 Common Component Layout & Controls \u2500\u2500 */
|
|
1038
|
-
|
|
1039
|
-
.component-container {
|
|
1040
|
-
padding: 2rem;
|
|
1041
|
-
background: var(--clr-bg-glass);
|
|
1042
|
-
backdrop-filter: blur(16px);
|
|
1043
|
-
border-radius: var(--radius-lg);
|
|
1044
|
-
border: 1px solid var(--clr-border);
|
|
1045
|
-
box-shadow: var(--shadow-card);
|
|
1046
|
-
color: var(--clr-text-primary);
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
.action-row {
|
|
1050
|
-
display: flex;
|
|
1051
|
-
gap: 1rem;
|
|
1052
|
-
margin-top: 0.5rem;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
.action-btn {
|
|
1056
|
-
padding: var(--button-padding-base, 0.75rem 1.5rem);
|
|
1057
|
-
background: var(--button-background-color-base, var(--clr-accent));
|
|
1058
|
-
color: var(--button-text-color-base, var(--clr-bg-deep));
|
|
1059
|
-
border: var(--button-border-width-base, 1px) solid var(--button-border-color-base, transparent);
|
|
1060
|
-
border-radius: var(--button-border-radius-base, var(--radius-md));
|
|
1061
|
-
font-weight: 600;
|
|
1062
|
-
cursor: pointer;
|
|
1063
|
-
transition: all var(--t-fast);
|
|
1064
|
-
display: inline-flex;
|
|
1065
|
-
align-items: center;
|
|
1066
|
-
justify-content: center;
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
.action-btn:hover:not(:disabled) {
|
|
1070
|
-
background: var(--button-hover-background-color, #9fffa5);
|
|
1071
|
-
color: var(--button-hover-text-color, var(--clr-bg-deep));
|
|
1072
|
-
border-color: var(--button-hover-border-color, transparent);
|
|
1073
|
-
transform: translateY(-1px);
|
|
1074
|
-
box-shadow: 0 4px 12px var(--clr-accent-glow);
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
.action-btn:active:not(:disabled) {
|
|
1078
|
-
transform: translateY(0);
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
.action-btn.secondary {
|
|
1082
|
-
background: transparent;
|
|
1083
|
-
border-color: var(--button-border-color-base, rgba(255, 255, 255, 0.2));
|
|
1084
|
-
color: var(--clr-text-primary);
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
.action-btn.secondary:hover:not(:disabled) {
|
|
1088
|
-
background: var(--button-hover-background-color, rgba(255, 255, 255, 0.05));
|
|
1089
|
-
border-color: var(--button-hover-border-color, rgba(255, 255, 255, 0.4));
|
|
1090
|
-
color: var(--clr-text-primary);
|
|
1091
|
-
box-shadow: none;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
.action-btn:disabled {
|
|
1095
|
-
opacity: 0.5;
|
|
1096
|
-
cursor: not-allowed;
|
|
1097
|
-
background: var(--clr-border) !important;
|
|
1098
|
-
color: var(--clr-text-muted) !important;
|
|
1099
|
-
border-color: transparent !important;
|
|
1100
|
-
box-shadow: none !important;
|
|
1101
|
-
transform: none !important;
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
.text-input,
|
|
1105
|
-
.secret-input {
|
|
1106
|
-
flex-grow: 1;
|
|
1107
|
-
padding: var(--input-padding, 0.75rem);
|
|
1108
|
-
background: var(--input-background-color, rgba(0, 0, 0, 0.25));
|
|
1109
|
-
color: var(--input-text-color, var(--clr-text-primary));
|
|
1110
|
-
border: var(--input-border-width, 1px) solid var(--input-border-color, var(--clr-border));
|
|
1111
|
-
border-radius: var(--input-border-radius, var(--radius-sm));
|
|
1112
|
-
font-size: 0.9rem;
|
|
1113
|
-
font-family: var(--font-mono);
|
|
1114
|
-
transition: border-color var(--t-fast);
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
.text-input:focus,
|
|
1118
|
-
.secret-input:focus {
|
|
1119
|
-
outline: none;
|
|
1120
|
-
border-color: var(--clr-accent);
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
.text-input.invalid,
|
|
1124
|
-
.secret-input.invalid {
|
|
1125
|
-
border-color: var(--clr-danger);
|
|
1126
|
-
box-shadow: 0 0 0 2px rgba(255, 91, 91, 0.2);
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
.status-msg {
|
|
1130
|
-
padding: 0.75rem 1rem;
|
|
1131
|
-
border-radius: var(--radius-sm);
|
|
1132
|
-
font-size: 0.85rem;
|
|
1133
|
-
margin: 0;
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
.status-msg.success {
|
|
1137
|
-
background: rgba(120, 248, 126, 0.08);
|
|
1138
|
-
border: 1px solid var(--clr-border);
|
|
1139
|
-
color: var(--clr-accent);
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
.status-msg.error {
|
|
1143
|
-
background: rgba(255, 91, 91, 0.08);
|
|
1144
|
-
border: 1px solid rgba(255, 91, 91, 0.2);
|
|
1145
|
-
color: var(--clr-danger);
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
.status-msg.info {
|
|
1149
|
-
background: rgba(255, 255, 255, 0.03);
|
|
1150
|
-
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
1151
|
-
color: var(--clr-text-secondary);
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
.address-code,
|
|
1155
|
-
.keystone-addr {
|
|
1156
|
-
display: block;
|
|
1157
|
-
padding: 0.75rem;
|
|
1158
|
-
background: rgba(0, 0, 0, 0.3);
|
|
1159
|
-
border-radius: var(--radius-sm);
|
|
1160
|
-
font-family: var(--font-mono);
|
|
1161
|
-
font-size: 0.85rem;
|
|
1162
|
-
word-break: break-all;
|
|
1163
|
-
color: var(--clr-accent);
|
|
1164
|
-
}`;var _r={$schema:"../schemas/keystone.high.schema.json",metadata:{name:"High Security Profile",securityLevel:"high"},pools:{sync:{id:"sync",allowedVerbs:["sync"],algo:"SHA-512",rounds:4,behavior:{size:2e3,replenish:"top-up",selectSequentially:10,selectRandomly:10,targetBindingCount:16}},manage:{id:"manage",allowedVerbs:["manage"],algo:"SHA-512",rounds:4,behavior:{size:2e3,replenish:"replace-all",selectSequentially:10,selectRandomly:10,targetBindingCount:16}},revoke:{id:"revoke",allowedVerbs:["revoke"],algo:"SHA-512",rounds:20,behavior:{size:2e3,replenish:"delete-all",selectSequentially:50,selectRandomly:50,targetBindingCount:0}},connect:{id:"connect",allowedVerbs:["connect"],algo:"SHA-512",rounds:4,behavior:{size:2e3,replenish:"top-up",selectSequentially:10,selectRandomly:10,targetBindingCount:16}},sign:{id:"default",allowedVerbs:["sign"],algo:"SHA-512",rounds:4,behavior:{size:2e3,replenish:"top-up",selectSequentially:10,selectRandomly:10,targetBindingCount:16}}}};var Cr={$schema:"../schemas/keystone.medium.schema.json",metadata:{name:"Medium Security Profile",securityLevel:"medium"},pools:{sync:{id:"sync",allowedVerbs:["sync"],algo:"SHA-256",rounds:2,behavior:{size:500,replenish:"top-up",selectSequentially:5,selectRandomly:5,targetBindingCount:10}},manage:{id:"manage",allowedVerbs:["manage"],algo:"SHA-256",rounds:2,behavior:{size:500,replenish:"replace-all",selectSequentially:5,selectRandomly:5,targetBindingCount:10}},revoke:{id:"revoke",allowedVerbs:["revoke"],algo:"SHA-256",rounds:10,behavior:{size:500,replenish:"delete-all",selectSequentially:20,selectRandomly:20,targetBindingCount:0}},connect:{id:"connect",allowedVerbs:["connect"],algo:"SHA-256",rounds:2,behavior:{size:500,replenish:"top-up",selectSequentially:5,selectRandomly:5,targetBindingCount:10}},sign:{id:"default",allowedVerbs:["sign"],algo:"SHA-256",rounds:2,behavior:{size:500,replenish:"top-up",selectSequentially:5,selectRandomly:5,targetBindingCount:10}}}};var Sr={$schema:"../schemas/keystone.low.schema.json",metadata:{name:"Low Security Profile",securityLevel:"low"},pools:{sync:{id:"sync",allowedVerbs:["sync"],algo:"SHA-256",rounds:1,behavior:{size:100,replenish:"top-up",selectSequentially:3,selectRandomly:3,targetBindingCount:8}},manage:{id:"manage",allowedVerbs:["manage"],algo:"SHA-256",rounds:2,behavior:{size:100,replenish:"replace-all",selectSequentially:3,selectRandomly:3,targetBindingCount:8}},revoke:{id:"revoke",allowedVerbs:["revoke"],algo:"SHA-256",rounds:5,behavior:{size:100,replenish:"delete-all",selectSequentially:3,selectRandomly:3,targetBindingCount:0}},connect:{id:"connect",allowedVerbs:["connect"],algo:"SHA-256",rounds:1,behavior:{size:100,replenish:"top-up",selectSequentially:3,selectRandomly:3,targetBindingCount:8}},sign:{id:"default",allowedVerbs:["sign"],algo:"SHA-256",rounds:2,behavior:{size:100,replenish:"top-up",selectSequentially:3,selectRandomly:3,targetBindingCount:8}}}};var Ar={$schema:"../schemas/keystone.low.schema.json",metadata:{name:"Session/Saga Identity Profile",securityLevel:"low"},pools:{sync:{id:"sync",allowedVerbs:["sync"],algo:"SHA-256",rounds:1,behavior:{size:50,replenish:"top-up",selectSequentially:2,selectRandomly:2,targetBindingCount:6}},manage:{id:"manage",allowedVerbs:["manage"],algo:"SHA-256",rounds:2,behavior:{size:50,replenish:"replace-all",selectSequentially:2,selectRandomly:2,targetBindingCount:6}},revoke:{id:"revoke",allowedVerbs:["revoke"],algo:"SHA-256",rounds:5,behavior:{size:50,replenish:"delete-all",selectSequentially:3,selectRandomly:3,targetBindingCount:0}},connect:{id:"connect",allowedVerbs:["connect"],algo:"SHA-256",rounds:1,behavior:{size:50,replenish:"top-up",selectSequentially:2,selectRandomly:2,targetBindingCount:6}},sign:{id:"default",allowedVerbs:["sign"],algo:"SHA-256",rounds:2,behavior:{size:50,replenish:"top-up",selectSequentially:2,selectRandomly:2,targetBindingCount:6}}}};var xr={$schema:"../schemas/keystone.low.schema.json",metadata:{name:"Test Identity Profile",securityLevel:"low"},pools:{sync:{id:"sync",allowedVerbs:["sync"],algo:"SHA-256",rounds:1,behavior:{size:12,replenish:"top-up",selectSequentially:1,selectRandomly:1,targetBindingCount:3}},manage:{id:"manage",allowedVerbs:["manage"],algo:"SHA-256",rounds:2,behavior:{size:12,replenish:"replace-all",selectSequentially:1,selectRandomly:2,targetBindingCount:3}},revoke:{id:"revoke",allowedVerbs:["revoke"],algo:"SHA-256",rounds:5,behavior:{size:12,replenish:"delete-all",selectSequentially:3,selectRandomly:3,targetBindingCount:0}},connect:{id:"connect",allowedVerbs:["connect"],algo:"SHA-256",rounds:1,behavior:{size:12,replenish:"top-up",selectSequentially:1,selectRandomly:1,targetBindingCount:3}},sign:{id:"default",allowedVerbs:["sign"],algo:"SHA-256",rounds:2,behavior:{size:20,replenish:"top-up",selectSequentially:1,selectRandomly:1,targetBindingCount:3}}}};var Pr={$schema:"../schemas/keystone.high.schema.json",metadata:{name:"Domain Identity Profile",securityLevel:"high"},pools:{sync:{id:"sync",allowedVerbs:["sync"],algo:"SHA-512",rounds:4,behavior:{size:2e3,replenish:"top-up",selectSequentially:10,selectRandomly:10,targetBindingCount:16}},manage:{id:"manage",allowedVerbs:["manage"],algo:"SHA-512",rounds:6,behavior:{size:2e3,replenish:"replace-all",selectSequentially:12,selectRandomly:12,targetBindingCount:16}},revoke:{id:"revoke",allowedVerbs:["revoke"],algo:"SHA-512",rounds:20,behavior:{size:2e3,replenish:"delete-all",selectSequentially:50,selectRandomly:50,targetBindingCount:0}},connect:{id:"connect",allowedVerbs:["connect"],algo:"SHA-512",rounds:4,behavior:{size:2e3,replenish:"top-up",selectSequentially:10,selectRandomly:10,targetBindingCount:16}},sign:{id:"default",allowedVerbs:["sign"],algo:"SHA-512",rounds:4,behavior:{size:2e3,replenish:"top-up",selectSequentially:10,selectRandomly:10,targetBindingCount:16}}}};var Nr={$schema:"../schemas/keystone.low.schema.json",metadata:{name:"Sync Delegate Profile",securityLevel:"low"},pools:{sync:{id:"sync",allowedVerbs:["sync"],algo:"SHA-256",rounds:1,behavior:{size:100,replenish:"top-up",selectSequentially:3,selectRandomly:3,targetBindingCount:8}},manage:{id:"manage",allowedVerbs:["manage"],algo:"SHA-256",rounds:2,behavior:{size:100,replenish:"replace-all",selectSequentially:3,selectRandomly:3,targetBindingCount:8}},revoke:{id:"revoke",allowedVerbs:["revoke"],algo:"SHA-256",rounds:5,behavior:{size:100,replenish:"delete-all",selectSequentially:3,selectRandomly:3,targetBindingCount:0}},connect:{id:"connect",allowedVerbs:["connect"],algo:"SHA-256",rounds:1,behavior:{size:100,replenish:"top-up",selectSequentially:3,selectRandomly:3,targetBindingCount:8}},sign:{id:"default",allowedVerbs:["sign"],algo:"SHA-256",rounds:2,behavior:{size:100,replenish:"top-up",selectSequentially:3,selectRandomly:3,targetBindingCount:8}}}};var vt=class n{static{f(this,"KeystoneProfileBuilder")}_template;_username;_email;_description;_details;_customizations={};constructor(e){this._template=JSON.parse(JSON.stringify(e))}static buildKeystone(e){let t;switch(e){case"high":t=_r;break;case"medium":t=Cr;break;case"low":t=Sr;break;case"session":t=Ar;break;case"test":t=xr;break;case"domain":t=Pr;break;case"sync":t=Nr;break;default:throw new Error(`Unknown profile name: ${e} (E: fc10a8ad482ef2bda871ac567d268d26)`)}return new n(t)}withUsername(e){return this._username=e,this}withEmail(e){return this._email=e,this}withDescription(e){return this._description=e,this}withDetails(e){return this._details=e,this}customizePool(e,t){let{behavior:o,...i}=t;return this._customizations[e]={template:i,behavior:o},this}getFrameDetails(){let e={...this._details};return this._username&&(e.username=this._username),this._email&&(e.email=this._email),this._description&&(e.description=this._description),e}async compileConfigs(){let e=[],t="";if(this._username||this._email){let o=`${this._username||""}:${this._email||""}`;t=await $t({s:o})}else t=await $t({s:"default-keystone-salt"});for(let[o,i]of Object.entries(this._template.pools)){let s=this._customizations[i.id];s&&(s.template&&Object.assign(i,s.template),s.behavior&&i.behavior&&Object.assign(i.behavior,s.behavior));let l=`${t}-${i.id}`,c=await $t({s:l}),d=cr({template:i,salt:c});e.push(d)}return e}};var Tt=!1,Ut=class n{static{f(this,"WitnessBase_V1")}lc=`[${n.name}]`;set trace(e){let t=`${this.lc}[set trace]`;e!==(this.data?.trace||!1)&&(this.data?(this.data.trace=e,delete this.gib):console.warn(`${t} data is falsy. Can't set.`))}get trace(){return this.data?.trace??!1}set catchAllErrors(e){let t=`${this.lc}[set catchAllErrors]`;e!==this.data?.catchAllErrors&&(this.data?(this.data.catchAllErrors=e,delete this.gib):console.error(`${t} data is falsy. Can't set value.`))}get catchAllErrors(){let e=`${this.lc}[catchAllErrors]`,t=this.data?.catchAllErrors||!1;return(Tt||this.trace)&&console.log(`${e} result: ${t}`),t}ib="";gib;data;rel8ns;initialized;constructor(e,t){e&&(this.data=e),t&&(this.rel8ns=t),this.initialized=this.initialize()}initialize(){return Promise.resolve()}toIbGibDto(){return re({ibGib:this})}loadIbGibDto(e){let t=`${this.lc}[${this.loadIbGibDto.name}]`;try{return Tt&&console.log(`${t} starting...`),e.ib||console.warn(`${t} dto.ib is falsy.`),e.gib||console.warn(`${t} dto.gib is falsy.`),this.ib=Y(e.ib),this.gib=Y(e.gib),e.data?this.data=Y(e.data):delete this.data,e.rel8ns?this.rel8ns=Y(e.rel8ns):delete this.rel8ns,Promise.resolve()}catch(o){throw console.error(`${t} ${o.message}`),o}finally{Tt&&console.log(`${t} complete.`)}}async witness(e){let t=`${this.lc}[${this.witness.name}]`;try{await this.initialized,this.gib||(this.gib=await Mi(this.toIbGibDto()));let o=await this.validateThis();if(o?.length>0){for(let l of o)console.error(`${t} ${l}`);throw new Error("internal witness validation failed. See `WitnessBase_V1.validateThis` (E: 2b5f73cadbfa416ba189346f3c31cd0c)")}let i=await this.validateWitnessArg(e);if(i?.length>0){for(let l of i)console.error(`${t} ${l}`);throw new Error("arg validation failed. See `WitnessBase_V1.validateWitnessArg` (E: 51531a1d928a485e8ffc277145ec44e9)")}(Tt||this.trace)&&console.log(`${t} addr: ${x(e)}`),Tt&&console.log(`${t} addr: ${x(e)} (I: f4cf13a44c4e4fc3903f14018e616c64)`);let s=await this.witnessImpl(e);return this.data?.persistOptsAndResultIbGibs&&await this.persistOptsAndResultIbGibs({arg:e,result:s}),s}catch(o){if(console.error(`${t} ${o.message||"unknown error (E: 3e22bea4c7fb4668bf13d7146b927869)"}`),this.catchAllErrors)return;throw o}}async validateWitnessArg(e){let t=`${this.lc}[${this.validateWitnessArg.name}]`;try{let o=[];e||o.push("arg required (E: a222db3b668e4bb09cfd82e75c07bfa6)");let i=Li({ib:e?.ib});(i?.length??!1)&&o.push(`invalid arg.ib (E: 2ae362ef274d4c3bb9716800f2106d28) errors: ${i.join(`
|
|
1165
|
-
`)}`);let s=ki({gib:e?.gib});(s?.length??!1)&&o.push(`invalid arg.gib (E: 73be275058084d768a39299337f2ce34) errors: ${s.join(`
|
|
1166
|
-
`)}`);let l=await Qe({ibGib:e});return l?.length??!1?o.push(`arg ibgib invalid intrinsically (E: 73be275058084d768a39299337f2ce34) errors: ${l.join(`
|
|
1167
|
-
`)}`):this.data?.allowPrimitiveArgs||ye({gib:e.gib}).isPrimitive&&o.push('arg is primitive (i.e. gib === "gib") and witness.data.allowPrimitiveArgs is falsy. (E: d0aa3d7ad4f54b01bd0023300d15ecd9)'),o}catch(o){throw console.error(`${t} ${o.message}`),o}}async validateThis(){let e=`${this.lc}[${this.validateThis.name}]`,t=[];try{this.ib||t.push("this.ib is falsy."),this.gib||t.push("this.gib is falsy.")}catch(o){throw console.error(`${e} ${o.message}`),o}return t}persistOptsAndResultIbGibs({arg:e,result:t}){let o=`${this.lc}[${this.persistOptsAndResultIbGibs.name}]`;return console.warn(`${o} not implemented in this base class. Override this in descendent class. (W: 087514e851704322a4ec8069a73ce944)`),Promise.resolve()}};var Rr="___whitespace___";var fe=!1;function $r({commentText:n,addlMetadataText:e}){let t=`[${$r.name}]`;try{if(!n)throw new Error("commentText required. (E: 22fdfd0aa0524a18b63a9405b312c99e)");let o=ht({text:n,length:20,replaceMap:{"?":"__qm__"}});if(e){e.length>128&&console.warn(`${t} addlMetadataText (${e.length}) is too long. Max length: ${128}`);let i=ht({text:e,length:128});if(!i)throw new Error("(UNEXPECTED) addlMetadataText contains no safe characters? (E: dd03c578ada2836b05c94a4aa1785222)");return`comment ${o} ${i}`}else return`comment ${o}`}catch(o){throw console.error(`${t} ${o.message}`),o}}f($r,"getCommentIb");function He({ib:n}){let e=`${He.name}]`;try{if(fe&&console.log(`${e} starting... (I: 1a16f5e3134599eeb585eae77ee6af22)`),!n)throw new Error("ib required (E: d89f8c4df46b970585c82bc89c1c6322)");let[t,o,i]=n.split(" ");for(;o.includes("__qm__");)o=o.replace("__qm__","?");return{safeIbCommentText:o,safeIbCommentMetadataText:i}}catch(t){throw console.error(`${e} ${t.message}`),t}finally{fe&&console.log(`${e} complete.`)}}f(He,"parseCommentIb");async function qe({text:n,addlMetadataText:e,saveInSpace:t,space:o,dontTrimText:i}){let s=`[${qe.name}]`;fe&&console.log(`${s} starting...`);try{if(!n)throw new Error("text required (E: 3e3d0f555e1a83771a6548eb10943522)");if(i||(n=n.trim()),!n)throw new Error("text cannot be only whitespace when dontTrimText is falsy. (E: d6db3537b9834294836aeb70987c908e)");let l={text:n,textTimestamp:Rt()},c={parentIbGib:Q.primitive({ib:"comment"}),ib:$r({commentText:n.trim()||Rr,addlMetadataText:e}),data:l,dna:!0,tjp:{uuid:!0,timestamp:!0},nCounter:!0};fe&&console.log(`${s} opts: ${D(c)}`);let d=await Q.firstGen(c);if(t){if(!o)throw new Error("space required if saveInSpace is truthy (E: 40f69f22f21b4279a83cb746cb4b0da1)");await Vi({resTransform:d,space:o})}return d}catch(l){throw console.error(`${s} ${l.message}`),l}}f(qe,"createCommentIbGib");function Be({ibGib:n}){let e=`[${Be.name}]`;try{if(fe&&console.log(`${e} starting...`),!n)throw new Error("ibGib required (E: f204dac30ae548b0a049f1c4d8048502)");let{ib:t,data:o,rel8ns:i}=n;if(!i)return fe&&console.log(`${e} rel8ns falsy, NOT a comment (I: 6e145eb2d0ba46629746215a3b655fd5)`),!1;let s=i.ancestor||[];return s&&s.includes("comment^gib")?(fe&&console.log(`${e} descends from comment^gib, YES is a comment (I: 1a8557780e2e4c1580d5a2585567762b)`),!0):o?o.text&&t?.includes("comment")?(fe&&console.log(`${e} has text, and ib has 'comment', YES is a comment (I: 3aa03bcd639d4ec7abd7ead917eda3d8)`),!0):(fe&&console.log(`${e} reached end, doesn't have comment qualities. NOT a comment. (I: cfa529f27f9d490abd476c924ef77087)`),!1):(fe&&console.log(`${e} data falsy, NOT a comment (I: 30b20ff6785f432f98489f11efe24299)`),!1)}catch(t){throw console.error(`${e} ${t.message}`),t}finally{fe&&console.log(`${e} complete.`)}}f(Be,"isComment");var U=!1,Ft=class n extends Ut{static{f(this,"WitnessWithContextBase_V1")}lc=`[${n.name}]`;metaspace;_contextChangesSubscription;_currentWorkingContextIbGib;_currentWorkingContextIbGib_PriorChildrenAddrs=[];_updatingContext=!1;constructor(e,t){super(e,t),this.initialized=this.initialize()}async initialize(){let e=`${this.lc}[${this.initialize.name}]`;try{U&&console.log(`${e} starting... (I: f0e65ab0f80046a59668ddfbf9f47a4a5)`),await super.initialize()}catch(t){console.error(`${e} ${y(t)}`)}finally{U&&console.log(`${e} complete.`)}}async loadNewerSelfIfAvailable(){let e=`${this.lc}[${this.loadNewerSelfIfAvailable.name}]`;try{if(U&&console.log(`${e} starting... (I: 94755c3131f4dfa12d20fa38e2926522)`),this.metaspace){let t=x({ibGib:this}),o=await this.metaspace.getLatestAddr({ibGib:this});if(o&&o!==t){let i=await this.metaspace.get({addr:o});if(!i||!i?.success||(i?.ibGibs??[]).length===0)throw new Error("could not get newer ibgib in timeline (E: 15fa346c8ac17edb96e4b0870104c122)");await this.loadIbGibDto(i.ibGibs[0]);let s=await this.validateThis();if(s?.length>0)throw new Error(`validationErrors when loading newer version: ${D(s)} (E: 0d9f0684a1ff6af44e20a57130e3ac22)`)}}else console.warn(`${e} this.metaspace undefined (W: 44cc5bf1b14b4695b8de4c589787be06)`)}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{U&&console.log(`${e} complete.`)}}async rel8To({ibGibs:e,rel8nName:t,linked:o,metaspace:i}){let s=`${this.lc}[${this.rel8To.name}]`;try{if(U&&console.log(`${s} starting...`),(e??[]).length===0)throw new Error("ibGibs required (E: 2fd13de0f025b170885bede4d7a50922)");if(t=t||this.data?.defaultRel8nName,!t)throw new Error("rel8nName required either as an arg or in this.data.defaultRel8nName (E: 43ab8ae63694a2a82cd8a70ed6b6b522)");let l=await this.validateThis();if(l?.length>0)throw new Error(`this is an invalid ibGib. thisValidationErrors: ${l.join("|")} (E: 8f08716866cd13bf254222ee9e6a6722)`);if(i=i??this.metaspace,!i)throw new Error("either metaspace or this.metaspace required (E: b5f9453ddb394a2b76dec74c7304df22)");let d=(this.rel8ns?this.rel8ns[t]??[]:[]).map(b=>ye({ibGibAddr:b}).tjpGib),u=e.filter(b=>{let E=ye({ibGibAddr:x({ibGib:b})}).tjpGib;return!d.includes(E)});if(u.length===0){U&&console.log(`${s} already rel8d to all incoming ibGib(s) via tjp. (I: 5e9d94a98ba262f146c0c0b765157922)`);return}let p=u.map(b=>x({ibGib:b})),m=await Ue({src:this.toIbGibDto(),rel8nsToAddByAddr:{[t]:p},linkedRel8ns:o?["past","ancestor",t]:["past","ancestor"],dna:!0,nCounter:!0}),h=m.newIbGib,g=await Qe({ibGib:h});if(g?.length??!1)throw new Error(`new this ibgib would have validation errors. aborting. newThisValidationErrors: ${g.join("|")} (E: eb816a27156c246c121ef55e37d59322)`);await i.persistTransformResult({resTransform:m}),await this.loadIbGibDto(h),await i.registerNewIbGib({ibGib:h})}catch(l){throw console.error(`${s} ${y(l)}`),l}finally{U&&console.log(`${s} complete.`)}}async rel8ToContextIbGib({ibGibToRel8:e,ibGibAddrToRel8:t,contextIbGib:o,rel8nNames:i}){let s=`${this.lc}[${this.rel8ToContextIbGib.name}]`;try{if(!e&&!t)throw new Error("ibGibToRel8 or ibGibAddrToRel8 required (E: 3ee14659fd22355a5ba0e537a477be22)");if(!o)throw new Error("contextIbGib required (E: 85f27c7cbf713704c21084c141cd8822)");if(!this.metaspace)throw new Error("this.metaspace required (E: 6a38c4274bdefc8d44cafd2d6faaa222)");if((i??[]).length===0){if(!this.data?.defaultRel8nName)throw new Error("either rel8nNames or this.data.defaultRel8nName required (E: a14ab4b3e479d9274c61bc5a30bc2222)");i=[this.data.defaultRel8nName]}let l={};t=t||x({ibGib:e}),i.forEach(u=>{l[u]=[t]});let c=await Ue({src:o,rel8nsToAddByAddr:l,dna:!0,nCounter:!0});await this.metaspace.persistTransformResult({resTransform:c});let{newIbGib:d}=c;await this.metaspace.registerNewIbGib({ibGib:d})}catch(l){throw console.error(`${s} ${y(l)}`),l}}async createCommentAndRel8ToContextIbGib({text:e,contextIbGib:t,rel8nName:o}){let i=`${this.lc}[${this.createCommentAndRel8ToContextIbGib.name}]`;try{if(U&&console.log(`${i} starting... (I: c3a005f7d323468a5b4e1b2710901d22)`),!this.metaspace)throw new Error("this.metaspace required (E: 5dbb1a7f0ff5469b8ce3cb1be175e521)");let s=await this.metaspace.getLocalUserSpace({lock:!0}),l=await qe({text:e,addlMetadataText:this.getAddlMetadata(),saveInSpace:!0,space:s});s=await this.metaspace.getLocalUserSpace({lock:!0});let c=l.newIbGib;if(!c)throw new Error("(UNEXPECTED) failed to create comment? (E: 6d668f4e55198e654324622eabaac922)");await this.metaspace.registerNewIbGib({ibGib:c}),await this.rel8ToContextIbGib({ibGibToRel8:c,contextIbGib:t,rel8nNames:["comment"]}),await this.rel8To({ibGibs:[c],rel8nName:o})}catch(s){throw console.error(`${i} ${y(s)}`),s}finally{U&&console.log(`${i} complete.`)}}getThisAtom(){return ht({text:this.data?.classname??"this",length:16})}getAddlMetadata(){let e=`${this.lc}[${this.getAddlMetadata.name}]`;try{if(U&&console.log(`${e} starting... (I: 7800732facf3783943fdf1b2423b0c22)`),!this.data)throw new Error("(UNEXPECTED) this.data falsy? (E: 7cb044b39b2b8e31f363f3b82f256323)");let t=this.getThisAtom();if(!t)throw new Error("(UNEXPECTED) atom couldn't be gotten? (E: b260de391356e04abd334e0cd8b09123)");if(t.includes(" "))throw new Error("(UNEXPECTED) atom contains space? (E: 574d088eea13d3afe5fcd2999ab6b423)");let o=this.data.classname?.replace(/[_]/mg,"")||void 0,i=this.data.name?.slice(0,8).replace(/[__]/mg,"")||void 0,s=this.data.uuid?.slice(0,8)||void 0,l=`${t}_${o}_${i}_${s}`;return U&&console.log(`${e} addlMetadataText: ${l} (I: 53c0044671dc99fb75635367d2e63c22)`),l}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{U&&console.log(`${e} complete.`)}}async getContextIbGibFromArgOrAddr({arg:e,addr:t,latest:o}){let i=`${this.lc}[${this.getContextIbGibFromArgOrAddr.name}]`;try{U&&console.log(`${i} starting... (I: c13f7cb92133984048f606075efb8a22)`);let s;if(!e&&!t)throw new Error("either arg or addr required. (E: 3f647b65742242fd9ba878521acf7c22)");if(!this.metaspace)throw new Error("(UNEXPECTED) this.metaspace required (E: f0046290b0d66d28c4bbbf83d9d9f523)");if(e){if((e.ibGibs??[]).length===0)throw new Error("(UNEXPECTED) invalid arg? no context ibgib on arg (E: 89997eb4bdeb3885bee9de5d33ee0f22)");if((e.ibGibs??[]).length!==1)throw new Error("(UNEXPECTED) invalid arg? only expected one ibgib on arg.ibGibs (E: 1a1498af668740fe9439f4953a74ea8a)");s=e.ibGibs[0]}else{let l=await this.metaspace.get({addr:t});if(!l.success||l.ibGibs?.length!==1)throw new Error(`could not get context addr (${t}) (E: 834492313512a45b23a7bebacdc48122)`);s=l.ibGibs[0]}if(o){let l=await this.metaspace.getLatestAddr({ibGib:s});if(l!==x({ibGib:s})){let c=await this.metaspace.get({addr:l});if(c.success&&c.ibGibs?.length===1)s=c.ibGibs[0];else throw new Error(`unable to get resLatestAddr (${l}) (E: ce1e1297743e9a16c8f082321e52a122)`)}}return s}catch(s){throw console.error(`${i} ${y(s)}`),s}finally{U&&console.log(`${i} complete.`)}}async initializeContext({arg:e,contextIbGib:t,rel8nName:o}){let i=`${this.lc}[${this.initializeContext.name}]`;try{if(U&&console.log(`${i} starting... (I: d93429c85b0a494388f66fba3eece922)`),!this.metaspace)throw new Error("this.metaspace (metaspace) required. set this before using this witness. (E: 67db388a0223bf813b40accd9941ad23)");e&&t&&console.warn(`${i} both arg and contextIbGib provided. using raw contextIbGib (W: d6d723ad7fb942079833c40647aecd22)`);let s=t??await this.getContextIbGibFromArgOrAddr({arg:e,latest:!1});if(this._currentWorkingContextIbGib){let d=le({ibGib:this._currentWorkingContextIbGib}),u=le({ibGib:s});if(d===u){U&&console.warn(`${i} initializing context but it's the same timeline (${d}). (W: 7609f8f51172443183e0c93ad52bfe56)`);return}else await this.finalizeContext({arg:e})}let l=f(()=>{this._currentWorkingContextIbGib_PriorChildrenAddrs=[...this._currentWorkingContextIbGib?.rel8ns?.comment??[],...this._currentWorkingContextIbGib?.rel8ns?.pic??[],...this._currentWorkingContextIbGib?.rel8ns?.link??[]]},"updatePriorChildren");this._currentWorkingContextIbGib=t?await this.getContextIbGibFromArgOrAddr({addr:x({ibGib:t}),latest:!0}):await this.getContextIbGibFromArgOrAddr({arg:e,latest:!0}),l();let c=le({ibGib:this._currentWorkingContextIbGib});if(!this.metaspace)throw new Error("(UNEXPECTED) this.metaspace falsy...not initialized? (E: 6e38bfdc5c2eb5fef884f0183889e823)");if(!this.metaspace.latestObs)throw new Error("(UNEXPECTED) this.metaspace.latestObs falsy? (E: 831936570c14ed526f9c9ab511929923)");this._contextChangesSubscription=await this.metaspace.latestObs.subscribe(we({next:f(async d=>{let u=`${i}[latestObs.next]`;if(d.tjpAddr!==c)return;let p=x({ibGib:this._currentWorkingContextIbGib});if(d.latestAddr!==p){if(U&&console.warn(`${u} checking if new context is actually new...damn getLatestAddr maybe not working in ionic space... argh (W: 3d1a12154dfafb9c96d07e6f75f7a322)`),d.latestIbGib){let m=d.latestIbGib.data?.n??-1,h=this._currentWorkingContextIbGib?.data?.n??-2;if(m<=h){console.warn(`${u} latestN is not really the latest. latestN_Supposedly: ${m}, currentN: ${h}. (tjpGib: ${d.tjpAddr}) (W: 6792c9a596c44c03b262614ae79a715e)`);return}}U&&console.log(`${u} update to context.
|
|
1168
|
-
currentAddr: ${p}
|
|
1169
|
-
latestAddr: ${d.latestAddr} (I: d0adcc392e6e974c9917730ebad51322)`),this._currentWorkingContextIbGib=d.latestIbGib??await this.getContextIbGibFromArgOrAddr({addr:d.latestAddr,latest:!1}),this._updatingContext?U&&console.log(`${u} already updating context (I: f856f9414627ab00418dccd285b55822)`):(await this.handleContextUpdate({update:d}),l())}},"next"),error:f(async d=>{let u=`${i}[latestObs.error]`;console.error(`${u} this.metaspace.latestObs error: ${dr({err:d})}. (E: 99df4c42195d46d0a9dbfb06ac45ae00)`)},"error")})),o&&await this.rel8To({ibGibs:[this._currentWorkingContextIbGib],rel8nName:o})}catch(s){throw console.error(`${i} ${y(s)}`),s}finally{U&&console.log(`${i} complete.`)}}async finalizeContext({arg:e}){let t=`${this.lc}[${this.finalizeContext.name}]`;try{U&&console.log(`${t} starting... (I: dd53dfc745864dd19fde5f209ceb82c8)`);let o=0,i=100;for(;this._updatingContext&&o<i;)await K(100),o++,o%10===0&&console.log(`${t} already updating context and taking a litle while... waiting still. tries: ${o}/${i} (I: d45ab59af9ea43518432e34ddad95c19)`);throw this._updatingContext&&console.error(`${t} previous call to updatingContext took too long. Ignoring flag and finalizing context. (E: 9a2dc4e1923442fa90fbeae72f358acd)`),this._updatingContext=!0,this._contextChangesSubscription&&(await this._contextChangesSubscription.unsubscribe(),delete this._contextChangesSubscription),delete this._currentWorkingContextIbGib,new Error("not refactored yet. the proceeding code needs to be introduced in the robbot descending class. (E: 066aa414693672d868dbf953617aab23)")}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{this._updatingContext=!1,U&&console.log(`${t} complete.`)}}async handleContextUpdate({update:e}){let t=`${this.lc}[${this.handleContextUpdate.name}]`;for(;this._updatingContext;)console.warn(`${t} already updating context? delaying... (W: 19d2ebeaaf2340fb91a7d6c717e9cb41)`),await K(1e3);this._updatingContext=!0;try{if(U&&console.log(`${t} starting... (I: 3eeaa40cad49094f125f9f5cd6ff6e22)`),U&&(console.log(`${t} update: (I: ad0abae7de472e3b4d3891ea0b937322)`),console.table(e)),!e.latestIbGib){debugger;throw new Error("(UNEXPECTED) update.latestIbGib falsy? (E: e18a048d7e95757238396ddd84748f22)")}let o=e.latestIbGib,i=await this.getNewChildrenIbGibs({newContext:o});if(i.length===1){let s=i[0];await this.handleNewContextChild({newChild:s})}else if(i.length>1){console.warn(`${t} (UNEXPECTED) multiple new children in context update. iterating through each one. (W: 02d82a8f755f418d95fa30f0f52ad58e)`);for(let s of i)await this.handleNewContextChild({newChild:s})}else{U&&console.log(`${t} no new children in context update. returning early... (I: 31397b04965351ab29bb3f78cb709122)`);return}}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{this._updatingContext=!1,U&&console.log(`${t} complete.`)}}async getNewChildrenIbGibs({newContext:e}){let t=`${this.lc}[${this.getNewChildrenIbGibs.name}]`;try{U&&console.log(`${t} starting... (I: 1b3d1cf908489087fa3b281f55b9a522)`);let i=[...e.rel8ns?.comment??[],...e.rel8ns?.pic??[],...e.rel8ns?.link??[]].filter(u=>!this._currentWorkingContextIbGib_PriorChildrenAddrs.includes(u));if(i.length===0)return U&&console.log(`${t} no new children addrs in newContext. returning early... (I: 8f9c3658c194c472cb1e2bc19d847b22)`),[];if(!this.metaspace)throw new Error("this.metaspace falsy. not initialized? (E: 1cc26ca7de7fadcdbaecbd6613350e23)");let s=await this.metaspace.getLocalUserSpace({});if(!s)throw new Error("couldn't get local user space? (E: f118f75e5852fc22bba3a6495beec723)");let l=await qi({addrs:i,space:s}),c=Object.values(l?.data?.latestAddrsMap??{});if(!l?.data?.success||c.length!==i.length)throw new Error("could not get latest addrs. (E: 2e1619e7e2e166696fe8ff78cb02cc22)");if(c.some(u=>u===null))throw new Error("some addrs were not found in the space. (E: 2216d8e5ad7fb600ceb025ed7c90f323)");let d=await this.metaspace.get({addrs:c});if(!d.success||d.ibGibs?.length!==i.length)throw new Error(`failed to get newChildren with addrs: ${i.join("|")}. Error: ${d.errorMsg??"unknown error 5737bd0996d5445b8bd80975bedc0d57"} (E: 05722e11350ec6ffffdb5c7d0caa2922)`);return d.ibGibs}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{U&&console.log(`${t} complete.`)}}async handleNewContextChild({newChild:e}){let t=`${this.lc}[${this.handleNewContextChild.name}]`;try{throw new Error("not implemented in base class (E: ea6b2b13d9504d93b33b70191d106084)")}catch(o){throw console.error(`${t} ${y(o)}`),o}}};var Z=V,Ne=class extends Ft{static{f(this,"LiveProxyIbGib")}lc="";ib=this._currentWorkingContextIbGib?this._currentWorkingContextIbGib.ib:Mt;gib=this._currentWorkingContextIbGib?this._currentWorkingContextIbGib.gib:Gt;data=this._currentWorkingContextIbGib?this._currentWorkingContextIbGib.data:void 0;rel8ns=this._currentWorkingContextIbGib?this._currentWorkingContextIbGib.rel8ns:void 0;async loadNewerSelfIfAvailable(){let e=`${this.lc}[${this.loadNewerSelfIfAvailable.name}]`;try{Z&&console.log(`${e} starting... (I: genuuid)`),console.warn(`${e} does nothing in this class. I just have this warning here because I want to see if this gets executed. (W: genuuid)`)}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{Z&&console.log(`${e} complete.`)}}async loadIbGibDto(e){let t=`${this.lc}[${this.loadIbGibDto.name}]`;try{Z&&console.log(`${t} starting... (I: genuuid)`);debugger;console.warn(`${t} does nothing in this class. I just have this warning here because I want to see if this gets executed. (W: genuuid)`)}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{Z&&console.log(`${t} complete.`)}}async validateThis(){let e=`${this.lc}[${this.validateThis.name}]`;return Z&&console.log(`${e} elided in this proxy class because this isn't a true witness atow (04/2025) (I: fd223814f169798d9f499d6e9cdc0325)`),[]}get ibGib(){return this._currentWorkingContextIbGib}spaceId;constructor(e,t){super(e,t)}async initialize(){let e=`${this.lc}[${this.initialize.name}]`;try{Z&&console.log(`${e} starting... (I: 1bd72217a5f334effc63f8d51e7b2225)`),await super.initialize(),this._contextUpdated$=await Jn(),this.contextUpdated$=this._contextUpdated$.asObservable(),this._newContextChild$=await Jn(),this.newContextChild$=this._newContextChild$.asObservable()}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{Z&&console.log(`${e} complete.`)}}parseAddlMetadataString({ib:e}){let t=`${this.lc}[${this.parseAddlMetadataString.name}]`;return console.warn(`${t} not really implemented in this class atow (04/2025). (W: genuuid)`),{}}_initialContext;async witnessImpl(e){let t=`${this.lc}[${this.witnessImpl.name}]`;try{if(Z&&console.log(`${t} starting...`),Hi({ib:e.ib})){if(!e.data)throw new Error("arg has space ib but arg.data is falsy (E: b2af9226c067d5e72f117fa36e239525)");let o=e.data.uuid;return this.spaceId=o,Z&&console.log(`${t} spaceId set to the ${o} (I: 018724a5431ba421b71fad36924c5a25)`),Q.primitive({ib:`spaceId set to ${o}`})}else if(this._initialContext){debugger;console.error(`${t} (UNEXPECTED) context already initialized. returning early without doing anything. NOTE: This error was not thrown, only logged. (E: genuuid)`)}else{let o=await this.metaspace?.getLocalUserSpace({localSpaceId:this.spaceId});return await this.setWrappedIbGib({ibGib:e,space:o}),gt}}catch(o){throw console.error(`${t} ${o.message}`),o}finally{Z&&console.log(`${t} complete.`)}}_contextUpdated$;contextUpdated$;_newContextChild$;newContextChild$;async handleContextUpdate({update:e}){let t=`${this.lc}[${this.handleContextUpdate.name}]`;try{if(Z&&console.log(`${t} starting... (I: c262bcda065c086ffe9e3ac5899abe25)`),await super.handleContextUpdate({update:e}),!this._contextUpdated$)throw new Error("(UNEXPECTED) this._contextUpdated$ falsy? (E: a184df090502bed9649f8df88bd4c125)");await this._contextUpdated$.next(this._currentWorkingContextIbGib)}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{Z&&console.log(`${t} complete.`)}}async setWrappedIbGib({ibGib:e,ibGibAddr:t,space:o}){let i=`${this.lc}[${this.setWrappedIbGib.name}]`;try{if(Z&&console.log(`${i} starting... (I: a4b0acda259c121801aa701534320125)`),this.metaspace||(this.metaspace=await Ee()),!e){if(!t)throw new Error("(UNEXPECTED) both ibGib AND ibGibAddr falsy? (E: 6fac98ba2d4cfdec2b7ee974dec74625)");if(o??=await this.metaspace.getLocalUserSpace({lock:!1}),!o)throw new Error("(UNEXPECTED) space falsy? no space provided and couldn't get default local user space? (E: e14d1b7a6586f99453fc571396d4df25)");let s=await this.metaspace.get({addrs:[t],space:o});if(!s.success||s.ibGibs?.length!==1)throw new Error(`${i} failed to get ibGib(?) (${t}). space.ib: ${o.ib} (E: b38f0a25d92e44c0aa5cc3b038a43c6c)`);e=s.ibGibs.at(0)}await this.initializeContext({contextIbGib:e,rel8nName:""})}catch(s){throw console.error(`${i} ${y(s)}`),s}finally{Z&&console.log(`${i} complete.`)}}async handleNewContextChild({newChild:e}){let t=`[${this.handleNewContextChild.name}]`;try{if(Z&&console.log(`${t} starting... (I: 7e9b6b7a4bb2726e9c717f230dfe1925)`),!this._newContextChild$)throw new Error("(UNEXPECTED) this._contextUpdated$ falsy? (E: a184df090502bed9649f8df88bd4c125)");await this._newContextChild$.next(e)}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{Z&&console.log(`${t} complete.`)}}};var tt="witness_agent",nt=/^[a-zA-Z0-9_\-.]{1,32}$/,Qn=/.{1,255}/,Mr="",Gr="Manco",Dr="This is a generic, unspecified agent.";var Vt="List of function info ibgib addresses. These contain info on both the requests you made and the resultant values.",Oe="agent",Fg={type:"string",description:"unique identifier for the agent. Should be provided to the agent in system instructions upon creation."},Vg={type:"string",description:"type of the agent that governs basic responsibilities. Should be provided to the agent in system instructions upon creation."};var Il="hardcoded",vl="human",Tl="ai",wl="function",_l="unknown",O={HARDCODED:Il,HUMAN:vl,AI:Tl,FUNCTION:wl,UNKNOWN:_l},Zn=Object.freeze(Object.values(O));function Lr(n){return!!n&&Zn.includes(n)}f(Lr,"isTextSource");var Hg={type:"string",description:`The agent should pick a name with which to represent him/her/itself to the user. This should not be "Gemini" or something bland like that, rather, it should be a name that the agent likes. Should contain no spaces, only alphanumerics. Note that the example given has a name, but really it should be up to the agent's own preference. Please be consistent with this with yourself, i.e., don't change it once established. Must pass regex: ${nt.source}`},kr="primaryagent";var Ur=!1;async function jn({ibGib:n,addr:e,tagIbGib:t,metaspace:o,space:i}){let s=`[${jn.name}]`;try{if(Ur&&console.log(`${s} starting... (I: b1fd25ec28bce8f1916b4ab55f48a724)`),!e&&!n)throw new Error("either addr or ibGib required (E: 3d580f8ecc251a0c81c7ea8bc3d38524)");if(e??=x({ibGib:n}),e!==x({ibGib:n}))throw new Error(`addr (${e}) differs from incoming ibGib's addr (${x({ibGib:n})}). (E: f2c14234a78c917fb9f587beaee89324)`);let l=await o.getLatestAddr({ibGib:t,space:i});if(l!==x({ibGib:t})){let p=await o.get({addr:l,space:i});if(!p.success||p.ibGibs?.length!==1)throw new Error(`could not get latest tag (${l}) from space (${i.ib}). error: ${p.errorMsg??"[unknown error (E: a4e31c98398b417db8f617f98a5f2741)]"} (E: 73c085d81efdab0e7b8939222ec07524)`);t=p.ibGibs.at(0)}let c={[Fi]:[e]},d=await Ue({src:t,rel8nsToAddByAddr:c,dna:!0,nCounter:!0}),u=d.newIbGib;return await o.persistTransformResult({resTransform:d,space:i}),await o.registerNewIbGib({ibGib:u,space:i}),u}catch(l){throw console.error(`${s} ${y(l)}`),l}finally{Ur&&console.log(`${s} complete.`)}}f(jn,"rel8ToTag");var X=V,to=class n{static{f(this,"AgentsService_V1")}lc=`[${n.name}]`;latestAgents=new Map;factoryFns={};constructor(){}async getAgentById(e){let t=`${this.lc}[${this.getAgentById.name}]`;try{let{agentId:o,agentType:i,spaceId:s}=e;X&&console.log(`${t} starting... (I: 0c4214b4614a43bd2825978e54aee325)`);let l=this.latestAgents.get(o);if(!l){let c=await Ee();l=(await Ht({metaspace:c,type:i,spaceId:s})).find(u=>u.data.uuid===o)}return l||console.warn(`${t} couldn't find any agent by id. opts: ${D(e)} (W: 70cf51ecbe68dfdcfe1e9995a7468f25)`),l}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{X&&console.log(`${t} complete.`)}}async updateOrSetLatestAgent({agent:e,throwIfNewerFound:t}){let o=`${this.lc}[${this.updateOrSetLatestAgent.name}]`;try{if(X&&console.log(`${o} starting... (I: 9bb74f19b989fc0ee969cb4c2c2aa525)`),!e.data)throw new Error(`invalid agent. data falsy. agent.ib: ${e.ib} (E: 7356db7395cb0c5664d13437dd62c425)`);if(!e.data.uuid)throw new Error(`invalid agent. data.uuid falsy. agent.ib: ${e.ib} (E: 48afcd6658154bee1138fca31cbfbf25)`);let i=await this.getLatestAgent({id:e.data.uuid});if(i){if(!i.data)throw new Error("(UNEXPECTED) existing.data falsy? should have thrown on previous set function call? (E: f3cbae9922ea9849ada25db2eea40825)");if(i.data.n===e.data.n){if(i.gib===e.gib)return;console.warn(`existing.data.n === agent.data.n but gibs are different. We have a branched timeline. just logging this error, need to figure out wth is going on here. we should not have this with the timeline being locked. The only thing I can think of is if the ibgib is updated very quickly, but even then, the n should be incremented. still the approach is valid. anyway, we're going ahead and taking the newer agent.
|
|
1170
|
-
existing: ${D(re({ibGib:i}))}
|
|
1171
|
-
new: ${D(re({ibGib:e}))} (E: 5e079b566ff3533acdb2d01359f08625)`),await i.loadIbGibDto(e.toIbGibDto()),this.latestAgents.set(e.data.uuid,e);return}else if(i.data.n>e.data.n){let s="existing.data.n > agent.data.n, i.e., the one we already have is newer. So why was the caller trying to set to the older agent thinking it was the most recent? Probably have a branched timeline.";if(t)throw new Error(`${o} ${s} (E: bb2cc3ce8cfa88b80fb62149b0e70225)`);console.warn(`${o} ${s} (W: caaf66deb4e6fd8e2eb9261685dc0325)`);return}else{await i.loadIbGibDto(e.toIbGibDto()),this.latestAgents.set(e.data.uuid,e);return}}else{this.latestAgents.set(e.data.uuid,e);return}}catch(i){throw console.error(`${o} ${y(i)}`),i}finally{X&&console.log(`${o} complete.`)}}getLatestAgent({id:e}){let t=`${this.lc}[${this.getLatestAgent.name}]`;try{return X&&console.log(`${t} starting... (I: 8e85b55057760b712a913a92e88ead25)`),Promise.resolve(this.latestAgents.get(e))}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{X&&console.log(`${t} complete.`)}}registerFactory({classname:e,fnDtoToAgentWitness:t}){this.factoryFns[e]=t}async getAgentWitnessFromDto({dto:e,classname:t}){let o=`${this.lc}[${this.getAgentWitnessFromDto.name}]`;try{if(X&&console.log(`${o} starting... (I: 718837d4ee3d590177f3425b99106225)`),!e.data)throw new Error("dto.data falsy (E: fad89dd4c787b687a657c13968946925)");let i;if(t??=e.data.classname,t){let s=this.factoryFns[t],l=await s(e);if(l.applies){if(!l.agent)throw new Error("(UNEXPECTED) factory function for agent dto applies: true, but the resulting agent is undefined? (E: b13cdf0f3d9c50f1fa419f2c409ebf25)");i=l.agent}else throw new Error(`classname (${t}) factory function found and attempted, but result says applied: false. (E: 751a2502c9a7e2d61c76c8ae2f7fb125)`)}else{let s=Object.keys(this.factoryFns);for(let l of s){let c=this.factoryFns[l],d=await c(e);if(d.applies){if(!d.agent)throw new Error("(UNEXPECTED) factory function for agent dto applies: true, but the resulting agent is undefined? (E: 60e97c083a668baf11efcd6adf6a3525)");i=d.agent;break}}}return i}catch(i){throw console.error(`${o} ${y(i)}`),i}finally{X&&console.log(`${o} complete.`)}}async getAgentByAddr({agentAddr:e,spaceId:t,metaspace:o}){let i=`${this.lc}[${this.getAgentByAddr.name}]`;try{if(X&&console.log(`${i} starting... (I: 42dfecbe6d6b5a3a7d392af5a66cc625)`),!e)throw new Error(`${i} agentAddr is required. (E: 389351659a2e08fa179ceede16925a25)`);let{ib:s}=de({ibGibAddr:e}),{uuid:l,type:c}=Fr({ib:s});if(!l){debugger;throw new Error(`(UNEXPECTED) agentAddr doesn't have uuid in the ib? agentAddr: ${e} (E: fedcacffed98fdc78b1e80e45c413925)`)}let d=await this.getAgentById({agentId:l,agentType:c});if(d)return X&&console.log(`${i} agent found already in agents svc so didn't need to go get it from the space. (I: ec6abaf3badd8e301d79a7476845bc25)`),d;o??=await Ee();let u=await o.getLocalUserSpace({localSpaceId:t,lock:!1});if(!u)throw t?new Error(`couldn't get space with spaceId (${t}) (E: 26b3f1414a93cc339e704d0162cb8b25)`):new Error("(UNEXPECTED) couldn't get default local user space? (E: 2e19a1fae8b3f00595257f51426ac225)");let p=await o.get({addrs:[e],space:u});if(!p.success||!p.ibGibs||p.ibGibs.length===0){X&&console.log(`${i} Agent ibGib not found in space (${t}) at address ${e}. (I: 29c5c7994fb3ed388b28a81a9ed68325)`);return}let m=p.ibGibs[0],h=await this.getAgentWitnessFromDto({dto:m});if(!h){debugger;throw new Error(`${i} Couldn't get actual agent witness from agent dto (${e}). Have we registered classname (${m.data?.classname}) and factory fn with agents service? (E: e6e9da6c91d14bd7acb5c571c8de1a25)`)}return await this.updateOrSetLatestAgent({agent:h,throwIfNewerFound:!0}),X&&console.log(`${i} Cached agent witness with id ${l}. (I: b862f63147a3fac3c6e6210d5ab87c25)`),X&&console.log(`${i} complete. Retrieved and cached agent witness for address ${e}.`),h}catch(s){throw console.error(`${i} ${y(s)}`),s}}async createNewAgent(e){let t=`[${this.createNewAgent.name}]`;try{X&&console.log(`${t} starting... (I: a3e07b54bb7bf45f7739eff2d738c825)`);let{metaspace:o,superSpace:i,name:s,availableFunctions:l,initialSystemText:c,initialChatText:d,fnGetAPIKey:u,addToAgentsTag:p,type:m}=e;if(i??=await o.getLocalUserSpace({}),!i)throw new Error("(UNEXPECTED) superSpace falsy? (E: ceb60d96ff25b6d6aaa5aa69a7a51d25)");if(!i.data)throw new Error("(UNEXPECTED) superSpace.data falsy? (E: 56b4ec127f8559da96e6f70c7cb13825)");let h=oo(e),g=await h.createInitialData(i);if(!g.uuid)throw new Error("(UNEXPECTED) data.uuid falsy? (E: 4e4f6fcf89d1e3775971ad843a083725)");let b=await o.createLocalSpaceAndUpdateBootstrap({allowCancel:!1,zeroSpace:o.zeroSpace,spaceName:s+g.uuid.substring(0,5),createBootstrap:!1});if(!b)throw new Error("(UNEXPECTED) newSubSpace falsy after creating locally? (E: af8b5503c15d4292e2f591b316e7d825)");g.subSpaceId=b.data.uuid;let E=await h.createInitialRel8ns(),I=await Q.firstGen({ib:io({data:g}),parentIbGib:Q.primitive({ib:tt}),data:g,rel8ns:E,nCounter:!0,dna:!0,tjp:{timestamp:!0}});await o.persistTransformResult({resTransform:I});let v=I.newIbGib,T=await h.createWitness();if(T.fnGetAPIKey=u,await T.loadIbGibDto(v),p){let C=await no({metaspace:o,space:i}),S=await jn({ibGib:v,metaspace:o,space:i,tagIbGib:C})}await je({type:m,rel8nInfos:[{rel8nName:Oe,ibGibs:[v]}],metaspace:o,space:i}),l.length>0&&await T.addAvailableFunctions(l);let w=[];return w.push({textSrc:"hardcoded",text:ot({tagText:Ki,contentText:`Your id (agent id) is: ${g.uuid}. Your superSpaceId is: ${g.superSpaceId}. Your subSpaceId is: ${g.subSpaceId}. These may be useful/required in some functions, though you should refer to those functions' instructions/descriptions for applicability.`}),isSystem:!0}),c&&w.push({textSrc:"hardcoded",text:c,isSystem:!0}),d&&w.push({textSrc:"hardcoded",text:d}),await T.addTexts({infos:w}),this.latestAgents.set(T.data.uuid,T),T}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{X&&console.log(`${t} complete.`)}}getAgents(e){let t=`${this.lc}[${this.getAgents.name}]`;try{return X&&console.log(`${t} starting... (I: 4663f125c3a21fa3ecccc2c5a38d1225)`),Ht(e)}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{X&&console.log(`${t} complete.`)}}},eo;function Ie(){return eo||(eo=new to),eo}f(Ie,"getAgentsSvc");var Cl="gemini-3.1-pro-preview",Sl="gemini-3-flash-preview",Al="gemini-3.1-flash-lite-preview",xl="gemini-3.1-flash-live-preview",Pl="gemini-2.5-pro",Nl="gemini-2.5-flash",Rl="gemini-2.5-flash-lite",$l="gemini-2.5-flash-preview-tts",Ml="gemini-2.0-flash",Gl="gemini-2.0-flash-lite",ro={GEMINI_3_1_PRO_PREVIEW:Cl,GEMINI_3_FLASH_PREVIEW:Sl,GEMINI_3_1_FLASH_LITE_PREVIEW:Al,GEMINI_3_1_FLASH_LIVE_PREVIEW:xl,GEMINI_2_5_PRO:Pl,GEMINI_2_5_FLASH:Nl,GEMINI_2_5_FLASH_LITE:Rl,GEMINI_2_5_FLASH_PREVIEW_TTS:$l,GEMINI_2_0_FLASH:Ml,GEMINI_2_0_FLASH_LITE:Gl},cb=Object.freeze(Object.values(ro));var Vr=ro.GEMINI_2_5_FLASH,it=ro.GEMINI_2_5_FLASH_LITE,so=5;var Hr={version:"1",uuid:Mr,name:Gr,description:Dr,classname:"AgentWitness_V1",icon:"happy",persistOptsAndResultIbGibs:!1,allowPrimitiveArgs:!0,catchAllErrors:!0,trace:!1,subSpaceId:"",superSpaceId:"",availableFunctionNameOrIds:[],model:Vr,api:"gemini",type:kr,"@currentContextTjpAddr":q},ao=void 0;var Dl,Ll;function kl(){return{geminiUrl:Dl,vertexUrl:Ll}}f(kl,"getDefaultBaseUrls");function Ul(n,e,t,o){var i,s;if(!n?.baseUrl){let l=kl();return e?(i=l.vertexUrl)!==null&&i!==void 0?i:t:(s=l.geminiUrl)!==null&&s!==void 0?s:o}return n.baseUrl}f(Ul,"getBaseUrl");var he=class{static{f(this,"BaseModule")}};function _(n,e){let t=/\{([^}]+)\}/g;return n.replace(t,(o,i)=>{if(Object.prototype.hasOwnProperty.call(e,i)){let s=e[i];return s!=null?String(s):""}else throw new Error(`Key '${i}' not found in valueMap.`)})}f(_,"formatMap");function a(n,e,t){for(let s=0;s<e.length-1;s++){let l=e[s];if(l.endsWith("[]")){let c=l.slice(0,-2);if(!(c in n))if(Array.isArray(t))n[c]=Array.from({length:t.length},()=>({}));else throw new Error(`Value must be a list given an array path ${l}`);if(Array.isArray(n[c])){let d=n[c];if(Array.isArray(t))for(let u=0;u<d.length;u++){let p=d[u];a(p,e.slice(s+1),t[u])}else for(let u of d)a(u,e.slice(s+1),t)}return}else if(l.endsWith("[0]")){let c=l.slice(0,-3);c in n||(n[c]=[{}]);let d=n[c];a(d[0],e.slice(s+1),t);return}(!n[l]||typeof n[l]!="object")&&(n[l]={}),n=n[l]}let o=e[e.length-1],i=n[o];if(i!==void 0){if(!t||typeof t=="object"&&Object.keys(t).length===0||t===i)return;if(typeof i=="object"&&typeof t=="object"&&i!==null&&t!==null)Object.assign(i,t);else throw new Error(`Cannot set value for an existing key. Key: ${o}`)}else o==="_self"&&typeof t=="object"&&t!==null&&!Array.isArray(t)?Object.assign(n,t):n[o]=t}f(a,"setValueByPath");function r(n,e,t=void 0){try{if(e.length===1&&e[0]==="_self")return n;for(let o=0;o<e.length;o++){if(typeof n!="object"||n===null)return t;let i=e[o];if(i.endsWith("[]")){let s=i.slice(0,-2);if(s in n){let l=n[s];return Array.isArray(l)?l.map(c=>r(c,e.slice(o+1),t)):t}else return t}else n=n[i]}return n}catch(o){if(o instanceof TypeError)return t;throw o}}f(r,"getValueByPath");function Fl(n,e){for(let[t,o]of Object.entries(e)){let i=t.split("."),s=o.split("."),l=new Set,c=-1;for(let d=0;d<i.length;d++)if(i[d]==="*"){c=d;break}if(c!==-1&&s.length>c)for(let d=c;d<s.length;d++){let u=s[d];u!=="*"&&!u.endsWith("[]")&&!u.endsWith("[0]")&&l.add(u)}fo(n,i,s,0,l)}}f(Fl,"moveValueByPath");function fo(n,e,t,o,i){if(o>=e.length||typeof n!="object"||n===null)return;let s=e[o];if(s.endsWith("[]")){let l=s.slice(0,-2),c=n;if(l in c&&Array.isArray(c[l]))for(let d of c[l])fo(d,e,t,o+1,i)}else if(s==="*"){if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let l=n,c=Object.keys(l).filter(u=>!u.startsWith("_")&&!i.has(u)),d={};for(let u of c)d[u]=l[u];for(let[u,p]of Object.entries(d)){let m=[];for(let h of t.slice(o))h==="*"?m.push(u):m.push(h);a(l,m,p)}for(let u of c)delete l[u]}}else{let l=n;s in l&&fo(l[s],e,t,o+1,i)}}f(fo,"_moveValueRecursive");function di(n){if(typeof n!="string")throw new Error("fromImageBytes must be a string");return n}f(di,"tBytes$1");function Vl(n){let e={},t=r(n,["operationName"]);t!=null&&a(e,["operationName"],t);let o=r(n,["resourceName"]);return o!=null&&a(e,["_url","resourceName"],o),e}f(Vl,"fetchPredictOperationParametersToVertex");function Hl(n){let e={},t=r(n,["name"]);t!=null&&a(e,["name"],t);let o=r(n,["metadata"]);o!=null&&a(e,["metadata"],o);let i=r(n,["done"]);i!=null&&a(e,["done"],i);let s=r(n,["error"]);s!=null&&a(e,["error"],s);let l=r(n,["response","generateVideoResponse"]);return l!=null&&a(e,["response"],Bl(l)),e}f(Hl,"generateVideosOperationFromMldev$1");function ql(n){let e={},t=r(n,["name"]);t!=null&&a(e,["name"],t);let o=r(n,["metadata"]);o!=null&&a(e,["metadata"],o);let i=r(n,["done"]);i!=null&&a(e,["done"],i);let s=r(n,["error"]);s!=null&&a(e,["error"],s);let l=r(n,["response"]);return l!=null&&a(e,["response"],Ol(l)),e}f(ql,"generateVideosOperationFromVertex$1");function Bl(n){let e={},t=r(n,["generatedSamples"]);if(t!=null){let s=t;Array.isArray(s)&&(s=s.map(l=>zl(l))),a(e,["generatedVideos"],s)}let o=r(n,["raiMediaFilteredCount"]);o!=null&&a(e,["raiMediaFilteredCount"],o);let i=r(n,["raiMediaFilteredReasons"]);return i!=null&&a(e,["raiMediaFilteredReasons"],i),e}f(Bl,"generateVideosResponseFromMldev$1");function Ol(n){let e={},t=r(n,["videos"]);if(t!=null){let s=t;Array.isArray(s)&&(s=s.map(l=>Jl(l))),a(e,["generatedVideos"],s)}let o=r(n,["raiMediaFilteredCount"]);o!=null&&a(e,["raiMediaFilteredCount"],o);let i=r(n,["raiMediaFilteredReasons"]);return i!=null&&a(e,["raiMediaFilteredReasons"],i),e}f(Ol,"generateVideosResponseFromVertex$1");function zl(n){let e={},t=r(n,["video"]);return t!=null&&a(e,["video"],Zl(t)),e}f(zl,"generatedVideoFromMldev$1");function Jl(n){let e={},t=r(n,["_self"]);return t!=null&&a(e,["video"],jl(t)),e}f(Jl,"generatedVideoFromVertex$1");function Wl(n){let e={},t=r(n,["operationName"]);return t!=null&&a(e,["_url","operationName"],t),e}f(Wl,"getOperationParametersToMldev");function Kl(n){let e={},t=r(n,["operationName"]);return t!=null&&a(e,["_url","operationName"],t),e}f(Kl,"getOperationParametersToVertex");function Xl(n){let e={},t=r(n,["name"]);t!=null&&a(e,["name"],t);let o=r(n,["metadata"]);o!=null&&a(e,["metadata"],o);let i=r(n,["done"]);i!=null&&a(e,["done"],i);let s=r(n,["error"]);s!=null&&a(e,["error"],s);let l=r(n,["response"]);return l!=null&&a(e,["response"],Yl(l)),e}f(Xl,"importFileOperationFromMldev$1");function Yl(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["parent"]);o!=null&&a(e,["parent"],o);let i=r(n,["documentName"]);return i!=null&&a(e,["documentName"],i),e}f(Yl,"importFileResponseFromMldev$1");function da(n){let e={},t=r(n,["name"]);t!=null&&a(e,["name"],t);let o=r(n,["metadata"]);o!=null&&a(e,["metadata"],o);let i=r(n,["done"]);i!=null&&a(e,["done"],i);let s=r(n,["error"]);s!=null&&a(e,["error"],s);let l=r(n,["response"]);return l!=null&&a(e,["response"],Ql(l)),e}f(da,"uploadToFileSearchStoreOperationFromMldev");function Ql(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["parent"]);o!=null&&a(e,["parent"],o);let i=r(n,["documentName"]);return i!=null&&a(e,["documentName"],i),e}f(Ql,"uploadToFileSearchStoreResponseFromMldev");function Zl(n){let e={},t=r(n,["uri"]);t!=null&&a(e,["uri"],t);let o=r(n,["encodedVideo"]);o!=null&&a(e,["videoBytes"],di(o));let i=r(n,["encoding"]);return i!=null&&a(e,["mimeType"],i),e}f(Zl,"videoFromMldev$1");function jl(n){let e={},t=r(n,["gcsUri"]);t!=null&&a(e,["uri"],t);let o=r(n,["bytesBase64Encoded"]);o!=null&&a(e,["videoBytes"],di(o));let i=r(n,["mimeType"]);return i!=null&&a(e,["mimeType"],i),e}f(jl,"videoFromVertex$1");var qr;(function(n){n.OUTCOME_UNSPECIFIED="OUTCOME_UNSPECIFIED",n.OUTCOME_OK="OUTCOME_OK",n.OUTCOME_FAILED="OUTCOME_FAILED",n.OUTCOME_DEADLINE_EXCEEDED="OUTCOME_DEADLINE_EXCEEDED"})(qr||(qr={}));var Br;(function(n){n.LANGUAGE_UNSPECIFIED="LANGUAGE_UNSPECIFIED",n.PYTHON="PYTHON"})(Br||(Br={}));var Or;(function(n){n.SCHEDULING_UNSPECIFIED="SCHEDULING_UNSPECIFIED",n.SILENT="SILENT",n.WHEN_IDLE="WHEN_IDLE",n.INTERRUPT="INTERRUPT"})(Or||(Or={}));var Re;(function(n){n.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",n.STRING="STRING",n.NUMBER="NUMBER",n.INTEGER="INTEGER",n.BOOLEAN="BOOLEAN",n.ARRAY="ARRAY",n.OBJECT="OBJECT",n.NULL="NULL"})(Re||(Re={}));var zr;(function(n){n.MODE_UNSPECIFIED="MODE_UNSPECIFIED",n.MODE_DYNAMIC="MODE_DYNAMIC"})(zr||(zr={}));var Jr;(function(n){n.API_SPEC_UNSPECIFIED="API_SPEC_UNSPECIFIED",n.SIMPLE_SEARCH="SIMPLE_SEARCH",n.ELASTIC_SEARCH="ELASTIC_SEARCH"})(Jr||(Jr={}));var Wr;(function(n){n.AUTH_TYPE_UNSPECIFIED="AUTH_TYPE_UNSPECIFIED",n.NO_AUTH="NO_AUTH",n.API_KEY_AUTH="API_KEY_AUTH",n.HTTP_BASIC_AUTH="HTTP_BASIC_AUTH",n.GOOGLE_SERVICE_ACCOUNT_AUTH="GOOGLE_SERVICE_ACCOUNT_AUTH",n.OAUTH="OAUTH",n.OIDC_AUTH="OIDC_AUTH"})(Wr||(Wr={}));var Kr;(function(n){n.HTTP_IN_UNSPECIFIED="HTTP_IN_UNSPECIFIED",n.HTTP_IN_QUERY="HTTP_IN_QUERY",n.HTTP_IN_HEADER="HTTP_IN_HEADER",n.HTTP_IN_PATH="HTTP_IN_PATH",n.HTTP_IN_BODY="HTTP_IN_BODY",n.HTTP_IN_COOKIE="HTTP_IN_COOKIE"})(Kr||(Kr={}));var Xr;(function(n){n.PHISH_BLOCK_THRESHOLD_UNSPECIFIED="PHISH_BLOCK_THRESHOLD_UNSPECIFIED",n.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",n.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",n.BLOCK_HIGH_AND_ABOVE="BLOCK_HIGH_AND_ABOVE",n.BLOCK_HIGHER_AND_ABOVE="BLOCK_HIGHER_AND_ABOVE",n.BLOCK_VERY_HIGH_AND_ABOVE="BLOCK_VERY_HIGH_AND_ABOVE",n.BLOCK_ONLY_EXTREMELY_HIGH="BLOCK_ONLY_EXTREMELY_HIGH"})(Xr||(Xr={}));var Yr;(function(n){n.THINKING_LEVEL_UNSPECIFIED="THINKING_LEVEL_UNSPECIFIED",n.LOW="LOW",n.HIGH="HIGH"})(Yr||(Yr={}));var Qr;(function(n){n.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",n.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",n.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",n.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",n.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",n.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY",n.HARM_CATEGORY_IMAGE_HATE="HARM_CATEGORY_IMAGE_HATE",n.HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT="HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",n.HARM_CATEGORY_IMAGE_HARASSMENT="HARM_CATEGORY_IMAGE_HARASSMENT",n.HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT="HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",n.HARM_CATEGORY_JAILBREAK="HARM_CATEGORY_JAILBREAK"})(Qr||(Qr={}));var Zr;(function(n){n.HARM_BLOCK_METHOD_UNSPECIFIED="HARM_BLOCK_METHOD_UNSPECIFIED",n.SEVERITY="SEVERITY",n.PROBABILITY="PROBABILITY"})(Zr||(Zr={}));var jr;(function(n){n.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",n.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",n.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",n.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",n.BLOCK_NONE="BLOCK_NONE",n.OFF="OFF"})(jr||(jr={}));var es;(function(n){n.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",n.STOP="STOP",n.MAX_TOKENS="MAX_TOKENS",n.SAFETY="SAFETY",n.RECITATION="RECITATION",n.LANGUAGE="LANGUAGE",n.OTHER="OTHER",n.BLOCKLIST="BLOCKLIST",n.PROHIBITED_CONTENT="PROHIBITED_CONTENT",n.SPII="SPII",n.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",n.IMAGE_SAFETY="IMAGE_SAFETY",n.UNEXPECTED_TOOL_CALL="UNEXPECTED_TOOL_CALL",n.IMAGE_PROHIBITED_CONTENT="IMAGE_PROHIBITED_CONTENT",n.NO_IMAGE="NO_IMAGE",n.IMAGE_RECITATION="IMAGE_RECITATION",n.IMAGE_OTHER="IMAGE_OTHER"})(es||(es={}));var ts;(function(n){n.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",n.NEGLIGIBLE="NEGLIGIBLE",n.LOW="LOW",n.MEDIUM="MEDIUM",n.HIGH="HIGH"})(ts||(ts={}));var ns;(function(n){n.HARM_SEVERITY_UNSPECIFIED="HARM_SEVERITY_UNSPECIFIED",n.HARM_SEVERITY_NEGLIGIBLE="HARM_SEVERITY_NEGLIGIBLE",n.HARM_SEVERITY_LOW="HARM_SEVERITY_LOW",n.HARM_SEVERITY_MEDIUM="HARM_SEVERITY_MEDIUM",n.HARM_SEVERITY_HIGH="HARM_SEVERITY_HIGH"})(ns||(ns={}));var os;(function(n){n.URL_RETRIEVAL_STATUS_UNSPECIFIED="URL_RETRIEVAL_STATUS_UNSPECIFIED",n.URL_RETRIEVAL_STATUS_SUCCESS="URL_RETRIEVAL_STATUS_SUCCESS",n.URL_RETRIEVAL_STATUS_ERROR="URL_RETRIEVAL_STATUS_ERROR",n.URL_RETRIEVAL_STATUS_PAYWALL="URL_RETRIEVAL_STATUS_PAYWALL",n.URL_RETRIEVAL_STATUS_UNSAFE="URL_RETRIEVAL_STATUS_UNSAFE"})(os||(os={}));var is;(function(n){n.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",n.SAFETY="SAFETY",n.OTHER="OTHER",n.BLOCKLIST="BLOCKLIST",n.PROHIBITED_CONTENT="PROHIBITED_CONTENT",n.IMAGE_SAFETY="IMAGE_SAFETY",n.MODEL_ARMOR="MODEL_ARMOR",n.JAILBREAK="JAILBREAK"})(is||(is={}));var rs;(function(n){n.TRAFFIC_TYPE_UNSPECIFIED="TRAFFIC_TYPE_UNSPECIFIED",n.ON_DEMAND="ON_DEMAND",n.PROVISIONED_THROUGHPUT="PROVISIONED_THROUGHPUT"})(rs||(rs={}));var Xt;(function(n){n.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",n.TEXT="TEXT",n.IMAGE="IMAGE",n.AUDIO="AUDIO"})(Xt||(Xt={}));var ss;(function(n){n.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",n.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",n.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",n.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(ss||(ss={}));var as;(function(n){n.TUNING_MODE_UNSPECIFIED="TUNING_MODE_UNSPECIFIED",n.TUNING_MODE_FULL="TUNING_MODE_FULL",n.TUNING_MODE_PEFT_ADAPTER="TUNING_MODE_PEFT_ADAPTER"})(as||(as={}));var ls;(function(n){n.ADAPTER_SIZE_UNSPECIFIED="ADAPTER_SIZE_UNSPECIFIED",n.ADAPTER_SIZE_ONE="ADAPTER_SIZE_ONE",n.ADAPTER_SIZE_TWO="ADAPTER_SIZE_TWO",n.ADAPTER_SIZE_FOUR="ADAPTER_SIZE_FOUR",n.ADAPTER_SIZE_EIGHT="ADAPTER_SIZE_EIGHT",n.ADAPTER_SIZE_SIXTEEN="ADAPTER_SIZE_SIXTEEN",n.ADAPTER_SIZE_THIRTY_TWO="ADAPTER_SIZE_THIRTY_TWO"})(ls||(ls={}));var po;(function(n){n.JOB_STATE_UNSPECIFIED="JOB_STATE_UNSPECIFIED",n.JOB_STATE_QUEUED="JOB_STATE_QUEUED",n.JOB_STATE_PENDING="JOB_STATE_PENDING",n.JOB_STATE_RUNNING="JOB_STATE_RUNNING",n.JOB_STATE_SUCCEEDED="JOB_STATE_SUCCEEDED",n.JOB_STATE_FAILED="JOB_STATE_FAILED",n.JOB_STATE_CANCELLING="JOB_STATE_CANCELLING",n.JOB_STATE_CANCELLED="JOB_STATE_CANCELLED",n.JOB_STATE_PAUSED="JOB_STATE_PAUSED",n.JOB_STATE_EXPIRED="JOB_STATE_EXPIRED",n.JOB_STATE_UPDATING="JOB_STATE_UPDATING",n.JOB_STATE_PARTIALLY_SUCCEEDED="JOB_STATE_PARTIALLY_SUCCEEDED"})(po||(po={}));var cs;(function(n){n.TUNING_TASK_UNSPECIFIED="TUNING_TASK_UNSPECIFIED",n.TUNING_TASK_I2V="TUNING_TASK_I2V",n.TUNING_TASK_T2V="TUNING_TASK_T2V",n.TUNING_TASK_R2V="TUNING_TASK_R2V"})(cs||(cs={}));var ds;(function(n){n.MEDIA_RESOLUTION_UNSPECIFIED="MEDIA_RESOLUTION_UNSPECIFIED",n.MEDIA_RESOLUTION_LOW="MEDIA_RESOLUTION_LOW",n.MEDIA_RESOLUTION_MEDIUM="MEDIA_RESOLUTION_MEDIUM",n.MEDIA_RESOLUTION_HIGH="MEDIA_RESOLUTION_HIGH"})(ds||(ds={}));var us;(function(n){n.FEATURE_SELECTION_PREFERENCE_UNSPECIFIED="FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",n.PRIORITIZE_QUALITY="PRIORITIZE_QUALITY",n.BALANCED="BALANCED",n.PRIORITIZE_COST="PRIORITIZE_COST"})(us||(us={}));var fs;(function(n){n.UNSPECIFIED="UNSPECIFIED",n.BLOCKING="BLOCKING",n.NON_BLOCKING="NON_BLOCKING"})(fs||(fs={}));var ps;(function(n){n.MODE_UNSPECIFIED="MODE_UNSPECIFIED",n.MODE_DYNAMIC="MODE_DYNAMIC"})(ps||(ps={}));var ms;(function(n){n.ENVIRONMENT_UNSPECIFIED="ENVIRONMENT_UNSPECIFIED",n.ENVIRONMENT_BROWSER="ENVIRONMENT_BROWSER"})(ms||(ms={}));var Yt;(function(n){n.MODE_UNSPECIFIED="MODE_UNSPECIFIED",n.AUTO="AUTO",n.ANY="ANY",n.NONE="NONE",n.VALIDATED="VALIDATED"})(Yt||(Yt={}));var hs;(function(n){n.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",n.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",n.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",n.BLOCK_NONE="BLOCK_NONE"})(hs||(hs={}));var gs;(function(n){n.DONT_ALLOW="DONT_ALLOW",n.ALLOW_ADULT="ALLOW_ADULT",n.ALLOW_ALL="ALLOW_ALL"})(gs||(gs={}));var bs;(function(n){n.auto="auto",n.en="en",n.ja="ja",n.ko="ko",n.hi="hi",n.zh="zh",n.pt="pt",n.es="es"})(bs||(bs={}));var ys;(function(n){n.MASK_MODE_DEFAULT="MASK_MODE_DEFAULT",n.MASK_MODE_USER_PROVIDED="MASK_MODE_USER_PROVIDED",n.MASK_MODE_BACKGROUND="MASK_MODE_BACKGROUND",n.MASK_MODE_FOREGROUND="MASK_MODE_FOREGROUND",n.MASK_MODE_SEMANTIC="MASK_MODE_SEMANTIC"})(ys||(ys={}));var Es;(function(n){n.CONTROL_TYPE_DEFAULT="CONTROL_TYPE_DEFAULT",n.CONTROL_TYPE_CANNY="CONTROL_TYPE_CANNY",n.CONTROL_TYPE_SCRIBBLE="CONTROL_TYPE_SCRIBBLE",n.CONTROL_TYPE_FACE_MESH="CONTROL_TYPE_FACE_MESH"})(Es||(Es={}));var Is;(function(n){n.SUBJECT_TYPE_DEFAULT="SUBJECT_TYPE_DEFAULT",n.SUBJECT_TYPE_PERSON="SUBJECT_TYPE_PERSON",n.SUBJECT_TYPE_ANIMAL="SUBJECT_TYPE_ANIMAL",n.SUBJECT_TYPE_PRODUCT="SUBJECT_TYPE_PRODUCT"})(Is||(Is={}));var vs;(function(n){n.EDIT_MODE_DEFAULT="EDIT_MODE_DEFAULT",n.EDIT_MODE_INPAINT_REMOVAL="EDIT_MODE_INPAINT_REMOVAL",n.EDIT_MODE_INPAINT_INSERTION="EDIT_MODE_INPAINT_INSERTION",n.EDIT_MODE_OUTPAINT="EDIT_MODE_OUTPAINT",n.EDIT_MODE_CONTROLLED_EDITING="EDIT_MODE_CONTROLLED_EDITING",n.EDIT_MODE_STYLE="EDIT_MODE_STYLE",n.EDIT_MODE_BGSWAP="EDIT_MODE_BGSWAP",n.EDIT_MODE_PRODUCT_IMAGE="EDIT_MODE_PRODUCT_IMAGE"})(vs||(vs={}));var Ts;(function(n){n.FOREGROUND="FOREGROUND",n.BACKGROUND="BACKGROUND",n.PROMPT="PROMPT",n.SEMANTIC="SEMANTIC",n.INTERACTIVE="INTERACTIVE"})(Ts||(Ts={}));var ws;(function(n){n.ASSET="ASSET",n.STYLE="STYLE"})(ws||(ws={}));var _s;(function(n){n.INSERT="INSERT",n.REMOVE="REMOVE",n.REMOVE_STATIC="REMOVE_STATIC",n.OUTPAINT="OUTPAINT"})(_s||(_s={}));var Cs;(function(n){n.OPTIMIZED="OPTIMIZED",n.LOSSLESS="LOSSLESS"})(Cs||(Cs={}));var Ss;(function(n){n.SUPERVISED_FINE_TUNING="SUPERVISED_FINE_TUNING",n.PREFERENCE_TUNING="PREFERENCE_TUNING"})(Ss||(Ss={}));var As;(function(n){n.STATE_UNSPECIFIED="STATE_UNSPECIFIED",n.STATE_PENDING="STATE_PENDING",n.STATE_ACTIVE="STATE_ACTIVE",n.STATE_FAILED="STATE_FAILED"})(As||(As={}));var xs;(function(n){n.STATE_UNSPECIFIED="STATE_UNSPECIFIED",n.PROCESSING="PROCESSING",n.ACTIVE="ACTIVE",n.FAILED="FAILED"})(xs||(xs={}));var Ps;(function(n){n.SOURCE_UNSPECIFIED="SOURCE_UNSPECIFIED",n.UPLOADED="UPLOADED",n.GENERATED="GENERATED"})(Ps||(Ps={}));var Ns;(function(n){n.TURN_COMPLETE_REASON_UNSPECIFIED="TURN_COMPLETE_REASON_UNSPECIFIED",n.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",n.RESPONSE_REJECTED="RESPONSE_REJECTED",n.NEED_MORE_INPUT="NEED_MORE_INPUT"})(Ns||(Ns={}));var Rs;(function(n){n.MODALITY_UNSPECIFIED="MODALITY_UNSPECIFIED",n.TEXT="TEXT",n.IMAGE="IMAGE",n.VIDEO="VIDEO",n.AUDIO="AUDIO",n.DOCUMENT="DOCUMENT"})(Rs||(Rs={}));var $s;(function(n){n.VAD_SIGNAL_TYPE_UNSPECIFIED="VAD_SIGNAL_TYPE_UNSPECIFIED",n.VAD_SIGNAL_TYPE_SOS="VAD_SIGNAL_TYPE_SOS",n.VAD_SIGNAL_TYPE_EOS="VAD_SIGNAL_TYPE_EOS"})($s||($s={}));var Ms;(function(n){n.START_SENSITIVITY_UNSPECIFIED="START_SENSITIVITY_UNSPECIFIED",n.START_SENSITIVITY_HIGH="START_SENSITIVITY_HIGH",n.START_SENSITIVITY_LOW="START_SENSITIVITY_LOW"})(Ms||(Ms={}));var Gs;(function(n){n.END_SENSITIVITY_UNSPECIFIED="END_SENSITIVITY_UNSPECIFIED",n.END_SENSITIVITY_HIGH="END_SENSITIVITY_HIGH",n.END_SENSITIVITY_LOW="END_SENSITIVITY_LOW"})(Gs||(Gs={}));var Ds;(function(n){n.ACTIVITY_HANDLING_UNSPECIFIED="ACTIVITY_HANDLING_UNSPECIFIED",n.START_OF_ACTIVITY_INTERRUPTS="START_OF_ACTIVITY_INTERRUPTS",n.NO_INTERRUPTION="NO_INTERRUPTION"})(Ds||(Ds={}));var Ls;(function(n){n.TURN_COVERAGE_UNSPECIFIED="TURN_COVERAGE_UNSPECIFIED",n.TURN_INCLUDES_ONLY_ACTIVITY="TURN_INCLUDES_ONLY_ACTIVITY",n.TURN_INCLUDES_ALL_INPUT="TURN_INCLUDES_ALL_INPUT"})(Ls||(Ls={}));var ks;(function(n){n.SCALE_UNSPECIFIED="SCALE_UNSPECIFIED",n.C_MAJOR_A_MINOR="C_MAJOR_A_MINOR",n.D_FLAT_MAJOR_B_FLAT_MINOR="D_FLAT_MAJOR_B_FLAT_MINOR",n.D_MAJOR_B_MINOR="D_MAJOR_B_MINOR",n.E_FLAT_MAJOR_C_MINOR="E_FLAT_MAJOR_C_MINOR",n.E_MAJOR_D_FLAT_MINOR="E_MAJOR_D_FLAT_MINOR",n.F_MAJOR_D_MINOR="F_MAJOR_D_MINOR",n.G_FLAT_MAJOR_E_FLAT_MINOR="G_FLAT_MAJOR_E_FLAT_MINOR",n.G_MAJOR_E_MINOR="G_MAJOR_E_MINOR",n.A_FLAT_MAJOR_F_MINOR="A_FLAT_MAJOR_F_MINOR",n.A_MAJOR_G_FLAT_MINOR="A_MAJOR_G_FLAT_MINOR",n.B_FLAT_MAJOR_G_MINOR="B_FLAT_MAJOR_G_MINOR",n.B_MAJOR_A_FLAT_MINOR="B_MAJOR_A_FLAT_MINOR"})(ks||(ks={}));var Us;(function(n){n.MUSIC_GENERATION_MODE_UNSPECIFIED="MUSIC_GENERATION_MODE_UNSPECIFIED",n.QUALITY="QUALITY",n.DIVERSITY="DIVERSITY",n.VOCALIZATION="VOCALIZATION"})(Us||(Us={}));var st;(function(n){n.PLAYBACK_CONTROL_UNSPECIFIED="PLAYBACK_CONTROL_UNSPECIFIED",n.PLAY="PLAY",n.PAUSE="PAUSE",n.STOP="STOP",n.RESET_CONTEXT="RESET_CONTEXT"})(st||(st={}));var _t=class{static{f(this,"HttpResponse")}constructor(e){let t={};for(let o of e.headers.entries())t[o[0]]=o[1];this.headers=t,this.responseInternal=e}json(){return this.responseInternal.json()}};var Je=class{static{f(this,"GenerateContentResponse")}get text(){var e,t,o,i,s,l,c,d;if(((i=(o=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||o===void 0?void 0:o.parts)===null||i===void 0?void 0:i.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning text from the first one.");let u="",p=!1,m=[];for(let h of(d=(c=(l=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||l===void 0?void 0:l.content)===null||c===void 0?void 0:c.parts)!==null&&d!==void 0?d:[]){for(let[g,b]of Object.entries(h))g!=="text"&&g!=="thought"&&g!=="thoughtSignature"&&(b!==null||b!==void 0)&&m.push(g);if(typeof h.text=="string"){if(typeof h.thought=="boolean"&&h.thought)continue;p=!0,u+=h.text}}return m.length>0&&console.warn(`there are non-text parts ${m} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),p?u:void 0}get data(){var e,t,o,i,s,l,c,d;if(((i=(o=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||o===void 0?void 0:o.parts)===null||i===void 0?void 0:i.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning data from the first one.");let u="",p=[];for(let m of(d=(c=(l=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||l===void 0?void 0:l.content)===null||c===void 0?void 0:c.parts)!==null&&d!==void 0?d:[]){for(let[h,g]of Object.entries(m))h!=="inlineData"&&(g!==null||g!==void 0)&&p.push(h);m.inlineData&&typeof m.inlineData.data=="string"&&(u+=atob(m.inlineData.data))}return p.length>0&&console.warn(`there are non-data parts ${p} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),u.length>0?btoa(u):void 0}get functionCalls(){var e,t,o,i,s,l,c,d;if(((i=(o=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||o===void 0?void 0:o.parts)===null||i===void 0?void 0:i.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning function calls from the first one.");let u=(d=(c=(l=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||l===void 0?void 0:l.content)===null||c===void 0?void 0:c.parts)===null||d===void 0?void 0:d.filter(p=>p.functionCall).map(p=>p.functionCall).filter(p=>p!==void 0);if(u?.length!==0)return u}get executableCode(){var e,t,o,i,s,l,c,d,u;if(((i=(o=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||o===void 0?void 0:o.parts)===null||i===void 0?void 0:i.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning executable code from the first one.");let p=(d=(c=(l=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||l===void 0?void 0:l.content)===null||c===void 0?void 0:c.parts)===null||d===void 0?void 0:d.filter(m=>m.executableCode).map(m=>m.executableCode).filter(m=>m!==void 0);if(p?.length!==0)return(u=p?.[0])===null||u===void 0?void 0:u.code}get codeExecutionResult(){var e,t,o,i,s,l,c,d,u;if(((i=(o=(t=(e=this.candidates)===null||e===void 0?void 0:e[0])===null||t===void 0?void 0:t.content)===null||o===void 0?void 0:o.parts)===null||i===void 0?void 0:i.length)===0)return;this.candidates&&this.candidates.length>1&&console.warn("there are multiple candidates in the response, returning code execution result from the first one.");let p=(d=(c=(l=(s=this.candidates)===null||s===void 0?void 0:s[0])===null||l===void 0?void 0:l.content)===null||c===void 0?void 0:c.parts)===null||d===void 0?void 0:d.filter(m=>m.codeExecutionResult).map(m=>m.codeExecutionResult).filter(m=>m!==void 0);if(p?.length!==0)return(u=p?.[0])===null||u===void 0?void 0:u.output}},Qt=class{static{f(this,"EmbedContentResponse")}},Zt=class{static{f(this,"GenerateImagesResponse")}},mo=class{static{f(this,"EditImageResponse")}},ho=class{static{f(this,"UpscaleImageResponse")}},go=class{static{f(this,"RecontextImageResponse")}},bo=class{static{f(this,"SegmentImageResponse")}},jt=class{static{f(this,"ListModelsResponse")}},en=class{static{f(this,"DeleteModelResponse")}},tn=class{static{f(this,"CountTokensResponse")}},yo=class{static{f(this,"ComputeTokensResponse")}};var nn=class n{static{f(this,"GenerateVideosOperation")}_fromAPIResponse({apiResponse:e,_isVertexAI:t}){let o=new n,i,s=e;return t?i=ql(s):i=Hl(s),Object.assign(o,i),o}},on=class{static{f(this,"ListTuningJobsResponse")}},rn=class{static{f(this,"CancelTuningJobResponse")}},sn=class{static{f(this,"DeleteCachedContentResponse")}},an=class{static{f(this,"ListCachedContentsResponse")}},Eo=class{static{f(this,"ListDocumentsResponse")}},Io=class{static{f(this,"ListFileSearchStoresResponse")}},vo=class{static{f(this,"UploadToFileSearchStoreResumableResponse")}};var To=class n{static{f(this,"ImportFileOperation")}_fromAPIResponse({apiResponse:e,_isVertexAI:t}){let o=new n,s=Xl(e);return Object.assign(o,s),o}},wo=class{static{f(this,"ListFilesResponse")}},_o=class{static{f(this,"CreateFileResponse")}},Co=class{static{f(this,"DeleteFileResponse")}};var ln=class{static{f(this,"ListBatchJobsResponse")}};var So=class{static{f(this,"LiveServerMessage")}get text(){var e,t,o;let i="",s=!1,l=[];for(let c of(o=(t=(e=this.serverContent)===null||e===void 0?void 0:e.modelTurn)===null||t===void 0?void 0:t.parts)!==null&&o!==void 0?o:[]){for(let[d,u]of Object.entries(c))d!=="text"&&d!=="thought"&&u!==null&&l.push(d);if(typeof c.text=="string"){if(typeof c.thought=="boolean"&&c.thought)continue;s=!0,i+=c.text}}return l.length>0&&console.warn(`there are non-text parts ${l} in the response, returning concatenation of all text parts. Please refer to the non text parts for a full response from model.`),s?i:void 0}get data(){var e,t,o;let i="",s=[];for(let l of(o=(t=(e=this.serverContent)===null||e===void 0?void 0:e.modelTurn)===null||t===void 0?void 0:t.parts)!==null&&o!==void 0?o:[]){for(let[c,d]of Object.entries(l))c!=="inlineData"&&d!==null&&s.push(c);l.inlineData&&typeof l.inlineData.data=="string"&&(i+=atob(l.inlineData.data))}return s.length>0&&console.warn(`there are non-data parts ${s} in the response, returning concatenation of all data parts. Please refer to the non data parts for a full response from model.`),i.length>0?btoa(i):void 0}};var Ao=class{static{f(this,"LiveMusicServerMessage")}get audioChunk(){if(this.serverContent&&this.serverContent.audioChunks&&this.serverContent.audioChunks.length>0)return this.serverContent.audioChunks[0]}};var xo=class n{static{f(this,"UploadToFileSearchStoreOperation")}_fromAPIResponse({apiResponse:e,_isVertexAI:t}){let o=new n,s=da(e);return Object.assign(o,s),o}};function L(n,e){if(!e||typeof e!="string")throw new Error("model is required and must be a string");if(e.includes("..")||e.includes("?")||e.includes("&"))throw new Error("invalid model parameter");if(n.isVertexAI()){if(e.startsWith("publishers/")||e.startsWith("projects/")||e.startsWith("models/"))return e;if(e.indexOf("/")>=0){let t=e.split("/",2);return`publishers/${t[0]}/models/${t[1]}`}else return`publishers/google/models/${e}`}else return e.startsWith("models/")||e.startsWith("tunedModels/")?e:`models/${e}`}f(L,"tModel");function ua(n,e){let t=L(n,e);return t?t.startsWith("publishers/")&&n.isVertexAI()?`projects/${n.getProject()}/locations/${n.getLocation()}/${t}`:t.startsWith("models/")&&n.isVertexAI()?`projects/${n.getProject()}/locations/${n.getLocation()}/publishers/google/${t}`:t:""}f(ua,"tCachesModel");function fa(n){return Array.isArray(n)?n.map(e=>cn(e)):[cn(n)]}f(fa,"tBlobs");function cn(n){if(typeof n=="object"&&n!==null)return n;throw new Error(`Could not parse input as Blob. Unsupported blob type: ${typeof n}`)}f(cn,"tBlob");function pa(n){let e=cn(n);if(e.mimeType&&e.mimeType.startsWith("image/"))return e;throw new Error(`Unsupported mime type: ${e.mimeType}`)}f(pa,"tImageBlob");function ma(n){let e=cn(n);if(e.mimeType&&e.mimeType.startsWith("audio/"))return e;throw new Error(`Unsupported mime type: ${e.mimeType}`)}f(ma,"tAudioBlob");function Fs(n){if(n==null)throw new Error("PartUnion is required");if(typeof n=="object")return n;if(typeof n=="string")return{text:n};throw new Error(`Unsupported part type: ${typeof n}`)}f(Fs,"tPart");function ha(n){if(n==null||Array.isArray(n)&&n.length===0)throw new Error("PartListUnion is required");return Array.isArray(n)?n.map(e=>Fs(e)):[Fs(n)]}f(ha,"tParts");function Po(n){return n!=null&&typeof n=="object"&&"parts"in n&&Array.isArray(n.parts)}f(Po,"_isContent");function Vs(n){return n!=null&&typeof n=="object"&&"functionCall"in n}f(Vs,"_isFunctionCallPart");function Hs(n){return n!=null&&typeof n=="object"&&"functionResponse"in n}f(Hs,"_isFunctionResponsePart");function j(n){if(n==null)throw new Error("ContentUnion is required");return Po(n)?n:{role:"user",parts:ha(n)}}f(j,"tContent");function ui(n,e){if(!e)return[];if(n.isVertexAI()&&Array.isArray(e))return e.flatMap(t=>{let o=j(t);return o.parts&&o.parts.length>0&&o.parts[0].text!==void 0?[o.parts[0].text]:[]});if(n.isVertexAI()){let t=j(e);return t.parts&&t.parts.length>0&&t.parts[0].text!==void 0?[t.parts[0].text]:[]}return Array.isArray(e)?e.map(t=>j(t)):[j(e)]}f(ui,"tContentsForEmbed");function ce(n){if(n==null||Array.isArray(n)&&n.length===0)throw new Error("contents are required");if(!Array.isArray(n)){if(Vs(n)||Hs(n))throw new Error("To specify functionCall or functionResponse parts, please wrap them in a Content object, specifying the role for them");return[j(n)]}let e=[],t=[],o=Po(n[0]);for(let i of n){let s=Po(i);if(s!=o)throw new Error("Mixing Content and Parts is not supported, please group the parts into a the appropriate Content objects and specify the roles for them");if(s)e.push(i);else{if(Vs(i)||Hs(i))throw new Error("To specify functionCall or functionResponse parts, please wrap them, and any other parts, in Content objects as appropriate, specifying the role for them");t.push(i)}}return o||e.push({role:"user",parts:ha(t)}),e}f(ce,"tContents");function ec(n,e){n.includes("null")&&(e.nullable=!0);let t=n.filter(o=>o!=="null");if(t.length===1)e.type=Object.values(Re).includes(t[0].toUpperCase())?t[0].toUpperCase():Re.TYPE_UNSPECIFIED;else{e.anyOf=[];for(let o of t)e.anyOf.push({type:Object.values(Re).includes(o.toUpperCase())?o.toUpperCase():Re.TYPE_UNSPECIFIED})}}f(ec,"flattenTypeArrayToAnyOf");function at(n){let e={},t=["items"],o=["anyOf"],i=["properties"];if(n.type&&n.anyOf)throw new Error("type and anyOf cannot be both populated.");let s=n.anyOf;s!=null&&s.length==2&&(s[0].type==="null"?(e.nullable=!0,n=s[1]):s[1].type==="null"&&(e.nullable=!0,n=s[0])),n.type instanceof Array&&ec(n.type,e);for(let[l,c]of Object.entries(n))if(c!=null)if(l=="type"){if(c==="null")throw new Error("type: null can not be the only possible type for the field.");if(c instanceof Array)continue;e.type=Object.values(Re).includes(c.toUpperCase())?c.toUpperCase():Re.TYPE_UNSPECIFIED}else if(t.includes(l))e[l]=at(c);else if(o.includes(l)){let d=[];for(let u of c){if(u.type=="null"){e.nullable=!0;continue}d.push(at(u))}e[l]=d}else if(i.includes(l)){let d={};for(let[u,p]of Object.entries(c))d[u]=at(p);e[l]=d}else{if(l==="additionalProperties")continue;e[l]=c}return e}f(at,"processJsonSchema");function fi(n){return at(n)}f(fi,"tSchema");function pi(n){if(typeof n=="object")return n;if(typeof n=="string")return{voiceConfig:{prebuiltVoiceConfig:{voiceName:n}}};throw new Error(`Unsupported speechConfig type: ${typeof n}`)}f(pi,"tSpeechConfig");function mi(n){if("multiSpeakerVoiceConfig"in n)throw new Error("multiSpeakerVoiceConfig is not supported in the live API.");return n}f(mi,"tLiveSpeechConfig");function ut(n){if(n.functionDeclarations)for(let e of n.functionDeclarations)e.parameters&&(Object.keys(e.parameters).includes("$schema")?e.parametersJsonSchema||(e.parametersJsonSchema=e.parameters,delete e.parameters):e.parameters=at(e.parameters)),e.response&&(Object.keys(e.response).includes("$schema")?e.responseJsonSchema||(e.responseJsonSchema=e.response,delete e.response):e.response=at(e.response));return n}f(ut,"tTool");function ft(n){if(n==null)throw new Error("tools is required");if(!Array.isArray(n))throw new Error("tools is required and must be an array of Tools");let e=[];for(let t of n)e.push(t);return e}f(ft,"tTools");function tc(n,e,t,o=1){let i=!e.startsWith(`${t}/`)&&e.split("/").length===o;return n.isVertexAI()?e.startsWith("projects/")?e:e.startsWith("locations/")?`projects/${n.getProject()}/${e}`:e.startsWith(`${t}/`)?`projects/${n.getProject()}/locations/${n.getLocation()}/${e}`:i?`projects/${n.getProject()}/locations/${n.getLocation()}/${t}/${e}`:e:i?`${t}/${e}`:e}f(tc,"resourceName");function Ae(n,e){if(typeof e!="string")throw new Error("name must be a string");return tc(n,e,"cachedContents")}f(Ae,"tCachedContentName");function ga(n){switch(n){case"STATE_UNSPECIFIED":return"JOB_STATE_UNSPECIFIED";case"CREATING":return"JOB_STATE_RUNNING";case"ACTIVE":return"JOB_STATE_SUCCEEDED";case"FAILED":return"JOB_STATE_FAILED";default:return n}}f(ga,"tTuningJobStatus");function $e(n){return di(n)}f($e,"tBytes");function nc(n){return n!=null&&typeof n=="object"&&"name"in n}f(nc,"_isFile");function oc(n){return n!=null&&typeof n=="object"&&"video"in n}f(oc,"isGeneratedVideo");function ic(n){return n!=null&&typeof n=="object"&&"uri"in n}f(ic,"isVideo");function ba(n){var e;let t;if(nc(n)&&(t=n.name),!(ic(n)&&(t=n.uri,t===void 0))&&!(oc(n)&&(t=(e=n.video)===null||e===void 0?void 0:e.uri,t===void 0))){if(typeof n=="string"&&(t=n),t===void 0)throw new Error("Could not extract file name from the provided input.");if(t.startsWith("https://")){let i=t.split("files/")[1].match(/[a-z0-9]+/);if(i===null)throw new Error(`Could not extract file name from URI ${t}`);t=i[0]}else t.startsWith("files/")&&(t=t.split("files/")[1]);return t}}f(ba,"tFileName");function ya(n,e){let t;return n.isVertexAI()?t=e?"publishers/google/models":"models":t=e?"models":"tunedModels",t}f(ya,"tModelsUrl");function Ea(n){for(let e of["models","tunedModels","publisherModels"])if(rc(n,e))return n[e];return[]}f(Ea,"tExtractModels");function rc(n,e){return n!==null&&typeof n=="object"&&e in n}f(rc,"hasField");function sc(n,e={}){let t=n,o={name:t.name,description:t.description,parametersJsonSchema:t.inputSchema};return t.outputSchema&&(o.responseJsonSchema=t.outputSchema),e.behavior&&(o.behavior=e.behavior),{functionDeclarations:[o]}}f(sc,"mcpToGeminiTool");function ac(n,e={}){let t=[],o=new Set;for(let i of n){let s=i.name;if(o.has(s))throw new Error(`Duplicate function name ${s} found in MCP tools. Please ensure function names are unique.`);o.add(s);let l=sc(i,e);l.functionDeclarations&&t.push(...l.functionDeclarations)}return{functionDeclarations:t}}f(ac,"mcpToolsToGeminiTool");function Ia(n,e){let t;if(typeof e=="string")if(n.isVertexAI())if(e.startsWith("gs://"))t={format:"jsonl",gcsUri:[e]};else if(e.startsWith("bq://"))t={format:"bigquery",bigqueryUri:e};else throw new Error(`Unsupported string source for Vertex AI: ${e}`);else if(e.startsWith("files/"))t={fileName:e};else throw new Error(`Unsupported string source for Gemini API: ${e}`);else if(Array.isArray(e)){if(n.isVertexAI())throw new Error("InlinedRequest[] is not supported in Vertex AI.");t={inlinedRequests:e}}else t=e;let o=[t.gcsUri,t.bigqueryUri].filter(Boolean).length,i=[t.inlinedRequests,t.fileName].filter(Boolean).length;if(n.isVertexAI()){if(i>0||o!==1)throw new Error("Exactly one of `gcsUri` or `bigqueryUri` must be set for Vertex AI.")}else if(o>0||i!==1)throw new Error("Exactly one of `inlinedRequests`, `fileName`, must be set for Gemini API.");return t}f(Ia,"tBatchJobSource");function lc(n){if(typeof n!="string")return n;let e=n;if(e.startsWith("gs://"))return{format:"jsonl",gcsUri:e};if(e.startsWith("bq://"))return{format:"bigquery",bigqueryUri:e};throw new Error(`Unsupported destination: ${e}`)}f(lc,"tBatchJobDestination");function va(n){if(typeof n!="object"||n===null)return{};let e=n,t=e.inlinedResponses;if(typeof t!="object"||t===null)return n;let i=t.inlinedResponses;if(!Array.isArray(i)||i.length===0)return n;let s=!1;for(let l of i){if(typeof l!="object"||l===null)continue;let d=l.response;if(typeof d!="object"||d===null)continue;if(d.embedding!==void 0){s=!0;break}}return s&&(e.inlinedEmbedContentResponses=e.inlinedResponses,delete e.inlinedResponses),n}f(va,"tRecvBatchJobDestination");function pt(n,e){let t=e;if(!n.isVertexAI()){if(/batches\/[^/]+$/.test(t))return t.split("/").pop();throw new Error(`Invalid batch job name: ${t}.`)}if(/^projects\/[^/]+\/locations\/[^/]+\/batchPredictionJobs\/[^/]+$/.test(t))return t.split("/").pop();if(/^\d+$/.test(t))return t;throw new Error(`Invalid batch job name: ${t}.`)}f(pt,"tBatchJobName");function Ta(n){let e=n;return e==="BATCH_STATE_UNSPECIFIED"?"JOB_STATE_UNSPECIFIED":e==="BATCH_STATE_PENDING"?"JOB_STATE_PENDING":e==="BATCH_STATE_RUNNING"?"JOB_STATE_RUNNING":e==="BATCH_STATE_SUCCEEDED"?"JOB_STATE_SUCCEEDED":e==="BATCH_STATE_FAILED"?"JOB_STATE_FAILED":e==="BATCH_STATE_CANCELLED"?"JOB_STATE_CANCELLED":e==="BATCH_STATE_EXPIRED"?"JOB_STATE_EXPIRED":e}f(Ta,"tJobState");function cc(n){let e={},t=r(n,["responsesFile"]);t!=null&&a(e,["fileName"],t);let o=r(n,["inlinedResponses","inlinedResponses"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(l=>Bc(l))),a(e,["inlinedResponses"],s)}let i=r(n,["inlinedEmbedContentResponses","inlinedResponses"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(l=>l)),a(e,["inlinedEmbedContentResponses"],s)}return e}f(cc,"batchJobDestinationFromMldev");function dc(n){let e={},t=r(n,["predictionsFormat"]);t!=null&&a(e,["format"],t);let o=r(n,["gcsDestination","outputUriPrefix"]);o!=null&&a(e,["gcsUri"],o);let i=r(n,["bigqueryDestination","outputUri"]);return i!=null&&a(e,["bigqueryUri"],i),e}f(dc,"batchJobDestinationFromVertex");function uc(n){let e={},t=r(n,["format"]);t!=null&&a(e,["predictionsFormat"],t);let o=r(n,["gcsUri"]);o!=null&&a(e,["gcsDestination","outputUriPrefix"],o);let i=r(n,["bigqueryUri"]);if(i!=null&&a(e,["bigqueryDestination","outputUri"],i),r(n,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(r(n,["inlinedResponses"])!==void 0)throw new Error("inlinedResponses parameter is not supported in Vertex AI.");if(r(n,["inlinedEmbedContentResponses"])!==void 0)throw new Error("inlinedEmbedContentResponses parameter is not supported in Vertex AI.");return e}f(uc,"batchJobDestinationToVertex");function Wt(n){let e={},t=r(n,["name"]);t!=null&&a(e,["name"],t);let o=r(n,["metadata","displayName"]);o!=null&&a(e,["displayName"],o);let i=r(n,["metadata","state"]);i!=null&&a(e,["state"],Ta(i));let s=r(n,["metadata","createTime"]);s!=null&&a(e,["createTime"],s);let l=r(n,["metadata","endTime"]);l!=null&&a(e,["endTime"],l);let c=r(n,["metadata","updateTime"]);c!=null&&a(e,["updateTime"],c);let d=r(n,["metadata","model"]);d!=null&&a(e,["model"],d);let u=r(n,["metadata","output"]);return u!=null&&a(e,["dest"],cc(va(u))),e}f(Wt,"batchJobFromMldev");function No(n){let e={},t=r(n,["name"]);t!=null&&a(e,["name"],t);let o=r(n,["displayName"]);o!=null&&a(e,["displayName"],o);let i=r(n,["state"]);i!=null&&a(e,["state"],Ta(i));let s=r(n,["error"]);s!=null&&a(e,["error"],s);let l=r(n,["createTime"]);l!=null&&a(e,["createTime"],l);let c=r(n,["startTime"]);c!=null&&a(e,["startTime"],c);let d=r(n,["endTime"]);d!=null&&a(e,["endTime"],d);let u=r(n,["updateTime"]);u!=null&&a(e,["updateTime"],u);let p=r(n,["model"]);p!=null&&a(e,["model"],p);let m=r(n,["inputConfig"]);m!=null&&a(e,["src"],fc(m));let h=r(n,["outputConfig"]);h!=null&&a(e,["dest"],dc(va(h)));let g=r(n,["completionStats"]);return g!=null&&a(e,["completionStats"],g),e}f(No,"batchJobFromVertex");function fc(n){let e={},t=r(n,["instancesFormat"]);t!=null&&a(e,["format"],t);let o=r(n,["gcsSource","uris"]);o!=null&&a(e,["gcsUri"],o);let i=r(n,["bigquerySource","inputUri"]);return i!=null&&a(e,["bigqueryUri"],i),e}f(fc,"batchJobSourceFromVertex");function pc(n,e){let t={};if(r(e,["format"])!==void 0)throw new Error("format parameter is not supported in Gemini API.");if(r(e,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(r(e,["bigqueryUri"])!==void 0)throw new Error("bigqueryUri parameter is not supported in Gemini API.");let o=r(e,["fileName"]);o!=null&&a(t,["fileName"],o);let i=r(e,["inlinedRequests"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(l=>qc(n,l))),a(t,["requests","requests"],s)}return t}f(pc,"batchJobSourceToMldev");function mc(n){let e={},t=r(n,["format"]);t!=null&&a(e,["instancesFormat"],t);let o=r(n,["gcsUri"]);o!=null&&a(e,["gcsSource","uris"],o);let i=r(n,["bigqueryUri"]);if(i!=null&&a(e,["bigquerySource","inputUri"],i),r(n,["fileName"])!==void 0)throw new Error("fileName parameter is not supported in Vertex AI.");if(r(n,["inlinedRequests"])!==void 0)throw new Error("inlinedRequests parameter is not supported in Vertex AI.");return e}f(mc,"batchJobSourceToVertex");function hc(n){let e={},t=r(n,["data"]);if(t!=null&&a(e,["data"],t),r(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f(hc,"blobToMldev$4");function gc(n,e){let t={},o=r(e,["name"]);return o!=null&&a(t,["_url","name"],pt(n,o)),t}f(gc,"cancelBatchJobParametersToMldev");function bc(n,e){let t={},o=r(e,["name"]);return o!=null&&a(t,["_url","name"],pt(n,o)),t}f(bc,"cancelBatchJobParametersToVertex");function yc(n){let e={},t=r(n,["content"]);t!=null&&a(e,["content"],t);let o=r(n,["citationMetadata"]);o!=null&&a(e,["citationMetadata"],Ec(o));let i=r(n,["tokenCount"]);i!=null&&a(e,["tokenCount"],i);let s=r(n,["finishReason"]);s!=null&&a(e,["finishReason"],s);let l=r(n,["avgLogprobs"]);l!=null&&a(e,["avgLogprobs"],l);let c=r(n,["groundingMetadata"]);c!=null&&a(e,["groundingMetadata"],c);let d=r(n,["index"]);d!=null&&a(e,["index"],d);let u=r(n,["logprobsResult"]);u!=null&&a(e,["logprobsResult"],u);let p=r(n,["safetyRatings"]);if(p!=null){let h=p;Array.isArray(h)&&(h=h.map(g=>g)),a(e,["safetyRatings"],h)}let m=r(n,["urlContextMetadata"]);return m!=null&&a(e,["urlContextMetadata"],m),e}f(yc,"candidateFromMldev$1");function Ec(n){let e={},t=r(n,["citationSources"]);if(t!=null){let o=t;Array.isArray(o)&&(o=o.map(i=>i)),a(e,["citations"],o)}return e}f(Ec,"citationMetadataFromMldev$1");function wa(n){let e={},t=r(n,["parts"]);if(t!=null){let i=t;Array.isArray(i)&&(i=i.map(s=>Yc(s))),a(e,["parts"],i)}let o=r(n,["role"]);return o!=null&&a(e,["role"],o),e}f(wa,"contentToMldev$4");function Ic(n,e){let t={},o=r(n,["displayName"]);if(e!==void 0&&o!=null&&a(e,["batch","displayName"],o),r(n,["dest"])!==void 0)throw new Error("dest parameter is not supported in Gemini API.");return t}f(Ic,"createBatchJobConfigToMldev");function vc(n,e){let t={},o=r(n,["displayName"]);e!==void 0&&o!=null&&a(e,["displayName"],o);let i=r(n,["dest"]);return e!==void 0&&i!=null&&a(e,["outputConfig"],uc(lc(i))),t}f(vc,"createBatchJobConfigToVertex");function qs(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["src"]);i!=null&&a(t,["batch","inputConfig"],pc(n,Ia(n,i)));let s=r(e,["config"]);return s!=null&&Ic(s,t),t}f(qs,"createBatchJobParametersToMldev");function Tc(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["model"],L(n,o));let i=r(e,["src"]);i!=null&&a(t,["inputConfig"],mc(Ia(n,i)));let s=r(e,["config"]);return s!=null&&vc(s,t),t}f(Tc,"createBatchJobParametersToVertex");function wc(n,e){let t={},o=r(n,["displayName"]);return e!==void 0&&o!=null&&a(e,["batch","displayName"],o),t}f(wc,"createEmbeddingsBatchJobConfigToMldev");function _c(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["src"]);i!=null&&a(t,["batch","inputConfig"],Rc(n,i));let s=r(e,["config"]);return s!=null&&wc(s,t),t}f(_c,"createEmbeddingsBatchJobParametersToMldev");function Cc(n,e){let t={},o=r(e,["name"]);return o!=null&&a(t,["_url","name"],pt(n,o)),t}f(Cc,"deleteBatchJobParametersToMldev");function Sc(n,e){let t={},o=r(e,["name"]);return o!=null&&a(t,["_url","name"],pt(n,o)),t}f(Sc,"deleteBatchJobParametersToVertex");function Ac(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["name"]);o!=null&&a(e,["name"],o);let i=r(n,["done"]);i!=null&&a(e,["done"],i);let s=r(n,["error"]);return s!=null&&a(e,["error"],s),e}f(Ac,"deleteResourceJobFromMldev");function xc(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["name"]);o!=null&&a(e,["name"],o);let i=r(n,["done"]);i!=null&&a(e,["done"],i);let s=r(n,["error"]);return s!=null&&a(e,["error"],s),e}f(xc,"deleteResourceJobFromVertex");function Pc(n,e){let t={},o=r(e,["contents"]);if(o!=null){let s=ui(n,o);Array.isArray(s)&&(s=s.map(l=>l)),a(t,["requests[]","request","content"],s)}let i=r(e,["config"]);return i!=null&&(a(t,["_self"],Nc(i,t)),Fl(t,{"requests[].*":"requests[].request.*"})),t}f(Pc,"embedContentBatchToMldev");function Nc(n,e){let t={},o=r(n,["taskType"]);e!==void 0&&o!=null&&a(e,["requests[]","taskType"],o);let i=r(n,["title"]);e!==void 0&&i!=null&&a(e,["requests[]","title"],i);let s=r(n,["outputDimensionality"]);if(e!==void 0&&s!=null&&a(e,["requests[]","outputDimensionality"],s),r(n,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(r(n,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return t}f(Nc,"embedContentConfigToMldev$1");function Rc(n,e){let t={},o=r(e,["fileName"]);o!=null&&a(t,["file_name"],o);let i=r(e,["inlinedRequests"]);return i!=null&&a(t,["requests"],Pc(n,i)),t}f(Rc,"embeddingsBatchJobSourceToMldev");function $c(n){let e={};if(r(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");let t=r(n,["fileUri"]);t!=null&&a(e,["fileUri"],t);let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f($c,"fileDataToMldev$4");function Mc(n){let e={},t=r(n,["id"]);t!=null&&a(e,["id"],t);let o=r(n,["args"]);o!=null&&a(e,["args"],o);let i=r(n,["name"]);if(i!=null&&a(e,["name"],i),r(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(r(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}f(Mc,"functionCallToMldev$4");function Gc(n){let e={},t=r(n,["mode"]);t!=null&&a(e,["mode"],t);let o=r(n,["allowedFunctionNames"]);if(o!=null&&a(e,["allowedFunctionNames"],o),r(n,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}f(Gc,"functionCallingConfigToMldev$2");function Dc(n,e,t){let o={},i=r(e,["systemInstruction"]);t!==void 0&&i!=null&&a(t,["systemInstruction"],wa(j(i)));let s=r(e,["temperature"]);s!=null&&a(o,["temperature"],s);let l=r(e,["topP"]);l!=null&&a(o,["topP"],l);let c=r(e,["topK"]);c!=null&&a(o,["topK"],c);let d=r(e,["candidateCount"]);d!=null&&a(o,["candidateCount"],d);let u=r(e,["maxOutputTokens"]);u!=null&&a(o,["maxOutputTokens"],u);let p=r(e,["stopSequences"]);p!=null&&a(o,["stopSequences"],p);let m=r(e,["responseLogprobs"]);m!=null&&a(o,["responseLogprobs"],m);let h=r(e,["logprobs"]);h!=null&&a(o,["logprobs"],h);let g=r(e,["presencePenalty"]);g!=null&&a(o,["presencePenalty"],g);let b=r(e,["frequencyPenalty"]);b!=null&&a(o,["frequencyPenalty"],b);let E=r(e,["seed"]);E!=null&&a(o,["seed"],E);let I=r(e,["responseMimeType"]);I!=null&&a(o,["responseMimeType"],I);let v=r(e,["responseSchema"]);v!=null&&a(o,["responseSchema"],fi(v));let T=r(e,["responseJsonSchema"]);if(T!=null&&a(o,["responseJsonSchema"],T),r(e,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(r(e,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");let w=r(e,["safetySettings"]);if(t!==void 0&&w!=null){let H=w;Array.isArray(H)&&(H=H.map(be=>Qc(be))),a(t,["safetySettings"],H)}let C=r(e,["tools"]);if(t!==void 0&&C!=null){let H=ft(C);Array.isArray(H)&&(H=H.map(be=>jc(ut(be)))),a(t,["tools"],H)}let S=r(e,["toolConfig"]);if(t!==void 0&&S!=null&&a(t,["toolConfig"],Zc(S)),r(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");let $=r(e,["cachedContent"]);t!==void 0&&$!=null&&a(t,["cachedContent"],Ae(n,$));let P=r(e,["responseModalities"]);P!=null&&a(o,["responseModalities"],P);let F=r(e,["mediaResolution"]);F!=null&&a(o,["mediaResolution"],F);let A=r(e,["speechConfig"]);if(A!=null&&a(o,["speechConfig"],pi(A)),r(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");let G=r(e,["thinkingConfig"]);G!=null&&a(o,["thinkingConfig"],G);let B=r(e,["imageConfig"]);B!=null&&a(o,["imageConfig"],Hc(B));let ve=r(e,["enableEnhancedCivicAnswers"]);return ve!=null&&a(o,["enableEnhancedCivicAnswers"],ve),o}f(Dc,"generateContentConfigToMldev$1");function Lc(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["candidates"]);if(o!=null){let d=o;Array.isArray(d)&&(d=d.map(u=>yc(u))),a(e,["candidates"],d)}let i=r(n,["modelVersion"]);i!=null&&a(e,["modelVersion"],i);let s=r(n,["promptFeedback"]);s!=null&&a(e,["promptFeedback"],s);let l=r(n,["responseId"]);l!=null&&a(e,["responseId"],l);let c=r(n,["usageMetadata"]);return c!=null&&a(e,["usageMetadata"],c),e}f(Lc,"generateContentResponseFromMldev$1");function kc(n,e){let t={},o=r(e,["name"]);return o!=null&&a(t,["_url","name"],pt(n,o)),t}f(kc,"getBatchJobParametersToMldev");function Uc(n,e){let t={},o=r(e,["name"]);return o!=null&&a(t,["_url","name"],pt(n,o)),t}f(Uc,"getBatchJobParametersToVertex");function Fc(n){let e={};if(r(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");let t=r(n,["enableWidget"]);return t!=null&&a(e,["enableWidget"],t),e}f(Fc,"googleMapsToMldev$4");function Vc(n){let e={};if(r(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(r(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");let t=r(n,["timeRangeFilter"]);return t!=null&&a(e,["timeRangeFilter"],t),e}f(Vc,"googleSearchToMldev$4");function Hc(n){let e={},t=r(n,["aspectRatio"]);t!=null&&a(e,["aspectRatio"],t);let o=r(n,["imageSize"]);if(o!=null&&a(e,["imageSize"],o),r(n,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(r(n,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return e}f(Hc,"imageConfigToMldev$1");function qc(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["request","model"],L(n,o));let i=r(e,["contents"]);if(i!=null){let c=ce(i);Array.isArray(c)&&(c=c.map(d=>wa(d))),a(t,["request","contents"],c)}let s=r(e,["metadata"]);s!=null&&a(t,["metadata"],s);let l=r(e,["config"]);return l!=null&&a(t,["request","generationConfig"],Dc(n,l,r(t,["request"],{}))),t}f(qc,"inlinedRequestToMldev");function Bc(n){let e={},t=r(n,["response"]);t!=null&&a(e,["response"],Lc(t));let o=r(n,["error"]);return o!=null&&a(e,["error"],o),e}f(Bc,"inlinedResponseFromMldev");function Oc(n,e){let t={},o=r(n,["pageSize"]);e!==void 0&&o!=null&&a(e,["_query","pageSize"],o);let i=r(n,["pageToken"]);if(e!==void 0&&i!=null&&a(e,["_query","pageToken"],i),r(n,["filter"])!==void 0)throw new Error("filter parameter is not supported in Gemini API.");return t}f(Oc,"listBatchJobsConfigToMldev");function zc(n,e){let t={},o=r(n,["pageSize"]);e!==void 0&&o!=null&&a(e,["_query","pageSize"],o);let i=r(n,["pageToken"]);e!==void 0&&i!=null&&a(e,["_query","pageToken"],i);let s=r(n,["filter"]);return e!==void 0&&s!=null&&a(e,["_query","filter"],s),t}f(zc,"listBatchJobsConfigToVertex");function Jc(n){let e={},t=r(n,["config"]);return t!=null&&Oc(t,e),e}f(Jc,"listBatchJobsParametersToMldev");function Wc(n){let e={},t=r(n,["config"]);return t!=null&&zc(t,e),e}f(Wc,"listBatchJobsParametersToVertex");function Kc(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["nextPageToken"]);o!=null&&a(e,["nextPageToken"],o);let i=r(n,["operations"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(l=>Wt(l))),a(e,["batchJobs"],s)}return e}f(Kc,"listBatchJobsResponseFromMldev");function Xc(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["nextPageToken"]);o!=null&&a(e,["nextPageToken"],o);let i=r(n,["batchPredictionJobs"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(l=>No(l))),a(e,["batchJobs"],s)}return e}f(Xc,"listBatchJobsResponseFromVertex");function Yc(n){let e={},t=r(n,["mediaResolution"]);t!=null&&a(e,["mediaResolution"],t);let o=r(n,["codeExecutionResult"]);o!=null&&a(e,["codeExecutionResult"],o);let i=r(n,["executableCode"]);i!=null&&a(e,["executableCode"],i);let s=r(n,["fileData"]);s!=null&&a(e,["fileData"],$c(s));let l=r(n,["functionCall"]);l!=null&&a(e,["functionCall"],Mc(l));let c=r(n,["functionResponse"]);c!=null&&a(e,["functionResponse"],c);let d=r(n,["inlineData"]);d!=null&&a(e,["inlineData"],hc(d));let u=r(n,["text"]);u!=null&&a(e,["text"],u);let p=r(n,["thought"]);p!=null&&a(e,["thought"],p);let m=r(n,["thoughtSignature"]);m!=null&&a(e,["thoughtSignature"],m);let h=r(n,["videoMetadata"]);return h!=null&&a(e,["videoMetadata"],h),e}f(Yc,"partToMldev$4");function Qc(n){let e={},t=r(n,["category"]);if(t!=null&&a(e,["category"],t),r(n,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");let o=r(n,["threshold"]);return o!=null&&a(e,["threshold"],o),e}f(Qc,"safetySettingToMldev$1");function Zc(n){let e={},t=r(n,["functionCallingConfig"]);t!=null&&a(e,["functionCallingConfig"],Gc(t));let o=r(n,["retrievalConfig"]);return o!=null&&a(e,["retrievalConfig"],o),e}f(Zc,"toolConfigToMldev$2");function jc(n){let e={},t=r(n,["functionDeclarations"]);if(t!=null){let p=t;Array.isArray(p)&&(p=p.map(m=>m)),a(e,["functionDeclarations"],p)}if(r(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");let o=r(n,["googleSearchRetrieval"]);o!=null&&a(e,["googleSearchRetrieval"],o);let i=r(n,["computerUse"]);i!=null&&a(e,["computerUse"],i);let s=r(n,["fileSearch"]);s!=null&&a(e,["fileSearch"],s);let l=r(n,["codeExecution"]);if(l!=null&&a(e,["codeExecution"],l),r(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");let c=r(n,["googleMaps"]);c!=null&&a(e,["googleMaps"],Fc(c));let d=r(n,["googleSearch"]);d!=null&&a(e,["googleSearch"],Vc(d));let u=r(n,["urlContext"]);return u!=null&&a(e,["urlContext"],u),e}f(jc,"toolToMldev$4");var Ce;(function(n){n.PAGED_ITEM_BATCH_JOBS="batchJobs",n.PAGED_ITEM_MODELS="models",n.PAGED_ITEM_TUNING_JOBS="tuningJobs",n.PAGED_ITEM_FILES="files",n.PAGED_ITEM_CACHED_CONTENTS="cachedContents",n.PAGED_ITEM_FILE_SEARCH_STORES="fileSearchStores",n.PAGED_ITEM_DOCUMENTS="documents"})(Ce||(Ce={}));var Se=class{static{f(this,"Pager")}constructor(e,t,o,i){this.pageInternal=[],this.paramsInternal={},this.requestInternal=t,this.init(e,o,i)}init(e,t,o){var i,s;this.nameInternal=e,this.pageInternal=t[this.nameInternal]||[],this.sdkHttpResponseInternal=t?.sdkHttpResponse,this.idxInternal=0;let l={config:{}};!o||Object.keys(o).length===0?l={config:{}}:typeof o=="object"?l=Object.assign({},o):l=o,l.config&&(l.config.pageToken=t.nextPageToken),this.paramsInternal=l,this.pageInternalSize=(s=(i=l.config)===null||i===void 0?void 0:i.pageSize)!==null&&s!==void 0?s:this.pageInternal.length}initNextPage(e){this.init(this.nameInternal,e,this.paramsInternal)}get page(){return this.pageInternal}get name(){return this.nameInternal}get pageSize(){return this.pageInternalSize}get sdkHttpResponse(){return this.sdkHttpResponseInternal}get params(){return this.paramsInternal}get pageLength(){return this.pageInternal.length}getItem(e){return this.pageInternal[e]}[Symbol.asyncIterator](){return{next:f(async()=>{if(this.idxInternal>=this.pageLength)if(this.hasNextPage())await this.nextPage();else return{value:void 0,done:!0};let e=this.getItem(this.idxInternal);return this.idxInternal+=1,{value:e,done:!1}},"next"),return:f(async()=>({value:void 0,done:!0}),"return")}}async nextPage(){if(!this.hasNextPage())throw new Error("No more pages to fetch.");let e=await this.requestInternal(this.params);return this.initNextPage(e),this.page}hasNextPage(){var e;return((e=this.params.config)===null||e===void 0?void 0:e.pageToken)!==void 0}};var Ro=class extends he{static{f(this,"Batches")}constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new Se(Ce.PAGED_ITEM_BATCH_JOBS,o=>this.listInternal(o),await this.listInternal(t),t),this.create=async t=>(this.apiClient.isVertexAI()&&(t.config=this.formatDestination(t.src,t.config)),this.createInternal(t)),this.createEmbeddings=async t=>{if(console.warn("batches.createEmbeddings() is experimental and may change without notice."),this.apiClient.isVertexAI())throw new Error("Vertex AI does not support batches.createEmbeddings.");return this.createEmbeddingsInternal(t)}}createInlinedGenerateContentRequest(e){let t=qs(this.apiClient,e),o=t._url,i=_("{model}:batchGenerateContent",o),c=t.batch.inputConfig.requests,d=c.requests,u=[];for(let p of d){let m=Object.assign({},p);if(m.systemInstruction){let h=m.systemInstruction;delete m.systemInstruction;let g=m.request;g.systemInstruction=h,m.request=g}u.push(m)}return c.requests=u,delete t.config,delete t._url,delete t._query,{path:i,body:t}}getGcsUri(e){if(typeof e=="string")return e.startsWith("gs://")?e:void 0;if(!Array.isArray(e)&&e.gcsUri&&e.gcsUri.length>0)return e.gcsUri[0]}getBigqueryUri(e){if(typeof e=="string")return e.startsWith("bq://")?e:void 0;if(!Array.isArray(e))return e.bigqueryUri}formatDestination(e,t){let o=t?Object.assign({},t):{},i=Date.now().toString();if(o.displayName||(o.displayName=`genaiBatchJob_${i}`),o.dest===void 0){let s=this.getGcsUri(e),l=this.getBigqueryUri(e);if(s)s.endsWith(".jsonl")?o.dest=`${s.slice(0,-6)}/dest`:o.dest=`${s}_dest_${i}`;else if(l)o.dest=`${l}_dest_${i}`;else throw new Error("Unsupported source for Vertex AI: No GCS or BigQuery URI found.")}return o}async createInternal(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Tc(this.apiClient,e);return c=_("batchPredictionJobs",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json()),l.then(p=>No(p))}else{let u=qs(this.apiClient,e);return c=_("{model}:batchGenerateContent",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),l.then(p=>Wt(p))}}async createEmbeddingsInternal(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=_c(this.apiClient,e);return s=_("{model}:asyncBatchEmbedContent",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>Wt(d))}}async get(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Uc(this.apiClient,e);return c=_("batchPredictionJobs/{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json()),l.then(p=>No(p))}else{let u=kc(this.apiClient,e);return c=_("batches/{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),l.then(p=>Wt(p))}}async cancel(e){var t,o,i,s;let l="",c={};if(this.apiClient.isVertexAI()){let d=bc(this.apiClient,e);l=_("batchPredictionJobs/{name}:cancel",d._url),c=d._query,delete d._url,delete d._query,await this.apiClient.request({path:l,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal})}else{let d=gc(this.apiClient,e);l=_("batches/{name}:cancel",d._url),c=d._query,delete d._url,delete d._query,await this.apiClient.request({path:l,queryParams:c,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal})}}async listInternal(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Wc(e);return c=_("batchPredictionJobs",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Xc(p),h=new ln;return Object.assign(h,m),h})}else{let u=Jc(e);return c=_("batches",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Kc(p),h=new ln;return Object.assign(h,m),h})}}async delete(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Sc(this.apiClient,e);return c=_("batchPredictionJobs/{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>xc(p))}else{let u=Cc(this.apiClient,e);return c=_("batches/{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>Ac(p))}}};function ed(n){let e={},t=r(n,["data"]);if(t!=null&&a(e,["data"],t),r(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f(ed,"blobToMldev$3");function Bs(n){let e={},t=r(n,["parts"]);if(t!=null){let i=t;Array.isArray(i)&&(i=i.map(s=>wd(s))),a(e,["parts"],i)}let o=r(n,["role"]);return o!=null&&a(e,["role"],o),e}f(Bs,"contentToMldev$3");function td(n,e){let t={},o=r(n,["ttl"]);e!==void 0&&o!=null&&a(e,["ttl"],o);let i=r(n,["expireTime"]);e!==void 0&&i!=null&&a(e,["expireTime"],i);let s=r(n,["displayName"]);e!==void 0&&s!=null&&a(e,["displayName"],s);let l=r(n,["contents"]);if(e!==void 0&&l!=null){let p=ce(l);Array.isArray(p)&&(p=p.map(m=>Bs(m))),a(e,["contents"],p)}let c=r(n,["systemInstruction"]);e!==void 0&&c!=null&&a(e,["systemInstruction"],Bs(j(c)));let d=r(n,["tools"]);if(e!==void 0&&d!=null){let p=d;Array.isArray(p)&&(p=p.map(m=>Cd(m))),a(e,["tools"],p)}let u=r(n,["toolConfig"]);if(e!==void 0&&u!=null&&a(e,["toolConfig"],_d(u)),r(n,["kmsKeyName"])!==void 0)throw new Error("kmsKeyName parameter is not supported in Gemini API.");return t}f(td,"createCachedContentConfigToMldev");function nd(n,e){let t={},o=r(n,["ttl"]);e!==void 0&&o!=null&&a(e,["ttl"],o);let i=r(n,["expireTime"]);e!==void 0&&i!=null&&a(e,["expireTime"],i);let s=r(n,["displayName"]);e!==void 0&&s!=null&&a(e,["displayName"],s);let l=r(n,["contents"]);if(e!==void 0&&l!=null){let m=ce(l);Array.isArray(m)&&(m=m.map(h=>h)),a(e,["contents"],m)}let c=r(n,["systemInstruction"]);e!==void 0&&c!=null&&a(e,["systemInstruction"],j(c));let d=r(n,["tools"]);if(e!==void 0&&d!=null){let m=d;Array.isArray(m)&&(m=m.map(h=>Sd(h))),a(e,["tools"],m)}let u=r(n,["toolConfig"]);e!==void 0&&u!=null&&a(e,["toolConfig"],u);let p=r(n,["kmsKeyName"]);return e!==void 0&&p!=null&&a(e,["encryption_spec","kmsKeyName"],p),t}f(nd,"createCachedContentConfigToVertex");function od(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["model"],ua(n,o));let i=r(e,["config"]);return i!=null&&td(i,t),t}f(od,"createCachedContentParametersToMldev");function id(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["model"],ua(n,o));let i=r(e,["config"]);return i!=null&&nd(i,t),t}f(id,"createCachedContentParametersToVertex");function rd(n,e){let t={},o=r(e,["name"]);return o!=null&&a(t,["_url","name"],Ae(n,o)),t}f(rd,"deleteCachedContentParametersToMldev");function sd(n,e){let t={},o=r(e,["name"]);return o!=null&&a(t,["_url","name"],Ae(n,o)),t}f(sd,"deleteCachedContentParametersToVertex");function ad(n){let e={},t=r(n,["sdkHttpResponse"]);return t!=null&&a(e,["sdkHttpResponse"],t),e}f(ad,"deleteCachedContentResponseFromMldev");function ld(n){let e={},t=r(n,["sdkHttpResponse"]);return t!=null&&a(e,["sdkHttpResponse"],t),e}f(ld,"deleteCachedContentResponseFromVertex");function cd(n){let e={};if(r(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");let t=r(n,["fileUri"]);t!=null&&a(e,["fileUri"],t);let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f(cd,"fileDataToMldev$3");function dd(n){let e={},t=r(n,["id"]);t!=null&&a(e,["id"],t);let o=r(n,["args"]);o!=null&&a(e,["args"],o);let i=r(n,["name"]);if(i!=null&&a(e,["name"],i),r(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(r(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}f(dd,"functionCallToMldev$3");function ud(n){let e={},t=r(n,["mode"]);t!=null&&a(e,["mode"],t);let o=r(n,["allowedFunctionNames"]);if(o!=null&&a(e,["allowedFunctionNames"],o),r(n,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}f(ud,"functionCallingConfigToMldev$1");function fd(n){let e={};if(r(n,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");let t=r(n,["description"]);t!=null&&a(e,["description"],t);let o=r(n,["name"]);o!=null&&a(e,["name"],o);let i=r(n,["parameters"]);i!=null&&a(e,["parameters"],i);let s=r(n,["parametersJsonSchema"]);s!=null&&a(e,["parametersJsonSchema"],s);let l=r(n,["response"]);l!=null&&a(e,["response"],l);let c=r(n,["responseJsonSchema"]);return c!=null&&a(e,["responseJsonSchema"],c),e}f(fd,"functionDeclarationToVertex$2");function pd(n,e){let t={},o=r(e,["name"]);return o!=null&&a(t,["_url","name"],Ae(n,o)),t}f(pd,"getCachedContentParametersToMldev");function md(n,e){let t={},o=r(e,["name"]);return o!=null&&a(t,["_url","name"],Ae(n,o)),t}f(md,"getCachedContentParametersToVertex");function hd(n){let e={};if(r(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");let t=r(n,["enableWidget"]);return t!=null&&a(e,["enableWidget"],t),e}f(hd,"googleMapsToMldev$3");function gd(n){let e={};if(r(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(r(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");let t=r(n,["timeRangeFilter"]);return t!=null&&a(e,["timeRangeFilter"],t),e}f(gd,"googleSearchToMldev$3");function bd(n,e){let t={},o=r(n,["pageSize"]);e!==void 0&&o!=null&&a(e,["_query","pageSize"],o);let i=r(n,["pageToken"]);return e!==void 0&&i!=null&&a(e,["_query","pageToken"],i),t}f(bd,"listCachedContentsConfigToMldev");function yd(n,e){let t={},o=r(n,["pageSize"]);e!==void 0&&o!=null&&a(e,["_query","pageSize"],o);let i=r(n,["pageToken"]);return e!==void 0&&i!=null&&a(e,["_query","pageToken"],i),t}f(yd,"listCachedContentsConfigToVertex");function Ed(n){let e={},t=r(n,["config"]);return t!=null&&bd(t,e),e}f(Ed,"listCachedContentsParametersToMldev");function Id(n){let e={},t=r(n,["config"]);return t!=null&&yd(t,e),e}f(Id,"listCachedContentsParametersToVertex");function vd(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["nextPageToken"]);o!=null&&a(e,["nextPageToken"],o);let i=r(n,["cachedContents"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(l=>l)),a(e,["cachedContents"],s)}return e}f(vd,"listCachedContentsResponseFromMldev");function Td(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["nextPageToken"]);o!=null&&a(e,["nextPageToken"],o);let i=r(n,["cachedContents"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(l=>l)),a(e,["cachedContents"],s)}return e}f(Td,"listCachedContentsResponseFromVertex");function wd(n){let e={},t=r(n,["mediaResolution"]);t!=null&&a(e,["mediaResolution"],t);let o=r(n,["codeExecutionResult"]);o!=null&&a(e,["codeExecutionResult"],o);let i=r(n,["executableCode"]);i!=null&&a(e,["executableCode"],i);let s=r(n,["fileData"]);s!=null&&a(e,["fileData"],cd(s));let l=r(n,["functionCall"]);l!=null&&a(e,["functionCall"],dd(l));let c=r(n,["functionResponse"]);c!=null&&a(e,["functionResponse"],c);let d=r(n,["inlineData"]);d!=null&&a(e,["inlineData"],ed(d));let u=r(n,["text"]);u!=null&&a(e,["text"],u);let p=r(n,["thought"]);p!=null&&a(e,["thought"],p);let m=r(n,["thoughtSignature"]);m!=null&&a(e,["thoughtSignature"],m);let h=r(n,["videoMetadata"]);return h!=null&&a(e,["videoMetadata"],h),e}f(wd,"partToMldev$3");function _d(n){let e={},t=r(n,["functionCallingConfig"]);t!=null&&a(e,["functionCallingConfig"],ud(t));let o=r(n,["retrievalConfig"]);return o!=null&&a(e,["retrievalConfig"],o),e}f(_d,"toolConfigToMldev$1");function Cd(n){let e={},t=r(n,["functionDeclarations"]);if(t!=null){let p=t;Array.isArray(p)&&(p=p.map(m=>m)),a(e,["functionDeclarations"],p)}if(r(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");let o=r(n,["googleSearchRetrieval"]);o!=null&&a(e,["googleSearchRetrieval"],o);let i=r(n,["computerUse"]);i!=null&&a(e,["computerUse"],i);let s=r(n,["fileSearch"]);s!=null&&a(e,["fileSearch"],s);let l=r(n,["codeExecution"]);if(l!=null&&a(e,["codeExecution"],l),r(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");let c=r(n,["googleMaps"]);c!=null&&a(e,["googleMaps"],hd(c));let d=r(n,["googleSearch"]);d!=null&&a(e,["googleSearch"],gd(d));let u=r(n,["urlContext"]);return u!=null&&a(e,["urlContext"],u),e}f(Cd,"toolToMldev$3");function Sd(n){let e={},t=r(n,["functionDeclarations"]);if(t!=null){let m=t;Array.isArray(m)&&(m=m.map(h=>fd(h))),a(e,["functionDeclarations"],m)}let o=r(n,["retrieval"]);o!=null&&a(e,["retrieval"],o);let i=r(n,["googleSearchRetrieval"]);i!=null&&a(e,["googleSearchRetrieval"],i);let s=r(n,["computerUse"]);if(s!=null&&a(e,["computerUse"],s),r(n,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");let l=r(n,["codeExecution"]);l!=null&&a(e,["codeExecution"],l);let c=r(n,["enterpriseWebSearch"]);c!=null&&a(e,["enterpriseWebSearch"],c);let d=r(n,["googleMaps"]);d!=null&&a(e,["googleMaps"],d);let u=r(n,["googleSearch"]);u!=null&&a(e,["googleSearch"],u);let p=r(n,["urlContext"]);return p!=null&&a(e,["urlContext"],p),e}f(Sd,"toolToVertex$2");function Ad(n,e){let t={},o=r(n,["ttl"]);e!==void 0&&o!=null&&a(e,["ttl"],o);let i=r(n,["expireTime"]);return e!==void 0&&i!=null&&a(e,["expireTime"],i),t}f(Ad,"updateCachedContentConfigToMldev");function xd(n,e){let t={},o=r(n,["ttl"]);e!==void 0&&o!=null&&a(e,["ttl"],o);let i=r(n,["expireTime"]);return e!==void 0&&i!=null&&a(e,["expireTime"],i),t}f(xd,"updateCachedContentConfigToVertex");function Pd(n,e){let t={},o=r(e,["name"]);o!=null&&a(t,["_url","name"],Ae(n,o));let i=r(e,["config"]);return i!=null&&Ad(i,t),t}f(Pd,"updateCachedContentParametersToMldev");function Nd(n,e){let t={},o=r(e,["name"]);o!=null&&a(t,["_url","name"],Ae(n,o));let i=r(e,["config"]);return i!=null&&xd(i,t),t}f(Nd,"updateCachedContentParametersToVertex");var $o=class extends he{static{f(this,"Caches")}constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new Se(Ce.PAGED_ITEM_CACHED_CONTENTS,o=>this.listInternal(o),await this.listInternal(t),t)}async create(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=id(this.apiClient,e);return c=_("cachedContents",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json()),l.then(p=>p)}else{let u=od(this.apiClient,e);return c=_("cachedContents",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),l.then(p=>p)}}async get(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=md(this.apiClient,e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json()),l.then(p=>p)}else{let u=pd(this.apiClient,e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),l.then(p=>p)}}async delete(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=sd(this.apiClient,e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=ld(p),h=new sn;return Object.assign(h,m),h})}else{let u=rd(this.apiClient,e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=ad(p),h=new sn;return Object.assign(h,m),h})}}async update(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Nd(this.apiClient,e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"PATCH",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json()),l.then(p=>p)}else{let u=Pd(this.apiClient,e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"PATCH",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),l.then(p=>p)}}async listInternal(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Id(e);return c=_("cachedContents",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Td(p),h=new an;return Object.assign(h,m),h})}else{let u=Ed(e);return c=_("cachedContents",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=vd(p),h=new an;return Object.assign(h,m),h})}}};function dn(n,e){var t={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&e.indexOf(o)<0&&(t[o]=n[o]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,o=Object.getOwnPropertySymbols(n);i<o.length;i++)e.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(n,o[i])&&(t[o[i]]=n[o[i]]);return t}f(dn,"__rest");function Os(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],o=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:f(function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}f(Os,"__values");function N(n){return this instanceof N?(this.v=n,this):new N(n)}f(N,"__await");function pe(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=t.apply(n,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",l),i[Symbol.asyncIterator]=function(){return this},i;function l(g){return function(b){return Promise.resolve(b).then(g,m)}}function c(g,b){o[g]&&(i[g]=function(E){return new Promise(function(I,v){s.push([g,E,I,v])>1||d(g,E)})},b&&(i[g]=b(i[g])))}function d(g,b){try{u(o[g](b))}catch(E){h(s[0][3],E)}}function u(g){g.value instanceof N?Promise.resolve(g.value.v).then(p,m):h(s[0][2],g)}function p(g){d("next",g)}function m(g){d("throw",g)}function h(g,b){g(b),s.shift(),s.length&&d(s[0][0],s[0][1])}}f(pe,"__asyncGenerator");function me(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof Os=="function"?Os(n):n[Symbol.iterator](),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(s){t[s]=n[s]&&function(l){return new Promise(function(c,d){l=n[s](l),i(c,d,l.done,l.value)})}}function i(s,l,c,d){Promise.resolve(d).then(function(u){s({value:u,done:c})},l)}}f(me,"__asyncValues");function Rd(n){var e;if(n.candidates==null||n.candidates.length===0)return!1;let t=(e=n.candidates[0])===null||e===void 0?void 0:e.content;return t===void 0?!1:_a(t)}f(Rd,"isValidResponse");function _a(n){if(n.parts===void 0||n.parts.length===0)return!1;for(let e of n.parts)if(e===void 0||Object.keys(e).length===0)return!1;return!0}f(_a,"isValidContent");function $d(n){if(n.length!==0){for(let e of n)if(e.role!=="user"&&e.role!=="model")throw new Error(`Role must be user or model, but got ${e.role}.`)}}f($d,"validateHistory");function zs(n){if(n===void 0||n.length===0)return[];let e=[],t=n.length,o=0;for(;o<t;)if(n[o].role==="user")e.push(n[o]),o++;else{let i=[],s=!0;for(;o<t&&n[o].role==="model";)i.push(n[o]),s&&!_a(n[o])&&(s=!1),o++;s?e.push(...i):e.pop()}return e}f(zs,"extractCuratedHistory");var Mo=class{static{f(this,"Chats")}constructor(e,t){this.modelsModule=e,this.apiClient=t}create(e){return new Go(this.apiClient,this.modelsModule,e.model,e.config,structuredClone(e.history))}},Go=class{static{f(this,"Chat")}constructor(e,t,o,i={},s=[]){this.apiClient=e,this.modelsModule=t,this.model=o,this.config=i,this.history=s,this.sendPromise=Promise.resolve(),$d(s)}async sendMessage(e){var t;await this.sendPromise;let o=j(e.message),i=this.modelsModule.generateContent({model:this.model,contents:this.getHistory(!0).concat(o),config:(t=e.config)!==null&&t!==void 0?t:this.config});return this.sendPromise=(async()=>{var s,l,c;let d=await i,u=(l=(s=d.candidates)===null||s===void 0?void 0:s[0])===null||l===void 0?void 0:l.content,p=d.automaticFunctionCallingHistory,m=this.getHistory(!0).length,h=[];p!=null&&(h=(c=p.slice(m))!==null&&c!==void 0?c:[]);let g=u?[u]:[];this.recordHistory(o,g,h)})(),await this.sendPromise.catch(()=>{this.sendPromise=Promise.resolve()}),i}async sendMessageStream(e){var t;await this.sendPromise;let o=j(e.message),i=this.modelsModule.generateContentStream({model:this.model,contents:this.getHistory(!0).concat(o),config:(t=e.config)!==null&&t!==void 0?t:this.config});this.sendPromise=i.then(()=>{}).catch(()=>{});let s=await i;return this.processStreamResponse(s,o)}getHistory(e=!1){let t=e?zs(this.history):this.history;return structuredClone(t)}processStreamResponse(e,t){return pe(this,arguments,f(function*(){var i,s,l,c,d,u;let p=[];try{for(var m=!0,h=me(e),g;g=yield N(h.next()),i=g.done,!i;m=!0){c=g.value,m=!1;let b=c;if(Rd(b)){let E=(u=(d=b.candidates)===null||d===void 0?void 0:d[0])===null||u===void 0?void 0:u.content;E!==void 0&&p.push(E)}yield yield N(b)}}catch(b){s={error:b}}finally{try{!m&&!i&&(l=h.return)&&(yield N(l.call(h)))}finally{if(s)throw s.error}}this.recordHistory(t,p)},"processStreamResponse_1"))}recordHistory(e,t,o){let i=[];t.length>0&&t.every(s=>s.role!==void 0)?i=t:i.push({role:"model",parts:[]}),o&&o.length>0?this.history.push(...zs(o)):this.history.push(e),this.history.push(...i)}};var un=class n extends Error{static{f(this,"ApiError")}constructor(e){super(e.message),this.name="ApiError",this.status=e.status,Object.setPrototypeOf(this,n.prototype)}};function Md(n){let e={},t=r(n,["file"]);return t!=null&&a(e,["file"],t),e}f(Md,"createFileParametersToMldev");function Gd(n){let e={},t=r(n,["sdkHttpResponse"]);return t!=null&&a(e,["sdkHttpResponse"],t),e}f(Gd,"createFileResponseFromMldev");function Dd(n){let e={},t=r(n,["name"]);return t!=null&&a(e,["_url","file"],ba(t)),e}f(Dd,"deleteFileParametersToMldev");function Ld(n){let e={},t=r(n,["sdkHttpResponse"]);return t!=null&&a(e,["sdkHttpResponse"],t),e}f(Ld,"deleteFileResponseFromMldev");function kd(n){let e={},t=r(n,["name"]);return t!=null&&a(e,["_url","file"],ba(t)),e}f(kd,"getFileParametersToMldev");function Ud(n,e){let t={},o=r(n,["pageSize"]);e!==void 0&&o!=null&&a(e,["_query","pageSize"],o);let i=r(n,["pageToken"]);return e!==void 0&&i!=null&&a(e,["_query","pageToken"],i),t}f(Ud,"listFilesConfigToMldev");function Fd(n){let e={},t=r(n,["config"]);return t!=null&&Ud(t,e),e}f(Fd,"listFilesParametersToMldev");function Vd(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["nextPageToken"]);o!=null&&a(e,["nextPageToken"],o);let i=r(n,["files"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(l=>l)),a(e,["files"],s)}return e}f(Vd,"listFilesResponseFromMldev");var Do=class extends he{static{f(this,"Files")}constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new Se(Ce.PAGED_ITEM_FILES,o=>this.listInternal(o),await this.listInternal(t),t)}async upload(e){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files. You can share files through a GCS bucket.");return this.apiClient.uploadFile(e.file,e.config).then(t=>t)}async download(e){await this.apiClient.downloadFile(e)}async listInternal(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=Fd(e);return s=_("files",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json().then(u=>{let p=u;return p.sdkHttpResponse={headers:d.headers},p})),i.then(d=>{let u=Vd(d),p=new wo;return Object.assign(p,u),p})}}async createInternal(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=Md(e);return s=_("upload/v1beta/files",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>{let u=Gd(d),p=new _o;return Object.assign(p,u),p})}}async get(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=kd(e);return s=_("files/{file}",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>d)}}async delete(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=Dd(e);return s=_("files/{file}",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json().then(u=>{let p=u;return p.sdkHttpResponse={headers:d.headers},p})),i.then(d=>{let u=Ld(d),p=new Co;return Object.assign(p,u),p})}}};function Kt(n){let e={},t=r(n,["data"]);if(t!=null&&a(e,["data"],t),r(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f(Kt,"blobToMldev$2");function Hd(n){let e={},t=r(n,["parts"]);if(t!=null){let i=t;Array.isArray(i)&&(i=i.map(s=>ou(s))),a(e,["parts"],i)}let o=r(n,["role"]);return o!=null&&a(e,["role"],o),e}f(Hd,"contentToMldev$2");function qd(n){let e={};if(r(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");let t=r(n,["fileUri"]);t!=null&&a(e,["fileUri"],t);let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f(qd,"fileDataToMldev$2");function Bd(n){let e={},t=r(n,["id"]);t!=null&&a(e,["id"],t);let o=r(n,["args"]);o!=null&&a(e,["args"],o);let i=r(n,["name"]);if(i!=null&&a(e,["name"],i),r(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(r(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}f(Bd,"functionCallToMldev$2");function Od(n){let e={};if(r(n,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");let t=r(n,["description"]);t!=null&&a(e,["description"],t);let o=r(n,["name"]);o!=null&&a(e,["name"],o);let i=r(n,["parameters"]);i!=null&&a(e,["parameters"],i);let s=r(n,["parametersJsonSchema"]);s!=null&&a(e,["parametersJsonSchema"],s);let l=r(n,["response"]);l!=null&&a(e,["response"],l);let c=r(n,["responseJsonSchema"]);return c!=null&&a(e,["responseJsonSchema"],c),e}f(Od,"functionDeclarationToVertex$1");function zd(n){let e={},t=r(n,["modelSelectionConfig"]);t!=null&&a(e,["modelConfig"],t);let o=r(n,["responseJsonSchema"]);o!=null&&a(e,["responseJsonSchema"],o);let i=r(n,["audioTimestamp"]);i!=null&&a(e,["audioTimestamp"],i);let s=r(n,["candidateCount"]);s!=null&&a(e,["candidateCount"],s);let l=r(n,["enableAffectiveDialog"]);l!=null&&a(e,["enableAffectiveDialog"],l);let c=r(n,["frequencyPenalty"]);c!=null&&a(e,["frequencyPenalty"],c);let d=r(n,["logprobs"]);d!=null&&a(e,["logprobs"],d);let u=r(n,["maxOutputTokens"]);u!=null&&a(e,["maxOutputTokens"],u);let p=r(n,["mediaResolution"]);p!=null&&a(e,["mediaResolution"],p);let m=r(n,["presencePenalty"]);m!=null&&a(e,["presencePenalty"],m);let h=r(n,["responseLogprobs"]);h!=null&&a(e,["responseLogprobs"],h);let g=r(n,["responseMimeType"]);g!=null&&a(e,["responseMimeType"],g);let b=r(n,["responseModalities"]);b!=null&&a(e,["responseModalities"],b);let E=r(n,["responseSchema"]);E!=null&&a(e,["responseSchema"],E);let I=r(n,["routingConfig"]);I!=null&&a(e,["routingConfig"],I);let v=r(n,["seed"]);v!=null&&a(e,["seed"],v);let T=r(n,["speechConfig"]);T!=null&&a(e,["speechConfig"],Ca(T));let w=r(n,["stopSequences"]);w!=null&&a(e,["stopSequences"],w);let C=r(n,["temperature"]);C!=null&&a(e,["temperature"],C);let S=r(n,["thinkingConfig"]);S!=null&&a(e,["thinkingConfig"],S);let $=r(n,["topK"]);$!=null&&a(e,["topK"],$);let P=r(n,["topP"]);if(P!=null&&a(e,["topP"],P),r(n,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return e}f(zd,"generationConfigToVertex$1");function Jd(n){let e={};if(r(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");let t=r(n,["enableWidget"]);return t!=null&&a(e,["enableWidget"],t),e}f(Jd,"googleMapsToMldev$2");function Wd(n){let e={};if(r(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(r(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");let t=r(n,["timeRangeFilter"]);return t!=null&&a(e,["timeRangeFilter"],t),e}f(Wd,"googleSearchToMldev$2");function Kd(n,e){let t={},o=r(n,["generationConfig"]);e!==void 0&&o!=null&&a(e,["setup","generationConfig"],o);let i=r(n,["responseModalities"]);e!==void 0&&i!=null&&a(e,["setup","generationConfig","responseModalities"],i);let s=r(n,["temperature"]);e!==void 0&&s!=null&&a(e,["setup","generationConfig","temperature"],s);let l=r(n,["topP"]);e!==void 0&&l!=null&&a(e,["setup","generationConfig","topP"],l);let c=r(n,["topK"]);e!==void 0&&c!=null&&a(e,["setup","generationConfig","topK"],c);let d=r(n,["maxOutputTokens"]);e!==void 0&&d!=null&&a(e,["setup","generationConfig","maxOutputTokens"],d);let u=r(n,["mediaResolution"]);e!==void 0&&u!=null&&a(e,["setup","generationConfig","mediaResolution"],u);let p=r(n,["seed"]);e!==void 0&&p!=null&&a(e,["setup","generationConfig","seed"],p);let m=r(n,["speechConfig"]);e!==void 0&&m!=null&&a(e,["setup","generationConfig","speechConfig"],mi(m));let h=r(n,["thinkingConfig"]);e!==void 0&&h!=null&&a(e,["setup","generationConfig","thinkingConfig"],h);let g=r(n,["enableAffectiveDialog"]);e!==void 0&&g!=null&&a(e,["setup","generationConfig","enableAffectiveDialog"],g);let b=r(n,["systemInstruction"]);e!==void 0&&b!=null&&a(e,["setup","systemInstruction"],Hd(j(b)));let E=r(n,["tools"]);if(e!==void 0&&E!=null){let $=ft(E);Array.isArray($)&&($=$.map(P=>ru(ut(P)))),a(e,["setup","tools"],$)}let I=r(n,["sessionResumption"]);e!==void 0&&I!=null&&a(e,["setup","sessionResumption"],iu(I));let v=r(n,["inputAudioTranscription"]);e!==void 0&&v!=null&&a(e,["setup","inputAudioTranscription"],v);let T=r(n,["outputAudioTranscription"]);e!==void 0&&T!=null&&a(e,["setup","outputAudioTranscription"],T);let w=r(n,["realtimeInputConfig"]);e!==void 0&&w!=null&&a(e,["setup","realtimeInputConfig"],w);let C=r(n,["contextWindowCompression"]);e!==void 0&&C!=null&&a(e,["setup","contextWindowCompression"],C);let S=r(n,["proactivity"]);if(e!==void 0&&S!=null&&a(e,["setup","proactivity"],S),r(n,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return t}f(Kd,"liveConnectConfigToMldev$1");function Xd(n,e){let t={},o=r(n,["generationConfig"]);e!==void 0&&o!=null&&a(e,["setup","generationConfig"],zd(o));let i=r(n,["responseModalities"]);e!==void 0&&i!=null&&a(e,["setup","generationConfig","responseModalities"],i);let s=r(n,["temperature"]);e!==void 0&&s!=null&&a(e,["setup","generationConfig","temperature"],s);let l=r(n,["topP"]);e!==void 0&&l!=null&&a(e,["setup","generationConfig","topP"],l);let c=r(n,["topK"]);e!==void 0&&c!=null&&a(e,["setup","generationConfig","topK"],c);let d=r(n,["maxOutputTokens"]);e!==void 0&&d!=null&&a(e,["setup","generationConfig","maxOutputTokens"],d);let u=r(n,["mediaResolution"]);e!==void 0&&u!=null&&a(e,["setup","generationConfig","mediaResolution"],u);let p=r(n,["seed"]);e!==void 0&&p!=null&&a(e,["setup","generationConfig","seed"],p);let m=r(n,["speechConfig"]);e!==void 0&&m!=null&&a(e,["setup","generationConfig","speechConfig"],Ca(mi(m)));let h=r(n,["thinkingConfig"]);e!==void 0&&h!=null&&a(e,["setup","generationConfig","thinkingConfig"],h);let g=r(n,["enableAffectiveDialog"]);e!==void 0&&g!=null&&a(e,["setup","generationConfig","enableAffectiveDialog"],g);let b=r(n,["systemInstruction"]);e!==void 0&&b!=null&&a(e,["setup","systemInstruction"],j(b));let E=r(n,["tools"]);if(e!==void 0&&E!=null){let P=ft(E);Array.isArray(P)&&(P=P.map(F=>su(ut(F)))),a(e,["setup","tools"],P)}let I=r(n,["sessionResumption"]);e!==void 0&&I!=null&&a(e,["setup","sessionResumption"],I);let v=r(n,["inputAudioTranscription"]);e!==void 0&&v!=null&&a(e,["setup","inputAudioTranscription"],v);let T=r(n,["outputAudioTranscription"]);e!==void 0&&T!=null&&a(e,["setup","outputAudioTranscription"],T);let w=r(n,["realtimeInputConfig"]);e!==void 0&&w!=null&&a(e,["setup","realtimeInputConfig"],w);let C=r(n,["contextWindowCompression"]);e!==void 0&&C!=null&&a(e,["setup","contextWindowCompression"],C);let S=r(n,["proactivity"]);e!==void 0&&S!=null&&a(e,["setup","proactivity"],S);let $=r(n,["explicitVadSignal"]);return e!==void 0&&$!=null&&a(e,["setup","explicitVadSignal"],$),t}f(Xd,"liveConnectConfigToVertex");function Yd(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["setup","model"],L(n,o));let i=r(e,["config"]);return i!=null&&a(t,["config"],Kd(i,t)),t}f(Yd,"liveConnectParametersToMldev");function Qd(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["setup","model"],L(n,o));let i=r(e,["config"]);return i!=null&&a(t,["config"],Xd(i,t)),t}f(Qd,"liveConnectParametersToVertex");function Zd(n){let e={},t=r(n,["musicGenerationConfig"]);return t!=null&&a(e,["musicGenerationConfig"],t),e}f(Zd,"liveMusicSetConfigParametersToMldev");function jd(n){let e={},t=r(n,["weightedPrompts"]);if(t!=null){let o=t;Array.isArray(o)&&(o=o.map(i=>i)),a(e,["weightedPrompts"],o)}return e}f(jd,"liveMusicSetWeightedPromptsParametersToMldev");function eu(n){let e={},t=r(n,["media"]);if(t!=null){let u=fa(t);Array.isArray(u)&&(u=u.map(p=>Kt(p))),a(e,["mediaChunks"],u)}let o=r(n,["audio"]);o!=null&&a(e,["audio"],Kt(ma(o)));let i=r(n,["audioStreamEnd"]);i!=null&&a(e,["audioStreamEnd"],i);let s=r(n,["video"]);s!=null&&a(e,["video"],Kt(pa(s)));let l=r(n,["text"]);l!=null&&a(e,["text"],l);let c=r(n,["activityStart"]);c!=null&&a(e,["activityStart"],c);let d=r(n,["activityEnd"]);return d!=null&&a(e,["activityEnd"],d),e}f(eu,"liveSendRealtimeInputParametersToMldev");function tu(n){let e={},t=r(n,["media"]);if(t!=null){let u=fa(t);Array.isArray(u)&&(u=u.map(p=>p)),a(e,["mediaChunks"],u)}let o=r(n,["audio"]);o!=null&&a(e,["audio"],ma(o));let i=r(n,["audioStreamEnd"]);i!=null&&a(e,["audioStreamEnd"],i);let s=r(n,["video"]);s!=null&&a(e,["video"],pa(s));let l=r(n,["text"]);l!=null&&a(e,["text"],l);let c=r(n,["activityStart"]);c!=null&&a(e,["activityStart"],c);let d=r(n,["activityEnd"]);return d!=null&&a(e,["activityEnd"],d),e}f(tu,"liveSendRealtimeInputParametersToVertex");function nu(n){let e={},t=r(n,["setupComplete"]);t!=null&&a(e,["setupComplete"],t);let o=r(n,["serverContent"]);o!=null&&a(e,["serverContent"],o);let i=r(n,["toolCall"]);i!=null&&a(e,["toolCall"],i);let s=r(n,["toolCallCancellation"]);s!=null&&a(e,["toolCallCancellation"],s);let l=r(n,["usageMetadata"]);l!=null&&a(e,["usageMetadata"],au(l));let c=r(n,["goAway"]);c!=null&&a(e,["goAway"],c);let d=r(n,["sessionResumptionUpdate"]);d!=null&&a(e,["sessionResumptionUpdate"],d);let u=r(n,["voiceActivityDetectionSignal"]);return u!=null&&a(e,["voiceActivityDetectionSignal"],u),e}f(nu,"liveServerMessageFromVertex");function ou(n){let e={},t=r(n,["mediaResolution"]);t!=null&&a(e,["mediaResolution"],t);let o=r(n,["codeExecutionResult"]);o!=null&&a(e,["codeExecutionResult"],o);let i=r(n,["executableCode"]);i!=null&&a(e,["executableCode"],i);let s=r(n,["fileData"]);s!=null&&a(e,["fileData"],qd(s));let l=r(n,["functionCall"]);l!=null&&a(e,["functionCall"],Bd(l));let c=r(n,["functionResponse"]);c!=null&&a(e,["functionResponse"],c);let d=r(n,["inlineData"]);d!=null&&a(e,["inlineData"],Kt(d));let u=r(n,["text"]);u!=null&&a(e,["text"],u);let p=r(n,["thought"]);p!=null&&a(e,["thought"],p);let m=r(n,["thoughtSignature"]);m!=null&&a(e,["thoughtSignature"],m);let h=r(n,["videoMetadata"]);return h!=null&&a(e,["videoMetadata"],h),e}f(ou,"partToMldev$2");function iu(n){let e={},t=r(n,["handle"]);if(t!=null&&a(e,["handle"],t),r(n,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return e}f(iu,"sessionResumptionConfigToMldev$1");function Ca(n){let e={},t=r(n,["voiceConfig"]);t!=null&&a(e,["voiceConfig"],t);let o=r(n,["languageCode"]);if(o!=null&&a(e,["languageCode"],o),r(n,["multiSpeakerVoiceConfig"])!==void 0)throw new Error("multiSpeakerVoiceConfig parameter is not supported in Vertex AI.");return e}f(Ca,"speechConfigToVertex$1");function ru(n){let e={},t=r(n,["functionDeclarations"]);if(t!=null){let p=t;Array.isArray(p)&&(p=p.map(m=>m)),a(e,["functionDeclarations"],p)}if(r(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");let o=r(n,["googleSearchRetrieval"]);o!=null&&a(e,["googleSearchRetrieval"],o);let i=r(n,["computerUse"]);i!=null&&a(e,["computerUse"],i);let s=r(n,["fileSearch"]);s!=null&&a(e,["fileSearch"],s);let l=r(n,["codeExecution"]);if(l!=null&&a(e,["codeExecution"],l),r(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");let c=r(n,["googleMaps"]);c!=null&&a(e,["googleMaps"],Jd(c));let d=r(n,["googleSearch"]);d!=null&&a(e,["googleSearch"],Wd(d));let u=r(n,["urlContext"]);return u!=null&&a(e,["urlContext"],u),e}f(ru,"toolToMldev$2");function su(n){let e={},t=r(n,["functionDeclarations"]);if(t!=null){let m=t;Array.isArray(m)&&(m=m.map(h=>Od(h))),a(e,["functionDeclarations"],m)}let o=r(n,["retrieval"]);o!=null&&a(e,["retrieval"],o);let i=r(n,["googleSearchRetrieval"]);i!=null&&a(e,["googleSearchRetrieval"],i);let s=r(n,["computerUse"]);if(s!=null&&a(e,["computerUse"],s),r(n,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");let l=r(n,["codeExecution"]);l!=null&&a(e,["codeExecution"],l);let c=r(n,["enterpriseWebSearch"]);c!=null&&a(e,["enterpriseWebSearch"],c);let d=r(n,["googleMaps"]);d!=null&&a(e,["googleMaps"],d);let u=r(n,["googleSearch"]);u!=null&&a(e,["googleSearch"],u);let p=r(n,["urlContext"]);return p!=null&&a(e,["urlContext"],p),e}f(su,"toolToVertex$1");function au(n){let e={},t=r(n,["promptTokenCount"]);t!=null&&a(e,["promptTokenCount"],t);let o=r(n,["cachedContentTokenCount"]);o!=null&&a(e,["cachedContentTokenCount"],o);let i=r(n,["candidatesTokenCount"]);i!=null&&a(e,["responseTokenCount"],i);let s=r(n,["toolUsePromptTokenCount"]);s!=null&&a(e,["toolUsePromptTokenCount"],s);let l=r(n,["thoughtsTokenCount"]);l!=null&&a(e,["thoughtsTokenCount"],l);let c=r(n,["totalTokenCount"]);c!=null&&a(e,["totalTokenCount"],c);let d=r(n,["promptTokensDetails"]);if(d!=null){let g=d;Array.isArray(g)&&(g=g.map(b=>b)),a(e,["promptTokensDetails"],g)}let u=r(n,["cacheTokensDetails"]);if(u!=null){let g=u;Array.isArray(g)&&(g=g.map(b=>b)),a(e,["cacheTokensDetails"],g)}let p=r(n,["candidatesTokensDetails"]);if(p!=null){let g=p;Array.isArray(g)&&(g=g.map(b=>b)),a(e,["responseTokensDetails"],g)}let m=r(n,["toolUsePromptTokensDetails"]);if(m!=null){let g=m;Array.isArray(g)&&(g=g.map(b=>b)),a(e,["toolUsePromptTokensDetails"],g)}let h=r(n,["trafficType"]);return h!=null&&a(e,["trafficType"],h),e}f(au,"usageMetadataFromVertex");function lu(n){let e={},t=r(n,["data"]);if(t!=null&&a(e,["data"],t),r(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f(lu,"blobToMldev$1");function cu(n){let e={},t=r(n,["content"]);t!=null&&a(e,["content"],t);let o=r(n,["citationMetadata"]);o!=null&&a(e,["citationMetadata"],du(o));let i=r(n,["tokenCount"]);i!=null&&a(e,["tokenCount"],i);let s=r(n,["finishReason"]);s!=null&&a(e,["finishReason"],s);let l=r(n,["avgLogprobs"]);l!=null&&a(e,["avgLogprobs"],l);let c=r(n,["groundingMetadata"]);c!=null&&a(e,["groundingMetadata"],c);let d=r(n,["index"]);d!=null&&a(e,["index"],d);let u=r(n,["logprobsResult"]);u!=null&&a(e,["logprobsResult"],u);let p=r(n,["safetyRatings"]);if(p!=null){let h=p;Array.isArray(h)&&(h=h.map(g=>g)),a(e,["safetyRatings"],h)}let m=r(n,["urlContextMetadata"]);return m!=null&&a(e,["urlContextMetadata"],m),e}f(cu,"candidateFromMldev");function du(n){let e={},t=r(n,["citationSources"]);if(t!=null){let o=t;Array.isArray(o)&&(o=o.map(i=>i)),a(e,["citations"],o)}return e}f(du,"citationMetadataFromMldev");function uu(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["contents"]);if(i!=null){let s=ce(i);Array.isArray(s)&&(s=s.map(l=>l)),a(t,["contents"],s)}return t}f(uu,"computeTokensParametersToVertex");function fu(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["tokensInfo"]);if(o!=null){let i=o;Array.isArray(i)&&(i=i.map(s=>s)),a(e,["tokensInfo"],i)}return e}f(fu,"computeTokensResponseFromVertex");function pu(n){let e={},t=r(n,["values"]);t!=null&&a(e,["values"],t);let o=r(n,["statistics"]);return o!=null&&a(e,["statistics"],mu(o)),e}f(pu,"contentEmbeddingFromVertex");function mu(n){let e={},t=r(n,["truncated"]);t!=null&&a(e,["truncated"],t);let o=r(n,["token_count"]);return o!=null&&a(e,["tokenCount"],o),e}f(mu,"contentEmbeddingStatisticsFromVertex");function An(n){let e={},t=r(n,["parts"]);if(t!=null){let i=t;Array.isArray(i)&&(i=i.map(s=>_f(s))),a(e,["parts"],i)}let o=r(n,["role"]);return o!=null&&a(e,["role"],o),e}f(An,"contentToMldev$1");function hu(n){let e={},t=r(n,["controlType"]);t!=null&&a(e,["controlType"],t);let o=r(n,["enableControlImageComputation"]);return o!=null&&a(e,["computeControl"],o),e}f(hu,"controlReferenceConfigToVertex");function gu(n){let e={};if(r(n,["systemInstruction"])!==void 0)throw new Error("systemInstruction parameter is not supported in Gemini API.");if(r(n,["tools"])!==void 0)throw new Error("tools parameter is not supported in Gemini API.");if(r(n,["generationConfig"])!==void 0)throw new Error("generationConfig parameter is not supported in Gemini API.");return e}f(gu,"countTokensConfigToMldev");function bu(n,e){let t={},o=r(n,["systemInstruction"]);e!==void 0&&o!=null&&a(e,["systemInstruction"],j(o));let i=r(n,["tools"]);if(e!==void 0&&i!=null){let l=i;Array.isArray(l)&&(l=l.map(c=>Na(c))),a(e,["tools"],l)}let s=r(n,["generationConfig"]);return e!==void 0&&s!=null&&a(e,["generationConfig"],cf(s)),t}f(bu,"countTokensConfigToVertex");function yu(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["contents"]);if(i!=null){let l=ce(i);Array.isArray(l)&&(l=l.map(c=>An(c))),a(t,["contents"],l)}let s=r(e,["config"]);return s!=null&&gu(s),t}f(yu,"countTokensParametersToMldev");function Eu(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["contents"]);if(i!=null){let l=ce(i);Array.isArray(l)&&(l=l.map(c=>c)),a(t,["contents"],l)}let s=r(e,["config"]);return s!=null&&bu(s,t),t}f(Eu,"countTokensParametersToVertex");function Iu(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["totalTokens"]);o!=null&&a(e,["totalTokens"],o);let i=r(n,["cachedContentTokenCount"]);return i!=null&&a(e,["cachedContentTokenCount"],i),e}f(Iu,"countTokensResponseFromMldev");function vu(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["totalTokens"]);return o!=null&&a(e,["totalTokens"],o),e}f(vu,"countTokensResponseFromVertex");function Tu(n,e){let t={},o=r(e,["model"]);return o!=null&&a(t,["_url","name"],L(n,o)),t}f(Tu,"deleteModelParametersToMldev");function wu(n,e){let t={},o=r(e,["model"]);return o!=null&&a(t,["_url","name"],L(n,o)),t}f(wu,"deleteModelParametersToVertex");function _u(n){let e={},t=r(n,["sdkHttpResponse"]);return t!=null&&a(e,["sdkHttpResponse"],t),e}f(_u,"deleteModelResponseFromMldev");function Cu(n){let e={},t=r(n,["sdkHttpResponse"]);return t!=null&&a(e,["sdkHttpResponse"],t),e}f(Cu,"deleteModelResponseFromVertex");function Su(n,e){let t={},o=r(n,["outputGcsUri"]);e!==void 0&&o!=null&&a(e,["parameters","storageUri"],o);let i=r(n,["negativePrompt"]);e!==void 0&&i!=null&&a(e,["parameters","negativePrompt"],i);let s=r(n,["numberOfImages"]);e!==void 0&&s!=null&&a(e,["parameters","sampleCount"],s);let l=r(n,["aspectRatio"]);e!==void 0&&l!=null&&a(e,["parameters","aspectRatio"],l);let c=r(n,["guidanceScale"]);e!==void 0&&c!=null&&a(e,["parameters","guidanceScale"],c);let d=r(n,["seed"]);e!==void 0&&d!=null&&a(e,["parameters","seed"],d);let u=r(n,["safetyFilterLevel"]);e!==void 0&&u!=null&&a(e,["parameters","safetySetting"],u);let p=r(n,["personGeneration"]);e!==void 0&&p!=null&&a(e,["parameters","personGeneration"],p);let m=r(n,["includeSafetyAttributes"]);e!==void 0&&m!=null&&a(e,["parameters","includeSafetyAttributes"],m);let h=r(n,["includeRaiReason"]);e!==void 0&&h!=null&&a(e,["parameters","includeRaiReason"],h);let g=r(n,["language"]);e!==void 0&&g!=null&&a(e,["parameters","language"],g);let b=r(n,["outputMimeType"]);e!==void 0&&b!=null&&a(e,["parameters","outputOptions","mimeType"],b);let E=r(n,["outputCompressionQuality"]);e!==void 0&&E!=null&&a(e,["parameters","outputOptions","compressionQuality"],E);let I=r(n,["addWatermark"]);e!==void 0&&I!=null&&a(e,["parameters","addWatermark"],I);let v=r(n,["labels"]);e!==void 0&&v!=null&&a(e,["labels"],v);let T=r(n,["editMode"]);e!==void 0&&T!=null&&a(e,["parameters","editMode"],T);let w=r(n,["baseSteps"]);return e!==void 0&&w!=null&&a(e,["parameters","editConfig","baseSteps"],w),t}f(Su,"editImageConfigToVertex");function Au(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["prompt"]);i!=null&&a(t,["instances[0]","prompt"],i);let s=r(e,["referenceImages"]);if(s!=null){let c=s;Array.isArray(c)&&(c=c.map(d=>Nf(d))),a(t,["instances[0]","referenceImages"],c)}let l=r(e,["config"]);return l!=null&&Su(l,t),t}f(Au,"editImageParametersInternalToVertex");function xu(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["predictions"]);if(o!=null){let i=o;Array.isArray(i)&&(i=i.map(s=>xn(s))),a(e,["generatedImages"],i)}return e}f(xu,"editImageResponseFromVertex");function Pu(n,e){let t={},o=r(n,["taskType"]);e!==void 0&&o!=null&&a(e,["requests[]","taskType"],o);let i=r(n,["title"]);e!==void 0&&i!=null&&a(e,["requests[]","title"],i);let s=r(n,["outputDimensionality"]);if(e!==void 0&&s!=null&&a(e,["requests[]","outputDimensionality"],s),r(n,["mimeType"])!==void 0)throw new Error("mimeType parameter is not supported in Gemini API.");if(r(n,["autoTruncate"])!==void 0)throw new Error("autoTruncate parameter is not supported in Gemini API.");return t}f(Pu,"embedContentConfigToMldev");function Nu(n,e){let t={},o=r(n,["taskType"]);e!==void 0&&o!=null&&a(e,["instances[]","task_type"],o);let i=r(n,["title"]);e!==void 0&&i!=null&&a(e,["instances[]","title"],i);let s=r(n,["outputDimensionality"]);e!==void 0&&s!=null&&a(e,["parameters","outputDimensionality"],s);let l=r(n,["mimeType"]);e!==void 0&&l!=null&&a(e,["instances[]","mimeType"],l);let c=r(n,["autoTruncate"]);return e!==void 0&&c!=null&&a(e,["parameters","autoTruncate"],c),t}f(Nu,"embedContentConfigToVertex");function Ru(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["contents"]);if(i!=null){let c=ui(n,i);Array.isArray(c)&&(c=c.map(d=>d)),a(t,["requests[]","content"],c)}let s=r(e,["config"]);s!=null&&Pu(s,t);let l=r(e,["model"]);return l!==void 0&&a(t,["requests[]","model"],L(n,l)),t}f(Ru,"embedContentParametersToMldev");function $u(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["contents"]);if(i!=null){let l=ui(n,i);Array.isArray(l)&&(l=l.map(c=>c)),a(t,["instances[]","content"],l)}let s=r(e,["config"]);return s!=null&&Nu(s,t),t}f($u,"embedContentParametersToVertex");function Mu(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["embeddings"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(l=>l)),a(e,["embeddings"],s)}let i=r(n,["metadata"]);return i!=null&&a(e,["metadata"],i),e}f(Mu,"embedContentResponseFromMldev");function Gu(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["predictions[]","embeddings"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(l=>pu(l))),a(e,["embeddings"],s)}let i=r(n,["metadata"]);return i!=null&&a(e,["metadata"],i),e}f(Gu,"embedContentResponseFromVertex");function Du(n){let e={},t=r(n,["endpoint"]);t!=null&&a(e,["name"],t);let o=r(n,["deployedModelId"]);return o!=null&&a(e,["deployedModelId"],o),e}f(Du,"endpointFromVertex");function Lu(n){let e={};if(r(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");let t=r(n,["fileUri"]);t!=null&&a(e,["fileUri"],t);let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f(Lu,"fileDataToMldev$1");function ku(n){let e={},t=r(n,["id"]);t!=null&&a(e,["id"],t);let o=r(n,["args"]);o!=null&&a(e,["args"],o);let i=r(n,["name"]);if(i!=null&&a(e,["name"],i),r(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(r(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}f(ku,"functionCallToMldev$1");function Uu(n){let e={},t=r(n,["mode"]);t!=null&&a(e,["mode"],t);let o=r(n,["allowedFunctionNames"]);if(o!=null&&a(e,["allowedFunctionNames"],o),r(n,["streamFunctionCallArguments"])!==void 0)throw new Error("streamFunctionCallArguments parameter is not supported in Gemini API.");return e}f(Uu,"functionCallingConfigToMldev");function Fu(n){let e={};if(r(n,["behavior"])!==void 0)throw new Error("behavior parameter is not supported in Vertex AI.");let t=r(n,["description"]);t!=null&&a(e,["description"],t);let o=r(n,["name"]);o!=null&&a(e,["name"],o);let i=r(n,["parameters"]);i!=null&&a(e,["parameters"],i);let s=r(n,["parametersJsonSchema"]);s!=null&&a(e,["parametersJsonSchema"],s);let l=r(n,["response"]);l!=null&&a(e,["response"],l);let c=r(n,["responseJsonSchema"]);return c!=null&&a(e,["responseJsonSchema"],c),e}f(Fu,"functionDeclarationToVertex");function Vu(n,e,t){let o={},i=r(e,["systemInstruction"]);t!==void 0&&i!=null&&a(t,["systemInstruction"],An(j(i)));let s=r(e,["temperature"]);s!=null&&a(o,["temperature"],s);let l=r(e,["topP"]);l!=null&&a(o,["topP"],l);let c=r(e,["topK"]);c!=null&&a(o,["topK"],c);let d=r(e,["candidateCount"]);d!=null&&a(o,["candidateCount"],d);let u=r(e,["maxOutputTokens"]);u!=null&&a(o,["maxOutputTokens"],u);let p=r(e,["stopSequences"]);p!=null&&a(o,["stopSequences"],p);let m=r(e,["responseLogprobs"]);m!=null&&a(o,["responseLogprobs"],m);let h=r(e,["logprobs"]);h!=null&&a(o,["logprobs"],h);let g=r(e,["presencePenalty"]);g!=null&&a(o,["presencePenalty"],g);let b=r(e,["frequencyPenalty"]);b!=null&&a(o,["frequencyPenalty"],b);let E=r(e,["seed"]);E!=null&&a(o,["seed"],E);let I=r(e,["responseMimeType"]);I!=null&&a(o,["responseMimeType"],I);let v=r(e,["responseSchema"]);v!=null&&a(o,["responseSchema"],fi(v));let T=r(e,["responseJsonSchema"]);if(T!=null&&a(o,["responseJsonSchema"],T),r(e,["routingConfig"])!==void 0)throw new Error("routingConfig parameter is not supported in Gemini API.");if(r(e,["modelSelectionConfig"])!==void 0)throw new Error("modelSelectionConfig parameter is not supported in Gemini API.");let w=r(e,["safetySettings"]);if(t!==void 0&&w!=null){let H=w;Array.isArray(H)&&(H=H.map(be=>Rf(be))),a(t,["safetySettings"],H)}let C=r(e,["tools"]);if(t!==void 0&&C!=null){let H=ft(C);Array.isArray(H)&&(H=H.map(be=>Uf(ut(be)))),a(t,["tools"],H)}let S=r(e,["toolConfig"]);if(t!==void 0&&S!=null&&a(t,["toolConfig"],kf(S)),r(e,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");let $=r(e,["cachedContent"]);t!==void 0&&$!=null&&a(t,["cachedContent"],Ae(n,$));let P=r(e,["responseModalities"]);P!=null&&a(o,["responseModalities"],P);let F=r(e,["mediaResolution"]);F!=null&&a(o,["mediaResolution"],F);let A=r(e,["speechConfig"]);if(A!=null&&a(o,["speechConfig"],pi(A)),r(e,["audioTimestamp"])!==void 0)throw new Error("audioTimestamp parameter is not supported in Gemini API.");let G=r(e,["thinkingConfig"]);G!=null&&a(o,["thinkingConfig"],G);let B=r(e,["imageConfig"]);B!=null&&a(o,["imageConfig"],mf(B));let ve=r(e,["enableEnhancedCivicAnswers"]);return ve!=null&&a(o,["enableEnhancedCivicAnswers"],ve),o}f(Vu,"generateContentConfigToMldev");function Hu(n,e,t){let o={},i=r(e,["systemInstruction"]);t!==void 0&&i!=null&&a(t,["systemInstruction"],j(i));let s=r(e,["temperature"]);s!=null&&a(o,["temperature"],s);let l=r(e,["topP"]);l!=null&&a(o,["topP"],l);let c=r(e,["topK"]);c!=null&&a(o,["topK"],c);let d=r(e,["candidateCount"]);d!=null&&a(o,["candidateCount"],d);let u=r(e,["maxOutputTokens"]);u!=null&&a(o,["maxOutputTokens"],u);let p=r(e,["stopSequences"]);p!=null&&a(o,["stopSequences"],p);let m=r(e,["responseLogprobs"]);m!=null&&a(o,["responseLogprobs"],m);let h=r(e,["logprobs"]);h!=null&&a(o,["logprobs"],h);let g=r(e,["presencePenalty"]);g!=null&&a(o,["presencePenalty"],g);let b=r(e,["frequencyPenalty"]);b!=null&&a(o,["frequencyPenalty"],b);let E=r(e,["seed"]);E!=null&&a(o,["seed"],E);let I=r(e,["responseMimeType"]);I!=null&&a(o,["responseMimeType"],I);let v=r(e,["responseSchema"]);v!=null&&a(o,["responseSchema"],fi(v));let T=r(e,["responseJsonSchema"]);T!=null&&a(o,["responseJsonSchema"],T);let w=r(e,["routingConfig"]);w!=null&&a(o,["routingConfig"],w);let C=r(e,["modelSelectionConfig"]);C!=null&&a(o,["modelConfig"],C);let S=r(e,["safetySettings"]);if(t!==void 0&&S!=null){let Te=S;Array.isArray(Te)&&(Te=Te.map(Bn=>Bn)),a(t,["safetySettings"],Te)}let $=r(e,["tools"]);if(t!==void 0&&$!=null){let Te=ft($);Array.isArray(Te)&&(Te=Te.map(Bn=>Na(ut(Bn)))),a(t,["tools"],Te)}let P=r(e,["toolConfig"]);t!==void 0&&P!=null&&a(t,["toolConfig"],P);let F=r(e,["labels"]);t!==void 0&&F!=null&&a(t,["labels"],F);let A=r(e,["cachedContent"]);t!==void 0&&A!=null&&a(t,["cachedContent"],Ae(n,A));let G=r(e,["responseModalities"]);G!=null&&a(o,["responseModalities"],G);let B=r(e,["mediaResolution"]);B!=null&&a(o,["mediaResolution"],B);let ve=r(e,["speechConfig"]);ve!=null&&a(o,["speechConfig"],Pa(pi(ve)));let H=r(e,["audioTimestamp"]);H!=null&&a(o,["audioTimestamp"],H);let be=r(e,["thinkingConfig"]);be!=null&&a(o,["thinkingConfig"],be);let Ri=r(e,["imageConfig"]);if(Ri!=null&&a(o,["imageConfig"],hf(Ri)),r(e,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return o}f(Hu,"generateContentConfigToVertex");function Js(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["contents"]);if(i!=null){let l=ce(i);Array.isArray(l)&&(l=l.map(c=>An(c))),a(t,["contents"],l)}let s=r(e,["config"]);return s!=null&&a(t,["generationConfig"],Vu(n,s,t)),t}f(Js,"generateContentParametersToMldev");function Ws(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["contents"]);if(i!=null){let l=ce(i);Array.isArray(l)&&(l=l.map(c=>c)),a(t,["contents"],l)}let s=r(e,["config"]);return s!=null&&a(t,["generationConfig"],Hu(n,s,t)),t}f(Ws,"generateContentParametersToVertex");function Ks(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["candidates"]);if(o!=null){let d=o;Array.isArray(d)&&(d=d.map(u=>cu(u))),a(e,["candidates"],d)}let i=r(n,["modelVersion"]);i!=null&&a(e,["modelVersion"],i);let s=r(n,["promptFeedback"]);s!=null&&a(e,["promptFeedback"],s);let l=r(n,["responseId"]);l!=null&&a(e,["responseId"],l);let c=r(n,["usageMetadata"]);return c!=null&&a(e,["usageMetadata"],c),e}f(Ks,"generateContentResponseFromMldev");function Xs(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["candidates"]);if(o!=null){let u=o;Array.isArray(u)&&(u=u.map(p=>p)),a(e,["candidates"],u)}let i=r(n,["createTime"]);i!=null&&a(e,["createTime"],i);let s=r(n,["modelVersion"]);s!=null&&a(e,["modelVersion"],s);let l=r(n,["promptFeedback"]);l!=null&&a(e,["promptFeedback"],l);let c=r(n,["responseId"]);c!=null&&a(e,["responseId"],c);let d=r(n,["usageMetadata"]);return d!=null&&a(e,["usageMetadata"],d),e}f(Xs,"generateContentResponseFromVertex");function qu(n,e){let t={};if(r(n,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(r(n,["negativePrompt"])!==void 0)throw new Error("negativePrompt parameter is not supported in Gemini API.");let o=r(n,["numberOfImages"]);e!==void 0&&o!=null&&a(e,["parameters","sampleCount"],o);let i=r(n,["aspectRatio"]);e!==void 0&&i!=null&&a(e,["parameters","aspectRatio"],i);let s=r(n,["guidanceScale"]);if(e!==void 0&&s!=null&&a(e,["parameters","guidanceScale"],s),r(n,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");let l=r(n,["safetyFilterLevel"]);e!==void 0&&l!=null&&a(e,["parameters","safetySetting"],l);let c=r(n,["personGeneration"]);e!==void 0&&c!=null&&a(e,["parameters","personGeneration"],c);let d=r(n,["includeSafetyAttributes"]);e!==void 0&&d!=null&&a(e,["parameters","includeSafetyAttributes"],d);let u=r(n,["includeRaiReason"]);e!==void 0&&u!=null&&a(e,["parameters","includeRaiReason"],u);let p=r(n,["language"]);e!==void 0&&p!=null&&a(e,["parameters","language"],p);let m=r(n,["outputMimeType"]);e!==void 0&&m!=null&&a(e,["parameters","outputOptions","mimeType"],m);let h=r(n,["outputCompressionQuality"]);if(e!==void 0&&h!=null&&a(e,["parameters","outputOptions","compressionQuality"],h),r(n,["addWatermark"])!==void 0)throw new Error("addWatermark parameter is not supported in Gemini API.");if(r(n,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");let g=r(n,["imageSize"]);if(e!==void 0&&g!=null&&a(e,["parameters","sampleImageSize"],g),r(n,["enhancePrompt"])!==void 0)throw new Error("enhancePrompt parameter is not supported in Gemini API.");return t}f(qu,"generateImagesConfigToMldev");function Bu(n,e){let t={},o=r(n,["outputGcsUri"]);e!==void 0&&o!=null&&a(e,["parameters","storageUri"],o);let i=r(n,["negativePrompt"]);e!==void 0&&i!=null&&a(e,["parameters","negativePrompt"],i);let s=r(n,["numberOfImages"]);e!==void 0&&s!=null&&a(e,["parameters","sampleCount"],s);let l=r(n,["aspectRatio"]);e!==void 0&&l!=null&&a(e,["parameters","aspectRatio"],l);let c=r(n,["guidanceScale"]);e!==void 0&&c!=null&&a(e,["parameters","guidanceScale"],c);let d=r(n,["seed"]);e!==void 0&&d!=null&&a(e,["parameters","seed"],d);let u=r(n,["safetyFilterLevel"]);e!==void 0&&u!=null&&a(e,["parameters","safetySetting"],u);let p=r(n,["personGeneration"]);e!==void 0&&p!=null&&a(e,["parameters","personGeneration"],p);let m=r(n,["includeSafetyAttributes"]);e!==void 0&&m!=null&&a(e,["parameters","includeSafetyAttributes"],m);let h=r(n,["includeRaiReason"]);e!==void 0&&h!=null&&a(e,["parameters","includeRaiReason"],h);let g=r(n,["language"]);e!==void 0&&g!=null&&a(e,["parameters","language"],g);let b=r(n,["outputMimeType"]);e!==void 0&&b!=null&&a(e,["parameters","outputOptions","mimeType"],b);let E=r(n,["outputCompressionQuality"]);e!==void 0&&E!=null&&a(e,["parameters","outputOptions","compressionQuality"],E);let I=r(n,["addWatermark"]);e!==void 0&&I!=null&&a(e,["parameters","addWatermark"],I);let v=r(n,["labels"]);e!==void 0&&v!=null&&a(e,["labels"],v);let T=r(n,["imageSize"]);e!==void 0&&T!=null&&a(e,["parameters","sampleImageSize"],T);let w=r(n,["enhancePrompt"]);return e!==void 0&&w!=null&&a(e,["parameters","enhancePrompt"],w),t}f(Bu,"generateImagesConfigToVertex");function Ou(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["prompt"]);i!=null&&a(t,["instances[0]","prompt"],i);let s=r(e,["config"]);return s!=null&&qu(s,t),t}f(Ou,"generateImagesParametersToMldev");function zu(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["prompt"]);i!=null&&a(t,["instances[0]","prompt"],i);let s=r(e,["config"]);return s!=null&&Bu(s,t),t}f(zu,"generateImagesParametersToVertex");function Ju(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["predictions"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(l=>rf(l))),a(e,["generatedImages"],s)}let i=r(n,["positivePromptSafetyAttributes"]);return i!=null&&a(e,["positivePromptSafetyAttributes"],Aa(i)),e}f(Ju,"generateImagesResponseFromMldev");function Wu(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["predictions"]);if(o!=null){let s=o;Array.isArray(s)&&(s=s.map(l=>xn(l))),a(e,["generatedImages"],s)}let i=r(n,["positivePromptSafetyAttributes"]);return i!=null&&a(e,["positivePromptSafetyAttributes"],xa(i)),e}f(Wu,"generateImagesResponseFromVertex");function Ku(n,e){let t={},o=r(n,["numberOfVideos"]);if(e!==void 0&&o!=null&&a(e,["parameters","sampleCount"],o),r(n,["outputGcsUri"])!==void 0)throw new Error("outputGcsUri parameter is not supported in Gemini API.");if(r(n,["fps"])!==void 0)throw new Error("fps parameter is not supported in Gemini API.");let i=r(n,["durationSeconds"]);if(e!==void 0&&i!=null&&a(e,["parameters","durationSeconds"],i),r(n,["seed"])!==void 0)throw new Error("seed parameter is not supported in Gemini API.");let s=r(n,["aspectRatio"]);e!==void 0&&s!=null&&a(e,["parameters","aspectRatio"],s);let l=r(n,["resolution"]);e!==void 0&&l!=null&&a(e,["parameters","resolution"],l);let c=r(n,["personGeneration"]);if(e!==void 0&&c!=null&&a(e,["parameters","personGeneration"],c),r(n,["pubsubTopic"])!==void 0)throw new Error("pubsubTopic parameter is not supported in Gemini API.");let d=r(n,["negativePrompt"]);e!==void 0&&d!=null&&a(e,["parameters","negativePrompt"],d);let u=r(n,["enhancePrompt"]);if(e!==void 0&&u!=null&&a(e,["parameters","enhancePrompt"],u),r(n,["generateAudio"])!==void 0)throw new Error("generateAudio parameter is not supported in Gemini API.");let p=r(n,["lastFrame"]);e!==void 0&&p!=null&&a(e,["instances[0]","lastFrame"],Pn(p));let m=r(n,["referenceImages"]);if(e!==void 0&&m!=null){let h=m;Array.isArray(h)&&(h=h.map(g=>Qf(g))),a(e,["instances[0]","referenceImages"],h)}if(r(n,["mask"])!==void 0)throw new Error("mask parameter is not supported in Gemini API.");if(r(n,["compressionQuality"])!==void 0)throw new Error("compressionQuality parameter is not supported in Gemini API.");return t}f(Ku,"generateVideosConfigToMldev");function Xu(n,e){let t={},o=r(n,["numberOfVideos"]);e!==void 0&&o!=null&&a(e,["parameters","sampleCount"],o);let i=r(n,["outputGcsUri"]);e!==void 0&&i!=null&&a(e,["parameters","storageUri"],i);let s=r(n,["fps"]);e!==void 0&&s!=null&&a(e,["parameters","fps"],s);let l=r(n,["durationSeconds"]);e!==void 0&&l!=null&&a(e,["parameters","durationSeconds"],l);let c=r(n,["seed"]);e!==void 0&&c!=null&&a(e,["parameters","seed"],c);let d=r(n,["aspectRatio"]);e!==void 0&&d!=null&&a(e,["parameters","aspectRatio"],d);let u=r(n,["resolution"]);e!==void 0&&u!=null&&a(e,["parameters","resolution"],u);let p=r(n,["personGeneration"]);e!==void 0&&p!=null&&a(e,["parameters","personGeneration"],p);let m=r(n,["pubsubTopic"]);e!==void 0&&m!=null&&a(e,["parameters","pubsubTopic"],m);let h=r(n,["negativePrompt"]);e!==void 0&&h!=null&&a(e,["parameters","negativePrompt"],h);let g=r(n,["enhancePrompt"]);e!==void 0&&g!=null&&a(e,["parameters","enhancePrompt"],g);let b=r(n,["generateAudio"]);e!==void 0&&b!=null&&a(e,["parameters","generateAudio"],b);let E=r(n,["lastFrame"]);e!==void 0&&E!=null&&a(e,["instances[0]","lastFrame"],ge(E));let I=r(n,["referenceImages"]);if(e!==void 0&&I!=null){let w=I;Array.isArray(w)&&(w=w.map(C=>Zf(C))),a(e,["instances[0]","referenceImages"],w)}let v=r(n,["mask"]);e!==void 0&&v!=null&&a(e,["instances[0]","mask"],Yf(v));let T=r(n,["compressionQuality"]);return e!==void 0&&T!=null&&a(e,["parameters","compressionQuality"],T),t}f(Xu,"generateVideosConfigToVertex");function Yu(n){let e={},t=r(n,["name"]);t!=null&&a(e,["name"],t);let o=r(n,["metadata"]);o!=null&&a(e,["metadata"],o);let i=r(n,["done"]);i!=null&&a(e,["done"],i);let s=r(n,["error"]);s!=null&&a(e,["error"],s);let l=r(n,["response","generateVideoResponse"]);return l!=null&&a(e,["response"],ef(l)),e}f(Yu,"generateVideosOperationFromMldev");function Qu(n){let e={},t=r(n,["name"]);t!=null&&a(e,["name"],t);let o=r(n,["metadata"]);o!=null&&a(e,["metadata"],o);let i=r(n,["done"]);i!=null&&a(e,["done"],i);let s=r(n,["error"]);s!=null&&a(e,["error"],s);let l=r(n,["response"]);return l!=null&&a(e,["response"],tf(l)),e}f(Qu,"generateVideosOperationFromVertex");function Zu(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["prompt"]);i!=null&&a(t,["instances[0]","prompt"],i);let s=r(e,["image"]);s!=null&&a(t,["instances[0]","image"],Pn(s));let l=r(e,["video"]);l!=null&&a(t,["instances[0]","video"],Ra(l));let c=r(e,["source"]);c!=null&&nf(c,t);let d=r(e,["config"]);return d!=null&&Ku(d,t),t}f(Zu,"generateVideosParametersToMldev");function ju(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["prompt"]);i!=null&&a(t,["instances[0]","prompt"],i);let s=r(e,["image"]);s!=null&&a(t,["instances[0]","image"],ge(s));let l=r(e,["video"]);l!=null&&a(t,["instances[0]","video"],$a(l));let c=r(e,["source"]);c!=null&&of(c,t);let d=r(e,["config"]);return d!=null&&Xu(d,t),t}f(ju,"generateVideosParametersToVertex");function ef(n){let e={},t=r(n,["generatedSamples"]);if(t!=null){let s=t;Array.isArray(s)&&(s=s.map(l=>af(l))),a(e,["generatedVideos"],s)}let o=r(n,["raiMediaFilteredCount"]);o!=null&&a(e,["raiMediaFilteredCount"],o);let i=r(n,["raiMediaFilteredReasons"]);return i!=null&&a(e,["raiMediaFilteredReasons"],i),e}f(ef,"generateVideosResponseFromMldev");function tf(n){let e={},t=r(n,["videos"]);if(t!=null){let s=t;Array.isArray(s)&&(s=s.map(l=>lf(l))),a(e,["generatedVideos"],s)}let o=r(n,["raiMediaFilteredCount"]);o!=null&&a(e,["raiMediaFilteredCount"],o);let i=r(n,["raiMediaFilteredReasons"]);return i!=null&&a(e,["raiMediaFilteredReasons"],i),e}f(tf,"generateVideosResponseFromVertex");function nf(n,e){let t={},o=r(n,["prompt"]);e!==void 0&&o!=null&&a(e,["instances[0]","prompt"],o);let i=r(n,["image"]);e!==void 0&&i!=null&&a(e,["instances[0]","image"],Pn(i));let s=r(n,["video"]);return e!==void 0&&s!=null&&a(e,["instances[0]","video"],Ra(s)),t}f(nf,"generateVideosSourceToMldev");function of(n,e){let t={},o=r(n,["prompt"]);e!==void 0&&o!=null&&a(e,["instances[0]","prompt"],o);let i=r(n,["image"]);e!==void 0&&i!=null&&a(e,["instances[0]","image"],ge(i));let s=r(n,["video"]);return e!==void 0&&s!=null&&a(e,["instances[0]","video"],$a(s)),t}f(of,"generateVideosSourceToVertex");function rf(n){let e={},t=r(n,["_self"]);t!=null&&a(e,["image"],gf(t));let o=r(n,["raiFilteredReason"]);o!=null&&a(e,["raiFilteredReason"],o);let i=r(n,["_self"]);return i!=null&&a(e,["safetyAttributes"],Aa(i)),e}f(rf,"generatedImageFromMldev");function xn(n){let e={},t=r(n,["_self"]);t!=null&&a(e,["image"],Sa(t));let o=r(n,["raiFilteredReason"]);o!=null&&a(e,["raiFilteredReason"],o);let i=r(n,["_self"]);i!=null&&a(e,["safetyAttributes"],xa(i));let s=r(n,["prompt"]);return s!=null&&a(e,["enhancedPrompt"],s),e}f(xn,"generatedImageFromVertex");function sf(n){let e={},t=r(n,["_self"]);t!=null&&a(e,["mask"],Sa(t));let o=r(n,["labels"]);if(o!=null){let i=o;Array.isArray(i)&&(i=i.map(s=>s)),a(e,["labels"],i)}return e}f(sf,"generatedImageMaskFromVertex");function af(n){let e={},t=r(n,["video"]);return t!=null&&a(e,["video"],Kf(t)),e}f(af,"generatedVideoFromMldev");function lf(n){let e={},t=r(n,["_self"]);return t!=null&&a(e,["video"],Xf(t)),e}f(lf,"generatedVideoFromVertex");function cf(n){let e={},t=r(n,["modelSelectionConfig"]);t!=null&&a(e,["modelConfig"],t);let o=r(n,["responseJsonSchema"]);o!=null&&a(e,["responseJsonSchema"],o);let i=r(n,["audioTimestamp"]);i!=null&&a(e,["audioTimestamp"],i);let s=r(n,["candidateCount"]);s!=null&&a(e,["candidateCount"],s);let l=r(n,["enableAffectiveDialog"]);l!=null&&a(e,["enableAffectiveDialog"],l);let c=r(n,["frequencyPenalty"]);c!=null&&a(e,["frequencyPenalty"],c);let d=r(n,["logprobs"]);d!=null&&a(e,["logprobs"],d);let u=r(n,["maxOutputTokens"]);u!=null&&a(e,["maxOutputTokens"],u);let p=r(n,["mediaResolution"]);p!=null&&a(e,["mediaResolution"],p);let m=r(n,["presencePenalty"]);m!=null&&a(e,["presencePenalty"],m);let h=r(n,["responseLogprobs"]);h!=null&&a(e,["responseLogprobs"],h);let g=r(n,["responseMimeType"]);g!=null&&a(e,["responseMimeType"],g);let b=r(n,["responseModalities"]);b!=null&&a(e,["responseModalities"],b);let E=r(n,["responseSchema"]);E!=null&&a(e,["responseSchema"],E);let I=r(n,["routingConfig"]);I!=null&&a(e,["routingConfig"],I);let v=r(n,["seed"]);v!=null&&a(e,["seed"],v);let T=r(n,["speechConfig"]);T!=null&&a(e,["speechConfig"],Pa(T));let w=r(n,["stopSequences"]);w!=null&&a(e,["stopSequences"],w);let C=r(n,["temperature"]);C!=null&&a(e,["temperature"],C);let S=r(n,["thinkingConfig"]);S!=null&&a(e,["thinkingConfig"],S);let $=r(n,["topK"]);$!=null&&a(e,["topK"],$);let P=r(n,["topP"]);if(P!=null&&a(e,["topP"],P),r(n,["enableEnhancedCivicAnswers"])!==void 0)throw new Error("enableEnhancedCivicAnswers parameter is not supported in Vertex AI.");return e}f(cf,"generationConfigToVertex");function df(n,e){let t={},o=r(e,["model"]);return o!=null&&a(t,["_url","name"],L(n,o)),t}f(df,"getModelParametersToMldev");function uf(n,e){let t={},o=r(e,["model"]);return o!=null&&a(t,["_url","name"],L(n,o)),t}f(uf,"getModelParametersToVertex");function ff(n){let e={};if(r(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");let t=r(n,["enableWidget"]);return t!=null&&a(e,["enableWidget"],t),e}f(ff,"googleMapsToMldev$1");function pf(n){let e={};if(r(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(r(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");let t=r(n,["timeRangeFilter"]);return t!=null&&a(e,["timeRangeFilter"],t),e}f(pf,"googleSearchToMldev$1");function mf(n){let e={},t=r(n,["aspectRatio"]);t!=null&&a(e,["aspectRatio"],t);let o=r(n,["imageSize"]);if(o!=null&&a(e,["imageSize"],o),r(n,["outputMimeType"])!==void 0)throw new Error("outputMimeType parameter is not supported in Gemini API.");if(r(n,["outputCompressionQuality"])!==void 0)throw new Error("outputCompressionQuality parameter is not supported in Gemini API.");return e}f(mf,"imageConfigToMldev");function hf(n){let e={},t=r(n,["aspectRatio"]);t!=null&&a(e,["aspectRatio"],t);let o=r(n,["imageSize"]);o!=null&&a(e,["imageSize"],o);let i=r(n,["outputMimeType"]);i!=null&&a(e,["imageOutputOptions","mimeType"],i);let s=r(n,["outputCompressionQuality"]);return s!=null&&a(e,["imageOutputOptions","compressionQuality"],s),e}f(hf,"imageConfigToVertex");function gf(n){let e={},t=r(n,["bytesBase64Encoded"]);t!=null&&a(e,["imageBytes"],$e(t));let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f(gf,"imageFromMldev");function Sa(n){let e={},t=r(n,["gcsUri"]);t!=null&&a(e,["gcsUri"],t);let o=r(n,["bytesBase64Encoded"]);o!=null&&a(e,["imageBytes"],$e(o));let i=r(n,["mimeType"]);return i!=null&&a(e,["mimeType"],i),e}f(Sa,"imageFromVertex");function Pn(n){let e={};if(r(n,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");let t=r(n,["imageBytes"]);t!=null&&a(e,["bytesBase64Encoded"],$e(t));let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f(Pn,"imageToMldev");function ge(n){let e={},t=r(n,["gcsUri"]);t!=null&&a(e,["gcsUri"],t);let o=r(n,["imageBytes"]);o!=null&&a(e,["bytesBase64Encoded"],$e(o));let i=r(n,["mimeType"]);return i!=null&&a(e,["mimeType"],i),e}f(ge,"imageToVertex");function bf(n,e,t){let o={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&a(t,["_query","pageSize"],i);let s=r(e,["pageToken"]);t!==void 0&&s!=null&&a(t,["_query","pageToken"],s);let l=r(e,["filter"]);t!==void 0&&l!=null&&a(t,["_query","filter"],l);let c=r(e,["queryBase"]);return t!==void 0&&c!=null&&a(t,["_url","models_url"],ya(n,c)),o}f(bf,"listModelsConfigToMldev");function yf(n,e,t){let o={},i=r(e,["pageSize"]);t!==void 0&&i!=null&&a(t,["_query","pageSize"],i);let s=r(e,["pageToken"]);t!==void 0&&s!=null&&a(t,["_query","pageToken"],s);let l=r(e,["filter"]);t!==void 0&&l!=null&&a(t,["_query","filter"],l);let c=r(e,["queryBase"]);return t!==void 0&&c!=null&&a(t,["_url","models_url"],ya(n,c)),o}f(yf,"listModelsConfigToVertex");function Ef(n,e){let t={},o=r(e,["config"]);return o!=null&&bf(n,o,t),t}f(Ef,"listModelsParametersToMldev");function If(n,e){let t={},o=r(e,["config"]);return o!=null&&yf(n,o,t),t}f(If,"listModelsParametersToVertex");function vf(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["nextPageToken"]);o!=null&&a(e,["nextPageToken"],o);let i=r(n,["_self"]);if(i!=null){let s=Ea(i);Array.isArray(s)&&(s=s.map(l=>Lo(l))),a(e,["models"],s)}return e}f(vf,"listModelsResponseFromMldev");function Tf(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["nextPageToken"]);o!=null&&a(e,["nextPageToken"],o);let i=r(n,["_self"]);if(i!=null){let s=Ea(i);Array.isArray(s)&&(s=s.map(l=>ko(l))),a(e,["models"],s)}return e}f(Tf,"listModelsResponseFromVertex");function wf(n){let e={},t=r(n,["maskMode"]);t!=null&&a(e,["maskMode"],t);let o=r(n,["segmentationClasses"]);o!=null&&a(e,["maskClasses"],o);let i=r(n,["maskDilation"]);return i!=null&&a(e,["dilation"],i),e}f(wf,"maskReferenceConfigToVertex");function Lo(n){let e={},t=r(n,["name"]);t!=null&&a(e,["name"],t);let o=r(n,["displayName"]);o!=null&&a(e,["displayName"],o);let i=r(n,["description"]);i!=null&&a(e,["description"],i);let s=r(n,["version"]);s!=null&&a(e,["version"],s);let l=r(n,["_self"]);l!=null&&a(e,["tunedModelInfo"],Ff(l));let c=r(n,["inputTokenLimit"]);c!=null&&a(e,["inputTokenLimit"],c);let d=r(n,["outputTokenLimit"]);d!=null&&a(e,["outputTokenLimit"],d);let u=r(n,["supportedGenerationMethods"]);u!=null&&a(e,["supportedActions"],u);let p=r(n,["temperature"]);p!=null&&a(e,["temperature"],p);let m=r(n,["maxTemperature"]);m!=null&&a(e,["maxTemperature"],m);let h=r(n,["topP"]);h!=null&&a(e,["topP"],h);let g=r(n,["topK"]);g!=null&&a(e,["topK"],g);let b=r(n,["thinking"]);return b!=null&&a(e,["thinking"],b),e}f(Lo,"modelFromMldev");function ko(n){let e={},t=r(n,["name"]);t!=null&&a(e,["name"],t);let o=r(n,["displayName"]);o!=null&&a(e,["displayName"],o);let i=r(n,["description"]);i!=null&&a(e,["description"],i);let s=r(n,["versionId"]);s!=null&&a(e,["version"],s);let l=r(n,["deployedModels"]);if(l!=null){let m=l;Array.isArray(m)&&(m=m.map(h=>Du(h))),a(e,["endpoints"],m)}let c=r(n,["labels"]);c!=null&&a(e,["labels"],c);let d=r(n,["_self"]);d!=null&&a(e,["tunedModelInfo"],Vf(d));let u=r(n,["defaultCheckpointId"]);u!=null&&a(e,["defaultCheckpointId"],u);let p=r(n,["checkpoints"]);if(p!=null){let m=p;Array.isArray(m)&&(m=m.map(h=>h)),a(e,["checkpoints"],m)}return e}f(ko,"modelFromVertex");function _f(n){let e={},t=r(n,["mediaResolution"]);t!=null&&a(e,["mediaResolution"],t);let o=r(n,["codeExecutionResult"]);o!=null&&a(e,["codeExecutionResult"],o);let i=r(n,["executableCode"]);i!=null&&a(e,["executableCode"],i);let s=r(n,["fileData"]);s!=null&&a(e,["fileData"],Lu(s));let l=r(n,["functionCall"]);l!=null&&a(e,["functionCall"],ku(l));let c=r(n,["functionResponse"]);c!=null&&a(e,["functionResponse"],c);let d=r(n,["inlineData"]);d!=null&&a(e,["inlineData"],lu(d));let u=r(n,["text"]);u!=null&&a(e,["text"],u);let p=r(n,["thought"]);p!=null&&a(e,["thought"],p);let m=r(n,["thoughtSignature"]);m!=null&&a(e,["thoughtSignature"],m);let h=r(n,["videoMetadata"]);return h!=null&&a(e,["videoMetadata"],h),e}f(_f,"partToMldev$1");function Cf(n){let e={},t=r(n,["productImage"]);return t!=null&&a(e,["image"],ge(t)),e}f(Cf,"productImageToVertex");function Sf(n,e){let t={},o=r(n,["numberOfImages"]);e!==void 0&&o!=null&&a(e,["parameters","sampleCount"],o);let i=r(n,["baseSteps"]);e!==void 0&&i!=null&&a(e,["parameters","baseSteps"],i);let s=r(n,["outputGcsUri"]);e!==void 0&&s!=null&&a(e,["parameters","storageUri"],s);let l=r(n,["seed"]);e!==void 0&&l!=null&&a(e,["parameters","seed"],l);let c=r(n,["safetyFilterLevel"]);e!==void 0&&c!=null&&a(e,["parameters","safetySetting"],c);let d=r(n,["personGeneration"]);e!==void 0&&d!=null&&a(e,["parameters","personGeneration"],d);let u=r(n,["addWatermark"]);e!==void 0&&u!=null&&a(e,["parameters","addWatermark"],u);let p=r(n,["outputMimeType"]);e!==void 0&&p!=null&&a(e,["parameters","outputOptions","mimeType"],p);let m=r(n,["outputCompressionQuality"]);e!==void 0&&m!=null&&a(e,["parameters","outputOptions","compressionQuality"],m);let h=r(n,["enhancePrompt"]);e!==void 0&&h!=null&&a(e,["parameters","enhancePrompt"],h);let g=r(n,["labels"]);return e!==void 0&&g!=null&&a(e,["labels"],g),t}f(Sf,"recontextImageConfigToVertex");function Af(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["source"]);i!=null&&Pf(i,t);let s=r(e,["config"]);return s!=null&&Sf(s,t),t}f(Af,"recontextImageParametersToVertex");function xf(n){let e={},t=r(n,["predictions"]);if(t!=null){let o=t;Array.isArray(o)&&(o=o.map(i=>xn(i))),a(e,["generatedImages"],o)}return e}f(xf,"recontextImageResponseFromVertex");function Pf(n,e){let t={},o=r(n,["prompt"]);e!==void 0&&o!=null&&a(e,["instances[0]","prompt"],o);let i=r(n,["personImage"]);e!==void 0&&i!=null&&a(e,["instances[0]","personImage","image"],ge(i));let s=r(n,["productImages"]);if(e!==void 0&&s!=null){let l=s;Array.isArray(l)&&(l=l.map(c=>Cf(c))),a(e,["instances[0]","productImages"],l)}return t}f(Pf,"recontextImageSourceToVertex");function Nf(n){let e={},t=r(n,["referenceImage"]);t!=null&&a(e,["referenceImage"],ge(t));let o=r(n,["referenceId"]);o!=null&&a(e,["referenceId"],o);let i=r(n,["referenceType"]);i!=null&&a(e,["referenceType"],i);let s=r(n,["maskImageConfig"]);s!=null&&a(e,["maskImageConfig"],wf(s));let l=r(n,["controlImageConfig"]);l!=null&&a(e,["controlImageConfig"],hu(l));let c=r(n,["styleImageConfig"]);c!=null&&a(e,["styleImageConfig"],c);let d=r(n,["subjectImageConfig"]);return d!=null&&a(e,["subjectImageConfig"],d),e}f(Nf,"referenceImageAPIInternalToVertex");function Aa(n){let e={},t=r(n,["safetyAttributes","categories"]);t!=null&&a(e,["categories"],t);let o=r(n,["safetyAttributes","scores"]);o!=null&&a(e,["scores"],o);let i=r(n,["contentType"]);return i!=null&&a(e,["contentType"],i),e}f(Aa,"safetyAttributesFromMldev");function xa(n){let e={},t=r(n,["safetyAttributes","categories"]);t!=null&&a(e,["categories"],t);let o=r(n,["safetyAttributes","scores"]);o!=null&&a(e,["scores"],o);let i=r(n,["contentType"]);return i!=null&&a(e,["contentType"],i),e}f(xa,"safetyAttributesFromVertex");function Rf(n){let e={},t=r(n,["category"]);if(t!=null&&a(e,["category"],t),r(n,["method"])!==void 0)throw new Error("method parameter is not supported in Gemini API.");let o=r(n,["threshold"]);return o!=null&&a(e,["threshold"],o),e}f(Rf,"safetySettingToMldev");function $f(n){let e={},t=r(n,["image"]);return t!=null&&a(e,["image"],ge(t)),e}f($f,"scribbleImageToVertex");function Mf(n,e){let t={},o=r(n,["mode"]);e!==void 0&&o!=null&&a(e,["parameters","mode"],o);let i=r(n,["maxPredictions"]);e!==void 0&&i!=null&&a(e,["parameters","maxPredictions"],i);let s=r(n,["confidenceThreshold"]);e!==void 0&&s!=null&&a(e,["parameters","confidenceThreshold"],s);let l=r(n,["maskDilation"]);e!==void 0&&l!=null&&a(e,["parameters","maskDilation"],l);let c=r(n,["binaryColorThreshold"]);e!==void 0&&c!=null&&a(e,["parameters","binaryColorThreshold"],c);let d=r(n,["labels"]);return e!==void 0&&d!=null&&a(e,["labels"],d),t}f(Mf,"segmentImageConfigToVertex");function Gf(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["source"]);i!=null&&Lf(i,t);let s=r(e,["config"]);return s!=null&&Mf(s,t),t}f(Gf,"segmentImageParametersToVertex");function Df(n){let e={},t=r(n,["predictions"]);if(t!=null){let o=t;Array.isArray(o)&&(o=o.map(i=>sf(i))),a(e,["generatedMasks"],o)}return e}f(Df,"segmentImageResponseFromVertex");function Lf(n,e){let t={},o=r(n,["prompt"]);e!==void 0&&o!=null&&a(e,["instances[0]","prompt"],o);let i=r(n,["image"]);e!==void 0&&i!=null&&a(e,["instances[0]","image"],ge(i));let s=r(n,["scribbleImage"]);return e!==void 0&&s!=null&&a(e,["instances[0]","scribble"],$f(s)),t}f(Lf,"segmentImageSourceToVertex");function Pa(n){let e={},t=r(n,["voiceConfig"]);t!=null&&a(e,["voiceConfig"],t);let o=r(n,["languageCode"]);if(o!=null&&a(e,["languageCode"],o),r(n,["multiSpeakerVoiceConfig"])!==void 0)throw new Error("multiSpeakerVoiceConfig parameter is not supported in Vertex AI.");return e}f(Pa,"speechConfigToVertex");function kf(n){let e={},t=r(n,["functionCallingConfig"]);t!=null&&a(e,["functionCallingConfig"],Uu(t));let o=r(n,["retrievalConfig"]);return o!=null&&a(e,["retrievalConfig"],o),e}f(kf,"toolConfigToMldev");function Uf(n){let e={},t=r(n,["functionDeclarations"]);if(t!=null){let p=t;Array.isArray(p)&&(p=p.map(m=>m)),a(e,["functionDeclarations"],p)}if(r(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");let o=r(n,["googleSearchRetrieval"]);o!=null&&a(e,["googleSearchRetrieval"],o);let i=r(n,["computerUse"]);i!=null&&a(e,["computerUse"],i);let s=r(n,["fileSearch"]);s!=null&&a(e,["fileSearch"],s);let l=r(n,["codeExecution"]);if(l!=null&&a(e,["codeExecution"],l),r(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");let c=r(n,["googleMaps"]);c!=null&&a(e,["googleMaps"],ff(c));let d=r(n,["googleSearch"]);d!=null&&a(e,["googleSearch"],pf(d));let u=r(n,["urlContext"]);return u!=null&&a(e,["urlContext"],u),e}f(Uf,"toolToMldev$1");function Na(n){let e={},t=r(n,["functionDeclarations"]);if(t!=null){let m=t;Array.isArray(m)&&(m=m.map(h=>Fu(h))),a(e,["functionDeclarations"],m)}let o=r(n,["retrieval"]);o!=null&&a(e,["retrieval"],o);let i=r(n,["googleSearchRetrieval"]);i!=null&&a(e,["googleSearchRetrieval"],i);let s=r(n,["computerUse"]);if(s!=null&&a(e,["computerUse"],s),r(n,["fileSearch"])!==void 0)throw new Error("fileSearch parameter is not supported in Vertex AI.");let l=r(n,["codeExecution"]);l!=null&&a(e,["codeExecution"],l);let c=r(n,["enterpriseWebSearch"]);c!=null&&a(e,["enterpriseWebSearch"],c);let d=r(n,["googleMaps"]);d!=null&&a(e,["googleMaps"],d);let u=r(n,["googleSearch"]);u!=null&&a(e,["googleSearch"],u);let p=r(n,["urlContext"]);return p!=null&&a(e,["urlContext"],p),e}f(Na,"toolToVertex");function Ff(n){let e={},t=r(n,["baseModel"]);t!=null&&a(e,["baseModel"],t);let o=r(n,["createTime"]);o!=null&&a(e,["createTime"],o);let i=r(n,["updateTime"]);return i!=null&&a(e,["updateTime"],i),e}f(Ff,"tunedModelInfoFromMldev");function Vf(n){let e={},t=r(n,["labels","google-vertex-llm-tuning-base-model-id"]);t!=null&&a(e,["baseModel"],t);let o=r(n,["createTime"]);o!=null&&a(e,["createTime"],o);let i=r(n,["updateTime"]);return i!=null&&a(e,["updateTime"],i),e}f(Vf,"tunedModelInfoFromVertex");function Hf(n,e){let t={},o=r(n,["displayName"]);e!==void 0&&o!=null&&a(e,["displayName"],o);let i=r(n,["description"]);e!==void 0&&i!=null&&a(e,["description"],i);let s=r(n,["defaultCheckpointId"]);return e!==void 0&&s!=null&&a(e,["defaultCheckpointId"],s),t}f(Hf,"updateModelConfigToMldev");function qf(n,e){let t={},o=r(n,["displayName"]);e!==void 0&&o!=null&&a(e,["displayName"],o);let i=r(n,["description"]);e!==void 0&&i!=null&&a(e,["description"],i);let s=r(n,["defaultCheckpointId"]);return e!==void 0&&s!=null&&a(e,["defaultCheckpointId"],s),t}f(qf,"updateModelConfigToVertex");function Bf(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","name"],L(n,o));let i=r(e,["config"]);return i!=null&&Hf(i,t),t}f(Bf,"updateModelParametersToMldev");function Of(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["config"]);return i!=null&&qf(i,t),t}f(Of,"updateModelParametersToVertex");function zf(n,e){let t={},o=r(n,["outputGcsUri"]);e!==void 0&&o!=null&&a(e,["parameters","storageUri"],o);let i=r(n,["safetyFilterLevel"]);e!==void 0&&i!=null&&a(e,["parameters","safetySetting"],i);let s=r(n,["personGeneration"]);e!==void 0&&s!=null&&a(e,["parameters","personGeneration"],s);let l=r(n,["includeRaiReason"]);e!==void 0&&l!=null&&a(e,["parameters","includeRaiReason"],l);let c=r(n,["outputMimeType"]);e!==void 0&&c!=null&&a(e,["parameters","outputOptions","mimeType"],c);let d=r(n,["outputCompressionQuality"]);e!==void 0&&d!=null&&a(e,["parameters","outputOptions","compressionQuality"],d);let u=r(n,["enhanceInputImage"]);e!==void 0&&u!=null&&a(e,["parameters","upscaleConfig","enhanceInputImage"],u);let p=r(n,["imagePreservationFactor"]);e!==void 0&&p!=null&&a(e,["parameters","upscaleConfig","imagePreservationFactor"],p);let m=r(n,["labels"]);e!==void 0&&m!=null&&a(e,["labels"],m);let h=r(n,["numberOfImages"]);e!==void 0&&h!=null&&a(e,["parameters","sampleCount"],h);let g=r(n,["mode"]);return e!==void 0&&g!=null&&a(e,["parameters","mode"],g),t}f(zf,"upscaleImageAPIConfigInternalToVertex");function Jf(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["_url","model"],L(n,o));let i=r(e,["image"]);i!=null&&a(t,["instances[0]","image"],ge(i));let s=r(e,["upscaleFactor"]);s!=null&&a(t,["parameters","upscaleConfig","upscaleFactor"],s);let l=r(e,["config"]);return l!=null&&zf(l,t),t}f(Jf,"upscaleImageAPIParametersInternalToVertex");function Wf(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["predictions"]);if(o!=null){let i=o;Array.isArray(i)&&(i=i.map(s=>xn(s))),a(e,["generatedImages"],i)}return e}f(Wf,"upscaleImageResponseFromVertex");function Kf(n){let e={},t=r(n,["uri"]);t!=null&&a(e,["uri"],t);let o=r(n,["encodedVideo"]);o!=null&&a(e,["videoBytes"],$e(o));let i=r(n,["encoding"]);return i!=null&&a(e,["mimeType"],i),e}f(Kf,"videoFromMldev");function Xf(n){let e={},t=r(n,["gcsUri"]);t!=null&&a(e,["uri"],t);let o=r(n,["bytesBase64Encoded"]);o!=null&&a(e,["videoBytes"],$e(o));let i=r(n,["mimeType"]);return i!=null&&a(e,["mimeType"],i),e}f(Xf,"videoFromVertex");function Yf(n){let e={},t=r(n,["image"]);t!=null&&a(e,["_self"],ge(t));let o=r(n,["maskMode"]);return o!=null&&a(e,["maskMode"],o),e}f(Yf,"videoGenerationMaskToVertex");function Qf(n){let e={},t=r(n,["image"]);t!=null&&a(e,["image"],Pn(t));let o=r(n,["referenceType"]);return o!=null&&a(e,["referenceType"],o),e}f(Qf,"videoGenerationReferenceImageToMldev");function Zf(n){let e={},t=r(n,["image"]);t!=null&&a(e,["image"],ge(t));let o=r(n,["referenceType"]);return o!=null&&a(e,["referenceType"],o),e}f(Zf,"videoGenerationReferenceImageToVertex");function Ra(n){let e={},t=r(n,["uri"]);t!=null&&a(e,["uri"],t);let o=r(n,["videoBytes"]);o!=null&&a(e,["encodedVideo"],$e(o));let i=r(n,["mimeType"]);return i!=null&&a(e,["encoding"],i),e}f(Ra,"videoToMldev");function $a(n){let e={},t=r(n,["uri"]);t!=null&&a(e,["gcsUri"],t);let o=r(n,["videoBytes"]);o!=null&&a(e,["bytesBase64Encoded"],$e(o));let i=r(n,["mimeType"]);return i!=null&&a(e,["mimeType"],i),e}f($a,"videoToVertex");function jf(n,e){let t={},o=r(n,["displayName"]);return e!==void 0&&o!=null&&a(e,["displayName"],o),t}f(jf,"createFileSearchStoreConfigToMldev");function ep(n){let e={},t=r(n,["config"]);return t!=null&&jf(t,e),e}f(ep,"createFileSearchStoreParametersToMldev");function tp(n,e){let t={},o=r(n,["force"]);return e!==void 0&&o!=null&&a(e,["_query","force"],o),t}f(tp,"deleteFileSearchStoreConfigToMldev");function np(n){let e={},t=r(n,["name"]);t!=null&&a(e,["_url","name"],t);let o=r(n,["config"]);return o!=null&&tp(o,e),e}f(np,"deleteFileSearchStoreParametersToMldev");function op(n){let e={},t=r(n,["name"]);return t!=null&&a(e,["_url","name"],t),e}f(op,"getFileSearchStoreParametersToMldev");function ip(n,e){let t={},o=r(n,["customMetadata"]);if(e!==void 0&&o!=null){let s=o;Array.isArray(s)&&(s=s.map(l=>l)),a(e,["customMetadata"],s)}let i=r(n,["chunkingConfig"]);return e!==void 0&&i!=null&&a(e,["chunkingConfig"],i),t}f(ip,"importFileConfigToMldev");function rp(n){let e={},t=r(n,["name"]);t!=null&&a(e,["name"],t);let o=r(n,["metadata"]);o!=null&&a(e,["metadata"],o);let i=r(n,["done"]);i!=null&&a(e,["done"],i);let s=r(n,["error"]);s!=null&&a(e,["error"],s);let l=r(n,["response"]);return l!=null&&a(e,["response"],ap(l)),e}f(rp,"importFileOperationFromMldev");function sp(n){let e={},t=r(n,["fileSearchStoreName"]);t!=null&&a(e,["_url","file_search_store_name"],t);let o=r(n,["fileName"]);o!=null&&a(e,["fileName"],o);let i=r(n,["config"]);return i!=null&&ip(i,e),e}f(sp,"importFileParametersToMldev");function ap(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["parent"]);o!=null&&a(e,["parent"],o);let i=r(n,["documentName"]);return i!=null&&a(e,["documentName"],i),e}f(ap,"importFileResponseFromMldev");function lp(n,e){let t={},o=r(n,["pageSize"]);e!==void 0&&o!=null&&a(e,["_query","pageSize"],o);let i=r(n,["pageToken"]);return e!==void 0&&i!=null&&a(e,["_query","pageToken"],i),t}f(lp,"listFileSearchStoresConfigToMldev");function cp(n){let e={},t=r(n,["config"]);return t!=null&&lp(t,e),e}f(cp,"listFileSearchStoresParametersToMldev");function dp(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["nextPageToken"]);o!=null&&a(e,["nextPageToken"],o);let i=r(n,["fileSearchStores"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(l=>l)),a(e,["fileSearchStores"],s)}return e}f(dp,"listFileSearchStoresResponseFromMldev");function Ma(n,e){let t={},o=r(n,["mimeType"]);e!==void 0&&o!=null&&a(e,["mimeType"],o);let i=r(n,["displayName"]);e!==void 0&&i!=null&&a(e,["displayName"],i);let s=r(n,["customMetadata"]);if(e!==void 0&&s!=null){let c=s;Array.isArray(c)&&(c=c.map(d=>d)),a(e,["customMetadata"],c)}let l=r(n,["chunkingConfig"]);return e!==void 0&&l!=null&&a(e,["chunkingConfig"],l),t}f(Ma,"uploadToFileSearchStoreConfigToMldev");function up(n){let e={},t=r(n,["fileSearchStoreName"]);t!=null&&a(e,["_url","file_search_store_name"],t);let o=r(n,["config"]);return o!=null&&Ma(o,e),e}f(up,"uploadToFileSearchStoreParametersToMldev");function fp(n){let e={},t=r(n,["sdkHttpResponse"]);return t!=null&&a(e,["sdkHttpResponse"],t),e}f(fp,"uploadToFileSearchStoreResumableResponseFromMldev");var pp="Content-Type",mp="X-Server-Timeout",hp="User-Agent",Uo="x-goog-api-client",gp="1.33.0",bp=`google-genai-sdk/${gp}`,yp="v1beta1",Ep="v1beta",Fo=class{static{f(this,"ApiClient")}constructor(e){var t,o;this.clientOptions=Object.assign(Object.assign({},e),{project:e.project,location:e.location,apiKey:e.apiKey,vertexai:e.vertexai});let i={};this.clientOptions.vertexai?(i.apiVersion=(t=this.clientOptions.apiVersion)!==null&&t!==void 0?t:yp,i.baseUrl=this.baseUrlFromProjectLocation(),this.normalizeAuthParameters()):(i.apiVersion=(o=this.clientOptions.apiVersion)!==null&&o!==void 0?o:Ep,i.baseUrl="https://generativelanguage.googleapis.com/"),i.headers=this.getDefaultHeaders(),this.clientOptions.httpOptions=i,e.httpOptions&&(this.clientOptions.httpOptions=this.patchHttpOptions(i,e.httpOptions))}baseUrlFromProjectLocation(){return this.clientOptions.project&&this.clientOptions.location&&this.clientOptions.location!=="global"?`https://${this.clientOptions.location}-aiplatform.googleapis.com/`:"https://aiplatform.googleapis.com/"}normalizeAuthParameters(){if(this.clientOptions.project&&this.clientOptions.location){this.clientOptions.apiKey=void 0;return}this.clientOptions.project=void 0,this.clientOptions.location=void 0}isVertexAI(){var e;return(e=this.clientOptions.vertexai)!==null&&e!==void 0?e:!1}getProject(){return this.clientOptions.project}getLocation(){return this.clientOptions.location}getApiVersion(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.apiVersion!==void 0)return this.clientOptions.httpOptions.apiVersion;throw new Error("API version is not set.")}getBaseUrl(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.baseUrl!==void 0)return this.clientOptions.httpOptions.baseUrl;throw new Error("Base URL is not set.")}getRequestUrl(){return this.getRequestUrlInternal(this.clientOptions.httpOptions)}getHeaders(){if(this.clientOptions.httpOptions&&this.clientOptions.httpOptions.headers!==void 0)return this.clientOptions.httpOptions.headers;throw new Error("Headers are not set.")}getRequestUrlInternal(e){if(!e||e.baseUrl===void 0||e.apiVersion===void 0)throw new Error("HTTP options are not correctly set.");let o=[e.baseUrl.endsWith("/")?e.baseUrl.slice(0,-1):e.baseUrl];return e.apiVersion&&e.apiVersion!==""&&o.push(e.apiVersion),o.join("/")}getBaseResourcePath(){return`projects/${this.clientOptions.project}/locations/${this.clientOptions.location}`}getApiKey(){return this.clientOptions.apiKey}getWebsocketBaseUrl(){let e=this.getBaseUrl(),t=new URL(e);return t.protocol=t.protocol=="http:"?"ws":"wss",t.toString()}setBaseUrl(e){if(this.clientOptions.httpOptions)this.clientOptions.httpOptions.baseUrl=e;else throw new Error("HTTP options are not correctly set.")}constructUrl(e,t,o){let i=[this.getRequestUrlInternal(t)];return o&&i.push(this.getBaseResourcePath()),e!==""&&i.push(e),new URL(`${i.join("/")}`)}shouldPrependVertexProjectPath(e){return!(this.clientOptions.apiKey||!this.clientOptions.vertexai||e.path.startsWith("projects/")||e.httpMethod==="GET"&&e.path.startsWith("publishers/google/models"))}async request(e){let t=this.clientOptions.httpOptions;e.httpOptions&&(t=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));let o=this.shouldPrependVertexProjectPath(e),i=this.constructUrl(e.path,t,o);if(e.queryParams)for(let[l,c]of Object.entries(e.queryParams))i.searchParams.append(l,String(c));let s={};if(e.httpMethod==="GET"){if(e.body&&e.body!=="{}")throw new Error("Request body should be empty for GET request, but got non empty request body")}else s.body=e.body;return s=await this.includeExtraHttpOptionsToRequestInit(s,t,i.toString(),e.abortSignal),this.unaryApiCall(i,s,e.httpMethod)}patchHttpOptions(e,t){let o=JSON.parse(JSON.stringify(e));for(let[i,s]of Object.entries(t))typeof s=="object"?o[i]=Object.assign(Object.assign({},o[i]),s):s!==void 0&&(o[i]=s);return o}async requestStream(e){let t=this.clientOptions.httpOptions;e.httpOptions&&(t=this.patchHttpOptions(this.clientOptions.httpOptions,e.httpOptions));let o=this.shouldPrependVertexProjectPath(e),i=this.constructUrl(e.path,t,o);(!i.searchParams.has("alt")||i.searchParams.get("alt")!=="sse")&&i.searchParams.set("alt","sse");let s={};return s.body=e.body,s=await this.includeExtraHttpOptionsToRequestInit(s,t,i.toString(),e.abortSignal),this.streamApiCall(i,s,e.httpMethod)}async includeExtraHttpOptionsToRequestInit(e,t,o,i){if(t&&t.timeout||i){let s=new AbortController,l=s.signal;if(t.timeout&&t?.timeout>0){let c=setTimeout(()=>s.abort(),t.timeout);c&&typeof c.unref=="function"&&c.unref()}i&&i.addEventListener("abort",()=>{s.abort()}),e.signal=l}return t&&t.extraBody!==null&&Ip(e,t.extraBody),e.headers=await this.getHeadersInternal(t,o),e}async unaryApiCall(e,t,o){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:o})).then(async i=>(await Ys(i),new _t(i))).catch(i=>{throw i instanceof Error?i:new Error(JSON.stringify(i))})}async streamApiCall(e,t,o){return this.apiCall(e.toString(),Object.assign(Object.assign({},t),{method:o})).then(async i=>(await Ys(i),this.processStreamResponse(i))).catch(i=>{throw i instanceof Error?i:new Error(JSON.stringify(i))})}processStreamResponse(e){return pe(this,arguments,f(function*(){var o;let i=(o=e?.body)===null||o===void 0?void 0:o.getReader(),s=new TextDecoder("utf-8");if(!i)throw new Error("Response body is empty");try{let l="",c="data:",d=[`
|
|
1172
|
-
|
|
1173
|
-
`,"\r\r",`\r
|
|
1174
|
-
\r
|
|
1175
|
-
`];for(;;){let{done:u,value:p}=yield N(i.read());if(u){if(l.trim().length>0)throw new Error("Incomplete JSON segment at the end");break}let m=s.decode(p,{stream:!0});try{let b=JSON.parse(m);if("error"in b){let E=JSON.parse(JSON.stringify(b.error)),I=E.status,v=E.code,T=`got status: ${I}. ${JSON.stringify(b)}`;if(v>=400&&v<600)throw new un({message:T,status:v})}}catch(b){if(b.name==="ApiError")throw b}l+=m;let h=-1,g=0;for(;;){h=-1,g=0;for(let I of d){let v=l.indexOf(I);v!==-1&&(h===-1||v<h)&&(h=v,g=I.length)}if(h===-1)break;let b=l.substring(0,h);l=l.substring(h+g);let E=b.trim();if(E.startsWith(c)){let I=E.substring(c.length).trim();try{let v=new Response(I,{headers:e?.headers,status:e?.status,statusText:e?.statusText});yield yield N(new _t(v))}catch(v){throw new Error(`exception parsing stream chunk ${I}. ${v}`)}}}}}finally{i.releaseLock()}},"processStreamResponse_1"))}async apiCall(e,t){return fetch(e,t).catch(o=>{throw new Error(`exception ${o} sending request`)})}getDefaultHeaders(){let e={},t=bp+" "+this.clientOptions.userAgentExtra;return e[hp]=t,e[Uo]=t,e[pp]="application/json",e}async getHeadersInternal(e,t){let o=new Headers;if(e&&e.headers){for(let[i,s]of Object.entries(e.headers))o.append(i,s);e.timeout&&e.timeout>0&&o.append(mp,String(Math.ceil(e.timeout/1e3)))}return await this.clientOptions.auth.addAuthHeaders(o,t),o}getFileName(e){var t;let o="";return typeof e=="string"&&(o=e.replace(/[/\\]+$/,""),o=(t=o.split(/[/\\]/).pop())!==null&&t!==void 0?t:""),o}async uploadFile(e,t){var o;let i={};t!=null&&(i.mimeType=t.mimeType,i.name=t.name,i.displayName=t.displayName),i.name&&!i.name.startsWith("files/")&&(i.name=`files/${i.name}`);let s=this.clientOptions.uploader,l=await s.stat(e);i.sizeBytes=String(l.size);let c=(o=t?.mimeType)!==null&&o!==void 0?o:l.type;if(c===void 0||c==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");i.mimeType=c;let d={file:i},u=this.getFileName(e),p=_("upload/v1beta/files",d._url),m=await this.fetchUploadUrl(p,i.sizeBytes,i.mimeType,u,d,t?.httpOptions);return s.upload(e,m,this)}async uploadFileToFileSearchStore(e,t,o){var i;let s=this.clientOptions.uploader,l=await s.stat(t),c=String(l.size),d=(i=o?.mimeType)!==null&&i!==void 0?i:l.type;if(d===void 0||d==="")throw new Error("Can not determine mimeType. Please provide mimeType in the config.");let u=`upload/v1beta/${e}:uploadToFileSearchStore`,p=this.getFileName(t),m={};o!=null&&Ma(o,m);let h=await this.fetchUploadUrl(u,c,d,p,m,o?.httpOptions);return s.uploadToFileSearchStore(t,h,this)}async downloadFile(e){await this.clientOptions.downloader.download(e,this)}async fetchUploadUrl(e,t,o,i,s,l){var c;let d={};l?d=l:d={apiVersion:"",headers:Object.assign({"Content-Type":"application/json","X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${t}`,"X-Goog-Upload-Header-Content-Type":`${o}`},i?{"X-Goog-Upload-File-Name":i}:{})};let u=await this.request({path:e,body:JSON.stringify(s),httpMethod:"POST",httpOptions:d});if(!u||!u?.headers)throw new Error("Server did not return an HttpResponse or the returned HttpResponse did not have headers.");let p=(c=u?.headers)===null||c===void 0?void 0:c["x-goog-upload-url"];if(p===void 0)throw new Error("Failed to get upload url. Server did not return the x-google-upload-url in the headers");return p}};async function Ys(n){var e;if(n===void 0)throw new Error("response is undefined");if(!n.ok){let t=n.status,o;!((e=n.headers.get("content-type"))===null||e===void 0)&&e.includes("application/json")?o=await n.json():o={error:{message:await n.text(),code:n.status,status:n.statusText}};let i=JSON.stringify(o);throw t>=400&&t<600?new un({message:i,status:t}):new Error(i)}}f(Ys,"throwErrorIfNotOK");function Ip(n,e){if(!e||Object.keys(e).length===0)return;if(n.body instanceof Blob){console.warn("includeExtraBodyToRequestInit: extraBody provided but current request body is a Blob. extraBody will be ignored as merging is not supported for Blob bodies.");return}let t={};if(typeof n.body=="string"&&n.body.length>0)try{let s=JSON.parse(n.body);if(typeof s=="object"&&s!==null&&!Array.isArray(s))t=s;else{console.warn("includeExtraBodyToRequestInit: Original request body is valid JSON but not a non-array object. Skip applying extraBody to the request body.");return}}catch{console.warn("includeExtraBodyToRequestInit: Original request body is not valid JSON. Skip applying extraBody to the request body.");return}function o(s,l){let c=Object.assign({},s);for(let d in l)if(Object.prototype.hasOwnProperty.call(l,d)){let u=l[d],p=c[d];u&&typeof u=="object"&&!Array.isArray(u)&&p&&typeof p=="object"&&!Array.isArray(p)?c[d]=o(p,u):(p&&u&&typeof p!=typeof u&&console.warn(`includeExtraBodyToRequestInit:deepMerge: Type mismatch for key "${d}". Original type: ${typeof p}, New type: ${typeof u}. Overwriting.`),c[d]=u)}return c}f(o,"deepMerge");let i=o(t,e);n.body=JSON.stringify(i)}f(Ip,"includeExtraBodyToRequestInit");var vp="mcp_used/unknown",Tp=!1;function Ga(n){for(let e of n)if(wp(e)||typeof e=="object"&&"inputSchema"in e)return!0;return Tp}f(Ga,"hasMcpToolUsage");function Da(n){var e;let t=(e=n[Uo])!==null&&e!==void 0?e:"";n[Uo]=(t+` ${vp}`).trimStart()}f(Da,"setMcpUsageHeader");function wp(n){return n!==null&&typeof n=="object"&&n instanceof Vo}f(wp,"isMcpCallableTool");function _p(n){return pe(this,arguments,f(function*(t,o=100){let i,s=0;for(;s<o;){let l=yield N(t.listTools({cursor:i}));for(let c of l.tools)yield yield N(c),s++;if(!l.nextCursor)break;i=l.nextCursor}},"listAllTools_1"))}f(_p,"listAllTools");var Vo=class n{static{f(this,"McpCallableTool")}constructor(e=[],t){this.mcpTools=[],this.functionNameToMcpClient={},this.mcpClients=e,this.config=t}static create(e,t){return new n(e,t)}async initialize(){var e,t,o,i;if(this.mcpTools.length>0)return;let s={},l=[];for(let p of this.mcpClients)try{for(var c=!0,d=(t=void 0,me(_p(p))),u;u=await d.next(),e=u.done,!e;c=!0){i=u.value,c=!1;let m=i;l.push(m);let h=m.name;if(s[h])throw new Error(`Duplicate function name ${h} found in MCP tools. Please ensure function names are unique.`);s[h]=p}}catch(m){t={error:m}}finally{try{!c&&!e&&(o=d.return)&&await o.call(d)}finally{if(t)throw t.error}}this.mcpTools=l,this.functionNameToMcpClient=s}async tool(){return await this.initialize(),ac(this.mcpTools,this.config)}async callTool(e){await this.initialize();let t=[];for(let o of e)if(o.name in this.functionNameToMcpClient){let i=this.functionNameToMcpClient[o.name],s;this.config.timeout&&(s={timeout:this.config.timeout});let l=await i.callTool({name:o.name,arguments:o.args},void 0,s);t.push({functionResponse:{name:o.name,response:l.isError?{error:l}:l}})}return t}};async function Cp(n,e,t){let o=new Ao,i;t.data instanceof Blob?i=JSON.parse(await t.data.text()):i=JSON.parse(t.data),Object.assign(o,i),e(o)}f(Cp,"handleWebSocketMessage$1");var Ho=class{static{f(this,"LiveMusic")}constructor(e,t,o){this.apiClient=e,this.auth=t,this.webSocketFactory=o}async connect(e){var t,o;if(this.apiClient.isVertexAI())throw new Error("Live music is not supported for Vertex AI.");console.warn("Live music generation is experimental and may change in future versions.");let i=this.apiClient.getWebsocketBaseUrl(),s=this.apiClient.getApiVersion(),l=Ap(this.apiClient.getDefaultHeaders()),c=this.apiClient.getApiKey(),d=`${i}/ws/google.ai.generativelanguage.${s}.GenerativeService.BidiGenerateMusic?key=${c}`,u=f(()=>{},"onopenResolve"),p=new Promise(w=>{u=w}),m=e.callbacks,h=f(function(){u({})},"onopenAwaitedCallback"),g=this.apiClient,b={onopen:h,onmessage:f(w=>{Cp(g,m.onmessage,w)},"onmessage"),onerror:(t=m?.onerror)!==null&&t!==void 0?t:function(w){},onclose:(o=m?.onclose)!==null&&o!==void 0?o:function(w){}},E=this.webSocketFactory.create(d,Sp(l),b);E.connect(),await p;let T={setup:{model:L(this.apiClient,e.model)}};return E.send(JSON.stringify(T)),new qo(E,this.apiClient)}},qo=class{static{f(this,"LiveMusicSession")}constructor(e,t){this.conn=e,this.apiClient=t}async setWeightedPrompts(e){if(!e.weightedPrompts||Object.keys(e.weightedPrompts).length===0)throw new Error("Weighted prompts must be set and contain at least one entry.");let t=jd(e);this.conn.send(JSON.stringify({clientContent:t}))}async setMusicGenerationConfig(e){e.musicGenerationConfig||(e.musicGenerationConfig={});let t=Zd(e);this.conn.send(JSON.stringify(t))}sendPlaybackControl(e){let t={playbackControl:e};this.conn.send(JSON.stringify(t))}play(){this.sendPlaybackControl(st.PLAY)}pause(){this.sendPlaybackControl(st.PAUSE)}stop(){this.sendPlaybackControl(st.STOP)}resetContext(){this.sendPlaybackControl(st.RESET_CONTEXT)}close(){this.conn.close()}};function Sp(n){let e={};return n.forEach((t,o)=>{e[o]=t}),e}f(Sp,"headersToMap$1");function Ap(n){let e=new Headers;for(let[t,o]of Object.entries(n))e.append(t,o);return e}f(Ap,"mapToHeaders$1");var xp="FunctionResponse request must have an `id` field from the response of a ToolCall.FunctionalCalls in Google AI.";async function Pp(n,e,t){let o=new So,i;t.data instanceof Blob?i=await t.data.text():t.data instanceof ArrayBuffer?i=new TextDecoder().decode(t.data):i=t.data;let s=JSON.parse(i);if(n.isVertexAI()){let l=nu(s);Object.assign(o,l)}else Object.assign(o,s);e(o)}f(Pp,"handleWebSocketMessage");var Bo=class{static{f(this,"Live")}constructor(e,t,o){this.apiClient=e,this.auth=t,this.webSocketFactory=o,this.music=new Ho(this.apiClient,this.auth,this.webSocketFactory)}async connect(e){var t,o,i,s,l,c;if(e.config&&e.config.httpOptions)throw new Error("The Live module does not support httpOptions at request-level in LiveConnectConfig yet. Please use the client-level httpOptions configuration instead.");let d=this.apiClient.getWebsocketBaseUrl(),u=this.apiClient.getApiVersion(),p,m=this.apiClient.getHeaders();e.config&&e.config.tools&&Ga(e.config.tools)&&Da(m);let h=$p(m);if(this.apiClient.isVertexAI())p=`${d}/ws/google.cloud.aiplatform.${u}.LlmBidiService/BidiGenerateContent`,await this.auth.addAuthHeaders(h,p);else{let A=this.apiClient.getApiKey(),G="BidiGenerateContent",B="key";A?.startsWith("auth_tokens/")&&(console.warn("Warning: Ephemeral token support is experimental and may change in future versions."),u!=="v1alpha"&&console.warn("Warning: The SDK's ephemeral token support is in v1alpha only. Please use const ai = new GoogleGenAI({apiKey: token.name, httpOptions: { apiVersion: 'v1alpha' }}); before session connection."),G="BidiGenerateContentConstrained",B="access_token"),p=`${d}/ws/google.ai.generativelanguage.${u}.GenerativeService.${G}?${B}=${A}`}let g=f(()=>{},"onopenResolve"),b=new Promise(A=>{g=A}),E=e.callbacks,I=f(function(){var A;(A=E?.onopen)===null||A===void 0||A.call(E),g({})},"onopenAwaitedCallback"),v=this.apiClient,T={onopen:I,onmessage:f(A=>{Pp(v,E.onmessage,A)},"onmessage"),onerror:(t=E?.onerror)!==null&&t!==void 0?t:function(A){},onclose:(o=E?.onclose)!==null&&o!==void 0?o:function(A){}},w=this.webSocketFactory.create(p,Rp(h),T);w.connect(),await b;let C=L(this.apiClient,e.model);if(this.apiClient.isVertexAI()&&C.startsWith("publishers/")){let A=this.apiClient.getProject(),G=this.apiClient.getLocation();C=`projects/${A}/locations/${G}/`+C}let S={};this.apiClient.isVertexAI()&&((i=e.config)===null||i===void 0?void 0:i.responseModalities)===void 0&&(e.config===void 0?e.config={responseModalities:[Xt.AUDIO]}:e.config.responseModalities=[Xt.AUDIO]),!((s=e.config)===null||s===void 0)&&s.generationConfig&&console.warn("Setting `LiveConnectConfig.generation_config` is deprecated, please set the fields on `LiveConnectConfig` directly. This will become an error in a future version (not before Q3 2025).");let $=(c=(l=e.config)===null||l===void 0?void 0:l.tools)!==null&&c!==void 0?c:[],P=[];for(let A of $)if(this.isCallableTool(A)){let G=A;P.push(await G.tool())}else P.push(A);P.length>0&&(e.config.tools=P);let F={model:C,config:e.config,callbacks:e.callbacks};return this.apiClient.isVertexAI()?S=Qd(this.apiClient,F):S=Yd(this.apiClient,F),delete S.config,w.send(JSON.stringify(S)),new Oo(w,this.apiClient)}isCallableTool(e){return"callTool"in e&&typeof e.callTool=="function"}},Np={turnComplete:!0},Oo=class{static{f(this,"Session")}constructor(e,t){this.conn=e,this.apiClient=t}tLiveClientContent(e,t){if(t.turns!==null&&t.turns!==void 0){let o=[];try{o=ce(t.turns),e.isVertexAI()||(o=o.map(i=>An(i)))}catch{throw new Error(`Failed to parse client content "turns", type: '${typeof t.turns}'`)}return{clientContent:{turns:o,turnComplete:t.turnComplete}}}return{clientContent:{turnComplete:t.turnComplete}}}tLiveClienttToolResponse(e,t){let o=[];if(t.functionResponses==null)throw new Error("functionResponses is required.");if(Array.isArray(t.functionResponses)?o=t.functionResponses:o=[t.functionResponses],o.length===0)throw new Error("functionResponses is required.");for(let s of o){if(typeof s!="object"||s===null||!("name"in s)||!("response"in s))throw new Error(`Could not parse function response, type '${typeof s}'.`);if(!e.isVertexAI()&&!("id"in s))throw new Error(xp)}return{toolResponse:{functionResponses:o}}}sendClientContent(e){e=Object.assign(Object.assign({},Np),e);let t=this.tLiveClientContent(this.apiClient,e);this.conn.send(JSON.stringify(t))}sendRealtimeInput(e){let t={};this.apiClient.isVertexAI()?t={realtimeInput:tu(e)}:t={realtimeInput:eu(e)},this.conn.send(JSON.stringify(t))}sendToolResponse(e){if(e.functionResponses==null)throw new Error("Tool response parameters are required.");let t=this.tLiveClienttToolResponse(this.apiClient,e);this.conn.send(JSON.stringify(t))}close(){this.conn.close()}};function Rp(n){let e={};return n.forEach((t,o)=>{e[o]=t}),e}f(Rp,"headersToMap");function $p(n){let e=new Headers;for(let[t,o]of Object.entries(n))e.append(t,o);return e}f($p,"mapToHeaders");var Qs=10;function Zs(n){var e,t,o;if(!((e=n?.automaticFunctionCalling)===null||e===void 0)&&e.disable)return!0;let i=!1;for(let l of(t=n?.tools)!==null&&t!==void 0?t:[])if(lt(l)){i=!0;break}if(!i)return!0;let s=(o=n?.automaticFunctionCalling)===null||o===void 0?void 0:o.maximumRemoteCalls;return s&&(s<0||!Number.isInteger(s))||s==0?(console.warn("Invalid maximumRemoteCalls value provided for automatic function calling. Disabled automatic function calling. Please provide a valid integer value greater than 0. maximumRemoteCalls provided:",s),!0):!1}f(Zs,"shouldDisableAfc");function lt(n){return"callTool"in n&&typeof n.callTool=="function"}f(lt,"isCallableTool");function Mp(n){var e,t,o;return(o=(t=(e=n.config)===null||e===void 0?void 0:e.tools)===null||t===void 0?void 0:t.some(i=>lt(i)))!==null&&o!==void 0?o:!1}f(Mp,"hasCallableTools");function js(n){var e;let t=[];return!((e=n?.config)===null||e===void 0)&&e.tools&&n.config.tools.forEach((o,i)=>{if(lt(o))return;let s=o;s.functionDeclarations&&s.functionDeclarations.length>0&&t.push(i)}),t}f(js,"findAfcIncompatibleToolIndexes");function ea(n){var e;return!(!((e=n?.automaticFunctionCalling)===null||e===void 0)&&e.ignoreCallHistory)}f(ea,"shouldAppendAfcHistory");var zo=class extends he{static{f(this,"Models")}constructor(e){super(),this.apiClient=e,this.generateContent=async t=>{var o,i,s,l,c;let d=await this.processParamsMaybeAddMcpUsage(t);if(this.maybeMoveToResponseJsonSchem(t),!Mp(t)||Zs(t.config))return await this.generateContentInternal(d);let u=js(t);if(u.length>0){let E=u.map(I=>`tools[${I}]`).join(", ");throw new Error(`Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations is not yet supported. Incompatible tools found at ${E}.`)}let p,m,h=ce(d.contents),g=(s=(i=(o=d.config)===null||o===void 0?void 0:o.automaticFunctionCalling)===null||i===void 0?void 0:i.maximumRemoteCalls)!==null&&s!==void 0?s:Qs,b=0;for(;b<g&&(p=await this.generateContentInternal(d),!(!p.functionCalls||p.functionCalls.length===0));){let E=p.candidates[0].content,I=[];for(let v of(c=(l=t.config)===null||l===void 0?void 0:l.tools)!==null&&c!==void 0?c:[])if(lt(v)){let w=await v.callTool(p.functionCalls);I.push(...w)}b++,m={role:"user",parts:I},d.contents=ce(d.contents),d.contents.push(E),d.contents.push(m),ea(d.config)&&(h.push(E),h.push(m))}return ea(d.config)&&(p.automaticFunctionCallingHistory=h),p},this.generateContentStream=async t=>{var o,i,s,l,c;if(this.maybeMoveToResponseJsonSchem(t),Zs(t.config)){let m=await this.processParamsMaybeAddMcpUsage(t);return await this.generateContentStreamInternal(m)}let d=js(t);if(d.length>0){let m=d.map(h=>`tools[${h}]`).join(", ");throw new Error(`Incompatible tools found at ${m}. Automatic function calling with CallableTools (or MCP objects) and basic FunctionDeclarations" is not yet supported.`)}let u=(s=(i=(o=t?.config)===null||o===void 0?void 0:o.toolConfig)===null||i===void 0?void 0:i.functionCallingConfig)===null||s===void 0?void 0:s.streamFunctionCallArguments,p=(c=(l=t?.config)===null||l===void 0?void 0:l.automaticFunctionCalling)===null||c===void 0?void 0:c.disable;if(u&&!p)throw new Error("Running in streaming mode with 'streamFunctionCallArguments' enabled, this feature is not compatible with automatic function calling (AFC). Please set 'config.automaticFunctionCalling.disable' to true to disable AFC or leave 'config.toolConfig.functionCallingConfig.streamFunctionCallArguments' to be undefined or set to false to disable streaming function call arguments feature.");return await this.processAfcStream(t)},this.generateImages=async t=>await this.generateImagesInternal(t).then(o=>{var i;let s,l=[];if(o?.generatedImages)for(let d of o.generatedImages)d&&d?.safetyAttributes&&((i=d?.safetyAttributes)===null||i===void 0?void 0:i.contentType)==="Positive Prompt"?s=d?.safetyAttributes:l.push(d);let c;return s?c={generatedImages:l,positivePromptSafetyAttributes:s,sdkHttpResponse:o.sdkHttpResponse}:c={generatedImages:l,sdkHttpResponse:o.sdkHttpResponse},c}),this.list=async t=>{var o;let l={config:Object.assign(Object.assign({},{queryBase:!0}),t?.config)};if(this.apiClient.isVertexAI()&&!l.config.queryBase){if(!((o=l.config)===null||o===void 0)&&o.filter)throw new Error("Filtering tuned models list for Vertex AI is not currently supported");l.config.filter="labels.tune-type:*"}return new Se(Ce.PAGED_ITEM_MODELS,c=>this.listInternal(c),await this.listInternal(l),l)},this.editImage=async t=>{let o={model:t.model,prompt:t.prompt,referenceImages:[],config:t.config};return t.referenceImages&&t.referenceImages&&(o.referenceImages=t.referenceImages.map(i=>i.toReferenceImageAPI())),await this.editImageInternal(o)},this.upscaleImage=async t=>{let o={numberOfImages:1,mode:"upscale"};t.config&&(o=Object.assign(Object.assign({},o),t.config));let i={model:t.model,image:t.image,upscaleFactor:t.upscaleFactor,config:o};return await this.upscaleImageInternal(i)},this.generateVideos=async t=>{var o,i,s,l,c,d;if((t.prompt||t.image||t.video)&&t.source)throw new Error("Source and prompt/image/video are mutually exclusive. Please only use source.");return this.apiClient.isVertexAI()||(!((o=t.video)===null||o===void 0)&&o.uri&&(!((i=t.video)===null||i===void 0)&&i.videoBytes)?t.video={uri:t.video.uri,mimeType:t.video.mimeType}:!((l=(s=t.source)===null||s===void 0?void 0:s.video)===null||l===void 0)&&l.uri&&(!((d=(c=t.source)===null||c===void 0?void 0:c.video)===null||d===void 0)&&d.videoBytes)&&(t.source.video={uri:t.source.video.uri,mimeType:t.source.video.mimeType})),await this.generateVideosInternal(t)}}maybeMoveToResponseJsonSchem(e){e.config&&e.config.responseSchema&&(e.config.responseJsonSchema||Object.keys(e.config.responseSchema).includes("$schema")&&(e.config.responseJsonSchema=e.config.responseSchema,delete e.config.responseSchema))}async processParamsMaybeAddMcpUsage(e){var t,o,i;let s=(t=e.config)===null||t===void 0?void 0:t.tools;if(!s)return e;let l=await Promise.all(s.map(async d=>lt(d)?await d.tool():d)),c={model:e.model,contents:e.contents,config:Object.assign(Object.assign({},e.config),{tools:l})};if(c.config.tools=l,e.config&&e.config.tools&&Ga(e.config.tools)){let d=(i=(o=e.config.httpOptions)===null||o===void 0?void 0:o.headers)!==null&&i!==void 0?i:{},u=Object.assign({},d);Object.keys(u).length===0&&(u=this.apiClient.getDefaultHeaders()),Da(u),c.config.httpOptions=Object.assign(Object.assign({},e.config.httpOptions),{headers:u})}return c}async initAfcToolsMap(e){var t,o,i;let s=new Map;for(let l of(o=(t=e.config)===null||t===void 0?void 0:t.tools)!==null&&o!==void 0?o:[])if(lt(l)){let c=l,d=await c.tool();for(let u of(i=d.functionDeclarations)!==null&&i!==void 0?i:[]){if(!u.name)throw new Error("Function declaration name is required.");if(s.has(u.name))throw new Error(`Duplicate tool declaration name: ${u.name}`);s.set(u.name,c)}}return s}async processAfcStream(e){var t,o,i;let s=(i=(o=(t=e.config)===null||t===void 0?void 0:t.automaticFunctionCalling)===null||o===void 0?void 0:o.maximumRemoteCalls)!==null&&i!==void 0?i:Qs,l=!1,c=0,d=await this.initAfcToolsMap(e);return function(u,p,m){return pe(this,arguments,function*(){for(var h,g,b,E,I,v;c<s;){l&&(c++,l=!1);let S=yield N(u.processParamsMaybeAddMcpUsage(m)),$=yield N(u.generateContentStreamInternal(S)),P=[],F=[];try{for(var T=!0,w=(g=void 0,me($)),C;C=yield N(w.next()),h=C.done,!h;T=!0){E=C.value,T=!1;let A=E;if(yield yield N(A),A.candidates&&(!((I=A.candidates[0])===null||I===void 0)&&I.content)){F.push(A.candidates[0].content);for(let G of(v=A.candidates[0].content.parts)!==null&&v!==void 0?v:[])if(c<s&&G.functionCall){if(!G.functionCall.name)throw new Error("Function call name was not returned by the model.");if(p.has(G.functionCall.name)){let B=yield N(p.get(G.functionCall.name).callTool([G.functionCall]));P.push(...B)}else throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${p.keys()}, mising tool: ${G.functionCall.name}`)}}}}catch(A){g={error:A}}finally{try{!T&&!h&&(b=w.return)&&(yield N(b.call(w)))}finally{if(g)throw g.error}}if(P.length>0){l=!0;let A=new Je;A.candidates=[{content:{role:"user",parts:P}}],yield yield N(A);let G=[];G.push(...F),G.push({role:"user",parts:P});let B=ce(m.contents).concat(G);m.contents=B}else break}})}(this,d,e)}async generateContentInternal(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Ws(this.apiClient,e);return c=_("{model}:generateContent",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Xs(p),h=new Je;return Object.assign(h,m),h})}else{let u=Js(this.apiClient,e);return c=_("{model}:generateContent",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Ks(p),h=new Je;return Object.assign(h,m),h})}}async generateContentStreamInternal(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Ws(this.apiClient,e);return c=_("{model}:streamGenerateContent?alt=sse",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.requestStream({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}),l.then(function(m){return pe(this,arguments,function*(){var h,g,b,E;try{for(var I=!0,v=me(m),T;T=yield N(v.next()),h=T.done,!h;I=!0){E=T.value,I=!1;let w=E,C=Xs(yield N(w.json()));C.sdkHttpResponse={headers:w.headers};let S=new Je;Object.assign(S,C),yield yield N(S)}}catch(w){g={error:w}}finally{try{!I&&!h&&(b=v.return)&&(yield N(b.call(v)))}finally{if(g)throw g.error}}})})}else{let u=Js(this.apiClient,e);return c=_("{model}:streamGenerateContent?alt=sse",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.requestStream({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}),l.then(function(m){return pe(this,arguments,function*(){var h,g,b,E;try{for(var I=!0,v=me(m),T;T=yield N(v.next()),h=T.done,!h;I=!0){E=T.value,I=!1;let w=E,C=Ks(yield N(w.json()));C.sdkHttpResponse={headers:w.headers};let S=new Je;Object.assign(S,C),yield yield N(S)}}catch(w){g={error:w}}finally{try{!I&&!h&&(b=v.return)&&(yield N(b.call(v)))}finally{if(g)throw g.error}}})})}}async embedContent(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=$u(this.apiClient,e);return c=_("{model}:predict",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Gu(p),h=new Qt;return Object.assign(h,m),h})}else{let u=Ru(this.apiClient,e);return c=_("{model}:batchEmbedContents",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Mu(p),h=new Qt;return Object.assign(h,m),h})}}async generateImagesInternal(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=zu(this.apiClient,e);return c=_("{model}:predict",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Wu(p),h=new Zt;return Object.assign(h,m),h})}else{let u=Ou(this.apiClient,e);return c=_("{model}:predict",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Ju(p),h=new Zt;return Object.assign(h,m),h})}}async editImageInternal(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let c=Au(this.apiClient,e);return s=_("{model}:predict",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json().then(u=>{let p=u;return p.sdkHttpResponse={headers:d.headers},p})),i.then(d=>{let u=xu(d),p=new mo;return Object.assign(p,u),p})}else throw new Error("This method is only supported by the Vertex AI.")}async upscaleImageInternal(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let c=Jf(this.apiClient,e);return s=_("{model}:predict",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json().then(u=>{let p=u;return p.sdkHttpResponse={headers:d.headers},p})),i.then(d=>{let u=Wf(d),p=new ho;return Object.assign(p,u),p})}else throw new Error("This method is only supported by the Vertex AI.")}async recontextImage(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let c=Af(this.apiClient,e);return s=_("{model}:predict",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>{let u=xf(d),p=new go;return Object.assign(p,u),p})}else throw new Error("This method is only supported by the Vertex AI.")}async segmentImage(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let c=Gf(this.apiClient,e);return s=_("{model}:predict",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>{let u=Df(d),p=new bo;return Object.assign(p,u),p})}else throw new Error("This method is only supported by the Vertex AI.")}async get(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=uf(this.apiClient,e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json()),l.then(p=>ko(p))}else{let u=df(this.apiClient,e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),l.then(p=>Lo(p))}}async listInternal(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=If(this.apiClient,e);return c=_("{models_url}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Tf(p),h=new jt;return Object.assign(h,m),h})}else{let u=Ef(this.apiClient,e);return c=_("{models_url}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=vf(p),h=new jt;return Object.assign(h,m),h})}}async update(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Of(this.apiClient,e);return c=_("{model}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"PATCH",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json()),l.then(p=>ko(p))}else{let u=Bf(this.apiClient,e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"PATCH",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),l.then(p=>Lo(p))}}async delete(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=wu(this.apiClient,e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Cu(p),h=new en;return Object.assign(h,m),h})}else{let u=Tu(this.apiClient,e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"DELETE",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=_u(p),h=new en;return Object.assign(h,m),h})}}async countTokens(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Eu(this.apiClient,e);return c=_("{model}:countTokens",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=vu(p),h=new tn;return Object.assign(h,m),h})}else{let u=yu(this.apiClient,e);return c=_("{model}:countTokens",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Iu(p),h=new tn;return Object.assign(h,m),h})}}async computeTokens(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let c=uu(this.apiClient,e);return s=_("{model}:computeTokens",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json().then(u=>{let p=u;return p.sdkHttpResponse={headers:d.headers},p})),i.then(d=>{let u=fu(d),p=new yo;return Object.assign(p,u),p})}else throw new Error("This method is only supported by the Vertex AI.")}async generateVideosInternal(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=ju(this.apiClient,e);return c=_("{model}:predictLongRunning",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json()),l.then(p=>{let m=Qu(p),h=new nn;return Object.assign(h,m),h})}else{let u=Zu(this.apiClient,e);return c=_("{model}:predictLongRunning",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),l.then(p=>{let m=Yu(p),h=new nn;return Object.assign(h,m),h})}}};var Jo=class extends he{static{f(this,"Operations")}constructor(e){super(),this.apiClient=e}async getVideosOperation(e){let t=e.operation,o=e.config;if(t.name===void 0||t.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){let i=t.name.split("/operations/")[0],s;o&&"httpOptions"in o&&(s=o.httpOptions);let l=await this.fetchPredictVideosOperationInternal({operationName:t.name,resourceName:i,config:{httpOptions:s}});return t._fromAPIResponse({apiResponse:l,_isVertexAI:!0})}else{let i=await this.getVideosOperationInternal({operationName:t.name,config:o});return t._fromAPIResponse({apiResponse:i,_isVertexAI:!1})}}async get(e){let t=e.operation,o=e.config;if(t.name===void 0||t.name==="")throw new Error("Operation name is required.");if(this.apiClient.isVertexAI()){let i=t.name.split("/operations/")[0],s;o&&"httpOptions"in o&&(s=o.httpOptions);let l=await this.fetchPredictVideosOperationInternal({operationName:t.name,resourceName:i,config:{httpOptions:s}});return t._fromAPIResponse({apiResponse:l,_isVertexAI:!0})}else{let i=await this.getVideosOperationInternal({operationName:t.name,config:o});return t._fromAPIResponse({apiResponse:i,_isVertexAI:!1})}}async getVideosOperationInternal(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Kl(e);return c=_("{operationName}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json()),l}else{let u=Wl(e);return c=_("{operationName}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json()),l}}async fetchPredictVideosOperationInternal(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let c=Vl(e);return s=_("{resourceName}:fetchPredictOperation",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i}else throw new Error("This method is only supported by the Vertex AI.")}};function Gp(n){let e={},t=r(n,["data"]);if(t!=null&&a(e,["data"],t),r(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f(Gp,"blobToMldev");function Dp(n){let e={},t=r(n,["parts"]);if(t!=null){let i=t;Array.isArray(i)&&(i=i.map(s=>Op(s))),a(e,["parts"],i)}let o=r(n,["role"]);return o!=null&&a(e,["role"],o),e}f(Dp,"contentToMldev");function Lp(n,e,t){let o={},i=r(e,["expireTime"]);t!==void 0&&i!=null&&a(t,["expireTime"],i);let s=r(e,["newSessionExpireTime"]);t!==void 0&&s!=null&&a(t,["newSessionExpireTime"],s);let l=r(e,["uses"]);t!==void 0&&l!=null&&a(t,["uses"],l);let c=r(e,["liveConnectConstraints"]);t!==void 0&&c!=null&&a(t,["bidiGenerateContentSetup"],Bp(n,c));let d=r(e,["lockAdditionalFields"]);return t!==void 0&&d!=null&&a(t,["fieldMask"],d),o}f(Lp,"createAuthTokenConfigToMldev");function kp(n,e){let t={},o=r(e,["config"]);return o!=null&&a(t,["config"],Lp(n,o,t)),t}f(kp,"createAuthTokenParametersToMldev");function Up(n){let e={};if(r(n,["displayName"])!==void 0)throw new Error("displayName parameter is not supported in Gemini API.");let t=r(n,["fileUri"]);t!=null&&a(e,["fileUri"],t);let o=r(n,["mimeType"]);return o!=null&&a(e,["mimeType"],o),e}f(Up,"fileDataToMldev");function Fp(n){let e={},t=r(n,["id"]);t!=null&&a(e,["id"],t);let o=r(n,["args"]);o!=null&&a(e,["args"],o);let i=r(n,["name"]);if(i!=null&&a(e,["name"],i),r(n,["partialArgs"])!==void 0)throw new Error("partialArgs parameter is not supported in Gemini API.");if(r(n,["willContinue"])!==void 0)throw new Error("willContinue parameter is not supported in Gemini API.");return e}f(Fp,"functionCallToMldev");function Vp(n){let e={};if(r(n,["authConfig"])!==void 0)throw new Error("authConfig parameter is not supported in Gemini API.");let t=r(n,["enableWidget"]);return t!=null&&a(e,["enableWidget"],t),e}f(Vp,"googleMapsToMldev");function Hp(n){let e={};if(r(n,["excludeDomains"])!==void 0)throw new Error("excludeDomains parameter is not supported in Gemini API.");if(r(n,["blockingConfidence"])!==void 0)throw new Error("blockingConfidence parameter is not supported in Gemini API.");let t=r(n,["timeRangeFilter"]);return t!=null&&a(e,["timeRangeFilter"],t),e}f(Hp,"googleSearchToMldev");function qp(n,e){let t={},o=r(n,["generationConfig"]);e!==void 0&&o!=null&&a(e,["setup","generationConfig"],o);let i=r(n,["responseModalities"]);e!==void 0&&i!=null&&a(e,["setup","generationConfig","responseModalities"],i);let s=r(n,["temperature"]);e!==void 0&&s!=null&&a(e,["setup","generationConfig","temperature"],s);let l=r(n,["topP"]);e!==void 0&&l!=null&&a(e,["setup","generationConfig","topP"],l);let c=r(n,["topK"]);e!==void 0&&c!=null&&a(e,["setup","generationConfig","topK"],c);let d=r(n,["maxOutputTokens"]);e!==void 0&&d!=null&&a(e,["setup","generationConfig","maxOutputTokens"],d);let u=r(n,["mediaResolution"]);e!==void 0&&u!=null&&a(e,["setup","generationConfig","mediaResolution"],u);let p=r(n,["seed"]);e!==void 0&&p!=null&&a(e,["setup","generationConfig","seed"],p);let m=r(n,["speechConfig"]);e!==void 0&&m!=null&&a(e,["setup","generationConfig","speechConfig"],mi(m));let h=r(n,["thinkingConfig"]);e!==void 0&&h!=null&&a(e,["setup","generationConfig","thinkingConfig"],h);let g=r(n,["enableAffectiveDialog"]);e!==void 0&&g!=null&&a(e,["setup","generationConfig","enableAffectiveDialog"],g);let b=r(n,["systemInstruction"]);e!==void 0&&b!=null&&a(e,["setup","systemInstruction"],Dp(j(b)));let E=r(n,["tools"]);if(e!==void 0&&E!=null){let $=ft(E);Array.isArray($)&&($=$.map(P=>Jp(ut(P)))),a(e,["setup","tools"],$)}let I=r(n,["sessionResumption"]);e!==void 0&&I!=null&&a(e,["setup","sessionResumption"],zp(I));let v=r(n,["inputAudioTranscription"]);e!==void 0&&v!=null&&a(e,["setup","inputAudioTranscription"],v);let T=r(n,["outputAudioTranscription"]);e!==void 0&&T!=null&&a(e,["setup","outputAudioTranscription"],T);let w=r(n,["realtimeInputConfig"]);e!==void 0&&w!=null&&a(e,["setup","realtimeInputConfig"],w);let C=r(n,["contextWindowCompression"]);e!==void 0&&C!=null&&a(e,["setup","contextWindowCompression"],C);let S=r(n,["proactivity"]);if(e!==void 0&&S!=null&&a(e,["setup","proactivity"],S),r(n,["explicitVadSignal"])!==void 0)throw new Error("explicitVadSignal parameter is not supported in Gemini API.");return t}f(qp,"liveConnectConfigToMldev");function Bp(n,e){let t={},o=r(e,["model"]);o!=null&&a(t,["setup","model"],L(n,o));let i=r(e,["config"]);return i!=null&&a(t,["config"],qp(i,t)),t}f(Bp,"liveConnectConstraintsToMldev");function Op(n){let e={},t=r(n,["mediaResolution"]);t!=null&&a(e,["mediaResolution"],t);let o=r(n,["codeExecutionResult"]);o!=null&&a(e,["codeExecutionResult"],o);let i=r(n,["executableCode"]);i!=null&&a(e,["executableCode"],i);let s=r(n,["fileData"]);s!=null&&a(e,["fileData"],Up(s));let l=r(n,["functionCall"]);l!=null&&a(e,["functionCall"],Fp(l));let c=r(n,["functionResponse"]);c!=null&&a(e,["functionResponse"],c);let d=r(n,["inlineData"]);d!=null&&a(e,["inlineData"],Gp(d));let u=r(n,["text"]);u!=null&&a(e,["text"],u);let p=r(n,["thought"]);p!=null&&a(e,["thought"],p);let m=r(n,["thoughtSignature"]);m!=null&&a(e,["thoughtSignature"],m);let h=r(n,["videoMetadata"]);return h!=null&&a(e,["videoMetadata"],h),e}f(Op,"partToMldev");function zp(n){let e={},t=r(n,["handle"]);if(t!=null&&a(e,["handle"],t),r(n,["transparent"])!==void 0)throw new Error("transparent parameter is not supported in Gemini API.");return e}f(zp,"sessionResumptionConfigToMldev");function Jp(n){let e={},t=r(n,["functionDeclarations"]);if(t!=null){let p=t;Array.isArray(p)&&(p=p.map(m=>m)),a(e,["functionDeclarations"],p)}if(r(n,["retrieval"])!==void 0)throw new Error("retrieval parameter is not supported in Gemini API.");let o=r(n,["googleSearchRetrieval"]);o!=null&&a(e,["googleSearchRetrieval"],o);let i=r(n,["computerUse"]);i!=null&&a(e,["computerUse"],i);let s=r(n,["fileSearch"]);s!=null&&a(e,["fileSearch"],s);let l=r(n,["codeExecution"]);if(l!=null&&a(e,["codeExecution"],l),r(n,["enterpriseWebSearch"])!==void 0)throw new Error("enterpriseWebSearch parameter is not supported in Gemini API.");let c=r(n,["googleMaps"]);c!=null&&a(e,["googleMaps"],Vp(c));let d=r(n,["googleSearch"]);d!=null&&a(e,["googleSearch"],Hp(d));let u=r(n,["urlContext"]);return u!=null&&a(e,["urlContext"],u),e}f(Jp,"toolToMldev");function Wp(n){let e=[];for(let t in n)if(Object.prototype.hasOwnProperty.call(n,t)){let o=n[t];if(typeof o=="object"&&o!=null&&Object.keys(o).length>0){let i=Object.keys(o).map(s=>`${t}.${s}`);e.push(...i)}else e.push(t)}return e.join(",")}f(Wp,"getFieldMasks");function Kp(n,e){let t=null,o=n.bidiGenerateContentSetup;if(typeof o=="object"&&o!==null&&"setup"in o){let s=o.setup;typeof s=="object"&&s!==null?(n.bidiGenerateContentSetup=s,t=s):delete n.bidiGenerateContentSetup}else o!==void 0&&delete n.bidiGenerateContentSetup;let i=n.fieldMask;if(t){let s=Wp(t);if(Array.isArray(e?.lockAdditionalFields)&&e?.lockAdditionalFields.length===0)s?n.fieldMask=s:delete n.fieldMask;else if(e?.lockAdditionalFields&&e.lockAdditionalFields.length>0&&i!==null&&Array.isArray(i)&&i.length>0){let l=["temperature","topK","topP","maxOutputTokens","responseModalities","seed","speechConfig"],c=[];i.length>0&&(c=i.map(u=>l.includes(u)?`generationConfig.${u}`:u));let d=[];s&&d.push(s),c.length>0&&d.push(...c),d.length>0?n.fieldMask=d.join(","):delete n.fieldMask}else delete n.fieldMask}else i!==null&&Array.isArray(i)&&i.length>0?n.fieldMask=i.join(","):delete n.fieldMask;return n}f(Kp,"convertBidiSetupToTokenSetup");var Wo=class extends he{static{f(this,"Tokens")}constructor(e){super(),this.apiClient=e}async create(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("The client.tokens.create method is only supported by the Gemini Developer API.");{let c=kp(this.apiClient,e);s=_("auth_tokens",c._url),l=c._query,delete c.config,delete c._url,delete c._query;let d=Kp(c,e.config);return i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(d),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(u=>u.json()),i.then(u=>u)}}};function Xp(n,e){let t={},o=r(n,["force"]);return e!==void 0&&o!=null&&a(e,["_query","force"],o),t}f(Xp,"deleteDocumentConfigToMldev");function Yp(n){let e={},t=r(n,["name"]);t!=null&&a(e,["_url","name"],t);let o=r(n,["config"]);return o!=null&&Xp(o,e),e}f(Yp,"deleteDocumentParametersToMldev");function Qp(n){let e={},t=r(n,["name"]);return t!=null&&a(e,["_url","name"],t),e}f(Qp,"getDocumentParametersToMldev");function Zp(n,e){let t={},o=r(n,["pageSize"]);e!==void 0&&o!=null&&a(e,["_query","pageSize"],o);let i=r(n,["pageToken"]);return e!==void 0&&i!=null&&a(e,["_query","pageToken"],i),t}f(Zp,"listDocumentsConfigToMldev");function jp(n){let e={},t=r(n,["parent"]);t!=null&&a(e,["_url","parent"],t);let o=r(n,["config"]);return o!=null&&Zp(o,e),e}f(jp,"listDocumentsParametersToMldev");function em(n){let e={},t=r(n,["sdkHttpResponse"]);t!=null&&a(e,["sdkHttpResponse"],t);let o=r(n,["nextPageToken"]);o!=null&&a(e,["nextPageToken"],o);let i=r(n,["documents"]);if(i!=null){let s=i;Array.isArray(s)&&(s=s.map(l=>l)),a(e,["documents"],s)}return e}f(em,"listDocumentsResponseFromMldev");var Ko=class extends he{static{f(this,"Documents")}constructor(e){super(),this.apiClient=e,this.list=async t=>new Se(Ce.PAGED_ITEM_DOCUMENTS,o=>this.listInternal({parent:t.parent,config:o.config}),await this.listInternal(t),t)}async get(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=Qp(e);return s=_("{name}",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>d)}}async delete(e){var t,o;let i="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let l=Yp(e);i=_("{name}",l._url),s=l._query,delete l._url,delete l._query,await this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal})}}async listInternal(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=jp(e);return s=_("{parent}/documents",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>{let u=em(d),p=new Eo;return Object.assign(p,u),p})}}};var Xo=class extends he{static{f(this,"FileSearchStores")}constructor(e,t=new Ko(e)){super(),this.apiClient=e,this.documents=t,this.list=async(o={})=>new Se(Ce.PAGED_ITEM_FILE_SEARCH_STORES,i=>this.listInternal(i),await this.listInternal(o),o)}async uploadToFileSearchStore(e){if(this.apiClient.isVertexAI())throw new Error("Vertex AI does not support uploading files to a file search store.");return this.apiClient.uploadFileToFileSearchStore(e.fileSearchStoreName,e.file,e.config)}async create(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=ep(e);return s=_("fileSearchStores",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>d)}}async get(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=op(e);return s=_("{name}",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>d)}}async delete(e){var t,o;let i="",s={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let l=np(e);i=_("{name}",l._url),s=l._query,delete l._url,delete l._query,await this.apiClient.request({path:i,queryParams:s,body:JSON.stringify(l),httpMethod:"DELETE",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal})}}async listInternal(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=cp(e);return s=_("fileSearchStores",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>{let u=dp(d),p=new Io;return Object.assign(p,u),p})}}async uploadToFileSearchStoreInternal(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=up(e);return s=_("upload/v1beta/{file_search_store_name}:uploadToFileSearchStore",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>{let u=fp(d),p=new vo;return Object.assign(p,u),p})}}async importFile(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=sp(e);return s=_("{file_search_store_name}:importFile",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json()),i.then(d=>{let u=rp(d),p=new To;return Object.assign(p,u),p})}}};var La=f(function(){let{crypto:n}=globalThis;if(n?.randomUUID)return La=n.randomUUID.bind(n),n.randomUUID();let e=new Uint8Array(1),t=n?()=>n.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,o=>(+o^t()&15>>+o/4).toString(16))},"uuid4Internal"),tm=f(()=>La(),"uuid4");function Yo(n){return typeof n=="object"&&n!==null&&("name"in n&&n.name==="AbortError"||"message"in n&&String(n.message).includes("FetchRequestCanceledException"))}f(Yo,"isAbortError");var Qo=f(n=>{if(n instanceof Error)return n;if(typeof n=="object"&&n!==null){try{if(Object.prototype.toString.call(n)==="[object Error]"){let e=new Error(n.message,n.cause?{cause:n.cause}:{});return n.stack&&(e.stack=n.stack),n.cause&&!e.cause&&(e.cause=n.cause),n.name&&(e.name=n.name),e}}catch{}try{return new Error(JSON.stringify(n))}catch{}}return new Error(n)},"castToError");var ne=class extends Error{static{f(this,"GeminiNextGenAPIClientError")}},oe=class n extends ne{static{f(this,"APIError")}constructor(e,t,o,i){super(`${n.makeMessage(e,t,o)}`),this.status=e,this.headers=i,this.error=t}static makeMessage(e,t,o){let i=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):o;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,t,o,i){if(!e||!i)return new ct({message:o,cause:Qo(t)});let s=t;return e===400?new pn(e,s,o,i):e===401?new mn(e,s,o,i):e===403?new hn(e,s,o,i):e===404?new gn(e,s,o,i):e===409?new bn(e,s,o,i):e===422?new yn(e,s,o,i):e===429?new En(e,s,o,i):e>=500?new In(e,s,o,i):new n(e,s,o,i)}},Ct=class extends oe{static{f(this,"APIUserAbortError")}constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},ct=class extends oe{static{f(this,"APIConnectionError")}constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},fn=class extends ct{static{f(this,"APIConnectionTimeoutError")}constructor({message:e}={}){super({message:e??"Request timed out."})}},pn=class extends oe{static{f(this,"BadRequestError")}},mn=class extends oe{static{f(this,"AuthenticationError")}},hn=class extends oe{static{f(this,"PermissionDeniedError")}},gn=class extends oe{static{f(this,"NotFoundError")}},bn=class extends oe{static{f(this,"ConflictError")}},yn=class extends oe{static{f(this,"UnprocessableEntityError")}},En=class extends oe{static{f(this,"RateLimitError")}},In=class extends oe{static{f(this,"InternalServerError")}};var nm=/^[a-z][a-z0-9+.-]*:/i,om=f(n=>nm.test(n),"isAbsoluteURL"),Zo=f(n=>(Zo=Array.isArray,Zo(n)),"isArrayInternal"),im=Zo,rm=im,ta=rm;function sm(n){if(!n)return!0;for(let e in n)return!1;return!0}f(sm,"isEmptyObj");function am(n,e){return Object.prototype.hasOwnProperty.call(n,e)}f(am,"hasOwn");var lm=f((n,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new ne(`${n} must be an integer`);if(e<0)throw new ne(`${n} must be a positive integer`);return e},"validatePositiveInteger"),cm=f(n=>{try{return JSON.parse(n)}catch{return}},"safeJSON");var dm=f(n=>new Promise(e=>setTimeout(e,n)),"sleep$1");var rt="0.0.1";function um(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}f(um,"getDetectedPlatform");var fm=f(()=>{var n,e,t,o,i;let s=um();if(s==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":rt,"X-Stainless-OS":oa(Deno.build.os),"X-Stainless-Arch":na(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:(e=(n=Deno.version)===null||n===void 0?void 0:n.deno)!==null&&e!==void 0?e:"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":rt,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(s==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":rt,"X-Stainless-OS":oa((t=globalThis.process.platform)!==null&&t!==void 0?t:"unknown"),"X-Stainless-Arch":na((o=globalThis.process.arch)!==null&&o!==void 0?o:"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":(i=globalThis.process.version)!==null&&i!==void 0?i:"unknown"};let l=pm();return l?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":rt,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${l.browser}`,"X-Stainless-Runtime-Version":l.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":rt,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},"getPlatformProperties");function pm(){if(typeof navigator>"u"||!navigator)return null;let n=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:t}of n){let o=t.exec(navigator.userAgent);if(o){let i=o[1]||0,s=o[2]||0,l=o[3]||0;return{browser:e,version:`${i}.${s}.${l}`}}}return null}f(pm,"getBrowserInfo");var na=f(n=>n==="x32"?"x32":n==="x86_64"||n==="x64"?"x64":n==="arm"?"arm":n==="aarch64"||n==="arm64"?"arm64":n?`other:${n}`:"unknown","normalizeArch"),oa=f(n=>(n=n.toLowerCase(),n.includes("ios")?"iOS":n==="android"?"Android":n==="darwin"?"MacOS":n==="win32"?"Windows":n==="freebsd"?"FreeBSD":n==="openbsd"?"OpenBSD":n==="linux"?"Linux":n?`Other:${n}`:"Unknown"),"normalizePlatform"),qt,mm=f(()=>qt??(qt=fm()),"getPlatformHeaders");function hm(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new GeminiNextGenAPIClient({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}f(hm,"getDefaultFetch");function ka(...n){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...n)}f(ka,"makeReadableStream");function gm(n){let e=Symbol.asyncIterator in n?n[Symbol.asyncIterator]():n[Symbol.iterator]();return ka({start(){},async pull(t){let{done:o,value:i}=await e.next();o?t.close():t.enqueue(i)},async cancel(){var t;await((t=e.return)===null||t===void 0?void 0:t.call(e))}})}f(gm,"ReadableStreamFrom");function Ua(n){if(n[Symbol.asyncIterator])return n;let e=n.getReader();return{async next(){try{let t=await e.read();return t?.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){let t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}f(Ua,"ReadableStreamToAsyncIterable");async function bm(n){var e,t;if(n===null||typeof n!="object")return;if(n[Symbol.asyncIterator]){await((t=(e=n[Symbol.asyncIterator]()).return)===null||t===void 0?void 0:t.call(e));return}let o=n.getReader(),i=o.cancel();o.releaseLock(),await i}f(bm,"CancelReadableStream");var ym=f(({headers:n,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)}),"FallbackEncoder");var Fa=f(()=>{var n;if(typeof File>"u"){let{process:e}=globalThis,t=typeof((n=e?.versions)===null||n===void 0?void 0:n.node)=="string"&&parseInt(e.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}},"checkFileSupport");function lo(n,e,t){return Fa(),new File(n,e??"unknown_file",t)}f(lo,"makeFile");function Em(n){return(typeof n=="object"&&n!==null&&("name"in n&&n.name&&String(n.name)||"url"in n&&n.url&&String(n.url)||"filename"in n&&n.filename&&String(n.filename)||"path"in n&&n.path&&String(n.path))||"").split(/[\\/]/).pop()||void 0}f(Em,"getName");var Im=f(n=>n!=null&&typeof n=="object"&&typeof n[Symbol.asyncIterator]=="function","isAsyncIterable");var Va=f(n=>n!=null&&typeof n=="object"&&typeof n.size=="number"&&typeof n.type=="string"&&typeof n.text=="function"&&typeof n.slice=="function"&&typeof n.arrayBuffer=="function","isBlobLike"),vm=f(n=>n!=null&&typeof n=="object"&&typeof n.name=="string"&&typeof n.lastModified=="number"&&Va(n),"isFileLike"),Tm=f(n=>n!=null&&typeof n=="object"&&typeof n.url=="string"&&typeof n.blob=="function","isResponseLike");async function wm(n,e,t){if(Fa(),n=await n,vm(n))return n instanceof File?n:lo([await n.arrayBuffer()],n.name);if(Tm(n)){let i=await n.blob();return e||(e=new URL(n.url).pathname.split(/[\\/]/).pop()),lo(await jo(i),e,t)}let o=await jo(n);if(e||(e=Em(n)),!t?.type){let i=o.find(s=>typeof s=="object"&&"type"in s&&s.type);typeof i=="string"&&(t=Object.assign(Object.assign({},t),{type:i}))}return lo(o,e,t)}f(wm,"toFile");async function jo(n){var e,t,o,i,s;let l=[];if(typeof n=="string"||ArrayBuffer.isView(n)||n instanceof ArrayBuffer)l.push(n);else if(Va(n))l.push(n instanceof Blob?n:await n.arrayBuffer());else if(Im(n))try{for(var c=!0,d=me(n),u;u=await d.next(),e=u.done,!e;c=!0){i=u.value,c=!1;let p=i;l.push(...await jo(p))}}catch(p){t={error:p}}finally{try{!c&&!e&&(o=d.return)&&await o.call(d)}finally{if(t)throw t.error}}else{let p=(s=n?.constructor)===null||s===void 0?void 0:s.name;throw new Error(`Unexpected data type: ${typeof n}${p?`; constructor: ${p}`:""}${_m(n)}`)}return l}f(jo,"getBytes");function _m(n){return typeof n!="object"||n===null?"":`; props: [${Object.getOwnPropertyNames(n).map(t=>`"${t}"`).join(", ")}]`}f(_m,"propsForError");var vn=class{static{f(this,"APIResource")}constructor(e){this._client=e}};vn._key=[];function Ha(n){return n.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}f(Ha,"encodeURIPath");var ia=Object.freeze(Object.create(null)),Cm=f((n=Ha)=>f(function(t,...o){if(t.length===1)return t[0];let i=!1,s=[],l=t.reduce((p,m,h)=>{var g,b,E;/[?#]/.test(m)&&(i=!0);let I=o[h],v=(i?encodeURIComponent:n)(""+I);return h!==o.length&&(I==null||typeof I=="object"&&I.toString===((E=Object.getPrototypeOf((b=Object.getPrototypeOf((g=I.hasOwnProperty)!==null&&g!==void 0?g:ia))!==null&&b!==void 0?b:ia))===null||E===void 0?void 0:E.toString))&&(v=I+"",s.push({start:p.length+m.length,length:v.length,error:`Value of type ${Object.prototype.toString.call(I).slice(8,-1)} is not a valid path parameter`})),p+m+(h===o.length?"":v)},""),c=l.split(/[?#]/,1)[0],d=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;for(;(u=d.exec(c))!==null;)s.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(s.sort((p,m)=>p.start-m.start),s.length>0){let p=0,m=s.reduce((h,g)=>{let b=" ".repeat(g.start-p),E="^".repeat(g.length);return p=g.start+g.length,h+b+E},"");throw new ne(`Path parameters result in path with invalid segments:
|
|
1176
|
-
${s.map(h=>h.error).join(`
|
|
1177
|
-
`)}
|
|
1178
|
-
${l}
|
|
1179
|
-
${m}`)}return l},"path"),"createPathTagFunction"),Bt=Cm(Ha);var Tn=class extends vn{static{f(this,"BaseInteractions")}create(e,t){var o;let{api_version:i=this._client.apiVersion}=e,s=dn(e,["api_version"]);if("model"in s&&"agent_config"in s)throw new ne("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.");if("agent"in s&&"generation_config"in s)throw new ne("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.");return this._client.post(Bt`/${i}/interactions`,Object.assign(Object.assign({body:s},t),{stream:(o=e.stream)!==null&&o!==void 0?o:!1}))}delete(e,t={},o){let{api_version:i=this._client.apiVersion}=t??{};return this._client.delete(Bt`/${i}/interactions/${e}`,o)}cancel(e,t={},o){let{api_version:i=this._client.apiVersion}=t??{};return this._client.post(Bt`/${i}/interactions/${e}/cancel`,o)}get(e,t={},o){var i;let s=t??{},{api_version:l=this._client.apiVersion}=s,c=dn(s,["api_version"]);return this._client.get(Bt`/${l}/interactions/${e}`,Object.assign(Object.assign({query:c},o),{stream:(i=t?.stream)!==null&&i!==void 0?i:!1}))}};Tn._key=Object.freeze(["interactions"]);var wn=class extends Tn{static{f(this,"Interactions")}};function Sm(n){let e=0;for(let i of n)e+=i.length;let t=new Uint8Array(e),o=0;for(let i of n)t.set(i,o),o+=i.length;return t}f(Sm,"concatBytes");var Ot;function hi(n){let e;return(Ot??(e=new globalThis.TextEncoder,Ot=e.encode.bind(e)))(n)}f(hi,"encodeUTF8");var zt;function ra(n){let e;return(zt??(e=new globalThis.TextDecoder,zt=e.decode.bind(e)))(n)}f(ra,"decodeUTF8");var dt=class{static{f(this,"LineDecoder")}constructor(){this.buffer=new Uint8Array,this.carriageReturnIndex=null}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?hi(e):e;this.buffer=Sm([this.buffer,t]);let o=[],i;for(;(i=Am(this.buffer,this.carriageReturnIndex))!=null;){if(i.carriage&&this.carriageReturnIndex==null){this.carriageReturnIndex=i.index;continue}if(this.carriageReturnIndex!=null&&(i.index!==this.carriageReturnIndex+1||i.carriage)){o.push(ra(this.buffer.subarray(0,this.carriageReturnIndex-1))),this.buffer=this.buffer.subarray(this.carriageReturnIndex),this.carriageReturnIndex=null;continue}let s=this.carriageReturnIndex!==null?i.preceding-1:i.preceding,l=ra(this.buffer.subarray(0,s));o.push(l),this.buffer=this.buffer.subarray(i.index),this.carriageReturnIndex=null}return o}flush(){return this.buffer.length?this.decode(`
|
|
1180
|
-
`):[]}};dt.NEWLINE_CHARS=new Set([`
|
|
1181
|
-
`,"\r"]);dt.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Am(n,e){for(let i=e??0;i<n.length;i++){if(n[i]===10)return{preceding:i,index:i+1,carriage:!1};if(n[i]===13)return{preceding:i,index:i+1,carriage:!0}}return null}f(Am,"findNewlineIndex");function xm(n){for(let o=0;o<n.length-1;o++){if(n[o]===10&&n[o+1]===10||n[o]===13&&n[o+1]===13)return o+2;if(n[o]===13&&n[o+1]===10&&o+3<n.length&&n[o+2]===13&&n[o+3]===10)return o+4}return-1}f(xm,"findDoubleNewlineIndex");var _n={off:0,error:200,warn:300,info:400,debug:500},sa=f((n,e,t)=>{if(n){if(am(_n,n))return n;ee(t).warn(`${e} was set to ${JSON.stringify(n)}, expected one of ${JSON.stringify(Object.keys(_n))}`)}},"parseLogLevel");function wt(){}f(wt,"noop");function Jt(n,e,t){return!e||_n[n]>_n[t]?wt:e[n].bind(e)}f(Jt,"makeLogFn");var Pm={error:wt,warn:wt,info:wt,debug:wt},aa=new WeakMap;function ee(n){var e;let t=n.logger,o=(e=n.logLevel)!==null&&e!==void 0?e:"off";if(!t)return Pm;let i=aa.get(t);if(i&&i[0]===o)return i[1];let s={error:Jt("error",t,o),warn:Jt("warn",t,o),info:Jt("info",t,o),debug:Jt("debug",t,o)};return aa.set(t,[o,s]),s}f(ee,"loggerFor");var ze=f(n=>(n.options&&(n.options=Object.assign({},n.options),delete n.options.headers),n.headers&&(n.headers=Object.fromEntries((n.headers instanceof Headers?[...n.headers]:Object.entries(n.headers)).map(([e,t])=>[e,e.toLowerCase()==="x-goog-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":t]))),"retryOfRequestLogID"in n&&(n.retryOfRequestLogID&&(n.retryOf=n.retryOfRequestLogID),delete n.retryOfRequestLogID),n),"formatRequestDetails");var ei=class n{static{f(this,"Stream")}constructor(e,t,o){this.iterator=e,this.controller=t,this.client=o}static fromSSEResponse(e,t,o){let i=!1,s=o?ee(o):console;function l(){return pe(this,arguments,f(function*(){var d,u,p,m;if(i)throw new ne("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let h=!1;try{try{for(var g=!0,b=me(Nm(e,t)),E;E=yield N(b.next()),d=E.done,!d;g=!0){m=E.value,g=!1;let I=m;if(!h)if(I.data.startsWith("[DONE]")){h=!0;continue}else try{yield yield N(JSON.parse(I.data))}catch(v){throw s.error("Could not parse message into JSON:",I.data),s.error("From chunk:",I.raw),v}}}catch(I){u={error:I}}finally{try{!g&&!d&&(p=b.return)&&(yield N(p.call(b)))}finally{if(u)throw u.error}}h=!0}catch(I){if(Yo(I))return yield N(void 0);throw I}finally{h||t.abort()}},"iterator_1"))}return f(l,"iterator"),new n(l,t,o)}static fromReadableStream(e,t,o){let i=!1;function s(){return pe(this,arguments,f(function*(){var d,u,p,m;let h=new dt,g=Ua(e);try{for(var b=!0,E=me(g),I;I=yield N(E.next()),d=I.done,!d;b=!0){m=I.value,b=!1;let v=m;for(let T of h.decode(v))yield yield N(T)}}catch(v){u={error:v}}finally{try{!b&&!d&&(p=E.return)&&(yield N(p.call(E)))}finally{if(u)throw u.error}}for(let v of h.flush())yield yield N(v)},"iterLines_1"))}f(s,"iterLines");function l(){return pe(this,arguments,f(function*(){var d,u,p,m;if(i)throw new ne("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let h=!1;try{try{for(var g=!0,b=me(s()),E;E=yield N(b.next()),d=E.done,!d;g=!0){m=E.value,g=!1;let I=m;h||I&&(yield yield N(JSON.parse(I)))}}catch(I){u={error:I}}finally{try{!g&&!d&&(p=b.return)&&(yield N(p.call(b)))}finally{if(u)throw u.error}}h=!0}catch(I){if(Yo(I))return yield N(void 0);throw I}finally{h||t.abort()}},"iterator_2"))}return f(l,"iterator"),new n(l,t,o)}[Symbol.asyncIterator](){return this.iterator()}tee(){let e=[],t=[],o=this.iterator(),i=f(s=>({next:f(()=>{if(s.length===0){let l=o.next();e.push(l),t.push(l)}return s.shift()},"next")}),"teeIterator");return[new n(()=>i(e),this.controller,this.client),new n(()=>i(t),this.controller,this.client)]}toReadableStream(){let e=this,t;return ka({async start(){t=e[Symbol.asyncIterator]()},async pull(o){try{let{value:i,done:s}=await t.next();if(s)return o.close();let l=hi(JSON.stringify(i)+`
|
|
1182
|
-
`);o.enqueue(l)}catch(i){o.error(i)}},async cancel(){var o;await((o=t.return)===null||o===void 0?void 0:o.call(t))}})}};function Nm(n,e){return pe(this,arguments,f(function*(){var o,i,s,l;if(!n.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new ne("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 ne("Attempted to iterate over a response with no body");let c=new ti,d=new dt,u=Ua(n.body);try{for(var p=!0,m=me(Rm(u)),h;h=yield N(m.next()),o=h.done,!o;p=!0){l=h.value,p=!1;let g=l;for(let b of d.decode(g)){let E=c.decode(b);E&&(yield yield N(E))}}}catch(g){i={error:g}}finally{try{!p&&!o&&(s=m.return)&&(yield N(s.call(m)))}finally{if(i)throw i.error}}for(let g of d.flush()){let b=c.decode(g);b&&(yield yield N(b))}},"_iterSSEMessages_1"))}f(Nm,"_iterSSEMessages");function Rm(n){return pe(this,arguments,f(function*(){var t,o,i,s;let l=new Uint8Array;try{for(var c=!0,d=me(n),u;u=yield N(d.next()),t=u.done,!t;c=!0){s=u.value,c=!1;let p=s;if(p==null)continue;let m=p instanceof ArrayBuffer?new Uint8Array(p):typeof p=="string"?hi(p):p,h=new Uint8Array(l.length+m.length);h.set(l),h.set(m,l.length),l=h;let g;for(;(g=xm(l))!==-1;)yield yield N(l.slice(0,g)),l=l.slice(g)}}catch(p){o={error:p}}finally{try{!c&&!t&&(i=d.return)&&(yield N(i.call(d)))}finally{if(o)throw o.error}}l.length>0&&(yield yield N(l))},"iterSSEChunks_1"))}f(Rm,"iterSSEChunks");var ti=class{static{f(this,"SSEDecoder")}constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let s={event:this.event,data:this.data.join(`
|
|
1183
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,o,i]=$m(e,":");return i.startsWith(" ")&&(i=i.substring(1)),t==="event"?this.event=i:t==="data"&&this.data.push(i),null}};function $m(n,e){let t=n.indexOf(e);return t!==-1?[n.substring(0,t),e,n.substring(t+e.length)]:[n,"",""]}f($m,"partition");async function Mm(n,e){let{response:t,requestLogID:o,retryOfRequestLogID:i,startTime:s}=e,l=await(async()=>{var c;if(e.options.stream)return ee(n).debug("response",t.status,t.url,t.headers,t.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(t,e.controller,n):ei.fromSSEResponse(t,e.controller,n);if(t.status===204)return null;if(e.options.__binaryResponse)return t;let d=t.headers.get("content-type"),u=(c=d?.split(";")[0])===null||c===void 0?void 0:c.trim();return u?.includes("application/json")||u?.endsWith("+json")?await t.json():await t.text()})();return ee(n).debug(`[${o}] response parsed`,ze({retryOfRequestLogID:i,url:t.url,status:t.status,body:l,durationMs:Date.now()-s})),l}f(Mm,"defaultParseResponse");var ni=class n extends Promise{static{f(this,"APIPromise")}constructor(e,t,o=Mm){super(i=>{i(null)}),this.responsePromise=t,this.parseResponse=o,this.client=e}_thenUnwrap(e){return new n(this.client,this.responsePromise,async(t,o)=>e(await this.parseResponse(t,o),o))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(this.client,e))),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};var qa=Symbol("brand.privateNullableHeaders");function*Gm(n){if(!n)return;if(qa in n){let{values:o,nulls:i}=n;yield*o.entries();for(let s of i)yield[s,null];return}let e=!1,t;n instanceof Headers?t=n.entries():ta(n)?t=n:(e=!0,t=Object.entries(n??{}));for(let o of t){let i=o[0];if(typeof i!="string")throw new TypeError("expected header name to be a string");let s=ta(o[1])?o[1]:[o[1]],l=!1;for(let c of s)c!==void 0&&(e&&!l&&(l=!0,yield[i,null]),yield[i,c])}}f(Gm,"iterateHeaders");var co=f(n=>{let e=new Headers,t=new Set;for(let o of n){let i=new Set;for(let[s,l]of Gm(o)){let c=s.toLowerCase();i.has(c)||(e.delete(s),i.add(c)),l===null?(e.delete(s),t.add(c)):(e.append(s,l),t.delete(c))}}return{[qa]:!0,values:e,nulls:t}},"buildHeaders");var uo=f(n=>{var e,t,o,i,s,l;if(typeof globalThis.process<"u")return(o=(t=(e=globalThis.process.env)===null||e===void 0?void 0:e[n])===null||t===void 0?void 0:t.trim())!==null&&o!==void 0?o:void 0;if(typeof globalThis.Deno<"u")return(l=(s=(i=globalThis.Deno.env)===null||i===void 0?void 0:i.get)===null||s===void 0?void 0:s.call(i,n))===null||l===void 0?void 0:l.trim()},"readEnv");var Ba,Cn=class n{static{f(this,"BaseGeminiNextGenAPIClient")}constructor(e){var t,o,i,s,l,c,d,u=e===void 0?{}:e,{baseURL:p=uo("GEMINI_NEXT_GEN_API_BASE_URL"),apiKey:m=(t=uo("GEMINI_API_KEY"))!==null&&t!==void 0?t:null,apiVersion:h="v1beta"}=u,g=dn(u,["baseURL","apiKey","apiVersion"]);let b=Object.assign(Object.assign({apiKey:m,apiVersion:h},g),{baseURL:p||"https://generativelanguage.googleapis.com"});this.baseURL=b.baseURL,this.timeout=(o=b.timeout)!==null&&o!==void 0?o:n.DEFAULT_TIMEOUT,this.logger=(i=b.logger)!==null&&i!==void 0?i:console;let E="warn";this.logLevel=E,this.logLevel=(l=(s=sa(b.logLevel,"ClientOptions.logLevel",this))!==null&&s!==void 0?s:sa(uo("GEMINI_NEXT_GEN_API_LOG"),"process.env['GEMINI_NEXT_GEN_API_LOG']",this))!==null&&l!==void 0?l:E,this.fetchOptions=b.fetchOptions,this.maxRetries=(c=b.maxRetries)!==null&&c!==void 0?c:2,this.fetch=(d=b.fetch)!==null&&d!==void 0?d:hm(),this.encoder=ym,this._options=b,this.apiKey=m,this.apiVersion=h}withOptions(e){return new this.constructor(Object.assign(Object.assign(Object.assign({},this._options),{baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,apiVersion:this.apiVersion}),e))}baseURLOverridden(){return this.baseURL!=="https://generativelanguage.googleapis.com"}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(this.apiKey&&e.get("x-goog-api-key"))&&!t.has("x-goog-api-key"))throw new Error('Could not resolve authentication method. Expected the apiKey to be set. Or for the "x-goog-api-key" headers to be explicitly omitted')}async authHeaders(e){if(this.apiKey!=null)return co([{"x-goog-api-key":this.apiKey}])}stringifyQuery(e){return Object.entries(e).filter(([t,o])=>typeof o<"u").map(([t,o])=>{if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")return`${encodeURIComponent(t)}=${encodeURIComponent(o)}`;if(o===null)return`${encodeURIComponent(t)}=`;throw new ne(`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.`)}).join("&")}getUserAgent(){return`${this.constructor.name}/JS ${rt}`}defaultIdempotencyKey(){return`stainless-node-retry-${tm()}`}makeStatusError(e,t,o,i){return oe.generate(e,t,o,i)}buildURL(e,t,o){let i=!this.baseURLOverridden()&&o||this.baseURL,s=om(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),l=this.defaultQuery();return sm(l)||(t=Object.assign(Object.assign({},l),t)),typeof t=="object"&&t&&!Array.isArray(t)&&(s.search=this.stringifyQuery(t)),s.toString()}async prepareOptions(e){}async prepareRequest(e,{url:t,options:o}){}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,o){return this.request(Promise.resolve(o).then(i=>Object.assign({method:e,path:t},i)))}request(e,t=null){return new ni(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,o){var i,s,l;let c=await e,d=(i=c.maxRetries)!==null&&i!==void 0?i:this.maxRetries;t==null&&(t=d),await this.prepareOptions(c);let{req:u,url:p,timeout:m}=await this.buildRequest(c,{retryCount:d-t});await this.prepareRequest(u,{url:p,options:c});let h="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),g=o===void 0?"":`, retryOf: ${o}`,b=Date.now();if(ee(this).debug(`[${h}] sending request`,ze({retryOfRequestLogID:o,method:c.method,url:p,options:c,headers:u.headers})),!((s=c.signal)===null||s===void 0)&&s.aborted)throw new Ct;let E=new AbortController,I=await this.fetchWithTimeout(p,u,m,E).catch(Qo),v=Date.now();if(I instanceof globalThis.Error){let w=`retrying, ${t} attempts remaining`;if(!((l=c.signal)===null||l===void 0)&&l.aborted)throw new Ct;let C=Yo(I)||/timed? ?out/i.test(String(I)+("cause"in I?String(I.cause):""));if(t)return ee(this).info(`[${h}] connection ${C?"timed out":"failed"} - ${w}`),ee(this).debug(`[${h}] connection ${C?"timed out":"failed"} (${w})`,ze({retryOfRequestLogID:o,url:p,durationMs:v-b,message:I.message})),this.retryRequest(c,t,o??h);throw ee(this).info(`[${h}] connection ${C?"timed out":"failed"} - error; no more retries left`),ee(this).debug(`[${h}] connection ${C?"timed out":"failed"} (error; no more retries left)`,ze({retryOfRequestLogID:o,url:p,durationMs:v-b,message:I.message})),C?new fn:new ct({cause:I})}let T=`[${h}${g}] ${u.method} ${p} ${I.ok?"succeeded":"failed"} with status ${I.status} in ${v-b}ms`;if(!I.ok){let w=await this.shouldRetry(I);if(t&&w){let A=`retrying, ${t} attempts remaining`;return await bm(I.body),ee(this).info(`${T} - ${A}`),ee(this).debug(`[${h}] response error (${A})`,ze({retryOfRequestLogID:o,url:I.url,status:I.status,headers:I.headers,durationMs:v-b})),this.retryRequest(c,t,o??h,I.headers)}let C=w?"error; no more retries left":"error; not retryable";ee(this).info(`${T} - ${C}`);let S=await I.text().catch(A=>Qo(A).message),$=cm(S),P=$?void 0:S;throw ee(this).debug(`[${h}] response error (${C})`,ze({retryOfRequestLogID:o,url:I.url,status:I.status,headers:I.headers,message:P,durationMs:Date.now()-b})),this.makeStatusError(I.status,$,P,I.headers)}return ee(this).info(T),ee(this).debug(`[${h}] response start`,ze({retryOfRequestLogID:o,url:I.url,status:I.status,headers:I.headers,durationMs:v-b})),{response:I,options:c,controller:E,requestLogID:h,retryOfRequestLogID:o,startTime:b}}async fetchWithTimeout(e,t,o,i){let s=t||{},{signal:l,method:c}=s,d=dn(s,["signal","method"]);l&&l.addEventListener("abort",()=>i.abort());let u=setTimeout(()=>i.abort(),o),p=globalThis.ReadableStream&&d.body instanceof globalThis.ReadableStream||typeof d.body=="object"&&d.body!==null&&Symbol.asyncIterator in d.body,m=Object.assign(Object.assign(Object.assign({signal:i.signal},p?{duplex:"half"}:{}),{method:"GET"}),d);c&&(m.method=c.toUpperCase());try{return await this.fetch.call(void 0,e,m)}finally{clearTimeout(u)}}async shouldRetry(e){let t=e.headers.get("x-should-retry");return t==="true"?!0:t==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,o,i){var s;let l,c=i?.get("retry-after-ms");if(c){let u=parseFloat(c);Number.isNaN(u)||(l=u)}let d=i?.get("retry-after");if(d&&!l){let u=parseFloat(d);Number.isNaN(u)?l=Date.parse(d)-Date.now():l=u*1e3}if(!(l&&0<=l&&l<60*1e3)){let u=(s=e.maxRetries)!==null&&s!==void 0?s:this.maxRetries;l=this.calculateDefaultRetryTimeoutMillis(t,u)}return await dm(l),this.makeRequest(e,t-1,o)}calculateDefaultRetryTimeoutMillis(e,t){let s=t-e,l=Math.min(.5*Math.pow(2,s),8),c=1-Math.random()*.25;return l*c*1e3}async buildRequest(e,{retryCount:t=0}={}){var o,i,s;let l=Object.assign({},e),{method:c,path:d,query:u,defaultBaseURL:p}=l,m=this.buildURL(d,u,p);"timeout"in l&&lm("timeout",l.timeout),l.timeout=(o=l.timeout)!==null&&o!==void 0?o:this.timeout;let{bodyHeaders:h,body:g}=this.buildBody({options:l}),b=await this.buildHeaders({options:e,method:c,bodyHeaders:h,retryCount:t});return{req:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({method:c,headers:b},l.signal&&{signal:l.signal}),globalThis.ReadableStream&&g instanceof globalThis.ReadableStream&&{duplex:"half"}),g&&{body:g}),(i=this.fetchOptions)!==null&&i!==void 0?i:{}),(s=l.fetchOptions)!==null&&s!==void 0?s:{}),url:m,timeout:l.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:o,retryCount:i}){let s={};this.idempotencyHeader&&t!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);let l=co([s,Object.assign(Object.assign({Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i)},e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{}),mm()),await this.authHeaders(e),this._options.defaultHeaders,o,e.headers]);return this.validateHeaders(l),l.values}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let o=co([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&o.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:gm(e)}:this.encoder({body:e,headers:o})}};Cn.DEFAULT_TIMEOUT=6e4;var z=class extends Cn{static{f(this,"GeminiNextGenAPIClient")}constructor(){super(...arguments),this.interactions=new wn(this)}};Ba=z;z.GeminiNextGenAPIClient=Ba;z.GeminiNextGenAPIClientError=ne;z.APIError=oe;z.APIConnectionError=ct;z.APIConnectionTimeoutError=fn;z.APIUserAbortError=Ct;z.NotFoundError=gn;z.ConflictError=bn;z.RateLimitError=En;z.BadRequestError=pn;z.AuthenticationError=mn;z.InternalServerError=In;z.PermissionDeniedError=hn;z.UnprocessableEntityError=yn;z.toFile=wm;z.Interactions=wn;function Dm(n,e){let t={},o=r(n,["name"]);return o!=null&&a(t,["_url","name"],o),t}f(Dm,"cancelTuningJobParametersToMldev");function Lm(n,e){let t={},o=r(n,["name"]);return o!=null&&a(t,["_url","name"],o),t}f(Lm,"cancelTuningJobParametersToVertex");function km(n,e){let t={},o=r(n,["sdkHttpResponse"]);return o!=null&&a(t,["sdkHttpResponse"],o),t}f(km,"cancelTuningJobResponseFromMldev");function Um(n,e){let t={},o=r(n,["sdkHttpResponse"]);return o!=null&&a(t,["sdkHttpResponse"],o),t}f(Um,"cancelTuningJobResponseFromVertex");function Fm(n,e,t){let o={};if(r(n,["validationDataset"])!==void 0)throw new Error("validationDataset parameter is not supported in Gemini API.");let i=r(n,["tunedModelDisplayName"]);if(e!==void 0&&i!=null&&a(e,["displayName"],i),r(n,["description"])!==void 0)throw new Error("description parameter is not supported in Gemini API.");let s=r(n,["epochCount"]);e!==void 0&&s!=null&&a(e,["tuningTask","hyperparameters","epochCount"],s);let l=r(n,["learningRateMultiplier"]);if(l!=null&&a(o,["tuningTask","hyperparameters","learningRateMultiplier"],l),r(n,["exportLastCheckpointOnly"])!==void 0)throw new Error("exportLastCheckpointOnly parameter is not supported in Gemini API.");if(r(n,["preTunedModelCheckpointId"])!==void 0)throw new Error("preTunedModelCheckpointId parameter is not supported in Gemini API.");if(r(n,["adapterSize"])!==void 0)throw new Error("adapterSize parameter is not supported in Gemini API.");let c=r(n,["batchSize"]);e!==void 0&&c!=null&&a(e,["tuningTask","hyperparameters","batchSize"],c);let d=r(n,["learningRate"]);if(e!==void 0&&d!=null&&a(e,["tuningTask","hyperparameters","learningRate"],d),r(n,["labels"])!==void 0)throw new Error("labels parameter is not supported in Gemini API.");if(r(n,["beta"])!==void 0)throw new Error("beta parameter is not supported in Gemini API.");return o}f(Fm,"createTuningJobConfigToMldev");function Vm(n,e,t){let o={},i=r(t,["config","method"]);if(i===void 0&&(i="SUPERVISED_FINE_TUNING"),i==="SUPERVISED_FINE_TUNING"){let g=r(n,["validationDataset"]);e!==void 0&&g!=null&&a(e,["supervisedTuningSpec"],la(g))}else if(i==="PREFERENCE_TUNING"){let g=r(n,["validationDataset"]);e!==void 0&&g!=null&&a(e,["preferenceOptimizationSpec"],la(g))}let s=r(n,["tunedModelDisplayName"]);e!==void 0&&s!=null&&a(e,["tunedModelDisplayName"],s);let l=r(n,["description"]);e!==void 0&&l!=null&&a(e,["description"],l);let c=r(t,["config","method"]);if(c===void 0&&(c="SUPERVISED_FINE_TUNING"),c==="SUPERVISED_FINE_TUNING"){let g=r(n,["epochCount"]);e!==void 0&&g!=null&&a(e,["supervisedTuningSpec","hyperParameters","epochCount"],g)}else if(c==="PREFERENCE_TUNING"){let g=r(n,["epochCount"]);e!==void 0&&g!=null&&a(e,["preferenceOptimizationSpec","hyperParameters","epochCount"],g)}let d=r(t,["config","method"]);if(d===void 0&&(d="SUPERVISED_FINE_TUNING"),d==="SUPERVISED_FINE_TUNING"){let g=r(n,["learningRateMultiplier"]);e!==void 0&&g!=null&&a(e,["supervisedTuningSpec","hyperParameters","learningRateMultiplier"],g)}else if(d==="PREFERENCE_TUNING"){let g=r(n,["learningRateMultiplier"]);e!==void 0&&g!=null&&a(e,["preferenceOptimizationSpec","hyperParameters","learningRateMultiplier"],g)}let u=r(t,["config","method"]);if(u===void 0&&(u="SUPERVISED_FINE_TUNING"),u==="SUPERVISED_FINE_TUNING"){let g=r(n,["exportLastCheckpointOnly"]);e!==void 0&&g!=null&&a(e,["supervisedTuningSpec","exportLastCheckpointOnly"],g)}else if(u==="PREFERENCE_TUNING"){let g=r(n,["exportLastCheckpointOnly"]);e!==void 0&&g!=null&&a(e,["preferenceOptimizationSpec","exportLastCheckpointOnly"],g)}let p=r(t,["config","method"]);if(p===void 0&&(p="SUPERVISED_FINE_TUNING"),p==="SUPERVISED_FINE_TUNING"){let g=r(n,["adapterSize"]);e!==void 0&&g!=null&&a(e,["supervisedTuningSpec","hyperParameters","adapterSize"],g)}else if(p==="PREFERENCE_TUNING"){let g=r(n,["adapterSize"]);e!==void 0&&g!=null&&a(e,["preferenceOptimizationSpec","hyperParameters","adapterSize"],g)}if(r(n,["batchSize"])!==void 0)throw new Error("batchSize parameter is not supported in Vertex AI.");if(r(n,["learningRate"])!==void 0)throw new Error("learningRate parameter is not supported in Vertex AI.");let m=r(n,["labels"]);e!==void 0&&m!=null&&a(e,["labels"],m);let h=r(n,["beta"]);return e!==void 0&&h!=null&&a(e,["preferenceOptimizationSpec","hyperParameters","beta"],h),o}f(Vm,"createTuningJobConfigToVertex");function Hm(n,e){let t={},o=r(n,["baseModel"]);o!=null&&a(t,["baseModel"],o);let i=r(n,["preTunedModel"]);i!=null&&a(t,["preTunedModel"],i);let s=r(n,["trainingDataset"]);s!=null&&Zm(s);let l=r(n,["config"]);return l!=null&&Fm(l,t),t}f(Hm,"createTuningJobParametersPrivateToMldev");function qm(n,e){let t={},o=r(n,["baseModel"]);o!=null&&a(t,["baseModel"],o);let i=r(n,["preTunedModel"]);i!=null&&a(t,["preTunedModel"],i);let s=r(n,["trainingDataset"]);s!=null&&jm(s,t,e);let l=r(n,["config"]);return l!=null&&Vm(l,t,e),t}f(qm,"createTuningJobParametersPrivateToVertex");function Bm(n,e){let t={},o=r(n,["name"]);return o!=null&&a(t,["_url","name"],o),t}f(Bm,"getTuningJobParametersToMldev");function Om(n,e){let t={},o=r(n,["name"]);return o!=null&&a(t,["_url","name"],o),t}f(Om,"getTuningJobParametersToVertex");function zm(n,e,t){let o={},i=r(n,["pageSize"]);e!==void 0&&i!=null&&a(e,["_query","pageSize"],i);let s=r(n,["pageToken"]);e!==void 0&&s!=null&&a(e,["_query","pageToken"],s);let l=r(n,["filter"]);return e!==void 0&&l!=null&&a(e,["_query","filter"],l),o}f(zm,"listTuningJobsConfigToMldev");function Jm(n,e,t){let o={},i=r(n,["pageSize"]);e!==void 0&&i!=null&&a(e,["_query","pageSize"],i);let s=r(n,["pageToken"]);e!==void 0&&s!=null&&a(e,["_query","pageToken"],s);let l=r(n,["filter"]);return e!==void 0&&l!=null&&a(e,["_query","filter"],l),o}f(Jm,"listTuningJobsConfigToVertex");function Wm(n,e){let t={},o=r(n,["config"]);return o!=null&&zm(o,t),t}f(Wm,"listTuningJobsParametersToMldev");function Km(n,e){let t={},o=r(n,["config"]);return o!=null&&Jm(o,t),t}f(Km,"listTuningJobsParametersToVertex");function Xm(n,e){let t={},o=r(n,["sdkHttpResponse"]);o!=null&&a(t,["sdkHttpResponse"],o);let i=r(n,["nextPageToken"]);i!=null&&a(t,["nextPageToken"],i);let s=r(n,["tunedModels"]);if(s!=null){let l=s;Array.isArray(l)&&(l=l.map(c=>Oa(c))),a(t,["tuningJobs"],l)}return t}f(Xm,"listTuningJobsResponseFromMldev");function Ym(n,e){let t={},o=r(n,["sdkHttpResponse"]);o!=null&&a(t,["sdkHttpResponse"],o);let i=r(n,["nextPageToken"]);i!=null&&a(t,["nextPageToken"],i);let s=r(n,["tuningJobs"]);if(s!=null){let l=s;Array.isArray(l)&&(l=l.map(c=>oi(c))),a(t,["tuningJobs"],l)}return t}f(Ym,"listTuningJobsResponseFromVertex");function Qm(n,e){let t={},o=r(n,["name"]);o!=null&&a(t,["model"],o);let i=r(n,["name"]);return i!=null&&a(t,["endpoint"],i),t}f(Qm,"tunedModelFromMldev");function Zm(n,e){let t={};if(r(n,["gcsUri"])!==void 0)throw new Error("gcsUri parameter is not supported in Gemini API.");if(r(n,["vertexDatasetResource"])!==void 0)throw new Error("vertexDatasetResource parameter is not supported in Gemini API.");let o=r(n,["examples"]);if(o!=null){let i=o;Array.isArray(i)&&(i=i.map(s=>s)),a(t,["examples","examples"],i)}return t}f(Zm,"tuningDatasetToMldev");function jm(n,e,t){let o={},i=r(t,["config","method"]);if(i===void 0&&(i="SUPERVISED_FINE_TUNING"),i==="SUPERVISED_FINE_TUNING"){let l=r(n,["gcsUri"]);e!==void 0&&l!=null&&a(e,["supervisedTuningSpec","trainingDatasetUri"],l)}else if(i==="PREFERENCE_TUNING"){let l=r(n,["gcsUri"]);e!==void 0&&l!=null&&a(e,["preferenceOptimizationSpec","trainingDatasetUri"],l)}let s=r(t,["config","method"]);if(s===void 0&&(s="SUPERVISED_FINE_TUNING"),s==="SUPERVISED_FINE_TUNING"){let l=r(n,["vertexDatasetResource"]);e!==void 0&&l!=null&&a(e,["supervisedTuningSpec","trainingDatasetUri"],l)}else if(s==="PREFERENCE_TUNING"){let l=r(n,["vertexDatasetResource"]);e!==void 0&&l!=null&&a(e,["preferenceOptimizationSpec","trainingDatasetUri"],l)}if(r(n,["examples"])!==void 0)throw new Error("examples parameter is not supported in Vertex AI.");return o}f(jm,"tuningDatasetToVertex");function Oa(n,e){let t={},o=r(n,["sdkHttpResponse"]);o!=null&&a(t,["sdkHttpResponse"],o);let i=r(n,["name"]);i!=null&&a(t,["name"],i);let s=r(n,["state"]);s!=null&&a(t,["state"],ga(s));let l=r(n,["createTime"]);l!=null&&a(t,["createTime"],l);let c=r(n,["tuningTask","startTime"]);c!=null&&a(t,["startTime"],c);let d=r(n,["tuningTask","completeTime"]);d!=null&&a(t,["endTime"],d);let u=r(n,["updateTime"]);u!=null&&a(t,["updateTime"],u);let p=r(n,["description"]);p!=null&&a(t,["description"],p);let m=r(n,["baseModel"]);m!=null&&a(t,["baseModel"],m);let h=r(n,["_self"]);return h!=null&&a(t,["tunedModel"],Qm(h)),t}f(Oa,"tuningJobFromMldev");function oi(n,e){let t={},o=r(n,["sdkHttpResponse"]);o!=null&&a(t,["sdkHttpResponse"],o);let i=r(n,["name"]);i!=null&&a(t,["name"],i);let s=r(n,["state"]);s!=null&&a(t,["state"],ga(s));let l=r(n,["createTime"]);l!=null&&a(t,["createTime"],l);let c=r(n,["startTime"]);c!=null&&a(t,["startTime"],c);let d=r(n,["endTime"]);d!=null&&a(t,["endTime"],d);let u=r(n,["updateTime"]);u!=null&&a(t,["updateTime"],u);let p=r(n,["error"]);p!=null&&a(t,["error"],p);let m=r(n,["description"]);m!=null&&a(t,["description"],m);let h=r(n,["baseModel"]);h!=null&&a(t,["baseModel"],h);let g=r(n,["tunedModel"]);g!=null&&a(t,["tunedModel"],g);let b=r(n,["preTunedModel"]);b!=null&&a(t,["preTunedModel"],b);let E=r(n,["supervisedTuningSpec"]);E!=null&&a(t,["supervisedTuningSpec"],E);let I=r(n,["preferenceOptimizationSpec"]);I!=null&&a(t,["preferenceOptimizationSpec"],I);let v=r(n,["tuningDataStats"]);v!=null&&a(t,["tuningDataStats"],v);let T=r(n,["encryptionSpec"]);T!=null&&a(t,["encryptionSpec"],T);let w=r(n,["partnerModelTuningSpec"]);w!=null&&a(t,["partnerModelTuningSpec"],w);let C=r(n,["customBaseModel"]);C!=null&&a(t,["customBaseModel"],C);let S=r(n,["experiment"]);S!=null&&a(t,["experiment"],S);let $=r(n,["labels"]);$!=null&&a(t,["labels"],$);let P=r(n,["outputUri"]);P!=null&&a(t,["outputUri"],P);let F=r(n,["pipelineJob"]);F!=null&&a(t,["pipelineJob"],F);let A=r(n,["serviceAccount"]);A!=null&&a(t,["serviceAccount"],A);let G=r(n,["tunedModelDisplayName"]);G!=null&&a(t,["tunedModelDisplayName"],G);let B=r(n,["veoTuningSpec"]);return B!=null&&a(t,["veoTuningSpec"],B),t}f(oi,"tuningJobFromVertex");function eh(n,e){let t={},o=r(n,["sdkHttpResponse"]);o!=null&&a(t,["sdkHttpResponse"],o);let i=r(n,["name"]);i!=null&&a(t,["name"],i);let s=r(n,["metadata"]);s!=null&&a(t,["metadata"],s);let l=r(n,["done"]);l!=null&&a(t,["done"],l);let c=r(n,["error"]);return c!=null&&a(t,["error"],c),t}f(eh,"tuningOperationFromMldev");function la(n,e){let t={},o=r(n,["gcsUri"]);o!=null&&a(t,["validationDatasetUri"],o);let i=r(n,["vertexDatasetResource"]);return i!=null&&a(t,["validationDatasetUri"],i),t}f(la,"tuningValidationDatasetToVertex");var ii=class extends he{static{f(this,"Tunings")}constructor(e){super(),this.apiClient=e,this.list=async(t={})=>new Se(Ce.PAGED_ITEM_TUNING_JOBS,o=>this.listInternal(o),await this.listInternal(t),t),this.get=async t=>await this.getInternal(t),this.tune=async t=>{var o;if(this.apiClient.isVertexAI())if(t.baseModel.startsWith("projects/")){let i={tunedModelName:t.baseModel};!((o=t.config)===null||o===void 0)&&o.preTunedModelCheckpointId&&(i.checkpointId=t.config.preTunedModelCheckpointId);let s=Object.assign(Object.assign({},t),{preTunedModel:i});return s.baseModel=void 0,await this.tuneInternal(s)}else{let i=Object.assign({},t);return await this.tuneInternal(i)}else{let i=Object.assign({},t),s=await this.tuneMldevInternal(i),l="";return s.metadata!==void 0&&s.metadata.tunedModel!==void 0?l=s.metadata.tunedModel:s.name!==void 0&&s.name.includes("/operations/")&&(l=s.name.split("/operations/")[0]),{name:l,state:po.JOB_STATE_QUEUED}}}}async getInternal(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Om(e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>oi(p))}else{let u=Bm(e);return c=_("{name}",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>Oa(p))}}async listInternal(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Km(e);return c=_("tuningJobs",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Ym(p),h=new on;return Object.assign(h,m),h})}else{let u=Wm(e);return c=_("tunedModels",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"GET",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Xm(p),h=new on;return Object.assign(h,m),h})}}async cancel(e){var t,o,i,s;let l,c="",d={};if(this.apiClient.isVertexAI()){let u=Lm(e);return c=_("{name}:cancel",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=Um(p),h=new rn;return Object.assign(h,m),h})}else{let u=Dm(e);return c=_("{name}:cancel",u._url),d=u._query,delete u._url,delete u._query,l=this.apiClient.request({path:c,queryParams:d,body:JSON.stringify(u),httpMethod:"POST",httpOptions:(i=e.config)===null||i===void 0?void 0:i.httpOptions,abortSignal:(s=e.config)===null||s===void 0?void 0:s.abortSignal}).then(p=>p.json().then(m=>{let h=m;return h.sdkHttpResponse={headers:p.headers},h})),l.then(p=>{let m=km(p),h=new rn;return Object.assign(h,m),h})}}async tuneInternal(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI()){let c=qm(e,e);return s=_("tuningJobs",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json().then(u=>{let p=u;return p.sdkHttpResponse={headers:d.headers},p})),i.then(d=>oi(d))}else throw new Error("This method is only supported by the Vertex AI.")}async tuneMldevInternal(e){var t,o;let i,s="",l={};if(this.apiClient.isVertexAI())throw new Error("This method is only supported by the Gemini Developer API.");{let c=Hm(e);return s=_("tunedModels",c._url),l=c._query,delete c._url,delete c._query,i=this.apiClient.request({path:s,queryParams:l,body:JSON.stringify(c),httpMethod:"POST",httpOptions:(t=e.config)===null||t===void 0?void 0:t.httpOptions,abortSignal:(o=e.config)===null||o===void 0?void 0:o.abortSignal}).then(d=>d.json().then(u=>{let p=u;return p.sdkHttpResponse={headers:d.headers},p})),i.then(d=>eh(d))}}};var ri=class{static{f(this,"BrowserDownloader")}async download(e,t){throw new Error("Download to file is not supported in the browser, please use a browser compliant download like an <a> tag.")}},th=1024*1024*8,nh=3,oh=1e3,ih=2,Sn="x-goog-upload-status";async function rh(n,e,t){var o;let i=await za(n,e,t),s=await i?.json();if(((o=i?.headers)===null||o===void 0?void 0:o[Sn])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");return s.file}f(rh,"uploadBlob");async function sh(n,e,t){var o;let i=await za(n,e,t),s=await i?.json();if(((o=i?.headers)===null||o===void 0?void 0:o[Sn])!=="final")throw new Error("Failed to upload file: Upload status is not finalized.");let l=da(s),c=new xo;return Object.assign(c,l),c}f(sh,"uploadBlobToFileSearchStore");async function za(n,e,t){var o,i;let s=0,l=0,c=new _t(new Response),d="upload";for(s=n.size;l<s;){let u=Math.min(th,s-l),p=n.slice(l,l+u);l+u>=s&&(d+=", finalize");let m=0,h=oh;for(;m<nh&&(c=await t.request({path:"",body:p,httpMethod:"POST",httpOptions:{apiVersion:"",baseUrl:e,headers:{"X-Goog-Upload-Command":d,"X-Goog-Upload-Offset":String(l),"Content-Length":String(u)}}}),!(!((o=c?.headers)===null||o===void 0)&&o[Sn]));)m++,await lh(h),h=h*ih;if(l+=u,((i=c?.headers)===null||i===void 0?void 0:i[Sn])!=="active")break;if(s<=l)throw new Error("All content has been uploaded, but the upload status is not finalized.")}return c}f(za,"uploadBlobInternal");async function ah(n){return{size:n.size,type:n.type}}f(ah,"getBlobStat");function lh(n){return new Promise(e=>setTimeout(e,n))}f(lh,"sleep");var si=class{static{f(this,"BrowserUploader")}async upload(e,t,o){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await rh(e,t,o)}async uploadToFileSearchStore(e,t,o){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await sh(e,t,o)}async stat(e){if(typeof e=="string")throw new Error("File path is not supported in browser uploader.");return await ah(e)}};var ai=class{static{f(this,"BrowserWebSocketFactory")}create(e,t,o){return new li(e,t,o)}},li=class{static{f(this,"BrowserWebSocket")}constructor(e,t,o){this.url=e,this.headers=t,this.callbacks=o}connect(){this.ws=new WebSocket(this.url),this.ws.onopen=this.callbacks.onopen,this.ws.onerror=this.callbacks.onerror,this.ws.onclose=this.callbacks.onclose,this.ws.onmessage=this.callbacks.onmessage}send(e){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.send(e)}close(){if(this.ws===void 0)throw new Error("WebSocket is not connected");this.ws.close()}};var ca="x-goog-api-key",ci=class{static{f(this,"WebAuth")}constructor(e){this.apiKey=e}async addAuthHeaders(e,t){if(e.get(ca)===null){if(this.apiKey.startsWith("auth_tokens/"))throw new Error("Ephemeral tokens are only supported by the live API.");if(!this.apiKey)throw new Error("API key is missing. Please provide a valid API key.");e.append(ca,this.apiKey)}}};var ch="gl-node/",St=class{static{f(this,"GoogleGenAI")}get interactions(){if(this._interactions!==void 0)return this._interactions;if(console.warn("GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions."),this.vertexai)throw new Error("This version of the GenAI SDK does not support Vertex AI API for interactions.");let e=this.httpOptions;e?.extraBody&&console.warn("GoogleGenAI.interactions: Client level httpOptions.extraBody is not supported by the interactions client and will be ignored.");let t=new z({baseURL:this.apiClient.getBaseUrl(),apiKey:this.apiKey,defaultHeaders:this.apiClient.getDefaultHeaders(),timeout:e?.timeout});return this._interactions=t.interactions,this._interactions}constructor(e){var t;if(e.apiKey==null)throw new Error("An API Key must be set when running in a browser");if(e.project||e.location)throw new Error("Vertex AI project based authentication is not supported on browser runtimes. Please do not provide a project or location.");this.vertexai=(t=e.vertexai)!==null&&t!==void 0?t:!1,this.apiKey=e.apiKey;let o=Ul(e.httpOptions,e.vertexai,void 0,void 0);o&&(e.httpOptions?e.httpOptions.baseUrl=o:e.httpOptions={baseUrl:o}),this.apiVersion=e.apiVersion,this.httpOptions=e.httpOptions;let i=new ci(this.apiKey);this.apiClient=new Fo({auth:i,apiVersion:this.apiVersion,apiKey:this.apiKey,vertexai:this.vertexai,httpOptions:this.httpOptions,userAgentExtra:ch+"web",uploader:new si,downloader:new ri}),this.models=new zo(this.apiClient),this.live=new Bo(this.apiClient,i,new ai),this.batches=new Ro(this.apiClient),this.chats=new Mo(this.models,this.apiClient),this.caches=new $o(this.apiClient),this.files=new Do(this.apiClient),this.operations=new Jo(this.apiClient),this.authTokens=new Wo(this.apiClient),this.tunings=new ii(this.apiClient),this.fileSearchStores=new Xo(this.apiClient)}};var We=V||!0,Ja=new Map,Wa=[];function Ke(){let n=`[${Ke.name}]`;try{return We&&console.log(`${n} starting... (I: a5cf5821b42e1c71182dd61431977e25)`),Ja}catch(e){throw console.error(`${n} ${y(e)}`),e}finally{We&&console.log(`${n} complete.`)}}f(Ke,"getAllFunctionInfos");function gi(){let n=`[${gi.name}]`;try{return We&&console.log(`${n} starting... (I: 82c9a8fc91d8121fb843af32e76c2e25)`),Wa}catch(e){throw console.error(`${n} ${y(e)}`),e}finally{We&&console.log(`${n} complete.`)}}f(gi,"getDeprecatedFunctionInfoNames");function dh({functionInfos:n}){let e=`[${dh.name}]`;try{We&&console.log(`${e} starting... (I: 14fee8e27384a040494542182031ae25)`),n.size===0&&console.warn(`${e} empty functionInfos? (W: 97fcb8fc47689bc418893c09a16a2525)`);for(let[t,o]of n)Wa.includes(t)?We&&console.log(`${e} functionInfo.nameOrId (${t}) is deprecated. Skipping add. (I: 3256eadf54f8087088a704798e2fd825)`):Ja.set(t,o)}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{We&&console.log(`${e} complete.`)}}f(dh,"registerFunctionInfos");var ie=V;function At(n){switch(n){case O.HUMAN:return"user";case O.AI:return"model";case O.FUNCTION:return"user";case O.HARDCODED:return"user";case O.UNKNOWN:return"user";default:throw new Error(`(UNEXPECTED) src is not a valid TextSource? src: ${n} (E: 9d954fe0bc49cf4572a65b19b6173925)`)}}f(At,"textSourceToGeminiRole");function Ka(n){return n.api==="gemini"}f(Ka,"isPromptInfoGemini");function bi({systemPromptEntries:n}){let e=`[${bi.name}]`;try{if(ie&&console.log(`${e} starting... (I: 18693a97427939699285ef8c1a9cc425)`),n.length===0)return;n.every(o=>o.src===O.HUMAN)||ie&&console.warn(`${e} not every system entry's src is human. We're still going to say that these are "user" origin in Gemini API. (W: 7115e2be876498ecb1e153c79a86e125)`);let t={role:"user",parts:n.filter(o=>!!o.content.parts).flatMap(o=>o.content.parts)};return ie&&console.log(`${e} sysInstructionContent: ${D(t)} (I: 011e5b865c23eb0b640df3f464ac2525)`),t}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{ie&&console.log(`${e} complete.`)}}f(bi,"systemPromptEntriesToSystemInstructionContent");function yi({ibGib:n}){let e=`[${yi.name}]`;try{if(ie&&console.log(`${e} starting... (I: 986d3edcd4f3aaf1d7eb0f8b59206b25)`),!n)return ie&&console.warn(`${e} ibGib falsy. (W: a70390e8bc3f420a92d3a84f4c78f12a)`),!1;if(!Be({ibGib:n}))return ie&&console.log(`${e} not a comment ibgib (I: 6a62c4f6e13776616855c4f237a5206b)`),!1;if(!n.data)return ie&&console.log(`${e} ibGib.data falsy (I: 69eb86975640475395bb74944141a46d)`),!1;let{text:t}=n.data;return t?t.includes(Vt)?(ie&&console.log(`${e} has tag. returning true. (I: 6d76b27d558d44f696582f41af561f29)`),!0):(ie&&console.log(`${e} no indicator found. returning false. (I: 815f181a0a08058362f76b08a8964674)`),!1):(ie&&console.log(`${e} text falsy (I: e348e38c841b4443b3f09e75c0215b24)`),!1)}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{ie&&console.log(`${e} complete.`)}}f(yi,"isFunctionCallRequestComment");function Ei({functionInfoIbGib:n}){let e=`[${Ei.name}]`;try{if(ie&&console.log(`${e} starting... (I: 1a2b3c4d5e6f7a8b)`),!n)throw new Error(`${e} functionInfoIbGib parameter is required. (E: 9c8f7a3b2d1e4a5b6c7d8e9f)`);if(!n.data)throw new Error(`${e} functionInfoIbGib.data is required. (E: 2b3c4d5e6f7a8b1c2d3e4f5a)`);let{fnName:t,fnArgs:o,fnResult:i}=n.data;if(!t)throw new Error(`${e} functionInfoIbGib.data.fnName is required. (E: 6f7a8b1c2d3e4f5a6b7c8d9e)`);return{call:{functionCall:{name:t,args:o??{}}},response:{functionResponse:{name:t,response:{value:i}}}}}catch(t){throw console.error(`${e} Error: ${y(t)}`),t}finally{ie&&console.log(`${e} complete.`)}}f(Ei,"getFunctionCallAndResponseParts");var xt=V,Nn="function_info",Xa="function_info";function Ya({data:n}){let e=`[${Ya.name}]`,{model:t,api:o,agentId:i,timestamp:s}=n;if(!t)throw new Error(`${e} data.model falsy (E: 6f47a28c0a8a45d794149c83e8f27e25)`);if(!o)throw new Error(`${e} data.api falsy (E: a0a812508a952a87c619d38084b7e325)`);if(!i)throw new Error(`${e} data.agentId falsy (E: ac35c1592c458e2c0e5908f6a9a3e525)`);let l=ke(s);if([t,o,i,l].some(d=>d.includes(" ")))throw new Error("invalid data. ib must not contain spaces (E: 36a56e4685163848458be06f51d4ad25)");return[Xa,l,t,o,i].join(" ")}f(Ya,"getFunctionInfoIb");async function Rn(n){let e=`[${Rn.name}]`;try{xt&&console.log(`${e} starting... (I: f4c9f0810a4d877f676297f6e6a96825)`);let{fnRawRequest:t,api:o,model:i,agentId:s,fnName:l,fnArgs:c,fnResult:d,fnComplete:u,parseErrorMsg:p,execErrorMsg:m,repromptWithResult:h,saveInSpace:g,metaspace:b,space:E}=n,I=new Date,v={name:i,timestamp:Rt(I),timestampMs:I.getMilliseconds(),agentId:s,api:o,model:i,fnRawRequest:t,fnName:l,fnArgs:c,fnResult:d,fnComplete:u,repromptWithResult:h};p&&(v.parseErrorMsg=p),m&&(v.execErrorMsg=m);let T=Ya({data:v}),w=await Q.firstGen({ib:T,parentIbGib:Q.primitive({ib:Xa}),data:v,nCounter:!0,dna:!0,tjp:{uuid:!0}});if(xt&&console.log(`${e} created functionInfoIbGib (I: e50d2e17f43312d4f4739899306bb725)`),g){if(!b)throw new Error(`${e} metaspace must be provided if saveInSpace is set to true (E: e74b76b00124d5874a6c5404e794b725)`);if(!E)throw new Error(`${e} space must be provided if saveInSpace is set to true (E: f3d5f1695a52707114117f72d932a025)`);await b.persistTransformResult({resTransform:w,space:E}),xt&&console.log(`${e} persisted resFunctionInfo (${x({ibGib:w.newIbGib})}) to space ${E.data?.uuid} (I: aa98e877d3b34e0d2a3b7711f8f27e25)`),await b.registerNewIbGib({ibGib:w.newIbGib,space:E}),xt&&console.log(`${e} registered new function info ibgib (${x({ibGib:w.newIbGib})}) with metaspace (I: aa98e877d3b34e0d2a3b7711f8f27e25)`)}return w}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{xt&&console.log(`${e} complete.`)}}f(Rn,"createFunctionInfoIbGib");var R=V,$n=class n extends pr{static{f(this,"AgentWitness_V1")}lc=`[${n.name}]`;availableFunctions=new Map;commentIbGibs_system=[];commentIbGibs_chat=[];_metaspace;fnGetAPIKey=f(()=>Promise.reject("not implemented. you need to set this after initializing the agent. (E: a14cbe903d08821126bbbb1d063d9825)"),"fnGetAPIKey");get name(){return this.data?.name??""}get uuid(){return this.data?.uuid??""}_genAI;transientDecompressionPromptText;fnOutputText=f(e=>{console.log(`${this.lc}[fnOutputText] this hack does nothing by default. set this to do something when text is returned by the model LLM. textResponse: ${e} (W: 3007e5d69dafdd7e42157fa7370d7f25)`)},"fnOutputText");ibGibProxy;constructor(e,t){super(e,t),this.instanceId=Ye({count:32})}async validateThis(){let e=`${this.lc}[${this.validateThis.name}]`;try{R&&console.log(`${e} starting... (I: 641e211473fc54d5a9ebb4ea44944d25)`);let t=await super.validateThis();return this.data?(this.data?.subSpaceId||t.push("agent.data.subSpaceId falsy (E: d4ea57fd6b1c5cbc1e18a084de2f7725)"),this.data?.subSpaceId.match(Nt)||t.push(`agent.data.subSpaceId must match regexp: ${Nt}. (E: f381eff533aa3f4713316f93f7f1dc25)`),this.data.name?this.data.name.match(nt)||t.push(`agent name must match regexp: ${nt}`):t.push("agent name falsy (E: 1351325107e5ac5ea6b7b789b73de125)"),this.data.description&&(this.data.description.match(Qn)||t.push(`agent description must match regexp: ${Qn}`))):t.push("this.data falsy (E: f5f151e11b12cad814b37ecad7c74a25)"),t}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{R&&console.log(`${e} complete.`)}}async initialize(){let e=`${this.lc}[${this.initialize.name}]`;try{R&&console.log(`${e} starting... (I: ce38519ac4bef52844a558fe31cda825)`),await super.initialize(),this._metaspace=await Ee();let t=new Ne;if(await t.initialized,!t.contextUpdated$)throw new Error("(UNEXPECTED) ibGibProxy.contextUpdated$ falsy? (E: e8840870af18091e6e4d52490ddca825)");if(t.contextUpdated$.subscribe(we({next:f(async o=>{let i=`${e}[ibGibProxy.contextUpdated$][next]`;R&&console.log(`${i} nextIbGib: ${D(o)} (I: 96c846357b94fda2cefa615aed88c325)`),await this.handleContextUpdated()},"next"),error:f(async o=>{debugger;console.error(`${e}[ibGibProxy.contextUpdated$][error] what up? ${y(o)}`)},"error")})),this.ib&&this.gib&&this.data){let o=this.toIbGibDto();await this.loadIbGibDto(o);let i=await this._metaspace.getLocalUserSpace({localSpaceId:o.data?.superSpaceId});if(!i)throw new Error(`couldn't get local space with agent.data.superSpaceId (${o.data?.superSpaceId})? (E: 0fc1b8a8ffa26f39d8a15218ec818725)`);await this.ibGibProxy?.setWrappedIbGib({ibGib:o,space:i})}else R&&console.log(`${e} agent is "empty". not loading dto at this time, caller is responsible for calling loadIbGibDto (I: 06dba19d74d5695fe7d1957889283725)`)}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{R&&console.log(`${e} complete.`)}}async handleContextUpdated(){let e=`${this.lc}[${this.handleContextUpdated.name}]`;try{if(!this.ibGibProxy)throw new Error("(UNEXPECTED) this.ibGibProxy falsy but we're within handleContextUpdated handler? (E: a88fa85e8f27bd7f72c207389ebfbc25)");if(!this.ibGibProxy.ibGib)throw new Error("(UNEXPECTED) this.ibGibProxy.ibGib falsy but we're within the handleContextUpdated handler? (E: ca60b8f0a60a3e3d652c3018102d1825)");debugger;if(!this.gib){debugger;console.error(`${e} not sure if error, but this.gib is falsy when we get a new context down the pipeline? (E: 8501d8aee4db7b8461587f38f0bbb125)`)}if(x({ibGib:this})!==x({ibGib:this.ibGibProxy.ibGib})){let t=this.ibGibProxy.ibGib.data.n??0,o=this.data?.n??0;if(t<=o){debugger;console.error(`${e} issue with "new" proxy context and the current this.data.n with different addresses. divergent timelines? (E: 15c698eb4488cbae2db0e778fec15825)`)}await this.loadIbGibDto(this.ibGibProxy.ibGib),await K(200)}else console.error(`${e} ibgibProxy new context is no different than current. this is NOT necessarily an error, I just want to see this when it happens. nothing is being done here, we're just not loading the "new" ibgib dto. (E: eff668b2e858ded448366d58e4dd6825)`)}catch(t){throw console.error(`${e} ${y(t)}`),t}}async getSubSpace(){let e=`[${this.getSubSpace.name}]`;try{R&&console.log(`${e} starting... (I: a2ec2c5e8f5fdf95c8c571b2b1b9e925)`);let{_metaspace:t}=this;if(!t)throw new Error("(UNEXPECTED) this.metaspace falsy? after init this.metaspace is expected to be set. (E: 4519a8feaf4489389be679598f274425)");let o=await t.getLocalUserSpace({localSpaceId:this.data.subSpaceId});if(!o){let i=await this.validateThis();if(i.length>0)throw new Error(`this agent has validation errors: ${i} (E: 9a0c6125cf89789ddb1610cf5a752225)`);if(!this.data)throw new Error("(UNEXPECTED) this.data falsy? (E: 06e30e1d53fd4935333c7cf7e10db425)");o=await t.createLocalSpaceAndUpdateBootstrap({allowCancel:!1,zeroSpace:t.zeroSpace,spaceName:this.name+this.uuid.substring(0,5),createBootstrap:!1})}if(!o)throw new Error("(UNEXPECTED) space still falsy after creating locally? (E: 037ef1e6f54a675d0367227fdae16525)");return o}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{R&&console.log(`${e} complete.`)}}async getSuperSpace(){let e=`[${this.getSuperSpace.name}]`;try{R&&console.log(`${e} starting... (I: 55fba9bcaf9539cc2219e03cda200525)`);let{_metaspace:t}=this;if(!t)throw new Error("(UNEXPECTED) this.metaspace falsy? after init this.metaspace is expected to be set. (E: 107f670c99832c573a7e5de18d58c325)");if(!this.data)throw new Error("(UNEXPECTED) this.data falsy? (E: a4341b8753678fcba7877b6319769b25)");if(!this.data.superSpaceId)throw new Error("(UNEXPECTED) this.data.superSpaceId falsy? (E: 0429fe44df5b56bf2ac67d38cde56325)");let o=await t.getLocalUserSpace({localSpaceId:this.data.superSpaceId});if(!o)throw new Error(`(UNEXPECTED) superSpace falsy? this.data.superSpaceId: ${this.data.superSpaceId} (E: fd9435212e8b87e4b60034bf9e797f25)`);return o}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{R&&console.log(`${e} complete.`)}}_activeContext=void 0;async setActiveContext(e){let t=`${this.lc}[${this.setActiveContext.name}]`;try{R&&console.log(`${t} starting... (I: genuuid)`);let{contextIbGib:o,loggingInfo:i}=e;if(!this.data)throw new Error("(UNEXPECTED) this.data falsy? (E: ab5377fda6bc324638722d9832bab925)");if(!o)throw new Error("(UNEXPECTED) contextIbGib falsy? (E: 694525e512cfdd12c14e1213dbaab925)");if(!o.data)throw new Error("(UNEXPECTED) contextIbGib.data falsy? (E: f337252a23c822bcbd76144540050825)");let s=x({ibGib:o}),l=le({ibGib:o});if(!l)throw new Error(`(UNEXPECTED) contextTjpAddr falsy? contextIbGib (${s}) is expected to be a living ibgib with a tjp address (i.e. a timeline). This means it should have a rel8ns.tjp or data.isTjp should be truthy. (E: d756d1e862d2cccfed4a5807737e9a25)`);if(this.data?.["@currentContextTjpAddr"]===l?R&&console.log(`${t} this.data.@currentContextTjpAddr already set to the same addr. (I: 9f0d58ec65eee3ca2aec528f1328c325)`):await this.mut8Self({dataToAddOrPatch:{"@currentContextTjpAddr":l}}),!this._activeContext){let c=new Ne;await c.initialized;let d=`${t}[contextUpdated]`;if(!c.contextUpdated$)throw new Error("(UNEXPECTED) proxy.contextUpdated$ falsy? (E: 868c5e3bf025baa6d1ae727ab1160c25)");c.contextUpdated$.subscribe(we({next:f(async p=>{console.log(`${d}[next] nextIbGib: ${D(p)}`)},"next"),complete:f(async()=>{debugger;throw new Error(`${d}[complete] (UNEXPECTED) agent active context subscription complete? i honestly don't know if this hits. (E: 786d26ab23e4313db7ae2e08c70a7425)`)},"complete"),error:f(async p=>{debugger;console.error(`${d}[error] ${y(p)}`)},"error")}));let u=`${t}[newContextChild]`;if(!c.newContextChild$)throw new Error("(UNEXPECTED) proxy.newContextChild$ falsy? (E: 123cf5624c3d2a6308aafc0c41f8a925)");c.newContextChild$.subscribe(we({next:f(async p=>{if(console.log(`${u}[next] newChild: ${D(p)}`),!p.data)throw new Error("newChild.data falsy? (E: a654134a2695c176971b0cd1426ced25)");if(Be({ibGib:p})){let m=this.commentIbGibs_chat.map(I=>le({ibGib:I})??x({ibGib:I})),h=le({ibGib:p})??x({ibGib:p});if(m.includes(h)){console.log(`${t} already did this comment (${h}) (I: bce18642bb9babeb553e6188d7ae2825)`);return}let{safeIbCommentMetadataText:g}=He({ib:p.ib}),{textSrc:b}=Pt({addlMetadataText:g??"",ifError:"warn"}),E=p.data.text.startsWith("system: ");await this.addTexts({infos:[{textSrc:b??O.UNKNOWN,commentIbGib:p,isSystem:E}]}),b===O.HUMAN&&(E?console.log(`${t} system prompt has been modified. (I: d21c26f0a3fa12e2a874925882f39825)`):await this.doPrompt())}else console.warn(`${u} non-comment newChild. probably not a warning proper, but at this stage I'm only expecting comments ignoring... (W: e664834af4791ddcde19bfd4f7063e25)`)},"next"),complete:f(async()=>{debugger;throw new Error(`${u}[complete] (UNEXPECTED) agent active context subscription complete? i honestly don't know if this hits. (E: 88202d1f7554330d3dfca0237c2d6525)`)},"complete"),error:f(async p=>{debugger;console.error(`${u}[error] ${y(p)}`)},"error")})),this._activeContext=c}if(!this._activeContext)throw new Error("(UNEXPECTED) this._activeContext still falsy after we just initialized it? (E: 584f2f672b9ae7c979dde693eafb7a25)");await this._activeContext.setWrappedIbGib({ibGib:o})}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{R&&console.log(`${t} complete.`)}}async updateName({name:e}){let t=`${this.lc}[${this.updateName.name}]`;try{if(R&&console.log(`${t} starting... (I: genuuid)`),e===this.name){console.warn(`${t} agent (${this.uuid}) already is named ${e}. returning early... (W: genuuid)`);return}else if(nt.test(e))await this.mut8Self({dataToAddOrPatch:{name:e}});else throw new Error(`invalid name ${e}. must match regexp: ${nt.source} (E: 507a2bfc0aaa60bd7bb608d253239e25)`)}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{R&&console.log(`${t} complete.`)}}async updateAvailableFunctions({availableFunctions:e}){let t=`${this.lc}[${this.updateAvailableFunctions.name}]`;try{R&&console.log(`${t} starting... (I: 68f1bfa343925a657f8c0545b191c725)`);let o=[];for(let i of e)if(!this.availableFunctions.has(i.nameOrId)){let s=Ke().get(i.nameOrId);if(s)o.push(s);else{console.error(`(UNEXPECTED) ${i} function not registered with getAllFunctionInfos()? skipping adding this function to the agent... (E: e860fe13c02677b274ac0e7df2587a25)`);continue}}o.length>0&&(console.log(`${t} adding newly found functions to agent: ${o.map(i=>i.nameOrId)}. (I: ab2b0ae6a62b3ced6a5f1e2e8cec4f25)`),await this.addAvailableFunctions(o))}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{R&&console.log(`${t} complete.`)}}async mut8Self({dataToAddOrPatch:e}){let t=`${this.lc}[${this.mut8Self.name}]`;try{R&&console.log(`${t} starting... (I: f4618832a0fe07ff8c89cea889d20725)`);let o=this._metaspace;if(!o)throw new Error("(UNEXPECTED) metaspace falsy? (E: genuuid)");let i=await o.getLocalUserSpace({lock:!1,localSpaceId:this.data.superSpaceId});if(!i)throw new Error(`couldn't get local superSpace given by this.data.superSpaceId (${this.data.superSpaceId}) (E: genuuid)`);let{tjpGib:s}=ye({gib:this.gib});if(!s)throw new Error(`(UNEXPECTED) this.gib (${this.gib}) has no tjpGib? (E: 75b8dcb82b58d3b0db40b39149023e25)`);await Dt({fn:f(async()=>{let l=Ie();await l.updateOrSetLatestAgent({agent:this,throwIfNewerFound:!1});let c=await Di({type:"mut8",src:this.toIbGibDto(),dataToAddOrPatch:e,dna:!0,nCounter:!0});await o.persistTransformResult({resTransform:c,space:i});let d=c.newIbGib;await this.loadIbGibDto(d),await l.updateOrSetLatestAgent({agent:this,throwIfNewerFound:!0}),await o.registerNewIbGib({ibGib:d,space:i}),await Ii({newAgentIbGib:d,metaspace:o,space:i,type:this.data.type})},"fn"),scope:s,secondsValid:60,maxDelayMs:100,maxLockAttempts:Number.MAX_SAFE_INTEGER,space:i,callerInstanceId:this.instanceId})}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{R&&console.log(`${t} complete.`)}}getAvailableFunctions(){return Array.from(this.availableFunctions.values())}getComments_System(){return[...this.commentIbGibs_system]}getComments_Chat(){return[...this.commentIbGibs_chat]}async addAvailableFunctions(e){let t=`[${this.addAvailableFunctions.name}]`;try{if(R&&console.log(`${t} starting... (I: 273525464ec540fc9cba565e608db925)`),!e)throw new Error("(UNEXPECTED) functionInfos falsy? (E: 19cf2b7c9ee1115f0a3f7f62fbf77825)");if(e.length===0){console.warn(`${t} functionInfos.length === 0? why is this being called with no functions? returning early without doing anything. (W: 86c6dc4fad3c1ddcac697d5636b1eb25)`);return}await Ie().updateOrSetLatestAgent({agent:this,throwIfNewerFound:!1}),e.forEach(i=>{this.availableFunctions.has(i.nameOrId)&&console.warn(`${t} this.availableFunctions already has an entry for ${i.nameOrId}. replacing anyway. (W: ef2372a27be67174cb3605eac2c85c25)`),this.availableFunctions.set(i.nameOrId,i)}),await this.mut8Self({dataToAddOrPatch:{availableFunctionNameOrIds:Array.from(this.availableFunctions.keys())}})}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{R&&console.log(`${t} complete.`)}}async doPrompt(){let e=`[${this.doPrompt.name}]`;try{if(R&&console.log(`${e} starting... (I: e7f1a7845cdf1bdce1f12d74c71a6425)`),!this.data)throw new Error("(UNEXPECTED) this.data falsy? (E: 3c528e2376a2f2600b347b2c183a5225)");let t=await this.composePromptInfo();R&&console.log(`${e} promptTextInfo: ${D(t)} (I: b769b5f2a47623a99f78210994d90525)`);let o=await this.callTextAPI(t);if(R&&console.log(`${e} api result:`,o,"(I: e4d2c767eb3d6e38d83123d684a07425)"),"text"in o)await this.doPrompt_text(o.text);else{let{functionCalls:i}=o;await this.doPrompt_functionCalls({functionCalls:i})}}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{R&&console.log(`${e} complete.`)}}async doPrompt_text(e){let t=`${this.lc}[${this.doPrompt_text.name}]`;try{R&&console.log(`${t} starting... (I: a2b9c21f3b2b058d355d16421e2b4425)`),e||="[no text returned from the model]",this.fnOutputText?this.fnOutputText(e):console.log(`${t} no fnOutputText set. Text Response: ${e} (I: 5936517474b10b214257781a24b10425)`)}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{R&&console.log(`${t} complete.`)}}async doPrompt_functionCalls({functionCalls:e}){let t=`${this.lc}[${this.doPrompt_functionCalls.name}]`;try{if(R&&console.log(`${t} starting... (I: a4f1b581517a9c2a9187e9f8f3519925)`),e.length===0)throw new Error("(UNEXPECTED) functionCalls.length is zero? (E: 6434b8515a435a59b331452b563f4425)");let o=await this.doPrompt_functionCalls_createFunctionInfoIbGibsAndExecFunctionCalls({functionCalls:e});if(await this.doPrompt_functionCalls_addFunctionCallRequestComment({functionInfoIbGibs:o}),o.some(s=>!!s.data?.repromptWithResult&&s.data.fnName!=="tellUser")){let s=await this.doPrompt_functionCalls_getTransientDecompressionPromptForNextPrompt({functionInfoIbGibs:o});s.length>0?(console.log(`${t} transientDecompressionPromptText: ${s} (I: 11c11d544b7c8f8f8e7e5f7c1a9e3625)`),this.transientDecompressionPromptText=s,await this.rePrompt()):console.warn(`${t} (UNEXPECTED) there is no decompression text? (W: 6ce5da95c1c89a7ec48a00fbc1d11825)`)}else R&&console.log(`${t} no repromptWithResult. returning early. (I: 9c0113c958c7404534291f6700325925)`)}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{R&&console.log(`${t} complete.`)}}async doPrompt_functionCalls_createFunctionInfoIbGibsAndExecFunctionCalls({functionCalls:e}){let t=`${this.lc}[${this.doPrompt_functionCalls_createFunctionInfoIbGibsAndExecFunctionCalls.name}]`;try{if(R&&console.log(`${t} starting... (I: adc094bc98cb076a4aaf729f70adce25)`),!this.data)throw new Error("(UNEXPECTED) this.data falsy? (E: d071328283b2cf880ff0ccd499c22b25)");if(!this.data.uuid)throw new Error("(UNEXPECTED) this.data.uuid falsy? (E: 8acd2f793e4b5a368dbcf1d8d1e6e825)");let o=this._metaspace;if(!o)throw new Error("(UNEXPECTED) metaspace falsy? (E: acf8a69e853eb8663f1dd0f79a823e25)");let i=[];for(let s of e)try{R&&console.log(`${t} processing functionCall: ${s} (I: a0c0b22b3c6b6c4b674a5a9c8c8b9e25)`);let l,c,d,u,p,m="";try{if(c=JSON.parse(s),m=c?.name??"",!m)throw new Error("functionName (functionCallParsedObj.name) falsy (E: e2397d675863a12b7609495b0007a025)");if(R&&console.log(`${t} functionCallParsedObj:`,D(c),"(I: 750f097243b85644d111971e0f929c25)"),u=Ke().get(c.name),!u)throw new Error(`no APIFunctionInfo found that matches functionName (${m}) (E: 9d36b6472ec5cdf95e4f498292449925)`);p=c.args,R&&console.log(`${t} valid params (I: a4d5c13c79a2405c8d20464b42083325)`)}catch(h){d=`${t} invalid functionCallParsedObj. error: ${y(h)}. functionCallStr: ${s}. (E: 1687a24c5a3667d34689a09f8f753125)`,console.error(d),c=void 0}if(u){R&&console.log(`${t} found functionInfo: ${u.nameOrId} (I: 837c7a8200689a0b2314b73057812b25)`);let h,g=!1,b;try{R&&console.log(`${t} calling function impl for ${u.nameOrId} (I: b145d08186782089c18564305f0f1125)`),h=await u.fnViaCmd(p),g=!0,R&&console.log(`${t} functionImpl complete for ${u.nameOrId}. result:`,D(h),"(I: e19d476f489261263165914750472d25)")}catch(I){b=`${t} could not call functionImpl for ${u.nameOrId}: ${y(I)} (E: 9c0e97f29a9290f9d57637b7053f0c25)`,console.error(b)}l=(await Rn({api:this.data.api,model:this.data.model,agentId:this.data.uuid,fnRawRequest:s,fnName:m,fnArgs:c.args,repromptWithResult:c.args?.repromptWithResult??!1,fnResult:h,fnComplete:g,execErrorMsg:b,parseErrorMsg:void 0,saveInSpace:!0,metaspace:o,space:await this.getSuperSpace()})).newIbGib}else l=(await Rn({api:this.data.api,model:this.data.model,agentId:this.data.uuid,fnRawRequest:s,fnName:m,fnArgs:c.args,repromptWithResult:c.args?.repromptWithResult??!1,fnResult:void 0,fnComplete:void 0,execErrorMsg:void 0,parseErrorMsg:d,saveInSpace:!0,metaspace:o,space:await this.getSuperSpace()})).newIbGib;if(!l)throw new Error("(UNEXPECTED) functionInfoIbGib falsy? we should have guaranteed to create one at this point. (E: 97c4ce12c7372adfeebfd45181b73f25)");i.push(l)}catch(l){throw console.error(`${t} ${y(l)}`),l}finally{R&&console.log(`${t} complete.`)}if(i.length===0)throw new Error("(UNEXPECTED) functionInfoIbGibs.length === 0? We expect at least one to be created (E: a8f81c56377cdbdeb468af6b21879825)");return i}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{R&&console.log(`${t} complete.`)}}async doPrompt_functionCalls_addFunctionCallRequestComment({functionInfoIbGibs:e}){let t=`${this.lc}[${this.doPrompt_functionCalls_addFunctionCallRequestComment.name}]`;try{R&&console.log(`${t} starting... (I: 5000adac5e8c4a7158a720c38f56b325)`);let o=this._metaspace;if(!o)throw new Error("(UNEXPECTED) metaspace falsy? (E: d7275731461d8d0526af3088553ae525)");let i=await this.getSuperSpace(),s=ot({tagText:Vt,contentText:e.map(p=>x({ibGib:p})).join(`
|
|
1184
|
-
`),randomIdLength:4}),l=mt({textSrc:"ai",other:"functionCallRequest"}),c=await qe({text:s,addlMetadataText:l,saveInSpace:!0,space:i}),d=await Ue({type:"rel8",src:c.newIbGib,rel8nsToAddByAddr:{[Nn]:e.map(p=>x({ibGib:p}))},dna:!0,nCounter:!0}),u=d.newIbGib;await o.persistTransformResult({resTransform:d,space:i}),await o.registerNewIbGib({ibGib:u,space:i}),await this.addTexts({infos:[{textSrc:"ai",commentIbGib:u}]})}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{R&&console.log(`${t} complete.`)}}async doPrompt_functionCalls_getTransientDecompressionPromptForNextPrompt({functionInfoIbGibs:e}){let t=`${this.lc}[${this.doPrompt_functionCalls_getTransientDecompressionPromptForNextPrompt.name}]`;try{R&&console.log(`${t} starting... (I: c245f78f6c78a98d62375a9f14b3d625)`);let o=[];for(let i of e)try{let s=x({ibGib:i});if(!i.data)throw new Error(`(UNEXPECTED) !functionInfoIbGib.data? functionInfoAddr: ${s} (E: 7815e4854513c26b889517a9bd7e0d25)`);let{fnRawRequest:l,fnComplete:c,fnResult:d}=i.data,p=ot({tagText:s,contentText:D({fnRawRequest:l,fnComplete:c,fnResult:d}),randomIdLength:void 0});o.push(p)}catch(s){console.error(`${t} could not call functionImpl: ${y(s)} (E: 2a3b8b37e146c524b67119e3a74e3d25)`)}return o.join(`
|
|
1185
|
-
`)}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{R&&console.log(`${t} complete.`)}}repromptCount=0;repromptMax=12;async rePrompt(){let e=`${this.lc}[${this.rePrompt.name}]`;try{R&&console.log(`${e} starting... (I: b6af34214acf07f9ca8c1d03c0011525)`),this.repromptCount<this.repromptMax?(this.repromptCount++,await this.doPrompt()):(console.log(`${e} already reached repromptMax (${this.repromptMax}). reprompt aborting. $(I: dacefb501dab2a1ee173ce8558657725)`),this.repromptCount=0)}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{R&&console.log(`${e} complete.`)}}async witness(e){if(e.ib===Mt&&e.gib===Gt)return this.getComments_Chat().length>0&&await this.doPrompt(),gt;throw new Error(`arg (${D(e)}) not implemented. only expect ${gt} right now to trigger doPrompt. (E: 24da0ad7333b6bbb359d1be425db3c25)`)}};var k=V,Me=class n extends $n{static{f(this,"AgentWitnessGemini_V1")}lc=`[${n.name}]`;async validateThis(){let e=`${this.lc}[${this.validateThis.name}]`;try{k&&console.log(`${e} starting... (I: 641e211473fc54d5a9ebb4ea44944d25)`);let t=await super.validateThis();return this.data&&console.warn(`${e} do more validation on this concrete class. (W: fb778a84ccca2ebcefd2ca7845543825)`),t}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{k&&console.log(`${e} complete.`)}}parseAddlMetadataString({ib:e}){let t=`${this.lc}[${this.parseAddlMetadataString.name}]`;try{throw k&&console.log(`${t} starting... (I: 080daf4b73f8bb52c70bf0a8f329be25)`),new Error("not implemented...i've just converted agent witness to a full witness with context and this was the only abstract method required. wasn't being used previously? so i'm not sure why this is here. (E: 129e816d3698f3867ec54c34fcc9a225)")}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{k&&console.log(`${t} complete.`)}}async addTexts(e){let t=`${this.lc}[${this.addTexts.name}]`;try{let o=Ie();await o.updateOrSetLatestAgent({agent:this,throwIfNewerFound:!1});let i=this._metaspace;if(!i)throw new Error("(UNEXPECTED) metaspace falsy? (E: fd92a81901a83e2698ab2c3d4e702f25)");if(e.infos.length===0)return console.warn(`${t} opts.infos.length === 0. So we've called addTexts but with an empty array? returning early. (W: 0d42cd3b26aec45874d0e65450b37d25)`),[];let s=[],l=[],c=[],d=await this.getSuperSpace();for(let m of e.infos){let{textSrc:h,isSystem:g}=m,{text:b,commentIbGib:E}=m;if(b&&E)throw new Error("(UNEXPECTED) both text and commentIbGib provided? (E: a3fd590db1a5efc301f3c7e66b322f25)");if(!b&&!E)throw new Error("(UNEXPECTED) both text and commentIbGib falsy? one or the other is required (E: e08c7c694a17319085adfb75914b2725)");let I=mt({textSrc:h});if(E)k&&console.log(`${t} adding existing commentIbGib (I: 72a3f7aafde92f65b168d27605f94625)`);else{if(k&&console.log(`${t} creating new commentIbGib for text (I: 72a3f7aafde92f65b168d27605f94625)`),!b)throw new Error("(UNEXPECTED) text falsy still? at this point it should be guaranteed (E: b2deec458f35f22298ccb664d0685125)");E=(await qe({text:b,addlMetadataText:I,saveInSpace:!0,space:d})).newIbGib,await i.registerNewIbGib({ibGib:E,space:d})}if(!E)throw new Error("(UNEXPECTED) commentIbGib still falsy? we should have just created one if it didn't exist (E: 9370b19aa207234db185cd74b57be525)");let v=await Dn({ibGib:E});if(v.length>0)throw new Error(`validation errors with trying to add a commentIbGib. errors: ${v} (E: beee1893050f9bcf9842c66831595225)`);s.push(E),g?l.push(E):c.push(E)}let u=[];l.length>0&&u.push({rel8nName:"system",ibGibs:l}),c.length>0&&u.push({rel8nName:"chat",ibGibs:c});let p=await ur({timeline:this.toIbGibDto(),rel8nInfos:u,timelineIndexInfo:{rel8nName:Oe,type:this.data.type},metaspace:i,space:d});return await this.loadIbGibDto(p),await o.updateOrSetLatestAgent({agent:this,throwIfNewerFound:!0}),s}catch(o){throw console.error(`${t} ${y(o)}`),o}}async composePromptInfo(){let e=`${this.lc}[${this.composePromptInfo.name}]`;try{if(k&&console.log(`${e} starting... (I: 155774d4811b038034342d5750174325)`),!this._metaspace)throw new Error("this.metaspace falsy (E: 7232a3a1b4348d460ed1375b32677125)");let t=[];for(let p of this.commentIbGibs_system){let m=await this.createPromptInfoEntriesFromGeminiComment({commentIbGib:p});t.push(...m)}let o=this.data?.["@currentContextTjpAddr"]??q;if(o!==q&&t.push({src:O.HARDCODED,content:{role:At(O.HARDCODED),parts:[{text:Qa({currentContextTjpAddr:o})}]}}),this.commentIbGibs_chat.length===0)throw new Error("(UNEXPECTED) this.commentIbGibs_chat.length === 0? why are we composing prompt info? We are assumed at this point to have added at least one comment ibgib to this agent. (E: a4e3d840946ab8e6dc3fde3e25d6b225)");let i=[],s=this.commentIbGibs_chat.length>1?this.commentIbGibs_chat.slice(0,-1):[];for(let p of s){let m=await this.createPromptInfoEntriesFromGeminiComment({commentIbGib:p});i.push(...m)}let l,c=this.commentIbGibs_chat.at(-1),d=await this.createPromptInfoEntriesFromGeminiComment({commentIbGib:c});if(d.length===1)l=d.at(0);else if(d.length===2)i.push(d.at(0)),l=d.at(1);else throw new Error("(UNEXPECTED) chatPromptCurrent_rawarray.length !== 1 or 2? We expect at this point either a regular text part or a FCR comment which creates two entries. (E: cd59f978479c20e496da4b0eb86c7d25)");let u={api:"gemini",systemPromptEntries:t,chatPromptHistoryParts:i,chatPromptCurrent:l};return k&&console.log(`${e} resPromptInfo:`,D(u),"(I: 8f17a8c45b9a91e20a5c5064d9114a25)"),u}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{k&&console.log(`${e} complete.`)}}async callTextAPI(e){let t=`${this.lc}[${this.callTextAPI.name}]`;try{if(k&&console.log(`${t} starting... (I: 27885f5b14682646542e9658417b2f25)`),!Ka(e))throw new Error("(UNEXPECTED) info.api !== gemini? we are in the gemini concrete class where this is assumed. (E: 9223647ec96fb3f4eaee32c3fc15d925)");if(!this.data)throw new Error("(UNEXPECTED) this.data falsy? (E: 09224b6688fdac884ce88f196b68a425)");let{api:o,model:i}=this.data;if(o!=="gemini")throw new Error(`api not supported: ${o} (E: 7e5c7c17988a666a86e72299630c7f25)`);k&&console.log(`${t} calling gemini api with model: ${i} (I: 6208942a419e9041bb037384135a0c25)`);let s=await this.fnGetAPIKey();if(!s)return console.error(`${t} apiKey falsy. did you set this.fnGetAPIKey (E: d964596b1538c0327209a92e97a54d25)`),{text:"no api key entered so no LLM chat happening. enter a gemini api key and donate/invest!"};this._genAI??=new St({apiKey:s});let l=Array.from(this.availableFunctions.values()).map(T=>({name:T.nameOrId,description:T.schema?.description,parameters:T.schema?.parameters}));l.some(T=>T.parameters==="undefined")&&console.error(`${t} (UNEXPECTED) function schema parameters not defined for all APIFunctionInfo values. (E: ae7227cdd65c0ab4513c7b282a1e4825)`),k&&(console.log(`${t} Gemini functionDeclarations:`),console.dir(l));let{systemPromptEntries:c,chatPromptHistoryParts:d,chatPromptCurrent:u}=e,p=Y(u);k&&console.log(`chatPromptCurrent_final (before decompression): ${D(p)} (I: bbd4c7b9f3225afe9da1761918d0ac25)`),k&&console.warn(`${t} skipping decompression for the moment. if we add decompression text when the last comment is a function response part, then we'll error out. Need to rethink compression/decompression with the new function call/response workflow. (W: 7478439f9bbbde30a1eab3c5189ea625)`);let m,h=f(async T=>{if(!this._genAI)throw new Error("(UNEXPECTED) this._genAI falsy? (E: 503a0d9e3f729de7653ee3565b017b25)");let w=d.map(F=>F.content),C={model:T,history:w,config:{systemInstruction:bi({systemPromptEntries:c}),tools:[{functionDeclarations:l}],toolConfig:{functionCallingConfig:{mode:e.overrideFunctionCallingMode??Yt.ANY}}}},S=this._genAI.chats.create(C),$={message:u.content.parts};return await S.sendMessage($)},"fnGoModel"),g=0,b=i;do{g++;try{m=await h(b);break}catch(T){let w=T.message,C=T.status??"[STATUS?]";w.includes(`${503}`)?(console.error(`${t}[fnGoModel][${b}] error trying to get result from model. will try using backup model (${it}) for this next call. error (${T.status}): ${y(T)} (E: a5cd7d174183518058da57cc6d0d8a25)`),b=it):w.includes(`${429}`)?(console.error(`${t}[fnGoModel][${b}] error trying to get result from model. will try using backup model (${it}) for this next call. error (${T.status}): ${y(T)} (E: a5cd7d174183518058da57cc6d0d8a25)`),b=it):console.error(`${t}[fnGoModel][${b}] error trying to get result from model. error (${T.status}): ${y(T)} (E: a67d595c8ed313d458369d4d0b3e7f25)`)}await K(2e3)}while(!m&&g<so);if(!m)throw new Error("couldn't get result from model (E: ede013a53f875d99a96a2e257c7e7125)");let E=m,I=[],v=E.candidates?.[0]?.content?.parts||[];for(let T of v)T.functionCall&&I.push(T.functionCall);if(!I||I.length===0){if(k&&console.warn(`${t} no function calls in response, returning text. (W: 3a4b8c940983b9e28e3f04c01a09bb25)`),!E.text)throw new Error("response generated no function calls and no response.text (E: 6123b8cacfb834105ad3160cfc4ef825)");return{text:E.text}}return k&&(console.log(`${t} Gemini function calls:`),console.dir(I)),{functionCalls:I.map(T=>JSON.stringify(T,null,2))}}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{k&&console.log(`${t} complete.`)}}async createPromptInfoEntriesFromGeminiComment({commentIbGib:e}){let t=`[${this.createPromptInfoEntriesFromGeminiComment.name}]`;try{k&&console.log(`${t} starting... (I: 826a9d6b120d96532afbe1f7a22e8d25)`);let o=await Dn({ibGib:e});if(o.length>0)throw new Error(`validation errors with commentIbGib. Cannot create a prompt info entry. errors: ${o} (E: beee1893050f9bcf9842c66831595225)`);let{safeIbCommentMetadataText:i}=He({ib:e.ib});if(!i)throw new Error("(UNEXPECTED) addlMetaDataText falsy? we just validated the comment ibgib, so there should be the expected shape of the comment.ib. (E: facf5801f9ba158b1526dd09d0e1b325)");let{textSrc:s,timestampInTicks:l,errorMsg:c,other:d}=Pt({addlMetadataText:i,ifError:"warn"});if(c)throw new Error("(UNEXPECTED) errorMsg is truthy after parse addl metadata from comment.ib? we just validated the comment ibgib, so there should be the expected shape of the comment.ib. (? (E: 7fd7fac50851916f39ceccbe93446425)");if(!e.data)throw new Error("(UNEXPECTED) commentIbGib.data falsy? (E: 8ce54d28219237feddf8f25b5846cc25)");if(!e.data.text)throw new Error("(UNEXPECTED) commentIbGib.data.text falsy? (E: 8556fc95c401d1b5441454fceb8f2f25)");if(yi({ibGib:e})){let p=await this.getFunctionInfoIbGibs({fcrCommentIbGib:e}),m=[],h=[];for(let E of p){let{call:I,response:v}=Ei({functionInfoIbGib:E});if(!I)throw new Error("(UNEXPECTED) call falsy? (E: 5c8f3bd6de3b300e1c105b9603bb7b25)");if(!v)throw new Error("(UNEXPECTED) response falsy? (E: d0388c838975c93126c1a6d64f781d25)");if(I.functionCall.name!==v.functionResponse.name)throw new Error("(UNEXPECTED) functionCall.name !== functionResponse.name? (E: e49f0d60093354db2b6ad17fdf86d425)");m.push(I),h.push(v)}let g={src:O.AI,content:{role:At("ai"),parts:m}},b={src:O.FUNCTION,content:{role:At(O.FUNCTION),parts:h}};return[g,b]}else return[{src:s,content:{role:At(s),parts:[{text:e.data.text}]}}]}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{k&&console.log(`${t} complete.`)}}async promptOneOff(e){let t=`${this.lc}[${this.promptOneOff.name}]`;try{k&&console.log(`${t} starting... (I: genuuid)`);let{text:o,systemInstructions:i}=e;if(!o)throw new Error("(UNEXPECTED) opts.text falsy? (E: genuuid)");if(!this.data)throw new Error("(UNEXPECTED) this.data falsy? (E: genuuid)");let{api:s,model:l}=this.data;if(s!=="gemini")throw new Error(`api not supported: ${s} (E: genuuid)`);k&&console.log(`${t} calling gemini api with model: ${l} (I: genuuid)`);let c=await this.fnGetAPIKey();if(!c){console.error(`${t} apiKey falsy. did you set this.fnGetAPIKey (E: genuuid)`);return}this._genAI??=new St({apiKey:c});let d=f(async b=>{if(!this._genAI)throw new Error("(UNEXPECTED) this._genAI falsy? (E: fbe235713d48f0d8e87cd0b88ec54825)");let E={model:b,config:{systemInstruction:i}},v=await this._genAI.chats.create(E).sendMessage({message:o});if(v.text)return v.text;throw new Error("response.text empty/falsy, potentially blocked by safety settings (E: a21a78c9471f27a42c07d1c859187825)")},"fnGoModel"),u,p=0,m=[];e.modelOverrides&&e.modelOverrides.length>0?m.push(...e.modelOverrides):m.push(l),e.modelBackupOverrides&&e.modelBackupOverrides.length>0?m.push(...e.modelBackupOverrides):m.push(it);let h=0,g=1;do{p++,g++;let b=m[h];try{u=await d(b);break}catch(E){if(E instanceof Error){let I=E.message,v=E.status??"[STATUS?]";if(I.includes(`${503}`))if(h===m.length-1)console.error(`${t}[fnGoModel][${b}] error trying to get result from model: GEMINI_ERROR_STATUS_MODEL_OVERLOADED ${503}. we are already using the final backup model in our modelsToTry, so SOL here. will try again... error (${v}): ${y(E)} (E: 9bb63cb520b8bd3bb85d2ca20715c825)`);else{h++;let T=m[h];console.error(`${t}[fnGoModel][${b}] error trying to get result from model: GEMINI_ERROR_STATUS_MODEL_OVERLOADED ${503}. will try using the next model (${T}) for this next call. error (${v}): ${y(E)} (E: b07a041bb97ea95b03cd6f9856f01525)`)}else if(I.includes(`${429}`))if(h===m.length-1)console.error(`${t}[fnGoModel][${b}] error trying to get result from model: GEMINI_ERROR_STATUS_RATE_QUOTA_EXCEEDED ${429}. we are already using the final backup model, so SOL here. will try again... error (${v}): ${y(E)} (E: d280c441aa37579bb2cfd29038202525)`);else{h++;let T=m[h];console.error(`${t}[fnGoModel][${b}] error trying to get result from model: GEMINI_ERROR_STATUS_RATE_QUOTA_EXCEEDED ${429}. will try using the next model (${T}) for this next call. error (${v}): ${y(E)} (E: a9869883fc72bf156f1691183e27ee25)`)}else console.error(`${t}[fnGoModel][${b}] error trying to get result from model. error (${v}): ${y(E)} (E: a67d595c8ed313d458369d4d0b3e7f25)`)}else console.error(`${t}[fnGoModel][${b}] (UNEXPECTED) error is not instanceof Error? The expected error from the @google/genai lib is supposed to be an instance of Error according to Gemini migration AI. (E: 15df95701e78b35f783d250801092825)`)}p>1&&await K(g*1e3)}while(!u&&p<so);return u}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{k&&console.log(`${t} complete.`)}}async getFunctionInfoIbGibs({fcrCommentIbGib:e}){let t=`[${this.getFunctionInfoIbGibs.name}]`;try{k&&console.log(`${t} starting... (I: 976a684b7ae58cda523b17fc0c62e325)`);let o=[];if(!e)throw new Error(`${t} fcrCommentIbGib is falsy. (E: a01c80f415ab8737a81b7b2a2f479f25)`);if(!e.data)throw new Error(`${t} fcrCommentIbGib.data is falsy. (E: a03bc3662a8d6f69c1c077605727a025)`);let i=this._metaspace;if(!i)throw new Error("(UNEXPECTED) this.metaspace falsy. (E: 997d071847c5d7e80692f48191244e25)");let s=await this.getSuperSpace();if(!s)throw new Error("(UNEXPECTED) superSpace falsy? (E: dd1600f15e1e659c01f73991656a3325)");let l=e.rel8ns?.[Nn]??[];if(l.length===0)return k&&console.warn(`${t} no functionInfoAddrs (I: 5f8965e92c305689c11677a1148b7425)`),[];k&&console.log(`${t} functionInfoAddrs: ${l} (I: e7b1f5a4576c493326b913e48a505e25)`);let c=await i.get({addrs:l,space:s});if(!c.success||!c.ibGibs||c.ibGibs.length!==l.length)throw new Error(`${t} could not retrieve function info ibgibs. errorMsg: ${c.errorMsg??"unknown error (E: 164246a6661d49f2b21d1b6769139625)"} (E: 0736d824876e420f91c089925191d425)`);return o=c.ibGibs,k&&console.log(`${t} resFunctionInfoIbGibs: ${D(o.map(d=>x({ibGib:d})))} (I: a5661b5c449608f0e8d773135a599a25)`),o}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{k&&console.log(`${t} complete.`)}}async loadIbGibDto(e){let t=`[${this.loadIbGibDto.name}]`;try{if(k&&console.log(`${t} starting... (I: cb0b1e9e22fce321ca9a26e7a5d4c825)`),await super.loadIbGibDto(e),!this.data)throw new Error("(UNEXPECTED) this.data falsy after load dto? (E: 77aecd066b0bbbd0c66e2658519bdb25)");let o=this._metaspace;if(!o)throw new Error("(UNEXPECTED) metaspace falsy? (E: e5762b1e3f77f84ca338641edc011225)");let i=await this.getSuperSpace(),s=f(async()=>{this.availableFunctions=new Map;for(let d of this.data.availableFunctionNameOrIds){if(!d)throw new Error("(UNEXPECTED) nameOrId falsy, driven by this.data.availableFunctionNameOrIds? somehow a falsy nameOrId saved? (E: 7b63f177624de2415e1569e96ef8d125)");let u=Ke().get(d);u?this.availableFunctions.set(d,u):gi().includes(d)?k&&console.log(`${t} function nameOrId (${d}) found as deprecated. not adding to available functions on agent. (I: 983864ad5cd8af915fb135580e455425)`):console.error(`no function info in getAllFunctionInfos() found corresponding to nameOrId (${d}) and this was not found in getDeprecatedFunctionInfoNames(). this is logged here but we're not throwing. (E: db0da9880cf1e414c3f1078d3e9f0b25)`)}let l=this.rel8ns?.system??[];if(l.length>0){let d=await o.get({addrs:l,space:i});if(!d.success||d.errorMsg)throw new Error(`couldn't get system comments. error: ${y(d.errorMsg??"unknown error (E: c0b4d7aab724bcf58e88ffd496de8825)")} (E: 7925d4b5ec3a8f7a648c109941c38a25)`);if((d.ibGibs??[]).length!==l.length)throw new Error("(UNEXPECTED) (resGet_systemComments.ibGibs ?? []).length !== rel8dAddrs_system.length, but resGet.success truthy and resGet.errorMsg falsy? (E: 2055553b602e6c2fe49e956a1e423f25)");this.commentIbGibs_system=d.ibGibs}let c=this.rel8ns?.chat??[];if(c.length>0){let d=await o.get({addrs:c,space:i});if(!d.success||d.errorMsg)throw new Error(`couldn't get chat comments. error: ${y(d.errorMsg??"unknown error (E: c0b4d7aab724bcf58e88ffd496de8825)")} (E: 7925d4b5ec3a8f7a648c109941c38a25)`);if((d.ibGibs??[]).length!==c.length)throw new Error("(UNEXPECTED) (resGet_chatComments.ibGibs ?? []).length !== rel8dAddrs_chat.length, but resGet.success truthy and resGet.errorMsg falsy? (E: 2055553b602e6c2fe49e956a1e423f25)");this.commentIbGibs_chat=d.ibGibs}},"fn");await Dt({scope:"prune",secondsValid:60,maxDelayMs:100,maxLockAttempts:1800,space:i,callerInstanceId:ke(),fn:s})}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{k&&console.log(`${t} complete.`)}}};setTimeout(()=>{Ie().registerFactory({classname:Me.name,fnDtoToAgentWitness:f(async e=>e.data?e.data.classname?e.data.classname===Me.name?{applies:!0,agent:await vi({agentIbGib:e})}:{applies:!1}:{applies:!1}:{applies:!1},"fnDtoToAgentWitness")})});function Qa({currentContextTjpAddr:n}){let e=`[${Qa.name}]`;try{k&&console.log(`${e} starting... (I: 7edafbba277d57eae51af325cf7eb225)`);let t=ye({ibGibAddr:n});return`Your current context ibGibAddr is ${n}
|
|
1186
|
-
It is very important that you use THIS context address. THIS context address takes precedence over previous contexts in your system chat history, because those chats may be from previous sessions per the user's POV. If there are any doubts, like if you're saying something and the user is not responding, then this may be the reason. You should call the function to get your context to be sure you are talking in the right one.`}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{k&&console.log(`${e} complete.`)}}f(Qa,"getTextPartForCurrentContextTjpAddr");var Ge=V,Ln=class n{static{f(this,"CreateConcreteAgentWitnessFactory_Gemini")}lc=`[${n.name}]`;arg;constructor(e){this.arg=e}async createInitialData(e){let t=`${this.lc}[${this.createInitialData.name}]`;try{Ge&&console.log(`${t} starting... (I: f4c8ac488804666077cfc2237972d625)`);let{name:o,api:i,model:s,type:l,availableFunctions:c}=this.arg;if(!s)throw new Error("(UNEXPECTED) model falsy? (E: ee7286c772a37fa86236c85f96233625)");if(!e.data)throw new Error("(UNEXPECTED) superSpace.data falsy? (E: 858d5950b9ef7a0175482a51caaf9c25)");if(!e.data.uuid)throw new Error("(UNEXPECTED) superSpace.data.uuid falsy? (E: 08867535db1b254d73c050bd5086e525)");let d=Y(Hr);return o&&(d.name=o),d.uuid=await $i(),d.superSpaceId=e.data.uuid,d.api=i,d.model=s,d.type=l,d.availableFunctionNameOrIds=c.map(u=>u.nameOrId),d.classname=Me.name,d}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{Ge&&console.log(`${t} complete.`)}}async createInitialRel8ns(){let e=`${this.lc}[${this.createInitialRel8ns.name}]`;try{return Ge&&console.log(`${e} starting... (I: 2d4933ea3761bd7df701d8d306fb2825)`),ao?Y(ao):void 0}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{Ge&&console.log(`${e} complete.`)}}async createWitness(){let e=`[${this.createWitness.name}]`;try{Ge&&console.log(`${e} starting... (I: 36709dfa0c398d63d64c4f6ba9055625)`);let{api:t,model:o}=this.arg;if(t==="gemini"){let i=new Me;return await i.initialized,i}else throw new Error(`(UNEXPECTED) unknown api: ${t}? only 'gemini' currently implemented (E: 2d1cb22ce787c6c42d4532c260320125)`)}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{Ge&&console.log(`${e} complete.`)}}};async function vi({agentIbGib:n}){let e=`[${vi.name}]`;try{Ge&&console.log(`${e} starting... (I: 5a4efefba9e4bdfb942afbe7919fff25)`);let t=new Me;return await t.initialized,await t.loadIbGibDto(n),t.fnGetAPIKey=async()=>await ir({dbName:nr(),storeName:await tr(),key:await or()})??"",t}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{Ge&&console.log(`${e} complete.`)}}f(vi,"agentIbGibDtoToWitness");var J=V;async function no({metaspace:n,space:e,createIfNone:t}){let o=`[${no.name}]`;try{if(J&&console.log(`${o} starting... (I: ad1594767abce66ca80fea8c8d89f325)`),e??=await n.getLocalUserSpace({lock:!1}),!e)throw new Error("(UNEXPECTED) space falsy after getting local user space? (E: bc68d97d46dcf1d15dd74edba200b725)");let i=await Zi({metaspace:n,space:e});if(!i.rel8ns)throw new Error("(UNEXPECTED) tagsIbGib.rel8ns falsy? (E: dc50e8d218fe5e30bbaec7f37d484525)");let l=(i.rel8ns[Ui]??[]).filter(u=>{let{ib:p}=de({ibGibAddr:u});return p===Wi}),c,d;if(l.length===0){if(t){J&&console.log(`${o} creating new agents tag... (I: 47f4f4fa89f1a1bba960e0a6ff5f5225)`);let{newTagIbGib:u}=await n.createTagIbGib({text:Oi,icon:zi,description:Ji,space:e});return d=u,J&&console.log(`${o} creating new agents tag complete. (I: 5f41d644f2b692348377f918057cf225)`),u}}else l.length===1?(c=l.at(0),J&&console.log(`${o} exactly one agent tag addr found (${c}) in space (${e.ib}) (I: 7ef995963313c966216097760d0cdb25)`)):(c=l.at(0),console.error(`${o} more than one agent tag found in space (${e.ib})? Well, we're returning just the first one (${c}), but really we've not coded for this edge/future case. (E: 52a4e2e49d3c0d644df483119b46f125)`));if(c){let u=await n.get({addrs:[c],space:e});if(u.success&&u.ibGibs?.length===1)return d=u.ibGibs.at(0),d;throw new Error(`couldn't get agentTagAddr (${c}) in space (${e.ib}) (E: 53d9cdb7b769014a2de15871484cc325)`)}else throw new Error(`agentTagAddr not found, so there ain't no agents tag, and createIfNone was ${t}. (E: 54cb3164a118105f187e936613ff4625)`)}catch(i){throw console.error(`${o} ${y(i)}`),i}finally{J&&console.log(`${o} complete.`)}}f(no,"getTag_Agents");async function Ht({metaspace:n,type:e,spaceId:t,space:o}){let i=`[${Ht.name}]`;try{if(J&&console.log(`${i} starting... (I: 41037d1926051c4b051769069f518f25)`),o??=await n.getLocalUserSpace({localSpaceId:t,lock:!1}),!o)throw new Error(`couldn't get local user space by id (${t}) (E: fe96076e79fb227c0ae2de077eb5e225)`);if(!await n.getSpecialIbGib({type:e,initialize:!0,dontWarnIfNotExist:!0,lock:!1,space:o}))throw new Error("(UNEXPECTED) couldn't initialize/get agents special ibgib? (E: 1abe0e2543711744adbdb7026b242e25)");let l=await n.getSpecialRel8dIbGibs({rel8nName:Oe,type:e,space:o})??[],c=[];for(let d of l){if(d.data?.api!=="gemini")throw new Error("(UNEXPECTED) agentIbGib.data.api !== gemini? only gemini is implemented right now. (E: 7348fe8c68565bcf88a4052458f42d25)");let u=Ie(),p=await u.getLatestAgent({id:d.data.uuid});if(!p){if(p=await u.getAgentWitnessFromDto({dto:d}),!p){debugger;throw new Error(`(UNEXPECTED) couldn't get actual agent witness from agent dto? have we registered classname (${d.data?.classname}) and factory fn with agents service? (E: bcbfdf6446793ac34d6f6118e050d325)`)}await u.updateOrSetLatestAgent({agent:p,throwIfNewerFound:!1})}c.push(p)}return c}catch(s){throw console.error(`${i} ${y(s)}`),s}finally{J&&console.log(`${i} complete.`)}}f(Ht,"getAgents");async function Ii({metaspace:n,type:e,space:t,newAgentIbGib:o}){await f(async()=>{let s=`[${Ii.name}]`;try{if(J&&console.log(`${s} starting... (I: bf6ff6bf4132eaa943eaa3af1ee17225)`),!o.data)throw new Error("(UNEXPECTED) newAgentIbGib.data falsy? (E: 26e03d0a8e286ac3a13b678a50c87a25)");if(!o.data.uuid)throw new Error("(UNEXPECTED) newAgentIbGib.data.uuid falsy? (E: 31b753e01275272484ea93e3dfe53225)");let c=await Ie().getLatestAgent({id:o.data.uuid});if(c&&c.data.n>o.data.n){debugger;throw new Error(`latestInMemory.data!.n! > newAgentIbGib.data.n! ... in plain english, this means that there is a more recent (higher n) agent with the given agent's id (${o.data.uuid}) already in existence, but the caller is trying to update the special ibgib index with the older agent. (E: 5c0c028075736f22072c55e20a0c7e25)`)}let d=x({ibGib:o});await je({type:o.data.type,rel8nInfos:[{rel8nName:Oe,ibGibs:[re({ibGib:o})]}],metaspace:n,space:t})}catch(l){throw console.error(`${s} ${y(l)}`),l}finally{J&&console.log(`${s} complete.`)}},"fn")()}f(Ii,"updateAgentIndex");async function Ti({ibGib:n,metaspace:e,space:t}){let o=`[${Ti.name}]`;try{if(J&&console.log(`${o} starting...`),!n)throw new Error("ibGib required (E: 753a0aa13e4e5ea20d7f6bb92d963625)");let i=await Lt({ibGib:n,metaspace:e,space:t,scope:"agent",skipGetLatest:!1});if(!i){console.warn(`${o} couldn't find agent for domain ibGib (${n.ib}) (W: 9536a8e67fe83ddc819c476f5a50c825)`);return}let s=le({ibGib:n,defaultIfNone:"incomingAddr"}),l=x({ibGib:i}),d=await Ie().getAgentByAddr({agentAddr:l,metaspace:e,spaceId:t.data.uuid});return J&&console.log(d?`${o} complete. Found agent ${x({ibGib:d})} for domain ${s}`:`${o} complete. No agent found for ibgib tjp ${s}`),d}catch(i){throw console.error(`${o} ${y(i)}`),i}}f(Ti,"getAgentForDomainIbGib");function oo(n){let e=`[${oo.name}]`;try{J&&console.log(`${e} starting... (I: 2a9899514ac6e478eb55819a57fd9725)`);let{api:t}=n;switch(t){case"gemini":return new Ln(n);default:throw new Error(`(UNEXPECTED) api: ${t}? only 'gemini' currently implemented? (E: 071fedab181fda80666858c14ea73625)`)}}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{J&&console.log(`${e} complete.`)}}f(oo,"getConcreteAgentFactory");function ot({tagText:n,contentText:e,randomIdLength:t}){let o=`[${ot.name}]`;try{J&&console.log(`${o} starting... (I: 94104ec059c89d4ba458d96580791d25)`);let i=t?`${n}|${Ye({count:t})}`:n;return[`[${i} begin]`,e,`[${i} end]`].join(`
|
|
1187
|
-
`)}catch(i){throw console.error(`${o} ${y(i)}`),i}finally{J&&console.log(`${o} complete.`)}}f(ot,"taggifyForPrompt");function mt({textSrc:n,other:e}){let t=`[${mt.name}]`;return e?[n,ke(),e].join("_"):[n,ke()].join("_")}f(mt,"getAddlMetadataTextForAgentText");function Pt({addlMetadataText:n,ifError:e="warn"}){let t=`[${mt.name}]`;try{J&&console.log(`${t} starting... (I: 89b8b19a8d785b945fe0f816df762d25)`);let[o,i,...s]=n.split("_");if(!o)throw new Error("addlMetadataText.textSrc falsy (E: 40bbec4269c1688ab1390fa5d5440325)");if(!Lr(o))throw new Error(`addlMetadataText.textSrc (${o}) is unexpected value. Expected one of ${Zn} (E: 02bae41275a39210e5737548747bd825)`);if(!i)throw new Error("addlMetadataText.timestampInTicks falsy (E: 03cbbc7515a1cff1fc7c12e3947c6825)");let l=Number.parseInt(i);if(Number.isNaN(l))throw new Error(`invalid timestampInTicks (${i}): value should be an integer but parse is NaN (E: 9d31e3563d972c02553ce18a19a19b25)`);return{textSrc:o,timestampInTicks:l,other:s.length>0?s:void 0}}catch(o){let i=`${t} ${y(o)}`;switch(e){case"ignore":return{textSrc:O.UNKNOWN,timestampInTicks:0,errorMsg:y(o)};case"warn":return console.warn(`${t} ${i} (W: 3e1f4a98ad6461c9bd96462841c31b25)`),{textSrc:O.UNKNOWN,timestampInTicks:0,errorMsg:y(o)};default:throw console.error(`${t} ${i} (E: 6396ed44947c52adf85788e1adc22825)`),new Error(i)}}finally{J&&console.log(`${t} complete.`)}}f(Pt,"parseAddlMetadataTextForAgentText");function io({data:n}){let e=`[${io.name}]`,{name:t,uuid:o,type:i}=n;if(!t)throw new Error(`${e} data.name falsy (E: 4c172c5b8a110ae26479b8c4006f3225)`);if(!o)throw new Error(`${e} data.uuid falsy (E: 67d2c79ac39e70e5ecfd1745e1fd3525)`);if(!i)throw new Error(`${e} data.type falsy (E: 53bf1f9a145a16be81296437682a7a25)`);if([t,o,i].some(l=>l.includes(" ")))throw new Error("invalid data. ib must not contain spaces in name, uuid, type. (E: 36a56e4685163848458be06f51d4ad25)");return[tt,t,o,i].join(" ")}f(io,"getAgentIb");function Fr({ib:n}){let[e,t,o,i]=n.split(" ");if(e!==tt)throw new Error(`invalid ib. first term expected to e an atom: ${tt} (E: 3c01d42035d2e32c4bfd5c1bf363f725)`);if(!t)throw new Error("invalid ib. name falsy in agent ib (E: 8b494c544f05b8ef9c866078b761a725)");if(!o)throw new Error("invalid ib. uuid falsy in agent ib (E: aba195db3ddcb000324ebed15351b725)");if(!i)throw new Error("invalid ib. type falsy in agent ib (E: 8c814772394ae76342f95e885570c325)");return{atom:e,name:t,uuid:o,type:i}}f(Fr,"parseAgentIb");async function Dn({ibGib:n}){let e=`[${Dn.name}]`;try{J&&console.log(`${e} starting... (I: f9a733a5a05b7f7494836d86a79e2d25)`);let t=await Qe({ibGib:n})??[];if(!Be({ibGib:n}))return t.push(`${e} not a comment ibgib (E: 08676d94c698c6e42e6c35e94a58f125)`),t;let{safeIbCommentMetadataText:o}=He({ib:n.ib});if(o){let i=Pt({addlMetadataText:o,ifError:"warn"});i.errorMsg&&t.push(`${e} could not parse addlMetadataText: ${i.errorMsg} (E: e178265c33e5e94947a02c1f9d6a7425)`)}else t.push(`${e} addlMetadataText falsy. this implies something is incorrect with the comment's ib, as we expect agent comments to have certain metadata (e.g. textSrc). See AgentWitness_V1 (and data interface) for more info. (E: 7c3c41c973a67256c432604666106b25)`);return t}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{J&&console.log(`${e} complete.`)}}f(Dn,"validateAgentWitnessCommentIbGib");var kn="settings",uh="general",fh="text-editor",ph="projects",mh="projects-explorer",hh="projects-dropdown",gh="project",bh="minigame",yh="chronologys",te={general:uh,textEditor:fh,projects:ph,projectsExplorer:mh,projectsDropdown:hh,project:gh,minigame:bh,chronologys:yh},Eh=Object.values(te);var wi={type:te.general,editor:void 0,readonly:!0,viewer:"ibgib-raw-viewer"},_i={type:te.textEditor,wrap:"wrap"},Ih={type:te.project,openChildTjpAddrs:[],activeChildTjpAddr:void 0,lensMode:"raw"},vh={type:te.minigame},Th={type:te.chronologys,openChildTjpAddrs:[],activeChildTjpAddr:void 0},Za={sections:{},children:{}};var De=V;async function Ci({ibGib:n}){let e=`[${Ci.name}]`;try{De&&console.log(`${e} starting... (I: 57ac4c0a3448bc5e98ecf5bfb02ce825)`);let{ib:t}=de({ibGib:n}),o=t.split(" ").at(0);if(!o)throw new Error("(UNEXPECTED) atom falsy? we split the ib by spaces (space-delimiter). this makes no sense. (E: 6a9ea640ae38823aeefc6ec82a05d625)");return`${kn}_${o}`}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{De&&console.log(`${e} complete.`)}}f(Ci,"getSettingsScope");async function xe({settingsType:n,useCase:e}){let t=`[${xe.name}]`;try{if(De&&console.log(`${t} starting... (I: f13dff111048421cad5453f821487825)`),e.includes("_"))throw new Error("(UNEXPECTED) settingsType.includes('_')? should be kebab-cased or camelCased (E: 8f75e89b9378819ab882cc1870f1e825)");if(n.includes("_"))throw new Error("(UNEXPECTED) settingsType.includes('_')? should be kebab-cased or camelCased (E: 1d316b0808287c12689d1e882648b825)");return[n,e].join("_")}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{De&&console.log(`${t} complete.`)}}f(xe,"getSectionName");async function Un({sectionName:n,settingsIbGib:e}){let t=`[${Un.name}]`;try{if(De&&console.log(`${t} starting... (I: 266554b13f6ce6daa85c882f04805825)`),!e.data)throw new Error("(UNEXPECTED) settingsIbGib.data falsy? (E: dd3708f0515fb0b4d4024f4d336a3625)");if(!e.data.sections)throw new Error("(UNEXPECTED) settingsIbGib.data.sections falsy? what was the settingsIbGib even created for? (E: 31f85898a1c854e13440e278a79ceb25)");return(e.data.sections??{})[n]}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{De&&console.log(`${t} complete.`)}}f(Un,"getSettingsSection");function ja({scope:n}){let e=`[${ja.name}]`;try{return n.includes(" ")&&(console.warn(`${e} scope includes one or more spaces. These will be converted to double underscores. (W: 75a53c623d3110b5e874e5789b414325)`),n=n.replace(/ /g,"__")),`${kn} ${n}`}catch(t){throw console.error(`${e} ${y(t)}`),t}}f(ja,"getSettingsIb");async function Si({scope:n,metaspace:e,space:t,saveInSpace:o}){let i=`[${Si.name}]`;try{let s=ja({scope:n}),l=await el(),d=await Q.firstGen({parentIbGib:Q.primitive({ib:kn}),ib:s,data:l,rel8ns:void 0,dna:!0,nCounter:!0,tjp:{timestamp:!0,uuid:!0}});if(o){if(!e)throw new Error("metaspace falsy but saveInSpace is true (E: f91adfe38d78e6e4f8bca278fce37925)");await e.persistTransformResult({resTransform:d,space:t}),await e.registerNewIbGib({ibGib:d.newIbGib,space:t})}return d}catch(s){throw console.error(`${i} ${y(s)}`),s}}f(Si,"createSettings");async function el(){let n=`[${el.name}]`;try{De&&console.log(`${n} starting... (I: 3d7cc3f242cc88ad28dafaf85d646a25)`);let e=Y(Za),t=await xe({settingsType:"general",useCase:"default"}),o=await xe({settingsType:"general",useCase:"current"});e.sections[t]=Y(wi),e.sections[o]=Y(wi);let i=await xe({settingsType:"text-editor",useCase:"default"}),s=await xe({settingsType:"text-editor",useCase:"current"});return e.sections[i]=Y(_i),e.sections[s]=Y(_i),e}catch(e){throw console.error(`${n} ${y(e)}`),e}finally{De&&console.log(`${n} complete.`)}}f(el,"getDefaultSettingsData");var M=V,Le=class n{static{f(this,"IbGibDynamicComponentMetaBase")}lc=`[${n.name}]`;componentName="";routeRegExp=void 0;fnHandleRoute=void 0;fnGetMetaspace;bootstrapPromise;constructor({fnGetMetaspace:e,bootstrapPromise:t}){this.fnGetMetaspace=e,this.bootstrapPromise=t}},Xe=class n extends HTMLElement{static{f(this,"IbGibDynamicComponentInstanceBase")}lc=`[${n.name}]`;elements;createdPromise;settings;get agent(){return this.agents.at(0)}agents=[];get ib(){let{ib:e}=de({ibGibAddr:this.ibGibAddr??q});return e}get gib(){let{gib:e}=de({ibGibAddr:this.ibGibAddr??q});return e}ibGibAddr=q;ibGibProxy;get ibGib(){let e=this.ibGibAddr??q,{ib:t,gib:o}=de({ibGibAddr:e});return this.ibGibAddr&&!bt({gib:o})?this.ibGibProxy?.ibGib:Q.primitive({ib:t})}get tjpAddr(){return this.ibGib?le({ibGib:this.ibGib,defaultIfNone:"incomingAddr"}):void 0}meta;html;css;static get observedAttributes(){return["ibGibAddr"]}_instanceId;get instanceId(){return this._instanceId}agentsInitialized;connectedCount=0;_isBusy=!1;get isBusy(){return this._isBusy}showBusy({isBusy:e,title:t,msg:o,localOnly:i,animationEmoji:s}){let l=`${this.lc}[${this.showBusy.name}]`;try{this._isBusy=e,i?this.dispatchEvent(new CustomEvent(yt,{detail:{isBusy:e,title:t,msg:o,animationEmoji:s},bubbles:!0,composed:!0})):window.dispatchEvent(new CustomEvent(yt,{detail:{isBusy:e,title:t,msg:o,animationEmoji:s}}))}catch(c){throw console.error(`${l} ${y(c)}`),c}}async getMetaspace(){let e=`${this.lc}[${this.getMetaspace.name}]`;try{if(M&&console.log(`${e} starting... (I: 956418cf932823bc767ccc6a0fd2b325)`),!this.meta)throw new Error("(UNEXPECTED) this.meta falsy? (E: dd2bfae6c0e84b1d58c72e2922b51325)");return await this.meta.fnGetMetaspace()}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{M&&console.log(`${e} complete.`)}}constructor(){super(),this._instanceId=Ye({count:8})}async initialize(e){let{ibGibAddr:t,meta:o,html:i,css:s}=e,l=`${this.lc}[${this.initialize.name}]`;try{M&&console.log(`${l} starting... (I: c9b94131bc2f0d20e1397c214dad6725)`),this.ibGibAddr=t,this.meta=o,this.html=i,this.css=s,this.attachShadow({mode:"open"}),await this.meta.bootstrapPromise}catch(c){throw console.error(`${l} ${y(c)}`),c}finally{M&&console.log(`${l} complete.`)}}async initAgents(){let e=`${this.lc}[${this.initAgents.name}]`;M&&console.log(`${e} does nothing in base class (I: 0b31a650b942619a0e36a1a7f763e825)`)}async connectedCallback(){let e=`${this.lc}[${this.connectedCallback.name}]`;try{M&&console.log(`${e} starting... (I: 01bbbf69f1c75b03a29e7a85ebd2c725)`),this.connectedCount++,this.connectedCount===1?await this.connectedCallback_initComponent():await this.connectedCallback_reconnectComponent()}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{M&&console.log(`${e} complete.`)}}async connectedCallback_initComponent(){let e=`${this.lc}[${this.connectedCallback_initComponent.name}]`;try{if(M&&console.log(`${e} starting... (I: bc4af3f6751d841f51bad19e334efa25)`),!this.html)throw new Error("(UNEXPECTED) this.html is falsy? (E: a0a0ab7c8f987d78058dd7cad09a5125)");let t=document.createElement("template");if(t.innerHTML=this.css?`
|
|
1188
|
-
<style>
|
|
1189
|
-
${this.css.join(`
|
|
1190
|
-
`)}
|
|
1191
|
-
</style>
|
|
1192
|
-
${this.html}
|
|
1193
|
-
`:this.html,!this.shadowRoot)throw new Error("(UNEXPECTED) this.shadowRoot is falsy? (E: 1a3cf77d87767aaff37d31657ee73f25)");this.shadowRoot.appendChild(t.content),this.createdPromise=this.created(),await this.createdPromise}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{M&&console.log(`${e} complete.`)}}async connectedCallback_reconnectComponent(){let e=`${this.lc}[${this.connectedCallback_reconnectComponent.name}]`;try{M&&console.log(`${e} starting... (I: 7fccefbeff68c0dda15642ebaa1eb525)`),console.log(`${e} does nothing in base class (I: 724bc670d4ccb0fde2b2fa49830cd425)`)}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{M&&console.log(`${e} complete.`)}}async disconnectedCallback(){let e=`${this.lc}[${this.disconnectedCallback.name}]`;try{M&&console.log(`${e} starting... (I: 6f3b25c23fb874b1ac513e8f0d1f4e25)`),await this.disconnected()}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{M&&console.log(`${e} complete.`)}}async attributeChangedCallback(e,t,o){let i=`${this.lc}[attributeChangedCallback]`;M&&console.log(`${i} starting... (I: 33cd68579171582166d25d8898640f25): ${e} ${t} => ${o}`),console.warn(`${i} nothing done in base class atow (W: 9eb93eb8fde7c0058c79cea841936a25)`)}async destroy(){let e=`${this.lc}[${this.destroy.name}]`;try{M&&console.log(`${e} starting... (I: 536989c9491b544105b6d01a688fbb25)`),await this.destroyed()}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{M&&console.log(`${e} complete.`)}}async destroyed(){let e=`${this.lc}[${this.destroyed.name}]`;try{M&&console.log(`${e} starting... (I: f34f3ca04b06b1e00ebe04df22331125)`)}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{M&&console.log(`${e} complete.`)}return M&&console.log(`${e} does nothing in the base class. (I: d9437f962e0aec40d69ad6159e7b5725)`),Promise.resolve()}async loadIbGib(e){let t=`${this.lc}[${this.loadIbGib.name}]`;try{M&&console.log(`${t} starting... (I: 4dcb1b7a3d86f3415ca7224c07126925)`);let o=e?.getLatest??!1;if(this.ibGib){console.warn(`${t} this.ibGib already loaded. idempotently returning early without doing anything. (W: 15498d346a32e884acec108cb3c8ee25)`);return}if(bt({gib:de({ibGibAddr:this.ibGibAddr??q}).gib})){M&&console.log(`${t} component loading primitive ibgib (I: 3349796ef6139c1e718c8626c7935625)`);return}let i=await this.getMetaspace(),s=await i.getLocalUserSpace({lock:!1});if(!s)throw new Error("(UNEXPECTED) local user space falsy? (E: bb093b7e9781064e8db9a4390b63bb25)");if(o){let m=await i.getLatestAddr({addr:this.ibGibAddr,space:s});m&&m!==this.ibGibAddr&&(this.ibGibAddr=m)}let l=await i.get({addrs:[this.ibGibAddr],space:s});if(!l.success||l.ibGibs?.length!==1)throw new Error(`couldn't get ibGib (${this.ibGibAddr}) in space (${s?.ib??"undefined"}) (E: 59c3461bebf3e0065df72bd1bd8dc125)`);let c=l.ibGibs.at(0),d=new Ne;if(await d.initialized,!d.contextUpdated$)throw new Error("(UNEXPECTED) ibGibProxy.contextUpdated$ falsy? (E: 351dfc898d2c3da2d7928079cec14925)");if(d.contextUpdated$.subscribe(we({next:f(async m=>{let h=`${t}[ibGibProxy.contextUpdated$][next]`;M&&console.log(`${h} nextIbGib: ${D(m)} (I: 96c846357b94fda2cefa615aed88c325)`),await this.handleContextUpdated()},"next"),error:f(async m=>{debugger;console.error(`${t}[ibGibProxy.contextUpdated$][error] what up? ${y(m)}`)},"error")})),!d.newContextChild$)throw new Error("(UNEXPECTED) ibGibProxy.newContextChild$ falsy? (E: 2cbde5ab402cc6d81259c74d68bca725)");d.newContextChild$.subscribe(we({next:f(async m=>{let h=`${t}[ibGibProxy.contextUpdated$][next]`;M&&console.log(`${h} childIbGib: ${D(m)} (I: 96c846357b94fda2cefa615aed88c325)`),await this.handleNewContextChild({childIbGib:m})},"next"),error:f(async m=>{debugger;console.error(`${t}[ibGibProxy.contextUpdated$][error] what up? ${y(m)}`)},"error")}));let u=await d.witness(s),p=await d.witness(c);this.ibGibProxy=d,this.ibGibAddr=x({ibGib:d.ibGib})}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{M&&console.log(`${t} complete.`)}}async handleContextUpdated(){let e=`${this.lc}[${this.handleContextUpdated.name}]`;try{let{ibGib:t}=this;this.ibGibAddr=t?x({ibGib:t}):q,M&&console.log(`${e} context updated. this.ibGibAddr (I: 64e5876f58cc54b5af777c94f13a4325)`)}catch(t){throw console.error(`${e} ${y(t)}`),t}}async handleNewContextChild({childIbGib:e}){let t=`${this.lc}[${this.handleNewContextChild.name}]`;try{M&&console.log(`${t} child added to contextcontext updated. childIbGib: ${D(e)} (I: 07d02c9182c6629cbbacd39fd0ff7f25)`),console.log(x({ibGib:e}))}catch(o){throw console.error(`${t} ${y(o)}`),o}}async renderUI(){let e=`${this.lc}[${this.renderUI.name}]`;try{if(M&&console.log(`${e} starting... (I: 7e5704afe17fb937c8473e7801f56e25)`),this.ibGib){let{punctiliarColor:t,punctiliarColorTranslucent:o,punctiliarColorContrast:i,tjpColor:s,tjpColorTranslucent:l,tjpColorContrast:c,errorMsg:d}=kt({ibGib:this.ibGib,translucentAlpha:10});d?console.error(`${e} ${d} (E: 65e0d330d029c1fe39f3d6280dda3725)`):(this.style.setProperty("--ibgib-color",t),this.style.setProperty("--ibgib-color-translucent",o),this.style.setProperty("--ibgib-color-contrast",i),this.style.setProperty("--tjp-color",s??t),this.style.setProperty("--tjp-color-translucent",l??o),this.style.setProperty("--tjp-color-contrast",c??"lime"))}await this.renderUI_busy()}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{M&&console.log(`${e} complete.`)}}async renderUI_busy(){}async loadAgentsCoupledToIbGib({dontThrowIfNone:e}={}){let t=`${this.lc}[${this.loadAgentsCoupledToIbGib.name}]`;try{let o=await this.getMetaspace(),i=await o.getLocalUserSpace({lock:!1});if(!i)throw new Error("(UNEXPECTED) space falsy? we couldn't get the default local user space? (E: 06f5be2eec8abaa54d42ad982a155925)");if(!this.ibGib)throw new Error("(UNEXPECTED) this.ibGib falsy? (E: 9b24c4b4aa491a21b58fde9185eb9325)");let s=await Ti({ibGib:this.ibGib,metaspace:o,space:i});if(s){let l=s.data.n;await s.setActiveContext({contextIbGib:this.ibGib,loggingInfo:this.lc}),await K(32);let c=s.data.n;l!==c&&console.warn(`${t} setting active context for agent changed agent.data.n.
|
|
1194
|
-
agent.data: ${D(re({ibGib:s}))}
|
|
1195
|
-
ibGib.data: ${re({ibGib:this.ibGib})} (W: cb22e8b064d8c2d7b3b2c488ed169225)`),this.agents=[s]}else if(e)console.warn(`(UNEXPECTED) agent falsy? an agent should have been created and registered with the ibGib (${x({ibGib:this.ibGib})}) (W: e4219903462baab438a23c786d714825)`);else throw new Error(`(UNEXPECTED) agent falsy? an agent should have been created and registered with the ibGib (${x({ibGib:this.ibGib})}) (E: 7182d1aa070b9578c78a5b8b401d8425)`)}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{M&&console.log(`${t} complete.`)}}async getSettings({settingsType:e,useCase:t}){let o=`${this.lc}[${this.getSettings.name}]`;try{if(M&&console.log(`${o} starting... (I: 00c8dbedd2e8a8b988cc45f4186efd25)`),!this.settings)throw new Error("(UNEXPECTED) this.settings falsy? shouldn't this be initialized by now? (E: ceae480e28fab1da38b8def8b1060d25 (E: dc7d984c1c64293a3c3e0628dedadb25)");if(!this.settings.ibGib)throw new Error("(UNEXPECTED) this.settings.ibGib falsy? shouldn't this be initialized by now? especially since this.settings is truthy? (E: faef6878abaf00a4a6a6f6b85ce8c825)");let i=await Un({sectionName:await xe({settingsType:e,useCase:t}),settingsIbGib:this.settings.ibGib});return i||M&&console.log(`${o} settingsSection does not exist. returning undefined. (I: 0462d83f5ae8049708274b88e9b0d825)`),i}catch(i){throw console.error(`${o} ${y(i)}`),i}finally{M&&console.log(`${o} complete.`)}}async updateSettings({settingsType:e,useCase:t,newSectionInfo:o}){let i=`${this.lc}[${this.updateSettings.name}]`;try{M&&console.log(`${i} starting... (I: 80ce98cf386e0c04d30e8b15ac0f2925)`);let s=await xe({settingsType:e,useCase:t}),l=await fr({timeline:this.settings.ibGib,metaspace:await this.getMetaspace(),mut8Opts:{dataToAddOrPatch:{sections:{[s]:o}}}});await K(100)}catch(s){throw console.error(`${i} ${y(s)}`),s}finally{M&&console.log(`${i} complete.`)}}async getCurrentSettings({settingsType:e}){let t=`${this.lc}[${this.getCurrentSettings.name}]`;try{if(M&&console.log(`${t} starting... (I: da0baee73e386089a8c059f83cc43825)`),!this.settings)return;let o=await xe({settingsType:e,useCase:"current"});return Un({sectionName:o,settingsIbGib:this.settings.ibGib})}catch(o){throw console.error(`${t} ${y(o)}`),o}finally{M&&console.log(`${t} complete.`)}}async initSettings(){let e=`${this.lc}[${this.initSettings.name}]`;try{if(M&&console.log(`${e} starting... (I: acfee8787d32a6075442e2887a386a25)`),!this.ibGib)throw new Error("(UNEXPECTED) this.ibGib falsy? (E: 8ce2e73bea87b9330b131778a3981825)");let t=await this.getMetaspace(),o=await t.getLocalUserSpace({lock:!1});if(!o)throw new Error("(UNEXPECTED) couldn't get default local user space? (E: f77ce7269a6f0d7ad8978349b4c6cd25)");if(bt({ibGib:this.ibGib})){console.error(`${e} this.ibGib is primitive, so what are we initializing settings for? (W: 9915089019b81c6935b32ae877095825)`);return}let i=await Ci({ibGib:this.ibGib}),s=await Lt({scope:i,ibGib:this.ibGib,metaspace:t,space:o});if(s||(s=(await Si({scope:i,metaspace:t,space:o,saveInSpace:!0})).newIbGib,await zn({scope:i,domainIbGib:this.ibGib,localIbGib:s,metaspace:t,space:o})),!s)throw new Error("(UNEXPECTED) settings falsy still? should be initialized. (E: a179adcbbab800cff849b8aa95fbe425)");let l=new Ne;if(await l.setWrappedIbGib({ibGib:s,space:o}),this.settings=l,!await this.getCurrentSettings({settingsType:te.general}))throw new Error("(UNEXPECTED) no current general settings? the settings should have been updated with this upon creation. (E: d10fd8d42b58d917180293a713009825)")}catch(t){throw console.error(`${e} ${y(t)}`),t}finally{M&&console.log(`${e} complete.`)}}async exportIbGib({ibGib:e,compress:t}){let o=`${this.lc}[${this.exportIbGib.name}]`;try{M&&console.log(`${o} starting... (I: 623d9463d919683be81f749821a95825)`);let i=await this.getMetaspace();if(!i)throw new Error("(UNEXPECTED) metaspace falsy? (E: 3d15dbd074ac0c15b834a788d0b57d25)");if(bt({ibGib:e}))throw new Error("ibGib is primitive. Can't export primitive. (E: dd42c42e9fda0707e81c692af1a2a225)");let s=await i.getLocalUserSpace({lock:!1});if(!s)throw new Error("(UNEXPECTED) couldn't get default local user space? (E: 7bb735be58282f1bd7abe5d9ffabb525)");await er({ibGib:e,compress:t,metaspace:i,space:s})}catch(i){throw console.error(`${o} ${y(i)}`),i}finally{M&&console.log(`${o} complete.`)}}async importIbGib({exportIbGibJsonString:e,rel8nName:t,force:o,skipRegisterTimelines:i,divergentTimelineStrategy:s}){let l=`${this.lc}[${this.importIbGib.name}]`;try{let c=await this.getMetaspace(),d=await c.getLocalUserSpace({lock:!1});if(!d)throw new Error("(UNEXPECTED) couldn't get default local user space? (E: 947c983e57a91aa00c8c185320354325)");let[u,p]=await ji({exportIbGibJsonString:e,metaspace:c});if(!u.data)throw new Error("(UNEXPECTED) rawExportIbGib.data falsy? this is assumed validated at this point. (E: 6bc4e84db08e3c6228b2c40c2ea50825)");let m=u.data.contextIbGibAddr,h=!1;if(!o){let g=await c.get({addr:m,space:d});g.success&&(g.ibGibs??[]).length===1&&(console.log(`${l} export's ibGib addr (${m}) already exists in the space, so we're skipping doing any physical importing of the export's graph. (I: 429b5bdcd0585c697869f568c4673825)`),h=!0)}if(!h){On;let g=[],b=[];Object.values(p).forEach(P=>{Gi({ibGib:P})?g.push(P):b.push(P)});let E=await c.put({ibGibs:g,isDna:!0,space:d,force:o});if(!E.success||E.errorMsg)throw new Error(`there was an error putting the export's dna ibgibs into the space (${d.ib}). error: ${E.errorMsg||"[unknown error (E: 7c7ef8d5281399b1d8f3fbeefba1b825)]"} (E: ce3e8b982208afc4889164ba20a31825)`);let{mapWithTjp_YesDna:I,mapWithTjp_NoDna:v,mapWithoutTjps:T}=On({ibGibs:b}),w=await c.put({ibGibs:Object.values(T),space:d,force:o});if(!w.success||w.errorMsg)throw new Error(`there was an error putting the export's non-dna stone ibgibs (no-tjp) into the space (${d.ib}). error: ${w.errorMsg||"[unknown error (E: dc17f8ee7aed5c445f8b827f274b0825)]"} (E: 9561364961e89c132818f6784a607825)`);let C={...I,...v},S=Object.values(C),$=await c.put({ibGibs:S,space:d,force:o});if(!$.success||$.errorMsg)throw new Error(`there was an error putting the export's timeline ibgibs into the space (${d.ib}). error: ${$.errorMsg||"[unknown error (E: be4a28961574765798c8d3686ae89c25)]"} (E: 066796a23da3c9f748558fd25bfdf525)`);if(!i){let P=Bi({ibGibs:S}),F=Object.values(P);for(let A of F){let G=A.at(-1);if(!G)throw new Error("(UNEXPECTED) latestInTimeline falsy? this would mean that we had an empty timeline, and this doesn't make sense... (E: 3bec09e79768cc39d8029f4fe3af9825)");let B=await c.getLatestAddr({ibGib:G,space:d});!1||await c.registerNewIbGib({ibGib:G,space:d})}}}throw new Error("not implemented (E: 66c308e420e848c8d7cd01c8fddf8425)")}catch(c){throw console.error(`${l} ${y(c)}`),c}finally{M&&console.log(`${l} complete.`)}}};var Fn=class extends Xe{static{f(this,"IbGibFormInstanceBase")}setLoading(e,t="#btn-submit, #btn-generate",o){if(!this.shadowRoot)return;let i=this.shadowRoot.querySelector(t);if(i)if(i.disabled=e,e)i.setAttribute("data-loading","true"),o&&(i.setAttribute("data-original-text",i.textContent||""),i.textContent=o);else{i.removeAttribute("data-loading");let s=i.getAttribute("data-original-text");s!==null&&(i.textContent=s,i.removeAttribute("data-original-text"))}}setStatus(e,t,o="status-area",i="status-text"){if(!this.shadowRoot)return;let s=this.shadowRoot.getElementById(o),l=this.shadowRoot.getElementById(i);l&&(l.textContent=e,l.className=`status-msg ${t}`),s&&(e?s.classList.remove("hidden"):s.classList.add("hidden"))}dispatchShellMessage(e,t){this.dispatchEvent(new CustomEvent(Yi,{detail:{message:e,level:t,source:this.tagName.toLowerCase()},bubbles:!0,composed:!0}))}validateForm(e="form"){if(!this.shadowRoot)return!0;let t=this.shadowRoot.querySelector(e);if(t)return t.checkValidity();let o=this.shadowRoot.querySelectorAll("input, select, textarea"),i=!0;for(let s of Array.from(o)){let l=s;if(!l.checkValidity()){i=!1,l.reportValidity();break}}return i}validateInputPattern({input:e,pattern:t,errorMessage:o,required:i=!0}){if(!e)return!0;let s=e.value.trim();if(!s&&!i)return e.classList.remove("invalid"),e.setCustomValidity(""),!0;let l=t.test(s);return l?(e.classList.remove("invalid"),e.setCustomValidity("")):(e.classList.add("invalid"),e.setCustomValidity(o),e.reportValidity()),l}showBusy({isBusy:e,title:t,msg:o,localOnly:i,submitBtnSelector:s,loadingText:l,animationEmoji:c}){let d=`${this.lc}[${this.showBusy.name}]`;try{this.setLoading(e,s,l),this.toggleAllInputsDisabled(e),super.showBusy({isBusy:e,title:t,msg:o,localOnly:i,animationEmoji:c})}catch(u){throw console.error(`${d} ${y(u)}`),u}}toggleAllInputsDisabled(e){if(!this.shadowRoot)return;this.shadowRoot.querySelectorAll("input, select, textarea, button").forEach(o=>{o.id==="btn-submit"||o.id==="btn-generate"||(o.disabled=e)})}};var tl="ibgib-keystone-creator",Vn=class extends Le{static{f(this,"KeystoneCreatorComponentMeta")}lc="[KeystoneCreatorComponentMeta]";routeRegExp=new RegExp(`^${tl}$`);componentName=tl;constructor(){super(Ze()),customElements.get(this.componentName)||customElements.define(this.componentName,Ai)}async createInstance({path:e,ibGibAddr:t}){let o=`${this.lc}[${this.createInstance.name}]`,i=document.createElement(this.componentName);return await i.initialize({ibGibAddr:t,meta:this,html:wr,css:[et,Tr]}),i}},Ai=class extends Fn{static{f(this,"KeystoneCreatorComponentInstance")}lc="[KeystoneCreatorComponentInstance]";hasExistingIdentities=!1;constructor(){super()}async initialize(e){await super.initialize(e)}async created(){this.elements={},this.elements.containerEl=this.shadowRoot.getElementById("container"),this.elements.titleEl=this.shadowRoot.getElementById("title"),this.elements.btnGenerateEl=this.shadowRoot.getElementById("btn-generate"),this.elements.resultAreaEl=this.shadowRoot.getElementById("result-area"),this.elements.keystoneAddrEl=this.shadowRoot.getElementById("keystone-addr"),this.elements.inputUsername=this.shadowRoot.getElementById("input-username"),this.elements.inputDescription=this.shadowRoot.getElementById("input-description"),this.elements.inputSecret=this.shadowRoot.getElementById("input-secret"),this.elements.checkboxMakeActive=this.shadowRoot.getElementById("checkbox-make-active"),this.elements.statusArea=this.shadowRoot.getElementById("status-area"),this.elements.statusText=this.shadowRoot.getElementById("status-text"),this.elements.contentEl=this.elements.containerEl,this.initHandlers(),this.ibGibAddr&&!this.ibGib&&await this.loadIbGib(),await this.checkExistingIdentities(),await this.renderUI()}async checkExistingIdentities(){let e=`${this.lc}[checkExistingIdentities]`;try{let o=await Ee(),i=await o.getLocalUserSpace({});if(i){let l=(await o.getSpecialIbGib({type:"keystones",space:i,initialize:!0}))?.rel8ns?.keystone??[];this.hasExistingIdentities=l.length>0}}catch(o){console.warn(`${e} Error checking existing identities: ${y(o)}`),this.hasExistingIdentities=!1}let t=this.elements.checkboxMakeActive;t&&(this.hasExistingIdentities?(t.disabled=!1,t.title=""):(t.checked=!0,t.disabled=!0,t.title="At least one active identity is required."))}async disconnected(){}initHandlers(){this.elements.btnGenerateEl.addEventListener("click",()=>this.handleGenerate()),this.elements.inputUsername.addEventListener("input",()=>{this.elements.inputUsername.classList.remove("invalid")}),this.elements.inputDescription.addEventListener("input",()=>{this.elements.inputDescription.classList.remove("invalid")}),this.elements.inputSecret.addEventListener("input",()=>{this.elements.inputSecret.classList.remove("invalid")})}async handleGenerate(){let e=`${this.lc}[${this.handleGenerate.name}]`;try{console.log(`${e} [NAG][ibgib-paradigm] starting genesis orchestration...`);let t=500;if(this.setStatus("Initializing genesis...","info"),W("Starting local genesis orchestration..."),!this.validateInputPattern({input:this.elements.inputUsername,pattern:sr,errorMessage:"Username must be 1-63 characters (alphanumeric, underscores, hyphens, dots).",required:!0})){this.setStatus("Invalid username. Must be 1-63 characters (alphanumeric, _, -, .).","error"),W("\u2717 Invalid username.");return}let o=this.elements.inputUsername.value.trim();if(!this.validateInputPattern({input:this.elements.inputDescription,pattern:ar,errorMessage:"Description must be 0-128 characters and consist of English characters and common punctuation.",required:!1})){this.setStatus("Invalid description. Alphanumeric + common punctuation, max 128 chars.","error"),W("\u2717 Invalid description.");return}let i=this.elements.inputDescription.value.trim(),s=this.elements.inputSecret.value;if(s)this.elements.inputSecret.classList.remove("invalid");else{this.elements.inputSecret.classList.add("invalid"),this.setStatus("Please enter a master secret.","error"),W("\u2717 Please enter a master secret.");return}this.showBusy({isBusy:!0,title:"Generating Identity...",msg:"Preparing configuration and policy options...",animationEmoji:"\u2699\uFE0F",submitBtnSelector:"#btn-generate",loadingText:"Generating..."});let l=vt.buildKeystone("domain").withUsername(o).withDescription(i).withDetails({client:"space-gib-web",role:"domain-identity"}),c=await l.compileConfigs(),d=await Ee(),u=await d.getLocalUserSpace({});if(!u)throw new Error("No default space found in metaspace.");this.showBusy({isBusy:!0,title:"Generating Identity...",msg:`Performing cryptographic local genesis...
|
|
1196
|
-
(This runs compute-heavy Key Derivation Functions)`,animationEmoji:"\u{1F5DD}\uFE0F"});let p=new Fe,m=await p.genesis({masterSecret:s,configs:c,metaspace:d,space:u,frameDetails:l.getFrameDetails()}),h=x({ibGib:m});console.log(`${e} [NAG][ibgib-paradigm] local genesis complete: ${h}`),await K(t),this.setStatus("Local genesis complete. Creating sync delegate...","info"),W(`\u2713 Local genesis complete: ${h}`),this.showBusy({isBusy:!0,title:"Creating Sync Delegate...",msg:"Generating cryptographic sync delegate keys...",animationEmoji:"\u{1F511}"});let g=await rr({masterSecret:s}),b=vt.buildKeystone("sync").withUsername(`${o}-sync`).withDescription(`Sync Delegate for ${o}`).withDetails({client:"space-gib-web",role:"sync-delegate"}),E=await b.compileConfigs(),I=await p.genesis({masterSecret:g,configs:E,metaspace:d,space:u,frameDetails:b.getFrameDetails()}),v=x({ibGib:I});console.log(`${e} sync delegate genesis complete: ${v}`),await K(t),this.setStatus("Registering delegate on parent...","info"),this.showBusy({isBusy:!0,title:"Registering Delegate...",msg:"Evolving domain identity to register delegate...",animationEmoji:"\u{1F4DD}"});let T=await p.registerDelegate({parentKeystone:m,delegateKeystone:I,masterSecret:s,metaspace:d,space:u,allowedVerbs:[lr]}),w=x({ibGib:T});console.log(`${e} delegate registered. evolved parent address: ${w}`),await K(t),W("Posting genesis keystone to server..."),this.setStatus("Syncing genesis to server...","info"),this.showBusy({isBusy:!0,title:"Syncing to Server...",msg:["Posting genesis keystone to server sync node...","(may take awhile, depending on strength of keystone...)"].join(`
|
|
1197
|
-
`),animationEmoji:"\u{1F504}"});let C=await Wn.postGenesisKeystone(m);if(!C.success){this.setStatus(`Sync failed: ${C.message}`,"error"),W(`\u2717 Server rejected genesis keystone: ${C.message}`);return}this.setStatus("Syncing delegate registration to server...","info"),this.showBusy({isBusy:!0,title:"Syncing Delegate...",msg:"Posting evolved domain identity and sync delegate to server...",animationEmoji:"\u{1F504}"});let S=await Wn.putEvolveKeystone(h,T,[I]);if(!S.success){this.setStatus(`Delegate registration sync failed: ${S.message}`,"error"),W(`\u2717 Server rejected delegate registration: ${S.message}`);return}this.showBusy({isBusy:!0,title:"Registering Identity...",msg:`Server sync succeeded!
|
|
1198
|
-
Updating local identity indexes and scope settings...`,animationEmoji:"\u{1F4BE}"}),await K(t),await je({type:"keystones",rel8nInfos:[{rel8nName:"keystone",ibGibs:[re({ibGib:T}),re({ibGib:I})]}],metaspace:d,space:u}),window.dev_domainI=T,window.dev_domainIMasterSecret=s,window.dev_syncDelegate=I,window.dev_syncDelegateSecret=g,this.elements.checkboxMakeActive?.checked&&window.dispatchEvent(new CustomEvent(Pe,{detail:{activeIdentityAddr:w},bubbles:!0,composed:!0})),this.elements.keystoneAddrEl.textContent=w,this.elements.statusArea.classList.remove("hidden"),this.setStatus("Keystone successfully created and synced!","success"),await K(t),W("\u2713 Keystone successfully created and synced!")}catch(t){let o=y(t);console.error(`${e} ${o}`),this.setStatus(`Error: ${o}`,"error"),W(`\u2717 Error: ${o}`)}finally{this.showBusy({isBusy:!1,submitBtnSelector:"#btn-generate"})}}async renderUI(){}async handleContextUpdated(){await this.renderUI()}};var nl=`:host {
|
|
1199
|
-
display: block;
|
|
1200
|
-
width: 100%;
|
|
1201
|
-
max-width: 100%;
|
|
1202
|
-
margin: 1rem auto;
|
|
1203
|
-
font-family: var(--font-family-base, inherit);
|
|
1204
|
-
font-size: var(--font-size-base, 1rem);
|
|
1205
|
-
color: var(--text-color-base, var(--clr-text-primary, #ffffff));
|
|
1206
|
-
box-sizing: border-box;
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
.component-container {
|
|
1210
|
-
padding: 2rem;
|
|
1211
|
-
background: var(--side-panel-tab-content-background-color, var(--clr-bg-glass, rgba(20, 20, 25, 0.6)));
|
|
1212
|
-
backdrop-filter: blur(16px);
|
|
1213
|
-
border-radius: var(--radius-lg, 12px);
|
|
1214
|
-
border: var(--border-width-base, 1px) var(--border-style-base, solid) var(--border-color-base, var(--clr-border, rgba(255, 255, 255, 0.1)));
|
|
1215
|
-
box-shadow: var(--shadow-card, 0 8px 32px 0 rgba(0, 0, 0, 0.37));
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
header {
|
|
1219
|
-
display: flex;
|
|
1220
|
-
flex-direction: column;
|
|
1221
|
-
gap: 1rem;
|
|
1222
|
-
margin-bottom: 2rem;
|
|
1223
|
-
border-bottom: 1px solid var(--border-color-base, rgba(255, 255, 255, 0.1));
|
|
1224
|
-
padding-bottom: 1rem;
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
h2 {
|
|
1228
|
-
margin: 0;
|
|
1229
|
-
font-size: var(--h2-font-size, 1.5rem);
|
|
1230
|
-
font-weight: var(--h2-font-weight, 600);
|
|
1231
|
-
color: var(--clr-accent, #50fa7b);
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
.icon-btn {
|
|
1236
|
-
width: 2.2rem;
|
|
1237
|
-
height: 2.2rem;
|
|
1238
|
-
display: flex;
|
|
1239
|
-
align-items: center;
|
|
1240
|
-
justify-content: center;
|
|
1241
|
-
background: var(--button-background-color-base, rgba(255, 255, 255, 0.05));
|
|
1242
|
-
border: 1px solid var(--button-border-color-base, rgba(255, 255, 255, 0.1));
|
|
1243
|
-
border-radius: var(--button-border-radius-base, 50%);
|
|
1244
|
-
color: var(--button-text-color-base, #ffffff);
|
|
1245
|
-
font-size: 1.2rem;
|
|
1246
|
-
cursor: pointer;
|
|
1247
|
-
transition: all 0.2s ease-in-out;
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
.icon-btn:hover {
|
|
1251
|
-
background: var(--button-hover-background-color, var(--clr-accent, #50fa7b));
|
|
1252
|
-
color: var(--button-hover-text-color, #1a1a24);
|
|
1253
|
-
border-color: var(--button-hover-border-color, var(--clr-accent, #50fa7b));
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
.content {
|
|
1257
|
-
display: flex;
|
|
1258
|
-
flex-direction: column;
|
|
1259
|
-
gap: 1.5rem;
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
.placeholder-view {
|
|
1263
|
-
padding: 3rem 1rem;
|
|
1264
|
-
text-align: center;
|
|
1265
|
-
background: rgba(0, 0, 0, 0.15);
|
|
1266
|
-
border-radius: var(--radius-md, 8px);
|
|
1267
|
-
border: 1px dashed var(--border-color-base, rgba(255, 255, 255, 0.1));
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
.placeholder-view p {
|
|
1271
|
-
color: var(--clr-text-secondary, #b3b3b3);
|
|
1272
|
-
margin-bottom: 1.5rem;
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
.card {
|
|
1276
|
-
padding: 1.5rem;
|
|
1277
|
-
background: rgba(255, 255, 255, 0.02);
|
|
1278
|
-
border: 1px solid var(--border-color-base, rgba(255, 255, 255, 0.05));
|
|
1279
|
-
border-radius: var(--radius-md, 8px);
|
|
1280
|
-
display: flex;
|
|
1281
|
-
flex-direction: column;
|
|
1282
|
-
gap: 1rem;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
.card h3 {
|
|
1286
|
-
margin: 0;
|
|
1287
|
-
font-size: var(--h3-font-size, 1.15rem);
|
|
1288
|
-
font-weight: var(--h3-font-weight, 500);
|
|
1289
|
-
color: var(--clr-accent, #50fa7b);
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
.info-group {
|
|
1293
|
-
display: flex;
|
|
1294
|
-
flex-direction: column;
|
|
1295
|
-
gap: 0.5rem;
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
.info-group label {
|
|
1299
|
-
font-size: 0.8rem;
|
|
1300
|
-
color: var(--clr-text-secondary, #b3b3b3);
|
|
1301
|
-
text-transform: uppercase;
|
|
1302
|
-
letter-spacing: 0.05em;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
.replicas-list {
|
|
1307
|
-
display: flex;
|
|
1308
|
-
flex-direction: column;
|
|
1309
|
-
gap: 0.5rem;
|
|
1310
|
-
max-height: 150px;
|
|
1311
|
-
overflow-y: auto;
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
.input-row {
|
|
1315
|
-
display: flex;
|
|
1316
|
-
gap: 0.5rem;
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
/* Accordion raw styles */
|
|
1320
|
-
.accordion {
|
|
1321
|
-
padding: 0;
|
|
1322
|
-
overflow: hidden;
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
.accordion-header {
|
|
1326
|
-
padding: 1.25rem 1.5rem;
|
|
1327
|
-
display: flex;
|
|
1328
|
-
justify-content: space-between;
|
|
1329
|
-
align-items: center;
|
|
1330
|
-
cursor: pointer;
|
|
1331
|
-
background: rgba(255, 255, 255, 0.01);
|
|
1332
|
-
transition: background 0.2s ease-in-out;
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
.accordion-header:hover {
|
|
1336
|
-
background: rgba(255, 255, 255, 0.03);
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
.accordion-header .chevron {
|
|
1340
|
-
transition: transform 0.2s ease-in-out;
|
|
1341
|
-
font-size: 0.8rem;
|
|
1342
|
-
color: var(--clr-text-secondary, #b3b3b3);
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
.accordion-header.expanded .chevron {
|
|
1346
|
-
transform: rotate(180deg);
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
.accordion-content {
|
|
1350
|
-
max-height: 0;
|
|
1351
|
-
transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
|
|
1352
|
-
background: rgba(0, 0, 0, 0.15);
|
|
1353
|
-
border-top: 1px solid var(--border-color-base, rgba(255, 255, 255, 0.03));
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
.accordion-content.expanded {
|
|
1357
|
-
max-height: 5000px;
|
|
1358
|
-
overflow-y: visible;
|
|
1359
|
-
transition: max-height 0.3s cubic-bezier(1, 0, 1, 0);
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
.json-code {
|
|
1363
|
-
margin: 0;
|
|
1364
|
-
padding: 1.25rem;
|
|
1365
|
-
font-family: var(--font-mono, monospace);
|
|
1366
|
-
font-size: 0.8rem;
|
|
1367
|
-
color: var(--clr-accent, #50fa7b);
|
|
1368
|
-
background: transparent;
|
|
1369
|
-
overflow: auto;
|
|
1370
|
-
max-height: 70dvh;
|
|
1371
|
-
white-space: pre-wrap;
|
|
1372
|
-
word-break: break-all;
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
.description {
|
|
1376
|
-
font-size: 0.85rem;
|
|
1377
|
-
color: var(--clr-text-secondary, #b3b3b3);
|
|
1378
|
-
margin: 0;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
.hidden {
|
|
1383
|
-
display: none !important;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
.info-group-grid {
|
|
1387
|
-
display: grid;
|
|
1388
|
-
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
1389
|
-
gap: 1rem;
|
|
1390
|
-
margin-top: 0.5rem;
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
.value-text {
|
|
1394
|
-
font-family: var(--font-family-base, inherit);
|
|
1395
|
-
font-size: 0.9rem;
|
|
1396
|
-
color: var(--text-color-base, #ffffff);
|
|
1397
|
-
font-weight: 500;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
.pools-container {
|
|
1401
|
-
display: flex;
|
|
1402
|
-
flex-direction: column;
|
|
1403
|
-
gap: 1rem;
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
|
-
.pool-card {
|
|
1407
|
-
padding: 1rem;
|
|
1408
|
-
background: rgba(0, 0, 0, 0.25);
|
|
1409
|
-
border: 1px solid var(--border-color-base, rgba(255, 255, 255, 0.05));
|
|
1410
|
-
border-radius: 6px;
|
|
1411
|
-
display: flex;
|
|
1412
|
-
flex-direction: column;
|
|
1413
|
-
gap: 0.75rem;
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
.pool-header {
|
|
1417
|
-
display: flex;
|
|
1418
|
-
justify-content: space-between;
|
|
1419
|
-
align-items: center;
|
|
1420
|
-
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
1421
|
-
padding-bottom: 0.5rem;
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1424
|
-
.pool-title {
|
|
1425
|
-
font-size: 0.95rem;
|
|
1426
|
-
font-weight: 600;
|
|
1427
|
-
color: var(--clr-accent, #50fa7b);
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
.pool-tag {
|
|
1431
|
-
font-size: 0.7rem;
|
|
1432
|
-
padding: 0.15rem 0.4rem;
|
|
1433
|
-
border-radius: 4px;
|
|
1434
|
-
font-weight: bold;
|
|
1435
|
-
text-transform: uppercase;
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
.pool-tag.foreign {
|
|
1439
|
-
background: rgba(255, 184, 108, 0.15);
|
|
1440
|
-
border: 1px solid rgba(255, 184, 108, 0.3);
|
|
1441
|
-
color: #ffb86c;
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
.pool-tag.native {
|
|
1445
|
-
background: rgba(80, 250, 123, 0.1);
|
|
1446
|
-
border: 1px solid rgba(80, 250, 123, 0.2);
|
|
1447
|
-
color: #50fa7b;
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
.pool-grid {
|
|
1451
|
-
display: grid;
|
|
1452
|
-
grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
|
|
1453
|
-
gap: 0.75rem;
|
|
1454
|
-
font-size: 0.85rem;
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
.pool-field {
|
|
1458
|
-
display: flex;
|
|
1459
|
-
flex-direction: column;
|
|
1460
|
-
gap: 0.2rem;
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
.pool-field label {
|
|
1464
|
-
font-size: 0.7rem;
|
|
1465
|
-
color: var(--clr-text-secondary, #b3b3b3);
|
|
1466
|
-
text-transform: uppercase;
|
|
1467
|
-
letter-spacing: 0.03em;
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
.pool-field span {
|
|
1471
|
-
color: #ffffff;
|
|
1472
|
-
font-weight: 500;
|
|
1473
|
-
word-break: break-all;
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
/* Key-Value Details Grid Layout */
|
|
1477
|
-
.kv-grid {
|
|
1478
|
-
display: grid;
|
|
1479
|
-
grid-template-columns: minmax(140px, 180px) 1fr;
|
|
1480
|
-
gap: 0.75rem 1.5rem;
|
|
1481
|
-
align-items: baseline;
|
|
1482
|
-
margin-top: 1rem;
|
|
1483
|
-
margin-bottom: 1.5rem;
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
.kv-label {
|
|
1487
|
-
font-family: var(--font-sans);
|
|
1488
|
-
font-size: 0.75rem;
|
|
1489
|
-
font-weight: 600;
|
|
1490
|
-
text-transform: uppercase;
|
|
1491
|
-
letter-spacing: 0.05em;
|
|
1492
|
-
color: var(--clr-text-secondary, #8fa08f);
|
|
1493
|
-
user-select: none;
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
.kv-value {
|
|
1497
|
-
font-size: 0.9375rem;
|
|
1498
|
-
color: var(--clr-text-primary, #ffffff);
|
|
1499
|
-
word-break: break-all;
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
|
-
.kv-pre {
|
|
1503
|
-
margin: 0;
|
|
1504
|
-
padding: 0.6rem 0.8rem;
|
|
1505
|
-
background: rgba(0, 0, 0, 0.3);
|
|
1506
|
-
border: 1px solid var(--border-color-base, rgba(255, 255, 255, 0.05));
|
|
1507
|
-
border-radius: var(--radius-sm, 6px);
|
|
1508
|
-
font-family: var(--font-mono, monospace);
|
|
1509
|
-
font-size: 0.8rem;
|
|
1510
|
-
color: var(--clr-accent, #50fa7b);
|
|
1511
|
-
max-height: 150px;
|
|
1512
|
-
overflow: auto;
|
|
1513
|
-
white-space: pre;
|
|
1514
|
-
word-break: normal;
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
/* Timeline Scrubber Navigation */
|
|
1518
|
-
.scrubber-nav {
|
|
1519
|
-
display: flex;
|
|
1520
|
-
align-items: center;
|
|
1521
|
-
justify-content: center;
|
|
1522
|
-
gap: 0.5rem;
|
|
1523
|
-
padding: 0.75rem;
|
|
1524
|
-
background: rgba(0, 0, 0, 0.2);
|
|
1525
|
-
border: 1px solid var(--border-color-base, rgba(255, 255, 255, 0.05));
|
|
1526
|
-
border-radius: var(--radius-md, 8px);
|
|
1527
|
-
margin-top: 1rem;
|
|
1528
|
-
margin-bottom: 1.5rem;
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
.scrubber-info {
|
|
1532
|
-
font-family: var(--font-mono, monospace);
|
|
1533
|
-
font-size: 0.85rem;
|
|
1534
|
-
color: var(--clr-accent, #50fa7b);
|
|
1535
|
-
min-width: 120px;
|
|
1536
|
-
text-align: center;
|
|
1537
|
-
font-weight: 500;
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
.scrubber-btn {
|
|
1541
|
-
padding: 0.4rem 0.8rem;
|
|
1542
|
-
font-size: 0.8rem;
|
|
1543
|
-
min-width: 2.2rem;
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
/* Pool Details & Challenges/Binding Map styling */
|
|
1547
|
-
.pool-details {
|
|
1548
|
-
margin-top: 0.75rem;
|
|
1549
|
-
border-top: 1px solid rgba(255, 255, 255, 0.05);
|
|
1550
|
-
padding-top: 0.5rem;
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
|
-
.pool-details-summary {
|
|
1554
|
-
font-size: 0.8rem;
|
|
1555
|
-
font-weight: 600;
|
|
1556
|
-
color: var(--clr-text-secondary, #8fa08f);
|
|
1557
|
-
cursor: pointer;
|
|
1558
|
-
user-select: none;
|
|
1559
|
-
outline: none;
|
|
1560
|
-
padding: 0.25rem 0;
|
|
1561
|
-
display: flex;
|
|
1562
|
-
align-items: center;
|
|
1563
|
-
gap: 0.25rem;
|
|
1564
|
-
transition: color var(--t-fast, 120ms ease);
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
.pool-details-summary:hover {
|
|
1568
|
-
color: var(--clr-accent, #78f87e);
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
.pool-challenges-list {
|
|
1572
|
-
margin-top: 0.5rem;
|
|
1573
|
-
display: flex;
|
|
1574
|
-
flex-direction: column;
|
|
1575
|
-
gap: 0.4rem;
|
|
1576
|
-
max-height: 180px;
|
|
1577
|
-
overflow-y: auto;
|
|
1578
|
-
padding-right: 0.25rem;
|
|
1579
|
-
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
1580
|
-
background: rgba(0, 0, 0, 0.15);
|
|
1581
|
-
border-radius: 4px;
|
|
1582
|
-
padding: 0.5rem;
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
|
-
.pool-challenge-item {
|
|
1586
|
-
display: flex;
|
|
1587
|
-
justify-content: space-between;
|
|
1588
|
-
align-items: center;
|
|
1589
|
-
background: rgba(255, 255, 255, 0.02);
|
|
1590
|
-
border: 1px solid rgba(255, 255, 255, 0.03);
|
|
1591
|
-
border-radius: 4px;
|
|
1592
|
-
padding: 0.35rem 0.5rem;
|
|
1593
|
-
font-size: 0.75rem;
|
|
1594
|
-
font-family: var(--font-mono, monospace);
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
.challenge-id {
|
|
1598
|
-
color: var(--clr-text-secondary, #8fa08f);
|
|
1599
|
-
font-weight: 500;
|
|
1600
|
-
}
|
|
1601
|
-
|
|
1602
|
-
.challenge-hash {
|
|
1603
|
-
color: var(--clr-accent, #78f87e);
|
|
1604
|
-
word-break: break-all;
|
|
1605
|
-
margin-left: 1rem;
|
|
1606
|
-
text-align: right;
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
.pool-binding-map {
|
|
1610
|
-
margin-top: 0.5rem;
|
|
1611
|
-
display: grid;
|
|
1612
|
-
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
|
|
1613
|
-
gap: 0.4rem;
|
|
1614
|
-
max-height: 200px;
|
|
1615
|
-
overflow-y: auto;
|
|
1616
|
-
padding-right: 0.25rem;
|
|
1617
|
-
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
1618
|
-
background: rgba(0, 0, 0, 0.15);
|
|
1619
|
-
border-radius: 4px;
|
|
1620
|
-
padding: 0.5rem;
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
.binding-bucket {
|
|
1624
|
-
display: flex;
|
|
1625
|
-
flex-direction: column;
|
|
1626
|
-
align-items: center;
|
|
1627
|
-
background: rgba(255, 255, 255, 0.02);
|
|
1628
|
-
border: 1px solid rgba(255, 255, 255, 0.03);
|
|
1629
|
-
border-radius: 4px;
|
|
1630
|
-
padding: 0.35rem;
|
|
1631
|
-
font-family: var(--font-mono, monospace);
|
|
1632
|
-
font-size: 0.75rem;
|
|
1633
|
-
}
|
|
1634
|
-
|
|
1635
|
-
.binding-key {
|
|
1636
|
-
color: var(--clr-text-secondary, #8fa08f);
|
|
1637
|
-
font-weight: bold;
|
|
1638
|
-
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
1639
|
-
width: 100%;
|
|
1640
|
-
text-align: center;
|
|
1641
|
-
padding-bottom: 0.15rem;
|
|
1642
|
-
margin-bottom: 0.15rem;
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
.binding-ids {
|
|
1646
|
-
display: flex;
|
|
1647
|
-
flex-direction: column;
|
|
1648
|
-
gap: 0.15rem;
|
|
1649
|
-
width: 100%;
|
|
1650
|
-
align-items: center;
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
.binding-id-tag {
|
|
1654
|
-
font-size: 0.65rem;
|
|
1655
|
-
background: rgba(120, 248, 126, 0.08);
|
|
1656
|
-
color: var(--clr-accent, #78f87e);
|
|
1657
|
-
padding: 0.05rem 0.25rem;
|
|
1658
|
-
border-radius: 3px;
|
|
1659
|
-
width: 100%;
|
|
1660
|
-
text-align: center;
|
|
1661
|
-
white-space: nowrap;
|
|
1662
|
-
overflow: hidden;
|
|
1663
|
-
text-overflow: ellipsis;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
/* Delegates Card styling */
|
|
1667
|
-
.delegates-table {
|
|
1668
|
-
width: 100%;
|
|
1669
|
-
border-collapse: collapse;
|
|
1670
|
-
margin-top: 1rem;
|
|
1671
|
-
font-size: 0.9rem;
|
|
1672
|
-
background: rgba(0, 0, 0, 0.2);
|
|
1673
|
-
border-radius: var(--radius-sm, 6px);
|
|
1674
|
-
overflow: hidden;
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
.delegates-table th,
|
|
1678
|
-
.delegates-table td {
|
|
1679
|
-
padding: 0.75rem 1rem;
|
|
1680
|
-
text-align: left;
|
|
1681
|
-
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
.delegates-table th {
|
|
1685
|
-
font-family: var(--font-sans);
|
|
1686
|
-
font-size: 0.75rem;
|
|
1687
|
-
font-weight: 600;
|
|
1688
|
-
text-transform: uppercase;
|
|
1689
|
-
letter-spacing: 0.05em;
|
|
1690
|
-
color: var(--clr-text-secondary, #8fa08f);
|
|
1691
|
-
background: rgba(255, 255, 255, 0.02);
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
|
-
.delegates-table td {
|
|
1695
|
-
font-family: var(--font-mono, monospace);
|
|
1696
|
-
font-size: 0.8rem;
|
|
1697
|
-
color: var(--clr-text-primary, #ffffff);
|
|
1698
|
-
word-break: break-all;
|
|
1699
|
-
}
|
|
1700
|
-
|
|
1701
|
-
.delegates-table tbody tr:hover {
|
|
1702
|
-
background: rgba(255, 255, 255, 0.02);
|
|
1703
|
-
}`;var ol=`<div id="container" class="component-container">
|
|
1704
|
-
<header id="identity-manager-header">
|
|
1705
|
-
<h2 id="title">Identity Manager</h2>
|
|
1706
|
-
<div class="tabs-row">
|
|
1707
|
-
<div id="identity-tabs" class="tabs-list">
|
|
1708
|
-
<!-- Tabs will be dynamically injected here -->
|
|
1709
|
-
</div>
|
|
1710
|
-
<button id="btn-add-identity" class="icon-btn" title="Create or Load Identity">+</button>
|
|
1711
|
-
</div>
|
|
1712
|
-
</header>
|
|
1713
|
-
|
|
1714
|
-
<div id="identity-manager-content" class="content">
|
|
1715
|
-
<!-- Active child or keystone-creator gets injected here -->
|
|
1716
|
-
<div id="no-identity-placeholder" class="placeholder-view">
|
|
1717
|
-
<p>No Domain Identities loaded. Create or load one to begin.</p>
|
|
1718
|
-
<button id="btn-create-placeholder" class="action-btn">Create/Load Identity</button>
|
|
1719
|
-
</div>
|
|
1720
|
-
|
|
1721
|
-
<div id="identity-details-view" class="details-view hidden">
|
|
1722
|
-
<!-- Details for the active Domain Identity -->
|
|
1723
|
-
<div class="card">
|
|
1724
|
-
<h3>Domain Identity Details</h3>
|
|
1725
|
-
|
|
1726
|
-
<!-- History Scrubber Navigation -->
|
|
1727
|
-
<div id="history-scrubber" class="scrubber-nav">
|
|
1728
|
-
<button id="btn-scrub-first" class="action-btn secondary scrubber-btn"
|
|
1729
|
-
title="First Frame (Genesis)">|<</button>
|
|
1730
|
-
<button id="btn-scrub-prev10" class="action-btn secondary scrubber-btn"
|
|
1731
|
-
title="Back 10 Frames"><< 10</button>
|
|
1732
|
-
<button id="btn-scrub-prev" class="action-btn secondary scrubber-btn"
|
|
1733
|
-
title="Previous Frame"><</button>
|
|
1734
|
-
<span id="scrubber-status" class="scrubber-info">Frame - / -</span>
|
|
1735
|
-
<button id="btn-scrub-next" class="action-btn secondary scrubber-btn"
|
|
1736
|
-
title="Next Frame">></button>
|
|
1737
|
-
<button id="btn-scrub-next10" class="action-btn secondary scrubber-btn" title="Forward 10 Frames">10
|
|
1738
|
-
>></button>
|
|
1739
|
-
<button id="btn-scrub-latest" class="action-btn secondary scrubber-btn"
|
|
1740
|
-
title="Latest Frame (Tip)">>|</button>
|
|
1741
|
-
</div>
|
|
1742
|
-
|
|
1743
|
-
<!-- Key-Value Grid -->
|
|
1744
|
-
<div class="kv-grid">
|
|
1745
|
-
<div class="kv-label">Username</div>
|
|
1746
|
-
<div id="identity-name" class="kv-value">-</div>
|
|
1747
|
-
|
|
1748
|
-
<div class="kv-label">Description</div>
|
|
1749
|
-
<div id="identity-description" class="kv-value">-</div>
|
|
1750
|
-
|
|
1751
|
-
<div class="kv-label">Verifiable Address</div>
|
|
1752
|
-
<code id="identity-addr" class="address-code"></code>
|
|
1753
|
-
|
|
1754
|
-
<div class="kv-label">Generation (n)</div>
|
|
1755
|
-
<div id="identity-gen" class="kv-value">-</div>
|
|
1756
|
-
|
|
1757
|
-
<div class="kv-label">Timestamp</div>
|
|
1758
|
-
<div id="identity-timestamp" class="kv-value">-</div>
|
|
1759
|
-
|
|
1760
|
-
<div class="kv-label">UUID</div>
|
|
1761
|
-
<div id="identity-uuid" class="kv-value">-</div>
|
|
1762
|
-
|
|
1763
|
-
<div class="kv-label">Frame Details</div>
|
|
1764
|
-
<div class="kv-value">
|
|
1765
|
-
<pre id="identity-frame-details" class="kv-pre">-</pre>
|
|
1766
|
-
</div>
|
|
1767
|
-
|
|
1768
|
-
<div class="kv-label">Aggr. Details</div>
|
|
1769
|
-
<div class="kv-value">
|
|
1770
|
-
<pre id="identity-aggr-details" class="kv-pre">-</pre>
|
|
1771
|
-
</div>
|
|
1772
|
-
</div>
|
|
1773
|
-
|
|
1774
|
-
<div class="action-row">
|
|
1775
|
-
<button id="btn-set-active" class="action-btn">Set as Active Identity</button>
|
|
1776
|
-
<button id="btn-verify-chain" class="action-btn secondary">Verify Identity Chain</button>
|
|
1777
|
-
<!-- <button id="btn-sync-identity" class="action-btn" disabled>Sync Identity & Data</button> -->
|
|
1778
|
-
</div>
|
|
1779
|
-
<div id="verification-status" class="status-msg hidden"></div>
|
|
1780
|
-
</div>
|
|
1781
|
-
|
|
1782
|
-
<!-- Challenge Pools Card -->
|
|
1783
|
-
<div class="card">
|
|
1784
|
-
<h3>Challenge Pools</h3>
|
|
1785
|
-
<div id="pools-container" class="pools-container">
|
|
1786
|
-
<!-- Dynamic pools list gets injected here -->
|
|
1787
|
-
</div>
|
|
1788
|
-
</div>
|
|
1789
|
-
|
|
1790
|
-
<!-- Delegates Card -->
|
|
1791
|
-
<div class="card">
|
|
1792
|
-
<h3>Registered Delegates</h3>
|
|
1793
|
-
<div id="delegates-container" class="delegates-container">
|
|
1794
|
-
<p class="description">Active sub-keystones authorized to perform sync and operations on behalf of this Domain Identity.</p>
|
|
1795
|
-
<table class="delegates-table">
|
|
1796
|
-
<thead>
|
|
1797
|
-
<tr>
|
|
1798
|
-
<th>Name / Description</th>
|
|
1799
|
-
<th>TJP Address</th>
|
|
1800
|
-
<th>Allowed Verbs</th>
|
|
1801
|
-
</tr>
|
|
1802
|
-
</thead>
|
|
1803
|
-
<tbody id="delegates-list">
|
|
1804
|
-
<!-- Dynamic list of delegates gets injected here -->
|
|
1805
|
-
</tbody>
|
|
1806
|
-
</table>
|
|
1807
|
-
</div>
|
|
1808
|
-
</div>
|
|
1809
|
-
|
|
1810
|
-
<!-- Replicas / Sync Peers Repository Manager -->
|
|
1811
|
-
<!-- <div class="card">
|
|
1812
|
-
<h3>Replication & Spaces</h3>
|
|
1813
|
-
<p class="description">Manage remote space providers where this identity's data is replicated.</p>
|
|
1814
|
-
<div id="replicas-list" class="replicas-list"> -->
|
|
1815
|
-
<!-- Configured space URLs listed here -->
|
|
1816
|
-
<!-- </div>
|
|
1817
|
-
<div class="input-row">
|
|
1818
|
-
<input type="url" id="input-replica-url" placeholder="https://space.example.com/api" class="text-input" disabled>
|
|
1819
|
-
<button id="btn-add-replica" class="action-btn secondary" disabled>Add Space</button>
|
|
1820
|
-
</div>
|
|
1821
|
-
</div> -->
|
|
1822
|
-
|
|
1823
|
-
<!-- Raw Keystone Timeline Explorer -->
|
|
1824
|
-
<div class="card accordion">
|
|
1825
|
-
<div id="raw-accordion-header" class="accordion-header">
|
|
1826
|
-
<span>Raw Keystone Timeline (JSON)</span>
|
|
1827
|
-
<span class="chevron">\u25BC</span>
|
|
1828
|
-
</div>
|
|
1829
|
-
<div id="raw-accordion-content" class="accordion-content">
|
|
1830
|
-
<pre id="raw-keystone-json" class="json-code"></pre>
|
|
1831
|
-
</div>
|
|
1832
|
-
</div>
|
|
1833
|
-
</div>
|
|
1834
|
-
</div>
|
|
1835
|
-
</div>`;var il="ibgib-identity-manager",Hn=class extends Le{static{f(this,"IdentityManagerComponentMeta")}lc="[IdentityManagerComponentMeta]";routeRegExp=new RegExp(`^${il}$`);componentName=il;constructor(){super(Ze()),customElements.get(this.componentName)||customElements.define(this.componentName,xi)}async createInstance({path:e,ibGibAddr:t}){let o=`${this.lc}[${this.createInstance.name}]`,i=document.createElement(this.componentName);return await i.initialize({ibGibAddr:t,meta:this,html:ol,css:[et,nl]}),i}},xi=class extends Xe{static{f(this,"IdentityManagerComponentInstance")}lc="[IdentityManagerComponentInstance]";activeAddr=null;globalActiveAddr=null;_onIdentityChanged=null;history=[];currentFrameIndex=-1;lastLoadedHistoryAddr=null;keystoneCache=new Map;constructor(){super()}async getKeystoneDetails(e){let t=this.keystoneCache.get(e);if(t)return t;let o=ae(se).metaspace;if(!o)return{username:"",description:""};let i=await o.getLocalUserSpace({lock:!1});if(!i)return{username:"",description:""};try{let s=await o.get({addr:e,space:i});if(s.success&&s.ibGibs&&s.ibGibs.length>0){let l=s.ibGibs[0],d=await new Fe().getAggregateDetails({latestKeystone:l,metaspace:o,space:i}),u=d?.username||d?.profile?.name||d?.name||"",p=d?.description||d?.profile?.description||"",m={username:u,description:p};return this.keystoneCache.set(e,m),m}}catch(s){console.warn(`Error getting details for keystone ${e}: ${y(s)}`)}return{username:"",description:""}}async initialize(e){await super.initialize(e)}async created(){this.elements={};let e=this.shadowRoot;this.elements.containerEl=e.getElementById("container"),this.elements.titleEl=e.getElementById("title"),this.elements.tabsListEl=e.getElementById("identity-tabs"),this.elements.btnAddIdentityEl=e.getElementById("btn-add-identity"),this.elements.noIdentityPlaceholderEl=e.getElementById("no-identity-placeholder"),this.elements.btnCreatePlaceholderEl=e.getElementById("btn-create-placeholder"),this.elements.identityDetailsViewEl=e.getElementById("identity-details-view"),this.elements.identityAddrEl=e.getElementById("identity-addr"),this.elements.identityGenEl=e.getElementById("identity-gen"),this.elements.identityTimestampEl=e.getElementById("identity-timestamp"),this.elements.identityUuidEl=e.getElementById("identity-uuid"),this.elements.identityNameEl=e.getElementById("identity-name"),this.elements.identityDescriptionEl=e.getElementById("identity-description"),this.elements.identityFrameDetailsEl=e.getElementById("identity-frame-details"),this.elements.identityAggrDetailsEl=e.getElementById("identity-aggr-details"),this.elements.btnScrubFirstEl=e.getElementById("btn-scrub-first"),this.elements.btnScrubPrev10El=e.getElementById("btn-scrub-prev10"),this.elements.btnScrubPrevEl=e.getElementById("btn-scrub-prev"),this.elements.scrubberStatusEl=e.getElementById("scrubber-status"),this.elements.btnScrubNextEl=e.getElementById("btn-scrub-next"),this.elements.btnScrubNext10El=e.getElementById("btn-scrub-next10"),this.elements.btnScrubLatestEl=e.getElementById("btn-scrub-latest"),this.elements.poolsContainerEl=e.getElementById("pools-container"),this.elements.btnVerifyChainEl=e.getElementById("btn-verify-chain"),this.elements.btnSetActiveEl=e.getElementById("btn-set-active"),this.elements.verificationStatusEl=e.getElementById("verification-status"),this.elements.replicasListEl=e.getElementById("replicas-list"),this.elements.rawAccordionHeaderEl=e.getElementById("raw-accordion-header"),this.elements.rawAccordionContentEl=e.getElementById("raw-accordion-content"),this.elements.rawKeystoneJsonEl=e.getElementById("raw-keystone-json"),this.elements.delegatesListEl=e.getElementById("delegates-list"),this.elements.contentEl=e.getElementById("identity-manager-content"),this.initHandlers(),this._onIdentityChanged=t=>{this.globalActiveAddr=t.detail?.activeIdentityAddr||null,this.renderUI()},window.addEventListener(Et,this._onIdentityChanged),this.ibGibAddr===q||!this.ibGib?await this.loadKeystonesIndex():await this.initSettings(),await this.renderUI()}async disconnected(){this._onIdentityChanged&&window.removeEventListener(Et,this._onIdentityChanged)}async loadKeystonesIndex(){let e=`${this.lc}[loadKeystonesIndex]`;try{let t=ae(se).metaspace;if(!t)return;let o=await t.getLocalUserSpace({lock:!1});if(!o)return;let i=await t.getSpecialIbGib({type:"keystones",space:o,initialize:!0});i&&(this.ibGibAddr=x({ibGib:i}),await this.loadIbGib(),await this.initSettings())}catch(t){console.error(`${e} ${y(t)}`)}}initHandlers(){this.elements.rawAccordionHeaderEl.addEventListener("click",()=>this.toggleAccordion()),this.elements.btnAddIdentityEl.addEventListener("click",()=>this.handleAddNewIdentityFlow()),this.elements.btnCreatePlaceholderEl.addEventListener("click",()=>this.handleAddNewIdentityFlow()),this.elements.btnVerifyChainEl.addEventListener("click",()=>this.handleVerifyIdentityChain()),this.elements.btnSetActiveEl.addEventListener("click",()=>this.handleSetActiveIdentity()),this.elements.btnScrubFirstEl.addEventListener("click",()=>this.scrubFirst()),this.elements.btnScrubPrev10El.addEventListener("click",()=>this.scrubPrev10()),this.elements.btnScrubPrevEl.addEventListener("click",()=>this.scrubPrev()),this.elements.btnScrubNextEl.addEventListener("click",()=>this.scrubNext()),this.elements.btnScrubNext10El.addEventListener("click",()=>this.scrubNext10()),this.elements.btnScrubLatestEl.addEventListener("click",()=>this.scrubLatest()),this.elements.tabsListEl.addEventListener("wheel",e=>{e.deltaY!==0&&(e.preventDefault(),this.elements.tabsListEl.scrollBy({left:e.deltaY,behavior:"smooth"}))},{passive:!1})}toggleAccordion(){let e=this.elements.rawAccordionHeaderEl,t=this.elements.rawAccordionContentEl;e.classList.toggle("expanded"),t.classList.toggle("expanded")}async handleAddNewIdentityFlow(){let e=`${this.lc}[${this.handleAddNewIdentityFlow.name}]`;W(`${e} Triggering identity creation/import flow...`);try{let o=await(await _e()).getComponentInstance({path:"ibgib-keystone-creator",ibGibAddr:q,useRegExpPrefilter:!0});if(o){this.elements.noIdentityPlaceholderEl.classList.add("hidden"),this.elements.identityDetailsViewEl.classList.add("hidden");let i=this.elements.contentEl.querySelector("ibgib-keystone-creator");i&&i.remove(),this.elements.contentEl.appendChild(o),W(`${e} Mounted ibgib-keystone-creator successfully.`)}else throw new Error("Could not find meta for ibgib-keystone-creator")}catch(t){console.error(`${e} ${y(t)}`),this.setVerificationStatus(`Failed to load creator: ${y(t)}`,"error")}}async handleVerifyIdentityChain(){let e=`${this.lc}[${this.handleVerifyIdentityChain.name}]`;W(`${e} Verifying identity keystone timeline...`),this.setVerificationStatus("Verification request sent...","info");try{this.setVerificationStatus("Verification complete. Root Keystone is verified (Genesis phase 1).","success")}catch(t){this.setVerificationStatus(`Verification failed: ${y(t)}`,"error")}}async handleSetActiveIdentity(){this.activeAddr&&window.dispatchEvent(new CustomEvent(Pe,{detail:{activeIdentityAddr:this.activeAddr},bubbles:!0,composed:!0}))}setVerificationStatus(e,t){let o=this.elements.verificationStatusEl;o.textContent=e,o.className=`status-msg ${t}`}async viewIdentityDetails(e){this.activeAddr=e,await this.renderUI()}async resolveActiveIdentity(){let e=`${this.lc}[resolveActiveIdentity]`;try{if(!this.settings){this.activeAddr=null,this.globalActiveAddr=null;return}let o=(await this.getSettings({settingsType:te.general,useCase:"current"}))?.activeIdentityAddr,i=this.ibGib?.rel8ns?.keystone??[];o&&i.includes(o)?this.globalActiveAddr=o:i.length>0?this.globalActiveAddr=i[0]:this.globalActiveAddr=null,this.activeAddr||(this.activeAddr=this.globalActiveAddr)}catch(t){console.error(`${e} ${y(t)}`),this.globalActiveAddr=null}}async renderUI(){let e=`${this.lc}[${this.renderUI.name}]`;if(!this.elements)return;await this.resolveActiveIdentity();let t=this.ibGib?.rel8ns?.keystone??[];if(t.length===0){this.elements.tabsListEl.innerHTML="",this.elements.noIdentityPlaceholderEl.classList.remove("hidden"),this.elements.identityDetailsViewEl.classList.add("hidden");let o=this.elements.contentEl.querySelector("ibgib-keystone-creator");o&&!this.elements.noIdentityPlaceholderEl.classList.contains("hidden")&&o.remove();return}this.elements.noIdentityPlaceholderEl.classList.add("hidden"),this.elements.tabsListEl.innerHTML="";for(let o of t){let i=document.createElement("button");i.className=`tab-btn ${o===this.activeAddr?"active":""} ${o===this.globalActiveAddr?"global-active":""}`;let s=o;s.length>12&&(s=s.substring(0,5)+"..."+s.substring(s.length-4)),i.textContent=s,i.title=o;let l=await this.getKeystoneDetails(o),c=l.username,d=16;c&&(c.length>d&&(c=c.substring(0,d-3)+"..."),i.textContent=c);let u=[];if(l.username&&u.push(`User: ${l.username}`),l.description){let p=l.description.length>100?l.description.substring(0,97)+"...":l.description;u.push(`Desc: ${p}`)}u.push(`Addr: ${o}`),i.title=u.join(`
|
|
1836
|
-
`),i.addEventListener("click",async()=>{await this.viewIdentityDetails(o)}),this.elements.tabsListEl.appendChild(i)}if(this.activeAddr){let o=this.elements.contentEl.querySelector("ibgib-keystone-creator");o&&o.remove(),this.elements.identityDetailsViewEl.classList.remove("hidden"),this.activeAddr===this.globalActiveAddr?(this.elements.btnSetActiveEl.disabled=!0,this.elements.btnSetActiveEl.textContent="Active Identity",this.elements.btnSetActiveEl.classList.add("active-primary")):(this.elements.btnSetActiveEl.disabled=!1,this.elements.btnSetActiveEl.textContent="Set as Active Identity",this.elements.btnSetActiveEl.classList.remove("active-primary")),this.activeAddr!==this.lastLoadedHistoryAddr&&(await this.loadHistory(this.activeAddr),this.lastLoadedHistoryAddr=this.activeAddr),await this.updateFrameDetailsView()}else this.elements.identityDetailsViewEl.classList.add("hidden"),this.clearActiveDetails()}clearActiveDetails(){this.elements&&(this.elements.identityGenEl.textContent="-",this.elements.identityTimestampEl.textContent="-",this.elements.identityUuidEl.textContent="-",this.elements.identityNameEl.textContent="-",this.elements.identityDescriptionEl.textContent="-",this.elements.identityFrameDetailsEl.textContent="{}",this.elements.identityAggrDetailsEl.textContent="{}",this.elements.scrubberStatusEl.textContent="Frame - / -",this.elements.poolsContainerEl.innerHTML="",this.elements.delegatesListEl&&(this.elements.delegatesListEl.innerHTML=""),this.history=[],this.currentFrameIndex=-1)}async loadHistory(e){let t=`${this.lc}[loadHistory]`;this.history=[],this.currentFrameIndex=-1;let o=ae(se).metaspace;if(!o)return;let i=await o.getLocalUserSpace({lock:!1});if(!i)return;let s=e,l=[];for(;s;){let c=await o.get({addr:s,space:i});if(!c.success||!c.ibGibs||c.ibGibs.length===0){console.warn(`${t} Could not find frame at ${s}`);break}let d=c.ibGibs[0];if(l.push(d),d.data?.n===0)break;let u=d.rel8ns?.past;s=u&&u.length>0?u[u.length-1]:void 0}this.history=l.reverse(),this.currentFrameIndex=this.history.length-1}scrubTo(e){this.history.length!==0&&(this.currentFrameIndex=Math.max(0,Math.min(e,this.history.length-1)),this.updateFrameDetailsView())}scrubFirst(){this.scrubTo(0)}scrubPrev10(){this.scrubTo(this.currentFrameIndex-10)}scrubPrev(){this.scrubTo(this.currentFrameIndex-1)}scrubNext(){this.scrubTo(this.currentFrameIndex+1)}scrubNext10(){this.scrubTo(this.currentFrameIndex+10)}scrubLatest(){this.scrubTo(this.history.length-1)}async updateFrameDetailsView(){let e=`${this.lc}[updateFrameDetailsView]`;if(!this.elements)return;if(this.history.length===0||this.currentFrameIndex<0||this.currentFrameIndex>=this.history.length){this.clearActiveDetails();return}let t=this.history[this.currentFrameIndex],o=x({ibGib:t});this.elements.identityAddrEl.textContent=o,this.elements.identityGenEl.textContent=t.data?.n!==void 0?String(t.data.n):"0 (Genesis)";let i=t.data?.timestamp,s="N/A";if(i){let d=parseInt(i);isNaN(d)?s=new Date(i).toLocaleString():s=new Date(d).toLocaleString()}this.elements.identityTimestampEl.textContent=s,this.elements.identityUuidEl.textContent=t.data?.uuid||"N/A",this.elements.scrubberStatusEl.textContent=`Frame ${this.currentFrameIndex+1} / ${this.history.length}`,this.elements.btnScrubFirstEl.disabled=this.currentFrameIndex===0,this.elements.btnScrubPrev10El.disabled=this.currentFrameIndex===0,this.elements.btnScrubPrevEl.disabled=this.currentFrameIndex===0,this.elements.btnScrubNextEl.disabled=this.currentFrameIndex===this.history.length-1,this.elements.btnScrubNext10El.disabled=this.currentFrameIndex===this.history.length-1,this.elements.btnScrubLatestEl.disabled=this.currentFrameIndex===this.history.length-1;let l=t.data?.frameDetails;this.elements.identityFrameDetailsEl.textContent=l?D(l):"{}";let c=ae(se).metaspace;if(c){let d=await c.getLocalUserSpace({lock:!1});if(d)try{let p=await new Fe().getAggregateDetails({latestKeystone:t,metaspace:c,space:d});this.elements.identityAggrDetailsEl.textContent=p?D(p):"{}",this.elements.identityNameEl.textContent=p?.username||p?.profile?.name||p?.name||"-",this.elements.identityDescriptionEl.textContent=p?.description||p?.profile?.description||"-"}catch(u){console.warn(`${e} Error aggregating details: ${y(u)}`),this.elements.identityAggrDetailsEl.textContent="{}",this.elements.identityNameEl.textContent="-",this.elements.identityDescriptionEl.textContent="-"}else this.elements.identityAggrDetailsEl.textContent="{}",this.elements.identityNameEl.textContent="-",this.elements.identityDescriptionEl.textContent="-"}else this.elements.identityAggrDetailsEl.textContent="{}",this.elements.identityNameEl.textContent="-",this.elements.identityDescriptionEl.textContent="-";this.elements.rawKeystoneJsonEl.textContent=D(t),this.renderChallengePools(t.data?.challengePools||[]),await this.renderDelegates(t.data?.delegates)}renderChallengePools(e){if(!this.elements)return;let t=this.elements.poolsContainerEl;if(t.innerHTML="",!e||e.length===0){t.innerHTML='<p class="description">No challenge pools found in this keystone.</p>';return}for(let o of e){let i=document.createElement("div");i.className="pool-card";let s=o.config||{},l=s.behavior||{},c=s.allowedVerbs||[],d=o.challenges?Object.keys(o.challenges).length:0,u=!!o.isForeign,p=o.challenges||{},m=Object.entries(p).map(([h,g])=>{let b=g.hash&&g.hash.length>20?g.hash.substring(0,10)+"..."+g.hash.substring(g.hash.length-8):g.hash||"N/A";return`
|
|
1837
|
-
<div class="pool-challenge-item">
|
|
1838
|
-
<span class="challenge-id">${h}</span>
|
|
1839
|
-
<span class="challenge-hash" title="${g.hash||""}">${b}</span>
|
|
1840
|
-
</div>
|
|
1841
|
-
`}).join("");i.innerHTML=`
|
|
1842
|
-
<div class="pool-header">
|
|
1843
|
-
<span class="pool-title">${o.id||"Unnamed Pool"}</span>
|
|
1844
|
-
<span class="pool-tag ${u?"foreign":"native"}">${u?"Foreign":"Native"}</span>
|
|
1845
|
-
</div>
|
|
1846
|
-
<div class="pool-grid">
|
|
1847
|
-
<div class="pool-field">
|
|
1848
|
-
<label>Challenge Type</label>
|
|
1849
|
-
<span>${s.type||"N/A"}</span>
|
|
1850
|
-
</div>
|
|
1851
|
-
<div class="pool-field">
|
|
1852
|
-
<label>Target Size</label>
|
|
1853
|
-
<span>${l.size??"N/A"}</span>
|
|
1854
|
-
</div>
|
|
1855
|
-
<div class="pool-field">
|
|
1856
|
-
<label>Active Challenges</label>
|
|
1857
|
-
<span>${d}</span>
|
|
1858
|
-
</div>
|
|
1859
|
-
<div class="pool-field">
|
|
1860
|
-
<label>Replenish Strategy</label>
|
|
1861
|
-
<span>${l.replenish||"N/A"}</span>
|
|
1862
|
-
</div>
|
|
1863
|
-
<div class="pool-field">
|
|
1864
|
-
<label>Allowed Verbs</label>
|
|
1865
|
-
<span>${c.length>0?c.join(", "):"Any"}</span>
|
|
1866
|
-
</div>
|
|
1867
|
-
<div class="pool-field">
|
|
1868
|
-
<label>FIFO / Random cost</label>
|
|
1869
|
-
<span>FIFO: ${l.selectSequentially??0}, Rand: ${l.selectRandomly??0}</span>
|
|
1870
|
-
</div>
|
|
1871
|
-
</div>
|
|
1872
|
-
|
|
1873
|
-
<!-- Collapsible Challenges List -->
|
|
1874
|
-
<details class="pool-details">
|
|
1875
|
-
<summary class="pool-details-summary">Challenges (${d})</summary>
|
|
1876
|
-
<div class="pool-challenges-list">
|
|
1877
|
-
${m||'<p class="placeholder-text" style="padding: 0.5rem; text-align: center;">No challenges active.</p>'}
|
|
1878
|
-
</div>
|
|
1879
|
-
</details>
|
|
1880
|
-
`,t.appendChild(i)}}async renderDelegates(e){if(!this.elements)return;let t=this.elements.delegatesListEl;if(t.innerHTML="",!e||Object.keys(e).length===0){t.innerHTML=`
|
|
1881
|
-
<tr>
|
|
1882
|
-
<td colspan="3" style="text-align: center; color: var(--clr-text-secondary, #b3b3b3);">
|
|
1883
|
-
No registered delegates.
|
|
1884
|
-
</td>
|
|
1885
|
-
</tr>
|
|
1886
|
-
`;return}for(let[o,i]of Object.entries(e)){let s=document.createElement("tr"),l=document.createElement("td");l.textContent="Loading...";let c=document.createElement("td");c.textContent=o,c.title=o;let d=document.createElement("td");d.textContent=i.allowedVerbs?i.allowedVerbs.join(", "):"-",d.title=d.textContent,s.appendChild(l),s.appendChild(c),s.appendChild(d),t.appendChild(s),i.delegateAddr?this.getKeystoneDetails(i.delegateAddr).then(u=>{let p=[];u.username&&p.push(u.username),u.description&&p.push(u.description),l.textContent=p.join(" / ")||"Unnamed Delegate",l.title=`Addr: ${i.delegateAddr}
|
|
1887
|
-
`+p.join(`
|
|
1888
|
-
`)}).catch(u=>{l.textContent="Unknown Delegate"}):l.textContent="No Address"}}async handleContextUpdated(){await this.renderUI()}};var rl=`:host {
|
|
1889
|
-
display: inline-block;
|
|
1890
|
-
vertical-align: middle;
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
|
-
.header-widget-container {
|
|
1894
|
-
display: flex;
|
|
1895
|
-
align-items: center;
|
|
1896
|
-
justify-content: flex-end;
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
/* Glassmorphic identity status pill */
|
|
1900
|
-
.identity-pill {
|
|
1901
|
-
display: flex;
|
|
1902
|
-
align-items: center;
|
|
1903
|
-
gap: 0.5rem;
|
|
1904
|
-
padding: 0.4rem 0.8rem;
|
|
1905
|
-
background: var(--tab-background-color-active, rgba(255, 255, 255, 0.1));
|
|
1906
|
-
border: 1px solid var(--tab-border-color-active, rgba(80, 250, 123, 0.3));
|
|
1907
|
-
border-radius: var(--radius-lg, 20px);
|
|
1908
|
-
cursor: default;
|
|
1909
|
-
transition: all 0.2s ease-in-out;
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
.identity-pill:hover {
|
|
1913
|
-
background: rgba(80, 250, 123, 0.15);
|
|
1914
|
-
border-color: var(--clr-accent, #50fa7b);
|
|
1915
|
-
box-shadow: 0 2px 8px rgba(80, 250, 123, 0.1);
|
|
1916
|
-
}
|
|
1917
|
-
|
|
1918
|
-
.avatar-circle {
|
|
1919
|
-
display: flex;
|
|
1920
|
-
align-items: center;
|
|
1921
|
-
justify-content: center;
|
|
1922
|
-
width: 24px;
|
|
1923
|
-
height: 24px;
|
|
1924
|
-
border-radius: 50%;
|
|
1925
|
-
font-size: 0.85rem;
|
|
1926
|
-
font-weight: 700;
|
|
1927
|
-
text-transform: uppercase;
|
|
1928
|
-
background: var(--clr-accent, #50fa7b);
|
|
1929
|
-
color: #11111b;
|
|
1930
|
-
flex-shrink: 0;
|
|
1931
|
-
}
|
|
1932
|
-
|
|
1933
|
-
.address-text {
|
|
1934
|
-
font-family: var(--font-sans, sans-serif);
|
|
1935
|
-
font-size: 0.85rem;
|
|
1936
|
-
color: var(--clr-text-primary, #ffffff);
|
|
1937
|
-
font-weight: 500;
|
|
1938
|
-
}
|
|
1939
|
-
|
|
1940
|
-
/* Fallback button when no identity is loaded */
|
|
1941
|
-
.action-btn {
|
|
1942
|
-
padding: 0.4rem 0.9rem;
|
|
1943
|
-
border-radius: 20px;
|
|
1944
|
-
font-size: 0.8rem;
|
|
1945
|
-
background: transparent;
|
|
1946
|
-
border: 1px dashed var(--clr-warn, #ffcc44);
|
|
1947
|
-
color: var(--clr-warn, #ffcc44);
|
|
1948
|
-
cursor: pointer;
|
|
1949
|
-
transition: all 0.2s ease-in-out;
|
|
1950
|
-
}
|
|
1951
|
-
|
|
1952
|
-
.action-btn:hover {
|
|
1953
|
-
background: rgba(255, 204, 68, 0.1);
|
|
1954
|
-
border-color: var(--clr-warn, #ffcc44);
|
|
1955
|
-
box-shadow: 0 0 8px rgba(255, 204, 68, 0.2);
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
.hidden {
|
|
1959
|
-
display: none !important;
|
|
1960
|
-
}
|
|
1961
|
-
|
|
1962
|
-
/* Styled selector dropdown */
|
|
1963
|
-
.identity-select {
|
|
1964
|
-
font-family: var(--font-sans, sans-serif);
|
|
1965
|
-
font-size: 0.85rem;
|
|
1966
|
-
color: var(--clr-text-primary, #ffffff);
|
|
1967
|
-
background: transparent;
|
|
1968
|
-
border: none;
|
|
1969
|
-
cursor: pointer;
|
|
1970
|
-
font-weight: 500;
|
|
1971
|
-
outline: none;
|
|
1972
|
-
padding: 0 0.2rem;
|
|
1973
|
-
max-width: 150px;
|
|
1974
|
-
text-overflow: ellipsis;
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
|
-
.identity-select option {
|
|
1978
|
-
background: var(--clr-bg-surface, #1e1e2e);
|
|
1979
|
-
color: var(--clr-text-primary, #ffffff);
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
/* Gear manage button */
|
|
1983
|
-
.manage-btn {
|
|
1984
|
-
background: transparent;
|
|
1985
|
-
border: none;
|
|
1986
|
-
font-size: 1rem;
|
|
1987
|
-
cursor: pointer;
|
|
1988
|
-
padding: 0 0.2rem;
|
|
1989
|
-
display: flex;
|
|
1990
|
-
align-items: center;
|
|
1991
|
-
justify-content: center;
|
|
1992
|
-
color: var(--clr-text-secondary, #b3b3b3);
|
|
1993
|
-
transition: color 0.2s ease, transform 0.2s ease;
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
.manage-btn:hover {
|
|
1997
|
-
color: var(--clr-accent, #50fa7b);
|
|
1998
|
-
transform: rotate(45deg);
|
|
1999
|
-
}
|
|
2000
|
-
`;var sl=`<div id="container" class="header-widget-container">
|
|
2001
|
-
<!-- Active Identity Pill -->
|
|
2002
|
-
<div id="active-identity-pill" class="identity-pill hidden">
|
|
2003
|
-
<div id="identity-avatar" class="avatar-circle">-</div>
|
|
2004
|
-
<select id="identity-selector" class="identity-select" title="Switch active identity"></select>
|
|
2005
|
-
<button id="btn-manage-identities" class="manage-btn" title="Manage Identities">\u2699\uFE0F</button>
|
|
2006
|
-
</div>
|
|
2007
|
-
|
|
2008
|
-
<!-- Fallback Action Button -->
|
|
2009
|
-
<button id="btn-create-identity" class="action-btn hidden" title="No active identity. Click to manage.">No Active Identity</button>
|
|
2010
|
-
</div>`;var al="ibgib-identity-header",qn=class extends Le{static{f(this,"IdentityHeaderComponentMeta")}lc="[IdentityHeaderComponentMeta]";routeRegExp=new RegExp(`^${al}$`);componentName=al;constructor(){super(Ze()),customElements.get(this.componentName)||customElements.define(this.componentName,Pi)}async createInstance({path:e,ibGibAddr:t}){let o=document.createElement(this.componentName);return await o.initialize({ibGibAddr:t,meta:this,html:sl,css:[et,rl]}),o}},Pi=class extends Xe{static{f(this,"IdentityHeaderComponentInstance")}lc="[IdentityHeaderComponentInstance]";activeAddr=null;_onRequestIdentityChange=null;keystoneCache=new Map;constructor(){super()}async getKeystoneDetails(e){let t=this.keystoneCache.get(e);if(t)return t;let o=ae(se).metaspace;if(!o)return{username:"",description:""};let i=await o.getLocalUserSpace({lock:!1});if(!i)return{username:"",description:""};try{let s=await o.get({addr:e,space:i});if(s.success&&s.ibGibs&&s.ibGibs.length>0){let l=s.ibGibs[0],d=await new Fe().getAggregateDetails({latestKeystone:l,metaspace:o,space:i}),u=d?.username||d?.profile?.name||d?.name||"",p=d?.description||d?.profile?.description||"",m={username:u,description:p};return this.keystoneCache.set(e,m),m}}catch(s){console.warn(`Error getting details for keystone ${e}: ${y(s)}`)}return{username:"",description:""}}async initialize(e){await super.initialize(e)}async created(){this.elements={};let e=this.shadowRoot;this.elements.containerEl=e.getElementById("container"),this.elements.activeIdentityPillEl=e.getElementById("active-identity-pill"),this.elements.identitySelectorEl=e.getElementById("identity-selector"),this.elements.btnManageIdentitiesEl=e.getElementById("btn-manage-identities"),this.elements.btnCreateIdentityEl=e.getElementById("btn-create-identity"),this.elements.identityAvatarEl=e.getElementById("identity-avatar"),this.elements.contentEl=this.elements.containerEl,this.initHandlers(),this._onRequestIdentityChange=t=>this.handleRequestIdentityChange(t),window.addEventListener(Pe,this._onRequestIdentityChange),this.ibGibAddr===q||!this.ibGib?await this.loadKeystonesIndex():await this.initSettings(),await this.renderUI()}async loadKeystonesIndex(){let e=`${this.lc}[loadKeystonesIndex]`;try{let t=ae(se).metaspace;if(!t)return;let o=await t.getLocalUserSpace({lock:!1});if(!o)return;let i=await t.getSpecialIbGib({type:"keystones",space:o,initialize:!0});i&&(this.ibGibAddr=x({ibGib:i}),await this.loadIbGib(),await this.initSettings())}catch(t){console.error(`${e} ${y(t)}`)}}async disconnected(){this._onRequestIdentityChange&&window.removeEventListener(Pe,this._onRequestIdentityChange)}initHandlers(){this.elements.btnCreateIdentityEl.addEventListener("click",()=>this.navigateToManager()),this.elements.btnManageIdentitiesEl.addEventListener("click",e=>{e.stopPropagation(),this.navigateToManager()}),this.elements.identitySelectorEl.addEventListener("click",e=>{e.stopPropagation()}),this.elements.identitySelectorEl.addEventListener("change",()=>{let e=this.elements.identitySelectorEl.value;e&&window.dispatchEvent(new CustomEvent(Pe,{detail:{activeIdentityAddr:e},bubbles:!0,composed:!0}))})}navigateToManager(){ll().showIdentityManager()}async resolveActiveIdentity(){let e=`${this.lc}[resolveActiveIdentity]`;try{if(!this.settings){this.activeAddr=null;let l=ae(se);l.identity=void 0;return}let o=(await this.getSettings({settingsType:te.general,useCase:"current"}))?.activeIdentityAddr,i=this.ibGib?.rel8ns?.keystone??[];o&&i.includes(o)?this.activeAddr=o:i.length>0?this.activeAddr=i[0]:this.activeAddr=null;let s=ae(se);if(this.activeAddr){let l=s.metaspace;if(l){let c=await l.getLocalUserSpace({lock:!1});if(c){let d=await l.get({addr:this.activeAddr,space:c});if(d.success&&d.ibGibs&&d.ibGibs.length>0){let u=d.ibGibs[0],p,m=u.data?.delegates;if(m){for(let h of Object.values(m))if(h.allowedVerbs?.includes("sync^gib")||!h.allowedVerbs&&h.delegateTjpAddr){let g=await l.getLatestAddr({addr:h.delegateTjpAddr,space:c});if(g){let b=await l.get({addr:g,space:c});if(b.success&&b.ibGibs&&b.ibGibs.length>0){p=b.ibGibs[0];break}}}}s.identity={resolved:!0,authenticated:!0,domainIdentity:u,syncDelegateIdentity:p}}}}}else s.identity={resolved:!1,authenticated:!1}}catch(t){console.error(`${e} ${y(t)}`),this.activeAddr=null;let o=ae(se);o.identity=void 0}}async renderUI(){if(!this.elements)return;await this.resolveActiveIdentity();let e=this.ibGib?.rel8ns?.keystone??[];if(this.activeAddr&&e.length>0){this.elements.activeIdentityPillEl.classList.remove("hidden"),this.elements.btnCreateIdentityEl.classList.add("hidden");let t=this.activeAddr;this.elements.identitySelectorEl.innerHTML="";for(let u of e){let p=document.createElement("option");p.value=u;let m=u;m.length>14&&(m=m.substring(0,7)+"..."+m.substring(m.length-5)),p.textContent=m,this.getKeystoneDetails(u).then(h=>{if(h.username){let g=h.username;g.length>14&&(g=g.substring(0,11)+"..."),p.textContent=g}}).catch(h=>{}),this.elements.identitySelectorEl.appendChild(p)}this.elements.identitySelectorEl.value=t,this.elements.identityAvatarEl.textContent="-",this.elements.identityAvatarEl.style.backgroundColor="var(--clr-accent)",this.elements.identityAvatarEl.style.color="#11111b";let o=await this.getKeystoneDetails(t),i="-";if(o.username)i=o.username.charAt(0).toUpperCase();else{let u=t.match(/[a-zA-Z]/);i=u?u[0].toUpperCase():"I"}if(!this.elements)throw new Error("(UNEXPECTED) this.elements falsy? (E: fd6bfa87c968a38c4860588818c3cd26)");this.elements.identityAvatarEl.textContent=i;let s=kt({ibGibAddr:t}),l=s.tjpColor||s.punctiliarColor,c=s.tjpColorContrast||s.punctiliarColorContrast;this.elements.identityAvatarEl.style.backgroundColor=l,this.elements.identityAvatarEl.style.color=c;let d=[];if(o.username&&d.push(`User: ${o.username}`),o.description){let u=o.description.length>100?o.description.substring(0,97)+"...":o.description;d.push(`Desc: ${u}`)}d.push(`Addr: ${t}`),this.elements.activeIdentityPillEl.title=d.join(`
|
|
2011
|
-
`)}else this.elements.activeIdentityPillEl.classList.add("hidden"),this.elements.btnCreateIdentityEl.classList.remove("hidden")}async handleRequestIdentityChange(e){let t=`${this.lc}[handleRequestIdentityChange]`,o=e.detail?.activeIdentityAddr;if(o){W(`${t} Request to change active identity to: ${o}`);try{if(!this.settings)return;let i=await this.getSettings({settingsType:te.general,useCase:"current"})??{type:"general"};i.activeIdentityAddr=o,await this.updateSettings({settingsType:te.general,useCase:"current",newSectionInfo:i}),await this.resolveActiveIdentity(),await this.renderUI(),window.dispatchEvent(new CustomEvent(Et,{detail:{activeIdentityAddr:o},bubbles:!0,composed:!0})),W(`${t} Successfully changed active identity settings to: ${o}`)}catch(i){console.error(`${t} Failed to switch active identity: ${y(i)}`)}}}async handleContextUpdated(){await this.renderUI()}};var Ni=class{static{f(this,"SpaceGibShellService")}lc="[SpaceGibShellService]";initialized;leftPanelState="collapsed";rightPanelState="collapsed";isResizingLeft=!1;isResizingRight=!1;isResizingFooter=!1;constructor(){this.initialized=this.initialize()}async initialize(){this.initElements(),this.initEventHandlers(),await this.registerComponents()}initElements(){let e=`${this.lc}[${this.initElements.name}]`;try{this.updateCssVariables()}catch(t){console.error(`${e} ${y(t)}`)}}initEventHandlers(){let e=`${this.lc}[${this.initEventHandlers.name}]`;try{let t=document.getElementById(Er);t&&t.addEventListener("click",()=>this.toggleLeftPanel());let o=document.getElementById(Ir);o&&o.addEventListener("click",()=>this.toggleRightPanel());let i=document.getElementById(gr);i&&(i.addEventListener("mousedown",()=>{this.leftPanelState==="expanded"&&(this.isResizingLeft=!0)}),i.addEventListener("dblclick",()=>this.toggleLeftPanel()));let s=document.getElementById(br);s&&(s.addEventListener("mousedown",()=>{this.rightPanelState==="expanded"&&(this.isResizingRight=!0)}),s.addEventListener("dblclick",()=>this.toggleRightPanel()));let l=document.getElementById(yr);l&&l.addEventListener("mousedown",()=>this.isResizingFooter=!0),window.addEventListener("mousemove",p=>this.handleMouseMove(p)),window.addEventListener("mouseup",()=>this.handleMouseUp());let c=document.getElementById(vr);c&&c.addEventListener("click",()=>this.showIdentityManager());let d,u=!1;window.addEventListener(yt,p=>{let{isBusy:m,title:h,msg:g,animationEmoji:b}=p.detail;m?(u=!0,d?d.update({title:h,msg:g,animationEmoji:b}):Qi({title:h||"Processing...",msg:g||"Please do not navigate away or refresh.",isBusy:!0,animationEmoji:b}).then(E=>{u?d=E:E.close()}).catch(E=>{console.error(`${e}[showFullscreenDialog] ${y(E)}`)})):(u=!1,d&&(d.close(),d=void 0))})}catch(t){console.error(`${e} ${y(t)}`)}}async showIdentityManager(){let e=`${this.lc}[${this.showIdentityManager.name}]`;try{let o=await(await _e()).getComponentInstance({path:"ibgib-identity-manager",ibGibAddr:q,useRegExpPrefilter:!0}),i=document.getElementById(Xn);i&&o&&(i.innerHTML="",i.appendChild(o))}catch(t){console.error(`${e} ${y(t)}`)}}async showKeystoneCreator(){let e=`${this.lc}[${this.showKeystoneCreator.name}]`;try{let o=await(await _e()).getComponentInstance({path:"ibgib-keystone-creator",ibGibAddr:q,useRegExpPrefilter:!0}),i=document.getElementById(Xn);i&&o&&(i.innerHTML="",i.appendChild(o))}catch(t){console.error(`${e} ${y(t)}`)}}toggleLeftPanel(){this.leftPanelState=this.leftPanelState==="expanded"?"collapsed":"expanded";let e=document.getElementById(mr);e&&(this.leftPanelState==="collapsed"?e.classList.add("collapsed"):e.classList.remove("collapsed"))}toggleRightPanel(){this.rightPanelState=this.rightPanelState==="expanded"?"collapsed":"expanded";let e=document.getElementById(hr);e&&(this.rightPanelState==="collapsed"?e.classList.add("collapsed"):e.classList.remove("collapsed"))}handleMouseMove(e){if(!(!this.isResizingLeft&&!this.isResizingRight&&!this.isResizingFooter)){if(e.preventDefault(),this.isResizingLeft){let t=Math.max(100,Math.min(e.clientX,600));document.documentElement.style.setProperty("--left-panel-width",`${t}px`)}if(this.isResizingRight){let t=Math.max(100,Math.min(window.innerWidth-e.clientX,600));document.documentElement.style.setProperty("--right-panel-width",`${t}px`)}if(this.isResizingFooter){let t=Math.max(24,Math.min(window.innerHeight-e.clientY,400));document.documentElement.style.setProperty("--footer-panel-height",`${t}px`)}}}handleMouseUp(){this.isResizingLeft=!1,this.isResizingRight=!1,this.isResizingFooter=!1}updateCssVariables(){}async registerComponents(){let e=`${this.lc}[${this.registerComponents.name}]`;try{let t=[new Vn,new Hn,new qn],o=await _e();for(let i of t)o.registerComponentMeta(i)}catch(t){throw console.error(`${e} ${y(t)}`),t}}async onEngineReady(){let e=`${this.lc}[${this.onEngineReady.name}]`;try{await this.initialized,console.log(`${e} SpaceGib Shell Service is ready.`);let t=document.getElementById("status-section");t&&(t.style.display="none");let i=await(await _e()).getComponentInstance({path:"ibgib-identity-header",ibGibAddr:q,useRegExpPrefilter:!0}),s=document.getElementById("identity-header-container");s&&i&&(s.innerHTML="",s.appendChild(i)),window.dispatchEvent(new CustomEvent(Xi,{detail:{timestamp:Date.now()}}))}catch(t){console.error(`${e} ${y(t)}`)}}};function ll(){let n="[getSpaceGibShellSvc]",e=ae(se);return e.spaceGibShellSvc||(typeof console<"u"&&console.log(`${n} initializing SpaceGibShellService singleton on globalThis... (I: genuuid)`),e.spaceGibShellSvc=new Ni),e.spaceGibShellSvc}f(ll,"getSpaceGibShellSvc");export{Ut as a,$r as b,qe as c,Be as d,Ft as e,Ne as f,Fg as g,Vg as h,O as i,Hg as j,Ie as k,Ke as l,dh as m,mt as n,kn as o,ll as p};
|
|
2012
|
-
/*! Bundled license information:
|
|
2013
|
-
|
|
2014
|
-
@google/genai/dist/web/index.mjs:
|
|
2015
|
-
(**
|
|
2016
|
-
* @license
|
|
2017
|
-
* Copyright 2025 Google LLC
|
|
2018
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2019
|
-
*)
|
|
2020
|
-
|
|
2021
|
-
@google/genai/dist/web/index.mjs:
|
|
2022
|
-
(**
|
|
2023
|
-
* @license
|
|
2024
|
-
* Copyright 2025 Google LLC
|
|
2025
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2026
|
-
*)
|
|
2027
|
-
|
|
2028
|
-
@google/genai/dist/web/index.mjs:
|
|
2029
|
-
(**
|
|
2030
|
-
* @license
|
|
2031
|
-
* Copyright 2025 Google LLC
|
|
2032
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2033
|
-
*)
|
|
2034
|
-
|
|
2035
|
-
@google/genai/dist/web/index.mjs:
|
|
2036
|
-
(**
|
|
2037
|
-
* @license
|
|
2038
|
-
* Copyright 2025 Google LLC
|
|
2039
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2040
|
-
*)
|
|
2041
|
-
|
|
2042
|
-
@google/genai/dist/web/index.mjs:
|
|
2043
|
-
(**
|
|
2044
|
-
* @license
|
|
2045
|
-
* Copyright 2025 Google LLC
|
|
2046
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2047
|
-
*)
|
|
2048
|
-
*/
|
|
2049
|
-
//# sourceMappingURL=chunk-SMOZ2D5E.mjs.map
|