// Generated by Documenter.jl requirejs.config({ paths: { 'highlight-julia': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/languages/julia.min', 'headroom': 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.12.0/headroom.min', 'jqueryui': 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min', 'katex-auto-render': 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/contrib/auto-render.min', 'jquery': 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min', 'headroom-jquery': 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.12.0/jQuery.headroom.min', 'katex': 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min', 'highlight': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min', 'highlight-julia-repl': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/languages/julia-repl.min', }, shim: { "highlight-julia": { "deps": [ "highlight" ] }, "katex-auto-render": { "deps": [ "katex" ] }, "headroom-jquery": { "deps": [ "jquery", "headroom" ] }, "highlight-julia-repl": { "deps": [ "highlight" ] } } }); //////////////////////////////////////////////////////////////////////////////// require(['jquery', 'katex', 'katex-auto-render'], function($, katex, renderMathInElement) { $(document).ready(function() { renderMathInElement( document.body, { "delimiters": [ { "left": "$", "right": "$", "display": false }, { "left": "$$", "right": "$$", "display": true }, { "left": "\\[", "right": "\\]", "display": true } ] } ); }) }) //////////////////////////////////////////////////////////////////////////////// require(['jquery', 'highlight', 'highlight-julia', 'highlight-julia-repl'], function($) { $(document).ready(function() { hljs.highlightAll(); }) }) //////////////////////////////////////////////////////////////////////////////// require(['jquery'], function($) { let timer = 0; var isExpanded = true; $(document).on("click", ".docstring header", function () { let articleToggleTitle = "Expand docstring"; debounce(() => { if ($(this).siblings("section").is(":visible")) { $(this) .find(".docstring-article-toggle-button") .removeClass("fa-chevron-down") .addClass("fa-chevron-right"); } else { $(this) .find(".docstring-article-toggle-button") .removeClass("fa-chevron-right") .addClass("fa-chevron-down"); articleToggleTitle = "Collapse docstring"; } $(this) .find(".docstring-article-toggle-button") .prop("title", articleToggleTitle); $(this).siblings("section").slideToggle(); }); }); $(document).on("click", ".docs-article-toggle-button", function (event) { let articleToggleTitle = "Expand docstring"; let navArticleToggleTitle = "Expand all docstrings"; let animationSpeed = event.noToggleAnimation ? 0 : 400; debounce(() => { if (isExpanded) { $(this).removeClass("fa-chevron-up").addClass("fa-chevron-down"); $(".docstring-article-toggle-button") .removeClass("fa-chevron-down") .addClass("fa-chevron-right"); isExpanded = false; $(".docstring section").slideUp(animationSpeed); } else { $(this).removeClass("fa-chevron-down").addClass("fa-chevron-up"); $(".docstring-article-toggle-button") .removeClass("fa-chevron-right") .addClass("fa-chevron-down"); isExpanded = true; articleToggleTitle = "Collapse docstring"; navArticleToggleTitle = "Collapse all docstrings"; $(".docstring section").slideDown(animationSpeed); } $(this).prop("title", navArticleToggleTitle); $(".docstring-article-toggle-button").prop("title", articleToggleTitle); }); }); function debounce(callback, timeout = 300) { if (Date.now() - timer > timeout) { callback(); } clearTimeout(timer); timer = Date.now(); } }) //////////////////////////////////////////////////////////////////////////////// require([], function() { function addCopyButtonCallbacks() { for (const el of document.getElementsByTagName("pre")) { const button = document.createElement("button"); button.classList.add("copy-button", "fa-solid", "fa-copy"); button.setAttribute("aria-label", "Copy this code block"); button.setAttribute("title", "Copy"); el.appendChild(button); const success = function () { button.classList.add("success", "fa-check"); button.classList.remove("fa-copy"); }; const failure = function () { button.classList.add("error", "fa-xmark"); button.classList.remove("fa-copy"); }; button.addEventListener("click", function () { copyToClipboard(el.innerText).then(success, failure); setTimeout(function () { button.classList.add("fa-copy"); button.classList.remove("success", "fa-check", "fa-xmark"); }, 5000); }); } } function copyToClipboard(text) { // clipboard API is only available in secure contexts if (window.navigator && window.navigator.clipboard) { return window.navigator.clipboard.writeText(text); } else { return new Promise(function (resolve, reject) { try { const el = document.createElement("textarea"); el.textContent = text; el.style.position = "fixed"; el.style.opacity = 0; document.body.appendChild(el); el.select(); document.execCommand("copy"); resolve(); } catch (err) { reject(err); } finally { document.body.removeChild(el); } }); } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", addCopyButtonCallbacks); } else { addCopyButtonCallbacks(); } }) //////////////////////////////////////////////////////////////////////////////// require(['jquery', 'headroom', 'headroom-jquery'], function($, Headroom) { // Manages the top navigation bar (hides it when the user starts scrolling down on the // mobile). window.Headroom = Headroom; // work around buggy module loading? $(document).ready(function () { $("#documenter .docs-navbar").headroom({ tolerance: { up: 10, down: 10 }, }); }); }) //////////////////////////////////////////////////////////////////////////////// require(['jquery'], function($) { $(document).ready(function () { let meta = $("div[data-docstringscollapsed]").data(); if (meta?.docstringscollapsed) { $("#documenter-article-toggle-button").trigger({ type: "click", noToggleAnimation: true, }); } }); }) //////////////////////////////////////////////////////////////////////////////// require(['jquery'], function($) { /* To get an in-depth about the thought process you can refer: https://hetarth02.hashnode.dev/series/gsoc PSEUDOCODE: Searching happens automatically as the user types or adjusts the selected filters. To preserve responsiveness, as much as possible of the slow parts of the search are done in a web worker. Searching and result generation are done in the worker, and filtering and DOM updates are done in the main thread. The filters are in the main thread as they should be very quick to apply. This lets filters be changed without re-searching with minisearch (which is possible even if filtering is on the worker thread) and also lets filters be changed _while_ the worker is searching and without message passing (neither of which are possible if filtering is on the worker thread) SEARCH WORKER: Import minisearch Build index On message from main thread run search find the first 200 unique results from each category, and compute their divs for display note that this is necessary and sufficient information for the main thread to find the first 200 unique results from any given filter set post results to main thread MAIN: Launch worker Declare nonconstant globals (worker_is_running, last_search_text, unfiltered_results) On text update if worker is not running, launch_search() launch_search set worker_is_running to true, set last_search_text to the search text post the search query to worker on message from worker if last_search_text is not the same as the text in the search field, the latest search result is not reflective of the latest search query, so update again launch_search() otherwise set worker_is_running to false regardless, display the new search results to the user save the unfiltered_results as a global update_search() on filter click adjust the filter selection update_search() update_search apply search filters by looping through the unfiltered_results and finding the first 200 unique results that match the filters Update the DOM */ /////// SEARCH WORKER /////// function worker_function(documenterSearchIndex, documenterBaseURL, filters) { importScripts( "https://cdn.jsdelivr.net/npm/minisearch@6.1.0/dist/umd/index.min.js" ); let data = documenterSearchIndex.map((x, key) => { x["id"] = key; // minisearch requires a unique for each object return x; }); // list below is the lunr 2.1.3 list minus the intersect with names(Base) // (all, any, get, in, is, only, which) and (do, else, for, let, where, while, with) // ideally we'd just filter the original list but it's not available as a variable const stopWords = new Set([ "a", "able", "about", "across", "after", "almost", "also", "am", "among", "an", "and", "are", "as", "at", "be", "because", "been", "but", "by", "can", "cannot", "could", "dear", "did", "does", "either", "ever", "every", "from", "got", "had", "has", "have", "he", "her", "hers", "him", "his", "how", "however", "i", "if", "into", "it", "its", "just", "least", "like", "likely", "may", "me", "might", "most", "must", "my", "neither", "no", "nor", "not", "of", "off", "often", "on", "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", "who", "whom", "why", "will", "would", "yet", "you", "your", ]); let index = new MiniSearch({ fields: ["title", "text"], // fields to index for full-text search storeFields: ["location", "title", "text", "category", "page"], // fields to return with results processTerm: (term) => { let word = stopWords.has(term) ? null : term; if (word) { // custom trimmer that doesn't strip @ and !, which are used in julia macro and function names word = word .replace(/^[^a-zA-Z0-9@!]+/, "") .replace(/[^a-zA-Z0-9@!]+$/, ""); word = word.toLowerCase(); } return word ?? null; }, // add . as a separator, because otherwise "title": "Documenter.Anchors.add!", would not // find anything if searching for "add!", only for the entire qualification tokenize: (string) => string.split(/[\s\-\.]+/), // options which will be applied during the search searchOptions: { prefix: true, boost: { title: 100 }, fuzzy: 2, }, }); index.addAll(data); /** * Used to map characters to HTML entities. * Refer: https://github.com/lodash/lodash/blob/main/src/escape.ts */ const htmlEscapes = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'", }; /** * Used to match HTML entities and HTML characters. * Refer: https://github.com/lodash/lodash/blob/main/src/escape.ts */ const reUnescapedHtml = /[&<>"']/g; const reHasUnescapedHtml = RegExp(reUnescapedHtml.source); /** * Escape function from lodash * Refer: https://github.com/lodash/lodash/blob/main/src/escape.ts */ function escape(string) { return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, (chr) => htmlEscapes[chr]) : string || ""; } /** * Make the result component given a minisearch result data object and the value * of the search input as queryString. To view the result object structure, refer: * https://lucaong.github.io/minisearch/modules/_minisearch_.html#searchresult * * @param {object} result * @param {string} querystring * @returns string */ function make_search_result(result, querystring) { let search_divider = `
`; let display_link = result.location.slice(Math.max(0), Math.min(50, result.location.length)) + (result.location.length > 30 ? "..." : ""); // To cut-off the link because it messes with the overflow of the whole div if (result.page !== "") { display_link += ` (${result.page})`; } let textindex = new RegExp(`${querystring}`, "i").exec(result.text); let text = textindex !== null ? result.text.slice( Math.max(textindex.index - 100, 0), Math.min( textindex.index + querystring.length + 100, result.text.length ) ) : ""; // cut-off text before and after from the match text = text.length ? escape(text) : ""; let display_result = text.length ? "..." + text.replace( new RegExp(`${escape(querystring)}`, "i"), // For first occurrence '$&' ) + "..." : ""; // highlights the match let in_code = false; if (!["page", "section"].includes(result.category.toLowerCase())) { in_code = true; } // We encode the full url to escape some special characters which can lead to broken links let result_div = `${display_result}