@uploadcare/ai-enhancer 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{UcAiEnhancer-DK6rhHp7.js → UcAiEnhancer-BZeCfJ6W.js} +386 -370
- package/dist/{UcAiEnhancer-Co-HZ72E.cjs → UcAiEnhancer-h1VGkbGn.cjs} +32 -32
- package/dist/ai-enhancer.cjs +1 -1
- package/dist/ai-enhancer.d.ts +30 -3
- package/dist/ai-enhancer.js +1 -1
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +1 -1
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
var
|
|
1
|
+
var yt = Object.defineProperty;
|
|
2
2
|
var Ie = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var b = (t, e, i) =>
|
|
7
|
-
var
|
|
8
|
-
import { unsafeCSS as j, LitElement as G, html as f, nothing as
|
|
5
|
+
var wt = (t, e, i) => e in t ? yt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
6
|
+
var b = (t, e, i) => wt(t, typeof e != "symbol" ? e + "" : e, i), ce = (t, e, i) => e.has(t) || Ie("Cannot " + i);
|
|
7
|
+
var k = (t, e, i) => (ce(t, e, "read from private field"), i ? i.call(t) : e.get(t)), he = (t, e, i) => e.has(t) ? Ie("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), Pe = (t, e, i, r) => (ce(t, e, "write to private field"), r ? r.call(t, i) : e.set(t, i), i), J = (t, e, i) => (ce(t, e, "access private method"), i);
|
|
8
|
+
import { unsafeCSS as j, LitElement as G, html as f, nothing as g } from "lit";
|
|
9
9
|
import { property as c, state as C, query as F, customElement as H } from "lit/decorators.js";
|
|
10
10
|
import { classMap as S } from "lit/directives/class-map.js";
|
|
11
11
|
import { AiEnhancerError as Z } from "./errors.js";
|
|
12
12
|
import { unsafeSVG as re } from "lit/directives/unsafe-svg.js";
|
|
13
|
-
import { nothing as
|
|
14
|
-
import { directive as
|
|
15
|
-
import { AsyncDirective as
|
|
16
|
-
import { repeat as
|
|
17
|
-
import { ifDefined as
|
|
13
|
+
import { nothing as st } from "lit/html.js";
|
|
14
|
+
import { directive as ot, PartType as at } from "lit/directive.js";
|
|
15
|
+
import { AsyncDirective as nt } from "lit/async-directive.js";
|
|
16
|
+
import { repeat as xt } from "lit/directives/repeat.js";
|
|
17
|
+
import { ifDefined as Et } from "lit/directives/if-defined.js";
|
|
18
18
|
const V = "original";
|
|
19
|
-
function
|
|
19
|
+
function I(t) {
|
|
20
20
|
return t != null && t !== V;
|
|
21
21
|
}
|
|
22
22
|
function _e(t, e) {
|
|
23
|
-
return t === V || e === V ? t === e :
|
|
23
|
+
return t === V || e === V ? t === e : Ft(t, e);
|
|
24
24
|
}
|
|
25
25
|
const kt = [
|
|
26
26
|
[2, 3],
|
|
@@ -28,7 +28,7 @@ const kt = [
|
|
|
28
28
|
[1, 1],
|
|
29
29
|
[9, 16],
|
|
30
30
|
[16, 9]
|
|
31
|
-
],
|
|
31
|
+
], Rt = [3, 2], St = {
|
|
32
32
|
"1:1": "ai-enhancer-aspect-square",
|
|
33
33
|
"2:3": "ai-enhancer-aspect-tall",
|
|
34
34
|
"3:2": "ai-enhancer-aspect-wide",
|
|
@@ -36,23 +36,23 @@ const kt = [
|
|
|
36
36
|
"5:4": "ai-enhancer-aspect-landscape",
|
|
37
37
|
"9:16": "ai-enhancer-aspect-vertical",
|
|
38
38
|
"16:9": "ai-enhancer-aspect-widescreen"
|
|
39
|
-
},
|
|
40
|
-
function
|
|
39
|
+
}, Ct = 0.1, $t = 10;
|
|
40
|
+
function Ee(t) {
|
|
41
41
|
const [e, i] = t;
|
|
42
42
|
if (!Number.isFinite(e) || !Number.isFinite(i) || e <= 0 || i <= 0) return !1;
|
|
43
43
|
const r = e / i;
|
|
44
|
-
return r >=
|
|
44
|
+
return r >= Ct && r <= $t;
|
|
45
45
|
}
|
|
46
46
|
function ee(t) {
|
|
47
47
|
return `${t[0]}:${t[1]}`;
|
|
48
48
|
}
|
|
49
|
-
function $t(t) {
|
|
50
|
-
return Rt[ee(t)] ?? null;
|
|
51
|
-
}
|
|
52
49
|
function At(t) {
|
|
53
|
-
return
|
|
50
|
+
return St[ee(t)] ?? null;
|
|
54
51
|
}
|
|
55
52
|
function Ut(t) {
|
|
53
|
+
return { value: t, labelKey: At(t) };
|
|
54
|
+
}
|
|
55
|
+
function Tt(t) {
|
|
56
56
|
const e = [];
|
|
57
57
|
for (const i of t.split(/[\s,]+/)) {
|
|
58
58
|
const r = i.trim();
|
|
@@ -60,14 +60,14 @@ function Ut(t) {
|
|
|
60
60
|
const s = r.indexOf(":");
|
|
61
61
|
if (s === -1) continue;
|
|
62
62
|
const o = Number(r.slice(0, s)), a = Number(r.slice(s + 1)), n = [o, a];
|
|
63
|
-
|
|
63
|
+
Ee(n) && e.push(n);
|
|
64
64
|
}
|
|
65
65
|
return e;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function Ft(t, e) {
|
|
68
68
|
return t[0] === e[0] && t[1] === e[1];
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function Mt(t) {
|
|
71
71
|
const [e, i] = t, r = 12, s = e >= i ? r : r * (e / i), o = i >= e ? r : r * (i / e), a = (16 - s) / 2, n = (16 - o) / 2;
|
|
72
72
|
return `<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect x="${a.toFixed(2)}" y="${n.toFixed(2)}" width="${s.toFixed(2)}" height="${o.toFixed(2)}" rx="1.5" stroke="currentColor" stroke-width="1.4"/></svg>`;
|
|
73
73
|
}
|
|
@@ -76,13 +76,13 @@ class se extends Error {
|
|
|
76
76
|
super(i), this.name = "AiProviderError", this.errorCode = e, this.errorSource = r;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function Ot(t) {
|
|
80
80
|
const e = t == null ? void 0 : t.error;
|
|
81
81
|
return !!e && typeof e == "object" && typeof e.error_code == "string";
|
|
82
82
|
}
|
|
83
83
|
async function Q(t, e) {
|
|
84
84
|
}
|
|
85
|
-
async function
|
|
85
|
+
async function Le(t, e) {
|
|
86
86
|
const i = await t.text().catch(() => "");
|
|
87
87
|
let r = null;
|
|
88
88
|
if (i)
|
|
@@ -90,7 +90,7 @@ async function Pe(t, e) {
|
|
|
90
90
|
r = JSON.parse(i);
|
|
91
91
|
} catch {
|
|
92
92
|
}
|
|
93
|
-
if (
|
|
93
|
+
if (Ot(r)) {
|
|
94
94
|
const { error_code: s, content: o } = r.error;
|
|
95
95
|
throw new se(s, o ?? s);
|
|
96
96
|
}
|
|
@@ -130,7 +130,7 @@ class It {
|
|
|
130
130
|
async getJobStatus(e, i) {
|
|
131
131
|
const r = new URL("/derivative/status/", this.baseUrl);
|
|
132
132
|
r.searchParams.set("pub_key", this.publicKey), r.searchParams.set("job_id", e);
|
|
133
|
-
const s = await this.doFetch(r.href, { method: "GET", headers: { Accept: "application/json" }, signal: i }), o = await
|
|
133
|
+
const s = await this.doFetch(r.href, { method: "GET", headers: { Accept: "application/json" }, signal: i }), o = await Le(s, "generate status");
|
|
134
134
|
return await Q(), o;
|
|
135
135
|
}
|
|
136
136
|
async startJob(e, i, r, s) {
|
|
@@ -139,18 +139,18 @@ class It {
|
|
|
139
139
|
headers: { "Content-Type": "application/json", Accept: "application/json" },
|
|
140
140
|
body: JSON.stringify(i),
|
|
141
141
|
signal: s
|
|
142
|
-
}), a = await
|
|
142
|
+
}), a = await Le(o, r);
|
|
143
143
|
return await Q(), a;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
const
|
|
147
|
-
function
|
|
146
|
+
const lt = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", Pt = new RegExp(`^${lt}$`, "i"), Lt = new RegExp(`^(${lt})~([0-9]+)$`, "i");
|
|
147
|
+
function ke(t) {
|
|
148
148
|
return t.replace(/\/+$/, "");
|
|
149
149
|
}
|
|
150
150
|
function ge(t, e = "size") {
|
|
151
151
|
return typeof t == "number" ? String(t) : t.replace("%", "p");
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function ct(t, e, i = "dimensions") {
|
|
154
154
|
const r = t == null ? "" : ge(t, `${i} width`), s = e == null ? "" : ge(e, `${i} height`);
|
|
155
155
|
return `${r}x${s}`;
|
|
156
156
|
}
|
|
@@ -160,15 +160,15 @@ function ze(t, e) {
|
|
|
160
160
|
function zt(t, e = "alignment") {
|
|
161
161
|
return typeof t == "string" ? t : `${ze(t.x, `${e} x`)},${ze(t.y, `${e} y`)}`;
|
|
162
162
|
}
|
|
163
|
-
const
|
|
163
|
+
const Dt = [
|
|
164
164
|
"video",
|
|
165
165
|
"document",
|
|
166
166
|
"gif2video"
|
|
167
|
-
],
|
|
168
|
-
function
|
|
169
|
-
return t != null &&
|
|
167
|
+
], Nt = /\/(https?:\/\/.+)$/i;
|
|
168
|
+
function Bt(t) {
|
|
169
|
+
return t != null && Dt.includes(t);
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function ht(t) {
|
|
172
172
|
var _;
|
|
173
173
|
let e;
|
|
174
174
|
try {
|
|
@@ -176,20 +176,20 @@ function ct(t) {
|
|
|
176
176
|
} catch {
|
|
177
177
|
throw new TypeError(`Invalid URL: "${t}"`);
|
|
178
178
|
}
|
|
179
|
-
const i = `${e.protocol}//${e.host}`, r = e.pathname, s = (_ = r.match(
|
|
179
|
+
const i = `${e.protocol}//${e.host}`, r = e.pathname, s = (_ = r.match(Nt)) == null ? void 0 : _[1];
|
|
180
180
|
if (s !== void 0) {
|
|
181
181
|
const x = r.slice(0, r.length - s.length);
|
|
182
182
|
return {
|
|
183
183
|
kind: "proxy",
|
|
184
184
|
origin: i,
|
|
185
|
-
operations: ue(
|
|
185
|
+
operations: ue(De(x), "proxy prefix"),
|
|
186
186
|
sourceUrl: s + e.search + e.hash
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
const o = r.endsWith("/"), a =
|
|
189
|
+
const o = r.endsWith("/"), a = De(r), n = a.shift();
|
|
190
190
|
if (n === void 0)
|
|
191
191
|
throw new TypeError(`Not a CDN URL (empty path): "${t}"`);
|
|
192
|
-
const l = { origin: i, search: e.search, hash: e.hash }, h = n.match(
|
|
192
|
+
const l = { origin: i, search: e.search, hash: e.hash }, h = n.match(Lt);
|
|
193
193
|
if ((h == null ? void 0 : h[1]) !== void 0) {
|
|
194
194
|
const x = {
|
|
195
195
|
uuid: h[1],
|
|
@@ -200,7 +200,7 @@ function ct(t) {
|
|
|
200
200
|
if (!Number.isInteger(w))
|
|
201
201
|
throw new TypeError(`Invalid group element index in "${t}"`);
|
|
202
202
|
a.splice(0, 2);
|
|
203
|
-
const $ =
|
|
203
|
+
const $ = Ne(a, o);
|
|
204
204
|
return {
|
|
205
205
|
kind: "group-element",
|
|
206
206
|
...l,
|
|
@@ -214,13 +214,13 @@ function ct(t) {
|
|
|
214
214
|
throw new TypeError(`Unexpected path after group id in "${t}"`);
|
|
215
215
|
return { kind: "group", ...l, group: x };
|
|
216
216
|
}
|
|
217
|
-
if (!
|
|
217
|
+
if (!Pt.test(n))
|
|
218
218
|
throw new TypeError(
|
|
219
219
|
`Not a CDN URL (no uuid, group or proxy source): "${t}"`
|
|
220
220
|
);
|
|
221
221
|
let p = null;
|
|
222
|
-
|
|
223
|
-
const u =
|
|
222
|
+
Bt(a[0]) && (p = a[0], a.shift());
|
|
223
|
+
const u = Ne(a, o);
|
|
224
224
|
return {
|
|
225
225
|
kind: "file",
|
|
226
226
|
...l,
|
|
@@ -230,10 +230,10 @@ function ct(t) {
|
|
|
230
230
|
filename: u
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function De(t) {
|
|
234
234
|
return t.split("/").filter((e) => e !== "");
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function Ne(t, e) {
|
|
237
237
|
return e || t.length === 0 ? null : t.pop() ?? null;
|
|
238
238
|
}
|
|
239
239
|
function ue(t, e) {
|
|
@@ -259,11 +259,11 @@ function ue(t, e) {
|
|
|
259
259
|
}
|
|
260
260
|
return i;
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function ut(t) {
|
|
263
263
|
return t.map((e) => `-/${[e.name, ...e.params].join("/")}/`).join("");
|
|
264
264
|
}
|
|
265
|
-
function
|
|
266
|
-
const e =
|
|
265
|
+
function dt(t) {
|
|
266
|
+
const e = ke(t.origin), i = ut(t.operations ?? []);
|
|
267
267
|
if ("sourceUrl" in t && t.sourceUrl != null)
|
|
268
268
|
return `${e}/${i}${t.sourceUrl}`;
|
|
269
269
|
const r = ("search" in t ? t.search : "") ?? "", s = ("hash" in t ? t.hash : "") ?? "";
|
|
@@ -277,59 +277,59 @@ function ut(t) {
|
|
|
277
277
|
}
|
|
278
278
|
throw new TypeError("serializeCdnUrl requires one of: uuid, group, sourceUrl");
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function jt(t) {
|
|
281
281
|
return typeof t == "string" ? t : "opName" in t ? t.opName : t.name;
|
|
282
282
|
}
|
|
283
283
|
function de(t, e) {
|
|
284
|
-
const i =
|
|
284
|
+
const i = jt(e);
|
|
285
285
|
return t.name === i || t.name.startsWith(`${i}~`);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function pt(t, e) {
|
|
288
288
|
return Object.assign(e, { opName: t });
|
|
289
289
|
}
|
|
290
|
-
const
|
|
290
|
+
const Gt = (t, e) => {
|
|
291
291
|
const i = new URL(e);
|
|
292
292
|
return i.hostname = `${t}.${i.hostname}`, i.toString().replace(/\/$/, "");
|
|
293
|
-
},
|
|
293
|
+
}, Ht = "0123456789abcdefghijklmnopqrstuvwxyz", Wt = (t) => {
|
|
294
294
|
if (t <= 0n)
|
|
295
295
|
return "0";
|
|
296
296
|
let e = "";
|
|
297
297
|
for (; t > 0n; ) {
|
|
298
298
|
const i = t % 36n;
|
|
299
|
-
e =
|
|
299
|
+
e = Ht[Number(i)] + e, t = t / 36n;
|
|
300
300
|
}
|
|
301
301
|
return e;
|
|
302
|
-
},
|
|
302
|
+
}, Vt = (t, e) => {
|
|
303
303
|
try {
|
|
304
304
|
const i = new URL(t), r = new URL(e);
|
|
305
305
|
return i.hostname.endsWith(r.hostname);
|
|
306
306
|
} catch {
|
|
307
307
|
return !1;
|
|
308
308
|
}
|
|
309
|
-
},
|
|
309
|
+
}, qt = async (t) => {
|
|
310
310
|
const e = new TextEncoder().encode(t), i = await window.crypto.subtle.digest("SHA-256", e), r = Array.from(new Uint8Array(i)).map((s) => s.toString(16).padStart(2, "0")).join("");
|
|
311
311
|
return BigInt(`0x${r}`);
|
|
312
|
-
},
|
|
313
|
-
const e = await
|
|
314
|
-
return
|
|
315
|
-
},
|
|
316
|
-
const i = await
|
|
317
|
-
return
|
|
312
|
+
}, Kt = 10, Yt = async (t) => {
|
|
313
|
+
const e = await qt(t);
|
|
314
|
+
return Wt(e).slice(0, Kt);
|
|
315
|
+
}, Xt = async (t, e) => {
|
|
316
|
+
const i = await Yt(t);
|
|
317
|
+
return Gt(i, e);
|
|
318
318
|
};
|
|
319
|
-
function
|
|
319
|
+
function Be(t) {
|
|
320
320
|
return Object.prototype.toString.call(t) === "[object Object]";
|
|
321
321
|
}
|
|
322
|
-
const
|
|
323
|
-
function
|
|
324
|
-
return t.split(
|
|
322
|
+
const Jt = /\W|_/g;
|
|
323
|
+
function Zt(t) {
|
|
324
|
+
return t.split(Jt).map((e, i) => e.charAt(0)[i > 0 ? "toUpperCase" : "toLowerCase"]() + e.slice(1)).join("");
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function je(t, { ignoreKeys: e } = { ignoreKeys: [] }) {
|
|
327
327
|
return Array.isArray(t) ? t.map((i) => Re(i, { ignoreKeys: e })) : t;
|
|
328
328
|
}
|
|
329
329
|
function Re(t, { ignoreKeys: e } = { ignoreKeys: [] }) {
|
|
330
330
|
if (Array.isArray(t))
|
|
331
|
-
return
|
|
332
|
-
if (!
|
|
331
|
+
return je(t, { ignoreKeys: e });
|
|
332
|
+
if (!Be(t))
|
|
333
333
|
return t;
|
|
334
334
|
const i = {};
|
|
335
335
|
for (const r of Object.keys(t)) {
|
|
@@ -338,12 +338,12 @@ function Re(t, { ignoreKeys: e } = { ignoreKeys: [] }) {
|
|
|
338
338
|
i[r] = s;
|
|
339
339
|
continue;
|
|
340
340
|
}
|
|
341
|
-
|
|
341
|
+
Be(s) ? s = Re(s, { ignoreKeys: e }) : Array.isArray(s) && (s = je(s, { ignoreKeys: e })), i[Zt(r)] = s;
|
|
342
342
|
}
|
|
343
343
|
return i;
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
function
|
|
345
|
+
const Qt = (t) => new Promise((e) => setTimeout(e, t));
|
|
346
|
+
function ei({ libraryName: t, libraryVersion: e, userAgent: i, publicKey: r = "", integration: s = "" }) {
|
|
347
347
|
const o = "JavaScript";
|
|
348
348
|
if (typeof i == "string")
|
|
349
349
|
return i;
|
|
@@ -358,17 +358,17 @@ function Qt({ libraryName: t, libraryVersion: e, userAgent: i, publicKey: r = ""
|
|
|
358
358
|
const a = [t, e, r].filter(Boolean).join("/"), n = [o, s].filter(Boolean).join("; ");
|
|
359
359
|
return `${a} (${n})`;
|
|
360
360
|
}
|
|
361
|
-
const
|
|
361
|
+
const ti = {
|
|
362
362
|
factor: 2,
|
|
363
363
|
time: 100
|
|
364
364
|
};
|
|
365
|
-
function
|
|
365
|
+
function ii(t, e = ti) {
|
|
366
366
|
let i = 0;
|
|
367
367
|
function r(s) {
|
|
368
368
|
const o = Math.round(e.time * e.factor ** i);
|
|
369
369
|
return s({
|
|
370
370
|
attempt: i,
|
|
371
|
-
retry: (n) =>
|
|
371
|
+
retry: (n) => Qt(n ?? o).then(() => (i += 1, r(s)))
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
374
|
return r(t);
|
|
@@ -382,7 +382,7 @@ class oe extends Se {
|
|
|
382
382
|
this.name = "NetworkError", this.message = "Network error", Object.setPrototypeOf(this, oe.prototype), this.originalProgressEvent = i;
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
|
-
const
|
|
385
|
+
const ri = (t, e) => {
|
|
386
386
|
t && (t.aborted ? Promise.resolve().then(e) : t.addEventListener("abort", () => e(), { once: !0 }));
|
|
387
387
|
};
|
|
388
388
|
class Ce extends Se {
|
|
@@ -397,13 +397,13 @@ const te = {
|
|
|
397
397
|
baseURL: "https://upload.uploadcare.com",
|
|
398
398
|
retryThrottledRequestMaxTimes: 1,
|
|
399
399
|
retryNetworkErrorMaxTimes: 3
|
|
400
|
-
},
|
|
400
|
+
}, si = ({ method: t, url: e, data: i, headers: r = {}, signal: s, onProgress: o }) => new Promise((a, n) => {
|
|
401
401
|
const l = new XMLHttpRequest(), h = (t == null ? void 0 : t.toUpperCase()) || "GET";
|
|
402
402
|
let p = !1;
|
|
403
403
|
l.open(h, e, !0), r && Object.entries(r).forEach((u) => {
|
|
404
404
|
const [_, x] = u;
|
|
405
405
|
typeof x < "u" && !Array.isArray(x) && l.setRequestHeader(_, x);
|
|
406
|
-
}), l.responseType = "text",
|
|
406
|
+
}), l.responseType = "text", ri(s, () => {
|
|
407
407
|
p = !0, l.abort(), n(new Ce());
|
|
408
408
|
}), l.onload = () => {
|
|
409
409
|
if (l.status != 200)
|
|
@@ -418,7 +418,7 @@ const te = {
|
|
|
418
418
|
onProgress: o
|
|
419
419
|
}, _ = l.getAllResponseHeaders().trim().split(/[\r\n]+/), x = {};
|
|
420
420
|
_.forEach(function(R) {
|
|
421
|
-
const
|
|
421
|
+
const O = R.split(": "), W = O.shift(), X = O.join(": ");
|
|
422
422
|
W && typeof W < "u" && (x[W] = X);
|
|
423
423
|
});
|
|
424
424
|
const w = l.response, $ = l.status;
|
|
@@ -448,7 +448,7 @@ class $e extends Se {
|
|
|
448
448
|
this.name = "UploadError", this.message = i, this.code = r, this.request = s, this.response = o, this.headers = a, Object.setPrototypeOf(this, $e.prototype);
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
const
|
|
451
|
+
const oi = (t) => {
|
|
452
452
|
const e = new URLSearchParams();
|
|
453
453
|
for (const [i, r] of Object.entries(t))
|
|
454
454
|
r && typeof r == "object" && !Array.isArray(r) ? Object.entries(r).filter((s) => s[1] ?? !1).forEach((s) => e.set(`${i}[${s[0]}]`, String(s[1]))) : Array.isArray(r) ? r.forEach((s) => {
|
|
@@ -457,48 +457,48 @@ const si = (t) => {
|
|
|
457
457
|
return e.toString();
|
|
458
458
|
}, ve = (t, e, i) => {
|
|
459
459
|
const r = new URL(t);
|
|
460
|
-
return r.pathname = (r.pathname + e).replace("//", "/"), i && (r.search =
|
|
460
|
+
return r.pathname = (r.pathname + e).replace("//", "/"), i && (r.search = oi(i)), r.toString();
|
|
461
461
|
};
|
|
462
|
-
var
|
|
463
|
-
const
|
|
464
|
-
function
|
|
465
|
-
return
|
|
466
|
-
libraryName:
|
|
467
|
-
libraryVersion:
|
|
462
|
+
var ai = "6.18.4";
|
|
463
|
+
const ni = "UploadcareUploadClient", li = ai;
|
|
464
|
+
function ci(t) {
|
|
465
|
+
return ei({
|
|
466
|
+
libraryName: ni,
|
|
467
|
+
libraryVersion: li,
|
|
468
468
|
...t
|
|
469
469
|
});
|
|
470
470
|
}
|
|
471
|
-
const
|
|
472
|
-
function
|
|
471
|
+
const hi = "RequestThrottledError", Ge = 15e3, ui = 1e3;
|
|
472
|
+
function di(t) {
|
|
473
473
|
const { headers: e } = t || {};
|
|
474
474
|
if (!e || typeof e["retry-after"] != "string")
|
|
475
|
-
return
|
|
475
|
+
return Ge;
|
|
476
476
|
const i = parseInt(e["retry-after"], 10);
|
|
477
|
-
return Number.isFinite(i) ? i * 1e3 :
|
|
477
|
+
return Number.isFinite(i) ? i * 1e3 : Ge;
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function pi(t, e) {
|
|
480
480
|
const { retryThrottledRequestMaxTimes: i, retryNetworkErrorMaxTimes: r } = e;
|
|
481
|
-
return
|
|
482
|
-
if ("response" in a && (a == null ? void 0 : a.code) ===
|
|
483
|
-
return o(
|
|
481
|
+
return ii(({ attempt: s, retry: o }) => t().catch((a) => {
|
|
482
|
+
if ("response" in a && (a == null ? void 0 : a.code) === hi && s < i)
|
|
483
|
+
return o(di(a));
|
|
484
484
|
if (a instanceof oe && s < r)
|
|
485
|
-
return o((s + 1) *
|
|
485
|
+
return o((s + 1) * ui);
|
|
486
486
|
throw a;
|
|
487
487
|
}));
|
|
488
488
|
}
|
|
489
|
-
var
|
|
489
|
+
var He;
|
|
490
490
|
(function(t) {
|
|
491
491
|
t.Token = "token", t.FileInfo = "file_info";
|
|
492
|
-
})(
|
|
493
|
-
var
|
|
492
|
+
})(He || (He = {}));
|
|
493
|
+
var We;
|
|
494
494
|
(function(t) {
|
|
495
495
|
t.Unknown = "unknown", t.Waiting = "waiting", t.Progress = "progress", t.Error = "error", t.Success = "success";
|
|
496
|
-
})(
|
|
497
|
-
function
|
|
498
|
-
return
|
|
496
|
+
})(We || (We = {}));
|
|
497
|
+
function fi(t, { publicKey: e, baseURL: i = te.baseURL, signal: r, source: s, integration: o, userAgent: a, retryThrottledRequestMaxTimes: n = te.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: l = te.retryNetworkErrorMaxTimes }) {
|
|
498
|
+
return pi(() => si({
|
|
499
499
|
method: "GET",
|
|
500
500
|
headers: {
|
|
501
|
-
"X-UC-User-Agent":
|
|
501
|
+
"X-UC-User-Agent": ci({ publicKey: e, integration: o, userAgent: a })
|
|
502
502
|
},
|
|
503
503
|
url: ve(i, "/info/", {
|
|
504
504
|
jsonerrors: 1,
|
|
@@ -514,10 +514,10 @@ function pi(t, { publicKey: e, baseURL: i = te.baseURL, signal: r, source: s, in
|
|
|
514
514
|
return _;
|
|
515
515
|
}), { retryThrottledRequestMaxTimes: n, retryNetworkErrorMaxTimes: l });
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function mi(t) {
|
|
518
518
|
return "defaultEffects" in t;
|
|
519
519
|
}
|
|
520
|
-
class
|
|
520
|
+
class Ve {
|
|
521
521
|
constructor(e, { baseCDN: i = te.baseCDN, fileName: r } = {}) {
|
|
522
522
|
b(this, "uuid");
|
|
523
523
|
b(this, "name");
|
|
@@ -535,28 +535,28 @@ class We {
|
|
|
535
535
|
b(this, "s3Bucket");
|
|
536
536
|
b(this, "defaultEffects", null);
|
|
537
537
|
const { uuid: s, s3Bucket: o } = e, a = ve(i, `${s}/`), n = o ? ve(`https://${o}.s3.amazonaws.com/`, `${s}/${e.filename}`) : null;
|
|
538
|
-
this.uuid = s, this.name = r || e.filename, this.size = e.size, this.isStored = e.isStored, this.isImage = e.isImage, this.mimeType = e.mimeType, this.cdnUrl = a, this.originalFilename = e.originalFilename, this.imageInfo = e.imageInfo, this.videoInfo = e.videoInfo, this.contentInfo = e.contentInfo, this.metadata = e.metadata || null, this.s3Bucket = o || null, this.s3Url = n,
|
|
538
|
+
this.uuid = s, this.name = r || e.filename, this.size = e.size, this.isStored = e.isStored, this.isImage = e.isImage, this.mimeType = e.mimeType, this.cdnUrl = a, this.originalFilename = e.originalFilename, this.imageInfo = e.imageInfo, this.videoInfo = e.videoInfo, this.contentInfo = e.contentInfo, this.metadata = e.metadata || null, this.s3Bucket = o || null, this.s3Url = n, mi(e) && (this.defaultEffects = e.defaultEffects);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
|
-
const
|
|
542
|
-
function
|
|
541
|
+
const _i = /\W|_/g;
|
|
542
|
+
function gi(t) {
|
|
543
543
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
544
544
|
}
|
|
545
|
-
function
|
|
546
|
-
return t.split(
|
|
545
|
+
function vi(t) {
|
|
546
|
+
return t.split(_i).map((e, i) => e && e.charAt(0)[i > 0 ? "toUpperCase" : "toLowerCase"]() + e.slice(1)).join("");
|
|
547
547
|
}
|
|
548
548
|
function be(t) {
|
|
549
549
|
if (Array.isArray(t))
|
|
550
550
|
return t.map((i) => be(i));
|
|
551
|
-
if (!
|
|
551
|
+
if (!gi(t))
|
|
552
552
|
return t;
|
|
553
553
|
const e = {};
|
|
554
554
|
for (const i of Object.keys(t))
|
|
555
|
-
e[
|
|
555
|
+
e[vi(i)] = be(t[i]);
|
|
556
556
|
return e;
|
|
557
557
|
}
|
|
558
|
-
const
|
|
559
|
-
function
|
|
558
|
+
const bi = [1, 1], qe = "https://ucarecdn.com", yi = 1500, wi = 1e6;
|
|
559
|
+
function xi(t, e) {
|
|
560
560
|
return new Promise((i, r) => {
|
|
561
561
|
if (e != null && e.aborted) {
|
|
562
562
|
r(new DOMException("Aborted", "AbortError"));
|
|
@@ -570,10 +570,10 @@ function wi(t, e) {
|
|
|
570
570
|
e == null || e.addEventListener("abort", o, { once: !0 });
|
|
571
571
|
});
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function Ke() {
|
|
574
574
|
return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
|
|
575
575
|
}
|
|
576
|
-
class
|
|
576
|
+
class Ei {
|
|
577
577
|
constructor(e) {
|
|
578
578
|
if (this.id = "uploadcare-derivative", !e.publicKey)
|
|
579
579
|
throw new Error("UploadcareDerivativeApi: publicKey is required");
|
|
@@ -581,7 +581,7 @@ class xi {
|
|
|
581
581
|
publicKey: e.publicKey,
|
|
582
582
|
baseUrl: e.baseUrl,
|
|
583
583
|
fetch: e.fetch
|
|
584
|
-
}), this.publicKey = e.publicKey, this.baseUrl = e.baseUrl, this.filename = e.filename ?? "generated.png", this.store = e.store, this.cname = e.cdnBaseUrl ??
|
|
584
|
+
}), this.publicKey = e.publicKey, this.baseUrl = e.baseUrl, this.filename = e.filename ?? "generated.png", this.store = e.store, this.cname = e.cdnBaseUrl ?? qe, this.cnamePrefixed = e.cdnCnamePrefixed ?? "https://ucarecd.net", this.pollIntervalMs = e.pollIntervalMs ?? yi, this.pollTimeoutMs = e.pollTimeoutMs ?? wi;
|
|
585
585
|
}
|
|
586
586
|
async generate(e) {
|
|
587
587
|
const i = await this.startJob(e);
|
|
@@ -593,7 +593,7 @@ class xi {
|
|
|
593
593
|
* the editor produced.
|
|
594
594
|
*/
|
|
595
595
|
async resolveCdnUrl(e) {
|
|
596
|
-
return
|
|
596
|
+
return dt({ origin: await this.getCdnBase(), uuid: e });
|
|
597
597
|
}
|
|
598
598
|
/**
|
|
599
599
|
* Resolve a stored file's full info (image dimensions, original filename,
|
|
@@ -602,13 +602,13 @@ class xi {
|
|
|
602
602
|
* true aspect ratio before the image decodes, and name outputs after it.
|
|
603
603
|
*/
|
|
604
604
|
async getFileInfo(e, i) {
|
|
605
|
-
const r = await
|
|
606
|
-
return new
|
|
605
|
+
const r = await fi(e, { publicKey: this.publicKey, baseURL: this.baseUrl, signal: i });
|
|
606
|
+
return new Ve(r, { baseCDN: await this.getCdnBase() });
|
|
607
607
|
}
|
|
608
608
|
async startJob(e) {
|
|
609
|
-
const i = e.aspectRatio &&
|
|
609
|
+
const i = e.aspectRatio && Ee(e.aspectRatio) ? [e.aspectRatio[0], e.aspectRatio[1]] : void 0, r = e.filename ?? this.filename, s = e.mode === "edit" ? await this.startEditJob(e, i, r, e.metadata) : await this.api.generate({
|
|
610
610
|
prompt: e.prompt,
|
|
611
|
-
aspectRatio: i ??
|
|
611
|
+
aspectRatio: i ?? bi,
|
|
612
612
|
filename: r,
|
|
613
613
|
store: this.store,
|
|
614
614
|
signal: e.signal,
|
|
@@ -632,22 +632,22 @@ class xi {
|
|
|
632
632
|
});
|
|
633
633
|
}
|
|
634
634
|
async pollUntilDone(e, i) {
|
|
635
|
-
const r = this.pollTimeoutMs +
|
|
635
|
+
const r = this.pollTimeoutMs + Ke();
|
|
636
636
|
for (; ; ) {
|
|
637
637
|
const s = await this.api.getJobStatus(e, i.signal);
|
|
638
638
|
if (s.status === "success") {
|
|
639
639
|
if (!s.uuid)
|
|
640
640
|
throw new Error("Uploadcare derivative: response did not include a uuid");
|
|
641
|
-
const o = be(s), a = new
|
|
641
|
+
const o = be(s), a = new Ve(o, { baseCDN: await this.getCdnBase() });
|
|
642
642
|
return { url: a.cdnUrl, uuid: a.uuid, prompt: i.prompt, mode: i.mode, file: a };
|
|
643
643
|
}
|
|
644
644
|
if (s.status === "error") {
|
|
645
645
|
const o = s.error_code ?? "unknown", a = s.error ?? o;
|
|
646
646
|
throw new se(o, a, s.error_source);
|
|
647
647
|
}
|
|
648
|
-
if (
|
|
648
|
+
if (Ke() >= r)
|
|
649
649
|
throw new Error(`Uploadcare derivative: timed out waiting for job ${e}`);
|
|
650
|
-
await
|
|
650
|
+
await xi(this.pollIntervalMs, i.signal);
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
653
|
/**
|
|
@@ -656,7 +656,7 @@ class xi {
|
|
|
656
656
|
* applies in its `cdnCname` computed config. Computed once and cached.
|
|
657
657
|
*/
|
|
658
658
|
getCdnBase() {
|
|
659
|
-
return this.cdnBasePromise || (this.cdnBasePromise = this.cname ===
|
|
659
|
+
return this.cdnBasePromise || (this.cdnBasePromise = this.cname === qe || Vt(this.cname, this.cnamePrefixed) ? Xt(this.publicKey, this.cnamePrefixed) : Promise.resolve(this.cname)), this.cdnBasePromise;
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
662
|
function ki(t) {
|
|
@@ -722,8 +722,8 @@ const ye = {
|
|
|
722
722
|
}
|
|
723
723
|
]
|
|
724
724
|
}
|
|
725
|
-
},
|
|
726
|
-
class
|
|
725
|
+
}, Ye = 20;
|
|
726
|
+
class Ri {
|
|
727
727
|
constructor(e) {
|
|
728
728
|
this.busy = !1, this.resultUrl = null, this.result = null, this.error = null, this.errorCode = null, this.history = [], this._abortController = null, this._host = e, e.addController(this);
|
|
729
729
|
}
|
|
@@ -744,7 +744,7 @@ class Ei {
|
|
|
744
744
|
/** Replace the strip with entries hydrated from storage (e.g. when the editor
|
|
745
745
|
* opens on a source whose lineage was generated in a past session). */
|
|
746
746
|
setHistory(e) {
|
|
747
|
-
this.history = e.slice(0,
|
|
747
|
+
this.history = e.slice(0, Ye), this._host.requestUpdate();
|
|
748
748
|
}
|
|
749
749
|
setResult(e) {
|
|
750
750
|
this.resultUrl = e.url, this.result = e, this.error = null, this.errorCode = null, this._host.requestUpdate();
|
|
@@ -775,7 +775,7 @@ class Ei {
|
|
|
775
775
|
ratio: e.ratioValue ?? null
|
|
776
776
|
},
|
|
777
777
|
...this.history
|
|
778
|
-
].slice(0,
|
|
778
|
+
].slice(0, Ye), s);
|
|
779
779
|
} catch (s) {
|
|
780
780
|
if ((s == null ? void 0 : s.name) === "AbortError") return null;
|
|
781
781
|
throw this.error = s.message || "Generation failed", this.errorCode = s instanceof se ? s.errorCode : null, s;
|
|
@@ -784,7 +784,7 @@ class Ei {
|
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
786
|
}
|
|
787
|
-
const
|
|
787
|
+
const Si = {
|
|
788
788
|
"ai-enhancer-source-label": "Generate image",
|
|
789
789
|
"ai-enhancer-file-action-label": "AI Edit",
|
|
790
790
|
"ai-enhancer-generate-title": "Generate image",
|
|
@@ -809,7 +809,7 @@ const Ri = {
|
|
|
809
809
|
"ai-enhancer-aspect-landscape": "Landscape",
|
|
810
810
|
"ai-enhancer-aspect-vertical": "Vertical",
|
|
811
811
|
"ai-enhancer-aspect-widescreen": "Widescreen"
|
|
812
|
-
},
|
|
812
|
+
}, Ci = {
|
|
813
813
|
// Platform validation (POST generate/edit/outpaint, GET status)
|
|
814
814
|
"ai-enhancer-error-invalid_request": "Something went wrong with the request. Please try again.",
|
|
815
815
|
"ai-enhancer-error-invalid_source": "The source image couldn't be read. Please try a different image.",
|
|
@@ -833,7 +833,7 @@ const Ri = {
|
|
|
833
833
|
"ai-enhancer-error-DownloadFileHTTPClientError": "Couldn't retrieve the generated image. Please try again.",
|
|
834
834
|
"ai-enhancer-error-DownloadFileNotFoundError": "The generated image couldn't be found. Please try again.",
|
|
835
835
|
"ai-enhancer-error-DownloadFileTaskFailedError": "Couldn't save the generated image. Please try again."
|
|
836
|
-
}, B = { ...
|
|
836
|
+
}, B = { ...Si, ...Ci }, pe = {
|
|
837
837
|
en: async () => B,
|
|
838
838
|
ar: () => import("./ar-0rfB4z3f.js").then((t) => t.default),
|
|
839
839
|
az: () => import("./az-CyK2FKx4.js").then((t) => t.default),
|
|
@@ -870,12 +870,12 @@ const Ri = {
|
|
|
870
870
|
zh: () => import("./zh-C0AOtYB8.js").then((t) => t.default),
|
|
871
871
|
"zh-TW": () => import("./zh-TW-BNfdfwdz.js").then((t) => t.default)
|
|
872
872
|
};
|
|
873
|
-
function
|
|
873
|
+
function $i(t, e) {
|
|
874
874
|
return (e == null ? void 0 : e[t]) ?? B[t];
|
|
875
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function Ai(t) {
|
|
877
877
|
if ("kind" in t) return t;
|
|
878
|
-
const e =
|
|
878
|
+
const e = ke(t.origin);
|
|
879
879
|
if ("sourceUrl" in t)
|
|
880
880
|
return {
|
|
881
881
|
kind: "proxy",
|
|
@@ -904,12 +904,12 @@ function $i(t) {
|
|
|
904
904
|
hash: r
|
|
905
905
|
};
|
|
906
906
|
}
|
|
907
|
-
var
|
|
908
|
-
let
|
|
907
|
+
var E, q, ie, M;
|
|
908
|
+
let Ui = (M = class {
|
|
909
909
|
constructor(e) {
|
|
910
910
|
he(this, q);
|
|
911
|
-
he(this,
|
|
912
|
-
|
|
911
|
+
he(this, E);
|
|
912
|
+
Pe(this, E, Ai(e));
|
|
913
913
|
}
|
|
914
914
|
/**
|
|
915
915
|
* Parses an existing CDN URL.
|
|
@@ -917,15 +917,15 @@ let Ai = (M = class {
|
|
|
917
917
|
* @throws TypeError when the URL cannot be interpreted as a CDN URL.
|
|
918
918
|
*/
|
|
919
919
|
static parse(e) {
|
|
920
|
-
return new M(
|
|
920
|
+
return new M(ht(e));
|
|
921
921
|
}
|
|
922
922
|
/** A defensive copy of the operation chain (empty for group root urls). */
|
|
923
923
|
get operations() {
|
|
924
|
-
return "operations" in
|
|
924
|
+
return "operations" in k(this, E) ? [...k(this, E).operations] : [];
|
|
925
925
|
}
|
|
926
926
|
/** The serialized URL string. */
|
|
927
927
|
get href() {
|
|
928
|
-
return
|
|
928
|
+
return dt(k(this, E));
|
|
929
929
|
}
|
|
930
930
|
/** Alias of {@link CdnUrl.href} for string coercion. */
|
|
931
931
|
toString() {
|
|
@@ -933,7 +933,7 @@ let Ai = (M = class {
|
|
|
933
933
|
}
|
|
934
934
|
/** The underlying {@link ParsedCdnUrl}, discriminated by `kind`. */
|
|
935
935
|
toJSON() {
|
|
936
|
-
return "operations" in
|
|
936
|
+
return "operations" in k(this, E) ? { ...k(this, E), operations: [...k(this, E).operations] } : { ...k(this, E) };
|
|
937
937
|
}
|
|
938
938
|
/**
|
|
939
939
|
* Appends operations to the chain.
|
|
@@ -973,54 +973,54 @@ let Ai = (M = class {
|
|
|
973
973
|
* @throws TypeError on group root and proxy urls.
|
|
974
974
|
*/
|
|
975
975
|
setFilename(e) {
|
|
976
|
-
return
|
|
976
|
+
return k(this, E).kind === "group" || k(this, E).kind === "proxy" ? this : new M({ ...k(this, E), filename: e });
|
|
977
977
|
}
|
|
978
978
|
/** Rebases the url onto another domain. */
|
|
979
979
|
setOrigin(e) {
|
|
980
|
-
return new M({ ...
|
|
980
|
+
return new M({ ...k(this, E), origin: ke(e) });
|
|
981
981
|
}
|
|
982
|
-
},
|
|
983
|
-
return "operations" in
|
|
984
|
-
...
|
|
985
|
-
operations: e(
|
|
982
|
+
}, E = new WeakMap(), q = new WeakSet(), ie = function(e) {
|
|
983
|
+
return "operations" in k(this, E) ? new M({
|
|
984
|
+
...k(this, E),
|
|
985
|
+
operations: e(k(this, E).operations)
|
|
986
986
|
}) : this;
|
|
987
987
|
}, M);
|
|
988
988
|
const we = (t, ...e) => ({
|
|
989
989
|
name: t,
|
|
990
990
|
params: e
|
|
991
|
-
}),
|
|
991
|
+
}), Ti = /* @__PURE__ */ pt(
|
|
992
992
|
"preview",
|
|
993
993
|
function(t, e) {
|
|
994
|
-
return t == null && e == null ? we("preview") : we("preview",
|
|
994
|
+
return t == null && e == null ? we("preview") : we("preview", ct(t, e, "preview"));
|
|
995
995
|
}
|
|
996
|
-
),
|
|
996
|
+
), Fi = /* @__PURE__ */ pt(
|
|
997
997
|
"scale_crop",
|
|
998
998
|
function(t, e, i = {}) {
|
|
999
|
-
const r = [
|
|
999
|
+
const r = [ct(t, e, "scale_crop")];
|
|
1000
1000
|
return i.type != null && r.push(i.type), i.align != null && r.push(zt(i.align, "scale_crop alignment")), we("scale_crop", ...r);
|
|
1001
1001
|
}
|
|
1002
|
-
),
|
|
1003
|
-
function
|
|
1002
|
+
), Mi = 3e3;
|
|
1003
|
+
function ft(t) {
|
|
1004
1004
|
const e = typeof window < "u" ? window.devicePixelRatio : 1;
|
|
1005
|
-
return Math.min(Math.ceil(t * Math.max(e, 1)),
|
|
1005
|
+
return Math.min(Math.ceil(t * Math.max(e, 1)), Mi);
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1007
|
+
function mt(t, e) {
|
|
1008
1008
|
if (e.length === 0) return t;
|
|
1009
1009
|
try {
|
|
1010
|
-
return
|
|
1010
|
+
return Ui.parse(t).with(...e).href;
|
|
1011
1011
|
} catch {
|
|
1012
1012
|
return t;
|
|
1013
1013
|
}
|
|
1014
1014
|
}
|
|
1015
|
-
function
|
|
1016
|
-
const i =
|
|
1017
|
-
return
|
|
1015
|
+
function Oi(t, e) {
|
|
1016
|
+
const i = ft(e);
|
|
1017
|
+
return mt(t, [Ti(i, i)]);
|
|
1018
1018
|
}
|
|
1019
1019
|
function Ii(t, e) {
|
|
1020
|
-
const i =
|
|
1021
|
-
return
|
|
1020
|
+
const i = ft(e);
|
|
1021
|
+
return mt(t, [Fi(i, i, { align: "center" })]);
|
|
1022
1022
|
}
|
|
1023
|
-
const
|
|
1023
|
+
const Pi = "uc-ai-enhancer/history", Xe = 200, Li = 10080 * 60 * 1e3;
|
|
1024
1024
|
class zi {
|
|
1025
1025
|
constructor(e) {
|
|
1026
1026
|
this._key = null, e.addController(this);
|
|
@@ -1029,7 +1029,7 @@ class zi {
|
|
|
1029
1029
|
}
|
|
1030
1030
|
/** Namespace the store by pubkey. Passing an empty key disables persistence. */
|
|
1031
1031
|
setNamespace(e) {
|
|
1032
|
-
this._key = e ? `${
|
|
1032
|
+
this._key = e ? `${Pi}/${e}` : null;
|
|
1033
1033
|
}
|
|
1034
1034
|
/** Upsert the result as a node and persist (evicting expired/overflowing nodes). */
|
|
1035
1035
|
record(e) {
|
|
@@ -1060,7 +1060,7 @@ class zi {
|
|
|
1060
1060
|
*/
|
|
1061
1061
|
lineage(e) {
|
|
1062
1062
|
const i = this._key;
|
|
1063
|
-
return !i || !e ? [] : this._component(this._read(i), e).sort((r, s) => s.createdAt - r.createdAt).map(
|
|
1063
|
+
return !i || !e ? [] : this._component(this._read(i), e).sort((r, s) => s.createdAt - r.createdAt).map(Di);
|
|
1064
1064
|
}
|
|
1065
1065
|
/** Nodes in `start`'s connected component, walking both parent and child edges.
|
|
1066
1066
|
* `start` may be a node itself or only a parent uuid (a source not yet edited). */
|
|
@@ -1086,8 +1086,8 @@ class zi {
|
|
|
1086
1086
|
* middle node just orphans its descendants (their lineage walk stops early). */
|
|
1087
1087
|
_evict(e) {
|
|
1088
1088
|
const i = Date.now();
|
|
1089
|
-
let r = Object.values(e).filter((o) => i - o.createdAt <
|
|
1090
|
-
r.length >
|
|
1089
|
+
let r = Object.values(e).filter((o) => i - o.createdAt < Li);
|
|
1090
|
+
r.length > Xe && (r = r.sort((o, a) => a.createdAt - o.createdAt).slice(0, Xe));
|
|
1091
1091
|
const s = {};
|
|
1092
1092
|
for (const o of r) s[o.uuid] = o;
|
|
1093
1093
|
return s;
|
|
@@ -1111,7 +1111,7 @@ class zi {
|
|
|
1111
1111
|
}
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1114
|
+
function Di(t) {
|
|
1115
1115
|
return {
|
|
1116
1116
|
id: t.uuid,
|
|
1117
1117
|
prompt: t.prompt,
|
|
@@ -1121,23 +1121,23 @@ function Li(t) {
|
|
|
1121
1121
|
ratio: t.ratio
|
|
1122
1122
|
};
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1124
|
+
function Ni(t) {
|
|
1125
1125
|
try {
|
|
1126
|
-
const e =
|
|
1126
|
+
const e = ht(t);
|
|
1127
1127
|
if (e.kind === "file")
|
|
1128
1128
|
return {
|
|
1129
1129
|
uuid: e.uuid,
|
|
1130
|
-
cdnUrlModifiers:
|
|
1130
|
+
cdnUrlModifiers: ut(e.operations),
|
|
1131
1131
|
fileName: e.filename ?? ""
|
|
1132
1132
|
};
|
|
1133
1133
|
} catch {
|
|
1134
1134
|
}
|
|
1135
1135
|
return { uuid: "", cdnUrlModifiers: "", fileName: "" };
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1138
|
-
return e ? e(t,
|
|
1137
|
+
function Bi(t, e) {
|
|
1138
|
+
return e ? e(t, Ni(t)) : t;
|
|
1139
1139
|
}
|
|
1140
|
-
class
|
|
1140
|
+
class _t {
|
|
1141
1141
|
constructor(e) {
|
|
1142
1142
|
this._cache = /* @__PURE__ */ new Map(), this._pending = /* @__PURE__ */ new Set(), this._host = e, e.addController(this);
|
|
1143
1143
|
}
|
|
@@ -1154,39 +1154,39 @@ class mt {
|
|
|
1154
1154
|
const i = this._cache.get(e);
|
|
1155
1155
|
if (i !== void 0) return i;
|
|
1156
1156
|
if (this._pending.has(e)) return null;
|
|
1157
|
-
const r =
|
|
1157
|
+
const r = Bi(e, this._resolver);
|
|
1158
1158
|
return typeof r == "string" ? (this._cache.set(e, r), r) : (this._pending.add(e), r.then((s) => this._cache.set(e, s)).catch(() => this._cache.set(e, e)).finally(() => {
|
|
1159
1159
|
this._pending.delete(e), this._host.requestUpdate();
|
|
1160
1160
|
}), null);
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
|
-
const
|
|
1163
|
+
const qr = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1164
1164
|
<path d="M9.5 3 11 6.5 14.5 8 11 9.5 9.5 13 8 9.5 4.5 8 8 6.5 9.5 3Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
|
|
1165
1165
|
<path d="M17.5 12 18.4 14.1 20.5 15 18.4 15.9 17.5 18 16.6 15.9 14.5 15 16.6 14.1 17.5 12Z" stroke="currentColor" stroke-width="1.25" stroke-linejoin="round"/>
|
|
1166
1166
|
<path d="M5.5 16 6.1 17.4 7.5 18 6.1 18.6 5.5 20 4.9 18.6 3.5 18 4.9 17.4 5.5 16Z" stroke="currentColor" stroke-width="1.25" stroke-linejoin="round"/>
|
|
1167
|
-
</svg>`,
|
|
1167
|
+
</svg>`, Kr = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1168
1168
|
<path d="m14.5 4.5 5 5L9 20H4v-5L14.5 4.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
|
|
1169
1169
|
<path d="m13 6 5 5" stroke="currentColor" stroke-width="1.5"/>
|
|
1170
1170
|
<path d="M18.5 14.5 19 16l1.5.5L19 17l-.5 1.5L18 17l-1.5-.5L18 16l.5-1.5Z" stroke="currentColor" stroke-width="1.1" stroke-linejoin="round"/>
|
|
1171
|
-
</svg>`, Bi = `<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1172
|
-
<path d="M3 6.74251L8 2L13 6.74251M7.99961 14V2.10636" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1173
1171
|
</svg>`, ji = `<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1172
|
+
<path d="M3 6.74251L8 2L13 6.74251M7.99961 14V2.10636" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1173
|
+
</svg>`, Gi = `<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1174
1174
|
<rect x="2" y="3" width="12" height="10" rx="1.6" stroke="currentColor" stroke-width="1.4"/>
|
|
1175
1175
|
<circle cx="5.75" cy="6.25" r="1.05" stroke="currentColor" stroke-width="1.2"/>
|
|
1176
1176
|
<path d="M3 11.5l3-2.6 2.3 1.8L11 8l2 2.4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1177
|
-
</svg>`, Gi = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1178
|
-
<path d="M9 4H4v5M15 4h5v5M9 20H4v-5M15 20h5v-5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1179
1177
|
</svg>`, Hi = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1178
|
+
<path d="M9 4H4v5M15 4h5v5M9 20H4v-5M15 20h5v-5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1179
|
+
</svg>`, Wi = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1180
1180
|
<path d="M4 9h5V4M20 9h-5V4M4 15h5v5M20 15h-5v5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1181
|
-
</svg>`,
|
|
1182
|
-
var
|
|
1183
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1181
|
+
</svg>`, Vi = ":host{display:inline-flex;position:relative}.trigger{anchor-name:--ai-aspect-anchor;display:inline-flex;align-items:center;gap:8px;height:var(--uc-ai-button-size);padding:0 10px;background:var(--uc-ai-secondary);border:0;border-radius:var(--uc-ai-radius-button);color:var(--uc-ai-foreground);cursor:pointer;font:inherit;transition:background var(--uc-ai-transition),transform .14s var(--uc-ai-ease-out, ease)}.trigger:hover,.trigger[aria-expanded=true]{background:var(--uc-ai-secondary-hover)}.trigger:active{transform:scale(.97)}.trigger:disabled{opacity:.4;cursor:not-allowed}.trigger svg{width:14px;height:14px;color:var(--uc-ai-foreground)}.trigger-label{font-variant-numeric:tabular-nums;font-size:12px;font-weight:500;letter-spacing:.02em;line-height:20px}.popover{margin:0 0 6px;padding:0;border:0;background:transparent;color:inherit;overflow:visible;width:max-content;min-width:180px;max-width:320px;position-anchor:--ai-aspect-anchor;inset:auto;bottom:anchor(top);right:anchor(right);transform-origin:bottom right;transition:opacity .15s var(--uc-ai-ease-out, ease),transform .15s var(--uc-ai-ease-out, ease),display .15s allow-discrete,overlay .15s allow-discrete}.popover:not(:popover-open){display:none;opacity:0;transform:scale(.96) translateY(4px)}@starting-style{.popover:popover-open{opacity:0;transform:scale(.96) translateY(4px)}}.popover-inner{background:var(--uc-ai-background);border:1px solid var(--uc-ai-border);border-radius:var(--uc-ai-radius-input, 12px);box-shadow:var(--uc-ai-dialog-shadow);padding:5px;display:flex;flex-direction:column;gap:2px}.option{display:flex;align-items:center;gap:10px;width:100%;padding:6px 10px;background:transparent;border:0;border-radius:max(0px,calc(var(--uc-ai-radius-input) - 5px));cursor:pointer;color:var(--uc-ai-foreground);font:inherit;font-size:13px;text-align:left;transition:background .12s ease}.option:hover{background:var(--uc-ai-secondary)}.option[aria-selected=true]{background:var(--uc-ai-secondary-hover)}.option svg{width:16px;height:16px;flex:0 0 16px;color:var(--uc-ai-foreground)}.option-ratio{flex:0 0 36px;font-variant-numeric:tabular-nums;font-weight:500;white-space:nowrap;color:var(--uc-ai-foreground)}.option-label{flex:1;min-width:0;color:var(--uc-ai-muted-foreground);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media(prefers-reduced-motion:reduce){.trigger,.popover{transition-property:opacity,background,display,overlay}.trigger:active{transform:none}.popover:not(:popover-open){transform:none}}";
|
|
1182
|
+
var qi = Object.defineProperty, Ki = Object.getOwnPropertyDescriptor, L = (t, e, i, r) => {
|
|
1183
|
+
for (var s = r > 1 ? void 0 : r ? Ki(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
1184
1184
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
1185
|
-
return r && s &&
|
|
1185
|
+
return r && s && qi(e, i, s), s;
|
|
1186
1186
|
};
|
|
1187
1187
|
let A = class extends G {
|
|
1188
1188
|
constructor() {
|
|
1189
|
-
super(...arguments), this.options = [], this.selected = null, this.busy = !1, this.labelText = null, this.labelFor = (t) =>
|
|
1189
|
+
super(...arguments), this.options = [], this.selected = null, this.busy = !1, this.labelText = null, this.labelFor = (t) => I(t.value) ? ee(t.value) : "", this.open = !1, this._onToggle = (t) => {
|
|
1190
1190
|
t.newState === "closed" && this.open && (this.open = !1);
|
|
1191
1191
|
};
|
|
1192
1192
|
}
|
|
@@ -1211,12 +1211,12 @@ let A = class extends G {
|
|
|
1211
1211
|
}
|
|
1212
1212
|
/** Icon for a selection: the ratio's shape, or the generic "Original" glyph. */
|
|
1213
1213
|
_iconFor(t) {
|
|
1214
|
-
return
|
|
1214
|
+
return I(t) ? Mt(t) : Gi;
|
|
1215
1215
|
}
|
|
1216
1216
|
_triggerLabel() {
|
|
1217
1217
|
const t = this.selected;
|
|
1218
1218
|
if (!t) return "";
|
|
1219
|
-
if (
|
|
1219
|
+
if (I(t)) return ee(t);
|
|
1220
1220
|
const e = this.options.find((i) => i.value === t);
|
|
1221
1221
|
return e ? this.labelFor(e) : "";
|
|
1222
1222
|
}
|
|
@@ -1248,7 +1248,7 @@ let A = class extends G {
|
|
|
1248
1248
|
@click=${() => this._select(e.value)}
|
|
1249
1249
|
>
|
|
1250
1250
|
${re(this._iconFor(e.value))}
|
|
1251
|
-
<span class="option-ratio">${
|
|
1251
|
+
<span class="option-ratio">${I(e.value) ? ee(e.value) : ""}</span>
|
|
1252
1252
|
<span class="option-label">${this.labelFor(e)}</span>
|
|
1253
1253
|
</button>
|
|
1254
1254
|
`;
|
|
@@ -1258,59 +1258,59 @@ let A = class extends G {
|
|
|
1258
1258
|
`;
|
|
1259
1259
|
}
|
|
1260
1260
|
};
|
|
1261
|
-
A.styles = j(
|
|
1262
|
-
|
|
1261
|
+
A.styles = j(Vi);
|
|
1262
|
+
L([
|
|
1263
1263
|
c({ attribute: !1 })
|
|
1264
1264
|
], A.prototype, "options", 2);
|
|
1265
|
-
|
|
1265
|
+
L([
|
|
1266
1266
|
c({ attribute: !1 })
|
|
1267
1267
|
], A.prototype, "selected", 2);
|
|
1268
|
-
|
|
1268
|
+
L([
|
|
1269
1269
|
c({ type: Boolean })
|
|
1270
1270
|
], A.prototype, "busy", 2);
|
|
1271
|
-
|
|
1271
|
+
L([
|
|
1272
1272
|
c({ attribute: "aria-label-text" })
|
|
1273
1273
|
], A.prototype, "labelText", 2);
|
|
1274
|
-
|
|
1274
|
+
L([
|
|
1275
1275
|
c({ attribute: !1 })
|
|
1276
1276
|
], A.prototype, "labelFor", 2);
|
|
1277
|
-
|
|
1277
|
+
L([
|
|
1278
1278
|
C()
|
|
1279
1279
|
], A.prototype, "open", 2);
|
|
1280
|
-
|
|
1280
|
+
L([
|
|
1281
1281
|
F(".popover")
|
|
1282
1282
|
], A.prototype, "_popover", 2);
|
|
1283
|
-
A =
|
|
1283
|
+
A = L([
|
|
1284
1284
|
H("uc-ai-aspect-ratio")
|
|
1285
1285
|
], A);
|
|
1286
|
-
const
|
|
1287
|
-
let
|
|
1288
|
-
const fe = /* @__PURE__ */ new Map(),
|
|
1286
|
+
const Yi = /* @__PURE__ */ new WeakMap();
|
|
1287
|
+
let Je = 0;
|
|
1288
|
+
const fe = /* @__PURE__ */ new Map(), Ze = /* @__PURE__ */ new WeakSet(), Qe = () => new Promise((t) => requestAnimationFrame(t)), et = (t, e) => {
|
|
1289
1289
|
const i = t - e;
|
|
1290
1290
|
return i === 0 ? void 0 : i;
|
|
1291
|
-
},
|
|
1291
|
+
}, tt = (t, e) => {
|
|
1292
1292
|
const i = t / e;
|
|
1293
1293
|
return i === 1 ? void 0 : i;
|
|
1294
1294
|
}, me = { left: (t, e) => {
|
|
1295
|
-
const i =
|
|
1295
|
+
const i = et(t, e);
|
|
1296
1296
|
return { value: i, transform: i == null || isNaN(i) ? void 0 : `translateX(${i}px)` };
|
|
1297
1297
|
}, top: (t, e) => {
|
|
1298
|
-
const i =
|
|
1298
|
+
const i = et(t, e);
|
|
1299
1299
|
return { value: i, transform: i == null || isNaN(i) ? void 0 : `translateY(${i}px)` };
|
|
1300
1300
|
}, width: (t, e) => {
|
|
1301
1301
|
let i;
|
|
1302
1302
|
e === 0 && (e = 1, i = { width: "1px" });
|
|
1303
|
-
const r =
|
|
1303
|
+
const r = tt(t, e);
|
|
1304
1304
|
return { value: r, overrideFrom: i, transform: r == null || isNaN(r) ? void 0 : `scaleX(${r})` };
|
|
1305
1305
|
}, height: (t, e) => {
|
|
1306
1306
|
let i;
|
|
1307
1307
|
e === 0 && (e = 1, i = { height: "1px" });
|
|
1308
|
-
const r =
|
|
1308
|
+
const r = tt(t, e);
|
|
1309
1309
|
return { value: r, overrideFrom: i, transform: r == null || isNaN(r) ? void 0 : `scaleY(${r})` };
|
|
1310
|
-
} },
|
|
1311
|
-
class
|
|
1310
|
+
} }, Xi = { duration: 333, easing: "ease-in-out" }, Ji = ["left", "top", "width", "height", "opacity", "color", "background"], it = /* @__PURE__ */ new WeakMap();
|
|
1311
|
+
class Zi extends nt {
|
|
1312
1312
|
constructor(e) {
|
|
1313
|
-
if (super(e), this.t = !1, this.i = null, this.o = null, this.h = !0, this.shouldLog = !1, e.type ===
|
|
1313
|
+
if (super(e), this.t = !1, this.i = null, this.o = null, this.h = !0, this.shouldLog = !1, e.type === at.CHILD) throw Error("The `animate` directive must be used in attribute position.");
|
|
1314
1314
|
this.createFinished();
|
|
1315
1315
|
}
|
|
1316
1316
|
createFinished() {
|
|
@@ -1324,10 +1324,10 @@ class Ji extends at {
|
|
|
1324
1324
|
(e = this.l) == null || e.call(this), this.l = void 0;
|
|
1325
1325
|
}
|
|
1326
1326
|
render(e) {
|
|
1327
|
-
return
|
|
1327
|
+
return st;
|
|
1328
1328
|
}
|
|
1329
1329
|
getController() {
|
|
1330
|
-
return
|
|
1330
|
+
return Yi.get(this.u);
|
|
1331
1331
|
}
|
|
1332
1332
|
isDisabled() {
|
|
1333
1333
|
var e;
|
|
@@ -1336,12 +1336,12 @@ class Ji extends at {
|
|
|
1336
1336
|
update(e, [i]) {
|
|
1337
1337
|
var s;
|
|
1338
1338
|
const r = this.u === void 0;
|
|
1339
|
-
return r && (this.u = (s = e.options) == null ? void 0 : s.host, this.u.addController(this), this.u.updateComplete.then((o) => this.t = !0), this.element = e.element,
|
|
1339
|
+
return r && (this.u = (s = e.options) == null ? void 0 : s.host, this.u.addController(this), this.u.updateComplete.then((o) => this.t = !0), this.element = e.element, it.set(this.element, this)), this.optionsOrCallback = i, (r || typeof i != "function") && this.m(i), this.render(i);
|
|
1340
1340
|
}
|
|
1341
1341
|
m(e) {
|
|
1342
1342
|
e = e ?? {};
|
|
1343
1343
|
const i = this.getController();
|
|
1344
|
-
i !== void 0 && ((e = { ...i.defaultOptions, ...e }).keyframeOptions = { ...i.defaultOptions.keyframeOptions, ...e.keyframeOptions }), e.properties ?? (e.properties =
|
|
1344
|
+
i !== void 0 && ((e = { ...i.defaultOptions, ...e }).keyframeOptions = { ...i.defaultOptions.keyframeOptions, ...e.keyframeOptions }), e.properties ?? (e.properties = Ji), this.options = e;
|
|
1345
1345
|
}
|
|
1346
1346
|
p() {
|
|
1347
1347
|
const e = {}, i = this.element.getBoundingClientRect(), r = getComputedStyle(this.element);
|
|
@@ -1365,7 +1365,7 @@ class Ji extends at {
|
|
|
1365
1365
|
async hostUpdated() {
|
|
1366
1366
|
if (!this.h || !this.element.isConnected || this.options.skipInitial && !this.isHostRendered) return;
|
|
1367
1367
|
let e;
|
|
1368
|
-
this.prepare(), await
|
|
1368
|
+
this.prepare(), await Qe;
|
|
1369
1369
|
const i = this.P(), r = this.V(this.options.keyframeOptions, i), s = this.p();
|
|
1370
1370
|
if (this.A !== void 0) {
|
|
1371
1371
|
const { from: o, to: a } = this.O(this.A, s, i);
|
|
@@ -1375,7 +1375,7 @@ class Ji extends at {
|
|
|
1375
1375
|
if (o) {
|
|
1376
1376
|
fe.delete(this.options.inId);
|
|
1377
1377
|
const { from: a, to: n } = this.O(o, s, i);
|
|
1378
|
-
e = this.calculateKeyframes(a, n), e = this.options.in ? [{ ...this.options.in[0], ...e[0] }, ...this.options.in.slice(1), e[1]] : e,
|
|
1378
|
+
e = this.calculateKeyframes(a, n), e = this.options.in ? [{ ...this.options.in[0], ...e[0] }, ...this.options.in.slice(1), e[1]] : e, Je++, e.forEach((l) => l.zIndex = Je);
|
|
1379
1379
|
} else this.options.in && (e = [...this.options.in, {}]);
|
|
1380
1380
|
}
|
|
1381
1381
|
this.animate(e, r);
|
|
@@ -1392,7 +1392,7 @@ class Ji extends at {
|
|
|
1392
1392
|
async disconnected() {
|
|
1393
1393
|
var i;
|
|
1394
1394
|
if (!this.h || (this.options.id !== void 0 && fe.set(this.options.id, this.A), this.options.out === void 0)) return;
|
|
1395
|
-
if (this.prepare(), await
|
|
1395
|
+
if (this.prepare(), await Qe(), (i = this.i) == null ? void 0 : i.isConnected) {
|
|
1396
1396
|
const r = this.o && this.o.parentNode === this.i ? this.o : null;
|
|
1397
1397
|
if (this.i.insertBefore(this.element, r), this.options.stabilizeOut) {
|
|
1398
1398
|
const s = this.p();
|
|
@@ -1418,19 +1418,19 @@ class Ji extends at {
|
|
|
1418
1418
|
P() {
|
|
1419
1419
|
const e = [];
|
|
1420
1420
|
for (let i = this.element.parentNode; i; i = i == null ? void 0 : i.parentNode) {
|
|
1421
|
-
const r =
|
|
1421
|
+
const r = it.get(i);
|
|
1422
1422
|
r && !r.isDisabled() && r && e.push(r);
|
|
1423
1423
|
}
|
|
1424
1424
|
return e;
|
|
1425
1425
|
}
|
|
1426
1426
|
get isHostRendered() {
|
|
1427
|
-
const e =
|
|
1427
|
+
const e = Ze.has(this.u);
|
|
1428
1428
|
return e || this.u.updateComplete.then(() => {
|
|
1429
|
-
|
|
1429
|
+
Ze.add(this.u);
|
|
1430
1430
|
}), e;
|
|
1431
1431
|
}
|
|
1432
1432
|
V(e, i = this.P()) {
|
|
1433
|
-
const r = { ...
|
|
1433
|
+
const r = { ...Xi };
|
|
1434
1434
|
return i.forEach((s) => Object.assign(r, s.options.keyframeOptions)), Object.assign(r, e), r;
|
|
1435
1435
|
}
|
|
1436
1436
|
O(e, i, r) {
|
|
@@ -1479,13 +1479,13 @@ class Ji extends at {
|
|
|
1479
1479
|
this.shouldLog && !this.isDisabled() && console.log(e, this.options.id, i);
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
|
-
const
|
|
1483
|
-
class
|
|
1482
|
+
const Qi = ot(Zi), er = ["top", "right", "bottom", "left"];
|
|
1483
|
+
class tr extends nt {
|
|
1484
1484
|
constructor(e) {
|
|
1485
|
-
if (super(e), e.type !==
|
|
1485
|
+
if (super(e), e.type !== at.ELEMENT) throw Error("The `position` directive must be used in attribute position.");
|
|
1486
1486
|
}
|
|
1487
1487
|
render(e, i) {
|
|
1488
|
-
return
|
|
1488
|
+
return st;
|
|
1489
1489
|
}
|
|
1490
1490
|
update(e, [i, r]) {
|
|
1491
1491
|
var s;
|
|
@@ -1500,22 +1500,22 @@ class er extends at {
|
|
|
1500
1500
|
if (e === void 0 || !i) return;
|
|
1501
1501
|
const r = e.getBoundingClientRect(), s = i.getBoundingClientRect();
|
|
1502
1502
|
(a = this.S) == null || a.forEach((n) => {
|
|
1503
|
-
const l =
|
|
1503
|
+
const l = er.includes(n) ? r[n] - s[n] : r[n];
|
|
1504
1504
|
this.C.style[n] = l + "px";
|
|
1505
1505
|
});
|
|
1506
1506
|
}
|
|
1507
1507
|
}
|
|
1508
|
-
|
|
1509
|
-
const
|
|
1510
|
-
var
|
|
1511
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1508
|
+
ot(tr);
|
|
1509
|
+
const ir = ':host{display:flex;justify-content:center}.strip{position:relative;display:inline-flex;align-items:center;min-height:44px}.chip{display:flex;align-items:center;padding:2px;margin-right:-11px;background:var(--uc-ai-floating, var(--uc-ai-background));border:1px solid transparent;border-radius:calc(var(--uc-ai-radius-button, 8px) + 2px);box-shadow:0 1px 8px #0000004d;cursor:pointer;transform:scale(1);transition:margin .3s var(--uc-ai-ease-out, ease),border-color 225ms ease,transform .27s var(--uc-ai-ease-out, ease),opacity .33s var(--uc-ai-ease-out, ease)}.chip:disabled{cursor:not-allowed}.chip:last-child{margin-right:0}@media(hover:hover)and (pointer:fine){.chip:hover:not(:disabled){transform:scale(1.1)}.strip:hover .chip:not(:disabled){margin-right:7px}.strip:hover .chip:not(:disabled):last-child{margin-right:0}}.chip--selected{border-color:var(--uc-ai-primary);transform:scale(1.2)}.thumb{position:relative;display:block;width:40px;height:40px;border-radius:var(--uc-ai-radius-button, 8px);background-color:var(--uc-ai-muted);overflow:hidden}.thumb:not(.thumb--loaded):after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:linear-gradient(100deg,transparent 30%,color-mix(in srgb,var(--uc-ai-foreground) 9%,transparent) 50%,transparent 70%);transform:translate(-100%);animation:thumb-shimmer 1.2s ease-in-out infinite}@keyframes thumb-shimmer{to{transform:translate(100%)}}.thumb__img{display:block;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .24s var(--uc-ai-ease-out, ease)}.thumb--loaded .thumb__img{opacity:1}@media(prefers-reduced-motion:reduce){.thumb:not(.thumb--loaded):after{animation:none}.thumb__img{transition:none}}.startover{position:absolute;right:calc(100% + 10px);top:50%;display:flex;align-items:center;background:var(--uc-ai-floating, var(--uc-ai-background));border:1px solid var(--uc-ai-floating-border, transparent);border-radius:calc(var(--uc-ai-radius-button, 8px) + 2px);box-shadow:var(--uc-ai-dialog-shadow);white-space:nowrap;opacity:0;transform:translateY(-50%) translate(-6px) scale(.95);transform-origin:right center;pointer-events:none;transition:opacity .26s var(--uc-ai-ease-out, ease),transform .26s var(--uc-ai-ease-out, ease)}.strip:hover .startover,.strip:focus-within .startover{opacity:1;transform:translateY(-50%) translate(0) scale(1);pointer-events:auto}.strip--empty .startover{position:static;opacity:1;transform:none;pointer-events:auto}.startover__btn{height:var(--uc-ai-button-size, 32px);padding:0 12px;background:transparent;border:0;border-radius:inherit;color:var(--uc-ai-foreground);font:inherit;font-size:13px;cursor:pointer}.startover__btn:disabled{cursor:not-allowed}.startover__btn:hover{background:var(--uc-ai-secondary)}.strip:before{content:"";position:absolute;right:100%;top:-12px;bottom:-12px;width:200px}.strip--empty:before{content:none}@media(prefers-reduced-motion:reduce){.chip,.startover{transition-property:opacity,border-color,margin}.chip:hover,.chip--selected{transform:scale(1)}.strip:not(.strip--empty) .startover,.strip:not(.strip--empty):hover .startover,.strip:not(.strip--empty):focus-within .startover{transform:translateY(-50%)}}';
|
|
1510
|
+
var rr = Object.defineProperty, sr = Object.getOwnPropertyDescriptor, z = (t, e, i, r) => {
|
|
1511
|
+
for (var s = r > 1 ? void 0 : r ? sr(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
1512
1512
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
1513
|
-
return r && s &&
|
|
1513
|
+
return r && s && rr(e, i, s), s;
|
|
1514
1514
|
};
|
|
1515
|
-
const
|
|
1515
|
+
const or = 80;
|
|
1516
1516
|
let U = class extends G {
|
|
1517
1517
|
constructor() {
|
|
1518
|
-
super(...arguments), this.entries = [], this.selectedUuid = null, this.showStartOver = !1, this.startOverLabel = "", this.listLabel = "Generation history", this.busy = !1, this._secure = new
|
|
1518
|
+
super(...arguments), this.entries = [], this.selectedUuid = null, this.showStartOver = !1, this.startOverLabel = "", this.listLabel = "Generation history", this.busy = !1, this._secure = new _t(this), this._loaded = /* @__PURE__ */ new Set();
|
|
1519
1519
|
}
|
|
1520
1520
|
willUpdate(t) {
|
|
1521
1521
|
if (t.has("secureResolver") && this._secure.setResolver(this.secureResolver), t.has("entries")) {
|
|
@@ -1537,7 +1537,7 @@ let U = class extends G {
|
|
|
1537
1537
|
}
|
|
1538
1538
|
render() {
|
|
1539
1539
|
const t = this.entries.length > 0;
|
|
1540
|
-
if (!t && !this.showStartOver) return f`${
|
|
1540
|
+
if (!t && !this.showStartOver) return f`${g}`;
|
|
1541
1541
|
const e = { strip: !0, "strip--empty": !t }, i = [...this.entries].reverse();
|
|
1542
1542
|
return f`
|
|
1543
1543
|
<div class=${S(e)} role="toolbar" aria-label="${this.listLabel}">
|
|
@@ -1547,12 +1547,12 @@ let U = class extends G {
|
|
|
1547
1547
|
${this.startOverLabel}
|
|
1548
1548
|
</button>
|
|
1549
1549
|
</div>
|
|
1550
|
-
` :
|
|
1551
|
-
${
|
|
1550
|
+
` : g}
|
|
1551
|
+
${xt(
|
|
1552
1552
|
i,
|
|
1553
1553
|
(r) => r.id,
|
|
1554
1554
|
(r) => {
|
|
1555
|
-
const s = this._secure.resolve(Ii(r.url,
|
|
1555
|
+
const s = this._secure.resolve(Ii(r.url, or)), o = this.selectedUuid != null && r.file.uuid === this.selectedUuid, a = this._loaded.has(r.id);
|
|
1556
1556
|
return f`
|
|
1557
1557
|
<button
|
|
1558
1558
|
type="button"
|
|
@@ -1562,7 +1562,7 @@ let U = class extends G {
|
|
|
1562
1562
|
aria-label=${r.prompt || "Result"}
|
|
1563
1563
|
title=${r.prompt}
|
|
1564
1564
|
@click=${() => this._select(r)}
|
|
1565
|
-
${
|
|
1565
|
+
${Qi({ keyframeOptions: { duration: 300, easing: "cubic-bezier(0.23, 1, 0.32, 1)" } })}
|
|
1566
1566
|
>
|
|
1567
1567
|
<span class=${S({ thumb: !0, "thumb--loaded": a })}>
|
|
1568
1568
|
${// Rendering the <img> preloads it; the skeleton shows until it
|
|
@@ -1575,7 +1575,7 @@ let U = class extends G {
|
|
|
1575
1575
|
decoding="async"
|
|
1576
1576
|
@load=${() => this._onThumbSettled(r.id)}
|
|
1577
1577
|
@error=${() => this._onThumbSettled(r.id)}
|
|
1578
|
-
/>` :
|
|
1578
|
+
/>` : g}
|
|
1579
1579
|
</span>
|
|
1580
1580
|
</button>
|
|
1581
1581
|
`;
|
|
@@ -1585,36 +1585,36 @@ let U = class extends G {
|
|
|
1585
1585
|
`;
|
|
1586
1586
|
}
|
|
1587
1587
|
};
|
|
1588
|
-
U.styles = j(
|
|
1589
|
-
|
|
1588
|
+
U.styles = j(ir);
|
|
1589
|
+
z([
|
|
1590
1590
|
c({ attribute: !1 })
|
|
1591
1591
|
], U.prototype, "entries", 2);
|
|
1592
|
-
|
|
1592
|
+
z([
|
|
1593
1593
|
c({ attribute: "selected-uuid" })
|
|
1594
1594
|
], U.prototype, "selectedUuid", 2);
|
|
1595
|
-
|
|
1595
|
+
z([
|
|
1596
1596
|
c({ type: Boolean, attribute: "show-start-over" })
|
|
1597
1597
|
], U.prototype, "showStartOver", 2);
|
|
1598
|
-
|
|
1598
|
+
z([
|
|
1599
1599
|
c({ attribute: "start-over-label" })
|
|
1600
1600
|
], U.prototype, "startOverLabel", 2);
|
|
1601
|
-
|
|
1601
|
+
z([
|
|
1602
1602
|
c({ attribute: "list-label" })
|
|
1603
1603
|
], U.prototype, "listLabel", 2);
|
|
1604
|
-
|
|
1604
|
+
z([
|
|
1605
1605
|
c({ type: Boolean })
|
|
1606
1606
|
], U.prototype, "busy", 2);
|
|
1607
|
-
|
|
1607
|
+
z([
|
|
1608
1608
|
c({ attribute: !1 })
|
|
1609
1609
|
], U.prototype, "secureResolver", 2);
|
|
1610
|
-
U =
|
|
1610
|
+
U = z([
|
|
1611
1611
|
H("uc-ai-history")
|
|
1612
1612
|
], U);
|
|
1613
|
-
const
|
|
1614
|
-
var
|
|
1615
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1613
|
+
const ar = ':host{display:block}.card{width:100%;box-sizing:border-box;background:color-mix(in srgb,var(--uc-ai-floating, var(--uc-ai-background)) 80%,transparent);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid var(--uc-ai-floating-border, transparent);border-radius:var(--uc-ai-composer-radius-top) var(--uc-ai-composer-radius-top) var(--uc-ai-composer-radius-bottom) var(--uc-ai-composer-radius-bottom);transition:border-radius .4s var(--uc-ai-ease-out),box-shadow .4s var(--uc-ai-ease-out);box-shadow:var(--uc-ai-composer-shadow);overflow:visible;--uc-ai-radius-button: max(0px, calc(var(--uc-ai-composer-radius) - var(--uc-ai-padding)))}.body{display:flex;flex-direction:column;gap:var(--uc-ai-padding);padding:var(--uc-ai-padding)}.input{box-sizing:border-box;width:100%;min-height:40px;max-height:var(--uc-ai-prompt-max-height, calc(var(--uc-ai-prompt-max-lines, 6) * 1.5em + 10px));resize:none;border:0;outline:none;padding:0 3px;background:transparent;font-family:inherit;font-size:var(--uc-ai-font-size);line-height:20px;color:var(--uc-ai-foreground);overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--uc-ai-border) transparent;transition:height .16s var(--uc-ai-ease-out, ease)}@supports (field-sizing: content){.input{field-sizing:content;transition:none}}.input::placeholder{color:var(--uc-ai-muted-foreground)}.input:disabled{color:var(--uc-ai-muted-foreground);-webkit-text-fill-color:var(--uc-ai-muted-foreground);cursor:not-allowed}.row{display:flex;align-items:center;gap:10px}.actions{flex:1;min-width:0;display:flex;align-items:center}.actions::slotted(*){min-width:0}.controls{display:flex;align-items:center;gap:0;flex:none}.send{margin-left:5px;width:var(--uc-ai-button-size, 32px);height:var(--uc-ai-button-size, 32px);flex:none;min-width:0;display:inline-flex;align-items:center;justify-content:center;position:relative;background:var(--uc-ai-primary);color:var(--uc-ai-primary-foreground);border:none;border-radius:var(--uc-ai-radius-button);cursor:pointer;overflow:hidden;transition:width .22s var(--uc-ai-ease-out, ease),margin-left .22s var(--uc-ai-ease-out, ease),opacity .15s var(--uc-ai-ease-out, ease),transform .15s var(--uc-ai-ease-out, ease),background var(--uc-ai-transition)}.send:hover:not(:disabled){background:var(--uc-ai-primary-hover)}.send:active:not(:disabled){transform:scale(.95)}.send:disabled{cursor:default}.send[hidden]{display:inline-flex;width:0;min-width:0;padding:0;margin-left:0;opacity:0;transform:scale(.8);pointer-events:none}.send__icon,.send__spinner{position:absolute;top:50%;left:50%;width:16px;height:16px;transition:opacity .2s var(--uc-ai-ease-out, ease),transform .2s var(--uc-ai-ease-out, ease),filter .2s var(--uc-ai-ease-out, ease)}.send__icon{opacity:1;transform:translate(-50%,-50%) scale(1);filter:blur(0)}.send__icon svg{width:16px;height:16px;display:block}.send__spinner{opacity:0;transform:translate(-50%,-50%) scale(.95);filter:blur(3px)}.send__spinner:before,.send__spinner:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:50%;border:1.5px solid currentColor}.send__spinner:before{opacity:.3}.send__spinner:after{border-top-color:transparent;animation:send-spin .7s linear infinite;will-change:transform}@keyframes send-spin{to{transform:rotate(360deg)}}.send--busy .send__icon{opacity:0;transform:translate(-50%,-50%) scale(.95);filter:blur(3px)}.send--busy .send__spinner{opacity:1;transform:translate(-50%,-50%) scale(1);filter:blur(0)}.send--busy:disabled{opacity:1}@media(prefers-reduced-motion:reduce){.input,.send{transition-property:opacity,background,width,margin-left}.send__icon,.send__spinner{transition-property:opacity}.send__spinner:after{animation:none}.send:active:not(:disabled){transform:none}}';
|
|
1614
|
+
var nr = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, D = (t, e, i, r) => {
|
|
1615
|
+
for (var s = r > 1 ? void 0 : r ? lr(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
1616
1616
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
1617
|
-
return r && s &&
|
|
1617
|
+
return r && s && nr(e, i, s), s;
|
|
1618
1618
|
};
|
|
1619
1619
|
let T = class extends G {
|
|
1620
1620
|
constructor() {
|
|
@@ -1669,7 +1669,7 @@ let T = class extends G {
|
|
|
1669
1669
|
@input=${this._onInput}
|
|
1670
1670
|
@keydown=${this._onKeydown}
|
|
1671
1671
|
?disabled=${this.busy}
|
|
1672
|
-
></textarea>` :
|
|
1672
|
+
></textarea>` : g}
|
|
1673
1673
|
|
|
1674
1674
|
<div class="row">
|
|
1675
1675
|
<div class="actions">
|
|
@@ -1685,7 +1685,7 @@ let T = class extends G {
|
|
|
1685
1685
|
?disabled=${this.busy || t}
|
|
1686
1686
|
@click=${this._emitSend}
|
|
1687
1687
|
>
|
|
1688
|
-
<span class="send__icon">${re(
|
|
1688
|
+
<span class="send__icon">${re(ji)}</span>
|
|
1689
1689
|
<span class="send__spinner" aria-hidden="true"></span>
|
|
1690
1690
|
</button>
|
|
1691
1691
|
</div>
|
|
@@ -1695,7 +1695,7 @@ let T = class extends G {
|
|
|
1695
1695
|
`;
|
|
1696
1696
|
}
|
|
1697
1697
|
};
|
|
1698
|
-
T.styles = j(
|
|
1698
|
+
T.styles = j(ar);
|
|
1699
1699
|
D([
|
|
1700
1700
|
c()
|
|
1701
1701
|
], T.prototype, "mode", 2);
|
|
@@ -1720,11 +1720,11 @@ D([
|
|
|
1720
1720
|
T = D([
|
|
1721
1721
|
H("uc-ai-prompt-row")
|
|
1722
1722
|
], T);
|
|
1723
|
-
const
|
|
1724
|
-
var
|
|
1725
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1723
|
+
const cr = ":host{display:block;min-width:0}.row{display:flex;flex-wrap:nowrap;align-items:center;gap:5px;overflow-x:auto;scrollbar-width:none}.row::-webkit-scrollbar{display:none}.row.fade-left.fade-right{-webkit-mask-image:linear-gradient(to right,transparent 0,#000 10px,#000 calc(100% - 10px),transparent 100%);mask-image:linear-gradient(to right,transparent 0,#000 10px,#000 calc(100% - 10px),transparent 100%)}.row.fade-left:not(.fade-right){-webkit-mask-image:linear-gradient(to right,transparent 0,#000 10px);mask-image:linear-gradient(to right,transparent 0,#000 10px)}.row.fade-right:not(.fade-left){-webkit-mask-image:linear-gradient(to right,#000 calc(100% - 10px),transparent 100%);mask-image:linear-gradient(to right,#000 calc(100% - 10px),transparent 100%)}.chip{flex:none;height:var(--uc-ai-button-size, 32px);display:inline-flex;align-items:center;justify-content:center;padding:0 10px;background:var(--uc-ai-secondary);border:0;border-radius:var(--uc-ai-radius-button);font-family:inherit;font-size:13px;line-height:20px;color:var(--uc-ai-secondary-foreground);cursor:pointer;white-space:nowrap;transition:background .15s ease,transform .14s var(--uc-ai-ease-out, ease)}@media(hover:hover)and (pointer:fine){.chip:hover{background:var(--uc-ai-secondary-hover)}}.chip:active{background:var(--uc-ai-secondary-hover);transform:scale(.97)}.chip:disabled{opacity:.5;cursor:not-allowed}@media(prefers-reduced-motion:reduce){.chip{transition-property:background}.chip:active{transform:none}}";
|
|
1724
|
+
var hr = Object.defineProperty, ur = Object.getOwnPropertyDescriptor, Y = (t, e, i, r) => {
|
|
1725
|
+
for (var s = r > 1 ? void 0 : r ? ur(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
1726
1726
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
1727
|
-
return r && s &&
|
|
1727
|
+
return r && s && hr(e, i, s), s;
|
|
1728
1728
|
};
|
|
1729
1729
|
let P = class extends G {
|
|
1730
1730
|
constructor() {
|
|
@@ -1783,7 +1783,7 @@ let P = class extends G {
|
|
|
1783
1783
|
`;
|
|
1784
1784
|
}
|
|
1785
1785
|
};
|
|
1786
|
-
P.styles = j(
|
|
1786
|
+
P.styles = j(cr);
|
|
1787
1787
|
Y([
|
|
1788
1788
|
c()
|
|
1789
1789
|
], P.prototype, "mode", 2);
|
|
@@ -1806,7 +1806,7 @@ function N(t, e) {
|
|
|
1806
1806
|
if (t === null) throw new Error(`DotGrid GL: failed to create ${e} (context lost?)`);
|
|
1807
1807
|
return t;
|
|
1808
1808
|
}
|
|
1809
|
-
const xe = 8,
|
|
1809
|
+
const xe = 8, dr = `#version 300 es
|
|
1810
1810
|
precision highp float;
|
|
1811
1811
|
precision highp int;
|
|
1812
1812
|
in vec2 aCorner; // unit quad corner, -0.5..0.5
|
|
@@ -1903,7 +1903,7 @@ void main() {
|
|
|
1903
1903
|
gl_Position = vec4(ndc.x, -ndc.y, 0.0, 1.0);
|
|
1904
1904
|
|
|
1905
1905
|
vAlpha = (uMask == 1) ? 1.0 : uColorA;
|
|
1906
|
-
}`,
|
|
1906
|
+
}`, pr = `#version 300 es
|
|
1907
1907
|
precision highp float;
|
|
1908
1908
|
precision highp int;
|
|
1909
1909
|
in float vAlpha;
|
|
@@ -1922,7 +1922,7 @@ void main() {
|
|
|
1922
1922
|
float cov = clamp(0.5 - sd / aaw, 0.0, 1.0);
|
|
1923
1923
|
vec3 rgb = (uMask == 1) ? vec3(1.0) : uColorRGB;
|
|
1924
1924
|
frag = vec4(rgb * vAlpha * cov, vAlpha * cov); // premultiplied
|
|
1925
|
-
}`,
|
|
1925
|
+
}`, fr = `#version 300 es
|
|
1926
1926
|
precision highp float;
|
|
1927
1927
|
in vec2 aQuad; // 0..1
|
|
1928
1928
|
uniform vec2 uResolution;
|
|
@@ -1933,7 +1933,7 @@ void main() {
|
|
|
1933
1933
|
vFramePx = px - uFrame.xy;
|
|
1934
1934
|
vec2 ndc = (px / uResolution) * 2.0 - 1.0;
|
|
1935
1935
|
gl_Position = vec4(ndc.x, -ndc.y, 0.0, 1.0);
|
|
1936
|
-
}`,
|
|
1936
|
+
}`, mr = `#version 300 es
|
|
1937
1937
|
precision highp float;
|
|
1938
1938
|
in vec2 vFramePx;
|
|
1939
1939
|
uniform sampler2D uImage;
|
|
@@ -1950,7 +1950,7 @@ void main() {
|
|
|
1950
1950
|
}`;
|
|
1951
1951
|
class Ae {
|
|
1952
1952
|
constructor(e) {
|
|
1953
|
-
this._dotUniforms = {}, this._imgUniforms = {}, this._appliedW = 0, this._appliedH = 0, this._appliedScale = 0, this._texImage = null, this._texOk = !1, this._gl = e, this._dotProgram = this._link(
|
|
1953
|
+
this._dotUniforms = {}, this._imgUniforms = {}, this._appliedW = 0, this._appliedH = 0, this._appliedScale = 0, this._texImage = null, this._texOk = !1, this._gl = e, this._dotProgram = this._link(dr, pr), this._imgProgram = this._link(fr, mr), this._cornerBuf = this._staticBuffer([-0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5]), this._quadBuf = this._staticBuffer([0, 0, 1, 0, 0, 1, 1, 1]), this._clipBuf = N(e.createBuffer(), "buffer"), this._dotVao = N(e.createVertexArray(), "vertex array"), e.bindVertexArray(this._dotVao);
|
|
1954
1954
|
const i = e.getAttribLocation(this._dotProgram, "aCorner");
|
|
1955
1955
|
e.bindBuffer(e.ARRAY_BUFFER, this._cornerBuf), e.enableVertexAttribArray(i), e.vertexAttribPointer(i, 2, e.FLOAT, !1, 0, 0);
|
|
1956
1956
|
const r = e.getAttribLocation(this._dotProgram, "aClip");
|
|
@@ -2071,7 +2071,7 @@ class Ae {
|
|
|
2071
2071
|
return s;
|
|
2072
2072
|
}
|
|
2073
2073
|
}
|
|
2074
|
-
const
|
|
2074
|
+
const _r = 1200, gr = 800, vr = 1.5, rt = (t) => 1 - (1 - t) ** 3, br = {
|
|
2075
2075
|
cellSize: 6,
|
|
2076
2076
|
dotRatio: 0.46,
|
|
2077
2077
|
sizeScale: 1,
|
|
@@ -2092,19 +2092,19 @@ const mr = 1200, _r = 800, gr = 1.5, it = (t) => 1 - (1 - t) ** 3, vr = {
|
|
|
2092
2092
|
shimEnterMs: 450,
|
|
2093
2093
|
shimExitMs: 450
|
|
2094
2094
|
};
|
|
2095
|
-
class
|
|
2095
|
+
class yr {
|
|
2096
2096
|
constructor(e, i) {
|
|
2097
|
-
this._refs = null, this._ctx = null, this._gl = null, this._glImageEl = null, this._glImageReady = !1, this._cfg = { ...
|
|
2097
|
+
this._refs = null, this._ctx = null, this._gl = null, this._glImageEl = null, this._glImageReady = !1, this._cfg = { ...br }, this._sizeMul = 1, this._dotColor = "rgba(0, 0, 0, 0.16)", this._dotColorRGBA = [0, 0, 0, 0.16], this._w = 0, this._h = 0, this._cols = 0, this._rows = 0, this._offsetX = 0, this._offsetY = 0, this._epiRadius = 1, this._appliedScale = 0, this._clip = new Float32Array(0), this._env = 0, this._envFrom = 0, this._envTo = 0, this._envStart = 0, this._envDur = 0, this._envAnimating = !1, this._shimMix = 0, this._shimFrom = 0, this._shimTo = 0, this._shimStart = 0, this._shimDur = 0, this._shimAnimating = !1, this._exitPending = !1, this._prevShim = !1, this._opacityManual = !1, this._hiddenImage = null, this._rafId = null, this._lastTime = 0, this._state = { shimmering: !1, empty: !0, generating: !1 }, this._epis = [], this._onThemeChange = () => {
|
|
2098
2098
|
this.refreshColor();
|
|
2099
2099
|
}, this._rectCache = null, this._glEpis = new Float32Array(16), this._tick = (r) => {
|
|
2100
2100
|
const s = this._lastTime ? Math.min(64, r - this._lastTime) : 16;
|
|
2101
2101
|
if (this._lastTime = r, this._rectCache = this._frameRect(), this._envAnimating) {
|
|
2102
2102
|
const a = Math.min(1, (r - this._envStart) / this._envDur);
|
|
2103
|
-
this._env = this._envFrom + (this._envTo - this._envFrom) *
|
|
2103
|
+
this._env = this._envFrom + (this._envTo - this._envFrom) * rt(a), a >= 1 && (this._env = this._envTo, this._envAnimating = !1);
|
|
2104
2104
|
}
|
|
2105
2105
|
if (this._shimAnimating) {
|
|
2106
2106
|
const a = Math.min(1, (r - this._shimStart) / this._shimDur);
|
|
2107
|
-
this._shimMix = this._shimFrom + (this._shimTo - this._shimFrom) *
|
|
2107
|
+
this._shimMix = this._shimFrom + (this._shimTo - this._shimFrom) * rt(a), a >= 1 && (this._shimMix = this._shimTo, this._shimAnimating = !1);
|
|
2108
2108
|
}
|
|
2109
2109
|
this._state.generating && !this._reduceMotion && this._moveEpicenters(s);
|
|
2110
2110
|
const o = this._followFrame(s);
|
|
@@ -2124,7 +2124,7 @@ class br {
|
|
|
2124
2124
|
* proportional, >1 exaggerates, <0 inverts). Always positive, so it never
|
|
2125
2125
|
* produces a negative radius/speed however far it's pushed. */
|
|
2126
2126
|
_computeSizeMul() {
|
|
2127
|
-
return this._w <= 0 || this._h <= 0 ? 1 : Math.sqrt(this._w * this._h / (
|
|
2127
|
+
return this._w <= 0 || this._h <= 0 ? 1 : Math.sqrt(this._w * this._h / (_r * gr)) ** this._cfg.sizeScale;
|
|
2128
2128
|
}
|
|
2129
2129
|
/** Wire the painter to the canvas's rendered elements. */
|
|
2130
2130
|
attach(e) {
|
|
@@ -2282,7 +2282,7 @@ class br {
|
|
|
2282
2282
|
* {@link MAX_ANIMATED_DPR} so per-frame raster stays cheap on hi-dpi. */
|
|
2283
2283
|
_scale(e = !1) {
|
|
2284
2284
|
const i = Math.min(window.devicePixelRatio || 1, this._cfg.maxDpr);
|
|
2285
|
-
return e ? Math.min(i,
|
|
2285
|
+
return e ? Math.min(i, vr) : i;
|
|
2286
2286
|
}
|
|
2287
2287
|
/** Size the backing store to `scale`× the viewport. Note: setting width/height
|
|
2288
2288
|
* clears the canvas and resets the context, so the transform is re-applied. */
|
|
@@ -2396,13 +2396,13 @@ class br {
|
|
|
2396
2396
|
const x = this._offsetX + u * o;
|
|
2397
2397
|
let w;
|
|
2398
2398
|
if (i) {
|
|
2399
|
-
const R = this._reduceMotion ? 1 : this._state.generating ? this._shimmerScale(u, h, x, p) : this._cfg.minScale,
|
|
2400
|
-
w = (a + this._env * (
|
|
2399
|
+
const R = this._reduceMotion ? 1 : this._state.generating ? this._shimmerScale(u, h, x, p) : this._cfg.minScale, O = this._baseRadius * R;
|
|
2400
|
+
w = (a + this._env * (O - a)) * _;
|
|
2401
2401
|
} else {
|
|
2402
2402
|
let R = this._staticScale();
|
|
2403
2403
|
if (!this._reduceMotion && this._shimMix > 0) {
|
|
2404
|
-
const
|
|
2405
|
-
R += (
|
|
2404
|
+
const O = this._shimmerScale(u, h, x, p);
|
|
2405
|
+
R += (O - R) * this._shimMix;
|
|
2406
2406
|
}
|
|
2407
2407
|
w = this._baseRadius * R * _;
|
|
2408
2408
|
}
|
|
@@ -2470,16 +2470,16 @@ class br {
|
|
|
2470
2470
|
this._exitPending && this._hasImage() && (this._exitPending = !1, this._env = 1, this._startEnv(0, this._cfg.exitMs));
|
|
2471
2471
|
}
|
|
2472
2472
|
}
|
|
2473
|
-
const
|
|
2474
|
-
var
|
|
2475
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
2473
|
+
const wr = ":host{display:block;width:100%;height:100%;container-type:inline-size}.canvas{position:relative;width:100%;height:100%;min-height:240px;overflow:hidden}.canvas__bg{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--uc-ai-background)}.canvas__viewport{position:absolute;top:20px;right:20px;bottom:20px;left:20px;display:grid;place-items:center;pointer-events:none}.canvas__frame{position:relative;overflow:hidden}.canvas.is-ready .canvas__frame{transition:width .46s var(--uc-ai-ease-in-out, ease),height .46s var(--uc-ai-ease-in-out, ease)}.canvas__image{position:relative;z-index:1;width:100%;height:100%;display:block;object-fit:cover;transition:opacity .3s var(--uc-ai-ease-out, ease)}.canvas__under{position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;width:100%;height:100%;display:block;object-fit:cover}.dot-grid{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;opacity:0;color:var(--uc-ai-dot-grid-color, color-mix(in srgb, currentColor 15%, transparent));transition:opacity .2s ease}.canvas.is-empty .dot-grid,.canvas.is-loading .dot-grid{opacity:1}.preload{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.layer.full{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;object-fit:contain;z-index:4}.fullscreen-btn{position:absolute;top:12px;right:12px;z-index:5;display:grid;place-items:center;width:var(--uc-ai-button-size, 32px);height:var(--uc-ai-button-size, 32px);padding:0;border:0;border-radius:var(--uc-ai-radius-button, 8px);background:color-mix(in oklch,var(--uc-ai-background) 75%,transparent);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);color:var(--uc-ai-foreground);cursor:pointer;opacity:0;transition:opacity var(--uc-ai-transition, .2s ease),background var(--uc-ai-transition, .2s ease)}.fullscreen-btn svg{width:18px;height:18px}.canvas:hover .fullscreen-btn,.fullscreen-btn:focus-visible{opacity:1}.fullscreen-btn:hover{background:var(--uc-ai-background)}@media(hover:none){.fullscreen-btn{opacity:1}}.canvas:fullscreen{background:#000}.canvas:fullscreen .canvas__bg{background:#000}.error-state{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;padding:16px;text-align:center;color:var(--uc-ai-muted-foreground);font-size:.875em;z-index:3}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(prefers-reduced-motion:reduce){.canvas__viewport,.canvas__frame,.canvas__image,.fullscreen-btn{transition:none}}";
|
|
2474
|
+
var xr = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, y = (t, e, i, r) => {
|
|
2475
|
+
for (var s = r > 1 ? void 0 : r ? Er(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
2476
2476
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
2477
|
-
return r && s &&
|
|
2477
|
+
return r && s && xr(e, i, s), s;
|
|
2478
2478
|
};
|
|
2479
|
-
const kr = 3 / 2,
|
|
2480
|
-
let
|
|
2479
|
+
const kr = 3 / 2, Rr = 70;
|
|
2480
|
+
let v = class extends G {
|
|
2481
2481
|
constructor() {
|
|
2482
|
-
super(...arguments), this.url = null, this.ratio = null, this.naturalRatio = null, this.busy = !1, this.alt = "", this.busyLabel = "", this.errorLabel = "", this.fullscreenLabel = "", this.exitFullscreenLabel = "", this.fullsizeUrl = null, this._displayedUrl = null, this._fadingUrl = null, this._failed = !1, this._frameReady = !1, this._fullscreen = !1, this._dotGrid = new
|
|
2482
|
+
super(...arguments), this.url = null, this.ratio = null, this.naturalRatio = null, this.busy = !1, this.alt = "", this.busyLabel = "", this.errorLabel = "", this.fullscreenLabel = "", this.exitFullscreenLabel = "", this.fullsizeUrl = null, this._displayedUrl = null, this._fadingUrl = null, this._failed = !1, this._frameReady = !1, this._fullscreen = !1, this._dotGrid = new yr(this), this._switchCovering = !1, this._seenUrls = /* @__PURE__ */ new Set(), this._instantSwap = !1, this._onVisibilityChange = () => {
|
|
2483
2483
|
document.visibilityState !== "visible" || this.busy || !this._displayedUrl || (this._clearCoverTimer(), this._switchCovering = !1, this._dotGrid.settle());
|
|
2484
2484
|
}, this._preloadedFullsizeUrl = null, this._onFullscreenKeydown = (t) => {
|
|
2485
2485
|
t.key === "Escape" && document.fullscreenElement && (t.preventDefault(), t.stopPropagation(), document.exitFullscreen());
|
|
@@ -2543,7 +2543,7 @@ let g = class extends G {
|
|
|
2543
2543
|
}
|
|
2544
2544
|
this._instantSwap = !1, !(this._switchCovering || this._coverTimer != null) && (this._coverTimer = window.setTimeout(() => {
|
|
2545
2545
|
this._coverTimer = void 0, this.url != null && this.url !== this._displayedUrl && !this._failed && !this.busy && !this._switchCovering && (this._switchCovering = !0, this._syncGrid());
|
|
2546
|
-
},
|
|
2546
|
+
}, Rr));
|
|
2547
2547
|
}
|
|
2548
2548
|
_clearCoverTimer() {
|
|
2549
2549
|
this._coverTimer != null && (clearTimeout(this._coverTimer), this._coverTimer = void 0);
|
|
@@ -2617,7 +2617,7 @@ let g = class extends G {
|
|
|
2617
2617
|
${// Previous image held underneath during an instant (cached) swap so
|
|
2618
2618
|
// the frame never blanks for the frame it takes the new <img> to
|
|
2619
2619
|
// paint; dropped on the new image's load.
|
|
2620
|
-
this._fadingUrl ? f`<img class="canvas__under" src="${this._fadingUrl}" alt="" aria-hidden="true" crossorigin="anonymous" />` :
|
|
2620
|
+
this._fadingUrl ? f`<img class="canvas__under" src="${this._fadingUrl}" alt="" aria-hidden="true" crossorigin="anonymous" />` : g}
|
|
2621
2621
|
${this._displayedUrl ? f`<img
|
|
2622
2622
|
class="canvas__image"
|
|
2623
2623
|
src="${this._displayedUrl}"
|
|
@@ -2625,24 +2625,24 @@ let g = class extends G {
|
|
|
2625
2625
|
decoding="async"
|
|
2626
2626
|
crossorigin="anonymous"
|
|
2627
2627
|
@load=${this._onDisplayedLoad}
|
|
2628
|
-
/>` :
|
|
2628
|
+
/>` : g}
|
|
2629
2629
|
</div>
|
|
2630
2630
|
<canvas class="dot-grid" aria-hidden="true"></canvas>
|
|
2631
2631
|
</div>
|
|
2632
2632
|
|
|
2633
2633
|
${// Full-quality rendition overlays the preview while fullscreen.
|
|
2634
|
-
this._fullscreen && this.fullsizeUrl ? f`<img class="layer full" src="${this.fullsizeUrl}" alt="${this.alt || "AI image"}" decoding="async" />` :
|
|
2634
|
+
this._fullscreen && this.fullsizeUrl ? f`<img class="layer full" src="${this.fullsizeUrl}" alt="${this.alt || "AI image"}" decoding="async" />` : g}
|
|
2635
2635
|
${t ? f`<img
|
|
2636
2636
|
class="preload"
|
|
2637
|
-
src="${
|
|
2637
|
+
src="${Et(this.url ?? void 0)}"
|
|
2638
2638
|
alt=""
|
|
2639
2639
|
aria-hidden="true"
|
|
2640
2640
|
decoding="async"
|
|
2641
2641
|
crossorigin="anonymous"
|
|
2642
2642
|
@load=${this._onLoaded}
|
|
2643
2643
|
@error=${this._onError}
|
|
2644
|
-
/>` :
|
|
2645
|
-
${this._failed ? f`<div class="error-state" role="alert">${this.errorLabel || "Failed to load image"}</div>` :
|
|
2644
|
+
/>` : g}
|
|
2645
|
+
${this._failed ? f`<div class="error-state" role="alert">${this.errorLabel || "Failed to load image"}</div>` : g}
|
|
2646
2646
|
${i ? f`
|
|
2647
2647
|
<button
|
|
2648
2648
|
type="button"
|
|
@@ -2653,86 +2653,86 @@ let g = class extends G {
|
|
|
2653
2653
|
@focus=${this._preloadFullsize}
|
|
2654
2654
|
@click=${this._toggleFullscreen}
|
|
2655
2655
|
>
|
|
2656
|
-
${re(this._fullscreen ?
|
|
2656
|
+
${re(this._fullscreen ? Wi : Hi)}
|
|
2657
2657
|
</button>
|
|
2658
|
-
` :
|
|
2658
|
+
` : g}
|
|
2659
2659
|
<span class="sr-only" role="status" aria-live="polite">${this.busy ? this.busyLabel : ""}</span>
|
|
2660
2660
|
</div>
|
|
2661
2661
|
`;
|
|
2662
2662
|
}
|
|
2663
2663
|
};
|
|
2664
|
-
|
|
2664
|
+
v.styles = j(wr);
|
|
2665
2665
|
y([
|
|
2666
2666
|
c()
|
|
2667
|
-
],
|
|
2667
|
+
], v.prototype, "url", 2);
|
|
2668
2668
|
y([
|
|
2669
2669
|
c({ type: Number })
|
|
2670
|
-
],
|
|
2670
|
+
], v.prototype, "ratio", 2);
|
|
2671
2671
|
y([
|
|
2672
2672
|
c({ type: Number, attribute: "natural-ratio" })
|
|
2673
|
-
],
|
|
2673
|
+
], v.prototype, "naturalRatio", 2);
|
|
2674
2674
|
y([
|
|
2675
2675
|
c({ type: Boolean })
|
|
2676
|
-
],
|
|
2676
|
+
], v.prototype, "busy", 2);
|
|
2677
2677
|
y([
|
|
2678
2678
|
c()
|
|
2679
|
-
],
|
|
2679
|
+
], v.prototype, "alt", 2);
|
|
2680
2680
|
y([
|
|
2681
2681
|
c({ attribute: "busy-label" })
|
|
2682
|
-
],
|
|
2682
|
+
], v.prototype, "busyLabel", 2);
|
|
2683
2683
|
y([
|
|
2684
2684
|
c({ attribute: "error-label" })
|
|
2685
|
-
],
|
|
2685
|
+
], v.prototype, "errorLabel", 2);
|
|
2686
2686
|
y([
|
|
2687
2687
|
c({ attribute: "fullscreen-label" })
|
|
2688
|
-
],
|
|
2688
|
+
], v.prototype, "fullscreenLabel", 2);
|
|
2689
2689
|
y([
|
|
2690
2690
|
c({ attribute: "exit-fullscreen-label" })
|
|
2691
|
-
],
|
|
2691
|
+
], v.prototype, "exitFullscreenLabel", 2);
|
|
2692
2692
|
y([
|
|
2693
2693
|
c({ attribute: "fullsize-url" })
|
|
2694
|
-
],
|
|
2694
|
+
], v.prototype, "fullsizeUrl", 2);
|
|
2695
2695
|
y([
|
|
2696
2696
|
c({ attribute: !1 })
|
|
2697
|
-
],
|
|
2697
|
+
], v.prototype, "shimmerConfig", 2);
|
|
2698
2698
|
y([
|
|
2699
2699
|
C()
|
|
2700
|
-
],
|
|
2700
|
+
], v.prototype, "_displayedUrl", 2);
|
|
2701
2701
|
y([
|
|
2702
2702
|
C()
|
|
2703
|
-
],
|
|
2703
|
+
], v.prototype, "_fadingUrl", 2);
|
|
2704
2704
|
y([
|
|
2705
2705
|
C()
|
|
2706
|
-
],
|
|
2706
|
+
], v.prototype, "_failed", 2);
|
|
2707
2707
|
y([
|
|
2708
2708
|
C()
|
|
2709
|
-
],
|
|
2709
|
+
], v.prototype, "_frameReady", 2);
|
|
2710
2710
|
y([
|
|
2711
2711
|
C()
|
|
2712
|
-
],
|
|
2712
|
+
], v.prototype, "_fullscreen", 2);
|
|
2713
2713
|
y([
|
|
2714
2714
|
F(".canvas")
|
|
2715
|
-
],
|
|
2715
|
+
], v.prototype, "_canvasEl", 2);
|
|
2716
2716
|
y([
|
|
2717
2717
|
F(".canvas__viewport")
|
|
2718
|
-
],
|
|
2718
|
+
], v.prototype, "_viewportEl", 2);
|
|
2719
2719
|
y([
|
|
2720
2720
|
F(".canvas__frame")
|
|
2721
|
-
],
|
|
2721
|
+
], v.prototype, "_frameEl", 2);
|
|
2722
2722
|
y([
|
|
2723
2723
|
F(".canvas__image")
|
|
2724
|
-
],
|
|
2724
|
+
], v.prototype, "_imageEl", 2);
|
|
2725
2725
|
y([
|
|
2726
2726
|
F(".dot-grid")
|
|
2727
|
-
],
|
|
2728
|
-
|
|
2727
|
+
], v.prototype, "_dotGridEl", 2);
|
|
2728
|
+
v = y([
|
|
2729
2729
|
H("uc-ai-canvas")
|
|
2730
|
-
],
|
|
2731
|
-
const
|
|
2732
|
-
var
|
|
2733
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
2730
|
+
], v);
|
|
2731
|
+
const Sr = ":host{display:block;container-type:inline-size}.footer{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:var(--uc-ai-padding);background:transparent}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:var(--uc-ai-button-size);padding:0 14px;border:0;border-radius:var(--uc-ai-radius-button);font-family:inherit;font-size:14px;font-weight:500;cursor:pointer;transition:background .15s ease,filter .15s ease,transform .14s var(--uc-ai-ease-out, ease)}.btn:active{transform:scale(.97)}.btn--ghost{background:var(--uc-ai-secondary);color:var(--uc-ai-secondary-foreground)}.btn--primary{background:var(--uc-ai-primary);color:var(--uc-ai-primary-foreground)}@media(hover:hover)and (pointer:fine){.btn--ghost:hover{background:var(--uc-ai-secondary-hover)}.btn--primary:hover{background:var(--uc-ai-primary-hover)}}.btn--primary:disabled{opacity:.5;cursor:not-allowed;background:var(--uc-ai-primary)}.btn svg{width:14px;height:14px}@media(prefers-reduced-motion:reduce){.btn{transition-property:background,filter}.btn:active{transform:none}}";
|
|
2732
|
+
var Cr = Object.defineProperty, $r = Object.getOwnPropertyDescriptor, ae = (t, e, i, r) => {
|
|
2733
|
+
for (var s = r > 1 ? void 0 : r ? $r(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
2734
2734
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
2735
|
-
return r && s &&
|
|
2735
|
+
return r && s && Cr(e, i, s), s;
|
|
2736
2736
|
};
|
|
2737
2737
|
let K = class extends G {
|
|
2738
2738
|
constructor() {
|
|
@@ -2762,7 +2762,7 @@ let K = class extends G {
|
|
|
2762
2762
|
`;
|
|
2763
2763
|
}
|
|
2764
2764
|
};
|
|
2765
|
-
K.styles = j(
|
|
2765
|
+
K.styles = j(Sr);
|
|
2766
2766
|
ae([
|
|
2767
2767
|
c({ attribute: "cancel-label" })
|
|
2768
2768
|
], K.prototype, "cancelLabel", 2);
|
|
@@ -2775,13 +2775,13 @@ ae([
|
|
|
2775
2775
|
K = ae([
|
|
2776
2776
|
H("uc-ai-footer")
|
|
2777
2777
|
], K);
|
|
2778
|
-
const
|
|
2779
|
-
var
|
|
2780
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
2778
|
+
const Ar = ":host{--uc-ai-foreground: light-dark(#181818, #e1e1e1);--uc-ai-background: light-dark(#ffffff, #1b1b1b);--uc-ai-floating: var(--uc-floating, light-dark(#ffffff, #242424));--uc-ai-floating-border: var(--uc-floating-border, light-dark(transparent, rgba(255, 255, 255, .05)));--uc-ai-muted: light-dark(#f5f5f5, #242424);--uc-ai-muted-foreground: light-dark(#717171, #989898);--uc-ai-primary: light-dark(#174bd7, #579aff);--uc-ai-primary-hover: light-dark(#1141c0, #4a8aef);--uc-ai-primary-foreground: light-dark(#ffffff, #000000);--uc-ai-primary-transparent: light-dark(rgba(23, 75, 215, .07), rgba(87, 154, 255, .07));--uc-ai-secondary: light-dark(rgba(24, 24, 24, .05), rgba(225, 225, 225, .07));--uc-ai-secondary-hover: light-dark(rgba(24, 24, 24, .08), rgba(225, 225, 225, .1));--uc-ai-secondary-foreground: light-dark(#181818, #e1e1e1);--uc-ai-border: light-dark(#e4e4e8, #3d3d3d);--uc-ai-shadow-color: light-dark(rgba(24, 24, 24, .18), rgba(0, 0, 0, .5));--uc-ai-dialog-shadow: 0 6px 20px light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .25));--uc-ai-composer-shadow: 0 4px 14px light-dark(rgba(0, 0, 0, .18), rgba(0, 0, 0, .34)), 0 0 26px light-dark(rgba(0, 0, 0, .2), rgba(0, 0, 0, .42));--uc-ai-composer-shadow-peek: 0 2px 10px light-dark(rgba(0, 0, 0, .16), rgba(0, 0, 0, .34));--uc-ai-composer-radius: var(--uc-ai-radius-frame);--uc-ai-composer-radius-top: var(--uc-ai-composer-radius);--uc-ai-composer-radius-bottom: var(--uc-ai-composer-radius);--uc-ai-destructive: #d8473e;--uc-ai-destructive-foreground: light-dark(#b3261e, #ff9d96);--uc-ai-radius: 8px;--uc-ai-radius-button: var(--uc-ai-radius);--uc-ai-radius-input: calc(var(--uc-ai-radius) * 1.5);--uc-ai-radius-card: calc(var(--uc-ai-radius) * 2);--uc-ai-radius-frame: calc(var(--uc-ai-radius) * 2.25);--uc-ai-padding: 10px;--uc-ai-button-size: 32px;--uc-ai-font-family: system-ui, -apple-system, sans-serif;--uc-ai-font-size: 14px;--uc-ai-transition: .2s ease;--uc-ai-ease-out: cubic-bezier(.23, 1, .32, 1);--uc-ai-ease-in-out: cubic-bezier(.77, 0, .175, 1);--uc-ai-dot-grid-color: light-dark(rgba(0, 0, 0, .21), rgba(255, 255, 255, .1));--uc-ai-prompt-max-lines: 6;--uc-ai-prompt-max-height: calc(var(--uc-ai-prompt-max-lines) * 1.5em + 10px);display:block;width:100%;height:100%;font-family:var(--uc-ai-font-family);font-size:var(--uc-ai-font-size);color:var(--uc-ai-foreground);color-scheme:light dark;container-type:inline-size}:host([hidden]){display:none}:host(.uc-light),:host-context(.uc-light){color-scheme:light}:host(.uc-dark),:host-context(.uc-dark){color-scheme:dark}.shell{display:flex;flex-direction:column;background:var(--uc-ai-background);border-radius:var(--uc-ai-radius-card);overflow:hidden;box-shadow:var(--uc-ai-dialog-shadow);height:100%}.stage{position:relative;flex:1;min-height:360px;overflow:hidden;background:var(--uc-ai-background)}uc-ai-canvas{position:absolute;top:0;right:0;bottom:0;left:0}.composer{width:700px;max-width:calc(100% - 40px)}.composer__content{display:flex;flex-direction:column;gap:14px;align-items:center}.composer--overlay{position:absolute;left:50%;transform:translate(-50%);z-index:5;transition:transform .48s var(--uc-ai-ease-out)}.composer--overlay-bottom{bottom:32px}.composer--overlay-top{top:32px}.composer--docked{margin-inline:auto;padding:14px 20px;position:relative;z-index:1}.composer--docked-bottom{padding-top:8px}.composer--docked-top{padding-bottom:8px}.history-pinned{position:absolute;left:50%;transform:translate(-50%);width:700px;max-width:calc(100% - 40px);z-index:5}.history-pinned--canvas-top{top:20px}.history-pinned--canvas-bottom{bottom:20px}.history-pinned--docked.history-pinned--canvas-top{top:6px}.history-pinned--docked.history-pinned--canvas-bottom{bottom:6px}.dock-hotzone{position:absolute;left:0;right:0;height:100px;z-index:4;pointer-events:none}.dock-hotzone--bottom{bottom:0}.dock-hotzone--top{top:0}:host([composer-auto-hide]) .stage:not(.is-empty) .dock-hotzone{pointer-events:auto}.composer-fade{position:absolute;left:0;right:0;height:26px;z-index:6;pointer-events:none;opacity:0;transition:opacity .3s var(--uc-ai-ease-out)}.composer-fade--bottom{bottom:0;background:linear-gradient(to top,var(--uc-ai-background) 0,var(--uc-ai-background) 8px,transparent)}.composer-fade--top{top:0;background:linear-gradient(to bottom,var(--uc-ai-background) 0,var(--uc-ai-background) 8px,transparent)}:host([composer-auto-hide]) .stage:not(.is-empty) .composer-fade{opacity:1}:host([composer-auto-hide]) .stage:not(.is-empty):has(.dock-hotzone:hover) .composer-fade,:host([composer-auto-hide]) .stage:not(.is-empty):has(.composer--overlay:hover) .composer-fade,:host([composer-auto-hide]) .stage:not(.is-empty):has(.composer--overlay:focus-within) .composer-fade{opacity:0}:host([composer-auto-hide]) .stage:not(.is-empty) .composer--overlay-bottom{transform:translate(-50%,calc(100% + 4px))}:host([composer-auto-hide]) .stage:not(.is-empty) .composer--overlay-top{transform:translate(-50%,calc(-100% - 4px))}:host([composer-auto-hide]) .stage:not(.is-empty):not(:has(.composer--overlay:hover)):not(:has(.composer--overlay:focus-within)):not(:has(.dock-hotzone:hover)) .composer--overlay{--uc-ai-composer-shadow: var(--uc-ai-composer-shadow-peek)}:host([composer-auto-hide]) .stage:not(.is-empty):not(:has(.composer--overlay:hover)):not(:has(.composer--overlay:focus-within)):not(:has(.dock-hotzone:hover)) .composer--overlay-bottom{--uc-ai-composer-radius-bottom: 0px}:host([composer-auto-hide]) .stage:not(.is-empty):not(:has(.composer--overlay:hover)):not(:has(.composer--overlay:focus-within)):not(:has(.dock-hotzone:hover)) .composer--overlay-top{--uc-ai-composer-radius-top: 0px}:host([composer-auto-hide]) .stage:not(.is-empty):has(.dock-hotzone--bottom:hover) .composer--overlay-bottom,:host([composer-auto-hide]) .stage:not(.is-empty):has(.composer--overlay-bottom:hover) .composer--overlay-bottom,:host([composer-auto-hide]) .stage:not(.is-empty):has(.composer--overlay-bottom:focus-within) .composer--overlay-bottom,:host([composer-auto-hide]) .stage:not(.is-empty):has(.dock-hotzone--top:hover) .composer--overlay-top,:host([composer-auto-hide]) .stage:not(.is-empty):has(.composer--overlay-top:hover) .composer--overlay-top,:host([composer-auto-hide]) .stage:not(.is-empty):has(.composer--overlay-top:focus-within) .composer--overlay-top{transform:translate(-50%)}:host([composer-auto-hide]) .stage:not(.is-empty):has(.dock-hotzone:hover) .dock-hotzone,:host([composer-auto-hide]) .stage:not(.is-empty):has(.composer--overlay:hover) .dock-hotzone,:host([composer-auto-hide]) .stage:not(.is-empty):has(.composer--overlay:focus-within) .dock-hotzone{height:320px}:host([composer-auto-hide]) .shell--has-image .composer--docked{margin-block:8px 14px;position:relative}:host([composer-auto-hide]) .shell--has-image .composer--docked .composer__content{position:relative;transition:transform .5s var(--uc-ai-ease-out)}:host([composer-auto-hide]) .shell--has-image .composer--docked .composer__content uc-ai-history{position:absolute;left:0;right:0}:host([composer-auto-hide]) .shell--has-image .composer--docked-bottom .composer__content uc-ai-history{bottom:calc(100% + 14px)}:host([composer-auto-hide]) .shell--has-image .composer--docked-top .composer__content uc-ai-history{top:calc(100% + 14px)}:host([composer-auto-hide]) .shell--has-image .composer--docked-bottom{clip-path:inset(-200px -200px 0 -200px)}:host([composer-auto-hide]) .shell--has-image .composer--docked-top{clip-path:inset(0 -200px -200px -200px)}:host([composer-auto-hide]) .shell--has-image:not(:has(.composer--docked:hover)):not(:has(.composer--docked:focus-within)) .composer--docked{--uc-ai-composer-shadow: var(--uc-ai-composer-shadow-peek)}:host([composer-auto-hide]) .shell--has-image:not(:has(.composer--docked:hover)):not(:has(.composer--docked:focus-within)) .composer--docked-bottom .composer__content{transform:translateY(calc(100% - 22px))}:host([composer-auto-hide]) .shell--has-image:not(:has(.composer--docked:hover)):not(:has(.composer--docked:focus-within)) .composer--docked-top .composer__content{transform:translateY(calc(-100% + 22px))}uc-ai-history,uc-ai-prompt-row{width:100%}.error-box{position:absolute;top:0;right:0;bottom:0;left:0;z-index:6;display:grid;place-items:center;padding:20px;pointer-events:none}.error-box__card{pointer-events:auto;max-width:75%;padding:10px 15px;background:var(--uc-ai-floating, var(--uc-ai-background));border:1px solid var(--uc-ai-floating-border, transparent);border-radius:var(--uc-ai-radius-card);box-shadow:var(--uc-ai-dialog-shadow);color:var(--uc-ai-destructive-foreground);font-size:14px;line-height:1.4;text-align:center}";
|
|
2779
|
+
var Ur = Object.defineProperty, Tr = Object.getOwnPropertyDescriptor, m = (t, e, i, r) => {
|
|
2780
|
+
for (var s = r > 1 ? void 0 : r ? Tr(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
2781
2781
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
2782
|
-
return r && s &&
|
|
2782
|
+
return r && s && Ur(e, i, s), s;
|
|
2783
2783
|
};
|
|
2784
|
-
const
|
|
2784
|
+
const Fr = ["top", "bottom"], Mr = ["bottom", "top", "none"], Or = ["full", "available"], Ir = [
|
|
2785
2785
|
"composer-above",
|
|
2786
2786
|
"composer-below",
|
|
2787
2787
|
"canvas-top",
|
|
@@ -2789,12 +2789,12 @@ const Tr = ["top", "bottom"], Fr = ["full", "available"], Mr = [
|
|
|
2789
2789
|
];
|
|
2790
2790
|
let d = class extends G {
|
|
2791
2791
|
constructor() {
|
|
2792
|
-
super(...arguments), this.sourceUuid = null, this.pubkey = "", this.aspectRatios = null, this.localeName = "en", this.localeDefinitionOverride = {}, this.presetsOnly = !1, this.presets = {}, this.composerPlacement = "bottom", this.canvasFit = "available", this.historyPlacement = "composer-above", this.composerAutoHide = !1, this.toolbarPlacement = "bottom", this._prompt = "", this._selectedRatio = null, this._inputUrl = null, this._gen = new
|
|
2792
|
+
super(...arguments), this.sourceUuid = null, this.pubkey = "", this.aspectRatios = null, this.localeName = "en", this.localeDefinitionOverride = {}, this.presetsOnly = !1, this.presets = {}, this.composerPlacement = "bottom", this.canvasFit = "available", this.historyPlacement = "composer-above", this.composerAutoHide = !1, this.toolbarPlacement = "bottom", this._prompt = "", this._selectedRatio = null, this._inputUrl = null, this._gen = new Ri(this), this._history = new zi(this), this._secure = new _t(this), this._localeStrings = B, this._localeToken = 0, this._lastPreviewUrl = null, this._ratioOptionsCache = /* @__PURE__ */ new Map(), this._labelForOption = (t) => t.labelKey ? this._l(t.labelKey) : "", this._lastResult = null;
|
|
2793
2793
|
}
|
|
2794
2794
|
/** @internal */
|
|
2795
2795
|
willUpdate(t) {
|
|
2796
2796
|
const e = t.has("provider") || t.has("pubkey") || t.has("baseUrl") || t.has("cdnCname") || t.has("cdnCnamePrefixed");
|
|
2797
|
-
e && (this._provider = this.provider ?? (this.pubkey ? new
|
|
2797
|
+
e && (this._provider = this.provider ?? (this.pubkey ? new Ei({
|
|
2798
2798
|
publicKey: this.pubkey,
|
|
2799
2799
|
baseUrl: this.baseUrl,
|
|
2800
2800
|
cdnBaseUrl: this.cdnCname,
|
|
@@ -2819,7 +2819,7 @@ let d = class extends G {
|
|
|
2819
2819
|
this._lastMode = r, this._selectedRatio = r === "edit" ? V : this._defaultGenerateRatio();
|
|
2820
2820
|
else if (t.has("aspectRatios")) {
|
|
2821
2821
|
const s = this._selectedRatio;
|
|
2822
|
-
|
|
2822
|
+
I(s) && !this._standardRatios().some((o) => _e(o, s)) && (this._selectedRatio = this._defaultGenerateRatio());
|
|
2823
2823
|
}
|
|
2824
2824
|
t.has("aspectRatios") && this._ratioOptionsCache.clear(), (t.has("localeName") || t.has("localeDefinitionOverride")) && this._resolveLocale();
|
|
2825
2825
|
}
|
|
@@ -2839,7 +2839,7 @@ let d = class extends G {
|
|
|
2839
2839
|
this._localeStrings = r ? { ...i, ...r } : i;
|
|
2840
2840
|
}
|
|
2841
2841
|
_l(t) {
|
|
2842
|
-
return
|
|
2842
|
+
return $i(t, this._localeStrings);
|
|
2843
2843
|
}
|
|
2844
2844
|
/** Friendly message for the current failure: the per-`error_code` string
|
|
2845
2845
|
* (`ai-enhancer-error-<code>`, overridable via the locale) when one is
|
|
@@ -2947,7 +2947,7 @@ let d = class extends G {
|
|
|
2947
2947
|
const t = this._displayUrl;
|
|
2948
2948
|
if (!t)
|
|
2949
2949
|
return this._lastPreviewUrl = null, null;
|
|
2950
|
-
const e = this._secure.resolve(
|
|
2950
|
+
const e = this._secure.resolve(Oi(t, this.clientWidth || 1024));
|
|
2951
2951
|
return e != null && (this._lastPreviewUrl = e), this._lastPreviewUrl;
|
|
2952
2952
|
}
|
|
2953
2953
|
/** Full-resolution rendition for fullscreen, secure-delivery-resolved. */
|
|
@@ -2956,7 +2956,7 @@ let d = class extends G {
|
|
|
2956
2956
|
}
|
|
2957
2957
|
/** The configured (or popular) standard ratios, validated. */
|
|
2958
2958
|
_standardRatios() {
|
|
2959
|
-
const t = (this.aspectRatios ?? []).filter(
|
|
2959
|
+
const t = (this.aspectRatios ?? []).filter(Ee);
|
|
2960
2960
|
return t.length > 0 ? t : [...kt];
|
|
2961
2961
|
}
|
|
2962
2962
|
/**
|
|
@@ -2966,12 +2966,12 @@ let d = class extends G {
|
|
|
2966
2966
|
*/
|
|
2967
2967
|
_defaultGenerateRatio() {
|
|
2968
2968
|
const t = this._standardRatios();
|
|
2969
|
-
return t.find((e) => _e(e,
|
|
2969
|
+
return t.find((e) => _e(e, Rt)) ?? t[0] ?? null;
|
|
2970
2970
|
}
|
|
2971
2971
|
_ratioOptions(t) {
|
|
2972
2972
|
const e = this._ratioOptionsCache.get(t);
|
|
2973
2973
|
if (e) return e;
|
|
2974
|
-
const i = this._standardRatios().map(
|
|
2974
|
+
const i = this._standardRatios().map(Ut), r = t === "edit" ? [{ value: V, labelKey: "ai-enhancer-aspect-original" }, ...i] : i;
|
|
2975
2975
|
return this._ratioOptionsCache.set(t, r), r;
|
|
2976
2976
|
}
|
|
2977
2977
|
/**
|
|
@@ -3012,7 +3012,7 @@ let d = class extends G {
|
|
|
3012
3012
|
mode: i,
|
|
3013
3013
|
// "Original" (and generate's null) omit the ratio; only a concrete pick
|
|
3014
3014
|
// is sent — in edit that reshapes, otherwise the source AR is preserved.
|
|
3015
|
-
aspectRatio:
|
|
3015
|
+
aspectRatio: I(this._selectedRatio) ? this._selectedRatio : void 0,
|
|
3016
3016
|
// Record the full selection (incl. "Original") so the history entry can
|
|
3017
3017
|
// restore the picker when re-selected.
|
|
3018
3018
|
ratioValue: this._selectedRatio,
|
|
@@ -3071,33 +3071,49 @@ let d = class extends G {
|
|
|
3071
3071
|
return (e = this._promptRow) == null ? void 0 : e.focusInput();
|
|
3072
3072
|
});
|
|
3073
3073
|
}
|
|
3074
|
-
|
|
3074
|
+
/** Snapshot of the current generation result in the `uc:done` payload shape. */
|
|
3075
|
+
_resultDetail() {
|
|
3075
3076
|
const t = this._gen.result;
|
|
3076
|
-
|
|
3077
|
-
const e = {
|
|
3077
|
+
return t ? {
|
|
3078
3078
|
url: t.url,
|
|
3079
3079
|
uuid: t.uuid,
|
|
3080
3080
|
prompt: t.prompt,
|
|
3081
3081
|
mode: t.mode,
|
|
3082
|
-
aspectRatio:
|
|
3082
|
+
aspectRatio: I(this._selectedRatio) ? this._selectedRatio : void 0,
|
|
3083
3083
|
file: t.file
|
|
3084
|
-
};
|
|
3085
|
-
|
|
3084
|
+
} : null;
|
|
3085
|
+
}
|
|
3086
|
+
_onPrimary() {
|
|
3087
|
+
const t = this._resultDetail();
|
|
3088
|
+
t && this.dispatchEvent(new CustomEvent("uc:done", { detail: t, bubbles: !0, composed: !0 }));
|
|
3086
3089
|
}
|
|
3087
3090
|
_onCancel(t) {
|
|
3088
3091
|
t.stopPropagation(), this.dispatchEvent(new CustomEvent("uc:cancel", { bubbles: !0, composed: !0 }));
|
|
3089
3092
|
}
|
|
3093
|
+
/**
|
|
3094
|
+
* Every result mutation (generation, history selection, reset) goes through
|
|
3095
|
+
* the generation controller's requestUpdate, so comparing here catches them
|
|
3096
|
+
* all with one code path.
|
|
3097
|
+
* @internal
|
|
3098
|
+
*/
|
|
3099
|
+
updated(t) {
|
|
3100
|
+
if (super.updated(t), this._gen.result !== this._lastResult) {
|
|
3101
|
+
this._lastResult = this._gen.result;
|
|
3102
|
+
const e = { result: this._resultDetail() };
|
|
3103
|
+
this.dispatchEvent(new CustomEvent("uc:change", { detail: e, bubbles: !0, composed: !0 }));
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3090
3106
|
/** @internal */
|
|
3091
3107
|
render() {
|
|
3092
|
-
var
|
|
3093
|
-
const t = this._mode, e = t === "edit" && !this.sourceUuid && !this.sourceFileInfo, i = ye[t].placeholderKey, r = ((
|
|
3108
|
+
var Me, Oe;
|
|
3109
|
+
const t = this._mode, e = t === "edit" && !this.sourceUuid && !this.sourceFileInfo, i = ye[t].placeholderKey, r = ((Me = this.presets) == null ? void 0 : Me[t]) ?? ye[t].presets, s = this._gen.busy || !this._gen.result, o = this._ratioOptions(t), a = this._displayUrl != null, n = I(this._selectedRatio) ? this._selectedRatio[0] / this._selectedRatio[1] : null, l = {
|
|
3094
3110
|
stage: !0,
|
|
3095
3111
|
"is-empty": !a
|
|
3096
|
-
}, h =
|
|
3112
|
+
}, h = Fr.includes(this.composerPlacement) ? this.composerPlacement : "bottom", u = (Or.includes(this.canvasFit) ? this.canvasFit : "available") === "full", _ = !u, x = `${u ? "overlay" : "docked"}-${h}`, w = Ir.includes(this.historyPlacement) ? this.historyPlacement : "composer-above", $ = w === "composer-above" || w === "composer-below", R = (u || _ && this.composerAutoHide) && $, O = w === "canvas-top" ? "top" : w === "canvas-bottom" ? "bottom" : h, W = this._historyEntries, X = W.length > 0 || e, ne = X ? f`
|
|
3097
3113
|
<uc-ai-history
|
|
3098
3114
|
.busy=${this._gen.busy}
|
|
3099
3115
|
.entries=${W}
|
|
3100
|
-
.selectedUuid=${((
|
|
3116
|
+
.selectedUuid=${((Oe = this._gen.result) == null ? void 0 : Oe.uuid) ?? this._sourceUuid}
|
|
3101
3117
|
?show-start-over=${e}
|
|
3102
3118
|
start-over-label="${this._l("ai-enhancer-start-over")}"
|
|
3103
3119
|
list-label="${this._l("ai-enhancer-history-title")}"
|
|
@@ -3105,7 +3121,7 @@ let d = class extends G {
|
|
|
3105
3121
|
@uc:select=${this._onSelectHistoryEntry}
|
|
3106
3122
|
@uc:start-over=${this._onStartOver}
|
|
3107
3123
|
></uc-ai-history>
|
|
3108
|
-
` :
|
|
3124
|
+
` : g, gt = f`
|
|
3109
3125
|
<uc-ai-prompt-row
|
|
3110
3126
|
.mode=${t}
|
|
3111
3127
|
.value=${this._prompt}
|
|
@@ -3124,7 +3140,7 @@ let d = class extends G {
|
|
|
3124
3140
|
.busy=${this._gen.busy}
|
|
3125
3141
|
@uc:select=${this._onSelectPreset}
|
|
3126
3142
|
></uc-ai-chips>
|
|
3127
|
-
` :
|
|
3143
|
+
` : g}
|
|
3128
3144
|
${o.length > 0 ? f`
|
|
3129
3145
|
<uc-ai-aspect-ratio
|
|
3130
3146
|
slot="aspect-ratio"
|
|
@@ -3135,7 +3151,7 @@ let d = class extends G {
|
|
|
3135
3151
|
aria-label-text="${this._l("ai-enhancer-aspect-ratio-aria")}"
|
|
3136
3152
|
@uc:select=${this._onSelectAspectRatio}
|
|
3137
3153
|
></uc-ai-aspect-ratio>
|
|
3138
|
-
` :
|
|
3154
|
+
` : g}
|
|
3139
3155
|
</uc-ai-prompt-row>
|
|
3140
3156
|
`, le = f`
|
|
3141
3157
|
<div
|
|
@@ -3147,23 +3163,23 @@ let d = class extends G {
|
|
|
3147
3163
|
})}
|
|
3148
3164
|
>
|
|
3149
3165
|
<div class="composer__content">
|
|
3150
|
-
${R && w === "composer-above" ? ne :
|
|
3151
|
-
${
|
|
3152
|
-
${R && w === "composer-below" ? ne :
|
|
3166
|
+
${R && w === "composer-above" ? ne : g}
|
|
3167
|
+
${gt}
|
|
3168
|
+
${R && w === "composer-below" ? ne : g}
|
|
3153
3169
|
</div>
|
|
3154
3170
|
</div>
|
|
3155
|
-
`,
|
|
3171
|
+
`, vt = X && !R ? f`<div
|
|
3156
3172
|
class=${S({
|
|
3157
3173
|
"history-pinned": !0,
|
|
3158
3174
|
"history-pinned--docked": _,
|
|
3159
|
-
[`history-pinned--canvas-${
|
|
3175
|
+
[`history-pinned--canvas-${O}`]: !0
|
|
3160
3176
|
})}
|
|
3161
3177
|
>
|
|
3162
3178
|
${ne}
|
|
3163
|
-
</div>` :
|
|
3179
|
+
</div>` : g, bt = this.composerAutoHide && u ? f`
|
|
3164
3180
|
<div class=${S({ "dock-hotzone": !0, [`dock-hotzone--${h}`]: !0 })}></div>
|
|
3165
3181
|
<div class=${S({ "composer-fade": !0, [`composer-fade--${h}`]: !0 })}></div>
|
|
3166
|
-
` :
|
|
3182
|
+
` : g, Ue = Mr.includes(this.toolbarPlacement) ? this.toolbarPlacement : "bottom", Te = Ue === "top", Fe = Ue === "none" ? g : f`
|
|
3167
3183
|
<uc-ai-footer
|
|
3168
3184
|
cancel-label="${this._l("ai-enhancer-cancel")}"
|
|
3169
3185
|
primary-label="${this._l("ai-enhancer-done-btn")}"
|
|
@@ -3178,8 +3194,8 @@ let d = class extends G {
|
|
|
3178
3194
|
role="region"
|
|
3179
3195
|
aria-label="${this._l(t === "edit" ? "ai-enhancer-edit-title" : "ai-enhancer-generate-title")}"
|
|
3180
3196
|
>
|
|
3181
|
-
${
|
|
3182
|
-
${_ && h === "top" ? le :
|
|
3197
|
+
${Te ? Fe : g}
|
|
3198
|
+
${_ && h === "top" ? le : g}
|
|
3183
3199
|
<div class=${S(l)}>
|
|
3184
3200
|
<uc-ai-canvas
|
|
3185
3201
|
.url=${this._previewUrl}
|
|
@@ -3195,21 +3211,21 @@ let d = class extends G {
|
|
|
3195
3211
|
exit-fullscreen-label="${this._l("ai-enhancer-exit-fullscreen")}"
|
|
3196
3212
|
></uc-ai-canvas>
|
|
3197
3213
|
|
|
3214
|
+
${bt}
|
|
3198
3215
|
${vt}
|
|
3199
|
-
${
|
|
3200
|
-
${u ? le : v}
|
|
3216
|
+
${u ? le : g}
|
|
3201
3217
|
|
|
3202
3218
|
${this._gen.error ? f`<div class="error-box" role="alert">
|
|
3203
3219
|
<div class="error-box__card">${this._errorMessage()}</div>
|
|
3204
|
-
</div>` :
|
|
3220
|
+
</div>` : g}
|
|
3205
3221
|
</div>
|
|
3206
|
-
${_ && h === "bottom" ? le :
|
|
3207
|
-
${
|
|
3222
|
+
${_ && h === "bottom" ? le : g}
|
|
3223
|
+
${Te ? g : Fe}
|
|
3208
3224
|
</div>
|
|
3209
3225
|
`;
|
|
3210
3226
|
}
|
|
3211
3227
|
};
|
|
3212
|
-
d.styles = j(
|
|
3228
|
+
d.styles = j(Ar);
|
|
3213
3229
|
m([
|
|
3214
3230
|
c({ attribute: "source-uuid" })
|
|
3215
3231
|
], d.prototype, "sourceUuid", 2);
|
|
@@ -3241,7 +3257,7 @@ m([
|
|
|
3241
3257
|
c({ attribute: !1 })
|
|
3242
3258
|
], d.prototype, "secureDeliveryProxyUrlResolver", 2);
|
|
3243
3259
|
m([
|
|
3244
|
-
c({ type: Array, attribute: "aspect-ratios", converter: (t) => t ?
|
|
3260
|
+
c({ type: Array, attribute: "aspect-ratios", converter: (t) => t ? Tt(t) : null })
|
|
3245
3261
|
], d.prototype, "aspectRatios", 2);
|
|
3246
3262
|
m([
|
|
3247
3263
|
c({ attribute: "locale-name" })
|
|
@@ -3298,11 +3314,11 @@ d = m([
|
|
|
3298
3314
|
H("uc-ai-enhancer")
|
|
3299
3315
|
], d);
|
|
3300
3316
|
export {
|
|
3301
|
-
|
|
3317
|
+
Kr as I,
|
|
3302
3318
|
pe as L,
|
|
3303
3319
|
kt as P,
|
|
3304
3320
|
d as U,
|
|
3305
|
-
|
|
3321
|
+
qr as a,
|
|
3306
3322
|
B as e,
|
|
3307
|
-
|
|
3323
|
+
Ee as i
|
|
3308
3324
|
};
|