@uploadcare/ai-enhancer 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -288
- package/dist/UcAiEnhancer-Co-HZ72E.cjs +444 -0
- package/dist/{UcAiEnhancer-D1z2-v9q.js → UcAiEnhancer-DK6rhHp7.js} +498 -489
- package/dist/ai-enhancer.cjs +1 -1
- package/dist/ai-enhancer.d.ts +73 -54
- package/dist/ai-enhancer.js +5 -3
- package/dist/errors.cjs +1 -0
- package/dist/errors.d.ts +81 -0
- package/dist/errors.js +8 -0
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +11 -3
- package/dist/UcAiEnhancer-D0mic9eT.cjs +0 -444
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var bt = Object.defineProperty;
|
|
2
|
+
var Ie = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var b = (t, e, i) =>
|
|
7
|
-
var E = (t, e, i) => (
|
|
8
|
-
import { unsafeCSS as
|
|
9
|
-
import { property as c, state as C, query as F, customElement as
|
|
5
|
+
var yt = (t, e, i) => e in t ? bt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
6
|
+
var b = (t, e, i) => yt(t, typeof e != "symbol" ? e + "" : e, i), ce = (t, e, i) => e.has(t) || Ie("Cannot " + i);
|
|
7
|
+
var E = (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), Oe = (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 v } from "lit";
|
|
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
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
11
|
+
import { AiEnhancerError as Z } from "./errors.js";
|
|
12
|
+
import { unsafeSVG as re } from "lit/directives/unsafe-svg.js";
|
|
13
|
+
import { nothing as rt } from "lit/html.js";
|
|
14
|
+
import { directive as st, PartType as ot } from "lit/directive.js";
|
|
15
|
+
import { AsyncDirective as at } from "lit/async-directive.js";
|
|
16
|
+
import { repeat as wt } from "lit/directives/repeat.js";
|
|
17
|
+
import { ifDefined as xt } from "lit/directives/if-defined.js";
|
|
18
|
+
const V = "original";
|
|
17
19
|
function O(t) {
|
|
18
|
-
return t != null && t !==
|
|
20
|
+
return t != null && t !== V;
|
|
19
21
|
}
|
|
20
|
-
function
|
|
21
|
-
return t ===
|
|
22
|
+
function _e(t, e) {
|
|
23
|
+
return t === V || e === V ? t === e : Tt(t, e);
|
|
22
24
|
}
|
|
23
|
-
const
|
|
25
|
+
const kt = [
|
|
24
26
|
[2, 3],
|
|
25
27
|
[3, 2],
|
|
26
28
|
[1, 1],
|
|
27
29
|
[9, 16],
|
|
28
30
|
[16, 9]
|
|
29
|
-
],
|
|
31
|
+
], Et = [3, 2], Rt = {
|
|
30
32
|
"1:1": "ai-enhancer-aspect-square",
|
|
31
33
|
"2:3": "ai-enhancer-aspect-tall",
|
|
32
34
|
"3:2": "ai-enhancer-aspect-wide",
|
|
@@ -34,23 +36,23 @@ const yt = [
|
|
|
34
36
|
"5:4": "ai-enhancer-aspect-landscape",
|
|
35
37
|
"9:16": "ai-enhancer-aspect-vertical",
|
|
36
38
|
"16:9": "ai-enhancer-aspect-widescreen"
|
|
37
|
-
},
|
|
38
|
-
function
|
|
39
|
+
}, St = 0.1, Ct = 10;
|
|
40
|
+
function ke(t) {
|
|
39
41
|
const [e, i] = t;
|
|
40
42
|
if (!Number.isFinite(e) || !Number.isFinite(i) || e <= 0 || i <= 0) return !1;
|
|
41
43
|
const r = e / i;
|
|
42
|
-
return r >=
|
|
44
|
+
return r >= St && r <= Ct;
|
|
43
45
|
}
|
|
44
|
-
function
|
|
46
|
+
function ee(t) {
|
|
45
47
|
return `${t[0]}:${t[1]}`;
|
|
46
48
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
49
|
+
function $t(t) {
|
|
50
|
+
return Rt[ee(t)] ?? null;
|
|
49
51
|
}
|
|
50
|
-
function
|
|
51
|
-
return { value: t, labelKey:
|
|
52
|
+
function At(t) {
|
|
53
|
+
return { value: t, labelKey: $t(t) };
|
|
52
54
|
}
|
|
53
|
-
function
|
|
55
|
+
function Ut(t) {
|
|
54
56
|
const e = [];
|
|
55
57
|
for (const i of t.split(/[\s,]+/)) {
|
|
56
58
|
const r = i.trim();
|
|
@@ -58,90 +60,29 @@ function Ct(t) {
|
|
|
58
60
|
const s = r.indexOf(":");
|
|
59
61
|
if (s === -1) continue;
|
|
60
62
|
const o = Number(r.slice(0, s)), a = Number(r.slice(s + 1)), n = [o, a];
|
|
61
|
-
|
|
63
|
+
ke(n) && e.push(n);
|
|
62
64
|
}
|
|
63
65
|
return e;
|
|
64
66
|
}
|
|
65
|
-
function
|
|
67
|
+
function Tt(t, e) {
|
|
66
68
|
return t[0] === e[0] && t[1] === e[1];
|
|
67
69
|
}
|
|
68
|
-
function
|
|
70
|
+
function Ft(t) {
|
|
69
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;
|
|
70
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>`;
|
|
71
73
|
}
|
|
72
|
-
|
|
73
|
-
generate: {
|
|
74
|
-
id: "generate",
|
|
75
|
-
placeholderKey: "ai-enhancer-generate-placeholder",
|
|
76
|
-
// Complete, descriptive starting prompts. Flux responds best to rich
|
|
77
|
-
// natural-language descriptions, and clicking a chip fills the prompt so the
|
|
78
|
-
// user can run it as-is or tweak it.
|
|
79
|
-
presets: [
|
|
80
|
-
{
|
|
81
|
-
label: "Portrait",
|
|
82
|
-
prompt: "A photorealistic close-up portrait of a woman with freckles and windswept hair, soft natural window light, shallow depth of field, shot on an 85mm lens, ultra-detailed skin texture"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
label: "Cinematic",
|
|
86
|
-
prompt: "Cinematic film still of a lone traveler on a neon-lit Tokyo street at night, rain-slicked pavement, glowing reflections, moody atmosphere, anamorphic, shot on 35mm"
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
label: "Product",
|
|
90
|
-
prompt: "Product photography of a frosted glass perfume bottle on a polished marble surface, soft studio lighting, gentle reflections, minimalist composition, high detail"
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
label: "Landscape",
|
|
94
|
-
prompt: "A serene mountain landscape at golden hour, low mist drifting through the valley, dramatic clouds, mirror-still lake reflections, photorealistic, ultra-detailed"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
label: "Illustration",
|
|
98
|
-
prompt: "A flat vector illustration of a cozy bookshop café, warm color palette, clean bold shapes, soft shadows, modern editorial style"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
label: "3D character",
|
|
102
|
-
prompt: "A cute 3D-rendered robot character, Pixar style, big expressive eyes, soft studio lighting, pastel color palette, smooth glossy materials, octane render"
|
|
103
|
-
}
|
|
104
|
-
]
|
|
105
|
-
},
|
|
106
|
-
edit: {
|
|
107
|
-
id: "edit",
|
|
108
|
-
placeholderKey: "ai-enhancer-edit-placeholder",
|
|
109
|
-
// Instruction-style edits Flux Kontext handles well — restyling, relighting,
|
|
110
|
-
// and background/subject changes that preserve the source image.
|
|
111
|
-
presets: [
|
|
112
|
-
{
|
|
113
|
-
label: "Enhance",
|
|
114
|
-
prompt: "Enhance the photo: improve the lighting, sharpen details, and make the colors richer while keeping it natural"
|
|
115
|
-
},
|
|
116
|
-
{ label: "Golden hour", prompt: "Relight the scene with warm golden-hour sunlight and long, soft shadows" },
|
|
117
|
-
{
|
|
118
|
-
label: "White studio",
|
|
119
|
-
prompt: "Place the subject on a clean seamless white studio backdrop with soft, even lighting"
|
|
120
|
-
},
|
|
121
|
-
{ label: "Remove people", prompt: "Remove all other people from the scene, keeping the main subject intact" },
|
|
122
|
-
{
|
|
123
|
-
label: "Watercolor",
|
|
124
|
-
prompt: "Restyle the image as a soft watercolor painting with delicate, visible brush strokes"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
label: "Black & white",
|
|
128
|
-
prompt: "Convert to dramatic high-contrast black and white film photography with subtle grain"
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
class we extends Error {
|
|
74
|
+
class se extends Error {
|
|
134
75
|
constructor(e, i, r) {
|
|
135
76
|
super(i), this.name = "AiProviderError", this.errorCode = e, this.errorSource = r;
|
|
136
77
|
}
|
|
137
78
|
}
|
|
138
|
-
function
|
|
79
|
+
function Mt(t) {
|
|
139
80
|
const e = t == null ? void 0 : t.error;
|
|
140
81
|
return !!e && typeof e == "object" && typeof e.error_code == "string";
|
|
141
82
|
}
|
|
142
|
-
async function
|
|
83
|
+
async function Q(t, e) {
|
|
143
84
|
}
|
|
144
|
-
async function
|
|
85
|
+
async function Pe(t, e) {
|
|
145
86
|
const i = await t.text().catch(() => "");
|
|
146
87
|
let r = null;
|
|
147
88
|
if (i)
|
|
@@ -149,9 +90,9 @@ async function Ie(t, e) {
|
|
|
149
90
|
r = JSON.parse(i);
|
|
150
91
|
} catch {
|
|
151
92
|
}
|
|
152
|
-
if (
|
|
93
|
+
if (Mt(r)) {
|
|
153
94
|
const { error_code: s, content: o } = r.error;
|
|
154
|
-
throw new
|
|
95
|
+
throw new se(s, o ?? s);
|
|
155
96
|
}
|
|
156
97
|
if (!t.ok)
|
|
157
98
|
throw new Error(
|
|
@@ -159,7 +100,7 @@ async function Ie(t, e) {
|
|
|
159
100
|
);
|
|
160
101
|
return r;
|
|
161
102
|
}
|
|
162
|
-
class
|
|
103
|
+
class It {
|
|
163
104
|
constructor(e) {
|
|
164
105
|
if (!e.publicKey)
|
|
165
106
|
throw new Error("UploadcareApiClient: publicKey is required");
|
|
@@ -173,7 +114,7 @@ class Tt {
|
|
|
173
114
|
aspect_ratio: [e.aspectRatio[0], e.aspectRatio[1]],
|
|
174
115
|
filename: e.filename
|
|
175
116
|
};
|
|
176
|
-
return e.store !== void 0 && (i.store = e.store), e.metadata && (i.metadata = e.metadata), await
|
|
117
|
+
return e.store !== void 0 && (i.store = e.store), e.metadata && (i.metadata = e.metadata), await Q(), this.startJob(new URL("/derivative/image/generate/", this.baseUrl), i, "generate", e.signal);
|
|
177
118
|
}
|
|
178
119
|
/** Start an image→image edit job. Resolves to the job handle. */
|
|
179
120
|
async edit(e) {
|
|
@@ -183,14 +124,14 @@ class Tt {
|
|
|
183
124
|
source: e.source,
|
|
184
125
|
filename: e.filename
|
|
185
126
|
};
|
|
186
|
-
return e.aspectRatio && (i.aspect_ratio = [e.aspectRatio[0], e.aspectRatio[1]]), e.store !== void 0 && (i.store = e.store), e.metadata && (i.metadata = e.metadata), await
|
|
127
|
+
return e.aspectRatio && (i.aspect_ratio = [e.aspectRatio[0], e.aspectRatio[1]]), e.store !== void 0 && (i.store = e.store), e.metadata && (i.metadata = e.metadata), await Q(), this.startJob(new URL("/derivative/image/edit/", this.baseUrl), i, "edit", e.signal);
|
|
187
128
|
}
|
|
188
129
|
/** Fetch the current state of a generation/edit job. */
|
|
189
130
|
async getJobStatus(e, i) {
|
|
190
131
|
const r = new URL("/derivative/status/", this.baseUrl);
|
|
191
132
|
r.searchParams.set("pub_key", this.publicKey), r.searchParams.set("job_id", e);
|
|
192
|
-
const s = await this.doFetch(r.href, { method: "GET", headers: { Accept: "application/json" }, signal: i }), o = await
|
|
193
|
-
return await
|
|
133
|
+
const s = await this.doFetch(r.href, { method: "GET", headers: { Accept: "application/json" }, signal: i }), o = await Pe(s, "generate status");
|
|
134
|
+
return await Q(), o;
|
|
194
135
|
}
|
|
195
136
|
async startJob(e, i, r, s) {
|
|
196
137
|
const o = await this.doFetch(e.href, {
|
|
@@ -198,36 +139,36 @@ class Tt {
|
|
|
198
139
|
headers: { "Content-Type": "application/json", Accept: "application/json" },
|
|
199
140
|
body: JSON.stringify(i),
|
|
200
141
|
signal: s
|
|
201
|
-
}), a = await
|
|
202
|
-
return await
|
|
142
|
+
}), a = await Pe(o, r);
|
|
143
|
+
return await Q(), a;
|
|
203
144
|
}
|
|
204
145
|
}
|
|
205
|
-
const
|
|
206
|
-
function
|
|
146
|
+
const nt = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", Ot = new RegExp(`^${nt}$`, "i"), Pt = new RegExp(`^(${nt})~([0-9]+)$`, "i");
|
|
147
|
+
function Ee(t) {
|
|
207
148
|
return t.replace(/\/+$/, "");
|
|
208
149
|
}
|
|
209
|
-
function
|
|
150
|
+
function ge(t, e = "size") {
|
|
210
151
|
return typeof t == "number" ? String(t) : t.replace("%", "p");
|
|
211
152
|
}
|
|
212
|
-
function
|
|
213
|
-
const r = t == null ? "" :
|
|
153
|
+
function lt(t, e, i = "dimensions") {
|
|
154
|
+
const r = t == null ? "" : ge(t, `${i} width`), s = e == null ? "" : ge(e, `${i} height`);
|
|
214
155
|
return `${r}x${s}`;
|
|
215
156
|
}
|
|
216
|
-
function
|
|
217
|
-
return typeof t == "number" ? String(t) :
|
|
157
|
+
function ze(t, e) {
|
|
158
|
+
return typeof t == "number" ? String(t) : ge(t, e);
|
|
218
159
|
}
|
|
219
|
-
function
|
|
220
|
-
return typeof t == "string" ? t : `${
|
|
160
|
+
function zt(t, e = "alignment") {
|
|
161
|
+
return typeof t == "string" ? t : `${ze(t.x, `${e} x`)},${ze(t.y, `${e} y`)}`;
|
|
221
162
|
}
|
|
222
|
-
const
|
|
163
|
+
const Lt = [
|
|
223
164
|
"video",
|
|
224
165
|
"document",
|
|
225
166
|
"gif2video"
|
|
226
|
-
],
|
|
227
|
-
function
|
|
228
|
-
return t != null &&
|
|
167
|
+
], Dt = /\/(https?:\/\/.+)$/i;
|
|
168
|
+
function Nt(t) {
|
|
169
|
+
return t != null && Lt.includes(t);
|
|
229
170
|
}
|
|
230
|
-
function
|
|
171
|
+
function ct(t) {
|
|
231
172
|
var _;
|
|
232
173
|
let e;
|
|
233
174
|
try {
|
|
@@ -235,20 +176,20 @@ function nt(t) {
|
|
|
235
176
|
} catch {
|
|
236
177
|
throw new TypeError(`Invalid URL: "${t}"`);
|
|
237
178
|
}
|
|
238
|
-
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(Dt)) == null ? void 0 : _[1];
|
|
239
180
|
if (s !== void 0) {
|
|
240
181
|
const x = r.slice(0, r.length - s.length);
|
|
241
182
|
return {
|
|
242
183
|
kind: "proxy",
|
|
243
184
|
origin: i,
|
|
244
|
-
operations:
|
|
185
|
+
operations: ue(Le(x), "proxy prefix"),
|
|
245
186
|
sourceUrl: s + e.search + e.hash
|
|
246
187
|
};
|
|
247
188
|
}
|
|
248
|
-
const o = r.endsWith("/"), a =
|
|
189
|
+
const o = r.endsWith("/"), a = Le(r), n = a.shift();
|
|
249
190
|
if (n === void 0)
|
|
250
191
|
throw new TypeError(`Not a CDN URL (empty path): "${t}"`);
|
|
251
|
-
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(Pt);
|
|
252
193
|
if ((h == null ? void 0 : h[1]) !== void 0) {
|
|
253
194
|
const x = {
|
|
254
195
|
uuid: h[1],
|
|
@@ -259,13 +200,13 @@ function nt(t) {
|
|
|
259
200
|
if (!Number.isInteger(w))
|
|
260
201
|
throw new TypeError(`Invalid group element index in "${t}"`);
|
|
261
202
|
a.splice(0, 2);
|
|
262
|
-
const $ =
|
|
203
|
+
const $ = De(a, o);
|
|
263
204
|
return {
|
|
264
205
|
kind: "group-element",
|
|
265
206
|
...l,
|
|
266
207
|
group: x,
|
|
267
208
|
nth: w,
|
|
268
|
-
operations:
|
|
209
|
+
operations: ue(a, t),
|
|
269
210
|
filename: $
|
|
270
211
|
};
|
|
271
212
|
}
|
|
@@ -273,29 +214,29 @@ function nt(t) {
|
|
|
273
214
|
throw new TypeError(`Unexpected path after group id in "${t}"`);
|
|
274
215
|
return { kind: "group", ...l, group: x };
|
|
275
216
|
}
|
|
276
|
-
if (!
|
|
217
|
+
if (!Ot.test(n))
|
|
277
218
|
throw new TypeError(
|
|
278
219
|
`Not a CDN URL (no uuid, group or proxy source): "${t}"`
|
|
279
220
|
);
|
|
280
221
|
let p = null;
|
|
281
|
-
|
|
282
|
-
const u =
|
|
222
|
+
Nt(a[0]) && (p = a[0], a.shift());
|
|
223
|
+
const u = De(a, o);
|
|
283
224
|
return {
|
|
284
225
|
kind: "file",
|
|
285
226
|
...l,
|
|
286
227
|
uuid: n,
|
|
287
228
|
conversion: p,
|
|
288
|
-
operations:
|
|
229
|
+
operations: ue(a, t),
|
|
289
230
|
filename: u
|
|
290
231
|
};
|
|
291
232
|
}
|
|
292
|
-
function
|
|
233
|
+
function Le(t) {
|
|
293
234
|
return t.split("/").filter((e) => e !== "");
|
|
294
235
|
}
|
|
295
|
-
function
|
|
236
|
+
function De(t, e) {
|
|
296
237
|
return e || t.length === 0 ? null : t.pop() ?? null;
|
|
297
238
|
}
|
|
298
|
-
function
|
|
239
|
+
function ue(t, e) {
|
|
299
240
|
const i = [];
|
|
300
241
|
let r = 0;
|
|
301
242
|
for (; r < t.length; ) {
|
|
@@ -318,11 +259,11 @@ function le(t, e) {
|
|
|
318
259
|
}
|
|
319
260
|
return i;
|
|
320
261
|
}
|
|
321
|
-
function
|
|
262
|
+
function ht(t) {
|
|
322
263
|
return t.map((e) => `-/${[e.name, ...e.params].join("/")}/`).join("");
|
|
323
264
|
}
|
|
324
|
-
function
|
|
325
|
-
const e =
|
|
265
|
+
function ut(t) {
|
|
266
|
+
const e = Ee(t.origin), i = ht(t.operations ?? []);
|
|
326
267
|
if ("sourceUrl" in t && t.sourceUrl != null)
|
|
327
268
|
return `${e}/${i}${t.sourceUrl}`;
|
|
328
269
|
const r = ("search" in t ? t.search : "") ?? "", s = ("hash" in t ? t.hash : "") ?? "";
|
|
@@ -336,59 +277,59 @@ function ct(t) {
|
|
|
336
277
|
}
|
|
337
278
|
throw new TypeError("serializeCdnUrl requires one of: uuid, group, sourceUrl");
|
|
338
279
|
}
|
|
339
|
-
function
|
|
280
|
+
function Bt(t) {
|
|
340
281
|
return typeof t == "string" ? t : "opName" in t ? t.opName : t.name;
|
|
341
282
|
}
|
|
342
|
-
function
|
|
343
|
-
const i =
|
|
283
|
+
function de(t, e) {
|
|
284
|
+
const i = Bt(e);
|
|
344
285
|
return t.name === i || t.name.startsWith(`${i}~`);
|
|
345
286
|
}
|
|
346
|
-
function
|
|
287
|
+
function dt(t, e) {
|
|
347
288
|
return Object.assign(e, { opName: t });
|
|
348
289
|
}
|
|
349
|
-
const
|
|
290
|
+
const jt = (t, e) => {
|
|
350
291
|
const i = new URL(e);
|
|
351
292
|
return i.hostname = `${t}.${i.hostname}`, i.toString().replace(/\/$/, "");
|
|
352
|
-
},
|
|
293
|
+
}, Gt = "0123456789abcdefghijklmnopqrstuvwxyz", Ht = (t) => {
|
|
353
294
|
if (t <= 0n)
|
|
354
295
|
return "0";
|
|
355
296
|
let e = "";
|
|
356
297
|
for (; t > 0n; ) {
|
|
357
298
|
const i = t % 36n;
|
|
358
|
-
e =
|
|
299
|
+
e = Gt[Number(i)] + e, t = t / 36n;
|
|
359
300
|
}
|
|
360
301
|
return e;
|
|
361
|
-
},
|
|
302
|
+
}, Wt = (t, e) => {
|
|
362
303
|
try {
|
|
363
304
|
const i = new URL(t), r = new URL(e);
|
|
364
305
|
return i.hostname.endsWith(r.hostname);
|
|
365
306
|
} catch {
|
|
366
307
|
return !1;
|
|
367
308
|
}
|
|
368
|
-
},
|
|
309
|
+
}, Vt = async (t) => {
|
|
369
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("");
|
|
370
311
|
return BigInt(`0x${r}`);
|
|
371
|
-
},
|
|
372
|
-
const e = await
|
|
373
|
-
return
|
|
374
|
-
},
|
|
375
|
-
const i = await
|
|
376
|
-
return
|
|
312
|
+
}, qt = 10, Kt = async (t) => {
|
|
313
|
+
const e = await Vt(t);
|
|
314
|
+
return Ht(e).slice(0, qt);
|
|
315
|
+
}, Yt = async (t, e) => {
|
|
316
|
+
const i = await Kt(t);
|
|
317
|
+
return jt(i, e);
|
|
377
318
|
};
|
|
378
|
-
function
|
|
319
|
+
function Ne(t) {
|
|
379
320
|
return Object.prototype.toString.call(t) === "[object Object]";
|
|
380
321
|
}
|
|
381
|
-
const
|
|
382
|
-
function
|
|
383
|
-
return t.split(
|
|
322
|
+
const Xt = /\W|_/g;
|
|
323
|
+
function Jt(t) {
|
|
324
|
+
return t.split(Xt).map((e, i) => e.charAt(0)[i > 0 ? "toUpperCase" : "toLowerCase"]() + e.slice(1)).join("");
|
|
384
325
|
}
|
|
385
|
-
function
|
|
386
|
-
return Array.isArray(t) ? t.map((i) =>
|
|
326
|
+
function Be(t, { ignoreKeys: e } = { ignoreKeys: [] }) {
|
|
327
|
+
return Array.isArray(t) ? t.map((i) => Re(i, { ignoreKeys: e })) : t;
|
|
387
328
|
}
|
|
388
|
-
function
|
|
329
|
+
function Re(t, { ignoreKeys: e } = { ignoreKeys: [] }) {
|
|
389
330
|
if (Array.isArray(t))
|
|
390
|
-
return
|
|
391
|
-
if (!
|
|
331
|
+
return Be(t, { ignoreKeys: e });
|
|
332
|
+
if (!Ne(t))
|
|
392
333
|
return t;
|
|
393
334
|
const i = {};
|
|
394
335
|
for (const r of Object.keys(t)) {
|
|
@@ -397,12 +338,12 @@ function ke(t, { ignoreKeys: e } = { ignoreKeys: [] }) {
|
|
|
397
338
|
i[r] = s;
|
|
398
339
|
continue;
|
|
399
340
|
}
|
|
400
|
-
|
|
341
|
+
Ne(s) ? s = Re(s, { ignoreKeys: e }) : Array.isArray(s) && (s = Be(s, { ignoreKeys: e })), i[Jt(r)] = s;
|
|
401
342
|
}
|
|
402
343
|
return i;
|
|
403
344
|
}
|
|
404
|
-
const
|
|
405
|
-
function
|
|
345
|
+
const Zt = (t) => new Promise((e) => setTimeout(e, t));
|
|
346
|
+
function Qt({ libraryName: t, libraryVersion: e, userAgent: i, publicKey: r = "", integration: s = "" }) {
|
|
406
347
|
const o = "JavaScript";
|
|
407
348
|
if (typeof i == "string")
|
|
408
349
|
return i;
|
|
@@ -417,53 +358,53 @@ function Xt({ libraryName: t, libraryVersion: e, userAgent: i, publicKey: r = ""
|
|
|
417
358
|
const a = [t, e, r].filter(Boolean).join("/"), n = [o, s].filter(Boolean).join("; ");
|
|
418
359
|
return `${a} (${n})`;
|
|
419
360
|
}
|
|
420
|
-
const
|
|
361
|
+
const ei = {
|
|
421
362
|
factor: 2,
|
|
422
363
|
time: 100
|
|
423
364
|
};
|
|
424
|
-
function
|
|
365
|
+
function ti(t, e = ei) {
|
|
425
366
|
let i = 0;
|
|
426
367
|
function r(s) {
|
|
427
368
|
const o = Math.round(e.time * e.factor ** i);
|
|
428
369
|
return s({
|
|
429
370
|
attempt: i,
|
|
430
|
-
retry: (n) =>
|
|
371
|
+
retry: (n) => Zt(n ?? o).then(() => (i += 1, r(s)))
|
|
431
372
|
});
|
|
432
373
|
}
|
|
433
374
|
return r(t);
|
|
434
375
|
}
|
|
435
|
-
class
|
|
376
|
+
class Se extends Error {
|
|
436
377
|
}
|
|
437
|
-
class
|
|
378
|
+
class oe extends Se {
|
|
438
379
|
constructor(i) {
|
|
439
380
|
super();
|
|
440
381
|
b(this, "originalProgressEvent");
|
|
441
|
-
this.name = "NetworkError", this.message = "Network error", Object.setPrototypeOf(this,
|
|
382
|
+
this.name = "NetworkError", this.message = "Network error", Object.setPrototypeOf(this, oe.prototype), this.originalProgressEvent = i;
|
|
442
383
|
}
|
|
443
384
|
}
|
|
444
|
-
const
|
|
385
|
+
const ii = (t, e) => {
|
|
445
386
|
t && (t.aborted ? Promise.resolve().then(e) : t.addEventListener("abort", () => e(), { once: !0 }));
|
|
446
387
|
};
|
|
447
|
-
class
|
|
388
|
+
class Ce extends Se {
|
|
448
389
|
constructor(i = "Request canceled") {
|
|
449
390
|
super(i);
|
|
450
391
|
b(this, "isCancel", !0);
|
|
451
|
-
this.name = "CancelError", Object.setPrototypeOf(this,
|
|
392
|
+
this.name = "CancelError", Object.setPrototypeOf(this, Ce.prototype);
|
|
452
393
|
}
|
|
453
394
|
}
|
|
454
|
-
const
|
|
395
|
+
const te = {
|
|
455
396
|
baseCDN: "https://ucarecdn.com",
|
|
456
397
|
baseURL: "https://upload.uploadcare.com",
|
|
457
398
|
retryThrottledRequestMaxTimes: 1,
|
|
458
399
|
retryNetworkErrorMaxTimes: 3
|
|
459
|
-
},
|
|
400
|
+
}, ri = ({ method: t, url: e, data: i, headers: r = {}, signal: s, onProgress: o }) => new Promise((a, n) => {
|
|
460
401
|
const l = new XMLHttpRequest(), h = (t == null ? void 0 : t.toUpperCase()) || "GET";
|
|
461
402
|
let p = !1;
|
|
462
403
|
l.open(h, e, !0), r && Object.entries(r).forEach((u) => {
|
|
463
404
|
const [_, x] = u;
|
|
464
405
|
typeof x < "u" && !Array.isArray(x) && l.setRequestHeader(_, x);
|
|
465
|
-
}), l.responseType = "text",
|
|
466
|
-
p = !0, l.abort(), n(new
|
|
406
|
+
}), l.responseType = "text", ii(s, () => {
|
|
407
|
+
p = !0, l.abort(), n(new Ce());
|
|
467
408
|
}), l.onload = () => {
|
|
468
409
|
if (l.status != 200)
|
|
469
410
|
n(new Error(`Error ${l.status}: ${l.statusText}`));
|
|
@@ -477,8 +418,8 @@ const Q = {
|
|
|
477
418
|
onProgress: o
|
|
478
419
|
}, _ = l.getAllResponseHeaders().trim().split(/[\r\n]+/), x = {};
|
|
479
420
|
_.forEach(function(R) {
|
|
480
|
-
const I = R.split(": "),
|
|
481
|
-
|
|
421
|
+
const I = R.split(": "), W = I.shift(), X = I.join(": ");
|
|
422
|
+
W && typeof W < "u" && (x[W] = X);
|
|
482
423
|
});
|
|
483
424
|
const w = l.response, $ = l.status;
|
|
484
425
|
a({
|
|
@@ -489,7 +430,7 @@ const Q = {
|
|
|
489
430
|
});
|
|
490
431
|
}
|
|
491
432
|
}, l.onerror = (u) => {
|
|
492
|
-
p || n(new
|
|
433
|
+
p || n(new oe(u));
|
|
493
434
|
}, o && typeof o == "function" && (l.upload.onprogress = (u) => {
|
|
494
435
|
u.lengthComputable ? o({
|
|
495
436
|
isComputable: !0,
|
|
@@ -497,69 +438,69 @@ const Q = {
|
|
|
497
438
|
}) : o({ isComputable: !1 });
|
|
498
439
|
}), i ? l.send(i) : l.send();
|
|
499
440
|
});
|
|
500
|
-
class
|
|
441
|
+
class $e extends Se {
|
|
501
442
|
constructor(i, r, s, o, a) {
|
|
502
443
|
super();
|
|
503
444
|
b(this, "code");
|
|
504
445
|
b(this, "request");
|
|
505
446
|
b(this, "response");
|
|
506
447
|
b(this, "headers");
|
|
507
|
-
this.name = "UploadError", this.message = i, this.code = r, this.request = s, this.response = o, this.headers = a, Object.setPrototypeOf(this,
|
|
448
|
+
this.name = "UploadError", this.message = i, this.code = r, this.request = s, this.response = o, this.headers = a, Object.setPrototypeOf(this, $e.prototype);
|
|
508
449
|
}
|
|
509
450
|
}
|
|
510
|
-
const
|
|
451
|
+
const si = (t) => {
|
|
511
452
|
const e = new URLSearchParams();
|
|
512
453
|
for (const [i, r] of Object.entries(t))
|
|
513
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) => {
|
|
514
455
|
e.append(`${i}[]`, s);
|
|
515
456
|
}) : typeof r == "string" && r ? e.set(i, r) : typeof r == "number" && e.set(i, r.toString());
|
|
516
457
|
return e.toString();
|
|
517
|
-
},
|
|
458
|
+
}, ve = (t, e, i) => {
|
|
518
459
|
const r = new URL(t);
|
|
519
|
-
return r.pathname = (r.pathname + e).replace("//", "/"), i && (r.search =
|
|
460
|
+
return r.pathname = (r.pathname + e).replace("//", "/"), i && (r.search = si(i)), r.toString();
|
|
520
461
|
};
|
|
521
|
-
var
|
|
522
|
-
const
|
|
523
|
-
function
|
|
524
|
-
return
|
|
525
|
-
libraryName:
|
|
526
|
-
libraryVersion:
|
|
462
|
+
var oi = "6.18.4";
|
|
463
|
+
const ai = "UploadcareUploadClient", ni = oi;
|
|
464
|
+
function li(t) {
|
|
465
|
+
return Qt({
|
|
466
|
+
libraryName: ai,
|
|
467
|
+
libraryVersion: ni,
|
|
527
468
|
...t
|
|
528
469
|
});
|
|
529
470
|
}
|
|
530
|
-
const
|
|
531
|
-
function
|
|
471
|
+
const ci = "RequestThrottledError", je = 15e3, hi = 1e3;
|
|
472
|
+
function ui(t) {
|
|
532
473
|
const { headers: e } = t || {};
|
|
533
474
|
if (!e || typeof e["retry-after"] != "string")
|
|
534
|
-
return
|
|
475
|
+
return je;
|
|
535
476
|
const i = parseInt(e["retry-after"], 10);
|
|
536
|
-
return Number.isFinite(i) ? i * 1e3 :
|
|
477
|
+
return Number.isFinite(i) ? i * 1e3 : je;
|
|
537
478
|
}
|
|
538
|
-
function
|
|
479
|
+
function di(t, e) {
|
|
539
480
|
const { retryThrottledRequestMaxTimes: i, retryNetworkErrorMaxTimes: r } = e;
|
|
540
|
-
return
|
|
541
|
-
if ("response" in a && (a == null ? void 0 : a.code) ===
|
|
542
|
-
return o(
|
|
543
|
-
if (a instanceof
|
|
544
|
-
return o((s + 1) *
|
|
481
|
+
return ti(({ attempt: s, retry: o }) => t().catch((a) => {
|
|
482
|
+
if ("response" in a && (a == null ? void 0 : a.code) === ci && s < i)
|
|
483
|
+
return o(ui(a));
|
|
484
|
+
if (a instanceof oe && s < r)
|
|
485
|
+
return o((s + 1) * hi);
|
|
545
486
|
throw a;
|
|
546
487
|
}));
|
|
547
488
|
}
|
|
548
|
-
var
|
|
489
|
+
var Ge;
|
|
549
490
|
(function(t) {
|
|
550
491
|
t.Token = "token", t.FileInfo = "file_info";
|
|
551
|
-
})(
|
|
552
|
-
var
|
|
492
|
+
})(Ge || (Ge = {}));
|
|
493
|
+
var He;
|
|
553
494
|
(function(t) {
|
|
554
495
|
t.Unknown = "unknown", t.Waiting = "waiting", t.Progress = "progress", t.Error = "error", t.Success = "success";
|
|
555
|
-
})(
|
|
556
|
-
function
|
|
557
|
-
return
|
|
496
|
+
})(He || (He = {}));
|
|
497
|
+
function pi(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 di(() => ri({
|
|
558
499
|
method: "GET",
|
|
559
500
|
headers: {
|
|
560
|
-
"X-UC-User-Agent":
|
|
501
|
+
"X-UC-User-Agent": li({ publicKey: e, integration: o, userAgent: a })
|
|
561
502
|
},
|
|
562
|
-
url:
|
|
503
|
+
url: ve(i, "/info/", {
|
|
563
504
|
jsonerrors: 1,
|
|
564
505
|
pub_key: e,
|
|
565
506
|
file_id: t,
|
|
@@ -567,17 +508,17 @@ function hi(t, { publicKey: e, baseURL: i = Q.baseURL, signal: r, source: s, int
|
|
|
567
508
|
}),
|
|
568
509
|
signal: r
|
|
569
510
|
}).then(({ data: h, headers: p, request: u }) => {
|
|
570
|
-
const _ =
|
|
511
|
+
const _ = Re(JSON.parse(h));
|
|
571
512
|
if ("error" in _)
|
|
572
|
-
throw new
|
|
513
|
+
throw new $e(_.error.content, _.error.errorCode, u, _, p);
|
|
573
514
|
return _;
|
|
574
515
|
}), { retryThrottledRequestMaxTimes: n, retryNetworkErrorMaxTimes: l });
|
|
575
516
|
}
|
|
576
|
-
function
|
|
517
|
+
function fi(t) {
|
|
577
518
|
return "defaultEffects" in t;
|
|
578
519
|
}
|
|
579
|
-
class
|
|
580
|
-
constructor(e, { baseCDN: i =
|
|
520
|
+
class We {
|
|
521
|
+
constructor(e, { baseCDN: i = te.baseCDN, fileName: r } = {}) {
|
|
581
522
|
b(this, "uuid");
|
|
582
523
|
b(this, "name");
|
|
583
524
|
b(this, "size");
|
|
@@ -593,29 +534,29 @@ class Ge {
|
|
|
593
534
|
b(this, "metadata");
|
|
594
535
|
b(this, "s3Bucket");
|
|
595
536
|
b(this, "defaultEffects", null);
|
|
596
|
-
const { uuid: s, s3Bucket: o } = e, a =
|
|
597
|
-
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,
|
|
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, fi(e) && (this.defaultEffects = e.defaultEffects);
|
|
598
539
|
}
|
|
599
540
|
}
|
|
600
|
-
const
|
|
601
|
-
function
|
|
541
|
+
const mi = /\W|_/g;
|
|
542
|
+
function _i(t) {
|
|
602
543
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
603
544
|
}
|
|
604
|
-
function
|
|
605
|
-
return t.split(
|
|
545
|
+
function gi(t) {
|
|
546
|
+
return t.split(mi).map((e, i) => e && e.charAt(0)[i > 0 ? "toUpperCase" : "toLowerCase"]() + e.slice(1)).join("");
|
|
606
547
|
}
|
|
607
|
-
function
|
|
548
|
+
function be(t) {
|
|
608
549
|
if (Array.isArray(t))
|
|
609
|
-
return t.map((i) =>
|
|
610
|
-
if (!
|
|
550
|
+
return t.map((i) => be(i));
|
|
551
|
+
if (!_i(t))
|
|
611
552
|
return t;
|
|
612
553
|
const e = {};
|
|
613
554
|
for (const i of Object.keys(t))
|
|
614
|
-
e[
|
|
555
|
+
e[gi(i)] = be(t[i]);
|
|
615
556
|
return e;
|
|
616
557
|
}
|
|
617
|
-
const
|
|
618
|
-
function
|
|
558
|
+
const vi = [1, 1], Ve = "https://ucarecdn.com", bi = 1500, yi = 1e6;
|
|
559
|
+
function wi(t, e) {
|
|
619
560
|
return new Promise((i, r) => {
|
|
620
561
|
if (e != null && e.aborted) {
|
|
621
562
|
r(new DOMException("Aborted", "AbortError"));
|
|
@@ -629,18 +570,18 @@ function vi(t, e) {
|
|
|
629
570
|
e == null || e.addEventListener("abort", o, { once: !0 });
|
|
630
571
|
});
|
|
631
572
|
}
|
|
632
|
-
function
|
|
573
|
+
function qe() {
|
|
633
574
|
return typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now();
|
|
634
575
|
}
|
|
635
|
-
class
|
|
576
|
+
class xi {
|
|
636
577
|
constructor(e) {
|
|
637
578
|
if (this.id = "uploadcare-derivative", !e.publicKey)
|
|
638
579
|
throw new Error("UploadcareDerivativeApi: publicKey is required");
|
|
639
|
-
this.api = new
|
|
580
|
+
this.api = new It({
|
|
640
581
|
publicKey: e.publicKey,
|
|
641
582
|
baseUrl: e.baseUrl,
|
|
642
583
|
fetch: e.fetch
|
|
643
|
-
}), 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 ?? Ve, this.cnamePrefixed = e.cdnCnamePrefixed ?? "https://ucarecd.net", this.pollIntervalMs = e.pollIntervalMs ?? bi, this.pollTimeoutMs = e.pollTimeoutMs ?? yi;
|
|
644
585
|
}
|
|
645
586
|
async generate(e) {
|
|
646
587
|
const i = await this.startJob(e);
|
|
@@ -652,7 +593,7 @@ class bi {
|
|
|
652
593
|
* the editor produced.
|
|
653
594
|
*/
|
|
654
595
|
async resolveCdnUrl(e) {
|
|
655
|
-
return
|
|
596
|
+
return ut({ origin: await this.getCdnBase(), uuid: e });
|
|
656
597
|
}
|
|
657
598
|
/**
|
|
658
599
|
* Resolve a stored file's full info (image dimensions, original filename,
|
|
@@ -661,13 +602,13 @@ class bi {
|
|
|
661
602
|
* true aspect ratio before the image decodes, and name outputs after it.
|
|
662
603
|
*/
|
|
663
604
|
async getFileInfo(e, i) {
|
|
664
|
-
const r = await
|
|
665
|
-
return new
|
|
605
|
+
const r = await pi(e, { publicKey: this.publicKey, baseURL: this.baseUrl, signal: i });
|
|
606
|
+
return new We(r, { baseCDN: await this.getCdnBase() });
|
|
666
607
|
}
|
|
667
608
|
async startJob(e) {
|
|
668
|
-
const i = e.aspectRatio &&
|
|
609
|
+
const i = e.aspectRatio && ke(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({
|
|
669
610
|
prompt: e.prompt,
|
|
670
|
-
aspectRatio: i ??
|
|
611
|
+
aspectRatio: i ?? vi,
|
|
671
612
|
filename: r,
|
|
672
613
|
store: this.store,
|
|
673
614
|
signal: e.signal,
|
|
@@ -691,22 +632,22 @@ class bi {
|
|
|
691
632
|
});
|
|
692
633
|
}
|
|
693
634
|
async pollUntilDone(e, i) {
|
|
694
|
-
const r = this.pollTimeoutMs +
|
|
635
|
+
const r = this.pollTimeoutMs + qe();
|
|
695
636
|
for (; ; ) {
|
|
696
637
|
const s = await this.api.getJobStatus(e, i.signal);
|
|
697
638
|
if (s.status === "success") {
|
|
698
639
|
if (!s.uuid)
|
|
699
640
|
throw new Error("Uploadcare derivative: response did not include a uuid");
|
|
700
|
-
const o =
|
|
641
|
+
const o = be(s), a = new We(o, { baseCDN: await this.getCdnBase() });
|
|
701
642
|
return { url: a.cdnUrl, uuid: a.uuid, prompt: i.prompt, mode: i.mode, file: a };
|
|
702
643
|
}
|
|
703
644
|
if (s.status === "error") {
|
|
704
645
|
const o = s.error_code ?? "unknown", a = s.error ?? o;
|
|
705
|
-
throw new
|
|
646
|
+
throw new se(o, a, s.error_source);
|
|
706
647
|
}
|
|
707
|
-
if (
|
|
648
|
+
if (qe() >= r)
|
|
708
649
|
throw new Error(`Uploadcare derivative: timed out waiting for job ${e}`);
|
|
709
|
-
await
|
|
650
|
+
await wi(this.pollIntervalMs, i.signal);
|
|
710
651
|
}
|
|
711
652
|
}
|
|
712
653
|
/**
|
|
@@ -715,11 +656,74 @@ class bi {
|
|
|
715
656
|
* applies in its `cdnCname` computed config. Computed once and cached.
|
|
716
657
|
*/
|
|
717
658
|
getCdnBase() {
|
|
718
|
-
return this.cdnBasePromise || (this.cdnBasePromise = this.cname ===
|
|
659
|
+
return this.cdnBasePromise || (this.cdnBasePromise = this.cname === Ve || Wt(this.cname, this.cnamePrefixed) ? Yt(this.publicKey, this.cnamePrefixed) : Promise.resolve(this.cname)), this.cdnBasePromise;
|
|
719
660
|
}
|
|
720
661
|
}
|
|
721
|
-
|
|
722
|
-
|
|
662
|
+
function ki(t) {
|
|
663
|
+
return t instanceof Z ? t : t instanceof se ? new Z(t.message, { code: t.errorCode, source: t.errorSource, cause: t }) : t instanceof Error ? new Z(t.message, { cause: t }) : new Z(typeof t == "string" && t ? t : "Generation failed", { cause: t });
|
|
664
|
+
}
|
|
665
|
+
const ye = {
|
|
666
|
+
generate: {
|
|
667
|
+
id: "generate",
|
|
668
|
+
placeholderKey: "ai-enhancer-generate-placeholder",
|
|
669
|
+
// Complete, descriptive starting prompts. Flux responds best to rich
|
|
670
|
+
// natural-language descriptions, and clicking a chip fills the prompt so the
|
|
671
|
+
// user can run it as-is or tweak it.
|
|
672
|
+
presets: [
|
|
673
|
+
{
|
|
674
|
+
label: "Portrait",
|
|
675
|
+
prompt: "A photorealistic close-up portrait of a woman with freckles and windswept hair, soft natural window light, shallow depth of field, shot on an 85mm lens, ultra-detailed skin texture"
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
label: "Cinematic",
|
|
679
|
+
prompt: "Cinematic film still of a lone traveler on a neon-lit Tokyo street at night, rain-slicked pavement, glowing reflections, moody atmosphere, anamorphic, shot on 35mm"
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
label: "Product",
|
|
683
|
+
prompt: "Product photography of a frosted glass perfume bottle on a polished marble surface, soft studio lighting, gentle reflections, minimalist composition, high detail"
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
label: "Landscape",
|
|
687
|
+
prompt: "A serene mountain landscape at golden hour, low mist drifting through the valley, dramatic clouds, mirror-still lake reflections, photorealistic, ultra-detailed"
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
label: "Illustration",
|
|
691
|
+
prompt: "A flat vector illustration of a cozy bookshop café, warm color palette, clean bold shapes, soft shadows, modern editorial style"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
label: "3D character",
|
|
695
|
+
prompt: "A cute 3D-rendered robot character, Pixar style, big expressive eyes, soft studio lighting, pastel color palette, smooth glossy materials, octane render"
|
|
696
|
+
}
|
|
697
|
+
]
|
|
698
|
+
},
|
|
699
|
+
edit: {
|
|
700
|
+
id: "edit",
|
|
701
|
+
placeholderKey: "ai-enhancer-edit-placeholder",
|
|
702
|
+
// Instruction-style edits Flux Kontext handles well — restyling, relighting,
|
|
703
|
+
// and background/subject changes that preserve the source image.
|
|
704
|
+
presets: [
|
|
705
|
+
{
|
|
706
|
+
label: "Enhance",
|
|
707
|
+
prompt: "Enhance the photo: improve the lighting, sharpen details, and make the colors richer while keeping it natural"
|
|
708
|
+
},
|
|
709
|
+
{ label: "Golden hour", prompt: "Relight the scene with warm golden-hour sunlight and long, soft shadows" },
|
|
710
|
+
{
|
|
711
|
+
label: "White studio",
|
|
712
|
+
prompt: "Place the subject on a clean seamless white studio backdrop with soft, even lighting"
|
|
713
|
+
},
|
|
714
|
+
{ label: "Remove people", prompt: "Remove all other people from the scene, keeping the main subject intact" },
|
|
715
|
+
{
|
|
716
|
+
label: "Watercolor",
|
|
717
|
+
prompt: "Restyle the image as a soft watercolor painting with delicate, visible brush strokes"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
label: "Black & white",
|
|
721
|
+
prompt: "Convert to dramatic high-contrast black and white film photography with subtle grain"
|
|
722
|
+
}
|
|
723
|
+
]
|
|
724
|
+
}
|
|
725
|
+
}, Ke = 20;
|
|
726
|
+
class Ei {
|
|
723
727
|
constructor(e) {
|
|
724
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);
|
|
725
729
|
}
|
|
@@ -740,7 +744,7 @@ class yi {
|
|
|
740
744
|
/** Replace the strip with entries hydrated from storage (e.g. when the editor
|
|
741
745
|
* opens on a source whose lineage was generated in a past session). */
|
|
742
746
|
setHistory(e) {
|
|
743
|
-
this.history = e.slice(0,
|
|
747
|
+
this.history = e.slice(0, Ke), this._host.requestUpdate();
|
|
744
748
|
}
|
|
745
749
|
setResult(e) {
|
|
746
750
|
this.resultUrl = e.url, this.result = e, this.error = null, this.errorCode = null, this._host.requestUpdate();
|
|
@@ -771,16 +775,16 @@ class yi {
|
|
|
771
775
|
ratio: e.ratioValue ?? null
|
|
772
776
|
},
|
|
773
777
|
...this.history
|
|
774
|
-
].slice(0,
|
|
778
|
+
].slice(0, Ke), s);
|
|
775
779
|
} catch (s) {
|
|
776
780
|
if ((s == null ? void 0 : s.name) === "AbortError") return null;
|
|
777
|
-
throw this.error = s.message || "Generation failed", this.errorCode = s instanceof
|
|
781
|
+
throw this.error = s.message || "Generation failed", this.errorCode = s instanceof se ? s.errorCode : null, s;
|
|
778
782
|
} finally {
|
|
779
783
|
this._abortController === i && (this.busy = !1, this._abortController = null), this._host.requestUpdate();
|
|
780
784
|
}
|
|
781
785
|
}
|
|
782
786
|
}
|
|
783
|
-
const
|
|
787
|
+
const Ri = {
|
|
784
788
|
"ai-enhancer-source-label": "Generate image",
|
|
785
789
|
"ai-enhancer-file-action-label": "AI Edit",
|
|
786
790
|
"ai-enhancer-generate-title": "Generate image",
|
|
@@ -805,7 +809,7 @@ const wi = {
|
|
|
805
809
|
"ai-enhancer-aspect-landscape": "Landscape",
|
|
806
810
|
"ai-enhancer-aspect-vertical": "Vertical",
|
|
807
811
|
"ai-enhancer-aspect-widescreen": "Widescreen"
|
|
808
|
-
},
|
|
812
|
+
}, Si = {
|
|
809
813
|
// Platform validation (POST generate/edit/outpaint, GET status)
|
|
810
814
|
"ai-enhancer-error-invalid_request": "Something went wrong with the request. Please try again.",
|
|
811
815
|
"ai-enhancer-error-invalid_source": "The source image couldn't be read. Please try a different image.",
|
|
@@ -829,8 +833,8 @@ const wi = {
|
|
|
829
833
|
"ai-enhancer-error-DownloadFileHTTPClientError": "Couldn't retrieve the generated image. Please try again.",
|
|
830
834
|
"ai-enhancer-error-DownloadFileNotFoundError": "The generated image couldn't be found. Please try again.",
|
|
831
835
|
"ai-enhancer-error-DownloadFileTaskFailedError": "Couldn't save the generated image. Please try again."
|
|
832
|
-
},
|
|
833
|
-
en: async () =>
|
|
836
|
+
}, B = { ...Ri, ...Si }, pe = {
|
|
837
|
+
en: async () => B,
|
|
834
838
|
ar: () => import("./ar-0rfB4z3f.js").then((t) => t.default),
|
|
835
839
|
az: () => import("./az-CyK2FKx4.js").then((t) => t.default),
|
|
836
840
|
ca: () => import("./ca-CAoPN2lq.js").then((t) => t.default),
|
|
@@ -866,12 +870,12 @@ const wi = {
|
|
|
866
870
|
zh: () => import("./zh-C0AOtYB8.js").then((t) => t.default),
|
|
867
871
|
"zh-TW": () => import("./zh-TW-BNfdfwdz.js").then((t) => t.default)
|
|
868
872
|
};
|
|
869
|
-
function
|
|
870
|
-
return (e == null ? void 0 : e[t]) ??
|
|
873
|
+
function Ci(t, e) {
|
|
874
|
+
return (e == null ? void 0 : e[t]) ?? B[t];
|
|
871
875
|
}
|
|
872
|
-
function
|
|
876
|
+
function $i(t) {
|
|
873
877
|
if ("kind" in t) return t;
|
|
874
|
-
const e =
|
|
878
|
+
const e = Ee(t.origin);
|
|
875
879
|
if ("sourceUrl" in t)
|
|
876
880
|
return {
|
|
877
881
|
kind: "proxy",
|
|
@@ -900,12 +904,12 @@ function Ei(t) {
|
|
|
900
904
|
hash: r
|
|
901
905
|
};
|
|
902
906
|
}
|
|
903
|
-
var k,
|
|
904
|
-
let
|
|
907
|
+
var k, q, ie, M;
|
|
908
|
+
let Ai = (M = class {
|
|
905
909
|
constructor(e) {
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
910
|
+
he(this, q);
|
|
911
|
+
he(this, k);
|
|
912
|
+
Oe(this, k, $i(e));
|
|
909
913
|
}
|
|
910
914
|
/**
|
|
911
915
|
* Parses an existing CDN URL.
|
|
@@ -913,7 +917,7 @@ let Ri = (M = class {
|
|
|
913
917
|
* @throws TypeError when the URL cannot be interpreted as a CDN URL.
|
|
914
918
|
*/
|
|
915
919
|
static parse(e) {
|
|
916
|
-
return new M(
|
|
920
|
+
return new M(ct(e));
|
|
917
921
|
}
|
|
918
922
|
/** A defensive copy of the operation chain (empty for group root urls). */
|
|
919
923
|
get operations() {
|
|
@@ -921,7 +925,7 @@ let Ri = (M = class {
|
|
|
921
925
|
}
|
|
922
926
|
/** The serialized URL string. */
|
|
923
927
|
get href() {
|
|
924
|
-
return
|
|
928
|
+
return ut(E(this, k));
|
|
925
929
|
}
|
|
926
930
|
/** Alias of {@link CdnUrl.href} for string coercion. */
|
|
927
931
|
toString() {
|
|
@@ -937,18 +941,18 @@ let Ri = (M = class {
|
|
|
937
941
|
* @throws TypeError on group root urls, which cannot carry operations.
|
|
938
942
|
*/
|
|
939
943
|
with(...e) {
|
|
940
|
-
return
|
|
944
|
+
return J(this, q, ie).call(this, (i) => [...i, ...e]);
|
|
941
945
|
}
|
|
942
946
|
/**
|
|
943
947
|
* Removes every occurrence of an operation. Accepts the operation name,
|
|
944
948
|
* an operation object, or the creator itself: `url.without(resize)`.
|
|
945
949
|
*/
|
|
946
950
|
without(e) {
|
|
947
|
-
return
|
|
951
|
+
return J(this, q, ie).call(this, (i) => i.filter((r) => !de(r, e)));
|
|
948
952
|
}
|
|
949
953
|
/** Replaces the first same-named operation in place, or appends it. */
|
|
950
954
|
replace(e) {
|
|
951
|
-
return
|
|
955
|
+
return J(this, q, ie).call(this, (i) => {
|
|
952
956
|
const r = i.findIndex((o) => o.name === e.name);
|
|
953
957
|
if (r === -1) return [...i, e];
|
|
954
958
|
const s = [...i];
|
|
@@ -957,11 +961,11 @@ let Ri = (M = class {
|
|
|
957
961
|
}
|
|
958
962
|
/** Whether a matching operation is present (name, object or creator ref). */
|
|
959
963
|
has(e) {
|
|
960
|
-
return this.operations.some((i) =>
|
|
964
|
+
return this.operations.some((i) => de(i, e));
|
|
961
965
|
}
|
|
962
966
|
/** First matching operation (name, object or creator ref), or null. */
|
|
963
967
|
get(e) {
|
|
964
|
-
return this.operations.find((i) =>
|
|
968
|
+
return this.operations.find((i) => de(i, e)) ?? null;
|
|
965
969
|
}
|
|
966
970
|
/**
|
|
967
971
|
* Sets or clears (`null`) the trailing filename.
|
|
@@ -973,51 +977,51 @@ let Ri = (M = class {
|
|
|
973
977
|
}
|
|
974
978
|
/** Rebases the url onto another domain. */
|
|
975
979
|
setOrigin(e) {
|
|
976
|
-
return new M({ ...E(this, k), origin:
|
|
980
|
+
return new M({ ...E(this, k), origin: Ee(e) });
|
|
977
981
|
}
|
|
978
|
-
}, k = new WeakMap(),
|
|
982
|
+
}, k = new WeakMap(), q = new WeakSet(), ie = function(e) {
|
|
979
983
|
return "operations" in E(this, k) ? new M({
|
|
980
984
|
...E(this, k),
|
|
981
985
|
operations: e(E(this, k).operations)
|
|
982
986
|
}) : this;
|
|
983
987
|
}, M);
|
|
984
|
-
const
|
|
988
|
+
const we = (t, ...e) => ({
|
|
985
989
|
name: t,
|
|
986
990
|
params: e
|
|
987
|
-
}),
|
|
991
|
+
}), Ui = /* @__PURE__ */ dt(
|
|
988
992
|
"preview",
|
|
989
993
|
function(t, e) {
|
|
990
|
-
return t == null && e == null ?
|
|
994
|
+
return t == null && e == null ? we("preview") : we("preview", lt(t, e, "preview"));
|
|
991
995
|
}
|
|
992
|
-
),
|
|
996
|
+
), Ti = /* @__PURE__ */ dt(
|
|
993
997
|
"scale_crop",
|
|
994
998
|
function(t, e, i = {}) {
|
|
995
|
-
const r = [
|
|
996
|
-
return i.type != null && r.push(i.type), i.align != null && r.push(
|
|
999
|
+
const r = [lt(t, e, "scale_crop")];
|
|
1000
|
+
return i.type != null && r.push(i.type), i.align != null && r.push(zt(i.align, "scale_crop alignment")), we("scale_crop", ...r);
|
|
997
1001
|
}
|
|
998
|
-
),
|
|
999
|
-
function
|
|
1002
|
+
), Fi = 3e3;
|
|
1003
|
+
function pt(t) {
|
|
1000
1004
|
const e = typeof window < "u" ? window.devicePixelRatio : 1;
|
|
1001
|
-
return Math.min(Math.ceil(t * Math.max(e, 1)),
|
|
1005
|
+
return Math.min(Math.ceil(t * Math.max(e, 1)), Fi);
|
|
1002
1006
|
}
|
|
1003
|
-
function
|
|
1007
|
+
function ft(t, e) {
|
|
1004
1008
|
if (e.length === 0) return t;
|
|
1005
1009
|
try {
|
|
1006
|
-
return
|
|
1010
|
+
return Ai.parse(t).with(...e).href;
|
|
1007
1011
|
} catch {
|
|
1008
1012
|
return t;
|
|
1009
1013
|
}
|
|
1010
1014
|
}
|
|
1011
|
-
function
|
|
1012
|
-
const i =
|
|
1013
|
-
return
|
|
1015
|
+
function Mi(t, e) {
|
|
1016
|
+
const i = pt(e);
|
|
1017
|
+
return ft(t, [Ui(i, i)]);
|
|
1014
1018
|
}
|
|
1015
|
-
function
|
|
1016
|
-
const i =
|
|
1017
|
-
return
|
|
1019
|
+
function Ii(t, e) {
|
|
1020
|
+
const i = pt(e);
|
|
1021
|
+
return ft(t, [Ti(i, i, { align: "center" })]);
|
|
1018
1022
|
}
|
|
1019
|
-
const
|
|
1020
|
-
class
|
|
1023
|
+
const Oi = "uc-ai-enhancer/history", Ye = 200, Pi = 10080 * 60 * 1e3;
|
|
1024
|
+
class zi {
|
|
1021
1025
|
constructor(e) {
|
|
1022
1026
|
this._key = null, e.addController(this);
|
|
1023
1027
|
}
|
|
@@ -1025,7 +1029,7 @@ class Mi {
|
|
|
1025
1029
|
}
|
|
1026
1030
|
/** Namespace the store by pubkey. Passing an empty key disables persistence. */
|
|
1027
1031
|
setNamespace(e) {
|
|
1028
|
-
this._key = e ? `${
|
|
1032
|
+
this._key = e ? `${Oi}/${e}` : null;
|
|
1029
1033
|
}
|
|
1030
1034
|
/** Upsert the result as a node and persist (evicting expired/overflowing nodes). */
|
|
1031
1035
|
record(e) {
|
|
@@ -1056,7 +1060,7 @@ class Mi {
|
|
|
1056
1060
|
*/
|
|
1057
1061
|
lineage(e) {
|
|
1058
1062
|
const i = this._key;
|
|
1059
|
-
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(Li);
|
|
1060
1064
|
}
|
|
1061
1065
|
/** Nodes in `start`'s connected component, walking both parent and child edges.
|
|
1062
1066
|
* `start` may be a node itself or only a parent uuid (a source not yet edited). */
|
|
@@ -1082,8 +1086,8 @@ class Mi {
|
|
|
1082
1086
|
* middle node just orphans its descendants (their lineage walk stops early). */
|
|
1083
1087
|
_evict(e) {
|
|
1084
1088
|
const i = Date.now();
|
|
1085
|
-
let r = Object.values(e).filter((o) => i - o.createdAt <
|
|
1086
|
-
r.length >
|
|
1089
|
+
let r = Object.values(e).filter((o) => i - o.createdAt < Pi);
|
|
1090
|
+
r.length > Ye && (r = r.sort((o, a) => a.createdAt - o.createdAt).slice(0, Ye));
|
|
1087
1091
|
const s = {};
|
|
1088
1092
|
for (const o of r) s[o.uuid] = o;
|
|
1089
1093
|
return s;
|
|
@@ -1107,7 +1111,7 @@ class Mi {
|
|
|
1107
1111
|
}
|
|
1108
1112
|
}
|
|
1109
1113
|
}
|
|
1110
|
-
function
|
|
1114
|
+
function Li(t) {
|
|
1111
1115
|
return {
|
|
1112
1116
|
id: t.uuid,
|
|
1113
1117
|
prompt: t.prompt,
|
|
@@ -1117,23 +1121,23 @@ function Ii(t) {
|
|
|
1117
1121
|
ratio: t.ratio
|
|
1118
1122
|
};
|
|
1119
1123
|
}
|
|
1120
|
-
function
|
|
1124
|
+
function Di(t) {
|
|
1121
1125
|
try {
|
|
1122
|
-
const e =
|
|
1126
|
+
const e = ct(t);
|
|
1123
1127
|
if (e.kind === "file")
|
|
1124
1128
|
return {
|
|
1125
1129
|
uuid: e.uuid,
|
|
1126
|
-
cdnUrlModifiers:
|
|
1130
|
+
cdnUrlModifiers: ht(e.operations),
|
|
1127
1131
|
fileName: e.filename ?? ""
|
|
1128
1132
|
};
|
|
1129
1133
|
} catch {
|
|
1130
1134
|
}
|
|
1131
1135
|
return { uuid: "", cdnUrlModifiers: "", fileName: "" };
|
|
1132
1136
|
}
|
|
1133
|
-
function
|
|
1134
|
-
return e ? e(t,
|
|
1137
|
+
function Ni(t, e) {
|
|
1138
|
+
return e ? e(t, Di(t)) : t;
|
|
1135
1139
|
}
|
|
1136
|
-
class
|
|
1140
|
+
class mt {
|
|
1137
1141
|
constructor(e) {
|
|
1138
1142
|
this._cache = /* @__PURE__ */ new Map(), this._pending = /* @__PURE__ */ new Set(), this._host = e, e.addController(this);
|
|
1139
1143
|
}
|
|
@@ -1150,39 +1154,39 @@ class pt {
|
|
|
1150
1154
|
const i = this._cache.get(e);
|
|
1151
1155
|
if (i !== void 0) return i;
|
|
1152
1156
|
if (this._pending.has(e)) return null;
|
|
1153
|
-
const r =
|
|
1157
|
+
const r = Ni(e, this._resolver);
|
|
1154
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(() => {
|
|
1155
1159
|
this._pending.delete(e), this._host.requestUpdate();
|
|
1156
1160
|
}), null);
|
|
1157
1161
|
}
|
|
1158
1162
|
}
|
|
1159
|
-
const
|
|
1163
|
+
const Wr = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1160
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"/>
|
|
1161
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"/>
|
|
1162
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"/>
|
|
1163
|
-
</svg>`,
|
|
1167
|
+
</svg>`, Vr = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1164
1168
|
<path d="m14.5 4.5 5 5L9 20H4v-5L14.5 4.5Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>
|
|
1165
1169
|
<path d="m13 6 5 5" stroke="currentColor" stroke-width="1.5"/>
|
|
1166
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"/>
|
|
1167
|
-
</svg>`,
|
|
1171
|
+
</svg>`, Bi = `<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1168
1172
|
<path d="M3 6.74251L8 2L13 6.74251M7.99961 14V2.10636" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1169
|
-
</svg>`,
|
|
1173
|
+
</svg>`, ji = `<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1170
1174
|
<rect x="2" y="3" width="12" height="10" rx="1.6" stroke="currentColor" stroke-width="1.4"/>
|
|
1171
1175
|
<circle cx="5.75" cy="6.25" r="1.05" stroke="currentColor" stroke-width="1.2"/>
|
|
1172
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"/>
|
|
1173
|
-
</svg>`,
|
|
1177
|
+
</svg>`, Gi = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1174
1178
|
<path d="M9 4H4v5M15 4h5v5M9 20H4v-5M15 20h5v-5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1175
|
-
</svg>`,
|
|
1179
|
+
</svg>`, Hi = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
1176
1180
|
<path d="M4 9h5V4M20 9h-5V4M4 15h5v5M20 15h-5v5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1177
|
-
</svg>`,
|
|
1178
|
-
var
|
|
1179
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1181
|
+
</svg>`, Wi = ":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 Vi = Object.defineProperty, qi = Object.getOwnPropertyDescriptor, z = (t, e, i, r) => {
|
|
1183
|
+
for (var s = r > 1 ? void 0 : r ? qi(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
1180
1184
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
1181
|
-
return r && s &&
|
|
1185
|
+
return r && s && Vi(e, i, s), s;
|
|
1182
1186
|
};
|
|
1183
|
-
let A = class extends
|
|
1187
|
+
let A = class extends G {
|
|
1184
1188
|
constructor() {
|
|
1185
|
-
super(...arguments), this.options = [], this.selected = null, this.busy = !1, this.labelText = null, this.labelFor = (t) => O(t.value) ?
|
|
1189
|
+
super(...arguments), this.options = [], this.selected = null, this.busy = !1, this.labelText = null, this.labelFor = (t) => O(t.value) ? ee(t.value) : "", this.open = !1, this._onToggle = (t) => {
|
|
1186
1190
|
t.newState === "closed" && this.open && (this.open = !1);
|
|
1187
1191
|
};
|
|
1188
1192
|
}
|
|
@@ -1207,12 +1211,12 @@ let A = class extends j {
|
|
|
1207
1211
|
}
|
|
1208
1212
|
/** Icon for a selection: the ratio's shape, or the generic "Original" glyph. */
|
|
1209
1213
|
_iconFor(t) {
|
|
1210
|
-
return O(t) ?
|
|
1214
|
+
return O(t) ? Ft(t) : ji;
|
|
1211
1215
|
}
|
|
1212
1216
|
_triggerLabel() {
|
|
1213
1217
|
const t = this.selected;
|
|
1214
1218
|
if (!t) return "";
|
|
1215
|
-
if (O(t)) return
|
|
1219
|
+
if (O(t)) return ee(t);
|
|
1216
1220
|
const e = this.options.find((i) => i.value === t);
|
|
1217
1221
|
return e ? this.labelFor(e) : "";
|
|
1218
1222
|
}
|
|
@@ -1228,13 +1232,13 @@ let A = class extends j {
|
|
|
1228
1232
|
?disabled=${this.busy}
|
|
1229
1233
|
@click=${this._toggle}
|
|
1230
1234
|
>
|
|
1231
|
-
${this.selected ?
|
|
1235
|
+
${this.selected ? re(this._iconFor(this.selected)) : null}
|
|
1232
1236
|
${t ? f`<span class="trigger-label">${t}</span>` : null}
|
|
1233
1237
|
</button>
|
|
1234
1238
|
<div class="popover" popover="auto" role="listbox" @toggle=${this._onToggle}>
|
|
1235
1239
|
<div class="popover-inner">
|
|
1236
1240
|
${this.options.map((e) => {
|
|
1237
|
-
const i = this.selected ?
|
|
1241
|
+
const i = this.selected ? _e(e.value, this.selected) : !1;
|
|
1238
1242
|
return f`
|
|
1239
1243
|
<button
|
|
1240
1244
|
type="button"
|
|
@@ -1243,8 +1247,8 @@ let A = class extends j {
|
|
|
1243
1247
|
aria-selected="${i ? "true" : "false"}"
|
|
1244
1248
|
@click=${() => this._select(e.value)}
|
|
1245
1249
|
>
|
|
1246
|
-
${
|
|
1247
|
-
<span class="option-ratio">${O(e.value) ?
|
|
1250
|
+
${re(this._iconFor(e.value))}
|
|
1251
|
+
<span class="option-ratio">${O(e.value) ? ee(e.value) : ""}</span>
|
|
1248
1252
|
<span class="option-label">${this.labelFor(e)}</span>
|
|
1249
1253
|
</button>
|
|
1250
1254
|
`;
|
|
@@ -1254,7 +1258,7 @@ let A = class extends j {
|
|
|
1254
1258
|
`;
|
|
1255
1259
|
}
|
|
1256
1260
|
};
|
|
1257
|
-
A.styles =
|
|
1261
|
+
A.styles = j(Wi);
|
|
1258
1262
|
z([
|
|
1259
1263
|
c({ attribute: !1 })
|
|
1260
1264
|
], A.prototype, "options", 2);
|
|
@@ -1277,36 +1281,36 @@ z([
|
|
|
1277
1281
|
F(".popover")
|
|
1278
1282
|
], A.prototype, "_popover", 2);
|
|
1279
1283
|
A = z([
|
|
1280
|
-
|
|
1284
|
+
H("uc-ai-aspect-ratio")
|
|
1281
1285
|
], A);
|
|
1282
|
-
const
|
|
1283
|
-
let
|
|
1284
|
-
const
|
|
1286
|
+
const Ki = /* @__PURE__ */ new WeakMap();
|
|
1287
|
+
let Xe = 0;
|
|
1288
|
+
const fe = /* @__PURE__ */ new Map(), Je = /* @__PURE__ */ new WeakSet(), Ze = () => new Promise((t) => requestAnimationFrame(t)), Qe = (t, e) => {
|
|
1285
1289
|
const i = t - e;
|
|
1286
1290
|
return i === 0 ? void 0 : i;
|
|
1287
|
-
},
|
|
1291
|
+
}, et = (t, e) => {
|
|
1288
1292
|
const i = t / e;
|
|
1289
1293
|
return i === 1 ? void 0 : i;
|
|
1290
|
-
},
|
|
1291
|
-
const i =
|
|
1294
|
+
}, me = { left: (t, e) => {
|
|
1295
|
+
const i = Qe(t, e);
|
|
1292
1296
|
return { value: i, transform: i == null || isNaN(i) ? void 0 : `translateX(${i}px)` };
|
|
1293
1297
|
}, top: (t, e) => {
|
|
1294
|
-
const i =
|
|
1298
|
+
const i = Qe(t, e);
|
|
1295
1299
|
return { value: i, transform: i == null || isNaN(i) ? void 0 : `translateY(${i}px)` };
|
|
1296
1300
|
}, width: (t, e) => {
|
|
1297
1301
|
let i;
|
|
1298
1302
|
e === 0 && (e = 1, i = { width: "1px" });
|
|
1299
|
-
const r =
|
|
1303
|
+
const r = et(t, e);
|
|
1300
1304
|
return { value: r, overrideFrom: i, transform: r == null || isNaN(r) ? void 0 : `scaleX(${r})` };
|
|
1301
1305
|
}, height: (t, e) => {
|
|
1302
1306
|
let i;
|
|
1303
1307
|
e === 0 && (e = 1, i = { height: "1px" });
|
|
1304
|
-
const r =
|
|
1308
|
+
const r = et(t, e);
|
|
1305
1309
|
return { value: r, overrideFrom: i, transform: r == null || isNaN(r) ? void 0 : `scaleY(${r})` };
|
|
1306
|
-
} },
|
|
1307
|
-
class
|
|
1310
|
+
} }, Yi = { duration: 333, easing: "ease-in-out" }, Xi = ["left", "top", "width", "height", "opacity", "color", "background"], tt = /* @__PURE__ */ new WeakMap();
|
|
1311
|
+
class Ji extends at {
|
|
1308
1312
|
constructor(e) {
|
|
1309
|
-
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 === ot.CHILD) throw Error("The `animate` directive must be used in attribute position.");
|
|
1310
1314
|
this.createFinished();
|
|
1311
1315
|
}
|
|
1312
1316
|
createFinished() {
|
|
@@ -1320,10 +1324,10 @@ class qi extends st {
|
|
|
1320
1324
|
(e = this.l) == null || e.call(this), this.l = void 0;
|
|
1321
1325
|
}
|
|
1322
1326
|
render(e) {
|
|
1323
|
-
return
|
|
1327
|
+
return rt;
|
|
1324
1328
|
}
|
|
1325
1329
|
getController() {
|
|
1326
|
-
return
|
|
1330
|
+
return Ki.get(this.u);
|
|
1327
1331
|
}
|
|
1328
1332
|
isDisabled() {
|
|
1329
1333
|
var e;
|
|
@@ -1332,17 +1336,17 @@ class qi extends st {
|
|
|
1332
1336
|
update(e, [i]) {
|
|
1333
1337
|
var s;
|
|
1334
1338
|
const r = this.u === void 0;
|
|
1335
|
-
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, tt.set(this.element, this)), this.optionsOrCallback = i, (r || typeof i != "function") && this.m(i), this.render(i);
|
|
1336
1340
|
}
|
|
1337
1341
|
m(e) {
|
|
1338
1342
|
e = e ?? {};
|
|
1339
1343
|
const i = this.getController();
|
|
1340
|
-
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 = Xi), this.options = e;
|
|
1341
1345
|
}
|
|
1342
1346
|
p() {
|
|
1343
1347
|
const e = {}, i = this.element.getBoundingClientRect(), r = getComputedStyle(this.element);
|
|
1344
1348
|
return this.options.properties.forEach((s) => {
|
|
1345
|
-
const o = i[s] ?? (
|
|
1349
|
+
const o = i[s] ?? (me[s] ? void 0 : r[s]), a = Number(o);
|
|
1346
1350
|
e[s] = isNaN(a) ? o + "" : a;
|
|
1347
1351
|
}), e;
|
|
1348
1352
|
}
|
|
@@ -1361,17 +1365,17 @@ class qi extends st {
|
|
|
1361
1365
|
async hostUpdated() {
|
|
1362
1366
|
if (!this.h || !this.element.isConnected || this.options.skipInitial && !this.isHostRendered) return;
|
|
1363
1367
|
let e;
|
|
1364
|
-
this.prepare(), await
|
|
1368
|
+
this.prepare(), await Ze;
|
|
1365
1369
|
const i = this.P(), r = this.V(this.options.keyframeOptions, i), s = this.p();
|
|
1366
1370
|
if (this.A !== void 0) {
|
|
1367
1371
|
const { from: o, to: a } = this.O(this.A, s, i);
|
|
1368
1372
|
this.log("measured", [this.A, s, o, a]), e = this.calculateKeyframes(o, a);
|
|
1369
1373
|
} else {
|
|
1370
|
-
const o =
|
|
1374
|
+
const o = fe.get(this.options.inId);
|
|
1371
1375
|
if (o) {
|
|
1372
|
-
|
|
1376
|
+
fe.delete(this.options.inId);
|
|
1373
1377
|
const { from: a, to: n } = this.O(o, s, i);
|
|
1374
|
-
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, Xe++, e.forEach((l) => l.zIndex = Xe);
|
|
1375
1379
|
} else this.options.in && (e = [...this.options.in, {}]);
|
|
1376
1380
|
}
|
|
1377
1381
|
this.animate(e, r);
|
|
@@ -1387,8 +1391,8 @@ class qi extends st {
|
|
|
1387
1391
|
}
|
|
1388
1392
|
async disconnected() {
|
|
1389
1393
|
var i;
|
|
1390
|
-
if (!this.h || (this.options.id !== void 0 &&
|
|
1391
|
-
if (this.prepare(), await
|
|
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 Ze(), (i = this.i) == null ? void 0 : i.isConnected) {
|
|
1392
1396
|
const r = this.o && this.o.parentNode === this.i ? this.o : null;
|
|
1393
1397
|
if (this.i.insertBefore(this.element, r), this.options.stabilizeOut) {
|
|
1394
1398
|
const s = this.p();
|
|
@@ -1414,19 +1418,19 @@ class qi extends st {
|
|
|
1414
1418
|
P() {
|
|
1415
1419
|
const e = [];
|
|
1416
1420
|
for (let i = this.element.parentNode; i; i = i == null ? void 0 : i.parentNode) {
|
|
1417
|
-
const r =
|
|
1421
|
+
const r = tt.get(i);
|
|
1418
1422
|
r && !r.isDisabled() && r && e.push(r);
|
|
1419
1423
|
}
|
|
1420
1424
|
return e;
|
|
1421
1425
|
}
|
|
1422
1426
|
get isHostRendered() {
|
|
1423
|
-
const e =
|
|
1427
|
+
const e = Je.has(this.u);
|
|
1424
1428
|
return e || this.u.updateComplete.then(() => {
|
|
1425
|
-
|
|
1429
|
+
Je.add(this.u);
|
|
1426
1430
|
}), e;
|
|
1427
1431
|
}
|
|
1428
1432
|
V(e, i = this.P()) {
|
|
1429
|
-
const r = { ...
|
|
1433
|
+
const r = { ...Yi };
|
|
1430
1434
|
return i.forEach((s) => Object.assign(r, s.options.keyframeOptions)), Object.assign(r, e), r;
|
|
1431
1435
|
}
|
|
1432
1436
|
O(e, i, r) {
|
|
@@ -1443,8 +1447,8 @@ class qi extends st {
|
|
|
1443
1447
|
const n = {};
|
|
1444
1448
|
for (const l in i) {
|
|
1445
1449
|
const h = e[l], p = i[l];
|
|
1446
|
-
if (l in
|
|
1447
|
-
const u =
|
|
1450
|
+
if (l in me) {
|
|
1451
|
+
const u = me[l];
|
|
1448
1452
|
if (h === void 0 || p === void 0) continue;
|
|
1449
1453
|
const _ = u(h, p);
|
|
1450
1454
|
_.transform !== void 0 && (n[l] = _.value, a = !0, s.transform = `${s.transform ?? ""} ${_.transform}`, _.overrideFrom !== void 0 && Object.assign(s, _.overrideFrom));
|
|
@@ -1475,13 +1479,13 @@ class qi extends st {
|
|
|
1475
1479
|
this.shouldLog && !this.isDisabled() && console.log(e, this.options.id, i);
|
|
1476
1480
|
}
|
|
1477
1481
|
}
|
|
1478
|
-
const
|
|
1479
|
-
class
|
|
1482
|
+
const Zi = st(Ji), Qi = ["top", "right", "bottom", "left"];
|
|
1483
|
+
class er extends at {
|
|
1480
1484
|
constructor(e) {
|
|
1481
|
-
if (super(e), e.type !==
|
|
1485
|
+
if (super(e), e.type !== ot.ELEMENT) throw Error("The `position` directive must be used in attribute position.");
|
|
1482
1486
|
}
|
|
1483
1487
|
render(e, i) {
|
|
1484
|
-
return
|
|
1488
|
+
return rt;
|
|
1485
1489
|
}
|
|
1486
1490
|
update(e, [i, r]) {
|
|
1487
1491
|
var s;
|
|
@@ -1496,22 +1500,22 @@ class Xi extends st {
|
|
|
1496
1500
|
if (e === void 0 || !i) return;
|
|
1497
1501
|
const r = e.getBoundingClientRect(), s = i.getBoundingClientRect();
|
|
1498
1502
|
(a = this.S) == null || a.forEach((n) => {
|
|
1499
|
-
const l =
|
|
1503
|
+
const l = Qi.includes(n) ? r[n] - s[n] : r[n];
|
|
1500
1504
|
this.C.style[n] = l + "px";
|
|
1501
1505
|
});
|
|
1502
1506
|
}
|
|
1503
1507
|
}
|
|
1504
|
-
|
|
1505
|
-
const
|
|
1506
|
-
var
|
|
1507
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1508
|
+
st(er);
|
|
1509
|
+
const tr = ':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 ir = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, L = (t, e, i, r) => {
|
|
1511
|
+
for (var s = r > 1 ? void 0 : r ? rr(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
1508
1512
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
1509
|
-
return r && s &&
|
|
1513
|
+
return r && s && ir(e, i, s), s;
|
|
1510
1514
|
};
|
|
1511
|
-
const
|
|
1512
|
-
let U = class extends
|
|
1515
|
+
const sr = 80;
|
|
1516
|
+
let U = class extends G {
|
|
1513
1517
|
constructor() {
|
|
1514
|
-
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 mt(this), this._loaded = /* @__PURE__ */ new Set();
|
|
1515
1519
|
}
|
|
1516
1520
|
willUpdate(t) {
|
|
1517
1521
|
if (t.has("secureResolver") && this._secure.setResolver(this.secureResolver), t.has("entries")) {
|
|
@@ -1544,11 +1548,11 @@ let U = class extends j {
|
|
|
1544
1548
|
</button>
|
|
1545
1549
|
</div>
|
|
1546
1550
|
` : v}
|
|
1547
|
-
${
|
|
1551
|
+
${wt(
|
|
1548
1552
|
i,
|
|
1549
1553
|
(r) => r.id,
|
|
1550
1554
|
(r) => {
|
|
1551
|
-
const s = this._secure.resolve(
|
|
1555
|
+
const s = this._secure.resolve(Ii(r.url, sr)), o = this.selectedUuid != null && r.file.uuid === this.selectedUuid, a = this._loaded.has(r.id);
|
|
1552
1556
|
return f`
|
|
1553
1557
|
<button
|
|
1554
1558
|
type="button"
|
|
@@ -1558,7 +1562,7 @@ let U = class extends j {
|
|
|
1558
1562
|
aria-label=${r.prompt || "Result"}
|
|
1559
1563
|
title=${r.prompt}
|
|
1560
1564
|
@click=${() => this._select(r)}
|
|
1561
|
-
${
|
|
1565
|
+
${Zi({ keyframeOptions: { duration: 300, easing: "cubic-bezier(0.23, 1, 0.32, 1)" } })}
|
|
1562
1566
|
>
|
|
1563
1567
|
<span class=${S({ thumb: !0, "thumb--loaded": a })}>
|
|
1564
1568
|
${// Rendering the <img> preloads it; the skeleton shows until it
|
|
@@ -1581,7 +1585,7 @@ let U = class extends j {
|
|
|
1581
1585
|
`;
|
|
1582
1586
|
}
|
|
1583
1587
|
};
|
|
1584
|
-
U.styles =
|
|
1588
|
+
U.styles = j(tr);
|
|
1585
1589
|
L([
|
|
1586
1590
|
c({ attribute: !1 })
|
|
1587
1591
|
], U.prototype, "entries", 2);
|
|
@@ -1604,15 +1608,15 @@ L([
|
|
|
1604
1608
|
c({ attribute: !1 })
|
|
1605
1609
|
], U.prototype, "secureResolver", 2);
|
|
1606
1610
|
U = L([
|
|
1607
|
-
|
|
1611
|
+
H("uc-ai-history")
|
|
1608
1612
|
], U);
|
|
1609
|
-
const
|
|
1610
|
-
var
|
|
1611
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1613
|
+
const or = ':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 ar = Object.defineProperty, nr = Object.getOwnPropertyDescriptor, D = (t, e, i, r) => {
|
|
1615
|
+
for (var s = r > 1 ? void 0 : r ? nr(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
1612
1616
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
1613
|
-
return r && s &&
|
|
1617
|
+
return r && s && ar(e, i, s), s;
|
|
1614
1618
|
};
|
|
1615
|
-
let T = class extends
|
|
1619
|
+
let T = class extends G {
|
|
1616
1620
|
constructor() {
|
|
1617
1621
|
super(...arguments), this.mode = "generate", this.value = "", this.placeholder = "", this.busy = !1, this.allowCustom = !0, this.sendAriaLabel = "";
|
|
1618
1622
|
}
|
|
@@ -1681,7 +1685,7 @@ let T = class extends j {
|
|
|
1681
1685
|
?disabled=${this.busy || t}
|
|
1682
1686
|
@click=${this._emitSend}
|
|
1683
1687
|
>
|
|
1684
|
-
<span class="send__icon">${
|
|
1688
|
+
<span class="send__icon">${re(Bi)}</span>
|
|
1685
1689
|
<span class="send__spinner" aria-hidden="true"></span>
|
|
1686
1690
|
</button>
|
|
1687
1691
|
</div>
|
|
@@ -1691,7 +1695,7 @@ let T = class extends j {
|
|
|
1691
1695
|
`;
|
|
1692
1696
|
}
|
|
1693
1697
|
};
|
|
1694
|
-
T.styles =
|
|
1698
|
+
T.styles = j(or);
|
|
1695
1699
|
D([
|
|
1696
1700
|
c()
|
|
1697
1701
|
], T.prototype, "mode", 2);
|
|
@@ -1714,15 +1718,15 @@ D([
|
|
|
1714
1718
|
F(".input")
|
|
1715
1719
|
], T.prototype, "_inputEl", 2);
|
|
1716
1720
|
T = D([
|
|
1717
|
-
|
|
1721
|
+
H("uc-ai-prompt-row")
|
|
1718
1722
|
], T);
|
|
1719
|
-
const
|
|
1720
|
-
var
|
|
1721
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
1723
|
+
const lr = ":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 cr = Object.defineProperty, hr = Object.getOwnPropertyDescriptor, Y = (t, e, i, r) => {
|
|
1725
|
+
for (var s = r > 1 ? void 0 : r ? hr(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
1722
1726
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
1723
|
-
return r && s &&
|
|
1727
|
+
return r && s && cr(e, i, s), s;
|
|
1724
1728
|
};
|
|
1725
|
-
let P = class extends
|
|
1729
|
+
let P = class extends G {
|
|
1726
1730
|
constructor() {
|
|
1727
1731
|
super(...arguments), this.mode = "generate", this.presets = null, this.busy = !1, this.labelText = "Quick prompts";
|
|
1728
1732
|
}
|
|
@@ -1759,7 +1763,7 @@ let P = class extends j {
|
|
|
1759
1763
|
);
|
|
1760
1764
|
}
|
|
1761
1765
|
render() {
|
|
1762
|
-
const t = this.presets ??
|
|
1766
|
+
const t = this.presets ?? ye[this.mode].presets;
|
|
1763
1767
|
return f`
|
|
1764
1768
|
<div
|
|
1765
1769
|
class="row"
|
|
@@ -1779,26 +1783,30 @@ let P = class extends j {
|
|
|
1779
1783
|
`;
|
|
1780
1784
|
}
|
|
1781
1785
|
};
|
|
1782
|
-
P.styles =
|
|
1783
|
-
|
|
1786
|
+
P.styles = j(lr);
|
|
1787
|
+
Y([
|
|
1784
1788
|
c()
|
|
1785
1789
|
], P.prototype, "mode", 2);
|
|
1786
|
-
|
|
1790
|
+
Y([
|
|
1787
1791
|
c({ attribute: !1 })
|
|
1788
1792
|
], P.prototype, "presets", 2);
|
|
1789
|
-
|
|
1793
|
+
Y([
|
|
1790
1794
|
c({ type: Boolean })
|
|
1791
1795
|
], P.prototype, "busy", 2);
|
|
1792
|
-
|
|
1796
|
+
Y([
|
|
1793
1797
|
c({ attribute: "aria-label-text" })
|
|
1794
1798
|
], P.prototype, "labelText", 2);
|
|
1795
|
-
|
|
1799
|
+
Y([
|
|
1796
1800
|
F(".row")
|
|
1797
1801
|
], P.prototype, "_rowEl", 2);
|
|
1798
|
-
P =
|
|
1799
|
-
|
|
1802
|
+
P = Y([
|
|
1803
|
+
H("uc-ai-chips")
|
|
1800
1804
|
], P);
|
|
1801
|
-
|
|
1805
|
+
function N(t, e) {
|
|
1806
|
+
if (t === null) throw new Error(`DotGrid GL: failed to create ${e} (context lost?)`);
|
|
1807
|
+
return t;
|
|
1808
|
+
}
|
|
1809
|
+
const xe = 8, ur = `#version 300 es
|
|
1802
1810
|
precision highp float;
|
|
1803
1811
|
precision highp int;
|
|
1804
1812
|
in vec2 aCorner; // unit quad corner, -0.5..0.5
|
|
@@ -1817,7 +1825,7 @@ uniform float uMinScale;
|
|
|
1817
1825
|
uniform float uPeakScale;
|
|
1818
1826
|
uniform float uIdleScale;
|
|
1819
1827
|
uniform int uEpiCount;
|
|
1820
|
-
uniform vec2 uEpis[${
|
|
1828
|
+
uniform vec2 uEpis[${xe}];
|
|
1821
1829
|
uniform float uEpiRadius;
|
|
1822
1830
|
uniform float uEpiFalloff;
|
|
1823
1831
|
uniform float uColorA;
|
|
@@ -1834,7 +1842,7 @@ float epiIntensity(vec2 p) {
|
|
|
1834
1842
|
// Low-frequency warp of the distance field — dissolves ring banding.
|
|
1835
1843
|
float k = uFalloffWarp > 0.0 ? (6.2831853 / (uEpiRadius * 0.7)) : 0.0;
|
|
1836
1844
|
float warp = k > 0.0 ? uFalloffWarp * uEpiRadius * sin(p.x * k + 1.3) * cos(p.y * k * 0.9) : 0.0;
|
|
1837
|
-
for (int i = 0; i < ${
|
|
1845
|
+
for (int i = 0; i < ${xe}; i++) {
|
|
1838
1846
|
if (i >= uEpiCount) break;
|
|
1839
1847
|
float d = max(0.0, distance(p, uEpis[i]) + warp);
|
|
1840
1848
|
if (d >= uEpiRadius) continue;
|
|
@@ -1895,7 +1903,7 @@ void main() {
|
|
|
1895
1903
|
gl_Position = vec4(ndc.x, -ndc.y, 0.0, 1.0);
|
|
1896
1904
|
|
|
1897
1905
|
vAlpha = (uMask == 1) ? 1.0 : uColorA;
|
|
1898
|
-
}`,
|
|
1906
|
+
}`, dr = `#version 300 es
|
|
1899
1907
|
precision highp float;
|
|
1900
1908
|
precision highp int;
|
|
1901
1909
|
in float vAlpha;
|
|
@@ -1914,7 +1922,7 @@ void main() {
|
|
|
1914
1922
|
float cov = clamp(0.5 - sd / aaw, 0.0, 1.0);
|
|
1915
1923
|
vec3 rgb = (uMask == 1) ? vec3(1.0) : uColorRGB;
|
|
1916
1924
|
frag = vec4(rgb * vAlpha * cov, vAlpha * cov); // premultiplied
|
|
1917
|
-
}`,
|
|
1925
|
+
}`, pr = `#version 300 es
|
|
1918
1926
|
precision highp float;
|
|
1919
1927
|
in vec2 aQuad; // 0..1
|
|
1920
1928
|
uniform vec2 uResolution;
|
|
@@ -1925,7 +1933,7 @@ void main() {
|
|
|
1925
1933
|
vFramePx = px - uFrame.xy;
|
|
1926
1934
|
vec2 ndc = (px / uResolution) * 2.0 - 1.0;
|
|
1927
1935
|
gl_Position = vec4(ndc.x, -ndc.y, 0.0, 1.0);
|
|
1928
|
-
}`,
|
|
1936
|
+
}`, fr = `#version 300 es
|
|
1929
1937
|
precision highp float;
|
|
1930
1938
|
in vec2 vFramePx;
|
|
1931
1939
|
uniform sampler2D uImage;
|
|
@@ -1940,13 +1948,13 @@ void main() {
|
|
|
1940
1948
|
vec2 uv = (vFramePx - off) / dsz;
|
|
1941
1949
|
frag = vec4(texture(uImage, uv).rgb, 1.0);
|
|
1942
1950
|
}`;
|
|
1943
|
-
class
|
|
1951
|
+
class Ae {
|
|
1944
1952
|
constructor(e) {
|
|
1945
|
-
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(ur, dr), this._imgProgram = this._link(pr, fr), 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);
|
|
1946
1954
|
const i = e.getAttribLocation(this._dotProgram, "aCorner");
|
|
1947
1955
|
e.bindBuffer(e.ARRAY_BUFFER, this._cornerBuf), e.enableVertexAttribArray(i), e.vertexAttribPointer(i, 2, e.FLOAT, !1, 0, 0);
|
|
1948
1956
|
const r = e.getAttribLocation(this._dotProgram, "aClip");
|
|
1949
|
-
e.bindBuffer(e.ARRAY_BUFFER, this._clipBuf), e.enableVertexAttribArray(r), e.vertexAttribPointer(r, 1, e.FLOAT, !1, 0, 0), e.vertexAttribDivisor(r, 1), e.bindVertexArray(null), this._imgVao = e.createVertexArray(), e.bindVertexArray(this._imgVao);
|
|
1957
|
+
e.bindBuffer(e.ARRAY_BUFFER, this._clipBuf), e.enableVertexAttribArray(r), e.vertexAttribPointer(r, 1, e.FLOAT, !1, 0, 0), e.vertexAttribDivisor(r, 1), e.bindVertexArray(null), this._imgVao = N(e.createVertexArray(), "vertex array"), e.bindVertexArray(this._imgVao);
|
|
1950
1958
|
const s = e.getAttribLocation(this._imgProgram, "aQuad");
|
|
1951
1959
|
e.bindBuffer(e.ARRAY_BUFFER, this._quadBuf), e.enableVertexAttribArray(s), e.vertexAttribPointer(s, 2, e.FLOAT, !1, 0, 0), e.bindVertexArray(null);
|
|
1952
1960
|
for (const o of [
|
|
@@ -1975,7 +1983,7 @@ class Ce {
|
|
|
1975
1983
|
this._dotUniforms[o] = e.getUniformLocation(this._dotProgram, o);
|
|
1976
1984
|
for (const o of ["uResolution", "uFrame", "uImage", "uFrameSize", "uImageSize"])
|
|
1977
1985
|
this._imgUniforms[o] = e.getUniformLocation(this._imgProgram, o);
|
|
1978
|
-
this._texture = e.createTexture(), e.bindTexture(e.TEXTURE_2D, this._texture), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, !1), e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1);
|
|
1986
|
+
this._texture = N(e.createTexture(), "texture"), e.bindTexture(e.TEXTURE_2D, this._texture), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, !1), e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1);
|
|
1979
1987
|
}
|
|
1980
1988
|
/** Create a renderer on `canvas`, or null if WebGL2 / compilation is unavailable. */
|
|
1981
1989
|
static create(e) {
|
|
@@ -1992,7 +2000,7 @@ class Ce {
|
|
|
1992
2000
|
}
|
|
1993
2001
|
if (!i) return null;
|
|
1994
2002
|
try {
|
|
1995
|
-
return new
|
|
2003
|
+
return new Ae(i);
|
|
1996
2004
|
} catch (r) {
|
|
1997
2005
|
return typeof console < "u" && console.warn("[dot-grid] WebGL init failed, using 2D:", r), null;
|
|
1998
2006
|
}
|
|
@@ -2025,7 +2033,7 @@ class Ce {
|
|
|
2025
2033
|
}
|
|
2026
2034
|
i.bindBuffer(i.ARRAY_BUFFER, this._clipBuf), i.bufferData(i.ARRAY_BUFFER, e.clip, i.DYNAMIC_DRAW), i.enable(i.BLEND), i.blendFunc(i.ONE, i.ONE_MINUS_SRC_ALPHA), i.useProgram(this._dotProgram), i.bindVertexArray(this._dotVao);
|
|
2027
2035
|
const s = this._dotUniforms;
|
|
2028
|
-
if (i.uniform2f(s.uResolution, e.cssW, e.cssH), i.uniform1f(s.uCols, e.cols), i.uniform2f(s.uOffset, e.offsetX, e.offsetY), i.uniform1f(s.uCell, e.cell), i.uniform1f(s.uBaseRadius, e.baseRadius), i.uniform1f(s.uFullHalf, e.fullHalf), i.uniform1f(s.uEnv, e.env), i.uniform1f(s.uShimMix, e.shimMix), i.uniform1i(s.uMask, e.mask ? 1 : 0), i.uniform1i(s.uGenerating, e.generating ? 1 : 0), i.uniform1f(s.uMinScale, e.minScale), i.uniform1f(s.uPeakScale, e.peakScale), i.uniform1f(s.uIdleScale, e.idleScale), i.uniform1i(s.uEpiCount, Math.min(e.epiCount,
|
|
2036
|
+
if (i.uniform2f(s.uResolution, e.cssW, e.cssH), i.uniform1f(s.uCols, e.cols), i.uniform2f(s.uOffset, e.offsetX, e.offsetY), i.uniform1f(s.uCell, e.cell), i.uniform1f(s.uBaseRadius, e.baseRadius), i.uniform1f(s.uFullHalf, e.fullHalf), i.uniform1f(s.uEnv, e.env), i.uniform1f(s.uShimMix, e.shimMix), i.uniform1i(s.uMask, e.mask ? 1 : 0), i.uniform1i(s.uGenerating, e.generating ? 1 : 0), i.uniform1f(s.uMinScale, e.minScale), i.uniform1f(s.uPeakScale, e.peakScale), i.uniform1f(s.uIdleScale, e.idleScale), i.uniform1i(s.uEpiCount, Math.min(e.epiCount, xe)), i.uniform2fv(s.uEpis, e.epis), i.uniform1f(s.uEpiRadius, e.epiRadius), i.uniform1f(s.uEpiFalloff, e.epiFalloff), i.uniform1f(s.uColorA, e.color[3]), i.uniform3f(s.uColorRGB, e.color[0], e.color[1], e.color[2]), i.uniform1f(s.uFalloffWarp, e.falloffWarp), i.uniform1f(s.uDither, e.dither), i.drawArraysInstanced(i.TRIANGLE_STRIP, 0, 4, r), e.mask && this._texOk && this._texImage) {
|
|
2029
2037
|
i.blendFunc(i.DST_ALPHA, i.ZERO), i.useProgram(this._imgProgram), i.bindVertexArray(this._imgVao);
|
|
2030
2038
|
const o = this._imgUniforms;
|
|
2031
2039
|
i.uniform2f(o.uResolution, e.cssW, e.cssH), i.uniform4f(o.uFrame, e.frameLeft, e.frameTop, e.frameRight, e.frameBottom), i.uniform2f(o.uFrameSize, e.frameRight - e.frameLeft, e.frameBottom - e.frameTop), i.uniform2f(o.uImageSize, this._texImage.naturalWidth, this._texImage.naturalHeight), i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, this._texture), i.uniform1i(o.uImage, 0), i.drawArrays(i.TRIANGLE_STRIP, 0, 4);
|
|
@@ -2043,11 +2051,11 @@ class Ce {
|
|
|
2043
2051
|
s.canvas.width = Math.round(e * r), s.canvas.height = Math.round(i * r), s.canvas.style.width = `${e}px`, s.canvas.style.height = `${i}px`, s.viewport(0, 0, s.canvas.width, s.canvas.height), this._appliedW = e, this._appliedH = i, this._appliedScale = r;
|
|
2044
2052
|
}
|
|
2045
2053
|
_staticBuffer(e) {
|
|
2046
|
-
const i = this._gl, r = i.createBuffer();
|
|
2054
|
+
const i = this._gl, r = N(i.createBuffer(), "buffer");
|
|
2047
2055
|
return i.bindBuffer(i.ARRAY_BUFFER, r), i.bufferData(i.ARRAY_BUFFER, new Float32Array(e), i.STATIC_DRAW), r;
|
|
2048
2056
|
}
|
|
2049
2057
|
_link(e, i) {
|
|
2050
|
-
const r = this._gl, s = this._compile(r.VERTEX_SHADER, e), o = this._compile(r.FRAGMENT_SHADER, i), a = r.createProgram();
|
|
2058
|
+
const r = this._gl, s = this._compile(r.VERTEX_SHADER, e), o = this._compile(r.FRAGMENT_SHADER, i), a = N(r.createProgram(), "program");
|
|
2051
2059
|
if (r.attachShader(a, s), r.attachShader(a, o), r.linkProgram(a), r.deleteShader(s), r.deleteShader(o), !r.getProgramParameter(a, r.LINK_STATUS)) {
|
|
2052
2060
|
const n = r.getProgramInfoLog(a);
|
|
2053
2061
|
throw r.deleteProgram(a), new Error(`DotGrid GL link failed: ${n}`);
|
|
@@ -2055,7 +2063,7 @@ class Ce {
|
|
|
2055
2063
|
return a;
|
|
2056
2064
|
}
|
|
2057
2065
|
_compile(e, i) {
|
|
2058
|
-
const r = this._gl, s = r.createShader(e);
|
|
2066
|
+
const r = this._gl, s = N(r.createShader(e), "shader");
|
|
2059
2067
|
if (r.shaderSource(s, i), r.compileShader(s), !r.getShaderParameter(s, r.COMPILE_STATUS)) {
|
|
2060
2068
|
const o = r.getShaderInfoLog(s);
|
|
2061
2069
|
throw r.deleteShader(s), new Error(`DotGrid GL compile failed: ${o}`);
|
|
@@ -2063,7 +2071,7 @@ class Ce {
|
|
|
2063
2071
|
return s;
|
|
2064
2072
|
}
|
|
2065
2073
|
}
|
|
2066
|
-
const
|
|
2074
|
+
const mr = 1200, _r = 800, gr = 1.5, it = (t) => 1 - (1 - t) ** 3, vr = {
|
|
2067
2075
|
cellSize: 6,
|
|
2068
2076
|
dotRatio: 0.46,
|
|
2069
2077
|
sizeScale: 1,
|
|
@@ -2084,19 +2092,19 @@ const ur = 1200, dr = 800, pr = 1.5, et = (t) => 1 - (1 - t) ** 3, fr = {
|
|
|
2084
2092
|
shimEnterMs: 450,
|
|
2085
2093
|
shimExitMs: 450
|
|
2086
2094
|
};
|
|
2087
|
-
class
|
|
2095
|
+
class br {
|
|
2088
2096
|
constructor(e, i) {
|
|
2089
|
-
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 = { ...vr }, 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 = () => {
|
|
2090
2098
|
this.refreshColor();
|
|
2091
2099
|
}, this._rectCache = null, this._glEpis = new Float32Array(16), this._tick = (r) => {
|
|
2092
2100
|
const s = this._lastTime ? Math.min(64, r - this._lastTime) : 16;
|
|
2093
2101
|
if (this._lastTime = r, this._rectCache = this._frameRect(), this._envAnimating) {
|
|
2094
2102
|
const a = Math.min(1, (r - this._envStart) / this._envDur);
|
|
2095
|
-
this._env = this._envFrom + (this._envTo - this._envFrom) *
|
|
2103
|
+
this._env = this._envFrom + (this._envTo - this._envFrom) * it(a), a >= 1 && (this._env = this._envTo, this._envAnimating = !1);
|
|
2096
2104
|
}
|
|
2097
2105
|
if (this._shimAnimating) {
|
|
2098
2106
|
const a = Math.min(1, (r - this._shimStart) / this._shimDur);
|
|
2099
|
-
this._shimMix = this._shimFrom + (this._shimTo - this._shimFrom) *
|
|
2107
|
+
this._shimMix = this._shimFrom + (this._shimTo - this._shimFrom) * it(a), a >= 1 && (this._shimMix = this._shimTo, this._shimAnimating = !1);
|
|
2100
2108
|
}
|
|
2101
2109
|
this._state.generating && !this._reduceMotion && this._moveEpicenters(s);
|
|
2102
2110
|
const o = this._followFrame(s);
|
|
@@ -2116,11 +2124,11 @@ class mr {
|
|
|
2116
2124
|
* proportional, >1 exaggerates, <0 inverts). Always positive, so it never
|
|
2117
2125
|
* produces a negative radius/speed however far it's pushed. */
|
|
2118
2126
|
_computeSizeMul() {
|
|
2119
|
-
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 / (mr * _r)) ** this._cfg.sizeScale;
|
|
2120
2128
|
}
|
|
2121
2129
|
/** Wire the painter to the canvas's rendered elements. */
|
|
2122
2130
|
attach(e) {
|
|
2123
|
-
if (this._refs = e, this._cfg.useWebgl !== !1 && (this._gl =
|
|
2131
|
+
if (this._refs = e, this._cfg.useWebgl !== !1 && (this._gl = Ae.create(e.surface)), this._gl || (this._ctx = e.surface.getContext("2d")), !!this._canDraw) {
|
|
2124
2132
|
if (this._readDotColor(), typeof ResizeObserver == "function" && (this._resizeObserver = new ResizeObserver(() => {
|
|
2125
2133
|
this._resize(), this.sync(this._state);
|
|
2126
2134
|
}), this._resizeObserver.observe(e.viewport), this._frameObserver = new ResizeObserver(() => this._ensureLoop()), this._frameObserver.observe(e.frame)), typeof window < "u" && typeof window.matchMedia == "function" && (this._schemeMql = window.matchMedia("(prefers-color-scheme: dark)"), this._schemeMql.addEventListener("change", this._onThemeChange)), typeof MutationObserver == "function" && typeof document < "u") {
|
|
@@ -2196,7 +2204,7 @@ class mr {
|
|
|
2196
2204
|
if (!i) return this._dotColorRGBA;
|
|
2197
2205
|
i.clearRect(0, 0, 1, 1), i.fillStyle = "#000", i.fillStyle = e, i.fillRect(0, 0, 1, 1);
|
|
2198
2206
|
const r = i.getImageData(0, 0, 1, 1).data;
|
|
2199
|
-
return [r[0] / 255, r[1] / 255, r[2] / 255, r[3] / 255];
|
|
2207
|
+
return [(r[0] ?? 0) / 255, (r[1] ?? 0) / 255, (r[2] ?? 0) / 255, (r[3] ?? 0) / 255];
|
|
2200
2208
|
}
|
|
2201
2209
|
_hasImage() {
|
|
2202
2210
|
var i;
|
|
@@ -2274,7 +2282,7 @@ class mr {
|
|
|
2274
2282
|
* {@link MAX_ANIMATED_DPR} so per-frame raster stays cheap on hi-dpi. */
|
|
2275
2283
|
_scale(e = !1) {
|
|
2276
2284
|
const i = Math.min(window.devicePixelRatio || 1, this._cfg.maxDpr);
|
|
2277
|
-
return e ? Math.min(i,
|
|
2285
|
+
return e ? Math.min(i, gr) : i;
|
|
2278
2286
|
}
|
|
2279
2287
|
/** Size the backing store to `scale`× the viewport. Note: setting width/height
|
|
2280
2288
|
* clears the canvas and resets the context, so the transform is re-applied. */
|
|
@@ -2462,16 +2470,16 @@ class mr {
|
|
|
2462
2470
|
this._exitPending && this._hasImage() && (this._exitPending = !1, this._env = 1, this._startEnv(0, this._cfg.exitMs));
|
|
2463
2471
|
}
|
|
2464
2472
|
}
|
|
2465
|
-
const
|
|
2466
|
-
var
|
|
2467
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
2473
|
+
const yr = ":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 wr = Object.defineProperty, xr = Object.getOwnPropertyDescriptor, y = (t, e, i, r) => {
|
|
2475
|
+
for (var s = r > 1 ? void 0 : r ? xr(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
2468
2476
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
2469
|
-
return r && s &&
|
|
2477
|
+
return r && s && wr(e, i, s), s;
|
|
2470
2478
|
};
|
|
2471
|
-
const
|
|
2472
|
-
let g = class extends
|
|
2479
|
+
const kr = 3 / 2, Er = 70;
|
|
2480
|
+
let g = class extends G {
|
|
2473
2481
|
constructor() {
|
|
2474
|
-
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 br(this), this._switchCovering = !1, this._seenUrls = /* @__PURE__ */ new Set(), this._instantSwap = !1, this._onVisibilityChange = () => {
|
|
2475
2483
|
document.visibilityState !== "visible" || this.busy || !this._displayedUrl || (this._clearCoverTimer(), this._switchCovering = !1, this._dotGrid.settle());
|
|
2476
2484
|
}, this._preloadedFullsizeUrl = null, this._onFullscreenKeydown = (t) => {
|
|
2477
2485
|
t.key === "Escape" && document.fullscreenElement && (t.preventDefault(), t.stopPropagation(), document.exitFullscreen());
|
|
@@ -2535,7 +2543,7 @@ let g = class extends j {
|
|
|
2535
2543
|
}
|
|
2536
2544
|
this._instantSwap = !1, !(this._switchCovering || this._coverTimer != null) && (this._coverTimer = window.setTimeout(() => {
|
|
2537
2545
|
this._coverTimer = void 0, this.url != null && this.url !== this._displayedUrl && !this._failed && !this.busy && !this._switchCovering && (this._switchCovering = !0, this._syncGrid());
|
|
2538
|
-
},
|
|
2546
|
+
}, Er));
|
|
2539
2547
|
}
|
|
2540
2548
|
_clearCoverTimer() {
|
|
2541
2549
|
this._coverTimer != null && (clearTimeout(this._coverTimer), this._coverTimer = void 0);
|
|
@@ -2548,7 +2556,7 @@ let g = class extends j {
|
|
|
2548
2556
|
if (this.ratio && this.ratio > 0) return this.ratio;
|
|
2549
2557
|
if (this.naturalRatio && this.naturalRatio > 0) return this.naturalRatio;
|
|
2550
2558
|
const t = this._imageEl;
|
|
2551
|
-
return t && t.naturalWidth > 0 && t.naturalHeight > 0 ? t.naturalWidth / t.naturalHeight :
|
|
2559
|
+
return t && t.naturalWidth > 0 && t.naturalHeight > 0 ? t.naturalWidth / t.naturalHeight : kr;
|
|
2552
2560
|
}
|
|
2553
2561
|
/** Size the frame to the largest box of the chosen ratio that fits the viewport. */
|
|
2554
2562
|
_updateFrame() {
|
|
@@ -2626,7 +2634,7 @@ let g = class extends j {
|
|
|
2626
2634
|
this._fullscreen && this.fullsizeUrl ? f`<img class="layer full" src="${this.fullsizeUrl}" alt="${this.alt || "AI image"}" decoding="async" />` : v}
|
|
2627
2635
|
${t ? f`<img
|
|
2628
2636
|
class="preload"
|
|
2629
|
-
src="${this.url}"
|
|
2637
|
+
src="${xt(this.url ?? void 0)}"
|
|
2630
2638
|
alt=""
|
|
2631
2639
|
aria-hidden="true"
|
|
2632
2640
|
decoding="async"
|
|
@@ -2645,7 +2653,7 @@ let g = class extends j {
|
|
|
2645
2653
|
@focus=${this._preloadFullsize}
|
|
2646
2654
|
@click=${this._toggleFullscreen}
|
|
2647
2655
|
>
|
|
2648
|
-
${
|
|
2656
|
+
${re(this._fullscreen ? Hi : Gi)}
|
|
2649
2657
|
</button>
|
|
2650
2658
|
` : v}
|
|
2651
2659
|
<span class="sr-only" role="status" aria-live="polite">${this.busy ? this.busyLabel : ""}</span>
|
|
@@ -2653,7 +2661,7 @@ let g = class extends j {
|
|
|
2653
2661
|
`;
|
|
2654
2662
|
}
|
|
2655
2663
|
};
|
|
2656
|
-
g.styles =
|
|
2664
|
+
g.styles = j(yr);
|
|
2657
2665
|
y([
|
|
2658
2666
|
c()
|
|
2659
2667
|
], g.prototype, "url", 2);
|
|
@@ -2718,15 +2726,15 @@ y([
|
|
|
2718
2726
|
F(".dot-grid")
|
|
2719
2727
|
], g.prototype, "_dotGridEl", 2);
|
|
2720
2728
|
g = y([
|
|
2721
|
-
|
|
2729
|
+
H("uc-ai-canvas")
|
|
2722
2730
|
], g);
|
|
2723
|
-
const
|
|
2724
|
-
var
|
|
2725
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
2731
|
+
const Rr = ":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 Sr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, ae = (t, e, i, r) => {
|
|
2733
|
+
for (var s = r > 1 ? void 0 : r ? Cr(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
2726
2734
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
2727
|
-
return r && s &&
|
|
2735
|
+
return r && s && Sr(e, i, s), s;
|
|
2728
2736
|
};
|
|
2729
|
-
let
|
|
2737
|
+
let K = class extends G {
|
|
2730
2738
|
constructor() {
|
|
2731
2739
|
super(...arguments), this.cancelLabel = "", this.primaryLabel = "", this.primaryDisabled = !1;
|
|
2732
2740
|
}
|
|
@@ -2754,39 +2762,39 @@ let q = class extends j {
|
|
|
2754
2762
|
`;
|
|
2755
2763
|
}
|
|
2756
2764
|
};
|
|
2757
|
-
|
|
2758
|
-
|
|
2765
|
+
K.styles = j(Rr);
|
|
2766
|
+
ae([
|
|
2759
2767
|
c({ attribute: "cancel-label" })
|
|
2760
|
-
],
|
|
2761
|
-
|
|
2768
|
+
], K.prototype, "cancelLabel", 2);
|
|
2769
|
+
ae([
|
|
2762
2770
|
c({ attribute: "primary-label" })
|
|
2763
|
-
],
|
|
2764
|
-
|
|
2771
|
+
], K.prototype, "primaryLabel", 2);
|
|
2772
|
+
ae([
|
|
2765
2773
|
c({ type: Boolean, attribute: "primary-disabled" })
|
|
2766
|
-
],
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
],
|
|
2770
|
-
const
|
|
2771
|
-
var
|
|
2772
|
-
for (var s = r > 1 ? void 0 : r ?
|
|
2774
|
+
], K.prototype, "primaryDisabled", 2);
|
|
2775
|
+
K = ae([
|
|
2776
|
+
H("uc-ai-footer")
|
|
2777
|
+
], K);
|
|
2778
|
+
const $r = ":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 Ar = Object.defineProperty, Ur = Object.getOwnPropertyDescriptor, m = (t, e, i, r) => {
|
|
2780
|
+
for (var s = r > 1 ? void 0 : r ? Ur(e, i) : e, o = t.length - 1, a; o >= 0; o--)
|
|
2773
2781
|
(a = t[o]) && (s = (r ? a(e, i, s) : a(s)) || s);
|
|
2774
|
-
return r && s &&
|
|
2782
|
+
return r && s && Ar(e, i, s), s;
|
|
2775
2783
|
};
|
|
2776
|
-
const
|
|
2784
|
+
const Tr = ["top", "bottom"], Fr = ["full", "available"], Mr = [
|
|
2777
2785
|
"composer-above",
|
|
2778
2786
|
"composer-below",
|
|
2779
2787
|
"canvas-top",
|
|
2780
2788
|
"canvas-bottom"
|
|
2781
2789
|
];
|
|
2782
|
-
let d = class extends
|
|
2790
|
+
let d = class extends G {
|
|
2783
2791
|
constructor() {
|
|
2784
|
-
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 Ei(this), this._history = new zi(this), this._secure = new mt(this), this._localeStrings = B, this._localeToken = 0, this._lastPreviewUrl = null, this._ratioOptionsCache = /* @__PURE__ */ new Map(), this._labelForOption = (t) => t.labelKey ? this._l(t.labelKey) : "";
|
|
2785
2793
|
}
|
|
2786
2794
|
/** @internal */
|
|
2787
2795
|
willUpdate(t) {
|
|
2788
2796
|
const e = t.has("provider") || t.has("pubkey") || t.has("baseUrl") || t.has("cdnCname") || t.has("cdnCnamePrefixed");
|
|
2789
|
-
e && (this._provider = this.provider ?? (this.pubkey ? new
|
|
2797
|
+
e && (this._provider = this.provider ?? (this.pubkey ? new xi({
|
|
2790
2798
|
publicKey: this.pubkey,
|
|
2791
2799
|
baseUrl: this.baseUrl,
|
|
2792
2800
|
cdnBaseUrl: this.cdnCname,
|
|
@@ -2808,10 +2816,10 @@ let d = class extends j {
|
|
|
2808
2816
|
(e || i) && this._resolveInputUrl(), (e || i) && this._resolveSourceFileInfo();
|
|
2809
2817
|
const r = this._mode;
|
|
2810
2818
|
if (r !== this._lastMode)
|
|
2811
|
-
this._lastMode = r, this._selectedRatio = r === "edit" ?
|
|
2819
|
+
this._lastMode = r, this._selectedRatio = r === "edit" ? V : this._defaultGenerateRatio();
|
|
2812
2820
|
else if (t.has("aspectRatios")) {
|
|
2813
2821
|
const s = this._selectedRatio;
|
|
2814
|
-
O(s) && !this._standardRatios().some((o) =>
|
|
2822
|
+
O(s) && !this._standardRatios().some((o) => _e(o, s)) && (this._selectedRatio = this._defaultGenerateRatio());
|
|
2815
2823
|
}
|
|
2816
2824
|
t.has("aspectRatios") && this._ratioOptionsCache.clear(), (t.has("localeName") || t.has("localeDefinitionOverride")) && this._resolveLocale();
|
|
2817
2825
|
}
|
|
@@ -2819,19 +2827,19 @@ let d = class extends j {
|
|
|
2819
2827
|
async _resolveLocale() {
|
|
2820
2828
|
var s, o;
|
|
2821
2829
|
const t = this.localeName || "en", e = ++this._localeToken;
|
|
2822
|
-
let i =
|
|
2830
|
+
let i = B;
|
|
2823
2831
|
if (t !== "en")
|
|
2824
2832
|
try {
|
|
2825
|
-
i = await ((s =
|
|
2833
|
+
i = await ((s = pe[t]) == null ? void 0 : s.call(pe)) ?? B;
|
|
2826
2834
|
} catch {
|
|
2827
|
-
i =
|
|
2835
|
+
i = B;
|
|
2828
2836
|
}
|
|
2829
2837
|
if (e !== this._localeToken) return;
|
|
2830
2838
|
const r = (o = this.localeDefinitionOverride) == null ? void 0 : o[t];
|
|
2831
2839
|
this._localeStrings = r ? { ...i, ...r } : i;
|
|
2832
2840
|
}
|
|
2833
2841
|
_l(t) {
|
|
2834
|
-
return
|
|
2842
|
+
return Ci(t, this._localeStrings);
|
|
2835
2843
|
}
|
|
2836
2844
|
/** Friendly message for the current failure: the per-`error_code` string
|
|
2837
2845
|
* (`ai-enhancer-error-<code>`, overridable via the locale) when one is
|
|
@@ -2839,7 +2847,7 @@ let d = class extends j {
|
|
|
2839
2847
|
_errorMessage() {
|
|
2840
2848
|
const t = this._gen.errorCode;
|
|
2841
2849
|
if (t) {
|
|
2842
|
-
const e = `ai-enhancer-error-${t}`, i = this._localeStrings[e] ??
|
|
2850
|
+
const e = `ai-enhancer-error-${t}`, i = this._localeStrings[e] ?? B[e];
|
|
2843
2851
|
if (i) return i;
|
|
2844
2852
|
}
|
|
2845
2853
|
return this._l("ai-enhancer-error");
|
|
@@ -2916,7 +2924,7 @@ let d = class extends j {
|
|
|
2916
2924
|
*/
|
|
2917
2925
|
get _sourceEntry() {
|
|
2918
2926
|
const t = this._sourceUuid, e = this._effectiveSourceFileInfo, i = this._inputUrl;
|
|
2919
|
-
return !t || !i || !e ? null : { id: t, prompt: "", mode: "edit", url: i, file: e, ratio:
|
|
2927
|
+
return !t || !i || !e ? null : { id: t, prompt: "", mode: "edit", url: i, file: e, ratio: V };
|
|
2920
2928
|
}
|
|
2921
2929
|
/** Strip entries: the generated results (newest-first) plus the original source
|
|
2922
2930
|
* appended as the base (oldest) when editing. */
|
|
@@ -2939,7 +2947,7 @@ let d = class extends j {
|
|
|
2939
2947
|
const t = this._displayUrl;
|
|
2940
2948
|
if (!t)
|
|
2941
2949
|
return this._lastPreviewUrl = null, null;
|
|
2942
|
-
const e = this._secure.resolve(
|
|
2950
|
+
const e = this._secure.resolve(Mi(t, this.clientWidth || 1024));
|
|
2943
2951
|
return e != null && (this._lastPreviewUrl = e), this._lastPreviewUrl;
|
|
2944
2952
|
}
|
|
2945
2953
|
/** Full-resolution rendition for fullscreen, secure-delivery-resolved. */
|
|
@@ -2948,8 +2956,8 @@ let d = class extends j {
|
|
|
2948
2956
|
}
|
|
2949
2957
|
/** The configured (or popular) standard ratios, validated. */
|
|
2950
2958
|
_standardRatios() {
|
|
2951
|
-
const t = (this.aspectRatios ?? []).filter(
|
|
2952
|
-
return t.length > 0 ? t : [...
|
|
2959
|
+
const t = (this.aspectRatios ?? []).filter(ke);
|
|
2960
|
+
return t.length > 0 ? t : [...kt];
|
|
2953
2961
|
}
|
|
2954
2962
|
/**
|
|
2955
2963
|
* The ratio the generate flow starts on: the prototype's landscape default
|
|
@@ -2958,12 +2966,12 @@ let d = class extends j {
|
|
|
2958
2966
|
*/
|
|
2959
2967
|
_defaultGenerateRatio() {
|
|
2960
2968
|
const t = this._standardRatios();
|
|
2961
|
-
return t.find((e) =>
|
|
2969
|
+
return t.find((e) => _e(e, Et)) ?? t[0] ?? null;
|
|
2962
2970
|
}
|
|
2963
2971
|
_ratioOptions(t) {
|
|
2964
2972
|
const e = this._ratioOptionsCache.get(t);
|
|
2965
2973
|
if (e) return e;
|
|
2966
|
-
const i = this._standardRatios().map(
|
|
2974
|
+
const i = this._standardRatios().map(At), r = t === "edit" ? [{ value: V, labelKey: "ai-enhancer-aspect-original" }, ...i] : i;
|
|
2967
2975
|
return this._ratioOptionsCache.set(t, r), r;
|
|
2968
2976
|
}
|
|
2969
2977
|
/**
|
|
@@ -3024,7 +3032,8 @@ let d = class extends j {
|
|
|
3024
3032
|
file: o.file
|
|
3025
3033
|
}));
|
|
3026
3034
|
} catch (o) {
|
|
3027
|
-
|
|
3035
|
+
const a = { error: ki(o) };
|
|
3036
|
+
this.dispatchEvent(new CustomEvent("uc:error", { detail: a, bubbles: !0, composed: !0 }));
|
|
3028
3037
|
}
|
|
3029
3038
|
}
|
|
3030
3039
|
/** Discard the current image (input or result) and prompt history, returning
|
|
@@ -3080,15 +3089,15 @@ let d = class extends j {
|
|
|
3080
3089
|
}
|
|
3081
3090
|
/** @internal */
|
|
3082
3091
|
render() {
|
|
3083
|
-
var
|
|
3084
|
-
const t = this._mode, e = t === "edit" && !this.sourceUuid && !this.sourceFileInfo, i =
|
|
3092
|
+
var Fe, Me;
|
|
3093
|
+
const t = this._mode, e = t === "edit" && !this.sourceUuid && !this.sourceFileInfo, i = ye[t].placeholderKey, r = ((Fe = this.presets) == null ? void 0 : Fe[t]) ?? ye[t].presets, s = this._gen.busy || !this._gen.result, o = this._ratioOptions(t), a = this._displayUrl != null, n = O(this._selectedRatio) ? this._selectedRatio[0] / this._selectedRatio[1] : null, l = {
|
|
3085
3094
|
stage: !0,
|
|
3086
3095
|
"is-empty": !a
|
|
3087
|
-
}, h =
|
|
3096
|
+
}, h = Tr.includes(this.composerPlacement) ? this.composerPlacement : "bottom", u = (Fr.includes(this.canvasFit) ? this.canvasFit : "available") === "full", _ = !u, x = `${u ? "overlay" : "docked"}-${h}`, w = Mr.includes(this.historyPlacement) ? this.historyPlacement : "composer-above", $ = w === "composer-above" || w === "composer-below", R = (u || _ && this.composerAutoHide) && $, I = w === "canvas-top" ? "top" : w === "canvas-bottom" ? "bottom" : h, W = this._historyEntries, X = W.length > 0 || e, ne = X ? f`
|
|
3088
3097
|
<uc-ai-history
|
|
3089
3098
|
.busy=${this._gen.busy}
|
|
3090
|
-
.entries=${
|
|
3091
|
-
.selectedUuid=${((
|
|
3099
|
+
.entries=${W}
|
|
3100
|
+
.selectedUuid=${((Me = this._gen.result) == null ? void 0 : Me.uuid) ?? this._sourceUuid}
|
|
3092
3101
|
?show-start-over=${e}
|
|
3093
3102
|
start-over-label="${this._l("ai-enhancer-start-over")}"
|
|
3094
3103
|
list-label="${this._l("ai-enhancer-history-title")}"
|
|
@@ -3096,7 +3105,7 @@ let d = class extends j {
|
|
|
3096
3105
|
@uc:select=${this._onSelectHistoryEntry}
|
|
3097
3106
|
@uc:start-over=${this._onStartOver}
|
|
3098
3107
|
></uc-ai-history>
|
|
3099
|
-
` : v,
|
|
3108
|
+
` : v, _t = f`
|
|
3100
3109
|
<uc-ai-prompt-row
|
|
3101
3110
|
.mode=${t}
|
|
3102
3111
|
.value=${this._prompt}
|
|
@@ -3128,7 +3137,7 @@ let d = class extends j {
|
|
|
3128
3137
|
></uc-ai-aspect-ratio>
|
|
3129
3138
|
` : v}
|
|
3130
3139
|
</uc-ai-prompt-row>
|
|
3131
|
-
`,
|
|
3140
|
+
`, le = f`
|
|
3132
3141
|
<div
|
|
3133
3142
|
class=${S({
|
|
3134
3143
|
composer: !0,
|
|
@@ -3138,23 +3147,23 @@ let d = class extends j {
|
|
|
3138
3147
|
})}
|
|
3139
3148
|
>
|
|
3140
3149
|
<div class="composer__content">
|
|
3141
|
-
${R && w === "composer-above" ?
|
|
3142
|
-
${
|
|
3143
|
-
${R && w === "composer-below" ?
|
|
3150
|
+
${R && w === "composer-above" ? ne : v}
|
|
3151
|
+
${_t}
|
|
3152
|
+
${R && w === "composer-below" ? ne : v}
|
|
3144
3153
|
</div>
|
|
3145
3154
|
</div>
|
|
3146
|
-
`,
|
|
3155
|
+
`, gt = X && !R ? f`<div
|
|
3147
3156
|
class=${S({
|
|
3148
3157
|
"history-pinned": !0,
|
|
3149
3158
|
"history-pinned--docked": _,
|
|
3150
3159
|
[`history-pinned--canvas-${I}`]: !0
|
|
3151
3160
|
})}
|
|
3152
3161
|
>
|
|
3153
|
-
${
|
|
3154
|
-
</div>` : v,
|
|
3162
|
+
${ne}
|
|
3163
|
+
</div>` : v, vt = this.composerAutoHide && u ? f`
|
|
3155
3164
|
<div class=${S({ "dock-hotzone": !0, [`dock-hotzone--${h}`]: !0 })}></div>
|
|
3156
3165
|
<div class=${S({ "composer-fade": !0, [`composer-fade--${h}`]: !0 })}></div>
|
|
3157
|
-
` : v,
|
|
3166
|
+
` : v, Ue = this.toolbarPlacement === "top", Te = f`
|
|
3158
3167
|
<uc-ai-footer
|
|
3159
3168
|
cancel-label="${this._l("ai-enhancer-cancel")}"
|
|
3160
3169
|
primary-label="${this._l("ai-enhancer-done-btn")}"
|
|
@@ -3169,8 +3178,8 @@ let d = class extends j {
|
|
|
3169
3178
|
role="region"
|
|
3170
3179
|
aria-label="${this._l(t === "edit" ? "ai-enhancer-edit-title" : "ai-enhancer-generate-title")}"
|
|
3171
3180
|
>
|
|
3172
|
-
${
|
|
3173
|
-
${_ && h === "top" ?
|
|
3181
|
+
${Ue ? Te : v}
|
|
3182
|
+
${_ && h === "top" ? le : v}
|
|
3174
3183
|
<div class=${S(l)}>
|
|
3175
3184
|
<uc-ai-canvas
|
|
3176
3185
|
.url=${this._previewUrl}
|
|
@@ -3186,21 +3195,21 @@ let d = class extends j {
|
|
|
3186
3195
|
exit-fullscreen-label="${this._l("ai-enhancer-exit-fullscreen")}"
|
|
3187
3196
|
></uc-ai-canvas>
|
|
3188
3197
|
|
|
3189
|
-
${
|
|
3190
|
-
${
|
|
3191
|
-
${u ?
|
|
3198
|
+
${vt}
|
|
3199
|
+
${gt}
|
|
3200
|
+
${u ? le : v}
|
|
3192
3201
|
|
|
3193
3202
|
${this._gen.error ? f`<div class="error-box" role="alert">
|
|
3194
3203
|
<div class="error-box__card">${this._errorMessage()}</div>
|
|
3195
3204
|
</div>` : v}
|
|
3196
3205
|
</div>
|
|
3197
|
-
${_ && h === "bottom" ?
|
|
3198
|
-
${
|
|
3206
|
+
${_ && h === "bottom" ? le : v}
|
|
3207
|
+
${Ue ? v : Te}
|
|
3199
3208
|
</div>
|
|
3200
3209
|
`;
|
|
3201
3210
|
}
|
|
3202
3211
|
};
|
|
3203
|
-
d.styles =
|
|
3212
|
+
d.styles = j($r);
|
|
3204
3213
|
m([
|
|
3205
3214
|
c({ attribute: "source-uuid" })
|
|
3206
3215
|
], d.prototype, "sourceUuid", 2);
|
|
@@ -3232,7 +3241,7 @@ m([
|
|
|
3232
3241
|
c({ attribute: !1 })
|
|
3233
3242
|
], d.prototype, "secureDeliveryProxyUrlResolver", 2);
|
|
3234
3243
|
m([
|
|
3235
|
-
c({ type: Array, attribute: "aspect-ratios", converter: (t) => t ?
|
|
3244
|
+
c({ type: Array, attribute: "aspect-ratios", converter: (t) => t ? Ut(t) : null })
|
|
3236
3245
|
], d.prototype, "aspectRatios", 2);
|
|
3237
3246
|
m([
|
|
3238
3247
|
c({ attribute: "locale-name" })
|
|
@@ -3286,14 +3295,14 @@ m([
|
|
|
3286
3295
|
C()
|
|
3287
3296
|
], d.prototype, "_localeStrings", 2);
|
|
3288
3297
|
d = m([
|
|
3289
|
-
|
|
3298
|
+
H("uc-ai-enhancer")
|
|
3290
3299
|
], d);
|
|
3291
3300
|
export {
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3301
|
+
Vr as I,
|
|
3302
|
+
pe as L,
|
|
3303
|
+
kt as P,
|
|
3295
3304
|
d as U,
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3305
|
+
Wr as a,
|
|
3306
|
+
B as e,
|
|
3307
|
+
ke as i
|
|
3299
3308
|
};
|