@easy-smart-app-banner/vue-plugin
Version:
A Vue Plugin for the Easy Smart App Banner
1,285 lines (1,284 loc) • 42.3 kB
JavaScript
function Ie(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var V = { 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 Pe = V.exports, ce;
function Ve() {
return ce || (ce = 1, function(e) {
(function(t) {
var n = {};
n.VERSION = "1.6.1";
var r, s = {}, l = function(o, i) {
return function() {
return i.apply(o, arguments);
};
}, c = function() {
var o = arguments, i = o[0], p, f;
for (f = 1; f < o.length; f++)
for (p in o[f])
!(p in i) && o[f].hasOwnProperty(p) && (i[p] = o[f][p]);
return i;
}, a = function(o, i) {
return { value: o, name: i };
};
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 i = this.context.filterLevel;
return o.value >= i.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, i) {
r && this.enabledFor(o) && r(i, 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 i in s)
s.hasOwnProperty(i) && s[i].setLevel(o);
}, n.getLevel = function() {
return u.getLevel();
}, n.get = function(o) {
return s[o] || (s[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 i = {}, 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, _;
d.level === n.TIME ? (_ = (d.name ? "[" + d.name + "] " : "") + f[0], f[1] === "start" ? console.time ? console.time(_) : i[_] = (/* @__PURE__ */ new Date()).getTime() : console.timeEnd ? console.timeEnd(_) : p(m, [_ + ": " + ((/* @__PURE__ */ new Date()).getTime() - i[_]) + "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);
})(Pe);
}(V)), V.exports;
}
var xe = Ve();
const $ = /* @__PURE__ */ Ie(xe);
function $e(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Z = { 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 Ue = Z.exports, ue;
function Be() {
return ue || (ue = 1, function(e) {
(function(t) {
var n = {};
n.VERSION = "1.6.1";
var r, s = {}, l = function(o, i) {
return function() {
return i.apply(o, arguments);
};
}, c = function() {
var o = arguments, i = o[0], p, f;
for (f = 1; f < o.length; f++)
for (p in o[f])
!(p in i) && o[f].hasOwnProperty(p) && (i[p] = o[f][p]);
return i;
}, a = function(o, i) {
return { value: o, name: i };
};
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 i = this.context.filterLevel;
return o.value >= i.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, i) {
r && this.enabledFor(o) && r(i, 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 i in s)
s.hasOwnProperty(i) && s[i].setLevel(o);
}, n.getLevel = function() {
return u.getLevel();
}, n.get = function(o) {
return s[o] || (s[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 i = {}, 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, _;
d.level === n.TIME ? (_ = (d.name ? "[" + d.name + "] " : "") + f[0], f[1] === "start" ? console.time ? console.time(_) : i[_] = (/* @__PURE__ */ new Date()).getTime() : console.timeEnd ? console.timeEnd(_) : p(m, [_ + ": " + ((/* @__PURE__ */ new Date()).getTime() - i[_]) + "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);
})(Ue);
}(Z)), Z.exports;
}
var Me = Be();
const g = /* @__PURE__ */ $e(Me);
class He extends Event {
static type;
target;
constructor(t, n = !1) {
super(t, { cancelable: n });
}
}
class We 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 I extends He {
}
class H extends I {
static type = "ready";
constructor() {
super(H.type, !0);
}
}
class W extends I {
static type = "destroyed";
constructor() {
super(W.type, !0);
}
}
class j extends I {
static type = "clicked-call-to-action";
constructor() {
super(j.type, !0);
}
}
class G extends I {
static type = "toggled-visibility";
constructor() {
super(G.type, !0);
}
}
const $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
ClickedCallToAction: j,
DestroyedEvent: W,
ReadyEvent: H,
SmartAppBannerEvent: I,
ToggledVisibility: G
}, Symbol.toStringTag, { value: "Module" }));
String.prototype.isFalsishOrEmpty = function() {
return !this.trim();
};
class E extends Error {
constructor(t, n) {
super(
n && n instanceof Error ? `${t}: ${n.message}` : t
), this.name = "SmartAppBanner", Error.captureStackTrace?.(this, E);
}
}
function je(e, t) {
const n = function(r) {
const s = {
...e,
...r
};
Object.keys(s).forEach((c) => {
t && c in t || g.warn(`Unknown option ${c}`);
});
const l = {};
return Object.entries(s).forEach(([c, a]) => {
t && c in t && (l[c] = t[c](a, {
rawOptions: s,
defaultValue: e[c]
}));
}), g.debug(), l;
};
return n.defaults = e, n.parsers = t || {}, n;
}
const Ge = {
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,
appleButtonLabel: null,
appleIcon: null,
applePrice: "GET - On the App Store"
}, qe = {
title: (e) => {
if (e.isFalsishOrEmpty())
throw new E("No title has been configured.");
return e;
},
author: (e) => {
if (e.isFalsishOrEmpty())
throw new E("No author has been configured.");
return e;
},
icon: (e) => e?.isFalsishOrEmpty() ? null : e,
platforms: (e, { defaultValue: t }) => !e || e.length === 0 ? t : e,
price: (e) => e?.isFalsishOrEmpty() ? null : e,
buttonLabel: (e, { defaultValue: t }) => e?.isFalsishOrEmpty() ? t : e,
verbose: (e, { defaultValue: t }) => e ? (g.debug("verbose logging enabled"), e) : t,
dismissPath: (e, { defaultValue: t }) => e?.isFalsishOrEmpty() ? t : e,
googlePlayStoreUrl: (e, { rawOptions: t }) => {
if (!t.platforms?.includes("android")) return null;
const n = `The Android platform was enabled but no valid Google Play Store URL has been configured. Provided URL was "${e}"`;
if (e?.isFalsishOrEmpty())
throw new E(n);
try {
return new URL(e);
} catch {
throw new E(n);
}
},
androidButtonLabel: (e, { rawOptions: t }) => t.platforms?.includes("android") ? e ?? null : null,
androidIcon: (e, { rawOptions: t }) => {
if (!t.platforms?.includes("android")) return null;
if (t.platforms?.includes("android") && t.icon?.isFalsishOrEmpty() && e?.isFalsishOrEmpty())
throw new E(
"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 }) => {
if (!t.platforms?.includes("ios")) return null;
const n = `The iOS platform was enabled but no valid Apple App Store URL has been configured. Provided URL was "${e}"`;
if (e?.isFalsishOrEmpty())
throw new E(n);
try {
return new URL(e);
} catch {
throw new E(n);
}
},
appleButtonLabel: (e, { rawOptions: t }) => t.platforms?.includes("ios") ? e ?? null : null,
appleIcon: (e, { rawOptions: t }) => {
if (!t.platforms?.includes("ios")) return null;
if (t.platforms?.includes("ios") && t.icon?.isFalsishOrEmpty() && e?.isFalsishOrEmpty())
throw new E(
"The iOS platform was enabled but there is no icon defined at all"
);
return e ?? null;
},
applePrice: (e, { defaultValue: t }) => e ?? t
}, ze = je(Ge, qe);
function fe(e) {
let t;
g.debug("Current user agent: ", e);
const n = window.navigator.maxTouchPoints > 2;
if (!(/X11|Windows|Macintosh/i.test(e) && !n))
return /android|windows phone/i.test(e) && (t = "android"), /(?:iPhone|iPad|iPod)(?!.*(criOS|fxiOS|opiOS|chrome|android))/i.test(
e
) ? t = "safari" : (/(?:iPhone|iPad|iPod)/i.test(e) || n && /Macintosh/i.test(e)) && (t = "ios"), !t && g.debug("The current platform is not supported"), g.debug("Resolved current platform as:", t), t;
}
function J() {
const e = "smart-app-banner-dismissed";
function t(r) {
const s = {};
return document.cookie.split(";").forEach((l) => {
const [c, a] = l.split("=");
s[c.trim()] = a ?? "";
}), s[r];
}
function n(r, s) {
document.cookie = `${e}=${r ? 1 : 0}; path=${s?.isFalsishOrEmpty() ? "/" : s}`;
}
return {
isDismissed: () => t(e) === "1",
dismiss: (r) => n(!0, r),
show: (r) => n(!1, r)
};
}
class Je extends We {
options;
platform;
bannerId = "smart-app-banner";
__bannerElement = null;
constructor(t) {
super(), this.options = ze(t), this.options.verbose && (g.setLevel(g.DEBUG), window.getCurrentPlatform = void 0, window.getCurrentPlatform = fe), this.platform = fe(window.navigator.userAgent), g.info("successfully initialised");
}
mount() {
!this.platform || this.platform === "safari" || J().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), document.querySelector(".smartappbanner__close")?.addEventListener("click", this.onClickClose, !1), document.querySelector(".smartappbanner__view")?.addEventListener("click", this.onClickCallToAction, !1), g.debug("mounted banner"), g.timeEnd("mounting banner"), this.dispatchEvent(new H()));
}
destroy() {
!this.__bannerElement || !this.platform || this.platform === "safari" || (this.removeEventListeners(), this.__bannerElement.remove(), g.debug("destroyed banner"), this.options.verbose && (window.getCurrentPlatform = void 0), this.dispatchEvent(new W()));
}
setBannerVisibility(t) {
const n = J();
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 G());
}
onClickClose(t) {
t.preventDefault(), J().dismiss(this.options.dismissPath), this.destroy();
}
onClickCallToAction(t) {
this.dispatchEvent(new j());
}
removeEventListeners() {
document.querySelector(".smartappbanner__close")?.removeEventListener("click", this.onClickClose, !1), document.querySelector(".smartappbanner__view")?.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 E(
`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 he = Symbol(
"SmartAppBanner"
), Ut = {
install(e, t) {
let n;
try {
n = new Je(t);
} catch (r) {
$.warn(r);
}
n ? (e.config.globalProperties.$smartAppBanner = n, e.provide(he, 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 ee = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {};
process.env.NODE_ENV !== "production" && Object.freeze([]);
const me = () => {
}, Ke = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && // uppercase letter
(e.charCodeAt(2) > 122 || e.charCodeAt(2) < 97), q = Object.assign, y = Array.isArray, S = (e) => typeof e == "function", O = (e) => typeof e == "string", Ye = (e) => typeof e == "symbol", R = (e) => e !== null && typeof e == "object";
let pe;
const z = () => pe || (pe = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
function re(e) {
if (y(e)) {
const t = {};
for (let n = 0; n < e.length; n++) {
const r = e[n], s = O(r) ? et(r) : re(r);
if (s)
for (const l in s)
t[l] = s[l];
}
return t;
} else if (O(e) || R(e))
return e;
}
const Xe = /;(?![^(]*\))/g, Qe = /:([^]+)/, Ze = /\/\*[^]*?\*\//g;
function et(e) {
const t = {};
return e.replace(Ze, "").split(Xe).forEach((n) => {
if (n) {
const r = n.split(Qe);
r.length > 1 && (t[r[0].trim()] = r[1].trim());
}
}), t;
}
function ie(e) {
let t = "";
if (O(e))
t = e;
else if (y(e))
for (let n = 0; n < e.length; n++) {
const r = ie(e[n]);
r && (t += r + " ");
}
else if (R(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(Ye)
);
function ge(e) {
return te(e) ? ge(e.__v_raw) : !!(e && e.__v_isReactive);
}
function te(e) {
return !!(e && e.__v_isReadonly);
}
function K(e) {
return !!(e && e.__v_isShallow);
}
function ne(e) {
return e ? !!e.__v_raw : !1;
}
function L(e) {
const t = e && e.__v_raw;
return t ? L(t) : e;
}
function se(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 C = [];
function tt(e) {
C.push(e);
}
function nt() {
C.pop();
}
let Y = !1;
function N(e, ...t) {
if (Y) return;
Y = !0;
const n = C.length ? C[C.length - 1].component : null, r = n && n.appContext.config.warnHandler, s = ot();
if (r)
le(
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,
s.map(
({ vnode: l }) => `at <${De(n, l.type)}>`
).join(`
`),
s
]
);
else {
const l = [`[Vue warn]: ${e}`, ...t];
s.length && l.push(`
`, ...rt(s)), console.warn(...l);
}
Y = !1;
}
function ot() {
let e = C[C.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 rt(e) {
const t = [];
return e.forEach((n, r) => {
t.push(...r === 0 ? [] : [`
`], ...it(n));
}), t;
}
function it({ vnode: e, recurseCount: t }) {
const n = t > 0 ? `... (${t} recursive calls)` : "", r = e.component ? e.component.parent == null : !1, s = ` at <${De(
e.component,
e.type,
r
)}`, l = ">" + n;
return e.props ? [s, ...st(e.props), l] : [s + l];
}
function st(e) {
const t = [], n = Object.keys(e);
return n.slice(0, 3).forEach((r) => {
t.push(..._e(r, e[r]));
}), n.length > 3 && t.push(" ..."), t;
}
function _e(e, t, n) {
return O(t) ? (t = JSON.stringify(t), n ? t : [`${e}=${t}`]) : typeof t == "number" || typeof t == "boolean" || t == null ? n ? t : [`${e}=${t}`] : se(t) ? (t = _e(e, L(t.value), !0), n ? t : [`${e}=Ref<`, t, ">"]) : S(t) ? [`${e}=fn${t.name ? `<${t.name}>` : ""}`] : (t = L(t), n ? t : [`${e}=`, t]);
}
const ve = {
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 le(e, t, n, r) {
try {
return r ? e(...r) : e();
} catch (s) {
Ee(s, t, n);
}
}
function Ee(e, t, n, r = !0) {
const s = t ? t.vnode : null, { errorHandler: l, throwUnhandledErrorInProduction: c } = t && t.appContext.config || ee;
if (t) {
let a = t.parent;
const h = t.proxy, u = process.env.NODE_ENV !== "production" ? ve[n] : `https://vuejs.org/error-reference/#runtime-${n}`;
for (; a; ) {
const o = a.ec;
if (o) {
for (let i = 0; i < o.length; i++)
if (o[i](e, h, u) === !1)
return;
}
a = a.parent;
}
if (l) {
le(l, null, 10, [
e,
h,
u
]);
return;
}
}
lt(e, n, s, r, c);
}
function lt(e, t, n, r = !0, s = !1) {
if (process.env.NODE_ENV !== "production") {
const l = ve[t];
if (n && tt(n), N(`Unhandled error${l ? ` during execution of ${l}` : ""}`), n && nt(), r)
throw e;
console.error(e);
} else {
if (s)
throw e;
console.error(e);
}
}
const v = [];
let b = -1;
const T = [];
let w = null, F = 0;
const at = /* @__PURE__ */ Promise.resolve();
let oe = null;
const ct = 100;
function ut(e) {
let t = b + 1, n = v.length;
for (; t < n; ) {
const r = t + n >>> 1, s = v[r], l = D(s);
l < e || l === e && s.flags & 2 ? t = r + 1 : n = r;
}
return t;
}
function ft(e) {
if (!(e.flags & 1)) {
const t = D(e), n = v[v.length - 1];
!n || // fast path when the job id is larger than the tail
!(e.flags & 2) && t >= D(n) ? v.push(e) : v.splice(ut(t), 0, e), e.flags |= 1, ye();
}
}
function ye() {
oe || (oe = at.then(be));
}
function pt(e) {
y(e) ? T.push(...e) : w && e.id === -1 ? w.splice(F + 1, 0, e) : e.flags & 1 || (T.push(e), e.flags |= 1), ye();
}
function dt(e) {
if (T.length) {
const t = [...new Set(T)].sort(
(n, r) => D(n) - D(r)
);
if (T.length = 0, w) {
w.push(...t);
return;
}
for (w = t, process.env.NODE_ENV !== "production" && (e = e || /* @__PURE__ */ new Map()), F = 0; F < w.length; F++) {
const n = w[F];
process.env.NODE_ENV !== "production" && we(e, n) || (n.flags & 4 && (n.flags &= -2), n.flags & 8 || n(), n.flags &= -2);
}
w = null, F = 0;
}
}
const D = (e) => e.id == null ? e.flags & 2 ? -1 : 1 / 0 : e.id;
function be(e) {
process.env.NODE_ENV !== "production" && (e = e || /* @__PURE__ */ new Map());
const t = process.env.NODE_ENV !== "production" ? (n) => we(e, n) : me;
try {
for (b = 0; b < v.length; b++) {
const n = v[b];
if (n && !(n.flags & 8)) {
if (process.env.NODE_ENV !== "production" && t(n))
continue;
n.flags & 4 && (n.flags &= -2), le(
n,
n.i,
n.i ? 15 : 14
), n.flags & 4 || (n.flags &= -2);
}
}
} finally {
for (; b < v.length; b++) {
const n = v[b];
n && (n.flags &= -2);
}
b = -1, v.length = 0, dt(e), oe = null, (v.length || T.length) && be(e);
}
}
function we(e, t) {
const n = e.get(t) || 0;
if (n > ct) {
const r = t.i, s = r && Te(r.type);
return Ee(
`Maximum recursive updates exceeded${s ? ` in component <${s}>` : ""}. 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 X = /* @__PURE__ */ new Map();
process.env.NODE_ENV !== "production" && (z().__VUE_HMR_RUNTIME__ = {
createRecord: Q(ht),
rerender: Q(mt),
reload: Q(gt)
});
const U = /* @__PURE__ */ new Map();
function ht(e, t) {
return U.has(e) ? !1 : (U.set(e, {
initialDef: B(t),
instances: /* @__PURE__ */ new Set()
}), !0);
}
function B(e) {
return Ae(e) ? e.__vccOpts : e;
}
function mt(e, t) {
const n = U.get(e);
n && (n.initialDef.render = t, [...n.instances].forEach((r) => {
t && (r.render = t, B(r.type).render = t), r.renderCache = [], r.update();
}));
}
function gt(e, t) {
const n = U.get(e);
if (!n) return;
t = B(t), de(n.initialDef, t);
const r = [...n.instances];
for (let s = 0; s < r.length; s++) {
const l = r[s], c = B(l.type);
let a = X.get(c);
a || (c !== n.initialDef && de(c, t), X.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 ? ft(() => {
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);
}
pt(() => {
X.clear();
});
}
function de(e, t) {
q(e, t);
for (const n in e)
n !== "__file" && !(n in t) && delete e[n];
}
function Q(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, P = [];
function Oe(e, t) {
var n, r;
k = e, k ? (k.enabled = !0, P.forEach(({ event: s, args: l }) => k.emit(s, ...l)), P = []) : /* 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) => {
Oe(l, t);
}), setTimeout(() => {
k || (t.__VUE_DEVTOOLS_HOOK_REPLAY__ = null, P = []);
}, 3e3)) : P = [];
}
let A = null, _t = null;
const vt = (e) => e.__isTeleport;
function Ne(e, t) {
e.shapeFlag & 6 && e.component ? (e.transition = t, Ne(e.component.subTree, t)) : e.shapeFlag & 128 ? (e.ssContent.transition = t.clone(e.ssContent), e.ssFallback.transition = t.clone(e.ssFallback)) : e.transition = t;
}
z().requestIdleCallback;
z().cancelIdleCallback;
const Et = Symbol.for("v-ndc"), yt = {};
process.env.NODE_ENV !== "production" && (yt.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 bt = null;
function wt(e, t, n = !1) {
const r = ke || A;
if (r || bt) {
const s = r ? r.parent == null ? r.vnode.appContext && r.vnode.appContext.provides : r.parent.provides : void 0;
if (s && e in s)
return s[e];
if (arguments.length > 1)
return n && S(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 Ot = {}, Se = (e) => Object.getPrototypeOf(e) === Ot, Nt = (e) => e.__isSuspense, Re = Symbol.for("v-fgt"), St = Symbol.for("v-txt"), Rt = Symbol.for("v-cmt");
function Lt(e) {
return e ? e.__v_isVNode === !0 : !1;
}
const Ct = (...e) => Ce(
...e
), Le = ({ key: e }) => e ?? null, x = ({
ref: e,
ref_key: t,
ref_for: n
}) => (typeof e == "number" && (e = "" + e), e != null ? O(e) || se(e) || S(e) ? { i: A, r: e, k: t, f: !!n } : e : null);
function Ft(e, t = null, n = null, r = 0, s = null, l = e === Re ? 0 : 1, c = !1, a = !1) {
const h = {
__v_isVNode: !0,
__v_skip: !0,
type: e,
props: t,
key: t && Le(t),
ref: t && x(t),
scopeId: _t,
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: s,
dynamicChildren: null,
appContext: null,
ctx: A
};
return a ? (ae(h, n), l & 128 && e.normalize(h)) : n && (h.shapeFlag |= O(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 kt = process.env.NODE_ENV !== "production" ? Ct : Ce;
function Ce(e, t = null, n = null, r = 0, s = null, l = !1) {
if ((!e || e === Et) && (process.env.NODE_ENV !== "production" && !e && N(`Invalid vnode type when creating vnode: ${e}.`), e = Rt), Lt(e)) {
const a = M(
e,
t,
!0
/* mergeRef: true */
);
return n && ae(a, n), a.patchFlag = -2, a;
}
if (Ae(e) && (e = e.__vccOpts), t) {
t = Tt(t);
let { class: a, style: h } = t;
a && !O(a) && (t.class = ie(a)), R(h) && (ne(h) && !y(h) && (h = q({}, h)), t.style = re(h));
}
const c = O(e) ? 1 : Nt(e) ? 128 : vt(e) ? 64 : R(e) ? 4 : S(e) ? 2 : 0;
return process.env.NODE_ENV !== "production" && c & 4 && ne(e) && (e = L(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
)), Ft(
e,
t,
n,
r,
s,
c,
l,
!0
);
}
function Tt(e) {
return e ? ne(e) || Se(e) ? q({}, e) : e : null;
}
function M(e, t, n = !1, r = !1) {
const { props: s, ref: l, patchFlag: c, children: a, transition: h } = e, u = t ? At(s || {}, t) : s, o = {
__v_isVNode: !0,
__v_skip: !0,
type: e.type,
props: u,
key: u && Le(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 ? y(l) ? l.concat(x(t)) : [l, x(t)] : x(t)
) : l,
scopeId: e.scopeId,
slotScopeIds: e.slotScopeIds,
children: process.env.NODE_ENV !== "production" && c === -1 && y(a) ? a.map(Fe) : 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 !== Re ? 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 && M(e.ssContent),
ssFallback: e.ssFallback && M(e.ssFallback),
el: e.el,
anchor: e.anchor,
ctx: e.ctx,
ce: e.ce
};
return h && r && Ne(
o,
h.clone(o)
), o;
}
function Fe(e) {
const t = M(e);
return y(e.children) && (t.children = e.children.map(Fe)), t;
}
function Dt(e = " ", t = 0) {
return kt(St, null, e, t);
}
function ae(e, t) {
let n = 0;
const { shapeFlag: r } = e;
if (t == null)
t = null;
else if (y(t))
n = 16;
else if (typeof t == "object")
if (r & 65) {
const s = t.default;
s && (s._c && (s._d = !1), ae(e, s()), s._c && (s._d = !0));
return;
} else
n = 32, !t._ && !Se(t) && (t._ctx = A);
else S(t) ? (t = { default: t, _ctx: A }, n = 32) : (t = String(t), r & 64 ? (n = 16, t = [Dt(t)]) : n = 8);
e.children = t, e.shapeFlag |= n;
}
function At(...e) {
const t = {};
for (let n = 0; n < e.length; n++) {
const r = e[n];
for (const s in r)
if (s === "class")
t.class !== r.class && (t.class = ie([t.class, r.class]));
else if (s === "style")
t.style = re([t.style, r.style]);
else if (Ke(s)) {
const l = t[s], c = r[s];
c && l !== c && !(y(l) && l.includes(c)) && (t[s] = l ? [].concat(l, c) : c);
} else s !== "" && (t[s] = r[s]);
}
return t;
}
let ke = null;
{
const e = z(), t = (n, r) => {
let s;
return (s = e[n]) || (s = e[n] = []), s.push(r), (l) => {
s.length > 1 ? s.forEach((c) => c(l)) : s[0](l);
};
};
t(
"__VUE_INSTANCE_SETTERS__",
(n) => ke = n
), t(
"__VUE_SSR_SETTERS__",
(n) => n
);
}
process.env.NODE_ENV;
const It = /(?:^|[-_])(\w)/g, Pt = (e) => e.replace(It, (t) => t.toUpperCase()).replace(/[-_]/g, "");
function Te(e, t = !0) {
return S(e) ? e.displayName || e.name : e.name || t && e.__name;
}
function De(e, t, n = !1) {
let r = Te(t);
if (!r && t.__file) {
const s = t.__file.match(/([^/\\]+)\.\w+$/);
s && (r = s[1]);
}
if (!r && e && e.parent) {
const s = (l) => {
for (const c in l)
if (l[c] === t)
return c;
};
r = s(
e.components || e.parent.type.components
) || s(e.appContext.components);
}
return r ? Pt(r) : n ? "App" : "Anonymous";
}
function Ae(e) {
return S(e) && "__vccOpts" in e;
}
function Vt() {
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" }, s = {
__vue_custom_formatter: !0,
header(i) {
return R(i) ? i.__isVue ? ["div", e, "VueInstance"] : se(i) ? [
"div",
{},
["span", e, o(i)],
"<",
// avoid debugger accessing value affecting behavior
a("_value" in i ? i._value : i),
">"
] : ge(i) ? [
"div",
{},
["span", e, K(i) ? "ShallowReactive" : "Reactive"],
"<",
a(i),
`>${te(i) ? " (readonly)" : ""}`
] : te(i) ? [
"div",
{},
["span", e, K(i) ? "ShallowReadonly" : "Readonly"],
"<",
a(i),
">"
] : null : null;
},
hasBody(i) {
return i && i.__isVue;
},
body(i) {
if (i && i.__isVue)
return [
"div",
{},
...l(i.$)
];
}
};
function l(i) {
const p = [];
i.type.props && i.props && p.push(c("props", L(i.props))), i.setupState !== ee && p.push(c("setup", i.setupState)), i.data !== ee && p.push(c("data", L(i.data)));
const f = h(i, "computed");
f && p.push(c("computed", f));
const d = h(i, "inject");
return d && p.push(c("injected", d)), p.push([
"div",
{},
[
"span",
{
style: r.style + ";opacity:0.66"
},
"$ (internal): "
],
["object", { object: i }]
]), p;
}
function c(i, p) {
return p = q({}, p), Object.keys(p).length ? [
"div",
{ style: "line-height:1.25em;margin-bottom:0.6em" },
[
"div",
{
style: "color:#476582"
},
i
],
[
"div",
{
style: "padding-left:1.25em"
},
...Object.keys(p).map((f) => [
"div",
{},
["span", r, f + ": "],
a(p[f], !1)
])
]
] : ["span", {}];
}
function a(i, p = !0) {
return typeof i == "number" ? ["span", t, i] : typeof i == "string" ? ["span", n, JSON.stringify(i)] : typeof i == "boolean" ? ["span", r, i] : R(i) ? ["object", { object: p ? L(i) : i }] : ["span", n, String(i)];
}
function h(i, p) {
const f = i.type;
if (S(f))
return;
const d = {};
for (const m in i.ctx)
u(f, m, p) && (d[m] = i.ctx[m]);
return d;
}
function u(i, p, f) {
const d = i[f];
if (y(d) && d.includes(p) || R(d) && p in d || i.extends && u(i.extends, p, f) || i.mixins && i.mixins.some((m) => u(m, p, f)))
return !0;
}
function o(i) {
return K(i) ? "ShallowRef" : i.effect ? "ComputedRef" : "Ref";
}
window.devtoolsFormatters ? window.devtoolsFormatters.push(s) : window.devtoolsFormatters = [s];
}
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 xt() {
Vt();
}
process.env.NODE_ENV !== "production" && xt();
function Bt() {
const e = wt(he);
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 {
Ge as DEFAULT_OPTIONS,
qe as OPTION_PARSERS,
Je as SmartAppBanner,
he as SmartAppBannerInjectionKey,
Ut as default,
$t as events,
Bt as useSmartAppBanner
};
//# sourceMappingURL=index.js.map