2024-08-20 23:05:39 -07:00
|
|
|
/*
|
2024-08-21 00:31:35 -07:00
|
|
|
Cook The Books v2.1.1
|
2024-08-20 23:05:39 -07:00
|
|
|
Licensed under CC BY-SA 4.0
|
|
|
|
Copyright 2022-2024 Oldgate Studios
|
|
|
|
Copyright 2019-2024 ScriptsTown
|
|
|
|
Copyright 2003-2024 The WordPress.org Team
|
|
|
|
*/
|
|
|
|
var cookthebooks = cookthebooks || {};
|
|
|
|
function cookthebooksDomReady(e) {
|
|
|
|
if ("function" == typeof e)
|
|
|
|
return "interactive" === document.readyState || "complete" === document.readyState ? e() : void document.addEventListener("DOMContentLoaded", e, !1)
|
|
|
|
}
|
|
|
|
Math.easeInOutQuad = function(e, t, n, a) {
|
|
|
|
return (e /= a / 2) < 1 ? n / 2 * e * e + t : -n / 2 * (--e * (e - 2) - 1) + t
|
|
|
|
}
|
|
|
|
,
|
|
|
|
cookthebooks.setupMainMenu = {
|
|
|
|
init: function() {
|
|
|
|
var e, t, n, a, o, i, s, r = document.getElementById("site-navigation");
|
|
|
|
r && (t = r.getElementsByTagName("ul")[0],
|
|
|
|
e = r.querySelector(".primary-menu-toggle"),
|
|
|
|
void 0 === t ? e && (e.style.display = "none") : (t.classList.add("nav-menu"),
|
|
|
|
t = r.querySelectorAll(".main-navigation-arrow-btn"),
|
|
|
|
n = r.querySelectorAll("li > a"),
|
|
|
|
a = r.querySelectorAll("li:not(.menu-item-has-children) > a"),
|
|
|
|
o = r.querySelectorAll("li:last-child:not(.menu-item-has-children) > a"),
|
|
|
|
i = r.querySelector(".primary-menu-search"),
|
|
|
|
s = r.querySelector(".primary-menu-search-toggle"),
|
|
|
|
this.toggleTouchClass(r),
|
|
|
|
this.toggleNavigation(e, r),
|
|
|
|
this.collapseIfClickOutside(e, r),
|
|
|
|
this.collapseIfEscapeKeyPress(e, r),
|
|
|
|
this.collapseOnResize(e, r),
|
|
|
|
this.toggleSubmenu(t, n, a, o),
|
|
|
|
this.trapFocusInModal(r),
|
|
|
|
this.toggleSearch(s, i),
|
|
|
|
this.trapFocusInSearch(i)))
|
|
|
|
},
|
|
|
|
toggleTouchClass: function(e) {
|
|
|
|
const t = "main-navigation--touch";
|
|
|
|
function n() {
|
|
|
|
return "ontouchstart"in window || 0 < navigator.maxTouchPoints || 0 < navigator.msMaxTouchPoints
|
|
|
|
}
|
|
|
|
n() && e.classList.add(t),
|
|
|
|
window.addEventListener("resize", function() {
|
|
|
|
n() ? e.classList.add(t) : e.classList.remove(t)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toggleNavigation: function(t, n) {
|
|
|
|
t && t.addEventListener("click", function(e) {
|
|
|
|
e.preventDefault(),
|
|
|
|
n.classList.toggle("toggled"),
|
|
|
|
t && ("true" === t.getAttribute("aria-expanded") ? t.setAttribute("aria-expanded", "false") : t.setAttribute("aria-expanded", "true"))
|
|
|
|
})
|
|
|
|
},
|
|
|
|
collapseIfClickOutside: function(e, t) {
|
|
|
|
const n = this;
|
|
|
|
document.addEventListener("click", function(e) {
|
|
|
|
t.contains(e.target) || t.classList.contains("toggled") || ([].forEach.call(t.querySelectorAll(".focus"), function(e) {
|
|
|
|
e.classList.remove("focus")
|
|
|
|
}),
|
|
|
|
[].forEach.call(t.querySelectorAll(".main-navigation-arrow-btn"), function(e) {
|
|
|
|
e.setAttribute("aria-expanded", "false")
|
|
|
|
}),
|
|
|
|
n.collapseSearchForm(t))
|
|
|
|
})
|
|
|
|
},
|
|
|
|
collapseIfEscapeKeyPress: function(t, n) {
|
|
|
|
const a = this;
|
|
|
|
document.addEventListener("keyup", function(e) {
|
|
|
|
"Escape" === e.key && (n.classList.remove("toggled"),
|
|
|
|
t && t.setAttribute("aria-expanded", "false"),
|
|
|
|
a.collapseSearchForm(n))
|
|
|
|
})
|
|
|
|
},
|
|
|
|
collapseOnResize: function(e, t) {
|
|
|
|
window.addEventListener("resize", function() {
|
|
|
|
window.matchMedia("screen and (min-width: 768px)").matches && (t.classList.remove("toggled"),
|
|
|
|
e) && e.setAttribute("aria-expanded", "false")
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toggleSubmenu: function(e, t, n, a) {
|
|
|
|
function o() {
|
|
|
|
for (var e = this, t = !1; "ul" !== e.tagName.toLowerCase(); )
|
|
|
|
"li" !== e.tagName.toLowerCase() || t || e.classList.contains("focus") || (t = e),
|
|
|
|
e = e.parentElement;
|
|
|
|
[].forEach.call(e.querySelectorAll(".focus"), function(e) {
|
|
|
|
e.classList.remove("focus")
|
|
|
|
}),
|
|
|
|
[].forEach.call(e.querySelectorAll(".main-navigation-arrow-btn"), function(e) {
|
|
|
|
e.setAttribute("aria-expanded", "false")
|
|
|
|
}),
|
|
|
|
t && (t.classList.add("focus"),
|
|
|
|
this.setAttribute("aria-expanded", "true"))
|
|
|
|
}
|
|
|
|
function i(e) {
|
|
|
|
var t = this.parentElement
|
|
|
|
, n = "Tab" === e.key
|
|
|
|
, e = e.shiftKey;
|
|
|
|
n && e && t.classList.contains("focus") ? (t.classList.remove("focus"),
|
|
|
|
this.setAttribute("aria-expanded", "false")) : !n || e || t.classList.contains("focus") || (t.classList.add("focus"),
|
|
|
|
this.setAttribute("aria-expanded", "true"))
|
|
|
|
}
|
|
|
|
function s() {
|
|
|
|
for (var e = this, t = !1; !e.classList.contains("nav-menu"); )
|
|
|
|
t || "ul" !== e.tagName.toLowerCase() || ([].forEach.call(e.querySelectorAll(".focus"), function(e) {
|
|
|
|
e.classList.remove("focus")
|
|
|
|
}),
|
|
|
|
[].forEach.call(e.querySelectorAll(".main-navigation-arrow-btn"), function(e) {
|
|
|
|
e.setAttribute("aria-expanded", "false")
|
|
|
|
}),
|
|
|
|
t = !0),
|
|
|
|
e = e.parentElement
|
|
|
|
}
|
|
|
|
function r() {
|
|
|
|
for (var e = this; !e.classList.contains("nav-menu"); )
|
|
|
|
"li" === e.tagName.toLowerCase() && !e.classList.contains("focus") && (e.classList.add("focus"),
|
|
|
|
e.querySelector(".main-navigation-arrow-btn")) && this.setAttribute("aria-expanded", "true"),
|
|
|
|
e = e.parentElement
|
|
|
|
}
|
|
|
|
function c(e) {
|
|
|
|
var t, n = this, a = "Tab" === e.key, e = e.shiftKey;
|
|
|
|
if (a && !e) {
|
|
|
|
for (; t = function(e) {
|
|
|
|
for (; (e = e.nextSibling) && 1 !== e.nodeType; )
|
|
|
|
;
|
|
|
|
return e
|
|
|
|
}(n),
|
|
|
|
n = n.parentElement,
|
|
|
|
!t; )
|
|
|
|
;
|
|
|
|
[].forEach.call(n.querySelectorAll(".focus"), function(e) {
|
|
|
|
e.classList.remove("focus")
|
|
|
|
}),
|
|
|
|
[].forEach.call(n.querySelectorAll(".main-navigation-arrow-btn"), function(e) {
|
|
|
|
e.setAttribute("aria-expanded", "false")
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
[].forEach.call(e, function(e) {
|
|
|
|
e.addEventListener("click", o),
|
|
|
|
e.addEventListener("keydown", i)
|
|
|
|
}),
|
|
|
|
[].forEach.call(t, function(e) {
|
|
|
|
e.addEventListener("focus", s)
|
|
|
|
}),
|
|
|
|
[].forEach.call(n, function(e) {
|
|
|
|
e.addEventListener("focus", r)
|
|
|
|
}),
|
|
|
|
[].forEach.call(a, function(e) {
|
|
|
|
e.addEventListener("keydown", c)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
trapFocusInModal: function(s) {
|
|
|
|
document.addEventListener("keydown", function(e) {
|
|
|
|
var t, n, a, o, i;
|
|
|
|
!s.classList.contains("toggled") || (n = s.querySelectorAll("input, a, button")).length < 1 || (t = n[0],
|
|
|
|
n = n[n.length - 1],
|
|
|
|
a = document.activeElement,
|
|
|
|
o = "Tab" === e.key,
|
|
|
|
i = e.shiftKey,
|
|
|
|
o && !i && n === a && (e.preventDefault(),
|
|
|
|
t.focus()),
|
|
|
|
o && i && t === a && (e.preventDefault(),
|
|
|
|
n.focus()))
|
|
|
|
})
|
|
|
|
},
|
|
|
|
toggleSearch: function(t, n) {
|
|
|
|
t && n && t.addEventListener("click", function(e) {
|
|
|
|
e.preventDefault(),
|
|
|
|
n.classList.toggle("toggled"),
|
|
|
|
"true" === t.getAttribute("aria-expanded") ? t.setAttribute("aria-expanded", "false") : t.setAttribute("aria-expanded", "true")
|
|
|
|
})
|
|
|
|
},
|
|
|
|
collapseSearchForm: function(e) {
|
|
|
|
var t = e.querySelector(".primary-menu-search")
|
|
|
|
, e = e.querySelector(".primary-menu-search-toggle");
|
|
|
|
t && t.classList.remove("toggled"),
|
|
|
|
e && e.setAttribute("aria-expanded", "false")
|
|
|
|
},
|
|
|
|
trapFocusInSearch: function(s) {
|
|
|
|
document.addEventListener("keydown", function(e) {
|
|
|
|
var t, n, a, o, i;
|
|
|
|
s && s.classList.contains("toggled") && (n = s.querySelector(".primary-menu-search-toggle"),
|
|
|
|
"none" === window.getComputedStyle(n, null).display || (n = s.querySelectorAll("input, a, button")).length < 1 || (t = n[0],
|
|
|
|
n = n[n.length - 1],
|
|
|
|
a = document.activeElement,
|
|
|
|
o = "Tab" === e.key,
|
|
|
|
i = e.shiftKey,
|
|
|
|
o && !i && n === a && (e.preventDefault(),
|
|
|
|
t.focus()),
|
|
|
|
o && i && t === a && (e.preventDefault(),
|
|
|
|
n.focus())))
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
cookthebooks.goToTop = {
|
|
|
|
offset: 300,
|
|
|
|
offsetOpacity: 1200,
|
|
|
|
scrollDuration: 700,
|
|
|
|
init: function() {
|
|
|
|
var e = document.querySelector(".go-to-top");
|
|
|
|
e && (this.handleScroll(e),
|
|
|
|
this.handleClick(e))
|
|
|
|
},
|
|
|
|
handleScroll: function(t) {
|
|
|
|
var n = this.offset
|
|
|
|
, a = this.offsetOpacity
|
|
|
|
, o = !1;
|
|
|
|
function e() {
|
|
|
|
var e = window.scrollY || document.documentElement.scrollTop;
|
|
|
|
n < e ? t.classList.add("go-to-top--show") : (t.classList.remove("go-to-top--show"),
|
|
|
|
t.classList.remove("go-to-top--fade-out")),
|
|
|
|
a < e && t.classList.add("go-to-top--fade-out"),
|
|
|
|
o = !1
|
|
|
|
}
|
|
|
|
window.addEventListener("scroll", function() {
|
|
|
|
o || (o = !0,
|
|
|
|
window.requestAnimationFrame ? window.requestAnimationFrame(e) : setTimeout(e, 250))
|
|
|
|
})
|
|
|
|
},
|
|
|
|
handleClick: function(t) {
|
|
|
|
t.addEventListener("click", function(e) {
|
|
|
|
function n(e) {
|
|
|
|
var e = e - (r = r || e)
|
|
|
|
, t = (o < e && (e = o),
|
|
|
|
Math.easeInOutQuad(e, s, a - s, o));
|
|
|
|
window.scrollTo(0, t),
|
|
|
|
e < o ? window.requestAnimationFrame(n) : i && i()
|
|
|
|
}
|
|
|
|
var a, o, i, s, r;
|
|
|
|
e.preventDefault(),
|
|
|
|
window.requestAnimationFrame ? (a = 0,
|
|
|
|
o = this.scrollDuration,
|
|
|
|
s = window.scrollY || document.documentElement.scrollTop,
|
|
|
|
r = null,
|
|
|
|
window.requestAnimationFrame(n)) : window.scrollTo(0, 0),
|
|
|
|
t.blur()
|
|
|
|
}
|
|
|
|
.bind(this))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
cookthebooksDomReady(function() {
|
|
|
|
cookthebooks.setupMainMenu.init(),
|
|
|
|
cookthebooks.goToTop.init()
|
|
|
|
});
|
|
|
|
/*
|
|
|
|
ResizeObserver.js
|
|
|
|
*/
|
|
|
|
!function(t, e) {
|
|
|
|
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : t.ResizeObserver = e()
|
|
|
|
}(this, function() {
|
|
|
|
"use strict";
|
|
|
|
var r = function() {
|
|
|
|
if ("undefined" != typeof Map)
|
|
|
|
return Map;
|
|
|
|
function r(t, n) {
|
|
|
|
var r = -1;
|
|
|
|
return t.some(function(t, e) {
|
|
|
|
return t[0] === n && (r = e,
|
|
|
|
!0)
|
|
|
|
}),
|
|
|
|
r
|
|
|
|
}
|
|
|
|
return function() {
|
|
|
|
function t() {
|
|
|
|
this.__entries__ = []
|
|
|
|
}
|
|
|
|
return Object.defineProperty(t.prototype, "size", {
|
|
|
|
get: function() {
|
|
|
|
return this.__entries__.length
|
|
|
|
},
|
|
|
|
enumerable: !0,
|
|
|
|
configurable: !0
|
|
|
|
}),
|
|
|
|
t.prototype.get = function(t) {
|
|
|
|
var e = r(this.__entries__, t)
|
|
|
|
, n = this.__entries__[e];
|
|
|
|
return n && n[1]
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.set = function(t, e) {
|
|
|
|
var n = r(this.__entries__, t);
|
|
|
|
~n ? this.__entries__[n][1] = e : this.__entries__.push([t, e])
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.delete = function(t) {
|
|
|
|
var e = this.__entries__
|
|
|
|
, n = r(e, t);
|
|
|
|
~n && e.splice(n, 1)
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.has = function(t) {
|
|
|
|
return !!~r(this.__entries__, t)
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.clear = function() {
|
|
|
|
this.__entries__.splice(0)
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.forEach = function(t, e) {
|
|
|
|
void 0 === e && (e = null);
|
|
|
|
for (var n = 0, r = this.__entries__; n < r.length; n++) {
|
|
|
|
var i = r[n];
|
|
|
|
t.call(e, i[1], i[0])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
, n = "undefined" != typeof window && "undefined" != typeof document && window.document === document
|
|
|
|
, e = "undefined" != typeof global && global.Math === Math ? global : "undefined" != typeof self && self.Math === Math ? self : "undefined" != typeof window && window.Math === Math ? window : Function("return this")()
|
|
|
|
, a = "function" == typeof requestAnimationFrame ? requestAnimationFrame.bind(e) : function(t) {
|
|
|
|
return setTimeout(function() {
|
|
|
|
return t(Date.now())
|
|
|
|
}, 1e3 / 60)
|
|
|
|
}
|
|
|
|
, h = 2;
|
|
|
|
var i = ["top", "right", "bottom", "left", "width", "height", "size", "weight"]
|
|
|
|
, o = "undefined" != typeof MutationObserver
|
|
|
|
, s = function() {
|
|
|
|
function t() {
|
|
|
|
this.connected_ = !1,
|
|
|
|
this.mutationEventsAdded_ = !1,
|
|
|
|
this.mutationsObserver_ = null,
|
|
|
|
this.observers_ = [],
|
|
|
|
this.onTransitionEnd_ = this.onTransitionEnd_.bind(this),
|
|
|
|
this.refresh = function(t, e) {
|
|
|
|
var n = !1
|
|
|
|
, r = !1
|
|
|
|
, i = 0;
|
|
|
|
function o() {
|
|
|
|
n && (n = !1,
|
|
|
|
t()),
|
|
|
|
r && c()
|
|
|
|
}
|
|
|
|
function s() {
|
|
|
|
a(o)
|
|
|
|
}
|
|
|
|
function c() {
|
|
|
|
var t = Date.now();
|
|
|
|
if (n) {
|
|
|
|
if (t - i < h)
|
|
|
|
return;
|
|
|
|
r = !0
|
|
|
|
} else
|
|
|
|
r = !(n = !0),
|
|
|
|
setTimeout(s, e);
|
|
|
|
i = t
|
|
|
|
}
|
|
|
|
return c
|
|
|
|
}(this.refresh.bind(this), 20)
|
|
|
|
}
|
|
|
|
return t.prototype.addObserver = function(t) {
|
|
|
|
~this.observers_.indexOf(t) || this.observers_.push(t),
|
|
|
|
this.connected_ || this.connect_()
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.removeObserver = function(t) {
|
|
|
|
var e = this.observers_
|
|
|
|
, n = e.indexOf(t);
|
|
|
|
~n && e.splice(n, 1),
|
|
|
|
!e.length && this.connected_ && this.disconnect_()
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.refresh = function() {
|
|
|
|
this.updateObservers_() && this.refresh()
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.updateObservers_ = function() {
|
|
|
|
var t = this.observers_.filter(function(t) {
|
|
|
|
return t.gatherActive(),
|
|
|
|
t.hasActive()
|
|
|
|
});
|
|
|
|
return t.forEach(function(t) {
|
|
|
|
return t.broadcastActive()
|
|
|
|
}),
|
|
|
|
0 < t.length
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.connect_ = function() {
|
|
|
|
n && !this.connected_ && (document.addEventListener("transitionend", this.onTransitionEnd_),
|
|
|
|
window.addEventListener("resize", this.refresh),
|
|
|
|
o ? (this.mutationsObserver_ = new MutationObserver(this.refresh),
|
|
|
|
this.mutationsObserver_.observe(document, {
|
|
|
|
attributes: !0,
|
|
|
|
childList: !0,
|
|
|
|
characterData: !0,
|
|
|
|
subtree: !0
|
|
|
|
})) : (document.addEventListener("DOMSubtreeModified", this.refresh),
|
|
|
|
this.mutationEventsAdded_ = !0),
|
|
|
|
this.connected_ = !0)
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.disconnect_ = function() {
|
|
|
|
n && this.connected_ && (document.removeEventListener("transitionend", this.onTransitionEnd_),
|
|
|
|
window.removeEventListener("resize", this.refresh),
|
|
|
|
this.mutationsObserver_ && this.mutationsObserver_.disconnect(),
|
|
|
|
this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh),
|
|
|
|
this.mutationsObserver_ = null,
|
|
|
|
this.mutationEventsAdded_ = !1,
|
|
|
|
this.connected_ = !1)
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.onTransitionEnd_ = function(t) {
|
|
|
|
var e = t.propertyName
|
|
|
|
, n = void 0 === e ? "" : e;
|
|
|
|
i.some(function(t) {
|
|
|
|
return !!~n.indexOf(t)
|
|
|
|
}) && this.refresh()
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.getInstance = function() {
|
|
|
|
return this.instance_ || (this.instance_ = new t),
|
|
|
|
this.instance_
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.instance_ = null,
|
|
|
|
t
|
|
|
|
}()
|
|
|
|
, u = function(t, e) {
|
|
|
|
for (var n = 0, r = Object.keys(e); n < r.length; n++) {
|
|
|
|
var i = r[n];
|
|
|
|
Object.defineProperty(t, i, {
|
|
|
|
value: e[i],
|
|
|
|
enumerable: !1,
|
|
|
|
writable: !1,
|
|
|
|
configurable: !0
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return t
|
|
|
|
}
|
|
|
|
, d = function(t) {
|
|
|
|
return t && t.ownerDocument && t.ownerDocument.defaultView || e
|
|
|
|
}
|
|
|
|
, p = b(0, 0, 0, 0);
|
|
|
|
function v(t) {
|
|
|
|
return parseFloat(t) || 0
|
|
|
|
}
|
|
|
|
function l(n) {
|
|
|
|
for (var t = [], e = 1; e < arguments.length; e++)
|
|
|
|
t[e - 1] = arguments[e];
|
|
|
|
return t.reduce(function(t, e) {
|
|
|
|
return t + v(n["border-" + e + "-width"])
|
|
|
|
}, 0)
|
|
|
|
}
|
|
|
|
function c(t) {
|
|
|
|
var e = t.clientWidth
|
|
|
|
, n = t.clientHeight;
|
|
|
|
if (!e && !n)
|
|
|
|
return p;
|
|
|
|
var r, i = d(t).getComputedStyle(t), o = function(t) {
|
|
|
|
for (var e = {}, n = 0, r = ["top", "right", "bottom", "left"]; n < r.length; n++) {
|
|
|
|
var i = r[n]
|
|
|
|
, o = t["padding-" + i];
|
|
|
|
e[i] = v(o)
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}(i), s = o.left + o.right, c = o.top + o.bottom, a = v(i.width), h = v(i.height);
|
|
|
|
if ("border-box" === i.boxSizing && (Math.round(a + s) !== e && (a -= l(i, "left", "right") + s),
|
|
|
|
Math.round(h + c) !== n && (h -= l(i, "top", "bottom") + c)),
|
|
|
|
(r = t) !== d(r).document.documentElement) {
|
|
|
|
var u = Math.round(a + s) - e
|
|
|
|
, f = Math.round(h + c) - n;
|
|
|
|
1 !== Math.abs(u) && (a -= u),
|
|
|
|
1 !== Math.abs(f) && (h -= f)
|
|
|
|
}
|
|
|
|
return b(o.left, o.top, a, h)
|
|
|
|
}
|
|
|
|
var f = "undefined" != typeof SVGGraphicsElement ? function(t) {
|
|
|
|
return t instanceof d(t).SVGGraphicsElement
|
|
|
|
}
|
|
|
|
: function(t) {
|
|
|
|
return t instanceof d(t).SVGElement && "function" == typeof t.getBBox
|
|
|
|
}
|
|
|
|
;
|
|
|
|
function _(t) {
|
|
|
|
return n ? f(t) ? b(0, 0, (e = t.getBBox()).width, e.height) : c(t) : p;
|
|
|
|
var e
|
|
|
|
}
|
|
|
|
function b(t, e, n, r) {
|
|
|
|
return {
|
|
|
|
x: t,
|
|
|
|
y: e,
|
|
|
|
width: n,
|
|
|
|
height: r
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var m = function() {
|
|
|
|
function t(t) {
|
|
|
|
this.broadcastWidth = 0,
|
|
|
|
this.broadcastHeight = 0,
|
|
|
|
this.contentRect_ = b(0, 0, 0, 0),
|
|
|
|
this.target = t
|
|
|
|
}
|
|
|
|
return t.prototype.isActive = function() {
|
|
|
|
var t = _(this.target);
|
|
|
|
return (this.contentRect_ = t).width !== this.broadcastWidth || t.height !== this.broadcastHeight
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.broadcastRect = function() {
|
|
|
|
var t = this.contentRect_;
|
|
|
|
return this.broadcastWidth = t.width,
|
|
|
|
this.broadcastHeight = t.height,
|
|
|
|
t
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t
|
|
|
|
}()
|
|
|
|
, y = function(t, e) {
|
|
|
|
var n, r, i, o, s, c, a, h = (r = (n = e).x,
|
|
|
|
i = n.y,
|
|
|
|
o = n.width,
|
|
|
|
s = n.height,
|
|
|
|
c = "undefined" != typeof DOMRectReadOnly ? DOMRectReadOnly : Object,
|
|
|
|
a = Object.create(c.prototype),
|
|
|
|
u(a, {
|
|
|
|
x: r,
|
|
|
|
y: i,
|
|
|
|
width: o,
|
|
|
|
height: s,
|
|
|
|
top: i,
|
|
|
|
right: r + o,
|
|
|
|
bottom: s + i,
|
|
|
|
left: r
|
|
|
|
}),
|
|
|
|
a);
|
|
|
|
u(this, {
|
|
|
|
target: t,
|
|
|
|
contentRect: h
|
|
|
|
})
|
|
|
|
}
|
|
|
|
, g = function() {
|
|
|
|
function t(t, e, n) {
|
|
|
|
if (this.activeObservations_ = [],
|
|
|
|
this.observations_ = new r,
|
|
|
|
"function" != typeof t)
|
|
|
|
throw new TypeError("The callback provided as parameter 1 is not a function.");
|
|
|
|
this.callback_ = t,
|
|
|
|
this.controller_ = e,
|
|
|
|
this.callbackCtx_ = n
|
|
|
|
}
|
|
|
|
return t.prototype.observe = function(t) {
|
|
|
|
if (!arguments.length)
|
|
|
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
|
|
if ("undefined" != typeof Element && Element instanceof Object) {
|
|
|
|
if (!(t instanceof d(t).Element))
|
|
|
|
throw new TypeError('parameter 1 is not of type "Element".');
|
|
|
|
var e = this.observations_;
|
|
|
|
e.has(t) || (e.set(t, new m(t)),
|
|
|
|
this.controller_.addObserver(this),
|
|
|
|
this.controller_.refresh())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.unobserve = function(t) {
|
|
|
|
if (!arguments.length)
|
|
|
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
|
|
if ("undefined" != typeof Element && Element instanceof Object) {
|
|
|
|
if (!(t instanceof d(t).Element))
|
|
|
|
throw new TypeError('parameter 1 is not of type "Element".');
|
|
|
|
var e = this.observations_;
|
|
|
|
e.has(t) && (e.delete(t),
|
|
|
|
e.size || this.controller_.removeObserver(this))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.disconnect = function() {
|
|
|
|
this.clearActive(),
|
|
|
|
this.observations_.clear(),
|
|
|
|
this.controller_.removeObserver(this)
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.gatherActive = function() {
|
|
|
|
var e = this;
|
|
|
|
this.clearActive(),
|
|
|
|
this.observations_.forEach(function(t) {
|
|
|
|
t.isActive() && e.activeObservations_.push(t)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.broadcastActive = function() {
|
|
|
|
if (this.hasActive()) {
|
|
|
|
var t = this.callbackCtx_
|
|
|
|
, e = this.activeObservations_.map(function(t) {
|
|
|
|
return new y(t.target,t.broadcastRect())
|
|
|
|
});
|
|
|
|
this.callback_.call(t, e, t),
|
|
|
|
this.clearActive()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.clearActive = function() {
|
|
|
|
this.activeObservations_.splice(0)
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t.prototype.hasActive = function() {
|
|
|
|
return 0 < this.activeObservations_.length
|
|
|
|
}
|
|
|
|
,
|
|
|
|
t
|
|
|
|
}()
|
|
|
|
, w = "undefined" != typeof WeakMap ? new WeakMap : new r
|
|
|
|
, t = function t(e) {
|
|
|
|
if (!(this instanceof t))
|
|
|
|
throw new TypeError("Cannot call a class as a function.");
|
|
|
|
if (!arguments.length)
|
|
|
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
|
|
var n = s.getInstance()
|
|
|
|
, r = new g(e,n,this);
|
|
|
|
w.set(this, r)
|
|
|
|
};
|
|
|
|
return ["observe", "unobserve", "disconnect"].forEach(function(e) {
|
|
|
|
t.prototype[e] = function() {
|
|
|
|
var t;
|
|
|
|
return (t = w.get(this))[e].apply(t, arguments)
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
void 0 !== e.ResizeObserver ? e.ResizeObserver : t
|
|
|
|
});
|
|
|
|
/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */
|
|
|
|
var twemoji = function () {
|
|
|
|
"use strict";
|
|
|
|
var twemoji = {
|
|
|
|
base: "https://cdn.jsdelivr.net/gh/jdecked/twemoji@15.1.0/assets/",
|
|
|
|
ext: ".svg",
|
|
|
|
size: "svg",
|
|
|
|
className: "emoji",
|
|
|
|
convert: {
|
|
|
|
fromCodePoint: fromCodePoint,
|
|
|
|
toCodePoint: toCodePoint
|
|
|
|
},
|
|
|
|
onerror: function onerror() {
|
|
|
|
if (this.parentNode) {
|
|
|
|
this.parentNode.replaceChild(createText(this.alt, false), this)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
parse: parse,
|
|
|
|
replace: replace,
|
|
|
|
test: test
|
|
|
|
},
|
|
|
|
escaper = {
|
|
|
|
"&": "&",
|
|
|
|
"<": "<",
|
|
|
|
">": ">",
|
|
|
|
"'": "'",
|
|
|
|
'"': """
|
|
|
|
},
|
|
|
|
re = /(?:\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffc-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffd-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb\udffc\udffe\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffd\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c[\udffb-\udffe]|\ud83d\udc68\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc68\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d\u2764\ufe0f\u200d\ud83d\udc69\ud83c[\udffb-\udfff]|\ud83d\udc69\ud83c\udffe\u200d
|
|
|
|
UFE0Fg = /\uFE0F/g,
|
|
|
|
U200D = String.fromCharCode(8205),
|
|
|
|
rescaper = /[&<>'"]/g,
|
|
|
|
shouldntBeParsed = /^(?:iframe|noframes|noscript|script|select|style|textarea)$/,
|
|
|
|
fromCharCode = String.fromCharCode;
|
|
|
|
return twemoji;
|
|
|
|
|
|
|
|
function createText(text, clean) {
|
|
|
|
return document.createTextNode(clean ? text.replace(UFE0Fg, "") : text)
|
|
|
|
}
|
|
|
|
|
|
|
|
function escapeHTML(s) {
|
|
|
|
return s.replace(rescaper, replacer)
|
|
|
|
}
|
|
|
|
|
|
|
|
function defaultImageSrcGenerator(icon, options) {
|
|
|
|
return "".concat(options.base, options.size, "/", icon, options.ext)
|
|
|
|
}
|
|
|
|
|
|
|
|
function grabAllTextNodes(node, allText) {
|
|
|
|
var childNodes = node.childNodes,
|
|
|
|
length = childNodes.length,
|
|
|
|
subnode, nodeType;
|
|
|
|
while (length--) {
|
|
|
|
subnode = childNodes[length];
|
|
|
|
nodeType = subnode.nodeType;
|
|
|
|
if (nodeType === 3) {
|
|
|
|
allText.push(subnode)
|
|
|
|
} else if (nodeType === 1 && !("ownerSVGElement" in subnode) && !shouldntBeParsed.test(subnode.nodeName.toLowerCase())) {
|
|
|
|
grabAllTextNodes(subnode, allText)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return allText
|
|
|
|
}
|
|
|
|
|
|
|
|
function grabTheRightIcon(rawText) {
|
|
|
|
return toCodePoint(rawText.indexOf(U200D) < 0 ? rawText.replace(UFE0Fg, "") : rawText)
|
|
|
|
}
|
|
|
|
|
|
|
|
function parseNode(node, options) {
|
|
|
|
var allText = grabAllTextNodes(node, []),
|
|
|
|
length = allText.length,
|
|
|
|
attrib, attrname, modified, fragment, subnode, text, match, i, index, img, rawText, iconId, src;
|
|
|
|
while (length--) {
|
|
|
|
modified = false;
|
|
|
|
fragment = document.createDocumentFragment();
|
|
|
|
subnode = allText[length];
|
|
|
|
text = subnode.nodeValue;
|
|
|
|
i = 0;
|
|
|
|
while (match = re.exec(text)) {
|
|
|
|
index = match.index;
|
|
|
|
if (index !== i) {
|
|
|
|
fragment.appendChild(createText(text.slice(i, index), true))
|
|
|
|
}
|
|
|
|
rawText = match[0];
|
|
|
|
iconId = grabTheRightIcon(rawText);
|
|
|
|
i = index + rawText.length;
|
|
|
|
src = options.callback(iconId, options);
|
|
|
|
if (iconId && src) {
|
|
|
|
img = new Image;
|
|
|
|
img.onerror = options.onerror;
|
|
|
|
img.setAttribute("draggable", "false");
|
|
|
|
img.setAttribute("loading", "lazy");
|
|
|
|
attrib = options.attributes(rawText, iconId);
|
|
|
|
for (attrname in attrib) {
|
|
|
|
if (attrib.hasOwnProperty(attrname) && attrname.indexOf("on") !== 0 && !img.hasAttribute(attrname)) {
|
|
|
|
img.setAttribute(attrname, attrib[attrname])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
img.className = options.className;
|
|
|
|
img.alt = rawText;
|
|
|
|
img.src = src;
|
|
|
|
modified = true;
|
|
|
|
fragment.appendChild(img)
|
|
|
|
}
|
|
|
|
if (!img)
|
|
|
|
fragment.appendChild(createText(rawText, false));
|
|
|
|
img = null
|
|
|
|
}
|
|
|
|
if (modified) {
|
|
|
|
if (i < text.length) {
|
|
|
|
fragment.appendChild(createText(text.slice(i), true))
|
|
|
|
}
|
|
|
|
subnode.parentNode.replaceChild(fragment, subnode)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return node
|
|
|
|
}
|
|
|
|
|
|
|
|
function parseString(str, options) {
|
|
|
|
return replace(str, function(rawText) {
|
|
|
|
var ret = rawText,
|
|
|
|
iconId = grabTheRightIcon(rawText),
|
|
|
|
src = options.callback(iconId, options),
|
|
|
|
attrib, attrname;
|
|
|
|
if (iconId && src) {
|
|
|
|
ret = "<img ".concat('class="', options.className, '" ', 'draggable="false" ', 'loading="lazy" ', 'alt="', rawText, '"', ' src="', src, '"');
|
|
|
|
attrib = options.attributes(rawText, iconId);
|
|
|
|
for (attrname in attrib) {
|
|
|
|
if (attrib.hasOwnProperty(attrname) && attrname.indexOf("on") !== 0 && ret.indexOf(" " + attrname + "=") === -1) {
|
|
|
|
ret = ret.concat(" ", attrname, '="', escapeHTML(attrib[attrname]), '"')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ret = ret.concat("/>")
|
|
|
|
}
|
|
|
|
return ret
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function replacer(m) {
|
|
|
|
return escaper[m]
|
|
|
|
}
|
|
|
|
|
|
|
|
function returnNull() {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
function toSizeSquaredAsset(value) {
|
|
|
|
return typeof value === "number" ? value + "x" + value : value
|
|
|
|
}
|
|
|
|
|
|
|
|
function fromCodePoint(codepoint) {
|
|
|
|
var code = typeof codepoint === "string" ? parseInt(codepoint, 16) : codepoint;
|
|
|
|
if (code < 65536) {
|
|
|
|
return fromCharCode(code)
|
|
|
|
}
|
|
|
|
code -= 65536;
|
|
|
|
return fromCharCode(55296 + (code >> 10), 56320 + (code & 1023))
|
|
|
|
}
|
|
|
|
|
|
|
|
function parse(what, how) {
|
|
|
|
if (!how || typeof how === "function") {
|
|
|
|
how = {
|
|
|
|
callback: how
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (typeof what === "string" ? parseString : parseNode)(what, {
|
|
|
|
callback: how.callback || defaultImageSrcGenerator,
|
|
|
|
attributes: typeof how.attributes === "function" ? how.attributes : returnNull,
|
|
|
|
base: typeof how.base === "string" ? how.base : twemoji.base,
|
|
|
|
ext: how.ext || twemoji.ext,
|
|
|
|
size: how.folder || toSizeSquaredAsset(how.size || twemoji.size),
|
|
|
|
className: how.className || twemoji.className,
|
|
|
|
onerror: how.onerror || twemoji.onerror
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function replace(text, callback) {
|
|
|
|
return String(text).replace(re, callback)
|
|
|
|
}
|
|
|
|
|
|
|
|
function test(text) {
|
|
|
|
re.lastIndex = 0;
|
|
|
|
var result = re.test(text);
|
|
|
|
re.lastIndex = 0;
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
function toCodePoint(unicodeSurrogates, sep) {
|
|
|
|
var r = [],
|
|
|
|
c = 0,
|
|
|
|
p = 0,
|
|
|
|
i = 0;
|
|
|
|
while (i < unicodeSurrogates.length) {
|
|
|
|
c = unicodeSurrogates.charCodeAt(i++);
|
|
|
|
if (p) {
|
|
|
|
r.push((65536 + (p - 55296 << 10) + (c - 56320)).toString(16));
|
|
|
|
p = 0
|
|
|
|
} else if (55296 <= c && c <= 56319) {
|
|
|
|
p = c
|
|
|
|
} else {
|
|
|
|
r.push(c.toString(16))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return r.join(sep || "-")
|
|
|
|
}
|
|
|
|
}();
|