unknown

abby

/* * Generated file — do not edit directly. * Source: tools/modules-builder/src/modules/abby/ * Rebuild: cd tools/modules-builder && npm run build -- abby */ (function(s){"use strict";const u="data-abby-mounted",d="https://abilityby.ai",l="width:100%;height:500px;border:0;display:block;",f="microphone";function r(e,t){for(const n of t){const o=e.getAttribute(n);if(o!=null&&o.trim()!=="")return o.trim()}return null}function m(e){if(e==null)return!0;const t=e.trim().toLowerCase();return t===""||t==="true"||t==="1"||t==="yes"?!0:!(t==="false"||t==="0"||t==="no"||t==="off")}function y(e){const t=r(e,["data-book","book"]);if(!t)return{error:'abby requires a book attribute, e.g. book="hs-government-demo".'};const n=r(e,["data-section","section"]),o=(r(e,["data-origin","origin"])||d).replace(/\/$/,""),i=m(r(e,["data-embed","embed"]));return{book:t,section:n,embed:i,origin:o}}function p(e){var o;const t=e.section?`/book/${encodeURIComponent(e.book)}/${encodeURIComponent(e.section)}`:`/book/${encodeURIComponent(e.book)}`,n=new URL(t,`${e.origin}/`);return e.embed&&n.searchParams.set("embed","1"),typeof window<"u"&&((o=window.location)!=null&&o.href)&&n.searchParams.set("return_to",window.location.href),n.toString()}function A(e){const t=document.createElement("iframe");return t.src=p(e),t.setAttribute("style",l),t.setAttribute("allow",f),t.title=e.section?`Abby: ${e.book} / ${e.section}`:`Abby: ${e.book}`,t}function h(){const e=document.createElement("div");return e.className="abby",e.setAttribute(u,""),e}function a(e){if(!(e instanceof HTMLElement)||e.getAttribute(u)!=null)return null;const t=y(e),n=h();if(e.replaceWith(n),"error"in t){const o=document.createElement("p");return o.className="abby-error",o.textContent=`abby error: ${t.error}`,n.append(o),n}return n.append(A(t)),n}function c(e){const t=e||document;if(!t||!("querySelectorAll"in t))return[];const n=t.querySelectorAll("pre.abby"),o=[];for(const i of n){if(!(i instanceof HTMLElement))continue;const b=a(i);b&&o.push(b)}return o}function w(e){const t=e.data;if(!t||t.type!=="abby:requestEmbedReturn")return;const n=e.source;!n||!("postMessage"in n)||n.postMessage({type:"abby:embedReturn",url:window.location.href},{targetOrigin:e.origin||"*"})}typeof window<"u"&&window.addEventListener("message",w),typeof document<"u"&&c(),s.mountAbby=a,s.scanAndMountAbbys=c,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})})(this.abby=this.abby||{});