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