@easy-smart-app-banner/vue-plugin
Version:
A Vue Plugin for the Easy Smart App Banner
1,334 lines (1,333 loc) • 44.4 kB
JavaScript
function je(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var x = { exports: {} };
/*!
* js-logger - http://github.com/jonnyreeves/js-logger
* Jonny Reeves, http://jonnyreeves.co.uk/
* js-logger may be freely distributed under the MIT license.
*/
var We = x.exports, se;
function Ge() {
return se || (se = 1, function(e) {
(function(t) {
var n = {};
n.VERSION = "1.6.1";
var r, i = {}, l = function(o, s) {
return function() {
return s.apply(o, arguments);
};
}, c = function() {
var o = arguments, s = o[0], p, f;
for (f = 1; f < o.length; f++)
for (p in o[f])
!(p in s) && o[f].hasOwnProperty(p) && (s[p] = o[f][p]);
return s;
}, a = function(o, s) {
return { value: o, name: s };
};
n.TRACE = a(1, "TRACE"), n.DEBUG = a(2, "DEBUG"), n.INFO = a(3, "INFO"), n.TIME = a(4, "TIME"), n.WARN = a(5, "WARN"), n.ERROR = a(8, "ERROR"), n.OFF = a(99, "OFF");
var h = function(o) {
this.context = o, this.setLevel(o.filterLevel), this.log = this.info;
};
h.prototype = {
// Changes the current logging level for the logging instance.
setLevel: function(o) {
o && "value" in o && (this.context.filterLevel = o);
},
// Gets the current logging level for the logging instance
getLevel: function() {
return this.context.filterLevel;
},
// Is the logger configured to output messages at the supplied level?
enabledFor: function(o) {
var s = this.context.filterLevel;
return o.value >= s.value;
},
trace: function() {
this.invoke(n.TRACE, arguments);
},
debug: function() {
this.invoke(n.DEBUG, arguments);
},
info: function() {
this.invoke(n.INFO, arguments);
},
warn: function() {
this.invoke(n.WARN, arguments);
},
error: function() {
this.invoke(n.ERROR, arguments);
},
time: function(o) {
typeof o == "string" && o.length > 0 && this.invoke(n.TIME, [o, "start"]);
},
timeEnd: function(o) {
typeof o == "string" && o.length > 0 && this.invoke(n.TIME, [o, "end"]);
},
// Invokes the logger callback if it's not being filtered.
invoke: function(o, s) {
r && this.enabledFor(o) && r(s, c({ level: o }, this.context));
}
};
var u = new h({ filterLevel: n.OFF });
(function() {
var o = n;
o.enabledFor = l(u, u.enabledFor), o.trace = l(u, u.trace), o.debug = l(u, u.debug), o.time = l(u, u.time), o.timeEnd = l(u, u.timeEnd), o.info = l(u, u.info), o.warn = l(u, u.warn), o.error = l(u, u.error), o.log = o.info;
})(), n.setHandler = function(o) {
r = o;
}, n.setLevel = function(o) {
u.setLevel(o);
for (var s in i)
i.hasOwnProperty(s) && i[s].setLevel(o);
}, n.getLevel = function() {
return u.getLevel();
}, n.get = function(o) {
return i[o] || (i[o] = new h(c({ name: o }, u.context)));
}, n.createDefaultHandler = function(o) {
o = o || {}, o.formatter = o.formatter || function(d, m) {
m.name && d.unshift("[" + m.name + "]");
};
var s = {}, p = function(f, d) {
Function.prototype.apply.call(f, console, d);
};
return typeof console > "u" ? function() {
} : function(f, d) {
f = Array.prototype.slice.call(f);
var m = console.log, v;
d.level === n.TIME ? (v = (d.name ? "[" + d.name + "] " : "") + f[0], f[1] === "start" ? console.time ? console.time(v) : s[v] = (/* @__PURE__ */ new Date()).getTime() : console.timeEnd ? console.timeEnd(v) : p(m, [v + ": " + ((/* @__PURE__ */ new Date()).getTime() - s[v]) + "ms"])) : (d.level === n.WARN && console.warn ? m = console.warn : d.level === n.ERROR && console.error ? m = console.error : d.level === n.INFO && console.info ? m = console.info : d.level === n.DEBUG && console.debug ? m = console.debug : d.level === n.TRACE && console.trace && (m = console.trace), o.formatter(f, d), p(m, f));
};
}, n.useDefaults = function(o) {
n.setLevel(o && o.defaultLevel || n.DEBUG), n.setHandler(n.createDefaultHandler(o));
}, n.setDefaults = n.useDefaults, e.exports ? e.exports = n : (n._prevLogger = t.Logger, n.noConflict = function() {
return t.Logger = n._prevLogger, n;
}, t.Logger = n);
})(We);
}(x)), x.exports;
}
var qe = Ge();
const $ = /* @__PURE__ */ je(qe);
var ze = Object.defineProperty, Je = (e, t, n) => t in e ? ze(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, y = (e, t, n) => Je(e, typeof t != "symbol" ? t + "" : t, n);
function Ke(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Y = { exports: {} };
/*!
* js-logger - http://github.com/jonnyreeves/js-logger
* Jonny Reeves, http://jonnyreeves.co.uk/
* js-logger may be freely distributed under the MIT license.
*/
var Ye = Y.exports, le;
function Xe() {
return le || (le = 1, function(e) {
(function(t) {
var n = {};
n.VERSION = "1.6.1";
var r, i = {}, l = function(o, s) {
return function() {
return s.apply(o, arguments);
};
}, c = function() {
var o = arguments, s = o[0], p, f;
for (f = 1; f < o.length; f++)
for (p in o[f])
!(p in s) && o[f].hasOwnProperty(p) && (s[p] = o[f][p]);
return s;
}, a = function(o, s) {
return { value: o, name: s };
};
n.TRACE = a(1, "TRACE"), n.DEBUG = a(2, "DEBUG"), n.INFO = a(3, "INFO"), n.TIME = a(4, "TIME"), n.WARN = a(5, "WARN"), n.ERROR = a(8, "ERROR"), n.OFF = a(99, "OFF");
var h = function(o) {
this.context = o, this.setLevel(o.filterLevel), this.log = this.info;
};
h.prototype = {
// Changes the current logging level for the logging instance.
setLevel: function(o) {
o && "value" in o && (this.context.filterLevel = o);
},
// Gets the current logging level for the logging instance
getLevel: function() {
return this.context.filterLevel;
},
// Is the logger configured to output messages at the supplied level?
enabledFor: function(o) {
var s = this.context.filterLevel;
return o.value >= s.value;
},
trace: function() {
this.invoke(n.TRACE, arguments);
},
debug: function() {
this.invoke(n.DEBUG, arguments);
},
info: function() {
this.invoke(n.INFO, arguments);
},
warn: function() {
this.invoke(n.WARN, arguments);
},
error: function() {
this.invoke(n.ERROR, arguments);
},
time: function(o) {
typeof o == "string" && o.length > 0 && this.invoke(n.TIME, [o, "start"]);
},
timeEnd: function(o) {
typeof o == "string" && o.length > 0 && this.invoke(n.TIME, [o, "end"]);
},
// Invokes the logger callback if it's not being filtered.
invoke: function(o, s) {
r && this.enabledFor(o) && r(s, c({ level: o }, this.context));
}
};
var u = new h({ filterLevel: n.OFF });
(function() {
var o = n;
o.enabledFor = l(u, u.enabledFor), o.trace = l(u, u.trace), o.debug = l(u, u.debug), o.time = l(u, u.time), o.timeEnd = l(u, u.timeEnd), o.info = l(u, u.info), o.warn = l(u, u.warn), o.error = l(u, u.error), o.log = o.info;
})(), n.setHandler = function(o) {
r = o;
}, n.setLevel = function(o) {
u.setLevel(o);
for (var s in i)
i.hasOwnProperty(s) && i[s].setLevel(o);
}, n.getLevel = function() {
return u.getLevel();
}, n.get = function(o) {
return i[o] || (i[o] = new h(c({ name: o }, u.context)));
}, n.createDefaultHandler = function(o) {
o = o || {}, o.formatter = o.formatter || function(f, d) {
d.name && f.unshift("[" + d.name + "]");
};
var s = {}, p = function(f, d) {
Function.prototype.apply.call(f, console, d);
};
return typeof console > "u" ? function() {
} : function(f, d) {
f = Array.prototype.slice.call(f);
var m = console.log, v;
d.level === n.TIME ? (v = (d.name ? "[" + d.name + "] " : "") + f[0], f[1] === "start" ? console.time ? console.time(v) : s[v] = (/* @__PURE__ */ new Date()).getTime() : console.timeEnd ? console.timeEnd(v) : p(m, [v + ": " + ((/* @__PURE__ */ new Date()).getTime() - s[v]) + "ms"])) : (d.level === n.WARN && console.warn ? m = console.warn : d.level === n.ERROR && console.error ? m = console.error : d.level === n.INFO && console.info ? m = console.info : d.level === n.DEBUG && console.debug ? m = console.debug : d.level === n.TRACE && console.trace && (m = console.trace), o.formatter(f, d), p(m, f));
};
}, n.useDefaults = function(o) {
n.setLevel(o && o.defaultLevel || n.DEBUG), n.setHandler(n.createDefaultHandler(o));
}, n.setDefaults = n.useDefaults, e.exports ? e.exports = n : (n._prevLogger = t.Logger, n.noConflict = function() {
return t.Logger = n._prevLogger, n;
}, t.Logger = n);
})(Ye);
}(Y)), Y.exports;
}
var Qe = Xe();
const g = /* @__PURE__ */ Ke(Qe);
class ue extends Event {
constructor(t, n = !1) {
super(t, { cancelable: n }), y(this, "target");
}
}
y(ue, "type");
class Ze extends EventTarget {
dispatchEvent(t) {
return super.dispatchEvent(t);
}
addEventListener(t, n, r) {
super.addEventListener(t, n, r);
}
removeEventListener(t, n, r) {
super.removeEventListener(t, n, r);
}
}
class P extends ue {
}
const fe = class pe extends P {
constructor() {
super(pe.type, !0);
}
};
y(fe, "type", "ready");
let de = fe;
const he = class me extends P {
constructor() {
super(me.type, !0);
}
};
y(he, "type", "destroyed");
let ge = he;
const ve = class _e extends P {
constructor() {
super(_e.type, !0);
}
};
y(ve, "type", "clicked-call-to-action");
let Ee = ve;
const ye = class be extends P {
constructor() {
super(be.type, !0);
}
};
y(ye, "type", "toggled-visibility");
let we = ye;
const Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
ClickedCallToAction: Ee,
DestroyedEvent: ge,
ReadyEvent: de,
SmartAppBannerEvent: P,
ToggledVisibility: we
}, Symbol.toStringTag, { value: "Module" }));
String.prototype.isFalsishOrEmpty = function() {
return !this.trim();
};
class _ extends Error {
constructor(t, n) {
var r;
super(
n && n instanceof Error ? `${t}: ${n.message}` : t
), this.name = "SmartAppBanner", (r = Error.captureStackTrace) == null || r.call(Error, this, _);
}
}
function et(e, t) {
const n = function(r) {
const i = {
...e,
...r
};
Object.keys(i).forEach((c) => {
t && c in t || g.warn(`Unknown option ${c}`);
});
const l = {};
return Object.entries(i).forEach(([c, a]) => {
t && c in t && (l[c] = t[c](a, {
rawOptions: i,
defaultValue: e[c]
}));
}), g.debug(), l;
};
return n.defaults = e, n.parsers = t || {}, n;
}
const tt = {
icon: null,
platforms: ["android", "ios"],
price: null,
buttonLabel: "View",
verbose: !1,
dismissPath: "/",
googlePlayStoreUrl: null,
androidButtonLabel: null,
androidIcon: null,
androidPrice: "FREE - On the Google Play Store",
appStoreUrl: null,
appleAppId: null,
appleAppArgumentUrl: null,
appleButtonLabel: null,
appleIcon: null,
applePrice: "GET - On the App Store"
}, nt = {
title: (e) => {
if (e.isFalsishOrEmpty())
throw new _("No title has been configured.");
return e;
},
author: (e) => {
if (e.isFalsishOrEmpty())
throw new _("No author has been configured.");
return e;
},
icon: (e) => e != null && e.isFalsishOrEmpty() ? null : e,
platforms: (e, { defaultValue: t }) => !e || e.length === 0 ? t : e,
price: (e) => e != null && e.isFalsishOrEmpty() ? null : e,
buttonLabel: (e, { defaultValue: t }) => e != null && e.isFalsishOrEmpty() ? t : e,
verbose: (e, { defaultValue: t }) => e ? (g.debug("verbose logging enabled"), e) : t,
dismissPath: (e, { defaultValue: t }) => e != null && e.isFalsishOrEmpty() ? t : e,
googlePlayStoreUrl: (e, { rawOptions: t }) => {
var n;
if (!((n = t.platforms) != null && n.includes("android"))) return null;
const r = `The Android platform was enabled but no valid Google Play Store URL has been configured. Provided URL was "${e}"`;
if (e != null && e.isFalsishOrEmpty())
throw new _(r);
try {
return new URL(e);
} catch {
throw new _(r);
}
},
androidButtonLabel: (e, { rawOptions: t }) => {
var n;
return (n = t.platforms) != null && n.includes("android") ? e ?? null : null;
},
androidIcon: (e, { rawOptions: t }) => {
var n, r, i;
if (!((n = t.platforms) != null && n.includes("android"))) return null;
if ((r = t.platforms) != null && r.includes("android") && (i = t.icon) != null && i.isFalsishOrEmpty() && e != null && e.isFalsishOrEmpty())
throw new _(
"The Android platform was enabled but there is no icon defined at all"
);
return e ?? null;
},
androidPrice: (e, { defaultValue: t }) => e ?? t,
appStoreUrl: (e, { rawOptions: t }) => {
var n;
if (!((n = t.platforms) != null && n.includes("ios"))) return null;
const r = `The iOS platform was enabled but no valid Apple App Store URL has been configured. Provided URL was "${e}"`;
if (e != null && e.isFalsishOrEmpty())
throw new _(r);
try {
return new URL(e);
} catch {
throw new _(r);
}
},
appleAppId: (e, { rawOptions: t }) => {
var n;
if (!((n = t.platforms) != null && n.includes("safari"))) return null;
if (e != null && e.isFalsishOrEmpty())
throw new _(
`The Safari platform was enabled but no valid Apple app ID has been configured. Provided app ID was "${e}"`
);
return e;
},
appleAppArgumentUrl: (e, { rawOptions: t }) => {
var n;
if (!((n = t.platforms) != null && n.includes("safari")) || e != null && e.isFalsishOrEmpty()) return null;
try {
return new URL(e);
} catch {
throw new _(
`The Safari platform was enabled but an invalid app argument URL was specified. Provided app argument URL was "${e}"`
);
}
},
appleButtonLabel: (e, { rawOptions: t }) => {
var n;
return (n = t.platforms) != null && n.includes("ios") ? e ?? null : null;
},
appleIcon: (e, { rawOptions: t }) => {
var n, r, i;
if (!((n = t.platforms) != null && n.includes("ios"))) return null;
if ((r = t.platforms) != null && r.includes("ios") && (i = t.icon) != null && i.isFalsishOrEmpty() && e != null && e.isFalsishOrEmpty())
throw new _(
"The iOS platform was enabled but there is no icon defined at all"
);
return e ?? null;
},
applePrice: (e, { defaultValue: t }) => e ?? t
}, rt = et(tt, nt);
function ot() {
const e = window.navigator.userAgent;
let t;
if (g.debug("Current user agent: ", e), /X11|Windows|Macintosh/i.test(e))
return;
/android|windows phone/i.test(e) && (t = "android");
const n = window.navigator.maxTouchPoints, r = !window.MSStream && n && n > 0, i = /(?:iPhone|iPad|iPod)(?=.*(criOS|fxiOS|opiOS|chrome|android))/i.test(
e
);
return r && /iPad(?=.*(criOS|fxiOS|opiOS|chrome|android))/i.test(e) && (t = "ios"), i && (t = "ios"), /(?:iPhone|iPad|iPod)(?!.*(criOS|fxiOS|opiOS|chrome|android))/i.test(
e
) && (t = "safari"), !t && g.debug("The current platform is not supported"), g.debug("Resolved current platform as:", t), t;
}
function G() {
const e = "smart-app-banner-dismissed";
function t(r) {
const i = {};
return document.cookie.split(";").forEach((l) => {
const [c, a] = l.split("=");
i[c.trim()] = a ?? "";
}), i[r];
}
function n(r, i) {
document.cookie = `${e}=${r ? 1 : 0}; path=${i != null && i.isFalsishOrEmpty() ? "/" : i}`;
}
return {
isDismissed: () => t(e) === "1",
dismiss: (r) => n(!0, r),
show: (r) => n(!1, r)
};
}
class it extends Ze {
constructor(t) {
super(), y(this, "options"), y(this, "platform"), y(this, "bannerId", "smart-app-banner"), y(this, "__bannerElement", null), this.options = rt(t), this.options.verbose && g.setLevel(g.DEBUG), this.platform = ot(), g.info("successfully initialised");
}
mount() {
var t, n;
if (this.platform) {
if (this.platform === "safari") {
this.setUpSafari();
return;
}
G().isDismissed() || (g.time("mounting banner"), this.__bannerElement = document.createElement("div"), this.__bannerElement.innerHTML = this.html, this.__bannerElement.id = this.bannerId, document.body.prepend(this.__bannerElement), this.onClickClose = this.onClickClose.bind(this), this.onClickCallToAction = this.onClickCallToAction.bind(this), (t = document.querySelector(".smartappbanner__close")) == null || t.addEventListener("click", this.onClickClose, !1), (n = document.querySelector(".smartappbanner__view")) == null || n.addEventListener("click", this.onClickCallToAction, !1), g.debug("mounted banner"), g.timeEnd("mounting banner"), this.dispatchEvent(new de()));
}
}
setUpSafari() {
const t = document.createElement("meta");
t.name = "apple-itunes-app", t.content = `app-id=${this.options.appleAppId}, app-argument=${this.options.appleAppArgumentUrl}`, document.head.append(t), g.debug("added Safari configuration");
}
destroy() {
!this.__bannerElement || !this.platform || this.platform === "safari" || (this.removeEventListeners(), this.__bannerElement.remove(), g.debug("destroyed banner"), this.dispatchEvent(new ge()));
}
setBannerVisibility(t) {
const n = G();
t ? (g.debug("re-showing banner"), n.show(this.options.dismissPath)) : (g.debug("dismissing banner"), n.dismiss(this.options.dismissPath)), this.destroy(), this.mount(), this.dispatchEvent(new we());
}
onClickClose(t) {
t.preventDefault(), G().dismiss(this.options.dismissPath), this.destroy();
}
onClickCallToAction(t) {
this.dispatchEvent(new Ee());
}
removeEventListeners() {
var t, n;
(t = document.querySelector(".smartappbanner__close")) == null || t.removeEventListener("click", this.onClickClose, !1), (n = document.querySelector(".smartappbanner__view")) == null || n.removeEventListener("click", this.onClickCallToAction, !1);
}
get title() {
if (this.platform !== "safari")
return this.options.title;
}
get author() {
if (this.platform !== "safari")
return this.options.author;
}
get price() {
if (this.platform !== "safari")
return this.platform === "android" && this.options.androidPrice ? this.options.androidPrice : this.platform === "ios" && this.options.applePrice ? this.options.applePrice : this.options.price ?? "";
}
get icon() {
if (this.platform !== "safari")
return this.platform === "android" && this.options.androidIcon ? this.options.androidIcon : this.platform === "ios" && this.options.appleIcon ? this.options.appleIcon : this.options.icon ?? "";
}
get buttonUrl() {
if (this.platform !== "safari") {
if (this.platform === "android" && this.options.googlePlayStoreUrl)
return this.options.googlePlayStoreUrl;
if (this.platform === "ios" && this.options.appStoreUrl)
return this.options.appStoreUrl;
}
}
get buttonLabel() {
if (this.platform !== "safari")
return this.platform === "android" && this.options.androidButtonLabel ? this.options.androidButtonLabel : this.platform === "ios" && this.options.appleButtonLabel ? this.options.appleButtonLabel : this.options.buttonLabel;
}
get html() {
if (this.platform === "safari")
throw new _(
`Attempted to render banner. However, the current platform is Safari. This should instead be handled via their recommended meta tag.
See: https://developer.apple.com/documentation/webkit/promoting-apps-with-smart-app-banners`
);
return `
<div class="smartappbanner">
<div class="smartappbanner__close">
<a
href="#"
href="nofollow"
></a>
</div>
<div
class="smartappbanner__app-icon"
style="background-image: url(${this.icon})"
></div>
<div class="smartappbanner__description">
<div class="smartappbanner__description__title">${this.title}</div>
<div class="smartappbanner__description__author">${this.author}</div>
<div class="smartappbanner__description__price">${this.price}</div>
</div>
<a
href="${this.buttonUrl}"
target="_blank"
rel="noopener"
aria-label="${this.buttonLabel}"
class="smartappbanner__view"
>
<span class="smartbanner__view__label">${this.buttonLabel}</span>
</a>
</div>
`;
}
}
g.useDefaults({
defaultLevel: g.WARN,
formatter: function(e, t) {
e.unshift("[🛍️ Smart App Banner]");
}
});
const Oe = Symbol(
"SmartAppBanner"
), Yt = {
install(e, t) {
let n;
try {
n = new it(t);
} catch (r) {
$.warn(r);
}
n ? (e.config.globalProperties.$smartAppBanner = n, e.provide(Oe, n)) : $.warn(
"failed to initialise the plugin, check the logs for further details"
);
}
};
/**
* @vue/shared v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
const X = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
process.env.NODE_ENV !== "production" && Object.freeze([]);
const Se = () => {
}, st = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && // uppercase letter
(e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), j = Object.assign, b = Array.isArray, R = (e) => typeof e == "function", S = (e) => typeof e == "string", lt = (e) => typeof e == "symbol", L = (e) => e !== null && typeof e == "object";
let ae;
const W = () => ae || (ae = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
function te(e) {
if (b(e)) {
const t = {};
for (let n = 0; n < e.length; n++) {
const r = e[n], i = S(r) ? ft(r) : te(r);
if (i)
for (const l in i)
t[l] = i[l];
}
return t;
} else if (S(e) || L(e))
return e;
}
const at = /;(?![^(]*\))/g, ct = /:([^]+)/, ut = /\/\*[^]*?\*\//g;
function ft(e) {
const t = {};
return e.replace(ut, "").split(at).forEach((n) => {
if (n) {
const r = n.split(ct);
r.length > 1 && (t[r[0].trim()] = r[1].trim());
}
}), t;
}
function ne(e) {
let t = "";
if (S(e))
t = e;
else if (b(e))
for (let n = 0; n < e.length; n++) {
const r = ne(e[n]);
r && (t += r + " ");
}
else if (L(e))
for (const n in e)
e[n] && (t += n + " ");
return t.trim();
}
/**
* @vue/reactivity v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
Symbol(
process.env.NODE_ENV !== "production" ? "Object iterate" : ""
);
Symbol(
process.env.NODE_ENV !== "production" ? "Map keys iterate" : ""
);
Symbol(
process.env.NODE_ENV !== "production" ? "Array iterate" : ""
);
new Set(
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((e) => e !== "arguments" && e !== "caller").map((e) => Symbol[e]).filter(lt)
);
function Ne(e) {
return Q(e) ? Ne(e.__v_raw) : !!(e && e.__v_isReactive);
}
function Q(e) {
return !!(e && e.__v_isReadonly);
}
function q(e) {
return !!(e && e.__v_isShallow);
}
function Z(e) {
return e ? !!e.__v_raw : !1;
}
function C(e) {
const t = e && e.__v_raw;
return t ? C(t) : e;
}
function re(e) {
return e ? e.__v_isRef === !0 : !1;
}
/**
* @vue/runtime-core v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
const F = [];
function pt(e) {
F.push(e);
}
function dt() {
F.pop();
}
let z = !1;
function N(e, ...t) {
if (z) return;
z = !0;
const n = F.length ? F[F.length - 1].component : null, r = n && n.appContext.config.warnHandler, i = ht();
if (r)
oe(
r,
n,
11,
[
// eslint-disable-next-line no-restricted-syntax
e + t.map((l) => {
var c, a;
return (a = (c = l.toString) == null ? void 0 : c.call(l)) != null ? a : JSON.stringify(l);
}).join(""),
n && n.proxy,
i.map(
({ vnode: l }) => `at <${Me(n, l.type)}>`
).join(`
`),
i
]
);
else {
const l = [`[Vue warn]: ${e}`, ...t];
i.length && l.push(`
`, ...mt(i)), console.warn(...l);
}
z = !1;
}
function ht() {
let e = F[F.length - 1];
if (!e)
return [];
const t = [];
for (; e; ) {
const n = t[0];
n && n.vnode === e ? n.recurseCount++ : t.push({
vnode: e,
recurseCount: 0
});
const r = e.component && e.component.parent;
e = r && r.vnode;
}
return t;
}
function mt(e) {
const t = [];
return e.forEach((n, r) => {
t.push(...r === 0 ? [] : [`
`], ...gt(n));
}), t;
}
function gt({ vnode: e, recurseCount: t }) {
const n = t > 0 ? `... (${t} recursive calls)` : "", r = e.component ? e.component.parent == null : !1, i = ` at <${Me(
e.component,
e.type,
r
)}`, l = ">" + n;
return e.props ? [i, ...vt(e.props), l] : [i + l];
}
function vt(e) {
const t = [], n = Object.keys(e);
return n.slice(0, 3).forEach((r) => {
t.push(...Re(r, e[r]));
}), n.length > 3 && t.push(" ..."), t;
}
function Re(e, t, n) {
return S(t) ? (t = JSON.stringify(t), n ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? n ? t : [`${e}=${t}`] : re(t) ? (t = Re(e, C(t.value), !0), n ? t : [`${e}=Ref<`, t, ">"]) : R(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = C(t), n ? t : [`${e}=`, t]);
}
const Le = {
sp: "serverPrefetch hook",
bc: "beforeCreate hook",
c: "created hook",
bm: "beforeMount hook",
m: "mounted hook",
bu: "beforeUpdate hook",
u: "updated",
bum: "beforeUnmount hook",
um: "unmounted hook",
a: "activated hook",
da: "deactivated hook",
ec: "errorCaptured hook",
rtc: "renderTracked hook",
rtg: "renderTriggered hook",
0: "setup function",
1: "render function",
2: "watcher getter",
3: "watcher callback",
4: "watcher cleanup function",
5: "native event handler",
6: "component event handler",
7: "vnode hook",
8: "directive hook",
9: "transition hook",
10: "app errorHandler",
11: "app warnHandler",
12: "ref function",
13: "async component loader",
14: "scheduler flush",
15: "component update",
16: "app unmount cleanup function"
};
function oe(e, t, n, r) {
try {
return r ? e(...r) : e();
} catch (i) {
Ce(i, t, n);
}
}
function Ce(e, t, n, r = !0) {
const i = t ? t.vnode : null, { errorHandler: l, throwUnhandledErrorInProduction: c } = t && t.appContext.config || X;
if (t) {
let a = t.parent;
const h = t.proxy, u = process.env.NODE_ENV !== "production" ? Le[n] : `https://vuejs.org/error-reference/#runtime-${n}`;
for (; a; ) {
const o = a.ec;
if (o) {
for (let s = 0; s < o.length; s++)
if (o[s](e, h, u) === !1)
return;
}
a = a.parent;
}
if (l) {
oe(l, null, 10, [
e,
h,
u
]);
return;
}
}
_t(e, n, i, r, c);
}
function _t(e, t, n, r = !0, i = !1) {
if (process.env.NODE_ENV !== "production") {
const l = Le[t];
if (n && pt(n), N(`Unhandled error${l ? ` during execution of ${l}` : ""}`), n && dt(), r)
throw e;
console.error(e);
} else {
if (i)
throw e;
console.error(e);
}
}
const E = [];
let w = -1;
const A = [];
let O = null, T = 0;
const Et = /* @__PURE__ */ Promise.resolve();
let ee = null;
const yt = 100;
function bt(e) {
let t = w + 1, n = E.length;
for (; t < n; ) {
const r = t + n >>> 1, i = E[r], l = D(i);
l < e || l === e && i.flags & 2 ? t = r + 1 : n = r;
}
return t;
}
function wt(e) {
if (!(e.flags & 1)) {
const t = D(e), n = E[E.length - 1];
!n || // fast path when the job id is larger than the tail
!(e.flags & 2) && t >= D(n) ? E.push(e) : E.splice(bt(t), 0, e), e.flags |= 1, Fe();
}
}
function Fe() {
ee || (ee = Et.then(Te));
}
function Ot(e) {
b(e) ? A.push(...e) : O && e.id === -1 ? O.splice(T + 1, 0, e) : e.flags & 1 || (A.push(e), e.flags |= 1), Fe();
}
function St(e) {
if (A.length) {
const t = [...new Set(A)].sort(
(n, r) => D(n) - D(r)
);
if (A.length = 0, O) {
O.push(...t);
return;
}
for (O = t, process.env.NODE_ENV !== "production" && (e = e || /* @__PURE__ */ new Map()), T = 0; T < O.length; T++) {
const n = O[T];
process.env.NODE_ENV !== "production" && ke(e, n) || (n.flags & 4 && (n.flags &= -2), n.flags & 8 || n(), n.flags &= -2);
}
O = null, T = 0;
}
}
const D = (e) => e.id == null ? e.flags & 2 ? -1 : 1 / 0 : e.id;
function Te(e) {
process.env.NODE_ENV !== "production" && (e = e || /* @__PURE__ */ new Map());
const t = process.env.NODE_ENV !== "production" ? (n) => ke(e, n) : Se;
try {
for (w = 0; w < E.length; w++) {
const n = E[w];
if (n && !(n.flags & 8)) {
if (process.env.NODE_ENV !== "production" && t(n))
continue;
n.flags & 4 && (n.flags &= -2), oe(
n,
n.i,
n.i ? 15 : 14
), n.flags & 4 || (n.flags &= -2);
}
}
} finally {
for (; w < E.length; w++) {
const n = E[w];
n && (n.flags &= -2);
}
w = -1, E.length = 0, St(e), ee = null, (E.length || A.length) && Te(e);
}
}
function ke(e, t) {
const n = e.get(t) || 0;
if (n > yt) {
const r = t.i, i = r && Be(r.type);
return Ce(
`Maximum recursive updates exceeded${i ? ` in component <${i}>` : ""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
null,
10
), !0;
}
return e.set(t, n + 1), !1;
}
const J = /* @__PURE__ */ new Map();
process.env.NODE_ENV !== "production" && (W().__VUE_HMR_RUNTIME__ = {
createRecord: K(Nt),
rerender: K(Rt),
reload: K(Lt)
});
const B = /* @__PURE__ */ new Map();
function Nt(e, t) {
return B.has(e) ? !1 : (B.set(e, {
initialDef: M(t),
instances: /* @__PURE__ */ new Set()
}), !0);
}
function M(e) {
return He(e) ? e.__vccOpts : e;
}
function Rt(e, t) {
const n = B.get(e);
n && (n.initialDef.render = t, [...n.instances].forEach((r) => {
t && (r.render = t, M(r.type).render = t), r.renderCache = [], r.update();
}));
}
function Lt(e, t) {
const n = B.get(e);
if (!n) return;
t = M(t), ce(n.initialDef, t);
const r = [...n.instances];
for (let i = 0; i < r.length; i++) {
const l = r[i], c = M(l.type);
let a = J.get(c);
a || (c !== n.initialDef && ce(c, t), J.set(c, a = /* @__PURE__ */ new Set())), a.add(l), l.appContext.propsCache.delete(l.type), l.appContext.emitsCache.delete(l.type), l.appContext.optionsCache.delete(l.type), l.ceReload ? (a.add(l), l.ceReload(t.styles), a.delete(l)) : l.parent ? wt(() => {
l.parent.update(), a.delete(l);
}) : l.appContext.reload ? l.appContext.reload() : typeof window < "u" ? window.location.reload() : console.warn(
"[HMR] Root or manually mounted instance modified. Full reload required."
), l.root.ce && l !== l.root && l.root.ce._removeChildStyle(c);
}
Ot(() => {
J.clear();
});
}
function ce(e, t) {
j(e, t);
for (const n in e)
n !== "__file" && !(n in t) && delete e[n];
}
function K(e) {
return (t, n) => {
try {
return e(t, n);
} catch (r) {
console.error(r), console.warn(
"[HMR] Something went wrong during Vue component hot-reload. Full reload required."
);
}
};
}
let k, V = [];
function Ae(e, t) {
var n, r;
k = e, k ? (k.enabled = !0, V.forEach(({ event: i, args: l }) => k.emit(i, ...l)), V = []) : /* handle late devtools injection - only do this if we are in an actual */ /* browser environment to avoid the timer handle stalling test runner exit */ /* (#4815) */ typeof window < "u" && // some envs mock window but not fully
window.HTMLElement && // also exclude jsdom
// eslint-disable-next-line no-restricted-syntax
!((r = (n = window.navigator) == null ? void 0 : n.userAgent) != null && r.includes("jsdom")) ? ((t.__VUE_DEVTOOLS_HOOK_REPLAY__ = t.__VUE_DEVTOOLS_HOOK_REPLAY__ || []).push((l) => {
Ae(l, t);
}), setTimeout(() => {
k || (t.__VUE_DEVTOOLS_HOOK_REPLAY__ = null, V = []);
}, 3e3)) : V = [];
}
let I = null, Ct = null;
const Ft = (e) => e.__isTeleport;
function De(e, t) {
e.shapeFlag & 6 && e.component ? (e.transition = t, De(e.component.subTree, t)) : e.shapeFlag & 128 ? (e.ssContent.transition = t.clone(e.ssContent), e.ssFallback.transition = t.clone(e.ssFallback)) : e.transition = t;
}
W().requestIdleCallback;
W().cancelIdleCallback;
const Tt = Symbol.for("v-ndc"), kt = {};
process.env.NODE_ENV !== "production" && (kt.ownKeys = (e) => (N(
"Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."
), Reflect.ownKeys(e)));
let At = null;
function Dt(e, t, n = !1) {
const r = $e || I;
if (r || At) {
const i = r ? r.parent == null ? r.vnode.appContext && r.vnode.appContext.provides : r.parent.provides : void 0;
if (i && e in i)
return i[e];
if (arguments.length > 1)
return n && R(t) ? t.call(r && r.proxy) : t;
process.env.NODE_ENV !== "production" && N(`injection "${String(e)}" not found.`);
} else process.env.NODE_ENV !== "production" && N("inject() can only be used inside setup() or functional components.");
}
const It = {}, Ie = (e) => Object.getPrototypeOf(e) === It, Pt = (e) => e.__isSuspense, Pe = Symbol.for("v-fgt"), Vt = Symbol.for("v-txt"), xt = Symbol.for("v-cmt");
function Ut(e) {
return e ? e.__v_isVNode === !0 : !1;
}
const $t = (...e) => xe(
...e
), Ve = ({ key: e }) => e ?? null, U = ({
ref: e,
ref_key: t,
ref_for: n
}) => (typeof e == "number" && (e = "" + e), e != null ? S(e) || re(e) || R(e) ? { i: I, r: e, k: t, f: !!n } : e : null);
function Bt(e, t = null, n = null, r = 0, i = null, l = e === Pe ? 0 : 1, c = !1, a = !1) {
const h = {
__v_isVNode: !0,
__v_skip: !0,
type: e,
props: t,
key: t && Ve(t),
ref: t && U(t),
scopeId: Ct,
slotScopeIds: null,
children: n,
component: null,
suspense: null,
ssContent: null,
ssFallback: null,
dirs: null,
transition: null,
el: null,
anchor: null,
target: null,
targetStart: null,
targetAnchor: null,
staticCount: 0,
shapeFlag: l,
patchFlag: r,
dynamicProps: i,
dynamicChildren: null,
appContext: null,
ctx: I
};
return a ? (ie(h, n), l & 128 && e.normalize(h)) : n && (h.shapeFlag |= S(n) ? 8 : 16), process.env.NODE_ENV !== "production" && h.key !== h.key && N("VNode created with invalid key (NaN). VNode type:", h.type), h;
}
const Mt = process.env.NODE_ENV !== "production" ? $t : xe;
function xe(e, t = null, n = null, r = 0, i = null, l = !1) {
if ((!e || e === Tt) && (process.env.NODE_ENV !== "production" && !e && N(`Invalid vnode type when creating vnode: ${e}.`), e = xt), Ut(e)) {
const a = H(
e,
t,
!0
/* mergeRef: true */
);
return n && ie(a, n), a.patchFlag = -2, a;
}
if (He(e) && (e = e.__vccOpts), t) {
t = Ht(t);
let { class: a, style: h } = t;
a && !S(a) && (t.class = ne(a)), L(h) && (Z(h) && !b(h) && (h = j({}, h)), t.style = te(h));
}
const c = S(e) ? 1 : Pt(e) ? 128 : Ft(e) ? 64 : L(e) ? 4 : R(e) ? 2 : 0;
return process.env.NODE_ENV !== "production" && c & 4 && Z(e) && (e = C(e), N(
"Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",
`
Component that was made reactive: `,
e
)), Bt(
e,
t,
n,
r,
i,
c,
l,
!0
);
}
function Ht(e) {
return e ? Z(e) || Ie(e) ? j({}, e) : e : null;
}
function H(e, t, n = !1, r = !1) {
const { props: i, ref: l, patchFlag: c, children: a, transition: h } = e, u = t ? Wt(i || {}, t) : i, o = {
__v_isVNode: !0,
__v_skip: !0,
type: e.type,
props: u,
key: u && Ve(u),
ref: t && t.ref ? (
// #2078 in the case of <component :is="vnode" ref="extra"/>
// if the vnode itself already has a ref, cloneVNode will need to merge
// the refs so the single vnode can be set on multiple refs
n && l ? b(l) ? l.concat(U(t)) : [l, U(t)] : U(t)
) : l,
scopeId: e.scopeId,
slotScopeIds: e.slotScopeIds,
children: process.env.NODE_ENV !== "production" && c === -1 && b(a) ? a.map(Ue) : a,
target: e.target,
targetStart: e.targetStart,
targetAnchor: e.targetAnchor,
staticCount: e.staticCount,
shapeFlag: e.shapeFlag,
// if the vnode is cloned with extra props, we can no longer assume its
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
// note: preserve flag for fragments since they use the flag for children
// fast paths only.
patchFlag: t && e.type !== Pe ? c === -1 ? 16 : c | 16 : c,
dynamicProps: e.dynamicProps,
dynamicChildren: e.dynamicChildren,
appContext: e.appContext,
dirs: e.dirs,
transition: h,
// These should technically only be non-null on mounted VNodes. However,
// they *should* be copied for kept-alive vnodes. So we just always copy
// them since them being non-null during a mount doesn't affect the logic as
// they will simply be overwritten.
component: e.component,
suspense: e.suspense,
ssContent: e.ssContent && H(e.ssContent),
ssFallback: e.ssFallback && H(e.ssFallback),
el: e.el,
anchor: e.anchor,
ctx: e.ctx,
ce: e.ce
};
return h && r && De(
o,
h.clone(o)
), o;
}
function Ue(e) {
const t = H(e);
return b(e.children) && (t.children = e.children.map(Ue)), t;
}
function jt(e = " ", t = 0) {
return Mt(Vt, null, e, t);
}
function ie(e, t) {
let n = 0;
const { shapeFlag: r } = e;
if (t == null)
t = null;
else if (b(t))
n = 16;
else if (typeof t == "object")
if (r & 65) {
const i = t.default;
i && (i._c && (i._d = !1), ie(e, i()), i._c && (i._d = !0));
return;
} else
n = 32, !t._ && !Ie(t) && (t._ctx = I);
else R(t) ? (t = { default: t, _ctx: I }, n = 32) : (t = String(t), r & 64 ? (n = 16, t = [jt(t)]) : n = 8);
e.children = t, e.shapeFlag |= n;
}
function Wt(...e) {
const t = {};
for (let n = 0; n < e.length; n++) {
const r = e[n];
for (const i in r)
if (i === "class")
t.class !== r.class && (t.class = ne([t.class, r.class]));
else if (i === "style")
t.style = te([t.style, r.style]);
else if (st(i)) {
const l = t[i], c = r[i];
c && l !== c && !(b(l) && l.includes(c)) && (t[i] = l ? [].concat(l, c) : c);
} else i !== "" && (t[i] = r[i]);
}
return t;
}
let $e = null;
{
const e = W(), t = (n, r) => {
let i;
return (i = e[n]) || (i = e[n] = []), i.push(r), (l) => {
i.length > 1 ? i.forEach((c) => c(l)) : i[0](l);
};
};
t(
"__VUE_INSTANCE_SETTERS__",
(n) => $e = n
), t(
"__VUE_SSR_SETTERS__",
(n) => n
);
}
process.env.NODE_ENV;
const Gt = /(?:^|[-_])(\w)/g, qt = (e) => e.replace(Gt, (t) => t.toUpperCase()).replace(/[-_]/g, "");
function Be(e, t = !0) {
return R(e) ? e.displayName || e.name : e.name || t && e.__name;
}
function Me(e, t, n = !1) {
let r = Be(t);
if (!r && t.__file) {
const i = t.__file.match(/([^/\\]+)\.\w+$/);
i && (r = i[1]);
}
if (!r && e && e.parent) {
const i = (l) => {
for (const c in l)
if (l[c] === t)
return c;
};
r = i(
e.components || e.parent.type.components
) || i(e.appContext.components);
}
return r ? qt(r) : n ? "App" : "Anonymous";
}
function He(e) {
return R(e) && "__vccOpts" in e;
}
function zt() {
if (process.env.NODE_ENV === "production" || typeof window > "u")
return;
const e = { style: "color:#3ba776" }, t = { style: "color:#1677ff" }, n = { style: "color:#f5222d" }, r = { style: "color:#eb2f96" }, i = {
__vue_custom_formatter: !0,
header(s) {
return L(s) ? s.__isVue ? ["div", e, "VueInstance"] : re(s) ? [
"div",
{},
["span", e, o(s)],
"<",
// avoid debugger accessing value affecting behavior
a("_value" in s ? s._value : s),
">"
] : Ne(s) ? [
"div",
{},
["span", e, q(s) ? "ShallowReactive" : "Reactive"],
"<",
a(s),
`>${Q(s) ? " (readonly)" : ""}`
] : Q(s) ? [
"div",
{},
["span", e, q(s) ? "ShallowReadonly" : "Readonly"],
"<",
a(s),
">"
] : null : null;
},
hasBody(s) {
return s && s.__isVue;
},
body(s) {
if (s && s.__isVue)
return [
"div",
{},
...l(s.$)
];
}
};
function l(s) {
const p = [];
s.type.props && s.props && p.push(c("props", C(s.props))), s.setupState !== X && p.push(c("setup", s.setupState)), s.data !== X && p.push(c("data", C(s.data)));
const f = h(s, "computed");
f && p.push(c("computed", f));
const d = h(s, "inject");
return d && p.push(c("injected", d)), p.push([
"div",
{},
[
"span",
{
style: r.style + ";opacity:0.66"
},
"$ (internal): "
],
["object", { object: s }]
]), p;
}
function c(s, p) {
return p = j({}, p), Object.keys(p).length ? [
"div",
{ style: "line-height:1.25em;margin-bottom:0.6em" },
[
"div",
{
style: "color:#476582"
},
s
],
[
"div",
{
style: "padding-left:1.25em"
},
...Object.keys(p).map((f) => [
"div",
{},
["span", r, f + ": "],
a(p[f], !1)
])
]
] : ["span", {}];
}
function a(s, p = !0) {
return typeof s == "number" ? ["span", t, s] : typeof s == "string" ? ["span", n, JSON.stringify(s)] : typeof s == "boolean" ? ["span", r, s] : L(s) ? ["object", { object: p ? C(s) : s }] : ["span", n, String(s)];
}
function h(s, p) {
const f = s.type;
if (R(f))
return;
const d = {};
for (const m in s.ctx)
u(f, m, p) && (d[m] = s.ctx[m]);
return d;
}
function u(s, p, f) {
const d = s[f];
if (b(d) && d.includes(p) || L(d) && p in d || s.extends && u(s.extends, p, f) || s.mixins && s.mixins.some((m) => u(m, p, f)))
return !0;
}
function o(s) {
return q(s) ? "ShallowRef" : s.effect ? "ComputedRef" : "Ref";
}
window.devtoolsFormatters ? window.devtoolsFormatters.push(i) : window.devtoolsFormatters = [i];
}
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
/**
* vue v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
function Jt() {
zt();
}
process.env.NODE_ENV !== "production" && Jt();
function Xt() {
const e = Dt(Oe);
if (!e)
throw new Error(
"No Smart App Banner instance was provided! Double check that the Smart App Banner plugin has been registered and that the service is not called within an async setup"
);
return e;
}
$.useDefaults({
defaultLevel: $.WARN,
formatter: function(e, t) {
e.unshift("[🛍️ Smart App Banner - Plugin]");
}
});
export {
tt as DEFAULT_OPTIONS,
nt as OPTION_PARSERS,
it as SmartAppBanner,
Oe as SmartAppBannerInjectionKey,
Yt as default,
Kt as events,
Xt as useSmartAppBanner
};
//# sourceMappingURL=index.js.map