reveal.js
Version:
The HTML Presentation Framework
961 lines • 139 kB
JavaScript
//#region js/utils/util.ts
var e = (e, t) => {
for (let n in t) e[n] = t[n];
return e;
}, t = (e, t) => Array.from(e.querySelectorAll(t)), n = (e, t, n) => {
n ? e.classList.add(t) : e.classList.remove(t);
}, r = (e) => {
if (typeof e == "string") {
if (e === "null") return null;
if (e === "true") return !0;
if (e === "false") return !1;
if (e.match(/^-?[\d\.]+$/)) return parseFloat(e);
}
return e;
}, i = (e, t) => {
e.style.transform = t;
}, a = (e, t) => {
let n = e.matches || e.matchesSelector || e.msMatchesSelector;
return !!(n && n.call(e, t));
}, o = (e, t) => {
if (e && typeof e.closest == "function") return e.closest(t);
for (; e;) {
if (a(e, t)) return e;
e = e.parentElement;
}
return null;
}, s = (e) => {
e = e || document.documentElement;
let t = e.requestFullscreen || e.webkitRequestFullscreen || e.webkitRequestFullScreen || e.mozRequestFullScreen || e.msRequestFullscreen;
t && t.apply(e);
}, c = (e, t, n, r = "") => {
let i = e.querySelectorAll("." + n);
for (let t = 0; t < i.length; t++) {
let n = i[t];
if (n.parentNode === e) return n;
}
let a = document.createElement(t);
return a.className = n, a.innerHTML = r, e.appendChild(a), a;
}, l = (e) => {
let t = document.createElement("style");
return e && e.length > 0 && t.appendChild(document.createTextNode(e)), document.head.appendChild(t), t;
}, u = () => {
let e = {};
location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi, (t) => {
let n = t.split("=").shift(), r = t.split("=").pop();
return n && r !== void 0 && (e[n] = r), t;
});
for (let t in e) {
let n = e[t];
e[t] = r(unescape(n));
}
return e.dependencies !== void 0 && delete e.dependencies, e;
}, d = (e, t = 0) => {
if (e) {
var n;
let r, i = e.style.height;
return e.style.height = "0px", e.parentElement && (e.parentElement.style.height = "auto"), r = t - (((n = e.parentElement) == null ? void 0 : n.offsetHeight) || 0), e.style.height = i + "px", e.parentElement && e.parentElement.style.removeProperty("height"), r;
}
return t;
}, f = {
mp4: "video/mp4",
m4a: "video/mp4",
ogv: "video/ogg",
mpeg: "video/mpeg",
webm: "video/webm"
}, p = (e = "") => {
let t = e.split(".").pop();
return t ? f[t] : void 0;
}, m = (e = "") => encodeURI(e).replace(/%5B/g, "[").replace(/%5D/g, "]").replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`), h = navigator.userAgent, g = /(iphone|ipod|ipad|android)/gi.test(h) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
/chrome/i.test(h) && /edge/i.test(h);
var _ = /android/gi.test(h), v = function(e) {
if (e) {
var t = function(e) {
return [].slice.call(e);
}, n = 0, r = 1, i = 2, a = 3, o = [], s = null, c = "requestAnimationFrame" in e ? function() {
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { sync: !1 };
e.cancelAnimationFrame(s);
var n = function() {
return u(o.filter((function(e) {
return e.dirty && e.active;
})));
};
if (t.sync) return n();
s = e.requestAnimationFrame(n);
} : function() {}, l = function(e) {
return function(t) {
o.forEach((function(t) {
return t.dirty = e;
})), c(t);
};
}, u = function(e) {
e.filter((function(e) {
return !e.styleComputed;
})).forEach((function(e) {
e.styleComputed = m(e);
})), e.filter(h).forEach(g);
var t = e.filter(p);
t.forEach(f), t.forEach((function(e) {
g(e), d(e);
})), t.forEach(_);
}, d = function(e) {
return e.dirty = n;
}, f = function(e) {
e.availableWidth = e.element.parentNode.clientWidth, e.currentWidth = e.element.scrollWidth, e.previousFontSize = e.currentFontSize, e.currentFontSize = Math.min(Math.max(e.minSize, e.availableWidth / e.currentWidth * e.previousFontSize), e.maxSize), e.whiteSpace = e.multiLine && e.currentFontSize === e.minSize ? "normal" : "nowrap";
}, p = function(e) {
return e.dirty !== i || e.dirty === i && e.element.parentNode.clientWidth !== e.availableWidth;
}, m = function(t) {
var n = e.getComputedStyle(t.element, null);
return t.currentFontSize = parseFloat(n.getPropertyValue("font-size")), t.display = n.getPropertyValue("display"), t.whiteSpace = n.getPropertyValue("white-space"), !0;
}, h = function(e) {
var t = !1;
return !e.preStyleTestCompleted && (/inline-/.test(e.display) || (t = !0, e.display = "inline-block"), e.whiteSpace !== "nowrap" && (t = !0, e.whiteSpace = "nowrap"), e.preStyleTestCompleted = !0, t);
}, g = function(e) {
e.element.style.whiteSpace = e.whiteSpace, e.element.style.display = e.display, e.element.style.fontSize = e.currentFontSize + "px";
}, _ = function(e) {
e.element.dispatchEvent(new CustomEvent("fit", { detail: {
oldValue: e.previousFontSize,
newValue: e.currentFontSize,
scaleFactor: e.currentFontSize / e.previousFontSize
} }));
}, v = function(e, t) {
return function(n) {
e.dirty = t, e.active && c(n);
};
}, y = function(e) {
return function() {
o = o.filter((function(t) {
return t.element !== e.element;
})), e.observeMutations && e.observer.disconnect(), e.element.style.whiteSpace = e.originalStyle.whiteSpace, e.element.style.display = e.originalStyle.display, e.element.style.fontSize = e.originalStyle.fontSize;
};
}, b = function(e) {
return function() {
e.active || (e.active = !0, c());
};
}, x = function(e) {
return function() {
return e.active = !1;
};
}, S = function(e) {
e.observeMutations && (e.observer = new MutationObserver(v(e, r)), e.observer.observe(e.element, e.observeMutations));
}, ee = {
minSize: 16,
maxSize: 512,
multiLine: !0,
observeMutations: "MutationObserver" in e && {
subtree: !0,
childList: !0,
characterData: !0
}
}, C = null, w = function() {
e.clearTimeout(C), C = e.setTimeout(l(i), E.observeWindowDelay);
}, te = ["resize", "orientationchange"];
return Object.defineProperty(E, "observeWindow", { set: function(t) {
var n = `${t ? "add" : "remove"}EventListener`;
te.forEach((function(t) {
e[n](t, w);
}));
} }), E.observeWindow = !0, E.observeWindowDelay = 100, E.fitAll = l(a), E;
}
function T(e, t) {
var n = Object.assign({}, ee, t), r = e.map((function(e) {
var t = Object.assign({}, n, {
element: e,
active: !0
});
return function(e) {
e.originalStyle = {
whiteSpace: e.element.style.whiteSpace,
display: e.element.style.display,
fontSize: e.element.style.fontSize
}, S(e), e.newbie = !0, e.dirty = !0, o.push(e);
}(t), {
element: e,
fit: v(t, a),
unfreeze: b(t),
freeze: x(t),
unsubscribe: y(t)
};
}));
return c(), r;
}
function E(e) {
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
return typeof e == "string" ? T(t(document.querySelectorAll(e)), n) : T([e], n)[0];
}
}(typeof window > "u" ? null : window);
//#endregion
//#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
function y(e) {
"@babel/helpers - typeof";
return y = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, y(e);
}
//#endregion
//#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
function b(e, t) {
if (y(e) != "object" || !e) return e;
var n = e[Symbol.toPrimitive];
if (n !== void 0) {
var r = n.call(e, t || "default");
if (y(r) != "object") return r;
throw TypeError("@@toPrimitive must return a primitive value.");
}
return (t === "string" ? String : Number)(e);
}
//#endregion
//#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
function x(e) {
var t = b(e, "string");
return y(t) == "symbol" ? t : t + "";
}
//#endregion
//#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
function S(e, t, n) {
return (t = x(t)) in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n, e;
}
//#endregion
//#region js/controllers/slidecontent.js
var ee = class {
constructor(e) {
S(this, "allowedToPlayAudio", null), this.Reveal = e, this.startEmbeddedMedia = this.startEmbeddedMedia.bind(this), this.startEmbeddedIframe = this.startEmbeddedIframe.bind(this), this.preventIframeAutoFocus = this.preventIframeAutoFocus.bind(this), this.ensureMobileMediaPlaying = this.ensureMobileMediaPlaying.bind(this), this.failedAudioPlaybackTargets = /* @__PURE__ */ new Set(), this.failedVideoPlaybackTargets = /* @__PURE__ */ new Set(), this.failedMutedVideoPlaybackTargets = /* @__PURE__ */ new Set(), this.renderMediaPlayButton();
}
renderMediaPlayButton() {
this.mediaPlayButton = document.createElement("button"), this.mediaPlayButton.className = "r-overlay-button r-media-play-button", this.mediaPlayButton.addEventListener("click", () => {
this.resetTemporarilyMutedMedia(), new Set([
...this.failedAudioPlaybackTargets,
...this.failedVideoPlaybackTargets,
...this.failedMutedVideoPlaybackTargets
]).forEach((e) => {
this.startEmbeddedMedia({ target: e });
}), this.clearMediaPlaybackErrors();
});
}
shouldPreload(e) {
if (this.Reveal.isScrollView()) return !0;
let t = this.Reveal.getConfig().preloadIframes;
return typeof t != "boolean" && (t = e.hasAttribute("data-preload")), t;
}
load(e, n = {}) {
let r = this.Reveal.getConfig().display;
if (r.includes("!important")) {
let t = r.replace(/\s*!important\s*$/, "").trim();
e.style.setProperty("display", t, "important");
} else e.style.display = r;
t(e, "img[data-src], video[data-src], audio[data-src], iframe[data-src]").forEach((e) => {
let t = e.tagName === "IFRAME";
(!t || this.shouldPreload(e)) && (e.setAttribute("src", e.getAttribute("data-src")), e.setAttribute("data-lazy-loaded", ""), e.removeAttribute("data-src"), t && e.addEventListener("load", this.preventIframeAutoFocus));
}), t(e, "video, audio").forEach((e) => {
let n = 0;
t(e, "source[data-src]").forEach((e) => {
e.setAttribute("src", e.getAttribute("data-src")), e.removeAttribute("data-src"), e.setAttribute("data-lazy-loaded", ""), n += 1;
}), g && e.tagName === "VIDEO" && e.setAttribute("playsinline", ""), n > 0 && e.load();
});
let i = e.slideBackgroundElement;
if (i) {
i.style.display = "block";
let t = e.slideBackgroundContentElement, r = e.getAttribute("data-background-iframe");
if (i.hasAttribute("data-loaded") === !1) {
i.setAttribute("data-loaded", "true");
let a = e.getAttribute("data-background-image"), o = e.getAttribute("data-background-video"), s = e.hasAttribute("data-background-video-loop"), c = e.hasAttribute("data-background-video-muted");
if (a) /^data:/.test(a.trim()) ? t.style.backgroundImage = `url(${a.trim()})` : t.style.backgroundImage = a.split(",").map((e) => `url(${m(decodeURI(e.trim()))})`).join(",");
else if (o) {
let e = document.createElement("video");
s && e.setAttribute("loop", ""), (c || this.Reveal.isSpeakerNotes()) && (e.muted = !0), g && e.setAttribute("playsinline", ""), o.split(",").forEach((t) => {
let n = document.createElement("source");
n.setAttribute("src", t);
let r = p(t);
r && n.setAttribute("type", r), e.appendChild(n);
}), t.appendChild(e);
} else if (r && n.excludeIframes !== !0) {
let e = document.createElement("iframe");
e.setAttribute("allowfullscreen", ""), e.setAttribute("mozallowfullscreen", ""), e.setAttribute("webkitallowfullscreen", ""), e.setAttribute("allow", "autoplay"), e.setAttribute("data-src", r), e.style.width = "100%", e.style.height = "100%", e.style.maxHeight = "100%", e.style.maxWidth = "100%", t.appendChild(e);
}
}
let a = t.querySelector("iframe[data-src]");
a && this.shouldPreload(i) && !/autoplay=(1|true|yes)/gi.test(r) && a.getAttribute("src") !== r && a.setAttribute("src", r);
}
this.layout(e);
}
layout(e) {
Array.from(e.querySelectorAll(".r-fit-text")).forEach((e) => {
v(e, {
minSize: 24,
maxSize: this.Reveal.getConfig().height * .8,
observeMutations: !1,
observeWindow: !1
});
});
}
unload(e) {
e.style.display = "none";
let n = this.Reveal.getSlideBackground(e);
n && (n.style.display = "none", t(n, "iframe[src]").forEach((e) => {
e.removeAttribute("src");
})), t(e, "video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]").forEach((e) => {
e.setAttribute("data-src", e.getAttribute("src")), e.removeAttribute("src");
}), t(e, "video[data-lazy-loaded] source[src], audio source[src]").forEach((e) => {
e.setAttribute("data-src", e.getAttribute("src")), e.removeAttribute("src");
});
}
formatEmbeddedContent() {
let e = (e, n, r) => {
t(this.Reveal.getSlidesElement(), "iframe[" + e + "*=\"" + n + "\"]").forEach((t) => {
let n = t.getAttribute(e);
n && n.indexOf(r) === -1 && t.setAttribute(e, n + (/\?/.test(n) ? "&" : "?") + r);
});
};
e("src", "youtube.com/embed/", "enablejsapi=1"), e("data-src", "youtube.com/embed/", "enablejsapi=1"), e("src", "player.vimeo.com/", "api=1"), e("data-src", "player.vimeo.com/", "api=1");
}
startEmbeddedContent(e) {
if (e) {
let n = this.Reveal.isSpeakerNotes();
t(e, "img[src$=\".gif\"]").forEach((e) => {
e.setAttribute("src", e.getAttribute("src"));
}), t(e, "video, audio").forEach((e) => {
if (o(e, ".fragment") && !o(e, ".fragment.visible")) return;
let t = this.Reveal.getConfig().autoPlayMedia;
if (typeof t != "boolean" && (t = e.hasAttribute("data-autoplay") || !!o(e, ".slide-background")), t && typeof e.play == "function") {
if (n && !e.muted) return;
e.readyState > 1 ? this.startEmbeddedMedia({ target: e }) : g ? (e.addEventListener("canplay", this.ensureMobileMediaPlaying), this.playMediaElement(e)) : (e.removeEventListener("loadeddata", this.startEmbeddedMedia), e.addEventListener("loadeddata", this.startEmbeddedMedia));
}
}), n || (t(e, "iframe[src]").forEach((e) => {
o(e, ".fragment") && !o(e, ".fragment.visible") || this.startEmbeddedIframe({ target: e });
}), t(e, "iframe[data-src]").forEach((e) => {
o(e, ".fragment") && !o(e, ".fragment.visible") || e.getAttribute("src") !== e.getAttribute("data-src") && (e.removeEventListener("load", this.startEmbeddedIframe), e.addEventListener("load", this.startEmbeddedIframe), e.setAttribute("src", e.getAttribute("data-src")));
}));
}
}
ensureMobileMediaPlaying(e) {
let t = e.target;
typeof t.getVideoPlaybackQuality == "function" && setTimeout(() => {
let e = t.paused === !1, n = t.getVideoPlaybackQuality().totalVideoFrames;
e && n === 0 && (t.load(), t.play());
}, 1e3);
}
startEmbeddedMedia(e) {
let t = !!o(e.target, "html"), n = !!o(e.target, ".present");
t && n && (e.target.paused || e.target.ended) && (e.target.currentTime = 0, this.playMediaElement(e.target)), e.target.removeEventListener("loadeddata", this.startEmbeddedMedia);
}
playMediaElement(e) {
let t = e.play();
t && typeof t.catch == "function" && t.then(() => {
e.muted || (this.allowedToPlayAudio = !0);
}).catch((t) => {
if (t.name === "NotAllowedError") if (this.allowedToPlayAudio = !1, e.tagName === "VIDEO") {
this.onVideoPlaybackNotAllowed(e);
let t = !!o(e, "html"), n = !!o(e, ".present"), r = e.muted;
t && n && !r && (e.setAttribute("data-muted-by-reveal", "true"), e.muted = !0, e.play().catch(() => {
this.onMutedVideoPlaybackNotAllowed(e);
}));
} else e.tagName === "AUDIO" && this.onAudioPlaybackNotAllowed(e);
});
}
startEmbeddedIframe(e) {
let t = e.target;
if (this.preventIframeAutoFocus(e), t && t.contentWindow) {
let n = !!o(e.target, "html"), r = !!o(e.target, ".present");
if (n && r) {
let e = this.Reveal.getConfig().autoPlayMedia;
typeof e != "boolean" && (e = t.hasAttribute("data-autoplay") || !!o(t, ".slide-background")), /youtube\.com\/embed\//.test(t.getAttribute("src")) && e ? t.contentWindow.postMessage("{\"event\":\"command\",\"func\":\"playVideo\",\"args\":\"\"}", "*") : /player\.vimeo\.com\//.test(t.getAttribute("src")) && e ? t.contentWindow.postMessage("{\"method\":\"play\"}", "*") : t.contentWindow.postMessage("slide:start", "*");
}
}
}
stopEmbeddedContent(n, r = {}) {
r = e({ unloadIframes: !0 }, r), n && n.parentNode && (t(n, "video, audio").forEach((e) => {
!e.hasAttribute("data-ignore") && typeof e.pause == "function" && (e.setAttribute("data-paused-by-reveal", ""), e.pause(), g && e.removeEventListener("canplay", this.ensureMobileMediaPlaying));
}), t(n, "iframe").forEach((e) => {
e.contentWindow && e.contentWindow.postMessage("slide:stop", "*"), e.removeEventListener("load", this.preventIframeAutoFocus), e.removeEventListener("load", this.startEmbeddedIframe);
}), t(n, "iframe[src*=\"youtube.com/embed/\"]").forEach((e) => {
!e.hasAttribute("data-ignore") && e.contentWindow && typeof e.contentWindow.postMessage == "function" && e.contentWindow.postMessage("{\"event\":\"command\",\"func\":\"pauseVideo\",\"args\":\"\"}", "*");
}), t(n, "iframe[src*=\"player.vimeo.com/\"]").forEach((e) => {
!e.hasAttribute("data-ignore") && e.contentWindow && typeof e.contentWindow.postMessage == "function" && e.contentWindow.postMessage("{\"method\":\"pause\"}", "*");
}), r.unloadIframes === !0 && t(n, "iframe[data-src]").forEach((e) => {
e.setAttribute("src", "about:blank"), e.removeAttribute("src");
}));
}
isAllowedToPlayAudio() {
return this.allowedToPlayAudio;
}
showPlayOrUnmuteButton() {
let e = this.failedAudioPlaybackTargets.size, t = this.failedVideoPlaybackTargets.size, n = this.failedMutedVideoPlaybackTargets.size, r = "Play media";
n > 0 ? r = "Play video" : t > 0 ? r = "Unmute video" : e > 0 && (r = "Play audio"), this.mediaPlayButton.textContent = r, this.Reveal.getRevealElement().appendChild(this.mediaPlayButton);
}
onAudioPlaybackNotAllowed(e) {
this.failedAudioPlaybackTargets.add(e), this.showPlayOrUnmuteButton(e);
}
onVideoPlaybackNotAllowed(e) {
this.failedVideoPlaybackTargets.add(e), this.showPlayOrUnmuteButton();
}
onMutedVideoPlaybackNotAllowed(e) {
this.failedMutedVideoPlaybackTargets.add(e), this.showPlayOrUnmuteButton();
}
resetTemporarilyMutedMedia() {
new Set([
...this.failedAudioPlaybackTargets,
...this.failedVideoPlaybackTargets,
...this.failedMutedVideoPlaybackTargets
]).forEach((e) => {
e.hasAttribute("data-muted-by-reveal") && (e.muted = !1, e.removeAttribute("data-muted-by-reveal"));
});
}
clearMediaPlaybackErrors() {
this.resetTemporarilyMutedMedia(), this.failedAudioPlaybackTargets.clear(), this.failedVideoPlaybackTargets.clear(), this.failedMutedVideoPlaybackTargets.clear(), this.mediaPlayButton && this.mediaPlayButton.parentNode && this.mediaPlayButton.remove();
}
preventIframeAutoFocus(e) {
let t = e.target;
if (t && this.Reveal.getConfig().preventIframeAutoFocus) {
let e = 0, n = () => {
document.activeElement === t ? document.activeElement.blur() : e < 1e3 && (e += 100, setTimeout(n, 100));
};
setTimeout(n, 100);
}
}
afterSlideChanged() {
this.clearMediaPlaybackErrors();
}
}, C = ".slides section", w = ".slides>section", te = ".slides>section.present>section", T = ".backgrounds>.slide-background", E = /registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview|previewIframe/, ne = class {
constructor(e) {
this.Reveal = e;
}
render() {
this.element = document.createElement("div"), this.element.className = "slide-number", this.Reveal.getRevealElement().appendChild(this.element);
}
configure(e, t) {
let n = "none";
e.slideNumber && !this.Reveal.isPrintView() && (e.showSlideNumber === "all" || e.showSlideNumber === "speaker" && this.Reveal.isSpeakerNotes()) && (n = "block"), this.element.style.display = n;
}
update() {
this.Reveal.getConfig().slideNumber && this.element && (this.element.innerHTML = this.getSlideNumber());
}
getSlideNumber(e = this.Reveal.getCurrentSlide()) {
let t = this.Reveal.getConfig(), n, r = "h.v";
if (typeof t.slideNumber == "function") n = t.slideNumber(e);
else {
typeof t.slideNumber == "string" && (r = t.slideNumber), !/c/.test(r) && this.Reveal.getHorizontalSlides().length === 1 && (r = "c");
let i = e && e.dataset.visibility === "uncounted" ? 0 : 1;
switch (n = [], r) {
case "c":
n.push(this.Reveal.getSlidePastCount(e) + i);
break;
case "c/t":
n.push(this.Reveal.getSlidePastCount(e) + i, "/", this.Reveal.getTotalSlides());
break;
default:
let t = this.Reveal.getIndices(e);
n.push(t.h + i);
let a = r === "h/v" ? "/" : ".";
this.Reveal.isVerticalSlide(e) && n.push(a, t.v + 1);
}
}
let i = "#" + this.Reveal.location.getHash(e);
return this.formatNumber(n[0], n[1], n[2], i);
}
formatNumber(e, t, n, r = "#" + this.Reveal.location.getHash()) {
return typeof n == "number" && !isNaN(n) ? `<a href="${r}">
<span class="slide-number-a">${e}</span>
<span class="slide-number-delimiter">${t}</span>
<span class="slide-number-b">${n}</span>
</a>` : `<a href="${r}">
<span class="slide-number-a">${e}</span>
</a>`;
}
destroy() {
this.element.remove();
}
}, re = class {
constructor(e) {
this.Reveal = e, this.onInput = this.onInput.bind(this), this.onBlur = this.onBlur.bind(this), this.onKeyDown = this.onKeyDown.bind(this);
}
render() {
this.element = document.createElement("div"), this.element.className = "jump-to-slide", this.jumpInput = document.createElement("input"), this.jumpInput.type = "text", this.jumpInput.className = "jump-to-slide-input", this.jumpInput.placeholder = "Jump to slide", this.jumpInput.addEventListener("input", this.onInput), this.jumpInput.addEventListener("keydown", this.onKeyDown), this.jumpInput.addEventListener("blur", this.onBlur), this.element.appendChild(this.jumpInput);
}
show() {
this.indicesOnShow = this.Reveal.getIndices(), this.Reveal.getRevealElement().appendChild(this.element), this.jumpInput.focus();
}
hide() {
this.isVisible() && (this.element.remove(), this.jumpInput.value = "", clearTimeout(this.jumpTimeout), delete this.jumpTimeout);
}
isVisible() {
return !!this.element.parentNode;
}
jump() {
clearTimeout(this.jumpTimeout), delete this.jumpTimeout;
let e = this.jumpInput.value.trim(""), t;
if (/^\d+$/.test(e)) {
let n = this.Reveal.getConfig().slideNumber;
if (n === "c" || n === "c/t") {
let n = this.Reveal.getSlides()[parseInt(e, 10) - 1];
n && (t = this.Reveal.getIndices(n));
}
}
return t || (/^\d+\.\d+$/.test(e) && (e = e.replace(".", "/")), t = this.Reveal.location.getIndicesFromHash(e, { oneBasedIndex: !0 })), !t && /\S+/i.test(e) && e.length > 1 && (t = this.search(e)), t && e !== "" ? (this.Reveal.slide(t.h, t.v, t.f), !0) : (this.Reveal.slide(this.indicesOnShow.h, this.indicesOnShow.v, this.indicesOnShow.f), !1);
}
jumpAfter(e) {
clearTimeout(this.jumpTimeout), this.jumpTimeout = setTimeout(() => this.jump(), e);
}
search(e) {
let t = RegExp("\\b" + e.trim() + "\\b", "i"), n = this.Reveal.getSlides().find((e) => t.test(e.innerText));
return n ? this.Reveal.getIndices(n) : null;
}
cancel() {
this.Reveal.slide(this.indicesOnShow.h, this.indicesOnShow.v, this.indicesOnShow.f), this.hide();
}
confirm() {
this.jump(), this.hide();
}
destroy() {
this.jumpInput.removeEventListener("input", this.onInput), this.jumpInput.removeEventListener("keydown", this.onKeyDown), this.jumpInput.removeEventListener("blur", this.onBlur), this.element.remove();
}
onKeyDown(e) {
e.keyCode === 13 ? this.confirm() : e.keyCode === 27 && (this.cancel(), e.stopImmediatePropagation());
}
onInput(e) {
this.jumpAfter(200);
}
onBlur() {
setTimeout(() => this.hide(), 1);
}
}, D = (e) => {
let t = e.match(/^#([0-9a-f]{3})$/i);
if (t && t[1]) {
let e = t[1];
return {
r: parseInt(e.charAt(0), 16) * 17,
g: parseInt(e.charAt(1), 16) * 17,
b: parseInt(e.charAt(2), 16) * 17
};
}
let n = e.match(/^#([0-9a-f]{6})$/i);
if (n && n[1]) {
let e = n[1];
return {
r: parseInt(e.slice(0, 2), 16),
g: parseInt(e.slice(2, 4), 16),
b: parseInt(e.slice(4, 6), 16)
};
}
let r = e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
if (r) return {
r: parseInt(r[1], 10),
g: parseInt(r[2], 10),
b: parseInt(r[3], 10)
};
let i = e.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d]+|[\d]*.[\d]+)\s*\)$/i);
return i ? {
r: parseInt(i[1], 10),
g: parseInt(i[2], 10),
b: parseInt(i[3], 10),
a: parseFloat(i[4])
} : null;
}, ie = (e) => (typeof e == "string" && (e = D(e)), e ? (e.r * 299 + e.g * 587 + e.b * 114) / 1e3 : null), ae = class {
constructor(e) {
this.Reveal = e;
}
render() {
this.element = document.createElement("div"), this.element.className = "backgrounds", this.Reveal.getRevealElement().appendChild(this.element);
}
create() {
this.element.innerHTML = "", this.element.classList.add("no-transition"), this.Reveal.getHorizontalSlides().forEach((e) => {
let n = this.createBackground(e, this.element);
t(e, "section").forEach((e) => {
this.createBackground(e, n), n.classList.add("stack");
});
}), this.Reveal.getConfig().parallaxBackgroundImage ? (this.element.style.backgroundImage = "url(\"" + this.Reveal.getConfig().parallaxBackgroundImage + "\")", this.element.style.backgroundSize = this.Reveal.getConfig().parallaxBackgroundSize, this.element.style.backgroundRepeat = this.Reveal.getConfig().parallaxBackgroundRepeat, this.element.style.backgroundPosition = this.Reveal.getConfig().parallaxBackgroundPosition, setTimeout(() => {
this.Reveal.getRevealElement().classList.add("has-parallax-background");
}, 1)) : (this.element.style.backgroundImage = "", this.Reveal.getRevealElement().classList.remove("has-parallax-background"));
}
createBackground(e, t) {
let n = document.createElement("div");
n.className = "slide-background " + e.className.replace(/present|past|future/, "");
let r = document.createElement("div");
return r.className = "slide-background-content", n.appendChild(r), t.appendChild(n), e.slideBackgroundElement = n, e.slideBackgroundContentElement = r, this.sync(e), n;
}
sync(e) {
let t = e.slideBackgroundElement, n = e.slideBackgroundContentElement, r = {
background: e.getAttribute("data-background"),
backgroundSize: e.getAttribute("data-background-size"),
backgroundImage: e.getAttribute("data-background-image"),
backgroundVideo: e.getAttribute("data-background-video"),
backgroundIframe: e.getAttribute("data-background-iframe"),
backgroundColor: e.getAttribute("data-background-color"),
backgroundGradient: e.getAttribute("data-background-gradient"),
backgroundRepeat: e.getAttribute("data-background-repeat"),
backgroundPosition: e.getAttribute("data-background-position"),
backgroundTransition: e.getAttribute("data-background-transition"),
backgroundOpacity: e.getAttribute("data-background-opacity")
}, i = e.hasAttribute("data-preload");
e.classList.remove("has-dark-background"), e.classList.remove("has-light-background"), t.removeAttribute("data-loaded"), t.removeAttribute("data-background-hash"), t.removeAttribute("data-background-size"), t.removeAttribute("data-background-transition"), t.style.backgroundColor = "", n.style.backgroundSize = "", n.style.backgroundRepeat = "", n.style.backgroundPosition = "", n.style.backgroundImage = "", n.style.opacity = "", n.innerHTML = "", r.background && (/^(http|file|\/\/)/gi.test(r.background) || /\.(svg|png|jpg|jpeg|gif|bmp|webp)([?#\s]|$)/gi.test(r.background) ? e.setAttribute("data-background-image", r.background) : t.style.background = r.background), (r.background || r.backgroundColor || r.backgroundGradient || r.backgroundImage || r.backgroundVideo || r.backgroundIframe) && t.setAttribute("data-background-hash", r.background + r.backgroundSize + r.backgroundImage + r.backgroundVideo + r.backgroundIframe + r.backgroundColor + r.backgroundGradient + r.backgroundRepeat + r.backgroundPosition + r.backgroundTransition + r.backgroundOpacity), r.backgroundSize && t.setAttribute("data-background-size", r.backgroundSize), r.backgroundColor && (t.style.backgroundColor = r.backgroundColor), r.backgroundGradient && (t.style.backgroundImage = r.backgroundGradient), r.backgroundTransition && t.setAttribute("data-background-transition", r.backgroundTransition), i && t.setAttribute("data-preload", ""), r.backgroundSize && (n.style.backgroundSize = r.backgroundSize), r.backgroundRepeat && (n.style.backgroundRepeat = r.backgroundRepeat), r.backgroundPosition && (n.style.backgroundPosition = r.backgroundPosition), r.backgroundOpacity && (n.style.opacity = r.backgroundOpacity);
let a = this.getContrastClass(e);
typeof a == "string" && e.classList.add(a);
}
getContrastClass(e) {
let t = e.slideBackgroundElement, n = e.getAttribute("data-background-color");
if (!n || !D(n)) {
let e = window.getComputedStyle(t);
e && e.backgroundColor && (n = e.backgroundColor);
}
if (n) {
let e = D(n);
if (e && e.a !== 0) return ie(n) < 128 ? "has-dark-background" : "has-light-background";
}
return null;
}
bubbleSlideContrastClassToElement(e, t) {
["has-light-background", "has-dark-background"].forEach((n) => {
e.classList.contains(n) ? t.classList.add(n) : t.classList.remove(n);
}, this);
}
update(e = !1) {
let n = this.Reveal.getConfig(), r = this.Reveal.getCurrentSlide(), i = this.Reveal.getIndices(), a = null, o = n.rtl ? "future" : "past", s = n.rtl ? "past" : "future";
if (Array.from(this.element.childNodes).forEach((n, r) => {
n.classList.remove("past", "present", "future"), r < i.h ? n.classList.add(o) : r > i.h ? n.classList.add(s) : (n.classList.add("present"), a = n), (e || r === i.h) && t(n, ".slide-background").forEach((e, t) => {
e.classList.remove("past", "present", "future");
let n = typeof i.v == "number" ? i.v : 0;
t < n ? e.classList.add("past") : t > n ? e.classList.add("future") : (e.classList.add("present"), r === i.h && (a = e));
});
}), this.previousBackground && !this.previousBackground.closest("body") && (this.previousBackground = null), a && this.previousBackground) {
let e = this.previousBackground.getAttribute("data-background-hash"), t = a.getAttribute("data-background-hash");
if (t && t === e && a !== this.previousBackground) {
this.element.classList.add("no-transition");
let e = a.querySelector("video"), t = this.previousBackground.querySelector("video");
if (e && t) {
let n = e.parentNode;
t.parentNode.appendChild(e), n.appendChild(t);
}
}
}
let c = a !== this.previousBackground;
if (c && this.previousBackground && this.Reveal.slideContent.stopEmbeddedContent(this.previousBackground, { unloadIframes: !this.Reveal.slideContent.shouldPreload(this.previousBackground) }), c && a) {
this.Reveal.slideContent.startEmbeddedContent(a);
let e = a.querySelector(".slide-background-content");
if (e) {
let t = e.style.backgroundImage || "";
/\.gif/i.test(t) && (e.style.backgroundImage = "", window.getComputedStyle(e).opacity, e.style.backgroundImage = t);
}
this.previousBackground = a;
}
r && this.bubbleSlideContrastClassToElement(r, this.Reveal.getRevealElement()), setTimeout(() => {
this.element.classList.remove("no-transition");
}, 10);
}
updateParallax() {
let e = this.Reveal.getIndices();
if (this.Reveal.getConfig().parallaxBackgroundImage) {
let t = this.Reveal.getHorizontalSlides(), n = this.Reveal.getVerticalSlides(), r = this.element.style.backgroundSize.split(" "), i, a;
r.length === 1 ? i = a = parseInt(r[0], 10) : (i = parseInt(r[0], 10), a = parseInt(r[1], 10));
let o = this.element.offsetWidth, s = t.length, c, l;
c = typeof this.Reveal.getConfig().parallaxBackgroundHorizontal == "number" ? this.Reveal.getConfig().parallaxBackgroundHorizontal : s > 1 ? (i - o) / (s - 1) : 0, l = c * e.h * -1;
let u = this.element.offsetHeight, d = n.length, f, p;
f = typeof this.Reveal.getConfig().parallaxBackgroundVertical == "number" ? this.Reveal.getConfig().parallaxBackgroundVertical : (a - u) / (d - 1), p = d > 0 ? f * e.v : 0, this.element.style.backgroundPosition = l + "px " + -p + "px";
}
}
destroy() {
this.element.remove();
}
}, O = 0, oe = class {
constructor(e) {
this.Reveal = e;
}
run(e, t) {
this.reset();
let n = this.Reveal.getSlides(), r = n.indexOf(t), i = n.indexOf(e);
if (e && t && e.hasAttribute("data-auto-animate") && t.hasAttribute("data-auto-animate") && e.getAttribute("data-auto-animate-id") === t.getAttribute("data-auto-animate-id") && !(r > i ? t : e).hasAttribute("data-auto-animate-restart")) {
this.autoAnimateStyleSheet = this.autoAnimateStyleSheet || l();
let n = this.getAutoAnimateOptions(t);
e.dataset.autoAnimate = "pending", t.dataset.autoAnimate = "pending", n.slideDirection = r > i ? "forward" : "backward";
let a = e.style.display === "none";
a && (e.style.display = this.Reveal.getConfig().display);
let o = this.getAutoAnimatableElements(e, t).map((e) => this.autoAnimateElements(e.from, e.to, e.options || {}, n, O++));
if (a && (e.style.display = "none"), t.dataset.autoAnimateUnmatched !== "false" && this.Reveal.getConfig().autoAnimateUnmatched === !0) {
let e = n.duration * .8, r = n.duration * .2;
this.getUnmatchedAutoAnimateElements(t).forEach((e) => {
let t = this.getAutoAnimateOptions(e, n), r = "unmatched";
(t.duration !== n.duration || t.delay !== n.delay) && (r = "unmatched-" + O++, o.push(`[data-auto-animate="running"] [data-auto-animate-target="${r}"] { transition: opacity ${t.duration}s ease ${t.delay}s; }`)), e.dataset.autoAnimateTarget = r;
}, this), o.push(`[data-auto-animate="running"] [data-auto-animate-target="unmatched"] { transition: opacity ${e}s ease ${r}s; }`);
}
this.autoAnimateStyleSheet.innerHTML = o.join(""), requestAnimationFrame(() => {
this.autoAnimateStyleSheet && (getComputedStyle(this.autoAnimateStyleSheet).fontWeight, t.dataset.autoAnimate = "running");
}), this.Reveal.dispatchEvent({
type: "autoanimate",
data: {
fromSlide: e,
toSlide: t,
sheet: this.autoAnimateStyleSheet
}
});
}
}
reset() {
t(this.Reveal.getRevealElement(), "[data-auto-animate]:not([data-auto-animate=\"\"])").forEach((e) => {
e.dataset.autoAnimate = "";
}), t(this.Reveal.getRevealElement(), "[data-auto-animate-target]").forEach((e) => {
delete e.dataset.autoAnimateTarget;
}), this.autoAnimateStyleSheet && this.autoAnimateStyleSheet.parentNode && (this.autoAnimateStyleSheet.parentNode.removeChild(this.autoAnimateStyleSheet), this.autoAnimateStyleSheet = null);
}
autoAnimateElements(e, t, n, r, i) {
e.dataset.autoAnimateTarget = "", t.dataset.autoAnimateTarget = i;
let a = this.getAutoAnimateOptions(t, r);
n.delay !== void 0 && (a.delay = n.delay), n.duration !== void 0 && (a.duration = n.duration), n.easing !== void 0 && (a.easing = n.easing);
let o = this.getAutoAnimatableProperties("from", e, n), s = this.getAutoAnimatableProperties("to", t, n);
if (t.classList.contains("fragment") && delete s.styles.opacity, n.translate !== !1 || n.scale !== !1) {
let e = this.Reveal.getScale(), t = {
x: (o.x - s.x) / e,
y: (o.y - s.y) / e,
scaleX: o.width / s.width,
scaleY: o.height / s.height
};
t.x = Math.round(t.x * 1e3) / 1e3, t.y = Math.round(t.y * 1e3) / 1e3, t.scaleX = Math.round(t.scaleX * 1e3) / 1e3, t.scaleX = Math.round(t.scaleX * 1e3) / 1e3;
let r = n.translate !== !1 && (t.x !== 0 || t.y !== 0), i = n.scale !== !1 && (t.scaleX !== 0 || t.scaleY !== 0);
if (r || i) {
let e = [];
r && e.push(`translate(${t.x}px, ${t.y}px)`), i && e.push(`scale(${t.scaleX}, ${t.scaleY})`), o.styles.transform = e.join(" "), o.styles["transform-origin"] = "top left", s.styles.transform = "none";
}
}
for (let e in s.styles) {
let t = s.styles[e], n = o.styles[e];
t === n ? delete s.styles[e] : (t.explicitValue === !0 && (s.styles[e] = t.value), n.explicitValue === !0 && (o.styles[e] = n.value));
}
let c = "", l = Object.keys(s.styles);
if (l.length > 0) {
o.styles.transition = "none", s.styles.transition = `all ${a.duration}s ${a.easing} ${a.delay}s`, s.styles["transition-property"] = l.join(", "), s.styles["will-change"] = l.join(", ");
let e = Object.keys(o.styles).map((e) => e + ": " + o.styles[e] + " !important;").join(""), t = Object.keys(s.styles).map((e) => e + ": " + s.styles[e] + " !important;").join("");
c = "[data-auto-animate-target=\"" + i + "\"] {" + e + "}[data-auto-animate=\"running\"] [data-auto-animate-target=\"" + i + "\"] {" + t + "}";
}
return c;
}
getAutoAnimateOptions(t, n) {
let r = {
easing: this.Reveal.getConfig().autoAnimateEasing,
duration: this.Reveal.getConfig().autoAnimateDuration,
delay: 0
};
if (r = e(r, n), t.parentNode) {
let e = o(t.parentNode, "[data-auto-animate-target]");
e && (r = this.getAutoAnimateOptions(e, r));
}
return t.dataset.autoAnimateEasing && (r.easing = t.dataset.autoAnimateEasing), t.dataset.autoAnimateDuration && (r.duration = parseFloat(t.dataset.autoAnimateDuration)), t.dataset.autoAnimateDelay && (r.delay = parseFloat(t.dataset.autoAnimateDelay)), r;
}
getAutoAnimatableProperties(e, t, n) {
let r = this.Reveal.getConfig(), i = { styles: [] };
if (n.translate !== !1 || n.scale !== !1) {
let e;
if (typeof n.measure == "function") e = n.measure(t);
else if (r.center) e = t.getBoundingClientRect();
else {
let n = this.Reveal.getScale();
e = {
x: t.offsetLeft * n,
y: t.offsetTop * n,
width: t.offsetWidth * n,
height: t.offsetHeight * n
};
}
i.x = e.x, i.y = e.y, i.width = e.width, i.height = e.height;
}
let a = getComputedStyle(t);
return (n.styles || r.autoAnimateStyles).forEach((t) => {
let n;
typeof t == "string" && (t = { property: t }), t.from !== void 0 && e === "from" ? n = {
value: t.from,
explicitValue: !0
} : t.to !== void 0 && e === "to" ? n = {
value: t.to,
explicitValue: !0
} : (t.property === "line-height" && (n = parseFloat(a["line-height"]) / parseFloat(a["font-size"])), isNaN(n) && (n = a[t.property])), n !== "" && (i.styles[t.property] = n);
}), i;
}
getAutoAnimatableElements(e, t) {
let n = (typeof this.Reveal.getConfig().autoAnimateMatcher == "function" ? this.Reveal.getConfig().autoAnimateMatcher : this.getAutoAnimatePairs).call(this, e, t), r = [];
return n.filter((e, t) => {
if (r.indexOf(e.to) === -1) return r.push(e.to), !0;
});
}
getAutoAnimatePairs(e, t) {
let n = [], r = "h1, h2, h3, h4, h5, h6, p, li";
return this.findAutoAnimateMatches(n, e, t, "[data-id]", (e) => e.nodeName + ":::" + e.getAttribute("data-id")), this.findAutoAnimateMatches(n, e, t, r, (e) => e.nodeName + ":::" + e.textContent.trim()), this.findAutoAnimateMatches(n, e, t, "img, video, iframe", (e) => e.nodeName + ":::" + (e.getAttribute("src") || e.getAttribute("data-src"))), this.findAutoAnimateMatches(n, e, t, "pre", (e) => e.nodeName + ":::" + e.textContent.trim()), n.forEach((e) => {
a(e.from, r) ? e.options = { scale: !1 } : a(e.from, "pre") && (e.options = {
scale: !1,
styles: ["width", "height"]
}, this.findAutoAnimateMatches(n, e.from, e.to, ".hljs .hljs-ln-code", (e) => e.textContent, {
scale: !1,
styles: [],
measure: this.getLocalBoundingBox.bind(this)
}), this.findAutoAnimateMatches(n, e.from, e.to, ".hljs .hljs-ln-numbers[data-line-number]", (e) => e.getAttribute("data-line-number"), {
scale: !1,
styles: ["width"],
measure: this.getLocalBoundingBox.bind(this)
}));
}, this), n;
}
getLocalBoundingBox(e) {
let t = this.Reveal.getScale();
return {
x: Math.round(e.offsetLeft * t * 100) / 100,
y: Math.round(e.offsetTop * t * 100) / 100,
width: Math.round(e.offsetWidth * t * 100) / 100,
height: Math.round(e.offsetHeight * t * 100) / 100
};
}
findAutoAnimateMatches(e, t, n, r, i, a) {
let o = {}, s = {};
[].slice.call(t.querySelectorAll(r)).forEach((e, t) => {
let n = i(e);
typeof n == "string" && n.length && (o[n] = o[n] || [], o[n].push(e));
}), [].slice.call(n.querySelectorAll(r)).forEach((t, n) => {
let r = i(t);
s[r] = s[r] || [], s[r].push(t);
let c;
if (o[r]) {
let e = s[r].length - 1, t = o[r].length - 1;
o[r][e] ? (c = o[r][e], o[r][e] = null) : o[r][t] && (c = o[r][t], o[r][t] = null);
}
c && e.push({
from: c,
to: t,
options: a
});
});
}
getUnmatchedAutoAnimateElements(e) {
return [].slice.call(e.children).reduce((e, t) => {
let n = t.querySelector("[data-auto-animate-target]");
return !t.hasAttribute("data-auto-animate-target") && !n && e.push(t), t.querySelector("[data-auto-animate-target]") && (e = e.concat(this.getUnmatchedAutoAnimateElements(t))), e;
}, []);
}
}, k = 500, A = 4, se = 6, j = 8, ce = class {
constructor(e) {
this.Reveal = e, this.active = !1, this.activatedCallbacks = [], this.onScroll = this.onScroll.bind(this);
}
activate() {
if (this.active) return;
let e = this.Reveal.getState();
this.active = !0, this.slideHTMLBeforeActivation = this.Reveal.getSlidesElement().innerHTML;
let n = t(this.Reveal.getRevealElement(), w), r = t(this.Reveal.getRevealElement(), T);
this.viewportElement.classList.add("loading-scroll-mode", "reveal-scroll");
let i, a = window.getComputedStyle(this.viewportElement);
a && a.background && (i = a.background);
let o = [], s = n[0].parentNode, c, l = (e, t, n, a) => {
let s;
if (c && this.Reveal.shouldAutoAnimateBetween(c, e)) s = document.createElement("div"), s.className = "scroll-page-content scroll-auto-animate-page", s.style.display = "none", c.closest(".scroll-page-content").parentNode.appendChild(s);
else {
let e = document.createElement("div");
if (e.className = "scroll-page", o.push(e), a && r.length > t) {
let n = r[t], a = window.getComputedStyle(n);
a && a.background ? e.style.background = a.background : i && (e.style.background = i);
} else i && (e.style.background = i);
let n = document.createElement("div");
n.className = "scroll-page-sticky", e.appendChild(n), s = document.createElement("div"), s.className = "scroll-page-content", n.appendChild(s);
}
s.appendChild(e), e.classList.remove("past", "future"), e.setAttribute("data-index-h", t), e.setAttribute("data-index-v", n), e.slideBackgroundElement && (e.slideBackgroundElement.remove("past", "future"), s.insertBefore(e.slideBackgroundElement, e)), c = e;
};
n.forEach((e, t) => {
this.Reveal.isVerticalStack(e) ? e.querySelectorAll("section").forEach((e, n) => {
l(e, t, n, !0);
}) : l(e, t, 0);
}, this), this.createProgressBar(), t(this.Reveal.getRevealElement(), ".stack").forEach((e) => e.remove()), o.forEach((e) => s.appendChild(e)), this.Reveal.slideContent.layout(this.Reveal.getSlidesElement()), this.Reveal.layout(), this.Reveal.setState(e), this.activatedCallbacks.forEach((e) => e()), this.activatedCallbacks = [], this.restoreScrollPosition(), this.viewportElement.classList.remove("loading-scroll-mode"), this.viewportElement.addEventListener("scroll", this.onScroll, { passive: !0 });
}
deactivate() {
if (!this.active) return;
let e = this.Reveal.getState();
this.active = !1, this.viewportElement.removeEventListener("scroll", this.onScroll), this.viewportElement.classList.remove("reveal-scroll"), this.removeProgressBar(), this.Reveal.getSlidesElement().innerHTML = this.slideHTMLBeforeActivation, this.Reveal.sync(), this.Reveal.setState(e), this.slideHTMLBeforeActivation = null;
}
toggle(e) {
typeof e == "boolean" ? e ? this.activate() : this.deactivate() : this.isActive() ? this.deactivate() : this.activate();
}
isActive() {
return this.active;
}
createProgressBar() {
this.progressBar = document.createElement("div"), this.progressBar.className = "scrollbar", this.progressBarInner = document.createElement("div"), this.progressBarInner.className = "scrollbar-inner", this.progressBar.appendChild(this.progressBarInner), this.progressBarPlayhead = document.createElement("div"), this.progressBarPlayhead.className = "scrollbar-playhead", this.progressBarInner.appendChild(this.progressBarPlayhead), this.viewportElement.insertBefore(this.progressBar, this.viewportElement.firstChild);
let e = (e) => {
let t = (e.clientY - this.progressBarInner.getBoundingClientRect().top) / this.progressBarHeight;
t = Math.max(Math.min(t, 1), 0), this.viewportElement.scrollTop = t * (this.viewportElement.scrollHeight - this.viewportElement.offsetHeight);
}, t = (n) => {
this.draggingProgressBar = !1, this.showProgressBar(), document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", t);
};
this.progressBarInner.addEventListener("mousedown", (n) => {
n.preventDefault(), this.draggingProgressBar = !0, document.addEventListener("mousemove", e), document.addEventListener("mouseup", t), e(n);
});
}
removeProgressBar() {
this.progressBar && (this.progressBar.remove(), this.progressBar = null);
}
layout() {
this.isActive() && (this.syncPages(), this.syncScrollPosition());
}
syncPages() {
let e = this.Reveal.getConfig(), t = this.Reveal.getComputedSlideSize(window.innerWidth, window.innerHeight), n = this.Reveal.getScale(), r = e.scrollLayout === "compact", i = this.viewportElement.offsetHeight, a = t.height * n, o = r ? a : i;
this.scrollTriggerHeight = r ? a : i, this.viewportElement.style.setProperty("--page-height", o + "px"), this.viewportElement.style.scrollSnapType = typeof e.scrollSnap == "string" ? `y ${e.scrollSnap}` : "", this.slideTriggers = [], this.pages = Array.from(this.Reveal.getRevealElement().querySelectorAll(".scroll-page")).map((n) => {
let a = this.createPage({
pageElement: n,
slideElement: n.querySelector("section"),
stickyElement: n.querySelector(".scroll-page-sticky"),
contentElement: n.querySelector(".scroll-page-content"),
backgroundElement: n.querySelector(".slide-background"),
autoAnimateElements: n.querySelectorAll(".scroll-auto-animate-page"),
autoAnimatePages: []
});
a.pageElement.style.setProperty("--slide-height", e.center === !0 ? "auto" : t.height + "px"), this.slideTriggers.push({
page: a,
activate: () => this.activatePage(a),
deactivate: () => this.deactivatePage(a)
}), this.createFragmentTriggersForPage(a), a.autoAnimateElements.length > 0 && this.createAutoAnimateTriggersForPage(a);
let s = Math.max(a.scrollTriggers.length - 1, 0);
s += a.autoAnimatePages.reduce((e, t) => e + Math.max(t.scrollTriggers.length - 1, 0), a.autoAnimatePages.length), a.pageElement.querySelectorAll(".scroll-snap-point").forEach((e) => e.remove());
for (let e = 0; e < s + 1; e++) {
let t = document.createElement("div");
t.className = "scroll-snap-point", t.style.height = this.scrollTriggerHeight + "px", t.style.scrollSnapAlign = r ? "center" : "start", a.pageElement.appendChild(t), e === 0 && (t.style.marginTop = -this.scrollTriggerHeight + "px");
}
return r && a.scrollTriggers.length > 0 ? (a.pageHeight = i, a.pageElement.style.setProperty("--page-height", i + "px")) : (a.pageHeight = o, a.pageElement.style.removeProperty("--page-height")), a.scrollPadding = this.scrollTriggerHeight * s, a.totalHeight = a.pageHeight + a.scrollPadding, a.pageElement.style.setProperty("--page-scroll-padding", a.scrollPadding + "px"), s > 0 ? (a.stickyElement.style.position = "sticky", a.stickyElement.style.top = Math.max((i - a.pageHeight) / 2, 0) + "px") : (a.stickyElement.style.position = "relative", a.pageElement.style.scrollSnapAlign = a.pageHeight < i ? "center" : "start"), a;
}), this.setTriggerRanges(), this.viewportElement.setAttribute("data-scrollbar", e.scrollProgress), e.scrollProgress && this.totalScrollTriggerCount > 1 ? (this.progressBar || this.createProgressBar(), this.syncProgressBar()) : this.removeProgressBar();
}
setTriggerRanges() {
this.totalScrollTriggerCount = this.slideTriggers.reduce((e, t) => e + Math.max(t.page.scrollTriggers.length, 1), 0);
let e = 0;
this.slideTriggers.forEach((t, n) => {
t.range = [e, e + Math.max(t.page.scrollTriggers.length, 1) / this.totalScrollTriggerCount];
let r = (t.range[1] - t.range[0]) / t.page.scrollTriggers.length;
t.page.scrollTriggers.forEach((t, n) => {
t.range = [e + n * r, e + (n + 1) * r];
}), e = t.range[1];
}), this.slideTriggers[this.slideTriggers.length - 1].range[1] = 1;
}
createFragmentTriggersForPage(e, t) {
t = t || e.slideElement;
let n = this.Reveal.fragments.sort(t.querySelectorAll(".fragment"), !0);
return n.length && (e.fragments = this.Reveal.fragments.sort(t.querySelectorAll(".fragment:not(.disabled)")), e.scrollTriggers.push({ activate: () => {
this.Reveal.fragments.update(-1, e.fragments, t);
} }), n.forEach((n, r) => {
e.scrollTriggers.push({ activate: () => {
this.Reveal.fragments.update(r, e.fragments, t);
} });
})), e.scrollTriggers.length;
}
createAutoAnimateTriggersForPage(e) {
e.autoAnimateElements.length > 0 && this.slideTriggers.push(...Array.from(e.autoAnimateElements).map((t, n) => {
let r = this.createPage({
slideElement: t.querySelector("section"),
contentElement: t,
backgroundElement: t.querySelector(".slide-background")
});
return this.createFragmentTriggersForPage(r, r.slideElement), e.autoAnimatePages.push(r), {
page: r,
activate: () => this.activatePage(r),
deactivate: () => this.deactivatePage(r)
};
}));
}
createPage(e) {
return e.scrollTriggers = [], e.indexh = parseInt(e.slideElement.getAttribute("data-index-h"), 10), e.indexv = parseInt(e.slideElement.getAttribute("data-index-v"), 10), e;
}
syncProgressBar() {
thi