@getpinax/widget 1.0.0-beta.1 → 1.0.0-beta.2

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.
@@ -1,5 +1,5 @@
1
- import { r as e, s as t } from "./widget-CkR1Ptzb.mjs";
2
- import { a as n, i as r, n as i, r as a, t as o } from "./privacy-DmU6v5Fr.mjs";
1
+ import { c as e, r as t } from "./widget-BpTBdX2R.mjs";
2
+ import { a as n, i as r, n as i, r as a, t as o } from "./privacy-B_b1_Y1n.mjs";
3
3
  // src/editor/shapes.ts
4
4
  var s = "#FF5C35", c = "#CC3F1B";
5
5
  function l(e) {
@@ -78,27 +78,27 @@ var g = "\n.ed { position: fixed; inset: 0; z-index: 10; display: flex; flex-dir
78
78
  ["text", "Text"],
79
79
  ["blur", "Blur"]
80
80
  ], v = 6;
81
- function y(t, n, r, i = []) {
81
+ function y(e, n, r, i = []) {
82
82
  return new Promise((a) => {
83
- let o = n.width, s = n.height, c = r ? r.shapes.map((e) => ({ ...e })) : [], u = r?.area ? { ...r.area } : null, f = "box", y = u ? "area" : "full", x = null, S = null, C = null, w = t.activeElement, T = e("style");
83
+ let o = n.width, s = n.height, c = r ? r.shapes.map((e) => ({ ...e })) : [], u = r?.area ? { ...r.area } : null, f = "box", y = u ? "area" : "full", x = null, S = null, C = null, w = e.activeElement, T = t("style");
84
84
  T.textContent = g;
85
- let E = e("div", {
85
+ let E = t("div", {
86
86
  class: "ed-sr",
87
87
  role: "status",
88
88
  "aria-live": "polite"
89
89
  }), D = (e) => {
90
90
  E.textContent = e;
91
- }, O = e("canvas", {
91
+ }, O = t("canvas", {
92
92
  class: "ed-cv",
93
93
  width: o,
94
94
  height: s,
95
95
  tabindex: 0,
96
96
  role: "img"
97
- }), k = O.getContext("2d"), A = (t, n = "ed-t", r = {}) => e("button", {
97
+ }), k = O.getContext("2d"), A = (e, n = "ed-t", r = {}) => t("button", {
98
98
  type: "button",
99
99
  class: n,
100
100
  ...r
101
- }, t), j = A("Whole screen", "ed-t", { "aria-pressed": "true" }), M = A("Select area", "ed-t", { "aria-pressed": "false" }), N = _.map(([e, t]) => {
101
+ }, e), j = A("Whole screen", "ed-t", { "aria-pressed": "true" }), M = A("Select area", "ed-t", { "aria-pressed": "false" }), N = _.map(([e, t]) => {
102
102
  let n = A(t, "ed-t", {
103
103
  "aria-pressed": "false",
104
104
  "data-tool": e
@@ -106,13 +106,13 @@ function y(t, n, r, i = []) {
106
106
  return n.addEventListener("click", () => {
107
107
  f = e, R = !1, u || (y = "full"), H();
108
108
  }), n;
109
- }), P = A("Undo"), F = A("Clear"), I = A("Cancel"), te = A("Done", "ed-t ed-done"), ne = e("p", {
109
+ }), P = A("Undo"), F = A("Clear"), I = A("Cancel"), te = A("Done", "ed-t ed-done"), ne = t("p", {
110
110
  class: "ed-hint",
111
111
  id: "pnx-ed-hint"
112
- }), L = i.length ? e("p", {
112
+ }), L = i.length ? t("p", {
113
113
  class: "ed-auto",
114
114
  id: "pnx-ed-auto"
115
- }, e("i", { "aria-hidden": "true" }), `${i.length === 1 ? "1 private detail was" : `${i.length} private details were`} blurred automatically (outlined). They stay blurred.`) : null;
115
+ }, t("i", { "aria-hidden": "true" }), `${i.length === 1 ? "1 private detail was" : `${i.length} private details were`} blurred automatically (outlined). They stay blurred.`) : null;
116
116
  O.setAttribute("aria-describedby", L ? "pnx-ed-hint pnx-ed-auto" : "pnx-ed-hint");
117
117
  let R = !1;
118
118
  j.addEventListener("click", () => {
@@ -124,25 +124,25 @@ function y(t, n, r, i = []) {
124
124
  }), F.addEventListener("click", () => {
125
125
  c.length = 0, D("All marks cleared."), H();
126
126
  });
127
- let re = e("div", {
127
+ let re = t("div", {
128
128
  class: "ed-bar",
129
129
  role: "toolbar",
130
130
  "aria-label": "Screenshot tools"
131
- }, e("div", {
131
+ }, t("div", {
132
132
  class: "ed-grp",
133
133
  role: "group",
134
134
  "aria-label": "Capture"
135
- }, j, M), e("span", {
135
+ }, j, M), t("span", {
136
136
  class: "ed-sep",
137
137
  "aria-hidden": "true"
138
- }), e("div", {
138
+ }), t("div", {
139
139
  class: "ed-grp",
140
140
  role: "group",
141
141
  "aria-label": "Draw"
142
- }, ...N), e("span", {
142
+ }, ...N), t("span", {
143
143
  class: "ed-sep",
144
144
  "aria-hidden": "true"
145
- }), e("div", { class: "ed-grp" }, P, F), e("span", { class: "ed-sp" }), e("div", { class: "ed-grp" }, I, te)), z = e("div", { class: "ed-stage" }, O), B = e("div", {
145
+ }), t("div", { class: "ed-grp" }, P, F), t("span", { class: "ed-sp" }), t("div", { class: "ed-grp" }, I, te)), z = t("div", { class: "ed-stage" }, O), B = t("div", {
146
146
  class: "ed",
147
147
  role: "dialog",
148
148
  "aria-modal": "true",
@@ -205,26 +205,26 @@ function y(t, n, r, i = []) {
205
205
  function G(e) {
206
206
  c.push(l(e)), D(`${e.type === "blur" ? "Blurred area" : e.type[0].toUpperCase() + e.type.slice(1)} added.`), H();
207
207
  }
208
- function K(t, n) {
208
+ function K(e, n) {
209
209
  C?.remove();
210
- let r = e("input", {
210
+ let r = t("input", {
211
211
  class: "ed-txt",
212
212
  type: "text",
213
213
  maxlength: 120,
214
214
  "aria-label": "Label text",
215
215
  placeholder: "Type a label, then Enter",
216
216
  autocomplete: "off"
217
- }), i = O.getBoundingClientRect(), a = z.getBoundingClientRect(), c = i.left - a.left + t / o * i.width, l = i.top - a.top + n / s * i.height;
217
+ }), i = O.getBoundingClientRect(), a = z.getBoundingClientRect(), c = i.left - a.left + e / o * i.width, l = i.top - a.top + n / s * i.height;
218
218
  r.style.left = `${Math.min(c, a.width - 170)}px`, r.style.top = `${Math.min(l, a.height - 40)}px`;
219
- let u = !1, f = (e) => {
219
+ let u = !1, f = (t) => {
220
220
  if (u) return;
221
221
  u = !0;
222
222
  let i = r.value.trim();
223
- if (r.remove(), C = null, e && i) {
224
- let e = d(o, s), r = p(k, i, e);
223
+ if (r.remove(), C = null, t && i) {
224
+ let t = d(o, s), r = p(k, i, t);
225
225
  G({
226
226
  type: "text",
227
- x: se(t, r.w),
227
+ x: se(e, r.w),
228
228
  y: W(n, r.h),
229
229
  w: r.w,
230
230
  h: r.h,
@@ -322,17 +322,17 @@ function y(t, n, r, i = []) {
322
322
  });
323
323
  }
324
324
  I.addEventListener("click", () => J(null)), te.addEventListener("click", le);
325
- function ue(e) {
326
- if (e.key === "Escape") e.preventDefault(), e.stopPropagation(), J(null);
327
- else if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "z") e.preventDefault(), c.pop() && D("Last mark removed."), H();
328
- else if (e.key === "Tab") {
325
+ function ue(t) {
326
+ if (t.key === "Escape") t.preventDefault(), t.stopPropagation(), J(null);
327
+ else if ((t.metaKey || t.ctrlKey) && t.key.toLowerCase() === "z") t.preventDefault(), c.pop() && D("Last mark removed."), H();
328
+ else if (t.key === "Tab") {
329
329
  let n = [...B.querySelectorAll("button:not(:disabled), canvas, input")];
330
330
  if (!n.length) return;
331
- let r = n[0], i = n[n.length - 1], a = t.activeElement;
332
- e.shiftKey && a === r ? (e.preventDefault(), i.focus()) : !e.shiftKey && a === i && (e.preventDefault(), r.focus());
331
+ let r = n[0], i = n[n.length - 1], a = e.activeElement;
332
+ t.shiftKey && a === r ? (t.preventDefault(), i.focus()) : !t.shiftKey && a === i && (t.preventDefault(), r.focus());
333
333
  }
334
334
  }
335
- B.addEventListener("keydown", ue, !0), t.append(T, B), H(), N[0].focus();
335
+ B.addEventListener("keydown", ue, !0), e.append(T, B), H(), N[0].focus();
336
336
  });
337
337
  }
338
338
  function b(e) {
@@ -1319,8 +1319,8 @@ function Rt(e, t) {
1319
1319
  let n = document.createElement("canvas");
1320
1320
  return n.width = Math.max(1, Math.round(e.width * t)), n.height = Math.max(1, Math.round(e.height * t)), n.getContext("2d")?.drawImage(e, 0, 0, n.width, n.height), n;
1321
1321
  }
1322
- function zt(e, n = It) {
1323
- let r = e, i = "";
1322
+ function zt(t, n = It) {
1323
+ let r = t, i = "";
1324
1324
  for (let e = 0; e < 6; e++) {
1325
1325
  for (let e of [
1326
1326
  .85,
@@ -1332,7 +1332,7 @@ function zt(e, n = It) {
1332
1332
  }
1333
1333
  r = Rt(r, .75);
1334
1334
  }
1335
- if (Lt(i) > t.screenshotBytes || i.length > t.screenshotChars) throw Error("Screenshot too large");
1335
+ if (Lt(i) > e.screenshotBytes || i.length > e.screenshotChars) throw Error("Screenshot too large");
1336
1336
  return i;
1337
1337
  }
1338
1338
  // src/editor/index.ts
@@ -1365,4 +1365,4 @@ async function Vt(e, t) {
1365
1365
  }
1366
1366
  export { Vt as markUp, Bt as takeScreenshot };
1367
1367
 
1368
- //# sourceMappingURL=editor-DbHLGwOA.mjs.map
1368
+ //# sourceMappingURL=editor-0Kr31Uly.mjs.map
@@ -29,11 +29,11 @@ function a(e) {
29
29
  for (let i of t) n += e.slice(r, i.start) + "*".repeat(i.end - i.start), r = i.end;
30
30
  return n + e.slice(r);
31
31
  }
32
- var o = "(?:(?:full|your|first|last|guest|customer|client|contact|booking|patient|member|account|lead)\\s+name|name|customer|guest|client|booked by|card ?holder|account holder)", s = RegExp(`^${o}\\s*[::]?$`, "i"), c = RegExp(`^${o}\\s*[::]\\s*`, "i"), l = /\b(?:signed in as|logged in as|welcome back,?)\s+/i;
32
+ var o = (e) => RegExp(`^(?:(?:full|your|first|last|guest|customer|client|contact|booking|patient|member|account|lead)\\s+name|name|customer|guest|client|booked by|card ?holder|account holder)${e}`, "i"), s = /* @__PURE__ */ o("\\s*[::]?$"), c = /* @__PURE__ */ o("\\s*[::]\\s*"), l = /\b(?:signed in as|logged in as|welcome back,?)\s+/i;
33
33
  function u(e) {
34
34
  let t = e.trim();
35
35
  return t.length >= 2 && t.length <= 60 && /\p{L}/u.test(t) && t.split(/\s+/).length <= 5;
36
36
  }
37
37
  export { u as a, i, s as n, a as o, l as r, c as t };
38
38
 
39
- //# sourceMappingURL=privacy-DmU6v5Fr.mjs.map
39
+ //# sourceMappingURL=privacy-B_b1_Y1n.mjs.map
@@ -1,5 +1,5 @@
1
- import { o as e } from "./privacy-DmU6v5Fr.mjs";
2
- import { n as t } from "./text-8QYEyRYs.mjs";
1
+ import { o as e } from "./privacy-B_b1_Y1n.mjs";
2
+ import { a as t } from "./text-D9SaDBT0.mjs";
3
3
  // node_modules/@rrweb/record/dist/record.js
4
4
  var n = Object.defineProperty, r = (e, t, r) => t in e ? n(e, t, {
5
5
  enumerable: !0,
@@ -2763,62 +2763,77 @@ var jn = /* @__PURE__ */ new Set([
2763
2763
  "longdesc",
2764
2764
  "ping",
2765
2765
  "xlink:href"
2766
- ]), Mn = (e) => e === "style" || e === "_cssText" || e.startsWith("rr_");
2767
- function Nn(n, r) {
2766
+ ]), Mn = /* @__PURE__ */ new Set([
2767
+ "alt",
2768
+ "title",
2769
+ "placeholder",
2770
+ "label",
2771
+ "value",
2772
+ "summary",
2773
+ "abbr",
2774
+ "aria-label",
2775
+ "aria-description",
2776
+ "aria-roledescription",
2777
+ "aria-valuetext",
2778
+ "aria-placeholder"
2779
+ ]), Nn = (e) => e === "style" || e === "_cssText" || e.startsWith("rr_");
2780
+ function Pn(n, r) {
2768
2781
  let i = n.trim();
2769
2782
  return !i || /^(data|blob):/i.test(i) ? n : i.startsWith("#") ? "#" : e(t(i, r));
2770
2783
  }
2771
- function Pn(e, t) {
2784
+ function Fn(e, t) {
2772
2785
  return e.split(",").map((e) => {
2773
2786
  let [n, ...r] = e.trim().split(/\s+/);
2774
- return n ? [Nn(n, t), ...r].join(" ") : e;
2787
+ return n ? [Pn(n, t), ...r].join(" ") : e;
2775
2788
  }).join(", ");
2776
2789
  }
2777
- function Fn(t, n, r) {
2778
- let i = {}, a = n?.toLowerCase() === "input" && String(t.type ?? "").toLowerCase() === "hidden";
2790
+ function In(t, n, r, i = !1) {
2791
+ let a = {}, o = n?.toLowerCase() === "input" && String(t.type ?? "").toLowerCase() === "hidden";
2779
2792
  for (let n in t) {
2780
- let o = t[n], s = n.toLowerCase();
2781
- a && s === "value" || (i[n] = typeof o != "string" || Mn(s) ? o : jn.has(s) ? Nn(o, r) : s === "srcset" ? Pn(o, r) : e(o));
2793
+ let s = t[n], c = n.toLowerCase();
2794
+ o && c === "value" || (a[n] = typeof s != "string" || Nn(c) ? s : jn.has(c) ? Pn(s, r) : c === "srcset" ? Fn(s, r) : i && Mn.has(c) ? s.replace(/\S/g, "*") : e(s));
2782
2795
  }
2783
- return i;
2796
+ return a;
2784
2797
  }
2785
- function In(e, t = typeof location > "u" ? void 0 : location.href) {
2786
- return JSON.stringify(e, function(e, n) {
2787
- if (e === "attributes" && n && typeof n == "object" && !Array.isArray(n)) return Fn(n, this.tagName, t);
2788
- if (e === "data" && this.type === 4 && n && typeof n == "object" && typeof n.href == "string") {
2789
- let e = n;
2798
+ function Ln(e, t = typeof location > "u" ? void 0 : location.href, n = {}) {
2799
+ return JSON.stringify(e, function(e, r) {
2800
+ if (e === "attributes" && r && typeof r == "object" && !Array.isArray(r)) return In(r, this.tagName, t, n.maskText === !0);
2801
+ if (e === "data" && this.type === 4 && r && typeof r == "object" && typeof r.href == "string") {
2802
+ let e = r;
2790
2803
  return {
2791
2804
  ...e,
2792
- href: Nn(e.href, t)
2805
+ href: Pn(e.href, t)
2793
2806
  };
2794
2807
  }
2795
- return n;
2808
+ return r;
2796
2809
  });
2797
2810
  }
2798
2811
  // src/replay/recorder.ts
2799
- var Ln = 3e4, Rn = 1e4, zn = "[contenteditable]:not([contenteditable=false])";
2800
- function Bn(t = {}) {
2801
- let n = new On(Ln), r = Dn({
2812
+ var Rn = 3e4, zn = 1e4, Bn = "[contenteditable]:not([contenteditable=false])", Vn = "img,picture,video,canvas,iframe", Hn = (e) => e.replace(/\S/g, "*");
2813
+ function Un(t = {}) {
2814
+ let n = t.mask !== "inputs", r = new On(Rn), i = Dn({
2802
2815
  emit: (e) => {
2803
2816
  try {
2804
- n.push(e);
2817
+ r.push(e);
2805
2818
  } catch {}
2806
2819
  },
2807
- checkoutEveryNms: Rn,
2820
+ checkoutEveryNms: zn,
2808
2821
  maskAllInputs: !0,
2809
2822
  blockClass: "pinax-mask",
2810
2823
  blockSelector: [
2811
2824
  "[data-pinax-mask]",
2812
2825
  "input[type=hidden]",
2826
+ n ? Vn : "",
2813
2827
  t.exclude
2814
2828
  ].filter(Boolean).join(","),
2815
2829
  maskTextClass: "pinax-mask",
2816
2830
  maskTextSelector: "*",
2817
- maskTextFn: (t, n) => {
2831
+ maskTextFn: (t, r) => {
2832
+ if (n) return Hn(t);
2818
2833
  try {
2819
- return n?.closest?.(`${zn},[data-pinax-mask],.pinax-mask`) ? t.replace(/\S/g, "*") : e(t);
2834
+ return r?.closest?.(`${Bn},[data-pinax-mask],.pinax-mask`) ? Hn(t) : e(t);
2820
2835
  } catch {
2821
- return t.replace(/\S/g, "*");
2836
+ return Hn(t);
2822
2837
  }
2823
2838
  },
2824
2839
  slimDOMOptions: "all",
@@ -2835,25 +2850,25 @@ function Bn(t = {}) {
2835
2850
  });
2836
2851
  return {
2837
2852
  async exportReplay(e) {
2838
- let t = n.segmentCount;
2839
- for (let r = t; r >= 1; r--) {
2840
- let t = n.events(r);
2853
+ let t = r.segmentCount;
2854
+ for (let i = t; i >= 1; i--) {
2855
+ let t = r.events(i);
2841
2856
  if (!t.length) return null;
2842
- let i = await An(In(t));
2843
- if (!i) return null;
2844
- let a = kn(i);
2845
- if (a.length <= e) return a;
2857
+ let a = await An(Ln(t, void 0, { maskText: n }));
2858
+ if (!a) return null;
2859
+ let o = kn(a);
2860
+ if (o.length <= e) return o;
2846
2861
  }
2847
2862
  return null;
2848
2863
  },
2849
2864
  stop() {
2850
2865
  try {
2851
- r?.();
2866
+ i?.();
2852
2867
  } catch {}
2853
- n.clear();
2868
+ r.clear();
2854
2869
  }
2855
2870
  };
2856
2871
  }
2857
- export { Rn as CHECKOUT_MS, Ln as WINDOW_MS, Bn as startRecorder };
2872
+ export { zn as CHECKOUT_MS, Vn as MEDIA, Rn as WINDOW_MS, Un as startRecorder };
2858
2873
 
2859
- //# sourceMappingURL=recorder-BUtEB_em.mjs.map
2874
+ //# sourceMappingURL=recorder-tu4yugLw.mjs.map