xvai-loi 0.1.34 → 0.1.35

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 +37 -9
package/co.txt CHANGED
@@ -1 +1 @@
1
- xvaiLoi092321
1
+ xvaiLoi100001
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xvai-loi",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
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
@@ -9999,7 +9999,26 @@ dangKy("cmAnh", (g, d, tuoi, W4, H2, _n, _s, dai2) => {
9999
9999
  if (a <= 0) return;
10000
10000
  g.save();
10001
10001
  g.globalAlpha = a;
10002
- if (im) {
10002
+ if (im && im.width > 1.25 * im.height) {
10003
+ const zb = Math.max(W4 / im.width, H2 / im.height);
10004
+ g.save();
10005
+ g.filter = "blur(" + Math.round(0.03 * W4) + "px)";
10006
+ g.drawImage(im, (W4 - im.width * zb) / 2, (H2 - im.height * zb) / 2, im.width * zb, im.height * zb);
10007
+ g.restore();
10008
+ const z = (1 + 0.03 * Math.min(1, tuoi / Math.max(0.5, dai2))) * Math.min(0.94 * W4 / im.width, 0.42 * H2 / im.height), iw = im.width * z, ih = im.height * z;
10009
+ g.save();
10010
+ g.shadowColor = "rgba(0,0,0,0.45)";
10011
+ g.shadowBlur = 0.03 * W4;
10012
+ bo(g, (W4 - iw) / 2, 0.33 * H2 - ih / 2, iw, ih, 0.02 * W4);
10013
+ g.fillStyle = "#000";
10014
+ g.fill();
10015
+ g.restore();
10016
+ g.save();
10017
+ bo(g, (W4 - iw) / 2, 0.33 * H2 - ih / 2, iw, ih, 0.02 * W4);
10018
+ g.clip();
10019
+ g.drawImage(im, (W4 - iw) / 2, 0.33 * H2 - ih / 2, iw, ih);
10020
+ g.restore();
10021
+ } else if (im) {
10003
10022
  const z = (1.03 + 0.045 * Math.min(1, tuoi / Math.max(0.5, dai2))) * Math.max(W4 / im.width, H2 / im.height);
10004
10023
  g.drawImage(im, (W4 - im.width * z) / 2, (H2 - im.height * z) / 2, im.width * z, im.height * z);
10005
10024
  }
@@ -11475,11 +11494,15 @@ function lapCuongMe(o) {
11475
11494
  {
11476
11495
  const G2 = globalThis;
11477
11496
  sp.sort((p, q) => p.f - q.f);
11497
+ const idC = (s) => Math.round(s.f * 10) + "-" + s.bo;
11498
+ sp.forEach((s) => {
11499
+ s.id = idC(s);
11500
+ });
11478
11501
  const sua = G2.__lichSua;
11479
11502
  let nS = 0;
11480
11503
  if (sua && typeof sua === "object") {
11481
11504
  for (const k of Object.keys(sua)) {
11482
- const s = sp[+k], e = sua[k];
11505
+ const s = /^\d+$/.test(k) ? sp[+k] : sp.find((x) => x.id === k), e = sua[k];
11483
11506
  if (!s || !e) continue;
11484
11507
  if (e.xoa) {
11485
11508
  s.xoa = 1;
@@ -11493,6 +11516,7 @@ function lapCuongMe(o) {
11493
11516
  }
11494
11517
  if (typeof e.d === "number" && e.d > 0.3) {
11495
11518
  s.d = e.d;
11519
+ s.dSua = 1;
11496
11520
  nS++;
11497
11521
  }
11498
11522
  if (typeof e.f === "number" && e.f >= 0) {
@@ -11504,10 +11528,14 @@ function lapCuongMe(o) {
11504
11528
  sp.length = 0;
11505
11529
  sp.push(...sp2);
11506
11530
  sp.sort((p, q) => p.f - q.f);
11531
+ for (let i = 0; i + 1 < sp.length; i++) {
11532
+ const s = sp[i];
11533
+ if (s.dSua && s.f + s.d > sp[i + 1].f + 0.05) s.d = Math.max(0.4, +(sp[i + 1].f - s.f).toFixed(2));
11534
+ }
11507
11535
  G2.__lichSuaDaAp = nS;
11508
11536
  ghiL("bo", { bo: "sua-tay" }, "sua tay: " + nS + " truong");
11509
11537
  }
11510
- G2.__lichSp = sp.map((s, i) => ({ i, f: +s.f.toFixed(2), d: +s.d.toFixed(2), bo: s.bo, giant: s.giant || "", chu: s.chu || "", chu2: s.chu2 || "", st: s.st || "", ten: s.ten || "", tieu: s.tieu || "", khoa: s.khoa ? 1 : 0 }));
11538
+ G2.__lichSp = sp.map((s, i) => ({ i, id: s.id, f: +s.f.toFixed(2), d: +s.d.toFixed(2), bo: s.bo, giant: s.giant || "", chu: s.chu || "", chu2: s.chu2 || "", st: s.st || "", ten: s.ten || "", tieu: s.tieu || "", khoa: s.khoa ? 1 : 0 }));
11511
11539
  }
11512
11540
  bc = "B7 phat the";
11513
11541
  const stTr = { n: 0 }, keuTr = {};
@@ -18934,7 +18962,7 @@ async function napLoi(d) {
18934
18962
  return "LOI: " + String(e && e.message || e).slice(0, 300);
18935
18963
  }
18936
18964
  }
18937
- var LOI_URL = "https://cdn.jsdelivr.net/npm/xvai-loi@0.1.32/nap.js";
18965
+ var LOI_URL = "https://cdn.jsdelivr.net/npm/xvai-loi@0.1.34/nap.js";
18938
18966
  var TRONG_LOI = !!globalThis.__xvaiReact;
18939
18967
  try {
18940
18968
  if (!TRONG_LOI) setTimeout(() => {
@@ -18964,7 +18992,7 @@ function datCauLenh(a) {
18964
18992
  on2 = true;
18965
18993
  window.addEventListener("message", async (ev) => {
18966
18994
  const d = ev.data;
18967
- if (!d || d.xvaiLoi092321 !== true) return;
18995
+ if (!d || d.xvaiLoi100001 !== true) return;
18968
18996
  const o = String(ev.origin || "");
18969
18997
  if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
18970
18998
  const tra = (kq) => {
@@ -19116,15 +19144,15 @@ var SuaLich = ({ ten, onDong }) => {
19116
19144
  if (!ds2.length) return /* @__PURE__ */ shim_react_default.createElement("div", { className: "rounded-xl border border-[#2C4A73] p-4 text-[12px]" }, 'Ch\u01B0a c\xF3 l\u1ECBch d\u1EF1ng \u2014 b\u1EA5m "L\xE0m pro" m\u1ED9t l\u1EA7n r\u1ED3i quay l\u1EA1i \u0111\xE2y. ', /* @__PURE__ */ shim_react_default.createElement("button", { className: nut3, onClick: onDong }, "\u0110\xF3ng"));
19117
19145
  return /* @__PURE__ */ shim_react_default.createElement("div", { className: "rounded-xl border border-[#F6D178]/60 p-3 text-[12px] bg-[#0E2240]" }, /* @__PURE__ */ shim_react_default.createElement("div", { className: "flex items-center gap-2 mb-2" }, /* @__PURE__ */ shim_react_default.createElement("span", { className: "font-black text-[#F6D178]" }, "S\u1EECA L\u1ECACH D\u1EF0NG \xB7 ", ds2.length, " c\u1EA3nh"), /* @__PURE__ */ shim_react_default.createElement("span", { className: "text-[#A2B2C9] flex-1" }, bao), /* @__PURE__ */ shim_react_default.createElement("button", { className: nut3, onClick: luu }, "L\u01B0u"), /* @__PURE__ */ shim_react_default.createElement("button", { className: nut3 + " bg-[#F6D178] text-[#122238]", onClick: veLai }, "V\u1EBD l\u1EA1i"), /* @__PURE__ */ shim_react_default.createElement("button", { className: nut3, onClick: xoaHet }, "B\u1ECF s\u1EEDa"), /* @__PURE__ */ shim_react_default.createElement("button", { className: nut3, onClick: () => {
19118
19146
  setDs(G.__lichSp || []);
19119
- } }, "N\u1EA1p l\u1EA1i"), /* @__PURE__ */ shim_react_default.createElement("button", { className: nut3, onClick: onDong }, "\u0110\xF3ng")), /* @__PURE__ */ shim_react_default.createElement("div", { className: "max-h-[60vh] overflow-auto" }, /* @__PURE__ */ shim_react_default.createElement("table", { className: "w-full text-[11px]" }, /* @__PURE__ */ shim_react_default.createElement("thead", null, /* @__PURE__ */ shim_react_default.createElement("tr", { className: "text-[#A2B2C9]" }, /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "#"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "gi\xE2y"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "b\u1ED1 c\u1EE5c"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "ch\u1EEF nh\u1EA5n"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "ch\u1EEF ph\u1EE5"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "icon"), /* @__PURE__ */ shim_react_default.createElement("th", null, "xo\xE1"))), /* @__PURE__ */ shim_react_default.createElement("tbody", null, ds2.map((s) => {
19120
- const e = sua[s.i] || {};
19147
+ } }, "N\u1EA1p l\u1EA1i"), /* @__PURE__ */ shim_react_default.createElement("button", { className: nut3, onClick: onDong }, "\u0110\xF3ng")), /* @__PURE__ */ shim_react_default.createElement("div", { className: "max-h-[60vh] overflow-auto" }, /* @__PURE__ */ shim_react_default.createElement("table", { className: "w-full text-[11px]" }, /* @__PURE__ */ shim_react_default.createElement("thead", null, /* @__PURE__ */ shim_react_default.createElement("tr", { className: "text-[#A2B2C9]" }, /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "#"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "gi\xE2y"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "b\u1ED1 c\u1EE5c"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "\u0111\u1EA7u/d\xE0i (s)"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "ch\u1EEF nh\u1EA5n"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "ch\u1EEF ph\u1EE5"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "icon"), /* @__PURE__ */ shim_react_default.createElement("th", { className: "text-left" }, "\u1EA3nh (t\xEAn kho)"), /* @__PURE__ */ shim_react_default.createElement("th", null, "xo\xE1"))), /* @__PURE__ */ shim_react_default.createElement("tbody", null, ds2.map((s) => {
19148
+ const e = sua[s.id] || sua[s.i] || {};
19121
19149
  const v = (k) => (typeof e[k] === "string" ? e[k] : s[k]) || "";
19122
- return /* @__PURE__ */ shim_react_default.createElement("tr", { key: s.i, className: e.xoa ? "opacity-40" : s.khoa ? "bg-[#1E3A5F]/40" : "" }, /* @__PURE__ */ shim_react_default.createElement("td", null, s.i), /* @__PURE__ */ shim_react_default.createElement("td", null, s.f.toFixed(1), "\u2013", (s.f + s.d).toFixed(1)), /* @__PURE__ */ shim_react_default.createElement("td", null, s.bo), /* @__PURE__ */ shim_react_default.createElement("td", null, /* @__PURE__ */ shim_react_default.createElement("input", { className: "w-full bg-[#0B1A2D] border border-[#2C4A73] rounded px-1", value: v("giant"), onChange: (ev) => dat(s.i, "giant", ev.target.value) })), /* @__PURE__ */ shim_react_default.createElement("td", null, /* @__PURE__ */ shim_react_default.createElement("input", { className: "w-full bg-[#0B1A2D] border border-[#2C4A73] rounded px-1", value: v("chu2") || v("chu"), onChange: (ev) => dat(s.i, s.chu2 || !s.chu ? "chu2" : "chu", ev.target.value) })), /* @__PURE__ */ shim_react_default.createElement("td", null, /* @__PURE__ */ shim_react_default.createElement("input", { className: "w-20 bg-[#0B1A2D] border border-[#2C4A73] rounded px-1", value: v("st"), onChange: (ev) => dat(s.i, "st", ev.target.value), placeholder: "tich/luu\u2026" })), /* @__PURE__ */ shim_react_default.createElement("td", { className: "text-center" }, /* @__PURE__ */ shim_react_default.createElement("input", { type: "checkbox", checked: !!e.xoa, onChange: (ev) => dat(s.i, "xoa", ev.target.checked ? 1 : 0) })));
19150
+ return /* @__PURE__ */ shim_react_default.createElement("tr", { key: s.id || s.i, className: e.xoa ? "opacity-40" : s.khoa ? "bg-[#1E3A5F]/40" : "" }, /* @__PURE__ */ shim_react_default.createElement("td", null, s.i), /* @__PURE__ */ shim_react_default.createElement("td", null, s.f.toFixed(1), "\u2013", (s.f + s.d).toFixed(1)), /* @__PURE__ */ shim_react_default.createElement("td", null, s.bo), /* @__PURE__ */ shim_react_default.createElement("td", { className: "whitespace-nowrap" }, /* @__PURE__ */ shim_react_default.createElement("input", { className: "w-12 bg-[#0B1A2D] border border-[#2C4A73] rounded px-1", value: typeof e.f === "number" ? e.f : s.f, onChange: (ev) => dat(s.id || String(s.i), "f", +ev.target.value), type: "number", step: "0.1" }), " ", /* @__PURE__ */ shim_react_default.createElement("input", { className: "w-12 bg-[#0B1A2D] border border-[#2C4A73] rounded px-1", value: typeof e.d === "number" ? e.d : s.d, onChange: (ev) => dat(s.id || String(s.i), "d", +ev.target.value), type: "number", step: "0.1", min: "0.4" })), /* @__PURE__ */ shim_react_default.createElement("td", null, /* @__PURE__ */ shim_react_default.createElement("input", { className: "w-full bg-[#0B1A2D] border border-[#2C4A73] rounded px-1", value: v("giant"), onChange: (ev) => dat(s.id || String(s.i), "giant", ev.target.value) })), /* @__PURE__ */ shim_react_default.createElement("td", null, /* @__PURE__ */ shim_react_default.createElement("input", { className: "w-full bg-[#0B1A2D] border border-[#2C4A73] rounded px-1", value: v("chu2") || v("chu"), onChange: (ev) => dat(s.id || String(s.i), s.chu2 || !s.chu ? "chu2" : "chu", ev.target.value) })), /* @__PURE__ */ shim_react_default.createElement("td", null, /* @__PURE__ */ shim_react_default.createElement("input", { className: "w-20 bg-[#0B1A2D] border border-[#2C4A73] rounded px-1", value: v("st"), onChange: (ev) => dat(s.id || String(s.i), "st", ev.target.value), placeholder: "tich/luu\u2026" })), /* @__PURE__ */ shim_react_default.createElement("td", null, /* @__PURE__ */ shim_react_default.createElement("input", { className: "w-24 bg-[#0B1A2D] border border-[#2C4A73] rounded px-1", value: v("ten"), onChange: (ev) => dat(s.id || String(s.i), "ten", ev.target.value), placeholder: "trang:\u2026 / anh:\u2026" })), /* @__PURE__ */ shim_react_default.createElement("td", { className: "text-center" }, /* @__PURE__ */ shim_react_default.createElement("input", { type: "checkbox", checked: !!e.xoa, onChange: (ev) => dat(s.id || String(s.i), "xoa", ev.target.checked ? 1 : 0) })));
19123
19151
  })))), /* @__PURE__ */ shim_react_default.createElement("div", { className: "text-[#A2B2C9] mt-2" }, "Ch\u1EEF nh\u1EA5n xu\u1ED1ng d\xF2ng: g\xF5 \\n. Icon: tich, luu, chuot, sao, tim, dong-ho\u2026 (t\xEAn trong veSticker). S\u1EEDa xong b\u1EA5m V\u1EBD l\u1EA1i (~2\u20135 ph\xFAt)."));
19124
19152
  };
19125
19153
 
19126
19154
  // loi/vo-flow.tsx
19127
- var PHIEN_BAN = "loi-0910K";
19155
+ var PHIEN_BAN = "loi-0910M";
19128
19156
  var TRONG = () => migrateProject({ id: crypto.randomUUID(), name: "D\u1EF1 \xE1n m\u1EDBi", scenes: [], timeline: [], images: [null, null, null] });
19129
19157
  var nut4 = "px-3 py-1.5 rounded-lg border border-[#2C4A73] text-[11px] font-bold text-[#A2B2C9] hover:text-[#F6D178] hover:border-[#F6D178]/60";
19130
19158
  var Vo = () => {