(function embed() {var embedScriptTag = document.querySelector("script[data-domain]");if (!embedScriptTag) {return ycbmlog("No script tag found. Have you added the data-domain attribute?");}var embedModal;var usingLayout = "desktop";var isIFrameLoaded = false;var isModalOpen = false;var hasPushedState = false;var documentStyles = {body: {},html: {}};var options = getOptions2(embedScriptTag);var iframe = getIframe(options);updateHTML(embedScriptTag, options, iframe);listenToMessages(options.origin, iframe, options.autoscroll);function ycbmlog(message) {console.log("N20 YCBM EMBED:" + message);}function updateHTML(embedScriptTag2, options2, iframe2) {if (shouldUseModal(options2.type)) {embedModal = getBookingModal(options2, iframe2);setResponsiveStyles();var triggerElement;if (options2.type === "button-link")triggerElement = getButton(options2).ycbm_button;if (options2.type === "text-link") triggerElement = getLink(options2);if (options2.type === "button-floating")triggerElement = getFloatingButton(options2).ycbm_button;embedModal.ycbm_modalContainer.tabIndex = "-1";embedModal.ycbm_modalCloseButton.onclick = closeModal;embedModal.ycbm_modalContent.onclick = closeModal;embedModal.ycbm_modalCloseButtonContainer.onclick = closeModal;embedModal.ycbm_modalIframeContainer.onclick = closeModal;triggerElement.onclick = onModalTriggerClick;iframe2.onload = function() {isIFrameLoaded = true;if (usingLayout === "mobile") {iframe2.style.border = "1px solid #e1e5e1";}embedModal.ycbm_modalLoading.style.display = "none";};if (options2.type === "button-floating") {embedScriptTag2.remove();document.body.appendChild(triggerElement);} else {embedScriptTag2.replaceWith(triggerElement);}window.addEventListener("popstate", function(e) {if (isModalOpen) {hasPushedState = false;closeModal();}});window.addEventListener("resize", setResponsiveStyles);if (shoulOpenOnLoad()) {openBookingModal();}} else {iframe2.onload = function() {isIFrameLoaded = true;};embedScriptTag2.replaceWith(iframe2);}}function getOptions2(tag2) {var optionsWithValues = ["type","domain","flow","intent","content","showtitle","innertext","buttoncolor","buttonposition","buttonicon","displaymode"];var options2 = optionsWithValues.reduce((acc, key) => {acc[key] = tag2.getAttribute("data-" + key);return acc;}, {});["copyparameters", "autoscroll"].forEach((key) => {if (tag2.hasAttribute("data-" + key)) {options2[key] = true;}});var selections = tag2.getAttribute("data-selections");if (selections) {try {options2.selections = JSON.parse(selections);} catch (e) {console.error("data-selections is not a valid JSON object, no selection will be made");}}options2.origin = getOrigin2(tag2.src, options2.domain);if (options2.flow !== "cancel" && options2.flow !== "reschedule") {options2.flow = "create";}return options2;}function shouldUseModal(type) {return type === "button-link" || type === "text-link" || type === "button-floating";}function getOrigin2(src, subdomain2) {return src.replace(/(ycb\.me|ycbm\.com)/, "youcanbook.me").replace("embed", subdomain2).split("/").slice(0, 3).join("/");}function getIframe(options2) {var iframe2 = document.createElement("iframe");iframe2.src = getIframeURL(options2);iframe2.style = "width:100%;min-height:300px;border:0px;background-color:transparent";iframe2.frameBorder = "0";iframe2.allowTransparency = "true";iframe2.allow = "payment";return iframe2;}function getIframeURL(options2) {var url2 = options2.origin + "?embed=true";if (options2.content === "all") {url2 += "&contentMode=all";if (options2.showtitle !== "true") {url2 += "&showTitle=false";}} else if (options2.showtitle === "false") {url2 += "&showTitle=false";}if (options2.copyparameters && location.search) {url2 += "&" + location.search.substring(1);}if (options2.intent) {url2 += "&i=" + options2.intent;}if (options2.flow === "cancel") {url2 += "&o=c&ro=b";}if (options2.flow === "reschedule") {url2 += "&o=r&ro=b";}if (options2.selections) {url2 += "&" + getSelectionsQuery(options2.selections);}if (options2.displaymode) {url2 += "&displayMode=" + options2.displaymode;}if (options2.type === "button-link" || options2.type === "text-link" || options2.type === "button-floating") {url2 += "&embedModal=true";}return url2;}function getSelectionsQuery(selections) {var urlParameters = [];if (selections.appointmentTypeIds) {if (Array.isArray(selections.appointmentTypeIds)) {selections.appointmentTypeIds.forEach((id) => {urlParameters.push("appointmentTypeIds=" + encodeURIComponent(id));});} else {console.error("appointmentTypeIds parameter must be an array");}}["teamMemberId", "startsAt", "units", "duration"].forEach(function(key) {if (selections[key]) {urlParameters.push(key + "=" + encodeURIComponent(selections[key]));}});if (selections.form) {Object.keys(selections.form).forEach(function(key) {urlParameters.push(key + "=" + encodeURIComponent(selections.form[key]));});}return urlParameters.join("&");}function getLink(options2) {var link2 = document.createElement("a");link2.style = "cursor:pointer;";link2.textContent = getDefaultInnerText();if (options2.innertext) link2.textContent = sanitizeText(options2.innertext);link2.classList.add("ycbm_link");return link2;}function getButton(options2) {var buttonStructure = [{isBaseNode: true,id: "ycbm_button",element: "button",style: 'box-sizing: border-box; position: relative; border-radius: 99999px; cursor: pointer; padding: 0; font-weight: 500; text-decoration: none; display: inline-block; font-size: 16px; border: 1px solid rgba(0, 0, 0, 0.1); vertical-align: middle; height: auto; line-height: auto; user-select: none; font-family:"Inter", sans-serif; line-height:1.15;',children: ["ycbm_buttonContent"]},{id: "ycbm_buttonContent",element: "div",style: "display: block; padding: 0 20px; line-height: 40px; height: 40px; font-size: 16px; margin: -1px; overflow: hidden; white-space: nowrap;"}];var button2 = appendHTMLFromNodeStruture(buttonStructure);var buttonColor = options2.buttoncolor || "#44ff87";var isLight = isLightColor(buttonColor);var ycbm_buttonTextColor = isLight ? "#000" : "#FFF";setStyles(button2.ycbm_button, {backgroundColor: buttonColor,color: ycbm_buttonTextColor});if (options2.buttonicon) {var span = document.createElement("span");span.style = "display: inline-block; vertical-align: middle; line-height: auto; width: 16px; margin-right: 16px; margin-left: -4px;";if (!isLight) {span.style.filter = "invert(1)";}span.appendChild(getButtonIcon(options2.buttonicon));button2.ycbm_buttonContent.appendChild(span);}if (options2.innertext) {button2.ycbm_buttonContent.innerHTML += sanitizeText(options2.innertext);} else {button2.ycbm_buttonContent.innerHTML += getDefaultInnerText();}return button2;}function getFloatingButton(options2) {var button2 = getButton(options2);setStyles(button2.ycbm_buttonContent, {padding: "0 40px",lineHeight: "60px",height: "60px"});setStyles(button2.ycbm_button, {boxShadow: "0px 1px 4px rgba(0,0,0,0.4)",position: "fixed",top: "unset",right: "unset",bottom: "unset",left: "unset"});var margin2 = "16px";if (!options2.buttonposition) {setStyles(button2.ycbm_button, {right: margin2,bottom: margin2});} else {setStyles(button2.ycbm_button, {top: options2.buttonposition.toLowerCase().includes("top") ? margin2 : void 0,bottom: options2.buttonposition.toLowerCase().includes("bottom") ? margin2 : void 0,left: options2.buttonposition.toLowerCase().includes("left") ? margin2 : null,right: options2.buttonposition.toLowerCase().includes("right") ? margin2 : null});}button2.ycbm_button.style.zIndex = "2147483646";return button2;}function getDefaultInnerText() {return "Schedule a meeting";}function getCloseIcon() {var img2 = document.createElement("img");img2.src = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZmlsbD0id2hpdGUiIGZpbGxSdWxlPSJldmVub2RkIiBkPSJNMi4zIDIuM2ExIDEgMCAwMTEuNCAwTDggNi42bDQuMy00LjNhMSAxIDAgMDExLjMgMGguMWMuNC40LjQgMSAwIDEuNEw5LjQgOGw0LjMgNC4zYy40LjQuNCAxIDAgMS4zdi4xYTEgMSAwIDAxLTEuNCAwTDggOS40bC00LjMgNC4zYTEgMSAwIDAxLTEuMyAwaC0uMWExIDEgMCAwMTAtMS40TDYuNiA4IDIuMyAzLjdhMSAxIDAgMDEwLTEuM3oiLz4KPC9zdmc+Cg==";img2.style.width = "16px";return img2;}function getButtonIcon(icon2) {if (icon2 !== "ycbm" && icon2 !== "calendar" && icon2 !== "time") return;var img2 = document.createElement("img");if (icon2 === "ycbm") {img2.src = "data:image/svg+xml;base64,Cgk8c3ZnICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMjQgMjQgIj4KCQkJPHBhdGgKCQkJCWZpbGw9IiMwMDAiCgkJCQlmaWxsUnVsZT0iZXZlbm9kZCIKCQkJCWQ9Ik0yNCAxMmMwIDEwLjA4LTEuOTIgMTItMTIgMTJDMi4wMyAyNCAuMDQgMjIuMTIgMCAxMi4zM1YxMkMwIDIuMDMgMS44OC4wNCAxMS42NyAwSDEyYzEwLjA4ID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Gg0YTEgMSAwIDAxMS0xem0zIDhIMnY2aDEyVjh6bS05IDJhMSAxIDAgMTEwIDIgMSAxIDAgMDEwLTJ6bTMgMGExIDEgMCAxMTAgMiAxIDEgMCAwMTAtMnptMyAwYTEgMSAwIDExMCAyIDEgMSAwIDAxMC0yek00IDNIMnYzaDEyVjNoLTJhMSAxIDAgMDEtMiAwSDZhMSAxIDAgMTEtMiAweiIKCgkJCS8+CgkJPC9zdmc+";}if (icon2 === "time") {img2.src = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSI+CgkJCTxwYXRoCgkJCQlmaWxsPSIjMDAwIgoJCQkJZmlsbFJ1bGU9ImV2ZW5vZGQiCgkJCQkJCQkJCQlkPSJNOCAwYTggOCAwIDExMCAxNkE4IDggMCAwMTggMHptMCAyYTYgNiAwIDEwMCAxMkE2IDYgMCAwMDggMnptMCAyYy41IDAgMSAuNCAxIC45VjdoMWMuNSAwIDEgLjQgMSAuOVY4YzAgLjYtLjQgMS0xIDFIOGExIDEgMCAwMS0xLS45VjVjMC0uNi40LTEgMS0xeiIKCgkJCS8+CgkJPC9zdmc+";}img2.style.width = "16px";return img2;}function getLoading(options2) {var img2 = document.createElement("img");img2.src = options2.origin + "/static/img/ycbm/spinner.gif";img2.style.width = "90px";return img2;}function getBookingModal(options2, iframe2) {return appendHTMLFromNodeStruture([{isBaseNode: true,id: "ycbm_modalContainer",element: "div",style: "position:fixed; top:0; left:0; right:0; bottom:0; pointer-events: none; opacity:0; transition: opacity 0.3s ease-in .1s; width:100vw; z-index: 2147483647 !important;",children: ["ycbm_modalBackground", "ycbm_modalContent"]},{id: "ycbm_modalBackground",element: "div",style: "position:absolute; top:0; left:0; right:0; bottom:0; opacity:0; background-color:#000; transition: opacity 0.15s ease-in 0.15s;"},{id: "ycbm_modalContent",element: "div",style: "position:absolute; top:0; left:0; right:0; bottom:0; opacity:0; overflow:auto; transform: translateY(200px); transition: opacity 0.1s, transform 0.1s ease .1s;",children: ["ycbm_modalIframeContainer"]},{id: "ycbm_modalIframeContainer",element: "div",style: "padding-top: 30px;",children: ["ycbm_modalCloseButtonContainer","ycbm_modalLoading",iframe2]},{id: "ycbm_modalLoading",element: "div",style: "position:absolute;z-index:-1;margin:120px auto 0 0; left:0; right:0; text-align:center;",children: [getLoading(options2)]},{id: "ycbm_modalCloseButtonContainer",element: "div",style: "text-align: right; margin: 40px auto 0; width: 900px; position: relative; z-index: 99999 !important;",children: ["ycbm_modalCloseButton"]},{id: "ycbm_modalCloseButton",element: "button",style: "background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit; width: 32px; height: 32px; padding: 8px; margin-bottom:12px;",children: [getCloseIcon()]}],document.body);}function onModalTriggerClick() {if (!location.search.substring(1).includes("ycbmModal=true")) {addYCBMModalParam();}openBookingModal();return false;}function addYCBMModalParam() {var href = new URL(window.location.href);href.searchParams.append("ycbmModal", "true");window.history.pushState({ path: href.toString() }, "", href.toString());hasPushedState = true;}function removeYCBMModalParam() {const href = new URL(window.location.href);href.searchParams.delete("ycbmModal");window.history.replaceState({ path: href.toString() }, "", href.toString());}function openBookingModal() {embedModal.ycbm_modalContainer.tabIndex = "0";setStyles(embedModal.ycbm_modalBackground, {opacity: "0.8"});setStyles(embedModal.ycbm_modalContainer, {opacity: "1",pointerEvents: "auto"});setStyles(embedModal.ycbm_modalContent, {opacity: "1",transform: "translateY(0)"});lockParentScroll();isModalOpen = true;}function closeModal() {if (hasPushedState) {history.back();hasPushedState = false;} else {removeYCBMModalParam();}unlockParentScroll();embedModal.ycbm_modalContainer.tabIndex = "-1";setStyles(embedModal.ycbm_modalContainer, {opacity: "0",pointerEvents: "none"});setStyles(embedModal.ycbm_modalBackground, {opacity: "0"});setStyles(embedModal.ycbm_modalContent, {opacity: "0",transform: "translateY(200px)"});isModalOpen = false;}function lockParentScroll() {documentStyles = {body: Object.assign({}, document.body.style),html: Object.assign({}, document.documentElement.style)};setStyles(document.documentElement, {overflow: "hidden"});setStyles(document.body, {position: "",top: "",left: "",right: "",bottom: "",overflow: "hidden"});const scrollTop = parseInt(document.body.dataset.scrollTop, 10) || 0;const scrollLeft = parseInt(document.body.dataset.scrollLeft, 10) || 0;window.scrollTo(scrollLeft, scrollTop);}function unlockParentScroll() {setStyles(document.body, {position: documentStyles.body.position,top: documentStyles.body.top,left: documentStyles.body.left,right: documentStyles.body.right,bottom: documentStyles.body.bottom,overflow: documentStyles.body.overflow});setStyles(document.documentElement, {overflow: documentStyles.html.overflow});}function setResponsiveStyles() {var width = window.innerWidth;if (usingLayout !== "mobile" && width <= 671) {setMobileEmbedModalStyles();return;} else if (usingLayout !== "tablet" && width > 671 && width < 1025) {setTabletEmbedModalStyles();return;} else if (usingLayout !== "desktop" && width >= 1025) {setDesktopEmbedModalStyles();}}function setDesktopEmbedModalStyles() {setStyles(embedModal.ycbm_modalIframeContainer, {padding: "unset",paddingTop: "30px"});setStyles(embedModal.ycbm_modalCloseButtonContainer, {margin: "40px auto 0",padding: "unset",top: "unset",position: "relative",width: "930px"});setStyles(embedModal.ycbm_modalCloseButton, {background: "none",borderRadius: "unset"});setStyles(embedModal.ycbm_modalIframeContainer.getElementsByTagName("iframe")[0],{borderRadius: "unset",border: "none"});usingLayout = "desktop";}function setTabletEmbedModalStyles() {setStyles(embedModal.ycbm_modalIframeContainer, {padding: "unset",paddingTop: "30px"});setStyles(embedModal.ycbm_modalCloseButtonContainer, {margin: "40px auto 0",padding: "0 60px",top: "unset",position: "relative",width: "unset"});setStyles(embedModal.ycbm_modalCloseButton, {background: "none",borderRadius: "unset"});setStyles(embedModal.ycbm_modalIframeContainer.getElementsByTagName("iframe")[0],{borderRadius: "unset",border: "none"});usingLayout = "tablet";}function setMobileEmbedModalStyles() {setStyles(embedModal.ycbm_modalIframeContainer, {padding: "0 16px"});setStyles(embedModal.ycbm_modalCloseButtonContainer, {margin: "unset",padding: "10px 20px 0 0",top: "0",position: "sticky",width: "unset"});setStyles(embedModal.ycbm_modalCloseButton, {background: "rgba(0,0,0,0.6)",borderRadius: "16px"});setStyles(embedModal.ycbm_modalIframeContainer.getElementsByTagName("iframe")[0],{borderRadius: "12px"});if (isIFrameLoaded) {setStyles(embedModal.ycbm_modalIframeContainer.getElementsByTagName("iframe")[0],{ border: "1px solid #e1e5e1" });}usingLayout = "mobile";}function setStyles(domElement, styles2 = {}) {Object.keys(styles2).forEach((att) => {const style2 = styles2[att];if (style2 !== void 0) domElement.style[att] = styles2[att];});}function shoulOpenOnLoad() {return location.search.substring(1).includes("ycbmModal=true") && !isModalOpen;}function listenToMessages(origin, iframe2, isAutoscroll) {window.addEventListener && window.addEventListener("message",function(event) {if (event.source === iframe2.contentWindow) {const { message } = event.data;if (!message) return;const { action: action2, data } = message;if (action2 === "resize") {if (!embedModal) iframe2.style.height = data + "px";if (embedModal) iframe2.style.height = data + 2 + "px";}if (isAutoscroll && action2 === "locationChange") {iframe2.scrollIntoView();}}},false);}function appendHTMLFromNodeStruture(nodesStructure, rootNode) {var createdNodes = {};var nodeStructure;var baseNode;for (var i = 0; i < nodesStructure.length; i++) {nodeStructure = nodesStructure[i];var node = document.createElement(nodeStructure.element);node.classList.add(nodeStructure.id);if (nodeStructure.style) {node.style = nodeStructure.style;}if (nodeStructure.isBaseNode) baseNode = node;createdNodes[nodeStructure.id] = node;}for (var i = 0; i < nodesStructure.length; i++) {nodeStructure = nodesStructure[i];node = createdNodes[nodeStructure.id];if (nodeStructure.children) {for (var childIndex = 0; childIndex < nodeStructure.children.length; childIndex++) {var child = nodeStructure.children[childIndex];if (typeof child === "string") {node.appendChild(createdNodes[child]);} else {node.appendChild(child);}}}}if (rootNode && baseNode) {rootNode.appendChild(baseNode);}return createdNodes;}function sanitizeText(text2) {return text2.replace(new RegExp(/[^\p{L}\p{N}\p{M}\p{Pc}\p{Pd} ]/, "gu"),"");}function isLightColor(color = "") {let hex = color.replace("#", "");if (hex.length === 3) {hex = hex.split("").map((char) => char + char).join("");}const c_r = parseInt(hex.substring(0, 0 + 2), 16);const c_g = parseInt(hex.substring(2, 2 + 2), 16);const c_b = parseInt(hex.substring(4, 4 + 2), 16);const brightness2 = (c_r * 299 + c_g * 587 + c_b * 114) / 1e3;return brightness2 > 155;}})();