diff --git a/assets/js/autocomplete/suggestions.js b/assets/js/autocomplete/suggestions.js index e21777227..71fc04dbb 100644 --- a/assets/js/autocomplete/suggestions.js +++ b/assets/js/autocomplete/suggestions.js @@ -1,5 +1,6 @@ import { getSidebarNodes } from '../globals' -import { escapeRegexModifiers, escapeHtmlEntities, isBlank } from '../helpers' +import { isBlank } from '../helpers' +import { highlightMatches } from '../highlighter' /** * @typedef Suggestion @@ -285,27 +286,3 @@ function startsWith (text, subtext) { function tokenize (query) { return query.trim().split(/\s+/) } - -/** - * Returns an HTML string highlighting the individual tokens from the query string. - */ -function highlightMatches (text, query) { - // Sort terms length, so that the longest are highlighted first. - const terms = tokenize(query).sort((term1, term2) => term2.length - term1.length) - return highlightTerms(text, terms) -} - -function highlightTerms (text, terms) { - if (terms.length === 0) return text - - const [firstTerm, ...otherTerms] = terms - const match = text.match(new RegExp(`(.*)(${escapeRegexModifiers(firstTerm)})(.*)`, 'i')) - - if (match) { - const [, before, matching, after] = match - // Note: this has exponential complexity, but we expect just a few terms, so that's fine. - return highlightTerms(before, terms) + '' + escapeHtmlEntities(matching) + '' + highlightTerms(after, terms) - } else { - return highlightTerms(text, otherTerms) - } -} diff --git a/assets/js/highlighter.js b/assets/js/highlighter.js new file mode 100644 index 000000000..feebb160d --- /dev/null +++ b/assets/js/highlighter.js @@ -0,0 +1,34 @@ +import { escapeRegexModifiers, escapeHtmlEntities } from './helpers' + +/** + * Returns an HTML string highlighting the individual tokens from the query string. + */ +export function highlightMatches (text, query, opts = {}) { + // Sort terms length, so that the longest are highlighted first. + if (typeof query === 'string') { + query = query.split(/\s+/) + } + const terms = query.sort((term1, term2) => term2.length - term1.length) + return highlightTerms(text, terms, opts) +} + +function highlightTerms (text, terms, opts) { + if (terms.length === 0) return text + + let flags = 'i' + + if (opts.multiline) { + flags = 'is' + } + + const [firstTerm, ...otherTerms] = terms + const match = text.match(new RegExp(`(.*)(${escapeRegexModifiers(firstTerm)})(.*)`, flags)) + + if (match) { + const [, before, matching, after] = match + // Note: this has exponential complexity, but we expect just a few terms, so that's fine. + return highlightTerms(before, terms, opts) + '' + escapeHtmlEntities(matching) + '' + highlightTerms(after, terms, opts) + } else { + return highlightTerms(text, otherTerms, opts) + } +} diff --git a/assets/js/search-page.js b/assets/js/search-page.js index 8ed49219d..199282503 100644 --- a/assets/js/search-page.js +++ b/assets/js/search-page.js @@ -5,6 +5,7 @@ import { qs, escapeHtmlEntities, isBlank, getQueryParamByName, getProjectNameAnd import { setSearchInputValue } from './search-bar' import searchResultsTemplate from './handlebars/templates/search-results.handlebars' import { getSearchNodes } from './globals' +import { highlightMatches } from './highlighter' const EXCERPT_RADIUS = 80 const SEARCH_CONTAINER_SELECTOR = '#search' @@ -24,7 +25,7 @@ lunr.Pipeline.registerFunction(docTrimmerFunction, 'docTrimmer') window.addEventListener('swup:page:view', initialize) initialize() -function initialize () { +function initialize() { const pathname = window.location.pathname if (pathname.endsWith('/search.html') || pathname.endsWith('/search')) { const query = getQueryParamByName('q') @@ -33,7 +34,7 @@ function initialize () { } } -async function search (value, queryType) { +async function search(value, queryType) { if (isBlank(value)) { renderResults({ value }) } else { @@ -56,7 +57,7 @@ async function search (value, queryType) { } } -async function localSearch (value) { +async function localSearch(value) { const index = await getIndex() // We cannot match on atoms :foo because that would be considered @@ -65,7 +66,7 @@ async function localSearch (value) { return searchResultsToDecoratedSearchItems(index.search(fixedValue)) } -async function remoteSearch (value, queryType, searchNodes) { +async function remoteSearch(value, queryType, searchNodes) { let filterNodes = searchNodes if (queryType === 'latest') { @@ -86,7 +87,7 @@ async function remoteSearch (value, queryType, searchNodes) { return payload.hits.map(result => { const [packageName, packageVersion] = result.document.package.split('-') - const doc = result.document.doc + const doc = highlightMatches(result.document.doc, value, { multiline: true }) const excerpts = [doc] const metadata = {} const ref = `https://hexdocs.pm/${packageName}/${packageVersion}/${result.document.ref}` @@ -107,13 +108,13 @@ async function remoteSearch (value, queryType, searchNodes) { } } -function renderResults ({ value, results, errorMessage }) { +function renderResults({ value, results, errorMessage }) { const searchContainer = qs(SEARCH_CONTAINER_SELECTOR) const resultsHtml = searchResultsTemplate({ value, results, errorMessage }) searchContainer.innerHTML = resultsHtml } -async function getIndex () { +async function getIndex() { const cachedIndex = await loadIndex() if (cachedIndex) { return cachedIndex } @@ -122,7 +123,7 @@ async function getIndex () { return index } -async function loadIndex () { +async function loadIndex() { try { const serializedIndex = sessionStorage.getItem(indexStorageKey()) if (serializedIndex) { @@ -137,7 +138,7 @@ async function loadIndex () { } } -async function saveIndex (index) { +async function saveIndex(index) { try { const serializedIndex = await compress(index) sessionStorage.setItem(indexStorageKey(), serializedIndex) @@ -146,7 +147,7 @@ async function saveIndex (index) { } } -async function compress (index) { +async function compress(index) { const stream = new Blob([JSON.stringify(index)], { type: 'application/json' }).stream().pipeThrough(new window.CompressionStream('gzip')) @@ -156,7 +157,7 @@ async function compress (index) { return b64encode(buffer) } -async function decompress (index) { +async function decompress(index) { const stream = new Blob([b64decode(index)], { type: 'application/json' }).stream().pipeThrough(new window.DecompressionStream('gzip')) @@ -165,7 +166,7 @@ async function decompress (index) { return JSON.parse(blob) } -function b64encode (buffer) { +function b64encode(buffer) { let binary = '' const bytes = new Uint8Array(buffer) const len = bytes.byteLength @@ -175,7 +176,7 @@ function b64encode (buffer) { return window.btoa(binary) } -function b64decode (str) { +function b64decode(str) { const binaryString = window.atob(str) const len = binaryString.length const bytes = new Uint8Array(new ArrayBuffer(len)) @@ -185,11 +186,11 @@ function b64decode (str) { return bytes } -function indexStorageKey () { +function indexStorageKey() { return `idv5:${getProjectNameAndVersion()}` } -function createIndex () { +function createIndex() { return lunr(function () { this.ref('ref') this.field('title', { boost: 3 }) @@ -207,11 +208,11 @@ function createIndex () { }) } -function docTokenSplitter (builder) { +function docTokenSplitter(builder) { builder.pipeline.before(lunr.stemmer, docTokenFunction) } -function docTokenFunction (token) { +function docTokenFunction(token) { // 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. @@ -275,11 +276,11 @@ function docTokenFunction (token) { return tokens } -function docTrimmer (builder) { +function docTrimmer(builder) { builder.pipeline.before(lunr.stemmer, docTrimmerFunction) } -function docTrimmerFunction (token) { +function docTrimmerFunction(token) { // Preserve @ and : at the beginning of tokens, // and ? and ! at the end of tokens. It needs to // be done before stemming, otherwise search and @@ -289,7 +290,7 @@ function docTrimmerFunction (token) { }) } -function searchResultsToDecoratedSearchItems (results) { +function searchResultsToDecoratedSearchItems(results) { return results // If the docs are regenerated without changing its version, // a reference may have been doc'ed false in the code but @@ -306,11 +307,11 @@ function searchResultsToDecoratedSearchItems (results) { }) } -function getSearchItemByRef (ref) { +function getSearchItemByRef(ref) { return searchData.items.find(searchItem => searchItem.ref === ref) || null } -function getExcerpts (searchItem, metadata) { +function getExcerpts(searchItem, metadata) { const { doc } = searchItem const searchTerms = Object.keys(metadata) @@ -331,7 +332,7 @@ function getExcerpts (searchItem, metadata) { return excerpts.slice(0, 1) } -function excerpt (doc, sliceStart, sliceLength) { +function excerpt(doc, sliceStart, sliceLength) { const startPos = Math.max(sliceStart - EXCERPT_RADIUS, 0) const endPos = Math.min(sliceStart + sliceLength + EXCERPT_RADIUS, doc.length) return [ diff --git a/formatters/html/dist/html-3VPR65AO.js b/formatters/html/dist/html-C3JAEIFG.js similarity index 78% rename from formatters/html/dist/html-3VPR65AO.js rename to formatters/html/dist/html-C3JAEIFG.js index 1e92775a0..4757978f1 100644 --- a/formatters/html/dist/html-3VPR65AO.js +++ b/formatters/html/dist/html-C3JAEIFG.js @@ -1,9 +1,9 @@ -(()=>{var Ns=Object.create;var Wn=Object.defineProperty;var Ds=Object.getOwnPropertyDescriptor;var Bs=Object.getOwnPropertyNames;var Qs=Object.getPrototypeOf,qs=Object.prototype.hasOwnProperty;var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fs=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Bs(e))!qs.call(t,i)&&i!==n&&Wn(t,i,{get:()=>e[i],enumerable:!(r=Ds(e,i))||r.enumerable});return t};var Y=(t,e,n)=>(n=t!=null?Ns(Qs(t)):{},Fs(e||!t||!t.__esModule?Wn(n,"default",{value:t,enumerable:!0}):n,t));var vr=_((lc,gr)=>{var mr="Expected a function",fr=NaN,Ws="[object Symbol]",zs=/^\s+|\s+$/g,Gs=/^[-+]0x[0-9a-f]+$/i,Ks=/^0b[01]+$/i,Ys=/^0o[0-7]+$/i,Js=parseInt,Xs=typeof global=="object"&&global&&global.Object===Object&&global,Zs=typeof self=="object"&&self&&self.Object===Object&&self,eo=Xs||Zs||Function("return this")(),to=Object.prototype,no=to.toString,ro=Math.max,io=Math.min,Dt=function(){return eo.Date.now()};function so(t,e,n){var r,i,s,o,a,l,u=0,c=!1,d=!1,h=!0;if(typeof t!="function")throw new TypeError(mr);e=pr(e)||0,Fe(n)&&(c=!!n.leading,d="maxWait"in n,s=d?ro(pr(n.maxWait)||0,e):s,h="trailing"in n?!!n.trailing:h);function f(S){var R=r,U=i;return r=i=void 0,u=S,o=t.apply(U,R),o}function m(S){return u=S,a=setTimeout(w,e),c?f(S):o}function g(S){var R=S-l,U=S-u,ee=e-R;return d?io(ee,s-U):ee}function v(S){var R=S-l,U=S-u;return l===void 0||R>=e||R<0||d&&U>=s}function w(){var S=Dt();if(v(S))return x(S);a=setTimeout(w,g(S))}function x(S){return a=void 0,h&&r?f(S):(r=i=void 0,o)}function I(){a!==void 0&&clearTimeout(a),u=0,r=l=i=a=void 0}function q(){return a===void 0?o:x(Dt())}function $(){var S=Dt(),R=v(S);if(r=arguments,i=this,l=S,R){if(a===void 0)return m(l);if(d)return a=setTimeout(w,e),f(l)}return a===void 0&&(a=setTimeout(w,e)),o}return $.cancel=I,$.flush=q,$}function oo(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(mr);return Fe(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),so(t,e,{leading:r,maxWait:e,trailing:i})}function Fe(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function ao(t){return!!t&&typeof t=="object"}function lo(t){return typeof t=="symbol"||ao(t)&&no.call(t)==Ws}function pr(t){if(typeof t=="number")return t;if(lo(t))return fr;if(Fe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Fe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(zs,"");var n=Ks.test(t);return n||Ys.test(t)?Js(t.slice(2),n?2:8):Gs.test(t)?fr:+t}gr.exports=oo});var F=_(D=>{"use strict";D.__esModule=!0;D.extend=Cr;D.indexOf=Eo;D.escapeExpression=xo;D.isEmpty=ko;D.createFrame=So;D.blockParams=_o;D.appendContextPath=Lo;var vo={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},yo=/[&<>"'`=]/g,wo=/[&<>"'`=]/;function bo(t){return vo[t]}function Cr(t){for(var e=1;e{"use strict";je.__esModule=!0;var Wt=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function zt(t,e){var n=e&&e.loc,r=void 0,i=void 0,s=void 0,o=void 0;n&&(r=n.start.line,i=n.end.line,s=n.start.column,o=n.end.column,t+=" - "+r+":"+s);for(var a=Error.prototype.constructor.call(this,t),l=0;l{"use strict";We.__esModule=!0;var Gt=F();We.default=function(t){t.registerHelper("blockHelperMissing",function(e,n){var r=n.inverse,i=n.fn;if(e===!0)return i(this);if(e===!1||e==null)return r(this);if(Gt.isArray(e))return e.length>0?(n.ids&&(n.ids=[n.name]),t.helpers.each(e,n)):r(this);if(n.data&&n.ids){var s=Gt.createFrame(n.data);s.contextPath=Gt.appendContextPath(n.data.contextPath,n.name),n={data:s}}return i(e,n)})};Hr.exports=We.default});var Br=_((ze,Dr)=>{"use strict";ze.__esModule=!0;function To(t){return t&&t.__esModule?t:{default:t}}var we=F(),Po=X(),Oo=To(Po);ze.default=function(t){t.registerHelper("each",function(e,n){if(!n)throw new Oo.default("Must pass iterator to #each");var r=n.fn,i=n.inverse,s=0,o="",a=void 0,l=void 0;n.data&&n.ids&&(l=we.appendContextPath(n.data.contextPath,n.ids[0])+"."),we.isFunction(e)&&(e=e.call(this)),n.data&&(a=we.createFrame(n.data));function u(m,g,v){a&&(a.key=m,a.index=g,a.first=g===0,a.last=!!v,l&&(a.contextPath=l+m)),o=o+r(e[m],{data:a,blockParams:we.blockParams([e[m],m],[l+m,null])})}if(e&&typeof e=="object")if(we.isArray(e))for(var c=e.length;s{"use strict";Ge.__esModule=!0;function Io(t){return t&&t.__esModule?t:{default:t}}var Ao=X(),Co=Io(Ao);Ge.default=function(t){t.registerHelper("helperMissing",function(){if(arguments.length!==1)throw new Co.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};Qr.exports=Ge.default});var Ur=_((Ke,$r)=>{"use strict";Ke.__esModule=!0;function Ro(t){return t&&t.__esModule?t:{default:t}}var Fr=F(),Mo=X(),Vr=Ro(Mo);Ke.default=function(t){t.registerHelper("if",function(e,n){if(arguments.length!=2)throw new Vr.default("#if requires exactly one argument");return Fr.isFunction(e)&&(e=e.call(this)),!n.hash.includeZero&&!e||Fr.isEmpty(e)?n.inverse(this):n.fn(this)}),t.registerHelper("unless",function(e,n){if(arguments.length!=2)throw new Vr.default("#unless requires exactly one argument");return t.helpers.if.call(this,e,{fn:n.inverse,inverse:n.fn,hash:n.hash})})};$r.exports=Ke.default});var Wr=_((Ye,jr)=>{"use strict";Ye.__esModule=!0;Ye.default=function(t){t.registerHelper("log",function(){for(var e=[void 0],n=arguments[arguments.length-1],r=0;r{"use strict";Je.__esModule=!0;Je.default=function(t){t.registerHelper("lookup",function(e,n,r){return e&&r.lookupProperty(e,n)})};zr.exports=Je.default});var Yr=_((Xe,Kr)=>{"use strict";Xe.__esModule=!0;function Ho(t){return t&&t.__esModule?t:{default:t}}var be=F(),No=X(),Do=Ho(No);Xe.default=function(t){t.registerHelper("with",function(e,n){if(arguments.length!=2)throw new Do.default("#with requires exactly one argument");be.isFunction(e)&&(e=e.call(this));var r=n.fn;if(be.isEmpty(e))return n.inverse(this);var i=n.data;return n.data&&n.ids&&(i=be.createFrame(n.data),i.contextPath=be.appendContextPath(n.data.contextPath,n.ids[0])),r(e,{data:i,blockParams:be.blockParams([e],[i&&i.contextPath])})})};Kr.exports=Xe.default});var Kt=_(Ze=>{"use strict";Ze.__esModule=!0;Ze.registerDefaultHelpers=Xo;Ze.moveHelperToHooks=Zo;function se(t){return t&&t.__esModule?t:{default:t}}var Bo=Nr(),Qo=se(Bo),qo=Br(),Fo=se(qo),Vo=qr(),$o=se(Vo),Uo=Ur(),jo=se(Uo),Wo=Wr(),zo=se(Wo),Go=Gr(),Ko=se(Go),Yo=Yr(),Jo=se(Yo);function Xo(t){Qo.default(t),Fo.default(t),$o.default(t),jo.default(t),zo.default(t),Ko.default(t),Jo.default(t)}function Zo(t,e,n){t.helpers[e]&&(t.hooks[e]=t.helpers[e],n||delete t.helpers[e])}});var Xr=_((et,Jr)=>{"use strict";et.__esModule=!0;var ea=F();et.default=function(t){t.registerDecorator("inline",function(e,n,r,i){var s=e;return n.partials||(n.partials={},s=function(o,a){var l=r.partials;r.partials=ea.extend({},l,n.partials);var u=e(o,a);return r.partials=l,u}),n.partials[i.args[0]]=i.fn,s})};Jr.exports=et.default});var Zr=_(Yt=>{"use strict";Yt.__esModule=!0;Yt.registerDefaultDecorators=ia;function ta(t){return t&&t.__esModule?t:{default:t}}var na=Xr(),ra=ta(na);function ia(t){ra.default(t)}});var Jt=_((tt,ei)=>{"use strict";tt.__esModule=!0;var sa=F(),fe={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if(typeof e=="string"){var n=sa.indexOf(fe.methodMap,e.toLowerCase());n>=0?e=n:e=parseInt(e,10)}return e},log:function(e){if(e=fe.lookupLevel(e),typeof console<"u"&&fe.lookupLevel(fe.level)<=e){var n=fe.methodMap[e];console[n]||(n="log");for(var r=arguments.length,i=Array(r>1?r-1:0),s=1;s{"use strict";Xt.__esModule=!0;Xt.createNewLookupObject=aa;var oa=F();function aa(){for(var t=arguments.length,e=Array(t),n=0;n{"use strict";Ee.__esModule=!0;Ee.createProtoAccessControl=da;Ee.resultIsAllowed=ha;Ee.resetLoggedProperties=pa;function la(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}var ni=ti(),ua=Jt(),ca=la(ua),nt=Object.create(null);function da(t){var e=Object.create(null);e.constructor=!1,e.__defineGetter__=!1,e.__defineSetter__=!1,e.__lookupGetter__=!1;var n=Object.create(null);return n.__proto__=!1,{properties:{whitelist:ni.createNewLookupObject(n,t.allowedProtoProperties),defaultValue:t.allowProtoPropertiesByDefault},methods:{whitelist:ni.createNewLookupObject(e,t.allowedProtoMethods),defaultValue:t.allowProtoMethodsByDefault}}}function ha(t,e,n){return ri(typeof t=="function"?e.methods:e.properties,n)}function ri(t,e){return t.whitelist[e]!==void 0?t.whitelist[e]===!0:t.defaultValue!==void 0?t.defaultValue:(fa(e),!1)}function fa(t){nt[t]!==!0&&(nt[t]=!0,ca.log("error",'Handlebars: Access has been denied to resolve the property "'+t+`" because it is not an "own property" of its parent. +(()=>{var Ns=Object.create;var Wn=Object.defineProperty;var Ds=Object.getOwnPropertyDescriptor;var Bs=Object.getOwnPropertyNames;var Qs=Object.getPrototypeOf,qs=Object.prototype.hasOwnProperty;var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fs=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Bs(e))!qs.call(t,i)&&i!==n&&Wn(t,i,{get:()=>e[i],enumerable:!(r=Ds(e,i))||r.enumerable});return t};var Y=(t,e,n)=>(n=t!=null?Ns(Qs(t)):{},Fs(e||!t||!t.__esModule?Wn(n,"default",{value:t,enumerable:!0}):n,t));var vr=_((lc,gr)=>{var mr="Expected a function",fr=NaN,Ws="[object Symbol]",zs=/^\s+|\s+$/g,Gs=/^[-+]0x[0-9a-f]+$/i,Ks=/^0b[01]+$/i,Ys=/^0o[0-7]+$/i,Js=parseInt,Xs=typeof global=="object"&&global&&global.Object===Object&&global,Zs=typeof self=="object"&&self&&self.Object===Object&&self,eo=Xs||Zs||Function("return this")(),to=Object.prototype,no=to.toString,ro=Math.max,io=Math.min,Nt=function(){return eo.Date.now()};function so(t,e,n){var r,i,s,o,a,l,u=0,c=!1,d=!1,h=!0;if(typeof t!="function")throw new TypeError(mr);e=pr(e)||0,Ve(n)&&(c=!!n.leading,d="maxWait"in n,s=d?ro(pr(n.maxWait)||0,e):s,h="trailing"in n?!!n.trailing:h);function f(S){var R=r,U=i;return r=i=void 0,u=S,o=t.apply(U,R),o}function m(S){return u=S,a=setTimeout(w,e),c?f(S):o}function g(S){var R=S-l,U=S-u,ee=e-R;return d?io(ee,s-U):ee}function v(S){var R=S-l,U=S-u;return l===void 0||R>=e||R<0||d&&U>=s}function w(){var S=Nt();if(v(S))return x(S);a=setTimeout(w,g(S))}function x(S){return a=void 0,h&&r?f(S):(r=i=void 0,o)}function I(){a!==void 0&&clearTimeout(a),u=0,r=l=i=a=void 0}function q(){return a===void 0?o:x(Nt())}function $(){var S=Nt(),R=v(S);if(r=arguments,i=this,l=S,R){if(a===void 0)return m(l);if(d)return a=setTimeout(w,e),f(l)}return a===void 0&&(a=setTimeout(w,e)),o}return $.cancel=I,$.flush=q,$}function oo(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(mr);return Ve(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),so(t,e,{leading:r,maxWait:e,trailing:i})}function Ve(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function ao(t){return!!t&&typeof t=="object"}function lo(t){return typeof t=="symbol"||ao(t)&&no.call(t)==Ws}function pr(t){if(typeof t=="number")return t;if(lo(t))return fr;if(Ve(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ve(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(zs,"");var n=Ks.test(t);return n||Ys.test(t)?Js(t.slice(2),n?2:8):Gs.test(t)?fr:+t}gr.exports=oo});var F=_(D=>{"use strict";D.__esModule=!0;D.extend=Cr;D.indexOf=Eo;D.escapeExpression=xo;D.isEmpty=ko;D.createFrame=So;D.blockParams=_o;D.appendContextPath=Lo;var vo={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},yo=/[&<>"'`=]/g,wo=/[&<>"'`=]/;function bo(t){return vo[t]}function Cr(t){for(var e=1;e{"use strict";We.__esModule=!0;var jt=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function Wt(t,e){var n=e&&e.loc,r=void 0,i=void 0,s=void 0,o=void 0;n&&(r=n.start.line,i=n.end.line,s=n.start.column,o=n.end.column,t+=" - "+r+":"+s);for(var a=Error.prototype.constructor.call(this,t),l=0;l{"use strict";ze.__esModule=!0;var zt=F();ze.default=function(t){t.registerHelper("blockHelperMissing",function(e,n){var r=n.inverse,i=n.fn;if(e===!0)return i(this);if(e===!1||e==null)return r(this);if(zt.isArray(e))return e.length>0?(n.ids&&(n.ids=[n.name]),t.helpers.each(e,n)):r(this);if(n.data&&n.ids){var s=zt.createFrame(n.data);s.contextPath=zt.appendContextPath(n.data.contextPath,n.name),n={data:s}}return i(e,n)})};Hr.exports=ze.default});var Br=_((Ge,Dr)=>{"use strict";Ge.__esModule=!0;function To(t){return t&&t.__esModule?t:{default:t}}var be=F(),Po=X(),Oo=To(Po);Ge.default=function(t){t.registerHelper("each",function(e,n){if(!n)throw new Oo.default("Must pass iterator to #each");var r=n.fn,i=n.inverse,s=0,o="",a=void 0,l=void 0;n.data&&n.ids&&(l=be.appendContextPath(n.data.contextPath,n.ids[0])+"."),be.isFunction(e)&&(e=e.call(this)),n.data&&(a=be.createFrame(n.data));function u(m,g,v){a&&(a.key=m,a.index=g,a.first=g===0,a.last=!!v,l&&(a.contextPath=l+m)),o=o+r(e[m],{data:a,blockParams:be.blockParams([e[m],m],[l+m,null])})}if(e&&typeof e=="object")if(be.isArray(e))for(var c=e.length;s{"use strict";Ke.__esModule=!0;function Io(t){return t&&t.__esModule?t:{default:t}}var Ao=X(),Co=Io(Ao);Ke.default=function(t){t.registerHelper("helperMissing",function(){if(arguments.length!==1)throw new Co.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};Qr.exports=Ke.default});var Ur=_((Ye,$r)=>{"use strict";Ye.__esModule=!0;function Ro(t){return t&&t.__esModule?t:{default:t}}var Fr=F(),Mo=X(),Vr=Ro(Mo);Ye.default=function(t){t.registerHelper("if",function(e,n){if(arguments.length!=2)throw new Vr.default("#if requires exactly one argument");return Fr.isFunction(e)&&(e=e.call(this)),!n.hash.includeZero&&!e||Fr.isEmpty(e)?n.inverse(this):n.fn(this)}),t.registerHelper("unless",function(e,n){if(arguments.length!=2)throw new Vr.default("#unless requires exactly one argument");return t.helpers.if.call(this,e,{fn:n.inverse,inverse:n.fn,hash:n.hash})})};$r.exports=Ye.default});var Wr=_((Je,jr)=>{"use strict";Je.__esModule=!0;Je.default=function(t){t.registerHelper("log",function(){for(var e=[void 0],n=arguments[arguments.length-1],r=0;r{"use strict";Xe.__esModule=!0;Xe.default=function(t){t.registerHelper("lookup",function(e,n,r){return e&&r.lookupProperty(e,n)})};zr.exports=Xe.default});var Yr=_((Ze,Kr)=>{"use strict";Ze.__esModule=!0;function Ho(t){return t&&t.__esModule?t:{default:t}}var Ee=F(),No=X(),Do=Ho(No);Ze.default=function(t){t.registerHelper("with",function(e,n){if(arguments.length!=2)throw new Do.default("#with requires exactly one argument");Ee.isFunction(e)&&(e=e.call(this));var r=n.fn;if(Ee.isEmpty(e))return n.inverse(this);var i=n.data;return n.data&&n.ids&&(i=Ee.createFrame(n.data),i.contextPath=Ee.appendContextPath(n.data.contextPath,n.ids[0])),r(e,{data:i,blockParams:Ee.blockParams([e],[i&&i.contextPath])})})};Kr.exports=Ze.default});var Gt=_(et=>{"use strict";et.__esModule=!0;et.registerDefaultHelpers=Xo;et.moveHelperToHooks=Zo;function se(t){return t&&t.__esModule?t:{default:t}}var Bo=Nr(),Qo=se(Bo),qo=Br(),Fo=se(qo),Vo=qr(),$o=se(Vo),Uo=Ur(),jo=se(Uo),Wo=Wr(),zo=se(Wo),Go=Gr(),Ko=se(Go),Yo=Yr(),Jo=se(Yo);function Xo(t){Qo.default(t),Fo.default(t),$o.default(t),jo.default(t),zo.default(t),Ko.default(t),Jo.default(t)}function Zo(t,e,n){t.helpers[e]&&(t.hooks[e]=t.helpers[e],n||delete t.helpers[e])}});var Xr=_((tt,Jr)=>{"use strict";tt.__esModule=!0;var ea=F();tt.default=function(t){t.registerDecorator("inline",function(e,n,r,i){var s=e;return n.partials||(n.partials={},s=function(o,a){var l=r.partials;r.partials=ea.extend({},l,n.partials);var u=e(o,a);return r.partials=l,u}),n.partials[i.args[0]]=i.fn,s})};Jr.exports=tt.default});var Zr=_(Kt=>{"use strict";Kt.__esModule=!0;Kt.registerDefaultDecorators=ia;function ta(t){return t&&t.__esModule?t:{default:t}}var na=Xr(),ra=ta(na);function ia(t){ra.default(t)}});var Yt=_((nt,ei)=>{"use strict";nt.__esModule=!0;var sa=F(),pe={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if(typeof e=="string"){var n=sa.indexOf(pe.methodMap,e.toLowerCase());n>=0?e=n:e=parseInt(e,10)}return e},log:function(e){if(e=pe.lookupLevel(e),typeof console<"u"&&pe.lookupLevel(pe.level)<=e){var n=pe.methodMap[e];console[n]||(n="log");for(var r=arguments.length,i=Array(r>1?r-1:0),s=1;s{"use strict";Jt.__esModule=!0;Jt.createNewLookupObject=aa;var oa=F();function aa(){for(var t=arguments.length,e=Array(t),n=0;n{"use strict";xe.__esModule=!0;xe.createProtoAccessControl=da;xe.resultIsAllowed=ha;xe.resetLoggedProperties=pa;function la(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}var ni=ti(),ua=Yt(),ca=la(ua),rt=Object.create(null);function da(t){var e=Object.create(null);e.constructor=!1,e.__defineGetter__=!1,e.__defineSetter__=!1,e.__lookupGetter__=!1;var n=Object.create(null);return n.__proto__=!1,{properties:{whitelist:ni.createNewLookupObject(n,t.allowedProtoProperties),defaultValue:t.allowProtoPropertiesByDefault},methods:{whitelist:ni.createNewLookupObject(e,t.allowedProtoMethods),defaultValue:t.allowProtoMethodsByDefault}}}function ha(t,e,n){return ri(typeof t=="function"?e.methods:e.properties,n)}function ri(t,e){return t.whitelist[e]!==void 0?t.whitelist[e]===!0:t.defaultValue!==void 0?t.defaultValue:(fa(e),!1)}function fa(t){rt[t]!==!0&&(rt[t]=!0,ca.log("error",'Handlebars: Access has been denied to resolve the property "'+t+`" because it is not an "own property" of its parent. You can add a runtime option to disable the check or this warning: -See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`))}function pa(){Object.keys(nt).forEach(function(t){delete nt[t]})}});var rn=_(j=>{"use strict";j.__esModule=!0;j.HandlebarsEnvironment=nn;function ii(t){return t&&t.__esModule?t:{default:t}}var oe=F(),ma=X(),en=ii(ma),ga=Kt(),va=Zr(),ya=Jt(),rt=ii(ya),wa=Zt(),ba="4.7.7";j.VERSION=ba;var Ea=8;j.COMPILER_REVISION=Ea;var xa=7;j.LAST_COMPATIBLE_COMPILER_REVISION=xa;var ka={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};j.REVISION_CHANGES=ka;var tn="[object Object]";function nn(t,e,n){this.helpers=t||{},this.partials=e||{},this.decorators=n||{},ga.registerDefaultHelpers(this),va.registerDefaultDecorators(this)}nn.prototype={constructor:nn,logger:rt.default,log:rt.default.log,registerHelper:function(e,n){if(oe.toString.call(e)===tn){if(n)throw new en.default("Arg not supported with multiple helpers");oe.extend(this.helpers,e)}else this.helpers[e]=n},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,n){if(oe.toString.call(e)===tn)oe.extend(this.partials,e);else{if(typeof n>"u")throw new en.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=n}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,n){if(oe.toString.call(e)===tn){if(n)throw new en.default("Arg not supported with multiple decorators");oe.extend(this.decorators,e)}else this.decorators[e]=n},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function(){wa.resetLoggedProperties()}};var Sa=rt.default.log;j.log=Sa;j.createFrame=oe.createFrame;j.logger=rt.default});var oi=_((it,si)=>{"use strict";it.__esModule=!0;function sn(t){this.string=t}sn.prototype.toString=sn.prototype.toHTML=function(){return""+this.string};it.default=sn;si.exports=it.default});var ai=_(on=>{"use strict";on.__esModule=!0;on.wrapHelper=_a;function _a(t,e){if(typeof t!="function")return t;var n=function(){var i=arguments[arguments.length-1];return arguments[arguments.length-1]=e(i),t.apply(this,arguments)};return n}});var hi=_(Z=>{"use strict";Z.__esModule=!0;Z.checkRevision=Aa;Z.template=Ca;Z.wrapProgram=st;Z.resolvePartial=Ra;Z.invokePartial=Ma;Z.noop=ci;function La(t){return t&&t.__esModule?t:{default:t}}function Ta(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}var Pa=F(),z=Ta(Pa),Oa=X(),G=La(Oa),K=rn(),li=Kt(),Ia=ai(),ui=Zt();function Aa(t){var e=t&&t[0]||1,n=K.COMPILER_REVISION;if(!(e>=K.LAST_COMPATIBLE_COMPILER_REVISION&&e<=K.COMPILER_REVISION))if(e{"use strict";j.__esModule=!0;j.HandlebarsEnvironment=tn;function ii(t){return t&&t.__esModule?t:{default:t}}var oe=F(),ma=X(),Zt=ii(ma),ga=Gt(),va=Zr(),ya=Yt(),it=ii(ya),wa=Xt(),ba="4.7.7";j.VERSION=ba;var Ea=8;j.COMPILER_REVISION=Ea;var xa=7;j.LAST_COMPATIBLE_COMPILER_REVISION=xa;var ka={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};j.REVISION_CHANGES=ka;var en="[object Object]";function tn(t,e,n){this.helpers=t||{},this.partials=e||{},this.decorators=n||{},ga.registerDefaultHelpers(this),va.registerDefaultDecorators(this)}tn.prototype={constructor:tn,logger:it.default,log:it.default.log,registerHelper:function(e,n){if(oe.toString.call(e)===en){if(n)throw new Zt.default("Arg not supported with multiple helpers");oe.extend(this.helpers,e)}else this.helpers[e]=n},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,n){if(oe.toString.call(e)===en)oe.extend(this.partials,e);else{if(typeof n>"u")throw new Zt.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=n}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,n){if(oe.toString.call(e)===en){if(n)throw new Zt.default("Arg not supported with multiple decorators");oe.extend(this.decorators,e)}else this.decorators[e]=n},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function(){wa.resetLoggedProperties()}};var Sa=it.default.log;j.log=Sa;j.createFrame=oe.createFrame;j.logger=it.default});var oi=_((st,si)=>{"use strict";st.__esModule=!0;function rn(t){this.string=t}rn.prototype.toString=rn.prototype.toHTML=function(){return""+this.string};st.default=rn;si.exports=st.default});var ai=_(sn=>{"use strict";sn.__esModule=!0;sn.wrapHelper=_a;function _a(t,e){if(typeof t!="function")return t;var n=function(){var i=arguments[arguments.length-1];return arguments[arguments.length-1]=e(i),t.apply(this,arguments)};return n}});var hi=_(Z=>{"use strict";Z.__esModule=!0;Z.checkRevision=Aa;Z.template=Ca;Z.wrapProgram=ot;Z.resolvePartial=Ra;Z.invokePartial=Ma;Z.noop=ci;function La(t){return t&&t.__esModule?t:{default:t}}function Ta(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}var Pa=F(),z=Ta(Pa),Oa=X(),G=La(Oa),K=nn(),li=Gt(),Ia=ai(),ui=Xt();function Aa(t){var e=t&&t[0]||1,n=K.COMPILER_REVISION;if(!(e>=K.LAST_COMPATIBLE_COMPILER_REVISION&&e<=K.COMPILER_REVISION))if(e{"use strict";ot.__esModule=!0;ot.default=function(t){var e=typeof global<"u"?global:window,n=e.Handlebars;t.noConflict=function(){return e.Handlebars===t&&(e.Handlebars=n),t}};fi.exports=ot.default});var ae=_((at,yi)=>{"use strict";at.__esModule=!0;function ln(t){return t&&t.__esModule?t:{default:t}}function un(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}var Ba=rn(),mi=un(Ba),Qa=oi(),qa=ln(Qa),Fa=X(),Va=ln(Fa),$a=F(),an=un($a),Ua=hi(),gi=un(Ua),ja=pi(),Wa=ln(ja);function vi(){var t=new mi.HandlebarsEnvironment;return an.extend(t,mi),t.SafeString=qa.default,t.Exception=Va.default,t.Utils=an,t.escapeExpression=an.escapeExpression,t.VM=gi,t.template=function(e){return gi.template(e,t)},t}var xe=vi();xe.create=vi;Wa.default(xe);xe.default=xe;at.default=xe;yi.exports=at.default});var Zi=_((Ji,Xi)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var c=t.utils.clone(n)||{};c.position=[a,u],c.index=s.length,s.push(new t.Token(r.slice(a,o),c))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?c+=2:a==l&&(n+=r[u+1]*i[c+1],u+=2,c+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.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 t.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 t.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 c=s.str.charAt(0),d=s.str.charAt(1),h;d in s.node.edges?h=s.node.edges[d]:(h=new t.TokenSet,s.node.edges[d]=h),s.str.length==1&&(h.final=!0),i.push({node:h,editsRemaining:s.editsRemaining-1,str:c+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;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()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.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;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.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 t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof Ji=="object"?Xi.exports=n():e.lunr=n()}(this,function(){return t})})()});var zn=new URLSearchParams(window.location.search),A=window.self!==window.parent,Gn=zn.has("preview"),Kn=zn.has("hint");function Ae(){return window.sidebarNodes||{}}function Yn(){return window.versionNodes||[]}function Jn(){return window.searchNodes||[]}var p=document.querySelector.bind(document),M=document.querySelectorAll.bind(document);function Xn(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Re(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function Me(){return document.getElementById("main").dataset.type}var Ce=["H1","H2","H3","H4","H5","H6"];function He(t=!1){let e=window.location.hash.replace(/^#/,"");if(!e)return t?document.getElementById("top-content"):null;let n=document.getElementById(e);if(!n)return null;if(n.matches(".detail"))return n;if(Ce.includes(n.tagName))return Pt(n);let r=Vs(n);return r||document.getElementById("top-content")}function Vs(t){let e=t.previousElementSibling;for(;e;){if(Ce.includes(e.tagName))return Pt(e);e=e.previousElementSibling}let n=t.parentNode;for(;n;){for(e=n.previousElementSibling;e;){if(Ce.includes(e.tagName))return Pt(e);e=e.previousElementSibling}n=n.parentNode}return null}function Pt(t){let e=document.createElement("div"),n=[t],r=t;for(;(r=r.nextSibling)&&!(Ce.includes(r.tagName)&&r.tagName<=t.tagName);)n.push(r);return e.append(...n),e}function Ot(t){return new URLSearchParams(window.location.search).get(t)}function It(t){return fetch(t).then(e=>e.ok).catch(()=>!1)}function he(t){return!t||t.trim()===""}function Zn(t,e){let n;return function(...i){clearTimeout(n),n=setTimeout(()=>{n=null,t(...i)},e)}}function Ne(){return document.head.querySelector("meta[name=project][content]").content}function De(){return document.documentElement.classList.contains("apple-os")}function E(t,e,n){let r=document.createElement(t);for(let i in e)e[i]!=null&&r.setAttribute(i,e[i]);return n&&r.replaceChildren(...n),r}if(Gn&&A){let t=He(!0);if(t){document.body.classList.add("preview"),document.getElementById("content").replaceChildren(...t.childNodes);let e=document.getElementsByTagName("a:not([target=_blank]");for(let n of e)n.setAttribute("target","_parent");window.scrollTo(0,0),document.body.style.position="fixed",setTimeout(er),window.addEventListener("resize",er)}}function er(){let t={type:"preview",contentHeight:document.getElementById("content").parentElement.offsetHeight};window.parent.postMessage(t,"*")}var ie={plain:"plain",function:"function",module:"module"},$s=[{href:"typespecs.html#basic-types",hint:{kind:ie.plain,description:"Basic type"}},{href:"typespecs.html#literals",hint:{kind:ie.plain,description:"Literal"}},{href:"typespecs.html#built-in-types",hint:{kind:ie.plain,description:"Built-in type"}}],Be={cancelHintFetching:null};function tr(t){if(rr(t))return!0;let e=/#.*\//;return t.includes("#")&&!e.test(t)?!1:t.includes(".html")}function nr(t){let e=rr(t);return e?Promise.resolve(e):Us(t)}function rr(t){let e=$s.find(n=>t.includes(n.href));return e?e.hint:null}function Us(t){let e=t.replace(".html",".html?hint=true");return new Promise((n,r)=>{let i=document.createElement("iframe");i.setAttribute("src",e),i.style.display="none";function s(a){let{href:l,hint:u}=a.data;e===l&&(o(),n(u))}Be.cancelHintFetching=()=>{o(),r(new Error("cancelled"))};function o(){i.remove(),window.removeEventListener("message",s),Be.cancelHintFetching=null}window.addEventListener("message",s),document.body.appendChild(i)})}function ir(){Be.cancelHintFetching&&Be.cancelHintFetching()}function sr(t){let n=t.querySelector("h1").textContent,r=t.querySelector(".docstring > p"),i=r?r.innerHTML:"";return{kind:ie.function,title:n.trim(),description:i.trim()}}function or(t){let n=t.querySelector("h1 > span").textContent,r=t.querySelector("#moduledoc p"),i=r?r.innerHTML:"";return{kind:ie.module,title:n.trim(),description:i.trim()}}if(Kn&&A){let t=He(),e=t?sr(t):["modules","tasks"].includes(Me())?or(p(".content-inner")):null;if(e){let n={hint:{...e,version:Ne()},href:window.location.href};window.parent.postMessage(n,"*")}p(".content-inner")?.replaceChildren()}var At="ex_doc:settings",ar="dark",Ct="system",Rt="dark",Mt="light";var js={tooltips:!0,theme:null,livebookUrl:null},Ht=class{constructor(){this._subscribers=[],this._settings=js,this._loadSettings()}get(){return this._settings}update(e){let n=this._settings;this._settings={...this._settings,...e},this._subscribers.forEach(r=>r(this._settings,n)),this._storeSettings()}getAndSubscribe(e){this._subscribers.push(e),e(this._settings)}_loadSettings(){try{let e=localStorage.getItem(At);if(e){let n=JSON.parse(e);this._settings={...this._settings,...n}}this._loadSettingsLegacy()}catch(e){console.error(`Failed to load settings: ${e}`)}}_storeSettings(){try{this._storeSettingsLegacy(),localStorage.setItem(At,JSON.stringify(this._settings))}catch(e){console.error(`Failed to persist settings: ${e}`)}}_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"))}},H=new Ht;var lr=!1,Qe=null,J=null;function ur(t){lr||(lr=!0,J=document.getElementById("toast"),J?.addEventListener("click",()=>{clearTimeout(Qe),J.classList.remove("show")})),J&&(clearTimeout(Qe),J.innerText=t,J.classList.add("show"),Qe=setTimeout(()=>{J.classList.remove("show"),Qe=setTimeout(function(){J.innerText=""},1e3)},5e3))}var Nt=[Ct,Rt,Mt],cr=window.matchMedia("(prefers-color-scheme: dark)");H.getAndSubscribe(dr);cr.addEventListener("change",dr);function dr(){let t=qe(),e=t===Rt||t!==Mt&&cr.matches;document.body.classList.toggle(ar,e)}function hr(){let t=Nt[Nt.indexOf(qe())+1]||Nt[0];H.update({theme:t}),ur(`Set theme to "${t}"`)}function qe(){return new URLSearchParams(window.location.search).get("theme")||H.get().theme||Ct}var Sr=Y(vr());var Bt="sidebar_state",Qt="closed",yr="open",wr="sidebar_width";var Ve="sidebar-open",$e="sidebar-transition";var br=!1;function Er(){if(br)return;br=!0;let t=document.getElementById("sidebar-list-nav");if(!t)return;let e=Me(),n={extras:t.dataset.extras||"Pages",modules:"Modules",tasks:'Mix Tasks'};Object.entries(n).forEach(([r,i])=>{let s=Ae()[r];if(!s?.length)return;let o=`${r}-list-tab-button`,a=`${r}-tab-panel`,l=r===e,u=E("button",{id:o,role:"tab",tabindex:l?0:-1,"aria-selected":l||void 0,"aria-controls":a});u.innerHTML=i,u.addEventListener("keydown",ho),u.addEventListener("click",fo),t.appendChild(E("li",{},[u]));let c=E("ul",{class:"full-list"});c.addEventListener("click",po);let d=E("div",{id:a,class:"sidebar-tabpanel",role:"tabpanel","aria-labelledby":o,hidden:l?void 0:""},[c]);document.getElementById("sidebar").appendChild(d);let h="",f,m;c.replaceChildren(...s.flatMap(g=>{let v=[],w=Array.isArray(g.headers),x=w?void 0:"no";return g.group!==h&&(v.push(E("li",{class:"group",translate:x},[g.group])),h=g.group,f=void 0),g.nested_context&&g.nested_context!==f?(f=g.nested_context,m!==f&&v.push(E("li",{class:"nesting-context",translate:"no","aria-hidden":!0},[f]))):m=g.title,v.push(E("li",{},[E("a",{href:`${g.id}.html`,translate:x},[g.nested_title||g.title]),...Ft(`node-${g.id}-headers`,w?uo(g):co(g))])),v}))}),window.addEventListener("hashchange",qt),window.addEventListener("swup:page:view",qt),qt(),requestAnimationFrame(xr)}function Ft(t,e){return e.length?[E("button",{"aria-label":"expand","aria-expanded":!1,"aria-controls":t}),E("ul",{id:t},e)]:[]}function uo(t){return t.headers.map(({id:e,anchor:n})=>E("li",{},[E("a",{href:`${t.id}.html#${n}`},[e])]))}function co(t){let e=[];return t.sections?.length&&e.push(E("li",{},[E("a",{href:`${t.id}.html#content`},["Sections"]),...Ft(`${t.id}-sections-list`,t.sections.map(({id:n,anchor:r})=>E("li",{},[E("a",{href:`${t.id}.html#${r}`},[n])])))])),t.nodeGroups&&(e.push(E("li",{},[E("a",{href:`${t.id}.html#summary`},["Summary"])])),e.push(...t.nodeGroups.map(({key:n,name:r,nodes:i})=>E("li",{},[E("a",{href:`${t.id}.html#${n}`},[r]),...Ft(`node-${t.id}-group-${n}-list`,i.map(({anchor:s,title:o,id:a})=>E("li",{},[E("a",{href:`${t.id}.html#${s}`,title:o,translate:"no"},[a])])))])))),e}function Vt(t){let e=document.getElementById("sidebar-list-nav").querySelector("[aria-selected]");e!==t&&(e&&(e.removeAttribute("aria-selected"),e.setAttribute("tabindex","-1"),document.getElementById(e.getAttribute("aria-controls")).setAttribute("hidden","hidden")),t.setAttribute("aria-selected","true"),t.setAttribute("tabindex","0"),document.getElementById(t.getAttribute("aria-controls")).removeAttribute("hidden"))}function xr(){p("#sidebar [role=tabpanel]:not([hidden]) a[aria-selected]")?.scrollIntoView()}function qt(){let t=document.getElementById("sidebar"),{pathname:e,hash:n}=window.location,r=e.split("/").pop().replace(/\.html$/,"")+".html",i=t.querySelector(`li a[href="${r+n}"]`)||t.querySelector(`li a[href="${r}"]`);if(!i)return;t.querySelectorAll(".full-list a[aria-selected]").forEach(o=>{o.removeAttribute("aria-selected")}),t.querySelectorAll(".full-list button[aria-expanded=true]").forEach(o=>{o.setAttribute("aria-expanded",!1)});let s=i.parentElement;for(;s;){if(s.tagName==="LI"){let o=s.firstChild;o.setAttribute("aria-selected",o.getAttribute("href")===r?"page":"true");let a=o.nextSibling;a?.tagName==="BUTTON"&&a.setAttribute("aria-expanded",!0)}else if(s.role==="tabpanel"){s.hasAttribute("hidden")&&Vt(document.getElementById(s.getAttribute("aria-labelledby")));break}s=s.parentElement}}function ho(t){if(!["ArrowRight","ArrowLeft"].includes(t.key))return;let e=Array.from(M('#sidebar-list-nav [role="tab"]')),r=e.indexOf(t.currentTarget)+(t.key==="ArrowRight"?1:-1),i=e.at(r%e.length);Vt(i),i.focus()}function fo(t){Vt(t.currentTarget),xr()}function po(t){let e=t.target;e.tagName==="BUTTON"&&e.setAttribute("aria-expanded",e.getAttribute("aria-expanded")==="false")}var go=300,_r=".sidebar-toggle",Lr=window.matchMedia(`screen and (max-width: ${768}px)`);if(!A){$t(),window.addEventListener("swup:page:view",$t);let t=document.getElementById("sidebar"),e=p(_r);e.addEventListener("click",Ue),document.body.addEventListener("click",i=>{Lr.matches&&Tr()&&!t.contains(i.target)&&!e.contains(i.target)&&Ue()});let n=window.innerWidth;window.addEventListener("resize",(0,Sr.default)(()=>{n!==window.innerWidth&&(n=window.innerWidth,$t())},100));let r=new ResizeObserver(([i])=>{if(!i)return;let s=i.contentRect.width;sessionStorage.setItem(wr,s),document.body.style.setProperty("--sidebarWidth",`${s}px`)});t.addEventListener("mousedown",()=>r.observe(t)),t.addEventListener("mouseup",()=>r.unobserve(t))}function $t(){let e=sessionStorage.getItem(Bt)!==Qt&&!Lr.matches;Or(e)}function Ue(){let t=!Tr();return sessionStorage.setItem(Bt,t?yr:Qt),Ir(t)}function Tr(){return document.body.classList.contains(Ve)}function Pr(){return document.body.classList.contains(Ve)&&!document.body.classList.contains($e)}function Or(t){t&&Er(),document.body.classList.toggle(Ve,t),p(_r).setAttribute("aria-expanded",t?"true":"false")}var kr;function Ir(t){return new Promise(e=>{document.body.classList.add($e),document.body.scrollTop,Or(t),clearTimeout(kr),kr=setTimeout(()=>{document.body.classList.remove($e),e()},go)})}function Ar(){return Ir(!0)}var wi=Y(ae());var cn=Y(ae());cn.registerHelper("isArray",function(t,e){return Array.isArray(t)?e.fn(this):e.inverse(this)});cn.registerHelper("isNonEmptyArray",function(t,e){return Array.isArray(t)&&t.length>0?e.fn(this):e.inverse(this)});var bi=wi.template({1:function(t,e,n,r,i){var s,o,a=e??(t.nullContext||{}),l=t.hooks.helperMissing,u="function",c=t.escapeExpression,d=t.lookupProperty||function(h,f){if(Object.prototype.hasOwnProperty.call(h,f))return h[f]};return'