xvai-loi 0.1.140 → 0.1.142
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/co.txt +1 -1
- package/package.json +1 -1
- package/xvai-loi.js +107 -104
package/co.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
xvaiLoi140229
|
package/package.json
CHANGED
package/xvai-loi.js
CHANGED
|
@@ -5090,11 +5090,11 @@ function giaiBoCuc(ung, tong, nc = {}) {
|
|
|
5090
5090
|
// flow-src/engine/moNhanh.ts
|
|
5091
5091
|
var KHO = {};
|
|
5092
5092
|
function moNhanh(g, W3, H2, ve, r, them = "") {
|
|
5093
|
-
const k = 4, w = Math.ceil(W3 / k), h = Math.ceil(H2 / k),
|
|
5094
|
-
let c = KHO[
|
|
5093
|
+
const k = 4, w = Math.ceil(W3 / k), h = Math.ceil(H2 / k), khoa3 = w + "x" + h;
|
|
5094
|
+
let c = KHO[khoa3];
|
|
5095
5095
|
if (!c) {
|
|
5096
5096
|
const cv = new OffscreenCanvas(w, h);
|
|
5097
|
-
c = KHO[
|
|
5097
|
+
c = KHO[khoa3] = { cv, g: cv.getContext("2d") };
|
|
5098
5098
|
}
|
|
5099
5099
|
const x = c.g;
|
|
5100
5100
|
x.setTransform(1, 0, 0, 1, 0, 0);
|
|
@@ -10826,21 +10826,64 @@ function buPhu(th, m, X, Y, x, y, w, h, W3, H2) {
|
|
|
10826
10826
|
|
|
10827
10827
|
// flow-src/engine/phongXanh.ts
|
|
10828
10828
|
var VS = "attribute vec2 p;varying vec2 v;void main(){v=vec2(p.x*.5+.5,.5-p.y*.5);gl_Position=vec4(p,0.,1.);}";
|
|
10829
|
-
var FS = "precision mediump float;uniform sampler2D u_v;uniform sampler2D u_n;varying vec2 v;void main(){vec4 c=texture2D(u_v,v);float m=max(c.r,c.b),d=c.g-m;float a=1.-smoothstep(.05,.2,d);vec3 col=c.rgb;col.g=min(col.g,m+.03);gl_FragColor=vec4(mix(texture2D(u_n,v).rgb,col,a),1.);}";
|
|
10829
|
+
var FS = "precision mediump float;uniform sampler2D u_v;uniform sampler2D u_n;uniform sampler2D u_m;varying vec2 v;void main(){vec4 c=texture2D(u_v,v);float m=max(c.r,c.b),d=c.g-m;float a=(1.-smoothstep(.05,.2,d))*(1.-smoothstep(.3,.7,texture2D(u_m,v).r));vec3 col=c.rgb;col.g=min(col.g,m+.03);gl_FragColor=vec4(mix(texture2D(u_n,v).rgb,col,a),1.);}";
|
|
10830
|
+
var MW = 48;
|
|
10831
|
+
var MH = 85;
|
|
10830
10832
|
async function coXanh(M, tr, lo, hi) {
|
|
10831
10833
|
try {
|
|
10832
|
-
const sk = new M.CanvasSink(tr, { poolSize: 1 }), c = new OffscreenCanvas(
|
|
10833
|
-
|
|
10834
|
-
|
|
10834
|
+
const sk = new M.CanvasSink(tr, { poolSize: 1 }), c = new OffscreenCanvas(MW, MH), g = c.getContext("2d", { willReadFrequently: true }), r = [], N = MW * MH;
|
|
10835
|
+
const xanh = new Uint8Array(N), s1 = new Float32Array(N), s2 = new Float32Array(N);
|
|
10836
|
+
let n = 0;
|
|
10837
|
+
for (let i = 0; i < 10; i++) {
|
|
10838
|
+
const fr = await sk.getCanvas(lo + (hi - lo) * (i + 0.5) / 10);
|
|
10835
10839
|
if (!fr) continue;
|
|
10836
|
-
g.drawImage(fr.canvas, 0, 0,
|
|
10837
|
-
const d = g.getImageData(0, 0,
|
|
10838
|
-
let
|
|
10839
|
-
|
|
10840
|
-
|
|
10840
|
+
g.drawImage(fr.canvas, 0, 0, MW, MH);
|
|
10841
|
+
const d = g.getImageData(0, 0, MW, MH).data;
|
|
10842
|
+
let k0 = 0;
|
|
10843
|
+
n++;
|
|
10844
|
+
for (let p = 0, k = 0; p < N; p++, k += 4) {
|
|
10845
|
+
const G6 = d[k + 1] > 80 && d[k + 1] > 1.25 * d[k] && d[k + 1] > 1.25 * d[k + 2];
|
|
10846
|
+
if (G6) {
|
|
10847
|
+
xanh[p]++;
|
|
10848
|
+
k0++;
|
|
10849
|
+
}
|
|
10850
|
+
const l = 0.3 * d[k] + 0.59 * d[k + 1] + 0.11 * d[k + 2];
|
|
10851
|
+
s1[p] += l;
|
|
10852
|
+
s2[p] += l * l;
|
|
10853
|
+
}
|
|
10854
|
+
r.push(k0 / N);
|
|
10841
10855
|
}
|
|
10842
10856
|
r.sort((a, b) => a - b);
|
|
10843
|
-
|
|
10857
|
+
if (!(r.length >= 3 && r[Math.floor(r.length / 2)] >= 0.25)) return false;
|
|
10858
|
+
const yen = (p) => !xanh[p] && s2[p] / n - (s1[p] / n) ** 2 < 49, ym = Math.round(0.4 * MH), m = new Uint8Array(N), q = [];
|
|
10859
|
+
for (let y = 0; y < ym; y++) for (let x = 0; x < MW; x++) {
|
|
10860
|
+
const p = y * MW + x;
|
|
10861
|
+
if ((y === 0 || x === 0 || x === MW - 1) && yen(p) && s1[p] / n > 120) {
|
|
10862
|
+
m[p] = 1;
|
|
10863
|
+
q.push(p);
|
|
10864
|
+
}
|
|
10865
|
+
}
|
|
10866
|
+
while (q.length) {
|
|
10867
|
+
const p = q.pop(), x = p % MW, y = (p - x) / MW;
|
|
10868
|
+
for (const [dx, dy] of [[1, 0], [-1, 0], [0, 1], [0, -1]]) {
|
|
10869
|
+
const X = x + dx, Y = y + dy, P4 = Y * MW + X;
|
|
10870
|
+
if (X >= 0 && X < MW && Y >= 0 && Y < ym && !m[P4] && yen(P4)) {
|
|
10871
|
+
m[P4] = 1;
|
|
10872
|
+
q.push(P4);
|
|
10873
|
+
}
|
|
10874
|
+
}
|
|
10875
|
+
}
|
|
10876
|
+
const md = new Uint8Array(N);
|
|
10877
|
+
for (let p = 0; p < N; p++) {
|
|
10878
|
+
const x = p % MW, y = (p - x) / MW;
|
|
10879
|
+
let v = m[p];
|
|
10880
|
+
for (let j = -1; j <= 1 && !v; j++) for (let i = -1; i <= 1 && !v; i++) {
|
|
10881
|
+
const X = x + i, Y = y + j;
|
|
10882
|
+
if (X >= 0 && X < MW && Y >= 0 && Y < MH) v = m[Y * MW + X];
|
|
10883
|
+
}
|
|
10884
|
+
md[p] = v ? 255 : 0;
|
|
10885
|
+
}
|
|
10886
|
+
return { mat: md, ngoai: +(m.reduce((s, v) => s + v, 0) / N).toFixed(3) };
|
|
10844
10887
|
} catch (e) {
|
|
10845
10888
|
return false;
|
|
10846
10889
|
}
|
|
@@ -10855,7 +10898,7 @@ function nen(W3, H2) {
|
|
|
10855
10898
|
g.fillRect(0, 0, W3, H2);
|
|
10856
10899
|
return c;
|
|
10857
10900
|
}
|
|
10858
|
-
function tachXanh(src) {
|
|
10901
|
+
function tachXanh(src, xn) {
|
|
10859
10902
|
try {
|
|
10860
10903
|
const W3 = src.width, H2 = src.height;
|
|
10861
10904
|
if (!G || G.W !== W3 || G.H !== H2) {
|
|
@@ -10886,14 +10929,21 @@ function tachXanh(src) {
|
|
|
10886
10929
|
gl2.uniform1i(gl2.getUniformLocation(pr, ten), u);
|
|
10887
10930
|
return t;
|
|
10888
10931
|
};
|
|
10889
|
-
const tv = tex(0, "u_v"), tn = tex(1, "u_n");
|
|
10932
|
+
const tv = tex(0, "u_v"), tn = tex(1, "u_n"), tm = tex(2, "u_m");
|
|
10890
10933
|
gl2.activeTexture(gl2.TEXTURE1);
|
|
10891
10934
|
gl2.bindTexture(gl2.TEXTURE_2D, tn);
|
|
10892
10935
|
gl2.texImage2D(gl2.TEXTURE_2D, 0, gl2.RGBA, gl2.RGBA, gl2.UNSIGNED_BYTE, nen(W3, H2));
|
|
10893
10936
|
gl2.viewport(0, 0, W3, H2);
|
|
10894
|
-
G = { W: W3, H: H2, cv, gl: gl2, tv };
|
|
10937
|
+
G = { W: W3, H: H2, cv, gl: gl2, tv, tm, m: void 0 };
|
|
10938
|
+
}
|
|
10939
|
+
const gl = G.gl, mat = xn && xn.mat ? xn.mat : null;
|
|
10940
|
+
if (G.m !== mat) {
|
|
10941
|
+
G.m = mat;
|
|
10942
|
+
gl.activeTexture(gl.TEXTURE2);
|
|
10943
|
+
gl.bindTexture(gl.TEXTURE_2D, G.tm);
|
|
10944
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);
|
|
10945
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.LUMINANCE, mat ? MW : 1, mat ? MH : 1, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, mat || new Uint8Array(1));
|
|
10895
10946
|
}
|
|
10896
|
-
const gl = G.gl;
|
|
10897
10947
|
gl.activeTexture(gl.TEXTURE0);
|
|
10898
10948
|
gl.bindTexture(gl.TEXTURE_2D, G.tv);
|
|
10899
10949
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, src);
|
|
@@ -11501,7 +11551,7 @@ async function renderNhanh(ff, clips, files, audio, cards, nen2, options, paint,
|
|
|
11501
11551
|
const mau2 = fx0.mau || globalThis.__xvaiMau || {}, sg = +mau2.sang || +fx0.sang || 1, tp = +mau2.tuongPhan || 1, bh = +mau2.baoHoa || 1, am = +mau2.am || 0;
|
|
11502
11552
|
const fS = (sg !== 1 ? "brightness(" + sg.toFixed(2) + ") " : "") + (tp !== 1 ? "contrast(" + tp.toFixed(2) + ") " : "") + (bh !== 1 ? "saturate(" + bh.toFixed(2) + ") " : "") + (am ? "sepia(" + Math.min(0.6, Math.abs(am)).toFixed(2) + ") " : "");
|
|
11503
11553
|
if (fS) gn.filter = fS.trim();
|
|
11504
|
-
gn.drawImage(S.xanh ? tachXanh(fr.canvas) : fr.canvas, ox, oy, sw * kz, sh * kz);
|
|
11554
|
+
gn.drawImage(S.xanh ? tachXanh(fr.canvas, S.xanh) : fr.canvas, ox, oy, sw * kz, sh * kz);
|
|
11505
11555
|
if (fS) gn.filter = "none";
|
|
11506
11556
|
const net = +(mau2.net || 0);
|
|
11507
11557
|
if (net > 0) {
|
|
@@ -14035,12 +14085,12 @@ var bam = (s) => {
|
|
|
14035
14085
|
};
|
|
14036
14086
|
var DE = 'B\u1EA1n l\xE0 bi\xEAn t\u1EADp vi\xEAn ph\u1EE5 \u0111\u1EC1 video ng\u1EAFn ti\u1EBFng Vi\u1EC7t. D\u01B0\u1EDBi \u0111\xE2y l\xE0 l\u1EDDi n\xF3i, m\u1ED7i t\u1EEB c\xF3 s\u1ED1 th\u1EE9 t\u1EF1 \u0111\u1EE9ng tr\u01B0\u1EDBc d\u1EA5u hai ch\u1EA5m. Ch\u1ECDn t\u1EEB c\u1EA7n NH\u1EA4N tr\xEAn ph\u1EE5 \u0111\u1EC1. k = t\u1EEB kho\xE1 mang \xFD ch\xEDnh c\u1EE7a c\xE2u, X\u1EBEP t\u1EEB quan tr\u1ECDng nh\u1EA5t tr\u1EDF xu\u1ED1ng (t\u1EEB gh\xE9p nh\u01B0 kh\xF3 kh\u0103n, l\xF2ng ng\u01B0\u1EDDi th\xEC ch\u1ECDn c\u1EA3 hai ti\u1EBFng, \u0111\u1EE9ng li\u1EC1n nhau; kh\xF4ng ch\u1ECDn h\u01B0 t\u1EEB nh\u01B0 l\xE0, th\xEC, m\xE0, c\u1EE7a, c\xF3, nh\u1EEFng). d = danh t\u1EEB quan tr\u1ECDng. g = t\u1EEB g\u1EE3i h\xECnh ho\u1EB7c c\u1EA3m x\xFAc m\u1EA1nh. Ch\u1EC9 tr\u1EA3 v\u1EC1 \u0111\xFAng m\u1ED9t d\xF2ng JSON d\u1EA1ng {"k":[s\u1ED1],"d":[s\u1ED1],"g":[s\u1ED1]}, kh\xF4ng gi\u1EA3i th\xEDch. L\u1EDDi n\xF3i: ';
|
|
14037
14087
|
async function nhanAI(ws, onStatus) {
|
|
14038
|
-
const
|
|
14039
|
-
if (kho4.has(
|
|
14088
|
+
const khoa3 = "xvaiNhan:2" + bam(ws.map((w) => w.text).join(" "));
|
|
14089
|
+
if (kho4.has(khoa3)) return kho4.get(khoa3);
|
|
14040
14090
|
try {
|
|
14041
|
-
const c = JSON.parse(localStorage.getItem(
|
|
14091
|
+
const c = JSON.parse(localStorage.getItem(khoa3) || "null");
|
|
14042
14092
|
if (c && Array.isArray(c.k)) {
|
|
14043
|
-
kho4.set(
|
|
14093
|
+
kho4.set(khoa3, c);
|
|
14044
14094
|
return c;
|
|
14045
14095
|
}
|
|
14046
14096
|
} catch (e) {
|
|
@@ -14060,9 +14110,9 @@ async function nhanAI(ws, onStatus) {
|
|
|
14060
14110
|
onStatus?.("AI ch\u1ECDn t\u1EEB nh\u1EA5n l\u1ED7i, xu\u1EA5t kh\xF4ng nh\u1EA5n: " + String(e?.message || e).slice(0, 60));
|
|
14061
14111
|
return null;
|
|
14062
14112
|
}
|
|
14063
|
-
kho4.set(
|
|
14113
|
+
kho4.set(khoa3, ra2);
|
|
14064
14114
|
try {
|
|
14065
|
-
localStorage.setItem(
|
|
14115
|
+
localStorage.setItem(khoa3, JSON.stringify(ra2));
|
|
14066
14116
|
} catch (e) {
|
|
14067
14117
|
}
|
|
14068
14118
|
return ra2;
|
|
@@ -15162,13 +15212,13 @@ async function chuanBiKho(kb, words, bao) {
|
|
|
15162
15212
|
}
|
|
15163
15213
|
}
|
|
15164
15214
|
if (best < 0 || bd2 > Math.max(2, Math.round(0.25 * t.length))) continue;
|
|
15165
|
-
const tu2 = W3.slice(best, best + 3).map((w) => String(w.text).replace(/[.,!?;:…"“”]/g, "")).join(" "),
|
|
15166
|
-
const cu = taiSan(
|
|
15215
|
+
const tu2 = W3.slice(best, best + 3).map((w) => String(w.text).replace(/[.,!?;:…"“”]/g, "")).join(" "), khoa3 = "anh:" + tu2.toLocaleLowerCase("vi");
|
|
15216
|
+
const cu = taiSan(khoa3);
|
|
15167
15217
|
if (cu && cu.laVideo) continue;
|
|
15168
15218
|
try {
|
|
15169
15219
|
const im = await napVideo(a.blob, bao);
|
|
15170
15220
|
im.khoId = a.id;
|
|
15171
|
-
datTaiSan(
|
|
15221
|
+
datTaiSan(khoa3, im);
|
|
15172
15222
|
da.add(a.id);
|
|
15173
15223
|
n++;
|
|
15174
15224
|
them++;
|
|
@@ -15404,9 +15454,9 @@ async function kichBanDoan(ws) {
|
|
|
15404
15454
|
let x = 5381;
|
|
15405
15455
|
for (let i = 0; i < t.length; i++) x = (x * 33 ^ t.charCodeAt(i)) >>> 0;
|
|
15406
15456
|
return x.toString(36).slice(0, 5);
|
|
15407
|
-
})(),
|
|
15457
|
+
})(), khoa3 = (cm ? "xvaiKbCm9" + hp + ":" : "xvaiKb3:") + h.toString(36);
|
|
15408
15458
|
try {
|
|
15409
|
-
const c = localStorage.getItem("xvaiDemLanh") === "1" ? null : JSON.parse(localStorage.getItem(
|
|
15459
|
+
const c = localStorage.getItem("xvaiDemLanh") === "1" ? null : JSON.parse(localStorage.getItem(khoa3) || "null");
|
|
15410
15460
|
if (c && c.moc) {
|
|
15411
15461
|
globalThis.__kbNguon = "dem";
|
|
15412
15462
|
return c;
|
|
@@ -15414,8 +15464,8 @@ async function kichBanDoan(ws) {
|
|
|
15414
15464
|
} catch (e) {
|
|
15415
15465
|
}
|
|
15416
15466
|
try {
|
|
15417
|
-
const kDa = "kb:" +
|
|
15418
|
-
const b = await docDem("kb:" +
|
|
15467
|
+
const kDa = "kb:" + khoa3.split(":")[0] + ":da:" + maDuAn(), sg = (x) => String(x || "").replace(/[^\p{L}]/gu, "").slice(0, 40);
|
|
15468
|
+
const b = await docDem("kb:" + khoa3) || await (async () => {
|
|
15419
15469
|
const c = await docDem(kDa);
|
|
15420
15470
|
return c && c.van && sg(c.van.dau) === sg(van.dau) ? c : null;
|
|
15421
15471
|
})();
|
|
@@ -15428,7 +15478,7 @@ async function kichBanDoan(ws) {
|
|
|
15428
15478
|
if (cm) {
|
|
15429
15479
|
const dau = van.dau;
|
|
15430
15480
|
for (const k of Object.keys(localStorage)) {
|
|
15431
|
-
if (k.indexOf(
|
|
15481
|
+
if (k.indexOf(khoa3.split(":")[0] + ":") !== 0) continue;
|
|
15432
15482
|
try {
|
|
15433
15483
|
const c = JSON.parse(localStorage.getItem(k) || "null"), v = c && c.van;
|
|
15434
15484
|
if (c && c.moc && Array.isArray(c.canh) && c.canh.length > 10 && dau.indexOf(String(c.moc).toLocaleLowerCase("vi").slice(0, 18)) >= 0 && v && v.dau === van.dau && v.cuoi === van.cuoi && Math.abs((v.n || 0) - van.n) <= van.n * 0.1) {
|
|
@@ -15486,13 +15536,13 @@ async function kichBanDoan(ws) {
|
|
|
15486
15536
|
}
|
|
15487
15537
|
if (j && j.moc) {
|
|
15488
15538
|
try {
|
|
15489
|
-
localStorage.setItem(
|
|
15539
|
+
localStorage.setItem(khoa3, JSON.stringify({ ...j, van }));
|
|
15490
15540
|
} catch (e) {
|
|
15491
15541
|
}
|
|
15492
15542
|
try {
|
|
15493
15543
|
const v2 = JSON.parse(JSON.stringify({ ...j, van }));
|
|
15494
|
-
ghiDem("kb:" +
|
|
15495
|
-
ghiDem("kb:" +
|
|
15544
|
+
ghiDem("kb:" + khoa3, v2);
|
|
15545
|
+
ghiDem("kb:" + khoa3.split(":")[0] + ":da:" + maDuAn(), v2);
|
|
15496
15546
|
} catch (e) {
|
|
15497
15547
|
}
|
|
15498
15548
|
return j;
|
|
@@ -16033,14 +16083,20 @@ function xepKho(p, mau2, kb, gia2) {
|
|
|
16033
16083
|
}
|
|
16034
16084
|
}
|
|
16035
16085
|
var khoTile = (mau2, kb) => new Map(dsTaiSan(mau2.doan, kb).map((x) => [x[0], x[2]]));
|
|
16036
|
-
|
|
16086
|
+
var khoa = (c) => "anh:" + String(c.tu || "").toLocaleLowerCase("vi");
|
|
16087
|
+
function canhClip(p, mau2, kb, toiDa = 4) {
|
|
16037
16088
|
if (!mau2?.doan || !kb) return null;
|
|
16038
|
-
const tile = khoTile(mau2, kb);
|
|
16039
|
-
const
|
|
16040
|
-
if (!
|
|
16041
|
-
const dung = new Set(
|
|
16042
|
-
const
|
|
16043
|
-
|
|
16089
|
+
const tile = khoTile(mau2, kb), anhG = (k) => tile.has(k) ? anhGia(String(tile.get(k))) : null;
|
|
16090
|
+
const d0 = xepKho(p, mau2, kb, anhG);
|
|
16091
|
+
if (!d0) return null;
|
|
16092
|
+
const dung = new Set(d0);
|
|
16093
|
+
const ung = (kb.canh || []).filter((c) => c && c.kieu === "anh" && (c.en || c.de) && dung.has(khoa(c))), b = ung.length / Math.max(1, toiDa);
|
|
16094
|
+
const chon = ung.length <= toiDa ? ung : Array.from({ length: toiDa }, (_, i) => ung[Math.floor(i * b)]), ck = new Set(chon.map(khoa));
|
|
16095
|
+
const d1 = xepKho(p, mau2, kb, (k) => ck.has(k) ? clipGia : anhG(k));
|
|
16096
|
+
if (!d1) return null;
|
|
16097
|
+
const song = new Set(d1);
|
|
16098
|
+
const ra2 = chon.filter((c) => song.has(khoa(c)));
|
|
16099
|
+
G2.__xepThu = { ...G2.__xepThu || {}, clip: [ung.length, chon.length, ra2.length] };
|
|
16044
16100
|
return ra2;
|
|
16045
16101
|
}
|
|
16046
16102
|
function anhCan(p, mau2, kb) {
|
|
@@ -16390,7 +16446,7 @@ async function handleExport(currentProject, setExporting, setExportedBlob, addLo
|
|
|
16390
16446
|
const khoCu = await layKho(), nVid = khoCu.filter((m) => m.loai === "video" && cuaDuAn(m.ten)).length;
|
|
16391
16447
|
const canVid = Math.max(3, Math.min(8, Math.ceil((window.__loiApp?.p?.timeline || []).reduce((s, t) => s + Math.max(0, (t.trimEnd || 0) - (t.trimStart || 0)), 0) / 18) || 4));
|
|
16392
16448
|
if (nVid < canVid) {
|
|
16393
|
-
const cc = canhClip(currentProject, mauPd, kb);
|
|
16449
|
+
const cc = canhClip(currentProject, mauPd, kb, canVid - nVid);
|
|
16394
16450
|
const r = await taoTramOmni(cc || kb && kb.canh || [], { toiDa: canVid - nVid, giay: 4, tran: 40, daXep: !!cc, bao: (st) => setExporting({ percent: 1, step: "T\u1EA1o clip tr\xE1m Omni (c\xF3 credit) " + st }) });
|
|
16395
16451
|
window.__omniXuat = r;
|
|
16396
16452
|
}
|
|
@@ -18161,7 +18217,7 @@ function datCauLenh(a) {
|
|
|
18161
18217
|
on2 = true;
|
|
18162
18218
|
window.addEventListener("message", async (ev) => {
|
|
18163
18219
|
const d = ev.data;
|
|
18164
|
-
if (!d || d.
|
|
18220
|
+
if (!d || d.xvaiLoi140229 !== true) return;
|
|
18165
18221
|
const o = String(ev.origin || "");
|
|
18166
18222
|
if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
|
|
18167
18223
|
const tra = (kq) => {
|
|
@@ -18184,24 +18240,6 @@ function datCauLenh(a) {
|
|
|
18184
18240
|
const p = api.project;
|
|
18185
18241
|
return tra({ id: p && p.id, ten: p && p.name, doan: p && p.timeline ? p.timeline.length : 0, fx: p && p.studioFx || null, sua: p && p.speechEdit && p.speechEdit.metrics || null, xuat: api.exporting || null, phim: api.blob ? api.blob.size : 0, pro: pro ? pro.trangThai() : null });
|
|
18186
18242
|
}
|
|
18187
|
-
if (d.lenh === "datFx") {
|
|
18188
|
-
api.setProject((c) => c ? { ...c, studioFx: { ...c.studioFx || {}, ...d.fx || {} } } : c);
|
|
18189
|
-
return tra("ok");
|
|
18190
|
-
}
|
|
18191
|
-
if (d.lenh === "tuyChon") return tra(pro ? pro.dat(d.tuyChon || {}) : "CHUA CO BANG HAU KY");
|
|
18192
|
-
if (d.lenh === "tuDongPro") {
|
|
18193
|
-
if (!pro) return tra("CHUA CO BANG HAU KY");
|
|
18194
|
-
pro.tuDong();
|
|
18195
|
-
return tra("ok");
|
|
18196
|
-
}
|
|
18197
|
-
if (d.lenh === "xuat") {
|
|
18198
|
-
api.xuat();
|
|
18199
|
-
return tra("ok");
|
|
18200
|
-
}
|
|
18201
|
-
if (d.lenh === "dongXuat") {
|
|
18202
|
-
api.dongXuat();
|
|
18203
|
-
return tra("ok");
|
|
18204
|
-
}
|
|
18205
18243
|
if (d.lenh === "taiPhim") {
|
|
18206
18244
|
await api.tai();
|
|
18207
18245
|
return tra("ok");
|
|
@@ -18219,41 +18257,6 @@ function datCauLenh(a) {
|
|
|
18219
18257
|
const text2 = JSON.stringify(api.project), a2 = Number(d.tu) || 0, b = Math.min(text2.length, Number(d.den) || text2.length);
|
|
18220
18258
|
return tra({ size: text2.length, tu: a2, den: b, text: text2.slice(a2, b) });
|
|
18221
18259
|
}
|
|
18222
|
-
if (d.lenh === "datXuatNhanh") {
|
|
18223
|
-
window.__xuatNhanh = !!d.bat;
|
|
18224
|
-
return tra("ok");
|
|
18225
|
-
}
|
|
18226
|
-
if (d.lenh === "datMauPhuDe") {
|
|
18227
|
-
window.__mauPhuDe = d.mau ? String(d.mau) : "";
|
|
18228
|
-
return tra("ok");
|
|
18229
|
-
}
|
|
18230
|
-
if (d.lenh === "layNhan") {
|
|
18231
|
-
const o2 = {};
|
|
18232
|
-
for (let i = 0; i < localStorage.length; i++) {
|
|
18233
|
-
const k = localStorage.key(i) || "";
|
|
18234
|
-
if (k.indexOf("xvaiNhan:") === 0) o2[k] = localStorage.getItem(k);
|
|
18235
|
-
}
|
|
18236
|
-
return tra(o2);
|
|
18237
|
-
}
|
|
18238
|
-
if (d.lenh === "bamNut") {
|
|
18239
|
-
const b = Array.from(document.querySelectorAll("button")).find((x) => (x.textContent || "").indexOf(String(d.chu || "")) >= 0);
|
|
18240
|
-
if (!b) return tra("KHONG THAY NUT");
|
|
18241
|
-
const L = [], h = (e) => {
|
|
18242
|
-
L.push(String(e && (e.message || e.reason) || e).slice(0, 160));
|
|
18243
|
-
}, ce = console.error;
|
|
18244
|
-
window.addEventListener("error", h);
|
|
18245
|
-
window.addEventListener("unhandledrejection", h);
|
|
18246
|
-
console.error = (...a2) => {
|
|
18247
|
-
L.push(a2.map(String).join(" ").slice(0, 160));
|
|
18248
|
-
ce.apply(console, a2);
|
|
18249
|
-
};
|
|
18250
|
-
b.click();
|
|
18251
|
-
await new Promise((r) => setTimeout(r, Number(d.cho) || 2e3));
|
|
18252
|
-
window.removeEventListener("error", h);
|
|
18253
|
-
window.removeEventListener("unhandledrejection", h);
|
|
18254
|
-
console.error = ce;
|
|
18255
|
-
return tra({ chu: document.body.innerText.slice(0, Number(d.dai) || 4e3), loi: L });
|
|
18256
|
-
}
|
|
18257
18260
|
if (d.lenh === "napLoi") return tra(await napLoi(d));
|
|
18258
18261
|
if (d.lenh === "taoTramOmni") return tra(await taoTramOmni(d.canh || [], d));
|
|
18259
18262
|
if (d.lenh === "cauApp") return tra(cauApp(d));
|
|
@@ -18270,10 +18273,10 @@ var sfx_kho_default = { "bong_001.ogg": "T2dnUwACAAAAAAAAAAABSQAAAAAAANTOBngBHgF
|
|
|
18270
18273
|
// loi/tuyChonBen.ts
|
|
18271
18274
|
var KHOA_TUY_CHON = ["xvaiNhipCham", "xvaiChuoiTram", "xvaiToanKhung", "xvaiNhacMuc", "xvaiNhac", "xvaiTramDai", "xvaiSfxCach", "xvaiMau", "xvaiAm", "xvaiKieuChu", "xvaiDem", "xvaiTuDien", "xvaiNguonTram", "xvaiTranAnh", "xvaiPhuDe"];
|
|
18272
18275
|
var G4 = globalThis;
|
|
18273
|
-
var
|
|
18276
|
+
var khoa2 = () => Array.isArray(G4.__khoaTuyChon) ? G4.__khoaTuyChon : KHOA_TUY_CHON;
|
|
18274
18277
|
var anh = () => {
|
|
18275
18278
|
const o = {};
|
|
18276
|
-
for (const k of
|
|
18279
|
+
for (const k of khoa2()) {
|
|
18277
18280
|
try {
|
|
18278
18281
|
const v = localStorage.getItem(k);
|
|
18279
18282
|
if (v != null) o[k] = v;
|
|
@@ -18295,7 +18298,7 @@ async function khoiPhucTuyChon() {
|
|
|
18295
18298
|
let n = 0;
|
|
18296
18299
|
try {
|
|
18297
18300
|
const o = await hoiNgoai("lay", "tuyChon");
|
|
18298
|
-
if (o && typeof o === "object") for (const k of
|
|
18301
|
+
if (o && typeof o === "object") for (const k of khoa2()) {
|
|
18299
18302
|
if (typeof o[k] === "string" && localStorage.getItem(k) == null) {
|
|
18300
18303
|
localStorage.setItem(k, o[k]);
|
|
18301
18304
|
n++;
|
|
@@ -18309,11 +18312,11 @@ async function khoiPhucTuyChon() {
|
|
|
18309
18312
|
const S = Storage.prototype, set = S.setItem, rm = S.removeItem;
|
|
18310
18313
|
S.setItem = function(k, v) {
|
|
18311
18314
|
set.call(this, k, v);
|
|
18312
|
-
if (this === localStorage &&
|
|
18315
|
+
if (this === localStorage && khoa2().indexOf(k) >= 0) (G4.__luuTuyChon || luu)();
|
|
18313
18316
|
};
|
|
18314
18317
|
S.removeItem = function(k) {
|
|
18315
18318
|
rm.call(this, k);
|
|
18316
|
-
if (this === localStorage &&
|
|
18319
|
+
if (this === localStorage && khoa2().indexOf(k) >= 0) (G4.__luuTuyChon || luu)();
|
|
18317
18320
|
};
|
|
18318
18321
|
}
|
|
18319
18322
|
return n;
|
|
@@ -18840,7 +18843,7 @@ var SuaLich = ({ ten, onDong }) => {
|
|
|
18840
18843
|
const S = p && p.speechDraft && p.speechDraft.analysis && p.speechDraft.analysis.silences || [];
|
|
18841
18844
|
return Array.isArray(w) ? canVung(w, S) : [];
|
|
18842
18845
|
})();
|
|
18843
|
-
const
|
|
18846
|
+
const khoa3 = (r) => r.t0g !== void 0 ? r.t0g : r.t0;
|
|
18844
18847
|
const luuCat = (n) => {
|
|
18845
18848
|
setCatTay(n);
|
|
18846
18849
|
G6.__catTay = n;
|
|
@@ -18849,7 +18852,7 @@ var SuaLich = ({ ten, onDong }) => {
|
|
|
18849
18852
|
} catch (e) {
|
|
18850
18853
|
}
|
|
18851
18854
|
};
|
|
18852
|
-
const ids = (r) => Array.isArray(r.ids) ? r.ids : [
|
|
18855
|
+
const ids = (r) => Array.isArray(r.ids) ? r.ids : [khoa3(r)];
|
|
18853
18856
|
const daCat = (w) => catTay.some((r) => ids(r).some((x) => Math.abs(x - w.t0g) < 0.01));
|
|
18854
18857
|
const batCat = async (w) => {
|
|
18855
18858
|
const chon = /* @__PURE__ */ new Set();
|