xvai-loi 0.1.129 → 0.1.131

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 +18 -15
package/co.txt CHANGED
@@ -1 +1 @@
1
- xvaiLoi130717
1
+ xvaiLoi130820
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xvai-loi",
3
- "version": "0.1.129",
3
+ "version": "0.1.131",
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
@@ -8750,17 +8750,19 @@ function lapAnhTheoKhuon(kb, ws, K = KHUON_TOPN, toiDa = 12) {
8750
8750
  };
8751
8751
  const g = 60 / K.tram.phut, t0 = W4[0].t0 + K.bien.dau, t1 = W4[W4.length - 1].t1 - K.bien.cuoi;
8752
8752
  {
8753
- let doi = 0;
8754
- const tDau = t0 + (t1 - t0) * K.soTrenAnh.phanDau;
8755
- for (const c of kb.canh) {
8756
- if (doi >= K.soTrenAnh.toiDa || !c || c.kieu !== "so" || !c.tu) continue;
8757
- const i = timTu(c.tu);
8758
- if (i < 0 || W4[i].t0 < t0 || W4[i].t0 > tDau) continue;
8759
- const cau = W4.slice(Math.max(0, i - 5), i + 10).map((w) => w.text).join(" ");
8760
- c.kieu = "anh";
8761
- c.soAnh = 1;
8762
- c.en = 'Cinematic photorealistic vertical photo that illustrates the meaning of this Vietnamese sentence: "' + cau + '". ' + K.tram.nhanVat[doi % 2] + " Natural light, no text, no captions.";
8763
- doi++;
8753
+ const coAnh2 = (a, b) => kb.canh.filter((c) => c && c.tu && /^(anh|ds)$/.test(String(c.kieu)) && ((i) => i >= 0 && W4[i].t0 >= a && W4[i].t0 < b)(timTu(c.tu))).length >= 2, ba = (p) => t0 + (t1 - t0) * p / 3;
8754
+ for (const [a, b] of [[t0, t0 + (t1 - t0) * K.soTrenAnh.phanDau], ...[1, 2].filter((p) => !coAnh2(ba(p), ba(p + 1))).map((p) => [ba(p), ba(p + 1)])]) {
8755
+ let doi = 0;
8756
+ for (const c of kb.canh) {
8757
+ if (doi >= K.soTrenAnh.toiDa || !c || c.kieu !== "so" || !c.tu) continue;
8758
+ const i = timTu(c.tu);
8759
+ if (i < 0 || W4[i].t0 < a || W4[i].t0 > b) continue;
8760
+ const cau = W4.slice(Math.max(0, i - 5), i + 10).map((w) => w.text).join(" ");
8761
+ c.kieu = "anh";
8762
+ c.soAnh = 1;
8763
+ c.en = 'Cinematic photorealistic vertical photo that illustrates the meaning of this Vietnamese sentence: "' + cau + '". ' + K.tram.nhanVat[doi % 2] + " Natural light, no text, no captions.";
8764
+ doi++;
8765
+ }
8764
8766
  }
8765
8767
  }
8766
8768
  const moc = kb.canh.filter(
@@ -9767,7 +9769,7 @@ dangKy("cmNen", (g, d, tuoi, W4, H2, nen2, _s, dai2) => {
9767
9769
  g.shadowColor = "rgba(60,20,0,0.45)";
9768
9770
  g.shadowBlur = 0.03 * W4;
9769
9771
  g.shadowOffsetY = 0.015 * W4;
9770
- g.drawImage(im, W4 / 2 - ww / 2, (d.chu ? 0.19 : 0.24) * H2 - h2 / 2 + (1 - p2) * 0.04 * H2, ww, h2);
9772
+ g.drawImage(im, W4 / 2 - ww / 2, (d.chu ? 0.2 : 0.24) * H2 - h2 / 2 + (1 - p2) * 0.04 * H2, ww, h2);
9771
9773
  g.restore();
9772
9774
  } else if (im) {
9773
9775
  const yT = 0.11 * H2, hA = hT - yT, zc = Math.max(W4 / im.width, hT / im.height);
@@ -9810,7 +9812,7 @@ dangKy("cmNen", (g, d, tuoi, W4, H2, nen2, _s, dai2) => {
9810
9812
  }
9811
9813
  g.fillStyle = "rgba(255,255,255,0.92)";
9812
9814
  g.fillRect(0, hT - 3 * H2 / 1920, W4, 6 * H2 / 1920);
9813
- if (d.chu) chu(g, d.chu, W4 / 2, hT - (d.chu2 ? 0.15 : 0.11) * H2, 100 * H2 / 1920, "kw", kep9(tuoi / 0.15) * kep9((1.9 - tuoi) / 0.3), 0.74 * W4);
9815
+ if (d.chu) chu(g, d.chu, W4 / 2, hT - (d.chu2 ? 0.15 : im && /^vat:/.test(String(d.ten)) ? 0.07 : 0.11) * H2, 100 * H2 / 1920, "kw", kep9(tuoi / 0.15) * kep9((1.9 - tuoi) / 0.3), 0.74 * W4);
9814
9816
  if (d.chu2) chu(g, d.chu2, W4 / 2, hT - 0.085 * H2, 84 * H2 / 1920, d.do2 ? "do" : "vang", kep9((tuoi - 0.3) / 0.15) * kep9((1.9 - tuoi) / 0.3), 0.74 * W4);
9815
9817
  }
9816
9818
  if (zk > 1.001 && d.bo !== "cut") phongK(g, nen2, W4, H2, F, zk);
@@ -11531,7 +11533,7 @@ function lapCuongMe(o) {
11531
11533
  }
11532
11534
  {
11533
11535
  bc = "B6j keo tram";
11534
- const KEO = 2.8;
11536
+ const KEO = +(globalThis.__keoTram ?? 2.8);
11535
11537
  sp.sort((p, q) => p.f - q.f);
11536
11538
  sp.forEach((s, k) => {
11537
11539
  if (!/^(anh|chia)$/.test(s.bo) || !s.ten || s.d >= KEO) return;
@@ -12077,6 +12079,7 @@ function lapCuongMe(o) {
12077
12079
  c.bo = "chia";
12078
12080
  delete c.pip;
12079
12081
  delete c.chu2;
12082
+ if (c.d > 2.6) c.d = 2.6;
12080
12083
  continue;
12081
12084
  }
12082
12085
  }
@@ -20835,7 +20838,7 @@ function datCauLenh(a) {
20835
20838
  on2 = true;
20836
20839
  window.addEventListener("message", async (ev) => {
20837
20840
  const d = ev.data;
20838
- if (!d || d.xvaiLoi130717 !== true) return;
20841
+ if (!d || d.xvaiLoi130820 !== true) return;
20839
20842
  const o = String(ev.origin || "");
20840
20843
  if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
20841
20844
  const tra = (kq) => {