xvai-loi 0.1.73 → 0.1.74

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 +39 -1
package/co.txt CHANGED
@@ -1 +1 @@
1
- xvaiLoi111825
1
+ xvaiLoi111930
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xvai-loi",
3
- "version": "0.1.73",
3
+ "version": "0.1.74",
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
@@ -18481,6 +18481,44 @@ async function chuanBiKho(kb, words, bao) {
18481
18481
  }
18482
18482
  }
18483
18483
  globalThis.__ghepKho = can.map((c) => [c.khoa, g[c.khoa] ? (co.find((x) => x.id === g[c.khoa])?.mo || "").slice(0, 70) : null]);
18484
+ {
18485
+ const W4 = (words || []).filter((w) => w && w.text), wl = W4.map((w) => chuan(w.text));
18486
+ let them = 0;
18487
+ for (const a of co) {
18488
+ if (a.loai !== "video" || da.has(a.id) || !/^omni-/i.test(String(a.ten))) continue;
18489
+ const t = chuan(String(a.ten).replace(/\.[a-z0-9]+$/i, "").replace(/^omni-[a-z0-9]+-\d+-/i, ""));
18490
+ if (t.length < 6) continue;
18491
+ let best = -1, bd = 1e9;
18492
+ for (let i = 0; i < wl.length; i++) {
18493
+ let s2 = "";
18494
+ for (let j = i; j < Math.min(wl.length, i + 8) && s2.length < t.length + 4; j++) {
18495
+ s2 += wl[j];
18496
+ if (s2.length >= t.length - 3) {
18497
+ const dd = lev(s2, t);
18498
+ if (dd < bd) {
18499
+ bd = dd;
18500
+ best = i;
18501
+ }
18502
+ }
18503
+ }
18504
+ }
18505
+ if (best < 0 || bd > Math.max(2, Math.round(0.25 * t.length))) continue;
18506
+ const tu = W4.slice(best, best + 3).map((w) => String(w.text).replace(/[.,!?;:…"“”]/g, "")).join(" "), khoa3 = "anh:" + tu.toLocaleLowerCase("vi");
18507
+ const cu = taiSan(khoa3);
18508
+ if (cu && cu.laVideo) continue;
18509
+ try {
18510
+ const im = await napVideo(a.blob, bao);
18511
+ im.khoId = a.id;
18512
+ datTaiSan(khoa3, im);
18513
+ da.add(a.id);
18514
+ n++;
18515
+ them++;
18516
+ kb.canh.push({ tu, kieu: "anh", chu: " ", chu2: "", khuon: 1, clip: 1 });
18517
+ } catch (e) {
18518
+ }
18519
+ }
18520
+ globalThis.__clipThem = them;
18521
+ }
18484
18522
  return n;
18485
18523
  }
18486
18524
  async function kiemAnhTao(kb, words, bao) {
@@ -20756,7 +20794,7 @@ function datCauLenh(a) {
20756
20794
  on2 = true;
20757
20795
  window.addEventListener("message", async (ev) => {
20758
20796
  const d = ev.data;
20759
- if (!d || d.xvaiLoi111825 !== true) return;
20797
+ if (!d || d.xvaiLoi111930 !== true) return;
20760
20798
  const o = String(ev.origin || "");
20761
20799
  if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
20762
20800
  const tra = (kq) => {