3 lines
69 KiB
JavaScript
3 lines
69 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./__vite-browser-external-BDDwtokW.js","./pwa-viewport-D2m4FCVR.js"])))=>i.map(i=>d[i]);
|
||
import{$ as e,$t as t,Bt as n,Et as r,F as i,Ht as a,Jt as o,Ot as s,Tt as c,Vt as l,W as u,Wt as d,Yt as f,Z as p,cn as m,d as h,gt as g,h as _,n as v}from"./pwa-viewport-D2m4FCVR.js";import{B as y,Dt as b,G as x,Ot as S,Q as C,Z as w,ct as T,gt as E,ht as D,o as O,st as k,ut as A,w as j,wt as M,z as N}from"./ScheduledAtField-Crk-z6KL.js";import{a as P,t as ee}from"./main-BRo5yFiv.js";import{t as F}from"./__vite-browser-external-BDDwtokW.js";var I;function L(e,t,n){let r=typeof n,i=typeof e;if(r!==`undefined`){if(i!==`undefined`){if(n){if(i===`function`&&r===i)return function(t){return e(n(t))};if(t=e.constructor,t===n.constructor){if(t===Array)return n.concat(e);if(t===Map){var a=new Map(n);for(var o of e)a.set(o[0],o[1]);return a}if(t===Set){o=new Set(n);for(a of e.values())o.add(a);return o}}}return e}return n}return i===`undefined`?t:e}function R(e,t){return e===void 0?t:e}function z(){return Object.create(null)}function B(e){return typeof e==`string`}function te(e){return typeof e==`object`}function ne(e,t){if(B(t))e=e[t];else for(let n=0;e&&n<t.length;n++)e=e[t[n]];return e}var re=/[^\p{L}\p{N}]+/u,ie=/(\d{3})/g,ae=/(\D)(\d{3})/g,oe=/(\d{3})(\D)/g,se=/[\u0300-\u036f]/g;function V(e={}){if(!this||this.constructor!==V)return new V(...arguments);if(arguments.length)for(e=0;e<arguments.length;e++)this.assign(arguments[e]);else this.assign(e)}I=V.prototype,I.assign=function(e){this.normalize=L(e.normalize,!0,this.normalize);let t=e.include,n=t||e.exclude||e.split,r;if(n||n===``){if(typeof n==`object`&&n.constructor!==RegExp){let e=``;r=!t,t||(e+=`\\p{Z}`),n.letter&&(e+=`\\p{L}`),n.number&&(e+=`\\p{N}`,r=!!t),n.symbol&&(e+=`\\p{S}`),n.punctuation&&(e+=`\\p{P}`),n.control&&(e+=`\\p{C}`),(n=n.char)&&(e+=typeof n==`object`?n.join(``):n);try{this.split=RegExp(`[`+(t?`^`:``)+e+`]+`,`u`)}catch{this.split=/\s+/}}else this.split=n,r=n===!1||`a1a`.split(n).length<2;this.numeric=L(e.numeric,r)}else{try{this.split=L(this.split,re)}catch{this.split=/\s+/}this.numeric=L(e.numeric,L(this.numeric,!0))}if(this.prepare=L(e.prepare,null,this.prepare),this.finalize=L(e.finalize,null,this.finalize),n=e.filter,this.filter=typeof n==`function`?n:L(n&&new Set(n),null,this.filter),this.dedupe=L(e.dedupe,!0,this.dedupe),this.matcher=L((n=e.matcher)&&new Map(n),null,this.matcher),this.mapper=L((n=e.mapper)&&new Map(n),null,this.mapper),this.stemmer=L((n=e.stemmer)&&new Map(n),null,this.stemmer),this.replacer=L(e.replacer,null,this.replacer),this.minlength=L(e.minlength,1,this.minlength),this.maxlength=L(e.maxlength,1024,this.maxlength),this.rtl=L(e.rtl,!1,this.rtl),(this.cache=n=L(e.cache,!0,this.cache))&&(this.F=null,this.L=typeof n==`number`?n:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h=``,this.J=null,this.A=``,this.K=null,this.matcher)for(let e of this.matcher.keys())this.h+=(this.h?`|`:``)+e;if(this.stemmer)for(let e of this.stemmer.keys())this.A+=(this.A?`|`:``)+e;return this},I.addStemmer=function(e,t){return this.stemmer||=new Map,this.stemmer.set(e,t),this.A+=(this.A?`|`:``)+e,this.K=null,this.cache&&H(this),this},I.addFilter=function(e){return typeof e==`function`?this.filter=e:(this.filter||=new Set,this.filter.add(e)),this.cache&&H(this),this},I.addMapper=function(e,t){return typeof e==`object`?this.addReplacer(e,t):e.length>1?this.addMatcher(e,t):(this.mapper||=new Map,this.mapper.set(e,t),this.cache&&H(this),this)},I.addMatcher=function(e,t){return typeof e==`object`?this.addReplacer(e,t):e.length<2&&(this.dedupe||this.mapper)?this.addMapper(e,t):(this.matcher||=new Map,this.matcher.set(e,t),this.h+=(this.h?`|`:``)+e,this.J=null,this.cache&&H(this),this)},I.addReplacer=function(e,t){return typeof e==`string`?this.addMatcher(e,t):(this.replacer||=[],this.replacer.push(e,t),this.cache&&H(this),this)},I.encode=function(e,t){if(this.cache&&e.length<=this.H)if(this.F){if(this.B.has(e))return this.B.get(e)}else this.F=setTimeout(H,50,this);this.normalize&&(e=typeof this.normalize==`function`?this.normalize(e):se?e.normalize(`NFKD`).replace(se,``).toLowerCase():e.toLowerCase()),this.prepare&&(e=this.prepare(e)),this.numeric&&e.length>3&&(e=e.replace(ae,`$1 $2`).replace(oe,`$1 $2`).replace(ie,`$1 `));let n=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer),r=[],i=z(),a,o,s=this.split||this.split===``?e.split(this.split):[e];for(let e=0,l,u;e<s.length;e++)if((l=u=s[e])&&!(l.length<this.minlength||l.length>this.maxlength)){if(t){if(i[l])continue;i[l]=1}else{if(a===l)continue;a=l}if(n)r.push(l);else if(!this.filter||(typeof this.filter==`function`?this.filter(l):!this.filter.has(l))){if(this.cache&&l.length<=this.I)if(this.F){var c=this.D.get(l);if(c||c===``){c&&r.push(c);continue}}else this.F=setTimeout(H,50,this);if(this.stemmer){this.K||=RegExp(`(?!^)(`+this.A+`)$`);let e;for(;e!==l&&l.length>2;)e=l,l=l.replace(this.K,e=>this.stemmer.get(e))}if(l&&(this.mapper||this.dedupe&&l.length>1)){c=``;for(let e=0,t=``,n,r;e<l.length;e++)n=l.charAt(e),n===t&&this.dedupe||((r=this.mapper&&this.mapper.get(n))||r===``?r===t&&this.dedupe||!(t=r)||(c+=r):c+=t=n);l=c}if(this.matcher&&l.length>1&&(this.J||=RegExp(`(`+this.h+`)`,`g`),l=l.replace(this.J,e=>this.matcher.get(e))),l&&this.replacer)for(c=0;l&&c<this.replacer.length;c+=2)l=l.replace(this.replacer[c],this.replacer[c+1]);if(this.cache&&u.length<=this.I&&(this.D.set(u,l),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),l){if(l!==u)if(t){if(i[l])continue;i[l]=1}else{if(o===l)continue;o=l}r.push(l)}}}return this.finalize&&(r=this.finalize(r)||r),this.cache&&e.length<=this.H&&(this.B.set(e,r),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),r};function H(e){e.F=null,e.B.clear(),e.D.clear()}function ce(e,t,n){n||(t||typeof e!=`object`?typeof t==`object`&&(n=t,t=0):n=e),n&&(e=n.query||e,t=n.limit||t);let r=``+(t||0);n&&(r+=(n.offset||0)+!!n.context+!!n.suggest+(n.resolve!==!1)+(n.resolution||this.resolution)+(n.boost||0)),e=(``+e).toLowerCase(),this.cache||=new U;let i=this.cache.get(e+r);if(!i){let a=n&&n.cache;a&&(n.cache=!1),i=this.search(e,t,n),a&&(n.cache=a),this.cache.set(e+r,i)}return i}function U(e){this.limit=e&&e!==!0?e:1e3,this.cache=new Map,this.h=``}U.prototype.set=function(e,t){this.cache.set(this.h=e,t),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)},U.prototype.get=function(e){let t=this.cache.get(e);return t&&this.h!==e&&(this.cache.delete(e),this.cache.set(this.h=e,t)),t},U.prototype.remove=function(e){for(let t of this.cache){let n=t[0];t[1].includes(e)&&this.cache.delete(n)}},U.prototype.clear=function(){this.cache.clear(),this.h=``};var le={normalize:!1,numeric:!1,dedupe:!1},W={},G=new Map([[`b`,`p`],[`v`,`f`],[`w`,`f`],[`z`,`s`],[`x`,`s`],[`d`,`t`],[`n`,`m`],[`c`,`k`],[`g`,`k`],[`j`,`k`],[`q`,`k`],[`i`,`e`],[`y`,`e`],[`u`,`o`]]),ue=new Map([[`ae`,`a`],[`oe`,`o`],[`sh`,`s`],[`kh`,`k`],[`th`,`t`],[`ph`,`f`],[`pf`,`f`]]),de=[/([^aeo])h(.)/g,`$1$2`,/([aeo])h([^aeo]|$)/g,`$1$2`,/(.)\1+/g,`$1`],fe={a:``,e:``,i:``,o:``,u:``,y:``,b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6},pe={Exact:le,Default:W,Normalize:W,LatinBalance:{mapper:G},LatinAdvanced:{mapper:G,matcher:ue,replacer:de},LatinExtra:{mapper:G,replacer:de.concat([/(?!^)[aeo]/g,``]),matcher:ue},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(e){for(let n=0;n<e.length;n++){var t=e[n];let r=t.charAt(0),i=fe[r];for(let e=1,n;e<t.length&&(n=t.charAt(e),n===`h`||n===`w`||!(n=fe[n])||n===i||(r+=n,i=n,r.length!==4));e++);e[n]=r}}},CJK:{split:``},LatinExact:le,LatinDefault:W,LatinSimple:W};function me(e,t,n,r){let i=[];for(let a=0,o;a<e.index.length;a++)if(o=e.index[a],t>=o.length)t-=o.length;else{t=o[r?`splice`:`slice`](t,n);let a=t.length;if(a&&(i=i.length?i.concat(t):t,n-=a,r&&(e.length-=a),!n))break;t=0}return i}function he(e){if(!this||this.constructor!==he)return new he(e);this.index=e?[e]:[],this.length=e?e.length:0;let t=this;return new Proxy([],{get(e,n){if(n===`length`)return t.length;if(n===`push`)return function(e){t.index[t.index.length-1].push(e),t.length++};if(n===`pop`)return function(){if(t.length)return t.length--,t.index[t.index.length-1].pop()};if(n===`indexOf`)return function(e){let n=0;for(let r=0,i,a;r<t.index.length;r++){if(i=t.index[r],a=i.indexOf(e),a>=0)return n+a;n+=i.length}return-1};if(n===`includes`)return function(e){for(let n=0;n<t.index.length;n++)if(t.index[n].includes(e))return!0;return!1};if(n===`slice`)return function(e,n){return me(t,e||0,n||t.length,!1)};if(n===`splice`)return function(e,n){return me(t,e||0,n||t.length,!0)};if(n===`constructor`)return Array;if(typeof n!=`symbol`)return(e=t.index[n/2**31|0])&&e[n]},set(e,n,r){return e=n/2**31|0,(t.index[e]||(t.index[e]=[]))[n]=r,t.length++,!0}})}he.prototype.clear=function(){this.index.length=0},he.prototype.push=function(){};function K(e=8){if(!this||this.constructor!==K)return new K(e);this.index=z(),this.h=[],this.size=0,e>32?(this.B=ge,this.A=BigInt(e)):(this.B=J,this.A=e)}K.prototype.get=function(e){let t=this.index[this.B(e)];return t&&t.get(e)},K.prototype.set=function(e,t){var n=this.B(e);let r=this.index[n];r?(n=r.size,r.set(e,t),(n-=r.size)&&this.size++):(this.index[n]=r=new Map([[e,t]]),this.h.push(r),this.size++)};function q(e=8){if(!this||this.constructor!==q)return new q(e);this.index=z(),this.h=[],this.size=0,e>32?(this.B=ge,this.A=BigInt(e)):(this.B=J,this.A=e)}q.prototype.add=function(e){var t=this.B(e);let n=this.index[t];n?(t=n.size,n.add(e),(t-=n.size)&&this.size++):(this.index[t]=n=new Set([e]),this.h.push(n),this.size++)},I=K.prototype,I.has=q.prototype.has=function(e){let t=this.index[this.B(e)];return t&&t.has(e)},I.delete=q.prototype.delete=function(e){let t=this.index[this.B(e)];t&&t.delete(e)&&this.size--},I.clear=q.prototype.clear=function(){this.index=z(),this.h=[],this.size=0},I.values=q.prototype.values=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].values())yield t},I.keys=q.prototype.keys=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].keys())yield t},I.entries=q.prototype.entries=function*(){for(let e=0;e<this.h.length;e++)for(let t of this.h[e].entries())yield t};function J(e){let t=2**this.A-1;if(typeof e==`number`)return e&t;let n=0,r=this.A+1;for(let i=0;i<e.length;i++)n=(n*r^e.charCodeAt(i))&t;return this.A===32?n+2**31:n}function ge(e){let t=BigInt(2)**this.A-BigInt(1);var n=typeof e;if(n===`bigint`)return e&t;if(n===`number`)return BigInt(e)&t;n=BigInt(0);let r=this.A+BigInt(1);for(let i=0;i<e.length;i++)n=(n*r^BigInt(e.charCodeAt(i)))&t;return n}var _e,Y;async function ve(e){e=e.data;var t=e.task;let n=e.id,r=e.args;switch(t){case`init`:Y=e.options||{},(t=e.factory)?(Function(`return `+t)()(self),_e=new self.FlexSearch.Index(Y),delete self.FlexSearch):_e=new $(Y),postMessage({id:n});break;default:let i;t===`export`&&(r[1]?(r[0]=Y.export,r[2]=0,r[3]=1):r=null),t===`import`?r[0]&&(e=await Y.import.call(_e,r[0]),_e.import(r[0],e)):((i=r&&_e[t].apply(_e,r))&&i.then&&(i=await i),i&&i.await&&(i=await i.await),t===`search`&&i.result&&(i=i.result)),postMessage(t===`search`?{id:n,msg:i}:{id:n})}}function X(e){Ce.call(e,`add`),Ce.call(e,`append`),Ce.call(e,`search`),Ce.call(e,`update`),Ce.call(e,`remove`),Ce.call(e,`searchCache`)}var ye,be,xe;function Se(){ye=xe=0}function Ce(e){this[e+`Async`]=function(){let t=arguments;var n=t[t.length-1];let r;if(typeof n==`function`&&(r=n,delete t[t.length-1]),ye?xe||=Date.now()-be>=this.priority*this.priority*3:(ye=setTimeout(Se,0),be=Date.now()),xe){let n=this;return new Promise(r=>{setTimeout(function(){r(n[e+`Async`].apply(n,t))},0)})}let i=this[e].apply(this,t);return n=i.then?i:new Promise(e=>e(i)),r&&n.then(r),n}}var we=0;function Te(e={},t){function n(n){function o(e){e=e.data||e;let t=e.id,n=t&&a.h[t];n&&(n(e.msg),delete a.h[t])}if(this.worker=n,this.h=z(),this.worker)return i?this.worker.on(`message`,o):this.worker.onmessage=o,e.config?new Promise(function(t){we>1e9&&(we=0),a.h[++we]=function(){t(a)},a.worker.postMessage({id:we,task:`init`,factory:r,options:e})}):(this.priority=e.priority||4,this.encoder=t||null,this.worker.postMessage({task:`init`,factory:r,options:e}),this)}if(!this||this.constructor!==Te)return new Te(e);let r=typeof self<`u`?self._factory:typeof window<`u`?window._factory:null;r&&=r.toString();let i=typeof window>`u`,a=this,o=De(r,i,e.worker);return o.then?o.then(function(e){return n.call(a,e)}):n.call(this,o)}Ee(`add`),Ee(`append`),Ee(`search`),Ee(`update`),Ee(`remove`),Ee(`clear`),Ee(`export`),Ee(`import`),Te.prototype.searchCache=ce,X(Te.prototype);function Ee(e){Te.prototype[e]=function(){let t=this,n=[].slice.call(arguments);var r=n[n.length-1];let i;return typeof r==`function`&&(i=r,n.pop()),r=new Promise(function(r){e===`export`&&typeof n[0]==`function`&&(n[0]=null),we>1e9&&(we=0),t.h[++we]=r,t.worker.postMessage({task:e,id:we,args:n})}),i?(r.then(i),this):r}}function De(e,t,n){return t?typeof module<`u`?new(F()).Worker(__dirname+`/worker/node.js`):_(()=>import(`./__vite-browser-external-BDDwtokW.js`).then(e=>m(e.t(),1)).then(function(e){return new e.Worker(import.meta.dirname+`/node/node.mjs`)}),__vite__mapDeps([0,1]),import.meta.url):e?new window.Worker(URL.createObjectURL(new Blob([`onmessage=`+ve.toString()],{type:`text/javascript`}))):new window.Worker(typeof n==`string`?n:import.meta.url.replace(`/worker.js`,`/worker/worker.js`).replace(`flexsearch.bundle.module.min.js`,`module/worker/worker.js`).replace(`flexsearch.bundle.module.min.mjs`,`module/worker/worker.js`),{type:`module`})}Ge.prototype.add=function(e,t,n){if(te(e)&&(t=e,e=ne(t,this.key)),t&&(e||e===0)){if(!n&&this.reg.has(e))return this.update(e,t);for(let a=0,o;a<this.field.length;a++){o=this.B[a];var r=this.index.get(this.field[a]);if(typeof o==`function`){var i=o(t);i&&r.add(e,i,n,!0)}else i=o.G,(!i||i(t))&&(o.constructor===String?o=[``+o]:B(o)&&(o=[o]),ke(t,o,this.D,0,r,e,o[0],n))}if(this.tag)for(r=0;r<this.A.length;r++){var a=this.A[r];i=this.tag.get(this.F[r]);let s=z();if(typeof a==`function`){if(a=a(t),!a)continue}else{var o=a.G;if(o&&!o(t))continue;a.constructor===String&&(a=``+a),a=ne(t,a)}if(i&&a){B(a)&&(a=[a]);for(let t=0,r,c;t<a.length;t++)if(r=a[t],!s[r]&&(s[r]=1,(o=i.get(r))?c=o:i.set(r,c=[]),!n||!c.includes(e))){if(c.length===2**31-1){if(o=new he(c),this.fastupdate)for(let e of this.reg.values())e.includes(c)&&(e[e.indexOf(c)]=o);i.set(r,c=o)}c.push(e),this.fastupdate&&((o=this.reg.get(e))?o.push(c):this.reg.set(e,[c]))}}}if(this.store&&(!n||!this.store.has(e))){let r;if(this.h){r=z();for(let e=0,i;e<this.h.length;e++){if(i=this.h[e],(n=i.G)&&!n(t))continue;let a;if(typeof i==`function`){if(a=i(t),!a)continue;i=[i.O]}else if(B(i)||i.constructor===String){r[i]=t[i];continue}Oe(t,r,i,0,i[0],a)}}this.store.set(e,r||t)}this.worker&&(this.fastupdate||this.reg.add(e))}return this};function Oe(e,t,n,r,i,a){if(e=e[i],r===n.length-1)t[i]=a||e;else if(e)if(e.constructor===Array)for(t=t[i]=Array(e.length),i=0;i<e.length;i++)Oe(e,t,n,r,i);else t=t[i]||(t[i]=z()),i=n[++r],Oe(e,t,n,r,i)}function ke(e,t,n,r,i,a,o,s){if(e=e[o])if(r===t.length-1){if(e.constructor===Array){if(n[r]){for(t=0;t<e.length;t++)i.add(a,e[t],!0,!0);return}e=e.join(` `)}i.add(a,e,s,!0)}else if(e.constructor===Array)for(o=0;o<e.length;o++)ke(e,t,n,r,i,a,o,s);else o=t[++r],ke(e,t,n,r,i,a,o,s)}function Ae(e,t,n,r){if(!e.length)return e;if(e.length===1)return e=e[0],e=n||e.length>t?e.slice(n,n+t):e,r?We.call(this,e):e;let i=[];for(let a=0,o,s;a<e.length;a++)if((o=e[a])&&(s=o.length)){if(n){if(n>=s){n-=s;continue}o=o.slice(n,n+t),s=o.length,n=0}if(s>t&&(o=o.slice(0,t),s=t),!i.length&&s>=t)return r?We.call(this,o):o;if(i.push(o),t-=s,!t)break}return i=i.length>1?[].concat.apply([],i):i[0],r?We.call(this,i):i}function je(e,t,n,r){var i=r[0];if(i[0]&&i[0].query)return e[t].apply(e,i);if(!(t!==`and`&&t!==`not`||e.result.length||e.await||i.suggest))return r.length>1&&(i=r[r.length-1]),(r=i.resolve)?e.await||e.result:e;let a=[],o=0,s=0,c,l,u,d,f;for(t=0;t<r.length;t++)if(i=r[t]){var p=void 0;if(i.constructor===Z)p=i.await||i.result;else if(i.then||i.constructor===Array)p=i;else{o=i.limit||0,s=i.offset||0,u=i.suggest,l=i.resolve,c=((d=i.highlight||e.highlight)||i.enrich)&&l,p=i.queue;let n=i.async||p,r=i.index,m=i.query;if(r?e.index||=r:r=e.index,m||i.tag){let o=i.field||i.pluck;if(o&&(!m||e.query&&!d||(e.query=m,e.field=o,e.highlight=d),r=r.index.get(o)),p&&(f||e.await)){f=1;let o,s=e.C.length,c=new Promise(function(e){o=e});(function(t,r){c.h=function(){r.index=null,r.resolve=!1;let i=n?t.searchAsync(r):t.search(r);return i.then?i.then(function(t){return e.C[s]=t=t.result||t,o(t),t}):(i=i.result||i,o(i),i)}})(r,Object.assign({},i)),e.C.push(c),a[t]=c;continue}else i.resolve=!1,i.index=null,p=n?r.searchAsync(i):r.search(i),i.resolve=l,i.index=r}else if(i.and)p=Me(i,`and`,r);else if(i.or)p=Me(i,`or`,r);else if(i.not)p=Me(i,`not`,r);else if(i.xor)p=Me(i,`xor`,r);else continue}p.await?(f=1,p=p.await):p.then?(f=1,p=p.then(function(e){return e.result||e})):p=p.result||p,a[t]=p}if(f&&!e.await&&(e.await=new Promise(function(t){e.return=t})),f){let t=Promise.all(a).then(function(r){for(let i=0;i<e.C.length;i++)if(e.C[i]===t){e.C[i]=function(){return n.call(e,r,o,s,c,l,u,d)};break}Re(e)});e.C.push(t)}else if(e.await)e.C.push(function(){return n.call(e,a,o,s,c,l,u,d)});else return n.call(e,a,o,s,c,l,u,d);return l?e.await||e.result:e}function Me(e,t,n){e=e[t];let r=e[0]||e;return r.index||=n,n=new Z(r),e.length>1&&(n=n[t].apply(n,e.slice(1))),n}Z.prototype.or=function(){return je(this,`or`,Ne,arguments)};function Ne(e,t,n,r,i,a,o){return e.length&&(this.result.length&&e.push(this.result),e.length<2?this.result=e[0]:(this.result=Be(e,t,n,!1,this.h),n=0)),i&&(this.await=null),i?this.resolve(t,n,r,o):this}Z.prototype.and=function(){return je(this,`and`,Pe,arguments)};function Pe(e,t,n,r,i,a,o){if(!a&&!this.result.length)return i?this.result:this;let s;if(e.length)if(this.result.length&&e.unshift(this.result),e.length<2)this.result=e[0];else{let r=0;for(let t=0,n,i;t<e.length;t++)if((n=e[t])&&(i=n.length))r<i&&(r=i);else if(!a){r=0;break}r?(this.result=ze(e,r,t,n,a,this.h,i),s=!0):this.result=[]}else a||(this.result=e);return i&&(this.await=null),i?this.resolve(t,n,r,o,s):this}Z.prototype.xor=function(){return je(this,`xor`,Fe,arguments)};function Fe(e,t,n,r,i,a,o){if(e.length)if(this.result.length&&e.unshift(this.result),e.length<2)this.result=e[0];else{a:{a=n;var s=this.h;let r=[],o=z(),c=0;for(let t=0,n;t<e.length;t++)if(n=e[t]){c<n.length&&(c=n.length);for(let e=0,t;e<n.length;e++)if(t=n[e])for(let e=0,n;e<t.length;e++)n=t[e],o[n]=o[n]?2:1}for(let n=0,l,u=0;n<c;n++)for(let c=0,d;c<e.length;c++)if((d=e[c])&&(l=d[n])){for(let d=0,f;d<l.length;d++)if(f=l[d],o[f]===1)if(a)a--;else if(i){if(r.push(f),r.length===t){e=r;break a}}else{let i=n+(c?s:0);if(r[i]||(r[i]=[]),r[i].push(f),++u===t){e=r;break a}}}e=r}this.result=e,s=!0}else a||(this.result=e);return i&&(this.await=null),i?this.resolve(t,n,r,o,s):this}Z.prototype.not=function(){return je(this,`not`,Ie,arguments)};function Ie(e,t,n,r,i,a,o){if(!a&&!this.result.length)return i?this.result:this;if(e.length&&this.result.length){a:{a=n;var s=[];e=new Set(e.flat().flat());for(let n=0,r,o=0;n<this.result.length;n++)if(r=this.result[n]){for(let c=0,l;c<r.length;c++)if(l=r[c],!e.has(l)){if(a)a--;else if(i){if(s.push(l),s.length===t){e=s;break a}}else if(s[n]||(s[n]=[]),s[n].push(l),++o===t){e=s;break a}}}e=s}this.result=e,s=!0}return i&&(this.await=null),i?this.resolve(t,n,r,o,s):this}function Le(e,t,n,r,i){let a,o,s;typeof i==`string`?(a=i,i=``):a=i.template,o=a.indexOf(`$1`),s=a.substring(o+2),o=a.substring(0,o);let c=i&&i.boundary,l=!i||i.clip!==!1,u=i&&i.merge&&s&&o&&RegExp(s+` `+o,`g`);i&&=i.ellipsis;var d=0;if(typeof i==`object`){var f=i.template;d=f.length-2,i=i.pattern}typeof i!=`string`&&(i=i===!1?``:`...`),d&&(i=f.replace(`$1`,i)),f=i.length-d;let p,m;typeof c==`object`&&(p=c.before,p===0&&(p=-1),m=c.after,m===0&&(m=-1),c=c.total||9e5),d=new Map;for(let N=0,P,ee,F;N<t.length;N++){let I;if(r)I=t,F=r;else{var h=t[N];if(F=h.field,!F)continue;I=h.result}ee=n.get(F),P=ee.encoder,h=d.get(P),typeof h!=`string`&&(h=P.encode(e),d.set(P,h));for(let e=0;e<I.length;e++){var g=I[e].doc;if(!g||(g=ne(g,F),!g))continue;var _=g.trim().split(/\s+/);if(!_.length)continue;g=``;var v=[];let t=[];for(var y=-1,b=-1,x=0,S=0;S<_.length;S++){var C=_[S],w=P.encode(C);w=w.length>1?w.join(` `):w[0];let e;if(w&&C){for(var T=C.length,E=(P.split?C.replace(P.split,``):C).length-w.length,D=``,O=0,k=0;k<h.length;k++){var A=h[k];if(A){var j=A.length;j+=E<0?0:E,O&&j<=O||(A=w.indexOf(A),A>-1&&(D=(A?C.substring(0,A):``)+o+C.substring(A,A+j)+s+(A+j<T?C.substring(A+j):``),O=j,e=!0))}}D&&(c&&(y<0&&(y=g.length+ +!!g),b=g.length+ +!!g+D.length,x+=T,t.push(v.length),v.push({match:D})),g+=(g?` `:``)+D)}if(!e)C=_[S],g+=(g?` `:``)+C,c&&v.push({text:C});else if(c&&x>=c)break}if(x=t.length*(a.length-2),p||m||c&&g.length-x>c)if(x=c+x-f*2,S=b-y,p>0&&(S+=p),m>0&&(S+=m),S<=x)_=p?y-(p>0?p:0):y-((x-S)/2|0),v=m?b+(m>0?m:0):_+x,l||(_>0&&g.charAt(_)!==` `&&g.charAt(_-1)!==` `&&(_=g.indexOf(` `,_),_<0&&(_=0)),v<g.length&&g.charAt(v-1)!==` `&&g.charAt(v)!==` `&&(v=g.lastIndexOf(` `,v),v<b?v=b:++v)),g=(_?i:``)+g.substring(_,v)+(v<g.length?i:``);else{for(b=[],y={},x={},S={},C={},w={},D=E=T=0,k=O=1;;){var M=void 0;for(let e=0,n;e<t.length;e++){if(n=t[e],D)if(E!==D){if(S[e+1])continue;if(n+=D,y[n]){T-=f,x[e+1]=1,S[e+1]=1;continue}if(n>=v.length-1){if(n>=v.length){S[e+1]=1,n>=_.length&&(x[e+1]=1);continue}T-=f}if(g=v[n].text,j=m&&w[e])if(j>0){if(g.length>j)if(S[e+1]=1,l)g=g.substring(0,j);else continue;(j-=g.length)||(j=-1),w[e]=j}else{S[e+1]=1;continue}if(T+g.length+1<=c)g=` `+g,b[e]+=g;else if(l)M=c-T-1,M>0&&(g=` `+g.substring(0,M),b[e]+=g),S[e+1]=1;else{S[e+1]=1;continue}}else{if(S[e])continue;if(n-=E,y[n]){T-=f,S[e]=1,x[e]=1;continue}if(n<=0){if(n<0){S[e]=1,x[e]=1;continue}T-=f}if(g=v[n].text,j=p&&C[e])if(j>0){if(g.length>j)if(S[e]=1,l)g=g.substring(g.length-j);else continue;(j-=g.length)||(j=-1),C[e]=j}else{S[e]=1;continue}if(T+g.length+1<=c)g+=` `,b[e]=g+b[e];else if(l)M=g.length+1-(c-T),M>=0&&M<g.length&&(g=g.substring(M)+` `,b[e]=g+b[e]),S[e]=1;else{S[e]=1;continue}}else{g=v[n].match,p&&(C[e]=p),m&&(w[e]=m),e&&T++;let t;if(n?!e&&f&&(T+=f):(x[e]=1,S[e]=1),n>=_.length-1||n<v.length-1&&v[n+1].match?t=1:f&&(T+=f),T-=a.length-2,!e||T+g.length<=c)b[e]=g;else{M=O=k=x[e]=0;break}t&&(x[e+1]=1,S[e+1]=1)}T+=g.length,M=y[n]=1}if(M)E===D?D++:E++;else{if(E===D?O=0:k=0,!O&&!k)break;O?(E++,D=E):D++}}g=``;for(let e=0,t;e<b.length;e++)t=(x[e]?e?` `:``:(e&&!i?` `:``)+i)+b[e],g+=t;i&&!x[b.length]&&(g+=i)}u&&(g=g.replace(u,` `)),I[e].highlight=g}if(r)break}return t}function Z(e,t){if(!this||this.constructor!==Z)return new Z(e,t);let n=0,r,i,a,o,s,c;if(e&&e.index){let r=e;if(t=r.index,n=r.boost||0,i=r.query){a=r.field||r.pluck,o=r.highlight;let n=r.resolve;e=r.async||r.queue,r.resolve=!1,r.index=null,e=e?t.searchAsync(r):t.search(r),r.resolve=n,r.index=t,e=e.result||e}else e=[]}if(e&&e.then){let t=this;e=e.then(function(e){t.C[0]=t.result=e.result||e,Re(t)}),r=[e],e=[],s=new Promise(function(e){c=e})}this.index=t||null,this.result=e||[],this.h=n,this.C=r||[],this.await=s||null,this.return=c||null,this.highlight=o||null,this.query=i||``,this.field=a||``}I=Z.prototype,I.limit=function(e){if(this.await){let t=this;this.C.push(function(){return t.limit(e).result})}else if(this.result.length){let t=[];for(let n=0,r;n<this.result.length;n++)if(r=this.result[n])if(r.length<=e){if(t[n]=r,e-=r.length,!e)break}else{t[n]=r.slice(0,e);break}this.result=t}return this},I.offset=function(e){if(this.await){let t=this;this.C.push(function(){return t.offset(e).result})}else if(this.result.length){let t=[];for(let n=0,r;n<this.result.length;n++)(r=this.result[n])&&(r.length<=e?e-=r.length:(t[n]=r.slice(e),e=0));this.result=t}return this},I.boost=function(e){if(this.await){let t=this;this.C.push(function(){return t.boost(e).result})}else this.h+=e;return this};function Re(e,t){let n=e.result;var r=e.await;e.await=null;for(let t=0,i;t<e.C.length;t++)if(i=e.C[t]){if(typeof i==`function`)n=i(),e.C[t]=n=n.result||n,t--;else if(i.h)n=i.h(),e.C[t]=n=n.result||n,t--;else if(i.then)return e.await=r}return r=e.return,e.C=[],e.return=null,t||r(n),n}I.resolve=function(e,t,n,r,i){let a=this.await?Re(this,!0):this.result;if(a.then){let o=this;return a.then(function(){return o.resolve(e,t,n,r,i)})}return a.length&&(typeof e==`object`?(r=e.highlight||this.highlight,n=!!r||e.enrich,t=e.offset,e=e.limit):(r||=this.highlight,n=!!r||n),a=i?n?We.call(this.index,a):a:Ae.call(this.index,a,e||100,t,n)),this.finalize(a,r)},I.finalize=function(e,t){if(e.then){let n=this;return e.then(function(e){return n.finalize(e,t)})}t&&e.length&&this.query&&(e=Le(this.query,e,this.index.index,this.field,t));let n=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field=``,n&&n(e),e};function ze(e,t,n,r,i,a,o){let s=e.length,c=[],l,u;l=z();for(let d=0,f,p,m,h;d<t;d++)for(let t=0;t<s;t++)if(m=e[t],d<m.length&&(f=m[d]))for(let e=0;e<f.length;e++){if(p=f[e],(u=l[p])?l[p]++:(u=0,l[p]=1),h=c[u]||(c[u]=[]),!o){let e=d+(t||!i?0:a||0);h=h[e]||(h[e]=[])}if(h.push(p),o&&n&&u===s-1&&h.length-r===n)return r?h.slice(r):h}if(e=c.length)if(i)c=c.length>1?Be(c,n,r,o,a):(c=c[0])&&n&&c.length>n||r?c.slice(r,n+r):c;else{if(e<s)return[];if(c=c[e-1],n||r)if(o)(c.length>n||r)&&(c=c.slice(r,n+r));else{i=[];for(let e=0,t;e<c.length;e++)if(t=c[e]){if(r&&t.length>r)r-=t.length;else if((n&&t.length>n||r)&&(t=t.slice(r,n+r),n-=t.length,r&&(r-=t.length)),i.push(t),!n)break}c=i}}return c}function Be(e,t,n,r,i){let a=[],o=z(),s;var c=e.length;let l;if(r){for(i=c-1;i>=0;i--)if(l=(r=e[i])&&r.length){for(c=0;c<l;c++)if(s=r[c],!o[s]){if(o[s]=1,n)n--;else if(a.push(s),a.length===t)return a}}}else for(let u=c-1,d,f=0;u>=0;u--){d=e[u];for(let e=0;e<d.length;e++)if(l=(r=d[e])&&r.length){for(let d=0;d<l;d++)if(s=r[d],!o[s])if(o[s]=1,n)n--;else{let n=(e+(u<c-1&&i||0))/(u+1)|0;if((a[n]||(a[n]=[])).push(s),++f===t)return a}}}return a}function Ve(e,t,n,r,i){let a=z(),o=[];for(let e=0,n;e<t.length;e++){n=t[e];for(let e=0;e<n.length;e++)a[n[e]]=1}if(i){for(let t=0,i;t<e.length;t++)if(i=e[t],a[i]){if(r)r--;else if(o.push(i),a[i]=0,n&&--n===0)break}}else for(let n=0,r,i;n<e.result.length;n++)for(r=e.result[n],t=0;t<r.length;t++)i=r[t],a[i]&&((o[n]||(o[n]=[])).push(i),a[i]=0);return o}Ge.prototype.search=function(e,t,n,r){n||(!t&&te(e)?(n=e,e=``):te(t)&&(n=t,t=0));let i=[];var a=[];let o,s,c,l,u,d,f=0,p=!0,m;if(n){n.constructor===Array&&(n={index:n}),e=n.query||e,o=n.pluck,s=n.merge,l=n.boost,d=o||n.field||(d=n.index)&&(d.index?null:d);var h=this.tag&&n.tag;c=n.suggest,p=n.resolve!==!1,u=n.cache,m=p&&this.store&&n.highlight;var g=!!m||p&&this.store&&n.enrich;t=n.limit||t;var _=n.offset||0;if(t||=p?100:0,h&&(!this.db||!r)){h.constructor!==Array&&(h=[h]);var v=[];for(let e=0,t;e<h.length;e++)if(t=h[e],t.field&&t.tag){var y=t.tag;if(y.constructor===Array)for(var b=0;b<y.length;b++)v.push(t.field,y[b]);else v.push(t.field,y)}else{y=Object.keys(t);for(let e=0,n,r;e<y.length;e++)if(n=y[e],r=t[n],r.constructor===Array)for(b=0;b<r.length;b++)v.push(n,r[b]);else v.push(n,r)}if(h=v,!e){if(a=[],v.length)for(h=0;h<v.length;h+=2){if(this.db){if(r=this.index.get(v[h]),!r)continue;a.push(r=r.db.tag(v[h+1],t,_,g))}else r=Ue.call(this,v[h],v[h+1],t,_,g);i.push(p?{field:v[h],tag:v[h+1],result:r}:[r])}if(a.length){let e=this;return Promise.all(a).then(function(t){for(let e=0;e<t.length;e++)p?i[e].result=t[e]:i[e]=t[e];return p?i:new Z(i.length>1?ze(i,1,0,0,c,l):i[0],e)})}return p?i:new Z(i.length>1?ze(i,1,0,0,c,l):i[0],this)}}p||o||!(d||=this.field)||(B(d)?o=d:(d.constructor===Array&&d.length===1&&(d=d[0]),o=d.field||d.index)),d&&d.constructor!==Array&&(d=[d])}d||=this.field;let x;v=(this.worker||this.db)&&!r&&[];for(let o=0,s,l,C;o<d.length;o++){if(l=d[o],this.db&&this.tag&&!this.B[o])continue;let w;if(B(l)||(w=l,l=w.field,e=w.query||e,t=R(w.limit,t),_=R(w.offset,_),c=R(w.suggest,c),m=p&&this.store&&R(w.highlight,m),g=!!m||p&&this.store&&R(w.enrich,g),u=R(w.cache,u)),r)s=r[o];else{y=w||n||{},b=y.enrich;var S=this.index.get(l);if(h&&(this.db&&(y.tag=h,y.field=d,x=S.db.support_tag_search),!x&&b&&(y.enrich=!1),x||(y.limit=0,y.offset=0)),s=u?S.searchCache(e,h&&!x?0:t,y):S.search(e,h&&!x?0:t,y),h&&!x&&(y.limit=t,y.offset=_),b&&(y.enrich=b),v){v[o]=s;continue}}if(C=(s=s.result||s)&&s.length,h&&C){if(y=[],b=0,this.db&&r){if(!x)for(S=d.length;S<r.length;S++){let e=r[S];if(e&&e.length)b++,y.push(e);else if(!c)return p?i:new Z(i,this)}}else for(let e=0,t,n;e<h.length;e+=2){if(t=this.tag.get(h[e]),!t){if(c)continue;return p?i:new Z(i,this)}if((t&&=t.get(h[e+1]))&&t.length)b++,y.push(t);else if(!c)return p?i:new Z(i,this)}if(b){if(s=Ve(s,y,t,_,p),C=s.length,!C&&!c)return p?s:new Z(s,this);b--}}if(C)a[f]=l,i.push(s),f++;else if(d.length===1)return p?i:new Z(i,this)}if(v){if(this.db&&h&&h.length&&!x)for(g=0;g<h.length;g+=2){if(a=this.index.get(h[g]),!a){if(c)continue;return p?i:new Z(i,this)}v.push(a.db.tag(h[g+1],t,_,!1))}let r=this;return Promise.all(v).then(function(i){return n&&(n.resolve=p),i.length&&(i=r.search(e,t,n,i)),i})}if(!f)return p?i:new Z(i,this);if(o&&(!g||!this.store))return i=i[0],p?i:new Z(i,this);for(v=[],_=0;_<a.length;_++){if(h=i[_],g&&h.length&&h[0].doc===void 0&&(this.db?v.push(h=this.index.get(this.field[0]).db.enrich(h)):h=We.call(this,h)),o)return p?m?Le(e,h,this.index,o,m):h:new Z(h,this);i[_]={field:a[_],result:h}}if(g&&this.db&&v.length){let t=this;return Promise.all(v).then(function(n){for(let e=0;e<n.length;e++)i[e].result=n[e];return m&&(i=Le(e,i,t.index,o,m)),s?He(i):i})}return m&&(i=Le(e,i,this.index,o,m)),s?He(i):i};function He(e){let t=[],n=z(),r=z();for(let i=0,a,o,s,c,l,u,d;i<e.length;i++){a=e[i],o=a.field,s=a.result;for(let e=0;e<s.length;e++)l=s[e],typeof l==`object`?c=l.id:l={id:c=l},(u=n[c])?u.push(o):(l.field=n[c]=[o],t.push(l)),(d=l.highlight)&&(u=r[c],u||(r[c]=u={},l.highlight=u),u[o]=d)}return t}function Ue(e,t,n,r,i){return e=this.tag.get(e),!e||(e=e.get(t),!e)?[]:(t=e.length-r,t>0&&((n&&t>n||r)&&(e=e.slice(r,r+n)),i&&(e=We.call(this,e))),e)}function We(e){if(!this||!this.store)return e;if(this.db)return this.index.get(this.field[0]).db.enrich(e);let t=Array(e.length);for(let n=0,r;n<e.length;n++)r=e[n],t[n]={id:r,doc:this.store.get(r)};return t}function Ge(e){if(!this||this.constructor!==Ge)return new Ge(e);let t=e.document||e.doc||e,n,r;if(this.B=[],this.field=[],this.D=[],this.key=(n=t.key||t.id)&&qe(n,this.D)||`id`,(r=e.keystore||0)&&(this.keystore=r),this.fastupdate=!!e.fastupdate,this.reg=!this.fastupdate||e.worker||e.db?r?new q(r):new Set:r?new K(r):new Map,this.h=(n=t.store||null)&&n&&n!==!0&&[],this.store=n?r?new K(r):new Map:null,this.cache=(n=e.cache||null)&&new U(n),e.cache=!1,this.worker=e.worker||!1,this.priority=e.priority||4,this.index=Ke.call(this,e,t),this.tag=null,(n=t.tag)&&(typeof n==`string`&&(n=[n]),n.length)){this.tag=new Map,this.A=[],this.F=[];for(let e=0,t,r;e<n.length;e++){if(t=n[e],r=t.field||t,!r)throw Error(`The tag field from the document descriptor is undefined.`);t.custom?this.A[e]=t.custom:(this.A[e]=qe(r,this.D),t.filter&&(typeof this.A[e]==`string`&&(this.A[e]=new String(this.A[e])),this.A[e].G=t.filter)),this.F[e]=r,this.tag.set(r,new Map)}}if(this.worker){this.fastupdate=!1,e=[];for(let t of this.index.values())t.then&&e.push(t);if(e.length){let t=this;return Promise.all(e).then(function(e){let n=0;for(let r of t.index.entries()){let i=r[0],a=r[1];a.then&&(a=e[n],t.index.set(i,a),n++)}return t})}}else e.db&&(this.fastupdate=!1,this.mount(e.db))}I=Ge.prototype,I.mount=function(e){let t=this.field;if(this.tag)for(let e=0,r;e<this.F.length;e++){r=this.F[e];var n=void 0;this.index.set(r,n=new $({},this.reg)),t===this.field&&(t=t.slice(0)),t.push(r),n.tag=this.tag.get(r)}n=[];let r={db:e.db,type:e.type,fastupdate:e.fastupdate};for(let i=0,a,o;i<t.length;i++){r.field=o=t[i],a=this.index.get(o);let s=new e.constructor(e.id,r);s.id=e.id,n[i]=s.mount(a),a.document=!0,i?a.bypass=!0:a.store=this.store}let i=this;return this.db=Promise.all(n).then(function(){i.db=!0})},I.commit=async function(){let e=[];for(let t of this.index.values())e.push(t.commit());await Promise.all(e),this.reg.clear()},I.destroy=function(){let e=[];for(let t of this.index.values())e.push(t.destroy());return Promise.all(e)};function Ke(e,t){let n=new Map,r=t.index||t.field||t;B(r)&&(r=[r]);for(let t=0,a,o;t<r.length;t++){if(a=r[t],B(a)||(o=a,a=a.field),o=te(o)?Object.assign({},e,o):e,this.worker){var i=void 0;i=(i=o.encoder)&&i.encode?i:new V(typeof i==`string`?pe[i]:i||{}),i=new Te(o,i),n.set(a,i)}this.worker||n.set(a,new $(o,this.reg)),o.custom?this.B[t]=o.custom:(this.B[t]=qe(a,this.D),o.filter&&(typeof this.B[t]==`string`&&(this.B[t]=new String(this.B[t])),this.B[t].G=o.filter)),this.field[t]=a}if(this.h){e=t.store,B(e)&&(e=[e]);for(let t=0,n,r;t<e.length;t++)n=e[t],r=n.field||n,n.custom?(this.h[t]=n.custom,n.custom.O=r):(this.h[t]=qe(r,this.D),n.filter&&(typeof this.h[t]==`string`&&(this.h[t]=new String(this.h[t])),this.h[t].G=n.filter))}return n}function qe(e,t){let n=e.split(`:`),r=0;for(let i=0;i<n.length;i++)e=n[i],e[e.length-1]===`]`&&(e=e.substring(0,e.length-2))&&(t[r]=!0),e&&(n[r++]=e);return r<n.length&&(n.length=r),r>1?n:n[0]}I.append=function(e,t){return this.add(e,t,!0)},I.update=function(e,t){return this.remove(e).add(e,t)},I.remove=function(e){te(e)&&(e=ne(e,this.key));for(var t of this.index.values())t.remove(e,!0);if(this.reg.has(e)){if(this.tag&&!this.fastupdate)for(let n of this.tag.values())for(let r of n){t=r[0];let i=r[1],a=i.indexOf(e);a>-1&&(i.length>1?i.splice(a,1):n.delete(t))}this.store&&this.store.delete(e),this.reg.delete(e)}return this.cache&&this.cache.remove(e),this},I.clear=function(){let e=[];for(let t of this.index.values()){let n=t.clear();n.then&&e.push(n)}if(this.tag)for(let e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),e.length?Promise.all(e):this},I.contain=function(e){return this.db?this.index.get(this.field[0]).db.has(e):this.reg.has(e)},I.cleanup=function(){for(let e of this.index.values())e.cleanup();return this},I.get=function(e){return this.db?this.index.get(this.field[0]).db.enrich(e).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(e)||null},I.set=function(e,t){return typeof e==`object`&&(t=e,e=ne(t,this.key)),this.store.set(e,t),this},I.searchCache=ce,I.export=tt,I.import=nt,X(Ge.prototype);function Je(e,t=0){let n=[],r=[];t&&=25e4/t*5e3|0;for(let i of e.entries())r.push(i),r.length===t&&(n.push(r),r=[]);return r.length&&n.push(r),n}function Ye(e,t){t||=new Map;for(let n=0,r;n<e.length;n++)r=e[n],t.set(r[0],r[1]);return t}function Xe(e,t=0){let n=[],r=[];t&&=25e4/t*1e3|0;for(let i of e.entries())r.push([i[0],Je(i[1])[0]||[]]),r.length===t&&(n.push(r),r=[]);return r.length&&n.push(r),n}function Ze(e,t){t||=new Map;for(let n=0,r,i;n<e.length;n++)r=e[n],i=t.get(r[0]),t.set(r[0],Ye(r[1],i));return t}function Qe(e){let t=[],n=[];for(let r of e.keys())n.push(r),n.length===25e4&&(t.push(n),n=[]);return n.length&&t.push(n),t}function $e(e,t){t||=new Set;for(let n=0;n<e.length;n++)t.add(e[n]);return t}function et(e,t,n,r,i,a,o=0){let s=r&&r.constructor===Array;var c=s?r.shift():r;if(!c)return this.export(e,t,i,a+1);if((c=e((t?t+`.`:``)+(o+1)+`.`+n,JSON.stringify(c)))&&c.then){let l=this;return c.then(function(){return et.call(l,e,t,n,s?r:null,i,a,o+1)})}return et.call(this,e,t,n,s?r:null,i,a,o+1)}function tt(e,t,n=0,r=0){if(n<this.field.length){let i=this.field[n];if((t=this.index.get(i).export(e,i,n,r=1))&&t.then){let r=this;return t.then(function(){return r.export(e,i,n+1)})}return this.export(e,i,n+1)}let i,a;switch(r){case 0:i=`reg`,a=Qe(this.reg),t=null;break;case 1:i=`tag`,a=this.tag&&Xe(this.tag,this.reg.size),t=null;break;case 2:i=`doc`,a=this.store&&Je(this.store),t=null;break;default:return}return et.call(this,e,t,i,a||null,n,r)}function nt(e,t){var n=e.split(`.`);n[n.length-1]===`json`&&n.pop();let r=n.length>2?n[0]:``;if(n=n.length>2?n[2]:n[1],this.worker&&r)return this.index.get(r).import(e);if(t){if(typeof t==`string`&&(t=JSON.parse(t)),r)return this.index.get(r).import(n,t);switch(n){case`reg`:this.fastupdate=!1,this.reg=$e(t,this.reg);for(let e=0,t;e<this.field.length;e++)t=this.index.get(this.field[e]),t.fastupdate=!1,t.reg=this.reg;if(this.worker){t=[];for(let n of this.index.values())t.push(n.import(e));return Promise.all(t)}break;case`tag`:this.tag=Ze(t,this.tag);break;case`doc`:this.store=Ye(t,this.store)}}}function rt(e,t){let n=``;for(let r of e.entries()){e=r[0];let i=r[1],a=``;for(let e=0,n;e<i.length;e++){n=i[e]||[``];let r=``;for(let e=0;e<n.length;e++)r+=(r?`,`:``)+(t===`string`?`"`+n[e]+`"`:n[e]);r=`[`+r+`]`,a+=(a?`,`:``)+r}a=`["`+e+`",[`+a+`]]`,n+=(n?`,`:``)+a}return n}$.prototype.remove=function(e,t){let n=this.reg.size&&(this.fastupdate?this.reg.get(e):this.reg.has(e));if(n){if(this.fastupdate){for(let t=0,r,i;t<n.length;t++)if((r=n[t])&&(i=r.length))if(r[i-1]===e)r.pop();else{let t=r.indexOf(e);t>=0&&r.splice(t,1)}}else it(this.map,e),this.depth&&it(this.ctx,e);t||this.reg.delete(e)}return this.db&&(this.commit_task.push({del:e}),this.M&&dt(this)),this.cache&&this.cache.remove(e),this};function it(e,t){let n=0;var r=t===void 0;if(e.constructor===Array){for(let i=0,a,o,s;i<e.length;i++)if((a=e[i])&&a.length){if(r)return 1;if(o=a.indexOf(t),o>=0){if(a.length>1)return a.splice(o,1),1;if(delete e[i],n)return 1;s=1}else{if(s)return 1;n++}}}else for(let i of e.entries())r=i[0],it(i[1],t)?n++:e.delete(r);return n}var at={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:`forward`},score:{resolution:9,context:{depth:2,resolution:3}}};$.prototype.add=function(e,t,n,r){if(t&&(e||e===0)){if(!r&&!n&&this.reg.has(e))return this.update(e,t);r=this.depth,t=this.encoder.encode(t,!r);let l=t.length;if(l){let u=z(),d=z(),f=this.resolution;for(let p=0;p<l;p++){let m=t[this.rtl?l-1-p:p];var i=m.length;if(i&&(r||!d[m])){var a=this.score?this.score(t,m,p,null,0):ot(f,l,p),o=``;switch(this.tokenize){case`tolerant`:if(Q(this,d,m,a,e,n),i>2){for(let t=1,r,s,c,l;t<i-1;t++)r=m.charAt(t),s=m.charAt(t+1),c=m.substring(0,t)+s,l=m.substring(t+2),o=c+r+l,Q(this,d,o,a,e,n),o=c+l,Q(this,d,o,a,e,n);Q(this,d,m.substring(0,m.length-1),a,e,n)}break;case`full`:if(i>2){for(let r=0,c;r<i;r++)for(a=i;a>r;a--){o=m.substring(r,a),c=this.rtl?i-1-r:r;var s=this.score?this.score(t,m,p,o,c):ot(f,l,p,i,c);Q(this,d,o,s,e,n)}break}case`bidirectional`:case`reverse`:if(i>1){for(s=i-1;s>0;s--){o=m[this.rtl?i-1-s:s]+o;var c=this.score?this.score(t,m,p,o,s):ot(f,l,p,i,s);Q(this,d,o,c,e,n)}o=``}case`forward`:if(i>1){for(s=0;s<i;s++)o+=m[this.rtl?i-1-s:s],Q(this,d,o,a,e,n);break}default:if(Q(this,d,m,a,e,n),r&&l>1&&p<l-1)for(i=this.N,o=m,a=Math.min(r+1,this.rtl?p+1:l-p),s=1;s<a;s++){m=t[this.rtl?l-1-p-s:p+s],c=this.bidirectional&&m>o;let r=this.score?this.score(t,o,p,m,s-1):ot(i+(l/2>i?0:1),l,p,a-1,s-1);Q(this,u,c?o:m,r,e,n,c?m:o)}}}}this.fastupdate||this.reg.add(e)}}return this.db&&(this.commit_task.push(n?{ins:e}:{del:e}),this.M&&dt(this)),this};function Q(e,t,n,r,i,a,o){let s,c;if(!(s=t[n])||o&&!s[o]){if(o?(t=s||(t[n]=z()),t[o]=1,c=e.ctx,(s=c.get(o))?c=s:c.set(o,c=e.keystore?new K(e.keystore):new Map)):(c=e.map,t[n]=1),(s=c.get(n))?c=s:c.set(n,c=s=[]),a){for(let n=0,a;n<s.length;n++)if((a=s[n])&&a.includes(i)){if(n<=r)return;a.splice(a.indexOf(i),1),e.fastupdate&&(t=e.reg.get(i))&&t.splice(t.indexOf(a),1);break}}if(c=c[r]||(c[r]=[]),c.push(i),c.length===2**31-1){if(t=new he(c),e.fastupdate)for(let n of e.reg.values())n.includes(c)&&(n[n.indexOf(c)]=t);s[r]=c=t}e.fastupdate&&((r=e.reg.get(i))?r.push(c):e.reg.set(i,[c]))}}function ot(e,t,n,r,i){return n&&e>1?t+(r||0)<=e?n+(i||0):(e-1)/(t+(r||0))*(n+(i||0))+1|0:0}$.prototype.search=function(e,t,n){if(n||(t||typeof e!=`object`?typeof t==`object`&&(n=t,t=0):(n=e,e=``)),n&&n.cache)return n.cache=!1,e=this.searchCache(e,t,n),n.cache=!0,e;let r=[],i,a,o,s=0,c,l,u,d,f;n&&(e=n.query||e,t=n.limit||t,s=n.offset||0,a=n.context,o=n.suggest,f=(c=n.resolve)&&n.enrich,u=n.boost,d=n.resolution,l=this.db&&n.tag),c===void 0&&(c=this.resolve),a=this.depth&&a!==!1;let p=this.encoder.encode(e,!a);if(i=p.length,t||=c?100:0,i===1)return ct.call(this,p[0],``,t,s,c,f,l);if(i===2&&a&&!o)return ct.call(this,p[1],p[0],t,s,c,f,l);let m=z(),h=0,g;if(a&&(g=p[0],h=1),d||d===0||(d=g?this.N:this.resolution),this.db){if(this.db.search&&(n=this.db.search(this,p,t,s,o,c,f,l),n!==!1))return n;let e=this;return async function(){for(let t,n;h<i;h++){if((n=p[h])&&!m[n]){if(m[n]=1,t=await ut(e,n,g,0,0,!1,!1),t=lt(t,r,o,d)){r=t;break}g&&(o&&t&&r.length||(g=n))}o&&g&&h===i-1&&!r.length&&(d=e.resolution,g=``,h=-1,m=z())}return st(r,d,t,s,o,u,c)}()}for(let e,t;h<i;h++){if((t=p[h])&&!m[t]){if(m[t]=1,e=ut(this,t,g,0,0,!1,!1),e=lt(e,r,o,d)){r=e;break}g&&(o&&e&&r.length||(g=t))}o&&g&&h===i-1&&!r.length&&(d=this.resolution,g=``,h=-1,m=z())}return st(r,d,t,s,o,u,c)};function st(e,t,n,r,i,a,o){let s=e.length,c=e;if(s>1)c=ze(e,t,n,r,i,a,o);else if(s===1)return o?Ae.call(null,e[0],n,r):new Z(e[0],this);return o?c:new Z(c,this)}function ct(e,t,n,r,i,a,o){return e=ut(this,e,t,n,r,i,a,o),this.db?e.then(function(e){return i?e||[]:new Z(e,this)}):e&&e.length?i?Ae.call(this,e,n,r):new Z(e,this):i?[]:new Z([],this)}function lt(e,t,n,r){let i=[];if(e&&e.length){if(e.length<=r){t.push(e);return}for(let t=0,n;t<r;t++)(n=e[t])&&(i[t]=n);if(i.length){t.push(i);return}}if(!n)return i}function ut(e,t,n,r,i,a,o,s){let c;return n&&(c=e.bidirectional&&t>n)&&(c=n,n=t,t=c),e.db?e.db.get(t,n,r,i,a,o,s):(e=n?(e=e.ctx.get(n))&&e.get(t):e.map.get(t),e)}function $(e,t){if(!this||this.constructor!==$)return new $(e);if(e){var n=B(e)?e:e.preset;n&&(e=Object.assign({},at[n],e))}else e={};n=e.context;let r=n===!0?{depth:1}:n||{},i=B(e.encoder)?pe[e.encoder]:e.encode||e.encoder||{};this.encoder=i.encode?i:typeof i==`object`?new V(i):{encode:i},this.resolution=e.resolution||9,this.tokenize=n=(n=e.tokenize)&&n!==`default`&&n!==`exact`&&n||`strict`,this.depth=n===`strict`&&r.depth||0,this.bidirectional=r.bidirectional!==!1,this.fastupdate=!!e.fastupdate,this.score=e.score||null,(n=e.keystore||0)&&(this.keystore=n),this.map=n?new K(n):new Map,this.ctx=n?new K(n):new Map,this.reg=t||(this.fastupdate?n?new K(n):new Map:n?new q(n):new Set),this.N=r.resolution||3,this.rtl=i.rtl||e.rtl||!1,this.cache=(n=e.cache||null)&&new U(n),this.resolve=e.resolve!==!1,(n=e.db)&&(this.db=this.mount(n)),this.M=e.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=e.priority||4}I=$.prototype,I.mount=function(e){return this.commit_timer&&=(clearTimeout(this.commit_timer),null),e.mount(this)},I.commit=function(){return this.commit_timer&&=(clearTimeout(this.commit_timer),null),this.db.commit(this)},I.destroy=function(){return this.commit_timer&&=(clearTimeout(this.commit_timer),null),this.db.destroy()};function dt(e){e.commit_timer||=setTimeout(function(){e.commit_timer=null,e.db.commit(e)},1)}I.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this},I.append=function(e,t){return this.add(e,t,!0)},I.contain=function(e){return this.db?this.db.has(e):this.reg.has(e)},I.update=function(e,t){let n=this,r=this.remove(e);return r&&r.then?r.then(()=>n.add(e,t)):this.add(e,t)},I.cleanup=function(){return this.fastupdate?(it(this.map),this.depth&&it(this.ctx),this):this},I.searchCache=ce,I.export=function(e,t,n=0,r=0){let i,a;switch(r){case 0:i=`reg`,a=Qe(this.reg);break;case 1:i=`cfg`,a=null;break;case 2:i=`map`,a=Je(this.map,this.reg.size);break;case 3:i=`ctx`,a=Xe(this.ctx,this.reg.size);break;default:return}return et.call(this,e,t,i,a,n,r)},I.import=function(e,t){if(t)switch(typeof t==`string`&&(t=JSON.parse(t)),e=e.split(`.`),e[e.length-1]===`json`&&e.pop(),e.length===3&&e.shift(),e=e.length>1?e[1]:e[0],e){case`reg`:this.fastupdate=!1,this.reg=$e(t,this.reg);break;case`map`:this.map=Ye(t,this.map);break;case`ctx`:this.ctx=Ze(t,this.ctx)}},I.serialize=function(e=!0){let t=``,n=``,r=``;if(this.reg.size){let e;for(var i of this.reg.keys())e||=typeof i,t+=(t?`,`:``)+(e===`string`?`"`+i+`"`:i);t=`index.reg=new Set([`+t+`]);`,n=rt(this.map,e),n=`index.map=new Map([`+n+`]);`;for(let t of this.ctx.entries()){i=t[0];let n=rt(t[1],e);n=`new Map([`+n+`])`,n=`["`+i+`",`+n+`]`,r+=(r?`,`:``)+n}r=`index.ctx=new Map([`+r+`]);`}return e?`function inject(index){`+t+n+r+`}`:t+n+r},X($.prototype);var ft=typeof window<`u`&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),pt=[`map`,`ctx`,`tag`,`reg`,`cfg`],mt=z();function ht(e,t={}){if(!this||this.constructor!==ht)return new ht(e,t);typeof e==`object`&&(t=e,e=e.name),e||console.info(`Default storage space was used, because a name was not passed.`),this.id=`flexsearch`+(e?`:`+e.toLowerCase().replace(/[^a-z0-9_\-]/g,``):``),this.field=t.field?t.field.toLowerCase().replace(/[^a-z0-9_\-]/g,``):``,this.type=t.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}I=ht.prototype,I.mount=function(e){return e.index?e.mount(this):(e.db=this,this.open())},I.open=function(){if(this.db)return this.db;let e=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),mt[e.id]||(mt[e.id]=[]),mt[e.id].push(e.field);let t=ft.open(e.id,1);return t.onupgradeneeded=function(){let t=e.db=this.result;for(let n=0,r;n<pt.length;n++){r=pt[n];for(let n=0,i;n<mt[e.id].length;n++)i=mt[e.id][n],t.objectStoreNames.contains(r+(r===`reg`?``:i?`:`+i:``))||t.createObjectStore(r+(r===`reg`?``:i?`:`+i:``))}},e.db=_t(t,function(t){e.db=t,e.db.onversionchange=function(){e.close()}})},I.close=function(){this.db&&this.db.close(),this.db=null},I.destroy=function(){return _t(ft.deleteDatabase(this.id))},I.clear=function(){let e=[];for(let t=0,n;t<pt.length;t++){n=pt[t];for(let t=0,r;t<mt[this.id].length;t++)r=mt[this.id][t],e.push(n+(n===`reg`?``:r?`:`+r:``))}let t=this.db.transaction(e,`readwrite`);for(let n=0;n<e.length;n++)t.objectStore(e[n]).clear();return _t(t)},I.get=function(e,t,n=0,r=0,i=!0,a=!1){e=this.db.transaction((t?`ctx`:`map`)+(this.field?`:`+this.field:``),`readonly`).objectStore((t?`ctx`:`map`)+(this.field?`:`+this.field:``)).get(t?t+`:`+e:e);let o=this;return _t(e).then(function(e){let t=[];if(!e||!e.length)return t;if(i){if(!n&&!r&&e.length===1)return e[0];for(let i=0,a;i<e.length;i++)if((a=e[i])&&a.length){if(r>=a.length){r-=a.length;continue}let e=n?r+Math.min(a.length-r,n):a.length;for(let n=r;n<e;n++)t.push(a[n]);if(r=0,t.length===n)break}return a?o.enrich(t):t}return e})},I.tag=function(e,t=0,n=0,r=!1){e=this.db.transaction(`tag`+(this.field?`:`+this.field:``),`readonly`).objectStore(`tag`+(this.field?`:`+this.field:``)).get(e);let i=this;return _t(e).then(function(e){return!e||!e.length||n>=e.length?[]:!t&&!n?e:(e=e.slice(n,n+t),r?i.enrich(e):e)})},I.enrich=function(e){typeof e!=`object`&&(e=[e]);let t=this.db.transaction(`reg`,`readonly`).objectStore(`reg`),n=[];for(let r=0;r<e.length;r++)n[r]=_t(t.get(e[r]));return Promise.all(n).then(function(t){for(let n=0;n<t.length;n++)t[n]={id:e[n],doc:t[n]?JSON.parse(t[n]):null};return t})},I.has=function(e){return e=this.db.transaction(`reg`,`readonly`).objectStore(`reg`).getKey(e),_t(e).then(function(e){return!!e})},I.search=null,I.info=function(){},I.transaction=function(e,t,n){e+=e===`reg`?``:this.field?`:`+this.field:``;let r=this.h[e+`:`+t];if(r)return n.call(this,r);let i=this.db.transaction(e,t);this.h[e+`:`+t]=r=i.objectStore(e);let a=n.call(this,r);return this.h[e+`:`+t]=null,_t(i).finally(function(){return a})},I.commit=async function(e){let t=e.commit_task,n=[];e.commit_task=[];for(let e=0,r;e<t.length;e++)r=t[e],r.del&&n.push(r.del);n.length&&await this.remove(n),e.reg.size&&(await this.transaction(`map`,`readwrite`,function(t){for(let n of e.map){let e=n[0],r=n[1];r.length&&(t.get(e).onsuccess=function(){let n=this.result;var i;if(n&&n.length){let e=Math.max(n.length,r.length);for(let t=0,a,o;t<e;t++)if((o=r[t])&&o.length){if((a=n[t])&&a.length)for(i=0;i<o.length;i++)a.push(o[i]);else n[t]=o;i=1}}else n=r,i=1;i&&t.put(n,e)})}}),await this.transaction(`ctx`,`readwrite`,function(t){for(let n of e.ctx){let e=n[0],r=n[1];for(let n of r){let r=n[0],i=n[1];i.length&&(t.get(e+`:`+r).onsuccess=function(){let n=this.result;var a;if(n&&n.length){let e=Math.max(n.length,i.length);for(let t=0,r,o;t<e;t++)if((o=i[t])&&o.length){if((r=n[t])&&r.length)for(a=0;a<o.length;a++)r.push(o[a]);else n[t]=o;a=1}}else n=i,a=1;a&&t.put(n,e+`:`+r)})}}}),e.store?await this.transaction(`reg`,`readwrite`,function(t){for(let n of e.store){let e=n[0],r=n[1];t.put(typeof r==`object`?JSON.stringify(r):1,e)}}):e.bypass||await this.transaction(`reg`,`readwrite`,function(t){for(let n of e.reg.keys())t.put(1,n)}),e.tag&&await this.transaction(`tag`,`readwrite`,function(t){for(let n of e.tag){let e=n[0],r=n[1];r.length&&(t.get(e).onsuccess=function(){let n=this.result;n=n&&n.length?n.concat(r):r,t.put(n,e)})}}),e.map.clear(),e.ctx.clear(),e.tag&&e.tag.clear(),e.store&&e.store.clear(),e.document||e.reg.clear())};function gt(e,t,n){let r=e.value,i,a=0;for(let e=0,o;e<r.length;e++){if(o=n?r:r[e]){for(let n=0,a,s;n<t.length;n++)if(s=t[n],a=o.indexOf(s),a>=0)if(i=1,o.length>1)o.splice(a,1);else{r[e]=[];break}a+=o.length}if(n)break}a?i&&e.update(r):e.delete(),e.continue()}I.remove=function(e){return typeof e!=`object`&&(e=[e]),Promise.all([this.transaction(`map`,`readwrite`,function(t){t.openCursor().onsuccess=function(){let t=this.result;t&>(t,e)}}),this.transaction(`ctx`,`readwrite`,function(t){t.openCursor().onsuccess=function(){let t=this.result;t&>(t,e)}}),this.transaction(`tag`,`readwrite`,function(t){t.openCursor().onsuccess=function(){let t=this.result;t&>(t,e,!0)}}),this.transaction(`reg`,`readwrite`,function(t){for(let n=0;n<e.length;n++)t.delete(e[n])})])};function _t(e,t){return new Promise((n,r)=>{e.onsuccess=e.oncomplete=function(){t&&t(this.result),t=null,n(this.result)},e.onerror=e.onblocked=r,e=null})}var vt={Index:$,Charset:pe,Encoder:V,Document:Ge,Worker:Te,Resolver:Z,IndexedDB:ht,Language:{}};``+new URL(`year-in-posts-B2lywqdx.png`,import.meta.url).href;var yt=`year-in-posts-list`;function bt(){try{let e=u.account.get(yt)||{};return Object.entries(e).map(([e,t])=>({year:parseInt(e),...t})).sort((e,t)=>t.year-e.year)}catch{return[]}}async function xt(t){try{let n=`${e()}-${t}`;await j.yearInPosts.del(n);let r=u.account.get(yt)||{};return delete r[t],u.account.set(yt,r),!0}catch(e){throw e}}function St(e,t){let n=new Date(e),r=new Date(t,0,1),i=new Date(t,11,31,23,59,59,999);return n>=r&&n<=i}async function Ct(t){let{masto:n,instance:r}=i(),a=[],o=!1,s=p();if(!s)throw Error(`No current account`);let c=s.info.id,l=s.info.acct,d=new Date(t,0,1),f=new Date(t,11,31,23,59,59,999),m=await P(r),h=null;if(m)try{let e=await n.v1.accounts.$select(c).statuses.list({limit:1,exclude_replies:!1,exclude_reblogs:!1}).values().next();if(e?.value?.length){let r=e.value[0];if(!St(r.createdAt,t)){let e=`${t+1}-01-02`;try{let t=await n.v2.search.list({q:`from:${l} before:${e}`,type:`statuses`,limit:1});t?.statuses?.length&&(h=t.statuses[0].id)}catch{}}}}catch{}let g=n.v1.accounts.$select(c).statuses.list({limit:40,exclude_replies:!1,exclude_reblogs:!1,max_id:h||void 0}).values(),_=!0;fetchLoop:for(;;)try{let{value:e,done:t}=await g.next();if(t||!e?.length)break fetchLoop;let n=!1;for(let t of e){let e=new Date(t.createdAt);e>f||(_=!1,e>=d&&(a.push(t),n=!0))}if(!n&&!_)break fetchLoop;await new Promise(e=>setTimeout(e,500))}catch{break fetchLoop}if(a.sort((e,t)=>new Date(e.createdAt)-new Date(t.createdAt)),a.length>0)try{let e=a[0].id,t=n.v1.accounts.$select(c).statuses.list({limit:40,min_id:e,exclude_replies:!1,exclude_reblogs:!1}).values();gapFillLoop:for(;;)try{let{value:e,done:n}=await t.next();if(n||!e?.length)break gapFillLoop;let r=!1;for(let t of e){let e=new Date(t.createdAt);e<d||e<=f&&(a.find(e=>e.id===t.id)||(a.push(t),o=!0),r=!0)}if(!r)break gapFillLoop;await new Promise(e=>setTimeout(e,500))}catch{break gapFillLoop}o&&a.sort((e,t)=>new Date(e.createdAt)-new Date(t.createdAt))}catch{}let v=0;try{v=new TextEncoder().encode(JSON.stringify(a)).length}catch{}let y=`${e()}-${t}`,b=new Date().getTimezoneOffset();await j.yearInPosts.set(y,{id:y,posts:a,count:a.length,year:t,size:v,fetchedAt:Date.now(),timezoneOffset:b});let x=u.account.get(yt)||{};return x[t]={count:a.length,size:v,fetchedAt:Date.now(),timezoneOffset:b},u.account.set(yt,x),{posts:a,searchEnabled:m,gapsFilled:o}}var wt=2005;function Tt(){let e=new Date,t=e.getFullYear(),n=e.getMonth(),r=e.getDate();return n===0&&r<=30?t-1:t}function Et(e){let t=e<=0?`+`:`-`,n=Math.abs(e),r=Math.floor(n/60),i=n%60;return`UTC${t}${r}${i>0?`:${String(i).padStart(2,`0`)}`:``}`}function Dt(){return new Date().getTimezoneOffset()}var Ot={all:`All`,original:`Original`,replies:`Replies`,quotes:`Quotes`,boosts:`Boosts`,media:`Media`},kt=[{key:`relevance`,condition:`searchQuery`},{key:`createdAt`},{key:`repliesCount`},{key:`favouritesCount`},{key:`reblogsCount`}];function At(e,t,n=`short`){let r=new Date(2e3,e,1);return E(t,{month:n}).format(r)}function jt(e){return e=parseInt(e,10),e>=wt&&e<=new Date().getFullYear()?e:null}function Mt(e){return e=parseInt(e,10),e>=0&&e<=11?e:null}var Nt=30;function Pt(){let{i18n:s}=r(),[c,l]=g(),u=c.get(`year`),p=c.get(`month`),[m,_]=d(`all`),[x,E]=d(``),P=jt(u),F=Mt(p);v(x?`Year in Posts ${P} - Search: ${x}`:P?F===null?`Year in Posts ${P}`:`Year in Posts ${P} - ${At(F,s.locale)}`:`Year in Posts`,`/yip`);let{instance:I}=i(),[L,R]=d(`default`),[z,B]=d([]),[te,ne]=d([]),[re,ie]=d(!0),[ae,oe]=d(!!x),[se,V]=d(Nt),[H,ce]=d(x?`relevance`:`createdAt`),[U,le]=d(`asc`),W=n(null),G=n(null),ue=a(()=>e(),[]);S([`Slash`,`/`],e=>{ae?W.current?.focus():(oe(!0),setTimeout(()=>{W.current?.focus()},100))},{useKey:!0,preventDefault:!0,ignoreEventWhen:e=>{let t=!!document.querySelector(`#modal-container > *`),n=[`INPUT`,`TEXTAREA`].includes(e.target.tagName);return e.key===`/`?!1:t||n||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}});let de=z.length;o(()=>{x||W.current?.isFocused()||oe(!1)},[x,p,m,H,U]);function fe(){ne(bt())}o(()=>{P||fe()},[P]);let pe=async e=>{e.preventDefault();let t=jt(e.target.elements.year.value);if(t)try{let e=`${ue}-${t}`,n=await j.yearInPosts.get(e);n&&n.year===t?l({year:t}):(R(`generating`),await Ct(t),l({year:t}))}catch{R(`error`),b(`Unable to generate year posts. Please try again.`)}finally{L===`generating`&&R(`default`)}else b(`Invalid year.`)};async function me(e){try{R(`generating`),await Ct(e),l({year:e})}catch{R(`error`),b(`Unable to regenerate year posts. Please try again.`)}finally{L===`generating`&&R(`default`)}}async function he(e){if(confirm(`Remove year ${e} posts?`))try{await xt(e),ne(t=>t.filter(t=>t.year!==e))}catch{alert(`Failed to remove year data`)}}let K=a(()=>{let e={};z.forEach(t=>{let n=new Date(t.createdAt),r=n.getMonth(),i=n.getDate();e[r]||(e[r]={}),e[r][i]||(e[r][i]={total:0,original:0,reply:0,quote:0,boost:0});let a=e[r][i];a.total++,t.reblog?a.boost++:N()&&(t.quote?.id||t.quote?.quotedStatus?.id)?a.quote++:t.inReplyToId?a.reply++:a.original++});let t={};return Object.keys(e).forEach(n=>{let r=e[n],i=Math.max(...Object.values(r).map(e=>e.total)),a=new Date(P,parseInt(n),1).getDay(),o=[];for(let e=0;e<a;e++)o.push({day:null,count:0,ratio:0,original:0,reply:0,quote:0,boost:0});for(let e=1;e<=31;e++){let t=r[e],n=t?.total||0,a=n&&i>0?n/i:0;o.push({day:e,count:n,ratio:a,original:t?.original||0,reply:t?.reply||0,quote:t?.quote||0,boost:t?.boost||0})}t[n]=o}),t},[z,P]),q=a(()=>{if(m!==`media`)return{};let e={};return z.forEach(t=>{let n=new Date(t.createdAt),r=n.getMonth(),i=n.getDate();e[r]||(e[r]={}),e[r][i]||(e[r][i]=[]),e[r][i].push(t)}),Object.keys(e).forEach(t=>{let n=e[t],r=new Date(P,parseInt(t),1).getDay(),i=[];for(let e=0;e<r;e++)i.push(null);for(let e=1;e<=31;e++){let t=n[e]||[],r=null,a=!1;if(t.length>0){let e=t.filter(e=>{let t=e.reblog||e;return!e.reblog&&t.mediaAttachments?.some(e=>e.previewUrl||e.url||e.previewRemoteUrl||e.remoteUrl)});e.length>0&&(r=e.reduce((e,t)=>{let n=t,r=(n.favouritesCount||0)+(n.reblogsCount||0)+(n.repliesCount||0)+(n.quotesCount||0),i=e?(e.favouritesCount||0)+(e.reblogsCount||0)+(e.repliesCount||0)+(e.quotesCount||0):-1;return r>i?t:r===i?e||t:e},null),a=!0)}i.push(r?{post:r,hasMedia:a}:{hasMedia:a})}e[t]=i}),e},[z,P,m]),J=a(()=>{let e={},t={};return z.forEach(n=>{let r=new Date(n.createdAt).getMonth();e[r]=(e[r]||0)+1,t[r]||(t[r]={original:0,reply:0,quote:0,boost:0}),n.reblog?t[r].boost++:N()&&(n.quote?.id||n.quote?.quotedStatus?.id)?t[r].quote++:n.inReplyToId?t[r].reply++:t[r].original++}),Object.entries(e).map(([e,n])=>{let r=t[e];return{month:parseInt(e),count:n,heatmap:K[e]||[],mediaGrid:q[e]||[],original:r.original,reply:r.reply,quote:r.quote,boost:r.boost}}).sort((e,t)=>e.month-t.month)},[z,K,q]),ge=n(null);o(()=>{if(de>0){let e=new vt.Document({preset:`match`,document:{id:`id`,index:[`content`,`spoilerText`,`poll`,`media`,`card`]}});z.forEach(t=>{let n=t.reblog||t,r=n.poll?.options?.map(e=>e.title).join(` `),i=n.mediaAttachments?.map(e=>e.description).join(` `),a=n.card?`${n.card.title} ${n.card.description} ${n.card.url}`:``;e.add({id:t.id,content:A(n.content),spoilerText:n.spoilerText,poll:r,media:i,card:a})}),ge.current=e}},[z]);let _e=a(()=>{if(!x)return z;if(!ge.current)return[];console.time(`search: '${x}'`);let e=ge.current.search(x,{limit:de});console.timeEnd(`search: '${x}'`);let t=e.flatMap(e=>e.result),n=[...new Set(t)],r=new Map(z.map(e=>[e.id,e]));return n.map(e=>r.get(e)).filter(Boolean)},[z,x]);o(()=>{V(Nt),x?[`relevance`,`createdAt`].includes(H)||ce(`relevance`):H===`relevance`&&ce(`createdAt`)},[x,H]);let[Y,ve]=a(()=>{let e=_e.filter(e=>{if(x)return!0;let t=new Date(e.createdAt).getMonth();return F!==null&&t===F}),t={all:e.length,original:0,replies:0,quotes:0,boosts:0,media:0};return e.forEach(e=>{e.reblog?t.boosts++:N()&&(e.quote?.id||e.quote?.quotedStatus?.id)?t.quotes++:e.inReplyToId?t.replies++:t.original++;let n=e.reblog||e;!e.reblog&&n.mediaAttachments?.length>0&&t.media++}),[t,e]},[_e,F,x]),[X,ye]=a(()=>{let e=ve.filter(e=>{if(m===`boosts`)return!!e.reblog;if(m===`media`){let t=e.reblog||e;return!e.reblog&&t.mediaAttachments?.length>0}else if(m===`quotes`)return N()&&(e.quote?.id||e.quote?.quotedStatus?.id);else if(m===`replies`)return!!e.inReplyToId;else if(m===`original`)return!e.reblog&&!(N()&&(e.quote?.id||e.quote?.quotedStatus?.id))&&!e.inReplyToId;return!0}),t=e;return H!==`relevance`&&(t=[...e].sort((e,t)=>{let n=e.reblog||e,r=t.reblog||t,i,a;return H===`createdAt`?(i=new Date(e.createdAt),a=new Date(t.createdAt)):(i=n[H]||0,a=r[H]||0),U===`asc`?i>a?1:-1:a>i?1:-1})),x?[t.slice(0,se),t.length>se]:[t,!1]},[ve,m,x,se,H,U]);o(()=>{x&&m!==`all`&&X.length===0&&Y.all>0&&_(`all`)},[x,m,X.length,Y.all]);let be=J.findIndex(e=>e.month===F),xe=be>0?J[be-1]:null,Se=be<J.length-1?J[be+1]:null;return o(()=>{if(!P){R(`default`),B([]);return}(async()=>{R(`loading`);try{let e=`${ue}-${P}`;console.time(`fetchYearPosts-${P}`);let t=await j.yearInPosts.get(e);console.timeEnd(`fetchYearPosts-${P}`),t&&t.year===P?(t.posts.sort((e,t)=>new Date(e.createdAt)-new Date(t.createdAt)),B(t.posts),R(`results`)):R(`no-data`)}catch{R(`error`)}})()},[P]),o(()=>{if(F!==null&&L===`results`){let e=document.querySelector(`.calendar-bar .month-filter[data-month="${F}"]`);e?.focus(),e?.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`nearest`})}},[F,L===`results`]),f(`div`,{ref:G,id:`year-in-posts-page`,class:`deck-container`,tabIndex:`-1`,style:{"--month":F||0},children:[f(`div`,{class:`timeline-deck deck`,children:[f(`header`,{class:L===`loading`?`loading`:``,onClick:e=>{e.target.closest(`a, button`)||G.current?.scrollTo({top:0,behavior:`smooth`})},children:f(`div`,{class:`header-grid`,children:[f(`div`,{class:`header-side`,children:[f(ee,{}),P&&F!==null?f(k,{to:`/yip?year=${P}`,class:`button plain`,onClick:()=>{E(``)},children:f(T,{icon:`grid`,size:`l`,alt:`Year in Posts`})}):P?f(k,{to:`/yip`,class:`button plain`,onClick:()=>{E(``)},children:f(T,{icon:`month`,size:`l`,alt:`Year in Posts`})}):f(k,{to:`/`,class:`button plain`,children:f(T,{icon:`home`,size:`l`,alt:`Home`})})]}),P&&f(t,{children:ae?f(Rt,{ref:W,placeholder:`Search posts in ${P}…`,searchQuery:x,onSearch:e=>{E(e),V(Nt)},onEscape:()=>{x.trim()||(oe(!1),E(``))}}):f(`h1`,{class:`header-double-lines`,children:[f(`b`,{children:P}),L===`results`&&f(`div`,{children:F===null?`${z.length} posts`:`${At(F)} – ${J[F].count} posts`})]})}),f(`div`,{class:`header-side`,children:P&&f(t,{children:[f(`button`,{type:`button`,class:`plain ${ae?`is-active`:``}`,onClick:()=>{ae?(oe(!1),E(``)):(oe(!0),setTimeout(()=>{W.current?.focus()},100))},children:f(T,{icon:`search`,size:`l`,alt:`Search`})}),f(C,{align:`end`,menuButton:f(`button`,{type:`button`,class:`plain`,children:f(T,{icon:`more`,size:`l`,alt:`More`})}),children:f(M,{type:`checkbox`,checked:m===`media`,onClick:()=>{_(m===`media`?`all`:`media`)},children:[f(T,{icon:`check-circle`,alt:`☑️`}),` `,f(`span`,{class:`menu-grow`,children:`Media only`})]})})]})})]})}),f(`main`,{children:[!P&&f(`div`,{class:`year-in-posts-start`,children:[L===`generating`?f(`div`,{class:`ui-state year-in-posts-start`,children:[f(h,{abrupt:!0}),f(`p`,{class:`insignificant`,children:`Generating Year in Posts…`}),f(`p`,{class:`insignificant`,children:`This might take a while.`})]}):f(t,{children:[f(`h1`,{children:[`Year in Posts `,f(`sup`,{children:`beta`})]}),f(`p`,{children:`A year-at-a-glance view of your posts.`}),f(`details`,{children:[f(`summary`,{children:`What is this?`}),f(`p`,{children:`Year in Posts is a simple, searchable archive of your posts, offering a year-at-a-glance view with calendar visualizations and straight-forward interface to sort and filter through posts.`}),f(`img`,{src:``+new URL(`year-in-posts-B2lywqdx.png`,import.meta.url).href,width:`1200`,height:`900`,alt:`Preview of Year in Posts UI`}),f(`p`,{children:f(`button`,{type:`button`,onClick:e=>{e.target.closest(`details`).open=!1},children:`Let's explore my posts`})})]}),f(`form`,{class:`year-generate`,onSubmit:pe,children:[f(`label`,{children:f(`input`,{type:`number`,min:wt,max:new Date().getFullYear(),name:`year`,defaultValue:Tt(),disabled:L===`generating`})}),f(`button`,{type:`submit`,disabled:L===`generating`,children:f(T,{icon:`arrow-right`,alt:`Generate`,size:`l`})})]}),f(`div`,{class:`insignificant`,children:f(`small`,{children:[f(`p`,{children:`This downloads your posts (excluding media files) from the server and saves them locally. It may take a longer time and require more disk space.`}),f(`p`,{children:`Once archived, updated or deleted posts are not reflected in the archive until regenerated.`})]})}),!re&&f(`p`,{class:`insignificant`,children:f(`small`,{children:`⚠️ Your server doesn't support advanced search, this will make more requests to the server and take much longer time.`})})]}),te.length>0&&L!==`generating`&&f(`div`,{class:`year-selection`,children:[f(`p`,{children:`Archived Year in Posts:`}),f(`ul`,{children:te.map(({year:e,count:t,fetchedAt:n,size:r,timezoneOffset:i})=>{let a=Dt(),o=i!==void 0&&i!==a;return f(`li`,{children:[f(k,{to:`/yip?year=${e}`,class:`year-card available`,children:[f(T,{icon:`month`}),` `,e]}),` `,f(`small`,{class:`ib insignificant`,children:[t,` posts`,` `]}),` `,r&&f(`small`,{class:`tag insignificant collapsed`,title:`${r.toLocaleString(s.locale||void 0)} bytes`,children:[`~`,y(r)]}),` `,f(w,{align:`end`,confirmLabel:f(`span`,{children:[`Regenerate `,e,` posts?`]}),onClick:()=>{me(e)},children:f(`button`,{type:`button`,class:`light small`,disabled:L===`loading`,title:n,children:[f(T,{icon:`refresh`,size:`s`,class:`insignificant`}),` `,f(`span`,{class:`insignificant`,children:new Date(n).toLocaleDateString(s.locale,{year:`numeric`,month:`short`,day:`numeric`})}),` `,i!==void 0&&f(`small`,{class:`tag insignificant collapsed ${o?`warn`:``}`,title:o?`Generated in ${Et(i)}, current timezone is ${Et(a)}`:Et(i),children:[o&&f(T,{icon:`time`}),Et(i)]})]})}),f(`button`,{type:`button`,class:`light danger small`,onClick:t=>{t.preventDefault(),he(e)},children:f(T,{icon:`x`,alt:`Remove`})})]},e)})})]})]}),P&&L===`loading`&&f(`div`,{class:`ui-state year-in-posts-start`,children:f(h,{abrupt:!0})}),P&&L===`results`&&f(t,{children:[!x&&J.length>0&&f(t,{children:[f(It,{year:P,month:F,monthsWithPosts:J,postType:m}),F===null&&f(Lt,{})]}),(F!==null||x)&&f(`div`,{class:`post-type-filters`,children:Object.entries(Ot).map(([e,t])=>Y[e]>0&&f(`button`,{type:`button`,class:`filter-cat plain ${m===e?`is-active`:``}`,onClick:()=>_(e),children:[t,` `,f(`span`,{class:`count`,children:Y[e]})]},e))}),(F!==null||x)&&X.length>1&&f(`div`,{class:`sort-controls`,children:[f(`span`,{class:`filter-label`,children:`Sort`}),` `,f(`fieldset`,{class:`radio-field-group`,children:kt.filter(e=>e.key===`relevance`?!!x:e.key===`createdAt`?!0:!x).map(({key:e})=>f(`label`,{class:`filter-sort`,onClick:t=>{H===e&&e!==`relevance`&&(t.preventDefault(),t.stopPropagation(),le(U===`asc`?`desc`:`asc`))},children:[f(`input`,{type:`radio`,name:`filter-sort-cat`,checked:H===e,onChange:()=>{ce(e),le(/(replies|favourites|reblogs)/.test(e)?`desc`:`asc`)}}),{relevance:`Relevance`,createdAt:`Date`,repliesCount:`Replies`,favouritesCount:`Likes`,reblogsCount:`Boosts`}[e],H===e&&e!==`relevance`&&(U===`asc`?` ↑`:` ↓`)]},e))})]}),(F!==null||x)&&f(t,{children:[f(`ul`,{class:`timeline`,children:X.length===0?f(`p`,{class:`ui-state insignificant`,children:`…`}):X.map((e,n)=>{let r=new Date(e.createdAt),i=X[n-1],a=i?new Date(i.createdAt):null;return f(t,{children:[H===`createdAt`&&(!a||r.toDateString()!==a.toDateString())&&f(`li`,{class:`date-header`,children:f(`h2`,{children:[f(`span`,{children:D(e.createdAt,{hideTime:!0,formatOpts:{year:void 0}})}),` `,f(`small`,{class:`insignificant bidi-isolate`,children:D(e.createdAt,{forceOpts:{weekday:`long`}})})]})},e.createdAt),f(`li`,{children:de>20?f(Ft,{root:G.current,post:e,instance:I,defaultShow:n<3},e.id):f(k,{class:`status-link timeline-item`,to:e.reblog?`/${I}/s/${e.reblog.id}`:`/${I}/s/${e.id}`,children:f(O,{status:e,instance:I,size:`m`,showCommentCount:!0,showQuoteCount:!0})})},e.id)]})})}),x&&ye&&f(`div`,{class:`ui-state`,children:f(`button`,{type:`button`,class:`plain6 block`,onClick:()=>V(e=>e+Nt),children:`More…`})}),!x&&f(`div`,{class:`year-in-posts-nav`,children:[xe?f(k,{to:`/yip?year=${P}&month=${xe.month}`,class:`button light`,onClick:()=>{G.current?.scrollTo({top:0,behavior:`instant`})},children:[f(T,{icon:`arrow-left`}),` `,At(xe.month,s.locale,`long`)]}):f(`span`,{}),Se&&f(k,{to:`/yip?year=${P}&month=${Se.month}`,class:`button light`,onClick:()=>{G.current?.scrollTo({top:0,behavior:`instant`})},children:[At(Se.month,s.locale,`long`),` `,f(T,{icon:`arrow-right`})]})]})]})]})]})]}),f(`div`,{class:`tron-grid ${F===null?`animated`:``}`})]})}var Ft=({root:e,post:r,instance:i,defaultShow:a})=>{let s=n(),[c,l]=d(a);o(()=>{if(a)return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&(queueMicrotask(()=>l(!0)),t.unobserve(s.current))},{root:e,rootMargin:`${Math.max(320,screen.height*.75)}px`});return s.current&&t.observe(s.current),()=>{s.current&&t.unobserve(s.current)}},[a]);let u=r.reblog?.id||r.id;return f(`li`,{ref:s,style:{height:c?void 0:`10em`},children:c?f(k,{class:`status-link timeline-item`,to:`/${i}/s/${u}`,children:f(O,{status:r,instance:i,size:`m`,showCommentCount:!0,showQuoteCount:!0})}):f(t,{children:`\xA0`})})};function It({year:e,month:t,monthsWithPosts:n,postType:i}){let{i18n:a}=r();return f(`div`,{class:`calendar-bar ${t===null?`grid`:`horizontal`} ${i===`media`?`media-grid`:``}`,children:n.map(({month:n,count:r,heatmap:o,mediaGrid:s,original:c,reply:l,quote:u,boost:d})=>{let p=r>0?c/r:0,m=r>0?l/r:0,h=r>0?u/r:0,g=r>0?d/r:0;return f(k,{to:`/yip?year=${e}&month=${n}${i===`all`?``:`&postType=${i}`}`,class:`button plain ${t===n?`is-active month-filter`:`month-filter`}`,style:{"--month-original-ratio":p,"--month-reply-ratio":m,"--month-quote-ratio":h,"--month-boost-ratio":g},"data-month":n,children:[f(`div`,{class:`month-name`,children:At(n,a.locale)}),i===`media`?s.length>0&&f(`div`,{class:`month-media-grid`,children:s.map((e,t)=>{if(!e)return f(`span`,{class:`media-day empty`},t);if(!e.hasMedia)return f(`span`,{class:`media-day no-media`},t);let n=e.post.mediaAttachments?.[0];return f(`span`,{class:`media-day`,children:f(`img`,{src:n.previewUrl||n.url,loading:`lazy`,decoding:`async`,onError:e=>{let{src:t}=e.target;t===n.previewUrl||t===n.url?e.target.src=n.previewRemoteUrl||n.remoteUrl:e.target.remove()},alt:``})},t)})}):o.length>0&&f(`div`,{class:`month-heatmap`,children:o.map((e,t)=>{let n=e.count||0,r=n>0?e.original/n:0,i=n>0?e.reply/n:0,a=n>0?e.quote/n:0,o=n>0?e.boost/n:0;return f(`span`,{class:`heatmap-day ${e.day===null?`empty`:``} ${t%7==0||t%7==6?`weekend`:``}`,"data-ratio":e.ratio,style:{"--ratio":e.ratio,"--original-ratio":r,"--reply-ratio":i,"--quote-ratio":a,"--boost-ratio":o}},t)})}),f(`div`,{class:`month-metadata`,children:[r,` posts `]})]},n)})})}function Lt(){return f(`div`,{class:`calendar-bar-legends`,children:[f(`span`,{class:`ib`,children:[f(`span`,{class:`calendar-bar-legend-item calendar-bar-original`}),` `,f(c,{id:`HxF6Fk`})]}),` `,f(`span`,{class:`ib`,children:[f(`span`,{class:`calendar-bar-legend-item calendar-bar-reply`}),` `,f(c,{id:`N8UzTV`})]}),` `,N()&&f(t,{children:[f(`span`,{class:`ib`,children:[f(`span`,{class:`calendar-bar-legend-item calendar-bar-quote`}),` `,f(c,{id:`eWLklq`})]}),` `]}),f(`span`,{class:`ib`,children:[f(`span`,{class:`calendar-bar-legend-item calendar-bar-boost`}),` `,f(c,{id:`puY2t0`})]})]})}var Rt=s(({searchQuery:e,onSearch:t,placeholder:r,onEscape:i},a)=>{let o=n(null);l(a,()=>({focus:()=>{o.current?.focus()},setValue:e=>{o.current.value=e},isFocused:()=>document.activeElement===o.current}));let s=x(t,150);return f(`form`,{class:`search-field`,onSubmit:e=>{e.preventDefault();let t=o.current.value.trim();s?.cancel(),s(t)},children:f(`input`,{ref:o,type:`search`,name:`q`,class:`block`,placeholder:r||`Search posts…`,defaultValue:e,dir:`auto`,autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,spellCheck:`false`,enterKeyHint:`search`,onInput:e=>{let t=e.target.value;s(t)},onKeyDown:e=>{e.key===`Escape`&&!e.target.value.trim()&&i?.()}})})});export{Pt as default};
|
||
//# sourceMappingURL=year-in-posts-CCySMT55.js.map
|