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(i){"use strict";const u="data-abby-mounted",d="https://abilityby.ai",l="width:100%;height:500px;border:0;display:block;",m="microphone";function r(t,e){for(const n of e){const o=t.getAttribute(n);if(o!=null&&o.trim()!=="")return o.trim()}return null}function f(t){if(t==null)return!0;const e=t.trim().toLowerCase();return e===""||e==="true"||e==="1"||e==="yes"?!0:!(e==="false"||e==="0"||e==="no"||e==="off")}function y(t){const e=r(t,["data-book","book"]);if(!e)return{error:'abby requires a book attribute, e.g. book="hs-government-demo".'};const n=r(t,["data-section","section"]),o=(r(t,["data-origin","origin"])||d).replace(/\/$/,""),s=f(r(t,["data-embed","embed"]));return{book:e,section:n,embed:s,origin:o}}function A(t){const e=t.section?`/book/${encodeURIComponent(t.book)}/${encodeURIComponent(t.section)}`:`/book/${encodeURIComponent(t.book)}`,n=new URL(e,`${t.origin}/`);return t.embed&&n.searchParams.set("embed","1"),n.toString()}function p(t){const e=document.createElement("iframe");return e.src=A(t),e.setAttribute("style",l),e.setAttribute("allow",m),e.title=t.section?`Abby: ${t.book} / ${t.section}`:`Abby: ${t.book}`,e}function h(){const t=document.createElement("div");return t.className="abby",t.setAttribute(u,""),t}function c(t){if(!(t instanceof HTMLElement)||t.getAttribute(u)!=null)return null;const e=y(t),n=h();if(t.replaceWith(n),"error"in e){const o=document.createElement("p");return o.className="abby-error",o.textContent=`abby error: ${e.error}`,n.append(o),n}return n.append(p(e)),n}function a(t){const e=t||document;if(!e||!("querySelectorAll"in e))return[];const n=e.querySelectorAll("pre.abby"),o=[];for(const s of n){if(!(s instanceof HTMLElement))continue;const b=c(s);b&&o.push(b)}return o}typeof document<"u"&&a(),i.mountAbby=c,i.scanAndMountAbbys=a,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})})(this.abby=this.abby||{});