easter-egg-quest 1.0.6 → 1.0.7

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.
@@ -3451,35 +3451,38 @@ const _ResultsRenderer = class _ResultsRenderer {
3451
3451
  }
3452
3452
  // ─── Combined copy & share ──────────────────────────────────────────
3453
3453
  _copyShareImage(s) {
3454
+ var _a2;
3454
3455
  const canvas = this._renderCard(s);
3455
- canvas.toBlob((blob) => {
3456
- var _a2;
3457
- if (!blob) return;
3458
- const isMobile = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent) && window.innerWidth < 768;
3459
- if (isMobile && navigator.share) {
3460
- const file = new File([blob], "easter-egg-quest.png", { type: "image/png" });
3461
- if ((_a2 = navigator.canShare) == null ? void 0 : _a2.call(navigator, { files: [file] })) {
3462
- navigator.share({
3463
- files: [file],
3464
- title: "Easter Egg Quest",
3465
- text: `«${s.behaviorProfile.title}»`
3466
- }).catch(() => {
3467
- });
3468
- return;
3469
- }
3470
- }
3471
- if (navigator.clipboard && typeof ClipboardItem !== "undefined") {
3472
- navigator.clipboard.write([
3473
- new ClipboardItem({ "image/png": blob })
3474
- ]).then(() => {
3475
- this._flashButton(".eeq-btn-share", "copied!");
3456
+ const dataUrl = canvas.toDataURL("image/png");
3457
+ const byteString = atob(dataUrl.split(",")[1]);
3458
+ const ab = new ArrayBuffer(byteString.length);
3459
+ const ia = new Uint8Array(ab);
3460
+ for (let i = 0; i < byteString.length; i++) ia[i] = byteString.charCodeAt(i);
3461
+ const blob = new Blob([ab], { type: "image/png" });
3462
+ const isMobile = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent) && window.innerWidth < 768;
3463
+ if (isMobile && navigator.share) {
3464
+ const file = new File([blob], "easter-egg-quest.png", { type: "image/png" });
3465
+ if ((_a2 = navigator.canShare) == null ? void 0 : _a2.call(navigator, { files: [file] })) {
3466
+ navigator.share({
3467
+ files: [file],
3468
+ title: "Easter Egg Quest",
3469
+ text: `«${s.behaviorProfile.title}»`
3476
3470
  }).catch(() => {
3477
- this._downloadBlob(blob);
3478
3471
  });
3479
3472
  return;
3480
3473
  }
3481
- this._downloadBlob(blob);
3482
- }, "image/png");
3474
+ }
3475
+ if (navigator.clipboard && typeof ClipboardItem !== "undefined") {
3476
+ navigator.clipboard.write([
3477
+ new ClipboardItem({ "image/png": blob })
3478
+ ]).then(() => {
3479
+ this._flashButton(".eeq-btn-share", "copied!");
3480
+ }).catch(() => {
3481
+ this._downloadBlob(blob);
3482
+ });
3483
+ return;
3484
+ }
3485
+ this._downloadBlob(blob);
3483
3486
  }
3484
3487
  _downloadBlob(blob) {
3485
3488
  const url = URL.createObjectURL(blob);