mirror of
https://github.com/plausible/analytics.git
synced 2024-11-23 20:13:31 +03:00
57 lines
65 KiB
JavaScript
57 lines
65 KiB
JavaScript
(()=>{var $n=Object.create;var it=Object.defineProperty;var Vn=Object.getOwnPropertyDescriptor;var jn=Object.getOwnPropertyNames;var Un=Object.getPrototypeOf,Wn=Object.prototype.hasOwnProperty;var st=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Gn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jn(t))!Wn.call(e,i)&&i!==n&&it(e,i,{get:()=>t[i],enumerable:!(r=Vn(t,i))||r.enumerable});return e};var ot=(e,t,n)=>(n=e!=null?$n(Un(e)):{},Gn(t||!e||!e.__esModule?it(n,"default",{value:e,enumerable:!0}):n,e));var St=st((Ws,vt)=>{var bt="Expected a function",gt=NaN,ir="[object Symbol]",sr=/^\s+|\s+$/g,or=/^[-+]0x[0-9a-f]+$/i,ar=/^0b[01]+$/i,cr=/^0o[0-7]+$/i,lr=parseInt,ur=typeof global=="object"&&global&&global.Object===Object&&global,dr=typeof self=="object"&&self&&self.Object===Object&&self,fr=ur||dr||Function("return this")(),hr=Object.prototype,pr=hr.toString,mr=Math.max,gr=Math.min,Qe=function(){return fr.Date.now()};function yr(e,t,n){var r,i,s,o,a,l,u=0,f=!1,y=!1,g=!0;if(typeof e!="function")throw new TypeError(bt);t=yt(t)||0,ge(n)&&(f=!!n.leading,y="maxWait"in n,s=y?mr(yt(n.maxWait)||0,t):s,g="trailing"in n?!!n.trailing:g);function L(S){var I=r,D=i;return r=i=void 0,u=S,o=e.apply(D,I),o}function v(S){return u=S,a=setTimeout(p,t),f?L(S):o}function T(S){var I=S-l,D=S-u,V=t-I;return y?gr(V,s-D):V}function m(S){var I=S-l,D=S-u;return l===void 0||I>=t||I<0||y&&D>=s}function p(){var S=Qe();if(m(S))return _(S);a=setTimeout(p,T(S))}function _(S){return a=void 0,g&&r?L(S):(r=i=void 0,o)}function w(){a!==void 0&&clearTimeout(a),u=0,r=l=i=a=void 0}function R(){return a===void 0?o:_(Qe())}function H(){var S=Qe(),I=m(S);if(r=arguments,i=this,l=S,I){if(a===void 0)return v(l);if(y)return a=setTimeout(p,t),L(l)}return a===void 0&&(a=setTimeout(p,t)),o}return H.cancel=w,H.flush=R,H}function br(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(bt);return ge(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),yr(e,t,{leading:r,maxWait:t,trailing:i})}function ge(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function vr(e){return!!e&&typeof e=="object"}function Sr(e){return typeof e=="symbol"||vr(e)&&pr.call(e)==ir}function yt(e){if(typeof e=="number")return e;if(Sr(e))return gt;if(ge(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ge(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(sr,"");var n=ar.test(e);return n||cr.test(e)?lr(e.slice(2),n?2:8):or.test(e)?gt:+e}vt.exports=br});var Gt=st((Ut,Wt)=>{(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),r=Object.keys(t),i=0;i<r.length;i++){var s=r[i],o=t[s];if(Array.isArray(o)){n[s]=o.slice();continue}if(typeof o=="string"||typeof o=="number"||typeof o=="boolean"){n[s]=o;continue}throw new TypeError("clone is not deep and does not support nested objects")}return n},e.FieldRef=function(t,n,r){this.docRef=t,this.fieldName=n,this._stringValue=r},e.FieldRef.joiner="/",e.FieldRef.fromString=function(t){var n=t.indexOf(e.FieldRef.joiner);if(n===-1)throw"malformed field ref string";var r=t.slice(0,n),i=t.slice(n+1);return new e.FieldRef(i,r,t)},e.FieldRef.prototype.toString=function(){return this._stringValue==null&&(this._stringValue=this.fieldName+e.FieldRef.joiner+this.docRef),this._stringValue};e.Set=function(t){if(this.elements=Object.create(null),t){this.length=t.length;for(var n=0;n<this.length;n++)this.elements[t[n]]=!0}else this.length=0},e.Set.complete={intersect:function(t){return t},union:function(){return this},contains:function(){return!0}},e.Set.empty={intersect:function(){return this},union:function(t){return t},contains:function(){return!1}},e.Set.prototype.contains=function(t){return!!this.elements[t]},e.Set.prototype.intersect=function(t){var n,r,i,s=[];if(t===e.Set.complete)return this;if(t===e.Set.empty)return t;this.length<t.length?(n=this,r=t):(n=t,r=this),i=Object.keys(n.elements);for(var o=0;o<i.length;o++){var a=i[o];a in r.elements&&s.push(a)}return new e.Set(s)},e.Set.prototype.union=function(t){return t===e.Set.complete?e.Set.complete:t===e.Set.empty?this:new e.Set(Object.keys(this.elements).concat(Object.keys(t.elements)))},e.idf=function(t,n){var r=0;for(var i in t)i!="_index"&&(r+=Object.keys(t[i]).length);var s=(n-r+.5)/(r+.5);return Math.log(1+Math.abs(s))},e.Token=function(t,n){this.str=t||"",this.metadata=n||{}},e.Token.prototype.toString=function(){return this.str},e.Token.prototype.update=function(t){return this.str=t(this.str,this.metadata),this},e.Token.prototype.clone=function(t){return t=t||function(n){return n},new e.Token(t(this.str,this.metadata),this.metadata)};e.tokenizer=function(t,n){if(t==null||t==null)return[];if(Array.isArray(t))return t.map(function(y){return new e.Token(e.utils.asString(y).toLowerCase(),e.utils.clone(n))});for(var r=t.toString().toLowerCase(),i=r.length,s=[],o=0,a=0;o<=i;o++){var l=r.charAt(o),u=o-a;if(l.match(e.tokenizer.separator)||o==i){if(u>0){var f=e.utils.clone(n)||{};f.position=[a,u],f.index=s.length,s.push(new e.Token(r.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(r){var i=e.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),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 r=this._stack.indexOf(t);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},e.Pipeline.prototype.before=function(t,n){e.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(t);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,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,r=0;r<n;r++){for(var i=this._stack[r],s=[],o=0;o<t.length;o++){var a=i(t[o],o,t);if(!(a==null||a===""))if(Array.isArray(a))for(var l=0;l<a.length;l++)s.push(a[l]);else s.push(a)}t=s}return t},e.Pipeline.prototype.runString=function(t,n){var r=new e.Token(t,n);return this.run([r]).map(function(i){return i.toString()})},e.Pipeline.prototype.reset=function(){this._stack=[]},e.Pipeline.prototype.toJSON=function(){return this._stack.map(function(t){return e.Pipeline.warnIfFunctionNotRegistered(t),t.label})};e.Vector=function(t){this._magnitude=0,this.elements=t||[]},e.Vector.prototype.positionForIndex=function(t){if(this.elements.length==0)return 0;for(var n=0,r=this.elements.length/2,i=r-n,s=Math.floor(i/2),o=this.elements[s*2];i>1&&(o<t&&(n=s),o>t&&(r=s),o!=t);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==t||o>t)return s*2;if(o<t)return(s+1)*2},e.Vector.prototype.insert=function(t,n){this.upsert(t,n,function(){throw"duplicate index"})},e.Vector.prototype.upsert=function(t,n,r){this._magnitude=0;var i=this.positionForIndex(t);this.elements[i]==t?this.elements[i+1]=r(this.elements[i+1],n):this.elements.splice(i,0,t,n)},e.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var t=0,n=this.elements.length,r=1;r<n;r+=2){var i=this.elements[r];t+=i*i}return this._magnitude=Math.sqrt(t)},e.Vector.prototype.dot=function(t){for(var n=0,r=this.elements,i=t.elements,s=r.length,o=i.length,a=0,l=0,u=0,f=0;u<s&&f<o;)a=r[u],l=i[f],a<l?u+=2:a>l?f+=2:a==l&&(n+=r[u+1]*i[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,r=0;n<this.elements.length;n+=2,r++)t[r]=this.elements[n];return t},e.Vector.prototype.toJSON=function(){return this.elements};e.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},n={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},r="[^aeiou]",i="[aeiouy]",s=r+"[^aeiouy]*",o=i+"[aeiou]*",a="^("+s+")?"+o+s,l="^("+s+")?"+o+s+"("+o+")?$",u="^("+s+")?"+o+s+o+s,f="^("+s+")?"+i,y=new RegExp(a),g=new RegExp(u),L=new RegExp(l),v=new RegExp(f),T=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,p=/^(.+?)eed$/,_=/^(.+?)(ed|ing)$/,w=/.$/,R=/(at|bl|iz)$/,H=new RegExp("([^aeiouylsz])\\1$"),S=new RegExp("^"+s+i+"[^aeiouwxy]$"),I=/^(.+?[^aeiou])y$/,D=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,V=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,re=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,ue=/^(.+?)(s|t)(ion)$/,j=/^(.+?)e$/,de=/ll$/,fe=new RegExp("^"+s+i+"[^aeiouwxy]$"),ie=function(d){var b,U,P,h,x,W,X;if(d.length<3)return d;if(P=d.substr(0,1),P=="y"&&(d=P.toUpperCase()+d.substr(1)),h=T,x=m,h.test(d)?d=d.replace(h,"$1$2"):x.test(d)&&(d=d.replace(x,"$1$2")),h=p,x=_,h.test(d)){var E=h.exec(d);h=y,h.test(E[1])&&(h=w,d=d.replace(h,""))}else if(x.test(d)){var E=x.exec(d);b=E[1],x=v,x.test(b)&&(d=b,x=R,W=H,X=S,x.test(d)?d=d+"e":W.test(d)?(h=w,d=d.replace(h,"")):X.test(d)&&(d=d+"e"))}if(h=I,h.test(d)){var E=h.exec(d);b=E[1],d=b+"i"}if(h=D,h.test(d)){var E=h.exec(d);b=E[1],U=E[2],h=y,h.test(b)&&(d=b+t[U])}if(h=V,h.test(d)){var E=h.exec(d);b=E[1],U=E[2],h=y,h.test(b)&&(d=b+n[U])}if(h=re,x=ue,h.test(d)){var E=h.exec(d);b=E[1],h=g,h.test(b)&&(d=b)}else if(x.test(d)){var E=x.exec(d);b=E[1]+E[2],x=g,x.test(b)&&(d=b)}if(h=j,h.test(d)){var E=h.exec(d);b=E[1],h=g,x=L,W=fe,(h.test(b)||x.test(b)&&!W.test(b))&&(d=b)}return h=de,x=g,h.test(d)&&x.test(d)&&(h=w,d=d.replace(h,"")),P=="y"&&(d=P.toLowerCase()+d.substr(1)),d};return function(J){return J.update(ie)}}(),e.Pipeline.registerFunction(e.stemmer,"stemmer");e.generateStopWordFilter=function(t){var n=t.reduce(function(r,i){return r[i]=i,r},{});return function(r){if(r&&n[r.toString()]!==r.toString())return r}},e.stopWordFilter=e.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),e.Pipeline.registerFunction(e.stopWordFilter,"stopWordFilter");e.trimmer=function(t){return t.update(function(n){return n.replace(/^\W+/,"").replace(/\W+$/,"")})},e.Pipeline.registerFunction(e.trimmer,"trimmer");e.TokenSet=function(){this.final=!1,this.edges={},this.id=e.TokenSet._nextId,e.TokenSet._nextId+=1},e.TokenSet._nextId=1,e.TokenSet.fromArray=function(t){for(var n=new e.TokenSet.Builder,r=0,i=t.length;r<i;r++)n.insert(t[r]);return n.finish(),n.root},e.TokenSet.fromClause=function(t){return"editDistance"in t?e.TokenSet.fromFuzzyString(t.term,t.editDistance):e.TokenSet.fromString(t.term)},e.TokenSet.fromFuzzyString=function(t,n){for(var r=new e.TokenSet,i=[{node:r,editsRemaining:n,str:t}];i.length;){var s=i.pop();if(s.str.length>0){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),i.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),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.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),i.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),i.push({node:g,editsRemaining:s.editsRemaining-1,str:f+s.str.slice(2)})}}}return r},e.TokenSet.fromString=function(t){for(var n=new e.TokenSet,r=n,i=0,s=t.length;i<s;i++){var o=t[i],a=i==s-1;if(o=="*")n.edges[o]=n,n.final=a;else{var l=new e.TokenSet;l.final=a,n.edges[o]=l,n=l}}return r},e.TokenSet.prototype.toArray=function(){for(var t=[],n=[{prefix:"",node:this}];n.length;){var r=n.pop(),i=Object.keys(r.node.edges),s=i.length;r.node.final&&(r.prefix.charAt(0),t.push(r.prefix));for(var o=0;o<s;o++){var a=i[o];n.push({prefix:r.prefix.concat(a),node:r.node.edges[a]})}}return t},e.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var t=this.final?"1":"0",n=Object.keys(this.edges).sort(),r=n.length,i=0;i<r;i++){var s=n[i],o=this.edges[s];t=t+s+o.id}return t},e.TokenSet.prototype.intersect=function(t){for(var n=new e.TokenSet,r=void 0,i=[{qNode:t,output:n,node:this}];i.length;){r=i.pop();for(var s=Object.keys(r.qNode.edges),o=s.length,a=Object.keys(r.node.edges),l=a.length,u=0;u<o;u++)for(var f=s[u],y=0;y<l;y++){var g=a[y];if(g==f||f=="*"){var L=r.node.edges[g],v=r.qNode.edges[f],T=L.final&&v.final,m=void 0;g in r.output.edges?(m=r.output.edges[g],m.final=m.final||T):(m=new e.TokenSet,m.final=T,r.output.edges[g]=m),i.push({qNode:v,output:m,node:L})}}}return n},e.TokenSet.Builder=function(){this.previousWord="",this.root=new e.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},e.TokenSet.Builder.prototype.insert=function(t){var n,r=0;if(t<this.previousWord)throw new Error("Out of order word insertion");for(var i=0;i<t.length&&i<this.previousWord.length&&t[i]==this.previousWord[i];i++)r++;this.minimize(r),this.uncheckedNodes.length==0?n=this.root:n=this.uncheckedNodes[this.uncheckedNodes.length-1].child;for(var i=r;i<t.length;i++){var s=new e.TokenSet,o=t[i];n.edges[o]=s,this.uncheckedNodes.push({parent:n,char:o,child:s}),n=s}n.final=!0,this.previousWord=t},e.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},e.TokenSet.Builder.prototype.minimize=function(t){for(var n=this.uncheckedNodes.length-1;n>=t;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.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 r=new e.QueryParser(t,n);r.parse()})},e.Index.prototype.query=function(t){for(var n=new e.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l<this.fields.length;l++)i[this.fields[l]]=new e.Vector;t.call(n,n);for(var l=0;l<n.clauses.length;l++){var u=n.clauses[l],f=null,y=e.Set.empty;u.usePipeline?f=this.pipeline.runString(u.term,{fields:u.fields}):f=[u.term];for(var g=0;g<f.length;g++){var L=f[g];u.term=L;var v=e.TokenSet.fromClause(u),T=this.tokenSet.intersect(v).toArray();if(T.length===0&&u.presence===e.Query.presence.REQUIRED){for(var m=0;m<u.fields.length;m++){var p=u.fields[m];o[p]=e.Set.empty}break}for(var _=0;_<T.length;_++)for(var w=T[_],R=this.invertedIndex[w],H=R._index,m=0;m<u.fields.length;m++){var p=u.fields[m],S=R[p],I=Object.keys(S),D=w+"/"+p,V=new e.Set(I);if(u.presence==e.Query.presence.REQUIRED&&(y=y.union(V),o[p]===void 0&&(o[p]=e.Set.complete)),u.presence==e.Query.presence.PROHIBITED){a[p]===void 0&&(a[p]=e.Set.empty),a[p]=a[p].union(V);continue}if(i[p].upsert(H,u.boost,function(qn,zn){return qn+zn}),!s[D]){for(var re=0;re<I.length;re++){var ue=I[re],j=new e.FieldRef(ue,p),de=S[ue],fe;(fe=r[j])===void 0?r[j]=new e.MatchData(w,p,de):fe.add(w,p,de)}s[D]=!0}}}if(u.presence===e.Query.presence.REQUIRED)for(var m=0;m<u.fields.length;m++){var p=u.fields[m];o[p]=o[p].intersect(y)}}for(var ie=e.Set.complete,J=e.Set.empty,l=0;l<this.fields.length;l++){var p=this.fields[l];o[p]&&(ie=ie.intersect(o[p])),a[p]&&(J=J.union(a[p]))}var d=Object.keys(r),b=[],U=Object.create(null);if(n.isNegated()){d=Object.keys(this.fieldVectors);for(var l=0;l<d.length;l++){var j=d[l],P=e.FieldRef.fromString(j);r[j]=new e.MatchData}}for(var l=0;l<d.length;l++){var P=e.FieldRef.fromString(d[l]),h=P.docRef;if(ie.contains(h)&&!J.contains(h)){var x=this.fieldVectors[P],W=i[P.fieldName].similarity(x),X;if((X=U[h])!==void 0)X.score+=W,X.matchData.combine(r[P]);else{var E={ref:h,score:W,matchData:r[P]};U[h]=E,b.push(E)}}}return b.sort(function(Mn,Bn){return Bn.score-Mn.score})},e.Index.prototype.toJSON=function(){var t=Object.keys(this.invertedIndex).sort().map(function(r){return[r,this.invertedIndex[r]]},this),n=Object.keys(this.fieldVectors).map(function(r){return[r,this.fieldVectors[r].toJSON()]},this);return{version:e.version,fields:this.fields,fieldVectors:n,invertedIndex:t,pipeline:this.pipeline.toJSON()}},e.Index.load=function(t){var n={},r={},i=t.fieldVectors,s=Object.create(null),o=t.invertedIndex,a=new e.TokenSet.Builder,l=e.Pipeline.load(t.pipeline);t.version!=e.version&&e.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+e.version+"' does not match serialized index '"+t.version+"'");for(var u=0;u<i.length;u++){var f=i[u],y=f[0],g=f[1];r[y]=new e.Vector(g)}for(var u=0;u<o.length;u++){var f=o[u],L=f[0],v=f[1];a.insert(L),s[L]=v}return a.finish(),n.fields=t.fields,n.fieldVectors=r,n.invertedIndex=s,n.tokenSet=a.root,n.pipeline=l,new e.Index(n)};e.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=e.tokenizer,this.pipeline=new e.Pipeline,this.searchPipeline=new e.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},e.Builder.prototype.ref=function(t){this._ref=t},e.Builder.prototype.field=function(t,n){if(/\//.test(t))throw new RangeError("Field '"+t+"' contains illegal character '/'");this._fields[t]=n||{}},e.Builder.prototype.b=function(t){t<0?this._b=0:t>1?this._b=1:this._b=t},e.Builder.prototype.k1=function(t){this._k1=t},e.Builder.prototype.add=function(t,n){var r=t[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s<i.length;s++){var o=i[s],a=this._fields[o].extractor,l=a?a(t):t[o],u=this.tokenizer(l,{fields:[o]}),f=this.pipeline.run(u),y=new e.FieldRef(r,o),g=Object.create(null);this.fieldTermFrequencies[y]=g,this.fieldLengths[y]=0,this.fieldLengths[y]+=f.length;for(var L=0;L<f.length;L++){var v=f[L];if(g[v]==null&&(g[v]=0),g[v]+=1,this.invertedIndex[v]==null){var T=Object.create(null);T._index=this.termIndex,this.termIndex+=1;for(var m=0;m<i.length;m++)T[i[m]]=Object.create(null);this.invertedIndex[v]=T}this.invertedIndex[v][o][r]==null&&(this.invertedIndex[v][o][r]=Object.create(null));for(var p=0;p<this.metadataWhitelist.length;p++){var _=this.metadataWhitelist[p],w=v.metadata[_];this.invertedIndex[v][o][r][_]==null&&(this.invertedIndex[v][o][r][_]=[]),this.invertedIndex[v][o][r][_].push(w)}}}},e.Builder.prototype.calculateAverageFieldLengths=function(){for(var t=Object.keys(this.fieldLengths),n=t.length,r={},i={},s=0;s<n;s++){var o=e.FieldRef.fromString(t[s]),a=o.fieldName;i[a]||(i[a]=0),i[a]+=1,r[a]||(r[a]=0),r[a]+=this.fieldLengths[o]}for(var l=Object.keys(this._fields),s=0;s<l.length;s++){var u=l[s];r[u]=r[u]/i[u]}this.averageFieldLength=r},e.Builder.prototype.createFieldVectors=function(){for(var t={},n=Object.keys(this.fieldTermFrequencies),r=n.length,i=Object.create(null),s=0;s<r;s++){for(var o=e.FieldRef.fromString(n[s]),a=o.fieldName,l=this.fieldLengths[o],u=new e.Vector,f=this.fieldTermFrequencies[o],y=Object.keys(f),g=y.length,L=this._fields[a].boost||1,v=this._documents[o.docRef].boost||1,T=0;T<g;T++){var m=y[T],p=f[m],_=this.invertedIndex[m]._index,w,R,H;i[m]===void 0?(w=e.idf(this.invertedIndex[m],this.documentCount),i[m]=w):w=i[m],R=w*((this._k1+1)*p)/(this._k1*(1-this._b+this._b*(l/this.averageFieldLength[a]))+p),R*=L,R*=v,H=Math.round(R*1e3)/1e3,u.insert(_,H)}t[o]=u}this.fieldVectors=t},e.Builder.prototype.createTokenSet=function(){this.tokenSet=e.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},e.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new e.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},e.Builder.prototype.use=function(t){var n=Array.prototype.slice.call(arguments,1);n.unshift(this),t.apply(this,n)},e.MatchData=function(t,n,r){for(var i=Object.create(null),s=Object.keys(r||{}),o=0;o<s.length;o++){var a=s[o];i[a]=r[a].slice()}this.metadata=Object.create(null),t!==void 0&&(this.metadata[t]=Object.create(null),this.metadata[t][n]=i)},e.MatchData.prototype.combine=function(t){for(var n=Object.keys(t.metadata),r=0;r<n.length;r++){var i=n[r],s=Object.keys(t.metadata[i]);this.metadata[i]==null&&(this.metadata[i]=Object.create(null));for(var o=0;o<s.length;o++){var a=s[o],l=Object.keys(t.metadata[i][a]);this.metadata[i][a]==null&&(this.metadata[i][a]=Object.create(null));for(var u=0;u<l.length;u++){var f=l[u];this.metadata[i][a][f]==null?this.metadata[i][a][f]=t.metadata[i][a][f]:this.metadata[i][a][f]=this.metadata[i][a][f].concat(t.metadata[i][a][f])}}}},e.MatchData.prototype.add=function(t,n,r){if(!(t in this.metadata)){this.metadata[t]=Object.create(null),this.metadata[t][n]=r;return}if(!(n in this.metadata[t])){this.metadata[t][n]=r;return}for(var i=Object.keys(r),s=0;s<i.length;s++){var o=i[s];o in this.metadata[t][n]?this.metadata[t][n][o]=this.metadata[t][n][o].concat(r[o]):this.metadata[t][n][o]=r[o]}},e.Query=function(t){this.clauses=[],this.allFields=t},e.Query.wildcard=new String("*"),e.Query.wildcard.NONE=0,e.Query.wildcard.LEADING=1,e.Query.wildcard.TRAILING=2,e.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},e.Query.prototype.clause=function(t){return"fields"in t||(t.fields=this.allFields),"boost"in t||(t.boost=1),"usePipeline"in t||(t.usePipeline=!0),"wildcard"in t||(t.wildcard=e.Query.wildcard.NONE),t.wildcard&e.Query.wildcard.LEADING&&t.term.charAt(0)!=e.Query.wildcard&&(t.term="*"+t.term),t.wildcard&e.Query.wildcard.TRAILING&&t.term.slice(-1)!=e.Query.wildcard&&(t.term=""+t.term+"*"),"presence"in t||(t.presence=e.Query.presence.OPTIONAL),this.clauses.push(t),this},e.Query.prototype.isNegated=function(){for(var t=0;t<this.clauses.length;t++)if(this.clauses[t].presence!=e.Query.presence.PROHIBITED)return!1;return!0},e.Query.prototype.term=function(t,n){if(Array.isArray(t))return t.forEach(function(i){this.term(i,e.utils.clone(n))},this),this;var r=n||{};return r.term=t.toString(),this.clause(r),this},e.QueryParseError=function(t,n,r){this.name="QueryParseError",this.message=t,this.start=n,this.end=r},e.QueryParseError.prototype=new Error,e.QueryLexer=function(t){this.lexemes=[],this.str=t,this.length=t.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},e.QueryLexer.prototype.run=function(){for(var t=e.QueryLexer.lexText;t;)t=t(this)},e.QueryLexer.prototype.sliceString=function(){for(var t=[],n=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],t.push(this.str.slice(n,r)),n=r+1;return t.push(this.str.slice(n,this.pos)),this.escapeCharPositions.length=0,t.join("")},e.QueryLexer.prototype.emit=function(t){this.lexemes.push({type:t,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},e.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},e.QueryLexer.prototype.next=function(){if(this.pos>=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.pos<this.length},e.QueryLexer.EOS="EOS",e.QueryLexer.FIELD="FIELD",e.QueryLexer.TERM="TERM",e.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",e.QueryLexer.BOOST="BOOST",e.QueryLexer.PRESENCE="PRESENCE",e.QueryLexer.lexField=function(t){return t.backup(),t.emit(e.QueryLexer.FIELD),t.ignore(),e.QueryLexer.lexText},e.QueryLexer.lexTerm=function(t){if(t.width()>1&&(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 r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new e.QueryParseError(r,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 r="unrecognised presence operator'"+n.str+"'";throw new e.QueryParseError(r,n.start,n.end)}var i=t.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new e.QueryParseError(r,n.start,n.end)}switch(i.type){case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new e.QueryParseError(r,i.start,i.end)}}},e.QueryParser.parseField=function(t){var n=t.consumeLexeme();if(n!=null){if(t.query.allFields.indexOf(n.str)==-1){var r=t.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new e.QueryParseError(i,n.start,n.end)}t.currentClause.fields=[n.str];var s=t.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new e.QueryParseError(i,n.start,n.end)}switch(s.type){case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new e.QueryParseError(i,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 r=t.peekLexeme();if(r==null){t.nextClause();return}switch(r.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 i="Unexpected lexeme type '"+r.type+"'";throw new e.QueryParseError(i,r.start,r.end)}}},e.QueryParser.parseEditDistance=function(t){var n=t.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new e.QueryParseError(i,n.start,n.end)}t.currentClause.editDistance=r;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 i="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(i,s.start,s.end)}}},e.QueryParser.parseBoost=function(t){var n=t.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new e.QueryParseError(i,n.start,n.end)}t.currentClause.boost=r;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 i="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(i,s.start,s.end)}}},function(t,n){typeof define=="function"&&define.amd?define(n):typeof Ut=="object"?Wt.exports=n():t.lunr=n()}(this,function(){return e})})()});Handlebars.registerHelper("groupChanged",function(e,t,n){let r=t||"";if(e.group!==r)return delete e.nestedContext,e.group=r,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 e+".html"===n?t.fn(this):t.inverse(this)});var c=document.querySelector.bind(document),k=document.querySelectorAll.bind(document);function at(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function he(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function z(){return document.body.dataset.type}function ct(e,t){if(e){for(let n of e){let r=n.nodeGroups&&n.nodeGroups.find(i=>i.nodes.some(s=>s.anchor===t));if(r)return r.key}return null}}function pe(){return window.location.hash.replace(/^#/,"")}function lt(e){return new URLSearchParams(window.location.search).get(e)}function ut(e){return fetch(e).then(t=>t.ok).catch(()=>!1)}function dt(e){document.readyState!=="loading"?e():document.addEventListener("DOMContentLoaded",e)}function Z(e){return!e||e.trim()===""}function ft(e,t){let n;return function(...i){clearTimeout(n),n=setTimeout(()=>{n=null,e(...i)},t)}}function me(){return document.head.querySelector("meta[name=project][content]").content}var ht="ex_doc:settings",Kn={tooltips:!0,theme:null,livebookUrl:null},Ne=class{constructor(){this._subscribers=[],this._settings=Kn,this._loadSettings()}get(){return this._settings}update(t){let n=this._settings;this._settings={...this._settings,...t},this._subscribers.forEach(r=>r(this._settings,n)),this._storeSettings()}getAndSubscribe(t){this._subscribers.push(t),t(this._settings)}_loadSettings(){try{let t=localStorage.getItem(ht);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(ht,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 Ne;var Yn=".content",pt=".content-inner",Jn=".livebook-badge";function mt(){Xn(),er(),tr(),Zn()}function Xn(){c(Yn).querySelectorAll("a").forEach(e=>{e.querySelector("code, img")&&e.classList.add("no-underline")})}function Zn(){["warning","info","error","neutral","tip"].forEach(t=>{k(`blockquote h3.${t}, blockquote h4.${t}`).forEach(n=>{n.closest("blockquote").classList.add(t)})})}function er(){c(pt).setAttribute("tabindex",-1),c(pt).focus()}function tr(){let t=window.location.pathname.replace(/(\.html)?$/,".livemd"),n=new URL(t,window.location.href).toString();O.getAndSubscribe(r=>{let i=r.livebookUrl?rr(r.livebookUrl,n):nr(n);for(let s of k(Jn))s.href=i})}function nr(e){return`https://livebook.dev/run?url=${encodeURIComponent(e)}`}function rr(e,t){return`${e}/import?url=${encodeURIComponent(t)}`}document.addEventListener("click",function(e){if(window.innerWidth<=768){let t=e.target.closest('a[href^="#"]');if(t){e.preventDefault();let n=t.getAttribute("href").substring(1),r=document.getElementById(n);if(r){let s=r.getBoundingClientRect().top+window.scrollY-45;window.scrollTo({top:s,behavior:"smooth"})}}}});var Et=ot(St());var xr=768,Lt=300,se=".sidebar-toggle",Er=".content",F={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"},Lr=Object.values(N),C={togglingTimeout:null,lastWindowWidth:window.innerWidth,sidebarPreference:F.NO_PREF};function Tt(){wt(),Tr(),wr()}function Tr(){let e=sessionStorage.getItem("sidebar_width");e&&xt(e),new ResizeObserver(n=>{for(let r of n)xt(r.contentRect.width)}).observe(document.getElementById("sidebar"))}function xt(e){sessionStorage.setItem("sidebar_width",e),document.body.style.setProperty("--sidebarWidth",`${e}px`)}function wt(){sessionStorage.getItem("sidebar_state")==="closed"||kt()?($(N.closed),c(se).setAttribute("aria-expanded","false")):($(N.opened),c(se).setAttribute("aria-expanded","true"))}function kt(){return window.matchMedia(`screen and (max-width: ${xr}px)`).matches}function $(...e){document.body.classList.remove(...Lr),document.body.classList.add(...e)}function wr(){c(se).addEventListener("click",e=>{He(),Ir()}),c(Er).addEventListener("click",e=>{Or()}),window.addEventListener("resize",(0,Et.default)(e=>{_r()},100))}function He(){return De()?_t():kr()}function De(){return document.body.classList.contains(N.opened)||document.body.classList.contains(N.opening)}function kr(){Ot(),sessionStorage.setItem("sidebar_state","opened"),c(se).setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{$(N.openingStart),requestAnimationFrame(()=>($(N.opening),new Promise((e,t)=>{C.togglingTimeout=setTimeout(()=>{$(N.opened),e()},Lt)})))})}function _t(){Ot(),sessionStorage.setItem("sidebar_state","closed"),c(se).setAttribute("aria-expanded","false"),requestAnimationFrame(()=>{$(N.closingStart),requestAnimationFrame(()=>($(N.closing),new Promise((e,t)=>{C.togglingTimeout=setTimeout(()=>{$(N.closed),e()},Lt)})))})}function Ot(){C.togglingTimeout&&(clearTimeout(C.togglingTimeout),C.togglingTimeout=null)}function _r(){C.lastWindowWidth!==window.innerWidth&&(C.lastWindowWidth=window.innerWidth,(C.sidebarPreference===F.OPEN||C.sidebarPreference===F.NO_PREF)&&wt())}function Or(){kt()&&De()&&_t()}function Ir(){switch(C.sidebarPreference){case F.OPEN:C.sidebarPreference=F.CLOSED;break;case F.CLOSED:C.sidebarPreference=F.OPEN;break;case F.NO_PREF:De()?C.sidebarPreference=F.OPEN:C.sidebarPreference=F.CLOSED}}function oe(){return window.sidebarNodes||{}}function It(){return window.versionNodes||[]}var Fe={search:"search",extras:"extras",modules:"modules",tasks:"tasks"},Me=[Fe.extras,Fe.modules,Fe.tasks],be=e=>`#${e}-full-list`;function Ct(){Me.forEach(e=>{Cr(oe(),e)}),ye(z()),Pt(),At(),Dr()}function Cr(e,t){let n=e[t]||[],r=c(be(t));if(!r)return;let i=Handlebars.templates["sidebar-items"]({nodes:n,group:""});r.innerHTML=i,r.querySelectorAll("ul").forEach(s=>{if(s.innerHTML.trim()===""){let o=s.previousElementSibling;o.classList.contains("expand")&&o.classList.remove("expand"),s.remove()}}),r.querySelectorAll("li a + button").forEach(s=>{s.addEventListener("click",o=>{let l=o.target.closest("li");Pr(l)})}),r.querySelectorAll("li a").forEach(s=>{s.addEventListener("click",o=>{let l=o.target.closest("li"),u=r.querySelector(".current-section");u&&Nr(u),s.matches(".expand")&&s.pathname===window.location.pathname&&Be(l)})})}function Be(e){e.classList.add("open"),e.querySelector("button[aria-controls]").setAttribute("aria-expanded","true")}function Ar(e){e.classList.remove("open"),e.querySelector("button[aria-controls]").setAttribute("aria-expanded","false")}function Pr(e){e.classList.contains("open")?Ar(e):Be(e)}function Rr(e){e.classList.add("current-section"),e.querySelector("a").setAttribute("aria-current","true")}function Nr(e){e.classList.remove("current-section"),e.querySelector("a").setAttribute("aria-current","false")}function Qr(e){e.classList.add("current-hash"),e.querySelector("a").setAttribute("aria-current","true")}function Hr(e){e.classList.remove("current-hash"),e.querySelector("a").setAttribute("aria-current","false")}function ye(e){Me.forEach(t=>{let n=c(`#${t}-list-tab-button`);if(n){let r=c(`#${n.getAttribute("aria-controls")}`);t===e?(n.parentElement.classList.add("selected"),n.setAttribute("aria-selected","true"),n.setAttribute("tabindex","0"),r.removeAttribute("hidden")):(n.parentElement.classList.remove("selected"),n.setAttribute("aria-selected","false"),n.setAttribute("tabindex","-1"),r.setAttribute("hidden","hidden"))}})}function At(){let e=c(be(z()));if(!e)return;let t=e.querySelector("li.current-page");t&&(t.scrollIntoView(),e.scrollTop-=40)}function Pt(){let e=pe()||"content",n=oe()[z()]||[],r=ct(n,e),i=c(be(z()));if(!i)return;let s=i.querySelector(`li.current-page a.expand[href$="#${r}"]`);s&&Be(s.closest("li"));let o=i.querySelector(`li.current-page a[href$="#${e}"]`);if(o){let a=o.closest("ul");a.classList.contains("deflist")&&Rr(a.closest("li")),Qr(o.closest("li"))}}function Dr(){Me.forEach(t=>{let n=c(`#${t}-list-tab-button`);n&&n.addEventListener("click",r=>{ye(t),At()})});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(i=>i.dataset.type),r=e.querySelector('[role="tab"][aria-selected="true"]').dataset.type;if(t.key==="ArrowRight"){let i=n.indexOf(r)+1;i>=n.length&&(i=0);let s=n[i];ye(s),c(`#${s}-list-tab-button`).focus()}else if(t.key==="ArrowLeft"){let i=n.indexOf(r)-1;i<0&&(i=n.length-1);let s=n[i];ye(s),c(`#${s}-list-tab-button`).focus()}}),window.addEventListener("hashchange",t=>{let n=c(be(z()));if(!n)return;let r=n.querySelector("li.current-page li.current-hash");r&&Hr(r),Pt()})}var M={module:"module",moduleChild:"module-child",mixTask:"mix-task",extra:"extra",section:"section"};function Nt(e,t=8){if(Z(e))return[];let n=oe(),r=[...qe(n.modules,e,M.module),...Fr(n.modules,e,M.moduleChild),...qe(n.tasks,e,M.mixTask),...qe(n.extras,e,M.extra),...ze(n.modules,e,M.section),...ze(n.tasks,e,M.section),...ze(n.extras,e,M.section)].filter(i=>i!==null);return jr(r).slice(0,t)}function qe(e,t,n){return e.map(r=>Br(r,t,n))}function Fr(e,t,n){return e.filter(r=>r.nodeGroups).flatMap(r=>r.nodeGroups.flatMap(({key:i,nodes:s})=>{let o=Vr(i);return s.map(a=>qr(a,r.id,t,n,o)||$r(a,r.id,t,n,o))}))}function ze(e,t,n){return e.flatMap(r=>Mr(r).map(i=>zr(r,i,t,n)))}function Mr(e){return(e.sections||[]).concat(e.headers||[])}function Br(e,t,n){return Se(e.title,t)?{link:`${e.id}.html`,title:Le(e.title,t),label:null,description:null,matchQuality:xe(e.title,t),deprecated:e.deprecated,category:n}:null}function qr(e,t,n,r,i){return Se(e.id,n)?{link:`${t}.html#${e.anchor}`,title:Le(e.id,n),label:i,description:t,matchQuality:xe(e.id,n),deprecated:e.deprecated,category:r}:null}function zr(e,t,n,r){return Qt(t.id,n)?{link:`${e.id}.html#${t.anchor}`,title:Le(t.id,n),label:null,description:e.title,matchQuality:xe(t.id,n),category:r}:null}function $r(e,t,n,r,i){let s=`${t}.${e.id}`,o=`${t}:${e.id}`,a,l;if(Se(s,n))a=s,l=/\./g;else if(Se(o,n))a=o,l=/:/g;else return null;let u=n.replace(l," ");return Qt(e.id,u)?{link:`${t}.html#${e.anchor}`,title:Le(e.id,u),label:i,description:t,matchQuality:xe(a,n),deprecated:e.deprecated,category:r}:null}function Vr(e){switch(e){case"callbacks":return"callback";case"types":return"type";default:return"function"}}function jr(e){return e.slice().sort((t,n)=>t.matchQuality!==n.matchQuality?n.matchQuality-t.matchQuality:Rt(t.category)-Rt(n.category))}function Rt(e){switch(e){case M.module:return 1;case M.moduleChild:return 2;case M.mixTask:return 3;default:return 4}}function Qt(e,t){return Ee(t).some(r=>Ht(e,r))}function Se(e,t){return Ee(t).every(r=>Ht(e,r))}function Ht(e,t){return e.toLowerCase().includes(t.toLowerCase())}function xe(e,t){let n=Ee(t),i=n.map(o=>o.length).reduce((o,a)=>o+a,0)/e.length,s=Ur(e,n[0])?1:0;return i+s}function Ur(e,t){return e.toLowerCase().startsWith(t.toLowerCase())}function Ee(e){return e.trim().split(/\s+/)}function Le(e,t){let n=Ee(t).sort((r,i)=>i.length-r.length);return ve(e,n)}function ve(e,t){if(t.length===0)return e;let[n,...r]=t,i=e.match(new RegExp(`(.*)(${at(n)})(.*)`,"i"));if(i){let[,s,o,a]=i;return ve(s,t)+"<em>"+he(o)+"</em>"+ve(a,t)}else return ve(e,r)}var ee=".autocomplete",Wr=".autocomplete-suggestions",Te=".autocomplete-suggestion",B={autocompleteSuggestions:[],selectedIdx:-1};function Gr(){c(ee).classList.add("shown")}function $e(){c(ee).classList.remove("shown")}function Dt(){return c(ee).classList.contains("shown")}function Ve(e){B.autocompleteSuggestions=Nt(e),B.selectedIdx=-1,Z(e)?$e():(Kr({term:e,suggestions:B.autocompleteSuggestions}),we(0),Gr())}function Kr({term:e,suggestions:t}){let n=Handlebars.templates["autocomplete-suggestions"]({suggestions:t,term:e}),r=c(ee);r.innerHTML=n}function Ft(){return B.selectedIdx===-1?null:B.autocompleteSuggestions[B.selectedIdx]}function we(e){B.selectedIdx=Yr(e);let t=c(`${Te}.selected`),n=c(`${Te}[data-index="${B.selectedIdx}"]`);t&&t.classList.remove("selected"),n?(n.classList.add("selected"),n.scrollIntoView({block:"nearest"})):c(Wr).scrollTop=0}function Yr(e){let t=B.autocompleteSuggestions.length+1;return(B.selectedIdx+e+1+t)%t-1}var ae="form.search-bar input",Jr="form.search-bar .search-close-button";function qt(){Xr()}function zt(e){let t=c(ae);t.value=e}function $t(){c(ae).focus()}function Xr(){let e=c(ae);e.addEventListener("keydown",t=>{let n=ei();t.key==="Escape"?(Ie(),e.blur()):t.key==="Enter"?Zr(t):t.key==="ArrowUp"||n&&t.ctrlKey&&t.key==="p"?(we(-1),t.preventDefault()):(t.key==="ArrowDown"||n&&t.ctrlKey&&t.key==="n")&&(we(1),t.preventDefault())}),e.addEventListener("input",t=>{Ve(t.target.value)}),e.addEventListener("focus",t=>{document.body.classList.add("search-focused"),Ve(t.target.value)}),e.addEventListener("blur",t=>{let n=t.relatedTarget;if(n){if(n.matches(Te))return setTimeout(()=>{Dt()&&e.focus()},1e3),null;n.matches(Jr)&&Ie()}je()}),c(ee).addEventListener("click",t=>{t.shiftKey||t.ctrlKey?e.focus():(Ie(),je())})}function Zr(e){let t=c(ae),n=e.shiftKey||e.ctrlKey,r=Ft();e.preventDefault();let i=n?"_blank":"_self",s=document.createElement("a");s.setAttribute("target",i),r?s.setAttribute("href",r.link):s.setAttribute("href",`search.html?q=${encodeURIComponent(t.value)}`),s.click(),n||(Ie(),je())}function Ie(){let e=c(ae);e.value=""}function je(){document.body.classList.remove("search-focused"),$e()}function ei(){return/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)}var Mt=window.scrollY,ke=document.querySelector(".top-search"),_e=document.getElementById("sidebar-menu"),Oe=document.querySelector(".background-layer"),Bt=70;window.addEventListener("scroll",function(){let e=window.scrollY;e>Bt*2&&(ke.classList.add("sm-fixed"),_e.classList.add("sm-fixed"),Oe.classList.add("sm-fixed")),e===0&&(ke.classList.remove("sm-fixed"),_e.classList.remove("sm-fixed"),Oe.classList.remove("sm-fixed")),e>Mt&&e>Bt?(ke.classList.add("sm-hidden"),_e.classList.add("sm-hidden"),Oe.classList.add("sm-hidden")):(ke.classList.remove("sm-hidden"),_e.classList.remove("sm-hidden"),Oe.classList.remove("sm-hidden")),Mt=e<=0?0:e},!1);var Vt=".sidebar-projectVersion",ti=".sidebar-projectVersionsDropdown";function jt(){let e=It();if(e.length>0){let n=c(Vt).textContent.trim(),r=ri(e,n);ni({nodes:r})}}function ni({nodes:e}){let t=c(Vt),n=Handlebars.templates["versions-dropdown"]({nodes:e});t.innerHTML=n,c(ti).addEventListener("change",si)}function ri(e,t){return ii(e,t).map(r=>({...r,isCurrentVersion:r.version===t}))}function ii(e,t){return e.some(r=>r.version===t)?e:[{version:t,url:"#"},...e]}function si(e){let t=e.target.value,n=window.location.pathname.split("/").pop()+window.location.hash,r=`${t}/${n}`;ut(r).then(i=>{i?window.location.href=r:window.location.href=t})}var Q=ot(Gt());var Ce=80,oi="#search";function Yt(){if(window.location.pathname.endsWith("/search.html")){let e=lt("q");ai(e)}}async function ai(e){if(Z(e))Ue({value:e});else{zt(e);let t=await ci();try{let n=e.replaceAll(/(\B|\\):/g,"\\:"),r=bi(t.search(n));Ue({value:e,results:r})}catch(n){Ue({value:e,errorMessage:n.message})}}}function Ue({value:e,results:t,errorMessage:n}){let r=c(oi),i=Handlebars.templates["search-results"]({value:e,results:t,errorMessage:n});r.innerHTML=i}async function ci(){Q.default.tokenizer.separator=/\s+/,Q.default.QueryLexer.termSeparator=/\s+/,Q.default.Pipeline.registerFunction(Xt,"docTokenSplitter"),Q.default.Pipeline.registerFunction(Zt,"docTrimmer");let e=await li();if(e)return e;let t=mi();return ui(t),t}async function li(){try{let e=sessionStorage.getItem(Jt());if(e){let t=await fi(e);return Q.default.Index.load(t)}else return null}catch(e){return console.error("Failed to load index: ",e),null}}async function ui(e){try{let t=await di(e);sessionStorage.setItem(Jt(),t)}catch(t){console.error("Failed to save index: ",t)}}async function di(e){let t=new Blob([JSON.stringify(e)],{type:"application/json"}).stream().pipeThrough(new window.CompressionStream("gzip")),r=await(await new Response(t).blob()).arrayBuffer();return hi(r)}async function fi(e){let t=new Blob([pi(e)],{type:"application/json"}).stream().pipeThrough(new window.DecompressionStream("gzip")),n=await new Response(t).text();return JSON.parse(n)}function hi(e){let t="",n=new Uint8Array(e),r=n.byteLength;for(let i=0;i<r;i++)t+=String.fromCharCode(n[i]);return window.btoa(t)}function pi(e){let t=window.atob(e),n=t.length,r=new Uint8Array(new ArrayBuffer(n));for(let i=0;i<n;i++)r[i]=t.charCodeAt(i);return r}function Jt(){return`idv4:${me()}`}function mi(){return(0,Q.default)(function(){this.ref("ref"),this.field("title",{boost:3}),this.field("doc"),this.field("type"),this.metadataWhitelist=["position"],this.pipeline.remove(Q.default.stopWordFilter),this.pipeline.remove(Q.default.trimmer),this.use(gi),this.use(yi),searchData.items.forEach(e=>{this.add(e)})})}function gi(e){e.pipeline.before(Q.default.stemmer,Xt)}function Xt(e){let t=e.toString().split(/\:|\.|\/|_|-/).map(n=>e.clone().update(()=>n));return t.length>1?[...t,e]:t}function yi(e){e.pipeline.before(Q.default.stemmer,Zt)}function Zt(e){return e.update(function(t){return t.replace(/^[^@:\w]+/,"").replace(/[^\?\!\w]+$/,"")})}function bi(e){return e.filter(t=>Kt(t.ref)).map(t=>{let n=Kt(t.ref),r=t.matchData.metadata;return{...n,metadata:r,excerpts:vi(n,r)}})}function Kt(e){return searchData.items.find(t=>t.ref===e)||null}function vi(e,t){let{doc:n}=e,i=Object.keys(t).filter(s=>"doc"in t[s]).map(s=>t[s].doc.position.map(([o,a])=>Si(n,o,a))).reduce((s,o)=>s.concat(o),[]);return i.length===0?[n.slice(0,Ce*2)+(Ce*2<n.length?"...":"")]:i.slice(0,1)}function Si(e,t,n){let r=Math.max(t-Ce,0),i=Math.min(t+n+Ce,e.length);return[r>0?"...":"",e.slice(r,t),"<em>"+he(e.slice(t,t+n))+"</em>",e.slice(t+n,i),i<e.length?"...":""].join("")}var Ae=null,G=null;function en(){G=document.getElementById("toast"),G.addEventListener("click",e=>{clearTimeout(Ae),e.target.classList.remove("show")})}function We(e){G&&(clearTimeout(Ae),G.innerText=e,G.classList.add("show"),Ae=setTimeout(()=>{G.classList.remove("show"),Ae=setTimeout(function(){G.innerText=""},1e3)},5e3))}var tn="dark",Ge=["system","dark","light"];function nn(){O.getAndSubscribe(e=>{document.body.classList.toggle(tn,sn(e))}),Ei()}function rn(){let t=O.get().theme||"system",n=Ge[Ge.indexOf(t)+1]||Ge[0];O.update({theme:n}),We(`Set theme to "${n}"`)}function sn(e){return e.theme==="dark"||xi()&&(e.theme==null||e.theme==="system")}function xi(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function Ei(){window.matchMedia("(prefers-color-scheme: dark)").addListener(e=>{let t=O.get(),n=sn(t);(t.theme==null||t.theme==="system")&&(document.body.classList.toggle(tn,n),We(`Browser changed theme to "${n?"dark":"light"}"`))})}var Li="hll";function an(){Ti()}function Ti(){k("[data-group-id]").forEach(t=>{let n=t.getAttribute("data-group-id");t.addEventListener("mouseenter",r=>{on(n,!0)}),t.addEventListener("mouseleave",r=>{on(n,!1)})})}function on(e,t){k(`[data-group-id="${e}"]`).forEach(r=>{r.classList.toggle(Li,t)})}var te="#modal",wi="#modal .modal-close",ki="#modal .modal-title",_i="#modal .modal-body",cn='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 ln(){Oi()}function Oi(){let e=Handlebars.templates["modal-layout"]();document.body.insertAdjacentHTML("beforeend",e),c(te).addEventListener("keydown",t=>{t.key==="Escape"&&ce()}),c(wi).addEventListener("click",t=>{ce()})}function un(e){if(q.ignoreFocusChanges)return;let t=c(te);if(t.contains(e.target))q.lastFocus=e.target;else{q.ignoreFocusChanges=!0;let n=Ii(t);q.lastFocus===n?Ci(t).focus():n.focus(),q.ignoreFocusChanges=!1,q.lastFocus=document.activeElement}}function Ii(e){return e.querySelector(cn)}function Ci(e){let t=e.querySelectorAll(cn);return t[t.length-1]}function Pe({title:e,body:t}){q.prevFocus=document.activeElement,document.addEventListener("focus",un,!0),c(ki).innerHTML=e,c(_i).innerHTML=t,c(te).classList.add("shown"),c(te).focus()}function ce(){c(te).classList.remove("shown"),document.addEventListener("focus",un,!0),q.prevFocus&&q.prevFocus.focus(),q.prevFocus=null}function dn(){return c(te).classList.contains("shown")}var Ai="https://hexdocs.pm/%%",Pi="https://hex.pm/api/packages?search=name:%%*",Ri=".display-quick-switch",Ke="#quick-switch-input",hn="#quick-switch-results",Ni=".quick-switch-result",Qi=300,Hi=9,Di=["elixir","eex","ex_unit","hex","iex","logger","mix"].map(e=>({name:e})),pn=2,A={autocompleteResults:[],selectedIdx:null};function mn(){Fi()}function Fi(){k(Ri).forEach(e=>{e.addEventListener("click",t=>{Je()})})}function Mi(e){if(e.key==="Enter"){let t=e.target.value;qi(t),e.preventDefault()}else e.key==="ArrowUp"?(fn(-1),e.preventDefault()):e.key==="ArrowDown"&&(fn(1),e.preventDefault())}function Bi(e){let t=e.target.value;if(t.length<pn){let n=c(hn);n.innerHTML=""}else zi(t)}function Je(){Pe({title:"Search HexDocs package",body:Handlebars.templates["quick-switch-modal-body"]()}),c(Ke).focus();let e=c(Ke);e.addEventListener("keydown",Mi),e.addEventListener("input",Bi),A.autocompleteResults=[],A.selectedIdx=null}function qi(e){if(A.selectedIdx===null)Ye(e);else{let t=A.autocompleteResults[A.selectedIdx];Ye(t.name)}}function Ye(e){window.location=Ai.replace("%%",e.toLowerCase())}var zi=ft($i,Qi);function $i(e){let t=Pi.replace("%%",e);fetch(t).then(n=>n.json()).then(n=>{Array.isArray(n)&&(A.autocompleteResults=ji(e,n),A.selectedIdx=null,c(Ke).value.length>=pn&&Vi({results:A.autocompleteResults}))})}function Vi({results:e}){let t=c(hn),n=Handlebars.templates["quick-switch-results"]({results:e});t.innerHTML=n,k(Ni).forEach(r=>{r.addEventListener("click",i=>{let s=r.getAttribute("data-index"),o=A.autocompleteResults[s];Ye(o.name)})})}function ji(e,t){return Di.concat(t).filter(n=>n.name.toLowerCase().includes(e.toLowerCase())).filter(n=>n.releases===void 0||n.releases[0].has_docs===!0).slice(0,Hi)}function fn(e){A.selectedIdx=Ui(e);let t=c(".quick-switch-result.selected"),n=c(`.quick-switch-result[data-index="${A.selectedIdx}"]`);t&&t.classList.remove("selected"),n&&n.classList.add("selected")}function Ui(e){let t=A.autocompleteResults.length;if(A.selectedIdx===null){if(e>=0)return 0;if(e<0)return t-1}return(A.selectedIdx+e+t)%t}var Wi=".display-settings",Gi="#settings-modal-content",Xe="#modal-settings-tab",Ze="#modal-keyboard-shortcuts-tab",yn="#settings-content",bn="#keyboard-shortcuts-content",Ki=[{title:"Settings",id:"modal-settings-tab"},{title:"Keyboard shortcuts",id:"modal-keyboard-shortcuts-tab"}];function vn(){Yi()}function Yi(){k(Wi).forEach(e=>{e.addEventListener("click",t=>{et()})})}function gn(){c(Ze).classList.remove("active"),c(Xe).classList.add("active"),c(yn).classList.remove("hidden"),c(bn).classList.add("hidden")}function Ji(){c(Ze).classList.add("active"),c(Xe).classList.remove("active"),c(bn).classList.remove("hidden"),c(yn).classList.add("hidden")}function et(){Pe({title:Ki.map(({id:s,title:o})=>`<button id="${s}">${o}</button>`).join(""),body:Handlebars.templates["settings-modal-body"]({shortcuts:tt})});let e=c(Gi),t=e.querySelector('[name="theme"]'),n=e.querySelector('[name="tooltips"]'),r=e.querySelector('[name="direct_livebook_url"]'),i=e.querySelector('[name="livebook_url"]');O.getAndSubscribe(s=>{t.value=s.theme||"system",n.checked=s.tooltips,s.livebookUrl===null?(r.checked=!1,i.classList.add("hidden"),i.tabIndex=-1):(r.checked=!0,i.classList.remove("hidden"),i.tabIndex=0,i.value=s.livebookUrl)}),t.addEventListener("change",s=>{O.update({theme:s.target.value})}),n.addEventListener("change",s=>{O.update({tooltips:s.target.checked})}),r.addEventListener("change",s=>{let o=s.target.checked?i.value:null;O.update({livebookUrl:o})}),i.addEventListener("input",s=>{O.update({livebookUrl:s.target.value})}),c(Xe).addEventListener("click",s=>{gn()}),c(Ze).addEventListener("click",s=>{Ji()}),gn()}var Xi="#settings-modal-content",tt=[{key:"c",description:"Toggle sidebar",action:He},{key:"n",description:"Cycle themes",action:rn},{key:"s",description:"Focus search bar",displayAs:"<kbd><kbd>/</kbd></kbd> or <kbd><kbd>s</kdb></kdb>",action:Sn},{key:"/",action:Sn},{key:"g",description:"Search HexDocs package",displayAs:"<kbd><kbd>g</kdb></kdb>",action:Je},{key:"?",displayAs:"<kbd><kbd>?</kbd></kbd>",description:"Bring up this modal",action:ns}],nt={shortcutBeingPressed:null};function xn(){Zi()}function Zi(){document.addEventListener("keydown",es),document.addEventListener("keyup",ts)}function es(e){if(nt.shortcutBeingPressed||e.target.matches("input, textarea")||e.ctrlKey||e.metaKey||e.altKey)return;let t=tt.find(n=>n.key===e.key);t&&(nt.shortcutBeingPressed=t,e.preventDefault(),t.action(e))}function ts(e){nt.shortcutBeingPressed=null}function Sn(e){ce(),$t()}function ns(){rs()?ce():et()}function rs(){return dn()&&c(Xi)}var K={plain:"plain",function:"function",module:"module"},is=[{href:"typespecs.html#basic-types",hint:{kind:K.plain,description:"Basic type"}},{href:"typespecs.html#literals",hint:{kind:K.plain,description:"Literal"}},{href:"typespecs.html#built-in-types",hint:{kind:K.plain,description:"Built-in type"}}],Re={cancelHintFetching:null};function En(e){if(Tn(e))return!0;let t=/#.*\//;return e.includes("#")&&!t.test(e)?!1:e.includes(".html")}function Ln(e){let t=Tn(e);return t?Promise.resolve(t):ss(e)}function Tn(e){let t=is.find(n=>e.includes(n.href));return t?t.hint:null}function ss(e){let t=e.replace(".html",".html?hint=true");return new Promise((n,r)=>{let i=document.createElement("iframe");i.setAttribute("sandbox","allow-scripts allow-same-origin"),i.setAttribute("src",t),i.style.display="none";function s(a){let{href:l,hint:u}=a.data;t===l&&(o(),n(u))}Re.cancelHintFetching=()=>{o(),r(new Error("cancelled"))};function o(){i.remove(),window.removeEventListener("message",s),Re.cancelHintFetching=null}window.addEventListener("message",s),document.body.appendChild(i)})}function wn(){Re.cancelHintFetching&&Re.cancelHintFetching()}function kn(e){let n=e.querySelector("h1").textContent,r=e.querySelector(".docstring > p"),i=r?r.innerHTML:"";return{kind:K.function,title:n.trim(),description:i.trim()}}function _n(e){let n=e.querySelector("h1 > span").textContent,r=e.querySelector("#moduledoc p"),i=r?r.innerHTML:"";return{kind:K.module,title:n.trim(),description:i.trim()}}var os=".content a",rt="#tooltip",as="#tooltip .tooltip-body",In="body .content-inner",cs="#content",Cn="tooltip-shown",le=10,ls=le*4,On={height:450,width:768},us=100,ne={currentLinkElement:null,hoverDelayTimeout:null};function An(){ds(),fs()}function ds(){let e=Handlebars.templates["tooltip-layout"]();c(In).insertAdjacentHTML("beforeend",e)}function fs(){k(os).forEach(e=>{hs(e)&&(e.addEventListener("mouseenter",t=>{ms(e)}),e.addEventListener("mouseleave",t=>{vs(e)}))})}function hs(e){return!(e.classList.contains("detail-link")||ps(e.href)||!En(e.href))}function ps(e){let t=e.replace(cs,"");return window.location.href.split("#")[0]===t}function ms(e){gs()&&(ne.currentLinkElement=e,ne.hoverDelayTimeout=setTimeout(()=>{Ln(e.href).then(t=>{ys(t),bs()}).catch(()=>{})},us))}function gs(){let e=window.innerWidth<On.width||window.innerHeight<On.height;return Pn()&&!e}function ys(e){let t=Handlebars.templates["tooltip-body"]({isPlain:e.kind===K.plain,hint:e});c(as).innerHTML=t,xs()}function bs(){c(rt).classList.add(Cn)}function vs(e){Pn()&&(clearTimeout(ne.hoverDelayTimeout),wn(),ne.currentLinkElement=null,Ss())}function Ss(){c(rt).classList.remove(Cn)}function xs(){if(!ne.currentLinkElement)return;let e=c(rt),t=ne.currentLinkElement.getBoundingClientRect(),n=c(In).getBoundingClientRect(),r=e.getBoundingClientRect(),i=Es(t,n);if(t.left+r.width+le<window.innerWidth)e.style.left=`${i.left}px`,e.style.right="auto";else{let s=Math.max(i.right-r.width,le);e.style.left=`${s}px`,e.style.right="auto"}t.bottom+r.height+ls<window.innerHeight?e.style.top=`${i.bottom+le}px`:e.style.top=`${i.top-r.height-le}px`}function Es(e,t){return{top:e.top-t.top,bottom:e.bottom-t.top,left:e.left-t.left,right:e.right-t.left,x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Pn(){return O.get().tooltips}var Ls=".content-inner";function Nn(){if(Ts()){let e=ks();e&&ws(e)}}function Ts(){return new URLSearchParams(window.location.search).has("hint")&&window.self!==window.parent}function ws(e){let t=window.location.href,n={hint:e,href:t};window.parent.postMessage(n,"*")}function ks(){let e=Os(pe()),t=c(Ls);if(e){let n=kn(e);return Rn(n)}else if(_s()){let n=_n(t);return Rn(n)}return null}function Rn(e){let t=me();return{...e,version:t}}function _s(){return["modules","tasks"].includes(z())}function Os(e){if(!e)return null;let t=document.getElementById(e);return t?t.matches(".detail")?t:t.matches("span")?t.parentElement:null:null}var Is='<button class="copy-button"><svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"><path d="M0 0h24v24H0z" fill="none"/><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg><span class="sr-only">copy</span><span aria-live="polite"></span></button>';function Qn(){"clipboard"in navigator&&Cs()}function Cs(){Array.from(k("pre")).filter(e=>e.firstElementChild&&e.firstElementChild.tagName==="CODE").forEach(e=>e.insertAdjacentHTML("beforeend",Is)),Array.from(k(".copy-button")).forEach(e=>{let t;e.addEventListener("click",()=>{let n=e.querySelector("[aria-live]");t&&clearTimeout(t);let r=Array.from(e.parentElement.querySelector("code").childNodes).filter(i=>!(i.tagName==="SPAN"&&i.classList.contains("unselectable"))).map(i=>i.textContent).join("");navigator.clipboard.writeText(r),e.classList.add("clicked"),n.innerHTML="Copied! ✓",t=setTimeout(()=>{e.classList.remove("clicked"),n.innerHTML=""},3e3)})})}function Hn(){let t=/(Macintosh|iPhone|iPad|iPod)/.test(window.navigator.userAgent)?"apple-os":"non-apple-os";document.documentElement.classList.add(t)}var As="content",Ps="tabs-open",Rs="tabs-close",Ns="H3",Qs="tabset";function Fn(){Hs().map(Ds).forEach(n=>Bs(n))}function Hs(){let e=document.createNodeIterator(document.getElementById(As),NodeFilter.SHOW_COMMENT,{acceptNode(r){return r.nodeValue.trim()===Ps?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),t=[],n;for(;n=e.nextNode();)t.push(n);return t}function Ds(e,t,n){let r=[],i=[],s={label:"",content:[]};for(;e=e.nextSibling;){if(Fs(e)){Dn(s,i,t);break}r.push(e),e.nodeName===Ns?(Dn(s,i,t),s.label=e.innerText,s.content=[]):s.content.push(e.outerHTML)}let o=document.createElement("div");return o.className=Qs,Ms(r,o),o.innerHTML=Handlebars.templates.tabset({tabs:i}),o}function Fs(e){return e.nodeName==="#comment"&&e.nodeValue.trim()===Rs}function Dn(e,t,n){if(e.label===""&&!e.content.length)return!1;let r=e.label,i=e.content;t.push({label:r,content:i,setIndex:n})}function Ms(e,t){if(!e||!e.length)return!1;e[0].parentNode.insertBefore(t,e[0]),e.forEach(n=>t.appendChild(n))}function Bs(e){let t={tabs:e.querySelectorAll(':scope [role="tab"]'),panels:e.querySelectorAll(':scope [role="tabpanel"]'),activeIndex:0};t.tabs.forEach((n,r)=>{n.addEventListener("click",i=>{Y(r,t)}),n.addEventListener("keydown",i=>{let s=t.tabs.length-1;i.code==="ArrowLeft"?(i.preventDefault(),t.activeIndex===0?Y(s,t):Y(t.activeIndex-1,t)):i.code==="ArrowRight"?(i.preventDefault(),t.activeIndex===s?Y(0,t):Y(t.activeIndex+1,t)):i.code==="Home"?(i.preventDefault(),Y(0,t)):i.code==="End"&&(i.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}dt(()=>{nn(),Tt(),Ct(),qt(),jt(),mt(),an(),ln(),xn(),mn(),en(),An(),Nn(),Yt(),Qn(),vn(),Hn(),Fn()});})();
|
|
/*! 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
|
|
*)
|
|
*/
|