!function(){if(!window.ManifestVendor){const t="https://cdn.jsdelivr.net/npm/";window.ManifestVendor={get checked(){return!(!window.Manifest||!window.Manifest.integrity)},script(e,n){const o=window.Manifest;return o&&o.loadVendor?o.loadVendor(e,n):new Promise((o,a)=>{const r=t+e,i=document.querySelector(`script[src="${r}"]`);if(i&&i.dataset.vendorLoaded)return o();const s=i||document.createElement("script");if(s.addEventListener("load",()=>{s.dataset.vendorLoaded="1",o()}),s.addEventListener("error",()=>a(new Error(`Failed to load ${r}`))),i){const t=()=>{try{return performance.getEntriesByName(r).length>0}catch(t){return!1}},e=setInterval(()=>{t()&&(clearInterval(e),o())},50);return void setTimeout(()=>{clearInterval(e),o()},4e3)}n&&(s.integrity=n,s.crossOrigin="anonymous"),s.src=r,document.head.appendChild(s)})},fetch(e,n){const o=window.Manifest;return o&&o.fetchVendor?o.fetchVendor(e,n):fetch(t+e,n?{integrity:n,mode:"cors",credentials:"omit"}:void 0).then(n=>{if(!n.ok)throw new Error(`Failed to load ${t+e}`);return n})}}}let t=null,e=null;const n=new WeakMap,o=new Set;let a=!1,r=null;function i(){return"function"==typeof window.hljs?.registerLanguage&&window.hljs!==r}async function s(){return e||(e=window.ManifestVendor.script("@highlightjs/cdn-assets@11.11.1/highlight.min.js","sha384-RH2xi4eIQ/gjtbs9fUXM68sLSi99C7ZWBRX1vDrVv6GQXRibxXLbwO2NGZB74MbU").then(()=>{if("undefined"==typeof hljs)throw new Error("hljs undefined after full load");return hljs}).catch(t=>{throw e=null,t}),e)}async function c(){return i()?window.hljs:window.ManifestVendor.checked?s():t||(t=import("https://esm.run/highlight.js@11.11.1/lib/core").then(t=>{const e=t.default;if(!e)throw new Error("hljs undefined after core ESM import");return i()?window.hljs:(r=e,window.hljs=e,e)}),t)}async function l(t){const e=b(t);if(!e||"auto"===e)return;if(g.has(e))return;for(const t of Object.hasOwn(f,e)?f[e]:[])await l(t);const r=await c();if(r.listLanguages().includes(e))return;if(o.has(e))return void(a=!0);n.has(r)||n.set(r,new Map);const i=n.get(r);if(i.has(e))return i.get(e);const s=(/^[a-z0-9-]+$/.test(e)?window.ManifestVendor.checked?window.ManifestVendor.script((t=>`@highlightjs/cdn-assets@11.11.1/languages/${t}.min.js`)(e)):import(`https://esm.run/highlight.js@11.11.1/lib/languages/${e}`).then(t=>{r.registerLanguage(e,t.default)}):Promise.reject(new Error("unknown language"))).catch(()=>{a=!0,o.add(e),i.delete(e)});return i.set(e,s),s}async function d(t=null){if(t=b(t)||null,window.ManifestVendor.checked||a||e){const e=await s();return t&&"auto"!==t&&!g.has(t)&&await l(t),e}if(g.has(t))return c();if(!t||"auto"===t)return a=!0,s();const n=await c();return await l(t),n}let u=null;async function h(){if("function"==typeof window.CodeJar)return window.CodeJar;if(u)return u;const t="codejar@4.3.0/dist/codejar.js";return u=(window.ManifestVendor.checked?window.ManifestVendor.fetch(t).then(t=>t.text()).then(t=>{const e=URL.createObjectURL(new Blob([t],{type:"text/javascript"}));return import(e).finally(()=>URL.revokeObjectURL(e))}):import(`https://cdn.jsdelivr.net/npm/${t}`)).then(t=>(window.CodeJar=t.CodeJar,t.CodeJar)).catch(t=>{throw u=null,t}),u}window.ManifestUtilities&&(window.ManifestUtilities.addIgnoredClassPattern(/^hljs/),window.ManifestUtilities.addIgnoredClassPattern(/^language-/),window.ManifestUtilities.addIgnoredClassPattern(/^copy$/),window.ManifestUtilities.addIgnoredClassPattern(/^copied$/),window.ManifestUtilities.addIgnoredClassPattern(/^lines$/),window.ManifestUtilities.addIgnoredClassPattern(/^selected$/),window.ManifestUtilities.addIgnoredClassPattern(/^expand$/),window.ManifestUtilities.addIgnoredElementSelector("pre"),window.ManifestUtilities.addIgnoredElementSelector("code"));const p={js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",cs:"csharp",golang:"go",sh:"bash",zsh:"bash",console:"shell",shellsession:"shell",env:"bash",dotenv:"bash",ps1:"powershell",yml:"yaml",toml:"ini",conf:"ini",jsonc:"json",json5:"json",html:"xml",htm:"xml",xhtml:"xml",svg:"xml",vue:"xml",svelte:"xml",astro:"xml",md:"markdown",mdx:"markdown",docker:"dockerfile",patch:"diff"},f={shell:["bash"]},g=new Set(["txt","text","plain","plaintext","none","nohighlight","csv","tsv","gitignore"]);function b(t){const e=String(t||"").trim().toLowerCase();return Object.hasOwn(p,e)?p[e]:e}function m(t,e){const n=b(e);return n&&"auto"!==n&&t.listLanguages().includes(n)?n:null}function y(t){return function(t){const e=t.split("\n");let n=1/0;for(const t of e){if(""===t.trim())continue;const e=t.length-t.trimStart().length;et.length>=n?t.slice(n):t).join("\n")}(t.replace(/^(?:[ \t]*\n)+/,"").replace(/(?:\n[ \t]*)+$/,""))}function w(t){const e=t.getAttribute("from");if(e){const t=document.querySelector(e);if(t)return y(t.innerHTML)}const n=(t.getAttribute("x-code")||t.getAttribute("language")||"").toLowerCase(),o=t.querySelector(":scope > code");if(o)return y(o.textContent);if(A.has(n)){const e=document.createElement("textarea");return e.innerHTML=t.innerHTML,y(e.value)}return y(t.textContent)}const A=new Set(["html","htm","xml","svg","xhtml","rss","atom","vue","svelte","astro"]);function x(t,e,n,o){if(g.has(b(o)))return t.textContent=e,t.className="hljs language-plaintext",t.dataset.highlighted="yes","plaintext";const a=m(n,o);if(a){const o=n.highlight(e,{language:a,ignoreIllegals:!0});return t.innerHTML=o.value,t.className=`hljs language-${a}`,t.dataset.highlighted="yes",a}if(t.textContent=e,!/^[^<]*<\w[^>]*>[^<]*<\/\w/.test(e))try{n.highlightElement(t);return(t.className.match(/language-([\w-]+)/)||[])[1]||null}catch(t){}return null}async function v(t,e){const n=w(t),o=t.getAttribute("x-code")||t.getAttribute("language");x(t,n,e,o),t.hasAttribute("copy")&&E(t)}function E(t){if(t._copyBound)return;t._copyBound=!0,t.hasAttribute("role")||t.setAttribute("role","button"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.hasAttribute("aria-label")||t.setAttribute("aria-label","Click to copy");const e=async e=>{if("keydown"!==e.type||"Enter"===e.key||" "===e.key){"keydown"===e.type&&e.preventDefault();try{await navigator.clipboard.writeText(t.textContent),t.classList.add("copied"),setTimeout(()=>t.classList.remove("copied"),1500),window.ManifestTooltips&&"function"==typeof window.ManifestTooltips.showTransient&&!t.hasAttribute("x-tooltip")&&window.ManifestTooltips.showTransient(t,'',1500,["top","end"])}catch{}}};t.addEventListener("click",e),t.addEventListener("keydown",e)}async function C(t,e){if("yes"===t.dataset.codeBlockBuilt)return;t.dataset.codeBlockBuilt="yes";const n=w(t),o=t.getAttribute("x-code")||t.getAttribute("language");t.innerHTML="";const a=t.getAttribute("name")||t.getAttribute("title");a&&!t.hasAttribute("aria-label")&&t.setAttribute("aria-label",a),t.hasAttribute("role")||t.setAttribute("role","region");const r=!!t.parentElement?.hasAttribute("x-code-group");if(a&&!r){const e=document.createElement("header"),n=document.createElement("div");n.textContent=a,e.appendChild(n),t.appendChild(e)}if(t.hasAttribute("lines")){const e=document.createElement("div");e.className="lines",e.setAttribute("aria-hidden","true");const o=n.split("\n").length;for(let t=1;t<=o;t++){const n=document.createElement("span");n.textContent=String(t),e.appendChild(n)}t.appendChild(e)}const i=document.createElement("code"),s=x(i,n,e,o);if(t.appendChild(i),t.hasAttribute("copy")&&!r&&j(t,i),t.hasAttribute("collapse")&&function(t,e){const n=t.getAttribute("collapse"),o=parseInt(n,10),a=Number.isFinite(o)&&o>0?o:20,r=e.textContent.split("\n").length;if(r<=a)return;t.style.setProperty("--collapse-lines",String(a)),t.setAttribute("data-collapsed","");const i=document.createElement("button");i.className="expand",i.type="button",i.setAttribute("aria-expanded","false"),L(t,i,r-a),t.appendChild(i)}(t,i),t.hasAttribute("edit")){M(t,i,s||m(e,o),e)}t._blockBound=!0}function k(t){if(t._blockBound)return;t._blockBound=!0;const e=t.querySelector(":scope > code");if(!e)return;const n=t.querySelector(":scope > button.copy");n&&j(t,e,n);const o=t.querySelector(":scope > button.expand");if(o){const n=parseInt(t.style.getPropertyValue("--collapse-lines"),10)||20,a=Math.max(1,e.textContent.split("\n").length-n);L(t,o,a)}if(t.hasAttribute("edit")){const n=(e.className||"").match(/language-([\w-]+)/),o=n&&n[1]||t.getAttribute("x-code")||t.getAttribute("language")||"";d(o).then(n=>M(t,e,m(n,o),n)).catch(()=>{})}}function j(t,e,n){const o=n||document.createElement("button");o.className="copy",o.type="button",o.setAttribute("aria-label","Copy code to clipboard"),o.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(e.textContent),o.classList.add("copied"),setTimeout(()=>o.classList.remove("copied"),1500)}catch{}}),n||t.appendChild(o)}function L(t,e,n){const o=()=>{const o=t.hasAttribute("data-collapsed");e.setAttribute("aria-expanded",o?"false":"true"),e.textContent=o?`+${n}`:"−",e.setAttribute("aria-label",o?`Show ${n} more line${1===n?"":"s"}`:"Show less")};e.addEventListener("click",()=>{t.hasAttribute("data-collapsed")?t.removeAttribute("data-collapsed"):t.setAttribute("data-collapsed",""),o()}),o()}async function M(t,e,n,o){try{const a=await h();e.setAttribute("contenteditable","plaintext-only"),"plaintext-only"!==e.getAttribute("contenteditable")&&"plaintext-only"!==e.contentEditable&&e.setAttribute("contenteditable","true"),e.setAttribute("spellcheck","false"),t.hasAttribute("aria-label")||t.setAttribute("aria-label",n?`${n} editor`:"Code editor");const r=a(e,t=>{if(!n)return;const e=t.textContent,a=o.highlight(e,{language:n,ignoreIllegals:!0});t.innerHTML=a.value},{tab:" ",indentOn:/[{[(]\s*$|<[a-zA-Z][^<>]*(?$/,addClosing:!0});e.style.whiteSpace="pre",t._codeJar=r,t.dispatchEvent(new CustomEvent("code:editor-ready",{detail:{editor:r}}))}catch{}}async function S(t){if(!("yes"===t.dataset.codeProcessed||t.parentElement&&t.parentElement.hasAttribute("x-code-group"))){t.dataset.codeProcessed="yes";try{const e=t.getAttribute("x-code")||t.getAttribute("language"),n=await d(e),o=t.tagName,a="CODE"===o&&t.parentElement&&"PRE"===t.parentElement.tagName;if("PRE"===o)await C(t,n);else if("CODE"!==o||a)if(a){const e=t.parentElement;e.hasAttribute("x-code")||e.setAttribute("x-code",t.getAttribute("x-code")||""),await C(e,n)}else await v(t,n);else await v(t,n)}catch{}}}const P=["lines","edit","collapse"];async function $(t){if("yes"===t.dataset.groupProcessed)return;const e=Array.from(t.children).filter(t=>t.hasAttribute("name")),n=Array.from(t.children).filter(t=>!t.hasAttribute("name"));if(0===e.length&&0===n.length)return;t.dataset.groupProcessed="yes";const o=[...e,...n].filter(t=>"PRE"===t.tagName);for(const e of o)for(const n of P)t.hasAttribute(n)&&!e.hasAttribute(n)&&e.setAttribute(n,t.getAttribute(n));const a=[];for(const t of e){const e=t.getAttribute("name");a.includes(e)||a.push(e)}const r=a[0],i=t=>t.replace(/\s+/g,"-").toLowerCase(),s=o.filter(t=>t.hasAttribute("x-code")).map(t=>t.getAttribute("x-code")).filter(Boolean);let c,u=null;if(s.length>0){u=await d(s[0]);for(const t of s.slice(1))await l(t)}if("PRE"===t.tagName)c=t;else{c=document.createElement("pre");for(const e of t.attributes)c.setAttribute(e.name,e.value);for(;t.firstChild;)c.appendChild(t.firstChild);t.replaceWith(c)}c.dataset.groupProcessed="yes",c.hasAttribute("role")||c.setAttribute("role","region");for(const t of o)t.hasAttribute("x-code")&&(await C(t,u),t.dataset.codeProcessed="yes");const h=1===a.length,p=0===a.length;let f=null,g=null,b=[];if(p||(f=document.createElement("header")),h){const t=document.createElement("div");t.textContent=r,f.appendChild(t),c.hasAttribute("aria-label")||c.setAttribute("aria-label",r)}else p||(g=document.createElement("div"),g.className="unstyle",g.setAttribute("role","tablist"),g.setAttribute("aria-label","Code examples"),f.appendChild(g),b=a.map((t,e)=>{const n=document.createElement("button");return n.type="button",n.setAttribute("role","tab"),n.id=`${i(t)}-tab-${e}`,n.textContent=t,n.setAttribute("aria-selected",t===r?"true":"false"),n.tabIndex=t===r?0:-1,g.appendChild(n),n}));f&&c.insertBefore(f,c.firstChild),e.forEach((t,e)=>{const n=t.getAttribute("name");if(t.id=t.id||`${i(n)}-panel-${e}`,!h){const e=b[a.indexOf(n)];t.setAttribute("role","tabpanel"),e&&!t.hasAttribute("aria-labelledby")&&t.setAttribute("aria-labelledby",e.id)}});const m=c.hasAttribute("copy"),y=[...e,...n].some(t=>t.hasAttribute("copy"));if(m||y){const t=document.createElement("button");t.className="copy",t.type="button",t.setAttribute("aria-label","Copy code to clipboard"),c.appendChild(t)}c.dataset.groupBuilt="yes",N(c)}function N(t){if(t._groupBound)return;t._groupBound=!0;const e=Array.from(t.children).filter(t=>t.hasAttribute("name")),n=Array.from(t.children).filter(t=>!t.hasAttribute("name")&&"PRE"===t.tagName&&t.hasAttribute("x-code")),o=Array.from(t.querySelectorAll(':scope > header [role="tab"]')),a=t.querySelector(":scope > button.copy"),r=t.hasAttribute("copy"),i=!t.querySelector(":scope > header");let s=(o.find(t=>"true"===t.getAttribute("aria-selected"))||o[0]||{}).textContent||e[0]&&e[0].getAttribute("name")||null;function c(t){if(s=t,o.forEach(e=>{const n=e.textContent===t;e.setAttribute("aria-selected",n?"true":"false"),e.tabIndex=n?0:-1}),e.forEach(e=>{e.style.display=e.getAttribute("name")===t?"":"none"}),a){const n=r||e.filter(e=>e.getAttribute("name")===t).some(t=>t.hasAttribute("copy"));a.style.display=n?"":"none"}}o.forEach(t=>t.addEventListener("click",()=>c(t.textContent))),o.forEach((t,e)=>{t.addEventListener("keydown",t=>{if("ArrowRight"===t.key||"ArrowLeft"===t.key){t.preventDefault();const n="ArrowRight"===t.key?(e+1)%o.length:(e-1+o.length)%o.length;o[n].focus(),o[n].click()}else"Home"===t.key?(t.preventDefault(),o[0].focus(),o[0].click()):"End"===t.key&&(t.preventDefault(),o[o.length-1].focus(),o[o.length-1].click())})}),a&&a.addEventListener("click",async()=>{let t;if(i)t=n[0];else{const n=e.filter(t=>t.getAttribute("name")===s);t=n.find(t=>"PRE"===t.tagName&&t.hasAttribute("x-code"))||n[0]}if(!t)return;const o=t.querySelector(":scope > code")||t;try{await navigator.clipboard.writeText(o.textContent),a.classList.add("copied"),setTimeout(()=>a.classList.remove("copied"),1500)}catch{}}),i||null==s||c(s)}let I=null;function V(){return I||(I=new IntersectionObserver((t,e)=>{for(const n of t){if(!n.isIntersecting)continue;const t=n.target;("function"!=typeof t.checkVisibility||t.checkVisibility())&&(e.unobserve(t),q(t))}},{rootMargin:"100px",threshold:0}),I)}function q(t){const e=document.querySelectorAll('[x-code]:not([data-code-processed]),[x-code-group]:not([data-group-processed]),pre:not([x-code]):not([data-code-processed]) > code[class*="language-"],code[copy]:not([x-code]):not([data-code-processed]):not(pre > code)');B(t);for(const n of e){if(n===t)continue;("function"!=typeof n.checkVisibility||n.checkVisibility())&&(I&&I.unobserve(n),B(n))}}function B(t){t.hasAttribute&&t.hasAttribute("x-code-group")?$(t):t.hasAttribute&&t.hasAttribute("x-code")?S(t):t.matches&&t.matches('pre > code[class*="language-"]')?(!function(t=document){if(t&&"PRE"===t.tagName&&!t.hasAttribute("x-code")){const e=t.querySelector(':scope > code[class*="language-"]');if(!e)return;const n=e.className.match(/language-([\w-]+)/);return t.setAttribute("x-code",n?n[1]:""),void(!t.hasAttribute("name")&&t.hasAttribute("title")&&t.setAttribute("name",t.getAttribute("title")))}const e=t.querySelectorAll('pre:not([x-code]):not([data-code-processed]) > code[class*="language-"]');for(const t of e){const e=t.parentElement;if(!e)continue;const n=t.className.match(/language-([\w-]+)/),o=n?n[1]:"";e.setAttribute("x-code",o),!e.hasAttribute("name")&&e.hasAttribute("title")&&e.setAttribute("name",e.getAttribute("title"))}}(t.parentElement),S(t.parentElement)):"CODE"===t.tagName&&t.hasAttribute("copy")&&"yes"!==t.dataset.codeProcessed&&(t.dataset.codeProcessed="yes",E(t))}function R(t=document){!function(t=document){t.querySelectorAll('[x-code-group][data-group-built="yes"]').forEach(t=>{N(t),Array.from(t.children).forEach(t=>{t.dataset&&"yes"===t.dataset.codeBlockBuilt&&k(t)})}),t.querySelectorAll('pre[data-code-block-built="yes"]').forEach(k),t.querySelectorAll('code[copy][data-code-processed="yes"]').forEach(t=>{t.parentElement&&"PRE"===t.parentElement.tagName||E(t)})}(t);const e=V(),n=[...t.querySelectorAll("[x-code]:not([data-code-processed])"),...t.querySelectorAll("[x-code-group]:not([data-group-processed])"),...t.querySelectorAll('pre:not([x-code]):not([data-code-processed]) > code[class*="language-"]'),...t.querySelectorAll("code[copy]:not([x-code]):not([data-code-processed]):not(pre > code)")];for(const t of n)e.observe(t),("function"!=typeof t.checkVisibility||t.checkVisibility())&&(e.unobserve(t),B(t))}function T(){R()}let U=!1;function O(){"undefined"!=typeof Alpine&&"function"==typeof Alpine.directive&&(window.__manifestCodeDirectivesRegistered||(window.__manifestCodeDirectivesRegistered=!0,Alpine.directive("code",t=>{"yes"!==t.dataset.codeProcessed&&V().observe(t)}),Alpine.directive("code-group",t=>{"yes"!==t.dataset.groupProcessed&&V().observe(t)})))}async function _(){U||(U=!0,O(),document.addEventListener("alpine:init",O),document.addEventListener("manifest:code-blocks-converted",T),document.body&&document.body.addEventListener("manifest:code-blocks-converted",T),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>R()):R(),window.addEventListener("manifest:route-change",()=>R()))}window.ensureCodePluginInitialized=_,window.ManifestCode={loadHighlightJS:d,loadCodeJar:h,processCodeElement:S,setupCodeGroup:$,observeAll:R},_()}(); //# sourceMappingURL=manifest.code.min.js.map