From 8bd43bb553ceabd1d434b6cff0927a5c04a33761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 6 Jul 2024 22:11:15 +0200 Subject: [PATCH] Improve tokenization of function names, closes #1930 --- assets/js/search-page.js | 49 +++++++++++++++---- .../{html-7XSQ4GTY.js => html-5OPRASEH.js} | 2 +- 2 files changed, 40 insertions(+), 11 deletions(-) rename formatters/html/dist/{html-7XSQ4GTY.js => html-5OPRASEH.js} (78%) diff --git a/assets/js/search-page.js b/assets/js/search-page.js index e3a029e58..74793e731 100644 --- a/assets/js/search-page.js +++ b/assets/js/search-page.js @@ -153,17 +153,46 @@ function docTokenSplitter (builder) { } function docTokenFunction (token) { - // Split on : . / _ - to make easier to partially match on function names. - // We split only when tokenizing, not when searching. - const tokens = token - .toString() - .split(/\:|\.|\/|_|-/) - .map(part => { - return token.clone().update(() => part) - }) + // If we have something with an arity, we split on : . to make partial + // matches easier. We split only when tokenizing, not when searching. + // Below we use ExDoc.Markdown.to_ast/2 as an example. + const tokens = [token] + const arityRegex = /\/\d+$/ + const namespaceRegex = /\:|\./ + let toSplitWords = token.toString() + + if(arityRegex.test(toSplitWords)) { + const withoutArity = token + .toString() + .replace(arityRegex, "") + + // This token represents ExDoc.Markdown.to_ast + tokens.push(token.clone().update(() => withoutArity)) + + // And now we get each part as token: ExDoc, Markdown, and to_ast + let parts = withoutArity.split(namespaceRegex) + + if(parts.length > 1) { + for(let part of parts) { + tokens.push(token.clone().update(() => part)) + } + + // Let's also add to_ast/2 + let lastWithArity = token.toString().split(namespaceRegex) + tokens.push(token.clone().update(() => lastWithArity[lastWithArity.length - 1])) + } - if (tokens.length > 1) { - return [...tokens, token] + toSplitWords = parts[parts.length - 1] + } + + // Now split the function name (or the token, if that's all we had), + // on _ or - (but we keep the original) + let words = toSplitWords.split(/\_|\-/) + + if(words.length > 1) { + for(let word of words) { + tokens.push(token.clone().update(() => word)) + } } return tokens diff --git a/formatters/html/dist/html-7XSQ4GTY.js b/formatters/html/dist/html-5OPRASEH.js similarity index 78% rename from formatters/html/dist/html-7XSQ4GTY.js rename to formatters/html/dist/html-5OPRASEH.js index 2bc886af4..9bbc50513 100644 --- a/formatters/html/dist/html-7XSQ4GTY.js +++ b/formatters/html/dist/html-5OPRASEH.js @@ -1,5 +1,5 @@ (()=>{var ii=Object.create;var pt=Object.defineProperty;var ri=Object.getOwnPropertyDescriptor;var si=Object.getOwnPropertyNames;var oi=Object.getPrototypeOf,ai=Object.prototype.hasOwnProperty;var ht=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ci=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of si(t))!ai.call(e,r)&&r!==n&&pt(e,r,{get:()=>t[r],enumerable:!(i=ri(t,r))||i.enumerable});return e};var mt=(e,t,n)=>(n=e!=null?ii(oi(e)):{},ci(t||!e||!e.__esModule?pt(n,"default",{value:e,enumerable:!0}):n,e));var It=ht((co,_t)=>{var Ot="Expected a function",wt=NaN,bi="[object Symbol]",Si=/^\s+|\s+$/g,xi=/^[-+]0x[0-9a-f]+$/i,Ei=/^0b[01]+$/i,Li=/^0o[0-7]+$/i,Ti=parseInt,wi=typeof global=="object"&&global&&global.Object===Object&&global,ki=typeof self=="object"&&self&&self.Object===Object&&self,Oi=wi||ki||Function("return this")(),_i=Object.prototype,Ii=_i.toString,Ci=Math.max,Ai=Math.min,Fe=function(){return Oi.Date.now()};function Pi(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(Ot);t=kt(t)||0,ve(n)&&(f=!!n.leading,y="maxWait"in n,s=y?Ci(kt(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,V=t-C;return y?Ai(V,s-D):V}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 O(S);a=setTimeout(h,T(S))}function O(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:O(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 Ri(e,t,n){var i=!0,r=!0;if(typeof e!="function")throw new TypeError(Ot);return ve(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),Pi(e,t,{leading:i,maxWait:t,trailing:r})}function ve(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Ni(e){return!!e&&typeof e=="object"}function Qi(e){return typeof e=="symbol"||Ni(e)&&Ii.call(e)==bi}function kt(e){if(typeof e=="number")return e;if(Qi(e))return wt;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(Si,"");var n=Ei.test(e);return n||Li.test(e)?Ti(e.slice(2),n?2:8):xi.test(e)?wt:+e}_t.exports=Ri});var pn=ht((dn,fn)=>{(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 dn=="object"?fn.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),k=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())?li(n):null:null}function li(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 Et="ex_doc:settings",ui={tooltips:!0,theme:null,livebookUrl:null},He=class{constructor(){this._subscribers=[],this._settings=ui,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(Et);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(Et,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"))}},_=new He;var di=".content",Lt=".content-inner",fi=".livebook-badge";function Tt(e){e||mi(),gi(),pi(),hi()}function pi(){c(di).querySelectorAll("a").forEach(e=>{e.querySelector("code, img")&&e.classList.add("no-underline")})}function hi(){["warning","info","error","neutral","tip"].forEach(t=>{k(`blockquote h3.${t}, blockquote h4.${t}`).forEach(n=>{n.closest("blockquote").classList.add(t)})})}function mi(){c(Lt).setAttribute("tabindex",-1),c(Lt).focus()}function gi(){let t=window.location.pathname.replace(/(\.html)?$/,".livemd"),n=new URL(t,window.location.href).toString();_.getAndSubscribe(i=>{let r=i.livebookUrl?vi(i.livebookUrl,n):yi(n);for(let s of k(fi))s.href=r})}function yi(e){return`https://livebook.dev/run?url=${encodeURIComponent(e)}`}function vi(e,t){return`${e}/import?url=${encodeURIComponent(t)}`}var At=mt(It());var Hi=768,De=300,re=".sidebar-toggle",Fi=".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"},Di=Object.values(N),A={togglingTimeout:null,lastWindowWidth:window.innerWidth,sidebarPreference:M.NO_PREF};function Pt(){Rt(),Mi(),Bi()}function Mi(){let e=sessionStorage.getItem("sidebar_width");e&&Ct(e),new ResizeObserver(n=>{for(let i of n)Ct(i.contentRect.width)}).observe(document.getElementById("sidebar"))}function Ct(e){sessionStorage.setItem("sidebar_width",e),document.body.style.setProperty("--sidebarWidth",`${e}px`)}function Rt(){sessionStorage.getItem("sidebar_state")==="closed"||Nt()?(q(N.closed),c(re).setAttribute("aria-expanded","false")):(q(N.opened),c(re).setAttribute("aria-expanded","true")),setTimeout(()=>c(re).classList.add("sidebar-toggle--animated"),De)}function Nt(){return window.matchMedia(`screen and (max-width: ${Hi}px)`).matches}function q(...e){document.body.classList.remove(...Di),document.body.classList.add(...e)}function Bi(){c(re).addEventListener("click",e=>{Me(),qi()}),c(Fi).addEventListener("click",e=>{$i()}),window.addEventListener("resize",(0,At.default)(e=>{zi()},100))}function Me(){return Be()?Ht():ze()}function Be(){return document.body.classList.contains(N.opened)||document.body.classList.contains(N.opening)}function Qt(){return document.body.classList.contains(N.opened)}function ze(){return Ft(),sessionStorage.setItem("sidebar_state","opened"),c(re).setAttribute("aria-expanded","true"),new Promise((e,t)=>{requestAnimationFrame(()=>{q(N.openingStart),requestAnimationFrame(()=>{q(N.opening),A.togglingTimeout=setTimeout(()=>{q(N.opened),e()},De)})})})}function Ht(){return Ft(),sessionStorage.setItem("sidebar_state","closed"),c(re).setAttribute("aria-expanded","false"),new Promise((e,t)=>{requestAnimationFrame(()=>{q(N.closingStart),requestAnimationFrame(()=>{q(N.closing),A.togglingTimeout=setTimeout(()=>{q(N.closed),e()},De)})})})}function Ft(){A.togglingTimeout&&(clearTimeout(A.togglingTimeout),A.togglingTimeout=null)}function zi(){A.lastWindowWidth!==window.innerWidth&&(A.lastWindowWidth=window.innerWidth,(A.sidebarPreference===M.OPEN||A.sidebarPreference===M.NO_PREF)&&Rt())}function $i(){Nt()&&Be()&&Ht()}function qi(){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 Dt(){return window.versionNodes||[]}var $e={search:"search",extras:"extras",modules:"modules",tasks:"tasks"},qe=[$e.extras,$e.modules,$e.tasks],Se=e=>`#${e}-full-list`;function Mt(){qe.forEach(e=>{Vi(le(),e)}),be($()),zt(),Bt(),Ji()}function Vi(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");Ui(l)})}),i.querySelectorAll("li a").forEach(s=>{s.addEventListener("click",o=>{let l=o.target.closest("li"),u=i.querySelector(".current-section");u&&Gi(u),s.matches(".expand")&&(s.pathname===window.location.pathname||s.pathname===window.location.pathname+".html")&&Ve(l)})})}function Ve(e){e.classList.add("open"),e.querySelector("button[aria-controls]").setAttribute("aria-expanded","true")}function ji(e){e.classList.remove("open"),e.querySelector("button[aria-controls]").setAttribute("aria-expanded","false")}function Ui(e){e.classList.contains("open")?ji(e):Ve(e)}function Wi(e){e.classList.add("current-section"),e.querySelector("a").setAttribute("aria-current","true")}function Gi(e){e.classList.remove("current-section"),e.querySelector("a").setAttribute("aria-current","false")}function Ki(e){e.classList.add("current-hash"),e.querySelector("a").setAttribute("aria-current","true")}function Yi(e){e.classList.remove("current-hash"),e.querySelector("a").setAttribute("aria-current","false")}function be(e){qe.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 Bt(){let e=c(Se($()));if(!e)return;let t=e.querySelector("li.current-page");t&&(t.scrollIntoView(),e.scrollTop-=40)}function zt(){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&&Ve(s.closest("li"));let o=r.querySelector(`li.current-page a[href$="#${e}"]`);if(o){let a=o.closest("ul");a.classList.contains("deflist")&&Wi(a.closest("li")),Ki(o.closest("li"))}}function Ji(){qe.forEach(t=>{let n=c(`#${t}-list-tab-button`);n&&n.addEventListener("click",i=>{be(t),Bt()})});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&&Yi(i),zt()})}var B={module:"module",moduleChild:"module-child",mixTask:"mix-task",extra:"extra",section:"section"};function qt(e,t=8){if(ne(e))return[];let n=le(),i=[...je(n.modules,e,B.module,"module"),...Xi(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 sr(i).slice(0,t)}function je(e,t,n,i){return e.map(r=>er(r,t,n,i))}function Xi(e,t,n){return e.filter(i=>i.nodeGroups).flatMap(i=>i.nodeGroups.flatMap(({key:r,nodes:s})=>{let o=rr(r);return s.map(a=>tr(a,i.id,t,n,o)||ir(a,i.id,t,n,o))}))}function Ue(e,t,n,i){return e.flatMap(r=>Zi(r).map(s=>nr(r,s,t,n,i)))}function Zi(e){return(e.sections||[]).concat(e.headers||[])}function er(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 tr(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 nr(e,t,n,i,r){return Vt(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 ir(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 Vt(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 rr(e){switch(e){case"callbacks":return"callback";case"types":return"type";default:return"function"}}function sr(e){return e.slice().sort((t,n)=>t.matchQuality!==n.matchQuality?n.matchQuality-t.matchQuality:$t(t.category)-$t(n.category))}function $t(e){switch(e){case B.module:return 1;case B.moduleChild:return 2;case B.mixTask:return 3;default:return 4}}function Vt(e,t){return Te(t).some(i=>jt(e,i))}function Ee(e,t){return Te(t).every(i=>jt(e,i))}function jt(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=or(e,n[0])?1:0;return r+s}function or(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,G=null;function Ut(){G=document.getElementById("toast"),G.addEventListener("click",e=>{clearTimeout(ke),e.target.classList.remove("show")})}function We(e){G&&(clearTimeout(ke),G.innerText=e,G.classList.add("show"),ke=setTimeout(()=>{G.classList.remove("show"),ke=setTimeout(function(){G.innerText=""},1e3)},5e3))}var Wt="dark",Ge=["system","dark","light"];function Gt(e){_.getAndSubscribe(t=>{document.body.classList.toggle(Wt,Yt(e||t.theme))}),cr()}function Kt(){let e=Ge[Ge.indexOf(Ke())+1]||Ge[0];_.update({theme:e}),We(`Set theme to "${e}"`)}function Ke(){return _.get().theme||"system"}function Yt(e){return e==="dark"||ar()&&(e==null||e==="system")}function ar(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function cr(){window.matchMedia("(prefers-color-scheme: dark)").addListener(e=>{let t=_.get().theme,n=Yt(t);(t==null||t==="system")&&(document.body.classList.toggle(Wt,n),We(`Browser changed theme to "${n?"dark":"light"}"`))})}var se=".autocomplete",_e=".autocomplete-suggestions",Oe=".autocomplete-suggestion",I={autocompleteSuggestions:[],previewOpen:!1,selectedIdx:-1};function lr(){c(se).classList.add("shown")}function Ye(){c(se).classList.remove("shown")}function Jt(){return c(se).classList.contains("shown")}function Je(e){I.autocompleteSuggestions=qt(e),I.selectedIdx=-1,ne(e)?Ye():(ur({term:e,suggestions:I.autocompleteSuggestions}),Ie(0),lr())}function ur({term:e,suggestions:t}){let n=Handlebars.templates["autocomplete-suggestions"]({suggestions:t,term:e}),i=c(se);i.innerHTML=n}function Xt(){return I.selectedIdx===-1?null:I.autocompleteSuggestions[I.selectedIdx]}function Ie(e){en(dr(e))}function Zt(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 en(e){I.selectedIdx=e;let t=c(_e),n=c(`${Oe}.selected`),i=c(`${Oe}[data-index="${I.selectedIdx}"]`);if(n&&n.classList.remove("selected"),i){if(I.previewOpen){nn(),window.addEventListener("message",Zt),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 tn(){I.previewOpen?Ce():Xe()}function Ce(){I.previewOpen=!1;let e=c(_e);e&&e.classList.remove("previewing"),nn()}function Xe(e){I.previewOpen=!0,e?e=e.closest(Oe):e=c(`${Oe}[data-index="${I.selectedIdx}"]`),e&&en(parseInt(e.dataset.index))}function nn(){let e=c(".autocomplete-preview");e&&(e.remove(),window.removeEventListener("message",Zt))}function dr(e){let t=I.autocompleteSuggestions.length+1;return(I.selectedIdx+e+1+t)%t-1}var ue="form.search-bar input",fr="form.search-bar .search-close-button";function on(){pr(),window.onTogglePreviewClick=function(e,t){e.preventDefault(),e.stopImmediatePropagation(),et(),t?Xe(e.target):Ce()}}function an(e){let t=c(ue);t.value=e}function et(){let e=c(ue);document.body.classList.add("search-focused"),e.focus()}function pr(){let e=c(ue);if(document.querySelector('meta[name="exdoc:autocomplete"][content="off"]'))return e.addEventListener("keydown",t=>{t.key==="Enter"&&rn(t)}),!0;e.addEventListener("keydown",t=>{let n=ie();t.key==="Escape"?(Ae(),e.blur()):t.key==="Enter"?rn(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"&&(tn(),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(_e);if(n&&i&&i.contains(n))return setTimeout(()=>{Jt()&&e.focus()},1e3),null;Pe()}),c(se).addEventListener("click",t=>{t.shiftKey||t.ctrlKey?e.focus():(Ae(),Pe())}),c(fr).addEventListener("click",t=>{Ae(),Pe()})}function rn(e){let t=c(ue),n=e.shiftKey||e.ctrlKey,i=Xt();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,hr=70,sn=-2;window.addEventListener("scroll",function(){let e=window.scrollY;e===0||Ze-ehr?document.body.classList.remove("scroll-sticky"):Ze-e>Math.abs(sn)&&document.body.classList.add("scroll-sticky"),Ze=e<=0?0:e},!1);var cn=".sidebar-projectVersion",ln=".sidebar-projectVersionsDropdown";function un(){let e=Dt();if(e.length>0){let n=c(cn).textContent.trim(),i=gr(e,n);mr({nodes:i})}}function mr({nodes:e}){let t=c(cn),n=Handlebars.templates["versions-dropdown"]({nodes:e});t.innerHTML=n,c(ln).addEventListener("change",vr)}function gr(e,t){return yr(e,t).map(i=>({...i,isCurrentVersion:i.version===t}))}function yr(e,t){return e.some(i=>i.version===t)?e:[{version:t,url:"#"},...e]}function vr(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(ln);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(pn());var Re=80,br="#search";function mn(){let e=window.location.pathname;if(e.endsWith("/search.html")||e.endsWith("/search")){let t=vt("q");Sr(t)}}async function Sr(e){if(ne(e))nt({value:e});else{an(e);let t=await xr();try{let n=e.replaceAll(/(\B|\\):/g,"\\:"),i=Ar(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(br),r=Handlebars.templates["search-results"]({value:e,results:t,errorMessage:n});i.innerHTML=r}async function xr(){H.default.tokenizer.separator=/\s+/,H.default.QueryLexer.termSeparator=/\s+/,H.default.Pipeline.registerFunction(yn,"docTokenSplitter"),H.default.Pipeline.registerFunction(vn,"docTrimmer");let e=await Er();if(e)return e;let t=_r();return Lr(t),t}async function Er(){try{let e=sessionStorage.getItem(gn());if(e){let t=await wr(e);return H.default.Index.load(t)}else return null}catch(e){return console.error("Failed to load index: ",e),null}}async function Lr(e){try{let t=await Tr(e);sessionStorage.setItem(gn(),t)}catch(t){console.error("Failed to save index: ",t)}}async function Tr(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 kr(i)}async function wr(e){let t=new Blob([Or(e)],{type:"application/json"}).stream().pipeThrough(new window.DecompressionStream("gzip")),n=await new Response(t).text();return JSON.parse(n)}function kr(e){let t="",n=new Uint8Array(e),i=n.byteLength;for(let r=0;r{this.add(e)})})}function Ir(e){e.pipeline.before(H.default.stemmer,yn)}function yn(e){let t=e.toString().split(/\:|\.|\/|_|-/).map(n=>e.clone().update(()=>n));return t.length>1?[...t,e]:t}function Cr(e){e.pipeline.before(H.default.stemmer,vn)}function vn(e){return e.update(function(t){return t.replace(/^[^@:\w]+/,"").replace(/[^\?\!\w]+$/,"")})}function Ar(e){return e.filter(t=>hn(t.ref)).map(t=>{let n=hn(t.ref),i=t.matchData.metadata;return{...n,metadata:i,excerpts:Pr(n,i)}})}function hn(e){return searchData.items.find(t=>t.ref===e)||null}function Pr(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])=>Rr(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=>{bn(n,!0)}),t.addEventListener("mouseleave",i=>{bn(n,!1)})})}function bn(e,t){k(`[data-group-id="${e}"]`).forEach(i=>{i.classList.toggle(Nr,t)})}var Y=".modal",Hr=".modal .modal-close",Fr=".modal .modal-title",Dr=".modal .modal-body",xn='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 En(){Mr()}function Mr(){let e=Handlebars.templates["modal-layout"]();document.body.insertAdjacentHTML("beforeend",e),c(Y).addEventListener("keydown",t=>{t.key==="Escape"&&K()}),c(Hr).addEventListener("click",t=>{K()}),c(Y).addEventListener("click",t=>{t.target.classList.contains("modal")&&K()})}function Ln(e){if(z.ignoreFocusChanges)return;let t=c(Y);if(t.contains(e.target))z.lastFocus=e.target;else{z.ignoreFocusChanges=!0;let n=Br(t);z.lastFocus===n?zr(t).focus():n.focus(),z.ignoreFocusChanges=!1,z.lastFocus=document.activeElement}}function Br(e){return e.querySelector(xn)}function zr(e){let t=e.querySelectorAll(xn);return t[t.length-1]}function Ne({title:e,body:t}){z.prevFocus=document.activeElement,document.addEventListener("focus",Ln,!0),c(Fr).innerHTML=e,c(Dr).innerHTML=t,c(Y).classList.add("shown"),c(Y).focus()}function K(){c(Y).classList.remove("shown"),document.addEventListener("focus",Ln,!0),z.prevFocus&&z.prevFocus.focus(),z.prevFocus=null}function Tn(){return c(Y).classList.contains("shown")}var $r="https://hexdocs.pm/%%",qr="https://hex.pm/api/packages?search=name:%%*",Vr=".display-quick-switch",it="#quick-switch-input",kn="#quick-switch-results",jr=".quick-switch-result",Ur=300,Wr=9,Gr=["elixir","eex","ex_unit","hex","iex","logger","mix"].map(e=>({name:e})),On=2,P={autocompleteResults:[],selectedIdx:null};function _n(){Kr()}function Kr(){k(Vr).forEach(e=>{e.addEventListener("click",t=>{st()})})}function Yr(e){if(e.key==="Enter"){let t=e.target.value;Xr(t),e.preventDefault()}else e.key==="ArrowUp"?(wn(-1),e.preventDefault()):e.key==="ArrowDown"&&(wn(1),e.preventDefault())}function Jr(e){let t=e.target.value;if(t.lengthn.json()).then(n=>{Array.isArray(n)&&(P.autocompleteResults=ns(e,n),P.selectedIdx=null,c(it).value.length>=On&&ts({results:P.autocompleteResults}))})}function ts({results:e}){let t=c(kn),n=Handlebars.templates["quick-switch-results"]({results:e});t.innerHTML=n,k(jr).forEach(i=>{i.addEventListener("click",r=>{let s=i.getAttribute("data-index"),o=P.autocompleteResults[s];rt(o.name)})})}function ns(e,t){return Gr.concat(t).filter(n=>n.name.toLowerCase().includes(e.toLowerCase())).filter(n=>n.releases===void 0||n.releases[0].has_docs===!0).slice(0,Wr)}function wn(e){P.selectedIdx=is(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 is(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 rs=".display-settings",ss="#settings-modal-content",ot="#modal-settings-tab",at="#modal-keyboard-shortcuts-tab",Cn="#settings-content",An="#keyboard-shortcuts-content",os=[{title:"Settings",id:"modal-settings-tab"},{title:"Keyboard shortcuts",id:"modal-keyboard-shortcuts-tab"}];function Pn(){as()}function as(){k(rs).forEach(e=>{e.addEventListener("click",t=>{ct()})})}function In(){c(at).classList.remove("active"),c(ot).classList.add("active"),c(Cn).classList.remove("hidden"),c(An).classList.add("hidden")}function cs(){c(at).classList.add("active"),c(ot).classList.remove("active"),c(An).classList.remove("hidden"),c(Cn).classList.add("hidden")}function ct(){Ne({title:os.map(({id:s,title:o})=>``).join(""),body:Handlebars.templates["settings-modal-body"]({shortcuts:lt})});let e=c(ss),t=e.querySelector('[name="theme"]'),n=e.querySelector('[name="tooltips"]'),i=e.querySelector('[name="direct_livebook_url"]'),r=e.querySelector('[name="livebook_url"]');_.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=>{_.update({theme:s.target.value})}),n.addEventListener("change",s=>{_.update({tooltips:s.target.checked})}),i.addEventListener("change",s=>{let o=s.target.checked?r.value:null;_.update({livebookUrl:o})}),r.addEventListener("input",s=>{_.update({livebookUrl:s.target.value})}),c(ot).addEventListener("click",s=>{In()}),c(at).addEventListener("click",s=>{cs()}),In()}var ls="#settings-modal-content",lt=[{key:"c",description:"Toggle sidebar",action:Me},{key:"n",description:"Cycle themes",action:Kt},{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:ps},{key:"g",description:"Search HexDocs package",displayAs:"g",action:st},{key:"?",displayAs:"?",description:"Bring up this modal",action:hs}],dt={shortcutBeingPressed:null};function Rn(){us()}function us(){document.addEventListener("keydown",ds),document.addEventListener("keyup",fs)}function ds(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 fs(e){dt.shortcutBeingPressed=null}function ut(e){K(),et()}function ps(){K(),Qt()?tt():ze().then(tt)}function hs(){ms()?K():ct()}function ms(){return Tn()&&c(ls)}var J={plain:"plain",function:"function",module:"module"},gs=[{href:"typespecs.html#basic-types",hint:{kind:J.plain,description:"Basic type"}},{href:"typespecs.html#literals",hint:{kind:J.plain,description:"Literal"}},{href:"typespecs.html#built-in-types",hint:{kind:J.plain,description:"Built-in type"}}],Qe={cancelHintFetching:null};function Nn(e){if(Hn(e))return!0;let t=/#.*\//;return e.includes("#")&&!t.test(e)?!1:e.includes(".html")}function Qn(e){let t=Hn(e);return t?Promise.resolve(t):ys(e)}function Hn(e){let t=gs.find(n=>e.includes(n.href));return t?t.hint:null}function ys(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 Fn(){Qe.cancelHintFetching&&Qe.cancelHintFetching()}function Dn(e){let n=e.querySelector("h1").textContent,i=e.querySelector(".docstring > p"),r=i?i.innerHTML:"";return{kind:J.function,title:n.trim(),description:r.trim()}}function Mn(e){let n=e.querySelector("h1 > span").textContent,i=e.querySelector("#moduledoc p"),r=i?i.innerHTML:"";return{kind:J.module,title:n.trim(),description:r.trim()}}var vs=".content a",ft=".tooltip",bs=".tooltip .tooltip-body",zn="body .content-inner",Ss="#content",$n="tooltip-shown",de=10,xs=de*4,Bn={height:450,width:768},Es=100,oe={currentLinkElement:null,hoverDelayTimeout:null};function qn(){Ls(),Ts()}function Ls(){let e=Handlebars.templates["tooltip-layout"]();c(zn).insertAdjacentHTML("beforeend",e)}function Ts(){k(vs).forEach(e=>{ws(e)&&(e.addEventListener("mouseenter",t=>{Os(e)}),e.addEventListener("mouseleave",t=>{As(e)}))})}function ws(e){return!(e.getAttribute("data-no-tooltip")!==null||ks(e.href)||!Nn(e.href))}function ks(e){let t=e.replace(Ss,"");return window.location.href.split("#")[0]===t}function Os(e){_s()&&(oe.currentLinkElement=e,oe.hoverDelayTimeout=setTimeout(()=>{Qn(e.href).then(t=>{Is(t),Cs()}).catch(()=>{})},Es))}function _s(){let e=window.innerWidthe.firstElementChild&&e.firstElementChild.tagName==="CODE").forEach(e=>e.insertAdjacentHTML("beforeend",Bs)),Array.from(k(".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 Gn(){let e=ie()?"apple-os":"non-apple-os";document.documentElement.classList.add(e)}var $s="content",qs="tabs-open",Vs="tabs-close",js="H3",Us="tabset";function Yn(){Ws().map(Gs).forEach(n=>Js(n))}function Ws(){let e=document.createNodeIterator(document.getElementById($s),NodeFilter.SHOW_COMMENT,{acceptNode(i){return i.nodeValue.trim()===qs?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),t=[],n;for(;n=e.nextNode();)t.push(n);return t}function Gs(e,t,n){let i=[],r=[],s={label:"",content:[]};for(;e=e.nextSibling;){if(Ks(e)){Kn(s,r,t);break}i.push(e),e.nodeName===js?(Kn(s,r,t),s.label=e.innerText,s.content=[]):s.content.push(e.outerHTML)}let o=document.createElement("div");return o.className=Us,Ys(i,o),o.innerHTML=Handlebars.templates.tabset({tabs:r}),o}function Ks(e){return e.nodeName==="#comment"&&e.nodeValue.trim()===Vs}function Kn(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 Ys(e,t){if(!e||!e.length)return!1;e[0].parentNode.insertBefore(t,e[0]),e.forEach(n=>t.appendChild(n))}function Js(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=>{X(i,t)}),n.addEventListener("keydown",r=>{let s=t.tabs.length-1;r.code==="ArrowLeft"?(r.preventDefault(),t.activeIndex===0?X(s,t):X(t.activeIndex-1,t)):r.code==="ArrowRight"?(r.preventDefault(),t.activeIndex===s?X(0,t):X(t.activeIndex+1,t)):r.code==="Home"?(r.preventDefault(),X(0,t)):r.code==="End"&&(r.preventDefault(),X(s,t))})})}function X(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}function Xn(){let e=ge(te(),!0);e&&Xs(e)}function Xs(e){to(e),Zs(),eo(),Jn(),window.addEventListener("resize",t=>{Jn()})}function Jn(){let e=document.body.scrollHeight,t=document.getElementById("content").parentElement.offsetHeight,n={type:"preview",maxHeight:e,contentHeight:t};window.parent.postMessage(n,"*")}function Zs(){let e=document.getElementsByTagName("a");for(let t of e)t.getAttribute("target")!=="_blank"&&t.setAttribute("target","_parent")}function eo(){window.scrollTo(0,0)}function to(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");Gt(e.get("theme")),Tt(t),Sn(),qn(),Un(),Wn(),Gn(),Yn(),t?Xn():(un(),Pt(),Mt(),on(),En(),Rn(),_n(),Ut(),mn(),Pn())});})(); +`,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 dn=="object"?fn.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),k=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())?li(n):null:null}function li(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 Et="ex_doc:settings",ui={tooltips:!0,theme:null,livebookUrl:null},He=class{constructor(){this._subscribers=[],this._settings=ui,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(Et);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(Et,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"))}},_=new He;var di=".content",Lt=".content-inner",fi=".livebook-badge";function Tt(e){e||mi(),gi(),pi(),hi()}function pi(){c(di).querySelectorAll("a").forEach(e=>{e.querySelector("code, img")&&e.classList.add("no-underline")})}function hi(){["warning","info","error","neutral","tip"].forEach(t=>{k(`blockquote h3.${t}, blockquote h4.${t}`).forEach(n=>{n.closest("blockquote").classList.add(t)})})}function mi(){c(Lt).setAttribute("tabindex",-1),c(Lt).focus()}function gi(){let t=window.location.pathname.replace(/(\.html)?$/,".livemd"),n=new URL(t,window.location.href).toString();_.getAndSubscribe(i=>{let r=i.livebookUrl?vi(i.livebookUrl,n):yi(n);for(let s of k(fi))s.href=r})}function yi(e){return`https://livebook.dev/run?url=${encodeURIComponent(e)}`}function vi(e,t){return`${e}/import?url=${encodeURIComponent(t)}`}var At=mt(It());var Hi=768,De=300,re=".sidebar-toggle",Fi=".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"},Di=Object.values(N),A={togglingTimeout:null,lastWindowWidth:window.innerWidth,sidebarPreference:M.NO_PREF};function Pt(){Rt(),Mi(),Bi()}function Mi(){let e=sessionStorage.getItem("sidebar_width");e&&Ct(e),new ResizeObserver(n=>{for(let i of n)Ct(i.contentRect.width)}).observe(document.getElementById("sidebar"))}function Ct(e){sessionStorage.setItem("sidebar_width",e),document.body.style.setProperty("--sidebarWidth",`${e}px`)}function Rt(){sessionStorage.getItem("sidebar_state")==="closed"||Nt()?(q(N.closed),c(re).setAttribute("aria-expanded","false")):(q(N.opened),c(re).setAttribute("aria-expanded","true")),setTimeout(()=>c(re).classList.add("sidebar-toggle--animated"),De)}function Nt(){return window.matchMedia(`screen and (max-width: ${Hi}px)`).matches}function q(...e){document.body.classList.remove(...Di),document.body.classList.add(...e)}function Bi(){c(re).addEventListener("click",e=>{Me(),qi()}),c(Fi).addEventListener("click",e=>{$i()}),window.addEventListener("resize",(0,At.default)(e=>{zi()},100))}function Me(){return Be()?Ht():ze()}function Be(){return document.body.classList.contains(N.opened)||document.body.classList.contains(N.opening)}function Qt(){return document.body.classList.contains(N.opened)}function ze(){return Ft(),sessionStorage.setItem("sidebar_state","opened"),c(re).setAttribute("aria-expanded","true"),new Promise((e,t)=>{requestAnimationFrame(()=>{q(N.openingStart),requestAnimationFrame(()=>{q(N.opening),A.togglingTimeout=setTimeout(()=>{q(N.opened),e()},De)})})})}function Ht(){return Ft(),sessionStorage.setItem("sidebar_state","closed"),c(re).setAttribute("aria-expanded","false"),new Promise((e,t)=>{requestAnimationFrame(()=>{q(N.closingStart),requestAnimationFrame(()=>{q(N.closing),A.togglingTimeout=setTimeout(()=>{q(N.closed),e()},De)})})})}function Ft(){A.togglingTimeout&&(clearTimeout(A.togglingTimeout),A.togglingTimeout=null)}function zi(){A.lastWindowWidth!==window.innerWidth&&(A.lastWindowWidth=window.innerWidth,(A.sidebarPreference===M.OPEN||A.sidebarPreference===M.NO_PREF)&&Rt())}function $i(){Nt()&&Be()&&Ht()}function qi(){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 Dt(){return window.versionNodes||[]}var $e={search:"search",extras:"extras",modules:"modules",tasks:"tasks"},qe=[$e.extras,$e.modules,$e.tasks],Se=e=>`#${e}-full-list`;function Mt(){qe.forEach(e=>{Vi(le(),e)}),be($()),zt(),Bt(),Ji()}function Vi(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");Ui(l)})}),i.querySelectorAll("li a").forEach(s=>{s.addEventListener("click",o=>{let l=o.target.closest("li"),u=i.querySelector(".current-section");u&&Gi(u),s.matches(".expand")&&(s.pathname===window.location.pathname||s.pathname===window.location.pathname+".html")&&Ve(l)})})}function Ve(e){e.classList.add("open"),e.querySelector("button[aria-controls]").setAttribute("aria-expanded","true")}function ji(e){e.classList.remove("open"),e.querySelector("button[aria-controls]").setAttribute("aria-expanded","false")}function Ui(e){e.classList.contains("open")?ji(e):Ve(e)}function Wi(e){e.classList.add("current-section"),e.querySelector("a").setAttribute("aria-current","true")}function Gi(e){e.classList.remove("current-section"),e.querySelector("a").setAttribute("aria-current","false")}function Ki(e){e.classList.add("current-hash"),e.querySelector("a").setAttribute("aria-current","true")}function Yi(e){e.classList.remove("current-hash"),e.querySelector("a").setAttribute("aria-current","false")}function be(e){qe.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 Bt(){let e=c(Se($()));if(!e)return;let t=e.querySelector("li.current-page");t&&(t.scrollIntoView(),e.scrollTop-=40)}function zt(){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&&Ve(s.closest("li"));let o=r.querySelector(`li.current-page a[href$="#${e}"]`);if(o){let a=o.closest("ul");a.classList.contains("deflist")&&Wi(a.closest("li")),Ki(o.closest("li"))}}function Ji(){qe.forEach(t=>{let n=c(`#${t}-list-tab-button`);n&&n.addEventListener("click",i=>{be(t),Bt()})});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&&Yi(i),zt()})}var B={module:"module",moduleChild:"module-child",mixTask:"mix-task",extra:"extra",section:"section"};function qt(e,t=8){if(ne(e))return[];let n=le(),i=[...je(n.modules,e,B.module,"module"),...Xi(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 sr(i).slice(0,t)}function je(e,t,n,i){return e.map(r=>er(r,t,n,i))}function Xi(e,t,n){return e.filter(i=>i.nodeGroups).flatMap(i=>i.nodeGroups.flatMap(({key:r,nodes:s})=>{let o=rr(r);return s.map(a=>tr(a,i.id,t,n,o)||ir(a,i.id,t,n,o))}))}function Ue(e,t,n,i){return e.flatMap(r=>Zi(r).map(s=>nr(r,s,t,n,i)))}function Zi(e){return(e.sections||[]).concat(e.headers||[])}function er(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 tr(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 nr(e,t,n,i,r){return Vt(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 ir(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 Vt(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 rr(e){switch(e){case"callbacks":return"callback";case"types":return"type";default:return"function"}}function sr(e){return e.slice().sort((t,n)=>t.matchQuality!==n.matchQuality?n.matchQuality-t.matchQuality:$t(t.category)-$t(n.category))}function $t(e){switch(e){case B.module:return 1;case B.moduleChild:return 2;case B.mixTask:return 3;default:return 4}}function Vt(e,t){return Te(t).some(i=>jt(e,i))}function Ee(e,t){return Te(t).every(i=>jt(e,i))}function jt(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=or(e,n[0])?1:0;return r+s}function or(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,G=null;function Ut(){G=document.getElementById("toast"),G.addEventListener("click",e=>{clearTimeout(ke),e.target.classList.remove("show")})}function We(e){G&&(clearTimeout(ke),G.innerText=e,G.classList.add("show"),ke=setTimeout(()=>{G.classList.remove("show"),ke=setTimeout(function(){G.innerText=""},1e3)},5e3))}var Wt="dark",Ge=["system","dark","light"];function Gt(e){_.getAndSubscribe(t=>{document.body.classList.toggle(Wt,Yt(e||t.theme))}),cr()}function Kt(){let e=Ge[Ge.indexOf(Ke())+1]||Ge[0];_.update({theme:e}),We(`Set theme to "${e}"`)}function Ke(){return _.get().theme||"system"}function Yt(e){return e==="dark"||ar()&&(e==null||e==="system")}function ar(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function cr(){window.matchMedia("(prefers-color-scheme: dark)").addListener(e=>{let t=_.get().theme,n=Yt(t);(t==null||t==="system")&&(document.body.classList.toggle(Wt,n),We(`Browser changed theme to "${n?"dark":"light"}"`))})}var se=".autocomplete",_e=".autocomplete-suggestions",Oe=".autocomplete-suggestion",I={autocompleteSuggestions:[],previewOpen:!1,selectedIdx:-1};function lr(){c(se).classList.add("shown")}function Ye(){c(se).classList.remove("shown")}function Jt(){return c(se).classList.contains("shown")}function Je(e){I.autocompleteSuggestions=qt(e),I.selectedIdx=-1,ne(e)?Ye():(ur({term:e,suggestions:I.autocompleteSuggestions}),Ie(0),lr())}function ur({term:e,suggestions:t}){let n=Handlebars.templates["autocomplete-suggestions"]({suggestions:t,term:e}),i=c(se);i.innerHTML=n}function Xt(){return I.selectedIdx===-1?null:I.autocompleteSuggestions[I.selectedIdx]}function Ie(e){en(dr(e))}function Zt(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 en(e){I.selectedIdx=e;let t=c(_e),n=c(`${Oe}.selected`),i=c(`${Oe}[data-index="${I.selectedIdx}"]`);if(n&&n.classList.remove("selected"),i){if(I.previewOpen){nn(),window.addEventListener("message",Zt),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 tn(){I.previewOpen?Ce():Xe()}function Ce(){I.previewOpen=!1;let e=c(_e);e&&e.classList.remove("previewing"),nn()}function Xe(e){I.previewOpen=!0,e?e=e.closest(Oe):e=c(`${Oe}[data-index="${I.selectedIdx}"]`),e&&en(parseInt(e.dataset.index))}function nn(){let e=c(".autocomplete-preview");e&&(e.remove(),window.removeEventListener("message",Zt))}function dr(e){let t=I.autocompleteSuggestions.length+1;return(I.selectedIdx+e+1+t)%t-1}var ue="form.search-bar input",fr="form.search-bar .search-close-button";function on(){pr(),window.onTogglePreviewClick=function(e,t){e.preventDefault(),e.stopImmediatePropagation(),et(),t?Xe(e.target):Ce()}}function an(e){let t=c(ue);t.value=e}function et(){let e=c(ue);document.body.classList.add("search-focused"),e.focus()}function pr(){let e=c(ue);if(document.querySelector('meta[name="exdoc:autocomplete"][content="off"]'))return e.addEventListener("keydown",t=>{t.key==="Enter"&&rn(t)}),!0;e.addEventListener("keydown",t=>{let n=ie();t.key==="Escape"?(Ae(),e.blur()):t.key==="Enter"?rn(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"&&(tn(),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(_e);if(n&&i&&i.contains(n))return setTimeout(()=>{Jt()&&e.focus()},1e3),null;Pe()}),c(se).addEventListener("click",t=>{t.shiftKey||t.ctrlKey?e.focus():(Ae(),Pe())}),c(fr).addEventListener("click",t=>{Ae(),Pe()})}function rn(e){let t=c(ue),n=e.shiftKey||e.ctrlKey,i=Xt();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,hr=70,sn=-2;window.addEventListener("scroll",function(){let e=window.scrollY;e===0||Ze-ehr?document.body.classList.remove("scroll-sticky"):Ze-e>Math.abs(sn)&&document.body.classList.add("scroll-sticky"),Ze=e<=0?0:e},!1);var cn=".sidebar-projectVersion",ln=".sidebar-projectVersionsDropdown";function un(){let e=Dt();if(e.length>0){let n=c(cn).textContent.trim(),i=gr(e,n);mr({nodes:i})}}function mr({nodes:e}){let t=c(cn),n=Handlebars.templates["versions-dropdown"]({nodes:e});t.innerHTML=n,c(ln).addEventListener("change",vr)}function gr(e,t){return yr(e,t).map(i=>({...i,isCurrentVersion:i.version===t}))}function yr(e,t){return e.some(i=>i.version===t)?e:[{version:t,url:"#"},...e]}function vr(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(ln);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(pn());var Re=80,br="#search";function mn(){let e=window.location.pathname;if(e.endsWith("/search.html")||e.endsWith("/search")){let t=vt("q");Sr(t)}}async function Sr(e){if(ne(e))nt({value:e});else{an(e);let t=await xr();try{let n=e.replaceAll(/(\B|\\):/g,"\\:"),i=Ar(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(br),r=Handlebars.templates["search-results"]({value:e,results:t,errorMessage:n});i.innerHTML=r}async function xr(){H.default.tokenizer.separator=/\s+/,H.default.QueryLexer.termSeparator=/\s+/,H.default.Pipeline.registerFunction(yn,"docTokenSplitter"),H.default.Pipeline.registerFunction(vn,"docTrimmer");let e=await Er();if(e)return e;let t=_r();return Lr(t),t}async function Er(){try{let e=sessionStorage.getItem(gn());if(e){let t=await wr(e);return H.default.Index.load(t)}else return null}catch(e){return console.error("Failed to load index: ",e),null}}async function Lr(e){try{let t=await Tr(e);sessionStorage.setItem(gn(),t)}catch(t){console.error("Failed to save index: ",t)}}async function Tr(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 kr(i)}async function wr(e){let t=new Blob([Or(e)],{type:"application/json"}).stream().pipeThrough(new window.DecompressionStream("gzip")),n=await new Response(t).text();return JSON.parse(n)}function kr(e){let t="",n=new Uint8Array(e),i=n.byteLength;for(let r=0;r{this.add(e)})})}function Ir(e){e.pipeline.before(H.default.stemmer,yn)}function yn(e){let t=[e],n=/\/\d+$/,i=/\:|\./,r=e.toString();if(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]}let s=r.split(/\_|\-/);if(s.length>1)for(let o of s)t.push(e.clone().update(()=>o));return t}function Cr(e){e.pipeline.before(H.default.stemmer,vn)}function vn(e){return e.update(function(t){return t.replace(/^[^@:\w]+/,"").replace(/[^\?\!\w]+$/,"")})}function Ar(e){return e.filter(t=>hn(t.ref)).map(t=>{let n=hn(t.ref),i=t.matchData.metadata;return{...n,metadata:i,excerpts:Pr(n,i)}})}function hn(e){return searchData.items.find(t=>t.ref===e)||null}function Pr(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])=>Rr(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=>{bn(n,!0)}),t.addEventListener("mouseleave",i=>{bn(n,!1)})})}function bn(e,t){k(`[data-group-id="${e}"]`).forEach(i=>{i.classList.toggle(Nr,t)})}var Y=".modal",Hr=".modal .modal-close",Fr=".modal .modal-title",Dr=".modal .modal-body",xn='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 En(){Mr()}function Mr(){let e=Handlebars.templates["modal-layout"]();document.body.insertAdjacentHTML("beforeend",e),c(Y).addEventListener("keydown",t=>{t.key==="Escape"&&K()}),c(Hr).addEventListener("click",t=>{K()}),c(Y).addEventListener("click",t=>{t.target.classList.contains("modal")&&K()})}function Ln(e){if(z.ignoreFocusChanges)return;let t=c(Y);if(t.contains(e.target))z.lastFocus=e.target;else{z.ignoreFocusChanges=!0;let n=Br(t);z.lastFocus===n?zr(t).focus():n.focus(),z.ignoreFocusChanges=!1,z.lastFocus=document.activeElement}}function Br(e){return e.querySelector(xn)}function zr(e){let t=e.querySelectorAll(xn);return t[t.length-1]}function Ne({title:e,body:t}){z.prevFocus=document.activeElement,document.addEventListener("focus",Ln,!0),c(Fr).innerHTML=e,c(Dr).innerHTML=t,c(Y).classList.add("shown"),c(Y).focus()}function K(){c(Y).classList.remove("shown"),document.addEventListener("focus",Ln,!0),z.prevFocus&&z.prevFocus.focus(),z.prevFocus=null}function Tn(){return c(Y).classList.contains("shown")}var $r="https://hexdocs.pm/%%",qr="https://hex.pm/api/packages?search=name:%%*",Vr=".display-quick-switch",it="#quick-switch-input",kn="#quick-switch-results",jr=".quick-switch-result",Ur=300,Wr=9,Gr=["elixir","eex","ex_unit","hex","iex","logger","mix"].map(e=>({name:e})),On=2,P={autocompleteResults:[],selectedIdx:null};function _n(){Kr()}function Kr(){k(Vr).forEach(e=>{e.addEventListener("click",t=>{st()})})}function Yr(e){if(e.key==="Enter"){let t=e.target.value;Xr(t),e.preventDefault()}else e.key==="ArrowUp"?(wn(-1),e.preventDefault()):e.key==="ArrowDown"&&(wn(1),e.preventDefault())}function Jr(e){let t=e.target.value;if(t.lengthn.json()).then(n=>{Array.isArray(n)&&(P.autocompleteResults=ns(e,n),P.selectedIdx=null,c(it).value.length>=On&&ts({results:P.autocompleteResults}))})}function ts({results:e}){let t=c(kn),n=Handlebars.templates["quick-switch-results"]({results:e});t.innerHTML=n,k(jr).forEach(i=>{i.addEventListener("click",r=>{let s=i.getAttribute("data-index"),o=P.autocompleteResults[s];rt(o.name)})})}function ns(e,t){return Gr.concat(t).filter(n=>n.name.toLowerCase().includes(e.toLowerCase())).filter(n=>n.releases===void 0||n.releases[0].has_docs===!0).slice(0,Wr)}function wn(e){P.selectedIdx=is(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 is(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 rs=".display-settings",ss="#settings-modal-content",ot="#modal-settings-tab",at="#modal-keyboard-shortcuts-tab",Cn="#settings-content",An="#keyboard-shortcuts-content",os=[{title:"Settings",id:"modal-settings-tab"},{title:"Keyboard shortcuts",id:"modal-keyboard-shortcuts-tab"}];function Pn(){as()}function as(){k(rs).forEach(e=>{e.addEventListener("click",t=>{ct()})})}function In(){c(at).classList.remove("active"),c(ot).classList.add("active"),c(Cn).classList.remove("hidden"),c(An).classList.add("hidden")}function cs(){c(at).classList.add("active"),c(ot).classList.remove("active"),c(An).classList.remove("hidden"),c(Cn).classList.add("hidden")}function ct(){Ne({title:os.map(({id:s,title:o})=>``).join(""),body:Handlebars.templates["settings-modal-body"]({shortcuts:lt})});let e=c(ss),t=e.querySelector('[name="theme"]'),n=e.querySelector('[name="tooltips"]'),i=e.querySelector('[name="direct_livebook_url"]'),r=e.querySelector('[name="livebook_url"]');_.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=>{_.update({theme:s.target.value})}),n.addEventListener("change",s=>{_.update({tooltips:s.target.checked})}),i.addEventListener("change",s=>{let o=s.target.checked?r.value:null;_.update({livebookUrl:o})}),r.addEventListener("input",s=>{_.update({livebookUrl:s.target.value})}),c(ot).addEventListener("click",s=>{In()}),c(at).addEventListener("click",s=>{cs()}),In()}var ls="#settings-modal-content",lt=[{key:"c",description:"Toggle sidebar",action:Me},{key:"n",description:"Cycle themes",action:Kt},{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:ps},{key:"g",description:"Search HexDocs package",displayAs:"g",action:st},{key:"?",displayAs:"?",description:"Bring up this modal",action:hs}],dt={shortcutBeingPressed:null};function Rn(){us()}function us(){document.addEventListener("keydown",ds),document.addEventListener("keyup",fs)}function ds(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 fs(e){dt.shortcutBeingPressed=null}function ut(e){K(),et()}function ps(){K(),Qt()?tt():ze().then(tt)}function hs(){ms()?K():ct()}function ms(){return Tn()&&c(ls)}var J={plain:"plain",function:"function",module:"module"},gs=[{href:"typespecs.html#basic-types",hint:{kind:J.plain,description:"Basic type"}},{href:"typespecs.html#literals",hint:{kind:J.plain,description:"Literal"}},{href:"typespecs.html#built-in-types",hint:{kind:J.plain,description:"Built-in type"}}],Qe={cancelHintFetching:null};function Nn(e){if(Hn(e))return!0;let t=/#.*\//;return e.includes("#")&&!t.test(e)?!1:e.includes(".html")}function Qn(e){let t=Hn(e);return t?Promise.resolve(t):ys(e)}function Hn(e){let t=gs.find(n=>e.includes(n.href));return t?t.hint:null}function ys(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 Fn(){Qe.cancelHintFetching&&Qe.cancelHintFetching()}function Dn(e){let n=e.querySelector("h1").textContent,i=e.querySelector(".docstring > p"),r=i?i.innerHTML:"";return{kind:J.function,title:n.trim(),description:r.trim()}}function Mn(e){let n=e.querySelector("h1 > span").textContent,i=e.querySelector("#moduledoc p"),r=i?i.innerHTML:"";return{kind:J.module,title:n.trim(),description:r.trim()}}var vs=".content a",ft=".tooltip",bs=".tooltip .tooltip-body",zn="body .content-inner",Ss="#content",$n="tooltip-shown",de=10,xs=de*4,Bn={height:450,width:768},Es=100,oe={currentLinkElement:null,hoverDelayTimeout:null};function qn(){Ls(),Ts()}function Ls(){let e=Handlebars.templates["tooltip-layout"]();c(zn).insertAdjacentHTML("beforeend",e)}function Ts(){k(vs).forEach(e=>{ws(e)&&(e.addEventListener("mouseenter",t=>{Os(e)}),e.addEventListener("mouseleave",t=>{As(e)}))})}function ws(e){return!(e.getAttribute("data-no-tooltip")!==null||ks(e.href)||!Nn(e.href))}function ks(e){let t=e.replace(Ss,"");return window.location.href.split("#")[0]===t}function Os(e){_s()&&(oe.currentLinkElement=e,oe.hoverDelayTimeout=setTimeout(()=>{Qn(e.href).then(t=>{Is(t),Cs()}).catch(()=>{})},Es))}function _s(){let e=window.innerWidthe.firstElementChild&&e.firstElementChild.tagName==="CODE").forEach(e=>e.insertAdjacentHTML("beforeend",Bs)),Array.from(k(".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 Gn(){let e=ie()?"apple-os":"non-apple-os";document.documentElement.classList.add(e)}var $s="content",qs="tabs-open",Vs="tabs-close",js="H3",Us="tabset";function Yn(){Ws().map(Gs).forEach(n=>Js(n))}function Ws(){let e=document.createNodeIterator(document.getElementById($s),NodeFilter.SHOW_COMMENT,{acceptNode(i){return i.nodeValue.trim()===qs?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),t=[],n;for(;n=e.nextNode();)t.push(n);return t}function Gs(e,t,n){let i=[],r=[],s={label:"",content:[]};for(;e=e.nextSibling;){if(Ks(e)){Kn(s,r,t);break}i.push(e),e.nodeName===js?(Kn(s,r,t),s.label=e.innerText,s.content=[]):s.content.push(e.outerHTML)}let o=document.createElement("div");return o.className=Us,Ys(i,o),o.innerHTML=Handlebars.templates.tabset({tabs:r}),o}function Ks(e){return e.nodeName==="#comment"&&e.nodeValue.trim()===Vs}function Kn(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 Ys(e,t){if(!e||!e.length)return!1;e[0].parentNode.insertBefore(t,e[0]),e.forEach(n=>t.appendChild(n))}function Js(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=>{X(i,t)}),n.addEventListener("keydown",r=>{let s=t.tabs.length-1;r.code==="ArrowLeft"?(r.preventDefault(),t.activeIndex===0?X(s,t):X(t.activeIndex-1,t)):r.code==="ArrowRight"?(r.preventDefault(),t.activeIndex===s?X(0,t):X(t.activeIndex+1,t)):r.code==="Home"?(r.preventDefault(),X(0,t)):r.code==="End"&&(r.preventDefault(),X(s,t))})})}function X(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}function Xn(){let e=ge(te(),!0);e&&Xs(e)}function Xs(e){to(e),Zs(),eo(),Jn(),window.addEventListener("resize",t=>{Jn()})}function Jn(){let e=document.body.scrollHeight,t=document.getElementById("content").parentElement.offsetHeight,n={type:"preview",maxHeight:e,contentHeight:t};window.parent.postMessage(n,"*")}function Zs(){let e=document.getElementsByTagName("a");for(let t of e)t.getAttribute("target")!=="_blank"&&t.setAttribute("target","_parent")}function eo(){window.scrollTo(0,0)}function to(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");Gt(e.get("theme")),Tt(t),Sn(),qn(),Un(),Wn(),Gn(),Yn(),t?Xn():(un(),Pt(),Mt(),on(),En(),Rn(),_n(),Ut(),mn(),Pn())});})(); /*! Bundled license information: lunr/lunr.js: