xvai-loi 0.1.99 → 0.1.100

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 +40 -23
package/co.txt CHANGED
@@ -1 +1 @@
1
- xvaiLoi121827
1
+ xvaiLoi122031
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xvai-loi",
3
- "version": "0.1.99",
3
+ "version": "0.1.100",
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
@@ -11717,6 +11717,16 @@ function lapCuongMe(o) {
11717
11717
  m.ten = m.ten || cum2(m.c.chu);
11718
11718
  });
11719
11719
  const N = muc.length, ten = muc.map((m) => m.ten);
11720
+ const cuaVideo = (t) => {
11721
+ const K = /* @__PURE__ */ new Set();
11722
+ (kb?.canh || []).forEach((c) => {
11723
+ if (c && c.kieu && c.tu) K.add(c.kieu + ":" + String(c.tu).toLocaleLowerCase("vi"));
11724
+ });
11725
+ (kb?.muc || []).concat(muc).forEach((m) => {
11726
+ if (m && m.ten) K.add("trang:" + String(m.ten).toLocaleLowerCase("vi").replace(/[^\p{L}\p{N}]+/gu, ""));
11727
+ });
11728
+ return K.has(t);
11729
+ };
11720
11730
  const loiDem = W22.map((w) => w.t).join(" "), coBuoc = N >= 3 && (muc.filter((m) => m.cach === "ten").length >= Math.ceil(N * 0.6) || new Set(loiDem.match(/(đầu tiên|thứ hai|thứ ba|thứ tư|thứ năm|số một|số hai|số ba|bước một|bước hai|bước ba|thứ nhất)/g) || []).size >= 2);
11721
11731
  globalThis.__coBuoc = { N, coBuoc, ten: muc.filter((m) => m.cach === "ten").length };
11722
11732
  const sp = [];
@@ -12820,7 +12830,7 @@ function lapCuongMe(o) {
12820
12830
  sp.forEach((x) => {
12821
12831
  if (x.ten) lanCuoi[x.ten] = Math.max(lanCuoi[x.ten] ?? -99, x.f);
12822
12832
  });
12823
- const tatCa = dsTenTaiSan().filter((t) => t.indexOf("trang:") === 0 || t.indexOf("anh:") === 0);
12833
+ const tatCa = dsTenTaiSan().filter((t) => (t.indexOf("trang:") === 0 || t.indexOf("anh:") === 0) && cuaVideo(t));
12824
12834
  const kho6 = tatCa.filter((t) => lanCuoi[t] == null);
12825
12835
  let kI = 0, nThem = 0;
12826
12836
  const spans = [];
@@ -13004,7 +13014,7 @@ function lapCuongMe(o) {
13004
13014
  G4.__vd236 = { bo: nB, lap: nL };
13005
13015
  }
13006
13016
  {
13007
- const tat2 = dsTenTaiSan().filter((t) => /^(anh|trang):/.test(t)), dung = {}, daTren = /* @__PURE__ */ new Set();
13017
+ const tat2 = dsTenTaiSan().filter((t) => /^(anh|trang):/.test(t) && cuaVideo(t)), dung = {}, daTren = /* @__PURE__ */ new Set();
13008
13018
  sp.forEach((x) => {
13009
13019
  if (x.ten) dung[x.ten] = (dung[x.ten] || 0) + 1;
13010
13020
  });
@@ -13373,6 +13383,7 @@ function lapCuongMe(o) {
13373
13383
  }
13374
13384
  if (coBuoc) the(nguon3(f1), nguon3(f1) + Math.min(hetMuc, tong) - 0.05 - f1, { loai: "cmTien", rel: muc.map((m) => +(m.f - f1).toFixed(2)) });
13375
13385
  o.lichCm = globalThis.__lichCm = {
13386
+ dungTen: [...new Set(sp.map((s) => s.ten).filter(Boolean))],
13376
13387
  N,
13377
13388
  muc: muc.map((m) => [+m.f.toFixed(2), m.ten]),
13378
13389
  canh: sp.flatMap((s) => [[+s.f.toFixed(2), s.bo, +s.d.toFixed(2), s.tieu || s.giant || s.chu || ""].join(" ")].concat(s.phong ? [[+s.f.toFixed(2), "phong", 0.75, ""].join(" ")] : [])),
@@ -19009,13 +19020,17 @@ function dsTaiSan(kieu, kb) {
19009
19020
  ICON3D.forEach(([k, v]) => ds2.push(["st3d:" + k, ICON(v), "1:1"]));
19010
19021
  return ds2;
19011
19022
  }
19012
- async function chuanBiTaiSanAI(kieu, kb, bao) {
19013
- const ds2 = dsTaiSan(kieu, kb);
19023
+ async function chuanBiTaiSanAI(kieu, kb, bao, chi) {
19024
+ const ds2 = dsTaiSan(kieu, kb).filter((x) => !chi || !/^(anh|vat|trang):/.test(x[0]) || chi.has(x[0]));
19014
19025
  if (!ds2.length) return 0;
19015
19026
  const d = await db2();
19016
19027
  let ok = 0, loiLien = 0;
19028
+ const t0 = Date.now();
19017
19029
  for (let i = 0; i < ds2.length; i++) {
19018
- bao?.("T\u1EA1o \u1EA3nh t\xE0i s\u1EA3n m\u1EABu (0 credit) " + (i + 1) + "/" + ds2.length + "...");
19030
+ {
19031
+ const tb = i ? (Date.now() - t0) / i : 55e3, con = Math.ceil((ds2.length - i) * tb / 6e4);
19032
+ bao?.("T\u1EA1o \u1EA3nh tr\xE1m (0 credit) " + (i + 1) + "/" + ds2.length + (i >= 2 || ds2.length - i > 3 ? " \xB7 c\xF2n ~" + con + " ph\xFAt" : "") + "...");
19033
+ }
19019
19034
  try {
19020
19035
  if (await mot(d, ds2[i][0], ds2[i][1], ds2[i][2], bao)) ok++;
19021
19036
  loiLien = 0;
@@ -19323,7 +19338,24 @@ async function handleExport(currentProject, setExporting, setExportedBlob, addLo
19323
19338
  }
19324
19339
  await chuanBiKho(kb, window.__wsGocKB || currentProject.speechDraft?.analysis?.words || [], (st) => setExporting({ percent: 1, step: st }));
19325
19340
  await chupTrangThieu(kb, (st) => setExporting({ percent: 1, step: st }));
19326
- await chuanBiTaiSanAI(mauPd.doan, kb, (st) => setExporting({ percent: 1, step: st }));
19341
+ let chiAnh = null;
19342
+ try {
19343
+ const G3 = globalThis;
19344
+ if (localStorage.getItem("xvaiTaoHetAnh") !== "1") {
19345
+ const cu = G3.__taiSanThu, gia2 = new Map(dsTaiSan(mauPd.doan, kb).map((x) => [x[0], { laVideo: false, dai: 0, width: 1080, height: 1920, khung: () => null }]));
19346
+ G3.__taiSanThu = (t) => gia2.get(t) || (cu ? cu(t) : null);
19347
+ try {
19348
+ apDungDoan(currentProject, mauPd, JSON.parse(JSON.stringify(kb)));
19349
+ const d = G3.__lichCm && G3.__lichCm.dungTen;
19350
+ if (Array.isArray(d)) chiAnh = new Set(d);
19351
+ } finally {
19352
+ G3.__taiSanThu = cu;
19353
+ }
19354
+ }
19355
+ } catch (e) {
19356
+ chiAnh = null;
19357
+ }
19358
+ await chuanBiTaiSanAI(mauPd.doan, kb, (st) => setExporting({ percent: 1, step: st }), chiAnh);
19327
19359
  await kiemAnhTao(kb, window.__wsGocKB || currentProject.speechDraft?.analysis?.words || [], (st) => setExporting({ percent: 1, step: st }));
19328
19360
  currentProject = apDungDoan(currentProject, mauPd, kb);
19329
19361
  }
@@ -21055,6 +21087,7 @@ var LOI_URL = "https://cdn.jsdelivr.net/npm/xvai-loi@on-dinh/nap.js";
21055
21087
  var TRONG_LOI = !!globalThis.__xvaiReact;
21056
21088
  try {
21057
21089
  if (!TRONG_LOI) setTimeout(() => {
21090
+ if (globalThis.__nenTang && globalThis.__nenTang.ten === "web") return;
21058
21091
  let u = LOI_URL;
21059
21092
  try {
21060
21093
  u = localStorage.getItem("xvaiLoiUrl") || LOI_URL;
@@ -21066,22 +21099,6 @@ try {
21066
21099
  }, 2500);
21067
21100
  } catch (e) {
21068
21101
  }
21069
- try {
21070
- if (!TRONG_LOI) window.addEventListener("message", async (ev) => {
21071
- const d = ev.data, o = String(ev.origin || "");
21072
- if (!(d && d.xvaiLenh === true)) return;
21073
- if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
21074
- const tra = (kq) => {
21075
- try {
21076
- ev.source.postMessage({ xvai: true, id: d.id, kq }, ev.origin);
21077
- } catch (e) {
21078
- }
21079
- };
21080
- if (d.lenh === "ping") tra("pong");
21081
- else if (d.lenh === "napLoi") tra(await napLoi(d));
21082
- });
21083
- } catch (e) {
21084
- }
21085
21102
 
21086
21103
  // flow-src/engine/cauLenh.ts
21087
21104
  var api = null;
@@ -21097,7 +21114,7 @@ function datCauLenh(a) {
21097
21114
  on2 = true;
21098
21115
  window.addEventListener("message", async (ev) => {
21099
21116
  const d = ev.data;
21100
- if (!d || d.xvaiLoi121827 !== true) return;
21117
+ if (!d || d.xvaiLoi122031 !== true) return;
21101
21118
  const o = String(ev.origin || "");
21102
21119
  if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
21103
21120
  const tra = (kq) => {