14 lines
30 KiB
JavaScript
14 lines
30 KiB
JavaScript
function scrollToTop(){const e=document.getElementById("scroll-to-top");window.scrollY>window.innerHeight*.5?(e.classList.remove("translate-y-4","opacity-0"),e.classList.add("translate-y-0","opacity-100")):(e.classList.remove("translate-y-0","opacity-100"),e.classList.add("translate-y-4","opacity-0"))}window.addEventListener("scroll",scrollToTop),window.addEventListener("load",scrollToTop);function e(e){return Array.isArray?Array.isArray(e):u(e)===`[object Array]`}function t(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function n(e){return e==null?``:t(e)}function r(e){return typeof e==`string`}function i(e){return typeof e==`number`}function a(e){return e===!0||e===!1||s(e)&&u(e)==`[object Boolean]`}function o(e){return typeof e==`object`}function s(e){return o(e)&&e!==null}function c(e){return e!=null}function l(e){return!e.trim().length}function u(e){return e==null?e===0[0]?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}const d=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,f=e=>`Invalid value for key ${e}`,p=e=>`Pattern length exceeds max of ${e}.`,m=e=>`Missing ${e} property in key`,h=e=>`Property 'weight' in key '${e}' must be a positive integer`,g=Object.prototype.hasOwnProperty;var D,N,se,de,ge,$,ye,fuse,showButton,showButtonMobile,hideButton,wrapper,modal,input,output,first,last,searchVisible,indexed,hasResults,_=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=v(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function v(t){let n=null,s=null,o=null,i=1,a=null;if(r(t)||e(t))o=t,n=y(t),s=b(t);else{if(!g.call(t,`name`))throw Error(m(`name`));let e=t.name;if(o=e,g.call(t,`weight`)&&t.weight!==0[0]&&(i=t.weight,i<=0))throw Error(h(b(e)));n=y(e),s=b(e),a=t.getFn??null}return{path:n,id:s,weight:i,src:o,getFn:a}}function y(t){return e(t)?t:t.split(`.`)}function b(t){return e(t)?t.join(`.`):t}function x(t,s){let o=[],d=!1,l=(t,s,u,h)=>{if(c(t))if(s[u]){let m=t[s[u]];if(!c(m))return;if(u===s.length-1&&(r(m)||i(m)||a(m)||typeof m==`bigint`))o.push(h===0[0]?n(m):{v:n(m),i:h});else if(e(m)){d=!0;for(let e=0,t=m.length;e<t;e+=1)l(m[e],s,u+1,e)}else s.length&&l(m,s,u+1,h)}else o.push(h===0[0]?t:{v:t,i:h})};return l(t,r(s)?s.split(`.`):s,0),d?o:o[0]}const S={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},C={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},w={location:0,threshold:.6,distance:100},T={useExtendedSearch:!1,useTokenSearch:!1,tokenize:0[0],tokenMatch:`any`,getFn:x,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},E=Object.freeze({...C,...S,...w,...T});function ee(e=1,t=3){let n=new Map,s=10**t;return{get(t){let o=1,i=!1;for(let e=0;e<t.length;e++)t.charCodeAt(e)===32?i||(o++,i=!0):i=!1;if(n.has(o))return n.get(o);let a=Math.round(s/o**(.5*e))/s;return n.set(o,a),a},clear(){n.clear()}}}D=class{constructor({getFn:e=E.getFn,fieldNormWeight:t=E.fieldNormWeight}={}){this.norm=ee(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(r(this.docs[0]))for(let n=0;n<e;n++){let s=this._createStringRecord(this.docs[n],n);s&&(this.records[t++]=s)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(d);if(r(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(d);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let s of this.records){let e=0,t=n.length;for(;e<t;){let o=e+t>>>1;n[o]<s.i?e=o+1:t=o}s.i-=e}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!c(e)||l(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(t,s){let o={i:s,$:{}};for(let i=0,d=this.keys.length;i<d;i++){let a=this.keys[i],s=a.getFn?a.getFn(t):this.getFn(t,a.path);if(c(s))if(e(s)){let e=[];for(let o=0,i=s.length;o<i;o+=1){let t=s[o];if(c(t))if(r(t)){if(!l(t)){let n={v:t,i:o,n:this.norm.get(t)};e.push(n)}}else if(c(t.v)){let s=r(t.v)?t.v:n(t.v);if(!l(s)){let n={v:s,i:t.i,n:this.norm.get(s)};e.push(n)}}}o.$[i]=e}else if(r(s)&&!l(s)){let e={v:s,n:this.norm.get(s)};o.$[i]=e}}return o}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function O(e,t,{getFn:n=E.getFn,fieldNormWeight:s=E.fieldNormWeight}={}){let o=new D({getFn:n,fieldNormWeight:s});return o.setKeys(e.map(v)),o.setSources(t),o.create(),o}function te(e,{getFn:t=E.getFn,fieldNormWeight:n=E.fieldNormWeight}={}){let{keys:o,records:i}=e,s=new D({getFn:t,fieldNormWeight:n});return s.setKeys(o),s.setIndexRecords(i),s}function ne(e=[],t=E.minMatchCharLength){let o=[],n=-1,i=-1,s=0;for(let r=e.length;s<r;s+=1){let a=e[s];a&&n===-1?n=s:!a&&n!==-1&&(i=s-1,i-n+1>=t&&o.push([n,i]),n=-1)}return e[s-1]&&s-n>=t&&o.push([n,s-1]),o}function re(e,t,n,{location:s=E.location,distance:o=E.distance,threshold:i=E.threshold,findAllMatches:a=E.findAllMatches,minMatchCharLength:r=E.minMatchCharLength,includeMatches:c=E.includeMatches,ignoreLocation:l=E.ignoreLocation}={}){if(t.length>32)throw Error(p(32));let u=t.length,m=e.length,h=Math.max(0,Math.min(s,m)),f=i,d=h,v=(e,t)=>{let n=e/u;if(l)return n;let s=Math.abs(h-t);return o?n+s/o:s?1:n},g=r>1||c,w=g?Array(m):[],b;for(;(b=e.indexOf(t,d))>-1;){let n=v(0,b);if(f=Math.min(n,f),d=b+u,g){let e=0;for(;e<u;)w[b+e]=1,e+=1}}d=-1;let j=[],y=1,x=0,_=u+m,C=1<<u-1;for(let t=0;t<u;t+=1){let i=0,s=_;for(;i<s;)v(t,h+s)<=f?i=s:_=s,s=Math.floor((_-i)/2+i);_=s;let c=Math.max(1,h-s+1),r=a?m:Math.min(h+s,m)+u,o=Array(r+2);o[r+1]=(1<<t)-1;for(let s=r;s>=c;--s){let i=s-1,a=n[e[i]];if(o[s]=(o[s+1]<<1|1)&a,t&&(o[s]|=(j[s+1]|j[s])<<1|1|j[s+1]),o[s]&C&&(y=v(t,i),y<=f)){if(f=y,d=i,x=t,d<=h)break;c=Math.max(1,2*h-d)}}if(v(t+1,h)>f)break;j=o}if(g&&d>=0){let t=Math.min(m-1,d+u-1+x);for(let s=d;s<=t;s+=1)n[e[s]]&&(w[s]=1)}let O={isMatch:d>=0,score:Math.max(.001,y)};if(g){let e=ne(w,r);e.length?c&&(O.indices=e):O.isMatch=!1}return O}function k(e){let t={};for(let n=0,s=e.length;n<s;n+=1){let o=e.charAt(n);t[o]=(t[o]||0)|1<<s-n-1}return t}function A(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,i=e.length;n<i;n+=1){let s=t[t.length-1],o=e[n];o[0]<=s[1]+1?s[1]=Math.max(s[1],o[1]):t.push(o)}return t}const j={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},ie=RegExp(`[`+Object.keys(j).join(``)+`]`,`g`),M=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(ie,e=>j[e]):e=>e;N=class{constructor(e,{location:t=E.location,threshold:n=E.threshold,distance:s=E.distance,includeMatches:o=E.includeMatches,findAllMatches:i=E.findAllMatches,minMatchCharLength:a=E.minMatchCharLength,isCaseSensitive:r=E.isCaseSensitive,ignoreDiacritics:c=E.ignoreDiacritics,ignoreLocation:l=E.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:s,includeMatches:o,findAllMatches:i,minMatchCharLength:a,isCaseSensitive:r,ignoreDiacritics:c,ignoreLocation:l},e=r?e:e.toLowerCase(),e=c?M(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:k(e),startIndex:t})},d=this.pattern.length;if(d>32){{let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:h,ignoreDiacritics:m,includeMatches:n}=this.options;if(e=h?e:e.toLowerCase(),e=m?M(e):e,this.pattern===e){let t={isMatch:!0,score:0};return n&&(t.indices=[[0,e.length-1]]),t}let{location:a,distance:u,threshold:d,findAllMatches:r,minMatchCharLength:c,ignoreLocation:l}=this.options,s=[],i=0,t=!1;this.chunks.forEach(({pattern:o,alphabet:h,startIndex:m})=>{let{isMatch:f,score:g,indices:p}=re(e,o,h,{location:a+m,distance:u,threshold:d,findAllMatches:r,minMatchCharLength:c,includeMatches:n,ignoreLocation:l});f&&(t=!0),i+=g,f&&p&&s.push(...p)});let o={isMatch:t,score:t?i/this.chunks.length:1};return t&&n&&(o.indices=A(s)),o}};const P=new Set([`fuzzy`,`include`]);function F(e){return e.startsWith(`inverse`)}const I=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,s,o=[],a=e.length;for(;(s=t.indexOf(e,n))>-1;)n=s+a,o.push([s,n-1]);let i=!!o.length;return{isMatch:i,score:+!i,indices:o}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new N(e,{location:t.location??E.location,threshold:t.threshold??E.threshold,distance:t.distance??E.distance,includeMatches:t.includeMatches??E.includeMatches,findAllMatches:t.findAllMatches??E.findAllMatches,minMatchCharLength:t.minMatchCharLength??E.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??E.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??E.ignoreDiacritics,ignoreLocation:t.ignoreLocation??E.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],L=I.length;function ae(e){let s=[],n=e.length,t=0;for(;t<n;){for(;t<n&&e[t]===` `;)t++;if(t>=n)break;let o=t;for(;o<n&&e[o]!==` `&&e[o]!==`"`;)o++;if(o<n&&e[o]===`"`){for(o++;o<n;){if(e[o]===`"`){let t=o+1;if(t>=n||e[t]===` `){o++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){o+=2;break}}o++}s.push(e.substring(t,o)),t=o}else{for(;o<n&&e[o]!==` `;)o++;s.push(e.substring(t,o)),t=o}}return s}function R(e,t){let n=e.match(t);return n?n[1]:null}function oe(e,t={}){return e.replace(/\\\|/g,`\0`).split(`|`).map(e=>{let s=ae(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),n=[];for(let o=0,r=s.length;o<r;o+=1){let a=s[o],i=!1,e=-1;for(;!i&&++e<L;){let s=I[e],o=R(a,s.multiRegex);o&&(n.push(s.create(o,t)),i=!0)}if(!i)for(e=-1;++e<L;){let s=I[e],o=R(a,s.singleRegex);if(o){n.push(s.create(o,t));break}}}return n})}se=class{constructor(e,{isCaseSensitive:t=E.isCaseSensitive,ignoreDiacritics:n=E.ignoreDiacritics,includeMatches:s=E.includeMatches,minMatchCharLength:o=E.minMatchCharLength,ignoreLocation:i=E.ignoreLocation,findAllMatches:a=E.findAllMatches,location:r=E.location,threshold:c=E.threshold,distance:l=E.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:s,minMatchCharLength:o,findAllMatches:a,ignoreLocation:i,location:r,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?M(e):e,this.pattern=e,this.query=oe(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let o=this.query;if(!o)return{isMatch:!1,score:1};let{includeMatches:a,isCaseSensitive:r,ignoreDiacritics:c}=this.options;e=r?e:e.toLowerCase(),e=c?M(e):e;let t=0,n=[],i=0,s=!1;for(let r=0,l=o.length;r<l;r+=1){let c=o[r];n.length=0,t=0,s=!1;for(let o=0,d=c.length;o<d;o+=1){let r=c[o],{isMatch:u,indices:l,score:h}=r.search(e);if(u)t+=1,i+=h,F(r.type)&&(s=!0),a&&(P.has(r.type)?n.push(...l):n.push(l));else{i=0,t=0,n.length=0,s=!1;break}}if(t){let e={isMatch:!0,score:i/t};return s&&(e.hasInverse=!0),a&&(e.indices=A(n)),e}}return{isMatch:!1,score:1}}};const z=[];function B(...e){z.push(...e)}function V(e,t){for(let n=0,o=z.length;n<o;n+=1){let s=z[n];if(s.condition(e,t))return new s(e,t)}return new N(e,t)}const H={AND:`$and`,OR:`$or`},U={PATH:`$path`,PATTERN:`$val`},W=e=>!!(e[H.AND]||e[H.OR]),G=e=>!!e[U.PATH],ce=t=>!e(t)&&o(t)&&!W(t),K=e=>({[H.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function le(t,n,{auto:s=!0}={}){let o=t=>{if(r(t)){let e={keyId:null,pattern:t};return s&&(e.searcher=V(t,n)),e}let i=Object.keys(t),a=G(t);if(!a&&i.length>1&&!W(t))return o(K(t));if(ce(t)){let e=a?t[U.PATH]:i[0],o=a?t[U.PATTERN]:t[e];if(!r(o))throw Error(f(e));let c={keyId:b(e),pattern:o};return s&&(c.searcher=V(o,n)),c}let c={children:[],operator:i[0]};return i.forEach(n=>{let s=t[n];e(s)&&s.forEach(e=>{c.children.push(o(e))})}),c};return W(t)||(t=K(t)),o(t)}function q(e,{ignoreFieldNorm:t=E.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:s,score:o})=>{let i=e?e.weight:null;n*=(o===0&&i?2**-52:o)**+((i||1)*(t?1:s))}),n}function ue(e,{ignoreFieldNorm:t=E.ignoreFieldNorm}){e.forEach(e=>{e.score=q(e.matches,{ignoreFieldNorm:t})})}de=class{constructor(e){this.limit=e,this.heap=[]}get size(){return this.heap.length}shouldInsert(e){return this.size<this.limit||e<this.heap[0].score}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):e.score<this.heap[0].score&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(e){return this.heap.sort(e)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(t[e].score<=t[n].score)break;let s=t[e];t[e]=t[n],t[n]=s,e=n}}_sinkDown(e){let t=this.heap,s=t.length,n=e;do{e=n;let o=2*e+1,i=2*e+2;if(o<s&&t[o].score>t[n].score&&(n=o),i<s&&t[i].score>t[n].score&&(n=i),n!==e){let s=t[e];t[e]=t[n],t[n]=s}}while(n!==e)}};function fe(e){let t=[];return e.matches.forEach(e=>{if(!c(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function pe(e,t,{includeMatches:n=E.includeMatches,includeScore:s=E.includeScore}={}){return e.map(e=>{let{idx:i}=e,o={item:t[i],refIndex:i};return n&&(o.matches=fe(e)),s&&(o.score=e.score),o})}const me=/[\p{L}\p{M}\p{N}_]+/gu;function he(e){return typeof e==`function`?t=>e(t):e instanceof RegExp?(e.global,t=>t.match(e)||[]):e=>e.match(me)||[]}function J({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let s=he(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=M(n)),s(n)}}}ge=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=J({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let{df:s,fieldCount:o}=t._invertedIndex,n=this.analyzer.tokenize(e);this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new N(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let i=s.get(e)||0,a=Math.log(1+(o-i+.5)/(i+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let n=[],o=0,s=0,i=0,a=0,r=this.combineAll&&!this.useMask?new Set:null;for(let t=0;t<this.termSearchers.length;t++){let c=this.termSearchers[t].searchIn(e),l=this.idfWeights[t];s+=l,c.isMatch&&(i++,o+=l*(1-c.score),c.indices&&n.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<t:r.add(t)))}if(i===0)return{isMatch:!1,score:1};let c=s>0?1-o/s:0,t={isMatch:!0,score:Math.max(.001,c)};return this.options.includeMatches&&n.length&&(t.indices=A(n)),this.combineAll&&(this.useMask?t.matchedMask=a:t.matchedTerms=r,t.termCount=this.numTerms),t}};function Y(e,t,n,s){let i=s.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function X(e,t,n,s){let{i:o,v:i,$:a}=t;if(i!==0[0]){Y(e,i,o,s);return}if(a)for(let i=0;i<n;i++){let t=a[i];if(t)if(Array.isArray(t))for(let n of t)Y(e,n.v,o,s);else Y(e,t.v,o,s)}}function _e(e,t,n){let s={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let o of e)X(s,o,t,n);return s}function ve(e,t,n,s){X(e,t,n,s)}function Z(e,t){let n=e.docFieldCount.get(t);if(n===0[0])return;e.fieldCount-=n,e.docFieldCount.delete(t);let s=e.docTermFieldHits.get(t);if(s){for(let[t,o]of s){let n=(e.df.get(t)||0)-o;n<=0?e.df.delete(t):e.df.set(t,n)}e.docTermFieldHits.delete(t)}}function Q(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)Z(e,t);let s=e=>{let t=0,s=n.length;for(;t<s;){let o=t+s>>>1;n[o]<e?t=o+1:s=o}return e-t},o=n[0],i=new Map;for(let[t,n]of e.docFieldCount)i.set(t>o?s(t):t,n);e.docFieldCount=i;let a=new Map;for(let[t,n]of e.docTermFieldHits)a.set(t>o?s(t):t,n);e.docTermFieldHits=a}$=class{constructor(e,t,n){this.options={...E,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new _(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=V(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof D))throw Error(`Incorrect 'index' type`);if(this._myIndex=t||O(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=J({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=_e(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!c(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=J({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});ve(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let n=[],t=[];for(let s=0,o=this._docs.length;s<o;s+=1)e(this._docs[s],s)&&(n.push(this._docs[s]),t.push(s));if(t.length){this._invertedIndex&&Q(this._invertedIndex,t);let e=new Set(t);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(t),this._invalidateSearcherCache()}return n}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(d);this._invertedIndex&&Q(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}search(e,t){let{limit:n=-1}=t||{},{includeMatches:c,includeScore:l,shouldSort:d,sortFn:a,ignoreFieldNorm:o}=this.options;if(r(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return i(n)&&n>-1&&(e=e.slice(0,n)),e}let u=i(n)&&n>0&&r(e),s;if(u){let t=new de(n);r(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:o}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:o}),s=t.extractSorted(a)}else s=r(e)?r(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),ue(s,{ignoreFieldNorm:o}),d&&s.sort(a),i(n)&&n>-1&&(s=s.slice(0,n));return pe(s,this._docs,{includeMatches:c,includeScore:l})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let{records:a}=this._myIndex,i=this._getSearcher(e),s=this.options.useTokenSearch&&this.options.tokenMatch===`all`,o=t?null:[];return a.forEach(({v:e,i:a,n:r})=>{if(!c(e))return;let l=i.searchIn(e);if(l.isMatch){let i={score:l.score,value:e,norm:r,indices:l.indices};s&&(i.matchedMask=l.matchedMask,i.matchedTerms=l.matchedTerms,i.termCount=l.termCount);let c=[i];if(!s||this._coversAllTokens(c)){let s={item:e,idx:a,matches:c};t?(s.score=q(s.matches,{ignoreFieldNorm:n}),t.shouldInsert(s.score)&&t.insert(s)):o.push(s)}}}),o}_searchLogical(e){let o=le(e,this.options),n=(e,t,s)=>{if(!(`children`in e)){let{keyId:o,searcher:i}=e,n;return o===null?(n=[],this._myIndex.keys.forEach((e,s)=>{n.push(...this._findMatches({key:e,value:t[s],searcher:i}))})):n=this._findMatches({key:this._keyStore.get(o),value:this._myIndex.getValueForItemAtKeyId(t,o),searcher:i}),n&&n.length?[{idx:s,item:t,matches:n}]:[]}let{children:o,operator:a}=e,i=[];for(let e=0,c=o.length;e<c;e+=1){let l=o[e],r=n(l,t,s);if(r.length)i.push(...r);else if(a===H.AND)return[]}return i},i=this._myIndex.records,t=new Map,s=[];return i.forEach(({$:e,i})=>{if(c(e)){let a=n(o,e,i);a.length&&(t.has(i)||(t.set(i,{idx:i,item:e,matches:[]}),s.push(t.get(i))),a.forEach(({matches:e})=>{t.get(i).matches.push(...e)}))}}),s}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let{keys:a,records:r}=this._myIndex,o=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,s=t?null:[];return r.forEach(({$:e,i:r})=>{if(!c(e))return;let l=[],d=!1,u=!1;if(a.forEach((t,n)=>{let s=this._findMatches({key:t,value:e[n],searcher:o});s.length?(l.push(...s),s[0].hasInverse&&(u=!0)):d=!0}),!(u&&d)&&l.length&&(!i||this._coversAllTokens(l))){let o={idx:r,item:e,matches:l};t?(o.score=q(o.matches,{ignoreFieldNorm:n}),t.shouldInsert(o.score)&&t.insert(o)):s.push(o)}}),s}_findMatches({key:t,value:n,searcher:s}){if(!c(n))return[];let o=[];if(e(n))n.forEach(({v:e,i:n,n:i})=>{if(!c(e))return;let a=s.searchIn(e);if(a.isMatch){let s={score:a.score,key:t,value:e,idx:n,norm:i,indices:a.indices,hasInverse:a.hasInverse};a.termCount!==0[0]&&(s.matchedMask=a.matchedMask,s.matchedTerms=a.matchedTerms,s.termCount=a.termCount),o.push(s)}});else{let{v:i,n:a}=n,e=s.searchIn(i);if(e.isMatch){let n={score:e.score,key:t,value:i,norm:a,indices:e.indices,hasInverse:e.hasInverse};e.termCount!==0[0]&&(n.matchedMask=e.matchedMask,n.matchedTerms=e.matchedTerms,n.termCount=e.termCount),o.push(n)}}return o}_coversAllTokens(e){let t=e.length?e[0].termCount:0[0];if(t===0[0])return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let s=e[t].matchedTerms;if(s)for(let e of s)n.add(e)}return n.size===t}},$.version=`7.4.2`,$.createIndex=O,$.parseIndex=te,$.config=E,$.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`);return V(e,{...E,...n}).searchIn(t)},B(se),B(ge),$.use=function(...e){e.forEach(e=>B(e))},ye=$,window.Fuse=ye,showButton=document.getElementById("search-button"),showButtonMobile=document.getElementById("search-button-mobile"),hideButton=document.getElementById("close-search-button"),wrapper=document.getElementById("search-wrapper"),modal=document.getElementById("search-modal"),input=document.getElementById("search-query"),output=document.getElementById("search-results"),first=output.firstChild,last=output.lastChild,searchVisible=!1,indexed=!1,hasResults=!1,showButton?showButton.addEventListener("click",displaySearch):null,showButtonMobile?showButtonMobile.addEventListener("click",displaySearch):null,hideButton.addEventListener("click",hideSearch),wrapper.addEventListener("click",hideSearch),modal.addEventListener("click",function(e){return e.stopPropagation(),e.stopImmediatePropagation(),!1}),document.addEventListener("keydown",function(e){if(e.key=="/"){const t=document.activeElement,n=t.tagName,s=n==="INPUT"||n==="TEXTAREA"||t.isContentEditable;!searchVisible&&!s&&(e.preventDefault(),displaySearch())}e.key=="Escape"&&hideSearch(),e.key=="ArrowDown"&&searchVisible&&hasResults&&(e.preventDefault(),document.activeElement==input?first.focus():document.activeElement==last?last.focus():document.activeElement.parentElement.nextSibling.firstElementChild.focus()),e.key=="ArrowUp"&&searchVisible&&hasResults&&(e.preventDefault(),document.activeElement==input?input.focus():document.activeElement==first?input.focus():document.activeElement.parentElement.previousSibling.firstElementChild.focus()),e.key=="Enter"&&searchVisible&&hasResults&&(e.preventDefault(),document.activeElement==input?first.focus():document.activeElement.click())}),input.onkeyup=function(){executeQuery(this.value)};function displaySearch(){indexed||buildIndex(),searchVisible||(document.body.style.overflow="hidden",wrapper.style.visibility="visible",input.focus(),searchVisible=!0)}function hideSearch(){searchVisible&&(document.body.style.overflow="visible",wrapper.style.visibility="hidden",input.value="",output.innerHTML="",document.activeElement.blur(),searchVisible=!1)}function fetchJSON(e,t){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(n.readyState===4&&n.status===200){var e=JSON.parse(n.responseText);t&&t(e)}},n.open("GET",e),n.send()}function buildIndex(){var e=wrapper.getAttribute("data-url"),e=e.replace(/\/?$/,"/");fetchJSON(e+"index.json",function(e){var t={shouldSort:!0,ignoreLocation:!0,threshold:0,includeMatches:!0,keys:[{name:"title",weight:.8},{name:"section",weight:.2},{name:"summary",weight:.6},{name:"content",weight:.4}]};fuse=new Fuse(e,t),indexed=!0})}function executeQuery(e){if(indexed||buildIndex(),!fuse)return;let n=fuse.search(e),t="";n.length>0?(n.forEach(function(e){var o,i,a=e.item.summary,s=document.createElement("div");s.innerHTML=a,e.item.summary=s.textContent||s.innerText||"",o=e.item.externalUrl?e.item.title+'<span class="text-xs ml-2 align-center cursor-default text-neutral-400 dark:text-neutral-500">'+e.item.externalUrl+"</span>":e.item.title,i=e.item.externalUrl?'target="_blank" rel="noopener" href="'+e.item.externalUrl+'"':'href="'+e.item.permalink+'"',t=t+`<li class="mb-2">
|
||
<a class="flex items-center px-3 py-2 rounded-md appearance-none bg-neutral-100 dark:bg-neutral-700 focus:bg-primary-100 hover:bg-primary-100 dark:hover:bg-primary-900 dark:focus:bg-primary-900 focus:outline-dotted focus:outline-transparent focus:outline-2"
|
||
${i} tabindex="0">
|
||
<div class="grow">
|
||
<div class="-mb-1 text-lg font-bold">
|
||
${o}
|
||
</div>
|
||
<div class="text-sm text-neutral-500 dark:text-neutral-400">${e.item.section}<span class="px-2 text-primary-500">·</span>${e.item.date?e.item.date:""}</span></div>
|
||
<div class="text-sm italic">${e.item.summary}</div>
|
||
</div>
|
||
<div class="ml-2 ltr:block rtl:hidden text-neutral-500">→</div>
|
||
<div class="mr-2 ltr:hidden rtl:block text-neutral-500">←</div>
|
||
</a>
|
||
</li>`}),hasResults=!0):(t="",hasResults=!1),output.innerHTML=t,n.length>0&&output.firstChild&&(first=output.firstChild.firstElementChild,last=output.lastChild.firstElementChild)}document.getElementById("katex-render")&&document.getElementById("katex-render").addEventListener("load",()=>{renderMathInElement(document.body)}),function(){"use strict";var e=[];window.addEventListener("beforeprint",function(){for(var n=document.querySelectorAll("details:not([open])"),t=0;t<n.length;t++)n[t].open=!0,e.push(n[t])}),window.addEventListener("afterprint",function(){for(var t=0;t<e.length;t++)e[t].open=!1;e=[]})}(),function(){const e=document.querySelectorAll(".email-link");e.forEach(e=>{let t=atob(e.getAttribute("data-email"));const s=e.getAttribute("data-subject");let n=t.startsWith("mailto:")?t:"mailto:"+t;s&&(n+=(n.includes("?")?"&":"?")+"subject="+encodeURIComponent(s)),e.href=n})}() |