your-ai-workflow-firebase-os 1.2.50 → 1.2.51

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.
@@ -45703,32 +45703,107 @@ function RW({ value: e, options: t, onChange: n, label: r, disabled: i, variant:
45703
45703
  ]
45704
45704
  });
45705
45705
  }
45706
+ var zW = /^image\/(jpe?g|png|webp)$/i, BW = [
45707
+ .82,
45708
+ .65,
45709
+ .5
45710
+ ], VW = () => {
45711
+ try {
45712
+ let e = document.createElement("canvas");
45713
+ return e.width = 1, e.height = 1, e.toDataURL("image/webp").startsWith("data:image/webp");
45714
+ } catch {
45715
+ return !1;
45716
+ }
45717
+ }, HW = async (e) => {
45718
+ if (typeof createImageBitmap == "function") {
45719
+ let t = await createImageBitmap(e);
45720
+ return {
45721
+ source: t,
45722
+ width: t.width,
45723
+ height: t.height,
45724
+ done: () => t.close?.()
45725
+ };
45726
+ }
45727
+ let t = URL.createObjectURL(e);
45728
+ try {
45729
+ let e = await new Promise((e, n) => {
45730
+ let r = new Image();
45731
+ r.onload = () => e(r), r.onerror = () => n(/* @__PURE__ */ Error("That picture could not be read.")), r.src = t;
45732
+ });
45733
+ return {
45734
+ source: e,
45735
+ width: e.naturalWidth,
45736
+ height: e.naturalHeight,
45737
+ done: () => URL.revokeObjectURL(t)
45738
+ };
45739
+ } catch (e) {
45740
+ throw URL.revokeObjectURL(t), e;
45741
+ }
45742
+ }, UW = (e, t, n) => new Promise((r) => {
45743
+ if (typeof e.toBlob != "function") {
45744
+ r(null);
45745
+ return;
45746
+ }
45747
+ e.toBlob((e) => r(e), t, n);
45748
+ }), WW = (e, t) => {
45749
+ let n = t === "image/webp" ? "webp" : t === "image/png" ? "png" : "jpg";
45750
+ return `${(e || "image").replace(/\.[^.]+$/, "") || "image"}.${n}`;
45751
+ };
45752
+ async function GW(e, t = {}) {
45753
+ let n = t.maxSide ?? 1600, r = t.targetBytes ?? 921600;
45754
+ if (!e || !zW.test(e.type || "") || e.size <= 153600 || typeof document > "u") return e;
45755
+ try {
45756
+ let { source: t, width: i, height: a, done: o } = await HW(e);
45757
+ try {
45758
+ if (!i || !a) return e;
45759
+ let o = Math.min(1, n / Math.max(i, a)), s = document.createElement("canvas");
45760
+ s.width = Math.max(1, Math.round(i * o)), s.height = Math.max(1, Math.round(a * o));
45761
+ let c = s.getContext("2d");
45762
+ if (!c) return e;
45763
+ c.drawImage(t, 0, 0, s.width, s.height);
45764
+ let l = /png$/i.test(e.type), u = VW() ? "image/webp" : l ? "image/png" : "image/jpeg", d = null;
45765
+ for (let e of BW) {
45766
+ let t = await UW(s, u, e);
45767
+ if (!t || (d = t, t.size <= r) || u === "image/png") break;
45768
+ }
45769
+ return !d || d.size >= e.size ? e : new File([d], WW(e.name, u), {
45770
+ type: u,
45771
+ lastModified: Date.now()
45772
+ });
45773
+ } finally {
45774
+ o();
45775
+ }
45776
+ } catch {
45777
+ return e;
45778
+ }
45779
+ }
45706
45780
  //#endregion
45707
45781
  //#region src/lib/assetUpload.ts
45708
- var zW = "pub_files", BW = (e) => `${Date.now()}_${(e || "file").replace(/[^a-zA-Z0-9.-]/g, "_")}`;
45709
- async function VW(e, t) {
45782
+ var KW = "pub_files", qW = (e) => `${Date.now()}_${(e || "file").replace(/[^a-zA-Z0-9.-]/g, "_")}`;
45783
+ async function JW(e, t) {
45710
45784
  if (!t) throw Error("Sign in again before uploading.");
45711
- let n = `${zW}/${BW(e.name)}`, r = k(we, n);
45712
- await se(r, e, { customMetadata: { ownerId: t.uid } });
45713
- let i = await ae(r);
45714
- return await y(b(Ce, zW), {
45715
- fileName: e.name,
45716
- fileType: e.type || "unknown",
45717
- fileSize: e.size,
45718
- downloadURL: i,
45719
- storagePath: n,
45785
+ let n = await GW(e), r = `${KW}/${qW(n.name)}`, i = k(we, r);
45786
+ await se(i, n, { customMetadata: { ownerId: t.uid } });
45787
+ let a = await ae(i);
45788
+ return await y(b(Ce, KW), {
45789
+ fileName: n.name,
45790
+ fileType: n.type || "unknown",
45791
+ fileSize: n.size,
45792
+ downloadURL: a,
45793
+ storagePath: r,
45720
45794
  uid: t.uid,
45721
45795
  uploaderEmail: t.email || "",
45722
45796
  createdAt: ee()
45723
- }), i;
45797
+ }), a;
45724
45798
  }
45725
- var HW = "pub_form_uploads";
45726
- async function UW(e, t) {
45727
- if (e.size >= 10485760) throw Error("That file is over 10 MB. Try a smaller one.");
45728
- let n = Math.random().toString(36).slice(2, 8), r = k(we, `${HW}/${Date.now()}_${n}_${(e.name || "file").replace(/[^a-zA-Z0-9.-]/g, "_")}`);
45729
- return await se(r, e, t ? { customMetadata: { ownerId: t.uid } } : void 0), ae(r);
45799
+ var YW = "pub_form_uploads";
45800
+ async function XW(e, t) {
45801
+ let n = await GW(e);
45802
+ if (n.size >= 10485760) throw Error("That file is over 10 MB. Try a smaller one.");
45803
+ let r = Math.random().toString(36).slice(2, 8), i = k(we, `${YW}/${Date.now()}_${r}_${(n.name || "file").replace(/[^a-zA-Z0-9.-]/g, "_")}`);
45804
+ return await se(i, n, t ? { customMetadata: { ownerId: t.uid } } : void 0), ae(i);
45730
45805
  }
45731
- function WW(e) {
45806
+ function ZW(e) {
45732
45807
  try {
45733
45808
  let t = new URL(e);
45734
45809
  return (decodeURIComponent(t.pathname.split("/o/")[1] || t.pathname).split("/").pop() || "").replace(/^\d+_[a-z0-9]+_/, "") || t.hostname || "Attached file";
@@ -45736,15 +45811,15 @@ function WW(e) {
45736
45811
  return "Attached file";
45737
45812
  }
45738
45813
  }
45739
- var GW = (e) => e?.code === "storage/unauthorized" ? "You do not have permission to upload here." : e?.message || "That upload did not work. Try again.", KW = t.lazy(() => import("./PhoneInputField-OdtJcL6V.js").then((e) => e.n)), qW = /^[^\s@,;]+@[^\s@,;.]+(\.[^\s@,;.]+)*\.[a-z]{2,}$/i;
45740
- function JW({ field: e, value: t, error: n, onChange: r }) {
45814
+ var QW = (e) => e?.code === "storage/unauthorized" ? "You do not have permission to upload here." : e?.message || "That upload did not work. Try again.", $W = t.lazy(() => import("./PhoneInputField-DZFhNM2v.js").then((e) => e.n)), eG = /^[^\s@,;]+@[^\s@,;.]+(\.[^\s@,;.]+)*\.[a-z]{2,}$/i;
45815
+ function tG({ field: e, value: t, error: n, onChange: r }) {
45741
45816
  let [i, a] = v(!1), [o, s] = v(""), c = _(null), l = async (e) => {
45742
45817
  if (!(!e || i)) {
45743
45818
  a(!0), s("");
45744
45819
  try {
45745
- r(await UW(e, Se.currentUser));
45820
+ r(await XW(e, Se.currentUser));
45746
45821
  } catch (e) {
45747
- s(e?.code === "storage/unauthorized" ? "That kind of file is not accepted. Try a PDF, a document or a picture." : GW(e));
45822
+ s(e?.code === "storage/unauthorized" ? "That kind of file is not accepted. Try a PDF, a document or a picture." : QW(e));
45748
45823
  }
45749
45824
  a(!1), c.current && (c.current.value = "");
45750
45825
  }
@@ -45763,7 +45838,7 @@ function JW({ field: e, value: t, error: n, onChange: r }) {
45763
45838
  i ? /* @__PURE__ */ A(I, { className: "w-4 h-4 animate-spin text-accent shrink-0" }) : /* @__PURE__ */ A(jx, { className: `w-4 h-4 shrink-0 ${t ? "text-accent" : "text-foreground/40"}` }),
45764
45839
  /* @__PURE__ */ A("span", {
45765
45840
  className: `flex-1 min-w-0 truncate text-[15px] ${t ? "text-foreground" : "text-foreground/40"}`,
45766
- children: i ? "Uploading..." : t ? WW(t) : e.placeholder || "Attach a file"
45841
+ children: i ? "Uploading..." : t ? ZW(t) : e.placeholder || "Attach a file"
45767
45842
  }),
45768
45843
  !i && /* @__PURE__ */ j("span", {
45769
45844
  className: "inline-flex items-center gap-1.5 text-[12.5px] font-bold text-foreground/60 shrink-0",
@@ -45799,7 +45874,7 @@ function JW({ field: e, value: t, error: n, onChange: r }) {
45799
45874
  ]
45800
45875
  });
45801
45876
  }
45802
- function YW({ onClose: e, formId: t, formConfig: n, isInline: r }) {
45877
+ function nG({ onClose: e, formId: t, formConfig: n, isInline: r }) {
45803
45878
  let [i, o] = v({}), [s, c] = v("idle"), [l, u] = v(""), [d, p] = v({}), m = _(null), [h, g] = v(n || null), [C, w] = v(!n), T = M(), E = Pe(), D = (e) => {
45804
45879
  let t = (typeof window < "u" ? window.__FBOS_FORMS__ : null) || {};
45805
45880
  return E?.defaultConfigs?.[e] || E?.defaultConfigs?.[`${e}Form`] || t[e] || (e === "contact" ? _e : e === "support" ? ye : null);
@@ -45873,7 +45948,7 @@ function YW({ onClose: e, formId: t, formConfig: n, isInline: r }) {
45873
45948
  let a = (h?.fields || []).filter((e) => e.type === "email"), s = {}, l = {};
45874
45949
  if (a.forEach((e) => {
45875
45950
  let t = String(i[e.name] ?? "").trim();
45876
- t && (l[e.name] = t, qW.test(t) || (s[e.name] = "That does not look like an email address — check for a typo, e.g. jane@example.com"));
45951
+ t && (l[e.name] = t, eG.test(t) || (s[e.name] = "That does not look like an email address — check for a typo, e.g. jane@example.com"));
45877
45952
  }), (h?.fields || []).filter((e) => e.type === "file" && e.required && !i[e.name]).forEach((e) => {
45878
45953
  s[e.name] = "Please attach a file before sending.";
45879
45954
  }), Object.keys(s).length > 0) {
@@ -46009,7 +46084,7 @@ function YW({ onClose: e, formId: t, formConfig: n, isInline: r }) {
46009
46084
  }).map((e, t) => {
46010
46085
  if (e.type === "tel") return /* @__PURE__ */ A(a, {
46011
46086
  fallback: /* @__PURE__ */ A("div", { className: "h-12 w-full glass-panel animate-pulse rounded-xl" }),
46012
- children: /* @__PURE__ */ A(KW, {
46087
+ children: /* @__PURE__ */ A($W, {
46013
46088
  field: e,
46014
46089
  value: i[e.name] || "",
46015
46090
  onChange: (t) => o({
@@ -46018,7 +46093,7 @@ function YW({ onClose: e, formId: t, formConfig: n, isInline: r }) {
46018
46093
  })
46019
46094
  })
46020
46095
  }, t);
46021
- if (e.type === "file") return /* @__PURE__ */ A(JW, {
46096
+ if (e.type === "file") return /* @__PURE__ */ A(tG, {
46022
46097
  field: e,
46023
46098
  value: i[e.name] || "",
46024
46099
  error: d[e.name],
@@ -46240,4 +46315,4 @@ function YW({ onClose: e, formId: t, formConfig: n, isInline: r }) {
46240
46315
  }), document.body);
46241
46316
  }
46242
46317
  //#endregion
46243
- export { hg as $, Zw as A, bn as At, Bv as B, Ce as Bt, sA as C, Qo as Ct, cO as D, Ln as Dt, TO as E, Yr as Et, TS as F, Re as Ft, x_ as G, ve as Gt, X_ as H, we as Ht, Vx as I, ze as It, $g as J, pe as Jt, y_ as K, _e as Kt, jx as L, Ne as Lt, zw as M, fn as Mt, KC as N, qt as Nt, _T as O, An as Ot, pC as P, Ut as Pt, Eg as Q, cx as R, Pe as Rt, SA as S, as as St, Rk as T, $a as Tt, Y_ as U, be as Ut, uv as V, Ee as Vt, I as W, ye as Wt, Xg as X, Zg as Y, Dg as Z, eM as _, Ps as _t, VW as a, $d as at, WA as b, us as bt, PW as c, bd as ct, cU as d, Jl as dt, fg as et, oU as f, xl as ft, nM as g, nc as gt, vM as h, sc as ht, GW as i, Mf as it, Hw as j, gn as jt, oT as k, wn as kt, MW as l, ed as lt, yM as m, Yc as mt, HW as n, Bm as nt, RW as o, Nd as ot, uV as p, hl as pt, n_ as q, ge as qt, WW as r, Vf as rt, IW as s, Md as st, YW as t, gh as tt, uU as u, xu as ut, bj as v, ws as vt, zk as w, no as wt, HA as x, ls as xt, aj as y, ds as yt, Jy as z, Se as zt };
46318
+ export { Eg as $, oT as A, wn as At, Jy as B, Se as Bt, SA as C, as as Ct, TO as D, Yr as Dt, Rk as E, $a as Et, pC as F, Ut as Ft, I as G, ye as Gt, uv as H, Ee as Ht, TS as I, Re as It, n_ as J, ge as Jt, x_ as K, ve as Kt, Vx as L, ze as Lt, Hw as M, gn as Mt, zw as N, fn as Nt, cO as O, Ln as Ot, KC as P, qt as Pt, Dg as Q, jx as R, Ne as Rt, HA as S, ls as St, zk as T, no as Tt, X_ as U, we as Ut, Bv as V, Ce as Vt, Y_ as W, be as Wt, Zg as X, $g as Y, pe as Yt, Xg as Z, nM as _, nc as _t, JW as a, Mf as at, aj as b, ds as bt, IW as c, Md as ct, uU as d, xu as dt, hg as et, cU as f, Jl as ft, vM as g, sc as gt, yM as h, Yc as ht, QW as i, Vf as it, Zw as j, bn as jt, _T as k, An as kt, PW as l, bd as lt, uV as m, hl as mt, YW as n, gh as nt, GW as o, $d as ot, oU as p, xl as pt, y_ as q, _e as qt, ZW as r, Bm as rt, RW as s, Nd as st, nG as t, fg as tt, MW as u, ed as ut, eM as v, Ps as vt, sA as w, Qo as wt, WA as x, us as xt, bj as y, ws as yt, cx as z, Pe as zt };