From dec484658984d5e9100b691aed36109e8f5dcc26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 21 Dec 2024 10:48:26 +0100 Subject: [PATCH 1/5] Use swup for page navigation --- assets/.eslintrc.js | 1 + assets/js/entry/html.js | 11 ++ assets/js/helpers.js | 2 +- assets/js/sidebar/sidebar-list.js | 1 + assets/package-lock.json | 134 ++++++++++++++++++ assets/package.json | 6 +- formatters/html/dist/html-FUIEFJA2.js | 56 -------- formatters/html/dist/html-MT3ZX75M.js | 56 ++++++++ lib/ex_doc/formatter/epub/templates.ex | 2 +- .../epub/templates/extra_template.eex | 2 +- .../epub/templates/head_template.eex | 2 +- .../epub/templates/module_template.eex | 2 +- .../formatter/epub/templates/nav_template.eex | 2 +- .../epub/templates/title_template.eex | 2 +- lib/ex_doc/formatter/html/templates.ex | 4 +- .../html/templates/extra_template.eex | 4 +- .../html/templates/head_template.eex | 9 +- .../html/templates/module_template.eex | 4 +- .../html/templates/not_found_template.eex | 4 +- .../html/templates/search_template.eex | 4 +- .../html/templates/sidebar_template.eex | 2 +- package-lock.json | 10 -- 22 files changed, 229 insertions(+), 91 deletions(-) delete mode 100644 formatters/html/dist/html-FUIEFJA2.js create mode 100644 formatters/html/dist/html-MT3ZX75M.js delete mode 100644 package-lock.json diff --git a/assets/.eslintrc.js b/assets/.eslintrc.js index d29ca8d14..7436d4593 100644 --- a/assets/.eslintrc.js +++ b/assets/.eslintrc.js @@ -11,6 +11,7 @@ module.exports = { sourceType: 'module' }, rules: { + 'no-new': 0, 'no-path-concat': 0, 'no-throw-literal': 0, 'no-useless-escape': 0, diff --git a/assets/js/entry/html.js b/assets/js/entry/html.js index e7bd1faf5..4c3e6eb4f 100644 --- a/assets/js/entry/html.js +++ b/assets/js/entry/html.js @@ -21,6 +21,9 @@ import { initialize as initSettings } from '../settings' import { initialize as initStyling } from '../styling' import { initialize as initPreview} from '../preview' +import Swup from 'swup' +import SwupA11yPlugin from '@swup/a11y-plugin' + onDocumentReady(() => { const params = new URLSearchParams(window.location.search) const isPreview = params.has('preview') @@ -37,6 +40,14 @@ onDocumentReady(() => { if (isPreview) { initPreview() } else { + new Swup({ + animationSelector: false, + containers: ['#main'], + hooks: {'page:view': initSidebarContent}, + linkSelector: 'a[href]:not([href^="/"]):not([href^="http"]):not(.no-swup)', + plugins: [new SwupA11yPlugin()] + }) + initVersions() initSidebarDrawer() initSidebarContent() diff --git a/assets/js/helpers.js b/assets/js/helpers.js index e6fd08258..9442b3f50 100644 --- a/assets/js/helpers.js +++ b/assets/js/helpers.js @@ -43,7 +43,7 @@ export function escapeHtmlEntities (text) { * @returns {String} */ export function getCurrentPageSidebarType () { - return document.body.dataset.type + return document.getElementById('main').dataset.type } /** diff --git a/assets/js/sidebar/sidebar-list.js b/assets/js/sidebar/sidebar-list.js index db6b8bf00..c8e7a31e2 100644 --- a/assets/js/sidebar/sidebar-list.js +++ b/assets/js/sidebar/sidebar-list.js @@ -65,6 +65,7 @@ function renderSidebarNodeList (nodesByType, type) { }) nodeList.querySelectorAll('li a').forEach(anchor => { + anchor.classList.add('no-swup') anchor.addEventListener('click', event => { const target = event.target const listItem = target.closest('li') diff --git a/assets/package-lock.json b/assets/package-lock.json index 4084ebd7a..ad641d3e5 100644 --- a/assets/package-lock.json +++ b/assets/package-lock.json @@ -6,6 +6,10 @@ "": { "name": "ex_doc", "license": "Apache-2.0", + "dependencies": { + "@swup/a11y-plugin": "^5.0.0", + "swup": "^4.8.1" + }, "devDependencies": { "@fontsource/inconsolata": "^4.5.9", "@fontsource/lato": "^4.5.10", @@ -503,6 +507,28 @@ "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", "dev": true }, + "node_modules/@swup/a11y-plugin": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@swup/a11y-plugin/-/a11y-plugin-5.0.0.tgz", + "integrity": "sha512-t0pVWAVea+Imjj05n9QMPfqZhw9i5rx7BV/l3Ejeic+X3Qs0VZwVvEJIcdqireCVJgAJGZAPlmgbiuaj5UHJaQ==", + "license": "MIT", + "dependencies": { + "@swup/plugin": "^4.0.0", + "focus-options-polyfill": "^1.5.0" + }, + "peerDependencies": { + "swup": "^4.0.0" + } + }, + "node_modules/@swup/plugin": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@swup/plugin/-/plugin-4.0.0.tgz", + "integrity": "sha512-3Kq31BJxnzoPg643YxGoWQggoU6VPKZpdE5CqqmP7wwkpCYTzkRmrfcQ29mGhsSS7xfS7D33iZoBiwY+wPoo2A==", + "license": "MIT", + "dependencies": { + "swup": "^4.0.0" + } + }, "node_modules/@types/cookie": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", @@ -1162,6 +1188,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delegate-it": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/delegate-it/-/delegate-it-6.2.1.tgz", + "integrity": "sha512-3/P/rwj+zal/99EEml7y1+bXjBY+Wok/WSg0EngWAtdvHK6iKTPbABQE84RyyRfR0Fmejs93BrkZQWlgyeWuFQ==", + "license": "MIT", + "dependencies": { + "typed-query-selector": "^2.11.2" + }, + "funding": { + "url": "https://github.com/sponsors/fregante" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -1990,6 +2028,12 @@ "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, + "node_modules/focus-options-polyfill": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/focus-options-polyfill/-/focus-options-polyfill-1.6.0.tgz", + "integrity": "sha512-uyrAmLZrPnUItQY5wTdg31TO9GGZRGsh/jmohUg9oLmLi/sw5y7LlTV/mwyd6rvbxIOGwmRiv6LcTS8w7Bk9NQ==", + "license": "MIT" + }, "node_modules/follow-redirects": { "version": "1.15.6", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", @@ -3369,6 +3413,15 @@ "wrappy": "1" } }, + "node_modules/opencollective-postinstall": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz", + "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==", + "license": "MIT", + "bin": { + "opencollective-postinstall": "index.js" + } + }, "node_modules/optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -4105,6 +4158,24 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/swup": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/swup/-/swup-4.8.1.tgz", + "integrity": "sha512-MEXrQUvsUE9lyt1SX8KEZcGmPigAvtkVvHwJf22MOKsjb+aDgiljTc5LTXz0ehsA/1OOXRqvtS4kWLey26i/hQ==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "delegate-it": "^6.0.0", + "opencollective-postinstall": "^2.0.2", + "path-to-regexp": "^6.2.1" + } + }, + "node_modules/swup/node_modules/path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "license": "MIT" + }, "node_modules/text-encoding": { "version": "0.6.4", "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", @@ -4223,6 +4294,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/typed-query-selector": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.0.tgz", + "integrity": "sha512-SbklCd1F0EiZOyPiW192rrHZzZ5sBijB6xM+cpmrwDqObvdtunOHHIk9fCGsoK5JVIYXoyEp4iEdE3upFH3PAg==", + "license": "MIT" + }, "node_modules/ua-parser-js": { "version": "0.7.33", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.33.tgz", @@ -4761,6 +4838,23 @@ "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", "dev": true }, + "@swup/a11y-plugin": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@swup/a11y-plugin/-/a11y-plugin-5.0.0.tgz", + "integrity": "sha512-t0pVWAVea+Imjj05n9QMPfqZhw9i5rx7BV/l3Ejeic+X3Qs0VZwVvEJIcdqireCVJgAJGZAPlmgbiuaj5UHJaQ==", + "requires": { + "@swup/plugin": "^4.0.0", + "focus-options-polyfill": "^1.5.0" + } + }, + "@swup/plugin": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@swup/plugin/-/plugin-4.0.0.tgz", + "integrity": "sha512-3Kq31BJxnzoPg643YxGoWQggoU6VPKZpdE5CqqmP7wwkpCYTzkRmrfcQ29mGhsSS7xfS7D33iZoBiwY+wPoo2A==", + "requires": { + "swup": "^4.0.0" + } + }, "@types/cookie": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", @@ -5259,6 +5353,14 @@ "object-keys": "^1.1.1" } }, + "delegate-it": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/delegate-it/-/delegate-it-6.2.1.tgz", + "integrity": "sha512-3/P/rwj+zal/99EEml7y1+bXjBY+Wok/WSg0EngWAtdvHK6iKTPbABQE84RyyRfR0Fmejs93BrkZQWlgyeWuFQ==", + "requires": { + "typed-query-selector": "^2.11.2" + } + }, "depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -5891,6 +5993,11 @@ "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, + "focus-options-polyfill": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/focus-options-polyfill/-/focus-options-polyfill-1.6.0.tgz", + "integrity": "sha512-uyrAmLZrPnUItQY5wTdg31TO9GGZRGsh/jmohUg9oLmLi/sw5y7LlTV/mwyd6rvbxIOGwmRiv6LcTS8w7Bk9NQ==" + }, "follow-redirects": { "version": "1.15.6", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", @@ -6894,6 +7001,11 @@ "wrappy": "1" } }, + "opencollective-postinstall": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz", + "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==" + }, "optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -7410,6 +7522,23 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true }, + "swup": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/swup/-/swup-4.8.1.tgz", + "integrity": "sha512-MEXrQUvsUE9lyt1SX8KEZcGmPigAvtkVvHwJf22MOKsjb+aDgiljTc5LTXz0ehsA/1OOXRqvtS4kWLey26i/hQ==", + "requires": { + "delegate-it": "^6.0.0", + "opencollective-postinstall": "^2.0.2", + "path-to-regexp": "^6.2.1" + }, + "dependencies": { + "path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==" + } + } + }, "text-encoding": { "version": "0.6.4", "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", @@ -7500,6 +7629,11 @@ "is-typed-array": "^1.1.9" } }, + "typed-query-selector": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.0.tgz", + "integrity": "sha512-SbklCd1F0EiZOyPiW192rrHZzZ5sBijB6xM+cpmrwDqObvdtunOHHIk9fCGsoK5JVIYXoyEp4iEdE3upFH3PAg==" + }, "ua-parser-js": { "version": "0.7.33", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.33.tgz", diff --git a/assets/package.json b/assets/package.json index 59babc881..949a4a80e 100644 --- a/assets/package.json +++ b/assets/package.json @@ -19,7 +19,7 @@ "type": "git", "url": "git+https://github.com/elixir-lang/ex_doc.git" }, - "author": "Plataformatec", + "author": "The Elixir Team", "license": "Apache-2.0", "bugs": { "url": "https://github.com/elixir-lang/ex_doc/issues" @@ -47,5 +47,9 @@ "lunr": "^2.3.8", "mocha": "^10.2.0", "normalize.css": "^8.0.1" + }, + "dependencies": { + "@swup/a11y-plugin": "^5.0.0", + "swup": "^4.8.1" } } diff --git a/formatters/html/dist/html-FUIEFJA2.js b/formatters/html/dist/html-FUIEFJA2.js deleted file mode 100644 index 536795599..000000000 --- a/formatters/html/dist/html-FUIEFJA2.js +++ /dev/null @@ -1,56 +0,0 @@ -(()=>{var ri=Object.create;var pt=Object.defineProperty;var si=Object.getOwnPropertyDescriptor;var oi=Object.getOwnPropertyNames;var ai=Object.getPrototypeOf,ci=Object.prototype.hasOwnProperty;var ht=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var li=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of oi(t))!ci.call(e,r)&&r!==n&&pt(e,r,{get:()=>t[r],enumerable:!(i=si(t,r))||i.enumerable});return e};var mt=(e,t,n)=>(n=e!=null?ri(ai(e)):{},li(t||!e||!e.__esModule?pt(n,"default",{value:e,enumerable:!0}):n,e));var At=ht((uo,Ct)=>{var It="Expected a function",_t=NaN,Ii="[object Symbol]",Ci=/^\s+|\s+$/g,Ai=/^[-+]0x[0-9a-f]+$/i,Pi=/^0b[01]+$/i,Ri=/^0o[0-7]+$/i,Ni=parseInt,Qi=typeof global=="object"&&global&&global.Object===Object&&global,Hi=typeof self=="object"&&self&&self.Object===Object&&self,Fi=Qi||Hi||Function("return this")(),Di=Object.prototype,Mi=Di.toString,Bi=Math.max,zi=Math.min,Fe=function(){return Fi.Date.now()};function $i(e,t,n){var i,r,s,o,a,l,u=0,f=!1,y=!1,g=!0;if(typeof e!="function")throw new TypeError(It);t=Ot(t)||0,ve(n)&&(f=!!n.leading,y="maxWait"in n,s=y?Bi(Ot(n.maxWait)||0,t):s,g="trailing"in n?!!n.trailing:g);function L(S){var C=i,D=r;return i=r=void 0,u=S,o=e.apply(D,C),o}function b(S){return u=S,a=setTimeout(h,t),f?L(S):o}function T(S){var C=S-l,D=S-u,q=t-C;return y?zi(q,s-D):q}function m(S){var C=S-l,D=S-u;return l===void 0||C>=t||C<0||y&&D>=s}function h(){var S=Fe();if(m(S))return k(S);a=setTimeout(h,T(S))}function k(S){return a=void 0,g&&i?L(S):(i=r=void 0,o)}function w(){a!==void 0&&clearTimeout(a),u=0,i=l=r=a=void 0}function Q(){return a===void 0?o:k(Fe())}function F(){var S=Fe(),C=m(S);if(i=arguments,r=this,l=S,C){if(a===void 0)return b(l);if(y)return a=setTimeout(h,t),L(l)}return a===void 0&&(a=setTimeout(h,t)),o}return F.cancel=w,F.flush=Q,F}function Vi(e,t,n){var i=!0,r=!0;if(typeof e!="function")throw new TypeError(It);return ve(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),$i(e,t,{leading:i,maxWait:t,trailing:r})}function ve(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function qi(e){return!!e&&typeof e=="object"}function ji(e){return typeof e=="symbol"||qi(e)&&Mi.call(e)==Ii}function Ot(e){if(typeof e=="number")return e;if(ji(e))return _t;if(ve(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ve(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Ci,"");var n=Pi.test(e);return n||Ri.test(e)?Ni(e.slice(2),n?2:8):Ai.test(e)?_t:+e}Ct.exports=Vi});var mn=ht((pn,hn)=>{(function(){var e=function(t){var n=new e.Builder;return n.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),n.searchPipeline.add(e.stemmer),t.call(n,n),n.build()};e.version="2.3.9";e.utils={},e.utils.warn=function(t){return function(n){t.console&&console.warn&&console.warn(n)}}(this),e.utils.asString=function(t){return t==null?"":t.toString()},e.utils.clone=function(t){if(t==null)return t;for(var n=Object.create(null),i=Object.keys(t),r=0;r0){var f=e.utils.clone(n)||{};f.position=[a,u],f.index=s.length,s.push(new e.Token(i.slice(a,o),f))}a=o+1}}return s},e.tokenizer.separator=/[\s\-]+/;e.Pipeline=function(){this._stack=[]},e.Pipeline.registeredFunctions=Object.create(null),e.Pipeline.registerFunction=function(t,n){n in this.registeredFunctions&&e.utils.warn("Overwriting existing registered function: "+n),t.label=n,e.Pipeline.registeredFunctions[t.label]=t},e.Pipeline.warnIfFunctionNotRegistered=function(t){var n=t.label&&t.label in this.registeredFunctions;n||e.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,t)},e.Pipeline.load=function(t){var n=new e.Pipeline;return t.forEach(function(i){var r=e.Pipeline.registeredFunctions[i];if(r)n.add(r);else throw new Error("Cannot load unregistered function: "+i)}),n},e.Pipeline.prototype.add=function(){var t=Array.prototype.slice.call(arguments);t.forEach(function(n){e.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},e.Pipeline.prototype.after=function(t,n){e.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");i=i+1,this._stack.splice(i,0,n)},e.Pipeline.prototype.before=function(t,n){e.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},e.Pipeline.prototype.remove=function(t){var n=this._stack.indexOf(t);n!=-1&&this._stack.splice(n,1)},e.Pipeline.prototype.run=function(t){for(var n=this._stack.length,i=0;i1&&(ot&&(i=s),o!=t);)r=i-n,s=n+Math.floor(r/2),o=this.elements[s*2];if(o==t||o>t)return s*2;if(ol?f+=2:a==l&&(n+=i[u+1]*r[f+1],u+=2,f+=2);return n},e.Vector.prototype.similarity=function(t){return this.dot(t)/this.magnitude()||0},e.Vector.prototype.toArray=function(){for(var t=new Array(this.elements.length/2),n=1,i=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new e.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),r.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new e.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),r.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&r.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new e.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),r.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var f=s.str.charAt(0),y=s.str.charAt(1),g;y in s.node.edges?g=s.node.edges[y]:(g=new e.TokenSet,s.node.edges[y]=g),s.str.length==1&&(g.final=!0),r.push({node:g,editsRemaining:s.editsRemaining-1,str:f+s.str.slice(2)})}}}return i},e.TokenSet.fromString=function(t){for(var n=new e.TokenSet,i=n,r=0,s=t.length;r=t;n--){var i=this.uncheckedNodes[n],r=i.child.toString();r in this.minimizedNodes?i.parent.edges[i.char]=this.minimizedNodes[r]:(i.child._str=r,this.minimizedNodes[r]=i.child),this.uncheckedNodes.pop()}};e.Index=function(t){this.invertedIndex=t.invertedIndex,this.fieldVectors=t.fieldVectors,this.tokenSet=t.tokenSet,this.fields=t.fields,this.pipeline=t.pipeline},e.Index.prototype.search=function(t){return this.query(function(n){var i=new e.QueryParser(t,n);i.parse()})},e.Index.prototype.query=function(t){for(var n=new e.Query(this.fields),i=Object.create(null),r=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=t},e.Builder.prototype.k1=function(t){this._k1=t},e.Builder.prototype.add=function(t,n){var i=t[this._ref],r=Object.keys(this._fields);this._documents[i]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return e.QueryLexer.EOS;var t=this.str.charAt(this.pos);return this.pos+=1,t},e.QueryLexer.prototype.width=function(){return this.pos-this.start},e.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},e.QueryLexer.prototype.backup=function(){this.pos-=1},e.QueryLexer.prototype.acceptDigitRun=function(){var t,n;do t=this.next(),n=t.charCodeAt(0);while(n>47&&n<58);t!=e.QueryLexer.EOS&&this.backup()},e.QueryLexer.prototype.more=function(){return this.pos1&&(t.backup(),t.emit(e.QueryLexer.TERM)),t.ignore(),t.more())return e.QueryLexer.lexText},e.QueryLexer.lexEditDistance=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.EDIT_DISTANCE),e.QueryLexer.lexText},e.QueryLexer.lexBoost=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.BOOST),e.QueryLexer.lexText},e.QueryLexer.lexEOS=function(t){t.width()>0&&t.emit(e.QueryLexer.TERM)},e.QueryLexer.termSeparator=e.tokenizer.separator,e.QueryLexer.lexText=function(t){for(;;){var n=t.next();if(n==e.QueryLexer.EOS)return e.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){t.escapeCharacter();continue}if(n==":")return e.QueryLexer.lexField;if(n=="~")return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexEditDistance;if(n=="^")return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexBoost;if(n=="+"&&t.width()===1||n=="-"&&t.width()===1)return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if(n.match(e.QueryLexer.termSeparator))return e.QueryLexer.lexTerm}},e.QueryParser=function(t,n){this.lexer=new e.QueryLexer(t),this.query=n,this.currentClause={},this.lexemeIdx=0},e.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var t=e.QueryParser.parseClause;t;)t=t(this);return this.query},e.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},e.QueryParser.prototype.consumeLexeme=function(){var t=this.peekLexeme();return this.lexemeIdx+=1,t},e.QueryParser.prototype.nextClause=function(){var t=this.currentClause;this.query.clause(t),this.currentClause={}},e.QueryParser.parseClause=function(t){var n=t.peekLexeme();if(n!=null)switch(n.type){case e.QueryLexer.PRESENCE:return e.QueryParser.parsePresence;case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(i+=" with value '"+n.str+"'"),new e.QueryParseError(i,n.start,n.end)}},e.QueryParser.parsePresence=function(t){var n=t.consumeLexeme();if(n!=null){switch(n.str){case"-":t.currentClause.presence=e.Query.presence.PROHIBITED;break;case"+":t.currentClause.presence=e.Query.presence.REQUIRED;break;default:var i="unrecognised presence operator'"+n.str+"'";throw new e.QueryParseError(i,n.start,n.end)}var r=t.peekLexeme();if(r==null){var i="expecting term or field, found nothing";throw new e.QueryParseError(i,n.start,n.end)}switch(r.type){case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expecting term or field, found '"+r.type+"'";throw new e.QueryParseError(i,r.start,r.end)}}},e.QueryParser.parseField=function(t){var n=t.consumeLexeme();if(n!=null){if(t.query.allFields.indexOf(n.str)==-1){var i=t.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),r="unrecognised field '"+n.str+"', possible fields: "+i;throw new e.QueryParseError(r,n.start,n.end)}t.currentClause.fields=[n.str];var s=t.peekLexeme();if(s==null){var r="expecting term, found nothing";throw new e.QueryParseError(r,n.start,n.end)}switch(s.type){case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var r="expecting term, found '"+s.type+"'";throw new e.QueryParseError(r,s.start,s.end)}}},e.QueryParser.parseTerm=function(t){var n=t.consumeLexeme();if(n!=null){t.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(t.currentClause.usePipeline=!1);var i=t.peekLexeme();if(i==null){t.nextClause();return}switch(i.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var r="Unexpected lexeme type '"+i.type+"'";throw new e.QueryParseError(r,i.start,i.end)}}},e.QueryParser.parseEditDistance=function(t){var n=t.consumeLexeme();if(n!=null){var i=parseInt(n.str,10);if(isNaN(i)){var r="edit distance must be numeric";throw new e.QueryParseError(r,n.start,n.end)}t.currentClause.editDistance=i;var s=t.peekLexeme();if(s==null){t.nextClause();return}switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var r="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(r,s.start,s.end)}}},e.QueryParser.parseBoost=function(t){var n=t.consumeLexeme();if(n!=null){var i=parseInt(n.str,10);if(isNaN(i)){var r="boost must be numeric";throw new e.QueryParseError(r,n.start,n.end)}t.currentClause.boost=i;var s=t.peekLexeme();if(s==null){t.nextClause();return}switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var r="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(r,s.start,s.end)}}},function(t,n){typeof define=="function"&&define.amd?define(n):typeof pn=="object"?hn.exports=n():t.lunr=n()}(this,function(){return e})})()});Handlebars.registerHelper("groupChanged",function(e,t,n){let i=t||"";if(e.group!==i)return delete e.nestedContext,e.group=i,n.fn(this)});Handlebars.registerHelper("nestingChanged",function(e,t,n){if(t.nested_context&&t.nested_context!==e.nestedContext){if(e.nestedContext=t.nested_context,e.lastModuleSeenInGroup!==t.nested_context)return n.fn(this)}else e.lastModuleSeenInGroup=t.title});Handlebars.registerHelper("showSections",function(e,t){if(e.sections.length>0)return t.fn(this)});Handlebars.registerHelper("showSummary",function(e,t){if(e.nodeGroups)return t.fn(this)});Handlebars.registerHelper("isArray",function(e,t){return Array.isArray(e)?t.fn(this):t.inverse(this)});Handlebars.registerHelper("isNonEmptyArray",function(e,t){return Array.isArray(e)&&e.length>0?t.fn(this):t.inverse(this)});Handlebars.registerHelper("isEmptyArray",function(e,t){return Array.isArray(e)&&e.length===0?t.fn(this):t.inverse(this)});Handlebars.registerHelper("isLocal",function(e,t){let n=window.location.pathname.split("/").pop();return n===e+".html"||n===e?t.fn(this):t.inverse(this)});var c=document.querySelector.bind(document),_=document.querySelectorAll.bind(document);function gt(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function me(e){return String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function $(){return document.body.dataset.type}function yt(e,t){if(e){for(let n of e){let i=n.nodeGroups&&n.nodeGroups.find(r=>r.nodes.some(s=>s.anchor===t));if(i)return i.key}return null}}function ge(e,t=!1){if(!e)return t?document.getElementById("top-content"):null;let n=document.getElementById(e);return n?n.matches(".detail")?n:["h1","h2","h3","h4","h5","h6"].includes(n.tagName.toLowerCase())?ui(n):null:null}function ui(e){let t=[e],n=e.nextElementSibling,i=e.tagName.toLowerCase();for(;n;){let s=n.tagName.toLowerCase();["h1","h2","h3","h4","h5","h6"].includes(s)&&s<=i?n=null:(t.push(n),n=n.nextElementSibling)}let r=document.createElement("div");return r.append(...t),r}function te(){return window.location.hash.replace(/^#/,"")}function vt(e){return new URLSearchParams(window.location.search).get(e)}function bt(e){return fetch(e).then(t=>t.ok).catch(()=>!1)}function St(e){document.readyState!=="loading"?e():document.addEventListener("DOMContentLoaded",e)}function ne(e){return!e||e.trim()===""}function xt(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>{n=null,e(...r)},t)}}function ye(){return document.head.querySelector("meta[name=project][content]").content}function ie(){return/(Macintosh|iPhone|iPad|iPod)/.test(window.navigator.userAgent)}var di="content",fi="tabs-open",pi="tabs-close",hi="H3",mi="tabset";function Lt(){gi().map(yi).forEach(n=>Si(n))}function gi(){let e=document.createNodeIterator(document.getElementById(di),NodeFilter.SHOW_COMMENT,{acceptNode(i){return i.nodeValue.trim()===fi?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),t=[],n;for(;n=e.nextNode();)t.push(n);return t}function yi(e,t,n){let i=[],r=[],s={label:"",content:[]};for(;e=e.nextSibling;){if(vi(e)){Et(s,r,t);break}i.push(e),e.nodeName===hi?(Et(s,r,t),s.label=e.innerText,s.content=[]):s.content.push(e.outerHTML)}let o=document.createElement("div");return o.className=mi,bi(i,o),o.innerHTML=Handlebars.templates.tabset({tabs:r}),o}function vi(e){return e.nodeName==="#comment"&&e.nodeValue.trim()===pi}function Et(e,t,n){if(e.label===""&&!e.content.length)return!1;let i=e.label,r=e.content;t.push({label:i,content:r,setIndex:n})}function bi(e,t){if(!e||!e.length)return!1;e[0].parentNode.insertBefore(t,e[0]),e.forEach(n=>t.appendChild(n))}function Si(e){let t={tabs:e.querySelectorAll(':scope [role="tab"]'),panels:e.querySelectorAll(':scope [role="tabpanel"]'),activeIndex:0};t.tabs.forEach((n,i)=>{n.addEventListener("click",r=>{G(i,t)}),n.addEventListener("keydown",r=>{let s=t.tabs.length-1;r.code==="ArrowLeft"?(r.preventDefault(),t.activeIndex===0?G(s,t):G(t.activeIndex-1,t)):r.code==="ArrowRight"?(r.preventDefault(),t.activeIndex===s?G(0,t):G(t.activeIndex+1,t)):r.code==="Home"?(r.preventDefault(),G(0,t)):r.code==="End"&&(r.preventDefault(),G(s,t))})})}function G(e,t){t.tabs[t.activeIndex].setAttribute("aria-selected","false"),t.tabs[t.activeIndex].tabIndex=-1,t.tabs[e].setAttribute("aria-selected","true"),t.tabs[e].tabIndex=0,t.tabs[e].focus(),t.panels[t.activeIndex].setAttribute("hidden",""),t.panels[t.activeIndex].tabIndex=-1,t.panels[e].removeAttribute("hidden"),t.panels[e].tabIndex=0,t.activeIndex=e}var Tt="ex_doc:settings",xi={tooltips:!0,theme:null,livebookUrl:null},He=class{constructor(){this._subscribers=[],this._settings=xi,this._loadSettings()}get(){return this._settings}update(t){let n=this._settings;this._settings={...this._settings,...t},this._subscribers.forEach(i=>i(this._settings,n)),this._storeSettings()}getAndSubscribe(t){this._subscribers.push(t),t(this._settings)}_loadSettings(){try{let t=localStorage.getItem(Tt);if(t){let n=JSON.parse(t);this._settings={...this._settings,...n}}this._loadSettingsLegacy()}catch(t){console.error(`Failed to load settings: ${t}`)}}_storeSettings(){try{this._storeSettingsLegacy(),localStorage.setItem(Tt,JSON.stringify(this._settings))}catch(t){console.error(`Failed to persist settings: ${t}`)}}_loadSettingsLegacy(){localStorage.getItem("tooltipsDisabled")!==null&&(this._settings={...this._settings,tooltips:!1}),localStorage.getItem("night-mode")==="true"&&(this._settings={...this._settings,nightMode:!0}),this._settings.nightMode===!0&&(this._settings={...this._settings,theme:"dark"})}_storeSettingsLegacy(){this._settings.tooltips?localStorage.removeItem("tooltipsDisabled"):localStorage.setItem("tooltipsDisabled","true"),this._settings.nightMode!==null?localStorage.setItem("night-mode",this._settings.nightMode===!0?"true":"false"):localStorage.removeItem("night-mode"),this._settings.theme!==null?(localStorage.setItem("night-mode",this._settings.theme==="dark"?"true":"false"),this._settings.nightMode=this._settings.theme==="dark"):(delete this._settings.nightMode,localStorage.removeItem("night-mode"))}},O=new He;var Ei=".content",wt=".content-inner",Li=".livebook-badge";function kt(e){e||wi(),ki(),Ti()}function Ti(){c(Ei).querySelectorAll("a").forEach(e=>{e.querySelector("code, img")&&e.classList.add("no-underline")})}function wi(){c(wt).setAttribute("tabindex",-1),c(wt).focus()}function ki(){let t=window.location.pathname.replace(/(\.html)?$/,".livemd"),n=new URL(t,window.location.href).toString();O.getAndSubscribe(i=>{let r=i.livebookUrl?Oi(i.livebookUrl,n):_i(n);for(let s of _(Li))s.href=r})}function _i(e){return`https://livebook.dev/run?url=${encodeURIComponent(e)}`}function Oi(e,t){return`${e}/import?url=${encodeURIComponent(t)}`}var Rt=mt(At());var Ui=768,De=300,re=".sidebar-toggle",Wi=".content",M={CLOSED:"closed",OPEN:"open",NO_PREF:"no_pref"},N={opened:"sidebar-opened",openingStart:"sidebar-opening-start",opening:"sidebar-opening",closed:"sidebar-closed",closingStart:"sidebar-closing-start",closing:"sidebar-closing"},Gi=Object.values(N),A={togglingTimeout:null,lastWindowWidth:window.innerWidth,sidebarPreference:M.NO_PREF};function Nt(){Qt(),Ki(),Yi()}function Ki(){let e=sessionStorage.getItem("sidebar_width");e&&Pt(e),new ResizeObserver(n=>{for(let i of n)Pt(i.contentRect.width)}).observe(document.getElementById("sidebar"))}function Pt(e){sessionStorage.setItem("sidebar_width",e),document.body.style.setProperty("--sidebarWidth",`${e}px`)}function Qt(){sessionStorage.getItem("sidebar_state")==="closed"||Ht()?(V(N.closed),c(re).setAttribute("aria-expanded","false")):(V(N.opened),c(re).setAttribute("aria-expanded","true")),setTimeout(()=>c(re).classList.add("sidebar-toggle--animated"),De)}function Ht(){return window.matchMedia(`screen and (max-width: ${Ui}px)`).matches}function V(...e){document.body.classList.remove(...Gi),document.body.classList.add(...e)}function Yi(){c(re).addEventListener("click",e=>{Me(),Zi()}),c(Wi).addEventListener("click",e=>{Xi()}),window.addEventListener("resize",(0,Rt.default)(e=>{Ji()},100))}function Me(){return Be()?Dt():ze()}function Be(){return document.body.classList.contains(N.opened)||document.body.classList.contains(N.opening)}function Ft(){return document.body.classList.contains(N.opened)}function ze(){return Mt(),sessionStorage.setItem("sidebar_state","opened"),c(re).setAttribute("aria-expanded","true"),new Promise((e,t)=>{requestAnimationFrame(()=>{V(N.openingStart),requestAnimationFrame(()=>{V(N.opening),A.togglingTimeout=setTimeout(()=>{V(N.opened),e()},De)})})})}function Dt(){return Mt(),sessionStorage.setItem("sidebar_state","closed"),c(re).setAttribute("aria-expanded","false"),new Promise((e,t)=>{requestAnimationFrame(()=>{V(N.closingStart),requestAnimationFrame(()=>{V(N.closing),A.togglingTimeout=setTimeout(()=>{V(N.closed),e()},De)})})})}function Mt(){A.togglingTimeout&&(clearTimeout(A.togglingTimeout),A.togglingTimeout=null)}function Ji(){A.lastWindowWidth!==window.innerWidth&&(A.lastWindowWidth=window.innerWidth,(A.sidebarPreference===M.OPEN||A.sidebarPreference===M.NO_PREF)&&Qt())}function Xi(){Ht()&&Be()&&Dt()}function Zi(){switch(A.sidebarPreference){case M.OPEN:A.sidebarPreference=M.CLOSED;break;case M.CLOSED:A.sidebarPreference=M.OPEN;break;case M.NO_PREF:Be()?A.sidebarPreference=M.OPEN:A.sidebarPreference=M.CLOSED}}function le(){return window.sidebarNodes||{}}function Bt(){return window.versionNodes||[]}var $e={search:"search",extras:"extras",modules:"modules",tasks:"tasks"},Ve=[$e.extras,$e.modules,$e.tasks],Se=e=>`#${e}-full-list`;function zt(){Ve.forEach(e=>{er(le(),e)}),be($()),Vt(),$t(),ar()}function er(e,t){let n=e[t]||[],i=c(Se(t));if(!i)return;let r=Handlebars.templates["sidebar-items"]({nodes:n,group:""});i.innerHTML=r,i.querySelectorAll("ul").forEach(s=>{if(s.innerHTML.trim()===""){let o=s.previousElementSibling;o.classList.contains("expand")&&o.classList.remove("expand"),s.remove()}}),i.querySelectorAll("li a + button").forEach(s=>{s.addEventListener("click",o=>{let l=o.target.closest("li");nr(l)})}),i.querySelectorAll("li a").forEach(s=>{s.addEventListener("click",o=>{let l=o.target.closest("li"),u=i.querySelector(".current-section");u&&rr(u),s.matches(".expand")&&(s.pathname===window.location.pathname||s.pathname===window.location.pathname+".html")&&qe(l)})})}function qe(e){e.classList.add("open"),e.querySelector("button[aria-controls]").setAttribute("aria-expanded","true")}function tr(e){e.classList.remove("open"),e.querySelector("button[aria-controls]").setAttribute("aria-expanded","false")}function nr(e){e.classList.contains("open")?tr(e):qe(e)}function ir(e){e.classList.add("current-section"),e.querySelector("a").setAttribute("aria-current","true")}function rr(e){e.classList.remove("current-section"),e.querySelector("a").setAttribute("aria-current","false")}function sr(e){e.classList.add("current-hash"),e.querySelector("a").setAttribute("aria-current","true")}function or(e){e.classList.remove("current-hash"),e.querySelector("a").setAttribute("aria-current","false")}function be(e){Ve.forEach(t=>{let n=c(`#${t}-list-tab-button`);if(n){let i=c(`#${n.getAttribute("aria-controls")}`);t===e?(n.parentElement.classList.add("selected"),n.setAttribute("aria-selected","true"),n.setAttribute("tabindex","0"),i.removeAttribute("hidden")):(n.parentElement.classList.remove("selected"),n.setAttribute("aria-selected","false"),n.setAttribute("tabindex","-1"),i.setAttribute("hidden","hidden"))}})}function $t(){let e=c(Se($()));if(!e)return;let t=e.querySelector("li.current-page");t&&(t.scrollIntoView(),e.scrollTop-=40)}function Vt(){let e=te()||"content",n=le()[$()]||[],i=yt(n,e),r=c(Se($()));if(!r)return;let s=r.querySelector(`li.current-page a.expand[href$="#${i}"]`);s&&qe(s.closest("li"));let o=r.querySelector(`li.current-page a[href$="#${e}"]`);if(o){let a=o.closest("ul");a.classList.contains("deflist")&&ir(a.closest("li")),sr(o.closest("li"))}}function ar(){Ve.forEach(t=>{let n=c(`#${t}-list-tab-button`);n&&n.addEventListener("click",i=>{be(t),$t()})});let e=c("#sidebar-listNav");e.addEventListener("keydown",t=>{if(t.key!=="ArrowRight"&&t.key!=="ArrowLeft")return;let n=Array.from(e.querySelectorAll('[role="tab"]')).map(r=>r.dataset.type),i=e.querySelector('[role="tab"][aria-selected="true"]').dataset.type;if(t.key==="ArrowRight"){let r=n.indexOf(i)+1;r>=n.length&&(r=0);let s=n[r];be(s),c(`#${s}-list-tab-button`).focus()}else if(t.key==="ArrowLeft"){let r=n.indexOf(i)-1;r<0&&(r=n.length-1);let s=n[r];be(s),c(`#${s}-list-tab-button`).focus()}}),window.addEventListener("hashchange",t=>{let n=c(Se($()));if(!n)return;let i=n.querySelector("li.current-page li.current-hash");i&&or(i),Vt()})}var B={module:"module",moduleChild:"module-child",mixTask:"mix-task",extra:"extra",section:"section"};function jt(e,t=8){if(ne(e))return[];let n=le(),i=[...je(n.modules,e,B.module,"module"),...cr(n.modules,e,B.moduleChild),...je(n.tasks,e,B.mixTask,"mix task"),...je(n.extras,e,B.extra,"page"),...Ue(n.modules,e,B.section,"module"),...Ue(n.tasks,e,B.section,"mix task"),...Ue(n.extras,e,B.section,"page")].filter(r=>r!==null);return mr(i).slice(0,t)}function je(e,t,n,i){return e.map(r=>ur(r,t,n,i))}function cr(e,t,n){return e.filter(i=>i.nodeGroups).flatMap(i=>i.nodeGroups.flatMap(({key:r,nodes:s})=>{let o=hr(r);return s.map(a=>dr(a,i.id,t,n,o)||pr(a,i.id,t,n,o))}))}function Ue(e,t,n,i){return e.flatMap(r=>lr(r).map(s=>fr(r,s,t,n,i)))}function lr(e){return(e.sections||[]).concat(e.headers||[])}function ur(e,t,n,i){return Ee(e.title,t)?{link:`${e.id}.html`,title:we(e.title,t),description:null,matchQuality:Le(e.title,t),deprecated:e.deprecated,labels:[i],category:n}:null}function dr(e,t,n,i,r){return Ee(e.id,n)?{link:`${t}.html#${e.anchor}`,title:we(e.id,n),labels:[r],description:t,matchQuality:Le(e.id,n),deprecated:e.deprecated,category:i}:null}function fr(e,t,n,i,r){return Ut(t.id,n)?{link:`${e.id}.html#${t.anchor}`,title:we(t.id,n),description:e.title,matchQuality:Le(t.id,n),labels:[r,"section"],category:i}:null}function pr(e,t,n,i,r){let s=`${t}.${e.id}`,o=`${t}:${e.id}`,a,l;if(Ee(s,n))a=s,l=/\./g;else if(Ee(o,n))a=o,l=/:/g;else return null;let u=n.replace(l," ");return Ut(e.id,u)?{link:`${t}.html#${e.anchor}`,title:we(e.id,u),label:r,description:t,matchQuality:Le(a,n),deprecated:e.deprecated,category:i}:null}function hr(e){switch(e){case"callbacks":return"callback";case"types":return"type";default:return"function"}}function mr(e){return e.slice().sort((t,n)=>t.matchQuality!==n.matchQuality?n.matchQuality-t.matchQuality:qt(t.category)-qt(n.category))}function qt(e){switch(e){case B.module:return 1;case B.moduleChild:return 2;case B.mixTask:return 3;default:return 4}}function Ut(e,t){return Te(t).some(i=>Wt(e,i))}function Ee(e,t){return Te(t).every(i=>Wt(e,i))}function Wt(e,t){return e.toLowerCase().includes(t.toLowerCase())}function Le(e,t){let n=Te(t),r=n.map(o=>o.length).reduce((o,a)=>o+a,0)/e.length,s=gr(e,n[0])?1:0;return r+s}function gr(e,t){return e.toLowerCase().startsWith(t.toLowerCase())}function Te(e){return e.trim().split(/\s+/)}function we(e,t){let n=Te(t).sort((i,r)=>r.length-i.length);return xe(e,n)}function xe(e,t){if(t.length===0)return e;let[n,...i]=t,r=e.match(new RegExp(`(.*)(${gt(n)})(.*)`,"i"));if(r){let[,s,o,a]=r;return xe(s,t)+""+me(o)+""+xe(a,t)}else return xe(e,i)}var ke=null,K=null;function Gt(){K=document.getElementById("toast"),K.addEventListener("click",e=>{clearTimeout(ke),e.target.classList.remove("show")})}function We(e){K&&(clearTimeout(ke),K.innerText=e,K.classList.add("show"),ke=setTimeout(()=>{K.classList.remove("show"),ke=setTimeout(function(){K.innerText=""},1e3)},5e3))}var Kt="dark",Ge=["system","dark","light"];function Yt(e){O.getAndSubscribe(t=>{document.body.classList.toggle(Kt,Xt(e||t.theme))}),vr()}function Jt(){let e=Ge[Ge.indexOf(Ke())+1]||Ge[0];O.update({theme:e}),We(`Set theme to "${e}"`)}function Ke(){return O.get().theme||"system"}function Xt(e){return e==="dark"||yr()&&(e==null||e==="system")}function yr(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function vr(){window.matchMedia("(prefers-color-scheme: dark)").addListener(e=>{let t=O.get().theme,n=Xt(t);(t==null||t==="system")&&(document.body.classList.toggle(Kt,n),We(`Browser changed theme to "${n?"dark":"light"}"`))})}var se=".autocomplete",Oe=".autocomplete-suggestions",_e=".autocomplete-suggestion",I={autocompleteSuggestions:[],previewOpen:!1,selectedIdx:-1};function br(){c(se).classList.add("shown")}function Ye(){c(se).classList.remove("shown")}function Zt(){return c(se).classList.contains("shown")}function Je(e){I.autocompleteSuggestions=jt(e),I.selectedIdx=-1,ne(e)?Ye():(Sr({term:e,suggestions:I.autocompleteSuggestions}),Ie(0),br())}function Sr({term:e,suggestions:t}){let n=Handlebars.templates["autocomplete-suggestions"]({suggestions:t,term:e}),i=c(se);i.innerHTML=n}function en(){return I.selectedIdx===-1?null:I.autocompleteSuggestions[I.selectedIdx]}function Ie(e){nn(xr(e))}function tn(e){if(e.data.type==="preview"){let{contentHeight:t}=e.data,n=c(".autocomplete-preview");n&&(n.style.height=`${t+32}px`,n.classList.remove("loading"))}}function nn(e){I.selectedIdx=e;let t=c(Oe),n=c(`${_e}.selected`),i=c(`${_e}[data-index="${I.selectedIdx}"]`);if(n&&n.classList.remove("selected"),i){if(I.previewOpen){sn(),window.addEventListener("message",tn),t.classList.add("previewing");let r=document.createElement("div");r.classList.add("autocomplete-preview"),r.classList.add("loading");let s=i.href.replace(".html",`.html?preview=true&theme=${Ke()}`),o=document.createElement("iframe");o.setAttribute("src",s),r.appendChild(document.createElement("div")),r.appendChild(document.createElement("span")),r.appendChild(o),i.parentNode.insertBefore(r,i.nextSibling)}i.classList.add("selected"),i.scrollIntoView({block:"nearest"})}else t&&(t.scrollTop=0)}function rn(){I.previewOpen?Ce():Xe()}function Ce(){I.previewOpen=!1;let e=c(Oe);e&&e.classList.remove("previewing"),sn()}function Xe(e){I.previewOpen=!0,e?e=e.closest(_e):e=c(`${_e}[data-index="${I.selectedIdx}"]`),e&&nn(parseInt(e.dataset.index))}function sn(){let e=c(".autocomplete-preview");e&&(e.remove(),window.removeEventListener("message",tn))}function xr(e){let t=I.autocompleteSuggestions.length+1;return(I.selectedIdx+e+1+t)%t-1}var ue="form.search-bar input",Er="form.search-bar .search-close-button";function cn(){Lr(),window.onTogglePreviewClick=function(e,t){e.preventDefault(),e.stopImmediatePropagation(),et(),t?Xe(e.target):Ce()}}function ln(e){let t=c(ue);t.value=e}function et(){let e=c(ue);document.body.classList.add("search-focused"),e.focus()}function Lr(){let e=c(ue);if(document.querySelector('meta[name="exdoc:autocomplete"][content="off"]'))return e.addEventListener("keydown",t=>{t.key==="Enter"&&on(t)}),!0;e.addEventListener("keydown",t=>{let n=ie();t.key==="Escape"?(Ae(),e.blur()):t.key==="Enter"?on(t):t.key==="ArrowUp"||n&&t.ctrlKey&&t.key==="p"?(Ie(-1),t.preventDefault()):t.key==="ArrowDown"||n&&t.ctrlKey&&t.key==="n"?(Ie(1),t.preventDefault()):t.key==="Tab"&&(rn(),t.preventDefault())}),e.addEventListener("input",t=>{Je(t.target.value)}),e.addEventListener("focus",t=>{document.body.classList.contains("search-focused")||(document.body.classList.add("search-focused"),Je(t.target.value))}),e.addEventListener("blur",t=>{let n=t.relatedTarget,i=c(Oe);if(n&&i&&i.contains(n))return setTimeout(()=>{Zt()&&e.focus()},1e3),null;Pe()}),c(se).addEventListener("click",t=>{t.shiftKey||t.ctrlKey?e.focus():(Ae(),Pe())}),c(Er).addEventListener("click",t=>{Ae(),Pe()})}function on(e){let t=c(ue),n=e.shiftKey||e.ctrlKey,i=en();e.preventDefault();let r=n?"_blank":"_self",s=document.createElement("a");if(s.setAttribute("target",r),i)s.setAttribute("href",i.link);else{let o=document.querySelector('meta[name="exdoc:full-text-search-url"]'),a=o?o.getAttribute("content"):"search.html?q=";s.setAttribute("href",`${a}${encodeURIComponent(t.value)}`)}s.click(),n||(Ae(),Pe())}function Ae(){let e=c(ue);e.value=""}function Pe(){Ce(),document.body.classList.remove("search-focused"),Ye()}var Ze=window.scrollY,Tr=70,an=-2;window.addEventListener("scroll",function(){let e=window.scrollY;e===0||Ze-eTr?document.body.classList.remove("scroll-sticky"):Ze-e>Math.abs(an)&&document.body.classList.add("scroll-sticky"),Ze=e<=0?0:e},!1);var un=".sidebar-projectVersion",dn=".sidebar-projectVersionsDropdown";function fn(){let e=Bt();if(e.length>0){let n=c(un).textContent.trim(),i=kr(e,n);wr({nodes:i})}}function wr({nodes:e}){let t=c(un),n=Handlebars.templates["versions-dropdown"]({nodes:e});t.innerHTML=n,c(dn).addEventListener("change",Or)}function kr(e,t){return _r(e,t).map(i=>({...i,isCurrentVersion:i.version===t}))}function _r(e,t){return e.some(i=>i.version===t)?e:[{version:t,url:"#"},...e]}function Or(e){let t=e.target.value,n=window.location.pathname.split("/").pop()+window.location.hash,i=`${t}/${n}`;bt(i).then(r=>{r?window.location.href=i:window.location.href=t})}function tt(){let e=c(dn);e&&(e.focus(),e.addEventListener("keydown",t=>{(t.key==="Escape"||t.key==="v")&&(t.preventDefault(),e.blur())}),navigator.userActivation.isActive&&"showPicker"in HTMLSelectElement.prototype&&e.showPicker())}var H=mt(mn());var Re=80,Ir="#search";function yn(){let e=window.location.pathname;if(e.endsWith("/search.html")||e.endsWith("/search")){let t=vt("q");Cr(t)}}async function Cr(e){if(ne(e))nt({value:e});else{ln(e);let t=await Ar();try{let n=e.replaceAll(/(\B|\\):/g,"\\:"),i=zr(t.search(n));nt({value:e,results:i})}catch(n){nt({value:e,errorMessage:n.message})}}}function nt({value:e,results:t,errorMessage:n}){let i=c(Ir),r=Handlebars.templates["search-results"]({value:e,results:t,errorMessage:n});i.innerHTML=r}async function Ar(){H.default.tokenizer.separator=/\s+/,H.default.QueryLexer.termSeparator=/\s+/,H.default.Pipeline.registerFunction(bn,"docTokenSplitter"),H.default.Pipeline.registerFunction(Sn,"docTrimmer");let e=await Pr();if(e)return e;let t=Dr();return Rr(t),t}async function Pr(){try{let e=sessionStorage.getItem(vn());if(e){let t=await Qr(e);return H.default.Index.load(t)}else return null}catch(e){return console.error("Failed to load index: ",e),null}}async function Rr(e){try{let t=await Nr(e);sessionStorage.setItem(vn(),t)}catch(t){console.error("Failed to save index: ",t)}}async function Nr(e){let t=new Blob([JSON.stringify(e)],{type:"application/json"}).stream().pipeThrough(new window.CompressionStream("gzip")),i=await(await new Response(t).blob()).arrayBuffer();return Hr(i)}async function Qr(e){let t=new Blob([Fr(e)],{type:"application/json"}).stream().pipeThrough(new window.DecompressionStream("gzip")),n=await new Response(t).text();return JSON.parse(n)}function Hr(e){let t="",n=new Uint8Array(e),i=n.byteLength;for(let r=0;r{this.add(e)})})}function Mr(e){e.pipeline.before(H.default.stemmer,bn)}function bn(e){let t=[e],n=/\/\d+$/,i=/\:|\./,r=e.toString();if(r.replace(/^[.,;?!]+|[.,;]+$/g,""),r.startsWith("`")&&r.endsWith("`")&&(r=r.slice(1,-1)),n.test(r)){let o=e.toString().replace(n,"");t.push(e.clone().update(()=>o));let a=o.split(i);if(a.length>1){for(let u of a)t.push(e.clone().update(()=>u));let l=e.toString().split(i);t.push(e.clone().update(()=>l[l.length-1]))}r=a[a.length-1]}else r.startsWith("@")?(r=r.substring(1),t.push(e.clone().update(()=>r))):r.startsWith(":")&&(r=r.substring(1),t.push(e.clone().update(()=>r)));let s=r.split(/\_|\-/);if(s.length>1)for(let o of s)t.push(e.clone().update(()=>o));return t}function Br(e){e.pipeline.before(H.default.stemmer,Sn)}function Sn(e){return e.update(function(t){return t.replace(/^[^@:\w]+/,"").replace(/[^\?\!\w]+$/,"")})}function zr(e){return e.filter(t=>gn(t.ref)).map(t=>{let n=gn(t.ref),i=t.matchData.metadata;return{...n,metadata:i,excerpts:$r(n,i)}})}function gn(e){return searchData.items.find(t=>t.ref===e)||null}function $r(e,t){let{doc:n}=e,r=Object.keys(t).filter(s=>"doc"in t[s]).map(s=>t[s].doc.position.map(([o,a])=>Vr(n,o,a))).reduce((s,o)=>s.concat(o),[]);return r.length===0?[n.slice(0,Re*2)+(Re*20?"...":"",e.slice(i,t),""+me(e.slice(t,t+n))+"",e.slice(t+n,r),r{let n=t.getAttribute("data-group-id");t.addEventListener("mouseenter",i=>{xn(n,!0)}),t.addEventListener("mouseleave",i=>{xn(n,!1)})})}function xn(e,t){_(`[data-group-id="${e}"]`).forEach(i=>{i.classList.toggle(qr,t)})}var J=".modal",Ur=".modal .modal-close",Wr=".modal .modal-title",Gr=".modal .modal-body",Ln='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',z={prevFocus:null,lastFocus:null,ignoreFocusChanges:!1};function Tn(){Kr()}function Kr(){let e=Handlebars.templates["modal-layout"]();document.body.insertAdjacentHTML("beforeend",e),c(J).addEventListener("keydown",t=>{t.key==="Escape"&&Y()}),c(Ur).addEventListener("click",t=>{Y()}),c(J).addEventListener("click",t=>{t.target.classList.contains("modal")&&Y()})}function wn(e){if(z.ignoreFocusChanges)return;let t=c(J);if(t.contains(e.target))z.lastFocus=e.target;else{z.ignoreFocusChanges=!0;let n=Yr(t);z.lastFocus===n?Jr(t).focus():n.focus(),z.ignoreFocusChanges=!1,z.lastFocus=document.activeElement}}function Yr(e){return e.querySelector(Ln)}function Jr(e){let t=e.querySelectorAll(Ln);return t[t.length-1]}function Ne({title:e,body:t}){z.prevFocus=document.activeElement,document.addEventListener("focus",wn,!0),c(Wr).innerHTML=e,c(Gr).innerHTML=t,c(J).classList.add("shown"),c(J).focus()}function Y(){c(J).classList.remove("shown"),document.addEventListener("focus",wn,!0),z.prevFocus&&z.prevFocus.focus(),z.prevFocus=null}function kn(){return c(J).classList.contains("shown")}var Xr="https://hexdocs.pm/%%",Zr="https://www.erlang.org/doc/apps/%%",es="https://hex.pm/api/packages?search=name:%%*",ts=".display-quick-switch",it="#quick-switch-input",On="#quick-switch-results",ns=".quick-switch-result",is=300,rs=9,In=["erts","asn1","common_test","compiler","crypto","debugger","dialyzer","diameter","edoc","eldap","erl_interface","et","eunit","ftp","inets","jinterface","kernel","megaco","mnesia","observer","odbc","os_mon","parsetools","public_key","reltool","runtime_tools","sasl","snmp","ssh","ssl","stdlib","syntax_tools","tftp","tools","wx","xmerl"],ss=["elixir","eex","ex_unit","hex","iex","logger","mix"].concat(In).map(e=>({name:e})),Cn=2,P={autocompleteResults:[],selectedIdx:null};function An(){os()}function os(){_(ts).forEach(e=>{e.addEventListener("click",t=>{st()})})}function as(e){if(e.key==="Enter"){let t=e.target.value;ls(t),e.preventDefault()}else e.key==="ArrowUp"?(_n(-1),e.preventDefault()):e.key==="ArrowDown"&&(_n(1),e.preventDefault())}function cs(e){let t=e.target.value;if(t.lengthn.json()).then(n=>{Array.isArray(n)&&(P.autocompleteResults=ps(e,n),P.selectedIdx=null,c(it).value.length>=Cn&&fs({results:P.autocompleteResults}))})}function fs({results:e}){let t=c(On),n=Handlebars.templates["quick-switch-results"]({results:e});t.innerHTML=n,_(ns).forEach(i=>{i.addEventListener("click",r=>{let s=i.getAttribute("data-index"),o=P.autocompleteResults[s];rt(o.name)})})}function ps(e,t){return ss.concat(t).filter(n=>n.name.toLowerCase().includes(e.toLowerCase())).filter(n=>n.releases===void 0||n.releases[0].has_docs===!0).slice(0,rs)}function _n(e){P.selectedIdx=hs(e);let t=c(".quick-switch-result.selected"),n=c(`.quick-switch-result[data-index="${P.selectedIdx}"]`);t&&t.classList.remove("selected"),n&&n.classList.add("selected")}function hs(e){let t=P.autocompleteResults.length;if(P.selectedIdx===null){if(e>=0)return 0;if(e<0)return t-1}return(P.selectedIdx+e+t)%t}var ms=".display-settings",gs="#settings-modal-content",ot="#modal-settings-tab",at="#modal-keyboard-shortcuts-tab",Rn="#settings-content",Nn="#keyboard-shortcuts-content",ys=[{title:"Settings",id:"modal-settings-tab"},{title:"Keyboard shortcuts",id:"modal-keyboard-shortcuts-tab"}];function Qn(){vs()}function vs(){_(ms).forEach(e=>{e.addEventListener("click",t=>{ct()})})}function Pn(){c(at).classList.remove("active"),c(ot).classList.add("active"),c(Rn).classList.remove("hidden"),c(Nn).classList.add("hidden")}function bs(){c(at).classList.add("active"),c(ot).classList.remove("active"),c(Nn).classList.remove("hidden"),c(Rn).classList.add("hidden")}function ct(){Ne({title:ys.map(({id:s,title:o})=>``).join(""),body:Handlebars.templates["settings-modal-body"]({shortcuts:lt})});let e=c(gs),t=e.querySelector('[name="theme"]'),n=e.querySelector('[name="tooltips"]'),i=e.querySelector('[name="direct_livebook_url"]'),r=e.querySelector('[name="livebook_url"]');O.getAndSubscribe(s=>{t.value=s.theme||"system",n.checked=s.tooltips,s.livebookUrl===null?(i.checked=!1,r.classList.add("hidden"),r.tabIndex=-1):(i.checked=!0,r.classList.remove("hidden"),r.tabIndex=0,r.value=s.livebookUrl)}),t.addEventListener("change",s=>{O.update({theme:s.target.value})}),n.addEventListener("change",s=>{O.update({tooltips:s.target.checked})}),i.addEventListener("change",s=>{let o=s.target.checked?r.value:null;O.update({livebookUrl:o})}),r.addEventListener("input",s=>{O.update({livebookUrl:s.target.value})}),c(ot).addEventListener("click",s=>{Pn()}),c(at).addEventListener("click",s=>{bs()}),Pn()}var Ss="#settings-modal-content",lt=[{key:"c",description:"Toggle sidebar",action:Me},{key:"n",description:"Cycle themes",action:Jt},{key:"s",description:"Focus search bar",displayAs:"/ or s",action:ut},{key:"/",action:ut},{key:"k",hasModifier:!0,action:ut},{key:"v",description:"Open/focus version select",action:Ts},{key:"g",description:"Go to package docs",displayAs:"g",action:st},{key:"?",displayAs:"?",description:"Bring up this modal",action:ws}],dt={shortcutBeingPressed:null};function Hn(){xs()}function xs(){document.addEventListener("keydown",Es),document.addEventListener("keyup",Ls)}function Es(e){if(dt.shortcutBeingPressed||e.target.matches("input, select, textarea"))return;let t=lt.find(n=>n.hasModifier?ie()&&e.metaKey||e.ctrlKey?n.key===e.key:!1:e.ctrlKey||e.metaKey||e.altKey?!1:n.key===e.key);t&&(dt.shortcutBeingPressed=t,e.preventDefault(),t.action(e))}function Ls(e){dt.shortcutBeingPressed=null}function ut(e){Y(),et()}function Ts(){Y(),Ft()?tt():ze().then(tt)}function ws(){ks()?Y():ct()}function ks(){return kn()&&c(Ss)}var X={plain:"plain",function:"function",module:"module"},_s=[{href:"typespecs.html#basic-types",hint:{kind:X.plain,description:"Basic type"}},{href:"typespecs.html#literals",hint:{kind:X.plain,description:"Literal"}},{href:"typespecs.html#built-in-types",hint:{kind:X.plain,description:"Built-in type"}}],Qe={cancelHintFetching:null};function Fn(e){if(Mn(e))return!0;let t=/#.*\//;return e.includes("#")&&!t.test(e)?!1:e.includes(".html")}function Dn(e){let t=Mn(e);return t?Promise.resolve(t):Os(e)}function Mn(e){let t=_s.find(n=>e.includes(n.href));return t?t.hint:null}function Os(e){let t=e.replace(".html",".html?hint=true");return new Promise((n,i)=>{let r=document.createElement("iframe");r.setAttribute("src",t),r.style.display="none";function s(a){let{href:l,hint:u}=a.data;t===l&&(o(),n(u))}Qe.cancelHintFetching=()=>{o(),i(new Error("cancelled"))};function o(){r.remove(),window.removeEventListener("message",s),Qe.cancelHintFetching=null}window.addEventListener("message",s),document.body.appendChild(r)})}function Bn(){Qe.cancelHintFetching&&Qe.cancelHintFetching()}function zn(e){let n=e.querySelector("h1").textContent,i=e.querySelector(".docstring > p"),r=i?i.innerHTML:"";return{kind:X.function,title:n.trim(),description:r.trim()}}function $n(e){let n=e.querySelector("h1 > span").textContent,i=e.querySelector("#moduledoc p"),r=i?i.innerHTML:"";return{kind:X.module,title:n.trim(),description:r.trim()}}var Is=".content a",ft=".tooltip",Cs=".tooltip .tooltip-body",qn="body .content-inner",As="#content",jn="tooltip-shown",de=10,Ps=de*4,Vn={height:450,width:768},Rs=100,oe={currentLinkElement:null,hoverDelayTimeout:null};function Un(){Ns(),Qs()}function Ns(){let e=Handlebars.templates["tooltip-layout"]();c(qn).insertAdjacentHTML("beforeend",e)}function Qs(){_(Is).forEach(e=>{Hs(e)&&(e.addEventListener("mouseenter",t=>{Ds(e)}),e.addEventListener("mouseleave",t=>{$s(e)}))})}function Hs(e){return!(e.getAttribute("data-no-tooltip")!==null||Fs(e.href)||!Fn(e.href))}function Fs(e){let t=e.replace(As,"");return window.location.href.split("#")[0]===t}function Ds(e){Ms()&&(oe.currentLinkElement=e,oe.hoverDelayTimeout=setTimeout(()=>{Dn(e.href).then(t=>{Bs(t),zs()}).catch(()=>{})},Rs))}function Ms(){let e=window.innerWidthe.firstElementChild&&e.firstElementChild.tagName==="CODE").forEach(e=>e.insertAdjacentHTML("beforeend",Js)),Array.from(_(".copy-button")).forEach(e=>{let t;e.addEventListener("click",()=>{let n=e.querySelector("[aria-live]");t&&clearTimeout(t);let i=Array.from(e.parentElement.querySelector("code").childNodes).filter(r=>!(r.tagName==="SPAN"&&r.classList.contains("unselectable"))).map(r=>r.textContent).join("");navigator.clipboard.writeText(i),e.classList.add("clicked"),n.innerHTML="Copied! ✓",t=setTimeout(()=>{e.classList.remove("clicked"),n.innerHTML=""},3e3)})})}function Jn(){let e=ie()?"apple-os":"non-apple-os";document.documentElement.classList.add(e)}function Zn(){let e=ge(te(),!0);e&&Zs(e)}function Zs(e){no(e),eo(),to(),Xn(),window.addEventListener("resize",t=>{Xn()})}function Xn(){let e=document.body.scrollHeight,t=document.getElementById("content").parentElement.offsetHeight,n={type:"preview",maxHeight:e,contentHeight:t};window.parent.postMessage(n,"*")}function eo(){let e=document.getElementsByTagName("a");for(let t of e)t.getAttribute("target")!=="_blank"&&t.setAttribute("target","_parent")}function to(){window.scrollTo(0,0)}function no(e){document.body.classList.add("preview");let t=document.getElementById("content");t.innerHTML=e.innerHTML}St(()=>{let e=new URLSearchParams(window.location.search),t=e.has("preview");Lt(),Yt(e.get("theme")),kt(t),En(),Un(),Kn(),Yn(),Jn(),t?Zn():(fn(),Nt(),zt(),cn(),Tn(),Hn(),An(),Gt(),yn(),Qn())});})(); -/*! Bundled license information: - -lunr/lunr.js: - (** - * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 - * Copyright (C) 2020 Oliver Nightingale - * @license MIT - *) - (*! - * lunr.utils - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.Set - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.tokenizer - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.Pipeline - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.Vector - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.stemmer - * Copyright (C) 2020 Oliver Nightingale - * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt - *) - (*! - * lunr.stopWordFilter - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.trimmer - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.TokenSet - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.Index - * Copyright (C) 2020 Oliver Nightingale - *) - (*! - * lunr.Builder - * Copyright (C) 2020 Oliver Nightingale - *) -*/ diff --git a/formatters/html/dist/html-MT3ZX75M.js b/formatters/html/dist/html-MT3ZX75M.js new file mode 100644 index 000000000..55c652e5c --- /dev/null +++ b/formatters/html/dist/html-MT3ZX75M.js @@ -0,0 +1,56 @@ +(()=>{var Qi=Object.create;var Mt=Object.defineProperty;var Mi=Object.getOwnPropertyDescriptor;var Di=Object.getOwnPropertyNames;var Fi=Object.getPrototypeOf,Bi=Object.prototype.hasOwnProperty;var Dt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $i=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Di(t))!Bi.call(e,r)&&r!==n&&Mt(e,r,{get:()=>t[r],enumerable:!(i=Mi(t,r))||i.enumerable});return e};var Ft=(e,t,n)=>(n=e!=null?Qi(Fi(e)):{},$i(t||!e||!e.__esModule?Mt(n,"default",{value:e,enumerable:!0}):n,e));var tn=Dt((da,en)=>{var Zt="Expected a function",Jt=NaN,ar="[object Symbol]",cr=/^\s+|\s+$/g,lr=/^[-+]0x[0-9a-f]+$/i,ur=/^0b[01]+$/i,dr=/^0o[0-7]+$/i,hr=parseInt,fr=typeof global=="object"&&global&&global.Object===Object&&global,pr=typeof self=="object"&&self&&self.Object===Object&&self,mr=fr||pr||Function("return this")(),gr=Object.prototype,vr=gr.toString,yr=Math.max,wr=Math.min,Ye=function(){return mr.Date.now()};function br(e,t,n){var i,r,s,o,a,c,l=0,u=!1,h=!1,f=!0;if(typeof e!="function")throw new TypeError(Zt);t=Xt(t)||0,Le(n)&&(u=!!n.leading,h="maxWait"in n,s=h?yr(Xt(n.maxWait)||0,t):s,f="trailing"in n?!!n.trailing:f);function y(E){var P=i,B=r;return i=r=void 0,l=E,o=e.apply(B,P),o}function w(E){return l=E,a=setTimeout(m,t),u?y(E):o}function b(E){var P=E-c,B=E-l,z=t-P;return h?wr(z,s-B):z}function g(E){var P=E-c,B=E-l;return c===void 0||P>=t||P<0||h&&B>=s}function m(){var E=Ye();if(g(E))return x(E);a=setTimeout(m,b(E))}function x(E){return a=void 0,f&&i?y(E):(i=r=void 0,o)}function C(){a!==void 0&&clearTimeout(a),l=0,i=c=r=a=void 0}function M(){return a===void 0?o:x(Ye())}function F(){var E=Ye(),P=g(E);if(i=arguments,r=this,c=E,P){if(a===void 0)return w(c);if(h)return a=setTimeout(m,t),y(c)}return a===void 0&&(a=setTimeout(m,t)),o}return F.cancel=C,F.flush=M,F}function Sr(e,t,n){var i=!0,r=!0;if(typeof e!="function")throw new TypeError(Zt);return Le(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),br(e,t,{leading:i,maxWait:t,trailing:r})}function Le(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Er(e){return!!e&&typeof e=="object"}function xr(e){return typeof e=="symbol"||Er(e)&&vr.call(e)==ar}function Xt(e){if(typeof e=="number")return e;if(xr(e))return Jt;if(Le(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Le(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(cr,"");var n=ur.test(e);return n||dr.test(e)?hr(e.slice(2),n?2:8):lr.test(e)?Jt:+e}en.exports=Sr});var Dn=Dt((Qn,Mn)=>{(function(){var e=function(t){var n=new e.Builder;return n.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),n.searchPipeline.add(e.stemmer),t.call(n,n),n.build()};e.version="2.3.9";e.utils={},e.utils.warn=function(t){return function(n){t.console&&console.warn&&console.warn(n)}}(this),e.utils.asString=function(t){return t==null?"":t.toString()},e.utils.clone=function(t){if(t==null)return t;for(var n=Object.create(null),i=Object.keys(t),r=0;r0){var u=e.utils.clone(n)||{};u.position=[a,l],u.index=s.length,s.push(new e.Token(i.slice(a,o),u))}a=o+1}}return s},e.tokenizer.separator=/[\s\-]+/;e.Pipeline=function(){this._stack=[]},e.Pipeline.registeredFunctions=Object.create(null),e.Pipeline.registerFunction=function(t,n){n in this.registeredFunctions&&e.utils.warn("Overwriting existing registered function: "+n),t.label=n,e.Pipeline.registeredFunctions[t.label]=t},e.Pipeline.warnIfFunctionNotRegistered=function(t){var n=t.label&&t.label in this.registeredFunctions;n||e.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. +`,t)},e.Pipeline.load=function(t){var n=new e.Pipeline;return t.forEach(function(i){var r=e.Pipeline.registeredFunctions[i];if(r)n.add(r);else throw new Error("Cannot load unregistered function: "+i)}),n},e.Pipeline.prototype.add=function(){var t=Array.prototype.slice.call(arguments);t.forEach(function(n){e.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},e.Pipeline.prototype.after=function(t,n){e.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");i=i+1,this._stack.splice(i,0,n)},e.Pipeline.prototype.before=function(t,n){e.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},e.Pipeline.prototype.remove=function(t){var n=this._stack.indexOf(t);n!=-1&&this._stack.splice(n,1)},e.Pipeline.prototype.run=function(t){for(var n=this._stack.length,i=0;i1&&(ot&&(i=s),o!=t);)r=i-n,s=n+Math.floor(r/2),o=this.elements[s*2];if(o==t||o>t)return s*2;if(oc?u+=2:a==c&&(n+=i[l+1]*r[u+1],l+=2,u+=2);return n},e.Vector.prototype.similarity=function(t){return this.dot(t)/this.magnitude()||0},e.Vector.prototype.toArray=function(){for(var t=new Array(this.elements.length/2),n=1,i=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new e.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),r.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var c=s.node.edges["*"];else{var c=new e.TokenSet;s.node.edges["*"]=c}if(s.str.length==0&&(c.final=!0),r.push({node:c,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&r.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new e.TokenSet;s.node.edges["*"]=l}s.str.length==1&&(l.final=!0),r.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var u=s.str.charAt(0),h=s.str.charAt(1),f;h in s.node.edges?f=s.node.edges[h]:(f=new e.TokenSet,s.node.edges[h]=f),s.str.length==1&&(f.final=!0),r.push({node:f,editsRemaining:s.editsRemaining-1,str:u+s.str.slice(2)})}}}return i},e.TokenSet.fromString=function(t){for(var n=new e.TokenSet,i=n,r=0,s=t.length;r=t;n--){var i=this.uncheckedNodes[n],r=i.child.toString();r in this.minimizedNodes?i.parent.edges[i.char]=this.minimizedNodes[r]:(i.child._str=r,this.minimizedNodes[r]=i.child),this.uncheckedNodes.pop()}};e.Index=function(t){this.invertedIndex=t.invertedIndex,this.fieldVectors=t.fieldVectors,this.tokenSet=t.tokenSet,this.fields=t.fields,this.pipeline=t.pipeline},e.Index.prototype.search=function(t){return this.query(function(n){var i=new e.QueryParser(t,n);i.parse()})},e.Index.prototype.query=function(t){for(var n=new e.Query(this.fields),i=Object.create(null),r=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),c=0;c1?this._b=1:this._b=t},e.Builder.prototype.k1=function(t){this._k1=t},e.Builder.prototype.add=function(t,n){var i=t[this._ref],r=Object.keys(this._fields);this._documents[i]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return e.QueryLexer.EOS;var t=this.str.charAt(this.pos);return this.pos+=1,t},e.QueryLexer.prototype.width=function(){return this.pos-this.start},e.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},e.QueryLexer.prototype.backup=function(){this.pos-=1},e.QueryLexer.prototype.acceptDigitRun=function(){var t,n;do t=this.next(),n=t.charCodeAt(0);while(n>47&&n<58);t!=e.QueryLexer.EOS&&this.backup()},e.QueryLexer.prototype.more=function(){return this.pos1&&(t.backup(),t.emit(e.QueryLexer.TERM)),t.ignore(),t.more())return e.QueryLexer.lexText},e.QueryLexer.lexEditDistance=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.EDIT_DISTANCE),e.QueryLexer.lexText},e.QueryLexer.lexBoost=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.BOOST),e.QueryLexer.lexText},e.QueryLexer.lexEOS=function(t){t.width()>0&&t.emit(e.QueryLexer.TERM)},e.QueryLexer.termSeparator=e.tokenizer.separator,e.QueryLexer.lexText=function(t){for(;;){var n=t.next();if(n==e.QueryLexer.EOS)return e.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){t.escapeCharacter();continue}if(n==":")return e.QueryLexer.lexField;if(n=="~")return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexEditDistance;if(n=="^")return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexBoost;if(n=="+"&&t.width()===1||n=="-"&&t.width()===1)return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if(n.match(e.QueryLexer.termSeparator))return e.QueryLexer.lexTerm}},e.QueryParser=function(t,n){this.lexer=new e.QueryLexer(t),this.query=n,this.currentClause={},this.lexemeIdx=0},e.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var t=e.QueryParser.parseClause;t;)t=t(this);return this.query},e.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},e.QueryParser.prototype.consumeLexeme=function(){var t=this.peekLexeme();return this.lexemeIdx+=1,t},e.QueryParser.prototype.nextClause=function(){var t=this.currentClause;this.query.clause(t),this.currentClause={}},e.QueryParser.parseClause=function(t){var n=t.peekLexeme();if(n!=null)switch(n.type){case e.QueryLexer.PRESENCE:return e.QueryParser.parsePresence;case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(i+=" with value '"+n.str+"'"),new e.QueryParseError(i,n.start,n.end)}},e.QueryParser.parsePresence=function(t){var n=t.consumeLexeme();if(n!=null){switch(n.str){case"-":t.currentClause.presence=e.Query.presence.PROHIBITED;break;case"+":t.currentClause.presence=e.Query.presence.REQUIRED;break;default:var i="unrecognised presence operator'"+n.str+"'";throw new e.QueryParseError(i,n.start,n.end)}var r=t.peekLexeme();if(r==null){var i="expecting term or field, found nothing";throw new e.QueryParseError(i,n.start,n.end)}switch(r.type){case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expecting term or field, found '"+r.type+"'";throw new e.QueryParseError(i,r.start,r.end)}}},e.QueryParser.parseField=function(t){var n=t.consumeLexeme();if(n!=null){if(t.query.allFields.indexOf(n.str)==-1){var i=t.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),r="unrecognised field '"+n.str+"', possible fields: "+i;throw new e.QueryParseError(r,n.start,n.end)}t.currentClause.fields=[n.str];var s=t.peekLexeme();if(s==null){var r="expecting term, found nothing";throw new e.QueryParseError(r,n.start,n.end)}switch(s.type){case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var r="expecting term, found '"+s.type+"'";throw new e.QueryParseError(r,s.start,s.end)}}},e.QueryParser.parseTerm=function(t){var n=t.consumeLexeme();if(n!=null){t.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(t.currentClause.usePipeline=!1);var i=t.peekLexeme();if(i==null){t.nextClause();return}switch(i.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var r="Unexpected lexeme type '"+i.type+"'";throw new e.QueryParseError(r,i.start,i.end)}}},e.QueryParser.parseEditDistance=function(t){var n=t.consumeLexeme();if(n!=null){var i=parseInt(n.str,10);if(isNaN(i)){var r="edit distance must be numeric";throw new e.QueryParseError(r,n.start,n.end)}t.currentClause.editDistance=i;var s=t.peekLexeme();if(s==null){t.nextClause();return}switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var r="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(r,s.start,s.end)}}},e.QueryParser.parseBoost=function(t){var n=t.consumeLexeme();if(n!=null){var i=parseInt(n.str,10);if(isNaN(i)){var r="boost must be numeric";throw new e.QueryParseError(r,n.start,n.end)}t.currentClause.boost=i;var s=t.peekLexeme();if(s==null){t.nextClause();return}switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var r="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(r,s.start,s.end)}}},function(t,n){typeof define=="function"&&define.amd?define(n):typeof Qn=="object"?Mn.exports=n():t.lunr=n()}(this,function(){return e})})()});Handlebars.registerHelper("groupChanged",function(e,t,n){let i=t||"";if(e.group!==i)return delete e.nestedContext,e.group=i,n.fn(this)});Handlebars.registerHelper("nestingChanged",function(e,t,n){if(t.nested_context&&t.nested_context!==e.nestedContext){if(e.nestedContext=t.nested_context,e.lastModuleSeenInGroup!==t.nested_context)return n.fn(this)}else e.lastModuleSeenInGroup=t.title});Handlebars.registerHelper("showSections",function(e,t){if(e.sections.length>0)return t.fn(this)});Handlebars.registerHelper("showSummary",function(e,t){if(e.nodeGroups)return t.fn(this)});Handlebars.registerHelper("isArray",function(e,t){return Array.isArray(e)?t.fn(this):t.inverse(this)});Handlebars.registerHelper("isNonEmptyArray",function(e,t){return Array.isArray(e)&&e.length>0?t.fn(this):t.inverse(this)});Handlebars.registerHelper("isEmptyArray",function(e,t){return Array.isArray(e)&&e.length===0?t.fn(this):t.inverse(this)});Handlebars.registerHelper("isLocal",function(e,t){let n=window.location.pathname.split("/").pop();return n===e+".html"||n===e?t.fn(this):t.inverse(this)});var d=document.querySelector.bind(document),A=document.querySelectorAll.bind(document);function Bt(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Se(e){return String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function V(){return document.getElementById("main").dataset.type}function $t(e,t){if(e){for(let n of e){let i=n.nodeGroups&&n.nodeGroups.find(r=>r.nodes.some(s=>s.anchor===t));if(i)return i.key}return null}}function Ee(e,t=!1){if(!e)return t?document.getElementById("top-content"):null;let n=document.getElementById(e);return n?n.matches(".detail")?n:["h1","h2","h3","h4","h5","h6"].includes(n.tagName.toLowerCase())?Ui(n):null:null}function Ui(e){let t=[e],n=e.nextElementSibling,i=e.tagName.toLowerCase();for(;n;){let s=n.tagName.toLowerCase();["h1","h2","h3","h4","h5","h6"].includes(s)&&s<=i?n=null:(t.push(n),n=n.nextElementSibling)}let r=document.createElement("div");return r.append(...t),r}function ie(){return window.location.hash.replace(/^#/,"")}function Ut(e){return new URLSearchParams(window.location.search).get(e)}function qt(e){return fetch(e).then(t=>t.ok).catch(()=>!1)}function Vt(e){document.readyState!=="loading"?e():document.addEventListener("DOMContentLoaded",e)}function re(e){return!e||e.trim()===""}function jt(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>{n=null,e(...r)},t)}}function xe(){return document.head.querySelector("meta[name=project][content]").content}function se(){return/(Macintosh|iPhone|iPad|iPod)/.test(window.navigator.userAgent)}var qi="content",Vi="tabs-open",ji="tabs-close",zi="H3",Wi="tabset";function Wt(){Gi().map(Ki).forEach(n=>Xi(n))}function Gi(){let e=document.createNodeIterator(document.getElementById(qi),NodeFilter.SHOW_COMMENT,{acceptNode(i){return i.nodeValue.trim()===Vi?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),t=[],n;for(;n=e.nextNode();)t.push(n);return t}function Ki(e,t,n){let i=[],r=[],s={label:"",content:[]};for(;e=e.nextSibling;){if(Yi(e)){zt(s,r,t);break}i.push(e),e.nodeName===zi?(zt(s,r,t),s.label=e.innerText,s.content=[]):s.content.push(e.outerHTML)}let o=document.createElement("div");return o.className=Wi,Ji(i,o),o.innerHTML=Handlebars.templates.tabset({tabs:r}),o}function Yi(e){return e.nodeName==="#comment"&&e.nodeValue.trim()===ji}function zt(e,t,n){if(e.label===""&&!e.content.length)return!1;let i=e.label,r=e.content;t.push({label:i,content:r,setIndex:n})}function Ji(e,t){if(!e||!e.length)return!1;e[0].parentNode.insertBefore(t,e[0]),e.forEach(n=>t.appendChild(n))}function Xi(e){let t={tabs:e.querySelectorAll(':scope [role="tab"]'),panels:e.querySelectorAll(':scope [role="tabpanel"]'),activeIndex:0};t.tabs.forEach((n,i)=>{n.addEventListener("click",r=>{Y(i,t)}),n.addEventListener("keydown",r=>{let s=t.tabs.length-1;r.code==="ArrowLeft"?(r.preventDefault(),t.activeIndex===0?Y(s,t):Y(t.activeIndex-1,t)):r.code==="ArrowRight"?(r.preventDefault(),t.activeIndex===s?Y(0,t):Y(t.activeIndex+1,t)):r.code==="Home"?(r.preventDefault(),Y(0,t)):r.code==="End"&&(r.preventDefault(),Y(s,t))})})}function Y(e,t){t.tabs[t.activeIndex].setAttribute("aria-selected","false"),t.tabs[t.activeIndex].tabIndex=-1,t.tabs[e].setAttribute("aria-selected","true"),t.tabs[e].tabIndex=0,t.tabs[e].focus(),t.panels[t.activeIndex].setAttribute("hidden",""),t.panels[t.activeIndex].tabIndex=-1,t.panels[e].removeAttribute("hidden"),t.panels[e].tabIndex=0,t.activeIndex=e}var Gt="ex_doc:settings",Zi={tooltips:!0,theme:null,livebookUrl:null},Ke=class{constructor(){this._subscribers=[],this._settings=Zi,this._loadSettings()}get(){return this._settings}update(t){let n=this._settings;this._settings={...this._settings,...t},this._subscribers.forEach(i=>i(this._settings,n)),this._storeSettings()}getAndSubscribe(t){this._subscribers.push(t),t(this._settings)}_loadSettings(){try{let t=localStorage.getItem(Gt);if(t){let n=JSON.parse(t);this._settings={...this._settings,...n}}this._loadSettingsLegacy()}catch(t){console.error(`Failed to load settings: ${t}`)}}_storeSettings(){try{this._storeSettingsLegacy(),localStorage.setItem(Gt,JSON.stringify(this._settings))}catch(t){console.error(`Failed to persist settings: ${t}`)}}_loadSettingsLegacy(){localStorage.getItem("tooltipsDisabled")!==null&&(this._settings={...this._settings,tooltips:!1}),localStorage.getItem("night-mode")==="true"&&(this._settings={...this._settings,nightMode:!0}),this._settings.nightMode===!0&&(this._settings={...this._settings,theme:"dark"})}_storeSettingsLegacy(){this._settings.tooltips?localStorage.removeItem("tooltipsDisabled"):localStorage.setItem("tooltipsDisabled","true"),this._settings.nightMode!==null?localStorage.setItem("night-mode",this._settings.nightMode===!0?"true":"false"):localStorage.removeItem("night-mode"),this._settings.theme!==null?(localStorage.setItem("night-mode",this._settings.theme==="dark"?"true":"false"),this._settings.nightMode=this._settings.theme==="dark"):(delete this._settings.nightMode,localStorage.removeItem("night-mode"))}},I=new Ke;var er=".content",Kt=".content-inner",tr=".livebook-badge";function Yt(e){e||ir(),rr(),nr()}function nr(){d(er).querySelectorAll("a").forEach(e=>{e.querySelector("code, img")&&e.classList.add("no-underline")})}function ir(){d(Kt).setAttribute("tabindex",-1),d(Kt).focus()}function rr(){let t=window.location.pathname.replace(/(\.html)?$/,".livemd"),n=new URL(t,window.location.href).toString();I.getAndSubscribe(i=>{let r=i.livebookUrl?or(i.livebookUrl,n):sr(n);for(let s of A(tr))s.href=r})}function sr(e){return`https://livebook.dev/run?url=${encodeURIComponent(e)}`}function or(e,t){return`${e}/import?url=${encodeURIComponent(t)}`}var rn=Ft(tn());var Lr=768,Je=300,oe=".sidebar-toggle",Tr=".content",$={CLOSED:"closed",OPEN:"open",NO_PREF:"no_pref"},Q={opened:"sidebar-opened",openingStart:"sidebar-opening-start",opening:"sidebar-opening",closed:"sidebar-closed",closingStart:"sidebar-closing-start",closing:"sidebar-closing"},kr=Object.values(Q),R={togglingTimeout:null,lastWindowWidth:window.innerWidth,sidebarPreference:$.NO_PREF};function sn(){on(),Or(),Cr()}function Or(){let e=sessionStorage.getItem("sidebar_width");e&&nn(e),new ResizeObserver(n=>{for(let i of n)nn(i.contentRect.width)}).observe(document.getElementById("sidebar"))}function nn(e){sessionStorage.setItem("sidebar_width",e),document.body.style.setProperty("--sidebarWidth",`${e}px`)}function on(){sessionStorage.getItem("sidebar_state")==="closed"||an()?(j(Q.closed),d(oe).setAttribute("aria-expanded","false")):(j(Q.opened),d(oe).setAttribute("aria-expanded","true")),setTimeout(()=>d(oe).classList.add("sidebar-toggle--animated"),Je)}function an(){return window.matchMedia(`screen and (max-width: ${Lr}px)`).matches}function j(...e){document.body.classList.remove(...kr),document.body.classList.add(...e)}function Cr(){d(oe).addEventListener("click",e=>{Xe(),_r()}),d(Tr).addEventListener("click",e=>{Ir()}),window.addEventListener("resize",(0,rn.default)(e=>{Ar()},100))}function Xe(){return Ze()?ln():et()}function Ze(){return document.body.classList.contains(Q.opened)||document.body.classList.contains(Q.opening)}function cn(){return document.body.classList.contains(Q.opened)}function et(){return un(),sessionStorage.setItem("sidebar_state","opened"),d(oe).setAttribute("aria-expanded","true"),new Promise((e,t)=>{requestAnimationFrame(()=>{j(Q.openingStart),requestAnimationFrame(()=>{j(Q.opening),R.togglingTimeout=setTimeout(()=>{j(Q.opened),e()},Je)})})})}function ln(){return un(),sessionStorage.setItem("sidebar_state","closed"),d(oe).setAttribute("aria-expanded","false"),new Promise((e,t)=>{requestAnimationFrame(()=>{j(Q.closingStart),requestAnimationFrame(()=>{j(Q.closing),R.togglingTimeout=setTimeout(()=>{j(Q.closed),e()},Je)})})})}function un(){R.togglingTimeout&&(clearTimeout(R.togglingTimeout),R.togglingTimeout=null)}function Ar(){R.lastWindowWidth!==window.innerWidth&&(R.lastWindowWidth=window.innerWidth,(R.sidebarPreference===$.OPEN||R.sidebarPreference===$.NO_PREF)&&on())}function Ir(){an()&&Ze()&&ln()}function _r(){switch(R.sidebarPreference){case $.OPEN:R.sidebarPreference=$.CLOSED;break;case $.CLOSED:R.sidebarPreference=$.OPEN;break;case $.NO_PREF:Ze()?R.sidebarPreference=$.OPEN:R.sidebarPreference=$.CLOSED}}function he(){return window.sidebarNodes||{}}function dn(){return window.versionNodes||[]}var tt={search:"search",extras:"extras",modules:"modules",tasks:"tasks"},nt=[tt.extras,tt.modules,tt.tasks],ke=e=>`#${e}-full-list`;function it(){nt.forEach(e=>{Pr(he(),e)}),Te(V()),fn(),hn(),Fr()}function Pr(e,t){let n=e[t]||[],i=d(ke(t));if(!i)return;let r=Handlebars.templates["sidebar-items"]({nodes:n,group:""});i.innerHTML=r,i.querySelectorAll("ul").forEach(s=>{if(s.innerHTML.trim()===""){let o=s.previousElementSibling;o.classList.contains("expand")&&o.classList.remove("expand"),s.remove()}}),i.querySelectorAll("li a + button").forEach(s=>{s.addEventListener("click",o=>{let c=o.target.closest("li");Nr(c)})}),i.querySelectorAll("li a").forEach(s=>{s.classList.add("no-swup"),s.addEventListener("click",o=>{let c=o.target.closest("li"),l=i.querySelector(".current-section");l&&Qr(l),s.matches(".expand")&&(s.pathname===window.location.pathname||s.pathname===window.location.pathname+".html")&&rt(c)})})}function rt(e){e.classList.add("open"),e.querySelector("button[aria-controls]").setAttribute("aria-expanded","true")}function Rr(e){e.classList.remove("open"),e.querySelector("button[aria-controls]").setAttribute("aria-expanded","false")}function Nr(e){e.classList.contains("open")?Rr(e):rt(e)}function Hr(e){e.classList.add("current-section"),e.querySelector("a").setAttribute("aria-current","true")}function Qr(e){e.classList.remove("current-section"),e.querySelector("a").setAttribute("aria-current","false")}function Mr(e){e.classList.add("current-hash"),e.querySelector("a").setAttribute("aria-current","true")}function Dr(e){e.classList.remove("current-hash"),e.querySelector("a").setAttribute("aria-current","false")}function Te(e){nt.forEach(t=>{let n=d(`#${t}-list-tab-button`);if(n){let i=d(`#${n.getAttribute("aria-controls")}`);t===e?(n.parentElement.classList.add("selected"),n.setAttribute("aria-selected","true"),n.setAttribute("tabindex","0"),i.removeAttribute("hidden")):(n.parentElement.classList.remove("selected"),n.setAttribute("aria-selected","false"),n.setAttribute("tabindex","-1"),i.setAttribute("hidden","hidden"))}})}function hn(){let e=d(ke(V()));if(!e)return;let t=e.querySelector("li.current-page");t&&(t.scrollIntoView(),e.scrollTop-=40)}function fn(){let e=ie()||"content",n=he()[V()]||[],i=$t(n,e),r=d(ke(V()));if(!r)return;let s=r.querySelector(`li.current-page a.expand[href$="#${i}"]`);s&&rt(s.closest("li"));let o=r.querySelector(`li.current-page a[href$="#${e}"]`);if(o){let a=o.closest("ul");a.classList.contains("deflist")&&Hr(a.closest("li")),Mr(o.closest("li"))}}function Fr(){nt.forEach(t=>{let n=d(`#${t}-list-tab-button`);n&&n.addEventListener("click",i=>{Te(t),hn()})});let e=d("#sidebar-listNav");e.addEventListener("keydown",t=>{if(t.key!=="ArrowRight"&&t.key!=="ArrowLeft")return;let n=Array.from(e.querySelectorAll('[role="tab"]')).map(r=>r.dataset.type),i=e.querySelector('[role="tab"][aria-selected="true"]').dataset.type;if(t.key==="ArrowRight"){let r=n.indexOf(i)+1;r>=n.length&&(r=0);let s=n[r];Te(s),d(`#${s}-list-tab-button`).focus()}else if(t.key==="ArrowLeft"){let r=n.indexOf(i)-1;r<0&&(r=n.length-1);let s=n[r];Te(s),d(`#${s}-list-tab-button`).focus()}}),window.addEventListener("hashchange",t=>{let n=d(ke(V()));if(!n)return;let i=n.querySelector("li.current-page li.current-hash");i&&Dr(i),fn()})}var U={module:"module",moduleChild:"module-child",mixTask:"mix-task",extra:"extra",section:"section"};function mn(e,t=8){if(re(e))return[];let n=he(),i=[...st(n.modules,e,U.module,"module"),...Br(n.modules,e,U.moduleChild),...st(n.tasks,e,U.mixTask,"mix task"),...st(n.extras,e,U.extra,"page"),...ot(n.modules,e,U.section,"module"),...ot(n.tasks,e,U.section,"mix task"),...ot(n.extras,e,U.section,"page")].filter(r=>r!==null);return Wr(i).slice(0,t)}function st(e,t,n,i){return e.map(r=>Ur(r,t,n,i))}function Br(e,t,n){return e.filter(i=>i.nodeGroups).flatMap(i=>i.nodeGroups.flatMap(({key:r,nodes:s})=>{let o=zr(r);return s.map(a=>qr(a,i.id,t,n,o)||jr(a,i.id,t,n,o))}))}function ot(e,t,n,i){return e.flatMap(r=>$r(r).map(s=>Vr(r,s,t,n,i)))}function $r(e){return(e.sections||[]).concat(e.headers||[])}function Ur(e,t,n,i){return Ce(e.title,t)?{link:`${e.id}.html`,title:_e(e.title,t),description:null,matchQuality:Ae(e.title,t),deprecated:e.deprecated,labels:[i],category:n}:null}function qr(e,t,n,i,r){return Ce(e.id,n)?{link:`${t}.html#${e.anchor}`,title:_e(e.id,n),labels:[r],description:t,matchQuality:Ae(e.id,n),deprecated:e.deprecated,category:i}:null}function Vr(e,t,n,i,r){return gn(t.id,n)?{link:`${e.id}.html#${t.anchor}`,title:_e(t.id,n),description:e.title,matchQuality:Ae(t.id,n),labels:[r,"section"],category:i}:null}function jr(e,t,n,i,r){let s=`${t}.${e.id}`,o=`${t}:${e.id}`,a,c;if(Ce(s,n))a=s,c=/\./g;else if(Ce(o,n))a=o,c=/:/g;else return null;let l=n.replace(c," ");return gn(e.id,l)?{link:`${t}.html#${e.anchor}`,title:_e(e.id,l),label:r,description:t,matchQuality:Ae(a,n),deprecated:e.deprecated,category:i}:null}function zr(e){switch(e){case"callbacks":return"callback";case"types":return"type";default:return"function"}}function Wr(e){return e.slice().sort((t,n)=>t.matchQuality!==n.matchQuality?n.matchQuality-t.matchQuality:pn(t.category)-pn(n.category))}function pn(e){switch(e){case U.module:return 1;case U.moduleChild:return 2;case U.mixTask:return 3;default:return 4}}function gn(e,t){return Ie(t).some(i=>vn(e,i))}function Ce(e,t){return Ie(t).every(i=>vn(e,i))}function vn(e,t){return e.toLowerCase().includes(t.toLowerCase())}function Ae(e,t){let n=Ie(t),r=n.map(o=>o.length).reduce((o,a)=>o+a,0)/e.length,s=Gr(e,n[0])?1:0;return r+s}function Gr(e,t){return e.toLowerCase().startsWith(t.toLowerCase())}function Ie(e){return e.trim().split(/\s+/)}function _e(e,t){let n=Ie(t).sort((i,r)=>r.length-i.length);return Oe(e,n)}function Oe(e,t){if(t.length===0)return e;let[n,...i]=t,r=e.match(new RegExp(`(.*)(${Bt(n)})(.*)`,"i"));if(r){let[,s,o,a]=r;return Oe(s,t)+""+Se(o)+""+Oe(a,t)}else return Oe(e,i)}var Pe=null,J=null;function yn(){J=document.getElementById("toast"),J.addEventListener("click",e=>{clearTimeout(Pe),e.target.classList.remove("show")})}function at(e){J&&(clearTimeout(Pe),J.innerText=e,J.classList.add("show"),Pe=setTimeout(()=>{J.classList.remove("show"),Pe=setTimeout(function(){J.innerText=""},1e3)},5e3))}var wn="dark",ct=["system","dark","light"];function bn(e){I.getAndSubscribe(t=>{document.body.classList.toggle(wn,En(e||t.theme))}),Yr()}function Sn(){let e=ct[ct.indexOf(lt())+1]||ct[0];I.update({theme:e}),at(`Set theme to "${e}"`)}function lt(){return I.get().theme||"system"}function En(e){return e==="dark"||Kr()&&(e==null||e==="system")}function Kr(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function Yr(){window.matchMedia("(prefers-color-scheme: dark)").addListener(e=>{let t=I.get().theme,n=En(t);(t==null||t==="system")&&(document.body.classList.toggle(wn,n),at(`Browser changed theme to "${n?"dark":"light"}"`))})}var ae=".autocomplete",Ne=".autocomplete-suggestions",Re=".autocomplete-suggestion",_={autocompleteSuggestions:[],previewOpen:!1,selectedIdx:-1};function Jr(){d(ae).classList.add("shown")}function ut(){d(ae).classList.remove("shown")}function xn(){return d(ae).classList.contains("shown")}function dt(e){_.autocompleteSuggestions=mn(e),_.selectedIdx=-1,re(e)?ut():(Xr({term:e,suggestions:_.autocompleteSuggestions}),He(0),Jr())}function Xr({term:e,suggestions:t}){let n=Handlebars.templates["autocomplete-suggestions"]({suggestions:t,term:e}),i=d(ae);i.innerHTML=n}function Ln(){return _.selectedIdx===-1?null:_.autocompleteSuggestions[_.selectedIdx]}function He(e){kn(Zr(e))}function Tn(e){if(e.data.type==="preview"){let{contentHeight:t}=e.data,n=d(".autocomplete-preview");n&&(n.style.height=`${t+32}px`,n.classList.remove("loading"))}}function kn(e){_.selectedIdx=e;let t=d(Ne),n=d(`${Re}.selected`),i=d(`${Re}[data-index="${_.selectedIdx}"]`);if(n&&n.classList.remove("selected"),i){if(_.previewOpen){Cn(),window.addEventListener("message",Tn),t.classList.add("previewing");let r=document.createElement("div");r.classList.add("autocomplete-preview"),r.classList.add("loading");let s=i.href.replace(".html",`.html?preview=true&theme=${lt()}`),o=document.createElement("iframe");o.setAttribute("src",s),r.appendChild(document.createElement("div")),r.appendChild(document.createElement("span")),r.appendChild(o),i.parentNode.insertBefore(r,i.nextSibling)}i.classList.add("selected"),i.scrollIntoView({block:"nearest"})}else t&&(t.scrollTop=0)}function On(){_.previewOpen?Qe():ht()}function Qe(){_.previewOpen=!1;let e=d(Ne);e&&e.classList.remove("previewing"),Cn()}function ht(e){_.previewOpen=!0,e?e=e.closest(Re):e=d(`${Re}[data-index="${_.selectedIdx}"]`),e&&kn(parseInt(e.dataset.index))}function Cn(){let e=d(".autocomplete-preview");e&&(e.remove(),window.removeEventListener("message",Tn))}function Zr(e){let t=_.autocompleteSuggestions.length+1;return(_.selectedIdx+e+1+t)%t-1}var fe="form.search-bar input",es="form.search-bar .search-close-button";function _n(){ts(),window.onTogglePreviewClick=function(e,t){e.preventDefault(),e.stopImmediatePropagation(),pt(),t?ht(e.target):Qe()}}function Pn(e){let t=d(fe);t.value=e}function pt(){let e=d(fe);document.body.classList.add("search-focused"),e.focus()}function ts(){let e=d(fe);if(document.querySelector('meta[name="exdoc:autocomplete"][content="off"]'))return e.addEventListener("keydown",t=>{t.key==="Enter"&&An(t)}),!0;e.addEventListener("keydown",t=>{let n=se();t.key==="Escape"?(Me(),e.blur()):t.key==="Enter"?An(t):t.key==="ArrowUp"||n&&t.ctrlKey&&t.key==="p"?(He(-1),t.preventDefault()):t.key==="ArrowDown"||n&&t.ctrlKey&&t.key==="n"?(He(1),t.preventDefault()):t.key==="Tab"&&(On(),t.preventDefault())}),e.addEventListener("input",t=>{dt(t.target.value)}),e.addEventListener("focus",t=>{document.body.classList.contains("search-focused")||(document.body.classList.add("search-focused"),dt(t.target.value))}),e.addEventListener("blur",t=>{let n=t.relatedTarget,i=d(Ne);if(n&&i&&i.contains(n))return setTimeout(()=>{xn()&&e.focus()},1e3),null;De()}),d(ae).addEventListener("click",t=>{t.shiftKey||t.ctrlKey?e.focus():(Me(),De())}),d(es).addEventListener("click",t=>{Me(),De()})}function An(e){let t=d(fe),n=e.shiftKey||e.ctrlKey,i=Ln();e.preventDefault();let r=n?"_blank":"_self",s=document.createElement("a");if(s.setAttribute("target",r),i)s.setAttribute("href",i.link);else{let o=document.querySelector('meta[name="exdoc:full-text-search-url"]'),a=o?o.getAttribute("content"):"search.html?q=";s.setAttribute("href",`${a}${encodeURIComponent(t.value)}`)}s.click(),n||(Me(),De())}function Me(){let e=d(fe);e.value=""}function De(){Qe(),document.body.classList.remove("search-focused"),ut()}var ft=window.scrollY,ns=70,In=-2;window.addEventListener("scroll",function(){let e=window.scrollY;e===0||ft-ens?document.body.classList.remove("scroll-sticky"):ft-e>Math.abs(In)&&document.body.classList.add("scroll-sticky"),ft=e<=0?0:e},!1);var Rn=".sidebar-projectVersion",Nn=".sidebar-projectVersionsDropdown";function Hn(){let e=dn();if(e.length>0){let n=d(Rn).textContent.trim(),i=rs(e,n);is({nodes:i})}}function is({nodes:e}){let t=d(Rn),n=Handlebars.templates["versions-dropdown"]({nodes:e});t.innerHTML=n,d(Nn).addEventListener("change",os)}function rs(e,t){return ss(e,t).map(i=>({...i,isCurrentVersion:i.version===t}))}function ss(e,t){return e.some(i=>i.version===t)?e:[{version:t,url:"#"},...e]}function os(e){let t=e.target.value,n=window.location.pathname.split("/").pop()+window.location.hash,i=`${t}/${n}`;qt(i).then(r=>{r?window.location.href=i:window.location.href=t})}function mt(){let e=d(Nn);e&&(e.focus(),e.addEventListener("keydown",t=>{(t.key==="Escape"||t.key==="v")&&(t.preventDefault(),e.blur())}),navigator.userActivation.isActive&&"showPicker"in HTMLSelectElement.prototype&&e.showPicker())}var D=Ft(Dn());var Fe=80,as="#search";function Bn(){let e=window.location.pathname;if(e.endsWith("/search.html")||e.endsWith("/search")){let t=Ut("q");cs(t)}}async function cs(e){if(re(e))gt({value:e});else{Pn(e);let t=await ls();try{let n=e.replaceAll(/(\B|\\):/g,"\\:"),i=ws(t.search(n));gt({value:e,results:i})}catch(n){gt({value:e,errorMessage:n.message})}}}function gt({value:e,results:t,errorMessage:n}){let i=d(as),r=Handlebars.templates["search-results"]({value:e,results:t,errorMessage:n});i.innerHTML=r}async function ls(){D.default.tokenizer.separator=/\s+/,D.default.QueryLexer.termSeparator=/\s+/,D.default.Pipeline.registerFunction(Un,"docTokenSplitter"),D.default.Pipeline.registerFunction(qn,"docTrimmer");let e=await us();if(e)return e;let t=gs();return ds(t),t}async function us(){try{let e=sessionStorage.getItem($n());if(e){let t=await fs(e);return D.default.Index.load(t)}else return null}catch(e){return console.error("Failed to load index: ",e),null}}async function ds(e){try{let t=await hs(e);sessionStorage.setItem($n(),t)}catch(t){console.error("Failed to save index: ",t)}}async function hs(e){let t=new Blob([JSON.stringify(e)],{type:"application/json"}).stream().pipeThrough(new window.CompressionStream("gzip")),i=await(await new Response(t).blob()).arrayBuffer();return ps(i)}async function fs(e){let t=new Blob([ms(e)],{type:"application/json"}).stream().pipeThrough(new window.DecompressionStream("gzip")),n=await new Response(t).text();return JSON.parse(n)}function ps(e){let t="",n=new Uint8Array(e),i=n.byteLength;for(let r=0;r{this.add(e)})})}function vs(e){e.pipeline.before(D.default.stemmer,Un)}function Un(e){let t=[e],n=/\/\d+$/,i=/\:|\./,r=e.toString();if(r.replace(/^[.,;?!]+|[.,;]+$/g,""),r.startsWith("`")&&r.endsWith("`")&&(r=r.slice(1,-1)),n.test(r)){let o=e.toString().replace(n,"");t.push(e.clone().update(()=>o));let a=o.split(i);if(a.length>1){for(let l of a)t.push(e.clone().update(()=>l));let c=e.toString().split(i);t.push(e.clone().update(()=>c[c.length-1]))}r=a[a.length-1]}else r.startsWith("@")?(r=r.substring(1),t.push(e.clone().update(()=>r))):r.startsWith(":")&&(r=r.substring(1),t.push(e.clone().update(()=>r)));let s=r.split(/\_|\-/);if(s.length>1)for(let o of s)t.push(e.clone().update(()=>o));return t}function ys(e){e.pipeline.before(D.default.stemmer,qn)}function qn(e){return e.update(function(t){return t.replace(/^[^@:\w]+/,"").replace(/[^\?\!\w]+$/,"")})}function ws(e){return e.filter(t=>Fn(t.ref)).map(t=>{let n=Fn(t.ref),i=t.matchData.metadata;return{...n,metadata:i,excerpts:bs(n,i)}})}function Fn(e){return searchData.items.find(t=>t.ref===e)||null}function bs(e,t){let{doc:n}=e,r=Object.keys(t).filter(s=>"doc"in t[s]).map(s=>t[s].doc.position.map(([o,a])=>Ss(n,o,a))).reduce((s,o)=>s.concat(o),[]);return r.length===0?[n.slice(0,Fe*2)+(Fe*20?"...":"",e.slice(i,t),""+Se(e.slice(t,t+n))+"",e.slice(t+n,r),r{let n=t.getAttribute("data-group-id");t.addEventListener("mouseenter",i=>{Vn(n,!0)}),t.addEventListener("mouseleave",i=>{Vn(n,!1)})})}function Vn(e,t){A(`[data-group-id="${e}"]`).forEach(i=>{i.classList.toggle(Es,t)})}var Z=".modal",Ls=".modal .modal-close",Ts=".modal .modal-title",ks=".modal .modal-body",zn='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',q={prevFocus:null,lastFocus:null,ignoreFocusChanges:!1};function Wn(){Os()}function Os(){let e=Handlebars.templates["modal-layout"]();document.body.insertAdjacentHTML("beforeend",e),d(Z).addEventListener("keydown",t=>{t.key==="Escape"&&X()}),d(Ls).addEventListener("click",t=>{X()}),d(Z).addEventListener("click",t=>{t.target.classList.contains("modal")&&X()})}function Gn(e){if(q.ignoreFocusChanges)return;let t=d(Z);if(t.contains(e.target))q.lastFocus=e.target;else{q.ignoreFocusChanges=!0;let n=Cs(t);q.lastFocus===n?As(t).focus():n.focus(),q.ignoreFocusChanges=!1,q.lastFocus=document.activeElement}}function Cs(e){return e.querySelector(zn)}function As(e){let t=e.querySelectorAll(zn);return t[t.length-1]}function Be({title:e,body:t}){q.prevFocus=document.activeElement,document.addEventListener("focus",Gn,!0),d(Ts).innerHTML=e,d(ks).innerHTML=t,d(Z).classList.add("shown"),d(Z).focus()}function X(){d(Z).classList.remove("shown"),document.addEventListener("focus",Gn,!0),q.prevFocus&&q.prevFocus.focus(),q.prevFocus=null}function Kn(){return d(Z).classList.contains("shown")}var Is="https://hexdocs.pm/%%",_s="https://www.erlang.org/doc/apps/%%",Ps="https://hex.pm/api/packages?search=name:%%*",Rs=".display-quick-switch",vt="#quick-switch-input",Jn="#quick-switch-results",Ns=".quick-switch-result",Hs=300,Qs=9,Xn=["erts","asn1","common_test","compiler","crypto","debugger","dialyzer","diameter","edoc","eldap","erl_interface","et","eunit","ftp","inets","jinterface","kernel","megaco","mnesia","observer","odbc","os_mon","parsetools","public_key","reltool","runtime_tools","sasl","snmp","ssh","ssl","stdlib","syntax_tools","tftp","tools","wx","xmerl"],Ms=["elixir","eex","ex_unit","hex","iex","logger","mix"].concat(Xn).map(e=>({name:e})),Zn=2,N={autocompleteResults:[],selectedIdx:null};function ei(){Ds()}function Ds(){A(Rs).forEach(e=>{e.addEventListener("click",t=>{wt()})})}function Fs(e){if(e.key==="Enter"){let t=e.target.value;$s(t),e.preventDefault()}else e.key==="ArrowUp"?(Yn(-1),e.preventDefault()):e.key==="ArrowDown"&&(Yn(1),e.preventDefault())}function Bs(e){let t=e.target.value;if(t.lengthn.json()).then(n=>{Array.isArray(n)&&(N.autocompleteResults=js(e,n),N.selectedIdx=null,d(vt).value.length>=Zn&&Vs({results:N.autocompleteResults}))})}function Vs({results:e}){let t=d(Jn),n=Handlebars.templates["quick-switch-results"]({results:e});t.innerHTML=n,A(Ns).forEach(i=>{i.addEventListener("click",r=>{let s=i.getAttribute("data-index"),o=N.autocompleteResults[s];yt(o.name)})})}function js(e,t){return Ms.concat(t).filter(n=>n.name.toLowerCase().includes(e.toLowerCase())).filter(n=>n.releases===void 0||n.releases[0].has_docs===!0).slice(0,Qs)}function Yn(e){N.selectedIdx=zs(e);let t=d(".quick-switch-result.selected"),n=d(`.quick-switch-result[data-index="${N.selectedIdx}"]`);t&&t.classList.remove("selected"),n&&n.classList.add("selected")}function zs(e){let t=N.autocompleteResults.length;if(N.selectedIdx===null){if(e>=0)return 0;if(e<0)return t-1}return(N.selectedIdx+e+t)%t}var Ws=".display-settings",Gs="#settings-modal-content",bt="#modal-settings-tab",St="#modal-keyboard-shortcuts-tab",ni="#settings-content",ii="#keyboard-shortcuts-content",Ks=[{title:"Settings",id:"modal-settings-tab"},{title:"Keyboard shortcuts",id:"modal-keyboard-shortcuts-tab"}];function ri(){Ys()}function Ys(){A(Ws).forEach(e=>{e.addEventListener("click",t=>{Et()})})}function ti(){d(St).classList.remove("active"),d(bt).classList.add("active"),d(ni).classList.remove("hidden"),d(ii).classList.add("hidden")}function Js(){d(St).classList.add("active"),d(bt).classList.remove("active"),d(ii).classList.remove("hidden"),d(ni).classList.add("hidden")}function Et(){Be({title:Ks.map(({id:s,title:o})=>``).join(""),body:Handlebars.templates["settings-modal-body"]({shortcuts:xt})});let e=d(Gs),t=e.querySelector('[name="theme"]'),n=e.querySelector('[name="tooltips"]'),i=e.querySelector('[name="direct_livebook_url"]'),r=e.querySelector('[name="livebook_url"]');I.getAndSubscribe(s=>{t.value=s.theme||"system",n.checked=s.tooltips,s.livebookUrl===null?(i.checked=!1,r.classList.add("hidden"),r.tabIndex=-1):(i.checked=!0,r.classList.remove("hidden"),r.tabIndex=0,r.value=s.livebookUrl)}),t.addEventListener("change",s=>{I.update({theme:s.target.value})}),n.addEventListener("change",s=>{I.update({tooltips:s.target.checked})}),i.addEventListener("change",s=>{let o=s.target.checked?r.value:null;I.update({livebookUrl:o})}),r.addEventListener("input",s=>{I.update({livebookUrl:s.target.value})}),d(bt).addEventListener("click",s=>{ti()}),d(St).addEventListener("click",s=>{Js()}),ti()}var Xs="#settings-modal-content",xt=[{key:"c",description:"Toggle sidebar",action:Xe},{key:"n",description:"Cycle themes",action:Sn},{key:"s",description:"Focus search bar",displayAs:"/ or s",action:Lt},{key:"/",action:Lt},{key:"k",hasModifier:!0,action:Lt},{key:"v",description:"Open/focus version select",action:no},{key:"g",description:"Go to package docs",displayAs:"g",action:wt},{key:"?",displayAs:"?",description:"Bring up this modal",action:io}],Tt={shortcutBeingPressed:null};function si(){Zs()}function Zs(){document.addEventListener("keydown",eo),document.addEventListener("keyup",to)}function eo(e){if(Tt.shortcutBeingPressed||e.target.matches("input, select, textarea"))return;let t=xt.find(n=>n.hasModifier?se()&&e.metaKey||e.ctrlKey?n.key===e.key:!1:e.ctrlKey||e.metaKey||e.altKey?!1:n.key===e.key);t&&(Tt.shortcutBeingPressed=t,e.preventDefault(),t.action(e))}function to(e){Tt.shortcutBeingPressed=null}function Lt(e){X(),pt()}function no(){X(),cn()?mt():et().then(mt)}function io(){ro()?X():Et()}function ro(){return Kn()&&d(Xs)}var ee={plain:"plain",function:"function",module:"module"},so=[{href:"typespecs.html#basic-types",hint:{kind:ee.plain,description:"Basic type"}},{href:"typespecs.html#literals",hint:{kind:ee.plain,description:"Literal"}},{href:"typespecs.html#built-in-types",hint:{kind:ee.plain,description:"Built-in type"}}],$e={cancelHintFetching:null};function oi(e){if(ci(e))return!0;let t=/#.*\//;return e.includes("#")&&!t.test(e)?!1:e.includes(".html")}function ai(e){let t=ci(e);return t?Promise.resolve(t):oo(e)}function ci(e){let t=so.find(n=>e.includes(n.href));return t?t.hint:null}function oo(e){let t=e.replace(".html",".html?hint=true");return new Promise((n,i)=>{let r=document.createElement("iframe");r.setAttribute("src",t),r.style.display="none";function s(a){let{href:c,hint:l}=a.data;t===c&&(o(),n(l))}$e.cancelHintFetching=()=>{o(),i(new Error("cancelled"))};function o(){r.remove(),window.removeEventListener("message",s),$e.cancelHintFetching=null}window.addEventListener("message",s),document.body.appendChild(r)})}function li(){$e.cancelHintFetching&&$e.cancelHintFetching()}function ui(e){let n=e.querySelector("h1").textContent,i=e.querySelector(".docstring > p"),r=i?i.innerHTML:"";return{kind:ee.function,title:n.trim(),description:r.trim()}}function di(e){let n=e.querySelector("h1 > span").textContent,i=e.querySelector("#moduledoc p"),r=i?i.innerHTML:"";return{kind:ee.module,title:n.trim(),description:r.trim()}}var ao=".content a",kt=".tooltip",co=".tooltip .tooltip-body",fi="body .content-inner",lo="#content",pi="tooltip-shown",pe=10,uo=pe*4,hi={height:450,width:768},ho=100,ce={currentLinkElement:null,hoverDelayTimeout:null};function mi(){fo(),po()}function fo(){let e=Handlebars.templates["tooltip-layout"]();d(fi).insertAdjacentHTML("beforeend",e)}function po(){A(ao).forEach(e=>{mo(e)&&(e.addEventListener("mouseenter",t=>{vo(e)}),e.addEventListener("mouseleave",t=>{So(e)}))})}function mo(e){return!(e.getAttribute("data-no-tooltip")!==null||go(e.href)||!oi(e.href))}function go(e){let t=e.replace(lo,"");return window.location.href.split("#")[0]===t}function vo(e){yo()&&(ce.currentLinkElement=e,ce.hoverDelayTimeout=setTimeout(()=>{ai(e.href).then(t=>{wo(t),bo()}).catch(()=>{})},ho))}function yo(){let e=window.innerWidthe.firstElementChild&&e.firstElementChild.tagName==="CODE").forEach(e=>e.insertAdjacentHTML("beforeend",Io)),Array.from(A(".copy-button")).forEach(e=>{let t;e.addEventListener("click",()=>{let n=e.querySelector("[aria-live]");t&&clearTimeout(t);let i=Array.from(e.parentElement.querySelector("code").childNodes).filter(r=>!(r.tagName==="SPAN"&&r.classList.contains("unselectable"))).map(r=>r.textContent).join("");navigator.clipboard.writeText(i),e.classList.add("clicked"),n.innerHTML="Copied! ✓",t=setTimeout(()=>{e.classList.remove("clicked"),n.innerHTML=""},3e3)})})}function bi(){let e=se()?"apple-os":"non-apple-os";document.documentElement.classList.add(e)}function Ei(){let e=Ee(ie(),!0);e&&Po(e)}function Po(e){Ho(e),Ro(),No(),Si(),window.addEventListener("resize",t=>{Si()})}function Si(){let e=document.body.scrollHeight,t=document.getElementById("content").parentElement.offsetHeight,n={type:"preview",maxHeight:e,contentHeight:t};window.parent.postMessage(n,"*")}function Ro(){let e=document.getElementsByTagName("a");for(let t of e)t.getAttribute("target")!=="_blank"&&t.setAttribute("target","_parent")}function No(){window.scrollTo(0,0)}function Ho(e){document.body.classList.add("preview");let t=document.getElementById("content");t.innerHTML=e.innerHTML}var Ot=new WeakMap;function Ct(e,t,n,i){if(!e&&!Ot.has(t))return!1;let r=Ot.get(t)??new WeakMap;Ot.set(t,r);let s=r.get(n)??new Set;r.set(n,s);let o=s.has(i);return e?s.add(i):s.delete(i),o&&e}function Qo(e,t){let n=e.target;if(n instanceof Text&&(n=n.parentElement),n instanceof Element&&e.currentTarget instanceof Element){let i=n.closest(t);if(i&&e.currentTarget.contains(i))return i}}function Mo(e,t,n,i={}){let{signal:r,base:s=document}=i;if(r?.aborted)return;let{once:o,...a}=i,c=s instanceof Document?s.documentElement:s,l=Boolean(typeof i=="object"?i.capture:i),u=y=>{let w=Qo(y,String(e));if(w){let b=Object.assign(y,{delegateTarget:w});n.call(c,b),o&&(c.removeEventListener(t,u,a),Ct(!1,c,n,h))}},h=JSON.stringify({selector:e,type:t,capture:l});Ct(!0,c,n,h)||c.addEventListener(t,u,a),r?.addEventListener("abort",()=>{Ct(!1,c,n,h)})}var Ue=Mo;function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;tString(e).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||t||"",ge=({hash:e}={})=>window.location.pathname+window.location.search+(e?window.location.hash:""),Do=(e,t={})=>{let n=k({url:e=e||ge({hash:!0}),random:Math.random(),source:"swup"},t);window.history.pushState(n,"",e)},me=(e=null,t={})=>{e=e||ge({hash:!0});let n=k({},window.history.state||{},{url:e,random:Math.random(),source:"swup"},t);window.history.replaceState(n,"",e)},Fo=(e,t,n,i)=>{let r=new AbortController;return i=k({},i,{signal:r.signal}),Ue(e,t,n,i),{destroy:()=>r.abort()}},O=class extends URL{constructor(t,n=document.baseURI){super(t.toString(),n),Object.setPrototypeOf(this,O.prototype)}get url(){return this.pathname+this.search}static fromElement(t){let n=t.getAttribute("href")||t.getAttribute("xlink:href")||"";return new O(n)}static fromUrl(t){return new O(t)}};var le=class extends Error{constructor(t,n){super(t),this.url=void 0,this.status=void 0,this.aborted=void 0,this.timedOut=void 0,this.name="FetchError",this.url=n.url,this.status=n.status,this.aborted=n.aborted||!1,this.timedOut=n.timedOut||!1}};async function Bo(e,t={}){var n;e=O.fromUrl(e).url;let{visit:i=this.visit}=t,r=k({},this.options.requestHeaders,t.headers),s=(n=t.timeout)!=null?n:this.options.timeout,o=new AbortController,{signal:a}=o;t=k({},t,{headers:r,signal:a});let c,l=!1,u=null;s&&s>0&&(u=setTimeout(()=>{l=!0,o.abort("timeout")},s));try{c=await this.hooks.call("fetch:request",i,{url:e,options:t},(g,{url:m,options:x})=>fetch(m,x)),u&&clearTimeout(u)}catch(g){throw l?(this.hooks.call("fetch:timeout",i,{url:e}),new le(`Request timed out: ${e}`,{url:e,timedOut:l})):g?.name==="AbortError"||a.aborted?new le(`Request aborted: ${e}`,{url:e,aborted:!0}):g}let{status:h,url:f}=c,y=await c.text();if(h===500)throw this.hooks.call("fetch:error",i,{status:h,response:c,url:f}),new le(`Server error: ${f}`,{status:h,url:f});if(!y)throw new le(`Empty response: ${f}`,{status:h,url:f});let{url:w}=O.fromUrl(f),b={url:w,html:y};return!i.cache.write||t.method&&t.method!=="GET"||e!==w||this.cache.set(b.url,b),b}var It=class{constructor(t){this.swup=void 0,this.pages=new Map,this.swup=t}get size(){return this.pages.size}get all(){let t=new Map;return this.pages.forEach((n,i)=>{t.set(i,k({},n))}),t}has(t){return this.pages.has(this.resolve(t))}get(t){let n=this.pages.get(this.resolve(t));return n&&k({},n)}set(t,n){n=k({},n,{url:t=this.resolve(t)}),this.pages.set(t,n),this.swup.hooks.callSync("cache:set",void 0,{page:n})}update(t,n){t=this.resolve(t);let i=k({},this.get(t),n,{url:t});this.pages.set(t,i)}delete(t){this.pages.delete(this.resolve(t))}clear(){this.pages.clear(),this.swup.hooks.callSync("cache:clear",void 0,void 0)}prune(t){this.pages.forEach((n,i)=>{t(i,n)&&this.delete(i)})}resolve(t){let{url:n}=O.fromUrl(t);return this.swup.resolveUrl(n)}},_t=(e,t=document)=>t.querySelector(e),Nt=(e,t=document)=>Array.from(t.querySelectorAll(e)),Oi=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{e()})})});function Ci(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function $o(e,t=[]){return new Promise((n,i)=>{let r=e(...t);Ci(r)?r.then(n,i):n(r)})}function xi(e,t){let n=e?.closest(`[${t}]`);return n!=null&&n.hasAttribute(t)?n?.getAttribute(t)||!0:void 0}var Pt=class{constructor(t){this.swup=void 0,this.swupClasses=["to-","is-changing","is-rendering","is-popstate","is-animating","is-leaving"],this.swup=t}get selectors(){let{scope:t}=this.swup.visit.animation;return t==="containers"?this.swup.visit.containers:t==="html"?["html"]:Array.isArray(t)?t:[]}get selector(){return this.selectors.join(",")}get targets(){return this.selector.trim()?Nt(this.selector):[]}add(...t){this.targets.forEach(n=>n.classList.add(...t))}remove(...t){this.targets.forEach(n=>n.classList.remove(...t))}clear(){this.targets.forEach(t=>{let n=t.className.split(" ").filter(i=>this.isSwupClass(i));t.classList.remove(...n)})}isSwupClass(t){return this.swupClasses.some(n=>t.startsWith(n))}},je=class{constructor(t,n){this.id=void 0,this.state=void 0,this.from=void 0,this.to=void 0,this.containers=void 0,this.animation=void 0,this.trigger=void 0,this.cache=void 0,this.history=void 0,this.scroll=void 0,this.meta=void 0;let{to:i,from:r,hash:s,el:o,event:a}=n;this.id=Math.random(),this.state=1,this.from={url:r??t.location.url,hash:t.location.hash},this.to={url:i,hash:s},this.containers=t.options.containers,this.animation={animate:!0,wait:!1,name:void 0,native:t.options.native,scope:t.options.animationScope,selector:t.options.animationSelector},this.trigger={el:o,event:a},this.cache={read:t.options.cache,write:t.options.cache},this.history={action:"push",popstate:!1,direction:void 0},this.scroll={reset:!0,target:void 0},this.meta={}}advance(t){this.state=7}};function Uo(e){return new je(this,e)}var Rt=class{constructor(t){this.swup=void 0,this.registry=new Map,this.hooks=["animation:out:start","animation:out:await","animation:out:end","animation:in:start","animation:in:await","animation:in:end","animation:skip","cache:clear","cache:set","content:replace","content:scroll","enable","disable","fetch:request","fetch:error","fetch:timeout","history:popstate","link:click","link:self","link:anchor","link:newtab","page:load","page:view","scroll:top","scroll:anchor","visit:start","visit:transition","visit:abort","visit:end"],this.swup=t,this.init()}init(){this.hooks.forEach(t=>this.create(t))}create(t){this.registry.has(t)||this.registry.set(t,new Map)}exists(t){return this.registry.has(t)}get(t){let n=this.registry.get(t);if(n)return n;console.error(`Unknown hook '${t}'`)}clear(){this.registry.forEach(t=>t.clear())}on(t,n,i={}){let r=this.get(t);if(!r)return console.warn(`Hook '${t}' not found.`),()=>{};let s=k({},i,{id:r.size+1,hook:t,handler:n});return r.set(n,s),()=>this.off(t,n)}before(t,n,i={}){return this.on(t,n,k({},i,{before:!0}))}replace(t,n,i={}){return this.on(t,n,k({},i,{replace:!0}))}once(t,n,i={}){return this.on(t,n,k({},i,{once:!0}))}off(t,n){let i=this.get(t);i&&n?i.delete(n)||console.warn(`Handler for hook '${t}' not found.`):i&&i.clear()}async call(t,n,i,r){let[s,o,a]=this.parseCallArgs(t,n,i,r),{before:c,handler:l,after:u}=this.getHandlers(t,a);await this.run(c,s,o);let[h]=await this.run(l,s,o,!0);return await this.run(u,s,o),this.dispatchDomEvent(t,s,o),h}callSync(t,n,i,r){let[s,o,a]=this.parseCallArgs(t,n,i,r),{before:c,handler:l,after:u}=this.getHandlers(t,a);this.runSync(c,s,o);let[h]=this.runSync(l,s,o,!0);return this.runSync(u,s,o),this.dispatchDomEvent(t,s,o),h}parseCallArgs(t,n,i,r){return n instanceof je||typeof n!="object"&&typeof i!="function"?[n,i,r]:[void 0,n,i]}async run(t,n=this.swup.visit,i,r=!1){let s=[];for(let{hook:o,handler:a,defaultHandler:c,once:l}of t)if(n==null||!n.done){l&&this.off(o,a);try{let u=await $o(a,[n,i,c]);s.push(u)}catch(u){if(r)throw u;console.error(`Error in hook '${o}':`,u)}}return s}runSync(t,n=this.swup.visit,i,r=!1){let s=[];for(let{hook:o,handler:a,defaultHandler:c,once:l}of t)if(n==null||!n.done){l&&this.off(o,a);try{let u=a(n,i,c);s.push(u),Ci(u)&&console.warn(`Swup will not await Promises in handler for synchronous hook '${o}'.`)}catch(u){if(r)throw u;console.error(`Error in hook '${o}':`,u)}}return s}getHandlers(t,n){let i=this.get(t);if(!i)return{found:!1,before:[],handler:[],after:[],replaced:!1};let r=Array.from(i.values()),s=this.sortRegistrations,o=r.filter(({before:h,replace:f})=>h&&!f).sort(s),a=r.filter(({replace:h})=>h).filter(h=>!0).sort(s),c=r.filter(({before:h,replace:f})=>!h&&!f).sort(s),l=a.length>0,u=[];if(n&&(u=[{id:0,hook:t,handler:n}],l)){let h=a.length-1,{handler:f,once:y}=a[h],w=b=>{let g=a[b-1];return g?(m,x)=>g.handler(m,x,w(b-1)):n};u=[{id:0,hook:t,once:y,handler:f,defaultHandler:w(h)}]}return{found:!0,before:o,handler:u,after:c,replaced:l}}sortRegistrations(t,n){var i,r;return((i=t.priority)!=null?i:0)-((r=n.priority)!=null?r:0)||t.id-n.id||0}dispatchDomEvent(t,n,i){if(n!=null&&n.done)return;let r={hook:t,args:i,visit:n||this.swup.visit};document.dispatchEvent(new CustomEvent("swup:any",{detail:r,bubbles:!0})),document.dispatchEvent(new CustomEvent(`swup:${t}`,{detail:r,bubbles:!0}))}parseName(t){let[n,...i]=t.split(".");return[n,i.reduce((r,s)=>k({},r,{[s]:!0}),{})]}},qo=e=>{if(e&&e.charAt(0)==="#"&&(e=e.substring(1)),!e)return null;let t=decodeURIComponent(e),n=document.getElementById(e)||document.getElementById(t)||_t(`a[name='${CSS.escape(e)}']`)||_t(`a[name='${CSS.escape(t)}']`);return n||e!=="top"||(n=document.body),n},qe="transition",At="animation";async function Vo({selector:e,elements:t}){if(e===!1&&!t)return;let n=[];if(t)n=Array.from(t);else if(e&&(n=Nt(e,document.body),!n.length))return void console.warn(`[swup] No elements found matching animationSelector \`${e}\``);let i=n.map(r=>function(s){let{type:o,timeout:a,propCount:c}=function(l){let u=window.getComputedStyle(l),h=Ve(u,`${qe}Delay`),f=Ve(u,`${qe}Duration`),y=Li(h,f),w=Ve(u,`${At}Delay`),b=Ve(u,`${At}Duration`),g=Li(w,b),m=Math.max(y,g),x=m>0?y>g?qe:At:null;return{type:x,timeout:m,propCount:x?x===qe?f.length:b.length:0}}(s);return!(!o||!a)&&new Promise(l=>{let u=`${o}end`,h=performance.now(),f=0,y=()=>{s.removeEventListener(u,w),l()},w=b=>{b.target===s&&((performance.now()-h)/1e3=c&&y())};setTimeout(()=>{f0?await Promise.all(i):e&&console.warn(`[swup] No CSS animation duration defined on elements matching \`${e}\``)}function Ve(e,t){return(e[t]||"").split(", ")}function Li(e,t){for(;e.lengthTi(n)+Ti(e[i])))}function Ti(e){return 1e3*parseFloat(e)}function jo(e,t={},n={}){if(typeof e!="string")throw new Error("swup.navigate() requires a URL parameter");if(this.shouldIgnoreVisit(e,{el:n.el,event:n.event}))return void window.location.assign(e);let{url:i,hash:r}=O.fromUrl(e),s=this.createVisit(k({},n,{to:i,hash:r}));this.performNavigation(s,t)}async function zo(e,t={}){if(this.navigating){if(this.visit.state>=6)return e.state=2,void(this.onVisitEnd=()=>this.performNavigation(e,t));await this.hooks.call("visit:abort",this.visit,void 0),delete this.visit.to.document,this.visit.state=8}this.navigating=!0,this.visit=e;let{el:n}=e.trigger;t.referrer=t.referrer||this.location.url,t.animate===!1&&(e.animation.animate=!1),e.animation.animate||this.classes.clear();let i=t.history||xi(n,"data-swup-history");typeof i=="string"&&["push","replace"].includes(i)&&(e.history.action=i);let r=t.animation||xi(n,"data-swup-animation");var s,o;typeof r=="string"&&(e.animation.name=r),e.meta=t.meta||{},typeof t.cache=="object"?(e.cache.read=(s=t.cache.read)!=null?s:e.cache.read,e.cache.write=(o=t.cache.write)!=null?o:e.cache.write):t.cache!==void 0&&(e.cache={read:!!t.cache,write:!!t.cache}),delete t.cache;try{await this.hooks.call("visit:start",e,void 0),e.state=3;let a=this.hooks.call("page:load",e,{options:t},async(l,u)=>{let h;return l.cache.read&&(h=this.cache.get(l.to.url)),u.page=h||await this.fetchPage(l.to.url,u.options),u.cache=!!h,u.page});a.then(({html:l})=>{e.advance(5),e.to.html=l,e.to.document=new DOMParser().parseFromString(l,"text/html")});let c=e.to.url+e.to.hash;if(e.history.popstate||(e.history.action==="replace"||e.to.url===this.location.url?me(c):(this.currentHistoryIndex++,Do(c,{index:this.currentHistoryIndex}))),this.location=O.fromUrl(c),e.history.popstate&&this.classes.add("is-popstate"),e.animation.name&&this.classes.add(`to-${ki(e.animation.name)}`),e.animation.wait&&await a,e.done||(await this.hooks.call("visit:transition",e,void 0,async()=>{if(!e.animation.animate)return await this.hooks.call("animation:skip",void 0),void await this.renderPage(e,await a);e.advance(4),await this.animatePageOut(e),e.animation.native&&document.startViewTransition?await document.startViewTransition(async()=>await this.renderPage(e,await a)).finished:await this.renderPage(e,await a),await this.animatePageIn(e)}),e.done))return;await this.hooks.call("visit:end",e,void 0,()=>this.classes.clear()),e.state=7,this.navigating=!1,this.onVisitEnd&&(this.onVisitEnd(),this.onVisitEnd=void 0)}catch(a){if(!a||a!=null&&a.aborted)return void(e.state=8);e.state=9,console.error(a),this.options.skipPopStateHandling=()=>(window.location.assign(e.to.url+e.to.hash),!0),window.history.back()}finally{delete e.to.document}}var Wo=async function(e){await this.hooks.call("animation:out:start",e,void 0,()=>{this.classes.add("is-changing","is-animating","is-leaving")}),await this.hooks.call("animation:out:await",e,{skip:!1},(t,{skip:n})=>{if(!n)return this.awaitAnimations({selector:t.animation.selector})}),await this.hooks.call("animation:out:end",e,void 0)},Go=function(e){var t;let n=e.to.document;if(!n)return!1;let i=((t=n.querySelector("title"))==null?void 0:t.innerText)||"";document.title=i;let r=Nt('[data-swup-persist]:not([data-swup-persist=""])'),s=e.containers.map(o=>{let a=document.querySelector(o),c=n.querySelector(o);return a&&c?(a.replaceWith(c.cloneNode(!0)),!0):(a||console.warn(`[swup] Container missing in current document: ${o}`),c||console.warn(`[swup] Container missing in incoming document: ${o}`),!1)}).filter(Boolean);return r.forEach(o=>{let a=o.getAttribute("data-swup-persist"),c=_t(`[data-swup-persist="${a}"]`);c&&c!==o&&c.replaceWith(o)}),s.length===e.containers.length},Ko=function(e){let t={behavior:"auto"},{target:n,reset:i}=e.scroll,r=n??e.to.hash,s=!1;return r&&(s=this.hooks.callSync("scroll:anchor",e,{hash:r,options:t},(o,{hash:a,options:c})=>{let l=this.getAnchorElement(a);return l&&l.scrollIntoView(c),!!l})),i&&!s&&(s=this.hooks.callSync("scroll:top",e,{options:t},(o,{options:a})=>(window.scrollTo(k({top:0,left:0},a)),!0))),s},Yo=async function(e){if(e.done)return;let t=this.hooks.call("animation:in:await",e,{skip:!1},(n,{skip:i})=>{if(!i)return this.awaitAnimations({selector:n.animation.selector})});await Oi(),await this.hooks.call("animation:in:start",e,void 0,()=>{this.classes.remove("is-animating")}),await t,await this.hooks.call("animation:in:end",e,void 0)},Jo=async function(e,t){if(e.done)return;e.advance(6);let{url:n}=t;this.isSameResolvedUrl(ge(),n)||(me(n),this.location=O.fromUrl(n),e.to.url=this.location.url,e.to.hash=this.location.hash),await this.hooks.call("content:replace",e,{page:t},(i,{})=>{if(this.classes.remove("is-leaving"),i.animation.animate&&this.classes.add("is-rendering"),!this.replaceContent(i))throw new Error("[swup] Container mismatch, aborting");i.animation.animate&&(this.classes.add("is-changing","is-animating","is-rendering"),i.animation.name&&this.classes.add(`to-${ki(i.animation.name)}`))}),await this.hooks.call("content:scroll",e,void 0,()=>this.scrollToContent(e)),await this.hooks.call("page:view",e,{url:this.location.url,title:document.title})},Xo=function(e){var t;if(t=e,Boolean(t?.isSwupPlugin)){if(e.swup=this,!e._checkRequirements||e._checkRequirements())return e._beforeMount&&e._beforeMount(),e.mount(),this.plugins.push(e),this.plugins}else console.error("Not a swup plugin instance",e)};function Zo(e){let t=this.findPlugin(e);if(t)return t.unmount(),t._afterUnmount&&t._afterUnmount(),this.plugins=this.plugins.filter(n=>n!==t),this.plugins;console.error("No such plugin",t)}function ea(e){return this.plugins.find(t=>t===e||t.name===e||t.name===`Swup${String(e)}`)}function ta(e){if(typeof this.options.resolveUrl!="function")return console.warn("[swup] options.resolveUrl expects a callback function."),e;let t=this.options.resolveUrl(e);return t&&typeof t=="string"?t.startsWith("//")||t.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),e):t:(console.warn("[swup] options.resolveUrl needs to return a url"),e)}function na(e,t){return this.resolveUrl(e)===this.resolveUrl(t)}var ia={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',animationScope:"html",cache:!0,containers:["#swup"],hooks:{},ignoreVisit:(e,{el:t}={})=>!(t==null||!t.closest("[data-no-swup]")),linkSelector:"a[href]",linkToSelf:"scroll",native:!1,plugins:[],resolveUrl:e=>e,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:e=>{var t;return((t=e.state)==null?void 0:t.source)!=="swup"},timeout:0},ze=class{get currentPageUrl(){return this.location.url}constructor(t={}){var n,i;this.version="4.8.1",this.options=void 0,this.defaults=ia,this.plugins=[],this.visit=void 0,this.cache=void 0,this.hooks=void 0,this.classes=void 0,this.location=O.fromUrl(window.location.href),this.currentHistoryIndex=void 0,this.clickDelegate=void 0,this.navigating=!1,this.onVisitEnd=void 0,this.use=Xo,this.unuse=Zo,this.findPlugin=ea,this.log=()=>{},this.navigate=jo,this.performNavigation=zo,this.createVisit=Uo,this.delegateEvent=Fo,this.fetchPage=Bo,this.awaitAnimations=Vo,this.renderPage=Jo,this.replaceContent=Go,this.animatePageIn=Yo,this.animatePageOut=Wo,this.scrollToContent=Ko,this.getAnchorElement=qo,this.getCurrentUrl=ge,this.resolveUrl=ta,this.isSameResolvedUrl=na,this.options=k({},this.defaults,t),this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this),this.cache=new It(this),this.classes=new Pt(this),this.hooks=new Rt(this),this.visit=this.createVisit({to:""}),this.currentHistoryIndex=(n=(i=window.history.state)==null?void 0:i.index)!=null?n:1,this.enable()}async enable(){var t;let{linkSelector:n}=this.options;this.clickDelegate=this.delegateEvent(n,"click",this.handleLinkClick),window.addEventListener("popstate",this.handlePopState),this.options.animateHistoryBrowsing&&(window.history.scrollRestoration="manual"),this.options.native=this.options.native&&!!document.startViewTransition,this.options.plugins.forEach(i=>this.use(i));for(let[i,r]of Object.entries(this.options.hooks)){let[s,o]=this.hooks.parseName(i);this.hooks.on(s,r,o)}((t=window.history.state)==null?void 0:t.source)!=="swup"&&me(null,{index:this.currentHistoryIndex}),await Oi(),await this.hooks.call("enable",void 0,void 0,()=>{let i=document.documentElement;i.classList.add("swup-enabled"),i.classList.toggle("swup-native",this.options.native)})}async destroy(){this.clickDelegate.destroy(),window.removeEventListener("popstate",this.handlePopState),this.cache.clear(),this.options.plugins.forEach(t=>this.unuse(t)),await this.hooks.call("disable",void 0,void 0,()=>{let t=document.documentElement;t.classList.remove("swup-enabled"),t.classList.remove("swup-native")}),this.hooks.clear()}shouldIgnoreVisit(t,{el:n,event:i}={}){let{origin:r,url:s,hash:o}=O.fromUrl(t);return r!==window.location.origin||!(!n||!this.triggerWillOpenNewWindow(n))||!!this.options.ignoreVisit(s+o,{el:n,event:i})}handleLinkClick(t){let n=t.delegateTarget,{href:i,url:r,hash:s}=O.fromElement(n);if(this.shouldIgnoreVisit(i,{el:n,event:t}))return;if(this.navigating&&r===this.visit.to.url)return void t.preventDefault();let o=this.createVisit({to:r,hash:s,el:n,event:t});t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?this.hooks.callSync("link:newtab",o,{href:i}):t.button===0&&this.hooks.callSync("link:click",o,{el:n,event:t},()=>{var a;let c=(a=o.from.url)!=null?a:"";t.preventDefault(),r&&r!==c?this.isSameResolvedUrl(r,c)||this.performNavigation(o):s?this.hooks.callSync("link:anchor",o,{hash:s},()=>{me(r+s),this.scrollToContent(o)}):this.hooks.callSync("link:self",o,void 0,()=>{this.options.linkToSelf==="navigate"?this.performNavigation(o):(me(r),this.scrollToContent(o))})})}handlePopState(t){var n,i,r,s;let o=(n=(i=t.state)==null?void 0:i.url)!=null?n:window.location.href;if(this.options.skipPopStateHandling(t)||this.isSameResolvedUrl(ge(),this.location.url))return;let{url:a,hash:c}=O.fromUrl(o),l=this.createVisit({to:a,hash:c,event:t});l.history.popstate=!0;let u=(r=(s=t.state)==null?void 0:s.index)!=null?r:0;u&&u!==this.currentHistoryIndex&&(l.history.direction=u-this.currentHistoryIndex>0?"forwards":"backwards",this.currentHistoryIndex=u),l.animation.animate=!1,l.scroll.reset=!1,l.scroll.target=!1,this.options.animateHistoryBrowsing&&(l.animation.animate=!0,l.scroll.reset=!0),this.hooks.callSync("history:popstate",l,{event:t},()=>{this.performNavigation(l)})}triggerWillOpenNewWindow(t){return!!t.matches('[download], [target="_blank"]')}};function ve(){return ve=Object.assign?Object.assign.bind():function(e){for(var t=1;tString(e).split(".").map(t=>String(parseInt(t||"0",10))).concat(["0","0"]).slice(0,3).join("."),We=class{constructor(){this.isSwupPlugin=!0,this.swup=void 0,this.version=void 0,this.requires={},this.handlersToUnregister=[]}mount(){}unmount(){this.handlersToUnregister.forEach(t=>t()),this.handlersToUnregister=[]}_beforeMount(){if(!this.name)throw new Error("You must define a name of plugin when creating a class.")}_afterUnmount(){}_checkRequirements(){return typeof this.requires!="object"||Object.entries(this.requires).forEach(([t,n])=>{if(!function(i,r,s){let o=function(a,c){var l;if(a==="swup")return(l=c.version)!=null?l:"";{var u;let h=c.findPlugin(a);return(u=h?.version)!=null?u:""}}(i,s);return!!o&&((a,c)=>c.every(l=>{let[,u,h]=l.match(/^([\D]+)?(.*)$/)||[];var f,y;return((w,b)=>{let g={"":m=>m===0,">":m=>m>0,">=":m=>m>=0,"<":m=>m<0,"<=":m=>m<=0};return(g[b]||g[""])(w)})((y=h,f=Ai(f=a),y=Ai(y),f.localeCompare(y,void 0,{numeric:!0})),u||">=")}))(o,r)}(t,n=Array.isArray(n)?n:[n],this.swup)){let i=`${t} ${n.join(", ")}`;throw new Error(`Plugin version mismatch: ${this.name} requires ${i}`)}}),!0}on(t,n,i={}){var r;n=!(r=n).name.startsWith("bound ")||r.hasOwnProperty("prototype")?n.bind(this):n;let s=this.swup.hooks.on(t,n,i);return this.handlersToUnregister.push(s),s}once(t,n,i={}){return this.on(t,n,ve({},i,{once:!0}))}before(t,n,i={}){return this.on(t,n,ve({},i,{before:!0}))}replace(t,n,i={}){return this.on(t,n,ve({},i,{replace:!0}))}off(t,n){return this.swup.hooks.off(t,n)}};(function(){if(!(typeof window>"u"||typeof document>"u"||typeof HTMLElement>"u")){var e=!1;try{var t=document.createElement("div");t.addEventListener("focus",function(s){s.preventDefault(),s.stopPropagation()},!0),t.focus(Object.defineProperty({},"preventScroll",{get:function(){if(navigator&&typeof navigator.userAgent<"u"&&navigator.userAgent&&navigator.userAgent.match(/Edge\/1[7-8]/))return e=!1;e=!0}}))}catch{}if(HTMLElement.prototype.nativeFocus===void 0&&!e){HTMLElement.prototype.nativeFocus=HTMLElement.prototype.focus;var n=function(s){for(var o=s.parentNode,a=[],c=document.scrollingElement||document.documentElement;o&&o!==c;)(o.offsetHeightn.replace(`{${i}}`,t[i]||""),e||"")}var Qt=class{constructor(){var t;this.id="swup-announcer",this.style="position:absolute;top:0;left:0;clip:rect(0 0 0 0);clip-path:inset(50%);overflow:hidden;white-space:nowrap;word-wrap:normal;width:1px;height:1px;",this.region=void 0,this.region=(t=this.getRegion())!=null?t:this.createRegion()}getRegion(){return document.getElementById(this.id)}createRegion(){let t=function(n){let i=document.createElement("template");return i.innerHTML=n,i.content.children[0]}(`

`);return document.body.appendChild(t),t}announce(t,n=0){return new Promise(i=>{setTimeout(()=>{this.region.textContent===t&&(t=`${t}.`),this.region.textContent="",this.region.textContent=t,i()},n)})}};function _i(e){let t;if(t=typeof e=="string"?document.querySelector(e):e,!(t instanceof HTMLElement))return;let n=t.getAttribute("tabindex");t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}),n!==null&&t.setAttribute("tabindex",n)}var Ge=class extends We{constructor(t={}){super(),this.name="SwupA11yPlugin",this.requires={swup:">=4"},this.defaults={headingSelector:"h1",respectReducedMotion:!0,autofocus:!1,announcements:{visit:"Navigated to: {title}",url:"New page at {url}"}},this.options=void 0,this.announcer=void 0,this.announcementDelay=100,this.rootSelector="body",this.handleAnchorScroll=(n,{hash:i})=>{let r=this.swup.getAnchorElement(i);r instanceof HTMLElement&&_i(r)},this.options=Ht({},this.defaults,t),this.announcer=new Qt}mount(){this.swup.hooks.create("content:announce"),this.swup.hooks.create("content:focus"),this.before("visit:start",this.prepareVisit),this.on("visit:start",this.markAsBusy),this.on("visit:end",this.unmarkAsBusy),this.on("visit:end",this.focusContent),this.on("visit:end",this.announceContent),this.on("scroll:anchor",this.handleAnchorScroll),this.before("visit:start",this.disableAnimations),this.before("link:self",this.disableAnimations),this.before("link:anchor",this.disableAnimations),this.swup.announce=this.announce.bind(this)}unmount(){this.swup.announce=void 0}async announce(t){await this.announcer.announce(t)}markAsBusy(){document.documentElement.setAttribute("aria-busy","true")}unmarkAsBusy(){document.documentElement.removeAttribute("aria-busy")}prepareVisit(t){t.a11y={announce:void 0,focus:this.rootSelector}}announceContent(t){this.swup.hooks.callSync("content:announce",t,void 0,n=>{n.a11y.announce===void 0&&(n.a11y.announce=this.getPageAnnouncement()),n.a11y.announce&&this.announcer.announce(n.a11y.announce,this.announcementDelay)})}focusContent(t){this.swup.hooks.callSync("content:focus",t,void 0,n=>{n.a11y.focus&&(this.options.autofocus&&function(){let i=function(){let r=document.querySelector("body [autofocus]");if(r&&!r.closest('[inert], [aria-disabled], [aria-hidden="true"]'))return r}();return!!i&&(i!==document.activeElement&&i.focus(),!0)}()===!0||_i(n.a11y.focus))})}getPageAnnouncement(){let{headingSelector:t,announcements:n}=this.options;return function({headingSelector:i="h1",announcements:r={}}){var s,o;let a=document.documentElement.lang||"*",{href:c,url:l,pathname:u}=O.fromUrl(window.location.href),h=(s=(o=r[a])!=null?o:r["*"])!=null?s:r;if(typeof h!="object")return;let f=document.querySelector(i);f||console.warn(`SwupA11yPlugin: No main heading (${i}) found on new page`);let y=f?.getAttribute("aria-label")||f?.textContent||document.title||Ii(h.url,{href:c,url:l,path:u});return Ii(h.visit,{title:y,href:c,url:l,path:u})}({headingSelector:t,announcements:n})}disableAnimations(t){this.options.respectReducedMotion&&window.matchMedia("(prefers-reduced-motion: reduce)").matches&&(t.animation.animate=!1,t.scroll.animate=!1)}};Vt(()=>{let e=new URLSearchParams(window.location.search),t=e.has("preview");Wt(),bn(e.get("theme")),Yt(t),jn(),mi(),yi(),wi(),bi(),t?Ei():(new ze({animationSelector:!1,containers:["#main"],hooks:{"page:view":it},linkSelector:'a[href]:not([href^="/"]):not([href^="http"]):not(.no-swup)',plugins:[new Ge]}),Hn(),sn(),it(),_n(),Wn(),si(),ei(),yn(),Bn(),ri())});})(); +/*! Bundled license information: + +lunr/lunr.js: + (** + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 + * Copyright (C) 2020 Oliver Nightingale + * @license MIT + *) + (*! + * lunr.utils + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Set + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.tokenizer + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Pipeline + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Vector + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.stemmer + * Copyright (C) 2020 Oliver Nightingale + * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt + *) + (*! + * lunr.stopWordFilter + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.trimmer + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.TokenSet + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Index + * Copyright (C) 2020 Oliver Nightingale + *) + (*! + * lunr.Builder + * Copyright (C) 2020 Oliver Nightingale + *) +*/ diff --git a/lib/ex_doc/formatter/epub/templates.ex b/lib/ex_doc/formatter/epub/templates.ex index 7fd10e2f3..02ab34eb3 100644 --- a/lib/ex_doc/formatter/epub/templates.ex +++ b/lib/ex_doc/formatter/epub/templates.ex @@ -94,7 +94,7 @@ defmodule ExDoc.Formatter.EPUB.Templates do :defp, :head_template, Path.expand("templates/head_template.eex", __DIR__), - [:config, :page], + [:config, :title], trim: true ) diff --git a/lib/ex_doc/formatter/epub/templates/extra_template.eex b/lib/ex_doc/formatter/epub/templates/extra_template.eex index 897cf8116..c73cb60ce 100644 --- a/lib/ex_doc/formatter/epub/templates/extra_template.eex +++ b/lib/ex_doc/formatter/epub/templates/extra_template.eex @@ -1,4 +1,4 @@ -<%= head_template(config, %{title: title}) %> +<%= head_template(config, title) %>

<%=h title_content %>

diff --git a/lib/ex_doc/formatter/epub/templates/head_template.eex b/lib/ex_doc/formatter/epub/templates/head_template.eex index 0102c6f44..43fc9be3d 100644 --- a/lib/ex_doc/formatter/epub/templates/head_template.eex +++ b/lib/ex_doc/formatter/epub/templates/head_template.eex @@ -3,7 +3,7 @@ xmlns:epub="http://www.idpf.org/2007/ops"> - <%= page.title %> - <%= config.project %> v<%= config.version %> + <%= title %> - <%= config.project %> v<%= config.version %> " /> diff --git a/lib/ex_doc/formatter/epub/templates/module_template.eex b/lib/ex_doc/formatter/epub/templates/module_template.eex index fc1ae4aaa..2639baddd 100644 --- a/lib/ex_doc/formatter/epub/templates/module_template.eex +++ b/lib/ex_doc/formatter/epub/templates/module_template.eex @@ -1,4 +1,4 @@ -<%= head_template(config, %{title: module.title}) %> +<%= head_template(config, module.title) %>

<%= module.title %> <%= H.module_type(module) %>

diff --git a/lib/ex_doc/formatter/epub/templates/nav_template.eex b/lib/ex_doc/formatter/epub/templates/nav_template.eex index 5ccd6c539..935e40a44 100644 --- a/lib/ex_doc/formatter/epub/templates/nav_template.eex +++ b/lib/ex_doc/formatter/epub/templates/nav_template.eex @@ -1,4 +1,4 @@ -<%= head_template(config, %{title: "Table Of Contents"}) %> +<%= head_template(config, "Table Of Contents") %>

Table of contents