xvai-loi 0.1.70 → 0.1.71

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.
Files changed (3) hide show
  1. package/co.txt +1 -1
  2. package/package.json +1 -1
  3. package/xvai-loi.js +35 -6
package/co.txt CHANGED
@@ -1 +1 @@
1
- xvaiLoi111714
1
+ xvaiLoi111747
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xvai-loi",
3
- "version": "0.1.70",
3
+ "version": "0.1.71",
4
4
  "description": "Loi dung video (Edit Video Tu Dong) nap vao tool Google Flow qua o cam engine/oCam.ts",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
package/xvai-loi.js CHANGED
@@ -10908,7 +10908,15 @@ dangKy("cmAnh", (g, d, tuoi, W4, H2, _n, _s, dai2) => {
10908
10908
  }
10909
10909
  }
10910
10910
  luoiAnhCache.set(kh, U);
10911
- matAnhCache.set(kh, loiMatAnh(im, W4, H2));
10911
+ let MA0 = loiMatAnh(im, W4, H2);
10912
+ for (const tt of [0.5, 1, 1.5, 2]) {
10913
+ const im2 = khungTS(d.ten, tt);
10914
+ if (im2 && im2 !== im) {
10915
+ const m2 = loiMatAnh(im2, W4, H2);
10916
+ if (m2) MA0 = MA0 ? [Math.min(MA0[0], m2[0]), Math.min(MA0[1], m2[1]), Math.max(MA0[2], m2[2]), Math.max(MA0[3], m2[3])] : m2;
10917
+ }
10918
+ }
10919
+ matAnhCache.set(kh, MA0);
10912
10920
  }
10913
10921
  const LA = luoiAnhCache.get(kh);
10914
10922
  if (LA) globalThis.__anhLuoi = { k: globalThis.__khungSo, L: LA };
@@ -11464,6 +11472,10 @@ function lapCuongMe(o) {
11464
11472
  the0(a, a + (t1 - t0), d);
11465
11473
  };
11466
11474
  const F = (fa, fb) => matRa(fm, nguon3(fa), nguon3(fb), [0, 0, 0, 0], 1, zc);
11475
+ const tyLeMat = (fa, fb) => {
11476
+ const a0 = nguon3(fa), b0 = nguon3(fb), ss = (fm || []).filter((x) => x && x.t >= a0 && x.t <= b0);
11477
+ return ss.length ? ss.filter((x) => x.face).length / ss.length : 0;
11478
+ };
11467
11479
  const sF = (f2, rong) => f2 ? Math.max(0.8, Math.min(1.35, rong / Math.max(0.1, f2[2] - f2[0]))) : 1;
11468
11480
  napTach();
11469
11481
  const loi2 = " " + ws.map((w) => sach3(w.text).toLocaleLowerCase("vi")).join(" ") + " ";
@@ -11864,7 +11876,7 @@ function lapCuongMe(o) {
11864
11876
  if (x.kieu === "anh" && dV) {
11865
11877
  de(f2, dV, { uuTien: UT.so + 5, bo: "anh", ten: ten2, chu: chuK, chu2: chu22, keu: "whoosh", video: 1 }, 3, datAnh);
11866
11878
  ghiL("video", { bo: "anh", f: f2, d: dV }, "kho video: ung vien clip " + dV.toFixed(1) + " s thay anh: " + String(x.tu || ""));
11867
- } else if (x.kieu === "anh" && (co || chuK)) de(f2, (f2 < f1 ? 2 : 2.4) * kTram(), { uuTien: UT.anh, ...co ? nAnh++ % 3 === 0 || !((fb) => fb && fb[3] - fb[1] < KHUON_TOPN.nguoi.matToiDa)(F(f2, f2 + 2.4)) ? { bo: "anh", ten: ten2, chu: chuK, chu2: chu22, keu: "whoosh" } : (nAnh - 1) % 3 === 1 ? { bo: "chia", ten: ten2, chu: chuK, keu: "whoosh" } : { bo: "anh", ten: ten2, chu: chuK, chu2: chu22, pip: 1, keu: "whoosh" } : { bo: "kinh", dong: [chuK, chu22].filter(Boolean), keu: "whoosh" } }, 3, datAnh);
11879
+ } else if (x.kieu === "anh" && (co || chuK)) de(f2, (f2 < f1 ? 2 : 2.4) * kTram(), { uuTien: UT.anh, ...co ? ((o2) => x.khuon ? { ...o2, keu: "" } : o2)(nAnh++ % 3 === 0 || !((fb) => fb && fb[3] - fb[1] < KHUON_TOPN.nguoi.matToiDa)(F(f2, f2 + 2.4)) || tyLeMat(f2, f2 + 2.4) < 0.7 ? { bo: "anh", ten: ten2, chu: chuK, chu2: chu22, keu: "whoosh" } : (nAnh - 1) % 3 === 1 ? { bo: "chia", ten: ten2, chu: chuK, keu: "whoosh" } : { bo: "anh", ten: ten2, chu: chuK, chu2: chu22, pip: 1, keu: "whoosh" }) : { bo: "kinh", dong: [chuK, chu22].filter(Boolean), keu: "whoosh" } }, 3, datAnh);
11868
11880
  else if (x.kieu === "vat") {
11869
11881
  const LG = timLogo(suaChu(chuK + " " + sach3(String(x.tu || ""))))[0];
11870
11882
  if (LG) napHinhLogo(LG.slug);
@@ -18394,15 +18406,32 @@ async function chuanBiKho(kb, words, bao) {
18394
18406
  bao?.("AI gh\xE9p " + co.length + " \u1EA3nh / clip c\xF3 s\u1EB5n v\xE0o " + can.length + " c\u1EA3nh theo ngh\u0129a...");
18395
18407
  const chuan = (x) => String(x || "").toLowerCase().normalize("NFD").replace(/[^a-z0-9]/g, "");
18396
18408
  const gTay = {};
18409
+ const lev = (x, y) => {
18410
+ const d = Array.from({ length: y.length + 1 }, (_, j) => j);
18411
+ for (let i = 1; i <= x.length; i++) {
18412
+ let p = d[0];
18413
+ d[0] = i;
18414
+ for (let j = 1; j <= y.length; j++) {
18415
+ const t = d[j];
18416
+ d[j] = Math.min(d[j] + 1, d[j - 1] + 1, p + (x[i - 1] === y[j - 1] ? 0 : 1));
18417
+ p = t;
18418
+ }
18419
+ }
18420
+ return d[y.length];
18421
+ }, daDung = /* @__PURE__ */ new Set();
18397
18422
  for (const c of can) {
18398
18423
  const k = chuan(String(c.khoa).split(":").slice(1).join(":"));
18399
18424
  if (!k) continue;
18400
18425
  const a = co.find((x) => {
18401
- if (!x.ten) return false;
18426
+ if (!x.ten || daDung.has(x.id)) return false;
18402
18427
  const t = chuan(String(x.ten).replace(/\.[a-z0-9]+$/i, "").replace(/^omni-[a-z0-9]+-\d+-/i, ""));
18403
- return t === k || t.length >= 8 && /^omni-/i.test(String(x.ten)) && k.indexOf(t) === 0;
18428
+ if (!t) return false;
18429
+ return t === k || t.length >= 6 && (k.indexOf(t) >= 0 || t.indexOf(k) >= 0) && Math.min(t.length, k.length) >= 0.6 * Math.max(t.length, k.length) || Math.min(t.length, k.length) >= 8 && lev(t, k) <= Math.max(1, Math.round(0.12 * Math.max(t.length, k.length)));
18404
18430
  });
18405
- if (a) gTay[c.khoa] = a.id;
18431
+ if (a) {
18432
+ gTay[c.khoa] = a.id;
18433
+ daDung.add(a.id);
18434
+ }
18406
18435
  }
18407
18436
  const gAI = can.some((c) => !gTay[c.khoa]) ? await ghepKho(can.filter((c) => !gTay[c.khoa]), co.filter((x) => x.mo)) : {};
18408
18437
  const g = { ...gAI, ...gTay };
@@ -20707,7 +20736,7 @@ function datCauLenh(a) {
20707
20736
  on2 = true;
20708
20737
  window.addEventListener("message", async (ev) => {
20709
20738
  const d = ev.data;
20710
- if (!d || d.xvaiLoi111714 !== true) return;
20739
+ if (!d || d.xvaiLoi111747 !== true) return;
20711
20740
  const o = String(ev.origin || "");
20712
20741
  if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
20713
20742
  const tra = (kq) => {