diff --git a/esbuild.config.mjs b/esbuild.config.mjs index 7f3b801..7e9f997 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -24,6 +24,7 @@ const buildOptions = { sourcemap: isWatch ? "inline" : false, minify: !isWatch, logLevel: "info", + loader: { ".svg": "text" }, define: { __BUILD_TIME__: JSON.stringify(buildTime), }, diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..cb920f9 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,20 @@ +import tsparser from "@typescript-eslint/parser"; +import { defineConfig } from "eslint/config"; +import obsidianmd from "eslint-plugin-obsidianmd"; + +// Mirrors the checks Obsidian's community-plugin review bot runs. Use +// `npm run lint` before cutting a release so issues surface locally instead +// of in the review queue. +export default defineConfig([ + ...obsidianmd.configs.recommended, + { + files: ["main.ts", "src/**/*.ts"], + languageOptions: { + parser: tsparser, + parserOptions: { project: "./tsconfig.json" }, + }, + }, + { + ignores: ["node_modules/**", "main.js", "dist/**", "test-support/**", "**/*.mjs", "datadeck/**", "datadeck-work/**"], + }, +]); diff --git a/main.js b/main.js index 3f65d8a..e6147c9 100644 --- a/main.js +++ b/main.js @@ -1,25 +1,25 @@ -"use strict";var _c=Object.create;var Ps=Object.defineProperty;var Sc=Object.getOwnPropertyDescriptor;var kc=Object.getOwnPropertyNames;var wc=Object.getPrototypeOf,Ec=Object.prototype.hasOwnProperty;var Dc=(s,t,e)=>t in s?Ps(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var _i=(s,t)=>()=>(s&&(t=s(s=0)),t);var Mc=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),Xo=(s,t)=>{for(var e in t)Ps(s,e,{get:t[e],enumerable:!0})},Qo=(s,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kc(t))!Ec.call(s,i)&&i!==e&&Ps(s,i,{get:()=>t[i],enumerable:!(n=Sc(t,i))||n.enumerable});return s};var Os=(s,t,e)=>(e=s!=null?_c(wc(s)):{},Qo(t||!s||!s.__esModule?Ps(e,"default",{value:s,enumerable:!0}):e,s)),Tc=s=>Qo(Ps({},"__esModule",{value:!0}),s);var K=(s,t,e)=>(Dc(s,typeof t!="symbol"?t+"":t,e),e);var ts=Mc((Si,ki)=>{((s,t)=>{typeof define=="function"&&define.amd?define([],t):typeof ki=="object"&&typeof Si!="undefined"?ki.exports=t():s.Papa=t()})(Si,function s(){var t=typeof self!="undefined"?self:typeof window!="undefined"?window:t!==void 0?t:{},e,n=!t.document&&!!t.postMessage,i=t.IS_PAPA_WORKER||!1,o={},r=0,a={};function l(x){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(y){var C=_(y);C.chunkSize=parseInt(C.chunkSize),y.step||y.chunk||(C.chunkSize=null),this._handle=new f(C),(this._handle.streamer=this)._config=C}.call(this,x),this.parseChunk=function(y,C){var E=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview),i)t.postMessage({results:D,workerId:a.WORKER_ID,finished:E});else if(S(this._config.chunk)&&!C){if(this._config.chunk(D,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=D=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(D.data),this._completeResults.errors=this._completeResults.errors.concat(D.errors),this._completeResults.meta=D.meta),this._completed||!E||!S(this._config.complete)||D&&D.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),E||D&&D.meta.paused||this._nextChunk(),D}this._halted=!0},this._sendError=function(y){S(this._config.error)?this._config.error(y):i&&this._config.error&&t.postMessage({workerId:a.WORKER_ID,error:y,finished:!1})}}function c(x){var y;(x=x||{}).chunkSize||(x.chunkSize=a.RemoteChunkSize),l.call(this,x),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(C){this._input=C,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(y=new XMLHttpRequest,this._config.withCredentials&&(y.withCredentials=this._config.withCredentials),n||(y.onload=k(this._chunkLoaded,this),y.onerror=k(this._chunkError,this)),y.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var C,E=this._config.downloadRequestHeaders;for(C in E)y.setRequestHeader(C,E[C])}var D;this._config.chunkSize&&(D=this._start+this._config.chunkSize-1,y.setRequestHeader("Range","bytes="+this._start+"-"+D));try{y.send(this._config.downloadRequestBody)}catch(w){this._chunkError(w.message)}n&&y.status===0&&this._chunkError()}},this._chunkLoaded=function(){y.readyState===4&&(y.status<200||400<=y.status?this._chunkError():(this._start+=this._config.chunkSize||y.responseText.length,this._finished=!this._config.chunkSize||this._start>=(C=>(C=C.getResponseHeader("Content-Range"))!==null?parseInt(C.substring(C.lastIndexOf("/")+1)):-1)(y),this.parseChunk(y.responseText)))},this._chunkError=function(C){C=y.statusText||C,this._sendError(new Error(C))}}function d(x){(x=x||{}).chunkSize||(x.chunkSize=a.LocalChunkSize),l.call(this,x);var y,C,E=typeof FileReader!="undefined";this.stream=function(D){this._input=D,C=D.slice||D.webkitSlice||D.mozSlice,E?((y=new FileReader).onload=k(this._chunkLoaded,this),y.onerror=k(this._chunkError,this)):y=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(D.target.result)},this._chunkError=function(){this._sendError(y.error)}}function h(x){var y;l.call(this,x=x||{}),this.stream=function(C){return y=C,this._nextChunk()},this._nextChunk=function(){var C,E;if(!this._finished)return C=this._config.chunkSize,y=C?(E=y.substring(0,C),y.substring(C)):(E=y,""),this._finished=!y,this.parseChunk(E)}}function u(x){l.call(this,x=x||{});var y=[],C=!0,E=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(D){this._input=D,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){E&&y.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),y.length?this.parseChunk(y.shift()):C=!0},this._streamData=k(function(D){try{y.push(typeof D=="string"?D:D.toString(this._config.encoding)),C&&(C=!1,this._checkIsFinished(),this.parseChunk(y.shift()))}catch(w){this._streamError(w)}},this),this._streamError=k(function(D){this._streamCleanUp(),this._sendError(D)},this),this._streamEnd=k(function(){this._streamCleanUp(),E=!0,this._streamData("")},this),this._streamCleanUp=k(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function f(x){var y,C,E,D,w=Math.pow(2,53),M=-w,L=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,O=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,V=this,P=0,T=0,U=!1,F=!1,G=[],z={data:[],errors:[],meta:{}};function A(R){return x.skipEmptyLines==="greedy"?R.join("").trim()==="":R.length===1&&R[0].length===0}function j(){if(z&&E&&($("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),E=!1),x.skipEmptyLines&&(z.data=z.data.filter(function(W){return!A(W)})),Y()){let W=function(I,q){S(x.transformHeader)&&(I=x.transformHeader(I,q)),G.push(I)};var N=W;if(z)if(Array.isArray(z.data[0])){for(var R=0;Y()&&R(at=>(x.dynamicTypingFunction&&x.dynamicTyping[at]===void 0&&(x.dynamicTyping[at]=x.dynamicTypingFunction(at)),(x.dynamicTyping[at]||x.dynamicTyping)===!0))(X)?tt==="true"||tt==="TRUE"||tt!=="false"&&tt!=="FALSE"&&((at=>{if(L.test(at)&&(at=parseFloat(at),M=G.length?"__parsed_extra":G[Q]:Z,nt=x.transform?x.transform(nt,Z):nt);Z==="__parsed_extra"?(q[Z]=q[Z]||[],q[Z].push(nt)):q[Z]=nt}return x.header&&(Q>G.length?$("FieldMismatch","TooManyFields","Too many fields: expected "+G.length+" fields but parsed "+Q,T+I):Qx.preview?C.abort():(z.data=z.data[0],D(z,V))))}),this.parse=function(R,B,H){var N=x.quoteChar||'"',N=(x.newline||(x.newline=this.guessLineEndings(R,N)),E=!1,x.delimiter?S(x.delimiter)&&(x.delimiter=x.delimiter(R),z.meta.delimiter=x.delimiter):((N=((W,I,q,Q,Z)=>{var nt,X,tt,at;Z=Z||[","," ","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var Wt=0;Wt=H.length/2?`\r -`:"\r"}}function g(x){return x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function p(x){var y=(x=x||{}).delimiter,C=x.newline,E=x.comments,D=x.step,w=x.preview,M=x.fastMode,L=null,O=!1,V=x.quoteChar==null?'"':x.quoteChar,P=V;if(x.escapeChar!==void 0&&(P=x.escapeChar),(typeof y!="string"||-1=w)return ft(!0);break}H.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:B.length,index:T}),X++}}else if(E&&N.length===0&&F.substring(T,T+$)===E){if(Z===-1)return ft();T=Z+Y,Z=F.indexOf(C,T),Q=F.indexOf(y,T)}else if(Q!==-1&&(Q=w)return ft(!0)}return rt();function at(yt){B.push(yt),W=T}function Wt(yt){var Mt=0;return Mt=yt!==-1&&(yt=F.substring(X+1,yt))&&yt.trim()===""?yt.length:Mt}function rt(yt){return z||(yt===void 0&&(yt=F.substring(T)),N.push(yt),T=A,at(N),R&&Kt()),ft()}function pt(yt){T=yt,at(N),N=[],Z=F.indexOf(C,T)}function ft(yt){if(x.header&&!G&&B.length&&!O){var Mt=B[0],ae=Object.create(null),Ci=new Set(Mt);let Ko=!1;for(let Je=0;JeE.charCodeAt(0)!==65279?E:E.slice(1))(x),C=new(y.download?c:h)(y)):x.readable===!0&&S(x.read)&&S(x.on)?C=new u(y):(t.File&&x instanceof File||x instanceof Object)&&(C=new d(y)),C.stream(x);(C=(()=>{var E;return!!a.WORKERS_SUPPORTED&&(E=(()=>{var D=t.URL||t.webkitURL||null,w=s.toString();return a.BLOB_URL||(a.BLOB_URL=D.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",w,")();"],{type:"text/javascript"})))})(),(E=new t.Worker(E)).onmessage=b,E.id=r++,o[E.id]=E)})()).userStep=y.step,C.userChunk=y.chunk,C.userComplete=y.complete,C.userError=y.error,y.step=S(y.step),y.chunk=S(y.chunk),y.complete=S(y.complete),y.error=S(y.error),delete y.worker,C.postMessage({input:x,config:y,workerId:C.id})},a.unparse=function(x,y){var C=!1,E=!0,D=",",w=`\r -`,M='"',L=M+M,O=!1,V=null,P=!1,T=((()=>{if(typeof y=="object"){if(typeof y.delimiter!="string"||a.BAD_DELIMITERS.filter(function(G){return y.delimiter.indexOf(G)!==-1}).length||(D=y.delimiter),typeof y.quotes!="boolean"&&typeof y.quotes!="function"&&!Array.isArray(y.quotes)||(C=y.quotes),typeof y.skipEmptyLines!="boolean"&&typeof y.skipEmptyLines!="string"||(O=y.skipEmptyLines),typeof y.newline=="string"&&(w=y.newline),typeof y.quoteChar=="string"&&(M=y.quoteChar),typeof y.header=="boolean"&&(E=y.header),Array.isArray(y.columns)){if(y.columns.length===0)throw new Error("Option columns is empty");V=y.columns}y.escapeChar!==void 0&&(L=y.escapeChar+M),y.escapeFormulae instanceof RegExp?P=y.escapeFormulae:typeof y.escapeFormulae=="boolean"&&y.escapeFormulae&&(P=/^[=+\-@\t\r].*$/)}})(),new RegExp(g(M),"g"));if(typeof x=="string"&&(x=JSON.parse(x)),Array.isArray(x)){if(!x.length||Array.isArray(x[0]))return U(null,x,O);if(typeof x[0]=="object")return U(V||Object.keys(x[0]),x,O)}else if(typeof x=="object")return typeof x.data=="string"&&(x.data=JSON.parse(x.data)),Array.isArray(x.data)&&(x.fields||(x.fields=x.meta&&x.meta.fields||V),x.fields||(x.fields=Array.isArray(x.data[0])?x.fields:typeof x.data[0]=="object"?Object.keys(x.data[0]):[]),Array.isArray(x.data[0])||typeof x.data[0]=="object"||(x.data=[x.data])),U(x.fields||[],x.data||[],O);throw new Error("Unable to serialize unrecognized input");function U(G,z,A){var j="",Y=(typeof G=="string"&&(G=JSON.parse(G)),typeof z=="string"&&(z=JSON.parse(z)),Array.isArray(G)&&0{for(var R=0;R<$.length;R++)if(-1e-n*Math.max(Math.min(r-3,9-r,1),-1);return[i(0),i(8),i(4)]}function cd(s,t,e){let n=(i,o=(i+s/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function dd(s,t,e){let n=Dr(s,1,.5),i;for(t+e>1&&(i=1/(t+e),t*=i,e*=i),i=0;i<3;i++)n[i]*=1-t-e,n[i]+=t;return n}function hd(s,t,e,n,i){return s===i?(t-e)/n+(t.5?d/(2-o-r):d/(o+r),l=hd(e,n,i,d,o),l=l*60+.5),[l|0,c||0,a]}function Fi(s,t,e,n){return(Array.isArray(t)?s(t[0],t[1],t[2]):s(t,e,n)).map(Ce)}function Ii(s,t,e){return Fi(Dr,s,t,e)}function ud(s,t,e){return Fi(dd,s,t,e)}function fd(s,t,e){return Fi(cd,s,t,e)}function Mr(s){return(s%360+360)%360}function gd(s){let t=ld.exec(s),e=255,n;if(!t)return;t[5]!==n&&(e=t[6]?Hs(+t[5]):Ce(+t[5]));let i=Mr(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?n=ud(i,o,r):t[1]==="hsv"?n=fd(i,o,r):n=Ii(i,o,r),{r:n[0],g:n[1],b:n[2],a:e}}function pd(s,t){var e=Oi(s);e[0]=Mr(e[0]+t),e=Ii(e),s.r=e[0],s.g=e[1],s.b=e[2]}function md(s){if(!s)return;let t=Oi(s),e=t[0],n=Sr(t[1]),i=Sr(t[2]);return s.a<255?`hsla(${e}, ${n}%, ${i}%, ${le(s.a)})`:`hsl(${e}, ${n}%, ${i}%)`}function bd(){let s={},t=Object.keys(wr),e=Object.keys(kr),n,i,o,r,a;for(n=0;n>16&255,o>>8&255,o&255]}return s}function vd(s){Dn||(Dn=bd(),Dn.transparent=[0,0,0,0]);let t=Dn[s.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}function xd(s){let t=yd.exec(s),e=255,n,i,o;if(t){if(t[7]!==n){let r=+t[7];e=t[8]?Hs(r):xe(r*255,0,255)}return n=+t[1],i=+t[3],o=+t[5],n=255&(t[2]?Hs(n):xe(n,0,255)),i=255&(t[4]?Hs(i):xe(i,0,255)),o=255&(t[6]?Hs(o):xe(o,0,255)),{r:n,g:i,b:o,a:e}}}function Cd(s){return s&&(s.a<255?`rgba(${s.r}, ${s.g}, ${s.b}, ${le(s.a)})`:`rgb(${s.r}, ${s.g}, ${s.b})`)}function _d(s,t,e){let n=cs(le(s.r)),i=cs(le(s.g)),o=cs(le(s.b));return{r:Ce(Ri(n+e*(cs(le(t.r))-n))),g:Ce(Ri(i+e*(cs(le(t.g))-i))),b:Ce(Ri(o+e*(cs(le(t.b))-o))),a:s.a+e*(t.a-s.a)}}function Mn(s,t,e){if(s){let n=Oi(s);n[t]=Math.max(0,Math.min(n[t]+n[t]*e,t===0?360:1)),n=Ii(n),s.r=n[0],s.g=n[1],s.b=n[2]}}function Tr(s,t){return s&&Object.assign(t||{},s)}function Er(s){var t={r:0,g:0,b:0,a:255};return Array.isArray(s)?s.length>=3&&(t={r:s[0],g:s[1],b:s[2],a:255},s.length>3&&(t.a=Ce(s[3]))):(t=Tr(s,{r:0,g:0,b:0,a:1}),t.a=Ce(t.a)),t}function Sd(s){return s.charAt(0)==="r"?xd(s):gd(s)}var xe,zt,Pi,sd,nd,En,id,rd,ld,kr,wr,Dn,yd,Ri,cs,Ws,Lr=_i(()=>{xe=(s,t,e)=>Math.max(Math.min(s,e),t);zt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Pi=[..."0123456789ABCDEF"],sd=s=>Pi[s&15],nd=s=>Pi[(s&240)>>4]+Pi[s&15],En=s=>(s&240)>>4===(s&15),id=s=>En(s.r)&&En(s.g)&&En(s.b)&&En(s.a);rd=(s,t)=>s<255?t(s):"";ld=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;kr={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},wr={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};yd=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;Ri=s=>s<=.0031308?s*12.92:Math.pow(s,1/2.4)*1.055-.055,cs=s=>s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4);Ws=class s{constructor(t){if(t instanceof s)return t;let e=typeof t,n;e==="object"?n=Er(t):e==="string"&&(n=od(t)||vd(t)||Sd(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=Tr(this._rgb);return t&&(t.a=le(t.a)),t}set rgb(t){this._rgb=Er(t)}rgbString(){return this._valid?Cd(this._rgb):void 0}hexString(){return this._valid?ad(this._rgb):void 0}hslString(){return this._valid?md(this._rgb):void 0}mix(t,e){if(t){let n=this.rgb,i=t.rgb,o,r=e===o?.5:e,a=2*r-1,l=n.a-i.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,n.r=255&c*n.r+o*i.r+.5,n.g=255&c*n.g+o*i.g+.5,n.b=255&c*n.b+o*i.b+.5,n.a=r*n.a+(1-r)*i.a,this.rgb=n}return this}interpolate(t,e){return t&&(this._rgb=_d(this._rgb,t._rgb,e)),this}clone(){return new s(this.rgb)}alpha(t){return this._rgb.a=Ce(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=js(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){let e=this._rgb;return e.a*=1+t,this}negate(){let t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Mn(this._rgb,2,t),this}darken(t){return Mn(this._rgb,2,-t),this}saturate(t){return Mn(this._rgb,1,t),this}desaturate(t){return Mn(this._rgb,1,-t),this}rotate(t){return pd(this._rgb,t),this}}});function te(){}function et(s){return s==null}function dt(s){if(Array.isArray&&Array.isArray(s))return!0;let t=Object.prototype.toString.call(s);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function st(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}function gt(s){return(typeof s=="number"||s instanceof Number)&&isFinite(+s)}function Lt(s,t){return gt(s)?s:t}function J(s,t){return typeof s=="undefined"?t:s}function ct(s,t,e){if(s&&typeof s.call=="function")return s.apply(e,t)}function lt(s,t,e,n){let i,o,r;if(dt(s))if(o=s.length,n)for(i=o-1;i>=0;i--)t.call(e,s[i],i);else for(i=0;i{for(let n of t){if(n==="")break;e=e&&e[n]}return e}}function he(s,t){return(Ar[t]||(Ar[t]=Dd(t)))(s)}function In(s){return s.charAt(0).toUpperCase()+s.slice(1)}function jr(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}function ps(s,t,e){return Math.abs(s-t)i-o).pop(),t}function Ld(s){return typeof s=="symbol"||typeof s=="object"&&s!==null&&!(Symbol.toPrimitive in s||"toString"in s||"valueOf"in s)}function $e(s){return!Ld(s)&&!isNaN(parseFloat(s))&&isFinite(s)}function Yr(s,t){let e=Math.round(s);return e-t<=s&&e+t>=s}function Wi(s,t,e){let n,i,o;for(n=0,i=s.length;nl&&c=Math.min(t,e)-n&&s<=Math.max(t,e)+n}function Nn(s,t,e){e=e||(r=>s[r]1;)o=i+n>>1,e(o)?i=o:n=o;return{lo:i,hi:n}}function qr(s,t,e){let n=0,i=s.length;for(;nn&&s[i-1]>e;)i--;return n>0||i{let n="_onData"+In(e),i=s[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,value(...o){let r=i.apply(this,o);return s._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...o)}),r}})})}function Yi(s,t){let e=s._chartjs;if(!e)return;let n=e.listeners,i=n.indexOf(t);i!==-1&&n.splice(i,1),!(n.length>0)&&(Xr.forEach(o=>{delete s[o]}),delete s._chartjs)}function Gi(s){let t=new Set(s);return t.size===s.length?s:Array.from(t)}function qi(s,t){let e=[],n=!1;return function(...i){e=i,n||(n=!0,Ki.call(window,()=>{n=!1,s.apply(t,e)}))}}function Zr(s,t){let e;return function(...n){return t?(clearTimeout(e),e=setTimeout(s,t,n)):s.apply(this,n),t}}function Xi(s,t,e){let n=t.length,i=0,o=n;if(s._sorted){let{iScale:r,vScale:a,_parsed:l}=s,c=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null,d=r.axis,{min:h,max:u,minDefined:f,maxDefined:g}=r.getUserBounds();if(f){if(i=Math.min(Zt(l,d,h).lo,e?n:Zt(t,d,r.getPixelForValue(h)).lo),c){let p=l.slice(0,i+1).reverse().findIndex(b=>!et(b[a.axis]));i-=Math.max(0,p)}i=vt(i,0,n-1)}if(g){let p=Math.max(Zt(l,r.axis,u,!0).hi+1,e?0:Zt(t,d,r.getPixelForValue(u),!0).hi+1);if(c){let b=l.slice(p-1).findIndex(m=>!et(m[a.axis]));p+=Math.max(0,b)}o=vt(p,i,n)-i}else o=n-i}return{start:i,count:o}}function Qi(s){let{xScale:t,yScale:e,_scaleRanges:n}=s,i={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!n)return s._scaleRanges=i,!0;let o=n.xmin!==t.min||n.xmax!==t.max||n.ymin!==e.min||n.ymax!==e.max;return Object.assign(n,i),o}function Zi(s){if(s&&typeof s=="object"){let t=s.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Ji(s){return Zi(s)?s:new Ws(s)}function Vi(s){return Zi(s)?s:new Ws(s).saturate(.5).darken(.1).hexString()}function Od(s){s.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),s.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),s.set("animations",{colors:{type:"color",properties:Pd},numbers:{type:"number",properties:Rd}}),s.describe("animations",{_fallback:"animation"}),s.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Fd(s){s.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}function Id(s,t){t=t||{};let e=s+JSON.stringify(t),n=Fr.get(e);return n||(n=new Intl.NumberFormat(s,t),Fr.set(e,n)),n}function bs(s,t,e){return Id(t,e).format(s)}function Vd(s,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&s!==Math.floor(s)&&(e=s-Math.floor(s)),e}function Nd(s){s.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:vs.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),s.route("scale.ticks","color","","color"),s.route("scale.grid","color","","borderColor"),s.route("scale.border","color","","borderColor"),s.route("scale.title","color","","color"),s.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),s.describe("scales",{_fallback:"scale"}),s.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}function Us(s,t){if(!t)return s;let e=t.split(".");for(let n=0,i=e.length;nn&&(n=o),n}function ea(s,t,e,n){n=n||{};let i=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==t&&(i=n.data={},o=n.garbageCollect=[],n.font=t),s.save(),s.font=t;let r=0,a=e.length,l,c,d,h,u;for(l=0;le.length){for(l=0;l0&&s.stroke()}}function Jt(s,t,e){return e=e||.5,!t||s&&s.x>t.left-e&&s.xt.top-e&&s.y0&&o.strokeColor!=="",l,c;for(s.save(),s.font=i.string,$d(s,o),l=0;lJ(s[r],s[t[r]]):r=>s[r]:()=>s;for(let r of i)e[r]=Yd(o(r));return e}function so(s){return Hn(s,{top:"y",right:"x",bottom:"y",left:"x"})}function De(s){return Hn(s,["topLeft","topRight","bottomLeft","bottomRight"])}function St(s){let t=so(s);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function bt(s,t){s=s||{},t=t||ut.font;let e=J(s.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let n=J(s.style,t.style);n&&!(""+n).match(jd)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);let i={family:J(s.family,t.family),lineHeight:Ud(J(s.lineHeight,t.lineHeight),e),size:e,style:n,weight:J(s.weight,t.weight),string:""};return i.string=Bd(i),i}function xs(s,t,e,n){let i=!0,o,r,a;for(o=0,r=s.length;oe&&a===0?0:a+l;return{min:r(n,-Math.abs(o)),max:r(i,o)}}function ue(s,t){return Object.assign(Object.create(s),t)}function Wn(s,t=[""],e,n,i=()=>s[0]){let o=e||s;typeof n=="undefined"&&(n=aa("_fallback",s));let r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:s,_rootScopes:o,_fallback:n,_getTarget:i,override:a=>Wn([a,...s],t,o,n)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete s[0][l],!0},get(a,l){return oa(a,l,()=>th(l,t,s,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(s[0])},has(a,l){return Vr(a).includes(l)},ownKeys(a){return Vr(a)},set(a,l,c){let d=a._storage||(a._storage=i());return a[l]=d[l]=c,delete a._keys,!0}})}function Be(s,t,e,n){let i={_cacheable:!1,_proxy:s,_context:t,_subProxy:e,_stack:new Set,_descriptors:no(s,n),setContext:o=>Be(s,o,e,n),override:o=>Be(s.override(o),t,e,n)};return new Proxy(i,{deleteProperty(o,r){return delete o[r],delete s[r],!0},get(o,r,a){return oa(o,r,()=>Kd(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(s,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(s,r)},getPrototypeOf(){return Reflect.getPrototypeOf(s)},has(o,r){return Reflect.has(s,r)},ownKeys(){return Reflect.ownKeys(s)},set(o,r,a){return s[r]=a,delete o[r],!0}})}function no(s,t={scriptable:!0,indexable:!0}){let{_scriptable:e=t.scriptable,_indexable:n=t.indexable,_allKeys:i=t.allKeys}=s;return{allKeys:i,scriptable:e,indexable:n,isScriptable:ce(e)?e:()=>e,isIndexable:ce(n)?n:()=>n}}function oa(s,t,e){if(Object.prototype.hasOwnProperty.call(s,t)||t==="constructor")return s[t];let n=e();return s[t]=n,n}function Kd(s,t,e){let{_proxy:n,_context:i,_subProxy:o,_descriptors:r}=s,a=n[t];return ce(a)&&r.isScriptable(t)&&(a=qd(t,a,s,e)),dt(a)&&a.length&&(a=Xd(t,a,s,r.isIndexable)),io(t,a)&&(a=Be(a,i,o&&o[t],r)),a}function qd(s,t,e,n){let{_proxy:i,_context:o,_subProxy:r,_stack:a}=e;if(a.has(s))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+s);a.add(s);let l=t(o,r||n);return a.delete(s),io(s,l)&&(l=oo(i._scopes,i,s,l)),l}function Xd(s,t,e,n){let{_proxy:i,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index!="undefined"&&n(s))return t[o.index%t.length];if(st(t[0])){let l=t,c=i._scopes.filter(d=>d!==l);t=[];for(let d of l){let h=oo(c,i,s,d);t.push(Be(h,o,r&&r[s],a))}}return t}function ra(s,t,e){return ce(s)?s(t,e):s}function Zd(s,t,e,n,i){for(let o of t){let r=Qd(e,o);if(r){s.add(r);let a=ra(r._fallback,e,i);if(typeof a!="undefined"&&a!==e&&a!==n)return a}else if(r===!1&&typeof n!="undefined"&&e!==n)return null}return!1}function oo(s,t,e,n){let i=t._rootScopes,o=ra(t._fallback,e,n),r=[...s,...i],a=new Set;a.add(n);let l=Ir(a,r,e,o||e,n);return l===null||typeof o!="undefined"&&o!==e&&(l=Ir(a,r,o,l,n),l===null)?!1:Wn(Array.from(a),[""],i,o,()=>Jd(t,e,n))}function Ir(s,t,e,n,i){for(;e;)e=Zd(s,t,e,n,i);return e}function Jd(s,t,e){let n=s._getTarget();t in n||(n[t]={});let i=n[t];return dt(i)&&st(e)?e:i||{}}function th(s,t,e,n){let i;for(let o of t)if(i=aa(Gd(o,s),e),typeof i!="undefined")return io(s,i)?oo(e,n,s,i):i}function aa(s,t){for(let e of t){if(!e)continue;let n=e[s];if(typeof n!="undefined")return n}}function Vr(s){let t=s._keys;return t||(t=s._keys=eh(s._scopes)),t}function eh(s){let t=new Set;for(let e of s)for(let n of Object.keys(e).filter(i=>!i.startsWith("_")))t.add(n);return Array.from(t)}function ro(s,t,e,n){let{iScale:i}=s,{key:o="r"}=this._parsing,r=new Array(n),a,l,c,d;for(a=0,l=n;a!c.skip)),t.cubicInterpolationMode==="monotone")rh(s,i);else{let c=n?s[s.length-1]:s[0];for(o=0,r=s.length;ol.height&&(d=l.height,c=Se(Math.floor(d*n))),{width:c,height:d}}function ao(s,t,e){let n=t||1,i=Se(s.height*n),o=Se(s.width*n);s.height=Se(s.height),s.width=Se(s.width);let r=s.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${s.height}px`,r.style.width=`${s.width}px`),s.currentDevicePixelRatio!==n||r.height!==i||r.width!==o?(s.currentDevicePixelRatio=n,r.height=i,r.width=o,s.ctx.setTransform(n,0,0,n,0,0),!0):!1}function lo(s,t){let e=lh(s,t),n=e&&e.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function _e(s,t,e,n){return{x:s.x+e*(t.x-s.x),y:s.y+e*(t.y-s.y)}}function ua(s,t,e,n){return{x:s.x+e*(t.x-s.x),y:n==="middle"?e<.5?s.y:t.y:n==="after"?e<1?s.y:t.y:e>0?t.y:s.y}}function fa(s,t,e,n){let i={x:s.cp2x,y:s.cp2y},o={x:t.cp1x,y:t.cp1y},r=_e(s,i,e),a=_e(i,o,e),l=_e(o,t,e),c=_e(r,a,e),d=_e(a,l,e);return _e(c,d,e)}function ze(s,t,e){return s?fh(t,e):gh()}function co(s,t){let e,n;(t==="ltr"||t==="rtl")&&(e=s.canvas.style,n=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),s.prevTextDirection=n)}function ho(s,t){t!==void 0&&(delete s.prevTextDirection,s.canvas.style.setProperty("direction",t[0],t[1]))}function ga(s){return s==="angle"?{between:ms,compare:Ad,normalize:Ct}:{between:ee,compare:(t,e)=>t-e,normalize:t=>t}}function Nr({start:s,end:t,count:e,loop:n,style:i}){return{start:s%e,end:t%e,loop:n&&(t-s+1)%e===0,style:i}}function ph(s,t,e){let{property:n,start:i,end:o}=e,{between:r,normalize:a}=ga(n),l=t.length,{start:c,end:d,loop:h}=s,u,f;if(h){for(c+=l,d+=l,u=0,f=l;ul(i,_,m)&&a(i,_)!==0,S=()=>a(o,m)===0||l(o,_,m),x=()=>p||k(),y=()=>!p||S();for(let C=d,E=d;C<=h;++C)v=t[C%r],!v.skip&&(m=c(v[n]),m!==_&&(p=l(m,i,o),b===null&&x()&&(b=a(m,i)===0?C:E),b!==null&&y()&&(g.push(Nr({start:b,end:C,loop:u,count:r,style:f})),b=null),E=C,_=m));return b!==null&&g.push(Nr({start:b,end:h,loop:u,count:r,style:f})),g}function fo(s,t){let e=[],n=s.segments;for(let i=0;ii&&s[o%t].skip;)o--;return o%=t,{start:i,end:o}}function bh(s,t,e,n){let i=s.length,o=[],r=t,a=s[t],l;for(l=t+1;l<=e;++l){let c=s[l%i];c.skip||c.stop?a.skip||(n=!1,o.push({start:t%i,end:(l-1)%i,loop:n}),t=r=c.stop?l:null):(r=l,a.skip&&(t=l)),a=c}return r!==null&&o.push({start:t%i,end:r%i,loop:n}),o}function pa(s,t){let e=s.points,n=s.options.spanGaps,i=e.length;if(!i)return[];let o=!!s._loop,{start:r,end:a}=mh(e,i,o,n);if(n===!0)return Br(s,[{start:r,end:a,loop:o}],e,t);let l=a{Lr();zr=(()=>{let s=0;return()=>s++})();Hr=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100:+s/t,$i=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*t:+s;Ar={"":s=>s,x:s=>s.x,y:s=>s.y};gs=s=>typeof s!="undefined",ce=s=>typeof s=="function",zi=(s,t)=>{if(s.size!==t.size)return!1;for(let e of s)if(!t.has(e))return!1;return!0};it=Math.PI,ht=2*it,Md=ht+it,Pn=Number.POSITIVE_INFINITY,Td=it/180,mt=it/2,Ve=it/4,Rr=it*2/3,de=Math.log10,Ut=Math.sign;Zt=(s,t,e,n)=>Nn(s,e,n?i=>{let o=s[i][t];return os[i][t]Nn(s,e,n=>s[n][t]>=e);Xr=["push","pop","shift","splice","unshift"];Ki=function(){return typeof window=="undefined"?function(s){return s()}:window.requestAnimationFrame}();Bn=s=>s==="start"?"left":s==="end"?"right":"center",_t=(s,t,e)=>s==="start"?t:s==="end"?e:(t+e)/2,Jr=(s,t,e,n)=>s===(n?"left":"right")?e:s==="center"?(t+e)/2:t;Tn=s=>s===0||s===1,Pr=(s,t,e)=>-(Math.pow(2,10*(s-=1))*Math.sin((s-t)*ht/e)),Or=(s,t,e)=>Math.pow(2,-10*s)*Math.sin((s-t)*ht/e)+1,ds={linear:s=>s,easeInQuad:s=>s*s,easeOutQuad:s=>-s*(s-2),easeInOutQuad:s=>(s/=.5)<1?.5*s*s:-.5*(--s*(s-2)-1),easeInCubic:s=>s*s*s,easeOutCubic:s=>(s-=1)*s*s+1,easeInOutCubic:s=>(s/=.5)<1?.5*s*s*s:.5*((s-=2)*s*s+2),easeInQuart:s=>s*s*s*s,easeOutQuart:s=>-((s-=1)*s*s*s-1),easeInOutQuart:s=>(s/=.5)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2),easeInQuint:s=>s*s*s*s*s,easeOutQuint:s=>(s-=1)*s*s*s*s+1,easeInOutQuint:s=>(s/=.5)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2),easeInSine:s=>-Math.cos(s*mt)+1,easeOutSine:s=>Math.sin(s*mt),easeInOutSine:s=>-.5*(Math.cos(it*s)-1),easeInExpo:s=>s===0?0:Math.pow(2,10*(s-1)),easeOutExpo:s=>s===1?1:-Math.pow(2,-10*s)+1,easeInOutExpo:s=>Tn(s)?s:s<.5?.5*Math.pow(2,10*(s*2-1)):.5*(-Math.pow(2,-10*(s*2-1))+2),easeInCirc:s=>s>=1?s:-(Math.sqrt(1-s*s)-1),easeOutCirc:s=>Math.sqrt(1-(s-=1)*s),easeInOutCirc:s=>(s/=.5)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1),easeInElastic:s=>Tn(s)?s:Pr(s,.075,.3),easeOutElastic:s=>Tn(s)?s:Or(s,.075,.3),easeInOutElastic(s){return Tn(s)?s:s<.5?.5*Pr(s*2,.1125,.45):.5+.5*Or(s*2-1,.1125,.45)},easeInBack(s){return s*s*((1.70158+1)*s-1.70158)},easeOutBack(s){return(s-=1)*s*((1.70158+1)*s+1.70158)+1},easeInOutBack(s){let t=1.70158;return(s/=.5)<1?.5*(s*s*(((t*=1.525)+1)*s-t)):.5*((s-=2)*s*(((t*=1.525)+1)*s+t)+2)},easeInBounce:s=>1-ds.easeOutBounce(1-s),easeOutBounce(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},easeInOutBounce:s=>s<.5?ds.easeInBounce(s*2)*.5:ds.easeOutBounce(s*2-1)*.5+.5};Rd=["x","y","borderWidth","radius","tension"],Pd=["color","borderColor","backgroundColor"];Fr=new Map;ta={values(s){return dt(s)?s:""+s},numeric(s,t,e){if(s===0)return"0";let n=this.chart.options.locale,i,o=s;if(e.length>1){let c=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(c<1e-4||c>1e15)&&(i="scientific"),o=Vd(s,e)}let r=de(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:i,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),bs(s,n,l)},logarithmic(s,t,e){if(s===0)return"0";let n=e[t].significand||s/Math.pow(10,Math.floor(de(s)));return[1,2,3,5,10,15].includes(n)||t>.8*e.length?ta.numeric.call(this,s,t,e):""}};vs={formatters:ta};ke=Object.create(null),$n=Object.create(null);Bi=class{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=n=>n.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(n,i)=>Vi(i.backgroundColor),this.hoverBorderColor=(n,i)=>Vi(i.borderColor),this.hoverColor=(n,i)=>Vi(i.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Ni(this,t,e)}get(t){return Us(this,t)}describe(t,e){return Ni($n,t,e)}override(t,e){return Ni(ke,t,e)}route(t,e,n,i){let o=Us(this,t),r=Us(this,n),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){let l=this[a],c=r[i];return st(l)?Object.assign({},c,l):J(l,c)},set(l){this[a]=l}}})}apply(t){t.forEach(e=>e(this))}},ut=new Bi({_scriptable:s=>!s.startsWith("on"),_indexable:s=>s!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Od,Fd,Nd]);Wd=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,jd=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;Yd=s=>+s||0;Gd=(s,t)=>s?s+In(t):t,io=(s,t)=>st(t)&&s!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);Qd=(s,t)=>s===!0?t:typeof s=="string"?he(t,s):void 0;sh=Number.EPSILON||1e-14,us=(s,t)=>ts==="x"?"y":"x";Yn=s=>s.ownerDocument.defaultView.getComputedStyle(s,null);ch=["top","right","bottom","left"];dh=(s,t,e)=>(s>0||t>0)&&(!e||!e.shadowRoot);Se=s=>Math.round(s*10)/10;ha=function(){let s=!1;try{let t={get passive(){return s=!0,!1}};jn()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch(t){}return s}();fh=function(s,t){return{x(e){return s+s+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,n){return e-n},leftForLtr(e,n){return e-n}}},gh=function(){return{x(s){return s},setWidth(s){},textAlign(s){return s},xPlus(s,t){return s+t},leftForLtr(s,t){return s}}}});var Xl={};Xo(Xl,{Animation:()=>ei,Animations:()=>on,ArcElement:()=>Te,BarController:()=>je,BarElement:()=>Xe,BasePlatform:()=>rn,BasicPlatform:()=>si,BubbleController:()=>Ue,CategoryScale:()=>ks,Chart:()=>ie,Colors:()=>Il,DatasetController:()=>Rt,Decimation:()=>Nl,DomPlatform:()=>ii,DoughnutController:()=>oe,Element:()=>Ot,Filler:()=>$l,Interaction:()=>xl,Legend:()=>Hl,LineController:()=>Ye,LineElement:()=>Gt,LinearScale:()=>ws,LogarithmicScale:()=>Es,PieController:()=>_s,PointElement:()=>qe,PolarAreaController:()=>Ae,RadarController:()=>Ge,RadialLinearScale:()=>Le,Scale:()=>Oe,ScatterController:()=>Ke,SubTitle:()=>jl,Ticks:()=>vs,TimeScale:()=>Pe,TimeSeriesScale:()=>Ds,Title:()=>Wl,Tooltip:()=>Yl,_adapters:()=>yl,_detectPlatform:()=>wl,animator:()=>ne,controllers:()=>vl,defaults:()=>ut,elements:()=>Pl,layouts:()=>kt,plugins:()=>Gl,registerables:()=>Cg,registry:()=>Yt,scales:()=>ql});function _h(s,t){let e=[],n=Object.keys(t);for(let i=0;i0||!e&&o<0)return i.index}return null}function Ca(s,t){let{chart:e,_cachedMeta:n}=s,i=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=n,l=o.axis,c=r.axis,d=Dh(o,r,n),h=t.length,u;for(let f=0;fe[n].axis===t).shift()}function Lh(s,t){return ue(s,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Ah(s,t,e){return ue(s,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function Xs(s,t){let e=s.controller.index,n=s.vScale&&s.vScale.axis;if(n){t=t||s._parsed;for(let i of t){let o=i._stacks;if(!o||o[n]===void 0||o[n][e]===void 0)return;delete o[n][e],o[n]._visualValues!==void 0&&o[n]._visualValues[e]!==void 0&&delete o[n]._visualValues[e]}}}function Ph(s,t){if(!s._cache.$bar){let e=s.getMatchingVisibleMetas(t),n=[];for(let i=0,o=e.length;ii-o))}return s._cache.$bar}function Oh(s){let t=s.iScale,e=Ph(t,s.type),n=t._length,i,o,r,a,l=()=>{r===32767||r===-32768||(gs(a)&&(n=Math.min(n,Math.abs(r-a)||n)),a=r)};for(i=0,o=e.length;i0?i[s-1]:null,a=sMath.abs(a)&&(l=a,c=r),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:i,end:o,min:r,max:a}}function bl(s,t,e,n){return dt(s)?Vh(s,t,e,n):t[e.axis]=e.parse(s,n),t}function Sa(s,t,e,n){let i=s.iScale,o=s.vScale,r=i.getLabels(),a=i===o,l=[],c,d,h,u;for(c=e,d=e+n;c=e?1:-1)}function Bh(s){let t,e,n,i,o;return s.horizontal?(t=s.base>s.x,e="left",n="right"):(t=s.basems(_,a,l,!0)?1:Math.max(k,k*e,S,S*e),g=(_,k,S)=>ms(_,a,l,!0)?-1:Math.min(k,k*e,S,S*e),p=f(0,c,h),b=f(mt,d,u),m=g(it,c,h),v=g(it+mt,d,u);n=(p-m)/2,i=(b-v)/2,o=-(p+m)/2,r=-(b+v)/2}return{ratioX:n,ratioY:i,offsetX:o,offsetY:r}}function He(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}function jh(s,t,e,n){let{controller:i,data:o,_sorted:r}=s,a=i._cachedMeta.iScale,l=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){let c=a._reversePixels?Kr:Zt;if(n){if(i._sharedOptions){let d=o[0],h=typeof d.getRange=="function"&&d.getRange(t);if(h){let u=c(o,t,e-h),f=c(o,t,e+h);return{lo:u.lo,hi:f.hi}}}}else{let d=c(o,t,e);if(l){let{vScale:h}=i._cachedMeta,{_parsed:u}=s,f=u.slice(0,d.lo+1).reverse().findIndex(p=>!et(p[h.axis]));d.lo-=Math.max(0,f);let g=u.slice(d.hi).findIndex(p=>!et(p[h.axis]));d.hi+=Math.max(0,g)}return d}}return{lo:0,hi:o.length-1}}function dn(s,t,e,n,i){let o=s.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,l=o.length;a{l[r]&&l[r](t[e],i)&&(o.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(t.x,t.y,i))}),n&&!a?[]:o}function Qs(s,t){return s.filter(e=>e.pos===t)}function Da(s,t){return s.filter(e=>Cl.indexOf(e.pos)===-1&&e.box.axis===t)}function Zs(s,t){return s.sort((e,n)=>{let i=t?n:e,o=t?e:n;return i.weight===o.weight?i.index-o.index:i.weight-o.weight})}function Kh(s){let t=[],e,n,i,o,r,a;for(e=0,n=(s||[]).length;ec.box.fullSize),!0),n=Zs(Qs(t,"left"),!0),i=Zs(Qs(t,"right")),o=Zs(Qs(t,"top"),!0),r=Zs(Qs(t,"bottom")),a=Da(t,"x"),l=Da(t,"y");return{fullSize:e,leftAndTop:n.concat(o),rightAndBottom:i.concat(l).concat(r).concat(a),chartArea:Qs(t,"chartArea"),vertical:n.concat(i).concat(l),horizontal:o.concat(r).concat(a)}}function Ma(s,t,e,n){return Math.max(s[e],t[e])+Math.max(s[n],t[n])}function _l(s,t){s.top=Math.max(s.top,t.top),s.left=Math.max(s.left,t.left),s.bottom=Math.max(s.bottom,t.bottom),s.right=Math.max(s.right,t.right)}function Zh(s,t,e,n){let{pos:i,box:o}=e,r=s.maxPadding;if(!st(i)){e.size&&(s[i]-=e.size);let h=n[e.stack]||{size:0,count:1};h.size=Math.max(h.size,e.horizontal?o.height:o.width),e.size=h.size/h.count,s[i]+=e.size}o.getPadding&&_l(r,o.getPadding());let a=Math.max(0,t.outerWidth-Ma(r,s,"left","right")),l=Math.max(0,t.outerHeight-Ma(r,s,"top","bottom")),c=a!==s.w,d=l!==s.h;return s.w=a,s.h=l,e.horizontal?{same:c,other:d}:{same:d,other:c}}function Jh(s){let t=s.maxPadding;function e(n){let i=Math.max(t[n]-s[n],0);return s[n]+=i,i}s.y+=e("top"),s.x+=e("left"),e("right"),e("bottom")}function tu(s,t){let e=t.maxPadding;function n(i){let o={left:0,top:0,right:0,bottom:0};return i.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return n(s?["left","right"]:["top","bottom"])}function en(s,t,e,n){let i=[],o,r,a,l,c,d;for(o=0,r=s.length,c=0;o{let r=!1;for(let a of o)r=r||ni(a.addedNodes,n),r=r&&!ni(a.removedNodes,n);r&&e()});return i.observe(document,{childList:!0,subtree:!0}),i}function au(s,t,e){let n=s.canvas,i=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||ni(a.removedNodes,n),r=r&&!ni(a.addedNodes,n);r&&e()});return i.observe(document,{childList:!0,subtree:!0}),i}function kl(){let s=window.devicePixelRatio;s!==Aa&&(Aa=s,an.forEach((t,e)=>{e.currentDevicePixelRatio!==s&&t()}))}function lu(s,t){an.size||window.addEventListener("resize",kl),an.set(s,t)}function cu(s){an.delete(s),an.size||window.removeEventListener("resize",kl)}function du(s,t,e){let n=s.canvas,i=n&&Un(n);if(!i)return;let o=qi((a,l)=>{let c=i.clientWidth;e(a,l),c{let l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return r.observe(i),lu(s,o),r}function Co(s,t,e){e&&e.disconnect(),t==="resize"&&cu(s)}function hu(s,t,e){let n=s.canvas,i=qi(o=>{s.ctx!==null&&e(ou(o,s))},s);return nu(n,t,i),i}function wl(s){return!jn()||typeof OffscreenCanvas!="undefined"&&s instanceof OffscreenCanvas?si:ii}function uu(s,t){let e=s.options.ticks,n=fu(s),i=Math.min(e.maxTicksLimit||n,n),o=e.major.enabled?pu(t):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>i)return mu(t,c,o,r/i),c;let d=gu(o,t,i);if(r>0){let h,u,f=r>1?Math.round((l-a)/(r-1)):null;for(Kn(t,c,d,et(f)?0:a-f,a),h=0,u=r-1;hi)return l}return Math.max(i,1)}function pu(s){let t=[],e,n;for(e=0,n=s.length;er+a)))return l}function xu(s,t){lt(s,e=>{let n=e.gc,i=n.length/2,o;if(i>t){for(o=0;o{let n=e.split("."),i=n.pop(),o=[s].concat(n).join("."),r=t[e].split("."),a=r.pop(),l=r.join(".");ut.route(o,i,l,a)})}function Du(s){return"id"in s&&"defaults"in s}function Mu(s){let t={},e=[],n=Object.keys(Yt.plugins.items);for(let o=0;o1&&Ia(s[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${s}' axis. Please provide 'axis' or 'position' option.`)}function Va(s,t,e){if(e[t+"AxisID"]===s)return{axis:t}}function Fu(s,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(n=>n.xAxisID===s||n.yAxisID===s);if(e.length)return Va(s,"x",e[0])||Va(s,"y",e[0])}return{}}function Iu(s,t){let e=ke[s.type]||{scales:{}},n=t.scales||{},i=Lo(s.type,t),o=Object.create(null);return Object.keys(n).forEach(r=>{let a=n[r];if(!st(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);let l=Ao(r,a,Fu(r,s),ut.scales[a.type]),c=Pu(l,i),d=e.scales||{};o[r]=fs(Object.create(null),[{axis:l},a,d[l],d[c]])}),s.data.datasets.forEach(r=>{let a=r.type||s.type,l=r.indexAxis||Lo(a,t),d=(ke[a]||{}).scales||{};Object.keys(d).forEach(h=>{let u=Ru(h,l),f=r[u+"AxisID"]||u;o[f]=o[f]||Object.create(null),fs(o[f],[{axis:u},n[f],d[h]])})}),Object.keys(o).forEach(r=>{let a=o[r];fs(a,[ut.scales[a.type],ut.scale])}),o}function El(s){let t=s.options||(s.options={});t.plugins=J(t.plugins,{}),t.scales=Iu(s,t)}function Dl(s){return s=s||{},s.datasets=s.datasets||[],s.labels=s.labels||[],s}function Vu(s){return s=s||{},s.data=Dl(s.data),El(s),s}function qn(s,t){let e=Na.get(s);return e||(e=t(),Na.set(s,e),Ml.add(e)),e}function Ba(s,t,e){let n=s.get(t);n||(n=new Map,s.set(t,n));let i=e.join(),o=n.get(i);return o||(o={resolver:Wn(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},n.set(i,o)),o}function Bu(s,t){let{isScriptable:e,isIndexable:n}=no(s);for(let i of t){let o=e(i),r=n(i),a=(r||o)&&s[i];if(o&&(ce(a)||Nu(a))||r&&dt(a))return!0}return!1}function $a(s,t){return s==="top"||s==="bottom"||zu.indexOf(s)===-1&&t==="x"}function za(s,t){return function(e,n){return e[s]===n[s]?e[t]-n[t]:e[s]-n[s]}}function Ha(s){let t=s.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ct(e&&e.onComplete,[s],t)}function Hu(s){let t=s.chart,e=t.options.animation;ct(e&&e.onProgress,[s],t)}function Tl(s){return jn()&&typeof s=="string"?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}function Wu(s,t,e){let n=Object.keys(s);for(let i of n){let o=+i;if(o>=t){let r=s[i];delete s[i],(e>0||o>t)&&(s[o+e]=r)}}}function ju(s,t,e,n){return!e||s.type==="mouseout"?null:n?t:s}function ja(){return lt(ie.instances,s=>s._plugins.invalidate())}function Uu(s,t,e){let{startAngle:n,x:i,y:o,outerRadius:r,innerRadius:a,options:l}=t,{borderWidth:c,borderJoinStyle:d}=l,h=Math.min(c/r,Ct(n-e));if(s.beginPath(),s.arc(i,o,r-c/2,n+h/2,e-h/2),a>0){let u=Math.min(c/a,Ct(n-e));s.arc(i,o,a+c/2,e-u/2,n+u/2,!0)}else{let u=Math.min(c/2,r*Ct(n-e));if(d==="round")s.arc(i,o,u,e-it/2,n+it/2,!0);else if(d==="bevel"){let f=2*u*u,g=-f*Math.cos(e+it/2)+i,p=-f*Math.sin(e+it/2)+o,b=f*Math.cos(n+it/2)+i,m=f*Math.sin(n+it/2)+o;s.lineTo(g,p),s.lineTo(b,m)}}s.closePath(),s.moveTo(0,0),s.rect(0,0,s.canvas.width,s.canvas.height),s.clip("evenodd")}function Yu(s,t,e){let{startAngle:n,pixelMargin:i,x:o,y:r,outerRadius:a,innerRadius:l}=t,c=i/a;s.beginPath(),s.arc(o,r,a,n-c,e+c),l>i?(c=i/l,s.arc(o,r,l,e+c,n-c,!0)):s.arc(o,r,i,e+mt,n-mt),s.closePath(),s.clip()}function Gu(s){return Hn(s,["outerStart","outerEnd","innerStart","innerEnd"])}function Ku(s,t,e,n){let i=Gu(s.options.borderRadius),o=(e-t)/2,r=Math.min(o,n*t/2),a=l=>{let c=(e-Math.min(o,l))*n/2;return vt(l,0,Math.min(o,c))};return{outerStart:a(i.outerStart),outerEnd:a(i.outerEnd),innerStart:vt(i.innerStart,0,r),innerEnd:vt(i.innerEnd,0,r)}}function Cs(s,t,e,n){return{x:e+s*Math.cos(t),y:n+s*Math.sin(t)}}function oi(s,t,e,n,i,o){let{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=t,h=Math.max(t.outerRadius+n+e-c,0),u=d>0?d+n+e+c:0,f=0,g=i-l;if(n){let V=d>0?d-n:0,P=h>0?h-n:0,T=(V+P)/2,U=T!==0?g*T/(T+n):g;f=(g-U)/2}let p=Math.max(.001,g*h-e/it)/h,b=(g-p)/2,m=l+b+f,v=i-b-f,{outerStart:_,outerEnd:k,innerStart:S,innerEnd:x}=Ku(t,u,h,v-m),y=h-_,C=h-k,E=m+_/y,D=v-k/C,w=u+S,M=u+x,L=m+S/w,O=v-x/M;if(s.beginPath(),o){let V=(E+D)/2;if(s.arc(r,a,h,E,V),s.arc(r,a,h,V,D),k>0){let F=Cs(C,D,r,a);s.arc(F.x,F.y,k,D,v+mt)}let P=Cs(M,v,r,a);if(s.lineTo(P.x,P.y),x>0){let F=Cs(M,O,r,a);s.arc(F.x,F.y,x,v+mt,O+Math.PI)}let T=(v-x/u+(m+S/u))/2;if(s.arc(r,a,u,v-x/u,T,!0),s.arc(r,a,u,T,m+S/u,!0),S>0){let F=Cs(w,L,r,a);s.arc(F.x,F.y,S,L+Math.PI,m-mt)}let U=Cs(y,m,r,a);if(s.lineTo(U.x,U.y),_>0){let F=Cs(y,E,r,a);s.arc(F.x,F.y,_,m-mt,E)}}else{s.moveTo(r,a);let V=Math.cos(E)*h+r,P=Math.sin(E)*h+a;s.lineTo(V,P);let T=Math.cos(D)*h+r,U=Math.sin(D)*h+a;s.lineTo(T,U)}s.closePath()}function qu(s,t,e,n,i){let{fullCircles:o,startAngle:r,circumference:a}=t,l=t.endAngle;if(o){oi(s,t,e,n,l,i);for(let c=0;c=it&&f===0&&d!=="miter"&&Uu(s,t,p),o||(oi(s,t,e,n,p,i),s.stroke())}function Ll(s,t,e=t){s.lineCap=J(e.borderCapStyle,t.borderCapStyle),s.setLineDash(J(e.borderDash,t.borderDash)),s.lineDashOffset=J(e.borderDashOffset,t.borderDashOffset),s.lineJoin=J(e.borderJoinStyle,t.borderJoinStyle),s.lineWidth=J(e.borderWidth,t.borderWidth),s.strokeStyle=J(e.borderColor,t.borderColor)}function Qu(s,t,e){s.lineTo(e.x,e.y)}function Zu(s){return s.stepped?sa:s.tension||s.cubicInterpolationMode==="monotone"?na:Qu}function Al(s,t,e={}){let n=s.length,{start:i=0,end:o=n-1}=e,{start:r,end:a}=t,l=Math.max(i,r),c=Math.min(o,a),d=ia&&o>a;return{count:n,start:l,loop:t.loop,ilen:c(r+(c?a-k:k))%o,_=()=>{p!==b&&(s.lineTo(d,b),s.lineTo(d,p),s.lineTo(d,m))};for(l&&(f=i[v(0)],s.moveTo(f.x,f.y)),u=0;u<=a;++u){if(f=i[v(u)],f.skip)continue;let k=f.x,S=f.y,x=k|0;x===g?(Sb&&(b=S),d=(h*d+k)/++h):(_(),s.lineTo(k,S),g=x,h=0,p=b=S),m=S}_()}function Po(s){let t=s.options,e=t.borderDash&&t.borderDash.length;return!s._decimated&&!s._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?tf:Ju}function ef(s){return s.stepped?ua:s.tension||s.cubicInterpolationMode==="monotone"?fa:_e}function sf(s,t,e,n){let i=t._path;i||(i=t._path=new Path2D,t.path(i,e,n)&&i.closePath()),Ll(s,t.options),s.stroke(i)}function nf(s,t,e,n){let{segments:i,options:o}=t,r=Po(t);for(let a of i)Ll(s,o,a.style),s.beginPath(),r(s,t,a,{start:e,end:e+n-1})&&s.closePath(),s.stroke()}function rf(s,t,e,n){of&&!t.options.segment?sf(s,t,e,n):nf(s,t,e,n)}function Ua(s,t,e,n){let i=s.options,{[e]:o}=s.getProps([e],n);return Math.abs(t-o)Ol(t++)),t}function gf(s,t){return s.backgroundColor=s.data.map(()=>Fl(t++)),t}function pf(s){let t=0;return(e,n)=>{let i=s.getDatasetMeta(n).controller;i instanceof oe?t=ff(e,t):i instanceof Ae?t=gf(e,t):i&&(t=uf(e,t))}}function Ga(s){let t;for(t in s)if(s[t].borderColor||s[t].backgroundColor)return!0;return!1}function mf(s){return s&&(s.borderColor||s.backgroundColor)}function bf(){return ut.borderColor!=="rgba(0,0,0,0.1)"||ut.backgroundColor!=="rgba(0,0,0,0.1)"}function vf(s,t,e,n,i){let o=i.samples||n;if(o>=e)return s.slice(t,t+e);let r=[],a=(e-2)/(o-2),l=0,c=t+e-1,d=t,h,u,f,g,p;for(r[l++]=s[d],h=0;hf&&(f=g,u=s[v],p=v);r[l++]=u,d=p}return r[l++]=s[c],r}function yf(s,t,e,n){let i=0,o=0,r,a,l,c,d,h,u,f,g,p,b=[],m=t+e-1,v=s[t].x,k=s[m].x-v;for(r=t;rp&&(p=c,u=r),i=(o*i+a.x)/++o;else{let x=r-1;if(!et(h)&&!et(u)){let y=Math.min(h,u),C=Math.max(h,u);y!==f&&y!==x&&b.push({...s[y],x:i}),C!==f&&C!==x&&b.push({...s[C],x:i})}r>0&&x!==f&&b.push(s[x]),b.push(a),d=S,o=0,g=p=c,h=u=f=r}}return b}function Vl(s){if(s._decimated){let t=s._data;delete s._decimated,delete s._data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Ka(s){s.data.datasets.forEach(t=>{Vl(t)})}function xf(s,t){let e=t.length,n=0,i,{iScale:o}=s,{min:r,max:a,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(n=vt(Zt(t,o.axis,r).lo,0,e-1)),c?i=vt(Zt(t,o.axis,a).hi+1,n,e)-n:i=e-n,{start:n,count:i}}function Cf(s,t,e){let n=s.segments,i=s.points,o=t.points,r=[];for(let a of n){let{start:l,end:c}=a;c=li(l,c,i);let d=Fo(e,i[l],i[c],a.loop);if(!t.segments){r.push({source:a,target:d,start:i[l],end:i[c]});continue}let h=fo(t,d);for(let u of h){let f=Fo(e,o[u.start],o[u.end],u.loop),g=uo(a,i,f);for(let p of g)r.push({source:p,target:u,start:{[e]:qa(d,f,"start",Math.max)},end:{[e]:qa(d,f,"end",Math.min)}})}}return r}function Fo(s,t,e,n){if(n)return;let i=t[s],o=e[s];return s==="angle"&&(i=Ct(i),o=Ct(o)),{property:s,start:i,end:o}}function _f(s,t){let{x:e=null,y:n=null}=s||{},i=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=li(r,a,i);let l=i[r],c=i[a];n!==null?(o.push({x:l.x,y:n}),o.push({x:c.x,y:n})):e!==null&&(o.push({x:e,y:l.y}),o.push({x:e,y:c.y}))}),o}function li(s,t,e){for(;t>s;t--){let n=e[t];if(!isNaN(n.x)&&!isNaN(n.y))break}return t}function qa(s,t,e,n){return s&&t?n(s[e],t[e]):s?s[e]:t?t[e]:0}function Bl(s,t){let e=[],n=!1;return dt(s)?(n=!0,e=s):e=_f(s,t),e.length?new Gt({points:e,options:{tension:0},_loop:n,_fullLoop:n}):null}function Xa(s){return s&&s.fill!==!1}function Sf(s,t,e){let i=s[t].fill,o=[t],r;if(!e)return i;for(;i!==!1&&o.indexOf(i)===-1;){if(!gt(i))return i;if(r=s[i],!r)return!1;if(r.visible)return i;o.push(i),i=r.fill}return!1}function kf(s,t,e){let n=Mf(s);if(st(n))return isNaN(n.value)?!1:n;let i=parseFloat(n);return gt(i)&&Math.floor(i)===i?wf(n[0],t,i,e):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function wf(s,t,e,n){return(s==="-"||s==="+")&&(e=t+e),e===t||e<0||e>=n?!1:e}function Ef(s,t){let e=null;return s==="start"?e=t.bottom:s==="end"?e=t.top:st(s)?e=t.getPixelForValue(s.value):t.getBasePixel&&(e=t.getBasePixel()),e}function Df(s,t,e){let n;return s==="start"?n=e:s==="end"?n=t.options.reverse?t.min:t.max:st(s)?n=s.value:n=t.getBaseValue(),n}function Mf(s){let t=s.options,e=t.fill,n=J(e&&e.target,e);return n===void 0&&(n=!!t.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function Tf(s){let{scale:t,index:e,line:n}=s,i=[],o=n.segments,r=n.points,a=Lf(t,e);a.push(Bl({x:null,y:t.bottom},n));for(let l=0;lo.length>r.length?o:r)),t+e.size/2+n.measureText(i).width}function Wf(s,t,e){let n=s;return typeof t.text!="string"&&(n=zl(t,e)),n}function zl(s,t){let e=s.text?s.text.length:0;return t*e}function jf(s,t){return!!((s==="mousemove"||s==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(s==="click"||s==="mouseup"))}function Uf(s,t){let e=new ln({ctx:s.ctx,options:t,chart:s});kt.configure(s,e,t),kt.addBox(s,e),s.titleBlock=e}function se(s,t){return t&&(dt(t)?Array.prototype.push.apply(s,t):s.push(t)),s}function fe(s){return(typeof s=="string"||s instanceof String)&&s.indexOf(` +"use strict";var Cl=Object.create;var Ps=Object.defineProperty;var _l=Object.getOwnPropertyDescriptor;var Sl=Object.getOwnPropertyNames;var Ml=Object.getPrototypeOf,kl=Object.prototype.hasOwnProperty;var wl=(s,t,e)=>t in s?Ps(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var xn=(s,t)=>()=>(s&&(t=s(s=0)),t);var El=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),Ko=(s,t)=>{for(var e in t)Ps(s,e,{get:t[e],enumerable:!0})},qo=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Sl(t))!kl.call(s,n)&&n!==e&&Ps(s,n,{get:()=>t[n],enumerable:!(i=_l(t,n))||i.enumerable});return s};var Os=(s,t,e)=>(e=s!=null?Cl(Ml(s)):{},qo(t||!s||!s.__esModule?Ps(e,"default",{value:s,enumerable:!0}):e,s)),Dl=s=>qo(Ps({},"__esModule",{value:!0}),s);var U=(s,t,e)=>(wl(s,typeof t!="symbol"?t+"":t,e),e);var ts=El((Cn,_n)=>{((s,t)=>{typeof define=="function"&&define.amd?define([],t):typeof _n=="object"&&typeof Cn!="undefined"?_n.exports=t():s.Papa=t()})(Cn,function s(){var t=typeof self!="undefined"?self:typeof window!="undefined"?window:t!==void 0?t:{},e,i=!t.document&&!!t.postMessage,n=t.IS_PAPA_WORKER||!1,o={},r=0,a={};function L(v){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(y){var x=_(y);x.chunkSize=parseInt(x.chunkSize),y.step||y.chunk||(x.chunkSize=null),this._handle=new u(x),(this._handle.streamer=this)._config=x}.call(this,v),this.parseChunk=function(y,x){var w=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview),n)t.postMessage({results:k,workerId:a.WORKER_ID,finished:w});else if(C(this._config.chunk)&&!x){if(this._config.chunk(k,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=k=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(k.data),this._completeResults.errors=this._completeResults.errors.concat(k.errors),this._completeResults.meta=k.meta),this._completed||!w||!C(this._config.complete)||k&&k.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),w||k&&k.meta.paused||this._nextChunk(),k}this._halted=!0},this._sendError=function(y){C(this._config.error)?this._config.error(y):n&&this._config.error&&t.postMessage({workerId:a.WORKER_ID,error:y,finished:!1})}}function l(v){var y;(v=v||{}).chunkSize||(v.chunkSize=a.RemoteChunkSize),L.call(this,v),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(x){this._input=x,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(y=new XMLHttpRequest,this._config.withCredentials&&(y.withCredentials=this._config.withCredentials),i||(y.onload=S(this._chunkLoaded,this),y.onerror=S(this._chunkError,this)),y.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var x,w=this._config.downloadRequestHeaders;for(x in w)y.setRequestHeader(x,w[x])}var k;this._config.chunkSize&&(k=this._start+this._config.chunkSize-1,y.setRequestHeader("Range","bytes="+this._start+"-"+k));try{y.send(this._config.downloadRequestBody)}catch(M){this._chunkError(M.message)}i&&y.status===0&&this._chunkError()}},this._chunkLoaded=function(){y.readyState===4&&(y.status<200||400<=y.status?this._chunkError():(this._start+=this._config.chunkSize||y.responseText.length,this._finished=!this._config.chunkSize||this._start>=(x=>(x=x.getResponseHeader("Content-Range"))!==null?parseInt(x.substring(x.lastIndexOf("/")+1)):-1)(y),this.parseChunk(y.responseText)))},this._chunkError=function(x){x=y.statusText||x,this._sendError(new Error(x))}}function c(v){(v=v||{}).chunkSize||(v.chunkSize=a.LocalChunkSize),L.call(this,v);var y,x,w=typeof FileReader!="undefined";this.stream=function(k){this._input=k,x=k.slice||k.webkitSlice||k.mozSlice,w?((y=new FileReader).onload=S(this._chunkLoaded,this),y.onerror=S(this._chunkError,this)):y=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(k.target.result)},this._chunkError=function(){this._sendError(y.error)}}function d(v){var y;L.call(this,v=v||{}),this.stream=function(x){return y=x,this._nextChunk()},this._nextChunk=function(){var x,w;if(!this._finished)return x=this._config.chunkSize,y=x?(w=y.substring(0,x),y.substring(x)):(w=y,""),this._finished=!y,this.parseChunk(w)}}function h(v){L.call(this,v=v||{});var y=[],x=!0,w=!1;this.pause=function(){L.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){L.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(k){this._input=k,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){w&&y.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),y.length?this.parseChunk(y.shift()):x=!0},this._streamData=S(function(k){try{y.push(typeof k=="string"?k:k.toString(this._config.encoding)),x&&(x=!1,this._checkIsFinished(),this.parseChunk(y.shift()))}catch(M){this._streamError(M)}},this),this._streamError=S(function(k){this._streamCleanUp(),this._sendError(k)},this),this._streamEnd=S(function(){this._streamCleanUp(),w=!0,this._streamData("")},this),this._streamCleanUp=S(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function u(v){var y,x,w,k,M=Math.pow(2,53),T=-M,A=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,B=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,I=this,P=0,E=0,j=!1,F=!1,W=[],N={data:[],errors:[],meta:{}};function G(D){return v.skipEmptyLines==="greedy"?D.join("").trim()==="":D.length===1&&D[0].length===0}function R(){if(N&&w&&(K("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),w=!1),v.skipEmptyLines&&(N.data=N.data.filter(function(z){return!G(z)})),Y()){let z=function(V,Z){C(v.transformHeader)&&(V=v.transformHeader(V,Z)),W.push(V)};var $=z;if(N)if(Array.isArray(N.data[0])){for(var D=0;Y()&&D(lt=>(v.dynamicTypingFunction&&v.dynamicTyping[lt]===void 0&&(v.dynamicTyping[lt]=v.dynamicTypingFunction(lt)),(v.dynamicTyping[lt]||v.dynamicTyping)===!0))(Q)?et==="true"||et==="TRUE"||et!=="false"&&et!=="FALSE"&&((lt=>{if(A.test(lt)&&(lt=parseFloat(lt),T=W.length?"__parsed_extra":W[X]:q,it=v.transform?v.transform(it,q):it);q==="__parsed_extra"?(Z[q]=Z[q]||[],Z[q].push(it)):Z[q]=it}return v.header&&(X>W.length?K("FieldMismatch","TooManyFields","Too many fields: expected "+W.length+" fields but parsed "+X,E+V):Xv.preview?x.abort():(N.data=N.data[0],k(N,I))))}),this.parse=function(D,O,H){var $=v.quoteChar||'"',$=(v.newline||(v.newline=this.guessLineEndings(D,$)),w=!1,v.delimiter?C(v.delimiter)&&(v.delimiter=v.delimiter(D),N.meta.delimiter=v.delimiter):(($=((z,V,Z,X,q)=>{var it,Q,et,lt;q=q||[","," ","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var ot=0;ot=H.length/2?`\r +`:"\r"}}function f(v){return v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function p(v){var y=(v=v||{}).delimiter,x=v.newline,w=v.comments,k=v.step,M=v.preview,T=v.fastMode,A=null,B=!1,I=v.quoteChar==null?'"':v.quoteChar,P=I;if(v.escapeChar!==void 0&&(P=v.escapeChar),(typeof y!="string"||-1=M)return St(!0);break}H.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:O.length,index:E}),Q++}}else if(w&&$.length===0&&F.substring(E,E+K)===w){if(q===-1)return St();E=q+Y,q=F.indexOf(x,E),X=F.indexOf(y,E)}else if(X!==-1&&(X=M)return St(!0)}return Lt();function lt(bt){O.push(bt),z=E}function ot(bt){var Et=0;return Et=bt!==-1&&(bt=F.substring(Q+1,bt))&&bt.trim()===""?bt.length:Et}function Lt(bt){return N||(bt===void 0&&(bt=F.substring(E)),$.push(bt),E=G,lt($),D&&Gt()),St()}function Vt(bt){E=bt,lt($),$=[],q=F.indexOf(x,E)}function St(bt){if(v.header&&!W&&O.length&&!B){var Et=O[0],ae=Object.create(null),yn=new Set(Et);let Yo=!1;for(let Je=0;Jew.charCodeAt(0)!==65279?w:w.slice(1))(v),x=new(y.download?l:d)(y)):v.readable===!0&&C(v.read)&&C(v.on)?x=new h(y):(t.File&&v instanceof File||v instanceof Object)&&(x=new c(y)),x.stream(v);(x=(()=>{var w;return!!a.WORKERS_SUPPORTED&&(w=(()=>{var k=t.URL||t.webkitURL||null,M=s.toString();return a.BLOB_URL||(a.BLOB_URL=k.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",M,")();"],{type:"text/javascript"})))})(),(w=new t.Worker(w)).onmessage=m,w.id=r++,o[w.id]=w)})()).userStep=y.step,x.userChunk=y.chunk,x.userComplete=y.complete,x.userError=y.error,y.step=C(y.step),y.chunk=C(y.chunk),y.complete=C(y.complete),y.error=C(y.error),delete y.worker,x.postMessage({input:v,config:y,workerId:x.id})},a.unparse=function(v,y){var x=!1,w=!0,k=",",M=`\r +`,T='"',A=T+T,B=!1,I=null,P=!1,E=((()=>{if(typeof y=="object"){if(typeof y.delimiter!="string"||a.BAD_DELIMITERS.filter(function(W){return y.delimiter.indexOf(W)!==-1}).length||(k=y.delimiter),typeof y.quotes!="boolean"&&typeof y.quotes!="function"&&!Array.isArray(y.quotes)||(x=y.quotes),typeof y.skipEmptyLines!="boolean"&&typeof y.skipEmptyLines!="string"||(B=y.skipEmptyLines),typeof y.newline=="string"&&(M=y.newline),typeof y.quoteChar=="string"&&(T=y.quoteChar),typeof y.header=="boolean"&&(w=y.header),Array.isArray(y.columns)){if(y.columns.length===0)throw new Error("Option columns is empty");I=y.columns}y.escapeChar!==void 0&&(A=y.escapeChar+T),y.escapeFormulae instanceof RegExp?P=y.escapeFormulae:typeof y.escapeFormulae=="boolean"&&y.escapeFormulae&&(P=/^[=+\-@\t\r].*$/)}})(),new RegExp(f(T),"g"));if(typeof v=="string"&&(v=JSON.parse(v)),Array.isArray(v)){if(!v.length||Array.isArray(v[0]))return j(null,v,B);if(typeof v[0]=="object")return j(I||Object.keys(v[0]),v,B)}else if(typeof v=="object")return typeof v.data=="string"&&(v.data=JSON.parse(v.data)),Array.isArray(v.data)&&(v.fields||(v.fields=v.meta&&v.meta.fields||I),v.fields||(v.fields=Array.isArray(v.data[0])?v.fields:typeof v.data[0]=="object"?Object.keys(v.data[0]):[]),Array.isArray(v.data[0])||typeof v.data[0]=="object"||(v.data=[v.data])),j(v.fields||[],v.data||[],B);throw new Error("Unable to serialize unrecognized input");function j(W,N,G){var R="",Y=(typeof W=="string"&&(W=JSON.parse(W)),typeof N=="string"&&(N=JSON.parse(N)),Array.isArray(W)&&0{for(var D=0;De-i*Math.max(Math.min(r-3,9-r,1),-1);return[n(0),n(8),n(4)]}function lc(s,t,e){let i=(n,o=(n+s/60)%6)=>e-e*t*Math.max(Math.min(o,4-o,1),0);return[i(5),i(3),i(1)]}function cc(s,t,e){let i=kr(s,1,.5),n;for(t+e>1&&(n=1/(t+e),t*=n,e*=n),n=0;n<3;n++)i[n]*=1-t-e,i[n]+=t;return i}function dc(s,t,e,i,n){return s===n?(t-e)/i+(t.5?c/(2-o-r):c/(o+r),L=dc(e,i,n,c,o),L=L*60+.5),[L|0,l||0,a]}function On(s,t,e,i){return(Array.isArray(t)?s(t[0],t[1],t[2]):s(t,e,i)).map(xe)}function Fn(s,t,e){return On(kr,s,t,e)}function hc(s,t,e){return On(cc,s,t,e)}function uc(s,t,e){return On(lc,s,t,e)}function wr(s){return(s%360+360)%360}function fc(s){let t=Lc.exec(s),e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?Hs(+t[5]):xe(+t[5]));let n=wr(+t[2]),o=+t[3]/100,r=+t[4]/100;return t[1]==="hwb"?i=hc(n,o,r):t[1]==="hsv"?i=uc(n,o,r):i=Fn(n,o,r),{r:i[0],g:i[1],b:i[2],a:e}}function pc(s,t){var e=Pn(s);e[0]=wr(e[0]+t),e=Fn(e),s.r=e[0],s.g=e[1],s.b=e[2]}function gc(s){if(!s)return;let t=Pn(s),e=t[0],i=Cr(t[1]),n=Cr(t[2]);return s.a<255?`hsla(${e}, ${i}%, ${n}%, ${Le(s.a)})`:`hsl(${e}, ${i}%, ${n}%)`}function mc(){let s={},t=Object.keys(Sr),e=Object.keys(_r),i,n,o,r,a;for(i=0;i>16&255,o>>8&255,o&255]}return s}function bc(s){Mi||(Mi=mc(),Mi.transparent=[0,0,0,0]);let t=Mi[s.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}function yc(s){let t=vc.exec(s),e=255,i,n,o;if(t){if(t[7]!==i){let r=+t[7];e=t[8]?Hs(r):ye(r*255,0,255)}return i=+t[1],n=+t[3],o=+t[5],i=255&(t[2]?Hs(i):ye(i,0,255)),n=255&(t[4]?Hs(n):ye(n,0,255)),o=255&(t[6]?Hs(o):ye(o,0,255)),{r:i,g:n,b:o,a:e}}}function xc(s){return s&&(s.a<255?`rgba(${s.r}, ${s.g}, ${s.b}, ${Le(s.a)})`:`rgb(${s.r}, ${s.g}, ${s.b})`)}function Cc(s,t,e){let i=ls(Le(s.r)),n=ls(Le(s.g)),o=ls(Le(s.b));return{r:xe(An(i+e*(ls(Le(t.r))-i))),g:xe(An(n+e*(ls(Le(t.g))-n))),b:xe(An(o+e*(ls(Le(t.b))-o))),a:s.a+e*(t.a-s.a)}}function ki(s,t,e){if(s){let i=Pn(s);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=Fn(i),s.r=i[0],s.g=i[1],s.b=i[2]}}function Er(s,t){return s&&Object.assign(t||{},s)}function Mr(s){var t={r:0,g:0,b:0,a:255};return Array.isArray(s)?s.length>=3&&(t={r:s[0],g:s[1],b:s[2],a:255},s.length>3&&(t.a=xe(s[3]))):(t=Er(s,{r:0,g:0,b:0,a:1}),t.a=xe(t.a)),t}function _c(s){return s.charAt(0)==="r"?yc(s):fc(s)}var ye,Ht,Rn,sc,ic,Si,nc,rc,Lc,_r,Sr,Mi,vc,An,ls,Zs,Dr=xn(()=>{ye=(s,t,e)=>Math.max(Math.min(s,e),t);Ht={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Rn=[..."0123456789ABCDEF"],sc=s=>Rn[s&15],ic=s=>Rn[(s&240)>>4]+Rn[s&15],Si=s=>(s&240)>>4===(s&15),nc=s=>Si(s.r)&&Si(s.g)&&Si(s.b)&&Si(s.a);rc=(s,t)=>s<255?t(s):"";Lc=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;_r={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Sr={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};vc=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;An=s=>s<=.0031308?s*12.92:Math.pow(s,1/2.4)*1.055-.055,ls=s=>s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4);Zs=class s{constructor(t){if(t instanceof s)return t;let e=typeof t,i;e==="object"?i=Mr(t):e==="string"&&(i=oc(t)||bc(t)||_c(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Er(this._rgb);return t&&(t.a=Le(t.a)),t}set rgb(t){this._rgb=Mr(t)}rgbString(){return this._valid?xc(this._rgb):void 0}hexString(){return this._valid?ac(this._rgb):void 0}hslString(){return this._valid?gc(this._rgb):void 0}mix(t,e){if(t){let i=this.rgb,n=t.rgb,o,r=e===o?.5:e,a=2*r-1,L=i.a-n.a,l=((a*L===-1?a:(a+L)/(1+a*L))+1)/2;o=1-l,i.r=255&l*i.r+o*n.r+.5,i.g=255&l*i.g+o*n.g+.5,i.b=255&l*i.b+o*n.b+.5,i.a=r*i.a+(1-r)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=Cc(this._rgb,t._rgb,e)),this}clone(){return new s(this.rgb)}alpha(t){return this._rgb.a=xe(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=Ws(t.r*.3+t.g*.59+t.b*.11);return t.r=t.g=t.b=e,this}opaquer(t){let e=this._rgb;return e.a*=1+t,this}negate(){let t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return ki(this._rgb,2,t),this}darken(t){return ki(this._rgb,2,-t),this}saturate(t){return ki(this._rgb,1,t),this}desaturate(t){return ki(this._rgb,1,-t),this}rotate(t){return pc(this._rgb,t),this}}});function te(){}function tt(s){return s==null}function dt(s){if(Array.isArray&&Array.isArray(s))return!0;let t=Object.prototype.toString.call(s);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function st(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}function ft(s){return(typeof s=="number"||s instanceof Number)&&isFinite(+s)}function At(s,t){return ft(s)?s:t}function J(s,t){return typeof s=="undefined"?t:s}function ct(s,t,e){if(s&&typeof s.call=="function")return s.apply(e,t)}function at(s,t,e,i){let n,o,r;if(dt(s))if(o=s.length,i)for(n=o-1;n>=0;n--)t.call(e,s[n],n);else for(n=0;n{for(let i of t){if(i==="")break;e=e&&e[i]}return e}}function de(s,t){return(Tr[t]||(Tr[t]=wc(t)))(s)}function Oi(s){return s.charAt(0).toUpperCase()+s.slice(1)}function Zr(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}function ps(s,t,e){return Math.abs(s-t)n-o).pop(),t}function Tc(s){return typeof s=="symbol"||typeof s=="object"&&s!==null&&!(Symbol.toPrimitive in s||"toString"in s||"valueOf"in s)}function $e(s){return!Tc(s)&&!isNaN(parseFloat(s))&&isFinite(s)}function jr(s,t){let e=Math.round(s);return e-t<=s&&e+t>=s}function Hn(s,t,e){let i,n,o;for(i=0,n=s.length;iL&&l=Math.min(t,e)-i&&s<=Math.max(t,e)+i}function Ii(s,t,e){e=e||(r=>s[r]1;)o=n+i>>1,e(o)?n=o:i=o;return{lo:n,hi:i}}function Gr(s,t,e){let i=0,n=s.length;for(;ii&&s[n-1]>e;)n--;return i>0||n{let i="_onData"+Oi(e),n=s[e];Object.defineProperty(s,e,{configurable:!0,enumerable:!1,value(...o){let r=n.apply(this,o);return s._chartjs.listeners.forEach(a=>{typeof a[i]=="function"&&a[i](...o)}),r}})})}function jn(s,t){let e=s._chartjs;if(!e)return;let i=e.listeners,n=i.indexOf(t);n!==-1&&i.splice(n,1),!(i.length>0)&&(Kr.forEach(o=>{delete s[o]}),delete s._chartjs)}function Un(s){let t=new Set(s);return t.size===s.length?s:Array.from(t)}function Gn(s,t){let e=[],i=!1;return function(...n){e=n,i||(i=!0,Yn.call(window,()=>{i=!1,s.apply(t,e)}))}}function Xr(s,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(s,t,i)):s.apply(this,i),t}}function Kn(s,t,e){let i=t.length,n=0,o=i;if(s._sorted){let{iScale:r,vScale:a,_parsed:L}=s,l=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null,c=r.axis,{min:d,max:h,minDefined:u,maxDefined:f}=r.getUserBounds();if(u){if(n=Math.min(Qt(L,c,d).lo,e?i:Qt(t,c,r.getPixelForValue(d)).lo),l){let p=L.slice(0,n+1).reverse().findIndex(m=>!tt(m[a.axis]));n-=Math.max(0,p)}n=mt(n,0,i-1)}if(f){let p=Math.max(Qt(L,r.axis,h,!0).hi+1,e?0:Qt(t,c,r.getPixelForValue(h),!0).hi+1);if(l){let m=L.slice(p-1).findIndex(g=>!tt(g[a.axis]));p+=Math.max(0,m)}o=mt(p,n,i)-n}else o=i-n}return{start:n,count:o}}function qn(s){let{xScale:t,yScale:e,_scaleRanges:i}=s,n={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return s._scaleRanges=n,!0;let o=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,n),o}function Xn(s){if(s&&typeof s=="object"){let t=s.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Qn(s){return Xn(s)?s:new Zs(s)}function In(s){return Xn(s)?s:new Zs(s).saturate(.5).darken(.1).hexString()}function Oc(s){s.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),s.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>t!=="onProgress"&&t!=="onComplete"&&t!=="fn"}),s.set("animations",{colors:{type:"color",properties:Pc},numbers:{type:"number",properties:Rc}}),s.describe("animations",{_fallback:"animation"}),s.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>t|0}}}})}function Fc(s){s.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}function Ic(s,t){t=t||{};let e=s+JSON.stringify(t),i=Or.get(e);return i||(i=new Intl.NumberFormat(s,t),Or.set(e,i)),i}function ms(s,t,e){return Ic(t,e).format(s)}function Vc(s,t){let e=t.length>3?t[2].value-t[1].value:t[1].value-t[0].value;return Math.abs(e)>=1&&s!==Math.floor(s)&&(e=s-Math.floor(s)),e}function Bc(s){s.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:bs.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),s.route("scale.ticks","color","","color"),s.route("scale.grid","color","","borderColor"),s.route("scale.border","color","","borderColor"),s.route("scale.title","color","","color"),s.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&t!=="callback"&&t!=="parser",_indexable:t=>t!=="borderDash"&&t!=="tickBorderDash"&&t!=="dash"}),s.describe("scales",{_fallback:"scale"}),s.describe("scale.ticks",{_scriptable:t=>t!=="backdropPadding"&&t!=="callback",_indexable:t=>t!=="backdropPadding"})}function js(s,t){if(!t)return s;let e=t.split(".");for(let i=0,n=e.length;ii&&(i=o),i}function ta(s,t,e,i){i=i||{};let n=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==t&&(n=i.data={},o=i.garbageCollect=[],i.font=t),s.save(),s.font=t;let r=0,a=e.length,L,l,c,d,h;for(L=0;Le.length){for(L=0;L0&&s.stroke()}}function Jt(s,t,e){return e=e||.5,!t||s&&s.x>t.left-e&&s.xt.top-e&&s.y0&&o.strokeColor!=="",L,l;for(s.save(),s.font=n.string,$c(s,o),L=0;LJ(s[r],s[t[r]]):r=>s[r]:()=>s;for(let r of n)e[r]=Uc(o(r));return e}function eo(s){return $i(s,{top:"y",right:"x",bottom:"y",left:"x"})}function we(s){return $i(s,["topLeft","topRight","bottomLeft","bottomRight"])}function Ct(s){let t=eo(s);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function gt(s,t){s=s||{},t=t||ut.font;let e=J(s.size,t.size);typeof e=="string"&&(e=parseInt(e,10));let i=J(s.style,t.style);i&&!(""+i).match(Wc)&&(console.warn('Invalid font style specified: "'+i+'"'),i=void 0);let n={family:J(s.family,t.family),lineHeight:jc(J(s.lineHeight,t.lineHeight),e),size:e,style:i,weight:J(s.weight,t.weight),string:""};return n.string=Nc(n),n}function ys(s,t,e,i){let n=!0,o,r,a;for(o=0,r=s.length;oe&&a===0?0:a+L;return{min:r(i,-Math.abs(o)),max:r(n,o)}}function he(s,t){return Object.assign(Object.create(s),t)}function zi(s,t=[""],e,i,n=()=>s[0]){let o=e||s;typeof i=="undefined"&&(i=ra("_fallback",s));let r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:s,_rootScopes:o,_fallback:i,_getTarget:n,override:a=>zi([a,...s],t,o,i)};return new Proxy(r,{deleteProperty(a,L){return delete a[L],delete a._keys,delete s[0][L],!0},get(a,L){return na(a,L,()=>t2(L,t,s,a))},getOwnPropertyDescriptor(a,L){return Reflect.getOwnPropertyDescriptor(a._scopes[0],L)},getPrototypeOf(){return Reflect.getPrototypeOf(s[0])},has(a,L){return Ir(a).includes(L)},ownKeys(a){return Ir(a)},set(a,L,l){let c=a._storage||(a._storage=n());return a[L]=c[L]=l,delete a._keys,!0}})}function Ne(s,t,e,i){let n={_cacheable:!1,_proxy:s,_context:t,_subProxy:e,_stack:new Set,_descriptors:so(s,i),setContext:o=>Ne(s,o,e,i),override:o=>Ne(s.override(o),t,e,i)};return new Proxy(n,{deleteProperty(o,r){return delete o[r],delete s[r],!0},get(o,r,a){return na(o,r,()=>Gc(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(s,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(s,r)},getPrototypeOf(){return Reflect.getPrototypeOf(s)},has(o,r){return Reflect.has(s,r)},ownKeys(){return Reflect.ownKeys(s)},set(o,r,a){return s[r]=a,delete o[r],!0}})}function so(s,t={scriptable:!0,indexable:!0}){let{_scriptable:e=t.scriptable,_indexable:i=t.indexable,_allKeys:n=t.allKeys}=s;return{allKeys:n,scriptable:e,indexable:i,isScriptable:le(e)?e:()=>e,isIndexable:le(i)?i:()=>i}}function na(s,t,e){if(Object.prototype.hasOwnProperty.call(s,t)||t==="constructor")return s[t];let i=e();return s[t]=i,i}function Gc(s,t,e){let{_proxy:i,_context:n,_subProxy:o,_descriptors:r}=s,a=i[t];return le(a)&&r.isScriptable(t)&&(a=Kc(t,a,s,e)),dt(a)&&a.length&&(a=qc(t,a,s,r.isIndexable)),io(t,a)&&(a=Ne(a,n,o&&o[t],r)),a}function Kc(s,t,e,i){let{_proxy:n,_context:o,_subProxy:r,_stack:a}=e;if(a.has(s))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+s);a.add(s);let L=t(o,r||i);return a.delete(s),io(s,L)&&(L=no(n._scopes,n,s,L)),L}function qc(s,t,e,i){let{_proxy:n,_context:o,_subProxy:r,_descriptors:a}=e;if(typeof o.index!="undefined"&&i(s))return t[o.index%t.length];if(st(t[0])){let L=t,l=n._scopes.filter(c=>c!==L);t=[];for(let c of L){let d=no(l,n,s,c);t.push(Ne(d,o,r&&r[s],a))}}return t}function oa(s,t,e){return le(s)?s(t,e):s}function Qc(s,t,e,i,n){for(let o of t){let r=Xc(e,o);if(r){s.add(r);let a=oa(r._fallback,e,n);if(typeof a!="undefined"&&a!==e&&a!==i)return a}else if(r===!1&&typeof i!="undefined"&&e!==i)return null}return!1}function no(s,t,e,i){let n=t._rootScopes,o=oa(t._fallback,e,i),r=[...s,...n],a=new Set;a.add(i);let L=Fr(a,r,e,o||e,i);return L===null||typeof o!="undefined"&&o!==e&&(L=Fr(a,r,o,L,i),L===null)?!1:zi(Array.from(a),[""],n,o,()=>Jc(t,e,i))}function Fr(s,t,e,i,n){for(;e;)e=Qc(s,t,e,i,n);return e}function Jc(s,t,e){let i=s._getTarget();t in i||(i[t]={});let n=i[t];return dt(n)&&st(e)?e:n||{}}function t2(s,t,e,i){let n;for(let o of t)if(n=ra(Yc(o,s),e),typeof n!="undefined")return io(s,n)?no(e,i,s,n):n}function ra(s,t){for(let e of t){if(!e)continue;let i=e[s];if(typeof i!="undefined")return i}}function Ir(s){let t=s._keys;return t||(t=s._keys=e2(s._scopes)),t}function e2(s){let t=new Set;for(let e of s)for(let i of Object.keys(e).filter(n=>!n.startsWith("_")))t.add(i);return Array.from(t)}function oo(s,t,e,i){let{iScale:n}=s,{key:o="r"}=this._parsing,r=new Array(i),a,L,l,c;for(a=0,L=i;a!l.skip)),t.cubicInterpolationMode==="monotone")r2(s,n);else{let l=i?s[s.length-1]:s[0];for(o=0,r=s.length;oL.height&&(c=L.height,l=_e(Math.floor(c*i))),{width:l,height:c}}function ro(s,t,e){let i=t||1,n=_e(s.height*i),o=_e(s.width*i);s.height=_e(s.height),s.width=_e(s.width);let r=s.canvas;return r.style&&(e||!r.style.height&&!r.style.width)&&(r.style.height=`${s.height}px`,r.style.width=`${s.width}px`),s.currentDevicePixelRatio!==i||r.height!==n||r.width!==o?(s.currentDevicePixelRatio=i,r.height=n,r.width=o,s.ctx.setTransform(i,0,0,i,0,0),!0):!1}function ao(s,t){let e=L2(s,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function Ce(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:s.y+e*(t.y-s.y)}}function da(s,t,e,i){return{x:s.x+e*(t.x-s.x),y:i==="middle"?e<.5?s.y:t.y:i==="after"?e<1?s.y:t.y:e>0?t.y:s.y}}function ha(s,t,e,i){let n={x:s.cp2x,y:s.cp2y},o={x:t.cp1x,y:t.cp1y},r=Ce(s,n,e),a=Ce(n,o,e),L=Ce(o,t,e),l=Ce(r,a,e),c=Ce(a,L,e);return Ce(l,c,e)}function ze(s,t,e){return s?u2(t,e):f2()}function Lo(s,t){let e,i;(t==="ltr"||t==="rtl")&&(e=s.canvas.style,i=[e.getPropertyValue("direction"),e.getPropertyPriority("direction")],e.setProperty("direction",t,"important"),s.prevTextDirection=i)}function lo(s,t){t!==void 0&&(delete s.prevTextDirection,s.canvas.style.setProperty("direction",t[0],t[1]))}function ua(s){return s==="angle"?{between:gs,compare:Ac,normalize:yt}:{between:ee,compare:(t,e)=>t-e,normalize:t=>t}}function Vr({start:s,end:t,count:e,loop:i,style:n}){return{start:s%e,end:t%e,loop:i&&(t-s+1)%e===0,style:n}}function p2(s,t,e){let{property:i,start:n,end:o}=e,{between:r,normalize:a}=ua(i),L=t.length,{start:l,end:c,loop:d}=s,h,u;if(d){for(l+=L,c+=L,h=0,u=L;hL(n,_,g)&&a(n,_)!==0,C=()=>a(o,g)===0||L(o,_,g),v=()=>p||S(),y=()=>!p||C();for(let x=c,w=c;x<=d;++x)b=t[x%r],!b.skip&&(g=l(b[i]),g!==_&&(p=L(g,n,o),m===null&&v()&&(m=a(g,n)===0?x:w),m!==null&&y()&&(f.push(Vr({start:m,end:x,loop:h,count:r,style:u})),m=null),w=x,_=g));return m!==null&&f.push(Vr({start:m,end:d,loop:h,count:r,style:u})),f}function ho(s,t){let e=[],i=s.segments;for(let n=0;nn&&s[o%t].skip;)o--;return o%=t,{start:n,end:o}}function m2(s,t,e,i){let n=s.length,o=[],r=t,a=s[t],L;for(L=t+1;L<=e;++L){let l=s[L%n];l.skip||l.stop?a.skip||(i=!1,o.push({start:t%n,end:(L-1)%n,loop:i}),t=r=l.stop?L:null):(r=L,a.skip&&(t=L)),a=l}return r!==null&&o.push({start:t%n,end:r%n,loop:i}),o}function fa(s,t){let e=s.points,i=s.options.spanGaps,n=e.length;if(!n)return[];let o=!!s._loop,{start:r,end:a}=g2(e,n,o,i);if(i===!0)return Br(s,[{start:r,end:a,loop:o}],e,t);let L=a{Dr();$r=(()=>{let s=0;return()=>s++})();zr=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100:+s/t,Nn=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*t:+s;Tr={"":s=>s,x:s=>s.x,y:s=>s.y};fs=s=>typeof s!="undefined",le=s=>typeof s=="function",$n=(s,t)=>{if(s.size!==t.size)return!1;for(let e of s)if(!t.has(e))return!1;return!0};nt=Math.PI,ht=2*nt,Ec=ht+nt,Ai=Number.POSITIVE_INFINITY,Dc=nt/180,pt=nt/2,Ve=nt/4,Ar=nt*2/3,ce=Math.log10,jt=Math.sign;Qt=(s,t,e,i)=>Ii(s,e,i?n=>{let o=s[n][t];return os[n][t]Ii(s,e,i=>s[i][t]>=e);Kr=["push","pop","shift","splice","unshift"];Yn=function(){return typeof window=="undefined"?function(s){return s()}:window.requestAnimationFrame}();Vi=s=>s==="start"?"left":s==="end"?"right":"center",xt=(s,t,e)=>s==="start"?t:s==="end"?e:(t+e)/2,Qr=(s,t,e,i)=>s===(i?"left":"right")?e:s==="center"?(t+e)/2:t;wi=s=>s===0||s===1,Rr=(s,t,e)=>-(Math.pow(2,10*(s-=1))*Math.sin((s-t)*ht/e)),Pr=(s,t,e)=>Math.pow(2,-10*s)*Math.sin((s-t)*ht/e)+1,cs={linear:s=>s,easeInQuad:s=>s*s,easeOutQuad:s=>-s*(s-2),easeInOutQuad:s=>(s/=.5)<1?.5*s*s:-.5*(--s*(s-2)-1),easeInCubic:s=>s*s*s,easeOutCubic:s=>(s-=1)*s*s+1,easeInOutCubic:s=>(s/=.5)<1?.5*s*s*s:.5*((s-=2)*s*s+2),easeInQuart:s=>s*s*s*s,easeOutQuart:s=>-((s-=1)*s*s*s-1),easeInOutQuart:s=>(s/=.5)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2),easeInQuint:s=>s*s*s*s*s,easeOutQuint:s=>(s-=1)*s*s*s*s+1,easeInOutQuint:s=>(s/=.5)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2),easeInSine:s=>-Math.cos(s*pt)+1,easeOutSine:s=>Math.sin(s*pt),easeInOutSine:s=>-.5*(Math.cos(nt*s)-1),easeInExpo:s=>s===0?0:Math.pow(2,10*(s-1)),easeOutExpo:s=>s===1?1:-Math.pow(2,-10*s)+1,easeInOutExpo:s=>wi(s)?s:s<.5?.5*Math.pow(2,10*(s*2-1)):.5*(-Math.pow(2,-10*(s*2-1))+2),easeInCirc:s=>s>=1?s:-(Math.sqrt(1-s*s)-1),easeOutCirc:s=>Math.sqrt(1-(s-=1)*s),easeInOutCirc:s=>(s/=.5)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1),easeInElastic:s=>wi(s)?s:Rr(s,.075,.3),easeOutElastic:s=>wi(s)?s:Pr(s,.075,.3),easeInOutElastic(s){return wi(s)?s:s<.5?.5*Rr(s*2,.1125,.45):.5+.5*Pr(s*2-1,.1125,.45)},easeInBack(s){return s*s*((1.70158+1)*s-1.70158)},easeOutBack(s){return(s-=1)*s*((1.70158+1)*s+1.70158)+1},easeInOutBack(s){let t=1.70158;return(s/=.5)<1?.5*(s*s*(((t*=1.525)+1)*s-t)):.5*((s-=2)*s*(((t*=1.525)+1)*s+t)+2)},easeInBounce:s=>1-cs.easeOutBounce(1-s),easeOutBounce(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},easeInOutBounce:s=>s<.5?cs.easeInBounce(s*2)*.5:cs.easeOutBounce(s*2-1)*.5+.5};Rc=["x","y","borderWidth","radius","tension"],Pc=["color","borderColor","backgroundColor"];Or=new Map;Jr={values(s){return dt(s)?s:""+s},numeric(s,t,e){if(s===0)return"0";let i=this.chart.options.locale,n,o=s;if(e.length>1){let l=Math.max(Math.abs(e[0].value),Math.abs(e[e.length-1].value));(l<1e-4||l>1e15)&&(n="scientific"),o=Vc(s,e)}let r=ce(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),L={notation:n,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(L,this.options.ticks.format),ms(s,i,L)},logarithmic(s,t,e){if(s===0)return"0";let i=e[t].significand||s/Math.pow(10,Math.floor(ce(s)));return[1,2,3,5,10,15].includes(i)||t>.8*e.length?Jr.numeric.call(this,s,t,e):""}};bs={formatters:Jr};Se=Object.create(null),Bi=Object.create(null);Bn=class{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=i=>i.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(i,n)=>In(n.backgroundColor),this.hoverBorderColor=(i,n)=>In(n.borderColor),this.hoverColor=(i,n)=>In(n.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return Vn(this,t,e)}get(t){return js(this,t)}describe(t,e){return Vn(Bi,t,e)}override(t,e){return Vn(Se,t,e)}route(t,e,i,n){let o=js(this,t),r=js(this,i),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){let L=this[a],l=r[n];return st(L)?Object.assign({},l,L):J(L,l)},set(L){this[a]=L}}})}apply(t){t.forEach(e=>e(this))}},ut=new Bn({_scriptable:s=>!s.startsWith("on"),_indexable:s=>s!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[Oc,Fc,Bc]);Zc=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Wc=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;Uc=s=>+s||0;Yc=(s,t)=>s?s+Oi(t):t,io=(s,t)=>st(t)&&s!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);Xc=(s,t)=>s===!0?t:typeof s=="string"?de(t,s):void 0;s2=Number.EPSILON||1e-14,hs=(s,t)=>ts==="x"?"y":"x";Wi=s=>s.ownerDocument.defaultView.getComputedStyle(s,null);l2=["top","right","bottom","left"];c2=(s,t,e)=>(s>0||t>0)&&(!e||!e.shadowRoot);_e=s=>Math.round(s*10)/10;ca=function(){let s=!1;try{let t={get passive(){return s=!0,!1}};Hi()&&(window.addEventListener("test",null,t),window.removeEventListener("test",null,t))}catch(t){}return s}();u2=function(s,t){return{x(e){return s+s+t-e},setWidth(e){t=e},textAlign(e){return e==="center"?e:e==="right"?"left":"right"},xPlus(e,i){return e-i},leftForLtr(e,i){return e-i}}},f2=function(){return{x(s){return s},setWidth(s){},textAlign(s){return s},xPlus(s,t){return s+t},leftForLtr(s,t){return s}}}});var KL={};Ko(KL,{Animation:()=>Ji,Animations:()=>ni,ArcElement:()=>De,BarController:()=>We,BarElement:()=>qe,BasePlatform:()=>oi,BasicPlatform:()=>tn,BubbleController:()=>je,CategoryScale:()=>Ss,Chart:()=>ne,Colors:()=>FL,DatasetController:()=>Pt,Decimation:()=>VL,DomPlatform:()=>sn,DoughnutController:()=>oe,Element:()=>Ft,Filler:()=>NL,Interaction:()=>vL,Legend:()=>zL,LineController:()=>Ue,LineElement:()=>Yt,LinearScale:()=>Ms,LogarithmicScale:()=>ks,PieController:()=>Cs,PointElement:()=>Ke,PolarAreaController:()=>Ae,RadarController:()=>Ye,RadialLinearScale:()=>Te,Scale:()=>Oe,ScatterController:()=>Ge,SubTitle:()=>ZL,Ticks:()=>bs,TimeScale:()=>Pe,TimeSeriesScale:()=>ws,Title:()=>HL,Tooltip:()=>jL,_adapters:()=>bL,_detectPlatform:()=>SL,animator:()=>ie,controllers:()=>mL,defaults:()=>ut,elements:()=>RL,layouts:()=>_t,plugins:()=>UL,registerables:()=>yd,registry:()=>Ut,scales:()=>GL});function C2(s,t){let e=[],i=Object.keys(t);for(let n=0;n0||!e&&o<0)return n.index}return null}function ya(s,t){let{chart:e,_cachedMeta:i}=s,n=e._stacks||(e._stacks={}),{iScale:o,vScale:r,index:a}=i,L=o.axis,l=r.axis,c=w2(o,r,i),d=t.length,h;for(let u=0;ue[i].axis===t).shift()}function T2(s,t){return he(s,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function A2(s,t,e){return he(s,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:e,index:t,mode:"default",type:"data"})}function qs(s,t){let e=s.controller.index,i=s.vScale&&s.vScale.axis;if(i){t=t||s._parsed;for(let n of t){let o=n._stacks;if(!o||o[i]===void 0||o[i][e]===void 0)return;delete o[i][e],o[i]._visualValues!==void 0&&o[i]._visualValues[e]!==void 0&&delete o[i]._visualValues[e]}}}function P2(s,t){if(!s._cache.$bar){let e=s.getMatchingVisibleMetas(t),i=[];for(let n=0,o=e.length;nn-o))}return s._cache.$bar}function O2(s){let t=s.iScale,e=P2(t,s.type),i=t._length,n,o,r,a,L=()=>{r===32767||r===-32768||(fs(a)&&(i=Math.min(i,Math.abs(r-a)||i)),a=r)};for(n=0,o=e.length;n0?n[s-1]:null,a=sMath.abs(a)&&(L=a,l=r),t[e.axis]=l,t._custom={barStart:L,barEnd:l,start:n,end:o,min:r,max:a}}function gL(s,t,e,i){return dt(s)?V2(s,t,e,i):t[e.axis]=e.parse(s,i),t}function Ca(s,t,e,i){let n=s.iScale,o=s.vScale,r=n.getLabels(),a=n===o,L=[],l,c,d,h;for(l=e,c=e+i;l=e?1:-1)}function N2(s){let t,e,i,n,o;return s.horizontal?(t=s.base>s.x,e="left",i="right"):(t=s.basegs(_,a,L,!0)?1:Math.max(S,S*e,C,C*e),f=(_,S,C)=>gs(_,a,L,!0)?-1:Math.min(S,S*e,C,C*e),p=u(0,l,d),m=u(pt,c,h),g=f(nt,l,d),b=f(nt+pt,c,h);i=(p-g)/2,n=(m-b)/2,o=-(p+g)/2,r=-(m+b)/2}return{ratioX:i,ratioY:n,offsetX:o,offsetY:r}}function He(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}function W2(s,t,e,i){let{controller:n,data:o,_sorted:r}=s,a=n._cachedMeta.iScale,L=s.dataset&&s.dataset.options?s.dataset.options.spanGaps:null;if(a&&t===a.axis&&t!=="r"&&r&&o.length){let l=a._reversePixels?Yr:Qt;if(i){if(n._sharedOptions){let c=o[0],d=typeof c.getRange=="function"&&c.getRange(t);if(d){let h=l(o,t,e-d),u=l(o,t,e+d);return{lo:h.lo,hi:u.hi}}}}else{let c=l(o,t,e);if(L){let{vScale:d}=n._cachedMeta,{_parsed:h}=s,u=h.slice(0,c.lo+1).reverse().findIndex(p=>!tt(p[d.axis]));c.lo-=Math.max(0,u);let f=h.slice(c.hi).findIndex(p=>!tt(p[d.axis]));c.hi+=Math.max(0,f)}return c}}return{lo:0,hi:o.length-1}}function li(s,t,e,i,n){let o=s.getSortedVisibleDatasetMetas(),r=e[t];for(let a=0,L=o.length;a{L[r]&&L[r](t[e],n)&&(o.push({element:L,datasetIndex:l,index:c}),a=a||L.inRange(t.x,t.y,n))}),i&&!a?[]:o}function Xs(s,t){return s.filter(e=>e.pos===t)}function ka(s,t){return s.filter(e=>yL.indexOf(e.pos)===-1&&e.box.axis===t)}function Qs(s,t){return s.sort((e,i)=>{let n=t?i:e,o=t?e:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight})}function G2(s){let t=[],e,i,n,o,r,a;for(e=0,i=(s||[]).length;el.box.fullSize),!0),i=Qs(Xs(t,"left"),!0),n=Qs(Xs(t,"right")),o=Qs(Xs(t,"top"),!0),r=Qs(Xs(t,"bottom")),a=ka(t,"x"),L=ka(t,"y");return{fullSize:e,leftAndTop:i.concat(o),rightAndBottom:n.concat(L).concat(r).concat(a),chartArea:Xs(t,"chartArea"),vertical:i.concat(n).concat(L),horizontal:o.concat(r).concat(a)}}function wa(s,t,e,i){return Math.max(s[e],t[e])+Math.max(s[i],t[i])}function xL(s,t){s.top=Math.max(s.top,t.top),s.left=Math.max(s.left,t.left),s.bottom=Math.max(s.bottom,t.bottom),s.right=Math.max(s.right,t.right)}function Q2(s,t,e,i){let{pos:n,box:o}=e,r=s.maxPadding;if(!st(n)){e.size&&(s[n]-=e.size);let d=i[e.stack]||{size:0,count:1};d.size=Math.max(d.size,e.horizontal?o.height:o.width),e.size=d.size/d.count,s[n]+=e.size}o.getPadding&&xL(r,o.getPadding());let a=Math.max(0,t.outerWidth-wa(r,s,"left","right")),L=Math.max(0,t.outerHeight-wa(r,s,"top","bottom")),l=a!==s.w,c=L!==s.h;return s.w=a,s.h=L,e.horizontal?{same:l,other:c}:{same:c,other:l}}function J2(s){let t=s.maxPadding;function e(i){let n=Math.max(t[i]-s[i],0);return s[i]+=n,n}s.y+=e("top"),s.x+=e("left"),e("right"),e("bottom")}function t1(s,t){let e=t.maxPadding;function i(n){let o={left:0,top:0,right:0,bottom:0};return n.forEach(r=>{o[r]=Math.max(t[r],e[r])}),o}return i(s?["left","right"]:["top","bottom"])}function ei(s,t,e,i){let n=[],o,r,a,L,l,c;for(o=0,r=s.length,l=0;o{let r=!1;for(let a of o)r=r||en(a.addedNodes,i),r=r&&!en(a.removedNodes,i);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function a1(s,t,e){let i=s.canvas,n=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||en(a.removedNodes,i),r=r&&!en(a.addedNodes,i);r&&e()});return n.observe(document,{childList:!0,subtree:!0}),n}function _L(){let s=window.devicePixelRatio;s!==Ta&&(Ta=s,ri.forEach((t,e)=>{e.currentDevicePixelRatio!==s&&t()}))}function L1(s,t){ri.size||window.addEventListener("resize",_L),ri.set(s,t)}function l1(s){ri.delete(s),ri.size||window.removeEventListener("resize",_L)}function c1(s,t,e){let i=s.canvas,n=i&&Zi(i);if(!n)return;let o=Gn((a,L)=>{let l=n.clientWidth;e(a,L),l{let L=a[0],l=L.contentRect.width,c=L.contentRect.height;l===0&&c===0||o(l,c)});return r.observe(n),L1(s,o),r}function yo(s,t,e){e&&e.disconnect(),t==="resize"&&l1(s)}function d1(s,t,e){let i=s.canvas,n=Gn(o=>{s.ctx!==null&&e(o1(o,s))},s);return i1(i,t,n),n}function SL(s){return!Hi()||typeof OffscreenCanvas!="undefined"&&s instanceof OffscreenCanvas?tn:sn}function h1(s,t){let e=s.options.ticks,i=u1(s),n=Math.min(e.maxTicksLimit||i,i),o=e.major.enabled?p1(t):[],r=o.length,a=o[0],L=o[r-1],l=[];if(r>n)return g1(t,l,o,r/n),l;let c=f1(o,t,n);if(r>0){let d,h,u=r>1?Math.round((L-a)/(r-1)):null;for(Ui(t,l,c,tt(u)?0:a-u,a),d=0,h=r-1;dn)return L}return Math.max(n,1)}function p1(s){let t=[],e,i;for(e=0,i=s.length;er+a)))return L}function y1(s,t){at(s,e=>{let i=e.gc,n=i.length/2,o;if(n>t){for(o=0;o{let i=e.split("."),n=i.pop(),o=[s].concat(i).join("."),r=t[e].split("."),a=r.pop(),L=r.join(".");ut.route(o,n,L,a)})}function w1(s){return"id"in s&&"defaults"in s}function E1(s){let t={},e=[],i=Object.keys(Ut.plugins.items);for(let o=0;o1&&Fa(s[0].toLowerCase());if(i)return i}throw new Error(`Cannot determine type of '${s}' axis. Please provide 'axis' or 'position' option.`)}function Ia(s,t,e){if(e[t+"AxisID"]===s)return{axis:t}}function F1(s,t){if(t.data&&t.data.datasets){let e=t.data.datasets.filter(i=>i.xAxisID===s||i.yAxisID===s);if(e.length)return Ia(s,"x",e[0])||Ia(s,"y",e[0])}return{}}function I1(s,t){let e=Se[s.type]||{scales:{}},i=t.scales||{},n=Do(s.type,t),o=Object.create(null);return Object.keys(i).forEach(r=>{let a=i[r];if(!st(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);let L=To(r,a,F1(r,s),ut.scales[a.type]),l=P1(L,n),c=e.scales||{};o[r]=us(Object.create(null),[{axis:L},a,c[L],c[l]])}),s.data.datasets.forEach(r=>{let a=r.type||s.type,L=r.indexAxis||Do(a,t),c=(Se[a]||{}).scales||{};Object.keys(c).forEach(d=>{let h=R1(d,L),u=r[h+"AxisID"]||h;o[u]=o[u]||Object.create(null),us(o[u],[{axis:h},i[u],c[d]])})}),Object.keys(o).forEach(r=>{let a=o[r];us(a,[ut.scales[a.type],ut.scale])}),o}function ML(s){let t=s.options||(s.options={});t.plugins=J(t.plugins,{}),t.scales=I1(s,t)}function kL(s){return s=s||{},s.datasets=s.datasets||[],s.labels=s.labels||[],s}function V1(s){return s=s||{},s.data=kL(s.data),ML(s),s}function Yi(s,t){let e=Va.get(s);return e||(e=t(),Va.set(s,e),wL.add(e)),e}function Ba(s,t,e){let i=s.get(t);i||(i=new Map,s.set(t,i));let n=e.join(),o=i.get(n);return o||(o={resolver:zi(t,e),subPrefixes:e.filter(a=>!a.toLowerCase().includes("hover"))},i.set(n,o)),o}function N1(s,t){let{isScriptable:e,isIndexable:i}=so(s);for(let n of t){let o=e(n),r=i(n),a=(r||o)&&s[n];if(o&&(le(a)||B1(a))||r&&dt(a))return!0}return!1}function Na(s,t){return s==="top"||s==="bottom"||z1.indexOf(s)===-1&&t==="x"}function $a(s,t){return function(e,i){return e[s]===i[s]?e[t]-i[t]:e[s]-i[s]}}function za(s){let t=s.chart,e=t.options.animation;t.notifyPlugins("afterRender"),ct(e&&e.onComplete,[s],t)}function H1(s){let t=s.chart,e=t.options.animation;ct(e&&e.onProgress,[s],t)}function EL(s){return Hi()&&typeof s=="string"?s=document.getElementById(s):s&&s.length&&(s=s[0]),s&&s.canvas&&(s=s.canvas),s}function Z1(s,t,e){let i=Object.keys(s);for(let n of i){let o=+n;if(o>=t){let r=s[n];delete s[n],(e>0||o>t)&&(s[o+e]=r)}}}function W1(s,t,e,i){return!e||s.type==="mouseout"?null:i?t:s}function Za(){return at(ne.instances,s=>s._plugins.invalidate())}function j1(s,t,e){let{startAngle:i,x:n,y:o,outerRadius:r,innerRadius:a,options:L}=t,{borderWidth:l,borderJoinStyle:c}=L,d=Math.min(l/r,yt(i-e));if(s.beginPath(),s.arc(n,o,r-l/2,i+d/2,e-d/2),a>0){let h=Math.min(l/a,yt(i-e));s.arc(n,o,a+l/2,e-h/2,i+h/2,!0)}else{let h=Math.min(l/2,r*yt(i-e));if(c==="round")s.arc(n,o,h,e-nt/2,i+nt/2,!0);else if(c==="bevel"){let u=2*h*h,f=-u*Math.cos(e+nt/2)+n,p=-u*Math.sin(e+nt/2)+o,m=u*Math.cos(i+nt/2)+n,g=u*Math.sin(i+nt/2)+o;s.lineTo(f,p),s.lineTo(m,g)}}s.closePath(),s.moveTo(0,0),s.rect(0,0,s.canvas.width,s.canvas.height),s.clip("evenodd")}function U1(s,t,e){let{startAngle:i,pixelMargin:n,x:o,y:r,outerRadius:a,innerRadius:L}=t,l=n/a;s.beginPath(),s.arc(o,r,a,i-l,e+l),L>n?(l=n/L,s.arc(o,r,L,e+l,i-l,!0)):s.arc(o,r,n,e+pt,i-pt),s.closePath(),s.clip()}function Y1(s){return $i(s,["outerStart","outerEnd","innerStart","innerEnd"])}function G1(s,t,e,i){let n=Y1(s.options.borderRadius),o=(e-t)/2,r=Math.min(o,i*t/2),a=L=>{let l=(e-Math.min(o,L))*i/2;return mt(L,0,Math.min(o,l))};return{outerStart:a(n.outerStart),outerEnd:a(n.outerEnd),innerStart:mt(n.innerStart,0,r),innerEnd:mt(n.innerEnd,0,r)}}function xs(s,t,e,i){return{x:e+s*Math.cos(t),y:i+s*Math.sin(t)}}function nn(s,t,e,i,n,o){let{x:r,y:a,startAngle:L,pixelMargin:l,innerRadius:c}=t,d=Math.max(t.outerRadius+i+e-l,0),h=c>0?c+i+e+l:0,u=0,f=n-L;if(i){let I=c>0?c-i:0,P=d>0?d-i:0,E=(I+P)/2,j=E!==0?f*E/(E+i):f;u=(f-j)/2}let p=Math.max(.001,f*d-e/nt)/d,m=(f-p)/2,g=L+m+u,b=n-m-u,{outerStart:_,outerEnd:S,innerStart:C,innerEnd:v}=G1(t,h,d,b-g),y=d-_,x=d-S,w=g+_/y,k=b-S/x,M=h+C,T=h+v,A=g+C/M,B=b-v/T;if(s.beginPath(),o){let I=(w+k)/2;if(s.arc(r,a,d,w,I),s.arc(r,a,d,I,k),S>0){let F=xs(x,k,r,a);s.arc(F.x,F.y,S,k,b+pt)}let P=xs(T,b,r,a);if(s.lineTo(P.x,P.y),v>0){let F=xs(T,B,r,a);s.arc(F.x,F.y,v,b+pt,B+Math.PI)}let E=(b-v/h+(g+C/h))/2;if(s.arc(r,a,h,b-v/h,E,!0),s.arc(r,a,h,E,g+C/h,!0),C>0){let F=xs(M,A,r,a);s.arc(F.x,F.y,C,A+Math.PI,g-pt)}let j=xs(y,g,r,a);if(s.lineTo(j.x,j.y),_>0){let F=xs(y,w,r,a);s.arc(F.x,F.y,_,g-pt,w)}}else{s.moveTo(r,a);let I=Math.cos(w)*d+r,P=Math.sin(w)*d+a;s.lineTo(I,P);let E=Math.cos(k)*d+r,j=Math.sin(k)*d+a;s.lineTo(E,j)}s.closePath()}function K1(s,t,e,i,n){let{fullCircles:o,startAngle:r,circumference:a}=t,L=t.endAngle;if(o){nn(s,t,e,i,L,n);for(let l=0;l=nt&&u===0&&c!=="miter"&&j1(s,t,p),o||(nn(s,t,e,i,p,n),s.stroke())}function DL(s,t,e=t){s.lineCap=J(e.borderCapStyle,t.borderCapStyle),s.setLineDash(J(e.borderDash,t.borderDash)),s.lineDashOffset=J(e.borderDashOffset,t.borderDashOffset),s.lineJoin=J(e.borderJoinStyle,t.borderJoinStyle),s.lineWidth=J(e.borderWidth,t.borderWidth),s.strokeStyle=J(e.borderColor,t.borderColor)}function X1(s,t,e){s.lineTo(e.x,e.y)}function Q1(s){return s.stepped?ea:s.tension||s.cubicInterpolationMode==="monotone"?sa:X1}function TL(s,t,e={}){let i=s.length,{start:n=0,end:o=i-1}=e,{start:r,end:a}=t,L=Math.max(n,r),l=Math.min(o,a),c=na&&o>a;return{count:i,start:L,loop:t.loop,ilen:l(r+(l?a-S:S))%o,_=()=>{p!==m&&(s.lineTo(c,m),s.lineTo(c,p),s.lineTo(c,g))};for(L&&(u=n[b(0)],s.moveTo(u.x,u.y)),h=0;h<=a;++h){if(u=n[b(h)],u.skip)continue;let S=u.x,C=u.y,v=S|0;v===f?(Cm&&(m=C),c=(d*c+S)/++d):(_(),s.lineTo(S,C),f=v,d=0,p=m=C),g=C}_()}function Ro(s){let t=s.options,e=t.borderDash&&t.borderDash.length;return!s._decimated&&!s._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?t5:J1}function e5(s){return s.stepped?da:s.tension||s.cubicInterpolationMode==="monotone"?ha:Ce}function s5(s,t,e,i){let n=t._path;n||(n=t._path=new Path2D,t.path(n,e,i)&&n.closePath()),DL(s,t.options),s.stroke(n)}function i5(s,t,e,i){let{segments:n,options:o}=t,r=Ro(t);for(let a of n)DL(s,o,a.style),s.beginPath(),r(s,t,a,{start:e,end:e+i-1})&&s.closePath(),s.stroke()}function o5(s,t,e,i){n5&&!t.options.segment?s5(s,t,e,i):i5(s,t,e,i)}function Wa(s,t,e,i){let n=s.options,{[e]:o}=s.getProps([e],i);return Math.abs(t-o)PL(t++)),t}function u5(s,t){return s.backgroundColor=s.data.map(()=>OL(t++)),t}function f5(s){let t=0;return(e,i)=>{let n=s.getDatasetMeta(i).controller;n instanceof oe?t=h5(e,t):n instanceof Ae?t=u5(e,t):n&&(t=d5(e,t))}}function Ua(s){let t;for(t in s)if(s[t].borderColor||s[t].backgroundColor)return!0;return!1}function p5(s){return s&&(s.borderColor||s.backgroundColor)}function g5(){return ut.borderColor!=="rgba(0,0,0,0.1)"||ut.backgroundColor!=="rgba(0,0,0,0.1)"}function m5(s,t,e,i,n){let o=n.samples||i;if(o>=e)return s.slice(t,t+e);let r=[],a=(e-2)/(o-2),L=0,l=t+e-1,c=t,d,h,u,f,p;for(r[L++]=s[c],d=0;du&&(u=f,h=s[b],p=b);r[L++]=h,c=p}return r[L++]=s[l],r}function b5(s,t,e,i){let n=0,o=0,r,a,L,l,c,d,h,u,f,p,m=[],g=t+e-1,b=s[t].x,S=s[g].x-b;for(r=t;rp&&(p=l,h=r),n=(o*n+a.x)/++o;else{let v=r-1;if(!tt(d)&&!tt(h)){let y=Math.min(d,h),x=Math.max(d,h);y!==u&&y!==v&&m.push({...s[y],x:n}),x!==u&&x!==v&&m.push({...s[x],x:n})}r>0&&v!==u&&m.push(s[v]),m.push(a),c=C,o=0,f=p=l,d=h=u=r}}return m}function IL(s){if(s._decimated){let t=s._data;delete s._decimated,delete s._data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,writable:!0,value:t})}}function Ya(s){s.data.datasets.forEach(t=>{IL(t)})}function v5(s,t){let e=t.length,i=0,n,{iScale:o}=s,{min:r,max:a,minDefined:L,maxDefined:l}=o.getUserBounds();return L&&(i=mt(Qt(t,o.axis,r).lo,0,e-1)),l?n=mt(Qt(t,o.axis,a).hi+1,i,e)-i:n=e-i,{start:i,count:n}}function y5(s,t,e){let i=s.segments,n=s.points,o=t.points,r=[];for(let a of i){let{start:L,end:l}=a;l=an(L,l,n);let c=Oo(e,n[L],n[l],a.loop);if(!t.segments){r.push({source:a,target:c,start:n[L],end:n[l]});continue}let d=ho(t,c);for(let h of d){let u=Oo(e,o[h.start],o[h.end],h.loop),f=co(a,n,u);for(let p of f)r.push({source:p,target:h,start:{[e]:Ga(c,u,"start",Math.max)},end:{[e]:Ga(c,u,"end",Math.min)}})}}return r}function Oo(s,t,e,i){if(i)return;let n=t[s],o=e[s];return s==="angle"&&(n=yt(n),o=yt(o)),{property:s,start:n,end:o}}function x5(s,t){let{x:e=null,y:i=null}=s||{},n=t.points,o=[];return t.segments.forEach(({start:r,end:a})=>{a=an(r,a,n);let L=n[r],l=n[a];i!==null?(o.push({x:L.x,y:i}),o.push({x:l.x,y:i})):e!==null&&(o.push({x:e,y:L.y}),o.push({x:e,y:l.y}))}),o}function an(s,t,e){for(;t>s;t--){let i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function Ga(s,t,e,i){return s&&t?i(s[e],t[e]):s?s[e]:t?t[e]:0}function BL(s,t){let e=[],i=!1;return dt(s)?(i=!0,e=s):e=x5(s,t),e.length?new Yt({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function Ka(s){return s&&s.fill!==!1}function C5(s,t,e){let n=s[t].fill,o=[t],r;if(!e)return n;for(;n!==!1&&o.indexOf(n)===-1;){if(!ft(n))return n;if(r=s[n],!r)return!1;if(r.visible)return n;o.push(n),n=r.fill}return!1}function _5(s,t,e){let i=w5(s);if(st(i))return isNaN(i.value)?!1:i;let n=parseFloat(i);return ft(n)&&Math.floor(n)===n?S5(i[0],t,n,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function S5(s,t,e,i){return(s==="-"||s==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function M5(s,t){let e=null;return s==="start"?e=t.bottom:s==="end"?e=t.top:st(s)?e=t.getPixelForValue(s.value):t.getBasePixel&&(e=t.getBasePixel()),e}function k5(s,t,e){let i;return s==="start"?i=e:s==="end"?i=t.options.reverse?t.min:t.max:st(s)?i=s.value:i=t.getBaseValue(),i}function w5(s){let t=s.options,e=t.fill,i=J(e&&e.target,e);return i===void 0&&(i=!!t.backgroundColor),i===!1||i===null?!1:i===!0?"origin":i}function E5(s){let{scale:t,index:e,line:i}=s,n=[],o=i.segments,r=i.points,a=D5(t,e);a.push(BL({x:null,y:t.bottom},i));for(let L=0;Lo.length>r.length?o:r)),t+e.size/2+i.measureText(n).width}function H5(s,t,e){let i=s;return typeof t.text!="string"&&(i=$L(t,e)),i}function $L(s,t){let e=s.text?s.text.length:0;return t*e}function Z5(s,t){return!!((s==="mousemove"||s==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(s==="click"||s==="mouseup"))}function W5(s,t){let e=new ai({ctx:s.ctx,options:t,chart:s});_t.configure(s,e,t),_t.addBox(s,e),s.titleBlock=e}function se(s,t){return t&&(dt(t)?Array.prototype.push.apply(s,t):s.push(t)),s}function ue(s){return(typeof s=="string"||s instanceof String)&&s.indexOf(` `)>-1?s.split(` -`):s}function Yf(s,t){let{element:e,datasetIndex:n,index:i}=t,o=s.getDatasetMeta(n).controller,{label:r,value:a}=o.getLabelAndValue(i);return{chart:s,label:r,parsed:o.getParsed(i),raw:s.data.datasets[n].data[i],formattedValue:a,dataset:o.getDataset(),dataIndex:i,datasetIndex:n,element:e}}function el(s,t){let e=s.chart.ctx,{body:n,footer:i,title:o}=s,{boxWidth:r,boxHeight:a}=t,l=bt(t.bodyFont),c=bt(t.titleFont),d=bt(t.footerFont),h=o.length,u=i.length,f=n.length,g=St(t.padding),p=g.height,b=0,m=n.reduce((k,S)=>k+S.before.length+S.lines.length+S.after.length,0);if(m+=s.beforeBody.length+s.afterBody.length,h&&(p+=h*c.lineHeight+(h-1)*t.titleSpacing+t.titleMarginBottom),m){let k=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;p+=f*k+(m-f)*l.lineHeight+(m-1)*t.bodySpacing}u&&(p+=t.footerMarginTop+u*d.lineHeight+(u-1)*t.footerSpacing);let v=0,_=function(k){b=Math.max(b,e.measureText(k).width+v)};return e.save(),e.font=c.string,lt(s.title,_),e.font=l.string,lt(s.beforeBody.concat(s.afterBody),_),v=t.displayColors?r+2+t.boxPadding:0,lt(n,k=>{lt(k.before,_),lt(k.lines,_),lt(k.after,_)}),v=0,e.font=d.string,lt(s.footer,_),e.restore(),b+=g.width,{width:b,height:p}}function Gf(s,t){let{y:e,height:n}=t;return es.height-n/2?"bottom":"center"}function Kf(s,t,e,n){let{x:i,width:o}=n,r=e.caretSize+e.caretPadding;if(s==="left"&&i+o+r>t.width||s==="right"&&i-o-r<0)return!0}function qf(s,t,e,n){let{x:i,width:o}=e,{width:r,chartArea:{left:a,right:l}}=s,c="center";return n==="center"?c=i<=(a+l)/2?"left":"right":i<=o/2?c="left":i>=r-o/2&&(c="right"),Kf(c,s,t,e)&&(c="center"),c}function sl(s,t,e){let n=e.yAlign||t.yAlign||Gf(s,e);return{xAlign:e.xAlign||t.xAlign||qf(s,t,e,n),yAlign:n}}function Xf(s,t){let{x:e,width:n}=s;return t==="right"?e-=n:t==="center"&&(e-=n/2),e}function Qf(s,t,e){let{y:n,height:i}=s;return t==="top"?n+=e:t==="bottom"?n-=i+e:n-=i/2,n}function nl(s,t,e,n){let{caretSize:i,caretPadding:o,cornerRadius:r}=s,{xAlign:a,yAlign:l}=e,c=i+o,{topLeft:d,topRight:h,bottomLeft:u,bottomRight:f}=De(r),g=Xf(t,a),p=Qf(t,l,c);return l==="center"?a==="left"?g+=c:a==="right"&&(g-=c):a==="left"?g-=Math.max(d,u)+i:a==="right"&&(g+=Math.max(h,f)+i),{x:vt(g,0,n.width-t.width),y:vt(p,0,n.height-t.height)}}function Qn(s,t,e){let n=St(e.padding);return t==="center"?s.x+s.width/2:t==="right"?s.x+s.width-n.right:s.x+n.left}function il(s){return se([],fe(s))}function Zf(s,t,e){return ue(s,{tooltip:t,tooltipItems:e,type:"tooltip"})}function ol(s,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?s.override(e):s}function At(s,t,e,n){let i=s[t].call(e,n);return typeof i=="undefined"?Ul[t].call(e,n):i}function tg(s,t,e,n){let i=s.indexOf(t);if(i===-1)return Jf(s,t,e,n);let o=s.lastIndexOf(t);return i!==o?e:i}function rl(s){let t=this.getLabels();return s>=0&&sg&&(S=Hi(E*S/g/f)*f),et(l)||(x=Math.pow(10,l),S=Math.ceil(S*x)/x),i==="ticks"?(y=Math.floor(p/S)*S,C=Math.ceil(b/S)*S):(y=p,C=b),m&&v&&o&&Yr((a-r)/o,S/1e3)?(E=Math.round(Math.min((a-r)/S,d)),S=(a-r)/E,y=r,C=a):_?(y=m?r:y,C=v?a:C,E=c-1,S=(C-y)/E):(E=(C-y)/S,ps(E,Math.round(E),S/1e3)?E=Math.round(E):E=Math.ceil(E));let D=Math.max(ji(S),ji(y));x=Math.pow(10,et(l)?D:l),y=Math.round(y*x)/x,C=Math.round(C*x)/x;let w=0;for(m&&(u&&y!==r?(e.push({value:r}),ya)break;e.push({value:M})}return v&&u&&C!==a?e.length&&ps(e[e.length-1].value,a,al(a,k,s))?e[e.length-1].value=a:e.push({value:a}):(!v||C===a)&&e.push({value:C}),e}function al(s,t,{horizontal:e,minRotation:n}){let i=Ht(n),o=(e?Math.sin(i):Math.cos(i))||.001,r=.75*t*(""+s).length;return Math.min(t/o,r)}function ll(s){return s/Math.pow(10,cn(s))===1}function cl(s,t,e){let n=Math.pow(10,e),i=Math.floor(s/n);return Math.ceil(t/n)-i}function ng(s,t){let e=t-s,n=cn(e);for(;cl(s,t,n)>10;)n++;for(;cl(s,t,n)<10;)n--;return Math.min(n,cn(s))}function ig(s,{min:t,max:e}){t=Lt(s.min,t);let n=[],i=cn(t),o=ng(t,e),r=o<0?Math.pow(10,Math.abs(o)):1,a=Math.pow(10,o),l=i>o?Math.pow(10,i):0,c=Math.round((t-l)*r)/r,d=Math.floor((t-l)/a/10)*a*10,h=Math.floor((c-d)/Math.pow(10,o)),u=Lt(s.min,Math.round((l+d+h*Math.pow(10,o))*r)/r);for(;u=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,r=o>=0?1:r),u=Math.round((l+d+h*Math.pow(10,o))*r)/r;let f=Lt(s.max,u);return n.push({value:f,major:ll(f),significand:h}),n}function Io(s){let t=s.ticks;if(t.display&&s.display){let e=St(t.backdropPadding);return J(t.font&&t.font.size,ut.font.size)+e.height}return 0}function og(s,t,e){return e=dt(e)?e:[e],{w:ea(s,t.string,e),h:e.length*t.lineHeight}}function dl(s,t,e,n,i){return s===n||s===i?{start:t-e/2,end:t+e/2}:si?{start:t-e,end:t}:{start:t,end:t+e}}function rg(s){let t={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},e=Object.assign({},t),n=[],i=[],o=s._pointLabels.length,r=s.options.pointLabels,a=r.centerPointLabels?it/o:0;for(let l=0;lt.r&&(a=(n.end-t.r)/o,s.r=Math.max(s.r,t.r+a)),i.startt.b&&(l=(i.end-t.b)/r,s.b=Math.max(s.b,t.b+l))}function lg(s,t,e){let n=s.drawingArea,{extra:i,additionalAngle:o,padding:r,size:a}=e,l=s.getPointPosition(t,n+i+r,o),c=Math.round(Vn(Ct(l.angle+mt))),d=fg(l.y,a.h,c),h=hg(c),u=ug(l.x,a.w,h);return{visible:!0,x:l.x,y:d,textAlign:h,left:u,top:d,right:u+a.w,bottom:d+a.h}}function cg(s,t){if(!t)return!0;let{left:e,top:n,right:i,bottom:o}=s;return!(Jt({x:e,y:n},t)||Jt({x:e,y:o},t)||Jt({x:i,y:n},t)||Jt({x:i,y:o},t))}function dg(s,t,e){let n=[],i=s._pointLabels.length,o=s.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:Io(o)/2,additionalAngle:r?it/i:0},c;for(let d=0;d270||e<90)&&(s-=t),s}function gg(s,t,e){let{left:n,top:i,right:o,bottom:r}=e,{backdropColor:a}=t;if(!et(a)){let l=De(t.borderRadius),c=St(t.backdropPadding);s.fillStyle=a;let d=n-c.left,h=i-c.top,u=o-n+c.width,f=r-i+c.height;Object.values(l).some(g=>g!==0)?(s.beginPath(),ys(s,{x:d,y:h,w:u,h:f,radius:l}),s.fill()):s.fillRect(d,h,u,f)}}function pg(s,t){let{ctx:e,options:{pointLabels:n}}=s;for(let i=t-1;i>=0;i--){let o=s._pointLabelItems[i];if(!o.visible)continue;let r=n.setContext(s.getPointLabelContext(i));gg(e,r,o);let a=bt(r.font),{x:l,y:c,textAlign:d}=o;Ee(e,s._pointLabels[i],l,c+a.lineHeight/2,a,{color:r.color,textAlign:d,textBaseline:"middle"})}}function Kl(s,t,e,n){let{ctx:i}=s;if(e)i.arc(s.xCenter,s.yCenter,t,0,ht);else{let o=s.getPointPosition(0,t);i.moveTo(o.x,o.y);for(let r=1;r=Pt.indexOf(e);o--){let r=Pt[o];if(ci[r].common&&s._adapter.diff(i,n,r)>=t-1)return r}return Pt[e?Pt.indexOf(e):0]}function yg(s){for(let t=Pt.indexOf(s)+1,e=Pt.length;t=t?e[n]:e[i];s[o]=!0}}function xg(s,t,e,n){let i=s._adapter,o=+i.startOf(t[0].value,n),r=t[t.length-1].value,a,l;for(a=o;a<=r;a=+i.add(a,1,n))l=e[a],l>=0&&(t[l].major=!0);return t}function pl(s,t,e){let n=[],i={},o=t.length,r,a;for(r=0;r=s[n].pos&&t<=s[i].pos&&({lo:n,hi:i}=Zt(s,"pos",t)),{pos:o,time:a}=s[n],{pos:r,time:l}=s[i]):(t>=s[n].time&&t<=s[i].time&&({lo:n,hi:i}=Zt(s,"time",t)),{time:o,pos:a}=s[n],{time:r,pos:l}=s[i]);let c=r-o;return c?a+(l-a)*(t-o)/c:a}var Eo,ne,ba,Ch,ei,on,bo,_a,Rh,Rt,je,Ue,oe,Ye,Ae,_s,Ge,Ke,vl,Do,yl,xl,Cl,kt,rn,si,Jn,eu,La,Sl,an,Aa,ii,Ot,vu,Ra,Pa,Oe,Ss,Mo,Yt,To,Na,Ml,tn,Ro,Nu,$u,zu,ti,Wa,ie,Te,of,Gt,qe,Xe,Pl,Oo,Ya,Il,Nl,ri,$l,tl,$f,ai,Hl,ln,Wl,Xn,jl,sn,Ul,nn,Yl,Gl,Jf,eg,ks,Ms,ws,cn,We,Es,Le,ci,Pt,Pe,Ds,ql,Cg,Ql=_i(()=>{ma();Eo=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,n,i){let o=e.listeners[i],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(n-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Ki.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((n,i)=>{if(!n.running||!n.items.length)return;let o=n.items,r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(i.draw(),this._notify(i,n,t,"progress")),o.length||(n.running=!1,this._notify(i,n,t,"complete"),n.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,n=e.get(t);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,n)),n}listen(t,e,n){this._getAnims(t).listeners[e].push(n)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((n,i)=>Math.max(n,i._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let n=e.items,i=n.length-1;for(;i>=0;--i)n[i].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},ne=new Eo,ba="transparent",Ch={boolean(s,t,e){return e>.5?t:s},color(s,t,e){let n=Ji(s||ba),i=n.valid&&Ji(t||ba);return i&&i.valid?i.mix(n,e).hexString():t},number(s,t,e){return s+(t-s)*e}},ei=class{constructor(t,e,n,i){let o=e[n];i=xs([t.to,i,o,t.from]);let r=xs([t.from,o,i]);this._active=!0,this._fn=t.fn||Ch[t.type||typeof r],this._easing=ds[t.easing]||ds.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=n,this._from=r,this._to=i,this._promises=void 0}active(){return this._active}update(t,e,n){if(this._active){this._notify(!1);let i=this._target[this._prop],o=n-this._start,r=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=xs([t.to,e,i,t.from]),this._from=xs([t.from,i,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,n=this._duration,i=this._prop,o=this._from,r=this._loop,a=this._to,l;if(this._active=o!==a&&(r||e1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(o,a,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,n)=>{t.push({res:e,rej:n})})}_notify(t){let e=t?"res":"rej",n=this._promises||[];for(let i=0;i{let o=t[i];if(!st(o))return;let r={};for(let a of e)r[a]=o[a];(dt(o.properties)&&o.properties||[i]).forEach(a=>{(a===i||!n.has(a))&&n.set(a,r)})})}_animateOptions(t,e){let n=e.options,i=Sh(t,n);if(!i)return[];let o=this._createAnimations(i,n);return n.$shared&&_h(t.options.$animations,n).then(()=>{t.options=n},()=>{}),o}_createAnimations(t,e){let n=this._properties,i=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now(),l;for(l=r.length-1;l>=0;--l){let c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){i.push(...this._animateOptions(t,e));continue}let d=e[c],h=o[c],u=n.get(c);if(h)if(u&&h.active()){h.update(u,d,a);continue}else h.cancel();if(!u||!u.duration){t[c]=d;continue}o[c]=h=new ei(u,t,c,d),i.push(h)}return i}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let n=this._createAnimations(t,e);if(n.length)return ne.add(this._chart,n),!0}};bo=s=>s==="reset"||s==="none",_a=(s,t)=>t?s:Object.assign({},s),Rh=(s,t,e)=>s&&!t.hidden&&t._stacked&&{keys:ml(e,!0),values:null},Rt=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=po(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Xs(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,n=this.getDataset(),i=(h,u,f,g)=>h==="x"?u:h==="r"?g:f,o=e.xAxisID=J(n.xAxisID,mo(t,"x")),r=e.yAxisID=J(n.yAxisID,mo(t,"y")),a=e.rAxisID=J(n.rAxisID,mo(t,"r")),l=e.indexAxis,c=e.iAxisID=i(l,o,r,a),d=e.vAxisID=i(l,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(c),e.vScale=this.getScaleForId(d)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&Yi(this._data,this),t._stacked&&Xs(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),n=this._data;if(st(e)){let i=this._cachedMeta;this._data=Eh(e,i)}else if(n!==e){if(n){Yi(n,this);let i=this._cachedMeta;Xs(i),i._parsed=[]}e&&Object.isExtensible(e)&&Qr(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,n=this.getDataset(),i=!1;this._dataCheck();let o=e._stacked;e._stacked=po(e.vScale,e),e.stack!==n.stack&&(i=!0,Xs(e),e.stack=n.stack),this._resyncElements(t),(i||o!==e._stacked)&&(Ca(this,e._parsed),e._stacked=po(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),n=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(n,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:n,_data:i}=this,{iScale:o,_stacked:r}=n,a=o.axis,l=t===0&&e===i.length?!0:n._sorted,c=t>0&&n._parsed[t-1],d,h,u;if(this._parsing===!1)n._parsed=i,n._sorted=!0,u=i;else{dt(i[t])?u=this.parseArrayData(n,i,t,e):st(i[t])?u=this.parseObjectData(n,i,t,e):u=this.parsePrimitiveData(n,i,t,e);let f=()=>h[a]===null||c&&h[a]p||h=0;--u)if(!g()){this.updateRangeFromParsed(c,t,f,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,n=[],i,o,r;for(i=0,o=e.length;i=0&&tthis.getContext(n,i,e),p=c.resolveNamedOptions(u,f,g,h);return p.$shared&&(p.$shared=l,o[r]=Object.freeze(_a(p,l))),p}_resolveAnimations(t,e,n){let i=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let l;if(i.options.animation!==!1){let d=this.chart.config,h=d.datasetAnimationScopeKeys(this._type,e),u=d.getOptionScopes(this.getDataset(),h);l=d.createResolver(u,this.getContext(t,n,e))}let c=new on(i,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||bo(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let n=this.resolveDataElementOptions(t,e),i=this._sharedOptions,o=this.getSharedOptions(n),r=this.includeOptions(e,o)||o!==i;return this.updateSharedOptions(o,e,n),{sharedOptions:o,includeOptions:r}}updateElement(t,e,n,i){bo(i)?Object.assign(t,n):this._resolveAnimations(e,i).update(t,n)}updateSharedOptions(t,e,n){t&&!bo(e)&&this._resolveAnimations(void 0,e).update(t,n)}_setStyle(t,e,n,i){t.active=i;let o=this.getStyle(e,i);this._resolveAnimations(e,n,i).update(t,{options:!i&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,n){this._setStyle(t,n,"active",!1)}setHoverStyle(t,e,n){this._setStyle(t,n,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,n=this._cachedMeta.data;for(let[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];let i=n.length,o=e.length,r=Math.min(o,i);r&&this.parse(0,r),o>i?this._insertElements(i,o-i,t):o{for(c.length+=e,a=c.length-1;a>=r;a--)c[a]=c[a-e]};for(l(o),a=t;ad.controller.options.grouped),o=n.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(e),l=a&&a[n.axis],c=d=>{let h=d._parsed.find(f=>f[n.axis]===l),u=h&&h[d.vScale.axis];if(et(u)||isNaN(u))return!0};for(let d of i)if(!(e!==void 0&&c(d))&&((o===!1||r.indexOf(d.stack)===-1||o===void 0&&d.stack===void 0)&&r.push(d.stack),d.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(n=>t[n].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let n of this.chart.data.datasets)t[J(this.chart.options.indexAxis==="x"?n.xAxisID:n.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,n){let i=this._getStacks(t,n),o=e!==void 0?i.indexOf(e):-1;return o===-1?i.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,n=e.iScale,i=[],o,r;for(o=0,r=e.data.length;o=0;--n)e=Math.max(e,t[n].size(this.resolveDataElementOptions(n))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart.data.labels||[],{xScale:i,yScale:o}=e,r=this.getParsed(t),a=i.getLabelForValue(r.x),l=o.getLabelForValue(r.y),c=r._custom;return{label:n[t]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,n,i){let o=i==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,i),d=r.axis,h=a.axis;for(let u=e;u+n[l];if(st(n[t])){let{key:l="value"}=this._parsing;o=c=>+he(n[c],l)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?ht*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart,i=n.data.labels||[],o=bs(e._parsed[t],n.options.locale);return{label:i[t]||"",value:o}}getMaxBorderWidth(t){let e=0,n=this.chart,i,o,r,a,l;if(!t){for(i=0,o=n.data.datasets.length;it!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),K(oe,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:n,textAlign:i,color:o,useBorderRadius:r,borderRadius:a}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((l,c)=>{let h=t.getDatasetMeta(0).controller.getStyle(c);return{text:l,fillStyle:h.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(c),lineDash:h.borderDash,lineDashOffset:h.borderDashOffset,lineJoin:h.borderJoinStyle,lineWidth:h.borderWidth,strokeStyle:h.borderColor,textAlign:i,pointStyle:n,borderRadius:r&&(a||h.borderRadius),index:c}}):[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}}});Ye=class extends Rt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:n,data:i=[],_dataset:o}=e,r=this.chart._animationsDisabled,{start:a,count:l}=Xi(e,i,r);this._drawStart=a,this._drawCount=l,Qi(e)&&(a=0,l=i.length),n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=i;let c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(n,void 0,{animated:!r,options:c},t),this.updateElements(i,a,l,t)}updateElements(t,e,n,i){let o=i==="reset",{iScale:r,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:d,includeOptions:h}=this._getSharedOptions(e,i),u=r.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,b=$e(g)?g:Number.POSITIVE_INFINITY,m=this.chart._animationsDisabled||o||i==="none",v=e+n,_=t.length,k=e>0&&this.getParsed(e-1);for(let S=0;S<_;++S){let x=t[S],y=m?x:{};if(S=v){y.skip=!0;continue}let C=this.getParsed(S),E=et(C[f]),D=y[u]=r.getPixelForValue(C[u],S),w=y[f]=o||E?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,C,l):C[f],S);y.skip=isNaN(D)||isNaN(w)||E,y.stop=S>0&&Math.abs(C[u]-k[u])>b,p&&(y.parsed=C,y.raw=c.data[S]),h&&(y.options=d||this.resolveDataElementOptions(S,x.active?"active":i)),m||this.updateElement(x,S,y,i),k=C}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,n=e.options&&e.options.borderWidth||0,i=t.data||[];if(!i.length)return n;let o=i[0].size(this.resolveDataElementOptions(0)),r=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(n,o,r)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};K(Ye,"id","line"),K(Ye,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),K(Ye,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});Ae=class extends Rt{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,n=this.chart,i=n.data.labels||[],o=bs(e._parsed[t].r,n.options.locale);return{label:i[t]||"",value:o}}parseObjectData(t,e,n,i){return ro.bind(this)(t,e,n,i)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((n,i)=>{let o=this.getParsed(i).r;!isNaN(o)&&this.chart.getDataVisibility(i)&&(oe.max&&(e.max=o))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,n=t.options,i=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(i/2,0),r=Math.max(n.cutoutPercentage?o/100*n.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,n,i){let o=i==="reset",r=this.chart,l=r.options.animation,c=this._cachedMeta.rScale,d=c.xCenter,h=c.yCenter,u=c.getIndexAngle(0)-.5*it,f=u,g,p=360/this.countVisibleElements();for(g=0;g{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++}),e}_computeAngle(t,e,n){return this.chart.getDataVisibility(t)?Ht(this.resolveDataElementOptions(t,e).angle||n):0}};K(Ae,"id","polarArea"),K(Ae,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),K(Ae,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:n,color:i}}=t.legend.options;return e.labels.map((o,r)=>{let l=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:i,lineWidth:l.borderWidth,pointStyle:n,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,n){n.chart.toggleDataVisibility(e.index),n.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});_s=class extends oe{};K(_s,"id","pie"),K(_s,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});Ge=class extends Rt{getLabelAndValue(t){let e=this._cachedMeta.vScale,n=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(n[e.axis])}}parseObjectData(t,e,n,i){return ro.bind(this)(t,e,n,i)}update(t){let e=this._cachedMeta,n=e.dataset,i=e.data||[],o=e.iScale.getLabels();if(n.points=i,t!=="resize"){let r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);let a={_loop:!0,_fullLoop:o.length===i.length,options:r};this.updateElement(n,void 0,a,t)}this.updateElements(i,0,i.length,t)}updateElements(t,e,n,i){let o=this._cachedMeta.rScale,r=i==="reset";for(let a=e;a0&&this.getParsed(e-1);for(let k=e;k0&&Math.abs(x[f]-_[f])>m,b&&(y.parsed=x,y.raw=c.data[k]),u&&(y.options=h||this.resolveDataElementOptions(k,S.active?"active":i)),v||this.updateElement(S,k,y,i),_=x}this.updateSharedOptions(h,i,d)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let l=e.length-1;l>=0;--l)a=Math.max(a,e[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}let n=t.dataset,i=n.options&&n.options.borderWidth||0;if(!e.length)return i;let o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(i,o,r)/2}};K(Ke,"id","scatter"),K(Ke,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),K(Ke,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});vl=Object.freeze({__proto__:null,BarController:je,BubbleController:Ue,DoughnutController:oe,LineController:Ye,PieController:_s,PolarAreaController:Ae,RadarController:Ge,ScatterController:Ke});Do=class s{constructor(t){K(this,"options");this.options=t||{}}static override(t){Object.assign(s.prototype,t)}init(){}formats(){return He()}parse(){return He()}format(){return He()}add(){return He()}diff(){return He()}startOf(){return He()}endOf(){return He()}},yl={_date:Do};xl={evaluateInteractionItems:dn,modes:{index(s,t,e,n){let i=Me(t,s),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?yo(s,i,o,n,r):xo(s,i,o,!1,n,r),l=[];return a.length?(s.getSortedVisibleDatasetMetas().forEach(c=>{let d=a[0].index,h=c.data[d];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:d})}),l):[]},dataset(s,t,e,n){let i=Me(t,s),o=e.axis||"xy",r=e.includeInvisible||!1,a=e.intersect?yo(s,i,o,n,r):xo(s,i,o,!1,n,r);if(a.length>0){let l=a[0].datasetIndex,c=s.getDatasetMeta(l).data;a=[];for(let d=0;d{typeof p.beforeLayout=="function"&&p.beforeLayout()});let d=l.reduce((p,b)=>b.box.options&&b.box.options.display===!1?p:p+1,0)||1,h=Object.freeze({outerWidth:t,outerHeight:e,padding:i,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/d,hBoxMaxHeight:r/2}),u=Object.assign({},i);_l(u,St(n));let f=Object.assign({maxPadding:u,w:o,h:r,x:i.left,y:i.top},i),g=Xh(l.concat(c),h);en(a.fullSize,f,h,g),en(l,f,h,g),en(c,f,h,g)&&en(l,f,h,g),Jh(f),Ta(a.leftAndTop,f,h,g),f.x+=f.w,f.y+=f.h,Ta(a.rightAndBottom,f,h,g),s.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},lt(a.chartArea,p=>{let b=p.box;Object.assign(b,s.chartArea),b.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})})}},rn=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,n){}removeEventListener(t,e,n){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,n,i){return e=Math.max(0,e||t.width),n=n||t.height,{width:e,height:Math.max(0,i?Math.floor(e/i):n)}}isAttached(t){return!0}updateConfig(t){}},si=class extends rn{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},Jn="$chartjs",eu={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},La=s=>s===null||s==="";Sl=ha?{passive:!0}:!1;an=new Map,Aa=0;ii=class extends rn{acquireContext(t,e){let n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(su(t,e),n):null}releaseContext(t){let e=t.canvas;if(!e[Jn])return!1;let n=e[Jn].initial;["height","width"].forEach(o=>{let r=n[o];et(r)?e.removeAttribute(o):e.setAttribute(o,r)});let i=n.style||{};return Object.keys(i).forEach(o=>{e.style[o]=i[o]}),e.width=e.width,delete e[Jn],!0}addEventListener(t,e,n){this.removeEventListener(t,e);let i=t.$proxies||(t.$proxies={}),r={attach:ru,detach:au,resize:du}[e]||hu;i[e]=r(t,e,n)}removeEventListener(t,e){let n=t.$proxies||(t.$proxies={}),i=n[e];if(!i)return;({attach:Co,detach:Co,resize:Co}[e]||iu)(t,e,i),n[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,n,i){return da(t,e,n,i)}isAttached(t){let e=t&&Un(t);return!!(e&&e.isConnected)}};Ot=class{constructor(){K(this,"x");K(this,"y");K(this,"active",!1);K(this,"options");K(this,"$animations")}tooltipPosition(t){let{x:e,y:n}=this.getProps(["x","y"],t);return{x:e,y:n}}hasValue(){return $e(this.x)&&$e(this.y)}getProps(t,e){let n=this.$animations;if(!e||!n)return this;let i={};return t.forEach(o=>{i[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),i}};K(Ot,"defaults",{}),K(Ot,"defaultRoutes");vu=s=>s==="left"?"right":s==="right"?"left":s,Ra=(s,t,e)=>t==="top"||t==="left"?s[t]+e:s[t]-e,Pa=(s,t)=>Math.min(t||s,s);Oe=class s extends Ot{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:n,_suggestedMax:i}=this;return t=Lt(t,Number.POSITIVE_INFINITY),e=Lt(e,Number.NEGATIVE_INFINITY),n=Lt(n,Number.POSITIVE_INFINITY),i=Lt(i,Number.NEGATIVE_INFINITY),{min:Lt(t,n),max:Lt(e,i),minDefined:gt(t),maxDefined:gt(e)}}getMinMax(t){let{min:e,max:n,minDefined:i,maxDefined:o}=this.getUserBounds(),r;if(i&&o)return{min:e,max:n};let a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;ln?n:e,n=i&&e>n?e:n,{min:Lt(e,Lt(n,e)),max:Lt(n,Lt(e,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ct(this.options.beforeUpdate,[this])}update(t,e,n){let{beginAtZero:i,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ia(this,o,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=a=o||n<=1||!this.isHorizontal()){this.labelRotation=i;return}let d=this._getLabelSizes(),h=d.widest.width,u=d.highest.height,f=vt(this.chart.width-h,0,this.maxWidth);a=t.offset?this.maxWidth/n:f/(n-1),h+6>a&&(a=f/(n-(t.offset?.5:1)),l=this.maxHeight-Js(t.grid)-e.padding-Fa(t.title,this.chart.options.font),c=Math.sqrt(h*h+u*u),r=Vn(Math.min(Math.asin(vt((d.highest.height+6)/a,-1,1)),Math.asin(vt(l/c,-1,1))-Math.asin(vt(u/c,-1,1)))),r=Math.max(i,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){ct(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ct(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:n,title:i,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){let l=Fa(i,e.options.font);if(a?(t.width=this.maxWidth,t.height=Js(o)+l):(t.height=this.maxHeight,t.width=Js(o)+l),n.display&&this.ticks.length){let{first:c,last:d,widest:h,highest:u}=this._getLabelSizes(),f=n.padding*2,g=Ht(this.labelRotation),p=Math.cos(g),b=Math.sin(g);if(a){let m=n.mirror?0:b*h.width+p*u.height;t.height=Math.min(this.maxHeight,t.height+m+f)}else{let m=n.mirror?0:p*h.width+b*u.height;t.width=Math.min(this.maxWidth,t.width+m+f)}this._calculatePadding(c,d,b,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,n,i){let{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){let d=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),u=0,f=0;l?c?(u=i*t.width,f=n*e.height):(u=n*t.height,f=i*e.width):o==="start"?f=e.width:o==="end"?u=t.width:o!=="inner"&&(u=t.width/2,f=e.width/2),this.paddingLeft=Math.max((u-d+r)*this.width/(this.width-d),0),this.paddingRight=Math.max((f-h+r)*this.width/(this.width-h),0)}else{let d=e.height/2,h=t.height/2;o==="start"?(d=0,h=t.height):o==="end"&&(d=e.height,h=0),this.paddingTop=d+r,this.paddingBottom=h+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ct(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,n;for(e=0,n=t.length;e({width:r[E]||0,height:a[E]||0});return{first:C(0),last:C(e-1),widest:C(x),highest:C(y),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return Gr(this._alignToPixels?we(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&ta*i?a/n:l/i:l*i0}_computeGridLineItems(t){let e=this.axis,n=this.chart,i=this.options,{grid:o,position:r,border:a}=i,l=o.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),u=Js(o),f=[],g=a.setContext(this.getContext()),p=g.display?g.width:0,b=p/2,m=function(P){return we(n,P,p)},v,_,k,S,x,y,C,E,D,w,M,L;if(r==="top")v=m(this.bottom),y=this.bottom-u,E=v-b,w=m(t.top)+b,L=t.bottom;else if(r==="bottom")v=m(this.top),w=t.top,L=m(t.bottom)-b,y=v+b,E=this.top+u;else if(r==="left")v=m(this.right),x=this.right-u,C=v-b,D=m(t.left)+b,M=t.right;else if(r==="right")v=m(this.left),D=t.left,M=m(t.right)-b,x=v+b,C=this.left+u;else if(e==="x"){if(r==="center")v=m((t.top+t.bottom)/2+.5);else if(st(r)){let P=Object.keys(r)[0],T=r[P];v=m(this.chart.scales[P].getPixelForValue(T))}w=t.top,L=t.bottom,y=v+b,E=y+u}else if(e==="y"){if(r==="center")v=m((t.left+t.right)/2);else if(st(r)){let P=Object.keys(r)[0],T=r[P];v=m(this.chart.scales[P].getPixelForValue(T))}x=v-b,C=x-u,D=t.left,M=t.right}let O=J(i.ticks.maxTicksLimit,h),V=Math.max(1,Math.ceil(h/O));for(_=0;_0&&(R-=Y/2);break}z={left:R,top:$,width:Y+A.width,height:j+A.height,color:V.backdropColor}}b.push({label:k,font:E,textOffset:M,options:{rotation:p,color:T,strokeColor:U,strokeWidth:F,textAlign:G,textBaseline:L,translation:[S,x],backdrop:z}})}return b}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-Ht(this.labelRotation))return t==="top"?"left":"right";let i="center";return e.align==="start"?i="left":e.align==="end"?i="right":e.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:n,mirror:i,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,l=r.widest.width,c,d;return e==="left"?i?(d=this.right+o,n==="near"?c="left":n==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,n==="near"?c="right":n==="center"?(c="center",d-=l/2):(c="left",d=this.left)):e==="right"?i?(d=this.left+o,n==="near"?c="right":n==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,n==="near"?c="left":n==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:n,top:i,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(n,i,o,r),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let i=this.ticks.findIndex(o=>o.value===t);return i>=0?e.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){let e=this.options.grid,n=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,r,a=(l,c,d)=>{!d.width||!d.color||(n.save(),n.lineWidth=d.width,n.strokeStyle=d.color,n.setLineDash(d.borderDash||[]),n.lineDashOffset=d.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(e.display)for(o=0,r=i.length;o{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",i=[],o,r;for(o=0,r=e.length;o{let o=n||this._getRegistryForType(i);n||o.isForType(i)||o===this.plugins&&i.id?this._exec(t,o,i):lt(i,r=>{let a=n||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,n){let i=In(t);ct(n["before"+i],[],n),e[t](n),ct(n["after"+i],[],n)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(i(e,n),t,"stop"),this._notify(i(n,e),t,"start")}};Na=new Map,Ml=new Set;tn=(s,t,e)=>{let n=he(t,e);n!==void 0&&s.add(n)},Ro=class{constructor(t){this._config=Vu(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Dl(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),El(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return qn(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return qn(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return qn(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,n=this.type;return qn(`${n}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let n=this._scopeCache,i=n.get(t);return(!i||e)&&(i=new Map,n.set(t,i)),i}getOptionScopes(t,e,n){let{options:i,type:o}=this,r=this._cachedScopes(t,n),a=r.get(e);if(a)return a;let l=new Set;e.forEach(d=>{t&&(l.add(t),d.forEach(h=>tn(l,t,h))),d.forEach(h=>tn(l,i,h)),d.forEach(h=>tn(l,ke[o]||{},h)),d.forEach(h=>tn(l,ut,h)),d.forEach(h=>tn(l,$n,h))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Ml.has(e)&&r.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,ke[e]||{},ut.datasets[e]||{},{type:e},ut,$n]}resolveNamedOptions(t,e,n,i=[""]){let o={$shared:!0},{resolver:r,subPrefixes:a}=Ba(this._resolverCache,t,i),l=r;if(Bu(r,e)){o.$shared=!1,n=ce(n)?n():n;let c=this.createResolver(t,n,a);l=Be(r,n,c)}for(let c of e)o[c]=l[c];return o}createResolver(t,e,n=[""],i){let{resolver:o}=Ba(this._resolverCache,t,n);return st(e)?Be(o,e,void 0,i):o}};Nu=s=>st(s)&&Object.getOwnPropertyNames(s).some(t=>ce(s[t]));$u="4.5.1",zu=["top","bottom","left","right","chartArea"];ti={},Wa=s=>{let t=Tl(s);return Object.values(ti).filter(e=>e.canvas===t).pop()};ie=class{static register(...t){Yt.add(...t),ja()}static unregister(...t){Yt.remove(...t),ja()}constructor(t,e){let n=this.config=new Ro(e),i=Tl(t),o=Wa(i);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let r=n.createResolver(n.chartOptionScopes(),this.getContext());this.platform=new(n.platform||wl(i)),this.platform.updateConfig(n);let a=this.platform.acquireContext(i,r.aspectRatio),l=a&&a.canvas,c=l&&l.height,d=l&&l.width;if(this.id=zr(),this.ctx=a,this.canvas=l,this.width=d,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new To,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Zr(h=>this.update(h),r.resizeDelay||0),this._dataChanges=[],ti[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}ne.listen(this,"complete",Ha),ne.listen(this,"progress",Hu),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:n,height:i,_aspectRatio:o}=this;return et(t)?e&&o?o:i?n/i:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Yt}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ao(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return to(this.canvas,this.ctx),this}stop(){return ne.stop(this),this}resize(t,e){ne.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let n=this.options,i=this.canvas,o=n.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(i,t,e,o),a=n.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,ao(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),ct(n.onResize,[this,r],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};lt(e,(n,i)=>{n.id=i})}buildOrUpdateScales(){let t=this.options,e=t.scales,n=this.scales,i=Object.keys(n).reduce((r,a)=>(r[a]=!1,r),{}),o=[];e&&(o=o.concat(Object.keys(e).map(r=>{let a=e[r],l=Ao(r,a),c=l==="r",d=l==="x";return{options:a,dposition:c?"chartArea":d?"bottom":"left",dtype:c?"radialLinear":d?"category":"linear"}}))),lt(o,r=>{let a=r.options,l=a.id,c=Ao(l,a),d=J(a.type,r.dtype);(a.position===void 0||$a(a.position,c)!==$a(r.dposition))&&(a.position=r.dposition),i[l]=!0;let h=null;if(l in n&&n[l].type===d)h=n[l];else{let u=Yt.getScale(d);h=new u({id:l,type:d,ctx:this.ctx,chart:this}),n[h.id]=h}h.init(a,t)}),lt(i,(r,a)=>{r||delete n[a]}),lt(n,r=>{kt.configure(this,r,r.options),kt.addBox(this,r)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,n=t.length;if(t.sort((i,o)=>i.index-o.index),n>e){for(let i=e;ie.length&&delete this._stacks,t.forEach((n,i)=>{e.filter(o=>o===n._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,n,i;for(this._removeUnreferencedMetasets(),n=0,i=e.length;n{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let n=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!n.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let c=0,d=this.data.datasets.length;c{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(za("z","_idx"));let{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){lt(this.scales,t=>{kt.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),n=new Set(t.events);(!zi(e,n)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:n,start:i,count:o}of e){let r=n==="_removeElements"?-o:o;Wu(t,i,r)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,n=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),i=n(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;kt.update(this,this.width,this.height,t);let e=this.chartArea,n=e.width<=0||e.height<=0;this._layers=[],lt(this.boxes,i=>{n&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,o)=>{i._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,n=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,n={meta:t,index:t.index,cancelable:!0},i=go(this,t);this.notifyPlugins("beforeDatasetDraw",n)!==!1&&(i&&Ks(e,i),t.controller.draw(),i&&qs(e),n.cancelable=!1,this.notifyPlugins("afterDatasetDraw",n))}isPointInArea(t){return Jt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,n,i){let o=xl.modes[e];return typeof o=="function"?o(this,t,n,i):[]}getDatasetMeta(t){let e=this.data.datasets[t],n=this._metasets,i=n.filter(o=>o&&o._dataset===e).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},n.push(i)),i}getContext(){return this.$context||(this.$context=ue(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let n=this.getDatasetMeta(t);return typeof n.hidden=="boolean"?!n.hidden:!e.hidden}setDatasetVisibility(t,e){let n=this.getDatasetMeta(t);n.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,n){let i=n?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,i);gs(e)?(o.data[e].hidden=!n,this.update()):(this.setDatasetVisibility(t,n),r.update(o,{visible:n}),this.update(a=>a.datasetIndex===t?i:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),ne.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},i=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};lt(this.options.events,o=>n(o,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,n=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},i=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)},r,a=()=>{i("attach",a),this.attached=!0,this.resize(),n("resize",o),n("detach",r)};r=()=>{this.attached=!1,i("resize",o),this._stop(),this._resize(0,0),n("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){lt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},lt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,n){let i=n?"set":"remove",o,r,a,l;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+i+"DatasetHoverStyle"]()),a=0,l=t.length;a{let a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Gs(n,e)&&(this._active=n,this._lastEvent=null,this._updateHoverStyles(n,e))}notifyPlugins(t,e,n){return this._plugins.notify(this,t,e,n)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,n){let i=this.options.hover,o=(l,c)=>l.filter(d=>!c.some(h=>d.datasetIndex===h.datasetIndex&&d.index===h.index)),r=o(e,t),a=n?t:o(t,e);r.length&&this.updateHoverStyle(r,i.mode,!1),a.length&&i.mode&&this.updateHoverStyle(a,i.mode,!0)}_eventHandler(t,e){let n={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},i=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",n,i)===!1)return;let o=this._handleEvent(t,e,n.inChartArea);return n.cancelable=!1,this.notifyPlugins("afterEvent",n,i),(o||n.changed)&&this.render(),this}_handleEvent(t,e,n){let{_active:i=[],options:o}=this,r=e,a=this._getActiveElements(t,i,n,r),l=jr(t),c=ju(t,this._lastEvent,n,l);n&&(this._lastEvent=null,ct(o.onHover,[t,a,this],this),l&&ct(o.onClick,[t,a,this],this));let d=!Gs(a,i);return(d||e)&&(this._active=a,this._updateHoverStyles(a,i,e)),this._lastEvent=c,d}_getActiveElements(t,e,n,i){if(t.type==="mouseout")return[];if(!n)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,i)}};K(ie,"defaults",ut),K(ie,"instances",ti),K(ie,"overrides",ke),K(ie,"registry",Yt),K(ie,"version",$u),K(ie,"getChart",Wa);Te=class extends Ot{constructor(e){super();K(this,"circumference");K(this,"endAngle");K(this,"fullCircles");K(this,"innerRadius");K(this,"outerRadius");K(this,"pixelMargin");K(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,n,i){let o=this.getProps(["x","y"],i),{angle:r,distance:a}=Ui(o,{x:e,y:n}),{startAngle:l,endAngle:c,innerRadius:d,outerRadius:h,circumference:u}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),f=(this.options.spacing+this.options.borderWidth)/2,g=J(u,c-l),p=ms(r,l,c)&&l!==c,b=g>=ht||p,m=ee(a,d+f,h+f);return b&&m}getCenterPoint(e){let{x:n,y:i,startAngle:o,endAngle:r,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:c,spacing:d}=this.options,h=(o+r)/2,u=(a+l+d+c)/2;return{x:n+Math.cos(h)*u,y:i+Math.sin(h)*u}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:n,circumference:i}=this,o=(n.offset||0)/4,r=(n.spacing||0)/2,a=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=i>ht?Math.floor(i/ht):0,i===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*o,Math.sin(l)*o);let c=1-Math.sin(Math.min(it,i||0)),d=o*c;e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,qu(e,this,d,r,a),Xu(e,this,d,r,a),e.restore()}};K(Te,"id","arc"),K(Te,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),K(Te,"defaultRoutes",{backgroundColor:"backgroundColor"}),K(Te,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});of=typeof Path2D=="function";Gt=class extends Ot{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let n=this.options;if((n.tension||n.cubicInterpolationMode==="monotone")&&!n.stepped&&!this._pointsUpdated){let i=n.spanGaps?this._loop:this._fullLoop;ca(this._points,n,t,i,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=pa(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,n=t.length;return n&&e[t[n-1].end]}interpolate(t,e){let n=this.options,i=t[e],o=this.points,r=fo(this,{property:e,start:i,end:i});if(!r.length)return;let a=[],l=ef(n),c,d;for(c=0,d=r.length;ct!=="borderDash"&&t!=="fill"});qe=class extends Ot{constructor(e){super();K(this,"parsed");K(this,"skip");K(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,n,i){let o=this.options,{x:r,y:a}=this.getProps(["x","y"],i);return Math.pow(e-r,2)+Math.pow(n-a,2)s.replace("rgb(","rgba(").replace(")",", 0.5)"));Il={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(s,t,e){if(!e.enabled)return;let{data:{datasets:n},options:i}=s.config,{elements:o}=i,r=Ga(n)||mf(i)||o&&Ga(o)||bf();if(!e.forceOverride&&r)return;let a=pf(s);n.forEach(a)}};Nl={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(s,t,e)=>{if(!e.enabled){Ka(s);return}let n=s.width;s.data.datasets.forEach((i,o)=>{let{_data:r,indexAxis:a}=i,l=s.getDatasetMeta(o),c=r||i.data;if(xs([a,s.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let d=s.scales[l.xAxisID];if(d.type!=="linear"&&d.type!=="time"||s.options.parsing)return;let{start:h,count:u}=xf(l,c),f=e.threshold||4*n;if(u<=f){Vl(i);return}et(r)&&(i._data=c,delete i.data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let g;switch(e.algorithm){case"lttb":g=vf(c,h,u,n,e);break;case"min-max":g=yf(c,h,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}i._decimated=g})},destroy(s){Ka(s)}};ri=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,n){let{x:i,y:o,radius:r}=this;return e=e||{start:0,end:ht},t.arc(i,o,r,e.end,e.start,!0),!n.bounds}interpolate(t){let{x:e,y:n,radius:i}=this,o=t.angle;return{x:e+Math.cos(o)*i,y:n+Math.sin(o)*i,angle:o}}};$l={id:"filler",afterDatasetsUpdate(s,t,e){let n=(s.data.datasets||[]).length,i=[],o,r,a,l;for(r=0;r=0;--r){let a=i[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),n&&a.fill&&ko(s.ctx,a,o))}},beforeDatasetsDraw(s,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let n=s.getSortedVisibleDatasetMetas();for(let i=n.length-1;i>=0;--i){let o=n[i].$filler;Xa(o)&&ko(s.ctx,o,s.chartArea)}},beforeDatasetDraw(s,t,e){let n=t.meta.$filler;!Xa(n)||e.drawTime!=="beforeDatasetDraw"||ko(s.ctx,n,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},tl=(s,t)=>{let{boxHeight:e=t,boxWidth:n=t}=s;return s.usePointStyle&&(e=Math.min(e,t),n=s.pointStyleWidth||Math.min(n,t)),{boxWidth:n,boxHeight:e,itemHeight:Math.max(t,e)}},$f=(s,t)=>s!==null&&t!==null&&s.datasetIndex===t.datasetIndex&&s.index===t.index,ai=class extends Ot{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,n){this.maxWidth=t,this.maxHeight=e,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=ct(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(n=>t.filter(n,this.chart.data))),t.sort&&(e=e.sort((n,i)=>t.sort(n,i,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let n=t.labels,i=bt(n.font),o=i.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=tl(n,o),c,d;e.font=i.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(r,o,a,l)+10):(d=this.maxHeight,c=this._fitCols(r,i,a,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(d,t.maxHeight||this.maxHeight)}_fitRows(t,e,n,i){let{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=i+a,h=t;o.textAlign="left",o.textBaseline="middle";let u=-1,f=-d;return this.legendItems.forEach((g,p)=>{let b=n+e/2+o.measureText(g.text).width;(p===0||c[c.length-1]+b+2*a>r)&&(h+=d,c[c.length-(p>0?0:1)]=0,f+=d,u++),l[p]={left:0,top:f,row:u,width:b,height:i},c[c.length-1]+=b+a}),h}_fitCols(t,e,n,i){let{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=r-t,h=a,u=0,f=0,g=0,p=0;return this.legendItems.forEach((b,m)=>{let{itemWidth:v,itemHeight:_}=zf(n,e,o,b,i);m>0&&f+_+2*a>d&&(h+=u+a,c.push({width:u,height:f}),g+=u+a,p++,u=f=0),l[m]={left:g,top:f,col:p,width:v,height:_},u=Math.max(u,v),f+=_+a}),h+=u,c.push({width:u,height:f}),h}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:n,labels:{padding:i},rtl:o}}=this,r=ze(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=_t(n,this.left+i,this.right-this.lineWidths[a]);for(let c of e)a!==c.row&&(a=c.row,l=_t(n,this.left+i,this.right-this.lineWidths[a])),c.top+=this.top+t+i,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+i}else{let a=0,l=_t(n,this.top+t+i,this.bottom-this.columnSizes[a].height);for(let c of e)c.col!==a&&(a=c.col,l=_t(n,this.top+t+i,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+i,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;Ks(t,this),this._draw(),qs(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:n,ctx:i}=this,{align:o,labels:r}=t,a=ut.color,l=ze(t.rtl,this.left,this.width),c=bt(r.font),{padding:d}=r,h=c.size,u=h/2,f;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=c.string;let{boxWidth:g,boxHeight:p,itemHeight:b}=tl(r,h),m=function(x,y,C){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;i.save();let E=J(C.lineWidth,1);if(i.fillStyle=J(C.fillStyle,a),i.lineCap=J(C.lineCap,"butt"),i.lineDashOffset=J(C.lineDashOffset,0),i.lineJoin=J(C.lineJoin,"miter"),i.lineWidth=E,i.strokeStyle=J(C.strokeStyle,a),i.setLineDash(J(C.lineDash,[])),r.usePointStyle){let D={radius:p*Math.SQRT2/2,pointStyle:C.pointStyle,rotation:C.rotation,borderWidth:E},w=l.xPlus(x,g/2),M=y+u;eo(i,D,w,M,r.pointStyleWidth&&g)}else{let D=y+Math.max((h-p)/2,0),w=l.leftForLtr(x,g),M=De(C.borderRadius);i.beginPath(),Object.values(M).some(L=>L!==0)?ys(i,{x:w,y:D,w:g,h:p,radius:M}):i.rect(w,D,g,p),i.fill(),E!==0&&i.stroke()}i.restore()},v=function(x,y,C){Ee(i,C.text,x,y+b/2,c,{strikethrough:C.hidden,textAlign:l.textAlign(C.textAlign)})},_=this.isHorizontal(),k=this._computeTitleHeight();_?f={x:_t(o,this.left+d,this.right-n[0]),y:this.top+d+k,line:0}:f={x:this.left+d,y:_t(o,this.top+k+d,this.bottom-e[0].height),line:0},co(this.ctx,t.textDirection);let S=b+d;this.legendItems.forEach((x,y)=>{i.strokeStyle=x.fontColor,i.fillStyle=x.fontColor;let C=i.measureText(x.text).width,E=l.textAlign(x.textAlign||(x.textAlign=r.textAlign)),D=g+u+C,w=f.x,M=f.y;l.setWidth(this.width),_?y>0&&w+D+d>this.right&&(M=f.y+=S,f.line++,w=f.x=_t(o,this.left+d,this.right-n[f.line])):y>0&&M+S>this.bottom&&(w=f.x=w+e[f.line].width+d,f.line++,M=f.y=_t(o,this.top+k+d,this.bottom-e[f.line].height));let L=l.x(w);if(m(L,M,x),w=Jr(E,w+g+u,_?w+D:this.right,t.rtl),v(l.x(w),M,x),_)f.x+=D+d;else if(typeof x.text!="string"){let O=c.lineHeight;f.y+=zl(x,O)+d}else f.y+=S}),ho(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,n=bt(e.font),i=St(e.padding);if(!e.display)return;let o=ze(t.rtl,this.left,this.width),r=this.ctx,a=e.position,l=n.size/2,c=i.top+l,d,h=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),d=this.top+c,h=_t(t.align,h,this.right-u);else{let g=this.columnSizes.reduce((p,b)=>Math.max(p,b.height),0);d=c+_t(t.align,this.top,this.bottom-g-t.labels.padding-this._computeTitleHeight())}let f=_t(a,h,h+u);r.textAlign=o.textAlign(Bn(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=n.string,Ee(r,e.text,f,d,n)}_computeTitleHeight(){let t=this.options.title,e=bt(t.font),n=St(t.padding);return t.display?e.lineHeight+n.height:0}_getLegendItemAt(t,e){let n,i,o;if(ee(t,this.left,this.right)&&ee(e,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;ns.chart.options.color,boxWidth:40,padding:10,generateLabels(s){let t=s.data.datasets,{labels:{usePointStyle:e,pointStyle:n,textAlign:i,color:o,useBorderRadius:r,borderRadius:a}}=s.legend.options;return s._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(e?0:void 0),d=St(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}},ln=class extends Ot{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){let n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let i=dt(n.text)?n.text.length:1;this._padding=St(n.padding);let o=i*bt(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:n,bottom:i,right:o,options:r}=this,a=r.align,l=0,c,d,h;return this.isHorizontal()?(d=_t(a,n,o),h=e+t,c=o-n):(r.position==="left"?(d=n+t,h=_t(a,i,e),l=it*-.5):(d=o-t,h=_t(a,e,i),l=it*.5),c=i-e),{titleX:d,titleY:h,maxWidth:c,rotation:l}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let n=bt(e.font),o=n.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);Ee(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:c,textAlign:Bn(e.align),textBaseline:"middle",translation:[r,a]})}};Wl={id:"title",_element:ln,start(s,t,e){Uf(s,e)},stop(s){let t=s.titleBlock;kt.removeBox(s,t),delete s.titleBlock},beforeUpdate(s,t,e){let n=s.titleBlock;kt.configure(s,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Xn=new WeakMap,jl={id:"subtitle",start(s,t,e){let n=new ln({ctx:s.ctx,options:e,chart:s});kt.configure(s,n,e),kt.addBox(s,n),Xn.set(s,n)},stop(s){kt.removeBox(s,Xn.get(s)),Xn.delete(s)},beforeUpdate(s,t,e){let n=Xn.get(s);kt.configure(s,n,e),n.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},sn={average(s){if(!s.length)return!1;let t,e,n=new Set,i=0,o=0;for(t=0,e=s.length;ta+l)/n.size,y:i/o}},nearest(s,t){if(!s.length)return!1;let e=t.x,n=t.y,i=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=s.length;o0){let t=s[0],e=t.chart.data.labels,n=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(n>0&&t.dataIndex{let r={before:[],lines:[],after:[]},a=ol(n,o);se(r.before,fe(At(a,"beforeLabel",this,o))),se(r.lines,At(a,"label",this,o)),se(r.after,fe(At(a,"afterLabel",this,o))),i.push(r)}),i}getAfterBody(t,e){return il(At(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:n}=e,i=At(n,"beforeFooter",this,t),o=At(n,"footer",this,t),r=At(n,"afterFooter",this,t),a=[];return a=se(a,fe(i)),a=se(a,fe(o)),a=se(a,fe(r)),a}_createItems(t){let e=this._active,n=this.chart.data,i=[],o=[],r=[],a=[],l,c;for(l=0,c=e.length;lt.filter(d,h,u,n))),t.itemSort&&(a=a.sort((d,h)=>t.itemSort(d,h,n))),lt(a,d=>{let h=ol(t.callbacks,d);i.push(At(h,"labelColor",this,d)),o.push(At(h,"labelPointStyle",this,d)),r.push(At(h,"labelTextColor",this,d))}),this.labelColors=i,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){let n=this.options.setContext(this.getContext()),i=this._active,o,r=[];if(!i.length)this.opacity!==0&&(o={opacity:0});else{let a=sn[n.position].call(this,i,this._eventPosition);r=this._createItems(n),this.title=this.getTitle(r,n),this.beforeBody=this.getBeforeBody(r,n),this.body=this.getBody(r,n),this.afterBody=this.getAfterBody(r,n),this.footer=this.getFooter(r,n);let l=this._size=el(this,n),c=Object.assign({},a,l),d=sl(this.chart,n,c),h=nl(n,c,d,this.chart);this.xAlign=d.xAlign,this.yAlign=d.yAlign,o={opacity:1,x:h.x,y:h.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&n.external&&n.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,n,i){let o=this.getCaretPosition(t,n,i);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,n){let{xAlign:i,yAlign:o}=this,{caretSize:r,cornerRadius:a}=n,{topLeft:l,topRight:c,bottomLeft:d,bottomRight:h}=De(a),{x:u,y:f}=t,{width:g,height:p}=e,b,m,v,_,k,S;return o==="center"?(k=f+p/2,i==="left"?(b=u,m=b-r,_=k+r,S=k-r):(b=u+g,m=b+r,_=k-r,S=k+r),v=b):(i==="left"?m=u+Math.max(l,d)+r:i==="right"?m=u+g-Math.max(c,h)-r:m=this.caretX,o==="top"?(_=f,k=_-r,b=m-r,v=m+r):(_=f+p,k=_+r,b=m+r,v=m-r),S=_),{x1:b,x2:m,x3:v,y1:_,y2:k,y3:S}}drawTitle(t,e,n){let i=this.title,o=i.length,r,a,l;if(o){let c=ze(n.rtl,this.x,this.width);for(t.x=Qn(this,n.titleAlign,n),e.textAlign=c.textAlign(n.titleAlign),e.textBaseline="middle",r=bt(n.titleFont),a=n.titleSpacing,e.fillStyle=n.titleColor,e.font=r.string,l=0;lv!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ys(t,{x:p,y:g,w:c,h:l,radius:m}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),ys(t,{x:b,y:g+1,w:c-2,h:l-2,radius:m}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,g,c,l),t.strokeRect(p,g,c,l),t.fillStyle=r.backgroundColor,t.fillRect(b,g+1,c-2,l-2))}t.fillStyle=this.labelTextColors[n]}drawBody(t,e,n){let{body:i}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:d}=n,h=bt(n.bodyFont),u=h.lineHeight,f=0,g=ze(n.rtl,this.x,this.width),p=function(C){e.fillText(C,g.x(t.x+f),t.y+u/2),t.y+=u+o},b=g.textAlign(r),m,v,_,k,S,x,y;for(e.textAlign=r,e.textBaseline="middle",e.font=h.string,t.x=Qn(this,b,n),e.fillStyle=n.bodyColor,lt(this.beforeBody,p),f=a&&b!=="right"?r==="center"?c/2+d:c+2+d:0,k=0,x=i.length;k0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,n=this.$animations,i=n&&n.x,o=n&&n.y;if(i||o){let r=sn[t.position].call(this,this._active,this._eventPosition);if(!r)return;let a=this._size=el(this,t),l=Object.assign({},r,this._size),c=sl(e,t,l),d=nl(t,l,c,e);(i._to!==d.x||o._to!==d.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,d))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),n=this.opacity;if(!n)return;this._updateAnimationTarget(e);let i={width:this.width,height:this.height},o={x:this.x,y:this.y};n=Math.abs(n)<.001?0:n;let r=St(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=n,this.drawBackground(o,t,i,e),co(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),ho(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let n=this._active,i=t.map(({datasetIndex:a,index:l})=>{let c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),o=!Gs(n,i),r=this._positionChanged(i,e);(o||r)&&(this._active=i,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,n=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let i=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,n),a=this._positionChanged(r,t),l=e||!Gs(r,o)||a;return l&&(this._active=r,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),l}_getActiveElements(t,e,n,i){let o=this.options;if(t.type==="mouseout")return[];if(!i)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);let r=this.chart.getElementsAtEventForMode(t,o.mode,o,n);return o.reverse&&r.reverse(),r}_positionChanged(t,e){let{caretX:n,caretY:i,options:o}=this,r=sn[o.position].call(this,t,e);return r!==!1&&(n!==r.x||i!==r.y)}};K(nn,"positioners",sn);Yl={id:"tooltip",_element:nn,positioners:sn,afterInit(s,t,e){e&&(s.tooltip=new nn({chart:s,options:e}))},beforeUpdate(s,t,e){s.tooltip&&s.tooltip.initialize(e)},reset(s,t,e){s.tooltip&&s.tooltip.initialize(e)},afterDraw(s){let t=s.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(s.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",e)}},afterEvent(s,t){if(s.tooltip){let e=t.replay;s.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(s,t)=>t.bodyFont.size,boxWidth:(s,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Ul},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Gl=Object.freeze({__proto__:null,Colors:Il,Decimation:Nl,Filler:$l,Legend:Hl,SubTitle:jl,Title:Wl,Tooltip:Yl}),Jf=(s,t,e,n)=>(typeof t=="string"?(e=s.push(t)-1,n.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);eg=(s,t)=>s===null?null:vt(Math.round(s),0,t);ks=class extends Oe{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let n=this.getLabels();for(let{index:i,label:o}of e)n[i]===o&&n.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(et(t))return null;let n=this.getLabels();return e=isFinite(e)&&n[e]===t?e:tg(n,t,J(e,t),this._addedLabels),eg(e,n.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:n,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(n=0),e||(i=this.getLabels().length-1)),this.min=n,this.max=i}buildTicks(){let t=this.min,e=this.max,n=this.options.offset,i=[],o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(n?0:1),1),this._startValue=this.min-(n?.5:0);for(let r=t;r<=e;r++)i.push({value:r});return i}getLabelForValue(t){return rl.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};K(ks,"id","category"),K(ks,"defaults",{ticks:{callback:rl}});Ms=class extends Oe{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return et(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:n}=this.getUserBounds(),{min:i,max:o}=this,r=l=>i=e?i:l,a=l=>o=n?o:l;if(t){let l=Ut(i),c=Ut(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(i===o){let l=o===0?1:Math.abs(o*.05);a(o+l),t||r(i-l)}this.min=i,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:n}=t,i;return n?(i=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),e=e||11),e&&(i=Math.min(e,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,n=this.getTickLimit();n=Math.max(2,n);let i={maxTicks:n,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=sg(i,o);return t.bounds==="ticks"&&Wi(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let t=this.ticks,e=this.min,n=this.max;if(super.configure(),this.options.offset&&t.length){let i=(n-e)/Math.max(t.length-1,1)/2;e-=i,n+=i}this._startValue=e,this._endValue=n,this._valueRange=n-e}getLabelForValue(t){return bs(t,this.chart.options.locale,this.options.ticks.format)}},ws=class extends Ms{determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=gt(t)?t:0,this.max=gt(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,n=Ht(this.options.ticks.minRotation),i=(t?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/i))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}};K(ws,"id","linear"),K(ws,"defaults",{ticks:{callback:vs.formatters.numeric}});cn=s=>Math.floor(de(s)),We=(s,t)=>Math.pow(10,cn(s)+t);Es=class extends Oe{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let n=Ms.prototype.parse.apply(this,[t,e]);if(n===0){this._zero=!0;return}return gt(n)&&n>0?n:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=gt(t)?Math.max(0,t):null,this.max=gt(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!gt(this._userMin)&&(this.min=t===We(this.min,0)?We(this.min,-1):We(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),n=this.min,i=this.max,o=a=>n=t?n:a,r=a=>i=e?i:a;n===i&&(n<=0?(o(1),r(10)):(o(We(n,-1)),r(We(i,1)))),n<=0&&o(We(i,-1)),i<=0&&r(We(n,1)),this.min=n,this.max=i}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},n=ig(e,this);return t.bounds==="ticks"&&Wi(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(t){return t===void 0?"0":bs(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=de(t),this._valueRange=de(this.max)-de(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(de(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};K(Es,"id","logarithmic"),K(Es,"defaults",{ticks:{callback:vs.formatters.logarithmic,major:{enabled:!0}}});Le=class extends Ms{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=St(Io(this.options)/2),e=this.width=this.maxWidth-t.width,n=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+n/2+t.top),this.drawingArea=Math.floor(Math.min(e,n)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=gt(t)&&!isNaN(t)?t:0,this.max=gt(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Io(this.options))}generateTickLabels(t){Ms.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,n)=>{let i=ct(this.options.pointLabels.callback,[e,n],this);return i||i===0?i:""}).filter((e,n)=>this.chart.getDataVisibility(n))}fit(){let t=this.options;t.display&&t.pointLabels.display?rg(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,n,i){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((n-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,n,i))}getIndexAngle(t){let e=ht/(this._pointLabels.length||1),n=this.options.startAngle||0;return Ct(t*e+Ht(n))}getDistanceFromCenterForValue(t){if(et(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(et(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t{if(h!==0||h===0&&this.min<0){l=this.getDistanceFromCenterForValue(d.value);let u=this.getContext(h),f=i.setContext(u),g=o.setContext(u);mg(this,f,l,r,g)}}),n.display){for(t.save(),a=r-1;a>=0;a--){let d=n.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:u}=d;!u||!h||(t.lineWidth=u,t.strokeStyle=h,t.setLineDash(d.borderDash),t.lineDashOffset=d.borderDashOffset,l=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),c=this.getPointPosition(a,l),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(c.x,c.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,n=e.ticks;if(!n.display)return;let i=this.getIndexAngle(0),o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(i),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!e.reverse)return;let c=n.setContext(this.getContext(l)),d=bt(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){t.font=d.string,r=t.measureText(a.label).width,t.fillStyle=c.backdropColor;let h=St(c.backdropPadding);t.fillRect(-r/2-h.left,-o-d.size/2-h.top,r+h.width,d.size+h.height)}Ee(t,a.label,0,-o,d,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),t.restore()}drawTitle(){}};K(Le,"id","radialLinear"),K(Le,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:vs.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),K(Le,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),K(Le,"descriptors",{angleLines:{_fallback:"grid"}});ci={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Pt=Object.keys(ci);Pe=class extends Oe{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){let n=t.time||(t.time={}),i=this._adapter=new yl._date(t.adapters.date);i.init(e),fs(n.displayFormats,i.formats()),this._parseOpts={parser:n.parser,round:n.round,isoWeekday:n.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:ul(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,n=t.time.unit||"day",{min:i,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function l(c){!r&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!a&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!r||!a)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=gt(i)&&!isNaN(i)?i:+e.startOf(Date.now(),n),o=gt(o)&&!isNaN(o)?o:+e.endOf(Date.now(),n)+1,this.min=Math.min(i,o-1),this.max=Math.max(i+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],n=t[t.length-1]),{min:e,max:n}}buildTicks(){let t=this.options,e=t.time,n=t.ticks,i=n.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);let o=this.min,r=this.max,a=qr(i,o,r);return this._unit=e.unit||(n.autoSkip?fl(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):vg(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!n.major.enabled||this._unit==="year"?void 0:yg(this._unit),this.initOffsets(i),t.reverse&&a.reverse(),pl(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,n=0,i,o;this.options.offset&&t.length&&(i=this.getDecimalForValue(t[0]),t.length===1?e=1-i:e=(this.getDecimalForValue(t[1])-i)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?n=o:n=(o-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;e=vt(e,0,r),n=vt(n,0,r),this._offsets={start:e,end:n,factor:1/(e+1+n)}}_generate(){let t=this._adapter,e=this.min,n=this.max,i=this.options,o=i.time,r=o.unit||fl(o.minUnit,e,n,this._getLabelCapacity(e)),a=J(i.ticks.stepSize,1),l=r==="week"?o.isoWeekday:!1,c=$e(l)||l===!0,d={},h=e,u,f;if(c&&(h=+t.startOf(h,"isoWeek",l)),h=+t.startOf(h,c?"day":r),t.diff(n,e,r)>1e5*a)throw new Error(e+" and "+n+" are too far apart with stepSize of "+a+" "+r);let g=i.ticks.source==="data"&&this.getDataTimestamps();for(u=h,f=0;u+p)}getLabelForValue(t){let e=this._adapter,n=this.options.time;return n.tooltipFormat?e.format(t,n.tooltipFormat):e.format(t,n.displayFormats.datetime)}format(t,e){let i=this.options.time.displayFormats,o=this._unit,r=e||i[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,n,i){let o=this.options,r=o.ticks.callback;if(r)return ct(r,[t,e,n],this);let a=o.time.displayFormats,l=this._unit,c=this._majorUnit,d=l&&a[l],h=c&&a[c],u=n[e],f=c&&h&&u&&u.major;return this._adapter.format(t,i||(f?h:d))}generateTickLabels(t){let e,n,i;for(e=0,n=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,n;if(t.length)return t;let i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(e=0,n=i.length;e=e&&c<=n&&i.push(c);if(i.length<2)return[{time:e,pos:0},{time:n,pos:1}];for(r=0,a=i.length;ri-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),n=this.getLabelTimestamps();return e.length&&n.length?t=this.normalize(e.concat(n)):t=e.length?e:n,t=this._cache.all=t,t}getDecimalForValue(t){return(Zn(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,n=this.getDecimalForPixel(t)/e.factor-e.end;return Zn(this._table,n*this._tableRange+this._minPos,!0)}};K(Ds,"id","timeseries"),K(Ds,"defaults",Pe.defaults);ql=Object.freeze({__proto__:null,CategoryScale:ks,LinearScale:ws,LogarithmicScale:Es,RadialLinearScale:Le,TimeScale:Pe,TimeSeriesScale:Ds}),Cg=[vl,Pl,Gl,ql]});var Kg={};Xo(Kg,{CardView:()=>As,default:()=>xi});module.exports=Tc(Kg);var ot=require("obsidian"),Cc=Os(ts());var Lc=["AT","BE","CZ","DK","EE","FI","FR","DE","GR","HU","IS","IT","LV","LI","LT","LU","MT","NL","NO","PL","PT","SK","SI","ES","SE","CH"],Ac=[{label:"\u{1F1EA}\u{1F1FA} Schengen 90/180 (example)",scope:{countries:Lc},window:{type:"rolling",days:180},threshold:90,note:"Example rule \u2014 add your own in Settings \u2192 CSV Card View."}],wi={defaultMode:"kanban-genre",notesColumns:["notes","note","Notes","Note","description","Description","review","Review"],statusColumn:"status",categoryColumn:"category",notesSubfolder:"Notes",columnWidths:{},selectColumns:["Category","Type","Rating","Status","rating","type","category","status","Score /5"],fileConfigs:{},residencyRules:Ac,showResidency:!0},fn="xlsx-card-view";var Zo=Os(ts()),gn=require("obsidian"),es=["Image","image","Cover","cover","Poster","poster","Thumbnail","thumbnail","Thumb","thumb","Photo","photo","Picture","picture","Img","img"],ge=["Title","title","Name","name"],ss=["Category","category","Categories","categories","Genre","genre","Genres","genres","Type","type","Types","types","Tag","tag","Tags","tags","Topic","topic","Topics","topics","Subject","subject","Section","section"],ns=["Status","status","State","state","Progress","progress","Stage","stage","Read","read","Watched","watched","Seen","seen","Done","done","Completed","completed"],pe=["Notes","notes","Note","note","Summary","summary","Review","review","Quote","quote","Quotes","quotes","Comment","comment","Comments","comments","Description","description","Annotation","annotation"];function pn(s,t,e){let n=(t!=null?t:"").trim();if(!n)return null;if(/^(https?:|data:)/i.test(n))return n;let i=n.match(/!?\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/);if(i)n=i[1].trim();else{let r=n.match(/!\[[^\]]*\]\(([^)]+)\)/);r&&(n=r[1].trim())}if(/^(https?:|data:)/i.test(n))return n;let o=s.metadataCache.getFirstLinkpathDest(n,e);return o instanceof gn.TFile?s.vault.getResourcePath(o):null}var Rc=15;function Xt(s){return s>=1&&s<=Rc}var Pc=["0","1","true","false","yes","no",""];function is(s){return s.length>0&&s.every(t=>Pc.includes(t))}function os(s){let t=(s!=null?s:"").toLowerCase().trim();return t==="1"||t==="true"||t==="yes"}function me(s=new Date){return`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`}function Ie(s){return s.replace(/[\\/:*?"<>|#^[\]]/g,"").replace(/\s+/g," ").trim().slice(0,100)}function Jo(s){return s.toLowerCase().replace(/[^\p{L}\p{N}/_-]+/gu,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function wt(s){var i,o;if(!s||!s.trim())return{headers:[],rows:[]};let t=Zo.default.parse(s,{header:!0,skipEmptyLines:!0}),e=((i=t.meta.fields)!=null?i:[]).map(String),n=((o=t.data)!=null?o:[]).map(r=>{let a={};return e.forEach(l=>{a[l]=r[l]!=null?String(r[l]):""}),a});return{headers:e,rows:n}}function Qt(s,t){if(!s)return s;let e=s.startsWith("./")||s.startsWith("../")||s==="."||s==="..";if(!e&&s.includes("/"))return s;if(!e)return t?`${t}/${s}`:s;let n=t?t.split("/").filter(Boolean):[];for(let i of s.split("/"))if(!(i===""||i===".")){if(i===".."){n.pop();continue}n.push(i)}return n.join("/")}function tr(s,t,e){let n=e==="asc"?1:-1;return[...s].sort((i,o)=>{var u,f;let r=((u=i[t])!=null?u:"").trim(),a=((f=o[t])!=null?f:"").trim();if(!r&&!a)return 0;if(!r)return 1;if(!a)return-1;let l=parseFloat(r),c=parseFloat(a);return(!isNaN(l)&&!isNaN(c)&&/^-?[\d.]/.test(r)&&/^-?[\d.]/.test(a)?l-c:r.localeCompare(a,void 0,{numeric:!0,sensitivity:"base"}))*n})}function Tt(s){return s.split(/[\s_-]+/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}function er(s,t){let e=(s!=null?s:"").trim();if(!e||e.toLowerCase()==="unrated"||e==="\u2014"||e==="-")return"";if(/[★⭐☆]/.test(e))return e;if(/^\d+$/.test(e)){let o=parseInt(e,10);if(o>=1&&o<=5)return"\u2605".repeat(o)}let i=Oc(e,t);return i&&i!==e&&i!=="\u2014"?i:""}function Oc(s,t){var o;let e=t.toLowerCase();if(!["rating","score","score /5"].includes(e))return s;let n=s.toLowerCase().trim();return(o={excellent:"\u2605\u2605\u2605\u2605\u2605",great:"\u2605\u2605\u2605\u2605\u2605",good:"\u2605\u2605\u2605\u2605\u2606",fair:"\u2605\u2605\u2605\u2606\u2606",poor:"\u2605\u2605\u2606\u2606\u2606",bad:"\u2605\u2606\u2606\u2606\u2606",5:"\u2605\u2605\u2605\u2605\u2605",4:"\u2605\u2605\u2605\u2605\u2606",3:"\u2605\u2605\u2605\u2606\u2606",2:"\u2605\u2605\u2606\u2606\u2606",1:"\u2605\u2606\u2606\u2606\u2606",0:"\u2606\u2606\u2606\u2606\u2606",unrated:"\u2014","":"\u2014"}[n])!=null?o:s}function sr(s,t){if(/^(year|released|decade)$/i.test((s!=null?s:"").trim()))return!0;let e=t.map(i=>(i!=null?i:"").trim()).filter(Boolean);return e.length<3?!1:e.filter(i=>/^(1[89]|20)\d{2}$/.test(i)).length/e.length>=.8}function nr(s){let t=(s!=null?s:"").match(/\b(1[89]\d{2}|20\d{2})\b/);return t?`${Math.floor(parseInt(t[1],10)/10)*10}s`:null}function ir(s,t,e){var r;if(!t.length)return null;let n=Math.max(12,t.length/3),i=null,o=1/0;for(let a of s){if(e.has(a))continue;let l=new Set;for(let d of t)((r=d[a])!=null?r:"").split(",").forEach(h=>{let u=h.trim();u&&l.add(u)});if(l.size<2||l.size>n)continue;let c=Math.abs(Math.log(l.size/8));cw.remove());let r=document.body.createDiv({cls:"csv-select-picker"});r.style.position="fixed",r.style.zIndex="9999";let a=()=>{let w=s.getBoundingClientRect(),M=r.offsetHeight||280,L=w.bottom+4+M>window.innerHeight&&w.top-4-M>0;r.style.left=w.left+"px",r.style.top=L?w.top-4-M+"px":w.bottom+4+"px"};a();let l=w=>{!r.contains(w.target)&&w.target!==s&&d()},c=w=>{r.contains(w.target)||d()},d=()=>{r.remove(),document.removeEventListener("mousedown",l),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",d)},h=r.createEl("input",{cls:"csv-picker-search",type:"text",placeholder:"Search or add\u2026"});h.focus();let u=r.createDiv({cls:"csv-picker-list"}),f=!!(o!=null&&o.multi),g=w=>w.split(",").map(M=>M.trim()).filter(Boolean),p=new Set(f?g(t):[]),b=()=>n([...p].join(", ")),m=f?Array.from(new Set(e.flatMap(g))):Array.from(new Set(e.filter(Boolean))),v=[],_=0,k=()=>{u.querySelectorAll(".csv-picker-item").forEach((w,M)=>{w.toggleClass("csv-picker-item--hover",M===_),M===_&&w.scrollIntoView({block:"nearest"})})},S=w=>{if(!f){n(w.isClear?"":w.value),d();return}w.isClear?p.clear():(p.has(w.value)?p.delete(w.value):p.add(w.value),w.isAdd&&!m.includes(w.value)&&m.push(w.value)),b(),w.isAdd?(h.value="",C("")):C(h.value)},x=w=>f?p.has(w):w===t,y=()=>f?p.size>0:!!t,C=w=>{u.empty(),v=[];let M=w?m.filter(L=>L.toLowerCase().includes(w.toLowerCase())):m;if(y()){v.push({value:"",isClear:!0});let L=u.createDiv({cls:"csv-picker-item csv-picker-clear"});L.setText(f?"\u2715 Clear all":"\u2715 Clear"),L.addEventListener("mousedown",O=>{O.preventDefault(),S({value:"",isClear:!0})})}if(M.forEach(L=>{v.push({value:L});let O=u.createDiv({cls:`csv-picker-item ${x(L)?"active":""}`});O.setText(f?`${p.has(L)?"\u2713 ":""}${L}`:L),O.addEventListener("mousedown",V=>{V.preventDefault(),S({value:L})})}),w&&!m.some(L=>L.toLowerCase()===w.toLowerCase())){v.push({value:w,isAdd:!0});let L=u.createDiv({cls:"csv-picker-item csv-picker-add"});L.setText(`+ Add "${w}"`),L.addEventListener("mousedown",O=>{O.preventDefault(),S({value:w,isAdd:!0})})}!M.length&&!w&&u.createDiv({cls:"csv-picker-empty",text:"No options yet. Type to add."}),_=Math.min(_,Math.max(v.length-1,0)),k()};f&&r.createEl("button",{cls:"csv-picker-done",text:"Done"}).addEventListener("mousedown",w=>{w.preventDefault(),d()}),C(""),a(),h.addEventListener("input",()=>{_=0,C(h.value),a()});let E=typeof window!="undefined"&&((D=window.matchMedia)==null?void 0:D.call(window,"(pointer: coarse)").matches);setTimeout(()=>{document.addEventListener("mousedown",l),E||(window.addEventListener("scroll",c,!0),window.addEventListener("resize",d))},0),h.addEventListener("keydown",w=>{if(w.key==="Escape"){d();return}if(w.key==="ArrowDown"){w.preventDefault(),v.length&&(_=(_+1)%v.length,k());return}if(w.key==="ArrowUp"){w.preventDefault(),v.length&&(_=(_-1+v.length)%v.length,k());return}if(w.key==="Enter")if(w.preventDefault(),v[_])S(v[_]);else{let M=h.value.trim();M&&(n(M),d())}})}async function rs(s,t,e){var l,c;let n=(c=(l=t.parent)==null?void 0:l.path)!=null?c:"",i=n?`${n}/Archive`:"Archive";await s.vault.adapter.exists(i)||await s.vault.adapter.mkdir(i);let o=new Date,r=`${me(o)} ${String(o.getHours()).padStart(2,"0")}${String(o.getMinutes()).padStart(2,"0")}${String(o.getSeconds()).padStart(2,"0")}`,a=`${i}/${t.basename} sync-conflict ${r}.csv`;return await s.vault.adapter.write(a,e),new gn.Notice(`"${t.name}" changed on disk while you were editing (another device?). That version was saved to ${a} \u2014 your edits won.`,1e4),a}function or(s,t,e){return!s[t]||t===e||(s[e]||(s[e]=s[t]),delete s[t]),s}var Fc={source:["confirmed","inferred","conflict"],resolved:["yes","no"]};function rr(s){var t;return(t=Fc[s.trim().toLowerCase()])!=null?t:null}function Et(s){return/(^|[_\s-])(date|due|deadline)([_\s-]|$)/i.test(s.trim())}var mn=/^\d{4}-\d{2}-\d{2}$/;var Vt=require("obsidian");function yn(s,t,e,n,i=Et){let o=i(t)&&(e===""||mn.test(e.slice(0,10))),r=o?e.slice(0,10):e,a=s.createEl("input",{cls:n,type:o?"date":"text",value:r});o||(a.placeholder=t);let l=rr(t);if(l){let c=`csv-dl-${t.toLowerCase().replace(/[^a-z0-9]+/g,"-")}-${Math.random().toString(36).slice(2,7)}`,d=s.createEl("datalist");d.id=c,l.forEach(h=>d.createEl("option",{value:h})),a.setAttr("list",c)}return a}var as=class extends Vt.Modal{constructor(t,e,n,i,o,r,a={},l=()=>!1,c,d,h=Et){super(t),this.headers=e,this.isNotesCol=n,this.isSelectCol=i,this.getColumnValues=o,this.onSubmit=r,this.optionPresets=a,this.isBooleanCol=l,this.isCategoricalCol=c!=null?c:u=>this.isSelectCol(u)||Xt(this.getColumnValues(u).length),this.titleCol=d!=null?d:this.headers.find(u=>["title","name"].includes(u.toLowerCase())),this.isDateCol=h}onOpen(){let{contentEl:t}=this;t.empty(),t.addClass("csv-add-modal"),t.createEl("h2",{text:"Add new entry",cls:"csv-modal-title"});let e=t.createDiv({cls:"csv-modal-form"}),n={};this.headers.forEach(d=>n[d]="");let i=this.titleCol,o=new Map;i&&this.getColumnValues(i).forEach(d=>{let h=d.trim().toLowerCase();h&&!o.has(h)&&o.set(h,d.trim())}),this.headers.forEach(d=>{var b;let h=e.createDiv({cls:"csv-modal-row"});h.createEl("label",{text:Tt(d),cls:"csv-modal-label"});let u=(b=this.optionPresets[d])!=null?b:[],f=d===i,g=xt(d),p=!f&&!this.isNotesCol(d)&&!g&&(u.length>0||this.isCategoricalCol(d));if(this.isBooleanCol(d)){n[d]="0";let m=h.createDiv({cls:"csv-toggle"});m.createDiv({cls:"csv-toggle-knob"}),m.addEventListener("click",()=>{let v=!m.hasClass("is-on");m.toggleClass("is-on",v),n[d]=v?"1":"0"})}else if(this.isNotesCol(d)){let m=h.createEl("textarea",{cls:"csv-modal-textarea",placeholder:"Markdown supported\u2026"});m.addEventListener("input",()=>{n[d]=m.value})}else if(p){let m="__custom__",v=[];[...u,...this.getColumnValues(d)].forEach(S=>{let x=(S!=null?S:"").trim();x&&!v.some(y=>y.toLowerCase()===x.toLowerCase())&&v.push(x)});let _=h.createEl("select",{cls:"csv-modal-select"});_.createEl("option",{text:"\u2014",value:""}),v.forEach(S=>_.createEl("option",{text:S,value:S})),_.createEl("option",{text:"+ Custom\u2026",value:m});let k=h.createEl("input",{cls:"csv-modal-input csv-modal-custom",type:"text",placeholder:`Custom ${Tt(d).toLowerCase()}`});k.hide(),k.addEventListener("input",()=>{n[d]=k.value}),k.addEventListener("keydown",S=>{S.key==="Enter"&&c()}),_.addEventListener("change",()=>{_.value===m?(k.show(),k.focus(),n[d]=k.value):(k.hide(),n[d]=_.value)})}else if(!f&&g&&this.isSelectCol(d)){let v=h.createDiv({cls:"csv-modal-select-wrap"}).createDiv({cls:"csv-select-chip empty"});v.setText("\u2014 click to select \u2014"),v.addEventListener("click",_=>{_.stopPropagation(),It(v,n[d],this.getColumnValues(d),k=>{n[d]=k,v.setText(k||"\u2014 click to select \u2014"),v.toggleClass("empty",!k)},t,{multi:xt(d)})})}else{let m=yn(h,d,"","csv-modal-input",v=>this.isDateCol(v));if(m.addEventListener("input",()=>{n[d]=m.value}),m.addEventListener("keydown",v=>{v.key==="Enter"&&c()}),d===i&&o.size){let v=h.createDiv({cls:"csv-modal-dup-hint"});v.hide(),m.addEventListener("input",()=>{let _=o.get(m.value.trim().toLowerCase());_?(v.setText(`\u26A0 \u201C${_}\u201D is already in this file`),v.show()):v.hide()})}}});let r=t.createDiv({cls:"csv-modal-btns"});r.createEl("button",{text:"Cancel",cls:"csv-modal-cancel"}).addEventListener("click",()=>this.close()),r.createEl("button",{text:"Add entry",cls:"csv-modal-submit"}).addEventListener("click",()=>c());let c=()=>{if(!Object.values(n).some(h=>h.trim())){new Vt.Notice("Fill in at least one field.");return}this.onSubmit(n),this.close()}}onClose(){this.contentEl.empty()}},be=class extends Vt.Modal{constructor(e,n,i,o,r,a,l,c,d,h,u,f,g=()=>!1,p=Et){super(e);this.vvHandler=null;this.row={...n},this.notesCol=i,this.headers=o,this.filePath=r,this.renderComponent=new Vt.Component,this.isNotesCol=a,this.isSelectCol=l,this.getColumnValues=c,this.onSave=d,this.onDelete=h,this.isCategoricalCol=u!=null?u:b=>this.isSelectCol(b)||!Et(b)&&Xt(this.getColumnValues(b).length),this.titleCol=f!=null?f:this.headers.find(b=>["title","name","Title","Name"].includes(b)),this.isBooleanCol=g,this.isDateCol=p,this.modalEl.addClass("csv-note-expander-modal")}onOpen(){var g,p,b,m,v;this.renderComponent.load();let{contentEl:e}=this;e.empty(),e.addClass("csv-note-expander");let n=window.visualViewport;if(n){let _=()=>{this.modalEl.style.setProperty("--csv-modal-vh",`${n.height}px`)};_(),n.addEventListener("resize",_),n.addEventListener("scroll",_),this.vvHandler=_}let i=e.createDiv({cls:"csv-expander-header"});i.createDiv({cls:"csv-expander-title",text:(p=this.row[(g=this.titleCol)!=null?g:this.headers[0]])!=null?p:"\u2014"});let o=i.createDiv({cls:"csv-expander-header-btns"}),r=e.createDiv({cls:"csv-expander-fields"}),a=this.titleCol,l=this.headers.find(_=>["author","Author","director","Director","artist","Artist","creator","Creator"].includes(_));this.headers.forEach(_=>{var y;if(this.isNotesCol(_))return;let k=r.createDiv({cls:"csv-expander-field-row"});if(k.createDiv({cls:"csv-expander-field-label",text:Tt(_)}),this.isBooleanCol(_)){let C=os((y=this.row[_])!=null?y:""),E=k.createDiv({cls:`csv-toggle ${C?"is-on":""}`});E.createDiv({cls:"csv-toggle-knob"}),E.addEventListener("click",()=>{let D=!E.hasClass("is-on");E.toggleClass("is-on",D),this.row[_]=D?"1":"0"});return}let S=xt(_);if(_!==a&&(S?this.isSelectCol(_):this.isCategoricalCol(_))){let C=k.createDiv({cls:`csv-select-chip ${this.row[_]?"":"empty"}`});C.setText(this.row[_]||"\u2014"),C.addEventListener("click",E=>{E.stopPropagation(),It(C,this.row[_],this.getColumnValues(_),D=>{this.row[_]=D,C.setText(D||"\u2014"),C.toggleClass("empty",!D)},e,{multi:xt(_)})})}else{let C=k.createDiv({cls:"csv-expander-field-value",text:this.row[_]||"\u2014"});C.addEventListener("click",()=>{var w;if(C.querySelector("input"))return;C.empty();let E=yn(C,_,(w=this.row[_])!=null?w:"","csv-inline-input",this.isDateCol);E.focus(),E.type==="text"&&E.select(),E.addEventListener("click",M=>M.stopPropagation());let D=()=>{this.row[_]=E.value,C.empty(),C.setText(E.value||"\u2014")};E.addEventListener("blur",D),E.addEventListener("keydown",M=>{M.key==="Enter"&&E.blur(),M.key==="Escape"&&(C.empty(),C.setText(this.row[_]||"\u2014"))})})}});let c=!1,d=this.notesCol&&(b=this.row[this.notesCol])!=null?b:"",h=null;if(this.notesCol){e.createDiv({cls:"csv-expander-divider"}).createDiv({cls:"csv-expander-notes-label",text:this.notesCol});let k=e.createDiv({cls:"csv-expander-rendered markdown-rendered"});k.title="Click to edit";let S=e.createDiv({cls:"csv-expander-editor"});S.style.display="none";let x=()=>{k.empty(),d.trim()?Vt.MarkdownRenderer.render(this.app,d,k,this.filePath,this.renderComponent):k.createDiv({cls:"csv-notes-empty",text:"+ Add note"})};x(),h=S.createEl("textarea",{cls:"csv-expander-textarea"}),h.value=d,h.addEventListener("input",()=>{d=h.value});let y=()=>{c||(c=!0,k.style.display="none",S.style.display="flex",h.value=d,h.focus())},C=()=>{c&&(c=!1,S.style.display="none",k.style.display="",d=h.value,x())};k.addEventListener("click",E=>{if(E.target.closest("a, button, input, textarea, [contenteditable]"))return;let w=window.getSelection();w&&w.toString().length>0||y()}),h.addEventListener("keydown",E=>{E.key==="Escape"&&(E.preventDefault(),h.blur())}),h.addEventListener("blur",C)}let u=e.createDiv({cls:"csv-expander-footer"});if(this.onDelete){let _=String((v=this.row[(m=this.titleCol)!=null?m:this.headers[0]])!=null?v:"").trim();u.createEl("button",{cls:"csv-expander-delete-btn",text:"Delete"}).addEventListener("click",()=>{let k=_||"this entry";window.confirm(`Delete "${k}"? This can't be undone.`)&&(this.onDelete(),this.close())})}let f=u.createDiv({cls:"csv-expander-footer-right"});f.createEl("button",{cls:"csv-modal-cancel",text:"Cancel"}).addEventListener("click",()=>this.close()),f.createEl("button",{cls:"csv-expander-save-btn",text:"Save & close"}).addEventListener("click",()=>{this.notesCol&&(c&&h&&(d=h.value),this.row[this.notesCol]=d),this.onSave(this.row),this.close()})}onClose(){let e=window.visualViewport;e&&this.vvHandler&&(e.removeEventListener("resize",this.vvHandler),e.removeEventListener("scroll",this.vvHandler)),this.vvHandler=null,this.renderComponent.unload(),this.contentEl.empty()}};var bn=class extends Vt.Modal{constructor(t,e,n,i,o,r,a,l,c,d,h,u,f,g=()=>0){super(t),this.headers=e,this.filePath=n,this.current={...i,habitColumns:i.habitColumns?[...i.habitColumns]:void 0,categoricalColumns:i.categoricalColumns?[...i.categoricalColumns]:void 0},this.autoDetectedHabits=o,this.autoDetectedCategorical=r,this.autoDetectedRoles=a,this.availableModes=l,this.onSave=c,this.getHeaders=d,this.getFileCfg=h,this.onAddColumn=u,this.onRemoveColumn=f,this.onCleanupBooleanColumn=g}onOpen(){var O,V,P;let{contentEl:t}=this;t.empty(),t.addClass("csv-add-modal"),t.createEl("h2",{text:"View settings for this file",cls:"csv-modal-title"}),t.createEl("p",{text:"These settings apply only to this file and override the global defaults.",cls:"csv-modal-desc"});let e=t.createDiv({cls:"csv-modal-form"}),n=()=>{this.headers=this.getHeaders();let T=this.getFileCfg();this.current={...T,habitColumns:T.habitColumns?[...T.habitColumns]:void 0,categoricalColumns:T.categoricalColumns?[...T.categoricalColumns]:void 0},this.onOpen()},i=e.createDiv({cls:"csv-modal-row"});i.createEl("label",{text:"Columns",cls:"csv-modal-label"}),i.createEl("p",{cls:"csv-modal-hint",text:`Type and Function are each exclusive per column \u2014 picking one clears it from whichever column held it before. "auto" means it's already doing that by column name, with nothing saved here yet. Card field is independent and can combine with anything. Checkbox columns get a "Clean up" action that rewrites every row to strict 1/0 right away \u2014 not deferred to Save.`});let o=[{value:"text",label:"Text"},{value:"checkbox",label:"Checkbox"},{value:"categorical",label:"Categorical"},{value:"date",label:"Date"}],r=[{value:"",label:"\u2014 no function \u2014"},{value:"title",label:"Title"},{value:"category",label:"Column group (Kanban lanes)"},{value:"status",label:"Row group / Status / Checkmark"},{value:"notes",label:"Notes"},{value:"image",label:"Image (card / kanban thumbnail)"},{value:"anki",label:"Anki card front"}],a=T=>{var z,A,j;let U=(z=this.current.habitColumns)!=null?z:this.autoDetectedHabits,F=(A=this.current.categoricalColumns)!=null?A:this.autoDetectedCategorical,G=(j=this.current.dateColumns)!=null?j:this.headers.filter(Y=>Et(Y));return U.includes(T)?{type:"checkbox",auto:!this.current.habitColumns}:F.includes(T)?{type:"categorical",auto:!this.current.categoricalColumns}:G.includes(T)?{type:"date",auto:!this.current.dateColumns}:{type:"text",auto:!1}},l=(T,U)=>{this.current.habitColumns||(this.current.habitColumns=[...this.autoDetectedHabits]),this.current.categoricalColumns||(this.current.categoricalColumns=[...this.autoDetectedCategorical]),this.current.dateColumns||(this.current.dateColumns=this.headers.filter(F=>Et(F))),this.current.habitColumns=this.current.habitColumns.filter(F=>F!==T),this.current.categoricalColumns=this.current.categoricalColumns.filter(F=>F!==T),this.current.dateColumns=this.current.dateColumns.filter(F=>F!==T),U==="checkbox"?this.current.habitColumns.push(T):U==="categorical"?this.current.categoricalColumns.push(T):U==="date"&&this.current.dateColumns.push(T)},c=(V=(O=this.current.titleColumn)!=null?O:this.autoDetectedRoles.title)!=null?V:this.headers[0],h=i.createDiv({cls:"csv-modal-colcfg-table-wrap"}).createEl("table",{cls:"csv-modal-colcfg-table"}),u=h.createEl("thead").createEl("tr");["Column","Type","Visibility"].forEach(T=>u.createEl("th",{text:T}));let f=h.createEl("tbody"),g=()=>{var U;f.empty();let T=new Set((U=this.current.cardFields)!=null?U:this.headers);this.headers.forEach(F=>{let G=f.createEl("tr"),z=G.createEl("td",{cls:"csv-modal-colcfg-name"});z.createSpan({text:F});let A=z.createEl("button",{cls:"csv-modal-column-remove",text:"\u2715",attr:{title:`Remove "${F}" \u2014 deletes this column's data from every row`}});A.addEventListener("click",()=>{if(A.hasClass("confirm")){this.onRemoveColumn(F),n();return}f.querySelectorAll(".csv-modal-column-remove.confirm").forEach(R=>{R.removeClass("confirm"),R.setText("\u2715")}),A.addClass("confirm"),A.setText("Confirm?"),window.setTimeout(()=>{A.isConnected&&(A.removeClass("confirm"),A.setText("\u2715"))},3e3)});let j=G.createEl("td",{cls:"csv-modal-colcfg-type-cell"});if(F===c)j.createSpan({cls:"csv-modal-colcfg-fixed",text:"Text"});else{let R=j.createEl("select",{cls:"csv-modal-select csv-modal-colcfg-type"}),{type:B,auto:H}=a(F);if(o.forEach(N=>{let W=R.createEl("option",{text:N.label,value:N.value});N.value===B&&(W.selected=!0)}),H&&R.addClass("auto-detected"),R.addEventListener("change",()=>{l(F,R.value),g()}),H&&j.createSpan({cls:"csv-modal-colcfg-auto-badge",text:"auto"}),B==="checkbox"){let N=j.createEl("button",{cls:"csv-modal-colcfg-cleanup-btn",text:"Clean up",attr:{title:`Rewrite every row in "${F}" to strict 1/0 (yes/true/1 \u2192 1, everything else \u2192 0)`}});N.addEventListener("click",()=>{if(N.hasClass("confirm")){let W=this.onCleanupBooleanColumn(F);new Vt.Notice(W>0?`"${F}": normalized ${W} row${W===1?"":"s"} to 1/0.`:`"${F}" is already strict 1/0 \u2014 nothing to change.`);return}f.querySelectorAll(".csv-modal-colcfg-cleanup-btn.confirm").forEach(W=>{W.removeClass("confirm"),W.setText("Clean up")}),N.addClass("confirm"),N.setText("Confirm?"),window.setTimeout(()=>{N.isConnected&&(N.removeClass("confirm"),N.setText("Clean up"))},3e3)})}}let $=G.createEl("td",{cls:"csv-modal-colcfg-card-cell"}).createEl("input",{type:"checkbox"});$.checked=T.has(F),$.addEventListener("change",()=>{this.current.cardFields||(this.current.cardFields=[...this.headers]),$.checked?this.current.cardFields.includes(F)||this.current.cardFields.push(F):this.current.cardFields=this.current.cardFields.filter(R=>R!==F)})})};g();let p=t.createDiv({cls:"csv-modal-section",attr:{style:"margin-top: 24px;"}});p.createEl("h3",{text:"Column Functions",cls:"csv-modal-h3"}),p.createEl("p",{cls:"csv-modal-desc",text:"Assign specific roles to your columns. 'auto' means it's already doing that by column name. Selecting '\u2014 none \u2014' disables the function entirely."});let m=p.createDiv({cls:"csv-modal-colcfg-table-wrap"}).createEl("table",{cls:"csv-modal-colcfg-table"}),v=m.createEl("thead").createEl("tr");["Function","Column"].forEach(T=>v.createEl("th",{text:T}));let _=m.createEl("tbody"),k=()=>{_.empty(),r.forEach(T=>{var Y,$,R,B,H,N,W,I,q,Q,Z,nt;if(T.value==="")return;let U=_.createEl("tr");U.createEl("td",{cls:"csv-modal-colcfg-name"}).setText(T.label);let G=U.createEl("td",{cls:"csv-modal-colcfg-type-cell"}),z=G.createEl("select",{cls:"csv-modal-select csv-modal-colcfg-role"});z.createEl("option",{text:"\u2014 none \u2014",value:""});let A="",j=!1;T.value==="title"?(A=($=(Y=this.current.titleColumn)!=null?Y:this.autoDetectedRoles.title)!=null?$:"",j=this.current.titleColumn===void 0&&!!this.autoDetectedRoles.title):T.value==="category"?(A=(B=(R=this.current.categoryColumn)!=null?R:this.autoDetectedRoles.category)!=null?B:"",j=this.current.categoryColumn===void 0&&!!this.autoDetectedRoles.category):T.value==="status"?(A=(N=(H=this.current.statusColumn)!=null?H:this.autoDetectedRoles.status)!=null?N:"",j=this.current.statusColumn===void 0&&!!this.autoDetectedRoles.status):T.value==="notes"?(A=(I=(W=this.current.notesColumn)!=null?W:this.autoDetectedRoles.notes)!=null?I:"",j=this.current.notesColumn===void 0&&!!this.autoDetectedRoles.notes):T.value==="image"?(A=(Q=(q=this.current.imageColumn)!=null?q:this.autoDetectedRoles.image)!=null?Q:"",j=this.current.imageColumn===void 0&&!!this.autoDetectedRoles.image):T.value==="anki"&&(A=(nt=(Z=this.current.ankiFrontCol)!=null?Z:this.autoDetectedRoles.anki)!=null?nt:"",j=this.current.ankiFrontCol===void 0&&!!this.autoDetectedRoles.anki),this.headers.forEach(X=>{let tt=z.createEl("option",{text:X,value:X});X===A&&(tt.selected=!0)}),j&&A!==""&&z.addClass("auto-detected"),z.addEventListener("change",()=>{let X=z.value;X&&(T.value!=="title"&&this.current.titleColumn===X&&(this.current.titleColumn=void 0),T.value!=="category"&&this.current.categoryColumn===X&&(this.current.categoryColumn=void 0),T.value!=="status"&&this.current.statusColumn===X&&(this.current.statusColumn=void 0),T.value!=="notes"&&this.current.notesColumn===X&&(this.current.notesColumn=void 0),T.value!=="image"&&this.current.imageColumn===X&&(this.current.imageColumn=void 0),T.value!=="anki"&&this.current.ankiFrontCol===X&&(this.current.ankiFrontCol=void 0)),T.value==="title"?this.current.titleColumn=X:T.value==="category"?this.current.categoryColumn=X:T.value==="status"?this.current.statusColumn=X:T.value==="notes"?this.current.notesColumn=X:T.value==="image"?this.current.imageColumn=X:T.value==="anki"&&(this.current.ankiFrontCol=X),k()}),j&&A!==""&&G.createSpan({cls:"csv-modal-colcfg-auto-badge",text:"auto"})})};k();let S=i.createDiv({cls:"csv-modal-add-column"}),x=S.createEl("input",{cls:"csv-modal-input",type:"text",placeholder:"New column name"}),y=S.createEl("button",{cls:"csv-modal-cancel",text:"+ Add column"}),C=()=>{let T=this.onAddColumn(x.value);if(T){new Vt.Notice(T);return}n()};y.addEventListener("click",C),x.addEventListener("keydown",T=>{T.key==="Enter"&&(T.preventDefault(),C())});let E=e.createDiv({cls:"csv-modal-row"});E.createEl("label",{text:"Default view",cls:"csv-modal-label"});let D=E.createEl("select",{cls:"csv-modal-select"}),w=[["\u2014 use global default \u2014",""],...this.availableModes.map(T=>[T.label,T.id])],M=(P=this.current.defaultMode)!=null?P:"";M&&!this.availableModes.some(T=>T.id===M)&&w.push([`${M} (no longer available)`,M]),w.forEach(([T,U])=>{let F=D.createEl("option",{text:T,value:U});M===U&&(F.selected=!0)}),D.addEventListener("change",()=>{this.current.defaultMode=D.value?D.value:void 0});let L=t.createDiv({cls:"csv-modal-btns"});L.createEl("button",{text:"Cancel",cls:"csv-modal-cancel"}).addEventListener("click",()=>this.close()),L.createEl("button",{text:"Save",cls:"csv-modal-submit"}).addEventListener("click",()=>{this.onSave(this.current),this.close()})}onClose(){this.contentEl.empty()}},vn=class extends Vt.Modal{constructor(e,n,i,o,r){super(e);this.title=n;this.initial=i;this.placeholder=o;this.onSubmit=r}onOpen(){let{contentEl:e}=this;e.empty(),e.addClass("csv-add-modal"),e.createEl("h2",{text:this.title,cls:"csv-modal-title"});let n=e.createEl("input",{cls:"csv-modal-field",type:"text"});n.value=this.initial,n.placeholder=this.placeholder,window.setTimeout(()=>{n.focus(),n.select()},0);let i=()=>{let r=n.value.trim();r&&(this.onSubmit(r),this.close())};n.addEventListener("keydown",r=>{r.key==="Enter"&&(r.preventDefault(),i())});let o=e.createDiv({cls:"csv-modal-btns"});o.createEl("button",{text:"Cancel",cls:"csv-modal-cancel"}).addEventListener("click",()=>this.close()),o.createEl("button",{text:"Create",cls:"csv-modal-submit"}).addEventListener("click",i)}onClose(){this.contentEl.empty()}};var Ei=195,Ic={AF:"Afghanistan",AL:"Albania",DZ:"Algeria",AD:"Andorra",AO:"Angola",AR:"Argentina",AM:"Armenia",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BD:"Bangladesh",BY:"Belarus",BE:"Belgium",BO:"Bolivia",BA:"Bosnia",BW:"Botswana",BR:"Brazil",BG:"Bulgaria",KH:"Cambodia",CM:"Cameroon",CA:"Canada",CL:"Chile",CN:"China",CO:"Colombia",HR:"Croatia",CU:"Cuba",CY:"Cyprus",CZ:"Czechia",DK:"Denmark",DO:"Dominican Rep.",EC:"Ecuador",EG:"Egypt",ET:"Ethiopia",FI:"Finland",FR:"France",GE:"Georgia",DE:"Germany",GH:"Ghana",GR:"Greece",GT:"Guatemala",GY:"Guyana",HT:"Haiti",HN:"Honduras",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran",IQ:"Iraq",IE:"Ireland",IL:"Israel",IT:"Italy",JP:"Japan",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KP:"N. Korea",KR:"S. Korea",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Laos",LV:"Latvia",LB:"Lebanon",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MY:"Malaysia",ML:"Mali",MT:"Malta",MR:"Mauritania",MX:"Mexico",MD:"Moldova",MN:"Mongolia",ME:"Montenegro",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NP:"Nepal",NL:"Netherlands",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NO:"Norway",OM:"Oman",PK:"Pakistan",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PL:"Poland",PT:"Portugal",QA:"Qatar",RO:"Romania",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SG:"Singapore",SK:"Slovakia",SI:"Slovenia",SO:"Somalia",ZA:"South Africa",SS:"South Sudan",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SE:"Sweden",CH:"Switzerland",SY:"Syria",TJ:"Tajikistan",TZ:"Tanzania",TH:"Thailand",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",UG:"Uganda",UA:"Ukraine",AE:"UAE",GB:"United Kingdom",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VN:"Vietnam",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe",MC:"Monaco",BZ:"Belize"},Vc={AF:["DZ","AO","BJ","BW","BF","BI","CM","CV","CF","TD","KM","CD","CG","CI","DJ","EG","GQ","ER","ET","GA","GM","GH","GN","GW","KE","LS","LR","LY","MG","MW","ML","MR","MU","MA","MZ","NA","NE","NG","RE","RW","ST","SN","SC","SL","SO","ZA","SS","SD","TZ","TG","TN","UG","ZM","ZW"],AN:["AQ"],AS:["AF","AM","AZ","BH","BD","BT","BN","KH","CN","CY","GE","IN","ID","IR","IQ","IL","JP","JO","KZ","KW","KG","LA","LB","MY","MV","MN","MM","NP","KP","OM","PK","PS","PH","QA","RU","SA","SG","KR","LK","SY","TW","TJ","TH","TL","TR","TM","AE","UZ","VN","YE"],EU:["AL","AD","AT","BY","BE","BA","BG","HR","CZ","DK","EE","FI","FR","DE","GR","HU","IS","IE","IT","XK","LV","LI","LT","LU","MT","MD","MC","ME","NL","MK","NO","PL","PT","RO","RU","SM","RS","SK","SI","ES","SE","CH","UA","GB","VA"],NA:["AG","BS","BB","BZ","CA","CR","CU","DM","DO","SV","GD","GT","HT","HN","JM","MX","NI","PA","KN","LC","VC","TT","US"],OC:["AU","FJ","KI","MH","FM","NR","NZ","PW","PG","WS","SB","TO","TV","VU"],SA:["AR","BO","BR","CL","CO","EC","GY","PY","PE","SR","UY","VE"]},ar={AF:"Africa",AN:"Antarctica",AS:"Asia",EU:"Europe",NA:"N. America",OC:"Oceania",SA:"S. America"},lr={};for(let[s,t]of Object.entries(Vc))for(let e of t)lr[e]=s;function Dt(s){return Ic[s]||s}function jt(s){return!s||s.length!==2?"":String.fromCodePoint(...s.toUpperCase().split("").map(t=>t.charCodeAt(0)+127397))}function Bt(s){if(!s||s.indexOf("?")!==-1)return null;let t=new Date(s+"T12:00:00Z");return isNaN(t.getTime())?null:t}function Fs(s){let t=Bt(s.date_entered),e=Bt(s.date_left);return!t||!e?0:Math.max(Math.round((e.getTime()-t.getTime())/864e5),1)}function cr(s,t=new Date){let e=t.getTime(),n=null,i=-1/0;for(let o of s){let r=Bt(o.date_entered);if(!(!r||r.getTime()>e)){if(o.date_left.trim()!==""){let a=Bt(o.date_left);if(!a||a.getTime()i&&(n=o,i=r.getTime())}}return n}function dr(s){let t=m=>{var v,_,k,S,x,y,C,E;return{date_entered:(v=m.date_entered)!=null?v:"",date_left:(_=m.date_left)!=null?_:"",country:((k=m.country)!=null?k:"").trim().toUpperCase(),city:(S=m.city)!=null?S:"",visa_status:(x=m.visa_status)!=null?x:"",notes:(y=m.notes)!=null?y:"",source:((C=m.source)!=null?C:"").trim().toLowerCase(),resolved:(E=m.resolved)!=null?E:"",_src:m}},e=s.map(t).filter(m=>m.country),n=e.filter(m=>m.source==="confirmed"),i=e.filter(m=>m.source==="inferred"),o=e.filter(m=>m.source==="conflict"),r=[];for(let m of n){let v=Bt(m.date_entered),_=Bt(m.date_left);v&&_&&r.push([v.getTime(),_.getTime()])}let a=m=>{let v=Bt(m.date_entered),_=Bt(m.date_left);if(!v||!_)return!1;let k=v.getTime(),S=_.getTime();return r.some(([x,y])=>k<=y&&S>=x)},l=i.filter(m=>Bt(m.date_entered)&&Bt(m.date_left)&&!a(m)),c=new Set(n.map(m=>m.country)),d=new Set(i.map(m=>m.country)),h=new Set([...d].filter(m=>!c.has(m))),u=new Set([...c,...d]),f=new Map;for(let m of n)f.set(m.country,(f.get(m.country)||0)+Fs(m));let g=[...f.entries()].map(([m,v])=>({iso:m,days:v})).sort((m,v)=>v.days-m.days||Dt(m.iso).localeCompare(Dt(v.iso))),p=g.reduce((m,v)=>m+v.days,0),b=new Set;for(let m of c){let v=lr[m];v&&b.add(v)}return{confirmed:n,inferred:i,conflicts:o,inferredVisible:l,confRanges:r,confirmedCountries:c,inferredOnlyCountries:h,allCountries:u,countryDays:g,totalConfirmedDays:p,visitedContinents:b,worldPct:Math.round(c.size/Ei*100)}}var Di=864e5;function hr(s){if(!s||s.indexOf("?")!==-1)return null;let t=Date.parse(s+"T00:00:00Z");return isNaN(t)?null:t}function Nc(s,t,e,n){let i=Math.max(s,e),o=Math.min(t,n);return o<=i?0:Math.round((o-i)/Di)}function Bc(s,t){var i;let e=s.window;if(e.type==="all-time")return{start:-1/0,end:1/0,label:"all time"};if(e.type==="calendar-year"){let o=new Date(t).getUTCFullYear();return{start:Date.UTC(o,0,1),end:Date.UTC(o+1,0,1),label:`in ${o}`}}let n=(i=e.days)!=null?i:180;return{start:t-n*Di,end:t+Di,label:`in last ${n} days`}}function ur(s,t,e=Date.now()){var d,h,u;let n=(d=s.scope.countries)!=null?d:s.scope.country?[s.scope.country]:[],i=new Set(n.map(f=>f.toUpperCase())),o=new Set(((u=(h=s.exempt)==null?void 0:h.visa_status)!=null?u:[]).map(f=>f.toLowerCase().trim())),r=Bc(s,e),a=0;for(let f of t){if(!i.has((f.country||"").toUpperCase())||o.has((f.visa_status||"").toLowerCase().trim()))continue;let g=hr(f.date_entered),p=hr(f.date_left);g===null||p===null||(a+=Nc(g,p,r.start,r.end))}let l=s.threshold-a,c=a>=s.threshold?"over":a/s.threshold>=.8?"warn":"ok";return{rule:s,used:a,threshold:s.threshold,remaining:l,windowLabel:r.label,status:c}}var fr=["#c9a96e","#4a6fa5","#5ba06e","#a05b8a","#6ea0a0","#a0855b","#7a6ea0","#a06e6e","#6e8fa0","#a09e5b"],$c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function zc(){let s=new Map,t=0;return e=>(s.has(e)||s.set(e,fr[t++%fr.length]),s.get(e))}function Hc(s){let t=document.body.createDiv({cls:"csv-tv-tooltip"}),e=null,n=(r,a)=>{let c=r+14,d=a+16,h=t.offsetWidth,u=t.offsetHeight;c+h+8>window.innerWidth&&(c=r-h-14),d+u+8>window.innerHeight&&(d=a-u-16),t.style.left=`${Math.max(8,c)}px`,t.style.top=`${Math.max(8,d)}px`},i=r=>{var c,d;let a=(d=(c=r.target)==null?void 0:c.closest("[data-tip]"))!=null?d:null,l=(a==null?void 0:a.getAttribute("data-tip"))||"";if(!a||!l){e&&(e=null,t.removeClass("is-on"));return}a!==e&&(e=a,t.setText(l),t.addClass("is-on")),n(r.clientX,r.clientY)},o=()=>{e=null,t.removeClass("is-on")};return s.addEventListener("pointermove",i),s.addEventListener("pointerleave",o),()=>{s.removeEventListener("pointermove",i),s.removeEventListener("pointerleave",o),t.remove()}}function Mi(s){let t=Fs(s);return t?`${t}d`:"\u2014"}function ls(s){return s||"\u2014"}function Vs(s){return s.createDiv({cls:"csv-tv-table-wrap"}).createEl("table",{cls:"csv-tv-table"})}function Is(s,t,e,n){s.addClass("csv-tv-editable"),s.title="Click to edit";let i=()=>{s.empty(),s.setText(t[e]?t[e]:"\u2014")};i(),s.addEventListener("click",()=>{var r;if(s.querySelector("input"))return;s.empty();let o=yn(s,e,(r=t[e])!=null?r:"","csv-inline-input");o.focus(),o.type==="text"&&o.select(),o.addEventListener("blur",()=>{t[e]=o.value,n(),i()}),o.addEventListener("keydown",a=>{var l;a.key==="Enter"&&o.blur(),a.key==="Escape"&&(o.value=(l=t[e])!=null?l:"",o.blur())})})}async function gr(s,t,e,n=()=>{},i=null,o=()=>{}){let r=dr(t),a=s.createDiv({cls:"csv-tv"});if(!r.confirmed.length&&!r.inferred.length){a.createDiv({cls:"csv-empty-state",text:"No travel rows found. Expected columns: country, date_entered, date_left, source."});return}o(Hc(a));let l=null,c=()=>{a.querySelectorAll(".country-path").forEach(f=>{let g=(f.getAttribute("data-iso")||"").toUpperCase();f.classList.toggle("cp-selected",!!l&&g===l)}),a.querySelectorAll(".csv-tv-seg").forEach(f=>{f.classList.toggle("is-dim",!!l&&f.getAttribute("data-iso")!==l)}),a.querySelectorAll("tr[data-iso]").forEach(f=>{f.classList.toggle("is-selected",!!l&&f.getAttribute("data-iso")===l)}),u.empty(),l&&(Uc(u,r,l,()=>d(null)),u.scrollIntoView({behavior:"smooth",block:"nearest"}))},d=f=>{l=f&&f!==l?f:null,c()};Wc(a,r);let h=a.createDiv({cls:"csv-tv-mapwrap"});h.createDiv({cls:"csv-tv-map-loading",text:"Loading map\u2026"});let u=a.createDiv({cls:"csv-tv-detailwrap"});i&&i.length&&Yc(a,r.confirmed,i),Gc(a,r,d),Kc(a,r,d),qc(a,r,n);try{let f=await e();h.empty(),f?jc(h,f,r,d):h.createDiv({cls:"csv-tv-map-loading",text:"World map asset not found (world-map.svg)."})}catch(f){h.empty(),h.createDiv({cls:"csv-tv-map-loading",text:"Couldn't load world map."})}}function Wc(s,t){let e=s.createDiv({cls:"csv-tv-stats"}),n=(c,d,h="")=>{let u=e.createDiv({cls:"csv-tv-stat"});u.createDiv({cls:"csv-tv-stat-label",text:c}),u.createDiv({cls:"csv-tv-stat-value",text:d}),h&&u.createDiv({cls:"csv-tv-stat-sub",text:h})},i=Math.round(t.allCountries.size/Ei*100);n("Countries",String(t.confirmedCountries.size),`${t.worldPct}% of world`),n("Incl. photos",String(t.allCountries.size),`${i}% of world`),n("Continents",`${t.visitedContinents.size} / 7`,[...t.visitedContinents].map(c=>ar[c]||c).sort().join(", ")),n("Confirmed trips",String(t.confirmed.length)),n("Confirmed days",String(t.totalConfirmedDays));let o=new Set(t.confirmed.map(c=>c.city.trim().toLowerCase()).filter(Boolean));o.size&&n("Cities",String(o.size));let r=null,a=0;for(let c of t.confirmed){let d=Fs(c);d>a&&(a=d,r=c)}if(r){let c=r.date_entered.slice(0,4);n("Longest trip",`${a}d`,`${jt(r.country)} ${Dt(r.country)}${c?` \xB7 ${c}`:""}`)}let l=cr(t.confirmed);if(l){let c=Bt(l.date_entered),d=Math.max(1,Math.round((Date.now()-c.getTime())/864e5)+1),h=s.createDiv({cls:"csv-tv-now"});h.createSpan({cls:"csv-tv-now-loc",text:`\u{1F4CD} Currently in ${jt(l.country)} ${Dt(l.country)}`}),h.createSpan({cls:"csv-tv-now-sub",text:` \u2014 since ${l.date_entered} (day ${d})${l.city?` \xB7 ${l.city}`:""}`})}}function jc(s,t,e,n){let i=s.createDiv({cls:"csv-tv-map"});i.innerHTML=t,i.querySelectorAll(".country-path").forEach(r=>{let a=(r.getAttribute("data-iso")||"").toUpperCase();if(r.classList.remove("cp-unvisited","cp-confirmed","cp-inferred"),a&&e.confirmedCountries.has(a)){r.classList.add("cp-confirmed");let l=e.countryDays.find(c=>c.iso===a);r.setAttr("aria-label",`${Dt(a)} \u2014 ${l&&l.days?l.days+"d confirmed":"confirmed"}`),r.setAttr("data-tip",`${Dt(a)}${l&&l.days?" \xB7 "+l.days+"d":""} \xB7 click for trips`)}else a&&e.inferredOnlyCountries.has(a)?(r.classList.add("cp-inferred"),r.setAttr("aria-label",`${Dt(a)} \u2014 photo evidence`),r.setAttr("data-tip",`${Dt(a)} \xB7 photo evidence \xB7 click for trips`)):a?(r.classList.add("cp-unvisited"),r.setAttr("data-tip",Dt(a))):r.classList.add("cp-unvisited");a&&r.addEventListener("click",()=>{e.allCountries.has(a)?n(a):n(null)})}),i.querySelectorAll(".country-path").forEach(r=>{try{let a=r.getBoundingClientRect();a.width&&a.height&&Math.max(a.width,a.height)<12&&r.classList.add("cp-tiny")}catch(a){}});let o=s.createDiv({cls:"csv-tv-map-legend"});o.createSpan({cls:"csv-tv-leg"}).innerHTML=' Confirmed',o.createSpan({cls:"csv-tv-leg"}).innerHTML=' Photo evidence'}function Uc(s,t,e,n){var b,m;let i=s.createDiv({cls:"csv-tv-detail"}),o=i.createDiv({cls:"csv-tv-detail-head"});o.createSpan({cls:"csv-tv-detail-flag",text:jt(e)});let r=o.createDiv({cls:"csv-tv-detail-titles"});r.createDiv({cls:"csv-tv-detail-name",text:Dt(e)});let a=t.confirmed.filter(v=>v.country===e),l=t.inferred.filter(v=>v.country===e),c=(m=(b=t.countryDays.find(v=>v.iso===e))==null?void 0:b.days)!=null?m:0,d=new Set([...a,...l].map(v=>v.city.trim()).filter(Boolean)),h=[];a.length&&h.push(`${a.length} confirmed trip${a.length===1?"":"s"}`),c&&h.push(`${c}d total`),l.length&&h.push(`${l.length} photo-inferred`),d.size&&h.push(`${d.size} cit${d.size===1?"y":"ies"}`),r.createDiv({cls:"csv-tv-detail-sub",text:h.join(" \xB7 ")}),o.createEl("button",{cls:"csv-tv-detail-close",text:"\u2715",title:"Close"}).addEventListener("click",n);let u=xn([...a.map(v=>({r:v,inf:!1,date_entered:v.date_entered})),...l.map(v=>({r:v,inf:!0,date_entered:v.date_entered}))]);if(!u.length)return;let f=Vs(i),g=f.createEl("thead").createEl("tr");["","Entered","Left","Days","City","Visa"].forEach(v=>g.createEl("th",{text:v}));let p=f.createEl("tbody");for(let{r:v,inf:_}of u){let k=p.createEl("tr");k.createEl("td",{text:_?"\u{1F4F7}":"",cls:"csv-tv-flag",attr:_?{"data-tip":"Photo-inferred"}:{}}),k.createEl("td",{text:ls(v.date_entered)}),k.createEl("td",{text:ls(v.date_left)}),k.createEl("td",{text:Mi(v)}),k.createEl("td",{text:v.city}),k.createEl("td",{text:v.visa_status})}}function Yc(s,t,e){s.createDiv({cls:"csv-tv-sec-title",text:"Residency counters"});let n=s.createDiv({cls:"csv-tv-res-grid"});for(let i of e){let o=ur(i,t),r=n.createDiv({cls:`csv-tv-res-card csv-tv-res-${o.status}`});r.createDiv({cls:"csv-tv-res-label",text:i.label});let a=r.createDiv({cls:"csv-tv-res-nums"});a.createSpan({cls:"csv-tv-res-used",text:String(o.used)}),a.createSpan({cls:"csv-tv-res-thresh",text:` / ${o.threshold}`}),a.createSpan({cls:"csv-tv-res-window",text:` ${o.windowLabel}`});let l=r.createDiv({cls:"csv-tv-res-bar"});l.createDiv({cls:"csv-tv-res-fill"}).style.width=`${Math.min(100,Math.round(o.used/o.threshold*100))}%`;let c=o.status==="over"?i.onExceed?`Over \u2014 ${i.onExceed}`:"Limit reached":`${o.remaining} day${o.remaining===1?"":"s"} left`;r.createDiv({cls:"csv-tv-res-status",text:c}),i.note&&r.createDiv({cls:"csv-tv-res-note",text:i.note})}s.createDiv({cls:"csv-tv-res-disclaimer",text:"Indicators only \u2014 not legal or tax advice. Based on confirmed trips."})}function Gc(s,t,e){s.createDiv({cls:"csv-tv-sec-title",text:"Countries visited"});let n=Vs(s),i=n.createEl("thead").createEl("tr");["","Country","Total days"].forEach(r=>i.createEl("th",{text:r}));let o=n.createEl("tbody");for(let{iso:r,days:a}of t.countryDays){let l=o.createEl("tr",{cls:"csv-tv-row-click",attr:{"data-iso":r}});l.createEl("td",{text:jt(r),cls:"csv-tv-flag"}),l.createEl("td",{text:Dt(r)}),l.createEl("td",{text:a?`${a}d`:"\u2014"}),l.addEventListener("click",()=>e(r))}if(t.inferredOnlyCountries.size){let r=s.createDiv({cls:"csv-tv-photo-only"});r.createSpan({text:"\u{1F4F7} Photo evidence only: "}),r.createSpan({text:[...t.inferredOnlyCountries].sort().map(jt).join(" ")})}}function Kc(s,t,e){s.createDiv({cls:"csv-tv-sec-title",text:"Timeline"});let n=zc(),i=[...t.confirmed.map(c=>({...c,_inf:!1})),...t.inferredVisible.map(c=>({...c,_inf:!0}))].filter(c=>c.date_entered&&c.date_left&&c.date_entered.indexOf("?")===-1),o=new Map;for(let c of i){let d=parseInt(c.date_entered.slice(0,4)),h=parseInt(c.date_left.slice(0,4));if(!(isNaN(d)||isNaN(h)))for(let u=d;u<=h;u++)o.has(u)||o.set(u,[]),o.get(u).push(c)}let r=[...o.keys()].sort((c,d)=>d-c),a=s.createDiv({cls:"csv-tv-timeline"});for(let c of r){let d=new Date(`${c}-01-01T12:00:00Z`).getTime(),h=new Date(`${c}-12-31T12:00:00Z`).getTime(),u=h-d,f=a.createDiv({cls:"csv-tv-tl-year"}),g=0,p=new Set;for(let _ of o.get(c)){if(p.add(_.country),_._inf)continue;let k=Math.max(new Date(_.date_entered+"T12:00:00Z").getTime(),d),S=Math.min(new Date(_.date_left+"T12:00:00Z").getTime(),h);k<=S&&(g+=Math.max(Math.round((S-k)/864e5)+1,1))}let b=f.createDiv({cls:"csv-tv-tl-label"});b.createSpan({text:String(c)}),b.createSpan({cls:"csv-tv-tl-sub",text:`${g?`${g}d \xB7 `:""}${p.size} ${p.size===1?"country":"countries"}`});let m=f.createDiv({cls:"csv-tv-month-row"});$c.forEach(_=>m.createDiv({cls:"csv-tv-month-tick",text:_}));let v=f.createDiv({cls:"csv-tv-track"});for(let _ of o.get(c)){let k=Math.max(new Date(_.date_entered+"T12:00:00Z").getTime(),d),S=Math.min(new Date(_.date_left+"T12:00:00Z").getTime(),h);if(k>S)continue;let x=(k-d)/u*100,y=Math.max((S-k+864e5)/u*100,.5),C=n(_.country),E=v.createDiv({cls:`csv-tv-seg${_._inf?" csv-tv-seg-inf":""}`});E.style.left=`${x}%`,E.style.width=`${y}%`,_._inf?(E.style.borderColor=C,E.style.background=C+"22",E.style.color=C):E.style.background=C,E.setAttr("data-iso",_.country),E.setAttr("data-tip",`${Dt(_.country)} ${_.date_entered} \u2192 ${_.date_left} (${Fs(_)}d)${_.visa_status?" ["+_.visa_status+"]":""}${_._inf?" [photo]":""}`),E.addEventListener("click",()=>e(_.country)),y>4?E.createSpan({cls:"csv-tv-seg-lbl",text:`${jt(_.country)} ${_.country}`}):y>2&&E.createSpan({cls:"csv-tv-seg-lbl",text:jt(_.country)})}}a.createDiv({cls:"csv-tv-tl-legend"}).setText("Confirmed (solid) \xB7 Photo inferred (outlined)")}function xn(s){return[...s].sort((t,e)=>!t.date_entered&&!e.date_entered?0:t.date_entered?e.date_entered?e.date_entered.localeCompare(t.date_entered):-1:1)}function qc(s,t,e){s.createDiv({cls:"csv-tv-sec-title",text:"Confirmed trips"}),s.createDiv({cls:"csv-tv-edit-hint",text:"Dates, city, visa and notes are editable \u2014 click a cell. Edit country in Table view."});let n=Vs(s),i=n.createEl("thead").createEl("tr");["","Country","Entered","Left","Duration","City","Visa","Notes"].forEach(r=>i.createEl("th",{text:r}));let o=n.createEl("tbody");for(let r of xn(t.confirmed)){let a=o.createEl("tr");a.createEl("td",{text:jt(r.country),cls:"csv-tv-flag"}),a.createEl("td",{text:Dt(r.country)}),Is(a.createEl("td"),r._src,"date_entered",e),Is(a.createEl("td"),r._src,"date_left",e),a.createEl("td",{text:Mi(r)}),Is(a.createEl("td"),r._src,"city",e),Is(a.createEl("td"),r._src,"visa_status",e),Is(a.createEl("td"),r._src,"notes",e)}if(t.inferred.length){let r=s.createEl("details",{cls:"csv-tv-details"});r.createEl("summary",{text:`\u{1F4F7} Photo inferred trips (${t.inferred.length})`});let a=Vs(r),l=a.createEl("thead").createEl("tr");["","Country","Entered","Left","Days","City"].forEach(d=>l.createEl("th",{text:d}));let c=a.createEl("tbody");for(let d of xn(t.inferred)){let h=c.createEl("tr");h.createEl("td",{text:jt(d.country),cls:"csv-tv-flag"}),h.createEl("td",{text:Dt(d.country)}),h.createEl("td",{text:ls(d.date_entered)}),h.createEl("td",{text:ls(d.date_left)}),h.createEl("td",{text:Mi(d)}),h.createEl("td",{text:d.city})}}if(t.conflicts.length){let r=s.createEl("details",{cls:"csv-tv-details csv-tv-details-warn"});r.createEl("summary",{text:`\u26A0 ${t.conflicts.length} conflict(s) \u2014 photo evidence contradicts a confirmed entry`});let a=Vs(r),l=a.createEl("thead").createEl("tr");["","Country (photos)","Dates","Detail"].forEach(d=>l.createEl("th",{text:d}));let c=a.createEl("tbody");for(let d of xn(t.conflicts)){let h=c.createEl("tr");h.createEl("td",{text:jt(d.country),cls:"csv-tv-flag"}),h.createEl("td",{text:d.country}),h.createEl("td",{text:`${ls(d.date_entered)} \u2192 ${ls(d.date_left)}`}),h.createEl("td",{text:d.notes})}}}var Nt=require("obsidian"),Cn=class extends Nt.PluginSettingTab{constructor(t,e){super(t,e),this.plugin=e}display(){let{containerEl:t}=this;t.empty(),t.createEl("h2",{text:"DataDeck"}),new Nt.Setting(t).setName("Default view mode").addDropdown(n=>n.addOption("kanban-genre","Kanban").addOption("table","Table").setValue(this.plugin.settings.defaultMode).onChange(async i=>{this.plugin.settings.defaultMode=i,await this.plugin.saveSettings()})),new Nt.Setting(t).setName("Status column name").addText(n=>n.setValue(this.plugin.settings.statusColumn).onChange(async i=>{this.plugin.settings.statusColumn=i,await this.plugin.saveSettings()})),new Nt.Setting(t).setName("Category/Genre column name").addText(n=>n.setValue(this.plugin.settings.categoryColumn).onChange(async i=>{this.plugin.settings.categoryColumn=i,await this.plugin.saveSettings()})),new Nt.Setting(t).setName("Notes column names").setDesc("Comma-separated.").addText(n=>n.setValue(this.plugin.settings.notesColumns.join(", ")).onChange(async i=>{this.plugin.settings.notesColumns=i.split(",").map(o=>o.trim()),await this.plugin.saveSettings()})),new Nt.Setting(t).setName("Select/dropdown columns").setDesc("Comma-separated column names that use a dropdown picker.").addText(n=>n.setValue(this.plugin.settings.selectColumns.join(", ")).onChange(async i=>{this.plugin.settings.selectColumns=i.split(",").map(o=>o.trim()),await this.plugin.saveSettings()})),new Nt.Setting(t).setName("Notes subfolder").addText(n=>n.setPlaceholder("Notes").setValue(this.plugin.settings.notesSubfolder).onChange(async i=>{this.plugin.settings.notesSubfolder=i,await this.plugin.saveSettings()})),new Nt.Setting(t).setName("Reset column widths").addButton(n=>n.setButtonText("Reset").onClick(async()=>{this.plugin.settings.columnWidths={},await this.plugin.saveSettings(),new Nt.Notice("Column widths reset.")})),new Nt.Setting(t).setName("Residency counters (travel view)").setDesc("Show residency / tax day-gauges in the travel view.").addToggle(n=>n.setValue(this.plugin.settings.showResidency!==!1).onChange(async i=>{this.plugin.settings.showResidency=i,await this.plugin.saveSettings()})),t.createEl("h3",{text:"Residency rules"}),t.createEl("p",{cls:"setting-item-description",text:"Each rule counts days in the listed countries within the window, minus exempt visa rows, against the threshold. Counts confirmed trips only. Indicators, not legal/tax advice."});let e=t.createDiv({cls:"csv-rr-wrap"});this.renderResidencyRules(e)}renderResidencyRules(t){var o;t.empty();let e=(o=this.plugin.settings.residencyRules)!=null?o:this.plugin.settings.residencyRules=[],n=()=>void this.plugin.saveSettings();e.forEach((r,a)=>{var m,v,_,k,S,x;let l=t.createDiv({cls:"csv-rr-card"}),c=l.createDiv({cls:"csv-rr-head"}),d=c.createEl("input",{cls:"csv-rr-label",type:"text",value:r.label});d.placeholder="Label (e.g. \u{1F1EA}\u{1F1FA} Schengen 90/180)",d.addEventListener("input",()=>{r.label=d.value,n()});let h=c.createEl("button",{cls:"csv-rr-del",text:"\u2715"});h.setAttr("aria-label","Remove rule"),h.addEventListener("click",async()=>{e.splice(a,1),await this.plugin.saveSettings(),this.renderResidencyRules(t)});let u=l.createDiv({cls:"csv-rr-grid"}),f=(y,C,E,D="")=>{let w=u.createDiv({cls:"csv-rr-field"});w.createEl("label",{text:y});let M=w.createEl("input",{type:"text",value:C});D&&(M.placeholder=D),M.addEventListener("input",()=>{E(M.value),n()})},g=(m=r.scope.countries)!=null?m:r.scope.country?[r.scope.country]:[];f("Countries (ISO-2, comma)",g.join(", "),y=>{r.scope={countries:y.split(",").map(C=>C.trim().toUpperCase()).filter(Boolean)}},"US, GB");let p=u.createDiv({cls:"csv-rr-field"});p.createEl("label",{text:"Window"});let b=p.createEl("select");[["calendar-year","Calendar year"],["rolling","Rolling N days"],["all-time","All time"]].forEach(([y,C])=>{let E=b.createEl("option",{text:C,value:y});r.window.type===y&&(E.selected=!0)}),b.addEventListener("change",()=>{r.window={type:b.value,days:r.window.days},n(),this.renderResidencyRules(t)}),r.window.type==="rolling"&&f("Rolling days",String((v=r.window.days)!=null?v:180),y=>{let C=parseInt(y,10);r.window.days=isNaN(C)?void 0:C},"180"),f("Threshold (days)",String(r.threshold),y=>{let C=parseInt(y,10);r.threshold=isNaN(C)?0:C},"183"),f("Exempt visas (comma)",((k=(_=r.exempt)==null?void 0:_.visa_status)!=null?k:[]).join(", "),y=>{let C=y.split(",").map(E=>E.trim()).filter(Boolean);r.exempt=C.length?{visa_status:C}:void 0},"F-1, J-1"),f("On-exceed label",(S=r.onExceed)!=null?S:"",y=>{r.onExceed=y||void 0},"tax resident"),f("Note",(x=r.note)!=null?x:"",y=>{r.note=y||void 0},"optional caveat")}),t.createDiv({cls:"csv-rr-btns"}).createEl("button",{cls:"csv-rr-add",text:"+ Add rule"}).addEventListener("click",async()=>{e.push({label:"New rule",scope:{countries:[]},window:{type:"calendar-year"},threshold:183}),await this.plugin.saveSettings(),this.renderResidencyRules(t)})}};var ve=require("obsidian"),pr=Os(ts());async function mr(s,t,e,n,i={}){var F,G,z;let o=t.split(` -`).map(A=>A.trim()).filter(Boolean),r="";for(let A of o)if(A.startsWith("file:")){r=A.replace("file:","").trim();break}if(!r){e.createEl("p",{text:"Error: No file specified. Use: file: yourfile.csv",cls:"csv-add-error"});return}let a=s.vault.getAbstractFileByPath(n.sourcePath),l=(G=(F=a==null?void 0:a.parent)==null?void 0:F.path)!=null?G:"",c=Qt(r,l),d=s.vault.getAbstractFileByPath(c);if(!d||!(d instanceof ve.TFile)){e.createEl("p",{text:`Error: File not found: ${c}`,cls:"csv-add-error"});return}let h=(z=i[c])!=null?z:{},u=[],f=[];try{let A=await s.vault.read(d),j=wt(A);u=j.headers,f=j.rows}catch(A){e.createEl("p",{text:`Error reading file: ${A}`,cls:"csv-add-error"});return}if(!u.length){e.createEl("p",{text:"Error: No columns found in file",cls:"csv-add-error"});return}let g=A=>{let j=A.toLowerCase();if(["date","day","datum"].includes(j))return!0;let Y=f.slice(0,5).map($=>{var R;return(R=$[A])!=null?R:""});return Y.length>0&&Y.every($=>/^\d{4}-\d{2}-\d{2}$/.test($))},p=A=>{let j=A.toLowerCase();return["notes","note","comments","description","journal"].includes(j)},b=h.habitColumns?h.habitColumns.filter(A=>u.includes(A)):u.filter(A=>!g(A)&&is(f.map(j=>{var Y;return((Y=j[A])!=null?Y:"").toLowerCase().trim()}))),m=u.filter(A=>g(A)),v=u.filter(A=>p(A)),_=u.filter(A=>!b.includes(A)&&!m.includes(A)&&!v.includes(A)),k=h.titleColumn?u.find(A=>A.toLowerCase()===h.titleColumn.toLowerCase()):u.find(A=>["title","name"].includes(A.toLowerCase())),S=e.createDiv({cls:"csv-add-form csv-add-compact"}),x=S.createEl("button",{cls:"csv-add-trigger",text:"+ New entry"});x.style.display="none";let y=S.createDiv({cls:"csv-add-card"}),C=y.createDiv({cls:"csv-add-card-header"});C.createEl("span",{cls:"csv-add-card-title",text:"New entry"});let E=C.createEl("button",{cls:"csv-add-card-close",text:"\xD7"}),D=y.createDiv({cls:"csv-add-rows"}),w={},M={},L=(A,j)=>{let Y=D.createDiv({cls:`csv-add-row csv-add-row-${j}`});return Y.createEl("span",{cls:"csv-add-row-label",text:Tt(A)}),Y};m.forEach(A=>{let Y=L(A,"date").createEl("input",{cls:"csv-add-row-control",type:"date"});Y.value=me(),w[A]=Y}),b.forEach(A=>{M[A]=!1;let Y=L(A,"toggle").createEl("label",{cls:"csv-add-switch"}),$=Y.createEl("input",{type:"checkbox",cls:"csv-add-switch-input"});Y.createEl("span",{cls:"csv-add-switch-track"}),$.addEventListener("change",()=>{M[A]=$.checked}),w[A]=$}),_.forEach(A=>{let j=L(A,"field"),Y=new Set(f.map(R=>{var B;return((B=R[A])!=null?B:"").trim()}).filter(Boolean));if(A!==k&&(h.categoricalColumns?h.categoricalColumns.includes(A):Xt(Y.size))){let R=j.createEl("select",{cls:"csv-add-row-control"});R.createEl("option",{text:"\u2014",value:""}),Array.from(Y).sort().forEach(N=>R.createEl("option",{text:N,value:N})),R.createEl("option",{text:"+ Custom",value:"__custom__"});let B=D.createDiv({cls:"csv-add-row csv-add-row-custom"});B.style.display="none";let H=B.createEl("input",{cls:"csv-add-row-control",type:"text",placeholder:`Custom ${Tt(A).toLowerCase()}`});D.insertBefore(B,j.nextSibling),R.addEventListener("change",()=>{B.style.display=R.value==="__custom__"?"flex":"none",R.value==="__custom__"&&H.focus()}),w[A]=R,w[`${A}__custom`]=H}else w[A]=j.createEl("input",{cls:"csv-add-row-control",type:"text",placeholder:Tt(A)})}),v.forEach(A=>{let j=D.createDiv({cls:"csv-add-row csv-add-row-notes"});j.createEl("span",{cls:"csv-add-row-label",text:Tt(A)}),w[A]=j.createEl("textarea",{cls:"csv-add-row-textarea",placeholder:"Optional notes\u2026"})});let O=y.createEl("button",{text:"Add",cls:"csv-add-submit"}),V=C.querySelector(".csv-add-card-title"),P=()=>{if(!m.length)return;let A=w[m[0]];if(!A)return;let j=A.value,Y=f.find($=>$[m[0]]===j);V&&V.setText(Y?`Updating ${j}`:"New entry"),y.classList.toggle("is-updating",!!Y),O.setText(Y?"Update":"Add"),b.forEach($=>{var H;let R=w[$];if(!R)return;let B=os((H=Y==null?void 0:Y[$])!=null?H:"");R.checked=B,M[$]=B}),[..._,...v].forEach($=>{var H;let R=w[$];if(!R)return;let B=(H=Y==null?void 0:Y[$])!=null?H:"";if(R instanceof HTMLSelectElement){let N=Array.from(R.options).find(q=>q.value===B),W=w[`${$}__custom`],I=W==null?void 0:W.closest(".csv-add-row-custom");N?(R.value=B,I&&(I.style.display="none"),W&&(W.value="")):B?(R.value="__custom__",W&&(W.value=B),I&&(I.style.display="flex")):(R.value="",I&&(I.style.display="none"),W&&(W.value=""))}else R instanceof HTMLTextAreaElement,R.value=B})};if(P(),m.length){let A=w[m[0]];A==null||A.addEventListener("change",P)}let T=()=>{y.style.display="block",x.style.display="none";let A=y.querySelector(".csv-add-row-control");A==null||A.focus()},U=()=>{y.style.display="none",x.style.display=""};x.addEventListener("click",T),E.addEventListener("click",U),O.addEventListener("click",async()=>{let A={};u.forEach(N=>{var W,I,q,Q;b.includes(N)?A[N]=M[N]?"1":"0":w[N]instanceof HTMLSelectElement&&w[N].value==="__custom__"?A[N]=(I=(W=w[`${N}__custom`])==null?void 0:W.value)!=null?I:"":w[N]instanceof HTMLTextAreaElement?A[N]=w[N].value:A[N]=(Q=(q=w[N])==null?void 0:q.value)!=null?Q:""});let j=m.length>0&&m.some(N=>{var W;return((W=A[N])!=null?W:"").trim()}),Y=[..._,...v].some(N=>{var W;return((W=A[N])!=null?W:"").trim()}),$=b.some(N=>M[N]);if(!j&&!Y&&!$){new ve.Notice("Please fill at least one field");return}let R=[];try{let N=await s.vault.read(d);R=wt(N).rows}catch(N){new ve.Notice(`Error reading file: ${N}`);return}let B=!1,H=-1;if(m.length>0){let N=m[0],W=A[N];if(H=R.findIndex(I=>I[N]===W),H>=0){B=!0;let I=R[H];u.forEach(q=>{var Q;(b.includes(q)||((Q=A[q])!=null?Q:"").trim())&&(I[q]=A[q])})}else R.push(A)}else R.push(A);try{let N=pr.default.unparse(R,{columns:u});await s.vault.modify(d,N),new ve.Notice(B?`Updated entry for ${A[m[0]]||""}`:`Added entry to ${d.basename}`),f.length=0,f.push(...R),m.length>0?P():(b.forEach(W=>{M[W]=!1;let I=w[W];I&&(I.checked=!1)}),[..._,...v].forEach(W=>{let I=w[W];I instanceof HTMLSelectElement?I.selectedIndex=0:(I instanceof HTMLTextAreaElement||I)&&(I.value="");let q=w[`${W}__custom`];if(q){q.value="";let Q=q.closest(".csv-add-row-custom");Q&&(Q.style.display="none")}})),setTimeout(async()=>{let W=s.vault.getAbstractFileByPath(n.sourcePath);if(W instanceof ve.TFile){let I=s.workspace.activeLeaf;I&&await I.openFile(W,{state:{mode:"preview"}})}},300)}catch(N){new ve.Notice(`Error saving: ${N}`)}})}function _n(s,t){let e=s.getFilteredRows();s.searchQuery.trim()&&t.createDiv({cls:"csv-search-results",text:`Found ${e.length} of ${s.rows.length} entries`});let i=t.createDiv({cls:"csv-table-wrapper"}).createEl("table",{cls:"csv-table"}),o=i.createEl("thead").createEl("tr");s.headers.forEach(l=>{let c=o.createEl("th");c.setText(l),c.addClass("csv-th-sortable"),s.tableSortCol===l&&c.createSpan({cls:"csv-th-sort-indicator",text:s.tableSortDir==="asc"?" \u25B2":" \u25BC"}),c.title="Click to sort",c.addEventListener("click",g=>{g.target.closest(".csv-col-resize-handle")||(s.tableSortCol!==l?(s.tableSortCol=l,s.tableSortDir="asc"):s.tableSortDir==="asc"?s.tableSortDir="desc":s.tableSortCol=null,s.renderView())});let d=s.settings.columnWidths[l];d&&(c.style.width=d+"px");let h=c.createDiv({cls:"csv-col-resize-handle"}),u=0,f=0;h.addEventListener("pointerdown",g=>{g.preventDefault(),g.stopPropagation(),h.setPointerCapture(g.pointerId),u=g.clientX,f=c.offsetWidth;let p=m=>{c.style.width=Math.max(60,f+m.clientX-u)+"px"},b=m=>{s.settings.columnWidths[l]=Math.max(60,f+m.clientX-u),h.removeEventListener("pointermove",p),h.removeEventListener("pointerup",b),s.persistSettings()};h.addEventListener("pointermove",p),h.addEventListener("pointerup",b)})}),o.createEl("th",{text:""});let r=matchMedia("(pointer: coarse)").matches,a=i.createEl("tbody");e.forEach(l=>{let c=a.createEl("tr");c.addEventListener("contextmenu",u=>s.openRowContextMenu(l,u)),s.headers.forEach(u=>{var g,p;let f=c.createEl("td");if(s.isNotesCol(u)){f.addClass("csv-table-notes-cell");let b=((g=l[u])!=null?g:"").replace(/#{1,6}\s/g,"").replace(/[*_>`]/g,"").split(` -`).filter(_=>_.trim()).slice(0,3).join(" \xB7 "),m=b?b.slice(0,200)+(b.length>200?"\u2026":""):"+ Add note",v=f.createSpan({text:m});b||v.addClass("csv-table-notes-empty"),f.title="Click to open note",f.addEventListener("click",_=>{_.stopPropagation(),s.openNoteExpander(l,u)})}else if(s.isSelectCol(u))s.renderSelectField(f,l,u);else{let b=(p=l[u])!=null?p:"";f.setText(b),b.length>80&&(f.title=b),Ns(s,f,l,u)}});let d=c.createEl("td",{cls:"csv-table-action"}),h=s.notesFileExists(l);d.createEl("button",{cls:`csv-table-notes-btn ${h?"exists":""}`,text:h?"\u{1F4C4}":"\u271A",title:h?"Open notes":"Create notes"}).addEventListener("click",()=>s.openOrCreateNotes(l)),d.createEl("button",{cls:"csv-table-del-btn",text:"\u2715",title:"Delete row (Undo available)"}).addEventListener("click",()=>s.deleteWithUndo(l))}),r||requestAnimationFrame(()=>{a.querySelectorAll("td:not(.csv-table-notes-cell):not(.csv-table-action)").forEach(l=>{l.scrollHeight>l.clientHeight+1&&l.addClass("csv-cell--clipped")})})}function Ns(s,t,e,n){t.addEventListener("click",i=>{var h,u;if(t.querySelector("input"))return;t.empty();let o=(h=s.fileCfg.dateColumns)==null?void 0:h.includes(n),r=((u=e[n])!=null?u:"").trim(),a=o||Et(n)&&(r===""||mn.test(r)),l=a?r.slice(0,10):r,c=t.createEl("input",{cls:"csv-inline-input",value:l,type:a?"date":"text"});c.focus(),a||c.select(),c.addEventListener("click",f=>f.stopPropagation());let d=!1;c.addEventListener("blur",()=>{var f;!d&&c.value!==l&&(e[n]=c.value,s.scheduleSave()),t.empty(),t.setText(((f=e[n])!=null?f:"")||"\u2014")}),c.addEventListener("keydown",f=>{f.key==="Enter"&&c.blur(),f.key==="Escape"&&(d=!0,c.blur())})})}function Sn(s){return!!(s.getCategoryCol()||s.getStatusCol()||br(s)||s.authorKey())}function br(s){return s.resolveCol(["Rating","rating","Score","score","Score /5","Stars","stars"])}function zs(s){var i;let t=(s!=null?s:"").trim();if(!t)return null;let e=((i=t.match(/★/g))!=null?i:[]).length;if(e>0)return e;let n=parseFloat(t);return isNaN(n)||n<=0?null:Math.min(5,n)}var vr=["watched","read","finished","completed","done","yes","seen"],yr=["watching","reading","in progress","in-progress"],Xc=["dropped","abandoned","dnf"];function Qc(s){let t=s.toLowerCase();return vr.includes(t)?"is-done":yr.includes(t)?"is-progress":Xc.includes(t)?"is-dropped":""}function Bs(s,t){let e=new Map;return s.forEach(n=>t(n).forEach(i=>{var o;return e.set(i,((o=e.get(i))!=null?o:0)+1)})),e}function $s(s,t,e,n){if(!e.length)return;let i=s.createDiv({cls:"csv-stats-section"});i.createDiv({cls:"csv-stats-section-title",text:t});let o=Math.max(...e.map(r=>r.count));e.forEach(r=>{var h;let a=i.createDiv({cls:"csv-stats-bar-row"});a.createDiv({cls:"csv-stats-bar-label",text:r.label,attr:{title:r.label}});let c=a.createDiv({cls:"csv-stats-bar-track"}).createDiv({cls:`csv-stats-bar-fill ${(h=r.cls)!=null?h:""}`});c.style.width=`${Math.max(2,Math.round(r.count/o*100))}%`;let d=n>0?Math.round(r.count/n*100):0;a.createDiv({cls:"csv-stats-bar-count",text:`${r.count} \xB7 ${d}%`}),r.onClick&&(a.addClass("is-clickable"),a.title=`Show "${r.label}" in the library`,a.addEventListener("click",r.onClick))})}function xr(s,t){let e=s.getFilteredRows();if(s.searchQuery.trim()&&t.createDiv({cls:"csv-search-results",text:`Stats over ${e.length} of ${s.rows.length} entries`}),!e.length){t.createEl("p",{text:"No entries to chart.",cls:"csv-empty-state"});return}let n=t.createDiv({cls:"csv-stats-wrap"}),i=s.getStatusCol(),o=s.getCategoryCol(),r=br(s),a=s.authorKey(),l=s.resolveCol(["Year","year"]),c=n.createDiv({cls:"csv-stats-overview"}),d=(u,f)=>{let g=c.createDiv({cls:"csv-stats-chip"});g.createDiv({cls:"csv-stats-chip-value",text:u}),g.createDiv({cls:"csv-stats-chip-label",text:f})};if(d(String(e.length),"entries"),i){let u=e.filter(g=>{var p;return vr.includes(((p=g[i])!=null?p:"").toLowerCase().trim())}).length;u>0&&d(`${u} \xB7 ${Math.round(u/e.length*100)}%`,"done");let f=e.filter(g=>{var p;return yr.includes(((p=g[i])!=null?p:"").toLowerCase().trim())}).length;f>0&&d(String(f),"in progress")}if(o){let u=Bs(e,f=>{var g;return((g=f[o])!=null?g:"").split(",").map(p=>p.trim()).filter(Boolean)});u.size>0&&d(String(u.size),o.toLowerCase()==="genre"||o.toLowerCase()==="genres"?"genres":"categories")}if(r){let u=e.map(f=>zs(f[r])).filter(f=>f!==null);if(u.length){let f=u.reduce((g,p)=>g+p,0)/u.length;d(`\u2605 ${f.toFixed(1)}`,`avg of ${u.length} rated`)}}let h=(u,f)=>{s.libraryStatusFilter=u!=null?u:"all",s.libraryGenreFilter=f!=null?f:"all",s.mode="library",s.renderView()};if(i){let u=Bs(e,g=>{var b;let p=((b=g[i])!=null?b:"").trim();return p?[p]:[]}),f=Array.from(u.entries()).sort((g,p)=>p[1]-g[1]).map(([g,p])=>({label:g,count:p,cls:Qc(g),onClick:o?()=>h(g,null):void 0}));$s(n,`By ${i.toLowerCase()}`,f,e.length)}if(o){let u=Bs(e,g=>{var p;return((p=g[o])!=null?p:"").split(",").map(b=>b.trim()).filter(Boolean)}),f=Array.from(u.entries()).sort((g,p)=>p[1]-g[1]||g[0].localeCompare(p[0])).slice(0,12).map(([g,p])=>({label:g,count:p,onClick:()=>h(null,g)}));$s(n,`By ${o.toLowerCase()}`,f,e.length)}if(r){let u=new Map,f=0;if(e.forEach(g=>{var m;let p=zs(g[r]);if(p===null)return;let b=Math.min(5,Math.max(1,Math.round(p)));u.set(b,((m=u.get(b))!=null?m:0)+1),f++}),f>0){let g=[5,4,3,2,1].filter(p=>{var b;return((b=u.get(p))!=null?b:0)>0}).map(p=>({label:"\u2605".repeat(p),count:u.get(p),cls:"is-rating"}));$s(n,"Ratings",g,f)}}if(l){let u=Bs(e,f=>{var p;let g=((p=f[l])!=null?p:"").match(/\d{4}/);return g?[g[0]]:[]});if(u.size>1){let f=Array.from(u.entries()).sort((g,p)=>g[0].localeCompare(p[0])).map(([g,p])=>({label:g,count:p}));$s(n,"By year",f,e.length)}}if(a){let u=Bs(e,g=>{var b;let p=((b=g[a])!=null?b:"").trim();return p?[p]:[]}),f=Array.from(u.entries()).filter(([,g])=>g>1);if(f.length>=2){let g=f.sort((p,b)=>b[1]-p[1]||p[0].localeCompare(b[0])).slice(0,8).map(([p,b])=>({label:p,count:b}));$s(n,`Top ${a.toLowerCase()}s`,g,e.length)}}}function $t(s){let t=s.fileCfg.kanbanGroupCol;if(t&&s.headers.includes(t))return t;let e=s.getCategoryCol();if(e)return e;let n=new Set;s.headers.forEach(r=>{s.isNotesCol(r)&&n.add(r)});let i=s.getDateCol();i&&n.add(i);let o=s.titleKey();return o&&n.add(o),ir(s.headers,s.rows,n)}function kn(s,t){let e=$t(s);if(!e){t.createEl("p",{text:"No groupable column found.",cls:"csv-empty-state"});return}let n=s.getCategoryCol(),i=s.getStatusCol(),o=i===e?null:i,r=s.getFilteredRows();s.searchQuery.trim()&&t.createDiv({cls:"csv-search-results",text:`Found ${r.length} of ${s.rows.length} entries`});let a=t.createDiv({cls:"csv-kanban-groupbar"});a.createSpan({cls:"csv-kanban-groupbar-label",text:"Group by"});let l=a.createEl("select",{cls:"csv-library-filter-select"});s.headers.filter(b=>!s.isNotesCol(b)).forEach(b=>{let m=l.createEl("option",{text:b===n?`${b} (default)`:b,value:b});b===e&&(m.selected=!0)}),l.addEventListener("change",()=>{let b=s.fileCfg;b.kanbanGroupCol=l.value===n?void 0:l.value,s.saveFileCfg(b),s.renderView(!0)});let c=sr(e,r.map(b=>{var m;return(m=b[e])!=null?m:""})),d=b=>{var _;let m=(_=b[e])!=null?_:"",v;if(c){let k=nr(m);v=k?[k]:[]}else v=m.split(",").map(k=>k.trim()).filter(Boolean);return v.length||(v=["\u2014"]),v},h=new Set;r.forEach(b=>d(b).forEach(m=>h.add(m)));let u=Array.from(h).sort();if(!u.length){let b=t.createDiv({cls:"csv-empty-state"});b.createEl("p",{text:s.searchQuery?"No matching entries found.":`No "${e}" values found.`}),s.searchQuery&&b.createEl("button",{cls:"csv-clear-filters-btn",text:"Clear search"}).addEventListener("click",()=>{s.searchQuery="",s.renderView()});return}let f=["In progress","Finished","Not started"],g=o?Array.from(new Set([...f,...r.map(b=>{var m;return(m=b[o])!=null?m:""}).filter(Boolean)])).filter(b=>r.some(m=>{var v;return((v=m[o])!=null?v:"")==b})):[],p=t.createDiv({cls:"csv-kanban-board"});u.forEach(b=>{let m=r.filter(S=>d(S).includes(b));if(!m.length)return;let v=p.createDiv({cls:"csv-kanban-col"}),_=v.createDiv({cls:"csv-kanban-col-header"});_.createDiv({cls:"csv-kanban-col-title",text:b}),_.createDiv({cls:"csv-kanban-col-count",text:String(m.length)});let k=v.createDiv({cls:"csv-kanban-col-body"});if(o&&g.length){g.forEach(y=>{let C=m.filter(D=>{var w;return((w=D[o])!=null?w:"")===y});if(!C.length)return;let E=k.createDiv({cls:"csv-kanban-status-group"});E.createDiv({cls:`csv-kanban-status-label status-${y.toLowerCase().replace(/\s+/g,"-")}`,text:y}),C.forEach(D=>Ti(s,E,D,o,e))});let S=new Set(g),x=m.filter(y=>{var C;return!S.has((C=y[o])!=null?C:"")});if(x.length){let y=k.createDiv({cls:"csv-kanban-status-group"});y.createDiv({cls:"csv-kanban-status-label",text:"\u2014"}),x.forEach(C=>Ti(s,y,C,o,e))}}else m.forEach(S=>Ti(s,k,S,o,e))})}function Ti(s,t,e,n,i){var C,E,D,w,M,L,O,V;let o=t.createDiv({cls:"csv-kanban-card"}),r=s.getNotesCol(),a=(E=(C=s.getImageCol)==null?void 0:C.call(s))!=null?E:null;if(a){let P=pn(s.app,(D=e[a])!=null?D:"",(M=(w=s.file)==null?void 0:w.path)!=null?M:"");if(P){let T=o.createEl("img",{cls:"csv-kanban-card-img",attr:{src:P,loading:"lazy",alt:""}});T.addEventListener("error",()=>T.remove())}}let l=o.createDiv({cls:"csv-kanban-card-title-row"});l.createDiv({cls:`csv-kanban-card-title ${(L=s.isHighlighted)!=null&&L.call(s,e)?"csv-title-highlight":""}`,text:s.getTitle(e)}).addEventListener("click",P=>{P.stopPropagation(),s.openNoteExpander(e,r!=null?r:"")});let d=s.notesFileExists(e);l.createEl("button",{cls:`csv-kanban-notes-icon ${d?"exists":""}`,text:d?"\u{1F4C4}":"+",title:d?"Open notes file":"Create notes file"}).addEventListener("click",P=>{P.stopPropagation(),s.openOrCreateNotes(e)});let u=s.getSubtitle(e);u&&o.createDiv({cls:"csv-kanban-card-sub",text:u});let f=s.titleKey(),g=s.authorKey(),p=new Set([n,f,g,i].filter(Boolean)),b=o.createDiv({cls:"csv-kanban-card-meta"});((O=s.fileCfg.cardFields)!=null?O:s.headers).forEach(P=>{if(!s.headers.includes(P)||p.has(P)||s.isNotesCol(P))return;let T=b.createDiv({cls:"csv-kanban-chip"});if(T.createSpan({cls:"csv-chip-label",text:P+": "}),s.isSelectCol(P)){let U=T.createSpan({cls:`csv-chip-value csv-chip-select${e[P]?"":" csv-chip-value--empty"}`,text:e[P]||"\u2014"});U.addEventListener("click",F=>{F.stopPropagation(),It(U,e[P],s.getColumnValues(P),G=>{e[P]=G,U.setText(G||"\u2014"),U.classList.toggle("csv-chip-value--empty",!G),s.scheduleSave()},s.contentEl,{multi:xt(P)})})}else{let U=e[P]?e[P].length>40?e[P].slice(0,38)+"\u2026":e[P]:"\u2014",F=T.createSpan({cls:`csv-chip-value${e[P]?"":" csv-chip-value--empty"}`,text:U});e[P]&&e[P].length>40&&(F.title=e[P])}});let v=s.getNotesCol(),_=!!(v&&((V=e[v])!=null&&V.trim())),k=o.createDiv({cls:"csv-kanban-notes-preview"});if(_&&v){let P=e[v].replace(/#{1,6}\s/g,"").replace(/[*_>`]/g,"").replace(/\n+/g," ").trim();k.setText(P.slice(0,120)+(P.length>120?"\u2026":"")),k.title="Click to edit"}else k.addClass("csv-kanban-notes-preview--empty"),v&&k.setText("+ Add note");let S=o.createDiv({cls:"csv-kanban-notes-editor"});S.style.display="none";let x=()=>{var j,Y,$;let P=s.contentEl.querySelector(".csv-content-area"),T=(j=P==null?void 0:P.scrollLeft)!=null?j:0,U=(Y=P==null?void 0:P.scrollTop)!=null?Y:0;k.style.display="none",S.style.display="block",S.empty();let F=S.createEl("textarea",{cls:"csv-notes-textarea"});F.value=($=v?e[v]:"")!=null?$:"",F.addEventListener("click",R=>R.stopPropagation()),F.addEventListener("mousedown",R=>R.stopPropagation()),F.addEventListener("input",()=>{F.style.height="auto",F.style.height=F.scrollHeight+"px"});let G=F.value,z=!1,A=R=>{z||(z=!0,y(R,P,T,U))};F.addEventListener("keydown",R=>{R.key==="Escape"&&A(G)}),F.addEventListener("blur",()=>A(F.value)),F.focus({preventScroll:!0}),F.setSelectionRange(0,0),F.scrollTop=0,requestAnimationFrame(()=>{F.style.height="auto",F.style.height=Math.max(120,F.scrollHeight)+"px"})},y=(P,T,U,F)=>{var G;if(v&&P!==((G=e[v])!=null?G:"")&&(e[v]=P,s.scheduleSave()),S.style.display="none",k.style.display="",P.trim()){let z=P.replace(/#{1,6}\s/g,"").replace(/[*_>`]/g,"").replace(/\n+/g," ").trim();k.setText(z.slice(0,120)+(z.length>120?"\u2026":"")),k.removeClass("csv-kanban-notes-preview--empty"),k.title="Click to edit"}else k.addClass("csv-kanban-notes-preview--empty"),k.setText(v?"+ Add note":""),k.removeAttribute("title");T&&(T.scrollLeft=U,T.scrollTop=F,requestAnimationFrame(()=>{T.scrollLeft=U,T.scrollTop=F,requestAnimationFrame(()=>{T.scrollLeft=U,T.scrollTop=F})}),setTimeout(()=>{T.scrollLeft=U,T.scrollTop=F},50))};k.addEventListener("click",P=>{if(P.stopPropagation(),v&&matchMedia("(pointer: coarse)").matches){s.openNoteExpander(e,v);return}x()}),o.addEventListener("contextmenu",P=>s.openRowContextMenu(e,P))}function wn(s,t){var E,D;let e=$t(s),n=s.getStatusCol(),i=(E=s.titleKey())!=null?E:s.headers[0],o=s.authorKey();if(!e){t.createEl("p",{text:"No groupable column found.",cls:"csv-empty-state"});return}let r=new Set;s.rows.forEach(w=>{var L;((L=w[e])!=null?L:"").split(",").map(O=>O.trim()).filter(Boolean).forEach(O=>r.add(O))});let a=new Set;n&&s.rows.forEach(w=>{var L;let M=((L=w[n])!=null?L:"").trim();M&&a.add(M)});let l=t.createDiv({cls:"csv-library-filters"}),c=l.createEl("select",{cls:"csv-library-filter-select"});c.createEl("option",{text:"All",value:"all"});let d=["watched","read","finished","completed","done","yes","seen"],h=["watching","reading","in progress","in-progress"],u=Array.from(a).some(w=>d.includes(w.toLowerCase())),f=Array.from(a).some(w=>h.includes(w.toLowerCase()));(u||f)&&(c.createEl("option",{text:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500",value:"",attr:{disabled:"true"}}),u&&c.createEl("option",{text:"\u2713 Done",value:"__done__"}),f&&c.createEl("option",{text:"\u25D0 In Progress",value:"__inprogress__"}),c.createEl("option",{text:"\u25CB Not Started",value:"__notstarted__"})),a.size>0&&(c.createEl("option",{text:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500",value:"",attr:{disabled:"true"}}),Array.from(a).sort().forEach(w=>{c.createEl("option",{text:w,value:w})})),c.value=s.libraryStatusFilter;let g=l.createEl("select",{cls:"csv-library-filter-select"});g.createEl("option",{text:"All genres",value:"all"}),Array.from(r).sort().forEach(w=>{g.createEl("option",{text:w,value:w})}),g.value=s.libraryGenreFilter;let p=s.resolveCol(["Year","year","Date","date"]),b=s.resolveCol(["Rating","rating","Score","score","Score /5","Stars","stars"]),m=s.resolveCol(["Theme","theme","Tags","tags","Tag","tag","Mood","mood"]),v=(D=s.fileCfg.librarySort)!=null?D:"status",_=l.createEl("select",{cls:"csv-library-filter-select"}),k=[["status","Sort: Status"],["title","Sort: Title"]];b&&k.push(["rating","Sort: Rating"]),p&&k.push(["year","Sort: Year"]),k.forEach(([w,M])=>{let L=_.createEl("option",{text:M,value:w});w===v&&(L.selected=!0)}),_.addEventListener("change",()=>{let w=s.fileCfg;w.librarySort=_.value==="status"?void 0:_.value,s.saveFileCfg(w),s.renderView(!0)});let S=()=>{s.libraryStatusFilter=c.value,s.libraryGenreFilter=g.value,s.renderView(!0)};c.addEventListener("change",S),g.addEventListener("change",S);let x=s.rows.filter(w=>{var M,L;if(s.libraryStatusFilter!=="all"&&n){let O=((M=w[n])!=null?M:"").toLowerCase();if(s.libraryStatusFilter==="__done__"){if(!d.includes(O))return!1}else if(s.libraryStatusFilter==="__inprogress__"){if(!h.includes(O))return!1}else if(s.libraryStatusFilter==="__notstarted__"){if(d.includes(O)||h.includes(O))return!1}else if(O!==s.libraryStatusFilter.toLowerCase())return!1}if(s.libraryGenreFilter!=="all"&&!((L=w[e])!=null?L:"").split(",").map(V=>V.trim().toLowerCase()).includes(s.libraryGenreFilter.toLowerCase()))return!1;if(s.searchQuery.trim()){let O=s.searchQuery.toLowerCase().trim();if(!s.headers.some(V=>{var P;return((P=w[V])!=null?P:"").toLowerCase().includes(O)}))return!1}return!0});(s.libraryStatusFilter!=="all"||s.libraryGenreFilter!=="all"||s.searchQuery.trim())&&t.createDiv({cls:"csv-library-result-count",text:`Showing ${x.length} of ${s.rows.length} entries`});let y={};x.forEach(w=>{var L;let M=s.libraryGenreFilter!=="all"?[s.libraryGenreFilter]:((L=w[e])!=null?L:"Uncategorized").split(",").map(O=>O.trim()).filter(Boolean);M.length===0&&M.push("Uncategorized"),M.forEach(O=>{y[O]||(y[O]=[]),y[O].push(w)})});let C=t.createDiv({cls:"csv-library-sections"});if(Object.keys(y).sort().forEach(w=>{var A,j,Y,$,R;let M=y[w],L=C.createEl("details",{cls:"csv-library-section"}),O=w.toLowerCase(),V=((A=s.fileCfg.collapsedGroups)!=null?A:[]).map(B=>B.toLowerCase());L.open=!((j=s.collapsedGroups)!=null&&j.has(O)||V.includes(O)),L.addEventListener("toggle",()=>{var I;let B=s.fileCfg,H=((I=B.collapsedGroups)!=null?I:[]).map(q=>q.toLowerCase()),N=new Set(H);L.open?N.delete(O):N.add(O);let W=Array.from(N);W.length===H.length&&W.every(q=>H.includes(q))||(B.collapsedGroups=W,s.saveFileCfg(B))});let P=L.createEl("summary",{cls:"csv-library-section-header"});P.createSpan({cls:"csv-library-arrow",text:"\u25B6"}),P.createSpan({text:` ${w} `}),P.createSpan({cls:"csv-library-count",text:String(M.length)});let T=L.createDiv({cls:"csv-library-grid"}),U=(B,H)=>{var N,W;return((N=B[i])!=null?N:"").localeCompare((W=H[i])!=null?W:"")},F=(B,H)=>B===null&&H===null?0:B===null?1:H===null?-1:H-B;M.sort((B,H)=>{var N,W,I,q;if(v==="title")return U(B,H);if(v==="rating"&&b)return F(zs((N=B[b])!=null?N:""),zs((W=H[b])!=null?W:""))||U(B,H);if(v==="year"&&p){let Q=Z=>{var X;let nt=((X=Z[p])!=null?X:"").match(/\d{4}/);return nt?parseInt(nt[0],10):null};return F(Q(B),Q(H))||U(B,H)}if(n){let Q=((I=B[n])!=null?I:"").toLowerCase(),Z=((q=H[n])!=null?q:"").toLowerCase(),nt=d.includes(Q),X=d.includes(Z);if(nt!==X)return nt?-1:1;let tt=h.includes(Q),at=h.includes(Z);if(tt!==at)return tt?-1:1}return U(B,H)});let G=(Y=s.fileCfg.cardFields)!=null?Y:s.headers,z=(R=($=s.getImageCol)==null?void 0:$.call(s))!=null?R:null;M.forEach(B=>{var q,Q,Z,nt,X,tt,at,Wt;let H=T.createDiv({cls:"csv-library-card"});if(z){let rt=pn(s.app,(q=B[z])!=null?q:"",(Z=(Q=s.file)==null?void 0:Q.path)!=null?Z:"");if(rt){let pt=H.createEl("img",{cls:"csv-library-card-img",attr:{src:rt,loading:"lazy",alt:""}});pt.addEventListener("error",()=>pt.remove())}}let N=H.createDiv({cls:`csv-library-card-title ${(nt=s.isHighlighted)!=null&&nt.call(s,B)?"csv-title-highlight":""}`});if(n){let rt=((X=B[n])!=null?X:"").toLowerCase();d.includes(rt)&&N.createSpan({cls:"csv-library-done-dot"})}N.createSpan({text:(tt=B[i])!=null?tt:"Untitled"});let W=[],I=[];for(let rt of G){if(!rt)continue;let pt=String((at=B[rt])!=null?at:"").trim();if(pt)if(rt===b){let ft=er(pt,rt);ft&&H.createDiv({cls:"csv-library-card-rating",text:ft})}else if(rt===m)I.push(...pt.split(",").map(ft=>ft.trim()).filter(Boolean));else if(rt===p){let ft=pt.match(/\d{4}/);W.push(ft?ft[0]:pt)}else W.push(pt)}if(W.length&&H.createDiv({cls:"csv-library-card-meta",text:W.join(" \xB7 ")}),s.libraryGenreFilter!=="all"){let rt=((Wt=B[e])!=null?Wt:"").split(",").map(pt=>pt.trim()).filter(pt=>pt&&pt.toLowerCase()!==s.libraryGenreFilter.toLowerCase());I.push(...rt)}if(I.length){let rt=H.createDiv({cls:"csv-library-card-tags"});I.slice(0,3).forEach(pt=>{rt.createSpan({cls:"csv-library-card-tag",text:pt})})}H.addEventListener("click",()=>{var rt;s.openNoteExpander(B,(rt=s.getNotesCol())!=null?rt:"")}),H.addEventListener("contextmenu",rt=>s.openRowContextMenu(B,rt))})}),Object.keys(y).length===0){let w=C.createDiv({cls:"csv-empty-state"});w.createEl("p",{text:"No entries match your filters."}),w.createEl("button",{cls:"csv-clear-filters-btn",text:"Clear filters"}).addEventListener("click",()=>{s.libraryStatusFilter="all",s.libraryGenreFilter="all",s.searchQuery="",s.renderView()})}}var vi=require("obsidian");var ye=require("obsidian"),Zc="http://127.0.0.1:8765",Jc=6;async function Cr(s,t){let e;try{e=await(0,ye.requestUrl)({url:Zc,method:"POST",contentType:"application/json",body:JSON.stringify({action:s,version:Jc,params:t}),throw:!1})}catch(i){throw new Error("Couldn't reach Anki. Is the desktop app open with the AnkiConnect add-on installed?")}let n=e.json;if(n.error)throw new Error(n.error);return n.result}function Ai(s){var t,e,n;return(n=(e=(t=s.titleKey())!=null?t:s.resolveCol(["Quote","Headline","Phrase","Term","Word","Question","Front","Name","Title"]))!=null?e:s.headers[0])!=null?n:null}function td(s){let t=s.fileCfg.ankiFrontCol;return t&&s.headers.includes(t)?t:Ai(s)}function Li(s){return s.replace(/&/g,"&").replace(//g,">")}function ed(s,t,e){return s.headers.filter(n=>{var i;return n!==e&&((i=t[n])!=null?i:"").trim()}).map(n=>`${Li(n)}: ${Li(t[n].trim())}`).join("
")}async function _r(s){if(!s.file)return;let t=td(s);if(!t){new ye.Notice("No column to use as the Anki card front.",6e3);return}let e=s.file.basename,n=s.rows.filter(o=>{var r;return((r=o[t])!=null?r:"").trim()});if(!n.length){new ye.Notice(`Nothing to sync \u2014 no rows with a "${t}" value.`,6e3);return}let i=new ye.Notice(`Syncing ${n.length} cards to Anki deck \u201C${e}\u201D\u2026`,0);try{await Cr("createDeck",{deck:e});let o=n.map(c=>({deckName:e,modelName:"Basic",fields:{Front:Li(c[t].trim()),Back:ed(s,c,t)},options:{allowDuplicate:!1,duplicateScope:"deck"},tags:["datadeck"]})),r=await Cr("addNotes",{notes:o}),a=r.filter(c=>c!=null).length,l=r.length-a;i.hide(),new ye.Notice(`Anki sync: ${a} added${l?`, ${l} already present`:""} (deck \u201C${e}\u201D).`,6e3)}catch(o){i.hide(),new ye.Notice(`Anki sync failed: ${o instanceof Error?o.message:String(o)}`,8e3)}}var Ze=require("obsidian");var Vo=null;async function Qe(){if(Vo)return Vo;let s=await Promise.resolve().then(()=>(Ql(),Xl));return s.Chart.register(s.LineController,s.ScatterController,s.BarController,s.LineElement,s.PointElement,s.BarElement,s.LinearScale,s.CategoryScale,s.Filler,s.Tooltip,s.Legend),Vo=s,s}var Zl={pi:Math.PI,e:Math.E},Jl={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,sqrt:Math.sqrt,log:Math.log10,ln:Math.log,exp:Math.exp,abs:Math.abs,floor:Math.floor,ceil:Math.ceil,round:Math.round,sign:Math.sign},No={min:Math.min,max:Math.max,pow:Math.pow,atan2:Math.atan2};function _g(s){let t=[],e=0;for(;e{var u;return(u=e[n])!=null?u:null},o=()=>{var u;return(u=e[n++])!=null?u:null};function r(){let u=a();for(;;){let f=i();if((f==null?void 0:f.kind)==="op"&&(f.op==="+"||f.op==="-")){n++;let g=a(),p=u;u=f.op==="+"?m=>p(m)+g(m):m=>p(m)-g(m)}else return u}}function a(){let u=l();for(;;){let f=i();if((f==null?void 0:f.kind)==="op"&&(f.op==="*"||f.op==="/"||f.op==="%")){n++;let g=l(),p=u,b=f.op;u=b==="*"?m=>p(m)*g(m):b==="/"?m=>p(m)/g(m):m=>p(m)%g(m)}else if(f&&(f.kind==="num"||f.kind==="ident"||f.kind==="lparen")){let g=l(),p=u;u=b=>p(b)*g(b)}else return u}}function l(){let u=i();if((u==null?void 0:u.kind)==="op"&&u.op==="-"){n++;let f=l();return g=>-f(g)}return(u==null?void 0:u.kind)==="op"&&u.op==="+"?(n++,l()):c()}function c(){let u=d(),f=i();if((f==null?void 0:f.kind)==="op"&&f.op==="^"){n++;let g=l();return p=>Math.pow(u(p),g(p))}return u}function d(){var f,g,p,b,m;let u=o();if(!u)throw new Error("Unexpected end of formula");if(u.kind==="num"){let v=u.value;return()=>v}if(u.kind==="lparen"){let v=r();if(((f=o())==null?void 0:f.kind)!=="rparen")throw new Error("Missing closing )");return v}if(u.kind==="ident"){if(u.name==="x")return _=>_;if(u.name in Zl){let _=Zl[u.name];return()=>_}let v=((g=i())==null?void 0:g.kind)==="lparen";if(u.name in Jl||u.name in No){if(!v)throw new Error(`${u.name} needs parentheses, e.g. ${u.name}(x)`);n++;let _=r();if(u.name in No){if(((p=o())==null?void 0:p.kind)!=="comma")throw new Error(`${u.name}(a, b) needs two arguments`);let S=r();if(((b=o())==null?void 0:b.kind)!=="rparen")throw new Error("Missing closing )");let x=No[u.name];return y=>x(_(y),S(y))}if(((m=o())==null?void 0:m.kind)!=="rparen")throw new Error("Missing closing )");let k=Jl[u.name];return S=>k(_(S))}throw new Error(`Unknown name "${u.name}" \u2014 use x, pi, e, or a function like sin()`)}throw new Error(`Unexpected "${u.kind==="op"?u.op:u.kind}"`)}let h=r();if(n{var o;let n=0,i=0;for(let r of t){let a=((o=r[e])!=null?o:"").trim();a&&(n++,hn(a)!==null&&i++)}return i>=2&&i/n>=.7})}function Sg(s){let t=s.length;if(t<2)return null;let e=0,n=0,i=0,o=0,r=0;for(let f of s)e+=f.x,n+=f.y,i+=f.x*f.x,o+=f.x*f.y,r+=f.y*f.y;let a=t*i-e*e;if(a===0)return null;let l=(t*o-e*n)/a,c=(n-l*e)/t,d=n/t,h=0,u=0;for(let f of s){let g=f.y-(l*f.x+c);h+=g*g,u+=(f.y-d)*(f.y-d)}return{slope:l,intercept:c,r2:u===0?1:1-h/u}}function kg(s,t){let e=[...s].sort((o,r)=>o.x-r.x),n=t/2,i=0;return e.map(o=>{for(;i{let r=new Date(o);if(t==="month")return new Date(r.getFullYear(),r.getMonth(),1).getTime();let a=(r.getDay()+6)%7;return new Date(r.getFullYear(),r.getMonth(),r.getDate()-a).getTime()},i=new Map;return s.forEach(o=>{var l;let r=n(o.x),a=(l=i.get(r))!=null?l:{sum:0,n:0};a.sum+=o.y,a.n+=1,i.set(r,a)}),[...i.entries()].sort((o,r)=>o[0]-r[0]).map(([o,r])=>({x:o,y:e==="count"?r.n:e==="sum"?r.sum:r.sum/r.n}))}function Ls(s){var n;let t=(n=s.ownerDocument.defaultView)==null?void 0:n.getComputedStyle(s),e=(i,o)=>(t==null?void 0:t.getPropertyValue(i).trim())||o;return{accent:e("--interactive-accent","#378ADD"),muted:e("--text-muted","#888888"),grid:e("--background-modifier-border","rgba(128,128,128,0.25)"),fitLine:e("--text-faint","#999999"),formula:e("--color-orange","#e0883a"),series:[e("--color-blue","#4e79a7"),e("--color-green","#59a14f"),e("--color-red","#e15759"),e("--color-purple","#b07aa1"),e("--color-cyan","#76b7b2"),e("--color-pink","#ff9da7"),e("--color-yellow","#edc948")]}}var Ts=s=>{if(!Number.isFinite(s))return String(s);let t=Math.abs(s);return t!==0&&(t>=1e6||t<.001)?s.toExponential(2):String(Math.round(s*1e3)/1e3)},ec=s=>{let t=new Date(s);return isNaN(t.getTime())?String(s):me(t)};function ui(s,t){var b,m;let e=[],n=s.series.length>1,i=s.series.flatMap(v=>v.points),o=i.map(v=>v.x),r=i.length?Math.min(...o):(b=s.xMin)!=null?b:0,a=i.length?Math.max(...o):(m=s.xMax)!=null?m:10,l=i.filter(v=>v.size!==void 0),c=l.length?Math.min(...l.map(v=>v.size)):0,d=l.length?Math.max(...l.map(v=>v.size)):0,h=(v,_)=>v.size===void 0?_:d===c?7:3+11*Math.sqrt((v.size-c)/(d-c)),u=[];s.series.forEach((v,_)=>{var y;let k=s.connect?[...v.points].sort((C,E)=>C.x-E.x):v.points;if(!k.length)return;let S=n?t.series[_%t.series.length]:t.accent,x=s.connect?3:4;if(((y=s.smoothDays)!=null?y:0)>0?(e.push({type:"scatter",label:v.label||s.yLabel,csvSkipLegend:!0,data:k,backgroundColor:S,borderColor:S,pointRadius:2.5,pointHoverRadius:5}),e.push({type:"line",label:v.label||s.yLabel,data:kg(k,s.smoothDays*864e5),borderColor:S,backgroundColor:S,borderWidth:2,pointRadius:0,pointHitRadius:0,tension:.3})):e.push({type:s.connect?"line":"scatter",label:v.label||s.yLabel,data:k,backgroundColor:S,borderColor:S,borderWidth:1.5,pointRadius:l.length?k.map(C=>h(C,x)):x,pointHoverRadius:l.length?k.map(C=>h(C,x)+2):6,tension:.3}),s.fit==="linear"){let C=Sg(k),E=k.map(M=>M.x),D=Math.min(...E),w=Math.max(...E);if(C&&w>D){e.push({type:"line",label:`${v.label||"Best"} fit`,csvIsFit:!0,data:[{x:D,y:C.slope*D+C.intercept},{x:w,y:C.slope*w+C.intercept}],borderColor:n?S:t.fitLine,borderDash:[6,4],borderWidth:1.5,pointRadius:0,pointHitRadius:0});let M=` \xB7 R\xB2 = ${(Math.round(C.r2*1e3)/1e3).toFixed(3)}`,L=s.xIsDate?`${C.slope*864e5>=0?"+":""}${Ts(C.slope*864e5)} ${s.yLabel}/day${M}`:`y = ${Ts(C.slope)}x ${C.intercept>=0?"+":"\u2212"} ${Ts(Math.abs(C.intercept))}${M}`;u.push(n?`${v.label}: ${L}`:s.xIsDate?`Trend: ${L}`:L)}}});let f=u.length?u.join(" \xB7 "):null,g=null;if(s.formula.trim())try{let v=tc(s.formula),_=[],k=160;for(let S=0;S<=k;S++){let x=r+(a-r)*S/k,y=v(x);Number.isFinite(y)&&_.push({x,y})}_.length&&e.push({type:"line",label:s.formula.trim(),data:_,borderColor:t.formula,borderWidth:1.5,pointRadius:0,pointHitRadius:0,tension:0})}catch(v){g=v instanceof Error?v.message:String(v)}return{config:{type:"scatter",data:{datasets:e},options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{type:"linear",title:{display:!s.xIsDate&&!!s.xLabel,text:s.xLabel,color:t.muted},ticks:{color:t.muted,...s.xIsDate?{callback:v=>ec(Number(v)),maxTicksLimit:8}:{}},grid:{color:t.grid}},y:{title:{display:!!s.yLabel,text:s.yLabel,color:t.muted},ticks:{color:t.muted},grid:{color:t.grid}}},plugins:{legend:{display:e.filter(v=>!v.csvIsFit&&!v.csvSkipLegend).length>1,labels:{color:t.muted,boxWidth:12,filter:v=>{var k;let _=e[(k=v.datasetIndex)!=null?k:-1];return!(_!=null&&_.csvIsFit||_!=null&&_.csvSkipLegend)}}},tooltip:{callbacks:{label:v=>{let _=v.raw,k=s.xIsDate?ec(_.x):Ts(_.x),S=n&&v.dataset.label?`[${v.dataset.label}] `:"",x=_.label?`${_.label}: `:"",y=_.size!==void 0&&s.sizeLabel?` \xB7 ${s.sizeLabel}: ${Ts(_.size)}`:"";return`${S}${x}(${k}, ${Ts(_.y)})${y}`}}}}}},fitText:f,formulaError:g}}var di="(row number)";function $o(s,t,e,n,i,o,r,a){let l=new Map,c=0;return s.forEach((h,u)=>{var v,_,k,S,x;let f=hn((v=h[e])!=null?v:""),g;if(t===di)g=u+1;else if(o){let y=r((_=h[t])!=null?_:"");g=y?y.getTime():null}else g=hn((k=h[t])!=null?k:"");if(g===null||f===null){c++;return}let p=n?((S=h[n])!=null?S:"").trim()||"\u2014":"",b=l.get(p);b||(b=[],l.set(p,b));let m={x:g,y:f,label:a(h)};if(i){let y=hn((x=h[i])!=null?x:"");y!==null&&(m.size=y)}b.push(m)}),{series:[...l.entries()].sort((h,u)=>h[0]==="\u2014"?1:u[0]==="\u2014"?-1:h[0].localeCompare(u[0])).map(([h,u])=>({label:h,points:u})),skipped:c}}function wg(s,t,e){return s.filter(n=>{if(e.has(n))return!1;let i=new Set(t.map(o=>{var r;return((r=o[n])!=null?r:"").trim()}).filter(Boolean));return i.size>=2&&i.size<=10})}function Eg(s,t,e){return s.filter(n=>{if(e.has(n))return!1;let i=new Set(t.map(o=>{var r;return((r=o[n])!=null?r:"").trim()}).filter(Boolean));return i.size>=1&&i.size<=30})}function zo(s,t,e,n,i){let o=new Map,r=new Set,a=0,l=xt(t);s.forEach(u=>{var m,v,_;let f=0;if(i!=="count"){let k=hn((m=u[e!=null?e:""])!=null?m:"");if(k===null){a++;return}f=k}let g=((v=u[t])!=null?v:"").trim(),p=l?g?g.split(",").map(k=>k.trim()).filter(Boolean):["\u2014"]:[g||"\u2014"],b=n?((_=u[n])!=null?_:"").trim()||"\u2014":"";r.add(b),p.forEach(k=>{var y;let S=o.get(k);S||(S=new Map,o.set(k,S));let x=(y=S.get(b))!=null?y:{sum:0,n:0};x.sum+=f,x.n+=1,S.set(b,x)})});let c=(u,f)=>u==="\u2014"?1:f==="\u2014"?-1:u.localeCompare(f,void 0,{numeric:!0}),d=[...o.keys()].sort(c),h=[...r].sort(c).map(u=>({label:u,values:d.map(f=>{var p;let g=(p=o.get(f))==null?void 0:p.get(u);return!g||g.n===0?0:i==="count"?g.n:i==="sum"?g.sum:g.sum/g.n})}));return{categories:d,series:h,skipped:a}}function Ho(s,t,e,n){let i=s.series.length>1;return{type:"bar",data:{labels:s.categories,datasets:s.series.map((o,r)=>({label:o.label||e,data:o.values,backgroundColor:i?n.series[r%n.series.length]:n.accent,borderRadius:3}))},options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{title:{display:!!t,text:t,color:n.muted},ticks:{color:n.muted,autoSkip:!1,maxRotation:60},grid:{display:!1}},y:{beginAtZero:!0,title:{display:!!e,text:e,color:n.muted},ticks:{color:n.muted},grid:{color:n.grid}}},plugins:{legend:{display:i,labels:{color:n.muted,boxWidth:12}}}}}}async function Dg(s,t){var e,n,i,o,r,a;try{let l=t.ownerDocument.createElement("canvas");l.width=t.width,l.height=t.height;let c=l.getContext("2d");if(!c||!l.toBlob){new Ze.Notice("PNG export isn't available here.");return}let d=(e=t.ownerDocument.defaultView)==null?void 0:e.getComputedStyle(t.ownerDocument.body);c.fillStyle=(d==null?void 0:d.getPropertyValue("--background-primary").trim())||"#ffffff",c.fillRect(0,0,l.width,l.height),c.drawImage(t,0,0);let h=await new Promise(m=>l.toBlob(m,"image/png"));if(!h){new Ze.Notice("PNG export failed.");return}let u=(o=(i=(n=s.file)==null?void 0:n.parent)==null?void 0:i.path)!=null?o:"",f=new Date,g=`${me(f)} ${String(f.getHours()).padStart(2,"0")}${String(f.getMinutes()).padStart(2,"0")}`,p=`${(a=(r=s.file)==null?void 0:r.basename)!=null?a:"chart"} chart ${g}.png`,b=(0,Ze.normalizePath)(u?`${u}/${p}`:p);await s.app.vault.createBinary(b,await h.arrayBuffer()),new Ze.Notice(`Saved ${b}`)}catch(l){new Ze.Notice(`PNG export failed: ${l instanceof Error?l.message:String(l)}`,6e3)}}function sc(s,t,e){t.createEl("button",{cls:"csv-cfg-btn csv-chart-export-btn",text:"\u2B07 PNG",title:"Save this chart as a PNG next to the CSV"}).addEventListener("click",()=>{Dg(s,e)})}function fi(s){return s.rows.length>=2&&hi(s.headers,s.rows).length>=1}async function nc(s,t){var H,N,W;let e=s.getFilteredRows(),n=hi(s.headers,s.rows);if(!n.length){t.createEl("p",{text:"No numeric column to chart.",cls:"csv-empty-state"});return}s.searchQuery.trim()&&t.createDiv({cls:"csv-search-results",text:`Chart over ${e.length} of ${s.rows.length} entries`});let i=s.fileCfg,o=s.getDateCol(),r=(H=s.titleKey())!=null?H:s.headers[0],a=new Set([r,...n,...o?[o]:[]]);s.headers.forEach(I=>{s.isNotesCol(I)&&a.add(I)});let l=Eg(s.headers,s.rows,a),c=[...o?[o]:[],...n.filter(I=>I!==o),di,...l],d=i.chartXCol&&c.includes(i.chartXCol)?i.chartXCol:c[0],h=l.includes(d),u=i.chartAgg==="sum"||i.chartAgg==="avg"?i.chartAgg:"count",f=n,g=i.chartYCol&&f.includes(i.chartYCol)?i.chartYCol:(N=f.find(I=>I!==d))!=null?N:f[0],p=i.chartFit==="linear"?"linear":"none",b=(W=i.chartFormula)!=null?W:"",m=t.createDiv({cls:"csv-chart-view"}),v=m.createDiv({cls:"csv-chart-controls"}),_=I=>{s.saveFileCfg({...s.fileCfg,...I}),s.renderViewPreservingScroll()},k=(I,q,Q,Z)=>{let nt=v.createDiv({cls:"csv-chart-control"});nt.createSpan({cls:"csv-chart-control-label",text:I});let X=nt.createEl("select",{cls:"csv-chart-select",attr:{"aria-label":I}});return q.forEach(tt=>{let at=X.createEl("option",{text:tt,value:tt});tt===Q&&(at.selected=!0)}),X.addEventListener("change",()=>Z(X.value)),X};k("X",c,d,I=>_({chartXCol:I})),(!h||u!=="count")&&k(h?`Y (${u})`:"Y",f,g,I=>_({chartYCol:I})),h&&k("Agg",["count","sum","avg"],u,I=>_({chartAgg:I}));let S=new Set([d,g,r]);s.headers.forEach(I=>{s.isNotesCol(I)&&S.add(I)});let x=wg(s.headers,s.rows,S),y="\u2014",C=i.chartHueCol&&x.includes(i.chartHueCol)?i.chartHueCol:null;x.length&&k("Color",[y,...x],C!=null?C:y,I=>_({chartHueCol:I===y?void 0:I}));let E=!h&&d!==di&&(d===o||s.isDateCol(d)),D=E&&(i.chartBucket==="week"||i.chartBucket==="month")?i.chartBucket:null,w=i.chartAgg==="avg"||i.chartAgg==="count"?i.chartAgg:"sum",M=E&&!D&&!!i.chartSmooth;E&&(k("By",["day","week","month"],D!=null?D:"day",I=>_({chartBucket:I==="day"?void 0:I})),D&&k("Agg",["sum","avg","count"],w,I=>_({chartAgg:I})));let L=n.filter(I=>I!==g&&I!==d),O=!h&&!D&&i.chartSizeCol&&L.includes(i.chartSizeCol)?i.chartSizeCol:null;if(!h&&!D&&L.length&&k("Size",[y,...L],O!=null?O:y,I=>_({chartSizeCol:I===y?void 0:I})),h){let I=zo(e,d,u==="count"?null:g,C,u),q=m.createDiv({cls:"csv-chart-wrap"}),Q=q.createEl("canvas",{cls:"csv-chart-canvas"});if(!I.categories.length){q.remove(),m.createEl("p",{text:`No rows with a "${d}" value to chart.`,cls:"csv-empty-state"});return}I.skipped>0&&m.createDiv({cls:"csv-chart-footer"}).createSpan({cls:"csv-chart-skipped",text:`${I.skipped} row${I.skipped===1?"":"s"} skipped (no numeric value)`});let Z=u==="count"?"count":`${u}(${g})`,nt=Ho(I,d,Z,Ls(t));s.chartInstance&&(s.chartInstance.destroy(),s.chartInstance=null);let{Chart:X}=await Qe();if(!Q.isConnected)return;s.chartInstance=new X(Q,nt),sc(s,v,Q);return}v.createEl("button",{cls:`csv-cfg-btn csv-chart-fit-btn ${p==="linear"?"active":""}`,text:"Best fit",title:"Toggle a least-squares fit line"}).addEventListener("click",()=>_({chartFit:p==="linear"?"none":"linear"})),E&&!D&&v.createEl("button",{cls:`csv-cfg-btn csv-chart-smooth-btn ${M?"active":""}`,text:"Smooth",title:"Toggle a 7-day rolling average (raw values stay as dots)"}).addEventListener("click",()=>_({chartSmooth:M?void 0:!0}));let P=v.createDiv({cls:"csv-chart-control csv-chart-formula-wrap"});P.createSpan({cls:"csv-chart-control-label",text:"y ="});let T=P.createEl("input",{cls:"csv-chart-formula-input",type:"text",value:b,placeholder:"overlay, e.g. 2x + 1",attr:{spellcheck:"false",autocomplete:"off",enterkeyhint:"done"}}),U=()=>{T.value.trim()!==b.trim()&&_({chartFormula:T.value})};T.addEventListener("change",U),T.addEventListener("keydown",I=>{I.key==="Enter"&&(I.preventDefault(),T.blur())});let F=$o(e,d,g,C,O,E,I=>s.parseDate(I),I=>s.getTitle(I)),G=F.skipped,z=D?F.series.map(I=>({label:I.label,points:Bo(I.points,D,w)})):F.series,A=m.createDiv({cls:"csv-chart-wrap"}),j=A.createEl("canvas",{cls:"csv-chart-canvas"}),Y=m.createDiv({cls:"csv-chart-footer"});if(!z.some(I=>I.points.length)){A.remove(),Y.remove(),m.createEl("p",{text:`No rows with both "${d}" and "${g}" values to plot.`,cls:"csv-empty-state"});return}let $={series:z,xIsDate:E,xLabel:d===di?"row":d,yLabel:D?w==="count"?`count / ${D}`:`${w}(${g}) / ${D}`:g,connect:E,fit:p,formula:b,sizeLabel:O!=null?O:"",smoothDays:M?7:0},R=ui($,Ls(t));R.fitText&&Y.createSpan({cls:"csv-chart-fit-text",text:R.fitText}),R.formulaError&&Y.createSpan({cls:"csv-chart-formula-error",text:`formula: ${R.formulaError}`}),G>0&&Y.createSpan({cls:"csv-chart-skipped",text:`${G} row${G===1?"":"s"} skipped (no numeric value)`}),s.chartInstance&&(s.chartInstance.destroy(),s.chartInstance=null);let{Chart:B}=await Qe();j.isConnected&&(s.chartInstance=new B(j,R.config),sc(s,v,j))}function gi(s){return s.resolveCol(["Type","type","Kind","kind","Item","item"])}function jo(s){var t;return(t=s.resolveCol(["Project","project","Projects","projects","Area","area"]))!=null?t:$t(s)}function rc(s){return s.resolveCol(["Due","due","Deadline","deadline","Due Date","Due date","due date"])}function pi(s){return s.resolveCol(["Priority","priority","Prio","prio","Importance","importance"])}var Mg=["task","todo","to-do","action",""],Tg=["task","todo","to-do","action","note","idea","reference","ref"],ac=["done","complete","completed","finished","closed","resolved","yes","x","\u2713","true","1"],Lg={high:0,med:1,medium:1,normal:1,low:2};function Fe(s){if(rc(s)||pi(s))return!0;let t=gi(s);return t?s.rows.some(e=>{var n;return Tg.includes(((n=e[t])!=null?n:"").trim().toLowerCase())}):!1}function Wo(s,t,e){var n;return e?ac.includes(((n=t[e])!=null?n:"").trim().toLowerCase()):!1}function ic(s){let t=Lg[(s!=null?s:"").trim().toLowerCase()];return t===void 0?3:t}function oc(s){return(s!=null?s:"").trim()?0:1}function Ag(){return me()}function Rg(s,t){let e=new Map;s.rows.forEach(o=>{var a,l;let r=((a=o[t])!=null?a:"").trim();r&&ac.includes(r.toLowerCase())&&e.set(r,((l=e.get(r))!=null?l:0)+1)});let n="done",i=0;return e.forEach((o,r)=>{o>i&&(n=r,i=o)}),n}function mi(s,t){var D,w;let e=jo(s),n=gi(s),i=s.getStatusCol(),o=rc(s),r=pi(s),a=(D=s.titleKey())!=null?D:s.headers[0],l=t.createDiv({cls:"csv-library-filters"}),c=new Set;e&&s.rows.forEach(M=>{var L;((L=M[e])!=null?L:"").split(",").map(O=>O.trim()).filter(Boolean).forEach(O=>c.add(O))});let d=l.createEl("select",{cls:"csv-library-filter-select"});d.createEl("option",{text:e?"All projects":"All",value:"all"}),Array.from(c).sort().forEach(M=>d.createEl("option",{text:M,value:M})),d.value=s.taskProjectFilter;let h=new Set;n&&s.rows.forEach(M=>{var O;let L=((O=M[n])!=null?O:"").trim();L&&h.add(L)});let u=null;h.size>0&&(u=l.createEl("select",{cls:"csv-library-filter-select"}),u.createEl("option",{text:"All types",value:"all"}),Array.from(h).sort().forEach(M=>u.createEl("option",{text:M,value:M})),u.value=s.taskTypeFilter);let f=()=>{s.taskProjectFilter=d.value,u&&(s.taskTypeFilter=u.value),s.renderView(!0)};d.addEventListener("change",f),u==null||u.addEventListener("change",f);let g=s.searchQuery.toLowerCase().trim(),p=s.rows.filter(M=>{var L,O;return!(s.taskProjectFilter!=="all"&&e&&!((L=M[e])!=null?L:"").split(",").map(P=>P.trim().toLowerCase()).includes(s.taskProjectFilter.toLowerCase())||s.taskTypeFilter!=="all"&&n&&((O=M[n])!=null?O:"").trim().toLowerCase()!==s.taskTypeFilter.toLowerCase()||g&&!s.headers.some(V=>{var P;return((P=M[V])!=null?P:"").toLowerCase().includes(g)}))});(s.taskProjectFilter!=="all"||s.taskTypeFilter!=="all"||g)&&t.createDiv({cls:"csv-library-result-count",text:`Showing ${p.length} of ${s.rows.length} entries`});let b={},m=M=>{var O;return e&&((O=M[e])!=null?O:"").split(",").map(V=>V.trim()).filter(Boolean)[0]||"\u2014"};p.forEach(M=>{var P,T,U;let L=n?((P=M[n])!=null?P:"").trim():"",O=Mg.includes(L.toLowerCase())?"Tasks":L,V=m(M);b[O]||(b[O]={}),((U=(T=b[O])[V])!=null?U:T[V]=[]).push(M)});let v=t.createDiv({cls:"csv-tasks"}),_=Ag(),k=i?Rg(s,i):"done",x=((w=s.fileCfg.cardFields)!=null?w:s.headers).filter(M=>M!==e&&M!==n&&M!==i),y=[];i&&y.push({name:"",cls:"csv-tasks-check-cell"}),x.forEach(M=>{let L="";M===a?L="csv-tasks-name-cell":M===o?L="csv-tasks-due":M===r?L="csv-tasks-priority":s.isNotesCol(M)?L="csv-tasks-generic-cell csv-tasks-notes-cell":L="csv-tasks-generic-cell",y.push({name:M,cls:L})});let C=(M,L)=>{L.sort((O,V)=>{var U,F,G,z,A,j;let P=Wo(s,O,i),T=Wo(s,V,i);if(P!==T)return P?1:-1;if(r){let Y=ic((U=O[r])!=null?U:"")-ic((F=V[r])!=null?F:"");if(Y)return Y}if(o){let Y=oc((G=O[o])!=null?G:"")-oc((z=V[o])!=null?z:"");if(Y)return Y;let $=((A=O[o])!=null?A:"").localeCompare((j=V[o])!=null?j:"");if($)return $}return s.getTitle(O).localeCompare(s.getTitle(V))}),L.forEach(O=>{let V=Wo(s,O,i),P=M.createEl("tr");if(i){let U=P.createEl("td",{cls:"csv-tasks-check-cell"}).createEl("span",{cls:`csv-tasks-check ${V?"is-done":""}`,text:V?"\u2713":""});U.setAttr("title",V?"Mark not done":"Mark done"),U.addEventListener("click",F=>{F.stopPropagation(),O[i]=V?"":k,s.scheduleSave(),s.renderView(!0)})}x.forEach(T=>{var U,F,G;if(T===a)Og(s,P,O,a,V);else if(T===o){let z=P.createEl("td",{cls:"csv-tasks-due csv-tasks-editable"}),A=o?((U=O[o])!=null?U:"").slice(0,10):"";z.setText(A||"\u2014"),A&&!V&&A<_&&z.addClass("csv-tasks-overdue"),Ns(s,z,O,T)}else if(T===r){let z=P.createEl("td",{cls:"csv-tasks-priority csv-tasks-editable",text:r&&O[r]||"\u2014"});z.addEventListener("click",A=>{var Y;A.stopPropagation();let j=Array.from(new Set([...s.getColumnValues(r),"high","medium","low"]));It(z,(Y=O[r])!=null?Y:"",j,$=>{O[r]=$,s.scheduleSave(),s.renderView(!0)},s.contentEl)})}else if(s.isNotesCol(T)){let z=((F=O[T])!=null?F:"").replace(/#{1,6}\s/g,"").replace(/[*_>`]/g,"").replace(/\n+/g," ").trim(),A=z?z.length>50?z.slice(0,48)+"\u2026":z:"\u2014",j=P.createEl("td",{text:A,cls:"csv-tasks-generic-cell csv-tasks-notes-cell csv-tasks-editable"});Ns(s,j,O,T)}else{let z=(G=O[T])!=null?G:"",A=z.length>40?z.slice(0,38)+"\u2026":z,j=P.createEl("td",{text:A||"\u2014",cls:"csv-tasks-generic-cell csv-tasks-editable"});Ns(s,j,O,T)}}),P.addEventListener("contextmenu",T=>s.openRowContextMenu(O,T))})},E=Object.keys(b).sort((M,L)=>M==="Tasks"?-1:L==="Tasks"?1:M.localeCompare(L));if(E.forEach(M=>{Pg(s,v,M==="Tasks"?M:Tt(M),b[M],C,y)}),E.length===0){let M=v.createDiv({cls:"csv-empty-state"});M.createEl("p",{text:g||s.taskProjectFilter!=="all"||s.taskTypeFilter!=="all"?"No entries match your filters.":"No tasks yet."}),(g||s.taskProjectFilter!=="all"||s.taskTypeFilter!=="all")&&M.createEl("button",{cls:"csv-clear-filters-btn",text:"Clear filters"}).addEventListener("click",()=>{s.taskProjectFilter="all",s.taskTypeFilter="all",s.searchQuery="",s.renderView()})}}function Pg(s,t,e,n,i,o){if(Object.keys(n).length===0)return;t.createDiv({cls:"csv-tasks-section-header",text:e});let r=t.createDiv({cls:"csv-tasks-section"});Object.keys(n).sort().forEach(a=>{let l=n[a],c=r.createEl("details",{cls:"csv-tasks-group"});c.open=!0;let d=c.createEl("summary",{cls:"csv-tasks-group-header"});d.createSpan({cls:"csv-tasks-arrow",text:"\u25B6"}),d.createSpan({text:` ${a} `}),d.createSpan({cls:"csv-tasks-count",text:String(l.length)});let u=c.createDiv({cls:"csv-tasks-table-wrapper"}).createEl("table",{cls:"csv-tasks-table"}),f=120;o.forEach(m=>{m.cls.includes("check-cell")?f+=30:m.cls.includes("priority")?f+=90:m.cls.includes("due")?f+=150:m.cls.includes("notes-cell")?f+=140:m.cls.includes("generic-cell")&&(f+=150)}),u.style.minWidth=`${f}px`;let p=u.createEl("thead").createEl("tr");o.forEach(m=>p.createEl("th",{text:m.name,cls:m.cls}));let b=u.createEl("tbody");i(b,l)})}function Og(s,t,e,n,i){var h;let o=t.createEl("td",{cls:"csv-tasks-name-cell"}),r=(h=s.isHighlighted)!=null&&h.call(s,e)?"csv-title-highlight":"",a=o.createSpan({cls:`csv-tasks-link ${i?"csv-tasks-done":""} ${r}`,text:e[n]||"Untitled"}),l=s.getNotesCol();a.addEventListener("click",()=>{l?s.openNoteExpander(e,l):s.openOrCreateNotes(e)});let c=s.notesFileExists(e),d=o.createEl("button",{cls:`csv-tasks-page-icon ${c?"exists":""}`,text:c?"\u{1F4C4}":"+"});d.setAttr("title",c?"Open page":"Create page"),d.addEventListener("click",u=>{u.stopPropagation(),s.openOrCreateNotes(e)})}function bi(s){let t=[];return s.isTravelFile()&&t.push({id:"travel",label:"Travel"}),s.hasDateColumn()&&t.push({id:"dashboard",label:"Dashboard"}),Fe(s)&&t.push({id:"tasks",label:"Tasks"}),$t(s)&&(t.push({id:"library",label:"Cards"}),t.push({id:"kanban-genre",label:"Kanban"})),t.push({id:"table",label:"Table"}),s.rows.length>0&&t.push({id:"focus",label:"Focus"}),Sn(s)&&t.push({id:"stats",label:"Stats"}),fi(s)&&t.push({id:"chart",label:"Chart"}),t}function lc(s,t){var u,f,g;let e=t.createDiv({cls:"csv-toolbar"});e.createDiv({cls:"csv-toolbar-title",text:(f=(u=s.file)==null?void 0:u.basename)!=null?f:""});let n=e.createDiv({cls:"csv-toolbar-controls"});n.createDiv({cls:"csv-row-count",text:`${s.rows.length} entries`});let i=n.createDiv({cls:"csv-mode-group"}),o=bi(s),r=i.createEl("select",{cls:"csv-mode-select",attr:{"aria-label":"View mode"}});if(o.forEach(({id:p,label:b})=>{let m=r.createEl("option",{text:b,value:p});s.mode===p&&(m.selected=!0)}),r.addEventListener("change",()=>{s.mode=r.value,s.renderView()}),s.mode!=="dashboard"){let p=n.createEl("button",{cls:"csv-cfg-btn csv-search-toggle",text:"\u{1F50D}",title:"Search"}),b=n.createDiv({cls:"csv-search-wrap"}),m=b.createDiv({cls:"csv-search-input-wrap"}),v=m.createEl("input",{cls:"csv-search-input",type:"text",placeholder:"Search...",value:s.searchQuery,attr:{inputmode:"search",enterkeyhint:"search",autocomplete:"off"}}),_=m.createEl("button",{cls:"csv-search-clear",text:"\xD7",title:"Clear search"});_.toggleClass("is-hidden",!s.searchQuery),b.createEl("button",{cls:"csv-search-done",text:"Done",title:"Dismiss keyboard"}).addEventListener("click",x=>{if(x.preventDefault(),!v.value){e.removeClass("csv-toolbar--search-expanded"),p.removeClass("has-query"),s.searchQuery="",s.renderView(!0);return}v.blur()});let S=null;v.addEventListener("input",x=>{s.searchQuery=x.target.value,_.toggleClass("is-hidden",!s.searchQuery),p.toggleClass("has-query",!!s.searchQuery),S!==null&&window.clearTimeout(S),S=window.setTimeout(()=>{S=null,s.renderView(!0)},120)}),v.addEventListener("keydown",x=>{x.key==="Enter"&&(x.preventDefault(),v.blur())}),_.addEventListener("click",()=>{s.searchQuery="",v.value="",_.addClass("is-hidden"),p.removeClass("has-query"),v.focus({preventScroll:!0}),s.renderView(!0)}),s.searchQuery&&p.addClass("has-query"),p.addEventListener("click",()=>{e.addClass("csv-toolbar--search-expanded"),v.focus({preventScroll:!0})})}if(s.mode==="table"&&s.hasDateColumn()){let p=(g=s.fileCfg.sortNewestFirst)!=null?g:!0;n.createEl("button",{cls:`csv-cfg-btn ${p?"active":""}`,text:p?"\u2193 Newest":"\u2191 Oldest",title:"Toggle sort order"}).addEventListener("click",()=>{var v;let m=s.fileCfg;m.sortNewestFirst=!((v=m.sortNewestFirst)==null||v),s.saveFileCfg(m),s.tableSortCol=null,s.renderViewPreservingScroll()})}let a=()=>{var b,m;let p={title:s.resolveCol(ge),category:s.resolveCol(ss),status:s.resolveCol(ns),notes:s.resolveCol(pe),image:s.resolveCol(es),anki:Ai(s)};new bn(s.app,s.headers,(m=(b=s.file)==null?void 0:b.path)!=null?m:"",s.fileCfg,s.autoDetectBooleanColumns(),s.autoDetectCategoricalColumns(),p,bi(s),v=>{s.saveFileCfg(v),v.defaultMode&&(s.mode=v.defaultMode),s.renderView()},()=>s.headers,()=>s.fileCfg,v=>s.addColumn(v),v=>s.removeColumn(v),v=>s.cleanupBooleanColumn(v)).open()},l=()=>s.backupToArchive(),c=()=>_r(s);n.createEl("button",{cls:"csv-cfg-btn csv-cfg-btn-secondary",text:"\u2699 Config",title:"Configure this file's columns and views"}).addEventListener("click",a),n.createEl("button",{cls:"csv-cfg-btn csv-cfg-btn-secondary",text:"\u{1F4BE} Backup",title:"Copy this file to Archive/ with today's date"}).addEventListener("click",l),n.createEl("button",{cls:"csv-cfg-btn csv-cfg-btn-secondary",text:"\u{1F3B4} Anki",title:"Sync rows to Anki (needs Anki desktop + AnkiConnect)"}).addEventListener("click",c),n.createEl("button",{cls:"csv-add-btn",text:"+ Add"}).addEventListener("click",()=>s.openAddModal()),n.createEl("button",{cls:"csv-cfg-btn csv-cfg-btn-overflow",text:"\u22EF",title:"More actions"}).addEventListener("click",p=>{let b=new vi.Menu;b.addItem(m=>m.setTitle("Config").setIcon("settings").onClick(a)),b.addItem(m=>m.setTitle("Backup").setIcon("save").onClick(l)),b.addItem(m=>m.setTitle("Sync to Anki").setIcon("layers").onClick(c)),b.addSeparator(),b.addItem(m=>m.setTitle("Built 2026-07-17 00:56").setIcon("info").setDisabled(!0)),b.showAtMouseEvent(p)}),n.createEl("button",{cls:"csv-cfg-btn csv-cfg-btn-secondary csv-info-btn",text:"\u24D8",title:"Built 2026-07-17 00:56 \u2014 click to confirm"}).addEventListener("click",()=>new vi.Notice("datadeck \u2014 built 2026-07-17 00:56",4e3))}function Fg(s){return s&&typeof s=="object"&&"basename"in s?s:null}var Ig=["Author","author","By","by","Source","source","Speaker","speaker","Artist","artist","Director","director"];async function cc(s,t,e,n){var v,_,k;let i=t.split(` -`).map(S=>S.trim()).filter(Boolean),o=S=>{var x,y;return(y=(x=i.find(C=>C.startsWith(S+":")))==null?void 0:x.slice(S.length+1).trim())!=null?y:""},r=o("file");if(!r){e.createEl("p",{text:"Error: No file specified. Use: file: yourfile.csv",cls:"csv-add-error"});return}let a=s.vault.getAbstractFileByPath(n.sourcePath),l=(_=(v=a==null?void 0:a.parent)==null?void 0:v.path)!=null?_:"",c=Qt(r,l),d=Fg(s.vault.getAbstractFileByPath(c));if(!d){e.createEl("p",{text:`Error: File not found: ${c}`,cls:"csv-add-error"});return}let h=[],u=[];try{let S=wt(await s.vault.read(d));h=S.headers,u=S.rows}catch(S){e.createEl("p",{text:`Error reading file: ${S}`,cls:"csv-add-error"});return}if(!u.length){e.createEl("p",{text:"No entries in file.",cls:"csv-add-error"});return}let f=o("field"),g=(k=h.find(S=>S.toLowerCase()===f.toLowerCase()))!=null?k:h[0],p=Ig.map(S=>h.find(x=>x===S)).find(Boolean),b=e.createDiv({cls:"csv-random-card"}),m=()=>{var w;b.empty();let S=u.filter(M=>{var L;return((L=M[g])!=null?L:"").trim()}),x=S.length?S:u,y=x[Math.floor(Math.random()*x.length)];b.createDiv({cls:"csv-random-text",text:y[g]||"\u2014"});let C=p?((w=y[p])!=null?w:"").trim():"";C&&b.createDiv({cls:"csv-random-sub",text:`\u2014 ${C}`});let E=b.createDiv({cls:"csv-random-foot"});E.createSpan({cls:"csv-random-src",text:d.basename}),E.createEl("button",{cls:"csv-random-btn",text:"\u21BB",title:"Another one"}).addEventListener("click",m)};m()}async function dc(s,t){var A,j,Y;let e=s.getDateCol();if(!e){t.createEl("p",{text:"No date column detected.",cls:"csv-empty-state"});return}let n=s.getBooleanColumns(),i=s.getNotesCol(),o=s.formatDate(new Date),r=[...s.rows].sort(($,R)=>{var B,H;return((B=$[e])!=null?B:"").localeCompare((H=R[e])!=null?H:"")});s.selectedDate||(s.selectedDate=o);let a=r.find($=>$[e]===s.selectedDate),l=s.selectedDate===o;t.addClass("csv-dashboard");let c=[...new Set([...r.map($=>$[e]),o])].filter(Boolean).sort(),d=t.createDiv({cls:"csv-dash-nav"});d.createEl("button",{cls:"csv-dash-nav-btn csv-dash-back-btn",text:"\u25C0"}).addEventListener("click",()=>{let $=c.indexOf(s.selectedDate);if($>0)s.selectedDate=c[$-1],s.renderView();else if($===-1&&c.length>0){let R=c.filter(B=>B0&&(s.selectedDate=R[R.length-1],s.renderView())}});let u=d.createDiv({cls:"csv-dash-date"});l&&u.createSpan({cls:"csv-dash-today-dot"});let f=u.createEl("select",{cls:"csv-dash-date-select"});if(c.forEach($=>{let R=f.createEl("option",{text:$,value:$});$===s.selectedDate&&(R.selected=!0)}),f.addEventListener("change",()=>{s.selectedDate=f.value,s.renderView()}),d.createEl("button",{cls:"csv-dash-nav-btn",text:"\u25B6"}).addEventListener("click",()=>{let $=c.indexOf(s.selectedDate);if($>=0&&$B>s.selectedDate);R.length>0&&(s.selectedDate=R[0],s.renderView())}}),l||d.createEl("button",{cls:"csv-dash-today-btn",text:"Today"}).addEventListener("click",()=>{s.selectedDate=o,s.renderView()}),!a){let $=t.createDiv({cls:"csv-dash-add-section"});$.createEl("p",{text:`No entry for ${s.selectedDate}`}),$.createEl("button",{cls:"csv-dash-add-btn",text:`+ Add entry for ${s.selectedDate}`}).addEventListener("click",()=>{let B={};s.headers.forEach(H=>B[H]=""),B[e]=s.selectedDate,s.rows.push(B),s.scheduleSave(),s.renderView()})}if(a){let $=t.createDiv({cls:"csv-dash-habits"});$.createEl("h3",{text:s.selectedDate===o?"Today":s.selectedDate,cls:"csv-dash-section-title"});let R=$.createDiv({cls:"csv-dash-habits-grid"});n.forEach(H=>{let N=s.isTruthy(a[H]),W=R.createDiv({cls:`csv-dash-habit ${N?"checked":""}`}),I=W.createEl("button",{cls:"csv-dash-habit-check",text:N?"\u25CF":"\u25CB"});W.createSpan({cls:"csv-dash-habit-label",text:H}),I.addEventListener("click",()=>{a[H]=N?"0":"1",s.scheduleSave(),s.renderViewPreservingScroll()})});let B=n.filter(H=>s.isTruthy(a[H])).length;if($.createDiv({cls:"csv-dash-habits-count",text:`${B} of ${n.length} complete`}),i&&((A=a[i])!=null&&A.trim())){let H=$.createDiv({cls:"csv-dash-notes-preview"});H.createEl("strong",{text:"Notes: "}),H.createSpan({text:a[i].slice(0,200)+(a[i].length>200?"\u2026":"")})}}let p=t.createDiv({cls:"csv-dash-chart-section"});p.createEl("h3",{text:"Progress",cls:"csv-dash-section-title"});let m=p.createDiv({cls:"csv-dash-chart-wrap"}).createEl("canvas",{cls:"csv-dash-chart"}),v=r.map($=>{var B;return((B=$[e])!=null?B:"").slice(5)}),_=r.map($=>n.filter(R=>s.isTruthy($[R])).length);s.chartInstance&&(s.chartInstance.destroy(),s.chartInstance=null);let{Chart:k}=await Qe();if(!m.isConnected)return;s.chartInstance=new k(m,{type:"line",data:{labels:v,datasets:[{label:"Habits done",data:_,borderColor:"#378ADD",backgroundColor:"rgba(55,138,221,0.08)",borderWidth:1.5,pointRadius:3,tension:.3,fill:!0}]},options:{responsive:!0,maintainAspectRatio:!1,scales:{y:{min:0,max:n.length||8,ticks:{stepSize:1}}},plugins:{tooltip:{enabled:!0}}}});let S=t.createDiv({cls:"csv-dash-stats-section"});S.createEl("h3",{text:"Stats",cls:"csv-dash-section-title"});let x=r.length,y=r.reduce(($,R)=>$+n.filter(B=>s.isTruthy(R[B])).length,0),C=x>0?(y/x).toFixed(1):"0",E=r.filter($=>n.every(R=>s.isTruthy($[R]))).length,D=0,w=0,M=null;for(let $ of r){let R=n.filter(N=>s.isTruthy($[N])).length,B=s.parseDate((j=$[e])!=null?j:""),H=!0;M&&B&&Math.round((B.getTime()-M.getTime())/864e5)!==1&&(H=!1),R>=1&&(H||M===null)?(w++,w>D&&(D=w)):R>=1?(w=1,w>D&&(D=w)):w=0,M=B}let L=0,O=new Date;O.setHours(0,0,0,0);let V=O;for(let $=r.length-1;$>=0;$--){let R=s.parseDate((Y=r[$][e])!=null?Y:"");if(!R)break;let B=Math.round((V.getTime()-R.getTime())/(1e3*60*60*24));if(L===0&&B>1||L>0&&B!==1)break;if(n.filter(N=>s.isTruthy(r[$][N])).length>=1)L++,V=R;else break}let P=S.createDiv({cls:"csv-dash-stats-bar"});P.innerHTML=`${x} days logged \xB7 ${C} avg/day \xB7 ${E} perfect days \xB7 current streak ${L}d \xB7 best streak ${D}d`;let U=t.createDiv({cls:"csv-dash-cards-section"}).createDiv({cls:"csv-dash-cards-grid"}),F=new Date().getFullYear(),G={language:"\u25CB",read:"\u2261",gym:"\u229E",vitamins:"\u2299",cardio:"\u2191",meditate:"\u25CE",challenge:"\u273F",journal:"\u270E",exercise:"\u229E",water:"\u{1F4A7}",sleep:"\u{1F319}",study:"\u{1F4DA}"};n.map($=>{let R=r.filter(I=>s.isTruthy(I[$])),B=R.length>0?R[R.length-1][e]:null,H=new Set;R.forEach(I=>{var Q;let q=s.parseDate((Q=I[e])!=null?Q:"");q&&H.add(q.getFullYear())});let N=r.filter(I=>{var Q;let q=s.parseDate((Q=I[e])!=null?Q:"");return q&&q.getFullYear()===F}),W=N.filter(I=>s.isTruthy(I[$])).length;return{habit:$,doneCount:R.length,doneThisYear:W,totalThisYear:N.length,lastDone:B,years:Array.from(H).sort()}}).sort(($,R)=>!$.lastDone&&!R.lastDone?0:$.lastDone?R.lastDone?R.lastDone.localeCompare($.lastDone):-1:1).forEach(({habit:$,doneCount:R,doneThisYear:B,totalThisYear:H,lastDone:N,years:W})=>{var tt;let I=U.createDiv({cls:"csv-dash-habit-card"}),q=(tt=G[$.toLowerCase()])!=null?tt:"\u25CB",Q=I.createDiv({cls:"csv-dash-habit-card-header"});if(Q.createSpan({cls:"csv-dash-habit-icon",text:q}),Q.createSpan({cls:"csv-dash-habit-card-name",text:Tt($)}),W.length>0&&I.createDiv({cls:"csv-dash-habit-years"}).setText(W.join(" \xB7 ")),I.createDiv({cls:"csv-dash-habit-card-thisyear",text:`${B} of ${H} complete this year`}),I.createDiv({cls:"csv-dash-habit-card-alltime",text:`${R} of ${x} all time`}),N){let at=s.parseDate(N),Wt=at?at.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):N;I.createDiv({cls:"csv-dash-habit-card-last",text:`Last logged: ${Wt}`})}else I.createDiv({cls:"csv-dash-habit-card-last",text:"Never logged"});let Z=x>0?R/x*100:0,X=I.createDiv({cls:"csv-dash-habit-progress"}).createDiv({cls:"csv-dash-habit-progress-bar"});X.style.width=`${Z}%`,I.addEventListener("click",()=>{s.selectedHabit=s.selectedHabit===$?null:$,s.renderViewPreservingScroll()}),s.selectedHabit===$&&I.addClass("selected")}),s.selectedHabit&&n.includes(s.selectedHabit)&&Vg(s,t,r,e,s.selectedHabit)}function Vg(s,t,e,n,i){var D,w,M;let o=t.createDiv({cls:"csv-dash-timeline-section"}),r=o.createDiv({cls:"csv-dash-timeline-header"});r.createEl("h3",{text:`${Tt(i)} Timeline`,cls:"csv-dash-section-title"});let a=r.createEl("select",{cls:"csv-dash-year-select"}),l=new Set;e.forEach(L=>{var V;let O=s.parseDate((V=L[n])!=null?V:"");O&&l.add(O.getFullYear())}),l.add(new Date().getFullYear()),Array.from(l).sort().reverse().forEach(L=>{let O=a.createEl("option",{text:String(L),value:String(L)});L===s.timelineYear&&(O.selected=!0)}),a.addEventListener("change",()=>{s.timelineYear=parseInt(a.value),s.renderViewPreservingScroll()}),r.createEl("button",{cls:"csv-dash-timeline-close",text:"\u2715"}).addEventListener("click",()=>{s.selectedHabit=null,s.renderViewPreservingScroll()});let d=new Map;e.forEach(L=>{var O;d.set((O=L[n])!=null?O:"",s.isTruthy(L[i]))});let h=o.createDiv({cls:"csv-dash-timeline-grid-wrap"}),u=h.createDiv({cls:"csv-dash-timeline-months"});["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].forEach(L=>u.createSpan({cls:"csv-dash-timeline-month-label",text:L}));let g=h.createDiv({cls:"csv-dash-timeline-calendar"}),p=g.createDiv({cls:"csv-dash-timeline-day-labels"});for(let L=1;L<=31;L++)p.createDiv({cls:"csv-dash-timeline-day-label",text:L%5===0||L===1?String(L):""});for(let L=0;L<12;L++){let O=g.createDiv({cls:"csv-dash-timeline-month-col"}),V=new Date(s.timelineYear,L+1,0).getDate();for(let P=1;P<=31;P++){if(P>V){O.createDiv({cls:"csv-dash-timeline-cell empty"});continue}let T=`${s.timelineYear}-${String(L+1).padStart(2,"0")}-${String(P).padStart(2,"0")}`,U=(D=d.get(T))!=null?D:!1,F=d.has(T),G=new Date(s.timelineYear,L,P)>new Date,z=O.createDiv({cls:`csv-dash-timeline-cell ${G?"future":""} ${U?"done":""} ${F&&!U?"missed":""} ${!F&&!G?"no-entry":""}`});z.title=`${T}: ${G?"Future":U?"\u2713 Done":F?"\u2717 Missed":"No entry"}`}}let b=e.filter(L=>{var V;let O=s.parseDate((V=L[n])!=null?V:"");return O&&O.getFullYear()===s.timelineYear}),m=b.filter(L=>s.isTruthy(L[i])).length,v=b.length,_=0,k=0,S=0,x=null;for(let L of e){let O=s.isTruthy(L[i]),V=s.parseDate((w=L[n])!=null?w:""),P=!0;x&&V&&Math.round((V.getTime()-x.getTime())/864e5)!==1&&(P=!1),O&&(P||x===null)?(S++,S>k&&(k=S)):O?S=1:S=0,x=V}let y=new Date;y.setHours(0,0,0,0);let C=y;for(let L=e.length-1;L>=0;L--){let O=s.parseDate((M=e[L][n])!=null?M:"");if(!O)break;let V=Math.round((C.getTime()-O.getTime())/(1e3*60*60*24));if(_===0&&V>1||_>0&&V!==1)break;if(s.isTruthy(e[L][i]))_++,C=O;else break}let E=o.createDiv({cls:"csv-dash-timeline-stats"});E.innerHTML=`${m} of ${v} in ${s.timelineYear} \xB7 current streak ${_}d \xB7 best streak ${k}d`}function hc(s,t){var v,_,k;let e=s.getFilteredRows();if(s.searchQuery.trim()&&t.createDiv({cls:"csv-search-results",text:`Found ${e.length} of ${s.rows.length} entries`}),!e.length){let S=t.createDiv({cls:"csv-empty-state"});S.createEl("p",{text:s.searchQuery?"No matching entries found.":"No entries yet."}),s.searchQuery&&S.createEl("button",{cls:"csv-clear-filters-btn",text:"Clear search"}).addEventListener("click",()=>{s.searchQuery="",s.renderView()});return}s.focusIndex>=e.length&&(s.focusIndex=e.length-1),s.focusIndex<0&&(s.focusIndex=0);let n=e[s.focusIndex],i=(v=s.titleKey())!=null?v:s.headers[0],o=s.getNotesCol(),r=s.authorKey(),a=t.createDiv({cls:"csv-focus-wrap",attr:{tabindex:"0"}}),l=S=>{s.focusIndex=(S%e.length+e.length)%e.length,s.focusNavPending=!0,s.renderView(!0)},c=a.createDiv({cls:"csv-focus-card"});c.createDiv({cls:"csv-focus-position",text:`${s.focusIndex+1} / ${e.length}`});let d=c.createDiv({cls:`csv-focus-title ${(_=s.isHighlighted)!=null&&_.call(s,n)?"csv-title-highlight":""}`,text:s.getTitle(n)});o&&(d.addClass("is-clickable"),d.title="Open entry",d.addEventListener("click",()=>s.openNoteExpander(n,o)));let h=s.getSubtitle(n);if(h&&c.createDiv({cls:"csv-focus-sub",text:h}),o&&o!==i&&((k=n[o])!=null&&k.trim())){let S=c.createDiv({cls:"csv-focus-notes"});s.renderMarkdownInto(S,n[o])}let u=new Set([i,o,r].filter(Boolean)),f=s.headers.filter(S=>{var x;return!u.has(S)&&((x=n[S])!=null?x:"").trim()});if(f.length){let S=c.createDiv({cls:"csv-focus-meta"});f.forEach(x=>{let y=S.createDiv({cls:"csv-kanban-chip"});if(y.createSpan({cls:"csv-chip-label",text:x+": "}),s.isSelectCol(x)){let C=y.createSpan({cls:"csv-chip-value csv-chip-select",text:n[x]});C.addEventListener("click",E=>{E.stopPropagation(),It(C,n[x],s.getColumnValues(x),D=>{n[x]=D,C.setText(D||"\u2014"),s.scheduleSave()},s.contentEl,{multi:xt(x)})})}else y.createSpan({cls:"csv-chip-value",text:n[x]})})}c.addEventListener("contextmenu",S=>s.openRowContextMenu(n,S));let g=a.createDiv({cls:"csv-focus-nav"}),p=g.createEl("button",{cls:"csv-focus-nav-btn",text:"\u2039",title:"Previous (\u2190)"}),b=g.createEl("button",{cls:"csv-focus-nav-btn csv-focus-nav-rand",text:"\u{1F500}",title:"Random entry"}),m=g.createEl("button",{cls:"csv-focus-nav-btn",text:"\u203A",title:"Next (\u2192)"});p.addEventListener("click",()=>l(s.focusIndex-1)),m.addEventListener("click",()=>l(s.focusIndex+1)),b.addEventListener("click",()=>{if(e.length<2)return;let S=s.focusIndex;for(;S===s.focusIndex;)S=Math.floor(Math.random()*e.length);l(S)}),a.addEventListener("keydown",S=>{S.key==="ArrowLeft"?(S.preventDefault(),l(s.focusIndex-1)):S.key==="ArrowRight"&&(S.preventDefault(),l(s.focusIndex+1))}),(s.focusNavPending||document.activeElement===document.body)&&(s.focusNavPending=!1,a.focus({preventScroll:!0}))}var Ft=require("obsidian"),fc=Os(ts());var Ng=[{id:"table",label:"Table"},{id:"library",label:"Cards"},{id:"kanban-genre",label:"Kanban"}];function uc(s){return s&&typeof s=="object"&&"basename"in s?s:null}function Bg(s){let t=s.split(` -`).map(r=>r.trim()).filter(Boolean),e=r=>{var a,l;return(l=(a=t.find(c=>c.toLowerCase().startsWith(r+":")))==null?void 0:a.slice(r.length+1).trim())!=null?l:""},n=e("mode").toLowerCase(),i=n==="kanban"||n==="kanban-genre"?"kanban-genre":n==="cards"||n==="card"||n==="library"?"library":"table",o=parseInt(e("height"),10);return{file:e("file"),mode:i,height:Number.isFinite(o)&&o>0?o:null,collapse:e("collapse").split(",").map(r=>r.trim()).filter(Boolean)}}var Uo=class extends Ft.MarkdownRenderChild{constructor(e,n,i,o,r){super(e);this.file=null;this.headers=[];this.rows=[];this.searchQuery="";this.tableSortCol=null;this.tableSortDir="asc";this.libraryStatusFilter="all";this.libraryGenreFilter="all";this.collapsedGroups=new Set;this.saveTimer=null;this.lastWritten=null;this.contentArea=null;this.app=n,this.settings=i,this.persistSettings=o,this.opts=r,this.mode=r.mode,this.collapsedGroups=new Set(r.collapse.map(a=>a.toLowerCase()))}get renderComponent(){return this}get contentEl(){return this.containerEl}get asView(){return this}async onload(){if(this.containerEl.addClass("csv-inline-view"),!this.opts.file){this.renderError("No file specified. Use: file: yourfile.csv");return}await this.reload()&&(this.renderView(),this.registerEvent(this.app.vault.on("modify",async e=>{if(!this.file||e.path!==this.file.path)return;let n=await this.app.vault.read(this.file);if(n===this.lastWritten)return;this.lastWritten=n;let i=wt(n);this.headers=i.headers,this.rows=i.rows,this.renderView()})),this.registerEvent(this.app.vault.on("rename",(e,n)=>{this.file&&n===this.file.path&&(this.file=uc(e))})))}onunload(){this.saveTimer&&window.clearTimeout(this.saveTimer)}async reload(){let e=uc(this.app.vault.getAbstractFileByPath(this.opts.file));if(!e)return this.renderError(`File not found: ${this.opts.file}`),!1;this.file=e;try{let n=await this.app.vault.read(e),i=wt(n);this.headers=i.headers,this.rows=i.rows,this.lastWritten=n}catch(n){return this.renderError(`Error reading file: ${n instanceof Error?n.message:String(n)}`),!1}return!0}renderError(e){this.containerEl.empty(),this.containerEl.createEl("p",{text:`csv-view: ${e}`,cls:"csv-add-error"})}scheduleSave(){this.saveTimer&&window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>void this.doSave(),600)}async doSave(){if(this.file)try{let e=fc.default.unparse(this.rows,{columns:this.headers});try{let n=await this.app.vault.read(this.file);this.lastWritten!==null&&n!==this.lastWritten&&n!==e&&await rs(this.app,this.file,n)}catch(n){}this.lastWritten=e,await this.app.vault.modify(this.file,e)}catch(e){new Ft.Notice(`Couldn't save ${this.file.name}: ${e instanceof Error?e.message:String(e)}`,8e3)}}get fileCfg(){var e;return this.file?(e=this.settings.fileConfigs[this.file.path])!=null?e:{}:{}}saveFileCfg(e){this.file&&(this.settings.fileConfigs[this.file.path]=e,this.persistSettings())}isHighlighted(e){var n;return((n=this.fileCfg.highlightedTitles)!=null?n:[]).includes(this.getTitle(e))}toggleHighlight(e){let n=this.getTitle(e),i=this.fileCfg,o=i.highlightedTitles?[...i.highlightedTitles]:[],r=o.indexOf(n);r>=0?o.splice(r,1):o.push(n),i.highlightedTitles=o,this.saveFileCfg(i)}resolveCol(e){for(let n of e){let i=this.headers.find(o=>o.toLowerCase()===n.toLowerCase());if(i)return i}return null}getNotesCol(){return this.fileCfg.notesColumn!==void 0?this.fileCfg.notesColumn===""?null:this.fileCfg.notesColumn:this.resolveCol(pe)}isNotesCol(e){let n=this.getNotesCol();return n?e===n:this.settings.notesColumns.some(i=>i.toLowerCase()===e.toLowerCase())}isSelectCol(e){return this.settings.selectColumns.some(n=>n.toLowerCase()===e.toLowerCase())}isCategoricalCol(e){var i;let n=(i=this.titleKey())!=null?i:this.headers[0];return e===n||this.getDateCol()===e||xt(e)?!1:this.fileCfg.categoricalColumns?this.fileCfg.categoricalColumns.includes(e):this.isSelectCol(e)||Xt(this.getColumnValues(e).length)}getStatusCol(){var e;return this.fileCfg.statusColumn!==void 0?this.fileCfg.statusColumn===""?null:(e=this.headers.find(n=>n.toLowerCase()===this.fileCfg.statusColumn.toLowerCase()))!=null?e:null:this.resolveCol(ns)}getCategoryCol(){var e;return this.fileCfg.categoryColumn!==void 0?this.fileCfg.categoryColumn===""?null:(e=this.headers.find(n=>n.toLowerCase()===this.fileCfg.categoryColumn.toLowerCase()))!=null?e:null:this.resolveCol(ss)}titleKey(){var e,n;return this.fileCfg.titleColumn!==void 0?this.fileCfg.titleColumn===""?void 0:(e=this.headers.find(i=>i.toLowerCase()===this.fileCfg.titleColumn.toLowerCase()))!=null?e:void 0:(n=this.resolveCol(ge))!=null?n:void 0}authorKey(){var e;return(e=this.resolveCol(["Author","author","Authors","authors","Director","director","Artist","artist","Creator","creator","By","by"]))!=null?e:void 0}getTitle(e){var i;let n=this.titleKey();return(i=n?e[n]:e[this.headers[0]])!=null?i:"\u2014"}getSubtitle(e){var i;let n=this.authorKey();return n&&(i=e[n])!=null?i:""}getColumnValues(e){return Array.from(new Set(this.rows.map(n=>{var i;return(i=n[e])!=null?i:""}).filter(Boolean))).sort()}getImageCol(){var e;return this.fileCfg.imageColumn!==void 0?this.fileCfg.imageColumn===""?null:(e=this.headers.find(n=>n.toLowerCase()===this.fileCfg.imageColumn.toLowerCase()))!=null?e:null:this.resolveCol(es)}getBooleanColumns(){return this.fileCfg.habitColumns?this.fileCfg.habitColumns.filter(e=>this.headers.includes(e)):this.headers.filter(e=>{if(e===this.getDateCol()||this.isNotesCol(e))return!1;let n=this.rows.map(i=>{var o;return((o=i[e])!=null?o:"").toLowerCase().trim()});return is(n)})}getDateCol(){var o,r;if(this.fileCfg.dateColumns&&this.fileCfg.dateColumns.length>0){let a=this.fileCfg.dateColumns[0];return(o=this.headers.find(l=>l===a))!=null?o:null}if(this.headers.length===0)return null;let e=this.headers[0];if(["date","day","datum"].includes(e.toLowerCase()))return e;let n=/^\d{4}-\d{2}-\d{2}$/,i=this.rows.slice(0,5);return i.length>0&&i.every(a=>{var l;return n.test((l=a[e])!=null?l:"")})?e:(r=this.headers.find(a=>this.isDateCol(a)))!=null?r:null}isDateCol(e){var n;return(n=this.fileCfg.dateColumns)!=null&&n.includes(e)?!0:Et(e)}getFilteredRows(){var i;let e=this.rows;if(this.searchQuery.trim()){let o=this.searchQuery.toLowerCase().trim();e=e.filter(r=>this.headers.some(a=>{var l;return((l=r[a])!=null?l:"").toLowerCase().includes(o)}))}if(this.mode==="table"&&this.tableSortCol&&this.headers.includes(this.tableSortCol)){let o=this.tableSortCol,r=this.tableSortDir;return[...e].sort((a,l)=>{var d,h;let c=((d=a[o])!=null?d:"").localeCompare((h=l[o])!=null?h:"",void 0,{numeric:!0});return r==="asc"?c:-c})}let n=this.getDateCol();if(this.mode==="table"&&n){let o=(i=this.fileCfg.sortNewestFirst)!=null?i:!0;e=[...e].sort((r,a)=>{var c,d;let l=((c=r[n])!=null?c:"").localeCompare((d=a[n])!=null?d:"");return o?-l:l})}return e}notesFilePath(e){var a,l,c;let n=Ie(this.getTitle(e)),i=(c=(l=(a=this.file)==null?void 0:a.parent)==null?void 0:l.path)!=null?c:"",o=this.settings.notesSubfolder.trim(),r=o?i?`${i}/${o}`:o:i;return(0,Ft.normalizePath)(`${r}/${n}.md`)}notesFileExists(e){return!!this.app.vault.getAbstractFileByPath(this.notesFilePath(e))}async openOrCreateNotes(e){var o;let n=this.notesFilePath(e),i=this.app.vault.getAbstractFileByPath(n);if(!i){let a=["---",...this.headers.filter(h=>!this.isNotesCol(h)&&e[h]).map(h=>`${h}: "${e[h].replace(/"/g,'\\"')}"`),"---","",`# ${this.getTitle(e)}`,"",""].join(` -`),l=this.headers.find(h=>this.isNotesCol(h)),c=a+(l&&((o=e[l])!=null&&o.trim())?e[l]:""),d=n.substring(0,n.lastIndexOf("/"));d&&!this.app.vault.getAbstractFileByPath(d)&&await this.app.vault.createFolder(d),i=await this.app.vault.create(n,c),new Ft.Notice(`Created: ${i.name}`)}await this.app.workspace.getLeaf("tab").openFile(i)}deleteWithUndo(e){let n=this.rows.indexOf(e);if(n<0)return;this.rows.splice(n,1),this.scheduleSave(),this.renderView();let i=this.getTitle(e)||"entry",o=document.createDocumentFragment();o.createSpan({text:`Deleted \u201C${i}\u201D. `});let r=o.createEl("button",{text:"Undo",cls:"csv-notice-undo"}),a=new Ft.Notice(o,6e3);r.addEventListener("click",()=>{r.hasAttribute("disabled")||(r.setAttribute("disabled","true"),this.rows.splice(Math.min(n,this.rows.length),0,e),this.scheduleSave(),this.renderView(),a.hide(),new Ft.Notice(`Restored \u201C${i}\u201D`,2500))})}openRowContextMenu(e,n){let i=new Ft.Menu;i.addItem(a=>a.setTitle("Open / Create Notes file").setIcon("file-text").onClick(()=>void this.openOrCreateNotes(e))),i.addItem(a=>a.setTitle("Open entry").setIcon("maximize").onClick(()=>{var l;return this.openNoteExpander(e,(l=this.getNotesCol())!=null?l:"")}));let o=this.getStatusCol();if(o){let a=this.getColumnValues(o);a.length&&(i.addSeparator(),a.forEach(l=>{l!==e[o]&&i.addItem(c=>c.setTitle(`Mark as: ${l}`).onClick(()=>{e[o]=l,this.scheduleSave(),this.renderView()}))}))}i.addSeparator();let r=this.isHighlighted(e);i.addItem(a=>a.setTitle(r?"Remove highlight":"Highlight").setIcon("highlighter").onClick(()=>{this.toggleHighlight(e),this.renderView()})),i.addSeparator(),i.addItem(a=>a.setTitle("Delete").setIcon("trash").onClick(()=>this.deleteWithUndo(e))),i.showAtMouseEvent(n)}openNoteExpander(e,n){var i,o;new be(this.app,e,n,this.headers,(o=(i=this.file)==null?void 0:i.path)!=null?o:"",this.isNotesCol.bind(this),this.isSelectCol.bind(this),this.getColumnValues.bind(this),r=>{Object.assign(e,r),this.scheduleSave(),this.renderView()},()=>this.deleteWithUndo(e),this.isCategoricalCol.bind(this),this.titleKey(),r=>this.getBooleanColumns().includes(r),r=>this.isDateCol(r)).open()}openAddModal(){new as(this.app,this.headers,this.isNotesCol.bind(this),this.isSelectCol.bind(this),this.getColumnValues.bind(this),e=>{this.rows.push(e),this.scheduleSave(),this.renderView(),new Ft.Notice(`Added: ${this.getTitle(e)}`)},{},e=>this.getBooleanColumns().includes(e),e=>this.isCategoricalCol(e),this.titleKey(),e=>this.isDateCol(e)).open()}renderSelectField(e,n,i){var a;let o=(a=n[i])!=null?a:"",r=e.createDiv({cls:`csv-select-chip ${o?"":"empty"}`});return r.setText(o||"\u2014"),i.toLowerCase()==="status"&&o&&r.addClass(`status-chip-${o.toLowerCase().replace(/\s+/g,"-")}`),r.addEventListener("click",l=>{var c;l.stopPropagation(),It(r,(c=n[i])!=null?c:"",this.getColumnValues(i),d=>{n[i]=d,r.setText(d||"\u2014"),this.scheduleSave()},this.contentEl)}),r}renderMarkdownInto(e,n){var i,o;Ft.MarkdownRenderer.render(this.app,n,e,(o=(i=this.file)==null?void 0:i.path)!=null?o:"",this.renderComponent)}renderViewPreservingScroll(){this.renderView()}renderView(e=!1){let n=this.containerEl;e?this.contentArea&&this.contentArea.empty():(n.empty(),this.renderToolbar(n),this.contentArea=n.createDiv({cls:"csv-content-area"}),this.opts.height&&(this.contentArea.style.maxHeight=this.opts.height+"px"));let i=this.contentArea;if(i){if(i.toggleClass("csv-content-area--no-yscroll",this.mode==="kanban-genre"||this.mode==="table"),!this.headers.length){i.createDiv({cls:"csv-empty-state"}).createEl("p",{text:"This file is empty."});return}if(this.rows.length===0){let o=i.createDiv({cls:"csv-empty-state"});o.createEl("p",{text:"No entries yet."}),o.createEl("button",{cls:"csv-empty-state-action",text:"+ Add the first entry"}).addEventListener("click",()=>this.openAddModal());return}(this.mode==="library"||this.mode==="kanban-genre")&&!$t(this.asView)&&(this.mode="table"),this.mode==="library"?wn(this.asView,i):this.mode==="kanban-genre"?kn(this.asView,i):_n(this.asView,i)}}renderToolbar(e){var c,d;let n=e.createDiv({cls:"csv-toolbar csv-inline-toolbar"});n.createDiv({cls:"csv-toolbar-title",text:(d=(c=this.file)==null?void 0:c.basename)!=null?d:""}).addEventListener("click",()=>{this.file&&this.app.workspace.getLeaf("tab").openFile(this.file)});let i=n.createDiv({cls:"csv-toolbar-controls"});i.createDiv({cls:"csv-row-count",text:`${this.rows.length} entries`});let o=!!$t(this.asView),r=i.createDiv({cls:"csv-mode-group"});Ng.forEach(({id:h,label:u})=>{if((h==="library"||h==="kanban-genre")&&!o)return;r.createEl("button",{cls:`csv-mode-btn ${this.mode===h?"active":""}`,text:u}).addEventListener("click",()=>{this.mode=h,this.renderView()})});let a=i.createEl("input",{cls:"csv-search-input",type:"text",placeholder:"Search\u2026",value:this.searchQuery,attr:{inputmode:"search",enterkeyhint:"search",autocomplete:"off"}}),l=null;a.addEventListener("input",h=>{this.searchQuery=h.target.value,l!==null&&window.clearTimeout(l),l=window.setTimeout(()=>{l=null,this.renderView(!0)},120)}),i.createEl("button",{cls:"csv-add-btn",text:"+ Add"}).addEventListener("click",()=>this.openAddModal())}};function gc(s,t,e,n){n("csv-view",(i,o,r)=>{var h,u,f;let a=Bg(i),l=(f=(u=(h=s.vault.getAbstractFileByPath(r.sourcePath))==null?void 0:h.parent)==null?void 0:u.path)!=null?f:"",c=a.file?Qt(a.file,l):a.file,d=new Uo(o,s,t,e,{...a,file:c});r.addChild(d)})}var mc=require("obsidian");function $g(s){let t=s.split(` -`).map(i=>i.trim()).filter(Boolean),e=i=>{var o,r;return(r=(o=t.find(a=>a.toLowerCase().startsWith(i+":")))==null?void 0:o.slice(i.length+1).trim())!=null?r:""},n=i=>{let o=parseFloat(e(i));return Number.isFinite(o)?o:null};return{file:e("file"),x:e("x"),y:e("y"),hue:e("hue")||e("color"),size:e("size"),agg:["count","sum","avg"].includes(e("agg").toLowerCase())?e("agg").toLowerCase():"",bucket:["week","month"].includes(e("bucket").toLowerCase())?e("bucket").toLowerCase():"",smooth:e("smooth").toLowerCase()==="true"?7:Math.max(0,parseInt(e("smooth"),10)||0),fit:e("fit").toLowerCase()==="linear"?"linear":"none",formula:e("formula"),xmin:n("xmin"),xmax:n("xmax"),height:n("height")}}function zg(s){return s&&typeof s=="object"&&"basename"in s?s:null}function pc(s){let t=(s!=null?s:"").trim().match(/^(\d{4})-(\d{2})-(\d{2})/);return t?new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3])):null}var Yo=class extends mc.MarkdownRenderChild{constructor(e,n,i){super(e);this.app=n;this.opts=i;this.chart=null}async onload(){this.containerEl.addClass("csv-chart-block"),await this.render(),this.opts.file&&(this.registerEvent(this.app.vault.on("modify",e=>{e.path===this.opts.file&&this.render()})),this.registerEvent(this.app.vault.on("rename",(e,n)=>{n===this.opts.file&&(this.opts.file=e.path)})))}onunload(){this.chart&&(this.chart.destroy(),this.chart=null)}renderError(e){this.containerEl.empty(),this.containerEl.createEl("p",{text:`csv-chart: ${e}`,cls:"csv-add-error"})}async render(){var l,c,d,h,u;let e=this.containerEl;this.chart&&(this.chart.destroy(),this.chart=null),e.empty();let n,i=0;if(this.opts.file){let f=zg(this.app.vault.getAbstractFileByPath(this.opts.file));if(!f)return this.renderError(`File not found: ${this.opts.file}`);let g,p;try{({headers:g,rows:p}=wt(await this.app.vault.read(f)))}catch(C){return this.renderError(`Error reading file: ${C instanceof Error?C.message:String(C)}`)}let b=C=>{var E;return(E=g.find(D=>D.toLowerCase()===C.toLowerCase()))!=null?E:null},m=hi(g,p),v=(l=g.find(C=>Et(C)))!=null?l:p.slice(0,5).length&&p.slice(0,5).every(C=>{var E;return pc((E=C[g[0]])!=null?E:"")})?g[0]:null,_=this.opts.x?b(this.opts.x):(c=v!=null?v:m[0])!=null?c:null;if(this.opts.x&&!_)return this.renderError(`No column "${this.opts.x}" in ${f.basename}`);let k=this.opts.y?b(this.opts.y):(d=m.find(C=>C!==_))!=null?d:null;if(this.opts.y&&!k)return this.renderError(`No column "${this.opts.y}" in ${f.basename}`);if(!_||!k)return this.renderError(`Couldn't auto-pick x/y columns \u2014 add "x:" and "y:" lines`);let S=this.opts.hue?b(this.opts.hue):null;if(this.opts.hue&&!S)return this.renderError(`No column "${this.opts.hue}" in ${f.basename}`);let x=this.opts.size?b(this.opts.size):null;if(this.opts.size&&!x)return this.renderError(`No column "${this.opts.size}" in ${f.basename}`);let y=_===v||Et(_);if(!y&&!m.includes(_)){let C=this.opts.agg||"count",E=zo(p,_,C==="count"?null:k,S,C);if(i=E.skipped,!E.categories.length)return this.renderError(`No rows with a "${_}" value to chart`);let D=C==="count"?"count":`${C}(${k})`;n={config:Ho(E,_,D,Ls(e)),fitText:null,formulaError:null}}else{let C=$o(p,_,k,S,x,y,pc,L=>{var O;return(O=L[g[0]])!=null?O:""});if(i=C.skipped,!C.series.some(L=>L.points.length))return this.renderError(`No rows with numeric "${_}" and "${k}" values`);let E=y?this.opts.bucket:"",D=this.opts.agg||"sum",M={series:E?C.series.map(L=>({label:L.label,points:Bo(L.points,E,D)})):C.series,xIsDate:y,xLabel:_,yLabel:E?D==="count"?`count / ${E}`:`${D}(${k}) / ${E}`:k,connect:y,fit:this.opts.fit,formula:this.opts.formula,sizeLabel:E?"":x!=null?x:"",smoothDays:y&&!E?this.opts.smooth:0};n=ui(M,Ls(e))}}else{if(!this.opts.formula.trim())return this.renderError('Give a "file:" line, a "formula:" line, or both');n=ui({series:[],xIsDate:!1,xLabel:"x",yLabel:"y",connect:!1,fit:"none",formula:this.opts.formula,xMin:(h=this.opts.xmin)!=null?h:-10,xMax:(u=this.opts.xmax)!=null?u:10},Ls(e))}if(n.formulaError)return this.renderError(`formula: ${n.formulaError}`);let o=e.createDiv({cls:"csv-chart-wrap"});this.opts.height&&(o.style.height=this.opts.height+"px");let r=o.createEl("canvas",{cls:"csv-chart-canvas"});if(n.fitText||i>0){let f=e.createDiv({cls:"csv-chart-footer"});n.fitText&&f.createSpan({cls:"csv-chart-fit-text",text:n.fitText}),i>0&&f.createSpan({cls:"csv-chart-skipped",text:`${i} row${i===1?"":"s"} skipped (no numeric value)`})}let{Chart:a}=await Qe();r.isConnected&&(this.chart=new a(r,n.config))}};function bc(s,t){t("csv-chart",(e,n,i)=>{var l,c,d;let o=$g(e),r=(d=(c=(l=s.vault.getAbstractFileByPath(i.sourcePath))==null?void 0:l.parent)==null?void 0:c.path)!=null?d:"",a=o.file?Qt(o.file,r):o.file;i.addChild(new Yo(n,s,{...o,file:a}))})}var re=require("obsidian"),yc=Os(ts());var yi=["Title","Type","Project","Priority","Due","Status","Notes"],Hg={Title:ge,Type:["Type","type","Kind","kind","Item","item"],Project:["Project","project","Projects","projects","Area","area"],Priority:["Priority","priority","Prio","prio","Importance","importance"],Due:["Due","due","Deadline","deadline","Due Date","Due date","due date"],Status:["Status","status","State","state","Done","done"],Notes:pe};function Wg(s){let t={};for(let e of yi)for(let n of Hg[e]){let i=s.find(o=>o.toLowerCase()===n.toLowerCase());if(i){t[e]=i;break}}return!t.Title&&s.length&&(t.Title=s[0]),t}function jg(s){let t=[],e=[];return s.forEach((n,i)=>{let o=Wg(n.headers);n.rows.forEach(r=>{var l;let a={};for(let c of yi)a[c]=o[c]&&(l=r[o[c]])!=null?l:"";o.Project||(a.Project=n.basename),t.push(a),e.push({sourceIndex:i,srcRow:r,map:o})})}),{headers:[...yi],rows:t,refs:e}}function Ug(s,t){var e;for(let n of yi){let i=t.map[n];i&&(t.srcRow[i]=(e=s[n])!=null?e:"")}}function Yg(s){let t=s.split(` -`).map(i=>i.trim()).filter(Boolean),e=i=>{var o,r;return(r=(o=t.find(a=>a.toLowerCase().startsWith(i+":")))==null?void 0:o.slice(i.length+1).trim())!=null?r:""},n=parseInt(e("height"),10);return{folder:e("folder"),files:e("files").split(",").map(i=>i.trim()).filter(Boolean),height:Number.isFinite(n)&&n>0?n:null}}function vc(s){return s&&typeof s=="object"&&"basename"in s?s:null}var Go=class extends re.MarkdownRenderChild{constructor(e,n,i,o,r){super(e);this.app=n;this.settings=i;this.opts=o;this.notePath=r;this.headers=[];this.rows=[];this.searchQuery="";this.taskProjectFilter="all";this.taskTypeFilter="all";this.fileCfg={};this.sources=[];this.refs=[];this.saveTimer=null;this.contentArea=null}get contentEl(){return this.containerEl}get asView(){return this}async onload(){if(this.containerEl.addClass("csv-inline-view","csv-tasks-block"),!this.opts.folder&&!this.opts.files.length){this.renderError('Give a "folder:" line ("/" = whole vault) and/or a "files:" list.');return}await this.reload(),this.renderView(),this.registerEvent(this.app.vault.on("modify",async e=>{let n=this.sources.find(r=>r.file.path===e.path);if(!n||this.saveTimer)return;let i=await this.app.vault.read(n.file);if(i===n.lastText)return;n.lastText=i;let o=wt(i);n.headers=o.headers,n.rows=o.rows,this.rebuild(),this.renderView()}))}onunload(){this.saveTimer&&window.clearTimeout(this.saveTimer)}renderError(e){this.containerEl.empty(),this.containerEl.createEl("p",{text:`csv-tasks: ${e}`,cls:"csv-add-error"})}async reload(){var i,o,r;let e=(r=(o=(i=this.app.vault.getAbstractFileByPath(this.notePath))==null?void 0:i.parent)==null?void 0:o.path)!=null?r:"",n=new Map;for(let a of this.opts.files){let l=vc(this.app.vault.getAbstractFileByPath(Qt(a,e)));if(!l){this.renderError(`File not found: ${a}`);continue}n.set(l.path,{file:l,explicit:!0})}if(this.opts.folder){let a=this.opts.folder==="/"?"":this.opts.folder.replace(/\/$/,"")+"/";for(let l of this.app.vault.getFiles())l.extension==="csv"&&(a&&!l.path.startsWith(a)||n.has(l.path)||n.set(l.path,{file:l,explicit:!1}))}this.sources=[];for(let{file:a,explicit:l}of n.values())try{let c=await this.app.vault.read(a),{headers:d,rows:h}=wt(c);(l||Fe({headers:d,rows:h,resolveCol:f=>{var g;return(g=f.map(p=>d.find(b=>b.toLowerCase()===p.toLowerCase())).find(Boolean))!=null?g:null}}))&&this.sources.push({file:a,headers:d,rows:h,lastText:c})}catch(c){}this.rebuild()}rebuild(){let e=jg(this.sources.map(n=>({basename:n.file.basename,headers:n.headers,rows:n.rows})));this.headers=e.headers,this.rows=e.rows,this.refs=e.refs}refOf(e){let n=this.rows.indexOf(e);return n>=0?this.refs[n]:null}sourceOf(e){var i;let n=this.refOf(e);return n&&(i=this.sources[n.sourceIndex])!=null?i:null}scheduleSave(){this.saveTimer&&window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>void this.doSave(),600)}async doSave(){this.saveTimer=null,this.rows.forEach((e,n)=>Ug(e,this.refs[n]));for(let e of this.sources){let n=yc.default.unparse(e.rows,{columns:e.headers});if(n!==e.lastText)try{try{let i=await this.app.vault.read(e.file);i!==e.lastText&&i!==n&&await rs(this.app,e.file,i)}catch(i){}e.lastText=n,await this.app.vault.modify(e.file,n)}catch(i){new re.Notice(`Couldn't save ${e.file.name}: ${i instanceof Error?i.message:String(i)}`,8e3)}}}resolveCol(e){for(let n of e){let i=this.headers.find(o=>o.toLowerCase()===n.toLowerCase());if(i)return i}return null}titleKey(){return"Title"}getStatusCol(){return"Status"}getCategoryCol(){return null}getDateCol(){return null}getNotesCol(){return"Notes"}isNotesCol(e){return e==="Notes"}isDateCol(e){return e==="Due"}getTitle(e){return e.Title||"\u2014"}getColumnValues(e){return Array.from(new Set(this.rows.map(n=>{var i;return(i=n[e])!=null?i:""}).filter(Boolean))).sort()}renderViewPreservingScroll(){this.renderView()}renderView(e=!1){let n=this.containerEl;if(e)this.contentArea&&this.contentArea.empty();else{n.empty();let i=n.createDiv({cls:"csv-toolbar csv-inline-toolbar"});i.createDiv({cls:"csv-toolbar-title",text:"Tasks"}),i.createDiv({cls:"csv-row-count",text:`${this.rows.length} entries \xB7 ${this.sources.length} file${this.sources.length===1?"":"s"}`}),this.contentArea=n.createDiv({cls:"csv-content-area"}),this.opts.height&&(this.contentArea.style.maxHeight=this.opts.height+"px")}if(this.contentArea){if(!this.sources.length){this.contentArea.createEl("p",{text:"No task-shaped CSV files found.",cls:"csv-empty-state"});return}mi(this.asView,this.contentArea)}}openNoteExpander(e,n){var l;let i=this.refOf(e),o=this.sourceOf(e);if(!i||!o)return;let r=(l=i.map.Notes)!=null?l:"",a=c=>c===i.map.Notes;new be(this.app,i.srcRow,r,o.headers,o.file.path,a,()=>!1,c=>Array.from(new Set(o.rows.map(d=>{var h;return(h=d[c])!=null?h:""}).filter(Boolean))).sort(),c=>{var d;Object.assign(i.srcRow,c);for(let h of Object.keys(e)){let u=i.map[h];u&&(e[h]=(d=i.srcRow[u])!=null?d:"")}this.scheduleSave(),this.renderView()},()=>this.deleteRow(e),void 0,i.map.Title,void 0,c=>/(^|[_\s-])(date|due|deadline)([_\s-]|$)/i.test(c)).open()}async openOrCreateNotes(e){let n=this.sourceOf(e);if(!n)return;let i=this.notesFilePath(e,n),o=vc(this.app.vault.getAbstractFileByPath(i));if(!o){let r=["---",`source: "[[${n.file.path}]]"`,"---","",`# ${this.getTitle(e)}`,"",""].join(` -`),a=i.substring(0,i.lastIndexOf("/"));a&&!this.app.vault.getAbstractFileByPath(a)&&await this.app.vault.createFolder(a),o=await this.app.vault.create(i,r),new re.Notice(`Created: ${o.name}`)}await this.app.workspace.getLeaf("tab").openFile(o)}notesFileExists(e){let n=this.sourceOf(e);return!!n&&!!this.app.vault.getAbstractFileByPath(this.notesFilePath(e,n))}notesFilePath(e,n){var l,c;let i=Ie(this.getTitle(e)),o=(c=(l=n.file.parent)==null?void 0:l.path)!=null?c:"",r=this.settings.notesSubfolder.trim(),a=r?o?`${o}/${r}`:r:o;return(0,re.normalizePath)(`${a}/${i}.md`)}deleteRow(e){let n=this.refOf(e),i=this.sourceOf(e);if(!n||!i)return;let o=i.rows.indexOf(n.srcRow);o>=0&&i.rows.splice(o,1);let r=this.rows.indexOf(e);r>=0&&(this.rows.splice(r,1),this.refs.splice(r,1)),this.scheduleSave(),this.renderView(),new re.Notice(`Deleted \u201C${this.getTitle(e)}\u201D from ${i.file.name}`)}openRowContextMenu(e,n){let i=this.sourceOf(e),o=new re.Menu;o.addItem(r=>r.setTitle("Open entry").setIcon("maximize").onClick(()=>this.openNoteExpander(e,"Notes"))),i&&o.addItem(r=>r.setTitle(`Open source: ${i.file.name}`).setIcon("file-spreadsheet").onClick(()=>void this.app.workspace.getLeaf("tab").openFile(i.file))),o.addSeparator(),o.addItem(r=>r.setTitle("Delete").setIcon("trash").onClick(()=>this.deleteRow(e))),o.showAtMouseEvent(n)}};function xc(s,t,e){e("csv-tasks",(n,i,o)=>{o.addChild(new Go(i,s,t,Yg(n),o.sourcePath))})}var un,As=class extends ot.FileView{constructor(e,n,i){super(e);this.headers=[];this.rows=[];this.saveTimer=null;this.searchQuery="";this.lastDiskContent=null;this.contentArea=null;this.selectedDate=null;this.selectedHabit=null;this.chartInstance=null;this.timelineYear=new Date().getFullYear();this.libraryStatusFilter="all";this.libraryGenreFilter="all";this.collapsedGroups=new Set;this.taskProjectFilter="all";this.taskTypeFilter="all";this.focusIndex=0;this.focusNavPending=!1;this.tableSortCol=null;this.tableSortDir="asc";this.settings=n,this.persistSettings=i,this.mode=n.defaultMode,this.renderComponent=new ot.Component,this.renderComponent.load()}getViewType(){return fn}getDisplayText(){var e,n;return(n=(e=this.file)==null?void 0:e.basename)!=null?n:"Card View"}getIcon(){return"table"}onload(){super.onload(),this.registerEvent(this.app.vault.on("modify",e=>{!this.file||e.path!==this.file.path||this.syncFromDisk()}))}async syncFromDisk(){if(!this.file)return;let e=await this.app.vault.read(this.file);if(e===this.lastDiskContent||this.saveTimer)return;this.lastDiskContent=e;let n=wt(e);this.headers=n.headers,this.rows=n.rows,this.renderViewPreservingScroll()}async onLoadFile(e){var o;try{let r=await this.app.vault.read(e),a=wt(r);this.headers=a.headers,this.rows=a.rows,this.lastDiskContent=r}catch(r){console.error("CardView load error",r),this.headers=[],this.rows=[],this.lastDiskContent=null,new ot.Notice(`Couldn't read ${e.name}: ${r instanceof Error?r.message:String(r)}`,8e3)}this.file&&((o=this.settings.fileConfigs[this.file.path])!=null&&o.defaultMode)?this.mode=this.settings.fileConfigs[this.file.path].defaultMode:this.isTravelFile()?this.mode="travel":this.hasDateColumn()?this.mode="dashboard":this.mode=this.settings.defaultMode;let n=this.mode==="kanban-genre"||this.mode==="library",i=this.mode==="dashboard";(n&&!$t(this)||i&&!this.hasDateColumn()||this.mode==="travel"&&!this.isTravelFile()||this.mode==="stats"&&!Sn(this)||this.mode==="chart"&&!fi(this)||this.mode==="tasks"&&!Fe(this))&&(this.mode="table"),this.selectedDate=null,this.focusIndex=0,this.tableSortCol=null,this.renderView()}async onUnloadFile(e){this.chartInstance&&(this.chartInstance.destroy(),this.chartInstance=null),this.headers=[],this.rows=[],this.contentEl.empty()}scheduleSave(){this.saveTimer&&window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>this.doSave(),600)}async doSave(){if(this.file)try{let e=Cc.default.unparse(this.rows,{columns:this.headers});try{let n=await this.app.vault.read(this.file);this.lastDiskContent!==null&&n!==this.lastDiskContent&&n!==e&&await rs(this.app,this.file,n)}catch(n){}this.lastDiskContent=e,await this.app.vault.modify(this.file,e)}catch(e){console.error("CardView save error",e),new ot.Notice(`Couldn't save ${this.file.name}: ${e instanceof Error?e.message:String(e)}`,8e3)}}get fileCfg(){var e;return this.file?(e=this.settings.fileConfigs[this.file.path])!=null?e:{}:{}}saveFileCfg(e){this.file&&(this.settings.fileConfigs[this.file.path]=e,this.persistSettings())}isHighlighted(e){var n;return((n=this.fileCfg.highlightedTitles)!=null?n:[]).includes(this.getTitle(e))}toggleHighlight(e){let n=this.getTitle(e),i=this.fileCfg,o=i.highlightedTitles?[...i.highlightedTitles]:[],r=o.indexOf(n);r>=0?o.splice(r,1):o.push(n),i.highlightedTitles=o,this.saveFileCfg(i)}addColumn(e){let n=e.trim();return n?this.headers.some(i=>i.toLowerCase()===n.toLowerCase())?`"${n}" already exists.`:(this.headers.push(n),this.rows.forEach(i=>{i[n]=""}),this.scheduleSave(),this.renderViewPreservingScroll(),null):"Column name can't be empty."}removeColumn(e){this.headers=this.headers.filter(i=>i!==e),this.rows.forEach(i=>{delete i[e]});let n=this.fileCfg;n.categoryColumn===e&&(n.categoryColumn=void 0),n.statusColumn===e&&(n.statusColumn=void 0),n.notesColumn===e&&(n.notesColumn=void 0),n.ankiFrontCol===e&&(n.ankiFrontCol=void 0),n.kanbanGroupCol===e&&(n.kanbanGroupCol=void 0),n.habitColumns&&(n.habitColumns=n.habitColumns.filter(i=>i!==e)),n.cardFields&&(n.cardFields=n.cardFields.filter(i=>i!==e)),n.categoricalColumns&&(n.categoricalColumns=n.categoricalColumns.filter(i=>i!==e)),this.saveFileCfg(n),this.scheduleSave(),this.renderViewPreservingScroll()}resolveCol(e){for(let n of e){let i=this.headers.find(o=>o.toLowerCase()===n.toLowerCase());if(i)return i}return null}getNotesCol(){return this.fileCfg.notesColumn!==void 0?this.fileCfg.notesColumn===""?null:this.fileCfg.notesColumn:this.resolveCol(pe)}isNotesCol(e){let n=this.getNotesCol();return n?e===n:this.settings.notesColumns.some(i=>i.toLowerCase()===e.toLowerCase())}isSelectCol(e){return this.settings.selectColumns.some(n=>n.toLowerCase()===e.toLowerCase())}isCategoricalCol(e){var i;let n=(i=this.titleKey())!=null?i:this.headers[0];return e===n||this.isDateCol(e)||xt(e)?!1:this.fileCfg.categoricalColumns?this.fileCfg.categoricalColumns.includes(e):this.isSelectCol(e)||Xt(this.getColumnValues(e).length)}autoDetectCategoricalColumns(){var n;let e=(n=this.titleKey())!=null?n:this.headers[0];return this.headers.filter(i=>i===e||this.isDateCol(i)||xt(i)||this.isNotesCol(i)?!1:this.isSelectCol(i)||Xt(this.getColumnValues(i).length))}isDateCol(e){var n;return(n=this.fileCfg.dateColumns)!=null&&n.includes(e)?!0:Et(e)}getStatusCol(){var e;return this.fileCfg.statusColumn!==void 0?this.fileCfg.statusColumn===""?null:(e=this.headers.find(n=>n.toLowerCase()===this.fileCfg.statusColumn.toLowerCase()))!=null?e:null:this.resolveCol(ns)}getCategoryCol(){var e;return this.fileCfg.categoryColumn!==void 0?this.fileCfg.categoryColumn===""?null:(e=this.headers.find(n=>n.toLowerCase()===this.fileCfg.categoryColumn.toLowerCase()))!=null?e:null:this.resolveCol(ss)}titleKey(){var e,n;return this.fileCfg.titleColumn!==void 0?this.fileCfg.titleColumn===""?void 0:(e=this.headers.find(i=>i.toLowerCase()===this.fileCfg.titleColumn.toLowerCase()))!=null?e:void 0:(n=this.resolveCol(ge))!=null?n:void 0}authorKey(){var e;return(e=this.resolveCol(["Author","author","Authors","authors","Director","director","Artist","artist","Creator","creator","By","by"]))!=null?e:void 0}getTitle(e){var i;let n=this.titleKey();return(i=n?e[n]:e[this.headers[0]])!=null?i:"\u2014"}getSubtitle(e){var i;let n=this.authorKey();return n&&(i=e[n])!=null?i:""}getColumnValues(e){return Array.from(new Set(this.rows.map(n=>{var i;return(i=n[e])!=null?i:""}).filter(Boolean))).sort()}getImageCol(){var e;return this.fileCfg.imageColumn!==void 0?this.fileCfg.imageColumn===""?null:(e=this.headers.find(n=>n.toLowerCase()===this.fileCfg.imageColumn.toLowerCase()))!=null?e:null:this.resolveCol(es)}notesFilePath(e){var a,l,c;let n=Ie(this.getTitle(e)),i=(c=(l=(a=this.file)==null?void 0:a.parent)==null?void 0:l.path)!=null?c:"",o=this.settings.notesSubfolder.trim(),r=o?i?`${i}/${o}`:o:i;return(0,ot.normalizePath)(`${r}/${n}.md`)}notesFileExists(e){return!!this.app.vault.getAbstractFileByPath(this.notesFilePath(e))}deleteWithUndo(e){let n=this.rows.indexOf(e);if(n<0)return;this.rows.splice(n,1),this.scheduleSave(),this.renderViewPreservingScroll();let i=this.getTitle(e)||"entry",o=document.createDocumentFragment();o.createSpan({text:`Deleted \u201C${i}\u201D. `});let r=o.createEl("button",{text:"Undo",cls:"csv-notice-undo"}),a=new ot.Notice(o,6e3);r.addEventListener("click",()=>{if(r.hasAttribute("disabled"))return;r.setAttribute("disabled","true");let l=Math.min(n,this.rows.length);this.rows.splice(l,0,e),this.scheduleSave(),this.renderViewPreservingScroll(),a.hide(),new ot.Notice(`Restored \u201C${i}\u201D`,2500)})}openRowContextMenu(e,n){let i=new ot.Menu;i.addItem(a=>a.setTitle("Open / Create Notes file").setIcon("file-text").onClick(()=>this.openOrCreateNotes(e))),i.addItem(a=>a.setTitle("Open entry").setIcon("maximize").onClick(()=>{var l;return this.openNoteExpander(e,(l=this.getNotesCol())!=null?l:"")}));let o=this.getStatusCol();if(o){let a=this.getColumnValues(o);a.length&&(i.addSeparator(),a.forEach(l=>{l!==e[o]&&i.addItem(c=>c.setTitle(`Mark as: ${l}`).onClick(()=>{e[o]=l,this.scheduleSave(),this.renderViewPreservingScroll()}))}))}i.addSeparator();let r=this.isHighlighted(e);i.addItem(a=>a.setTitle(r?"Remove highlight":"Highlight").setIcon("highlighter").onClick(()=>{this.toggleHighlight(e),this.renderViewPreservingScroll()})),i.addSeparator(),i.addItem(a=>a.setTitle("Delete").setIcon("trash").onClick(()=>this.deleteWithUndo(e))),i.showAtMouseEvent(n)}async openOrCreateNotes(e){var o,r;let n=this.notesFilePath(e),i=this.app.vault.getAbstractFileByPath(n);if(!i){let a={},l=Fe(this)?jo(this):null,c=l?((o=e[l])!=null?o:"").split(",").map(g=>Jo(g.trim())).filter(Boolean).map(g=>`project-${g}`):[];c.length&&(a.tags=c);for(let g of this.headers)!this.isNotesCol(g)&&e[g]&&(a[g]=e[g]);this.file&&!Object.keys(a).some(g=>g.toLowerCase()==="source")&&(a.source=`[[${this.file.path}]]`);let d=["---",(0,ot.stringifyYaml)(a).trimEnd(),"---","",`# ${this.getTitle(e)}`,"",""].join(` -`),h=this.headers.find(g=>this.isNotesCol(g)),u=d+(h&&((r=e[h])!=null&&r.trim())?e[h]:""),f=n.substring(0,n.lastIndexOf("/"));f&&!this.app.vault.getAbstractFileByPath(f)&&await this.app.vault.createFolder(f),i=await this.app.vault.create(n,u),new ot.Notice(`Created: ${i.name}`)}await this.app.workspace.getLeaf("tab").openFile(i)}openNoteExpander(e,n){var i,o;new be(this.app,e,n,this.headers,(o=(i=this.file)==null?void 0:i.path)!=null?o:"",this.isNotesCol.bind(this),this.isSelectCol.bind(this),this.getColumnValues.bind(this),r=>{Object.assign(e,r),this.scheduleSave(),this.renderViewPreservingScroll()},()=>this.deleteWithUndo(e),r=>this.isCategoricalCol(r),this.titleKey(),r=>this.getBooleanColumns().includes(r),r=>this.isDateCol(r)).open()}renderViewPreservingScroll(){var l,c,d,h,u;let e=this.contentEl,n=e.querySelector(".csv-content-area"),i=e.querySelector(".csv-table-wrapper"),o=e.querySelector(".csv-kanban-board"),r={contentTop:(l=n==null?void 0:n.scrollTop)!=null?l:0,contentLeft:(c=n==null?void 0:n.scrollLeft)!=null?c:0,tableLeft:(d=i==null?void 0:i.scrollLeft)!=null?d:0,tableTop:(h=i==null?void 0:i.scrollTop)!=null?h:0,boardLeft:(u=o==null?void 0:o.scrollLeft)!=null?u:0,cols:new Map};e.querySelectorAll(".csv-kanban-col").forEach(f=>{var b,m;let g=(m=(b=f.querySelector(".csv-kanban-col-title"))==null?void 0:b.textContent)!=null?m:"",p=f.querySelector(".csv-kanban-col-body");g&&p&&r.cols.set(g,p.scrollTop)}),this.renderView();let a=()=>{let f=this.contentEl.querySelector(".csv-content-area"),g=this.contentEl.querySelector(".csv-table-wrapper"),p=this.contentEl.querySelector(".csv-kanban-board");f&&(f.scrollTop=r.contentTop,f.scrollLeft=r.contentLeft),g&&(g.scrollLeft=r.tableLeft,g.scrollTop=r.tableTop),p&&(p.scrollLeft=r.boardLeft),this.contentEl.querySelectorAll(".csv-kanban-col").forEach(b=>{var k,S;let m=(S=(k=b.querySelector(".csv-kanban-col-title"))==null?void 0:k.textContent)!=null?S:"",v=b.querySelector(".csv-kanban-col-body"),_=r.cols.get(m);v&&_!=null&&(v.scrollTop=_)})};a(),requestAnimationFrame(()=>{a(),requestAnimationFrame(a)}),setTimeout(a,50)}openAddModal(){let e={};if(Fe(this)){let n=gi(this);n&&(e[n]=["Task","Note","Idea"]);let i=pi(this);i&&(e[i]=["Low","Medium","High"])}new as(this.app,this.headers,this.isNotesCol.bind(this),this.isSelectCol.bind(this),this.getColumnValues.bind(this),n=>{this.rows.push(n),this.scheduleSave(),this.renderViewPreservingScroll(),new ot.Notice(`Added: ${this.getTitle(n)}`)},e,n=>this.getBooleanColumns().includes(n),n=>this.isCategoricalCol(n),this.titleKey(),n=>this.isDateCol(n)).open()}renderSelectField(e,n,i){var a;let o=(a=n[i])!=null?a:"",r=e.createDiv({cls:`csv-select-chip ${o?"":"empty"}`});return r.setText(o||"\u2014"),i.toLowerCase()==="status"&&o&&r.addClass(`status-chip-${o.toLowerCase().replace(/\s+/g,"-")}`),r.addEventListener("click",l=>{var c;l.stopPropagation(),It(r,(c=n[i])!=null?c:"",this.getColumnValues(i),d=>{n[i]=d,r.setText(d||"\u2014"),r.className=`csv-select-chip ${d?"":"empty"}`,i.toLowerCase()==="status"&&d&&r.addClass(`status-chip-${d.toLowerCase().replace(/\s+/g,"-")}`),this.scheduleSave()},this.contentEl,{multi:xt(i)})}),r}renderView(e=!1){var o;let n=this.contentEl;e?this.contentArea&&this.contentArea.empty():(n.empty(),n.addClass("datadeck-root"),this.renderComponent.unload(),this.renderComponent=new ot.Component,this.renderComponent.load(),lc(this,n),this.contentArea=n.createDiv({cls:"csv-content-area"}),this.installTouchScrollGuard(this.contentArea));let i=this.contentArea;if(i){if(i.toggleClass("csv-content-area--no-yscroll",this.mode==="kanban-genre"||this.mode==="table"),!this.headers.length){let r=i.createDiv({cls:"csv-empty-state csv-empty-state--big"});r.createEl("h3",{text:"This file is empty"}),r.createEl("p",{text:"Add a header row in your spreadsheet app, then come back \u2014 or click + Add in the toolbar to start fresh."});return}if(this.rows.length===0){let r=i.createDiv({cls:"csv-empty-state csv-empty-state--big"});r.createEl("h3",{text:"No entries yet"}),r.createEl("button",{cls:"csv-empty-state-action",text:"+ Add the first entry"}).addEventListener("click",()=>this.openAddModal()),r.createEl("p",{cls:"csv-empty-state-hint",text:`${this.headers.length} column${this.headers.length===1?"":"s"} detected: ${this.headers.slice(0,5).join(", ")}${this.headers.length>5?"\u2026":""}`});return}this.mode==="travel"?gr(i,this.rows,()=>this.loadMapSvg(),()=>this.scheduleSave(),this.settings.showResidency===!1?null:(o=this.settings.residencyRules)!=null?o:null,r=>this.renderComponent.register(r)):this.mode==="dashboard"?dc(this,i):this.mode==="library"?wn(this,i):this.mode==="kanban-genre"?kn(this,i):this.mode==="stats"?xr(this,i):this.mode==="chart"?nc(this,i):this.mode==="focus"?hc(this,i):this.mode==="tasks"?mi(this,i):_n(this,i)}}installTouchScrollGuard(e){if(!matchMedia("(pointer: coarse)").matches)return;let n=0,i=0,o=!1;e.addEventListener("touchstart",r=>{r.touches.length===1&&(n=r.touches[0].clientX,i=r.touches[0].clientY,o=!1)},{capture:!0,passive:!0}),e.addEventListener("touchmove",r=>{if(r.touches.length!==1||o)return;let a=Math.abs(r.touches[0].clientX-n),l=Math.abs(r.touches[0].clientY-i);(a>10||l>10)&&(o=!0)},{capture:!0,passive:!0}),e.addEventListener("click",r=>{o&&(r.preventDefault(),r.stopImmediatePropagation())},!0)}async backupToArchive(){var a,l;if(!this.file)return;let e=(l=(a=this.file.parent)==null?void 0:a.path)!=null?l:"",n=e?`${e}/Archive`:"Archive";await this.app.vault.adapter.exists(n)||await this.app.vault.adapter.mkdir(n);let i=this.formatDate(new Date),o=`${n}/${this.file.basename}_${i}.${this.file.extension}`;if(await this.app.vault.adapter.exists(o)){new ot.Notice(`Backup already exists for today: ${o}`);return}let r=await this.app.vault.readBinary(this.file);await this.app.vault.adapter.writeBinary(o,r),new ot.Notice(`Backed up to ${o}`)}hasDateColumn(){return this.getDateCol()!==null}isTravelFile(){let e=new Set(this.headers.map(n=>n.toLowerCase()));return e.has("country")&&e.has("date_entered")&&e.has("date_left")&&e.has("source")}async loadMapSvg(){if(un!==void 0)return un;let e=(0,ot.normalizePath)(`${this.app.vault.configDir}/plugins/datadeck/world-map.svg`);try{un=await this.app.vault.adapter.read(e)}catch(n){un=null}return un}getFilteredRows(){var i;let e=this.rows;if(this.searchQuery.trim()){let o=this.searchQuery.toLowerCase().trim();e=e.filter(r=>this.headers.some(a=>{var c;return((c=r[a])!=null?c:"").toLowerCase().includes(o)}))}if(this.mode==="table"&&this.tableSortCol&&this.headers.includes(this.tableSortCol))return tr(e,this.tableSortCol,this.tableSortDir);let n=this.getDateCol();if(this.mode==="table"&&n){let o=(i=this.fileCfg.sortNewestFirst)!=null?i:!0;e=[...e].sort((r,a)=>{var h,u;let l=(h=r[n])!=null?h:"",c=(u=a[n])!=null?u:"",d=l.localeCompare(c);return o?-d:d})}return e}getDateCol(){var a;if(this.fileCfg.dateColumns&&this.fileCfg.dateColumns.length>0){let l=this.fileCfg.dateColumns[0];return(a=this.headers.find(c=>c===l))!=null?a:null}if(this.headers.length===0)return null;let e=this.headers[0],n=e.toLowerCase();if(["date","day","datum"].includes(n))return e;let i=this.rows.slice(0,5),o=/^\d{4}-\d{2}-\d{2}$/;return i.length>0&&i.every(l=>{var c;return o.test((c=l[e])!=null?c:"")})?e:null}getBooleanColumns(){return this.fileCfg.habitColumns?this.fileCfg.habitColumns.filter(e=>this.headers.includes(e)):this.autoDetectBooleanColumns()}cleanupBooleanColumn(e){let n=0;return this.rows.forEach(i=>{var r;let o=this.isTruthy((r=i[e])!=null?r:"")?"1":"0";i[e]!==o&&n++,i[e]=o}),n>0&&(this.scheduleSave(),this.renderViewPreservingScroll()),n}autoDetectBooleanColumns(){return this.headers.filter(e=>{if(e===this.getDateCol()||this.isNotesCol(e))return!1;let n=this.rows.map(i=>{var o;return((o=i[e])!=null?o:"").toLowerCase().trim()});return is(n)})}parseDate(e){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);return n?new Date(parseInt(n[1]),parseInt(n[2])-1,parseInt(n[3])):null}formatDate(e){let n=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${n}-${i}-${o}`}isTruthy(e){return os(e)}renderMarkdownInto(e,n){var i,o;ot.MarkdownRenderer.render(this.app,n,e,(o=(i=this.file)==null?void 0:i.path)!=null?o:"",this.renderComponent)}cycleMode(){let e=bi(this);if(e.length<2)return;let n=e.findIndex(i=>i.id===this.mode);this.mode=e[(n+1)%e.length].id,this.renderView()}onunload(){this.renderComponent.unload(),this.saveTimer&&window.clearTimeout(this.saveTimer)}},Gg=[{id:"tasks",command:"Create tasks file",defaultName:"Tasks",headers:["Title","Type","Project","Priority","Due","Status","Notes"],mode:"tasks",configOverrides:{categoricalColumns:["Type","Priority"],dateColumns:["Due"],statusColumn:"Status",notesColumn:"Notes"}},{id:"travel",command:"Create travel file",defaultName:"Travel",headers:["date_entered","date_left","country","city","visa_status","notes","source","resolved"],mode:"travel"},{id:"habits",command:"Create habit tracker file",defaultName:"Habits",headers:["Date","Exercise","Meditate","Read","Notes"],mode:"dashboard",configOverrides:{habitColumns:["Exercise","Meditate","Read"],notesColumn:"Notes",statusColumn:""}},{id:"chart",command:"Create chart file",defaultName:"Measurements",headers:["Date","Value","Notes"],mode:"chart",configOverrides:{chartYCol:"Value",chartFit:"linear",notesColumn:"Notes"}}],xi=class extends ot.Plugin{constructor(){super(...arguments);this.settings=wi}async onload(){await this.loadSettings(),this.registerView(fn,e=>new As(e,this.settings,()=>this.saveSettings())),this.registerExtensions(["csv"],fn),this.addSettingTab(new Cn(this.app,this)),this.registerMarkdownCodeBlockProcessor("csv-add",async(e,n,i)=>{await mr(this.app,e.trim(),n,i,this.settings.fileConfigs)}),this.registerMarkdownCodeBlockProcessor("csv-random",async(e,n,i)=>{await cc(this.app,e.trim(),n,i)}),gc(this.app,this.settings,()=>this.saveSettings(),(e,n)=>this.registerMarkdownCodeBlockProcessor(e,n)),bc(this.app,(e,n)=>this.registerMarkdownCodeBlockProcessor(e,n)),xc(this.app,this.settings,(e,n)=>this.registerMarkdownCodeBlockProcessor(e,n)),this.addCommand({id:"add-entry",name:"Add entry to current CSV",checkCallback:e=>{let n=this.app.workspace.getActiveViewOfType(As);return n?(e||n.openAddModal(),!0):!1}}),this.addCommand({id:"cycle-view-mode",name:"Cycle view mode",checkCallback:e=>{let n=this.app.workspace.getActiveViewOfType(As);return n?(e||n.cycleMode(),!0):!1}});for(let e of Gg)this.addCommand({id:`create-${e.id}`,name:e.command,callback:()=>this.createTemplateFile(e)});this.registerEvent(this.app.vault.on("rename",async(e,n)=>{e instanceof ot.TFile&&e.extension==="csv"&&this.settings.fileConfigs[n]&&(or(this.settings.fileConfigs,n,e.path),await this.saveSettings())})),this.registerEvent(this.app.vault.on("delete",async e=>{e instanceof ot.TFile&&this.settings.fileConfigs[e.path]&&(delete this.settings.fileConfigs[e.path],await this.saveSettings())})),this.registerMarkdownCodeBlockProcessor("csv-refresh",(e,n,i)=>{let o=n.createEl("button",{cls:"csv-refresh-btn"});o.innerHTML="\u21BB refresh",o.addEventListener("click",async()=>{let r=i.sourcePath,a=this.app.vault.getAbstractFileByPath(r);if(a instanceof ot.TFile){let l=this.app.workspace.activeLeaf;l&&await l.openFile(a,{state:{mode:"preview"}})}})})}async createTemplateFile(e){new vn(this.app,e.command,e.defaultName,"File name (without .csv)",async n=>{let i=this.app.workspace.getActiveFile(),o=i!=null&&i.parent&&i.parent.path!=="/"?`${i.parent.path}/`:"",r=Ie(n),a=(0,ot.normalizePath)(`${o}${r}.csv`);for(let d=2;this.app.vault.getAbstractFileByPath(a);d++)a=(0,ot.normalizePath)(`${o}${r} ${d}.csv`);let l=await this.app.vault.create(a,e.headers.join(",")+` -`),c=this.settings.fileConfigs[l.path]||{};this.settings.fileConfigs[l.path]={...c,defaultMode:e.mode,...e.configOverrides||{}},await this.saveSettings(),await this.app.workspace.getLeaf("tab").openFile(l),new ot.Notice(`Created: ${l.name}`)}).open()}async loadSettings(){var e;this.settings=Object.assign({},wi,await this.loadData()),this.settings.residencyRules=JSON.parse(JSON.stringify((e=this.settings.residencyRules)!=null?e:[]))}async saveSettings(){await this.saveData(this.settings)}}; +`):s}function j5(s,t){let{element:e,datasetIndex:i,index:n}=t,o=s.getDatasetMeta(i).controller,{label:r,value:a}=o.getLabelAndValue(n);return{chart:s,label:r,parsed:o.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:a,dataset:o.getDataset(),dataIndex:n,datasetIndex:i,element:e}}function tL(s,t){let e=s.chart.ctx,{body:i,footer:n,title:o}=s,{boxWidth:r,boxHeight:a}=t,L=gt(t.bodyFont),l=gt(t.titleFont),c=gt(t.footerFont),d=o.length,h=n.length,u=i.length,f=Ct(t.padding),p=f.height,m=0,g=i.reduce((S,C)=>S+C.before.length+C.lines.length+C.after.length,0);if(g+=s.beforeBody.length+s.afterBody.length,d&&(p+=d*l.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),g){let S=t.displayColors?Math.max(a,L.lineHeight):L.lineHeight;p+=u*S+(g-u)*L.lineHeight+(g-1)*t.bodySpacing}h&&(p+=t.footerMarginTop+h*c.lineHeight+(h-1)*t.footerSpacing);let b=0,_=function(S){m=Math.max(m,e.measureText(S).width+b)};return e.save(),e.font=l.string,at(s.title,_),e.font=L.string,at(s.beforeBody.concat(s.afterBody),_),b=t.displayColors?r+2+t.boxPadding:0,at(i,S=>{at(S.before,_),at(S.lines,_),at(S.after,_)}),b=0,e.font=c.string,at(s.footer,_),e.restore(),m+=f.width,{width:m,height:p}}function U5(s,t){let{y:e,height:i}=t;return es.height-i/2?"bottom":"center"}function Y5(s,t,e,i){let{x:n,width:o}=i,r=e.caretSize+e.caretPadding;if(s==="left"&&n+o+r>t.width||s==="right"&&n-o-r<0)return!0}function G5(s,t,e,i){let{x:n,width:o}=e,{width:r,chartArea:{left:a,right:L}}=s,l="center";return i==="center"?l=n<=(a+L)/2?"left":"right":n<=o/2?l="left":n>=r-o/2&&(l="right"),Y5(l,s,t,e)&&(l="center"),l}function eL(s,t,e){let i=e.yAlign||t.yAlign||U5(s,e);return{xAlign:e.xAlign||t.xAlign||G5(s,t,e,i),yAlign:i}}function K5(s,t){let{x:e,width:i}=s;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function q5(s,t,e){let{y:i,height:n}=s;return t==="top"?i+=e:t==="bottom"?i-=n+e:i-=n/2,i}function sL(s,t,e,i){let{caretSize:n,caretPadding:o,cornerRadius:r}=s,{xAlign:a,yAlign:L}=e,l=n+o,{topLeft:c,topRight:d,bottomLeft:h,bottomRight:u}=we(r),f=K5(t,a),p=q5(t,L,l);return L==="center"?a==="left"?f+=l:a==="right"&&(f-=l):a==="left"?f-=Math.max(c,h)+n:a==="right"&&(f+=Math.max(d,u)+n),{x:mt(f,0,i.width-t.width),y:mt(p,0,i.height-t.height)}}function Ki(s,t,e){let i=Ct(e.padding);return t==="center"?s.x+s.width/2:t==="right"?s.x+s.width-i.right:s.x+i.left}function iL(s){return se([],ue(s))}function X5(s,t,e){return he(s,{tooltip:t,tooltipItems:e,type:"tooltip"})}function nL(s,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?s.override(e):s}function Rt(s,t,e,i){let n=s[t].call(e,i);return typeof n=="undefined"?WL[t].call(e,i):n}function J5(s,t,e,i){let n=s.indexOf(t);if(n===-1)return Q5(s,t,e,i);let o=s.lastIndexOf(t);return n!==o?e:n}function oL(s){let t=this.getLabels();return s>=0&&sf&&(C=zn(w*C/f/u)*u),tt(L)||(v=Math.pow(10,L),C=Math.ceil(C*v)/v),n==="ticks"?(y=Math.floor(p/C)*C,x=Math.ceil(m/C)*C):(y=p,x=m),g&&b&&o&&jr((a-r)/o,C/1e3)?(w=Math.round(Math.min((a-r)/C,c)),C=(a-r)/w,y=r,x=a):_?(y=g?r:y,x=b?a:x,w=l-1,C=(x-y)/w):(w=(x-y)/C,ps(w,Math.round(w),C/1e3)?w=Math.round(w):w=Math.ceil(w));let k=Math.max(Zn(C),Zn(y));v=Math.pow(10,tt(L)?k:L),y=Math.round(y*v)/v,x=Math.round(x*v)/v;let M=0;for(g&&(h&&y!==r?(e.push({value:r}),ya)break;e.push({value:T})}return b&&h&&x!==a?e.length&&ps(e[e.length-1].value,a,rL(a,S,s))?e[e.length-1].value=a:e.push({value:a}):(!b||x===a)&&e.push({value:x}),e}function rL(s,t,{horizontal:e,minRotation:i}){let n=Zt(i),o=(e?Math.sin(n):Math.cos(n))||.001,r=.75*t*(""+s).length;return Math.min(t/o,r)}function aL(s){return s/Math.pow(10,Li(s))===1}function LL(s,t,e){let i=Math.pow(10,e),n=Math.floor(s/i);return Math.ceil(t/i)-n}function sd(s,t){let e=t-s,i=Li(e);for(;LL(s,t,i)>10;)i++;for(;LL(s,t,i)<10;)i--;return Math.min(i,Li(s))}function id(s,{min:t,max:e}){t=At(s.min,t);let i=[],n=Li(t),o=sd(t,e),r=o<0?Math.pow(10,Math.abs(o)):1,a=Math.pow(10,o),L=n>o?Math.pow(10,n):0,l=Math.round((t-L)*r)/r,c=Math.floor((t-L)/a/10)*a*10,d=Math.floor((l-c)/Math.pow(10,o)),h=At(s.min,Math.round((L+c+d*Math.pow(10,o))*r)/r);for(;h=10?d=d<15?15:20:d++,d>=20&&(o++,d=2,r=o>=0?1:r),h=Math.round((L+c+d*Math.pow(10,o))*r)/r;let u=At(s.max,h);return i.push({value:u,major:aL(u),significand:d}),i}function Fo(s){let t=s.ticks;if(t.display&&s.display){let e=Ct(t.backdropPadding);return J(t.font&&t.font.size,ut.font.size)+e.height}return 0}function nd(s,t,e){return e=dt(e)?e:[e],{w:ta(s,t.string,e),h:e.length*t.lineHeight}}function lL(s,t,e,i,n){return s===i||s===n?{start:t-e/2,end:t+e/2}:sn?{start:t-e,end:t}:{start:t,end:t+e}}function od(s){let t={l:s.left+s._padding.left,r:s.right-s._padding.right,t:s.top+s._padding.top,b:s.bottom-s._padding.bottom},e=Object.assign({},t),i=[],n=[],o=s._pointLabels.length,r=s.options.pointLabels,a=r.centerPointLabels?nt/o:0;for(let L=0;Lt.r&&(a=(i.end-t.r)/o,s.r=Math.max(s.r,t.r+a)),n.startt.b&&(L=(n.end-t.b)/r,s.b=Math.max(s.b,t.b+L))}function ad(s,t,e){let i=s.drawingArea,{extra:n,additionalAngle:o,padding:r,size:a}=e,L=s.getPointPosition(t,i+n+r,o),l=Math.round(Fi(yt(L.angle+pt))),c=hd(L.y,a.h,l),d=cd(l),h=dd(L.x,a.w,d);return{visible:!0,x:L.x,y:c,textAlign:d,left:h,top:c,right:h+a.w,bottom:c+a.h}}function Ld(s,t){if(!t)return!0;let{left:e,top:i,right:n,bottom:o}=s;return!(Jt({x:e,y:i},t)||Jt({x:e,y:o},t)||Jt({x:n,y:i},t)||Jt({x:n,y:o},t))}function ld(s,t,e){let i=[],n=s._pointLabels.length,o=s.options,{centerPointLabels:r,display:a}=o.pointLabels,L={extra:Fo(o)/2,additionalAngle:r?nt/n:0},l;for(let c=0;c270||e<90)&&(s-=t),s}function ud(s,t,e){let{left:i,top:n,right:o,bottom:r}=e,{backdropColor:a}=t;if(!tt(a)){let L=we(t.borderRadius),l=Ct(t.backdropPadding);s.fillStyle=a;let c=i-l.left,d=n-l.top,h=o-i+l.width,u=r-n+l.height;Object.values(L).some(f=>f!==0)?(s.beginPath(),vs(s,{x:c,y:d,w:h,h:u,radius:L}),s.fill()):s.fillRect(c,d,h,u)}}function fd(s,t){let{ctx:e,options:{pointLabels:i}}=s;for(let n=t-1;n>=0;n--){let o=s._pointLabelItems[n];if(!o.visible)continue;let r=i.setContext(s.getPointLabelContext(n));ud(e,r,o);let a=gt(r.font),{x:L,y:l,textAlign:c}=o;ke(e,s._pointLabels[n],L,l+a.lineHeight/2,a,{color:r.color,textAlign:c,textBaseline:"middle"})}}function YL(s,t,e,i){let{ctx:n}=s;if(e)n.arc(s.xCenter,s.yCenter,t,0,ht);else{let o=s.getPointPosition(0,t);n.moveTo(o.x,o.y);for(let r=1;r=Ot.indexOf(e);o--){let r=Ot[o];if(Ln[r].common&&s._adapter.diff(n,i,r)>=t-1)return r}return Ot[e?Ot.indexOf(e):0]}function bd(s){for(let t=Ot.indexOf(s)+1,e=Ot.length;t=t?e[i]:e[n];s[o]=!0}}function vd(s,t,e,i){let n=s._adapter,o=+n.startOf(t[0].value,i),r=t[t.length-1].value,a,L;for(a=o;a<=r;a=+n.add(a,1,i))L=e[a],L>=0&&(t[L].major=!0);return t}function fL(s,t,e){let i=[],n={},o=t.length,r,a;for(r=0;r=s[i].pos&&t<=s[n].pos&&({lo:i,hi:n}=Qt(s,"pos",t)),{pos:o,time:a}=s[i],{pos:r,time:L}=s[n]):(t>=s[i].time&&t<=s[n].time&&({lo:i,hi:n}=Qt(s,"time",t)),{time:o,pos:a}=s[i],{time:r,pos:L}=s[n]);let l=r-o;return l?a+(L-a)*(t-o)/l:a}var Mo,ie,ga,x2,Ji,ni,go,xa,R2,Pt,We,je,oe,Ue,Ae,Cs,Ye,Ge,mL,ko,bL,vL,yL,_t,oi,tn,Xi,e1,Da,CL,ri,Ta,sn,Ft,b1,Aa,Ra,Oe,_s,wo,Ut,Eo,Va,wL,ti,Ao,B1,$1,z1,Qi,Ha,ne,De,n5,Yt,Ke,qe,RL,Po,ja,FL,VL,on,NL,Ja,N5,rn,zL,ai,HL,Gi,ZL,si,WL,ii,jL,UL,Q5,td,Ss,Es,Ms,Li,Ze,ks,Te,Ln,Ot,Pe,ws,GL,yd,qL=xn(()=>{pa();Mo=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){let o=e.listeners[n],r=e.duration;o.forEach(a=>a({chart:t,initial:e.initial,numSteps:r,currentStep:Math.min(i-e.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=Yn.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let e=0;this._charts.forEach((i,n)=>{if(!i.running||!i.items.length)return;let o=i.items,r=o.length-1,a=!1,L;for(;r>=0;--r)L=o[r],L._active?(L._total>i.duration&&(i.duration=L._total),L.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length}),this._lastDate=t,e===0&&(this._running=!1)}_getAnims(t){let e=this._charts,i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){!e||!e.length||this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){let e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce((i,n)=>Math.max(i,n._duration),0),this._refresh())}running(t){if(!this._running)return!1;let e=this._charts.get(t);return!(!e||!e.running||!e.items.length)}stop(t){let e=this._charts.get(t);if(!e||!e.items.length)return;let i=e.items,n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}},ie=new Mo,ga="transparent",x2={boolean(s,t,e){return e>.5?t:s},color(s,t,e){let i=Qn(s||ga),n=i.valid&&Qn(t||ga);return n&&n.valid?n.mix(i,e).hexString():t},number(s,t,e){return s+(t-s)*e}},Ji=class{constructor(t,e,i,n){let o=e[i];n=ys([t.to,n,o,t.from]);let r=ys([t.from,o,n]);this._active=!0,this._fn=t.fn||x2[t.type||typeof r],this._easing=cs[t.easing]||cs.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=r,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);let n=this._target[this._prop],o=i-this._start,r=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=ys([t.to,e,n,t.from]),this._from=ys([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,n=this._prop,o=this._from,r=this._loop,a=this._to,L;if(this._active=o!==a&&(r||e1?2-L:L,L=this._easing(Math.min(1,Math.max(0,L))),this._target[n]=this._fn(o,a,L)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let n=0;n{let o=t[n];if(!st(o))return;let r={};for(let a of e)r[a]=o[a];(dt(o.properties)&&o.properties||[n]).forEach(a=>{(a===n||!i.has(a))&&i.set(a,r)})})}_animateOptions(t,e){let i=e.options,n=_2(t,i);if(!n)return[];let o=this._createAnimations(n,i);return i.$shared&&C2(t.options.$animations,i).then(()=>{t.options=i},()=>{}),o}_createAnimations(t,e){let i=this._properties,n=[],o=t.$animations||(t.$animations={}),r=Object.keys(e),a=Date.now(),L;for(L=r.length-1;L>=0;--L){let l=r[L];if(l.charAt(0)==="$")continue;if(l==="options"){n.push(...this._animateOptions(t,e));continue}let c=e[l],d=o[l],h=i.get(l);if(d)if(h&&d.active()){d.update(h,c,a);continue}else d.cancel();if(!h||!h.duration){t[l]=c;continue}o[l]=d=new Ji(h,t,l,c),n.push(d)}return n}update(t,e){if(this._properties.size===0){Object.assign(t,e);return}let i=this._createAnimations(t,e);if(i.length)return ie.add(this._chart,i),!0}};go=s=>s==="reset"||s==="none",xa=(s,t)=>t?s:Object.assign({},s),R2=(s,t,e)=>s&&!t.hidden&&t._stacked&&{keys:pL(e,!0),values:null},Pt=class{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=fo(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&qs(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(d,h,u,f)=>d==="x"?h:d==="r"?f:u,o=e.xAxisID=J(i.xAxisID,po(t,"x")),r=e.yAxisID=J(i.yAxisID,po(t,"y")),a=e.rAxisID=J(i.rAxisID,po(t,"r")),L=e.indexAxis,l=e.iAxisID=n(L,o,r,a),c=e.vAxisID=n(L,r,o,a);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(r),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&jn(this._data,this),t._stacked&&qs(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(st(e)){let n=this._cachedMeta;this._data=k2(e,n)}else if(i!==e){if(i){jn(i,this);let n=this._cachedMeta;qs(n),n._parsed=[]}e&&Object.isExtensible(e)&&qr(e,this),this._syncList=[],this._data=e}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let e=this._cachedMeta,i=this.getDataset(),n=!1;this._dataCheck();let o=e._stacked;e._stacked=fo(e.vScale,e),e.stack!==i.stack&&(n=!0,qs(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(ya(this,e._parsed),e._stacked=fo(e.vScale,e))}configure(){let t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){let{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:r}=i,a=o.axis,L=t===0&&e===n.length?!0:i._sorted,l=t>0&&i._parsed[t-1],c,d,h;if(this._parsing===!1)i._parsed=n,i._sorted=!0,h=n;else{dt(n[t])?h=this.parseArrayData(i,n,t,e):st(n[t])?h=this.parseObjectData(i,n,t,e):h=this.parsePrimitiveData(i,n,t,e);let u=()=>d[a]===null||l&&d[a]p||d=0;--h)if(!f()){this.updateRangeFromParsed(l,t,u,L);break}}return l}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],n,o,r;for(n=0,o=e.length;n=0&&tthis.getContext(i,n,e),p=l.resolveNamedOptions(h,u,f,d);return p.$shared&&(p.$shared=L,o[r]=Object.freeze(xa(p,L))),p}_resolveAnimations(t,e,i){let n=this.chart,o=this._cachedDataOpts,r=`animation-${e}`,a=o[r];if(a)return a;let L;if(n.options.animation!==!1){let c=this.chart.config,d=c.datasetAnimationScopeKeys(this._type,e),h=c.getOptionScopes(this.getDataset(),d);L=c.createResolver(h,this.getContext(t,i,e))}let l=new ni(n,L&&L.animations);return L&&L._cacheable&&(o[r]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||go(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){let i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),r=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:r}}updateElement(t,e,i,n){go(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!go(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;let o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[a,L,l]of this._syncList)this[a](L,l);this._syncList=[];let n=i.length,o=e.length,r=Math.min(o,n);r&&this.parse(0,r),o>n?this._insertElements(n,o-n,t):o{for(l.length+=e,a=l.length-1;a>=r;a--)l[a]=l[a-e]};for(L(o),a=t;ac.controller.options.grouped),o=i.options.stacked,r=[],a=this._cachedMeta.controller.getParsed(e),L=a&&a[i.axis],l=c=>{let d=c._parsed.find(u=>u[i.axis]===L),h=d&&d[c.vScale.axis];if(tt(h)||isNaN(h))return!0};for(let c of n)if(!(e!==void 0&&l(c))&&((o===!1||r.indexOf(c.stack)===-1||o===void 0&&c.stack===void 0)&&r.push(c.stack),c.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter(i=>t[i].axis===e).shift()}_getAxis(){let t={},e=this.getFirstScaleIdForIndexAxis();for(let i of this.chart.data.datasets)t[J(this.chart.options.indexAxis==="x"?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){let n=this._getStacks(t,i),o=e!==void 0?n.indexOf(e):-1;return o===-1?n.length-1:o}_getRuler(){let t=this.options,e=this._cachedMeta,i=e.iScale,n=[],o,r;for(o=0,r=e.data.length;o=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,r=this.getParsed(t),a=n.getLabelForValue(r.x),L=o.getLabelForValue(r.y),l=r._custom;return{label:i[t]||"",value:"("+a+", "+L+(l?", "+l:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){let o=n==="reset",{iScale:r,vScale:a}=this._cachedMeta,{sharedOptions:L,includeOptions:l}=this._getSharedOptions(e,n),c=r.axis,d=a.axis;for(let h=e;h+i[L];if(st(i[t])){let{key:L="value"}=this._parsing;o=l=>+de(i[l],L)}let r,a;for(r=t,a=t+e;r0&&!isNaN(t)?ht*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=ms(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0,i=this.chart,n,o,r,a,L;if(!t){for(n=0,o=i.data.datasets.length;nt!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")}),U(oe,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data,{labels:{pointStyle:i,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map((L,l)=>{let d=t.getDatasetMeta(0).controller.getStyle(l);return{text:L,fillStyle:d.backgroundColor,fontColor:o,hidden:!t.getDataVisibility(l),lineDash:d.borderDash,lineDashOffset:d.borderDashOffset,lineJoin:d.borderJoinStyle,lineWidth:d.borderWidth,strokeStyle:d.borderColor,textAlign:n,pointStyle:i,borderRadius:r&&(a||d.borderRadius),index:l}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}});Ue=class extends Pt{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,r=this.chart._animationsDisabled,{start:a,count:L}=Kn(e,n,r);this._drawStart=a,this._drawCount=L,qn(e)&&(a=0,L=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;let l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!r,options:l},t),this.updateElements(n,a,L,t)}updateElements(t,e,i,n){let o=n==="reset",{iScale:r,vScale:a,_stacked:L,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,n),h=r.axis,u=a.axis,{spanGaps:f,segment:p}=this.options,m=$e(f)?f:Number.POSITIVE_INFINITY,g=this.chart._animationsDisabled||o||n==="none",b=e+i,_=t.length,S=e>0&&this.getParsed(e-1);for(let C=0;C<_;++C){let v=t[C],y=g?v:{};if(C=b){y.skip=!0;continue}let x=this.getParsed(C),w=tt(x[u]),k=y[h]=r.getPixelForValue(x[h],C),M=y[u]=o||w?a.getBasePixel():a.getPixelForValue(L?this.applyStack(a,x,L):x[u],C);y.skip=isNaN(k)||isNaN(M)||w,y.stop=C>0&&Math.abs(x[h]-S[h])>m,p&&(y.parsed=x,y.raw=l.data[C]),d&&(y.options=c||this.resolveDataElementOptions(C,v.active?"active":n)),g||this.updateElement(v,C,y,n),S=x}}getMaxOverflow(){let t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;let o=n[0].size(this.resolveDataElementOptions(0)),r=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,r)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}};U(Ue,"id","line"),U(Ue,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),U(Ue,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});Ae=class extends Pt{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=ms(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return oo.bind(this)(t,e,i,n)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,n)=>{let o=this.getParsed(n).r;!isNaN(o)&&this.chart.getDataVisibility(n)&&(oe.max&&(e.max=o))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),r=Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0),a=(o-r)/t.getVisibleDatasetCount();this.outerRadius=o-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(t,e,i,n){let o=n==="reset",r=this.chart,L=r.options.animation,l=this._cachedMeta.rScale,c=l.xCenter,d=l.yCenter,h=l.getIndexAngle(0)-.5*nt,u=h,f,p=360/this.countVisibleElements();for(f=0;f{!isNaN(this.getParsed(n).r)&&this.chart.getDataVisibility(n)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Zt(this.resolveDataElementOptions(t,e).angle||i):0}};U(Ae,"id","polarArea"),U(Ae,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),U(Ae,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let e=t.data;if(e.labels.length&&e.datasets.length){let{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map((o,r)=>{let L=t.getDatasetMeta(0).controller.getStyle(r);return{text:o,fillStyle:L.backgroundColor,strokeStyle:L.borderColor,fontColor:n,lineWidth:L.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(r),index:r}})}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});Cs=class extends oe{};U(Cs,"id","pie"),U(Cs,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});Ye=class extends Pt{getLabelAndValue(t){let e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return oo.bind(this)(t,e,i,n)}update(t){let e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,t!=="resize"){let r=this.resolveDatasetElementOptions(t);this.options.showLine||(r.borderWidth=0);let a={_loop:!0,_fullLoop:o.length===n.length,options:r};this.updateElement(i,void 0,a,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){let o=this._cachedMeta.rScale,r=n==="reset";for(let a=e;a0&&this.getParsed(e-1);for(let S=e;S0&&Math.abs(v[u]-_[u])>g,m&&(y.parsed=v,y.raw=l.data[S]),h&&(y.options=d||this.resolveDataElementOptions(S,C.active?"active":n)),b||this.updateElement(C,S,y,n),_=v}this.updateSharedOptions(d,n,c)}getMaxOverflow(){let t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let a=0;for(let L=e.length-1;L>=0;--L)a=Math.max(a,e[L].size(this.resolveDataElementOptions(L))/2);return a>0&&a}let i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;let o=e[0].size(this.resolveDataElementOptions(0)),r=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,r)/2}};U(Ge,"id","scatter"),U(Ge,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),U(Ge,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});mL=Object.freeze({__proto__:null,BarController:We,BubbleController:je,DoughnutController:oe,LineController:Ue,PieController:Cs,PolarAreaController:Ae,RadarController:Ye,ScatterController:Ge});ko=class s{constructor(t){U(this,"options");this.options=t||{}}static override(t){Object.assign(s.prototype,t)}init(){}formats(){return He()}parse(){return He()}format(){return He()}add(){return He()}diff(){return He()}startOf(){return He()}endOf(){return He()}},bL={_date:ko};vL={evaluateInteractionItems:li,modes:{index(s,t,e,i){let n=Ee(t,s),o=e.axis||"x",r=e.includeInvisible||!1,a=e.intersect?bo(s,n,o,i,r):vo(s,n,o,!1,i,r),L=[];return a.length?(s.getSortedVisibleDatasetMetas().forEach(l=>{let c=a[0].index,d=l.data[c];d&&!d.skip&&L.push({element:d,datasetIndex:l.index,index:c})}),L):[]},dataset(s,t,e,i){let n=Ee(t,s),o=e.axis||"xy",r=e.includeInvisible||!1,a=e.intersect?bo(s,n,o,i,r):vo(s,n,o,!1,i,r);if(a.length>0){let L=a[0].datasetIndex,l=s.getDatasetMeta(L).data;a=[];for(let c=0;c{typeof p.beforeLayout=="function"&&p.beforeLayout()});let c=L.reduce((p,m)=>m.box.options&&m.box.options.display===!1?p:p+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/c,hBoxMaxHeight:r/2}),h=Object.assign({},n);xL(h,Ct(i));let u=Object.assign({maxPadding:h,w:o,h:r,x:n.left,y:n.top},n),f=q2(L.concat(l),d);ei(a.fullSize,u,d,f),ei(L,u,d,f),ei(l,u,d,f)&&ei(L,u,d,f),J2(u),Ea(a.leftAndTop,u,d,f),u.x+=u.w,u.y+=u.h,Ea(a.rightAndBottom,u,d,f),s.chartArea={left:u.left,top:u.top,right:u.left+u.w,bottom:u.top+u.h,height:u.h,width:u.w},at(a.chartArea,p=>{let m=p.box;Object.assign(m,s.chartArea),m.update(u.w,u.h,{left:0,top:0,right:0,bottom:0})})}},oi=class{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}},tn=class extends oi{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},Xi="$chartjs",e1={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Da=s=>s===null||s==="";CL=ca?{passive:!0}:!1;ri=new Map,Ta=0;sn=class extends oi{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(s1(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[Xi])return!1;let i=e[Xi].initial;["height","width"].forEach(o=>{let r=i[o];tt(r)?e.removeAttribute(o):e.setAttribute(o,r)});let n=i.style||{};return Object.keys(n).forEach(o=>{e.style[o]=n[o]}),e.width=e.width,delete e[Xi],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let n=t.$proxies||(t.$proxies={}),r={attach:r1,detach:a1,resize:c1}[e]||d1;n[e]=r(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:yo,detach:yo,resize:yo}[e]||n1)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return la(t,e,i,n)}isAttached(t){let e=t&&Zi(t);return!!(e&&e.isConnected)}};Ft=class{constructor(){U(this,"x");U(this,"y");U(this,"active",!1);U(this,"options");U(this,"$animations")}tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return $e(this.x)&&$e(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let n={};return t.forEach(o=>{n[o]=i[o]&&i[o].active()?i[o]._to:this[o]}),n}};U(Ft,"defaults",{}),U(Ft,"defaultRoutes");b1=s=>s==="left"?"right":s==="right"?"left":s,Aa=(s,t,e)=>t==="top"||t==="left"?s[t]+e:s[t]-e,Ra=(s,t)=>Math.min(t||s,s);Oe=class s extends Ft{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=At(t,Number.POSITIVE_INFINITY),e=At(e,Number.NEGATIVE_INFINITY),i=At(i,Number.POSITIVE_INFINITY),n=At(n,Number.NEGATIVE_INFINITY),{min:At(t,i),max:At(e,n),minDefined:ft(t),maxDefined:ft(e)}}getMinMax(t){let{min:e,max:i,minDefined:n,maxDefined:o}=this.getUserBounds(),r;if(n&&o)return{min:e,max:i};let a=this.getMatchingVisibleMetas();for(let L=0,l=a.length;Li?i:e,i=n&&e>i?e:i,{min:At(e,At(i,e)),max:At(i,At(e,i))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ct(this.options.beforeUpdate,[this])}update(t,e,i){let{beginAtZero:n,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ia(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let L=a=o||i<=1||!this.isHorizontal()){this.labelRotation=n;return}let c=this._getLabelSizes(),d=c.widest.width,h=c.highest.height,u=mt(this.chart.width-d,0,this.maxWidth);a=t.offset?this.maxWidth/i:u/(i-1),d+6>a&&(a=u/(i-(t.offset?.5:1)),L=this.maxHeight-Js(t.grid)-e.padding-Oa(t.title,this.chart.options.font),l=Math.sqrt(d*d+h*h),r=Fi(Math.min(Math.asin(mt((c.highest.height+6)/a,-1,1)),Math.asin(mt(L/l,-1,1))-Math.asin(mt(h/l,-1,1)))),r=Math.max(n,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){ct(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ct(this.options.beforeFit,[this])}fit(){let t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){let L=Oa(n,e.options.font);if(a?(t.width=this.maxWidth,t.height=Js(o)+L):(t.height=this.maxHeight,t.width=Js(o)+L),i.display&&this.ticks.length){let{first:l,last:c,widest:d,highest:h}=this._getLabelSizes(),u=i.padding*2,f=Zt(this.labelRotation),p=Math.cos(f),m=Math.sin(f);if(a){let g=i.mirror?0:m*d.width+p*h.height;t.height=Math.min(this.maxHeight,t.height+g+u)}else{let g=i.mirror?0:p*d.width+m*h.height;t.width=Math.min(this.maxWidth,t.width+g+u)}this._calculatePadding(l,c,m,p)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){let{ticks:{align:o,padding:r},position:a}=this.options,L=this.labelRotation!==0,l=a!=="top"&&this.axis==="x";if(this.isHorizontal()){let c=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1),h=0,u=0;L?l?(h=n*t.width,u=i*e.height):(h=i*t.height,u=n*e.width):o==="start"?u=e.width:o==="end"?h=t.width:o!=="inner"&&(h=t.width/2,u=e.width/2),this.paddingLeft=Math.max((h-c+r)*this.width/(this.width-c),0),this.paddingRight=Math.max((u-d+r)*this.width/(this.width-d),0)}else{let c=e.height/2,d=t.height/2;o==="start"?(c=0,d=t.height):o==="end"&&(c=e.height,d=0),this.paddingTop=c+r,this.paddingBottom=d+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ct(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e({width:r[w]||0,height:a[w]||0});return{first:x(0),last:x(e-1),widest:x(v),highest:x(y),widths:r,heights:a}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);let e=this._startPixel+t*this._length;return Ur(this._alignToPixels?Me(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&ta*n?a/i:L/n:L*n0}_computeGridLineItems(t){let e=this.axis,i=this.chart,n=this.options,{grid:o,position:r,border:a}=n,L=o.offset,l=this.isHorizontal(),d=this.ticks.length+(L?1:0),h=Js(o),u=[],f=a.setContext(this.getContext()),p=f.display?f.width:0,m=p/2,g=function(P){return Me(i,P,p)},b,_,S,C,v,y,x,w,k,M,T,A;if(r==="top")b=g(this.bottom),y=this.bottom-h,w=b-m,M=g(t.top)+m,A=t.bottom;else if(r==="bottom")b=g(this.top),M=t.top,A=g(t.bottom)-m,y=b+m,w=this.top+h;else if(r==="left")b=g(this.right),v=this.right-h,x=b-m,k=g(t.left)+m,T=t.right;else if(r==="right")b=g(this.left),k=t.left,T=g(t.right)-m,v=b+m,x=this.left+h;else if(e==="x"){if(r==="center")b=g((t.top+t.bottom)/2+.5);else if(st(r)){let P=Object.keys(r)[0],E=r[P];b=g(this.chart.scales[P].getPixelForValue(E))}M=t.top,A=t.bottom,y=b+m,w=y+h}else if(e==="y"){if(r==="center")b=g((t.left+t.right)/2);else if(st(r)){let P=Object.keys(r)[0],E=r[P];b=g(this.chart.scales[P].getPixelForValue(E))}v=b-m,x=v-h,k=t.left,T=t.right}let B=J(n.ticks.maxTicksLimit,d),I=Math.max(1,Math.ceil(d/B));for(_=0;_0&&(D-=Y/2);break}N={left:D,top:K,width:Y+G.width,height:R+G.height,color:I.backdropColor}}m.push({label:S,font:w,textOffset:T,options:{rotation:p,color:E,strokeColor:j,strokeWidth:F,textAlign:W,textBaseline:A,translation:[C,v],backdrop:N}})}return m}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-Zt(this.labelRotation))return t==="top"?"left":"right";let n="center";return e.align==="start"?n="left":e.align==="end"?n="right":e.align==="inner"&&(n="inner"),n}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,r=this._getLabelSizes(),a=t+o,L=r.widest.width,l,c;return e==="left"?n?(c=this.right+o,i==="near"?l="left":i==="center"?(l="center",c+=L/2):(l="right",c+=L)):(c=this.right-a,i==="near"?l="right":i==="center"?(l="center",c-=L/2):(l="left",c=this.left)):e==="right"?n?(c=this.left+o,i==="near"?l="right":i==="center"?(l="center",c-=L/2):(l="left",c-=L)):(c=this.left+a,i==="near"?l="left":i==="center"?(l="center",c+=L/2):(l="right",c=this.right)):l="right",{textAlign:l,x:c}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:r}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,r),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let n=this.ticks.findIndex(o=>o.value===t);return n>=0?e.setContext(this.getContext(n)).lineWidth:0}drawGrid(t){let e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),o,r,a=(L,l,c)=>{!c.width||!c.color||(i.save(),i.lineWidth=c.width,i.strokeStyle=c.color,i.setLineDash(c.borderDash||[]),i.lineDashOffset=c.borderDashOffset,i.beginPath(),i.moveTo(L.x,L.y),i.lineTo(l.x,l.y),i.stroke(),i.restore())};if(e.display)for(o=0,r=n.length;o{this.draw(o)}}]:[{z:i,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[],o,r;for(o=0,r=e.length;o{let o=i||this._getRegistryForType(n);i||o.isForType(n)||o===this.plugins&&n.id?this._exec(t,o,n):at(n,r=>{let a=i||this._getRegistryForType(r);this._exec(t,a,r)})})}_exec(t,e,i){let n=Oi(t);ct(i["before"+n],[],i),e[t](i),ct(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;eo.filter(a=>!r.some(L=>a.plugin.id===L.plugin.id));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}};Va=new Map,wL=new Set;ti=(s,t,e)=>{let i=de(t,e);i!==void 0&&s.add(i)},Ao=class{constructor(t){this._config=V1(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=kL(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){let t=this._config;this.clearCache(),ML(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Yi(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Yi(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Yi(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return Yi(`${i}-plugin-${e}`,()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){let i=this._scopeCache,n=i.get(t);return(!n||e)&&(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){let{options:n,type:o}=this,r=this._cachedScopes(t,i),a=r.get(e);if(a)return a;let L=new Set;e.forEach(c=>{t&&(L.add(t),c.forEach(d=>ti(L,t,d))),c.forEach(d=>ti(L,n,d)),c.forEach(d=>ti(L,Se[o]||{},d)),c.forEach(d=>ti(L,ut,d)),c.forEach(d=>ti(L,Bi,d))});let l=Array.from(L);return l.length===0&&l.push(Object.create(null)),wL.has(e)&&r.set(e,l),l}chartOptionScopes(){let{options:t,type:e}=this;return[t,Se[e]||{},ut.datasets[e]||{},{type:e},ut,Bi]}resolveNamedOptions(t,e,i,n=[""]){let o={$shared:!0},{resolver:r,subPrefixes:a}=Ba(this._resolverCache,t,n),L=r;if(N1(r,e)){o.$shared=!1,i=le(i)?i():i;let l=this.createResolver(t,i,a);L=Ne(r,i,l)}for(let l of e)o[l]=L[l];return o}createResolver(t,e,i=[""],n){let{resolver:o}=Ba(this._resolverCache,t,i);return st(e)?Ne(o,e,void 0,n):o}};B1=s=>st(s)&&Object.getOwnPropertyNames(s).some(t=>le(s[t]));$1="4.5.1",z1=["top","bottom","left","right","chartArea"];Qi={},Ha=s=>{let t=EL(s);return Object.values(Qi).filter(e=>e.canvas===t).pop()};ne=class{static register(...t){Ut.add(...t),Za()}static unregister(...t){Ut.remove(...t),Za()}constructor(t,e){let i=this.config=new Ao(e),n=EL(t),o=Ha(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");let r=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||SL(n)),this.platform.updateConfig(i);let a=this.platform.acquireContext(n,r.aspectRatio),L=a&&a.canvas,l=L&&L.height,c=L&&L.width;if(this.id=$r(),this.ctx=a,this.canvas=L,this.width=c,this.height=l,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Eo,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Xr(d=>this.update(d),r.resizeDelay||0),this._dataChanges=[],Qi[this.id]=this,!a||!L){console.error("Failed to create chart: can't acquire context from the given item");return}ie.listen(this,"complete",za),ie.listen(this,"progress",H1),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return tt(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return Ut}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ro(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Jn(this.canvas,this.ctx),this}stop(){return ie.stop(this),this}resize(t,e){ie.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){let i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,r=this.platform.getMaximumSize(n,t,e,o),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),L=this.width?"resize":"attach";this.width=r.width,this.height=r.height,this._aspectRatio=this.aspectRatio,ro(this,a,!0)&&(this.notifyPlugins("resize",{size:r}),ct(i.onResize,[this,r],this),this.attached&&this._doResize(L)&&this.render())}ensureScalesHaveIDs(){let e=this.options.scales||{};at(e,(i,n)=>{i.id=n})}buildOrUpdateScales(){let t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce((r,a)=>(r[a]=!1,r),{}),o=[];e&&(o=o.concat(Object.keys(e).map(r=>{let a=e[r],L=To(r,a),l=L==="r",c=L==="x";return{options:a,dposition:l?"chartArea":c?"bottom":"left",dtype:l?"radialLinear":c?"category":"linear"}}))),at(o,r=>{let a=r.options,L=a.id,l=To(L,a),c=J(a.type,r.dtype);(a.position===void 0||Na(a.position,l)!==Na(r.dposition))&&(a.position=r.dposition),n[L]=!0;let d=null;if(L in i&&i[L].type===c)d=i[L];else{let h=Ut.getScale(c);d=new h({id:L,type:c,ctx:this.ctx,chart:this}),i[d.id]=d}d.init(a,t)}),at(n,(r,a)=>{r||delete i[a]}),at(i,r=>{_t.configure(this,r,r.options),_t.addBox(this,r)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((n,o)=>n.index-o.index),i>e){for(let n=e;ne.length&&delete this._stacks,t.forEach((i,n)=>{e.filter(o=>o===i._dataset).length===0&&this._destroyDatasetMeta(n)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let l=0,c=this.data.datasets.length;l{l.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort($a("z","_idx"));let{_active:a,_lastEvent:L}=this;L?this._eventHandler(L,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){at(this.scales,t=>{_t.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!$n(e,i)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(let{method:i,start:n,count:o}of e){let r=i==="_removeElements"?-o:o;Z1(t,n,r)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=o=>new Set(t.filter(r=>r[0]===o).map((r,a)=>a+","+r.splice(1).join(","))),n=i(0);for(let o=1;oo.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;_t.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],at(this.boxes,n=>{i&&n.position==="chartArea"||(n.configure&&n.configure(),this._layers.push(...n._layers()))},this),this._layers.forEach((n,o)=>{n._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i={meta:t,index:t.index,cancelable:!0},n=uo(this,t);this.notifyPlugins("beforeDatasetDraw",i)!==!1&&(n&&Gs(e,n),t.controller.draw(),n&&Ks(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Jt(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){let o=vL.modes[e];return typeof o=="function"?o(this,t,i,n):[]}getDatasetMeta(t){let e=this.data.datasets[t],i=this._metasets,n=i.filter(o=>o&&o._dataset===e).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=he(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let e=this.data.datasets[t];if(!e)return!1;let i=this.getDatasetMeta(t);return typeof i.hidden=="boolean"?!i.hidden:!e.hidden}setDatasetVisibility(t,e){let i=this.getDatasetMeta(t);i.hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){let n=i?"show":"hide",o=this.getDatasetMeta(t),r=o.controller._resolveAnimations(void 0,n);fs(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),r.update(o,{visible:i}),this.update(a=>a.datasetIndex===t?n:void 0))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){let e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),ie.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,o,r),t[o]=r},n=(o,r,a)=>{o.offsetX=r,o.offsetY=a,this._eventHandler(o)};at(this.options.events,o=>i(o,n))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(L,l)=>{e.addEventListener(this,L,l),t[L]=l},n=(L,l)=>{t[L]&&(e.removeEventListener(this,L,l),delete t[L])},o=(L,l)=>{this.canvas&&this.resize(L,l)},r,a=()=>{n("attach",a),this.attached=!0,this.resize(),i("resize",o),i("detach",r)};r=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():r()}unbindEvents(){at(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},at(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let n=i?"set":"remove",o,r,a,L;for(e==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,L=t.length;a{let a=this.getDatasetMeta(o);if(!a)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:a.data[r],index:r}});!Ys(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return this._plugins._cache.filter(e=>e.plugin.id===t).length===1}_updateHoverStyles(t,e,i){let n=this.options.hover,o=(L,l)=>L.filter(c=>!l.some(d=>c.datasetIndex===d.datasetIndex&&c.index===d.index)),r=o(e,t),a=i?t:o(t,e);r.length&&this.updateHoverStyle(r,n.mode,!1),a.length&&n.mode&&this.updateHoverStyle(a,n.mode,!0)}_eventHandler(t,e){let i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=r=>(r.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",i,n)===!1)return;let o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){let{_active:n=[],options:o}=this,r=e,a=this._getActiveElements(t,n,i,r),L=Zr(t),l=W1(t,this._lastEvent,i,L);i&&(this._lastEvent=null,ct(o.onHover,[t,a,this],this),L&&ct(o.onClick,[t,a,this],this));let c=!Ys(a,n);return(c||e)&&(this._active=a,this._updateHoverStyles(a,n,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,n){if(t.type==="mouseout")return[];if(!i)return e;let o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}};U(ne,"defaults",ut),U(ne,"instances",Qi),U(ne,"overrides",Se),U(ne,"registry",Ut),U(ne,"version",$1),U(ne,"getChart",Ha);De=class extends Ft{constructor(e){super();U(this,"circumference");U(this,"endAngle");U(this,"fullCircles");U(this,"innerRadius");U(this,"outerRadius");U(this,"pixelMargin");U(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,i,n){let o=this.getProps(["x","y"],n),{angle:r,distance:a}=Wn(o,{x:e,y:i}),{startAngle:L,endAngle:l,innerRadius:c,outerRadius:d,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),u=(this.options.spacing+this.options.borderWidth)/2,f=J(h,l-L),p=gs(r,L,l)&&L!==l,m=f>=ht||p,g=ee(a,c+u,d+u);return m&&g}getCenterPoint(e){let{x:i,y:n,startAngle:o,endAngle:r,innerRadius:a,outerRadius:L}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:l,spacing:c}=this.options,d=(o+r)/2,h=(a+L+c+l)/2;return{x:i+Math.cos(d)*h,y:n+Math.sin(d)*h}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:i,circumference:n}=this,o=(i.offset||0)/4,r=(i.spacing||0)/2,a=i.circular;if(this.pixelMargin=i.borderAlign==="inner"?.33:0,this.fullCircles=n>ht?Math.floor(n/ht):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let L=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(L)*o,Math.sin(L)*o);let l=1-Math.sin(Math.min(nt,n||0)),c=o*l;e.fillStyle=i.backgroundColor,e.strokeStyle=i.borderColor,K1(e,this,c,r,a),q1(e,this,c,r,a),e.restore()}};U(De,"id","arc"),U(De,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1}),U(De,"defaultRoutes",{backgroundColor:"backgroundColor"}),U(De,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"});n5=typeof Path2D=="function";Yt=class extends Ft{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){let i=this.options;if((i.tension||i.cubicInterpolationMode==="monotone")&&!i.stepped&&!this._pointsUpdated){let n=i.spanGaps?this._loop:this._fullLoop;La(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=fa(this,this.options.segment))}first(){let t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){let t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){let i=this.options,n=t[e],o=this.points,r=ho(this,{property:e,start:n,end:n});if(!r.length)return;let a=[],L=e5(i),l,c;for(l=0,c=r.length;lt!=="borderDash"&&t!=="fill"});Ke=class extends Ft{constructor(e){super();U(this,"parsed");U(this,"skip");U(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,e&&Object.assign(this,e)}inRange(e,i,n){let o=this.options,{x:r,y:a}=this.getProps(["x","y"],n);return Math.pow(e-r,2)+Math.pow(i-a,2)s.replace("rgb(","rgba(").replace(")",", 0.5)"));FL={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(s,t,e){if(!e.enabled)return;let{data:{datasets:i},options:n}=s.config,{elements:o}=n,r=Ua(i)||p5(n)||o&&Ua(o)||g5();if(!e.forceOverride&&r)return;let a=f5(s);i.forEach(a)}};VL={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(s,t,e)=>{if(!e.enabled){Ya(s);return}let i=s.width;s.data.datasets.forEach((n,o)=>{let{_data:r,indexAxis:a}=n,L=s.getDatasetMeta(o),l=r||n.data;if(ys([a,s.options.indexAxis])==="y"||!L.controller.supportsDecimation)return;let c=s.scales[L.xAxisID];if(c.type!=="linear"&&c.type!=="time"||s.options.parsing)return;let{start:d,count:h}=v5(L,l),u=e.threshold||4*i;if(h<=u){IL(n);return}tt(r)&&(n._data=l,delete n.data,Object.defineProperty(n,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(p){this._data=p}}));let f;switch(e.algorithm){case"lttb":f=m5(l,d,h,i,e);break;case"min-max":f=b5(l,d,h,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}n._decimated=f})},destroy(s){Ya(s)}};on=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){let{x:n,y:o,radius:r}=this;return e=e||{start:0,end:ht},t.arc(n,o,r,e.end,e.start,!0),!i.bounds}interpolate(t){let{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}};NL={id:"filler",afterDatasetsUpdate(s,t,e){let i=(s.data.datasets||[]).length,n=[],o,r,a,L;for(r=0;r=0;--r){let a=n[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),i&&a.fill&&_o(s.ctx,a,o))}},beforeDatasetsDraw(s,t,e){if(e.drawTime!=="beforeDatasetsDraw")return;let i=s.getSortedVisibleDatasetMetas();for(let n=i.length-1;n>=0;--n){let o=i[n].$filler;Ka(o)&&_o(s.ctx,o,s.chartArea)}},beforeDatasetDraw(s,t,e){let i=t.meta.$filler;!Ka(i)||e.drawTime!=="beforeDatasetDraw"||_o(s.ctx,i,s.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},Ja=(s,t)=>{let{boxHeight:e=t,boxWidth:i=t}=s;return s.usePointStyle&&(e=Math.min(e,t),i=s.pointStyleWidth||Math.min(i,t)),{boxWidth:i,boxHeight:e,itemHeight:Math.max(t,e)}},N5=(s,t)=>s!==null&&t!==null&&s.datasetIndex===t.datasetIndex&&s.index===t.index,rn=class extends Ft{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let t=this.options.labels||{},e=ct(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter(i=>t.filter(i,this.chart.data))),t.sort&&(e=e.sort((i,n)=>t.sort(i,n,this.chart.data))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){let{options:t,ctx:e}=this;if(!t.display){this.width=this.height=0;return}let i=t.labels,n=gt(i.font),o=n.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:L}=Ja(i,o),l,c;e.font=n.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(r,o,a,L)+10):(c=this.maxHeight,l=this._fitCols(r,n,a,L)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){let{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,L=this.legendHitBoxes=[],l=this.lineWidths=[0],c=n+a,d=t;o.textAlign="left",o.textBaseline="middle";let h=-1,u=-c;return this.legendItems.forEach((f,p)=>{let m=i+e/2+o.measureText(f.text).width;(p===0||l[l.length-1]+m+2*a>r)&&(d+=c,l[l.length-(p>0?0:1)]=0,u+=c,h++),L[p]={left:0,top:u,row:h,width:m,height:n},l[l.length-1]+=m+a}),d}_fitCols(t,e,i,n){let{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,L=this.legendHitBoxes=[],l=this.columnSizes=[],c=r-t,d=a,h=0,u=0,f=0,p=0;return this.legendItems.forEach((m,g)=>{let{itemWidth:b,itemHeight:_}=$5(i,e,o,m,n);g>0&&u+_+2*a>c&&(d+=h+a,l.push({width:h,height:u}),f+=h+a,p++,h=u=0),L[g]={left:f,top:u,col:p,width:b,height:_},h=Math.max(h,b),u+=_+a}),d+=h,l.push({width:h,height:u}),d}adjustHitBoxes(){if(!this.options.display)return;let t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,r=ze(o,this.left,this.width);if(this.isHorizontal()){let a=0,L=xt(i,this.left+n,this.right-this.lineWidths[a]);for(let l of e)a!==l.row&&(a=l.row,L=xt(i,this.left+n,this.right-this.lineWidths[a])),l.top+=this.top+t+n,l.left=r.leftForLtr(r.x(L),l.width),L+=l.width+n}else{let a=0,L=xt(i,this.top+t+n,this.bottom-this.columnSizes[a].height);for(let l of e)l.col!==a&&(a=l.col,L=xt(i,this.top+t+n,this.bottom-this.columnSizes[a].height)),l.top=L,l.left+=this.left+n,l.left=r.leftForLtr(r.x(l.left),l.width),L+=l.height+n}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let t=this.ctx;Gs(t,this),this._draw(),Ks(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:r}=t,a=ut.color,L=ze(t.rtl,this.left,this.width),l=gt(r.font),{padding:c}=r,d=l.size,h=d/2,u;this.drawTitle(),n.textAlign=L.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=l.string;let{boxWidth:f,boxHeight:p,itemHeight:m}=Ja(r,d),g=function(v,y,x){if(isNaN(f)||f<=0||isNaN(p)||p<0)return;n.save();let w=J(x.lineWidth,1);if(n.fillStyle=J(x.fillStyle,a),n.lineCap=J(x.lineCap,"butt"),n.lineDashOffset=J(x.lineDashOffset,0),n.lineJoin=J(x.lineJoin,"miter"),n.lineWidth=w,n.strokeStyle=J(x.strokeStyle,a),n.setLineDash(J(x.lineDash,[])),r.usePointStyle){let k={radius:p*Math.SQRT2/2,pointStyle:x.pointStyle,rotation:x.rotation,borderWidth:w},M=L.xPlus(v,f/2),T=y+h;to(n,k,M,T,r.pointStyleWidth&&f)}else{let k=y+Math.max((d-p)/2,0),M=L.leftForLtr(v,f),T=we(x.borderRadius);n.beginPath(),Object.values(T).some(A=>A!==0)?vs(n,{x:M,y:k,w:f,h:p,radius:T}):n.rect(M,k,f,p),n.fill(),w!==0&&n.stroke()}n.restore()},b=function(v,y,x){ke(n,x.text,v,y+m/2,l,{strikethrough:x.hidden,textAlign:L.textAlign(x.textAlign)})},_=this.isHorizontal(),S=this._computeTitleHeight();_?u={x:xt(o,this.left+c,this.right-i[0]),y:this.top+c+S,line:0}:u={x:this.left+c,y:xt(o,this.top+S+c,this.bottom-e[0].height),line:0},Lo(this.ctx,t.textDirection);let C=m+c;this.legendItems.forEach((v,y)=>{n.strokeStyle=v.fontColor,n.fillStyle=v.fontColor;let x=n.measureText(v.text).width,w=L.textAlign(v.textAlign||(v.textAlign=r.textAlign)),k=f+h+x,M=u.x,T=u.y;L.setWidth(this.width),_?y>0&&M+k+c>this.right&&(T=u.y+=C,u.line++,M=u.x=xt(o,this.left+c,this.right-i[u.line])):y>0&&T+C>this.bottom&&(M=u.x=M+e[u.line].width+c,u.line++,T=u.y=xt(o,this.top+S+c,this.bottom-e[u.line].height));let A=L.x(M);if(g(A,T,v),M=Qr(w,M+f+h,_?M+k:this.right,t.rtl),b(L.x(M),T,v),_)u.x+=k+c;else if(typeof v.text!="string"){let B=l.lineHeight;u.y+=$L(v,B)+c}else u.y+=C}),lo(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,i=gt(e.font),n=Ct(e.padding);if(!e.display)return;let o=ze(t.rtl,this.left,this.width),r=this.ctx,a=e.position,L=i.size/2,l=n.top+L,c,d=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),c=this.top+l,d=xt(t.align,d,this.right-h);else{let f=this.columnSizes.reduce((p,m)=>Math.max(p,m.height),0);c=l+xt(t.align,this.top,this.bottom-f-t.labels.padding-this._computeTitleHeight())}let u=xt(a,d,d+h);r.textAlign=o.textAlign(Vi(a)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=i.string,ke(r,e.text,u,c,i)}_computeTitleHeight(){let t=this.options.title,e=gt(t.font),i=Ct(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(ee(t,this.left,this.right)&&ee(e,this.top,this.bottom)){for(o=this.legendHitBoxes,i=0;is.chart.options.color,boxWidth:40,padding:10,generateLabels(s){let t=s.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:n,color:o,useBorderRadius:r,borderRadius:a}}=s.legend.options;return s._getSortedDatasetMetas().map(L=>{let l=L.controller.getStyle(e?0:void 0),c=Ct(l.borderWidth);return{text:t[L.index].label,fillStyle:l.backgroundColor,fontColor:o,hidden:!L.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:i||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:r&&(a||l.borderRadius),datasetIndex:L.index}},this)}},title:{color:s=>s.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:s=>!s.startsWith("on"),labels:{_scriptable:s=>!["generateLabels","filter","sort"].includes(s)}}},ai=class extends Ft{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){let i=this.options;if(this.left=0,this.top=0,!i.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=t,this.height=this.bottom=e;let n=dt(i.text)?i.text.length:1;this._padding=Ct(i.padding);let o=n*gt(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let t=this.options.position;return t==="top"||t==="bottom"}_drawArgs(t){let{top:e,left:i,bottom:n,right:o,options:r}=this,a=r.align,L=0,l,c,d;return this.isHorizontal()?(c=xt(a,i,o),d=e+t,l=o-i):(r.position==="left"?(c=i+t,d=xt(a,n,e),L=nt*-.5):(c=o-t,d=xt(a,e,n),L=nt*.5),l=n-e),{titleX:c,titleY:d,maxWidth:l,rotation:L}}draw(){let t=this.ctx,e=this.options;if(!e.display)return;let i=gt(e.font),o=i.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:L,rotation:l}=this._drawArgs(o);ke(t,e.text,0,0,i,{color:e.color,maxWidth:L,rotation:l,textAlign:Vi(e.align),textBaseline:"middle",translation:[r,a]})}};HL={id:"title",_element:ai,start(s,t,e){W5(s,e)},stop(s){let t=s.titleBlock;_t.removeBox(s,t),delete s.titleBlock},beforeUpdate(s,t,e){let i=s.titleBlock;_t.configure(s,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Gi=new WeakMap,ZL={id:"subtitle",start(s,t,e){let i=new ai({ctx:s.ctx,options:e,chart:s});_t.configure(s,i,e),_t.addBox(s,i),Gi.set(s,i)},stop(s){_t.removeBox(s,Gi.get(s)),Gi.delete(s)},beforeUpdate(s,t,e){let i=Gi.get(s);_t.configure(s,i,e),i.options=e},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},si={average(s){if(!s.length)return!1;let t,e,i=new Set,n=0,o=0;for(t=0,e=s.length;ta+L)/i.size,y:n/o}},nearest(s,t){if(!s.length)return!1;let e=t.x,i=t.y,n=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=s.length;o0){let t=s[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex{let r={before:[],lines:[],after:[]},a=nL(i,o);se(r.before,ue(Rt(a,"beforeLabel",this,o))),se(r.lines,Rt(a,"label",this,o)),se(r.after,ue(Rt(a,"afterLabel",this,o))),n.push(r)}),n}getAfterBody(t,e){return iL(Rt(e.callbacks,"afterBody",this,t))}getFooter(t,e){let{callbacks:i}=e,n=Rt(i,"beforeFooter",this,t),o=Rt(i,"footer",this,t),r=Rt(i,"afterFooter",this,t),a=[];return a=se(a,ue(n)),a=se(a,ue(o)),a=se(a,ue(r)),a}_createItems(t){let e=this._active,i=this.chart.data,n=[],o=[],r=[],a=[],L,l;for(L=0,l=e.length;Lt.filter(c,d,h,i))),t.itemSort&&(a=a.sort((c,d)=>t.itemSort(c,d,i))),at(a,c=>{let d=nL(t.callbacks,c);n.push(Rt(d,"labelColor",this,c)),o.push(Rt(d,"labelPointStyle",this,c)),r.push(Rt(d,"labelTextColor",this,c))}),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=r,this.dataPoints=a,a}update(t,e){let i=this.options.setContext(this.getContext()),n=this._active,o,r=[];if(!n.length)this.opacity!==0&&(o={opacity:0});else{let a=si[i.position].call(this,n,this._eventPosition);r=this._createItems(i),this.title=this.getTitle(r,i),this.beforeBody=this.getBeforeBody(r,i),this.body=this.getBody(r,i),this.afterBody=this.getAfterBody(r,i),this.footer=this.getFooter(r,i);let L=this._size=tL(this,i),l=Object.assign({},a,L),c=eL(this.chart,i,l),d=sL(i,l,c,this.chart);this.xAlign=c.xAlign,this.yAlign=c.yAlign,o={opacity:1,x:d.x,y:d.y,width:L.width,height:L.height,caretX:a.x,caretY:a.y}}this._tooltipItems=r,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){let o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){let{xAlign:n,yAlign:o}=this,{caretSize:r,cornerRadius:a}=i,{topLeft:L,topRight:l,bottomLeft:c,bottomRight:d}=we(a),{x:h,y:u}=t,{width:f,height:p}=e,m,g,b,_,S,C;return o==="center"?(S=u+p/2,n==="left"?(m=h,g=m-r,_=S+r,C=S-r):(m=h+f,g=m+r,_=S-r,C=S+r),b=m):(n==="left"?g=h+Math.max(L,c)+r:n==="right"?g=h+f-Math.max(l,d)-r:g=this.caretX,o==="top"?(_=u,S=_-r,m=g-r,b=g+r):(_=u+p,S=_+r,m=g+r,b=g-r),C=_),{x1:m,x2:g,x3:b,y1:_,y2:S,y3:C}}drawTitle(t,e,i){let n=this.title,o=n.length,r,a,L;if(o){let l=ze(i.rtl,this.x,this.width);for(t.x=Ki(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",r=gt(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=r.string,L=0;Lb!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,vs(t,{x:p,y:f,w:l,h:L,radius:g}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),vs(t,{x:m,y:f+1,w:l-2,h:L-2,radius:g}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(p,f,l,L),t.strokeRect(p,f,l,L),t.fillStyle=r.backgroundColor,t.fillRect(m,f+1,l-2,L-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){let{body:n}=this,{bodySpacing:o,bodyAlign:r,displayColors:a,boxHeight:L,boxWidth:l,boxPadding:c}=i,d=gt(i.bodyFont),h=d.lineHeight,u=0,f=ze(i.rtl,this.x,this.width),p=function(x){e.fillText(x,f.x(t.x+u),t.y+h/2),t.y+=h+o},m=f.textAlign(r),g,b,_,S,C,v,y;for(e.textAlign=r,e.textBaseline="middle",e.font=d.string,t.x=Ki(this,m,i),e.fillStyle=i.bodyColor,at(this.beforeBody,p),u=a&&m!=="right"?r==="center"?l/2+c:l+2+c:0,S=0,v=n.length;S0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){let r=si[t.position].call(this,this._active,this._eventPosition);if(!r)return;let a=this._size=tL(this,t),L=Object.assign({},r,this._size),l=eL(e,t,L),c=sL(t,L,l,e);(n._to!==c.x||o._to!==c.y)&&(this.xAlign=l.xAlign,this.yAlign=l.yAlign,this.width=a.width,this.height=a.height,this.caretX=r.x,this.caretY=r.y,this._resolveAnimations().update(this,c))}}_willRender(){return!!this.opacity}draw(t){let e=this.options.setContext(this.getContext()),i=this.opacity;if(!i)return;this._updateAnimationTarget(e);let n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;let r=Ct(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),Lo(t,e.textDirection),o.y+=r.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),lo(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){let i=this._active,n=t.map(({datasetIndex:a,index:L})=>{let l=this.chart.getDatasetMeta(a);if(!l)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:l.data[L],index:L}}),o=!Ys(i,n),r=this._positionChanged(n,e);(o||r)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let n=this.options,o=this._active||[],r=this._getActiveElements(t,o,e,i),a=this._positionChanged(r,t),L=e||!Ys(r,o)||a;return L&&(this._active=r,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),L}_getActiveElements(t,e,i,n){let o=this.options;if(t.type==="mouseout")return[];if(!n)return e.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);let r=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&r.reverse(),r}_positionChanged(t,e){let{caretX:i,caretY:n,options:o}=this,r=si[o.position].call(this,t,e);return r!==!1&&(i!==r.x||n!==r.y)}};U(ii,"positioners",si);jL={id:"tooltip",_element:ii,positioners:si,afterInit(s,t,e){e&&(s.tooltip=new ii({chart:s,options:e}))},beforeUpdate(s,t,e){s.tooltip&&s.tooltip.initialize(e)},reset(s,t,e){s.tooltip&&s.tooltip.initialize(e)},afterDraw(s){let t=s.tooltip;if(t&&t._willRender()){let e={tooltip:t};if(s.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0})===!1)return;t.draw(s.ctx),s.notifyPlugins("afterTooltipDraw",e)}},afterEvent(s,t){if(s.tooltip){let e=t.replay;s.tooltip.handleEvent(t.event,e,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(s,t)=>t.bodyFont.size,boxWidth:(s,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:WL},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:s=>s!=="filter"&&s!=="itemSort"&&s!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},UL=Object.freeze({__proto__:null,Colors:FL,Decimation:VL,Filler:NL,Legend:zL,SubTitle:ZL,Title:HL,Tooltip:jL}),Q5=(s,t,e,i)=>(typeof t=="string"?(e=s.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);td=(s,t)=>s===null?null:mt(Math.round(s),0,t);Ss=class extends Oe{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let e=this._addedLabels;if(e.length){let i=this.getLabels();for(let{index:n,label:o}of e)i[n]===o&&i.splice(n,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(tt(t))return null;let i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:J5(i,t,J(e,t),this._addedLabels),td(e,i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:n}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){let t=this.min,e=this.max,i=this.options.offset,n=[],o=this.getLabels();o=t===0&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let r=t;r<=e;r++)n.push({value:r});return n}getLabelForValue(t){return oL.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};U(Ss,"id","category"),U(Ss,"defaults",{ticks:{callback:oL}});Es=class extends Oe{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return tt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:n,max:o}=this,r=L=>n=e?n:L,a=L=>o=i?o:L;if(t){let L=jt(n),l=jt(o);L<0&&l<0?a(0):L>0&&l>0&&r(0)}if(n===o){let L=o===0?1:Math.abs(o*.05);a(o+L),t||r(n-L)}this.min=n,this.max=o}getTickLimit(){let t=this.options.ticks,{maxTicksLimit:e,stepSize:i}=t,n;return i?(n=Math.ceil(this.max/i)-Math.floor(this.min/i)+1,n>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${i} would result generating up to ${n} ticks. Limiting to 1000.`),n=1e3)):(n=this.computeTickLimit(),e=e||11),e&&(n=Math.min(e,n)),n}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let t=this.options,e=t.ticks,i=this.getTickLimit();i=Math.max(2,i);let n={maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:e.includeBounds!==!1},o=this._range||this,r=ed(n,o);return t.bounds==="ticks"&&Hn(r,this,"value"),t.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let t=this.ticks,e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){let n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ms(t,this.chart.options.locale,this.options.ticks.format)}},Ms=class extends Es{determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=ft(t)?t:0,this.max=ft(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=Zt(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}};U(Ms,"id","linear"),U(Ms,"defaults",{ticks:{callback:bs.formatters.numeric}});Li=s=>Math.floor(ce(s)),Ze=(s,t)=>Math.pow(10,Li(s)+t);ks=class extends Oe{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=Es.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return ft(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=ft(t)?Math.max(0,t):null,this.max=ft(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ft(this._userMin)&&(this.min=t===Ze(this.min,0)?Ze(this.min,-1):Ze(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),i=this.min,n=this.max,o=a=>i=t?i:a,r=a=>n=e?n:a;i===n&&(i<=0?(o(1),r(10)):(o(Ze(i,-1)),r(Ze(n,1)))),i<=0&&o(Ze(n,-1)),n<=0&&r(Ze(i,1)),this.min=i,this.max=n}buildTicks(){let t=this.options,e={min:this._userMin,max:this._userMax},i=id(e,this);return t.bounds==="ticks"&&Hn(i,this,"value"),t.reverse?(i.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),i}getLabelForValue(t){return t===void 0?"0":ms(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=ce(t),this._valueRange=ce(this.max)-ce(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(ce(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};U(ks,"id","logarithmic"),U(ks,"defaults",{ticks:{callback:bs.formatters.logarithmic,major:{enabled:!0}}});Te=class extends Es{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=Ct(Fo(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=ft(t)&&!isNaN(t)?t:0,this.max=ft(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Fo(this.options))}generateTickLabels(t){Es.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{let n=ct(this.options.pointLabels.callback,[e,i],this);return n||n===0?n:""}).filter((e,i)=>this.chart.getDataVisibility(i))}fit(){let t=this.options;t.display&&t.pointLabels.display?od(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){let e=ht/(this._pointLabels.length||1),i=this.options.startAngle||0;return yt(t*e+Zt(i))}getDistanceFromCenterForValue(t){if(tt(t))return NaN;let e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(tt(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t{if(d!==0||d===0&&this.min<0){L=this.getDistanceFromCenterForValue(c.value);let h=this.getContext(d),u=n.setContext(h),f=o.setContext(h);pd(this,u,L,r,f)}}),i.display){for(t.save(),a=r-1;a>=0;a--){let c=i.setContext(this.getPointLabelContext(a)),{color:d,lineWidth:h}=c;!h||!d||(t.lineWidth=h,t.strokeStyle=d,t.setLineDash(c.borderDash),t.lineDashOffset=c.borderDashOffset,L=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(a,L),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){let t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;let n=this.getIndexAngle(0),o,r;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach((a,L)=>{if(L===0&&this.min>=0&&!e.reverse)return;let l=i.setContext(this.getContext(L)),c=gt(l.font);if(o=this.getDistanceFromCenterForValue(this.ticks[L].value),l.showLabelBackdrop){t.font=c.string,r=t.measureText(a.label).width,t.fillStyle=l.backdropColor;let d=Ct(l.backdropPadding);t.fillRect(-r/2-d.left,-o-c.size/2-d.top,r+d.width,c.size+d.height)}ke(t,a.label,0,-o,c,{color:l.color,strokeColor:l.textStrokeColor,strokeWidth:l.textStrokeWidth})}),t.restore()}drawTitle(){}};U(Te,"id","radialLinear"),U(Te,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:bs.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(t){return t},padding:5,centerPointLabels:!1}}),U(Te,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),U(Te,"descriptors",{angleLines:{_fallback:"grid"}});Ln={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Ot=Object.keys(Ln);Pe=class extends Oe{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){let i=t.time||(t.time={}),n=this._adapter=new bL._date(t.adapters.date);n.init(e),us(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:dL(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=t.time.unit||"day",{min:n,max:o,minDefined:r,maxDefined:a}=this.getUserBounds();function L(l){!r&&!isNaN(l.min)&&(n=Math.min(n,l.min)),!a&&!isNaN(l.max)&&(o=Math.max(o,l.max))}(!r||!a)&&(L(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&L(this.getMinMax(!1))),n=ft(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=ft(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,n=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);let o=this.min,r=this.max,a=Gr(n,o,r);return this._unit=e.unit||(i.autoSkip?hL(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):md(this,a.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:bd(this._unit),this.initOffsets(n),t.reverse&&a.reverse(),fL(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let e=0,i=0,n,o;this.options.offset&&t.length&&(n=this.getDecimalForValue(t[0]),t.length===1?e=1-n:e=(this.getDecimalForValue(t[1])-n)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?i=o:i=(o-this.getDecimalForValue(t[t.length-2]))/2);let r=t.length<3?.5:.25;e=mt(e,0,r),i=mt(i,0,r),this._offsets={start:e,end:i,factor:1/(e+1+i)}}_generate(){let t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,r=o.unit||hL(o.minUnit,e,i,this._getLabelCapacity(e)),a=J(n.ticks.stepSize,1),L=r==="week"?o.isoWeekday:!1,l=$e(L)||L===!0,c={},d=e,h,u;if(l&&(d=+t.startOf(d,"isoWeek",L)),d=+t.startOf(d,l?"day":r),t.diff(i,e,r)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+r);let f=n.ticks.source==="data"&&this.getDataTimestamps();for(h=d,u=0;h+p)}getLabelForValue(t){let e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){let n=this.options.time.displayFormats,o=this._unit,r=e||n[o];return this._adapter.format(t,r)}_tickFormatFunction(t,e,i,n){let o=this.options,r=o.ticks.callback;if(r)return ct(r,[t,e,i],this);let a=o.time.displayFormats,L=this._unit,l=this._majorUnit,c=L&&a[L],d=l&&a[l],h=i[e],u=l&&d&&h&&h.major;return this._adapter.format(t,n||(u?d:c))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;let n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(e=0,i=n.length;e=e&&l<=i&&n.push(l);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(r=0,a=n.length;rn-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(qi(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return qi(this._table,i*this._tableRange+this._minPos,!0)}};U(ws,"id","timeseries"),U(ws,"defaults",Pe.defaults);GL=Object.freeze({__proto__:null,CategoryScale:Ss,LinearScale:Ms,LogarithmicScale:ks,RadialLinearScale:Te,TimeScale:Pe,TimeSeriesScale:ws}),yd=[mL,RL,UL,GL]});var Gd={};Ko(Gd,{CardView:()=>As,default:()=>vn});module.exports=Dl(Gd);var rt=require("obsidian"),xl=Os(ts());var Tl=["AT","BE","CZ","DK","EE","FI","FR","DE","GR","HU","IS","IT","LV","LI","LT","LU","MT","NL","NO","PL","PT","SK","SI","ES","SE","CH"],Al=[{label:"\u{1F1EA}\u{1F1FA} Schengen 90/180 (example)",scope:{countries:Tl},window:{type:"rolling",days:180},threshold:90,note:"Example rule \u2014 add your own in Settings \u2192 CSV Card View."}],Sn={defaultMode:"kanban-genre",notesColumns:["notes","note","Notes","Note","description","Description","review","Review"],statusColumn:"status",categoryColumn:"category",notesSubfolder:"Notes",columnWidths:{},selectColumns:["Category","Type","Rating","Status","rating","type","category","status","Score /5"],fileConfigs:{},residencyRules:Al,showResidency:!0},di="xlsx-card-view";var Xo=Os(ts()),hi=require("obsidian"),es=["Image","image","Cover","cover","Poster","poster","Thumbnail","thumbnail","Thumb","thumb","Photo","photo","Picture","picture","Img","img"],fe=["Title","title","Name","name"],ss=["Category","category","Categories","categories","Genre","genre","Genres","genres","Type","type","Types","types","Tag","tag","Tags","tags","Topic","topic","Topics","topics","Subject","subject","Section","section"],is=["Status","status","State","state","Progress","progress","Stage","stage","Read","read","Watched","watched","Seen","seen","Done","done","Completed","completed"],pe=["Notes","notes","Note","note","Summary","summary","Review","review","Quote","quote","Quotes","quotes","Comment","comment","Comments","comments","Description","description","Annotation","annotation"];function ui(s,t,e){let i=(t!=null?t:"").trim();if(!i)return null;if(/^(https?:|data:)/i.test(i))return i;let n=i.match(/!?\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/);if(n)i=n[1].trim();else{let r=i.match(/!\[[^\]]*\]\(([^)]+)\)/);r&&(i=r[1].trim())}if(/^(https?:|data:)/i.test(i))return i;let o=s.metadataCache.getFirstLinkpathDest(i,e);return o instanceof hi.TFile?s.vault.getResourcePath(o):null}var Rl=15;function qt(s){return s>=1&&s<=Rl}var Pl=["0","1","true","false","yes","no",""];function ns(s){return s.length>0&&s.every(t=>Pl.includes(t))}function os(s){let t=(s!=null?s:"").toLowerCase().trim();return t==="1"||t==="true"||t==="yes"}function ge(s=new Date){return`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`}function Ie(s){return s.replace(/[\\/:*?"<>|#^[\]]/g,"").replace(/\s+/g," ").trim().slice(0,100)}function Qo(s){return s.toLowerCase().replace(/[^\p{L}\p{N}/_-]+/gu,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function Mt(s){var n,o;if(!s||!s.trim())return{headers:[],rows:[]};let t=Xo.default.parse(s,{header:!0,skipEmptyLines:!0}),e=((n=t.meta.fields)!=null?n:[]).map(String),i=((o=t.data)!=null?o:[]).map(r=>{let a={};return e.forEach(L=>{a[L]=r[L]!=null?String(r[L]):""}),a});return{headers:e,rows:i}}function Xt(s,t){if(!s)return s;let e=s.startsWith("./")||s.startsWith("../")||s==="."||s==="..";if(!e&&s.includes("/"))return s;if(!e)return t?`${t}/${s}`:s;let i=t?t.split("/").filter(Boolean):[];for(let n of s.split("/"))if(!(n===""||n===".")){if(n===".."){i.pop();continue}i.push(n)}return i.join("/")}function Jo(s,t,e){let i=e==="asc"?1:-1;return[...s].sort((n,o)=>{var h,u;let r=((h=n[t])!=null?h:"").trim(),a=((u=o[t])!=null?u:"").trim();if(!r&&!a)return 0;if(!r)return 1;if(!a)return-1;let L=parseFloat(r),l=parseFloat(a);return(!isNaN(L)&&!isNaN(l)&&/^-?[\d.]/.test(r)&&/^-?[\d.]/.test(a)?L-l:r.localeCompare(a,void 0,{numeric:!0,sensitivity:"base"}))*i})}function Dt(s){return s.split(/[\s_-]+/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}function tr(s,t){let e=(s!=null?s:"").trim();if(!e||e.toLowerCase()==="unrated"||e==="\u2014"||e==="-")return"";if(/[★⭐☆]/.test(e))return e;if(/^\d+$/.test(e)){let o=parseInt(e,10);if(o>=1&&o<=5)return"\u2605".repeat(o)}let n=Ol(e,t);return n&&n!==e&&n!=="\u2014"?n:""}function Ol(s,t){var o;let e=t.toLowerCase();if(!["rating","score","score /5"].includes(e))return s;let i=s.toLowerCase().trim();return(o={excellent:"\u2605\u2605\u2605\u2605\u2605",great:"\u2605\u2605\u2605\u2605\u2605",good:"\u2605\u2605\u2605\u2605\u2606",fair:"\u2605\u2605\u2605\u2606\u2606",poor:"\u2605\u2605\u2606\u2606\u2606",bad:"\u2605\u2606\u2606\u2606\u2606",5:"\u2605\u2605\u2605\u2605\u2605",4:"\u2605\u2605\u2605\u2605\u2606",3:"\u2605\u2605\u2605\u2606\u2606",2:"\u2605\u2605\u2606\u2606\u2606",1:"\u2605\u2606\u2606\u2606\u2606",0:"\u2606\u2606\u2606\u2606\u2606",unrated:"\u2014","":"\u2014"}[i])!=null?o:s}function er(s,t){if(/^(year|released|decade)$/i.test((s!=null?s:"").trim()))return!0;let e=t.map(n=>(n!=null?n:"").trim()).filter(Boolean);return e.length<3?!1:e.filter(n=>/^(1[89]|20)\d{2}$/.test(n)).length/e.length>=.8}function sr(s){let t=(s!=null?s:"").match(/\b(1[89]\d{2}|20\d{2})\b/);return t?`${Math.floor(parseInt(t[1],10)/10)*10}s`:null}function ir(s,t,e){var r;if(!t.length)return null;let i=Math.max(12,t.length/3),n=null,o=1/0;for(let a of s){if(e.has(a))continue;let L=new Set;for(let c of t)((r=c[a])!=null?r:"").split(",").forEach(d=>{let h=d.trim();h&&L.add(h)});if(L.size<2||L.size>i)continue;let l=Math.abs(Math.log(L.size/8));lM.remove());let r=document.body.createDiv({cls:"csv-select-picker"}),a=()=>{let M=s.getBoundingClientRect(),T=r.offsetHeight||280,A=M.bottom+4+T>window.innerHeight&&M.top-4-T>0;r.style.left=M.left+"px",r.style.top=A?M.top-4-T+"px":M.bottom+4+"px"};a();let L=M=>{!r.contains(M.target)&&M.target!==s&&c()},l=M=>{r.contains(M.target)||c()},c=()=>{r.remove(),document.removeEventListener("mousedown",L),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",c)},d=r.createEl("input",{cls:"csv-picker-search",type:"text",placeholder:"Search or add\u2026"});d.focus();let h=r.createDiv({cls:"csv-picker-list"}),u=!!(o!=null&&o.multi),f=M=>M.split(",").map(T=>T.trim()).filter(Boolean),p=new Set(u?f(t):[]),m=()=>i([...p].join(", ")),g=u?Array.from(new Set(e.flatMap(f))):Array.from(new Set(e.filter(Boolean))),b=[],_=0,S=()=>{h.querySelectorAll(".csv-picker-item").forEach((M,T)=>{M.toggleClass("csv-picker-item--hover",T===_),T===_&&M.scrollIntoView({block:"nearest"})})},C=M=>{if(!u){i(M.isClear?"":M.value),c();return}M.isClear?p.clear():(p.has(M.value)?p.delete(M.value):p.add(M.value),M.isAdd&&!g.includes(M.value)&&g.push(M.value)),m(),M.isAdd?(d.value="",x("")):x(d.value)},v=M=>u?p.has(M):M===t,y=()=>u?p.size>0:!!t,x=M=>{h.empty(),b=[];let T=M?g.filter(A=>A.toLowerCase().includes(M.toLowerCase())):g;if(y()){b.push({value:"",isClear:!0});let A=h.createDiv({cls:"csv-picker-item csv-picker-clear"});A.setText(u?"\u2715 Clear all":"\u2715 Clear"),A.addEventListener("mousedown",B=>{B.preventDefault(),C({value:"",isClear:!0})})}if(T.forEach(A=>{b.push({value:A});let B=h.createDiv({cls:`csv-picker-item ${v(A)?"active":""}`});B.setText(u?`${p.has(A)?"\u2713 ":""}${A}`:A),B.addEventListener("mousedown",I=>{I.preventDefault(),C({value:A})})}),M&&!g.some(A=>A.toLowerCase()===M.toLowerCase())){b.push({value:M,isAdd:!0});let A=h.createDiv({cls:"csv-picker-item csv-picker-add"});A.setText(`+ Add "${M}"`),A.addEventListener("mousedown",B=>{B.preventDefault(),C({value:M,isAdd:!0})})}!T.length&&!M&&h.createDiv({cls:"csv-picker-empty",text:"No options yet. Type to add."}),_=Math.min(_,Math.max(b.length-1,0)),S()};u&&r.createEl("button",{cls:"csv-picker-done",text:"Done"}).addEventListener("mousedown",M=>{M.preventDefault(),c()}),x(""),a(),d.addEventListener("input",()=>{_=0,x(d.value),a()});let w=typeof window!="undefined"&&((k=window.matchMedia)==null?void 0:k.call(window,"(pointer: coarse)").matches);window.setTimeout(()=>{document.addEventListener("mousedown",L),w||(window.addEventListener("scroll",l,!0),window.addEventListener("resize",c))},0),d.addEventListener("keydown",M=>{if(M.key==="Escape"){c();return}if(M.key==="ArrowDown"){M.preventDefault(),b.length&&(_=(_+1)%b.length,S());return}if(M.key==="ArrowUp"){M.preventDefault(),b.length&&(_=(_-1+b.length)%b.length,S());return}if(M.key==="Enter")if(M.preventDefault(),b[_])C(b[_]);else{let T=d.value.trim();T&&(i(T),c())}})}async function rs(s,t,e){var L,l;let i=(l=(L=t.parent)==null?void 0:L.path)!=null?l:"",n=i?`${i}/Archive`:"Archive";await s.vault.adapter.exists(n)||await s.vault.adapter.mkdir(n);let o=new Date,r=`${ge(o)} ${String(o.getHours()).padStart(2,"0")}${String(o.getMinutes()).padStart(2,"0")}${String(o.getSeconds()).padStart(2,"0")}`,a=`${n}/${t.basename} sync-conflict ${r}.csv`;return await s.vault.adapter.write(a,e),new hi.Notice(`"${t.name}" changed on disk while you were editing (another device?). That version was saved to ${a} \u2014 your edits won.`,1e4),a}function nr(s,t,e){return!s[t]||t===e||(s[e]||(s[e]=s[t]),delete s[t]),s}var Fl={source:["confirmed","inferred","conflict"],resolved:["yes","no"]};function or(s){var t;return(t=Fl[s.trim().toLowerCase()])!=null?t:null}function kt(s){return/(^|[_\s-])(date|due|deadline)([_\s-]|$)/i.test(s.trim())}var fi=/^\d{4}-\d{2}-\d{2}$/;var Nt=require("obsidian");function mi(s,t,e,i,n=kt){let o=n(t)&&(e===""||fi.test(e.slice(0,10))),r=o?e.slice(0,10):e,a=s.createEl("input",{cls:i,type:o?"date":"text",value:r});o||(a.placeholder=t);let L=or(t);if(L){let l=`csv-dl-${t.toLowerCase().replace(/[^a-z0-9]+/g,"-")}-${Math.random().toString(36).slice(2,7)}`,c=s.createEl("datalist");c.id=l,L.forEach(d=>c.createEl("option",{value:d})),a.setAttr("list",l)}return a}var as=class extends Nt.Modal{constructor(t,e,i,n,o,r,a={},L=()=>!1,l,c,d=kt){super(t),this.headers=e,this.isNotesCol=i,this.isSelectCol=n,this.getColumnValues=o,this.onSubmit=r,this.optionPresets=a,this.isBooleanCol=L,this.isCategoricalCol=l!=null?l:h=>this.isSelectCol(h)||qt(this.getColumnValues(h).length),this.titleCol=c!=null?c:this.headers.find(h=>["title","name"].includes(h.toLowerCase())),this.isDateCol=d}onOpen(){let{contentEl:t}=this;t.empty(),t.addClass("csv-add-modal"),t.createEl("h2",{text:"Add new entry",cls:"csv-modal-title"});let e=t.createDiv({cls:"csv-modal-form"}),i={};this.headers.forEach(c=>i[c]="");let n=this.titleCol,o=new Map;n&&this.getColumnValues(n).forEach(c=>{let d=c.trim().toLowerCase();d&&!o.has(d)&&o.set(d,c.trim())}),this.headers.forEach(c=>{var m;let d=e.createDiv({cls:"csv-modal-row"});d.createEl("label",{text:Dt(c),cls:"csv-modal-label"});let h=(m=this.optionPresets[c])!=null?m:[],u=c===n,f=vt(c),p=!u&&!this.isNotesCol(c)&&!f&&(h.length>0||this.isCategoricalCol(c));if(this.isBooleanCol(c)){i[c]="0";let g=d.createDiv({cls:"csv-toggle"});g.createDiv({cls:"csv-toggle-knob"}),g.addEventListener("click",()=>{let b=!g.hasClass("is-on");g.toggleClass("is-on",b),i[c]=b?"1":"0"})}else if(this.isNotesCol(c)){let g=d.createEl("textarea",{cls:"csv-modal-textarea",placeholder:"Markdown supported\u2026"});g.addEventListener("input",()=>{i[c]=g.value})}else if(p){let g="__custom__",b=[];[...h,...this.getColumnValues(c)].forEach(C=>{let v=(C!=null?C:"").trim();v&&!b.some(y=>y.toLowerCase()===v.toLowerCase())&&b.push(v)});let _=d.createEl("select",{cls:"csv-modal-select"});_.createEl("option",{text:"\u2014",value:""}),b.forEach(C=>_.createEl("option",{text:C,value:C})),_.createEl("option",{text:"+ custom\u2026",value:g});let S=d.createEl("input",{cls:"csv-modal-input csv-modal-custom",type:"text",placeholder:`Custom ${Dt(c).toLowerCase()}`});S.hide(),S.addEventListener("input",()=>{i[c]=S.value}),S.addEventListener("keydown",C=>{C.key==="Enter"&&l()}),_.addEventListener("change",()=>{_.value===g?(S.show(),S.focus(),i[c]=S.value):(S.hide(),i[c]=_.value)})}else if(!u&&f&&this.isSelectCol(c)){let b=d.createDiv({cls:"csv-modal-select-wrap"}).createDiv({cls:"csv-select-chip empty"});b.setText("\u2014 click to select \u2014"),b.addEventListener("click",_=>{_.stopPropagation(),Bt(b,i[c],this.getColumnValues(c),S=>{i[c]=S,b.setText(S||"\u2014 click to select \u2014"),b.toggleClass("empty",!S)},t,{multi:vt(c)})})}else{let g=mi(d,c,"","csv-modal-input",b=>this.isDateCol(b));if(g.addEventListener("input",()=>{i[c]=g.value}),g.addEventListener("keydown",b=>{b.key==="Enter"&&l()}),c===n&&o.size){let b=d.createDiv({cls:"csv-modal-dup-hint"});b.hide(),g.addEventListener("input",()=>{let _=o.get(g.value.trim().toLowerCase());_?(b.setText(`\u26A0 \u201C${_}\u201D is already in this file`),b.show()):b.hide()})}}});let r=t.createDiv({cls:"csv-modal-btns"});r.createEl("button",{text:"Cancel",cls:"csv-modal-cancel"}).addEventListener("click",()=>this.close()),r.createEl("button",{text:"Add entry",cls:"csv-modal-submit"}).addEventListener("click",()=>l());let l=()=>{if(!Object.values(i).some(d=>d.trim())){new Nt.Notice("Fill in at least one field.");return}this.onSubmit(i),this.close()}}onClose(){this.contentEl.empty()}},me=class extends Nt.Modal{constructor(e,i,n,o,r,a,L,l,c,d,h,u,f=()=>!1,p=kt){super(e);this.vvHandler=null;this.row={...i},this.notesCol=n,this.headers=o,this.filePath=r,this.renderComponent=new Nt.Component,this.isNotesCol=a,this.isSelectCol=L,this.getColumnValues=l,this.onSave=c,this.onDelete=d,this.isCategoricalCol=h!=null?h:m=>this.isSelectCol(m)||!kt(m)&&qt(this.getColumnValues(m).length),this.titleCol=u!=null?u:this.headers.find(m=>["title","name","Title","Name"].includes(m)),this.isBooleanCol=f,this.isDateCol=p,this.modalEl.addClass("csv-note-expander-modal")}onOpen(){var h,u,f,p,m;this.renderComponent.load();let{contentEl:e}=this;e.empty(),e.addClass("csv-note-expander");let i=window.visualViewport;if(i){let g=()=>{this.modalEl.style.setProperty("--csv-modal-vh",`${i.height}px`)};g(),i.addEventListener("resize",g),i.addEventListener("scroll",g),this.vvHandler=g}e.createDiv({cls:"csv-expander-header"}).createDiv({cls:"csv-expander-title",text:(u=this.row[(h=this.titleCol)!=null?h:this.headers[0]])!=null?u:"\u2014"});let o=e.createDiv({cls:"csv-expander-fields"}),r=this.titleCol;this.headers.forEach(g=>{var C;if(this.isNotesCol(g))return;let b=o.createDiv({cls:"csv-expander-field-row"});if(b.createDiv({cls:"csv-expander-field-label",text:Dt(g)}),this.isBooleanCol(g)){let v=os((C=this.row[g])!=null?C:""),y=b.createDiv({cls:`csv-toggle ${v?"is-on":""}`});y.createDiv({cls:"csv-toggle-knob"}),y.addEventListener("click",()=>{let x=!y.hasClass("is-on");y.toggleClass("is-on",x),this.row[g]=x?"1":"0"});return}let _=vt(g);if(g!==r&&(_?this.isSelectCol(g):this.isCategoricalCol(g))){let v=b.createDiv({cls:`csv-select-chip ${this.row[g]?"":"empty"}`});v.setText(this.row[g]||"\u2014"),v.addEventListener("click",y=>{y.stopPropagation(),Bt(v,this.row[g],this.getColumnValues(g),x=>{this.row[g]=x,v.setText(x||"\u2014"),v.toggleClass("empty",!x)},e,{multi:vt(g)})})}else{let v=b.createDiv({cls:"csv-expander-field-value",text:this.row[g]||"\u2014"});v.addEventListener("click",()=>{var w;if(v.querySelector("input"))return;v.empty();let y=mi(v,g,(w=this.row[g])!=null?w:"","csv-inline-input",this.isDateCol);y.focus(),y.type==="text"&&y.select(),y.addEventListener("click",k=>k.stopPropagation());let x=()=>{this.row[g]=y.value,v.empty(),v.setText(y.value||"\u2014")};y.addEventListener("blur",x),y.addEventListener("keydown",k=>{k.key==="Enter"&&y.blur(),k.key==="Escape"&&(v.empty(),v.setText(this.row[g]||"\u2014"))})})}});let a=!1,L=this.notesCol&&(f=this.row[this.notesCol])!=null?f:"",l=null;if(this.notesCol){e.createDiv({cls:"csv-expander-divider"}).createDiv({cls:"csv-expander-notes-label",text:this.notesCol});let b=e.createDiv({cls:"csv-expander-rendered markdown-rendered"});b.title="Click to edit";let _=e.createDiv({cls:"csv-expander-editor is-hidden"}),S=()=>{b.empty(),L.trim()?Nt.MarkdownRenderer.render(this.app,L,b,this.filePath,this.renderComponent):b.createDiv({cls:"csv-notes-empty",text:"+ add note"})};S(),l=_.createEl("textarea",{cls:"csv-expander-textarea"}),l.value=L,l.addEventListener("input",()=>{L=l.value});let C=()=>{a||(a=!0,b.classList.add("is-hidden"),_.classList.remove("is-hidden"),l.value=L,l.focus())},v=()=>{a&&(a=!1,_.classList.add("is-hidden"),b.classList.remove("is-hidden"),L=l.value,S())};b.addEventListener("click",y=>{if(y.target.closest("a, button, input, textarea, [contenteditable]"))return;let w=window.getSelection();w&&w.toString().length>0||C()}),l.addEventListener("keydown",y=>{y.key==="Escape"&&(y.preventDefault(),l.blur())}),l.addEventListener("blur",v)}let c=e.createDiv({cls:"csv-expander-footer"});if(this.onDelete){let g=String((m=this.row[(p=this.titleCol)!=null?p:this.headers[0]])!=null?m:"").trim(),b=c.createEl("button",{cls:"csv-expander-delete-btn",text:"Delete",attr:{title:`Delete "${g||"this entry"}"? This can't be undone.`}});b.addEventListener("click",()=>{if(b.hasClass("confirm")){this.onDelete(),this.close();return}b.addClass("confirm"),b.setText("Confirm?"),window.setTimeout(()=>{b.isConnected&&(b.removeClass("confirm"),b.setText("Delete"))},3e3)})}let d=c.createDiv({cls:"csv-expander-footer-right"});d.createEl("button",{cls:"csv-modal-cancel",text:"Cancel"}).addEventListener("click",()=>this.close()),d.createEl("button",{cls:"csv-expander-save-btn",text:"Save & close"}).addEventListener("click",()=>{this.notesCol&&(a&&l&&(L=l.value),this.row[this.notesCol]=L),this.onSave(this.row),this.close()})}onClose(){let e=window.visualViewport;e&&this.vvHandler&&(e.removeEventListener("resize",this.vvHandler),e.removeEventListener("scroll",this.vvHandler)),this.vvHandler=null,this.renderComponent.unload(),this.contentEl.empty()}};var pi=class extends Nt.Modal{constructor(t,e,i,n,o,r,a,L,l,c,d,h,u,f=()=>0){super(t),this.headers=e,this.filePath=i,this.current={...n,habitColumns:n.habitColumns?[...n.habitColumns]:void 0,categoricalColumns:n.categoricalColumns?[...n.categoricalColumns]:void 0},this.autoDetectedHabits=o,this.autoDetectedCategorical=r,this.autoDetectedRoles=a,this.availableModes=L,this.onSave=l,this.getHeaders=c,this.getFileCfg=d,this.onAddColumn=h,this.onRemoveColumn=u,this.onCleanupBooleanColumn=f}onOpen(){var B,I,P;let{contentEl:t}=this;t.empty(),t.addClass("csv-add-modal"),t.createEl("h2",{text:"View settings for this file",cls:"csv-modal-title"}),t.createEl("p",{text:"These settings apply only to this file and override the global defaults.",cls:"csv-modal-desc"});let e=t.createDiv({cls:"csv-modal-form"}),i=()=>{this.headers=this.getHeaders();let E=this.getFileCfg();this.current={...E,habitColumns:E.habitColumns?[...E.habitColumns]:void 0,categoricalColumns:E.categoricalColumns?[...E.categoricalColumns]:void 0},this.onOpen()},n=e.createDiv({cls:"csv-modal-row"});n.createEl("label",{text:"Columns",cls:"csv-modal-label"}),n.createEl("p",{cls:"csv-modal-hint",text:`Type and function are each exclusive per column \u2014 picking one clears it from whichever column held it before. "auto" means it's already doing that by column name, with nothing saved here yet. Card field is independent and can combine with anything. Checkbox columns get a "clean up" action that rewrites every row to strict 1/0 right away \u2014 not deferred to save.`});let o=[{value:"text",label:"Text"},{value:"checkbox",label:"Checkbox"},{value:"categorical",label:"Categorical"},{value:"date",label:"Date"}],r=[{value:"",label:"\u2014 no function \u2014"},{value:"title",label:"Title"},{value:"category",label:"Column group (Kanban lanes)"},{value:"status",label:"Row group / Status / Checkmark"},{value:"notes",label:"Notes"},{value:"image",label:"Image (card / kanban thumbnail)"},{value:"anki",label:"Anki card front"}],a=E=>{var N,G,R;let j=(N=this.current.habitColumns)!=null?N:this.autoDetectedHabits,F=(G=this.current.categoricalColumns)!=null?G:this.autoDetectedCategorical,W=(R=this.current.dateColumns)!=null?R:this.headers.filter(Y=>kt(Y));return j.includes(E)?{type:"checkbox",auto:!this.current.habitColumns}:F.includes(E)?{type:"categorical",auto:!this.current.categoricalColumns}:W.includes(E)?{type:"date",auto:!this.current.dateColumns}:{type:"text",auto:!1}},L=(E,j)=>{this.current.habitColumns||(this.current.habitColumns=[...this.autoDetectedHabits]),this.current.categoricalColumns||(this.current.categoricalColumns=[...this.autoDetectedCategorical]),this.current.dateColumns||(this.current.dateColumns=this.headers.filter(F=>kt(F))),this.current.habitColumns=this.current.habitColumns.filter(F=>F!==E),this.current.categoricalColumns=this.current.categoricalColumns.filter(F=>F!==E),this.current.dateColumns=this.current.dateColumns.filter(F=>F!==E),j==="checkbox"?this.current.habitColumns.push(E):j==="categorical"?this.current.categoricalColumns.push(E):j==="date"&&this.current.dateColumns.push(E)},l=(I=(B=this.current.titleColumn)!=null?B:this.autoDetectedRoles.title)!=null?I:this.headers[0],d=n.createDiv({cls:"csv-modal-colcfg-table-wrap"}).createEl("table",{cls:"csv-modal-colcfg-table"}),h=d.createEl("thead").createEl("tr");["Column","Type","Visibility"].forEach(E=>h.createEl("th",{text:E}));let u=d.createEl("tbody"),f=()=>{var j;u.empty();let E=new Set((j=this.current.cardFields)!=null?j:this.headers);this.headers.forEach(F=>{let W=u.createEl("tr"),N=W.createEl("td",{cls:"csv-modal-colcfg-name"});N.createSpan({text:F});let G=N.createEl("button",{cls:"csv-modal-column-remove",text:"\u2715",attr:{title:`Remove "${F}" \u2014 deletes this column's data from every row`}});G.addEventListener("click",()=>{if(G.hasClass("confirm")){this.onRemoveColumn(F),i();return}u.querySelectorAll(".csv-modal-column-remove.confirm").forEach(D=>{D.removeClass("confirm"),D.setText("\u2715")}),G.addClass("confirm"),G.setText("Confirm?"),window.setTimeout(()=>{G.isConnected&&(G.removeClass("confirm"),G.setText("\u2715"))},3e3)});let R=W.createEl("td",{cls:"csv-modal-colcfg-type-cell"});if(F===l)R.createSpan({cls:"csv-modal-colcfg-fixed",text:"Text"});else{let D=R.createEl("select",{cls:"csv-modal-select csv-modal-colcfg-type"}),{type:O,auto:H}=a(F);if(o.forEach($=>{let z=D.createEl("option",{text:$.label,value:$.value});$.value===O&&(z.selected=!0)}),H&&D.addClass("auto-detected"),D.addEventListener("change",()=>{L(F,D.value),f()}),H&&R.createSpan({cls:"csv-modal-colcfg-auto-badge",text:"auto"}),O==="checkbox"){let $=R.createEl("button",{cls:"csv-modal-colcfg-cleanup-btn",text:"Clean up",attr:{title:`Rewrite every row in "${F}" to strict 1/0 (yes/true/1 \u2192 1, everything else \u2192 0)`}});$.addEventListener("click",()=>{if($.hasClass("confirm")){let z=this.onCleanupBooleanColumn(F);new Nt.Notice(z>0?`"${F}": normalized ${z} row${z===1?"":"s"} to 1/0.`:`"${F}" is already strict 1/0 \u2014 nothing to change.`);return}u.querySelectorAll(".csv-modal-colcfg-cleanup-btn.confirm").forEach(z=>{z.removeClass("confirm"),z.setText("Clean up")}),$.addClass("confirm"),$.setText("Confirm?"),window.setTimeout(()=>{$.isConnected&&($.removeClass("confirm"),$.setText("Clean up"))},3e3)})}}let K=W.createEl("td",{cls:"csv-modal-colcfg-card-cell"}).createEl("input",{type:"checkbox"});K.checked=E.has(F),K.addEventListener("change",()=>{this.current.cardFields||(this.current.cardFields=[...this.headers]),K.checked?this.current.cardFields.includes(F)||this.current.cardFields.push(F):this.current.cardFields=this.current.cardFields.filter(D=>D!==F)})})};f();let p=t.createDiv({cls:"csv-modal-section",attr:{style:"margin-top: 24px;"}});p.createEl("h3",{text:"Column functions",cls:"csv-modal-h3"}),p.createEl("p",{cls:"csv-modal-desc",text:"Assign specific roles to your columns. 'auto' means it's already doing that by column name. Selecting '\u2014 none \u2014' disables the function entirely."});let g=p.createDiv({cls:"csv-modal-colcfg-table-wrap"}).createEl("table",{cls:"csv-modal-colcfg-table"}),b=g.createEl("thead").createEl("tr");["Function","Column"].forEach(E=>b.createEl("th",{text:E}));let _=g.createEl("tbody"),S=()=>{_.empty(),r.forEach(E=>{var Y,K,D,O,H,$,z,V,Z,X,q,it;if(E.value==="")return;let j=_.createEl("tr");j.createEl("td",{cls:"csv-modal-colcfg-name"}).setText(E.label);let W=j.createEl("td",{cls:"csv-modal-colcfg-type-cell"}),N=W.createEl("select",{cls:"csv-modal-select csv-modal-colcfg-role"});N.createEl("option",{text:"\u2014 none \u2014",value:""});let G="",R=!1;E.value==="title"?(G=(K=(Y=this.current.titleColumn)!=null?Y:this.autoDetectedRoles.title)!=null?K:"",R=this.current.titleColumn===void 0&&!!this.autoDetectedRoles.title):E.value==="category"?(G=(O=(D=this.current.categoryColumn)!=null?D:this.autoDetectedRoles.category)!=null?O:"",R=this.current.categoryColumn===void 0&&!!this.autoDetectedRoles.category):E.value==="status"?(G=($=(H=this.current.statusColumn)!=null?H:this.autoDetectedRoles.status)!=null?$:"",R=this.current.statusColumn===void 0&&!!this.autoDetectedRoles.status):E.value==="notes"?(G=(V=(z=this.current.notesColumn)!=null?z:this.autoDetectedRoles.notes)!=null?V:"",R=this.current.notesColumn===void 0&&!!this.autoDetectedRoles.notes):E.value==="image"?(G=(X=(Z=this.current.imageColumn)!=null?Z:this.autoDetectedRoles.image)!=null?X:"",R=this.current.imageColumn===void 0&&!!this.autoDetectedRoles.image):E.value==="anki"&&(G=(it=(q=this.current.ankiFrontCol)!=null?q:this.autoDetectedRoles.anki)!=null?it:"",R=this.current.ankiFrontCol===void 0&&!!this.autoDetectedRoles.anki),this.headers.forEach(Q=>{let et=N.createEl("option",{text:Q,value:Q});Q===G&&(et.selected=!0)}),R&&G!==""&&N.addClass("auto-detected"),N.addEventListener("change",()=>{let Q=N.value;Q&&(E.value!=="title"&&this.current.titleColumn===Q&&(this.current.titleColumn=void 0),E.value!=="category"&&this.current.categoryColumn===Q&&(this.current.categoryColumn=void 0),E.value!=="status"&&this.current.statusColumn===Q&&(this.current.statusColumn=void 0),E.value!=="notes"&&this.current.notesColumn===Q&&(this.current.notesColumn=void 0),E.value!=="image"&&this.current.imageColumn===Q&&(this.current.imageColumn=void 0),E.value!=="anki"&&this.current.ankiFrontCol===Q&&(this.current.ankiFrontCol=void 0)),E.value==="title"?this.current.titleColumn=Q:E.value==="category"?this.current.categoryColumn=Q:E.value==="status"?this.current.statusColumn=Q:E.value==="notes"?this.current.notesColumn=Q:E.value==="image"?this.current.imageColumn=Q:E.value==="anki"&&(this.current.ankiFrontCol=Q),S()}),R&&G!==""&&W.createSpan({cls:"csv-modal-colcfg-auto-badge",text:"auto"})})};S();let C=n.createDiv({cls:"csv-modal-add-column"}),v=C.createEl("input",{cls:"csv-modal-input",type:"text",placeholder:"New column name"}),y=C.createEl("button",{cls:"csv-modal-cancel",text:"+ add column"}),x=()=>{let E=this.onAddColumn(v.value);if(E){new Nt.Notice(E);return}i()};y.addEventListener("click",x),v.addEventListener("keydown",E=>{E.key==="Enter"&&(E.preventDefault(),x())});let w=e.createDiv({cls:"csv-modal-row"});w.createEl("label",{text:"Default view",cls:"csv-modal-label"});let k=w.createEl("select",{cls:"csv-modal-select"}),M=[["\u2014 use global default \u2014",""],...this.availableModes.map(E=>[E.label,E.id])],T=(P=this.current.defaultMode)!=null?P:"";T&&!this.availableModes.some(E=>E.id===T)&&M.push([`${T} (no longer available)`,T]),M.forEach(([E,j])=>{let F=k.createEl("option",{text:E,value:j});T===j&&(F.selected=!0)}),k.addEventListener("change",()=>{this.current.defaultMode=k.value?k.value:void 0});let A=t.createDiv({cls:"csv-modal-btns"});A.createEl("button",{text:"Cancel",cls:"csv-modal-cancel"}).addEventListener("click",()=>this.close()),A.createEl("button",{text:"Save",cls:"csv-modal-submit"}).addEventListener("click",()=>{this.onSave(this.current),this.close()})}onClose(){this.contentEl.empty()}},gi=class extends Nt.Modal{constructor(e,i,n,o,r){super(e);this.title=i;this.initial=n;this.placeholder=o;this.onSubmit=r}onOpen(){let{contentEl:e}=this;e.empty(),e.addClass("csv-add-modal"),e.createEl("h2",{text:this.title,cls:"csv-modal-title"});let i=e.createEl("input",{cls:"csv-modal-field",type:"text"});i.value=this.initial,i.placeholder=this.placeholder,window.setTimeout(()=>{i.focus(),i.select()},0);let n=()=>{let r=i.value.trim();r&&(this.onSubmit(r),this.close())};i.addEventListener("keydown",r=>{r.key==="Enter"&&(r.preventDefault(),n())});let o=e.createDiv({cls:"csv-modal-btns"});o.createEl("button",{text:"Cancel",cls:"csv-modal-cancel"}).addEventListener("click",()=>this.close()),o.createEl("button",{text:"Create",cls:"csv-modal-submit"}).addEventListener("click",n)}onClose(){this.contentEl.empty()}};var Mn=195,Il={AF:"Afghanistan",AL:"Albania",DZ:"Algeria",AD:"Andorra",AO:"Angola",AR:"Argentina",AM:"Armenia",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BD:"Bangladesh",BY:"Belarus",BE:"Belgium",BO:"Bolivia",BA:"Bosnia",BW:"Botswana",BR:"Brazil",BG:"Bulgaria",KH:"Cambodia",CM:"Cameroon",CA:"Canada",CL:"Chile",CN:"China",CO:"Colombia",HR:"Croatia",CU:"Cuba",CY:"Cyprus",CZ:"Czechia",DK:"Denmark",DO:"Dominican Rep.",EC:"Ecuador",EG:"Egypt",ET:"Ethiopia",FI:"Finland",FR:"France",GE:"Georgia",DE:"Germany",GH:"Ghana",GR:"Greece",GT:"Guatemala",GY:"Guyana",HT:"Haiti",HN:"Honduras",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran",IQ:"Iraq",IE:"Ireland",IL:"Israel",IT:"Italy",JP:"Japan",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KP:"N. Korea",KR:"S. Korea",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Laos",LV:"Latvia",LB:"Lebanon",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MY:"Malaysia",ML:"Mali",MT:"Malta",MR:"Mauritania",MX:"Mexico",MD:"Moldova",MN:"Mongolia",ME:"Montenegro",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar",NA:"Namibia",NP:"Nepal",NL:"Netherlands",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NO:"Norway",OM:"Oman",PK:"Pakistan",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PL:"Poland",PT:"Portugal",QA:"Qatar",RO:"Romania",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SG:"Singapore",SK:"Slovakia",SI:"Slovenia",SO:"Somalia",ZA:"South Africa",SS:"South Sudan",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SE:"Sweden",CH:"Switzerland",SY:"Syria",TJ:"Tajikistan",TZ:"Tanzania",TH:"Thailand",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",UG:"Uganda",UA:"Ukraine",AE:"UAE",GB:"United Kingdom",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VN:"Vietnam",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe",MC:"Monaco",BZ:"Belize"},Vl={AF:["DZ","AO","BJ","BW","BF","BI","CM","CV","CF","TD","KM","CD","CG","CI","DJ","EG","GQ","ER","ET","GA","GM","GH","GN","GW","KE","LS","LR","LY","MG","MW","ML","MR","MU","MA","MZ","NA","NE","NG","RE","RW","ST","SN","SC","SL","SO","ZA","SS","SD","TZ","TG","TN","UG","ZM","ZW"],AN:["AQ"],AS:["AF","AM","AZ","BH","BD","BT","BN","KH","CN","CY","GE","IN","ID","IR","IQ","IL","JP","JO","KZ","KW","KG","LA","LB","MY","MV","MN","MM","NP","KP","OM","PK","PS","PH","QA","RU","SA","SG","KR","LK","SY","TW","TJ","TH","TL","TR","TM","AE","UZ","VN","YE"],EU:["AL","AD","AT","BY","BE","BA","BG","HR","CZ","DK","EE","FI","FR","DE","GR","HU","IS","IE","IT","XK","LV","LI","LT","LU","MT","MD","MC","ME","NL","MK","NO","PL","PT","RO","RU","SM","RS","SK","SI","ES","SE","CH","UA","GB","VA"],NA:["AG","BS","BB","BZ","CA","CR","CU","DM","DO","SV","GD","GT","HT","HN","JM","MX","NI","PA","KN","LC","VC","TT","US"],OC:["AU","FJ","KI","MH","FM","NR","NZ","PW","PG","WS","SB","TO","TV","VU"],SA:["AR","BO","BR","CL","CO","EC","GY","PY","PE","SR","UY","VE"]},rr={AF:"Africa",AN:"Antarctica",AS:"Asia",EU:"Europe",NA:"N. America",OC:"Oceania",SA:"S. America"},ar={};for(let[s,t]of Object.entries(Vl))for(let e of t)ar[e]=s;function wt(s){return Il[s]||s}function Wt(s){return!s||s.length!==2?"":String.fromCodePoint(...s.toUpperCase().split("").map(t=>t.charCodeAt(0)+127397))}function $t(s){if(!s||s.indexOf("?")!==-1)return null;let t=new Date(s+"T12:00:00Z");return isNaN(t.getTime())?null:t}function Fs(s){let t=$t(s.date_entered),e=$t(s.date_left);return!t||!e?0:Math.max(Math.round((e.getTime()-t.getTime())/864e5),1)}function Lr(s,t=new Date){let e=t.getTime(),i=null,n=-1/0;for(let o of s){let r=$t(o.date_entered);if(!(!r||r.getTime()>e)){if(o.date_left.trim()!==""){let a=$t(o.date_left);if(!a||a.getTime()n&&(i=o,n=r.getTime())}}return i}function lr(s){let t=g=>{var b,_,S,C,v,y,x,w;return{date_entered:(b=g.date_entered)!=null?b:"",date_left:(_=g.date_left)!=null?_:"",country:((S=g.country)!=null?S:"").trim().toUpperCase(),city:(C=g.city)!=null?C:"",visa_status:(v=g.visa_status)!=null?v:"",notes:(y=g.notes)!=null?y:"",source:((x=g.source)!=null?x:"").trim().toLowerCase(),resolved:(w=g.resolved)!=null?w:"",_src:g}},e=s.map(t).filter(g=>g.country),i=e.filter(g=>g.source==="confirmed"),n=e.filter(g=>g.source==="inferred"),o=e.filter(g=>g.source==="conflict"),r=[];for(let g of i){let b=$t(g.date_entered),_=$t(g.date_left);b&&_&&r.push([b.getTime(),_.getTime()])}let a=g=>{let b=$t(g.date_entered),_=$t(g.date_left);if(!b||!_)return!1;let S=b.getTime(),C=_.getTime();return r.some(([v,y])=>S<=y&&C>=v)},L=n.filter(g=>$t(g.date_entered)&&$t(g.date_left)&&!a(g)),l=new Set(i.map(g=>g.country)),c=new Set(n.map(g=>g.country)),d=new Set([...c].filter(g=>!l.has(g))),h=new Set([...l,...c]),u=new Map;for(let g of i)u.set(g.country,(u.get(g.country)||0)+Fs(g));let f=[...u.entries()].map(([g,b])=>({iso:g,days:b})).sort((g,b)=>b.days-g.days||wt(g.iso).localeCompare(wt(b.iso))),p=f.reduce((g,b)=>g+b.days,0),m=new Set;for(let g of l){let b=ar[g];b&&m.add(b)}return{confirmed:i,inferred:n,conflicts:o,inferredVisible:L,confRanges:r,confirmedCountries:l,inferredOnlyCountries:d,allCountries:h,countryDays:f,totalConfirmedDays:p,visitedContinents:m,worldPct:Math.round(l.size/Mn*100)}}var kn=864e5;function cr(s){if(!s||s.indexOf("?")!==-1)return null;let t=Date.parse(s+"T00:00:00Z");return isNaN(t)?null:t}function Bl(s,t,e,i){let n=Math.max(s,e),o=Math.min(t,i);return o<=n?0:Math.round((o-n)/kn)}function Nl(s,t){var n;let e=s.window;if(e.type==="all-time")return{start:-1/0,end:1/0,label:"all time"};if(e.type==="calendar-year"){let o=new Date(t).getUTCFullYear();return{start:Date.UTC(o,0,1),end:Date.UTC(o+1,0,1),label:`in ${o}`}}let i=(n=e.days)!=null?n:180;return{start:t-i*kn,end:t+kn,label:`in last ${i} days`}}function dr(s,t,e=Date.now()){var c,d,h;let i=(c=s.scope.countries)!=null?c:s.scope.country?[s.scope.country]:[],n=new Set(i.map(u=>u.toUpperCase())),o=new Set(((h=(d=s.exempt)==null?void 0:d.visa_status)!=null?h:[]).map(u=>u.toLowerCase().trim())),r=Nl(s,e),a=0;for(let u of t){if(!n.has((u.country||"").toUpperCase())||o.has((u.visa_status||"").toLowerCase().trim()))continue;let f=cr(u.date_entered),p=cr(u.date_left);f===null||p===null||(a+=Bl(f,p,r.start,r.end))}let L=s.threshold-a,l=a>=s.threshold?"over":a/s.threshold>=.8?"warn":"ok";return{rule:s,used:a,threshold:s.threshold,remaining:L,windowLabel:r.label,status:l}}var hr=["#c9a96e","#4a6fa5","#5ba06e","#a05b8a","#6ea0a0","#a0855b","#7a6ea0","#a06e6e","#6e8fa0","#a09e5b"],$l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function zl(){let s=new Map,t=0;return e=>(s.has(e)||s.set(e,hr[t++%hr.length]),s.get(e))}function Hl(s){let t=document.body.createDiv({cls:"csv-tv-tooltip"}),e=null,i=(r,a)=>{let l=r+14,c=a+16,d=t.offsetWidth,h=t.offsetHeight;l+d+8>window.innerWidth&&(l=r-d-14),c+h+8>window.innerHeight&&(c=a-h-16),t.style.left=`${Math.max(8,l)}px`,t.style.top=`${Math.max(8,c)}px`},n=r=>{var l,c;let a=(c=(l=r.target)==null?void 0:l.closest("[data-tip]"))!=null?c:null,L=(a==null?void 0:a.getAttribute("data-tip"))||"";if(!a||!L){e&&(e=null,t.removeClass("is-on"));return}a!==e&&(e=a,t.setText(L),t.addClass("is-on")),i(r.clientX,r.clientY)},o=()=>{e=null,t.removeClass("is-on")};return s.addEventListener("pointermove",n),s.addEventListener("pointerleave",o),()=>{s.removeEventListener("pointermove",n),s.removeEventListener("pointerleave",o),t.remove()}}function wn(s){let t=Fs(s);return t?`${t}d`:"\u2014"}function Ls(s){return s||"\u2014"}function Vs(s){return s.createDiv({cls:"csv-tv-table-wrap"}).createEl("table",{cls:"csv-tv-table"})}function Is(s,t,e,i){s.addClass("csv-tv-editable"),s.title="Click to edit";let n=()=>{s.empty(),s.setText(t[e]?t[e]:"\u2014")};n(),s.addEventListener("click",()=>{var r;if(s.querySelector("input"))return;s.empty();let o=mi(s,e,(r=t[e])!=null?r:"","csv-inline-input");o.focus(),o.type==="text"&&o.select(),o.addEventListener("blur",()=>{t[e]=o.value,i(),n()}),o.addEventListener("keydown",a=>{var L;a.key==="Enter"&&o.blur(),a.key==="Escape"&&(o.value=(L=t[e])!=null?L:"",o.blur())})})}async function ur(s,t,e,i=()=>{},n=null,o=()=>{}){let r=lr(t),a=s.createDiv({cls:"csv-tv"});if(!r.confirmed.length&&!r.inferred.length){a.createDiv({cls:"csv-empty-state",text:"No travel rows found. Expected columns: country, date_entered, date_left, source."});return}o(Hl(a));let L=null,l=()=>{a.querySelectorAll(".country-path").forEach(u=>{let f=(u.getAttribute("data-iso")||"").toUpperCase();u.classList.toggle("cp-selected",!!L&&f===L)}),a.querySelectorAll(".csv-tv-seg").forEach(u=>{u.classList.toggle("is-dim",!!L&&u.getAttribute("data-iso")!==L)}),a.querySelectorAll("tr[data-iso]").forEach(u=>{u.classList.toggle("is-selected",!!L&&u.getAttribute("data-iso")===L)}),h.empty(),L&&(jl(h,r,L,()=>c(null)),h.scrollIntoView({behavior:"smooth",block:"nearest"}))},c=u=>{L=u&&u!==L?u:null,l()};Zl(a,r);let d=a.createDiv({cls:"csv-tv-mapwrap"});d.createDiv({cls:"csv-tv-map-loading",text:"Loading map\u2026"});let h=a.createDiv({cls:"csv-tv-detailwrap"});n&&n.length&&Ul(a,r.confirmed,n),Yl(a,r,c),Gl(a,r,c),Kl(a,r,i);try{let u=await e();d.empty(),u?Wl(d,u,r,c):d.createDiv({cls:"csv-tv-map-loading",text:"World map asset not found (world-map.svg)."})}catch(u){d.empty(),d.createDiv({cls:"csv-tv-map-loading",text:"Couldn't load world map."})}}function Zl(s,t){let e=s.createDiv({cls:"csv-tv-stats"}),i=(l,c,d="")=>{let h=e.createDiv({cls:"csv-tv-stat"});h.createDiv({cls:"csv-tv-stat-label",text:l}),h.createDiv({cls:"csv-tv-stat-value",text:c}),d&&h.createDiv({cls:"csv-tv-stat-sub",text:d})},n=Math.round(t.allCountries.size/Mn*100);i("Countries",String(t.confirmedCountries.size),`${t.worldPct}% of world`),i("Incl. photos",String(t.allCountries.size),`${n}% of world`),i("Continents",`${t.visitedContinents.size} / 7`,[...t.visitedContinents].map(l=>rr[l]||l).sort().join(", ")),i("Confirmed trips",String(t.confirmed.length)),i("Confirmed days",String(t.totalConfirmedDays));let o=new Set(t.confirmed.map(l=>l.city.trim().toLowerCase()).filter(Boolean));o.size&&i("Cities",String(o.size));let r=null,a=0;for(let l of t.confirmed){let c=Fs(l);c>a&&(a=c,r=l)}if(r){let l=r.date_entered.slice(0,4);i("Longest trip",`${a}d`,`${Wt(r.country)} ${wt(r.country)}${l?` \xB7 ${l}`:""}`)}let L=Lr(t.confirmed);if(L){let l=$t(L.date_entered),c=Math.max(1,Math.round((Date.now()-l.getTime())/864e5)+1),d=s.createDiv({cls:"csv-tv-now"});d.createSpan({cls:"csv-tv-now-loc",text:`\u{1F4CD} Currently in ${Wt(L.country)} ${wt(L.country)}`}),d.createSpan({cls:"csv-tv-now-sub",text:` \u2014 since ${L.date_entered} (day ${c})${L.city?` \xB7 ${L.city}`:""}`})}}function Wl(s,t,e,i){let n=s.createDiv({cls:"csv-tv-map"}),o=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;n.appendChild(o),n.querySelectorAll(".country-path").forEach(l=>{let c=(l.getAttribute("data-iso")||"").toUpperCase();if(l.classList.remove("cp-unvisited","cp-confirmed","cp-inferred"),c&&e.confirmedCountries.has(c)){l.classList.add("cp-confirmed");let d=e.countryDays.find(h=>h.iso===c);l.setAttr("aria-label",`${wt(c)} \u2014 ${d&&d.days?d.days+"d confirmed":"confirmed"}`),l.setAttr("data-tip",`${wt(c)}${d&&d.days?" \xB7 "+d.days+"d":""} \xB7 click for trips`)}else c&&e.inferredOnlyCountries.has(c)?(l.classList.add("cp-inferred"),l.setAttr("aria-label",`${wt(c)} \u2014 photo evidence`),l.setAttr("data-tip",`${wt(c)} \xB7 photo evidence \xB7 click for trips`)):c?(l.classList.add("cp-unvisited"),l.setAttr("data-tip",wt(c))):l.classList.add("cp-unvisited");c&&l.addEventListener("click",()=>{e.allCountries.has(c)?i(c):i(null)})}),n.querySelectorAll(".country-path").forEach(l=>{try{let c=l.getBoundingClientRect();c.width&&c.height&&Math.max(c.width,c.height)<12&&l.classList.add("cp-tiny")}catch(c){}});let r=s.createDiv({cls:"csv-tv-map-legend"}),a=r.createSpan({cls:"csv-tv-leg"});a.createSpan({cls:"csv-tv-dot cp-confirmed"}),a.appendText(" Confirmed");let L=r.createSpan({cls:"csv-tv-leg"});L.createSpan({cls:"csv-tv-dot cp-inferred"}),L.appendText(" Photo evidence")}function jl(s,t,e,i){var m,g;let n=s.createDiv({cls:"csv-tv-detail"}),o=n.createDiv({cls:"csv-tv-detail-head"});o.createSpan({cls:"csv-tv-detail-flag",text:Wt(e)});let r=o.createDiv({cls:"csv-tv-detail-titles"});r.createDiv({cls:"csv-tv-detail-name",text:wt(e)});let a=t.confirmed.filter(b=>b.country===e),L=t.inferred.filter(b=>b.country===e),l=(g=(m=t.countryDays.find(b=>b.iso===e))==null?void 0:m.days)!=null?g:0,c=new Set([...a,...L].map(b=>b.city.trim()).filter(Boolean)),d=[];a.length&&d.push(`${a.length} confirmed trip${a.length===1?"":"s"}`),l&&d.push(`${l}d total`),L.length&&d.push(`${L.length} photo-inferred`),c.size&&d.push(`${c.size} cit${c.size===1?"y":"ies"}`),r.createDiv({cls:"csv-tv-detail-sub",text:d.join(" \xB7 ")}),o.createEl("button",{cls:"csv-tv-detail-close",text:"\u2715",title:"Close"}).addEventListener("click",i);let h=bi([...a.map(b=>({r:b,inf:!1,date_entered:b.date_entered})),...L.map(b=>({r:b,inf:!0,date_entered:b.date_entered}))]);if(!h.length)return;let u=Vs(n),f=u.createEl("thead").createEl("tr");["","Entered","Left","Days","City","Visa"].forEach(b=>f.createEl("th",{text:b}));let p=u.createEl("tbody");for(let{r:b,inf:_}of h){let S=p.createEl("tr");S.createEl("td",{text:_?"\u{1F4F7}":"",cls:"csv-tv-flag",attr:_?{"data-tip":"Photo-inferred"}:{}}),S.createEl("td",{text:Ls(b.date_entered)}),S.createEl("td",{text:Ls(b.date_left)}),S.createEl("td",{text:wn(b)}),S.createEl("td",{text:b.city}),S.createEl("td",{text:b.visa_status})}}function Ul(s,t,e){s.createDiv({cls:"csv-tv-sec-title",text:"Residency counters"});let i=s.createDiv({cls:"csv-tv-res-grid"});for(let n of e){let o=dr(n,t),r=i.createDiv({cls:`csv-tv-res-card csv-tv-res-${o.status}`});r.createDiv({cls:"csv-tv-res-label",text:n.label});let a=r.createDiv({cls:"csv-tv-res-nums"});a.createSpan({cls:"csv-tv-res-used",text:String(o.used)}),a.createSpan({cls:"csv-tv-res-thresh",text:` / ${o.threshold}`}),a.createSpan({cls:"csv-tv-res-window",text:` ${o.windowLabel}`});let L=r.createDiv({cls:"csv-tv-res-bar"});L.createDiv({cls:"csv-tv-res-fill"}).style.width=`${Math.min(100,Math.round(o.used/o.threshold*100))}%`;let l=o.status==="over"?n.onExceed?`Over \u2014 ${n.onExceed}`:"Limit reached":`${o.remaining} day${o.remaining===1?"":"s"} left`;r.createDiv({cls:"csv-tv-res-status",text:l}),n.note&&r.createDiv({cls:"csv-tv-res-note",text:n.note})}s.createDiv({cls:"csv-tv-res-disclaimer",text:"Indicators only \u2014 not legal or tax advice. Based on confirmed trips."})}function Yl(s,t,e){s.createDiv({cls:"csv-tv-sec-title",text:"Countries visited"});let i=Vs(s),n=i.createEl("thead").createEl("tr");["","Country","Total days"].forEach(r=>n.createEl("th",{text:r}));let o=i.createEl("tbody");for(let{iso:r,days:a}of t.countryDays){let L=o.createEl("tr",{cls:"csv-tv-row-click",attr:{"data-iso":r}});L.createEl("td",{text:Wt(r),cls:"csv-tv-flag"}),L.createEl("td",{text:wt(r)}),L.createEl("td",{text:a?`${a}d`:"\u2014"}),L.addEventListener("click",()=>e(r))}if(t.inferredOnlyCountries.size){let r=s.createDiv({cls:"csv-tv-photo-only"});r.createSpan({text:"\u{1F4F7} Photo evidence only: "}),r.createSpan({text:[...t.inferredOnlyCountries].sort().map(Wt).join(" ")})}}function Gl(s,t,e){s.createDiv({cls:"csv-tv-sec-title",text:"Timeline"});let i=zl(),n=[...t.confirmed.map(l=>({...l,_inf:!1})),...t.inferredVisible.map(l=>({...l,_inf:!0}))].filter(l=>l.date_entered&&l.date_left&&l.date_entered.indexOf("?")===-1),o=new Map;for(let l of n){let c=parseInt(l.date_entered.slice(0,4)),d=parseInt(l.date_left.slice(0,4));if(!(isNaN(c)||isNaN(d)))for(let h=c;h<=d;h++)o.has(h)||o.set(h,[]),o.get(h).push(l)}let r=[...o.keys()].sort((l,c)=>c-l),a=s.createDiv({cls:"csv-tv-timeline"});for(let l of r){let c=new Date(`${l}-01-01T12:00:00Z`).getTime(),d=new Date(`${l}-12-31T12:00:00Z`).getTime(),h=d-c,u=a.createDiv({cls:"csv-tv-tl-year"}),f=0,p=new Set;for(let _ of o.get(l)){if(p.add(_.country),_._inf)continue;let S=Math.max(new Date(_.date_entered+"T12:00:00Z").getTime(),c),C=Math.min(new Date(_.date_left+"T12:00:00Z").getTime(),d);S<=C&&(f+=Math.max(Math.round((C-S)/864e5)+1,1))}let m=u.createDiv({cls:"csv-tv-tl-label"});m.createSpan({text:String(l)}),m.createSpan({cls:"csv-tv-tl-sub",text:`${f?`${f}d \xB7 `:""}${p.size} ${p.size===1?"country":"countries"}`});let g=u.createDiv({cls:"csv-tv-month-row"});$l.forEach(_=>g.createDiv({cls:"csv-tv-month-tick",text:_}));let b=u.createDiv({cls:"csv-tv-track"});for(let _ of o.get(l)){let S=Math.max(new Date(_.date_entered+"T12:00:00Z").getTime(),c),C=Math.min(new Date(_.date_left+"T12:00:00Z").getTime(),d);if(S>C)continue;let v=(S-c)/h*100,y=Math.max((C-S+864e5)/h*100,.5),x=i(_.country),w=b.createDiv({cls:`csv-tv-seg${_._inf?" csv-tv-seg-inf":""}`});w.style.left=`${v}%`,w.style.width=`${y}%`,_._inf?(w.style.borderColor=x,w.style.background=x+"22",w.style.color=x):w.style.background=x,w.setAttr("data-iso",_.country),w.setAttr("data-tip",`${wt(_.country)} ${_.date_entered} \u2192 ${_.date_left} (${Fs(_)}d)${_.visa_status?" ["+_.visa_status+"]":""}${_._inf?" [photo]":""}`),w.addEventListener("click",()=>e(_.country)),y>4?w.createSpan({cls:"csv-tv-seg-lbl",text:`${Wt(_.country)} ${_.country}`}):y>2&&w.createSpan({cls:"csv-tv-seg-lbl",text:Wt(_.country)})}}a.createDiv({cls:"csv-tv-tl-legend"}).setText("Confirmed (solid) \xB7 photo inferred (outlined)")}function bi(s){return[...s].sort((t,e)=>!t.date_entered&&!e.date_entered?0:t.date_entered?e.date_entered?e.date_entered.localeCompare(t.date_entered):-1:1)}function Kl(s,t,e){s.createDiv({cls:"csv-tv-sec-title",text:"Confirmed trips"}),s.createDiv({cls:"csv-tv-edit-hint",text:"Dates, city, visa and notes are editable \u2014 click a cell. Edit country in Table view."});let i=Vs(s),n=i.createEl("thead").createEl("tr");["","Country","Entered","Left","Duration","City","Visa","Notes"].forEach(r=>n.createEl("th",{text:r}));let o=i.createEl("tbody");for(let r of bi(t.confirmed)){let a=o.createEl("tr");a.createEl("td",{text:Wt(r.country),cls:"csv-tv-flag"}),a.createEl("td",{text:wt(r.country)}),Is(a.createEl("td"),r._src,"date_entered",e),Is(a.createEl("td"),r._src,"date_left",e),a.createEl("td",{text:wn(r)}),Is(a.createEl("td"),r._src,"city",e),Is(a.createEl("td"),r._src,"visa_status",e),Is(a.createEl("td"),r._src,"notes",e)}if(t.inferred.length){let r=s.createEl("details",{cls:"csv-tv-details"});r.createEl("summary",{text:`\u{1F4F7} Photo inferred trips (${t.inferred.length})`});let a=Vs(r),L=a.createEl("thead").createEl("tr");["","Country","Entered","Left","Days","City"].forEach(c=>L.createEl("th",{text:c}));let l=a.createEl("tbody");for(let c of bi(t.inferred)){let d=l.createEl("tr");d.createEl("td",{text:Wt(c.country),cls:"csv-tv-flag"}),d.createEl("td",{text:wt(c.country)}),d.createEl("td",{text:Ls(c.date_entered)}),d.createEl("td",{text:Ls(c.date_left)}),d.createEl("td",{text:wn(c)}),d.createEl("td",{text:c.city})}}if(t.conflicts.length){let r=s.createEl("details",{cls:"csv-tv-details csv-tv-details-warn"});r.createEl("summary",{text:`\u26A0 ${t.conflicts.length} conflict(s) \u2014 photo evidence contradicts a confirmed entry`});let a=Vs(r),L=a.createEl("thead").createEl("tr");["","Country (photos)","Dates","Detail"].forEach(c=>L.createEl("th",{text:c}));let l=a.createEl("tbody");for(let c of bi(t.conflicts)){let d=l.createEl("tr");d.createEl("td",{text:Wt(c.country),cls:"csv-tv-flag"}),d.createEl("td",{text:c.country}),d.createEl("td",{text:`${Ls(c.date_entered)} \u2192 ${Ls(c.date_left)}`}),d.createEl("td",{text:c.notes})}}}var Tt=require("obsidian"),vi=class extends Tt.PluginSettingTab{constructor(t,e){super(t,e),this.plugin=e}display(){let{containerEl:t}=this;t.empty(),new Tt.Setting(t).setName("Default view mode").addDropdown(i=>i.addOption("kanban-genre","Kanban").addOption("table","Table").setValue(this.plugin.settings.defaultMode).onChange(async n=>{this.plugin.settings.defaultMode=n,await this.plugin.saveSettings()})),new Tt.Setting(t).setName("Status column name").addText(i=>i.setValue(this.plugin.settings.statusColumn).onChange(async n=>{this.plugin.settings.statusColumn=n,await this.plugin.saveSettings()})),new Tt.Setting(t).setName("Category/genre column name").addText(i=>i.setValue(this.plugin.settings.categoryColumn).onChange(async n=>{this.plugin.settings.categoryColumn=n,await this.plugin.saveSettings()})),new Tt.Setting(t).setName("Notes column names").setDesc("Comma-separated.").addText(i=>i.setValue(this.plugin.settings.notesColumns.join(", ")).onChange(async n=>{this.plugin.settings.notesColumns=n.split(",").map(o=>o.trim()),await this.plugin.saveSettings()})),new Tt.Setting(t).setName("Select/dropdown columns").setDesc("Comma-separated column names that use a dropdown picker.").addText(i=>i.setValue(this.plugin.settings.selectColumns.join(", ")).onChange(async n=>{this.plugin.settings.selectColumns=n.split(",").map(o=>o.trim()),await this.plugin.saveSettings()})),new Tt.Setting(t).setName("Notes subfolder").addText(i=>i.setPlaceholder("Notes").setValue(this.plugin.settings.notesSubfolder).onChange(async n=>{this.plugin.settings.notesSubfolder=n,await this.plugin.saveSettings()})),new Tt.Setting(t).setName("Reset column widths").addButton(i=>i.setButtonText("Reset").onClick(async()=>{this.plugin.settings.columnWidths={},await this.plugin.saveSettings(),new Tt.Notice("Column widths reset.")})),new Tt.Setting(t).setName("Residency counters (travel view)").setDesc("Show residency / tax day-gauges in the travel view.").addToggle(i=>i.setValue(this.plugin.settings.showResidency!==!1).onChange(async n=>{this.plugin.settings.showResidency=n,await this.plugin.saveSettings()})),new Tt.Setting(t).setName("Residency rules").setHeading(),t.createEl("p",{cls:"setting-item-description",text:"Each rule counts days in the listed countries within the window, minus exempt visa rows, against the threshold. Counts confirmed trips only. Indicators, not legal/tax advice."});let e=t.createDiv({cls:"csv-rr-wrap"});this.renderResidencyRules(e)}renderResidencyRules(t){var o;t.empty();let e=(o=this.plugin.settings.residencyRules)!=null?o:this.plugin.settings.residencyRules=[],i=()=>void this.plugin.saveSettings();e.forEach((r,a)=>{var g,b,_,S,C,v;let L=t.createDiv({cls:"csv-rr-card"}),l=L.createDiv({cls:"csv-rr-head"}),c=l.createEl("input",{cls:"csv-rr-label",type:"text",value:r.label});c.placeholder="Label (e.g. \u{1F1EA}\u{1F1FA} Schengen 90/180)",c.addEventListener("input",()=>{r.label=c.value,i()});let d=l.createEl("button",{cls:"csv-rr-del",text:"\u2715"});d.setAttr("aria-label","Remove rule"),d.addEventListener("click",()=>{(async()=>(e.splice(a,1),await this.plugin.saveSettings(),this.renderResidencyRules(t)))()});let h=L.createDiv({cls:"csv-rr-grid"}),u=(y,x,w,k="")=>{let M=h.createDiv({cls:"csv-rr-field"});M.createEl("label",{text:y});let T=M.createEl("input",{type:"text",value:x});k&&(T.placeholder=k),T.addEventListener("input",()=>{w(T.value),i()})},f=(g=r.scope.countries)!=null?g:r.scope.country?[r.scope.country]:[];u("Countries (ISO-2, comma)",f.join(", "),y=>{r.scope={countries:y.split(",").map(x=>x.trim().toUpperCase()).filter(Boolean)}},"US, GB");let p=h.createDiv({cls:"csv-rr-field"});p.createEl("label",{text:"Window"});let m=p.createEl("select");[["calendar-year","Calendar year"],["rolling","Rolling N days"],["all-time","All time"]].forEach(([y,x])=>{let w=m.createEl("option",{text:x,value:y});r.window.type===y&&(w.selected=!0)}),m.addEventListener("change",()=>{r.window={type:m.value,days:r.window.days},i(),this.renderResidencyRules(t)}),r.window.type==="rolling"&&u("Rolling days",String((b=r.window.days)!=null?b:180),y=>{let x=parseInt(y,10);r.window.days=isNaN(x)?void 0:x},"180"),u("Threshold (days)",String(r.threshold),y=>{let x=parseInt(y,10);r.threshold=isNaN(x)?0:x},"183"),u("Exempt visas (comma)",((S=(_=r.exempt)==null?void 0:_.visa_status)!=null?S:[]).join(", "),y=>{let x=y.split(",").map(w=>w.trim()).filter(Boolean);r.exempt=x.length?{visa_status:x}:void 0},"F-1, J-1"),u("On-exceed label",(C=r.onExceed)!=null?C:"",y=>{r.onExceed=y||void 0},"tax resident"),u("Note",(v=r.note)!=null?v:"",y=>{r.note=y||void 0},"optional caveat")}),t.createDiv({cls:"csv-rr-btns"}).createEl("button",{cls:"csv-rr-add",text:"+ add rule"}).addEventListener("click",()=>{(async()=>(e.push({label:"New rule",scope:{countries:[]},window:{type:"calendar-year"},threshold:183}),await this.plugin.saveSettings(),this.renderResidencyRules(t)))()})}};var be=require("obsidian"),fr=Os(ts());async function pr(s,t,e,i,n={}){var W,N,G;let o=t.split(` +`).map(R=>R.trim()).filter(Boolean),r="";for(let R of o)if(R.startsWith("file:")){r=R.replace("file:","").trim();break}if(!r){e.createEl("p",{text:"Error: No file specified. Use: file: yourfile.csv",cls:"csv-add-error"});return}let a=s.vault.getAbstractFileByPath(i.sourcePath),L=(N=(W=a==null?void 0:a.parent)==null?void 0:W.path)!=null?N:"",l=Xt(r,L),c=s.vault.getAbstractFileByPath(l);if(!c||!(c instanceof be.TFile)){e.createEl("p",{text:`Error: File not found: ${l}`,cls:"csv-add-error"});return}let d=(G=n[l])!=null?G:{},h=[],u=[];try{let R=await s.vault.read(c),Y=Mt(R);h=Y.headers,u=Y.rows}catch(R){e.createEl("p",{text:`Error reading file: ${R instanceof Error?R.message:String(R)}`,cls:"csv-add-error"});return}if(!h.length){e.createEl("p",{text:"Error: No columns found in file",cls:"csv-add-error"});return}let f=R=>{let Y=R.toLowerCase();if(["date","day","datum"].includes(Y))return!0;let K=u.slice(0,5).map(D=>{var O;return(O=D[R])!=null?O:""});return K.length>0&&K.every(D=>/^\d{4}-\d{2}-\d{2}$/.test(D))},p=R=>{let Y=R.toLowerCase();return["notes","note","comments","description","journal"].includes(Y)},m=d.habitColumns?d.habitColumns.filter(R=>h.includes(R)):h.filter(R=>!f(R)&&ns(u.map(Y=>{var K;return((K=Y[R])!=null?K:"").toLowerCase().trim()}))),g=h.filter(R=>f(R)),b=h.filter(R=>p(R)),_=h.filter(R=>!m.includes(R)&&!g.includes(R)&&!b.includes(R)),S=d.titleColumn?h.find(R=>R.toLowerCase()===d.titleColumn.toLowerCase()):h.find(R=>["title","name"].includes(R.toLowerCase())),C=e.createDiv({cls:"csv-add-form csv-add-compact"}),v=C.createEl("button",{cls:"csv-add-trigger is-hidden",text:"+ new entry"}),y=C.createDiv({cls:"csv-add-card"}),x=y.createDiv({cls:"csv-add-card-header"});x.createSpan({cls:"csv-add-card-title",text:"New entry"});let w=x.createEl("button",{cls:"csv-add-card-close",text:"\xD7"}),k=y.createDiv({cls:"csv-add-rows"}),M={},T={},A=(R,Y)=>{let K=k.createDiv({cls:`csv-add-row csv-add-row-${Y}`});return K.createSpan({cls:"csv-add-row-label",text:Dt(R)}),K};g.forEach(R=>{let K=A(R,"date").createEl("input",{cls:"csv-add-row-control",type:"date"});K.value=ge(),M[R]=K}),m.forEach(R=>{T[R]=!1;let K=A(R,"toggle").createEl("label",{cls:"csv-add-switch"}),D=K.createEl("input",{type:"checkbox",cls:"csv-add-switch-input"});K.createSpan({cls:"csv-add-switch-track"}),D.addEventListener("change",()=>{T[R]=D.checked}),M[R]=D}),_.forEach(R=>{let Y=A(R,"field"),K=new Set(u.map(O=>{var H;return((H=O[R])!=null?H:"").trim()}).filter(Boolean));if(R!==S&&(d.categoricalColumns?d.categoricalColumns.includes(R):qt(K.size))){let O=Y.createEl("select",{cls:"csv-add-row-control"});O.createEl("option",{text:"\u2014",value:""}),Array.from(K).sort().forEach(z=>O.createEl("option",{text:z,value:z})),O.createEl("option",{text:"+ custom",value:"__custom__"});let H=k.createDiv({cls:"csv-add-row csv-add-row-custom is-hidden"}),$=H.createEl("input",{cls:"csv-add-row-control",type:"text",placeholder:`Custom ${Dt(R).toLowerCase()}`});k.insertBefore(H,Y.nextSibling),O.addEventListener("change",()=>{H.classList.toggle("is-hidden",O.value!=="__custom__"),O.value==="__custom__"&&$.focus()}),M[R]=O,M[`${R}__custom`]=$}else M[R]=Y.createEl("input",{cls:"csv-add-row-control",type:"text",placeholder:Dt(R)})}),b.forEach(R=>{let Y=k.createDiv({cls:"csv-add-row csv-add-row-notes"});Y.createSpan({cls:"csv-add-row-label",text:Dt(R)}),M[R]=Y.createEl("textarea",{cls:"csv-add-row-textarea",placeholder:"Optional notes\u2026"})});let B=y.createEl("button",{text:"Add",cls:"csv-add-submit"}),I=x.querySelector(".csv-add-card-title"),P=()=>{if(!g.length)return;let R=M[g[0]];if(!R)return;let Y=R.value,K=u.find(D=>D[g[0]]===Y);I&&I.setText(K?`Updating ${Y}`:"New entry"),y.classList.toggle("is-updating",!!K),B.setText(K?"Update":"Add"),m.forEach(D=>{var $;let O=M[D];if(!O)return;let H=os(($=K==null?void 0:K[D])!=null?$:"");O.checked=H,T[D]=H}),[..._,...b].forEach(D=>{var $;let O=M[D];if(!O)return;let H=($=K==null?void 0:K[D])!=null?$:"";if(O instanceof HTMLSelectElement){let z=Array.from(O.options).find(X=>X.value===H),V=M[`${D}__custom`],Z=V==null?void 0:V.closest(".csv-add-row-custom");z?(O.value=H,Z&&Z.classList.add("is-hidden"),V&&(V.value="")):H?(O.value="__custom__",V&&(V.value=H),Z&&Z.classList.remove("is-hidden")):(O.value="",Z&&Z.classList.add("is-hidden"),V&&(V.value=""))}else O.instanceOf(HTMLTextAreaElement),O.value=H})};if(P(),g.length){let R=M[g[0]];R==null||R.addEventListener("change",P)}let E=()=>{y.classList.remove("is-hidden"),v.classList.add("is-hidden");let R=y.querySelector(".csv-add-row-control");R==null||R.focus()},j=()=>{y.classList.add("is-hidden"),v.classList.remove("is-hidden")};v.addEventListener("click",E),w.addEventListener("click",j);let F=async()=>{let R={};h.forEach(z=>{var V,Z,X,q;m.includes(z)?R[z]=T[z]?"1":"0":M[z]instanceof HTMLSelectElement&&M[z].value==="__custom__"?R[z]=(Z=(V=M[`${z}__custom`])==null?void 0:V.value)!=null?Z:"":M[z]instanceof HTMLTextAreaElement?R[z]=M[z].value:R[z]=(q=(X=M[z])==null?void 0:X.value)!=null?q:""});let Y=g.length>0&&g.some(z=>{var V;return((V=R[z])!=null?V:"").trim()}),K=[..._,...b].some(z=>{var V;return((V=R[z])!=null?V:"").trim()}),D=m.some(z=>T[z]);if(!Y&&!K&&!D){new be.Notice("Please fill at least one field");return}let O=[];try{let z=await s.vault.read(c);O=Mt(z).rows}catch(z){new be.Notice(`Error reading file: ${z instanceof Error?z.message:String(z)}`);return}let H=!1,$=-1;if(g.length>0){let z=g[0],V=R[z];if($=O.findIndex(Z=>Z[z]===V),$>=0){H=!0;let Z=O[$];h.forEach(X=>{var q;(m.includes(X)||((q=R[X])!=null?q:"").trim())&&(Z[X]=R[X])})}else O.push(R)}else O.push(R);try{let z=fr.default.unparse(O,{columns:h});await s.vault.modify(c,z),new be.Notice(H?`Updated entry for ${R[g[0]]||""}`:`Added entry to ${c.basename}`),u.length=0,u.push(...O),g.length>0?P():(m.forEach(V=>{T[V]=!1;let Z=M[V];Z&&(Z.checked=!1)}),[..._,...b].forEach(V=>{let Z=M[V];Z instanceof HTMLSelectElement?Z.selectedIndex=0:(Z.instanceOf(HTMLTextAreaElement)||Z)&&(Z.value="");let X=M[`${V}__custom`];if(X){X.value="";let q=X.closest(".csv-add-row-custom");q&&q.classList.add("is-hidden")}})),window.setTimeout(()=>{(async()=>{let V=s.vault.getAbstractFileByPath(i.sourcePath);V instanceof be.TFile&&await s.workspace.getLeaf(!1).openFile(V,{state:{mode:"preview"}})})()},300)}catch(z){new be.Notice(`Error saving: ${z instanceof Error?z.message:String(z)}`)}};B.addEventListener("click",()=>{F()})}function yi(s,t){let e=s.getFilteredRows();s.searchQuery.trim()&&t.createDiv({cls:"csv-search-results",text:`Found ${e.length} of ${s.rows.length} entries`});let n=t.createDiv({cls:"csv-table-wrapper"}).createEl("table",{cls:"csv-table"}),o=n.createEl("thead").createEl("tr");s.headers.forEach(L=>{let l=o.createEl("th");l.setText(L),l.addClass("csv-th-sortable"),s.tableSortCol===L&&l.createSpan({cls:"csv-th-sort-indicator",text:s.tableSortDir==="asc"?" \u25B2":" \u25BC"}),l.title="Click to sort",l.addEventListener("click",f=>{f.target.closest(".csv-col-resize-handle")||(s.tableSortCol!==L?(s.tableSortCol=L,s.tableSortDir="asc"):s.tableSortDir==="asc"?s.tableSortDir="desc":s.tableSortCol=null,s.renderView())});let c=s.settings.columnWidths[L];c&&(l.style.width=c+"px");let d=l.createDiv({cls:"csv-col-resize-handle"}),h=0,u=0;d.addEventListener("pointerdown",f=>{f.preventDefault(),f.stopPropagation(),d.setPointerCapture(f.pointerId),h=f.clientX,u=l.offsetWidth;let p=g=>{l.style.width=Math.max(60,u+g.clientX-h)+"px"},m=g=>{s.settings.columnWidths[L]=Math.max(60,u+g.clientX-h),d.removeEventListener("pointermove",p),d.removeEventListener("pointerup",m),s.persistSettings()};d.addEventListener("pointermove",p),d.addEventListener("pointerup",m)})}),o.createEl("th",{text:""});let r=matchMedia("(pointer: coarse)").matches,a=n.createEl("tbody");e.forEach(L=>{let l=a.createEl("tr");l.addEventListener("contextmenu",h=>s.openRowContextMenu(L,h)),s.headers.forEach(h=>{var f,p;let u=l.createEl("td");if(s.isNotesCol(h)){u.addClass("csv-table-notes-cell");let m=((f=L[h])!=null?f:"").replace(/#{1,6}\s/g,"").replace(/[*_>`]/g,"").split(` +`).filter(_=>_.trim()).slice(0,3).join(" \xB7 "),g=m?m.slice(0,200)+(m.length>200?"\u2026":""):"+ Add note",b=u.createSpan({text:g});m||b.addClass("csv-table-notes-empty"),u.title="Click to open note",u.addEventListener("click",_=>{_.stopPropagation(),s.openNoteExpander(L,h)})}else if(s.isSelectCol(h))s.renderSelectField(u,L,h);else{let m=(p=L[h])!=null?p:"";u.setText(m),m.length>80&&(u.title=m),Bs(s,u,L,h)}});let c=l.createEl("td",{cls:"csv-table-action"}),d=s.notesFileExists(L);c.createEl("button",{cls:`csv-table-notes-btn ${d?"exists":""}`,text:d?"\u{1F4C4}":"\u271A",title:d?"Open notes":"Create notes"}).addEventListener("click",()=>void s.openOrCreateNotes(L)),c.createEl("button",{cls:"csv-table-del-btn",text:"\u2715",title:"Delete row (undo available)"}).addEventListener("click",()=>s.deleteWithUndo(L))}),r||window.requestAnimationFrame(()=>{a.querySelectorAll("td:not(.csv-table-notes-cell):not(.csv-table-action)").forEach(L=>{L.scrollHeight>L.clientHeight+1&&L.addClass("csv-cell--clipped")})})}function Bs(s,t,e,i){t.addEventListener("click",n=>{var d,h;if(t.querySelector("input"))return;t.empty();let o=(d=s.fileCfg.dateColumns)==null?void 0:d.includes(i),r=((h=e[i])!=null?h:"").trim(),a=o||kt(i)&&(r===""||fi.test(r)),L=a?r.slice(0,10):r,l=t.createEl("input",{cls:"csv-inline-input",value:L,type:a?"date":"text"});l.focus(),a||l.select(),l.addEventListener("click",u=>u.stopPropagation());let c=!1;l.addEventListener("blur",()=>{var u;!c&&l.value!==L&&(e[i]=l.value,s.scheduleSave()),t.empty(),t.setText(((u=e[i])!=null?u:"")||"\u2014")}),l.addEventListener("keydown",u=>{u.key==="Enter"&&l.blur(),u.key==="Escape"&&(c=!0,l.blur())})})}function xi(s){return!!(s.getCategoryCol()||s.getStatusCol()||gr(s)||s.authorKey())}function gr(s){return s.resolveCol(["Rating","rating","Score","score","Score /5","Stars","stars"])}function zs(s){var n;let t=(s!=null?s:"").trim();if(!t)return null;let e=((n=t.match(/★/g))!=null?n:[]).length;if(e>0)return e;let i=parseFloat(t);return isNaN(i)||i<=0?null:Math.min(5,i)}var mr=["watched","read","finished","completed","done","yes","seen"],br=["watching","reading","in progress","in-progress"],ql=["dropped","abandoned","dnf"];function Xl(s){let t=s.toLowerCase();return mr.includes(t)?"is-done":br.includes(t)?"is-progress":ql.includes(t)?"is-dropped":""}function Ns(s,t){let e=new Map;return s.forEach(i=>t(i).forEach(n=>{var o;return e.set(n,((o=e.get(n))!=null?o:0)+1)})),e}function $s(s,t,e,i){if(!e.length)return;let n=s.createDiv({cls:"csv-stats-section"});n.createDiv({cls:"csv-stats-section-title",text:t});let o=Math.max(...e.map(r=>r.count));e.forEach(r=>{var d;let a=n.createDiv({cls:"csv-stats-bar-row"});a.createDiv({cls:"csv-stats-bar-label",text:r.label,attr:{title:r.label}});let l=a.createDiv({cls:"csv-stats-bar-track"}).createDiv({cls:`csv-stats-bar-fill ${(d=r.cls)!=null?d:""}`});l.style.width=`${Math.max(2,Math.round(r.count/o*100))}%`;let c=i>0?Math.round(r.count/i*100):0;a.createDiv({cls:"csv-stats-bar-count",text:`${r.count} \xB7 ${c}%`}),r.onClick&&(a.addClass("is-clickable"),a.title=`Show "${r.label}" in the library`,a.addEventListener("click",r.onClick))})}function vr(s,t){let e=s.getFilteredRows();if(s.searchQuery.trim()&&t.createDiv({cls:"csv-search-results",text:`Stats over ${e.length} of ${s.rows.length} entries`}),!e.length){t.createEl("p",{text:"No entries to chart.",cls:"csv-empty-state"});return}let i=t.createDiv({cls:"csv-stats-wrap"}),n=s.getStatusCol(),o=s.getCategoryCol(),r=gr(s),a=s.authorKey(),L=s.resolveCol(["Year","year"]),l=i.createDiv({cls:"csv-stats-overview"}),c=(h,u)=>{let f=l.createDiv({cls:"csv-stats-chip"});f.createDiv({cls:"csv-stats-chip-value",text:h}),f.createDiv({cls:"csv-stats-chip-label",text:u})};if(c(String(e.length),"entries"),n){let h=e.filter(f=>{var p;return mr.includes(((p=f[n])!=null?p:"").toLowerCase().trim())}).length;h>0&&c(`${h} \xB7 ${Math.round(h/e.length*100)}%`,"done");let u=e.filter(f=>{var p;return br.includes(((p=f[n])!=null?p:"").toLowerCase().trim())}).length;u>0&&c(String(u),"in progress")}if(o){let h=Ns(e,u=>{var f;return((f=u[o])!=null?f:"").split(",").map(p=>p.trim()).filter(Boolean)});h.size>0&&c(String(h.size),o.toLowerCase()==="genre"||o.toLowerCase()==="genres"?"genres":"categories")}if(r){let h=e.map(u=>zs(u[r])).filter(u=>u!==null);if(h.length){let u=h.reduce((f,p)=>f+p,0)/h.length;c(`\u2605 ${u.toFixed(1)}`,`avg of ${h.length} rated`)}}let d=(h,u)=>{s.libraryStatusFilter=h!=null?h:"all",s.libraryGenreFilter=u!=null?u:"all",s.mode="library",s.renderView()};if(n){let h=Ns(e,f=>{var m;let p=((m=f[n])!=null?m:"").trim();return p?[p]:[]}),u=Array.from(h.entries()).sort((f,p)=>p[1]-f[1]).map(([f,p])=>({label:f,count:p,cls:Xl(f),onClick:o?()=>d(f,null):void 0}));$s(i,`By ${n.toLowerCase()}`,u,e.length)}if(o){let h=Ns(e,f=>{var p;return((p=f[o])!=null?p:"").split(",").map(m=>m.trim()).filter(Boolean)}),u=Array.from(h.entries()).sort((f,p)=>p[1]-f[1]||f[0].localeCompare(p[0])).slice(0,12).map(([f,p])=>({label:f,count:p,onClick:()=>d(null,f)}));$s(i,`By ${o.toLowerCase()}`,u,e.length)}if(r){let h=new Map,u=0;if(e.forEach(f=>{var g;let p=zs(f[r]);if(p===null)return;let m=Math.min(5,Math.max(1,Math.round(p)));h.set(m,((g=h.get(m))!=null?g:0)+1),u++}),u>0){let f=[5,4,3,2,1].filter(p=>{var m;return((m=h.get(p))!=null?m:0)>0}).map(p=>({label:"\u2605".repeat(p),count:h.get(p),cls:"is-rating"}));$s(i,"Ratings",f,u)}}if(L){let h=Ns(e,u=>{var p;let f=((p=u[L])!=null?p:"").match(/\d{4}/);return f?[f[0]]:[]});if(h.size>1){let u=Array.from(h.entries()).sort((f,p)=>f[0].localeCompare(p[0])).map(([f,p])=>({label:f,count:p}));$s(i,"By year",u,e.length)}}if(a){let h=Ns(e,f=>{var m;let p=((m=f[a])!=null?m:"").trim();return p?[p]:[]}),u=Array.from(h.entries()).filter(([,f])=>f>1);if(u.length>=2){let f=u.sort((p,m)=>m[1]-p[1]||p[0].localeCompare(m[0])).slice(0,8).map(([p,m])=>({label:p,count:m}));$s(i,`Top ${a.toLowerCase()}s`,f,e.length)}}}function zt(s){let t=s.fileCfg.kanbanGroupCol;if(t&&s.headers.includes(t))return t;let e=s.getCategoryCol();if(e)return e;let i=new Set;s.headers.forEach(r=>{s.isNotesCol(r)&&i.add(r)});let n=s.getDateCol();n&&i.add(n);let o=s.titleKey();return o&&i.add(o),ir(s.headers,s.rows,i)}function Ci(s,t){let e=zt(s);if(!e){t.createEl("p",{text:"No groupable column found.",cls:"csv-empty-state"});return}let i=s.getCategoryCol(),n=s.getStatusCol(),o=n===e?null:n,r=s.getFilteredRows();s.searchQuery.trim()&&t.createDiv({cls:"csv-search-results",text:`Found ${r.length} of ${s.rows.length} entries`});let a=t.createDiv({cls:"csv-kanban-groupbar"});a.createSpan({cls:"csv-kanban-groupbar-label",text:"Group by"});let L=a.createEl("select",{cls:"csv-library-filter-select"});s.headers.filter(m=>!s.isNotesCol(m)).forEach(m=>{let g=L.createEl("option",{text:m===i?`${m} (default)`:m,value:m});m===e&&(g.selected=!0)}),L.addEventListener("change",()=>{let m=s.fileCfg;m.kanbanGroupCol=L.value===i?void 0:L.value,s.saveFileCfg(m),s.renderView(!0)});let l=er(e,r.map(m=>{var g;return(g=m[e])!=null?g:""})),c=m=>{var _;let g=(_=m[e])!=null?_:"",b;if(l){let S=sr(g);b=S?[S]:[]}else b=g.split(",").map(S=>S.trim()).filter(Boolean);return b.length||(b=["\u2014"]),b},d=new Set;r.forEach(m=>c(m).forEach(g=>d.add(g)));let h=Array.from(d).sort();if(!h.length){let m=t.createDiv({cls:"csv-empty-state"});m.createEl("p",{text:s.searchQuery?"No matching entries found.":`No "${e}" values found.`}),s.searchQuery&&m.createEl("button",{cls:"csv-clear-filters-btn",text:"Clear search"}).addEventListener("click",()=>{s.searchQuery="",s.renderView()});return}let u=["In progress","Finished","Not started"],f=o?Array.from(new Set([...u,...r.map(m=>{var g;return(g=m[o])!=null?g:""}).filter(Boolean)])).filter(m=>r.some(g=>{var b;return((b=g[o])!=null?b:"")==m})):[],p=t.createDiv({cls:"csv-kanban-board"});h.forEach(m=>{let g=r.filter(C=>c(C).includes(m));if(!g.length)return;let b=p.createDiv({cls:"csv-kanban-col"}),_=b.createDiv({cls:"csv-kanban-col-header"});_.createDiv({cls:"csv-kanban-col-title",text:m}),_.createDiv({cls:"csv-kanban-col-count",text:String(g.length)});let S=b.createDiv({cls:"csv-kanban-col-body"});if(o&&f.length){f.forEach(y=>{let x=g.filter(k=>{var M;return((M=k[o])!=null?M:"")===y});if(!x.length)return;let w=S.createDiv({cls:"csv-kanban-status-group"});w.createDiv({cls:`csv-kanban-status-label status-${y.toLowerCase().replace(/\s+/g,"-")}`,text:y}),x.forEach(k=>En(s,w,k,o,e))});let C=new Set(f),v=g.filter(y=>{var x;return!C.has((x=y[o])!=null?x:"")});if(v.length){let y=S.createDiv({cls:"csv-kanban-status-group"});y.createDiv({cls:"csv-kanban-status-label",text:"\u2014"}),v.forEach(x=>En(s,y,x,o,e))}}else g.forEach(C=>En(s,S,C,o,e))})}function En(s,t,e,i,n){var x,w,k,M,T,A,B,I;let o=t.createDiv({cls:"csv-kanban-card"}),r=s.getNotesCol(),a=(w=(x=s.getImageCol)==null?void 0:x.call(s))!=null?w:null;if(a){let P=ui(s.app,(k=e[a])!=null?k:"",(T=(M=s.file)==null?void 0:M.path)!=null?T:"");if(P){let E=o.createEl("img",{cls:"csv-kanban-card-img",attr:{src:P,loading:"lazy",alt:""}});E.addEventListener("error",()=>E.remove())}}let L=o.createDiv({cls:"csv-kanban-card-title-row"});L.createDiv({cls:`csv-kanban-card-title ${(A=s.isHighlighted)!=null&&A.call(s,e)?"csv-title-highlight":""}`,text:s.getTitle(e)}).addEventListener("click",P=>{P.stopPropagation(),s.openNoteExpander(e,r!=null?r:"")});let c=s.notesFileExists(e);L.createEl("button",{cls:`csv-kanban-notes-icon ${c?"exists":""}`,text:c?"\u{1F4C4}":"+",title:c?"Open notes file":"Create notes file"}).addEventListener("click",P=>{P.stopPropagation(),s.openOrCreateNotes(e)});let h=s.getSubtitle(e);h&&o.createDiv({cls:"csv-kanban-card-sub",text:h});let u=s.titleKey(),f=s.authorKey(),p=new Set([i,u,f,n].filter(Boolean)),m=o.createDiv({cls:"csv-kanban-card-meta"});((B=s.fileCfg.cardFields)!=null?B:s.headers).forEach(P=>{if(!s.headers.includes(P)||p.has(P)||s.isNotesCol(P))return;let E=m.createDiv({cls:"csv-kanban-chip"});if(E.createSpan({cls:"csv-chip-label",text:P+": "}),s.isSelectCol(P)){let j=E.createSpan({cls:`csv-chip-value csv-chip-select${e[P]?"":" csv-chip-value--empty"}`,text:e[P]||"\u2014"});j.addEventListener("click",F=>{F.stopPropagation(),Bt(j,e[P],s.getColumnValues(P),W=>{e[P]=W,j.setText(W||"\u2014"),j.classList.toggle("csv-chip-value--empty",!W),s.scheduleSave()},s.contentEl,{multi:vt(P)})})}else{let j=e[P]?e[P].length>40?e[P].slice(0,38)+"\u2026":e[P]:"\u2014",F=E.createSpan({cls:`csv-chip-value${e[P]?"":" csv-chip-value--empty"}`,text:j});e[P]&&e[P].length>40&&(F.title=e[P])}});let b=s.getNotesCol(),_=!!(b&&((I=e[b])!=null&&I.trim())),S=o.createDiv({cls:"csv-kanban-notes-preview"});if(_&&b){let P=e[b].replace(/#{1,6}\s/g,"").replace(/[*_>`]/g,"").replace(/\n+/g," ").trim();S.setText(P.slice(0,120)+(P.length>120?"\u2026":"")),S.title="Click to edit"}else S.addClass("csv-kanban-notes-preview--empty"),b&&S.setText("+ add note");let C=o.createDiv({cls:"csv-kanban-notes-editor is-hidden"}),v=()=>{var R,Y,K;let P=s.contentEl.querySelector(".csv-content-area"),E=(R=P==null?void 0:P.scrollLeft)!=null?R:0,j=(Y=P==null?void 0:P.scrollTop)!=null?Y:0;S.classList.add("is-hidden"),C.classList.remove("is-hidden"),C.empty();let F=C.createEl("textarea",{cls:"csv-notes-textarea"});F.value=(K=b?e[b]:"")!=null?K:"",F.addEventListener("click",D=>D.stopPropagation()),F.addEventListener("mousedown",D=>D.stopPropagation()),F.addEventListener("input",()=>{F.style.removeProperty("height"),F.style.height=F.scrollHeight+"px"});let W=F.value,N=!1,G=D=>{N||(N=!0,y(D,P,E,j))};F.addEventListener("keydown",D=>{D.key==="Escape"&&G(W)}),F.addEventListener("blur",()=>G(F.value)),F.focus({preventScroll:!0}),F.setSelectionRange(0,0),F.scrollTop=0,window.requestAnimationFrame(()=>{F.style.removeProperty("height"),F.style.height=Math.max(120,F.scrollHeight)+"px"})},y=(P,E,j,F)=>{var W;if(b&&P!==((W=e[b])!=null?W:"")&&(e[b]=P,s.scheduleSave()),C.classList.add("is-hidden"),S.classList.remove("is-hidden"),P.trim()){let N=P.replace(/#{1,6}\s/g,"").replace(/[*_>`]/g,"").replace(/\n+/g," ").trim();S.setText(N.slice(0,120)+(N.length>120?"\u2026":"")),S.removeClass("csv-kanban-notes-preview--empty"),S.title="Click to edit"}else S.addClass("csv-kanban-notes-preview--empty"),S.setText(b?"+ add note":""),S.removeAttribute("title");E&&(E.scrollLeft=j,E.scrollTop=F,window.requestAnimationFrame(()=>{E.scrollLeft=j,E.scrollTop=F,window.requestAnimationFrame(()=>{E.scrollLeft=j,E.scrollTop=F})}),window.setTimeout(()=>{E.scrollLeft=j,E.scrollTop=F},50))};S.addEventListener("click",P=>{if(P.stopPropagation(),b&&matchMedia("(pointer: coarse)").matches){s.openNoteExpander(e,b);return}v()}),o.addEventListener("contextmenu",P=>s.openRowContextMenu(e,P))}function _i(s,t){var x,w;let e=zt(s),i=s.getStatusCol(),n=(x=s.titleKey())!=null?x:s.headers[0];if(!e){t.createEl("p",{text:"No groupable column found.",cls:"csv-empty-state"});return}let o=new Set;s.rows.forEach(k=>{var T;((T=k[e])!=null?T:"").split(",").map(A=>A.trim()).filter(Boolean).forEach(A=>o.add(A))});let r=new Set;i&&s.rows.forEach(k=>{var T;let M=((T=k[i])!=null?T:"").trim();M&&r.add(M)});let a=t.createDiv({cls:"csv-library-filters"}),L=a.createEl("select",{cls:"csv-library-filter-select"});L.createEl("option",{text:"All",value:"all"});let l=["watched","read","finished","completed","done","yes","seen"],c=["watching","reading","in progress","in-progress"],d=Array.from(r).some(k=>l.includes(k.toLowerCase())),h=Array.from(r).some(k=>c.includes(k.toLowerCase()));(d||h)&&(L.createEl("option",{text:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500",value:"",attr:{disabled:"true"}}),d&&L.createEl("option",{text:"\u2713 done",value:"__done__"}),h&&L.createEl("option",{text:"\u25D0 in progress",value:"__inprogress__"}),L.createEl("option",{text:"\u25CB not started",value:"__notstarted__"})),r.size>0&&(L.createEl("option",{text:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500",value:"",attr:{disabled:"true"}}),Array.from(r).sort().forEach(k=>{L.createEl("option",{text:k,value:k})})),L.value=s.libraryStatusFilter;let u=a.createEl("select",{cls:"csv-library-filter-select"});u.createEl("option",{text:"All genres",value:"all"}),Array.from(o).sort().forEach(k=>{u.createEl("option",{text:k,value:k})}),u.value=s.libraryGenreFilter;let f=s.resolveCol(["Year","year","Date","date"]),p=s.resolveCol(["Rating","rating","Score","score","Score /5","Stars","stars"]),m=s.resolveCol(["Theme","theme","Tags","tags","Tag","tag","Mood","mood"]),g=(w=s.fileCfg.librarySort)!=null?w:"status",b=a.createEl("select",{cls:"csv-library-filter-select"}),_=[["status","Sort: Status"],["title","Sort: Title"]];p&&_.push(["rating","Sort: Rating"]),f&&_.push(["year","Sort: Year"]),_.forEach(([k,M])=>{let T=b.createEl("option",{text:M,value:k});k===g&&(T.selected=!0)}),b.addEventListener("change",()=>{let k=s.fileCfg;k.librarySort=b.value==="status"?void 0:b.value,s.saveFileCfg(k),s.renderView(!0)});let S=()=>{s.libraryStatusFilter=L.value,s.libraryGenreFilter=u.value,s.renderView(!0)};L.addEventListener("change",S),u.addEventListener("change",S);let C=s.rows.filter(k=>{var M,T;if(s.libraryStatusFilter!=="all"&&i){let A=((M=k[i])!=null?M:"").toLowerCase();if(s.libraryStatusFilter==="__done__"){if(!l.includes(A))return!1}else if(s.libraryStatusFilter==="__inprogress__"){if(!c.includes(A))return!1}else if(s.libraryStatusFilter==="__notstarted__"){if(l.includes(A)||c.includes(A))return!1}else if(A!==s.libraryStatusFilter.toLowerCase())return!1}if(s.libraryGenreFilter!=="all"&&!((T=k[e])!=null?T:"").split(",").map(B=>B.trim().toLowerCase()).includes(s.libraryGenreFilter.toLowerCase()))return!1;if(s.searchQuery.trim()){let A=s.searchQuery.toLowerCase().trim();if(!s.headers.some(B=>{var I;return((I=k[B])!=null?I:"").toLowerCase().includes(A)}))return!1}return!0});(s.libraryStatusFilter!=="all"||s.libraryGenreFilter!=="all"||s.searchQuery.trim())&&t.createDiv({cls:"csv-library-result-count",text:`Showing ${C.length} of ${s.rows.length} entries`});let v={};C.forEach(k=>{var T;let M=s.libraryGenreFilter!=="all"?[s.libraryGenreFilter]:((T=k[e])!=null?T:"Uncategorized").split(",").map(A=>A.trim()).filter(Boolean);M.length===0&&M.push("Uncategorized"),M.forEach(A=>{v[A]||(v[A]=[]),v[A].push(k)})});let y=t.createDiv({cls:"csv-library-sections"});if(Object.keys(v).sort().forEach(k=>{var N,G,R,Y,K;let M=v[k],T=y.createEl("details",{cls:"csv-library-section"}),A=k.toLowerCase(),B=((N=s.fileCfg.collapsedGroups)!=null?N:[]).map(D=>D.toLowerCase());T.open=!((G=s.collapsedGroups)!=null&&G.has(A)||B.includes(A)),T.addEventListener("toggle",()=>{var z;let D=s.fileCfg,O=((z=D.collapsedGroups)!=null?z:[]).map(V=>V.toLowerCase()),H=new Set(O);T.open?H.delete(A):H.add(A);let $=Array.from(H);$.length===O.length&&$.every(V=>O.includes(V))||(D.collapsedGroups=$,s.saveFileCfg(D))});let I=T.createEl("summary",{cls:"csv-library-section-header"});I.createSpan({cls:"csv-library-arrow",text:"\u25B6"}),I.createSpan({text:` ${k} `}),I.createSpan({cls:"csv-library-count",text:String(M.length)});let P=T.createDiv({cls:"csv-library-grid"}),E=(D,O)=>{var H,$;return((H=D[n])!=null?H:"").localeCompare(($=O[n])!=null?$:"")},j=(D,O)=>D===null&&O===null?0:D===null?1:O===null?-1:O-D;M.sort((D,O)=>{var H,$,z,V;if(g==="title")return E(D,O);if(g==="rating"&&p)return j(zs((H=D[p])!=null?H:""),zs(($=O[p])!=null?$:""))||E(D,O);if(g==="year"&&f){let Z=X=>{var it;let q=((it=X[f])!=null?it:"").match(/\d{4}/);return q?parseInt(q[0],10):null};return j(Z(D),Z(O))||E(D,O)}if(i){let Z=((z=D[i])!=null?z:"").toLowerCase(),X=((V=O[i])!=null?V:"").toLowerCase(),q=l.includes(Z),it=l.includes(X);if(q!==it)return q?-1:1;let Q=c.includes(Z),et=c.includes(X);if(Q!==et)return Q?-1:1}return E(D,O)});let F=(R=s.fileCfg.cardFields)!=null?R:s.headers,W=(K=(Y=s.getImageCol)==null?void 0:Y.call(s))!=null?K:null;M.forEach(D=>{var V,Z,X,q,it,Q,et,lt;let O=P.createDiv({cls:"csv-library-card"});if(W){let ot=ui(s.app,(V=D[W])!=null?V:"",(X=(Z=s.file)==null?void 0:Z.path)!=null?X:"");if(ot){let Lt=O.createEl("img",{cls:"csv-library-card-img",attr:{src:ot,loading:"lazy",alt:""}});Lt.addEventListener("error",()=>Lt.remove())}}let H=O.createDiv({cls:`csv-library-card-title ${(q=s.isHighlighted)!=null&&q.call(s,D)?"csv-title-highlight":""}`});if(i){let ot=((it=D[i])!=null?it:"").toLowerCase();l.includes(ot)&&H.createSpan({cls:"csv-library-done-dot"})}H.createSpan({text:(Q=D[n])!=null?Q:"Untitled"});let $=[],z=[];for(let ot of F){if(!ot)continue;let Lt=String((et=D[ot])!=null?et:"").trim();if(Lt)if(ot===p){let Vt=tr(Lt,ot);Vt&&O.createDiv({cls:"csv-library-card-rating",text:Vt})}else if(ot===m)z.push(...Lt.split(",").map(Vt=>Vt.trim()).filter(Boolean));else if(ot===f){let Vt=Lt.match(/\d{4}/);$.push(Vt?Vt[0]:Lt)}else $.push(Lt)}if($.length&&O.createDiv({cls:"csv-library-card-meta",text:$.join(" \xB7 ")}),s.libraryGenreFilter!=="all"){let ot=((lt=D[e])!=null?lt:"").split(",").map(Lt=>Lt.trim()).filter(Lt=>Lt&&Lt.toLowerCase()!==s.libraryGenreFilter.toLowerCase());z.push(...ot)}if(z.length){let ot=O.createDiv({cls:"csv-library-card-tags"});z.slice(0,3).forEach(Lt=>{ot.createSpan({cls:"csv-library-card-tag",text:Lt})})}O.addEventListener("click",()=>{var ot;s.openNoteExpander(D,(ot=s.getNotesCol())!=null?ot:"")}),O.addEventListener("contextmenu",ot=>s.openRowContextMenu(D,ot))})}),Object.keys(v).length===0){let k=y.createDiv({cls:"csv-empty-state"});k.createEl("p",{text:"No entries match your filters."}),k.createEl("button",{cls:"csv-clear-filters-btn",text:"Clear filters"}).addEventListener("click",()=>{s.libraryStatusFilter="all",s.libraryGenreFilter="all",s.searchQuery="",s.renderView()})}}var mn=require("obsidian");var ve=require("obsidian"),Ql="http://127.0.0.1:8765",Jl=6;async function yr(s,t){let e;try{e=await(0,ve.requestUrl)({url:Ql,method:"POST",contentType:"application/json",body:JSON.stringify({action:s,version:Jl,params:t}),throw:!1})}catch(n){throw new Error("Couldn't reach Anki. Is the desktop app open with the AnkiConnect add-on installed?")}let i=e.json;if(i.error)throw new Error(i.error);return i.result}function Tn(s){var t,e,i;return(i=(e=(t=s.titleKey())!=null?t:s.resolveCol(["Quote","Headline","Phrase","Term","Word","Question","Front","Name","Title"]))!=null?e:s.headers[0])!=null?i:null}function tc(s){let t=s.fileCfg.ankiFrontCol;return t&&s.headers.includes(t)?t:Tn(s)}function Dn(s){return s.replace(/&/g,"&").replace(//g,">")}function ec(s,t,e){return s.headers.filter(i=>{var n;return i!==e&&((n=t[i])!=null?n:"").trim()}).map(i=>`${Dn(i)}: ${Dn(t[i].trim())}`).join("
")}async function xr(s){if(!s.file)return;let t=tc(s);if(!t){new ve.Notice("No column to use as the Anki card front.",6e3);return}let e=s.file.basename,i=s.rows.filter(o=>{var r;return((r=o[t])!=null?r:"").trim()});if(!i.length){new ve.Notice(`Nothing to sync \u2014 no rows with a "${t}" value.`,6e3);return}let n=new ve.Notice(`Syncing ${i.length} cards to Anki deck \u201C${e}\u201D\u2026`,0);try{await yr("createDeck",{deck:e});let o=i.map(l=>({deckName:e,modelName:"Basic",fields:{Front:Dn(l[t].trim()),Back:ec(s,l,t)},options:{allowDuplicate:!1,duplicateScope:"deck"},tags:["datadeck"]})),r=await yr("addNotes",{notes:o}),a=r.filter(l=>l!=null).length,L=r.length-a;n.hide(),new ve.Notice(`Anki sync: ${a} added${L?`, ${L} already present`:""} (deck \u201C${e}\u201D).`,6e3)}catch(o){n.hide(),new ve.Notice(`Anki sync failed: ${o instanceof Error?o.message:String(o)}`,8e3)}}var Qe=require("obsidian");var Io=null;async function Xe(){if(Io)return Io;let s=await Promise.resolve().then(()=>(qL(),KL));return s.Chart.register(s.LineController,s.ScatterController,s.BarController,s.LineElement,s.PointElement,s.BarElement,s.LinearScale,s.CategoryScale,s.Filler,s.Tooltip,s.Legend),Io=s,s}var XL={pi:Math.PI,e:Math.E},QL={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,sqrt:Math.sqrt,log:Math.log10,ln:Math.log,exp:Math.exp,abs:Math.abs,floor:Math.floor,ceil:Math.ceil,round:Math.round,sign:Math.sign},Vo={min:Math.min,max:Math.max,pow:Math.pow,atan2:Math.atan2};function xd(s){let t=[],e=0;for(;e{var h;return(h=e[i])!=null?h:null},o=()=>{var h;return(h=e[i++])!=null?h:null};function r(){let h=a();for(;;){let u=n();if((u==null?void 0:u.kind)==="op"&&(u.op==="+"||u.op==="-")){i++;let f=a(),p=h;h=u.op==="+"?g=>p(g)+f(g):g=>p(g)-f(g)}else return h}}function a(){let h=L();for(;;){let u=n();if((u==null?void 0:u.kind)==="op"&&(u.op==="*"||u.op==="/"||u.op==="%")){i++;let f=L(),p=h,m=u.op;h=m==="*"?g=>p(g)*f(g):m==="/"?g=>p(g)/f(g):g=>p(g)%f(g)}else if(u&&(u.kind==="num"||u.kind==="ident"||u.kind==="lparen")){let f=L(),p=h;h=m=>p(m)*f(m)}else return h}}function L(){let h=n();if((h==null?void 0:h.kind)==="op"&&h.op==="-"){i++;let u=L();return f=>-u(f)}return(h==null?void 0:h.kind)==="op"&&h.op==="+"?(i++,L()):l()}function l(){let h=c(),u=n();if((u==null?void 0:u.kind)==="op"&&u.op==="^"){i++;let f=L();return p=>Math.pow(h(p),f(p))}return h}function c(){var u,f,p,m,g;let h=o();if(!h)throw new Error("Unexpected end of formula");if(h.kind==="num"){let b=h.value;return()=>b}if(h.kind==="lparen"){let b=r();if(((u=o())==null?void 0:u.kind)!=="rparen")throw new Error("Missing closing )");return b}if(h.kind==="ident"){if(h.name==="x")return _=>_;if(h.name in XL){let _=XL[h.name];return()=>_}let b=((f=n())==null?void 0:f.kind)==="lparen";if(h.name in QL||h.name in Vo){if(!b)throw new Error(`${h.name} needs parentheses, e.g. ${h.name}(x)`);i++;let _=r();if(h.name in Vo){if(((p=o())==null?void 0:p.kind)!=="comma")throw new Error(`${h.name}(a, b) needs two arguments`);let C=r();if(((m=o())==null?void 0:m.kind)!=="rparen")throw new Error("Missing closing )");let v=Vo[h.name];return y=>v(_(y),C(y))}if(((g=o())==null?void 0:g.kind)!=="rparen")throw new Error("Missing closing )");let S=QL[h.name];return C=>S(_(C))}throw new Error(`Unknown name "${h.name}" \u2014 use x, pi, e, or a function like sin()`)}throw new Error(`Unexpected "${h.kind==="op"?h.op:h.kind}"`)}let d=r();if(i{var o;let i=0,n=0;for(let r of t){let a=((o=r[e])!=null?o:"").trim();a&&(i++,ci(a)!==null&&n++)}return n>=2&&n/i>=.7})}function Cd(s){let t=s.length;if(t<2)return null;let e=0,i=0,n=0,o=0;for(let h of s)e+=h.x,i+=h.y,n+=h.x*h.x,o+=h.x*h.y;let r=t*n-e*e;if(r===0)return null;let a=(t*o-e*i)/r,L=(i-a*e)/t,l=i/t,c=0,d=0;for(let h of s){let u=h.y-(a*h.x+L);c+=u*u,d+=(h.y-l)*(h.y-l)}return{slope:a,intercept:L,r2:d===0?1:1-c/d}}function _d(s,t){let e=[...s].sort((o,r)=>o.x-r.x),i=t/2,n=0;return e.map(o=>{for(;n{let r=new Date(o);if(t==="month")return new Date(r.getFullYear(),r.getMonth(),1).getTime();let a=(r.getDay()+6)%7;return new Date(r.getFullYear(),r.getMonth(),r.getDate()-a).getTime()},n=new Map;return s.forEach(o=>{var L;let r=i(o.x),a=(L=n.get(r))!=null?L:{sum:0,n:0};a.sum+=o.y,a.n+=1,n.set(r,a)}),[...n.entries()].sort((o,r)=>o[0]-r[0]).map(([o,r])=>({x:o,y:e==="count"?r.n:e==="sum"?r.sum:r.sum/r.n}))}function Ts(s){var i;let t=(i=s.ownerDocument.defaultView)==null?void 0:i.getComputedStyle(s),e=(n,o)=>(t==null?void 0:t.getPropertyValue(n).trim())||o;return{accent:e("--interactive-accent","#378ADD"),muted:e("--text-muted","#888888"),grid:e("--background-modifier-border","rgba(128,128,128,0.25)"),fitLine:e("--text-faint","#999999"),formula:e("--color-orange","#e0883a"),series:[e("--color-blue","#4e79a7"),e("--color-green","#59a14f"),e("--color-red","#e15759"),e("--color-purple","#b07aa1"),e("--color-cyan","#76b7b2"),e("--color-pink","#ff9da7"),e("--color-yellow","#edc948")]}}var Ds=s=>{if(!Number.isFinite(s))return String(s);let t=Math.abs(s);return t!==0&&(t>=1e6||t<.001)?s.toExponential(2):String(Math.round(s*1e3)/1e3)},tl=s=>{let t=new Date(s);return isNaN(t.getTime())?String(s):ge(t)};function dn(s,t){var m,g;let e=[],i=s.series.length>1,n=s.series.flatMap(b=>b.points),o=n.map(b=>b.x),r=n.length?Math.min(...o):(m=s.xMin)!=null?m:0,a=n.length?Math.max(...o):(g=s.xMax)!=null?g:10,L=n.filter(b=>b.size!==void 0),l=L.length?Math.min(...L.map(b=>b.size)):0,c=L.length?Math.max(...L.map(b=>b.size)):0,d=(b,_)=>b.size===void 0?_:c===l?7:3+11*Math.sqrt((b.size-l)/(c-l)),h=[];s.series.forEach((b,_)=>{var y;let S=s.connect?[...b.points].sort((x,w)=>x.x-w.x):b.points;if(!S.length)return;let C=i?t.series[_%t.series.length]:t.accent,v=s.connect?3:4;if(((y=s.smoothDays)!=null?y:0)>0?(e.push({type:"scatter",label:b.label||s.yLabel,csvSkipLegend:!0,data:S,backgroundColor:C,borderColor:C,pointRadius:2.5,pointHoverRadius:5}),e.push({type:"line",label:b.label||s.yLabel,data:_d(S,s.smoothDays*864e5),borderColor:C,backgroundColor:C,borderWidth:2,pointRadius:0,pointHitRadius:0,tension:.3})):e.push({type:s.connect?"line":"scatter",label:b.label||s.yLabel,data:S,backgroundColor:C,borderColor:C,borderWidth:1.5,pointRadius:L.length?S.map(x=>d(x,v)):v,pointHoverRadius:L.length?S.map(x=>d(x,v)+2):6,tension:.3}),s.fit==="linear"){let x=Cd(S),w=S.map(T=>T.x),k=Math.min(...w),M=Math.max(...w);if(x&&M>k){e.push({type:"line",label:`${b.label||"Best"} fit`,csvIsFit:!0,data:[{x:k,y:x.slope*k+x.intercept},{x:M,y:x.slope*M+x.intercept}],borderColor:i?C:t.fitLine,borderDash:[6,4],borderWidth:1.5,pointRadius:0,pointHitRadius:0});let T=` \xB7 R\xB2 = ${(Math.round(x.r2*1e3)/1e3).toFixed(3)}`,A=s.xIsDate?`${x.slope*864e5>=0?"+":""}${Ds(x.slope*864e5)} ${s.yLabel}/day${T}`:`y = ${Ds(x.slope)}x ${x.intercept>=0?"+":"\u2212"} ${Ds(Math.abs(x.intercept))}${T}`;h.push(i?`${b.label}: ${A}`:s.xIsDate?`Trend: ${A}`:A)}}});let u=h.length?h.join(" \xB7 "):null,f=null;if(s.formula.trim())try{let b=JL(s.formula),_=[],S=160;for(let C=0;C<=S;C++){let v=r+(a-r)*C/S,y=b(v);Number.isFinite(y)&&_.push({x:v,y})}_.length&&e.push({type:"line",label:s.formula.trim(),data:_,borderColor:t.formula,borderWidth:1.5,pointRadius:0,pointHitRadius:0,tension:0})}catch(b){f=b instanceof Error?b.message:String(b)}return{config:{type:"scatter",data:{datasets:e},options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{type:"linear",title:{display:!s.xIsDate&&!!s.xLabel,text:s.xLabel,color:t.muted},ticks:{color:t.muted,...s.xIsDate?{callback:b=>tl(Number(b)),maxTicksLimit:8}:{}},grid:{color:t.grid}},y:{title:{display:!!s.yLabel,text:s.yLabel,color:t.muted},ticks:{color:t.muted},grid:{color:t.grid}}},plugins:{legend:{display:e.filter(b=>!b.csvIsFit&&!b.csvSkipLegend).length>1,labels:{color:t.muted,boxWidth:12,filter:b=>{var S;let _=e[(S=b.datasetIndex)!=null?S:-1];return!(_!=null&&_.csvIsFit||_!=null&&_.csvSkipLegend)}}},tooltip:{callbacks:{label:b=>{let _=b.raw,S=s.xIsDate?tl(_.x):Ds(_.x),C=i&&b.dataset.label?`[${b.dataset.label}] `:"",v=_.label?`${_.label}: `:"",y=_.size!==void 0&&s.sizeLabel?` \xB7 ${s.sizeLabel}: ${Ds(_.size)}`:"";return`${C}${v}(${S}, ${Ds(_.y)})${y}`}}}}}},fitText:u,formulaError:f}}var ln="(row number)";function No(s,t,e,i,n,o,r,a){let L=new Map,l=0;return s.forEach((d,h)=>{var b,_,S,C,v;let u=ci((b=d[e])!=null?b:""),f;if(t===ln)f=h+1;else if(o){let y=r((_=d[t])!=null?_:"");f=y?y.getTime():null}else f=ci((S=d[t])!=null?S:"");if(f===null||u===null){l++;return}let p=i?((C=d[i])!=null?C:"").trim()||"\u2014":"",m=L.get(p);m||(m=[],L.set(p,m));let g={x:f,y:u,label:a(d)};if(n){let y=ci((v=d[n])!=null?v:"");y!==null&&(g.size=y)}m.push(g)}),{series:[...L.entries()].sort((d,h)=>d[0]==="\u2014"?1:h[0]==="\u2014"?-1:d[0].localeCompare(h[0])).map(([d,h])=>({label:d,points:h})),skipped:l}}function Sd(s,t,e){return s.filter(i=>{if(e.has(i))return!1;let n=new Set(t.map(o=>{var r;return((r=o[i])!=null?r:"").trim()}).filter(Boolean));return n.size>=2&&n.size<=10})}function Md(s,t,e){return s.filter(i=>{if(e.has(i))return!1;let n=new Set(t.map(o=>{var r;return((r=o[i])!=null?r:"").trim()}).filter(Boolean));return n.size>=1&&n.size<=30})}function $o(s,t,e,i,n){let o=new Map,r=new Set,a=0,L=vt(t);s.forEach(h=>{var g,b,_;let u=0;if(n!=="count"){let S=ci((g=h[e!=null?e:""])!=null?g:"");if(S===null){a++;return}u=S}let f=((b=h[t])!=null?b:"").trim(),p=L?f?f.split(",").map(S=>S.trim()).filter(Boolean):["\u2014"]:[f||"\u2014"],m=i?((_=h[i])!=null?_:"").trim()||"\u2014":"";r.add(m),p.forEach(S=>{var y;let C=o.get(S);C||(C=new Map,o.set(S,C));let v=(y=C.get(m))!=null?y:{sum:0,n:0};v.sum+=u,v.n+=1,C.set(m,v)})});let l=(h,u)=>h==="\u2014"?1:u==="\u2014"?-1:h.localeCompare(u,void 0,{numeric:!0}),c=[...o.keys()].sort(l),d=[...r].sort(l).map(h=>({label:h,values:c.map(u=>{var p;let f=(p=o.get(u))==null?void 0:p.get(h);return!f||f.n===0?0:n==="count"?f.n:n==="sum"?f.sum:f.sum/f.n})}));return{categories:c,series:d,skipped:a}}function zo(s,t,e,i){let n=s.series.length>1;return{type:"bar",data:{labels:s.categories,datasets:s.series.map((o,r)=>({label:o.label||e,data:o.values,backgroundColor:n?i.series[r%i.series.length]:i.accent,borderRadius:3}))},options:{responsive:!0,maintainAspectRatio:!1,scales:{x:{title:{display:!!t,text:t,color:i.muted},ticks:{color:i.muted,autoSkip:!1,maxRotation:60},grid:{display:!1}},y:{beginAtZero:!0,title:{display:!!e,text:e,color:i.muted},ticks:{color:i.muted},grid:{color:i.grid}}},plugins:{legend:{display:n,labels:{color:i.muted,boxWidth:12}}}}}}async function kd(s,t){var e,i,n,o,r,a;try{let L=t.ownerDocument.createElement("canvas");L.width=t.width,L.height=t.height;let l=L.getContext("2d");if(!l||!L.toBlob){new Qe.Notice("PNG export isn't available here.");return}let c=(e=t.ownerDocument.defaultView)==null?void 0:e.getComputedStyle(t.ownerDocument.body);l.fillStyle=(c==null?void 0:c.getPropertyValue("--background-primary").trim())||"#ffffff",l.fillRect(0,0,L.width,L.height),l.drawImage(t,0,0);let d=await new Promise(g=>L.toBlob(g,"image/png"));if(!d){new Qe.Notice("PNG export failed.");return}let h=(o=(n=(i=s.file)==null?void 0:i.parent)==null?void 0:n.path)!=null?o:"",u=new Date,f=`${ge(u)} ${String(u.getHours()).padStart(2,"0")}${String(u.getMinutes()).padStart(2,"0")}`,p=`${(a=(r=s.file)==null?void 0:r.basename)!=null?a:"chart"} chart ${f}.png`,m=(0,Qe.normalizePath)(h?`${h}/${p}`:p);await s.app.vault.createBinary(m,await d.arrayBuffer()),new Qe.Notice(`Saved ${m}`)}catch(L){new Qe.Notice(`PNG export failed: ${L instanceof Error?L.message:String(L)}`,6e3)}}function el(s,t,e){t.createEl("button",{cls:"csv-cfg-btn csv-chart-export-btn",text:"\u2B07 PNG",title:"Save this chart as a PNG next to the CSV"}).addEventListener("click",()=>{kd(s,e)})}function hn(s){return s.rows.length>=2&&cn(s.headers,s.rows).length>=1}async function sl(s,t){var H,$,z;let e=s.getFilteredRows(),i=cn(s.headers,s.rows);if(!i.length){t.createEl("p",{text:"No numeric column to chart.",cls:"csv-empty-state"});return}s.searchQuery.trim()&&t.createDiv({cls:"csv-search-results",text:`Chart over ${e.length} of ${s.rows.length} entries`});let n=s.fileCfg,o=s.getDateCol(),r=(H=s.titleKey())!=null?H:s.headers[0],a=new Set([r,...i,...o?[o]:[]]);s.headers.forEach(V=>{s.isNotesCol(V)&&a.add(V)});let L=Md(s.headers,s.rows,a),l=[...o?[o]:[],...i.filter(V=>V!==o),ln,...L],c=n.chartXCol&&l.includes(n.chartXCol)?n.chartXCol:l[0],d=L.includes(c),h=n.chartAgg==="sum"||n.chartAgg==="avg"?n.chartAgg:"count",u=i,f=n.chartYCol&&u.includes(n.chartYCol)?n.chartYCol:($=u.find(V=>V!==c))!=null?$:u[0],p=n.chartFit==="linear"?"linear":"none",m=(z=n.chartFormula)!=null?z:"",g=t.createDiv({cls:"csv-chart-view"}),b=g.createDiv({cls:"csv-chart-controls"}),_=V=>{s.saveFileCfg({...s.fileCfg,...V}),s.renderViewPreservingScroll()},S=(V,Z,X,q)=>{let it=b.createDiv({cls:"csv-chart-control"});it.createSpan({cls:"csv-chart-control-label",text:V});let Q=it.createEl("select",{cls:"csv-chart-select",attr:{"aria-label":V}});return Z.forEach(et=>{let lt=Q.createEl("option",{text:et,value:et});et===X&&(lt.selected=!0)}),Q.addEventListener("change",()=>q(Q.value)),Q};S("X",l,c,V=>_({chartXCol:V})),(!d||h!=="count")&&S(d?`Y (${h})`:"Y",u,f,V=>_({chartYCol:V})),d&&S("Agg",["count","sum","avg"],h,V=>_({chartAgg:V}));let C=new Set([c,f,r]);s.headers.forEach(V=>{s.isNotesCol(V)&&C.add(V)});let v=Sd(s.headers,s.rows,C),y="\u2014",x=n.chartHueCol&&v.includes(n.chartHueCol)?n.chartHueCol:null;v.length&&S("Color",[y,...v],x!=null?x:y,V=>_({chartHueCol:V===y?void 0:V}));let w=!d&&c!==ln&&(c===o||s.isDateCol(c)),k=w&&(n.chartBucket==="week"||n.chartBucket==="month")?n.chartBucket:null,M=n.chartAgg==="avg"||n.chartAgg==="count"?n.chartAgg:"sum",T=w&&!k&&!!n.chartSmooth;w&&(S("By",["day","week","month"],k!=null?k:"day",V=>_({chartBucket:V==="day"?void 0:V})),k&&S("Agg",["sum","avg","count"],M,V=>_({chartAgg:V})));let A=i.filter(V=>V!==f&&V!==c),B=!d&&!k&&n.chartSizeCol&&A.includes(n.chartSizeCol)?n.chartSizeCol:null;if(!d&&!k&&A.length&&S("Size",[y,...A],B!=null?B:y,V=>_({chartSizeCol:V===y?void 0:V})),d){let V=$o(e,c,h==="count"?null:f,x,h),Z=g.createDiv({cls:"csv-chart-wrap"}),X=Z.createEl("canvas",{cls:"csv-chart-canvas"});if(!V.categories.length){Z.remove(),g.createEl("p",{text:`No rows with a "${c}" value to chart.`,cls:"csv-empty-state"});return}V.skipped>0&&g.createDiv({cls:"csv-chart-footer"}).createSpan({cls:"csv-chart-skipped",text:`${V.skipped} row${V.skipped===1?"":"s"} skipped (no numeric value)`});let q=h==="count"?"count":`${h}(${f})`,it=zo(V,c,q,Ts(t));s.chartInstance&&(s.chartInstance.destroy(),s.chartInstance=null);let{Chart:Q}=await Xe();if(!X.isConnected)return;s.chartInstance=new Q(X,it),el(s,b,X);return}b.createEl("button",{cls:`csv-cfg-btn csv-chart-fit-btn ${p==="linear"?"active":""}`,text:"Best fit",title:"Toggle a least-squares fit line"}).addEventListener("click",()=>_({chartFit:p==="linear"?"none":"linear"})),w&&!k&&b.createEl("button",{cls:`csv-cfg-btn csv-chart-smooth-btn ${T?"active":""}`,text:"Smooth",title:"Toggle a 7-day rolling average (raw values stay as dots)"}).addEventListener("click",()=>_({chartSmooth:T?void 0:!0}));let P=b.createDiv({cls:"csv-chart-control csv-chart-formula-wrap"});P.createSpan({cls:"csv-chart-control-label",text:"y ="});let E=P.createEl("input",{cls:"csv-chart-formula-input",type:"text",value:m,placeholder:"overlay, e.g. 2x + 1",attr:{spellcheck:"false",autocomplete:"off",enterkeyhint:"done"}}),j=()=>{E.value.trim()!==m.trim()&&_({chartFormula:E.value})};E.addEventListener("change",j),E.addEventListener("keydown",V=>{V.key==="Enter"&&(V.preventDefault(),E.blur())});let F=No(e,c,f,x,B,w,V=>s.parseDate(V),V=>s.getTitle(V)),W=F.skipped,N=k?F.series.map(V=>({label:V.label,points:Bo(V.points,k,M)})):F.series,G=g.createDiv({cls:"csv-chart-wrap"}),R=G.createEl("canvas",{cls:"csv-chart-canvas"}),Y=g.createDiv({cls:"csv-chart-footer"});if(!N.some(V=>V.points.length)){G.remove(),Y.remove(),g.createEl("p",{text:`No rows with both "${c}" and "${f}" values to plot.`,cls:"csv-empty-state"});return}let K={series:N,xIsDate:w,xLabel:c===ln?"row":c,yLabel:k?M==="count"?`count / ${k}`:`${M}(${f}) / ${k}`:f,connect:w,fit:p,formula:m,sizeLabel:B!=null?B:"",smoothDays:T?7:0},D=dn(K,Ts(t));D.fitText&&Y.createSpan({cls:"csv-chart-fit-text",text:D.fitText}),D.formulaError&&Y.createSpan({cls:"csv-chart-formula-error",text:`formula: ${D.formulaError}`}),W>0&&Y.createSpan({cls:"csv-chart-skipped",text:`${W} row${W===1?"":"s"} skipped (no numeric value)`}),s.chartInstance&&(s.chartInstance.destroy(),s.chartInstance=null);let{Chart:O}=await Xe();R.isConnected&&(s.chartInstance=new O(R,D.config),el(s,b,R))}function un(s){return s.resolveCol(["Type","type","Kind","kind","Item","item"])}function Zo(s){var t;return(t=s.resolveCol(["Project","project","Projects","projects","Area","area"]))!=null?t:zt(s)}function ol(s){return s.resolveCol(["Due","due","Deadline","deadline","Due Date","Due date","due date"])}function fn(s){return s.resolveCol(["Priority","priority","Prio","prio","Importance","importance"])}var wd=["task","todo","to-do","action",""],Ed=["task","todo","to-do","action","note","idea","reference","ref"],rl=["done","complete","completed","finished","closed","resolved","yes","x","\u2713","true","1"],Dd={high:0,med:1,medium:1,normal:1,low:2};function Fe(s){if(ol(s)||fn(s))return!0;let t=un(s);return t?s.rows.some(e=>{var i;return Ed.includes(((i=e[t])!=null?i:"").trim().toLowerCase())}):!1}function Ho(s,t,e){var i;return e?rl.includes(((i=t[e])!=null?i:"").trim().toLowerCase()):!1}function il(s){let t=Dd[(s!=null?s:"").trim().toLowerCase()];return t===void 0?3:t}function nl(s){return(s!=null?s:"").trim()?0:1}function Td(){return ge()}function Ad(s,t){let e=new Map;s.rows.forEach(o=>{var a,L;let r=((a=o[t])!=null?a:"").trim();r&&rl.includes(r.toLowerCase())&&e.set(r,((L=e.get(r))!=null?L:0)+1)});let i="done",n=0;return e.forEach((o,r)=>{o>n&&(i=r,n=o)}),i}function pn(s,t){var k,M;let e=Zo(s),i=un(s),n=s.getStatusCol(),o=ol(s),r=fn(s),a=(k=s.titleKey())!=null?k:s.headers[0],L=t.createDiv({cls:"csv-library-filters"}),l=new Set;e&&s.rows.forEach(T=>{var A;((A=T[e])!=null?A:"").split(",").map(B=>B.trim()).filter(Boolean).forEach(B=>l.add(B))});let c=L.createEl("select",{cls:"csv-library-filter-select"});c.createEl("option",{text:e?"All projects":"All",value:"all"}),Array.from(l).sort().forEach(T=>c.createEl("option",{text:T,value:T})),c.value=s.taskProjectFilter;let d=new Set;i&&s.rows.forEach(T=>{var B;let A=((B=T[i])!=null?B:"").trim();A&&d.add(A)});let h=null;d.size>0&&(h=L.createEl("select",{cls:"csv-library-filter-select"}),h.createEl("option",{text:"All types",value:"all"}),Array.from(d).sort().forEach(T=>h.createEl("option",{text:T,value:T})),h.value=s.taskTypeFilter);let u=()=>{s.taskProjectFilter=c.value,h&&(s.taskTypeFilter=h.value),s.renderView(!0)};c.addEventListener("change",u),h==null||h.addEventListener("change",u);let f=s.searchQuery.toLowerCase().trim(),p=s.rows.filter(T=>{var A,B;return!(s.taskProjectFilter!=="all"&&e&&!((A=T[e])!=null?A:"").split(",").map(P=>P.trim().toLowerCase()).includes(s.taskProjectFilter.toLowerCase())||s.taskTypeFilter!=="all"&&i&&((B=T[i])!=null?B:"").trim().toLowerCase()!==s.taskTypeFilter.toLowerCase()||f&&!s.headers.some(I=>{var P;return((P=T[I])!=null?P:"").toLowerCase().includes(f)}))});(s.taskProjectFilter!=="all"||s.taskTypeFilter!=="all"||f)&&t.createDiv({cls:"csv-library-result-count",text:`Showing ${p.length} of ${s.rows.length} entries`});let m={},g=T=>{var B;return e&&((B=T[e])!=null?B:"").split(",").map(I=>I.trim()).filter(Boolean)[0]||"\u2014"};p.forEach(T=>{var P,E,j;let A=i?((P=T[i])!=null?P:"").trim():"",B=wd.includes(A.toLowerCase())?"Tasks":A,I=g(T);m[B]||(m[B]={}),((j=(E=m[B])[I])!=null?j:E[I]=[]).push(T)});let b=t.createDiv({cls:"csv-tasks"}),_=Td(),S=n?Ad(s,n):"done",v=((M=s.fileCfg.cardFields)!=null?M:s.headers).filter(T=>T!==e&&T!==i&&T!==n),y=[];n&&y.push({name:"",cls:"csv-tasks-check-cell"}),v.forEach(T=>{let A="";T===a?A="csv-tasks-name-cell":T===o?A="csv-tasks-due":T===r?A="csv-tasks-priority":s.isNotesCol(T)?A="csv-tasks-generic-cell csv-tasks-notes-cell":A="csv-tasks-generic-cell",y.push({name:T,cls:A})});let x=(T,A)=>{A.sort((B,I)=>{var j,F,W,N,G,R;let P=Ho(s,B,n),E=Ho(s,I,n);if(P!==E)return P?1:-1;if(r){let Y=il((j=B[r])!=null?j:"")-il((F=I[r])!=null?F:"");if(Y)return Y}if(o){let Y=nl((W=B[o])!=null?W:"")-nl((N=I[o])!=null?N:"");if(Y)return Y;let K=((G=B[o])!=null?G:"").localeCompare((R=I[o])!=null?R:"");if(K)return K}return s.getTitle(B).localeCompare(s.getTitle(I))}),A.forEach(B=>{let I=Ho(s,B,n),P=T.createEl("tr");if(n){let j=P.createEl("td",{cls:"csv-tasks-check-cell"}).createSpan({cls:`csv-tasks-check ${I?"is-done":""}`,text:I?"\u2713":""});j.setAttr("title",I?"Mark not done":"Mark done"),j.addEventListener("click",F=>{F.stopPropagation(),B[n]=I?"":S,s.scheduleSave(),s.renderView(!0)})}v.forEach(E=>{var j,F,W;if(E===a)Pd(s,P,B,a,I);else if(E===o){let N=P.createEl("td",{cls:"csv-tasks-due csv-tasks-editable"}),G=o?((j=B[o])!=null?j:"").slice(0,10):"";N.setText(G||"\u2014"),G&&!I&&G<_&&N.addClass("csv-tasks-overdue"),Bs(s,N,B,E)}else if(E===r){let N=P.createEl("td",{cls:"csv-tasks-priority csv-tasks-editable",text:r&&B[r]||"\u2014"});N.addEventListener("click",G=>{var Y;G.stopPropagation();let R=Array.from(new Set([...s.getColumnValues(r),"high","medium","low"]));Bt(N,(Y=B[r])!=null?Y:"",R,K=>{B[r]=K,s.scheduleSave(),s.renderView(!0)},s.contentEl)})}else if(s.isNotesCol(E)){let N=((F=B[E])!=null?F:"").replace(/#{1,6}\s/g,"").replace(/[*_>`]/g,"").replace(/\n+/g," ").trim(),G=N?N.length>50?N.slice(0,48)+"\u2026":N:"\u2014",R=P.createEl("td",{text:G,cls:"csv-tasks-generic-cell csv-tasks-notes-cell csv-tasks-editable"});Bs(s,R,B,E)}else{let N=(W=B[E])!=null?W:"",G=N.length>40?N.slice(0,38)+"\u2026":N,R=P.createEl("td",{text:G||"\u2014",cls:"csv-tasks-generic-cell csv-tasks-editable"});Bs(s,R,B,E)}}),P.addEventListener("contextmenu",E=>s.openRowContextMenu(B,E))})},w=Object.keys(m).sort((T,A)=>T==="Tasks"?-1:A==="Tasks"?1:T.localeCompare(A));if(w.forEach(T=>{Rd(s,b,T==="Tasks"?T:Dt(T),m[T],x,y)}),w.length===0){let T=b.createDiv({cls:"csv-empty-state"});T.createEl("p",{text:f||s.taskProjectFilter!=="all"||s.taskTypeFilter!=="all"?"No entries match your filters.":"No tasks yet."}),(f||s.taskProjectFilter!=="all"||s.taskTypeFilter!=="all")&&T.createEl("button",{cls:"csv-clear-filters-btn",text:"Clear filters"}).addEventListener("click",()=>{s.taskProjectFilter="all",s.taskTypeFilter="all",s.searchQuery="",s.renderView()})}}function Rd(s,t,e,i,n,o){if(Object.keys(i).length===0)return;t.createDiv({cls:"csv-tasks-section-header",text:e});let r=t.createDiv({cls:"csv-tasks-section"});Object.keys(i).sort().forEach(a=>{let L=i[a],l=r.createEl("details",{cls:"csv-tasks-group"});l.open=!0;let c=l.createEl("summary",{cls:"csv-tasks-group-header"});c.createSpan({cls:"csv-tasks-arrow",text:"\u25B6"}),c.createSpan({text:` ${a} `}),c.createSpan({cls:"csv-tasks-count",text:String(L.length)});let h=l.createDiv({cls:"csv-tasks-table-wrapper"}).createEl("table",{cls:"csv-tasks-table"}),u=120;o.forEach(g=>{g.cls.includes("check-cell")?u+=30:g.cls.includes("priority")?u+=90:g.cls.includes("due")?u+=150:g.cls.includes("notes-cell")?u+=140:g.cls.includes("generic-cell")&&(u+=150)}),h.style.minWidth=`${u}px`;let p=h.createEl("thead").createEl("tr");o.forEach(g=>p.createEl("th",{text:g.name,cls:g.cls}));let m=h.createEl("tbody");n(m,L)})}function Pd(s,t,e,i,n){var d;let o=t.createEl("td",{cls:"csv-tasks-name-cell"}),r=(d=s.isHighlighted)!=null&&d.call(s,e)?"csv-title-highlight":"",a=o.createSpan({cls:`csv-tasks-link ${n?"csv-tasks-done":""} ${r}`,text:e[i]||"Untitled"}),L=s.getNotesCol();a.addEventListener("click",()=>{L?s.openNoteExpander(e,L):s.openOrCreateNotes(e)});let l=s.notesFileExists(e),c=o.createEl("button",{cls:`csv-tasks-page-icon ${l?"exists":""}`,text:l?"\u{1F4C4}":"+"});c.setAttr("title",l?"Open page":"Create page"),c.addEventListener("click",h=>{h.stopPropagation(),s.openOrCreateNotes(e)})}function gn(s){let t=[];return s.isTravelFile()&&t.push({id:"travel",label:"Travel"}),s.hasDateColumn()&&t.push({id:"dashboard",label:"Dashboard"}),Fe(s)&&t.push({id:"tasks",label:"Tasks"}),zt(s)&&(t.push({id:"library",label:"Cards"}),t.push({id:"kanban-genre",label:"Kanban"})),t.push({id:"table",label:"Table"}),s.rows.length>0&&t.push({id:"focus",label:"Focus"}),xi(s)&&t.push({id:"stats",label:"Stats"}),hn(s)&&t.push({id:"chart",label:"Chart"}),t}function al(s,t){var h,u,f;let e=t.createDiv({cls:"csv-toolbar"});e.createDiv({cls:"csv-toolbar-title",text:(u=(h=s.file)==null?void 0:h.basename)!=null?u:""});let i=e.createDiv({cls:"csv-toolbar-controls"});i.createDiv({cls:"csv-row-count",text:`${s.rows.length} entries`});let n=i.createDiv({cls:"csv-mode-group"}),o=gn(s),r=n.createEl("select",{cls:"csv-mode-select",attr:{"aria-label":"View mode"}});if(o.forEach(({id:p,label:m})=>{let g=r.createEl("option",{text:m,value:p});s.mode===p&&(g.selected=!0)}),r.addEventListener("change",()=>{s.mode=r.value,s.renderView()}),s.mode!=="dashboard"){let p=i.createEl("button",{cls:"csv-cfg-btn csv-search-toggle",text:"\u{1F50D}",title:"Search"}),m=i.createDiv({cls:"csv-search-wrap"}),g=m.createDiv({cls:"csv-search-input-wrap"}),b=g.createEl("input",{cls:"csv-search-input",type:"text",placeholder:"Search...",value:s.searchQuery,attr:{inputmode:"search",enterkeyhint:"search",autocomplete:"off"}}),_=g.createEl("button",{cls:"csv-search-clear",text:"\xD7",title:"Clear search"});_.toggleClass("is-hidden",!s.searchQuery),m.createEl("button",{cls:"csv-search-done",text:"Done",title:"Dismiss keyboard"}).addEventListener("click",v=>{if(v.preventDefault(),!b.value){e.removeClass("csv-toolbar--search-expanded"),p.removeClass("has-query"),s.searchQuery="",s.renderView(!0);return}b.blur()});let C=null;b.addEventListener("input",v=>{s.searchQuery=v.target.value,_.toggleClass("is-hidden",!s.searchQuery),p.toggleClass("has-query",!!s.searchQuery),C!==null&&window.clearTimeout(C),C=window.setTimeout(()=>{C=null,s.renderView(!0)},120)}),b.addEventListener("keydown",v=>{v.key==="Enter"&&(v.preventDefault(),b.blur())}),_.addEventListener("click",()=>{s.searchQuery="",b.value="",_.addClass("is-hidden"),p.removeClass("has-query"),b.focus({preventScroll:!0}),s.renderView(!0)}),s.searchQuery&&p.addClass("has-query"),p.addEventListener("click",()=>{e.addClass("csv-toolbar--search-expanded"),b.focus({preventScroll:!0})})}if(s.mode==="table"&&s.hasDateColumn()){let p=(f=s.fileCfg.sortNewestFirst)!=null?f:!0;i.createEl("button",{cls:`csv-cfg-btn ${p?"active":""}`,text:p?"\u2193 Newest":"\u2191 Oldest",title:"Toggle sort order"}).addEventListener("click",()=>{var b;let g=s.fileCfg;g.sortNewestFirst=!((b=g.sortNewestFirst)==null||b),s.saveFileCfg(g),s.tableSortCol=null,s.renderViewPreservingScroll()})}let a=()=>{var m,g;let p={title:s.resolveCol(fe),category:s.resolveCol(ss),status:s.resolveCol(is),notes:s.resolveCol(pe),image:s.resolveCol(es),anki:Tn(s)};new pi(s.app,s.headers,(g=(m=s.file)==null?void 0:m.path)!=null?g:"",s.fileCfg,s.autoDetectBooleanColumns(),s.autoDetectCategoricalColumns(),p,gn(s),b=>{s.saveFileCfg(b),b.defaultMode&&(s.mode=b.defaultMode),s.renderView()},()=>s.headers,()=>s.fileCfg,b=>s.addColumn(b),b=>s.removeColumn(b),b=>s.cleanupBooleanColumn(b)).open()},L=()=>{s.backupToArchive()},l=()=>{xr(s)};i.createEl("button",{cls:"csv-cfg-btn csv-cfg-btn-secondary",text:"\u2699 Config",title:"Configure this file's columns and views"}).addEventListener("click",a),i.createEl("button",{cls:"csv-cfg-btn csv-cfg-btn-secondary",text:"\u{1F4BE} Backup",title:"Copy this file to archive/ with today's date"}).addEventListener("click",L),i.createEl("button",{cls:"csv-cfg-btn csv-cfg-btn-secondary",text:"\u{1F3B4} Anki",title:"Sync rows to Anki (needs Anki desktop + AnkiConnect)"}).addEventListener("click",l),i.createEl("button",{cls:"csv-add-btn",text:"+ add"}).addEventListener("click",()=>s.openAddModal()),i.createEl("button",{cls:"csv-cfg-btn csv-cfg-btn-overflow",text:"\u22EF",title:"More actions"}).addEventListener("click",p=>{let m=new mn.Menu;m.addItem(g=>g.setTitle("Config").setIcon("settings").onClick(a)),m.addItem(g=>g.setTitle("Backup").setIcon("save").onClick(L)),m.addItem(g=>g.setTitle("Sync to Anki").setIcon("layers").onClick(l)),m.addSeparator(),m.addItem(g=>g.setTitle("Built 2026-07-17 16:29").setIcon("info").setDisabled(!0)),m.showAtMouseEvent(p)}),i.createEl("button",{cls:"csv-cfg-btn csv-cfg-btn-secondary csv-info-btn",text:"\u24D8",title:"Built 2026-07-17 16:29 \u2014 click to confirm"}).addEventListener("click",()=>new mn.Notice("datadeck \u2014 built 2026-07-17 16:29",4e3))}function Od(s){return s&&typeof s=="object"&&"basename"in s?s:null}var Fd=["Author","author","By","by","Source","source","Speaker","speaker","Artist","artist","Director","director"];async function Ll(s,t,e,i){var b,_,S;let n=t.split(` +`).map(C=>C.trim()).filter(Boolean),o=C=>{var v,y;return(y=(v=n.find(x=>x.startsWith(C+":")))==null?void 0:v.slice(C.length+1).trim())!=null?y:""},r=o("file");if(!r){e.createEl("p",{text:"Error: No file specified. Use: file: yourfile.csv",cls:"csv-add-error"});return}let a=s.vault.getAbstractFileByPath(i.sourcePath),L=(_=(b=a==null?void 0:a.parent)==null?void 0:b.path)!=null?_:"",l=Xt(r,L),c=Od(s.vault.getAbstractFileByPath(l));if(!c){e.createEl("p",{text:`Error: File not found: ${l}`,cls:"csv-add-error"});return}let d=[],h=[];try{let C=Mt(await s.vault.read(c));d=C.headers,h=C.rows}catch(C){e.createEl("p",{text:`Error reading file: ${C instanceof Error?C.message:String(C)}`,cls:"csv-add-error"});return}if(!h.length){e.createEl("p",{text:"No entries in file.",cls:"csv-add-error"});return}let u=o("field"),f=(S=d.find(C=>C.toLowerCase()===u.toLowerCase()))!=null?S:d[0],p=Fd.map(C=>d.find(v=>v===C)).find(Boolean),m=e.createDiv({cls:"csv-random-card"}),g=()=>{var M;m.empty();let C=h.filter(T=>{var A;return((A=T[f])!=null?A:"").trim()}),v=C.length?C:h,y=v[Math.floor(Math.random()*v.length)];m.createDiv({cls:"csv-random-text",text:y[f]||"\u2014"});let x=p?((M=y[p])!=null?M:"").trim():"";x&&m.createDiv({cls:"csv-random-sub",text:`\u2014 ${x}`});let w=m.createDiv({cls:"csv-random-foot"});w.createSpan({cls:"csv-random-src",text:c.basename}),w.createEl("button",{cls:"csv-random-btn",text:"\u21BB",title:"Another one"}).addEventListener("click",g)};g()}async function ll(s,t){var R,Y,K;let e=s.getDateCol();if(!e){t.createEl("p",{text:"No date column detected.",cls:"csv-empty-state"});return}let i=s.getBooleanColumns(),n=s.getNotesCol(),o=s.formatDate(new Date),r=[...s.rows].sort((D,O)=>{var H,$;return((H=D[e])!=null?H:"").localeCompare(($=O[e])!=null?$:"")});s.selectedDate||(s.selectedDate=o);let a=r.find(D=>D[e]===s.selectedDate),L=s.selectedDate===o;t.addClass("csv-dashboard");let l=[...new Set([...r.map(D=>D[e]),o])].filter(Boolean).sort(),c=t.createDiv({cls:"csv-dash-nav"});c.createEl("button",{cls:"csv-dash-nav-btn csv-dash-back-btn",text:"\u25C0"}).addEventListener("click",()=>{let D=l.indexOf(s.selectedDate);if(D>0)s.selectedDate=l[D-1],s.renderView();else if(D===-1&&l.length>0){let O=l.filter(H=>H0&&(s.selectedDate=O[O.length-1],s.renderView())}});let h=c.createDiv({cls:"csv-dash-date"});L&&h.createSpan({cls:"csv-dash-today-dot"});let u=h.createEl("select",{cls:"csv-dash-date-select"});if(l.forEach(D=>{let O=u.createEl("option",{text:D,value:D});D===s.selectedDate&&(O.selected=!0)}),u.addEventListener("change",()=>{s.selectedDate=u.value,s.renderView()}),c.createEl("button",{cls:"csv-dash-nav-btn",text:"\u25B6"}).addEventListener("click",()=>{let D=l.indexOf(s.selectedDate);if(D>=0&&DH>s.selectedDate);O.length>0&&(s.selectedDate=O[0],s.renderView())}}),L||c.createEl("button",{cls:"csv-dash-today-btn",text:"Today"}).addEventListener("click",()=>{s.selectedDate=o,s.renderView()}),!a){let D=t.createDiv({cls:"csv-dash-add-section"});D.createEl("p",{text:`No entry for ${s.selectedDate}`}),D.createEl("button",{cls:"csv-dash-add-btn",text:`+ Add entry for ${s.selectedDate}`}).addEventListener("click",()=>{let H={};s.headers.forEach($=>H[$]=""),H[e]=s.selectedDate,s.rows.push(H),s.scheduleSave(),s.renderView()})}if(a){let D=t.createDiv({cls:"csv-dash-habits"});D.createEl("h3",{text:s.selectedDate===o?"Today":s.selectedDate,cls:"csv-dash-section-title"});let O=D.createDiv({cls:"csv-dash-habits-grid"});i.forEach($=>{let z=s.isTruthy(a[$]),V=O.createDiv({cls:`csv-dash-habit ${z?"checked":""}`}),Z=V.createEl("button",{cls:"csv-dash-habit-check",text:z?"\u25CF":"\u25CB"});V.createSpan({cls:"csv-dash-habit-label",text:$}),Z.addEventListener("click",()=>{a[$]=z?"0":"1",s.scheduleSave(),s.renderViewPreservingScroll()})});let H=i.filter($=>s.isTruthy(a[$])).length;if(D.createDiv({cls:"csv-dash-habits-count",text:`${H} of ${i.length} complete`}),n&&((R=a[n])!=null&&R.trim())){let $=D.createDiv({cls:"csv-dash-notes-preview"});$.createEl("strong",{text:"Notes: "}),$.createSpan({text:a[n].slice(0,200)+(a[n].length>200?"\u2026":"")})}}let p=t.createDiv({cls:"csv-dash-chart-section"});p.createEl("h3",{text:"Progress",cls:"csv-dash-section-title"});let g=p.createDiv({cls:"csv-dash-chart-wrap"}).createEl("canvas",{cls:"csv-dash-chart"}),b=r.map(D=>{var H;return((H=D[e])!=null?H:"").slice(5)}),_=r.map(D=>i.filter(O=>s.isTruthy(D[O])).length);s.chartInstance&&(s.chartInstance.destroy(),s.chartInstance=null);let{Chart:S}=await Xe();if(!g.isConnected)return;s.chartInstance=new S(g,{type:"line",data:{labels:b,datasets:[{label:"Habits done",data:_,borderColor:"#378ADD",backgroundColor:"rgba(55,138,221,0.08)",borderWidth:1.5,pointRadius:3,tension:.3,fill:!0}]},options:{responsive:!0,maintainAspectRatio:!1,scales:{y:{min:0,max:i.length||8,ticks:{stepSize:1}}},plugins:{tooltip:{enabled:!0}}}});let C=t.createDiv({cls:"csv-dash-stats-section"});C.createEl("h3",{text:"Stats",cls:"csv-dash-section-title"});let v=r.length,y=r.reduce((D,O)=>D+i.filter(H=>s.isTruthy(O[H])).length,0),x=v>0?(y/v).toFixed(1):"0",w=r.filter(D=>i.every(O=>s.isTruthy(D[O]))).length,k=0,M=0,T=null;for(let D of r){let O=i.filter(z=>s.isTruthy(D[z])).length,H=s.parseDate((Y=D[e])!=null?Y:""),$=!0;T&&H&&Math.round((H.getTime()-T.getTime())/864e5)!==1&&($=!1),O>=1&&($||T===null)?(M++,M>k&&(k=M)):O>=1?(M=1,M>k&&(k=M)):M=0,T=H}let A=0,B=new Date;B.setHours(0,0,0,0);let I=B;for(let D=r.length-1;D>=0;D--){let O=s.parseDate((K=r[D][e])!=null?K:"");if(!O)break;let H=Math.round((I.getTime()-O.getTime())/(1e3*60*60*24));if(A===0&&H>1||A>0&&H!==1)break;if(i.filter(z=>s.isTruthy(r[D][z])).length>=1)A++,I=O;else break}let P=C.createDiv({cls:"csv-dash-stats-bar"}),E=(D,O)=>{P.createEl("strong",{text:D}),P.appendText(` ${O}`)};E(String(v),"days logged"),P.appendText(" \xB7 "),E(String(x),"avg/day"),P.appendText(" \xB7 "),E(String(w),"perfect days"),P.appendText(" \xB7 current streak "),P.createEl("strong",{text:`${A}d`}),P.appendText(" \xB7 best streak "),P.createEl("strong",{text:`${k}d`});let F=t.createDiv({cls:"csv-dash-cards-section"}).createDiv({cls:"csv-dash-cards-grid"}),W=new Date().getFullYear(),N={language:"\u25CB",read:"\u2261",gym:"\u229E",vitamins:"\u2299",cardio:"\u2191",meditate:"\u25CE",challenge:"\u273F",journal:"\u270E",exercise:"\u229E",water:"\u{1F4A7}",sleep:"\u{1F319}",study:"\u{1F4DA}"};i.map(D=>{let O=r.filter(Z=>s.isTruthy(Z[D])),H=O.length>0?O[O.length-1][e]:null,$=new Set;O.forEach(Z=>{var q;let X=s.parseDate((q=Z[e])!=null?q:"");X&&$.add(X.getFullYear())});let z=r.filter(Z=>{var q;let X=s.parseDate((q=Z[e])!=null?q:"");return X&&X.getFullYear()===W}),V=z.filter(Z=>s.isTruthy(Z[D])).length;return{habit:D,doneCount:O.length,doneThisYear:V,totalThisYear:z.length,lastDone:H,years:Array.from($).sort()}}).sort((D,O)=>!D.lastDone&&!O.lastDone?0:D.lastDone?O.lastDone?O.lastDone.localeCompare(D.lastDone):-1:1).forEach(({habit:D,doneCount:O,doneThisYear:H,totalThisYear:$,lastDone:z,years:V})=>{var lt;let Z=F.createDiv({cls:"csv-dash-habit-card"}),X=(lt=N[D.toLowerCase()])!=null?lt:"\u25CB",q=Z.createDiv({cls:"csv-dash-habit-card-header"});if(q.createSpan({cls:"csv-dash-habit-icon",text:X}),q.createSpan({cls:"csv-dash-habit-card-name",text:Dt(D)}),V.length>0&&Z.createDiv({cls:"csv-dash-habit-years"}).setText(V.join(" \xB7 ")),Z.createDiv({cls:"csv-dash-habit-card-thisyear",text:`${H} of ${$} complete this year`}),Z.createDiv({cls:"csv-dash-habit-card-alltime",text:`${O} of ${v} all time`}),z){let ot=s.parseDate(z),Lt=ot?ot.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):z;Z.createDiv({cls:"csv-dash-habit-card-last",text:`Last logged: ${Lt}`})}else Z.createDiv({cls:"csv-dash-habit-card-last",text:"Never logged"});let it=v>0?O/v*100:0,et=Z.createDiv({cls:"csv-dash-habit-progress"}).createDiv({cls:"csv-dash-habit-progress-bar"});et.style.width=`${it}%`,Z.addEventListener("click",()=>{s.selectedHabit=s.selectedHabit===D?null:D,s.renderViewPreservingScroll()}),s.selectedHabit===D&&Z.addClass("selected")}),s.selectedHabit&&i.includes(s.selectedHabit)&&Id(s,t,r,e,s.selectedHabit)}function Id(s,t,e,i,n){var k,M,T;let o=t.createDiv({cls:"csv-dash-timeline-section"}),r=o.createDiv({cls:"csv-dash-timeline-header"});r.createEl("h3",{text:`${Dt(n)} Timeline`,cls:"csv-dash-section-title"});let a=r.createEl("select",{cls:"csv-dash-year-select"}),L=new Set;e.forEach(A=>{var I;let B=s.parseDate((I=A[i])!=null?I:"");B&&L.add(B.getFullYear())}),L.add(new Date().getFullYear()),Array.from(L).sort().reverse().forEach(A=>{let B=a.createEl("option",{text:String(A),value:String(A)});A===s.timelineYear&&(B.selected=!0)}),a.addEventListener("change",()=>{s.timelineYear=parseInt(a.value),s.renderViewPreservingScroll()}),r.createEl("button",{cls:"csv-dash-timeline-close",text:"\u2715"}).addEventListener("click",()=>{s.selectedHabit=null,s.renderViewPreservingScroll()});let c=new Map;e.forEach(A=>{var B;c.set((B=A[i])!=null?B:"",s.isTruthy(A[n]))});let d=o.createDiv({cls:"csv-dash-timeline-grid-wrap"}),h=d.createDiv({cls:"csv-dash-timeline-months"});["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].forEach(A=>h.createSpan({cls:"csv-dash-timeline-month-label",text:A}));let f=d.createDiv({cls:"csv-dash-timeline-calendar"}),p=f.createDiv({cls:"csv-dash-timeline-day-labels"});for(let A=1;A<=31;A++)p.createDiv({cls:"csv-dash-timeline-day-label",text:A%5===0||A===1?String(A):""});for(let A=0;A<12;A++){let B=f.createDiv({cls:"csv-dash-timeline-month-col"}),I=new Date(s.timelineYear,A+1,0).getDate();for(let P=1;P<=31;P++){if(P>I){B.createDiv({cls:"csv-dash-timeline-cell empty"});continue}let E=`${s.timelineYear}-${String(A+1).padStart(2,"0")}-${String(P).padStart(2,"0")}`,j=(k=c.get(E))!=null?k:!1,F=c.has(E),W=new Date(s.timelineYear,A,P)>new Date,N=B.createDiv({cls:`csv-dash-timeline-cell ${W?"future":""} ${j?"done":""} ${F&&!j?"missed":""} ${!F&&!W?"no-entry":""}`});N.title=`${E}: ${W?"Future":j?"\u2713 Done":F?"\u2717 Missed":"No entry"}`}}let m=e.filter(A=>{var I;let B=s.parseDate((I=A[i])!=null?I:"");return B&&B.getFullYear()===s.timelineYear}),g=m.filter(A=>s.isTruthy(A[n])).length,b=m.length,_=0,S=0,C=0,v=null;for(let A of e){let B=s.isTruthy(A[n]),I=s.parseDate((M=A[i])!=null?M:""),P=!0;v&&I&&Math.round((I.getTime()-v.getTime())/864e5)!==1&&(P=!1),B&&(P||v===null)?(C++,C>S&&(S=C)):B?C=1:C=0,v=I}let y=new Date;y.setHours(0,0,0,0);let x=y;for(let A=e.length-1;A>=0;A--){let B=s.parseDate((T=e[A][i])!=null?T:"");if(!B)break;let I=Math.round((x.getTime()-B.getTime())/(1e3*60*60*24));if(_===0&&I>1||_>0&&I!==1)break;if(s.isTruthy(e[A][n]))_++,x=B;else break}let w=o.createDiv({cls:"csv-dash-timeline-stats"});w.createEl("strong",{text:String(g)}),w.appendText(` of ${b} in ${s.timelineYear} \xB7 current streak `),w.createEl("strong",{text:`${_}d`}),w.appendText(" \xB7 best streak "),w.createEl("strong",{text:`${S}d`})}function cl(s,t){var b,_,S;let e=s.getFilteredRows();if(s.searchQuery.trim()&&t.createDiv({cls:"csv-search-results",text:`Found ${e.length} of ${s.rows.length} entries`}),!e.length){let C=t.createDiv({cls:"csv-empty-state"});C.createEl("p",{text:s.searchQuery?"No matching entries found.":"No entries yet."}),s.searchQuery&&C.createEl("button",{cls:"csv-clear-filters-btn",text:"Clear search"}).addEventListener("click",()=>{s.searchQuery="",s.renderView()});return}s.focusIndex>=e.length&&(s.focusIndex=e.length-1),s.focusIndex<0&&(s.focusIndex=0);let i=e[s.focusIndex],n=(b=s.titleKey())!=null?b:s.headers[0],o=s.getNotesCol(),r=s.authorKey(),a=t.createDiv({cls:"csv-focus-wrap",attr:{tabindex:"0"}}),L=C=>{s.focusIndex=(C%e.length+e.length)%e.length,s.focusNavPending=!0,s.renderView(!0)},l=a.createDiv({cls:"csv-focus-card"});l.createDiv({cls:"csv-focus-position",text:`${s.focusIndex+1} / ${e.length}`});let c=l.createDiv({cls:`csv-focus-title ${(_=s.isHighlighted)!=null&&_.call(s,i)?"csv-title-highlight":""}`,text:s.getTitle(i)});o&&(c.addClass("is-clickable"),c.title="Open entry",c.addEventListener("click",()=>s.openNoteExpander(i,o)));let d=s.getSubtitle(i);if(d&&l.createDiv({cls:"csv-focus-sub",text:d}),o&&o!==n&&((S=i[o])!=null&&S.trim())){let C=l.createDiv({cls:"csv-focus-notes"});s.renderMarkdownInto(C,i[o])}let h=new Set([n,o,r].filter(Boolean)),u=s.headers.filter(C=>{var v;return!h.has(C)&&((v=i[C])!=null?v:"").trim()});if(u.length){let C=l.createDiv({cls:"csv-focus-meta"});u.forEach(v=>{let y=C.createDiv({cls:"csv-kanban-chip"});if(y.createSpan({cls:"csv-chip-label",text:v+": "}),s.isSelectCol(v)){let x=y.createSpan({cls:"csv-chip-value csv-chip-select",text:i[v]});x.addEventListener("click",w=>{w.stopPropagation(),Bt(x,i[v],s.getColumnValues(v),k=>{i[v]=k,x.setText(k||"\u2014"),s.scheduleSave()},s.contentEl,{multi:vt(v)})})}else y.createSpan({cls:"csv-chip-value",text:i[v]})})}l.addEventListener("contextmenu",C=>s.openRowContextMenu(i,C));let f=a.createDiv({cls:"csv-focus-nav"}),p=f.createEl("button",{cls:"csv-focus-nav-btn",text:"\u2039",title:"Previous (\u2190)"}),m=f.createEl("button",{cls:"csv-focus-nav-btn csv-focus-nav-rand",text:"\u{1F500}",title:"Random entry"}),g=f.createEl("button",{cls:"csv-focus-nav-btn",text:"\u203A",title:"Next (\u2192)"});p.addEventListener("click",()=>L(s.focusIndex-1)),g.addEventListener("click",()=>L(s.focusIndex+1)),m.addEventListener("click",()=>{if(e.length<2)return;let C=s.focusIndex;for(;C===s.focusIndex;)C=Math.floor(Math.random()*e.length);L(C)}),a.addEventListener("keydown",C=>{C.key==="ArrowLeft"?(C.preventDefault(),L(s.focusIndex-1)):C.key==="ArrowRight"&&(C.preventDefault(),L(s.focusIndex+1))}),(s.focusNavPending||document.activeElement===document.body)&&(s.focusNavPending=!1,a.focus({preventScroll:!0}))}var It=require("obsidian"),hl=Os(ts());var Vd=[{id:"table",label:"Table"},{id:"library",label:"Cards"},{id:"kanban-genre",label:"Kanban"}];function dl(s){return s&&typeof s=="object"&&"basename"in s?s:null}function Bd(s){let t=s.split(` +`).map(r=>r.trim()).filter(Boolean),e=r=>{var a,L;return(L=(a=t.find(l=>l.toLowerCase().startsWith(r+":")))==null?void 0:a.slice(r.length+1).trim())!=null?L:""},i=e("mode").toLowerCase(),n=i==="kanban"||i==="kanban-genre"?"kanban-genre":i==="cards"||i==="card"||i==="library"?"library":"table",o=parseInt(e("height"),10);return{file:e("file"),mode:n,height:Number.isFinite(o)&&o>0?o:null,collapse:e("collapse").split(",").map(r=>r.trim()).filter(Boolean)}}var Wo=class extends It.MarkdownRenderChild{constructor(e,i,n,o,r){super(e);this.file=null;this.headers=[];this.rows=[];this.searchQuery="";this.tableSortCol=null;this.tableSortDir="asc";this.libraryStatusFilter="all";this.libraryGenreFilter="all";this.collapsedGroups=new Set;this.saveTimer=null;this.lastWritten=null;this.contentArea=null;this.app=i,this.settings=n,this.persistSettings=o,this.opts=r,this.mode=r.mode,this.collapsedGroups=new Set(r.collapse.map(a=>a.toLowerCase()))}get renderComponent(){return this}get contentEl(){return this.containerEl}get asView(){return this}onload(){if(this.containerEl.addClass("csv-inline-view"),!this.opts.file){this.renderError("No file specified. Use: file: yourfile.csv");return}(async()=>await this.reload()&&(this.renderView(),this.registerEvent(this.app.vault.on("modify",async e=>{if(!this.file||e.path!==this.file.path)return;let i=await this.app.vault.read(this.file);if(i===this.lastWritten)return;this.lastWritten=i;let n=Mt(i);this.headers=n.headers,this.rows=n.rows,this.renderView()})),this.registerEvent(this.app.vault.on("rename",(e,i)=>{this.file&&i===this.file.path&&(this.file=dl(e))}))))()}onunload(){this.saveTimer&&window.clearTimeout(this.saveTimer)}async reload(){let e=dl(this.app.vault.getAbstractFileByPath(this.opts.file));if(!e)return this.renderError(`File not found: ${this.opts.file}`),!1;this.file=e;try{let i=await this.app.vault.read(e),n=Mt(i);this.headers=n.headers,this.rows=n.rows,this.lastWritten=i}catch(i){return this.renderError(`Error reading file: ${i instanceof Error?i.message:String(i)}`),!1}return!0}renderError(e){this.containerEl.empty(),this.containerEl.createEl("p",{text:`csv-view: ${e}`,cls:"csv-add-error"})}scheduleSave(){this.saveTimer&&window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>void this.doSave(),600)}async doSave(){if(this.file)try{let e=hl.default.unparse(this.rows,{columns:this.headers});try{let i=await this.app.vault.read(this.file);this.lastWritten!==null&&i!==this.lastWritten&&i!==e&&await rs(this.app,this.file,i)}catch(i){}this.lastWritten=e,await this.app.vault.modify(this.file,e)}catch(e){new It.Notice(`Couldn't save ${this.file.name}: ${e instanceof Error?e.message:String(e)}`,8e3)}}get fileCfg(){var e;return this.file?(e=this.settings.fileConfigs[this.file.path])!=null?e:{}:{}}saveFileCfg(e){this.file&&(this.settings.fileConfigs[this.file.path]=e,this.persistSettings())}isHighlighted(e){var i;return((i=this.fileCfg.highlightedTitles)!=null?i:[]).includes(this.getTitle(e))}toggleHighlight(e){let i=this.getTitle(e),n=this.fileCfg,o=n.highlightedTitles?[...n.highlightedTitles]:[],r=o.indexOf(i);r>=0?o.splice(r,1):o.push(i),n.highlightedTitles=o,this.saveFileCfg(n)}resolveCol(e){for(let i of e){let n=this.headers.find(o=>o.toLowerCase()===i.toLowerCase());if(n)return n}return null}getNotesCol(){return this.fileCfg.notesColumn!==void 0?this.fileCfg.notesColumn===""?null:this.fileCfg.notesColumn:this.resolveCol(pe)}isNotesCol(e){let i=this.getNotesCol();return i?e===i:this.settings.notesColumns.some(n=>n.toLowerCase()===e.toLowerCase())}isSelectCol(e){return this.settings.selectColumns.some(i=>i.toLowerCase()===e.toLowerCase())}isCategoricalCol(e){var n;let i=(n=this.titleKey())!=null?n:this.headers[0];return e===i||this.getDateCol()===e||vt(e)?!1:this.fileCfg.categoricalColumns?this.fileCfg.categoricalColumns.includes(e):this.isSelectCol(e)||qt(this.getColumnValues(e).length)}getStatusCol(){var e;return this.fileCfg.statusColumn!==void 0?this.fileCfg.statusColumn===""?null:(e=this.headers.find(i=>i.toLowerCase()===this.fileCfg.statusColumn.toLowerCase()))!=null?e:null:this.resolveCol(is)}getCategoryCol(){var e;return this.fileCfg.categoryColumn!==void 0?this.fileCfg.categoryColumn===""?null:(e=this.headers.find(i=>i.toLowerCase()===this.fileCfg.categoryColumn.toLowerCase()))!=null?e:null:this.resolveCol(ss)}titleKey(){var e,i;return this.fileCfg.titleColumn!==void 0?this.fileCfg.titleColumn===""?void 0:(e=this.headers.find(n=>n.toLowerCase()===this.fileCfg.titleColumn.toLowerCase()))!=null?e:void 0:(i=this.resolveCol(fe))!=null?i:void 0}authorKey(){var e;return(e=this.resolveCol(["Author","author","Authors","authors","Director","director","Artist","artist","Creator","creator","By","by"]))!=null?e:void 0}getTitle(e){var n;let i=this.titleKey();return(n=i?e[i]:e[this.headers[0]])!=null?n:"\u2014"}getSubtitle(e){var n;let i=this.authorKey();return i&&(n=e[i])!=null?n:""}getColumnValues(e){return Array.from(new Set(this.rows.map(i=>{var n;return(n=i[e])!=null?n:""}).filter(Boolean))).sort()}getImageCol(){var e;return this.fileCfg.imageColumn!==void 0?this.fileCfg.imageColumn===""?null:(e=this.headers.find(i=>i.toLowerCase()===this.fileCfg.imageColumn.toLowerCase()))!=null?e:null:this.resolveCol(es)}getBooleanColumns(){return this.fileCfg.habitColumns?this.fileCfg.habitColumns.filter(e=>this.headers.includes(e)):this.headers.filter(e=>{if(e===this.getDateCol()||this.isNotesCol(e))return!1;let i=this.rows.map(n=>{var o;return((o=n[e])!=null?o:"").toLowerCase().trim()});return ns(i)})}getDateCol(){var o,r;if(this.fileCfg.dateColumns&&this.fileCfg.dateColumns.length>0){let a=this.fileCfg.dateColumns[0];return(o=this.headers.find(L=>L===a))!=null?o:null}if(this.headers.length===0)return null;let e=this.headers[0];if(["date","day","datum"].includes(e.toLowerCase()))return e;let i=/^\d{4}-\d{2}-\d{2}$/,n=this.rows.slice(0,5);return n.length>0&&n.every(a=>{var L;return i.test((L=a[e])!=null?L:"")})?e:(r=this.headers.find(a=>this.isDateCol(a)))!=null?r:null}isDateCol(e){var i;return(i=this.fileCfg.dateColumns)!=null&&i.includes(e)?!0:kt(e)}getFilteredRows(){var n;let e=this.rows;if(this.searchQuery.trim()){let o=this.searchQuery.toLowerCase().trim();e=e.filter(r=>this.headers.some(a=>{var L;return((L=r[a])!=null?L:"").toLowerCase().includes(o)}))}if(this.mode==="table"&&this.tableSortCol&&this.headers.includes(this.tableSortCol)){let o=this.tableSortCol,r=this.tableSortDir;return[...e].sort((a,L)=>{var c,d;let l=((c=a[o])!=null?c:"").localeCompare((d=L[o])!=null?d:"",void 0,{numeric:!0});return r==="asc"?l:-l})}let i=this.getDateCol();if(this.mode==="table"&&i){let o=(n=this.fileCfg.sortNewestFirst)!=null?n:!0;e=[...e].sort((r,a)=>{var l,c;let L=((l=r[i])!=null?l:"").localeCompare((c=a[i])!=null?c:"");return o?-L:L})}return e}notesFilePath(e){var a,L,l;let i=Ie(this.getTitle(e)),n=(l=(L=(a=this.file)==null?void 0:a.parent)==null?void 0:L.path)!=null?l:"",o=this.settings.notesSubfolder.trim(),r=o?n?`${n}/${o}`:o:n;return(0,It.normalizePath)(`${r}/${i}.md`)}notesFileExists(e){return!!this.app.vault.getAbstractFileByPath(this.notesFilePath(e))}async openOrCreateNotes(e){var o;let i=this.notesFilePath(e),n=this.app.vault.getAbstractFileByPath(i);if(!n){let a=["---",...this.headers.filter(d=>!this.isNotesCol(d)&&e[d]).map(d=>`${d}: "${e[d].replace(/"/g,'\\"')}"`),"---","",`# ${this.getTitle(e)}`,"",""].join(` +`),L=this.headers.find(d=>this.isNotesCol(d)),l=a+(L&&((o=e[L])!=null&&o.trim())?e[L]:""),c=i.substring(0,i.lastIndexOf("/"));c&&!this.app.vault.getAbstractFileByPath(c)&&await this.app.vault.createFolder(c),n=await this.app.vault.create(i,l),new It.Notice(`Created: ${n.name}`)}await this.app.workspace.getLeaf("tab").openFile(n)}deleteWithUndo(e){let i=this.rows.indexOf(e);if(i<0)return;this.rows.splice(i,1),this.scheduleSave(),this.renderView();let n=this.getTitle(e)||"entry",o=createFragment();o.createSpan({text:`Deleted \u201C${n}\u201D. `});let r=o.createEl("button",{text:"Undo",cls:"csv-notice-undo"}),a=new It.Notice(o,6e3);r.addEventListener("click",()=>{r.hasAttribute("disabled")||(r.setAttribute("disabled","true"),this.rows.splice(Math.min(i,this.rows.length),0,e),this.scheduleSave(),this.renderView(),a.hide(),new It.Notice(`Restored \u201C${n}\u201D`,2500))})}openRowContextMenu(e,i){let n=new It.Menu;n.addItem(a=>a.setTitle("Open / create notes file").setIcon("file-text").onClick(()=>void this.openOrCreateNotes(e))),n.addItem(a=>a.setTitle("Open entry").setIcon("maximize").onClick(()=>{var L;return this.openNoteExpander(e,(L=this.getNotesCol())!=null?L:"")}));let o=this.getStatusCol();if(o){let a=this.getColumnValues(o);a.length&&(n.addSeparator(),a.forEach(L=>{L!==e[o]&&n.addItem(l=>l.setTitle(`Mark as: ${L}`).onClick(()=>{e[o]=L,this.scheduleSave(),this.renderView()}))}))}n.addSeparator();let r=this.isHighlighted(e);n.addItem(a=>a.setTitle(r?"Remove highlight":"Highlight").setIcon("highlighter").onClick(()=>{this.toggleHighlight(e),this.renderView()})),n.addSeparator(),n.addItem(a=>a.setTitle("Delete").setIcon("trash").onClick(()=>this.deleteWithUndo(e))),n.showAtMouseEvent(i)}openNoteExpander(e,i){var n,o;new me(this.app,e,i,this.headers,(o=(n=this.file)==null?void 0:n.path)!=null?o:"",this.isNotesCol.bind(this),this.isSelectCol.bind(this),this.getColumnValues.bind(this),r=>{Object.assign(e,r),this.scheduleSave(),this.renderView()},()=>this.deleteWithUndo(e),this.isCategoricalCol.bind(this),this.titleKey(),r=>this.getBooleanColumns().includes(r),r=>this.isDateCol(r)).open()}openAddModal(){new as(this.app,this.headers,this.isNotesCol.bind(this),this.isSelectCol.bind(this),this.getColumnValues.bind(this),e=>{this.rows.push(e),this.scheduleSave(),this.renderView(),new It.Notice(`Added: ${this.getTitle(e)}`)},{},e=>this.getBooleanColumns().includes(e),e=>this.isCategoricalCol(e),this.titleKey(),e=>this.isDateCol(e)).open()}renderSelectField(e,i,n){var a;let o=(a=i[n])!=null?a:"",r=e.createDiv({cls:`csv-select-chip ${o?"":"empty"}`});return r.setText(o||"\u2014"),n.toLowerCase()==="status"&&o&&r.addClass(`status-chip-${o.toLowerCase().replace(/\s+/g,"-")}`),r.addEventListener("click",L=>{var l;L.stopPropagation(),Bt(r,(l=i[n])!=null?l:"",this.getColumnValues(n),c=>{i[n]=c,r.setText(c||"\u2014"),this.scheduleSave()},this.contentEl)}),r}renderMarkdownInto(e,i){var n,o;It.MarkdownRenderer.render(this.app,i,e,(o=(n=this.file)==null?void 0:n.path)!=null?o:"",this.renderComponent)}renderViewPreservingScroll(){this.renderView()}renderView(e=!1){let i=this.containerEl;e?this.contentArea&&this.contentArea.empty():(i.empty(),this.renderToolbar(i),this.contentArea=i.createDiv({cls:"csv-content-area"}),this.opts.height&&(this.contentArea.style.maxHeight=this.opts.height+"px"));let n=this.contentArea;if(n){if(n.toggleClass("csv-content-area--no-yscroll",this.mode==="kanban-genre"||this.mode==="table"),!this.headers.length){n.createDiv({cls:"csv-empty-state"}).createEl("p",{text:"This file is empty."});return}if(this.rows.length===0){let o=n.createDiv({cls:"csv-empty-state"});o.createEl("p",{text:"No entries yet."}),o.createEl("button",{cls:"csv-empty-state-action",text:"+ add the first entry"}).addEventListener("click",()=>this.openAddModal());return}(this.mode==="library"||this.mode==="kanban-genre")&&!zt(this.asView)&&(this.mode="table"),this.mode==="library"?_i(this.asView,n):this.mode==="kanban-genre"?Ci(this.asView,n):yi(this.asView,n)}}renderToolbar(e){var l,c;let i=e.createDiv({cls:"csv-toolbar csv-inline-toolbar"});i.createDiv({cls:"csv-toolbar-title",text:(c=(l=this.file)==null?void 0:l.basename)!=null?c:""}).addEventListener("click",()=>{this.file&&this.app.workspace.getLeaf("tab").openFile(this.file)});let n=i.createDiv({cls:"csv-toolbar-controls"});n.createDiv({cls:"csv-row-count",text:`${this.rows.length} entries`});let o=!!zt(this.asView),r=n.createDiv({cls:"csv-mode-group"});Vd.forEach(({id:d,label:h})=>{if((d==="library"||d==="kanban-genre")&&!o)return;r.createEl("button",{cls:`csv-mode-btn ${this.mode===d?"active":""}`,text:h}).addEventListener("click",()=>{this.mode=d,this.renderView()})});let a=n.createEl("input",{cls:"csv-search-input",type:"text",placeholder:"Search\u2026",value:this.searchQuery,attr:{inputmode:"search",enterkeyhint:"search",autocomplete:"off"}}),L=null;a.addEventListener("input",d=>{this.searchQuery=d.target.value,L!==null&&window.clearTimeout(L),L=window.setTimeout(()=>{L=null,this.renderView(!0)},120)}),n.createEl("button",{cls:"csv-add-btn",text:"+ add"}).addEventListener("click",()=>this.openAddModal())}};function ul(s,t,e,i){i("csv-view",(n,o,r)=>{var d,h,u;let a=Bd(n),L=(u=(h=(d=s.vault.getAbstractFileByPath(r.sourcePath))==null?void 0:d.parent)==null?void 0:h.path)!=null?u:"",l=a.file?Xt(a.file,L):a.file,c=new Wo(o,s,t,e,{...a,file:l});r.addChild(c)})}var pl=require("obsidian");function Nd(s){let t=s.split(` +`).map(n=>n.trim()).filter(Boolean),e=n=>{var o,r;return(r=(o=t.find(a=>a.toLowerCase().startsWith(n+":")))==null?void 0:o.slice(n.length+1).trim())!=null?r:""},i=n=>{let o=parseFloat(e(n));return Number.isFinite(o)?o:null};return{file:e("file"),x:e("x"),y:e("y"),hue:e("hue")||e("color"),size:e("size"),agg:["count","sum","avg"].includes(e("agg").toLowerCase())?e("agg").toLowerCase():"",bucket:["week","month"].includes(e("bucket").toLowerCase())?e("bucket").toLowerCase():"",smooth:e("smooth").toLowerCase()==="true"?7:Math.max(0,parseInt(e("smooth"),10)||0),fit:e("fit").toLowerCase()==="linear"?"linear":"none",formula:e("formula"),xmin:i("xmin"),xmax:i("xmax"),height:i("height")}}function $d(s){return s&&typeof s=="object"&&"basename"in s?s:null}function fl(s){let t=(s!=null?s:"").trim().match(/^(\d{4})-(\d{2})-(\d{2})/);return t?new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3])):null}var jo=class extends pl.MarkdownRenderChild{constructor(e,i,n){super(e);this.app=i;this.opts=n;this.chart=null}onload(){this.containerEl.addClass("csv-chart-block"),(async()=>(await this.render(),this.opts.file&&(this.registerEvent(this.app.vault.on("modify",e=>{e.path===this.opts.file&&this.render()})),this.registerEvent(this.app.vault.on("rename",(e,i)=>{i===this.opts.file&&(this.opts.file=e.path)})))))()}onunload(){this.chart&&(this.chart.destroy(),this.chart=null)}renderError(e){this.containerEl.empty(),this.containerEl.createEl("p",{text:`csv-chart: ${e}`,cls:"csv-add-error"})}async render(){var L,l,c,d,h;let e=this.containerEl;this.chart&&(this.chart.destroy(),this.chart=null),e.empty();let i,n=0;if(this.opts.file){let u=$d(this.app.vault.getAbstractFileByPath(this.opts.file));if(!u)return this.renderError(`File not found: ${this.opts.file}`);let f,p;try{({headers:f,rows:p}=Mt(await this.app.vault.read(u)))}catch(x){return this.renderError(`Error reading file: ${x instanceof Error?x.message:String(x)}`)}let m=x=>{var w;return(w=f.find(k=>k.toLowerCase()===x.toLowerCase()))!=null?w:null},g=cn(f,p),b=(L=f.find(x=>kt(x)))!=null?L:p.slice(0,5).length&&p.slice(0,5).every(x=>{var w;return fl((w=x[f[0]])!=null?w:"")})?f[0]:null,_=this.opts.x?m(this.opts.x):(l=b!=null?b:g[0])!=null?l:null;if(this.opts.x&&!_)return this.renderError(`No column "${this.opts.x}" in ${u.basename}`);let S=this.opts.y?m(this.opts.y):(c=g.find(x=>x!==_))!=null?c:null;if(this.opts.y&&!S)return this.renderError(`No column "${this.opts.y}" in ${u.basename}`);if(!_||!S)return this.renderError(`Couldn't auto-pick x/y columns \u2014 add "x:" and "y:" lines`);let C=this.opts.hue?m(this.opts.hue):null;if(this.opts.hue&&!C)return this.renderError(`No column "${this.opts.hue}" in ${u.basename}`);let v=this.opts.size?m(this.opts.size):null;if(this.opts.size&&!v)return this.renderError(`No column "${this.opts.size}" in ${u.basename}`);let y=_===b||kt(_);if(!y&&!g.includes(_)){let x=this.opts.agg||"count",w=$o(p,_,x==="count"?null:S,C,x);if(n=w.skipped,!w.categories.length)return this.renderError(`No rows with a "${_}" value to chart`);let k=x==="count"?"count":`${x}(${S})`;i={config:zo(w,_,k,Ts(e)),fitText:null,formulaError:null}}else{let x=No(p,_,S,C,v,y,fl,A=>{var B;return(B=A[f[0]])!=null?B:""});if(n=x.skipped,!x.series.some(A=>A.points.length))return this.renderError(`No rows with numeric "${_}" and "${S}" values`);let w=y?this.opts.bucket:"",k=this.opts.agg||"sum",T={series:w?x.series.map(A=>({label:A.label,points:Bo(A.points,w,k)})):x.series,xIsDate:y,xLabel:_,yLabel:w?k==="count"?`count / ${w}`:`${k}(${S}) / ${w}`:S,connect:y,fit:this.opts.fit,formula:this.opts.formula,sizeLabel:w?"":v!=null?v:"",smoothDays:y&&!w?this.opts.smooth:0};i=dn(T,Ts(e))}}else{if(!this.opts.formula.trim())return this.renderError('Give a "file:" line, a "formula:" line, or both');i=dn({series:[],xIsDate:!1,xLabel:"x",yLabel:"y",connect:!1,fit:"none",formula:this.opts.formula,xMin:(d=this.opts.xmin)!=null?d:-10,xMax:(h=this.opts.xmax)!=null?h:10},Ts(e))}if(i.formulaError)return this.renderError(`formula: ${i.formulaError}`);let o=e.createDiv({cls:"csv-chart-wrap"});this.opts.height&&(o.style.height=this.opts.height+"px");let r=o.createEl("canvas",{cls:"csv-chart-canvas"});if(i.fitText||n>0){let u=e.createDiv({cls:"csv-chart-footer"});i.fitText&&u.createSpan({cls:"csv-chart-fit-text",text:i.fitText}),n>0&&u.createSpan({cls:"csv-chart-skipped",text:`${n} row${n===1?"":"s"} skipped (no numeric value)`})}let{Chart:a}=await Xe();r.isConnected&&(this.chart=new a(r,i.config))}};function gl(s,t){t("csv-chart",(e,i,n)=>{var L,l,c;let o=Nd(e),r=(c=(l=(L=s.vault.getAbstractFileByPath(n.sourcePath))==null?void 0:L.parent)==null?void 0:l.path)!=null?c:"",a=o.file?Xt(o.file,r):o.file;n.addChild(new jo(i,s,{...o,file:a}))})}var re=require("obsidian"),bl=Os(ts());var bn=["Title","Type","Project","Priority","Due","Status","Notes"],zd={Title:fe,Type:["Type","type","Kind","kind","Item","item"],Project:["Project","project","Projects","projects","Area","area"],Priority:["Priority","priority","Prio","prio","Importance","importance"],Due:["Due","due","Deadline","deadline","Due Date","Due date","due date"],Status:["Status","status","State","state","Done","done"],Notes:pe};function Hd(s){let t={};for(let e of bn)for(let i of zd[e]){let n=s.find(o=>o.toLowerCase()===i.toLowerCase());if(n){t[e]=n;break}}return!t.Title&&s.length&&(t.Title=s[0]),t}function Zd(s){let t=[],e=[];return s.forEach((i,n)=>{let o=Hd(i.headers);i.rows.forEach(r=>{var L;let a={};for(let l of bn)a[l]=o[l]&&(L=r[o[l]])!=null?L:"";o.Project||(a.Project=i.basename),t.push(a),e.push({sourceIndex:n,srcRow:r,map:o})})}),{headers:[...bn],rows:t,refs:e}}function Wd(s,t){var e;for(let i of bn){let n=t.map[i];n&&(t.srcRow[n]=(e=s[i])!=null?e:"")}}function jd(s){let t=s.split(` +`).map(n=>n.trim()).filter(Boolean),e=n=>{var o,r;return(r=(o=t.find(a=>a.toLowerCase().startsWith(n+":")))==null?void 0:o.slice(n.length+1).trim())!=null?r:""},i=parseInt(e("height"),10);return{folder:e("folder"),files:e("files").split(",").map(n=>n.trim()).filter(Boolean),height:Number.isFinite(i)&&i>0?i:null}}function ml(s){return s&&typeof s=="object"&&"basename"in s?s:null}var Uo=class extends re.MarkdownRenderChild{constructor(e,i,n,o,r){super(e);this.app=i;this.settings=n;this.opts=o;this.notePath=r;this.headers=[];this.rows=[];this.searchQuery="";this.taskProjectFilter="all";this.taskTypeFilter="all";this.fileCfg={};this.sources=[];this.refs=[];this.saveTimer=null;this.contentArea=null}get contentEl(){return this.containerEl}get asView(){return this}onload(){if(this.containerEl.addClass("csv-inline-view","csv-tasks-block"),!this.opts.folder&&!this.opts.files.length){this.renderError('Give a "folder:" line ("/" = whole vault) and/or a "files:" list.');return}(async()=>(await this.reload(),this.renderView(),this.registerEvent(this.app.vault.on("modify",async e=>{let i=this.sources.find(r=>r.file.path===e.path);if(!i||this.saveTimer)return;let n=await this.app.vault.read(i.file);if(n===i.lastText)return;i.lastText=n;let o=Mt(n);i.headers=o.headers,i.rows=o.rows,this.rebuild(),this.renderView()}))))()}onunload(){this.saveTimer&&window.clearTimeout(this.saveTimer)}renderError(e){this.containerEl.empty(),this.containerEl.createEl("p",{text:`csv-tasks: ${e}`,cls:"csv-add-error"})}async reload(){var n,o,r;let e=(r=(o=(n=this.app.vault.getAbstractFileByPath(this.notePath))==null?void 0:n.parent)==null?void 0:o.path)!=null?r:"",i=new Map;for(let a of this.opts.files){let L=ml(this.app.vault.getAbstractFileByPath(Xt(a,e)));if(!L){this.renderError(`File not found: ${a}`);continue}i.set(L.path,{file:L,explicit:!0})}if(this.opts.folder){let a=this.opts.folder==="/"?"":this.opts.folder.replace(/\/$/,"")+"/";for(let L of this.app.vault.getFiles())L.extension==="csv"&&(a&&!L.path.startsWith(a)||i.has(L.path)||i.set(L.path,{file:L,explicit:!1}))}this.sources=[];for(let{file:a,explicit:L}of i.values())try{let l=await this.app.vault.read(a),{headers:c,rows:d}=Mt(l);(L||Fe({headers:c,rows:d,resolveCol:u=>{var f;return(f=u.map(p=>c.find(m=>m.toLowerCase()===p.toLowerCase())).find(Boolean))!=null?f:null}}))&&this.sources.push({file:a,headers:c,rows:d,lastText:l})}catch(l){}this.rebuild()}rebuild(){let e=Zd(this.sources.map(i=>({basename:i.file.basename,headers:i.headers,rows:i.rows})));this.headers=e.headers,this.rows=e.rows,this.refs=e.refs}refOf(e){let i=this.rows.indexOf(e);return i>=0?this.refs[i]:null}sourceOf(e){var n;let i=this.refOf(e);return i&&(n=this.sources[i.sourceIndex])!=null?n:null}scheduleSave(){this.saveTimer&&window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>void this.doSave(),600)}async doSave(){this.saveTimer=null,this.rows.forEach((e,i)=>Wd(e,this.refs[i]));for(let e of this.sources){let i=bl.default.unparse(e.rows,{columns:e.headers});if(i!==e.lastText)try{try{let n=await this.app.vault.read(e.file);n!==e.lastText&&n!==i&&await rs(this.app,e.file,n)}catch(n){}e.lastText=i,await this.app.vault.modify(e.file,i)}catch(n){new re.Notice(`Couldn't save ${e.file.name}: ${n instanceof Error?n.message:String(n)}`,8e3)}}}resolveCol(e){for(let i of e){let n=this.headers.find(o=>o.toLowerCase()===i.toLowerCase());if(n)return n}return null}titleKey(){return"Title"}getStatusCol(){return"Status"}getCategoryCol(){return null}getDateCol(){return null}getNotesCol(){return"Notes"}isNotesCol(e){return e==="Notes"}isDateCol(e){return e==="Due"}getTitle(e){return e.Title||"\u2014"}getColumnValues(e){return Array.from(new Set(this.rows.map(i=>{var n;return(n=i[e])!=null?n:""}).filter(Boolean))).sort()}renderViewPreservingScroll(){this.renderView()}renderView(e=!1){let i=this.containerEl;if(e)this.contentArea&&this.contentArea.empty();else{i.empty();let n=i.createDiv({cls:"csv-toolbar csv-inline-toolbar"});n.createDiv({cls:"csv-toolbar-title",text:"Tasks"}),n.createDiv({cls:"csv-row-count",text:`${this.rows.length} entries \xB7 ${this.sources.length} file${this.sources.length===1?"":"s"}`}),this.contentArea=i.createDiv({cls:"csv-content-area"}),this.opts.height&&(this.contentArea.style.maxHeight=this.opts.height+"px")}if(this.contentArea){if(!this.sources.length){this.contentArea.createEl("p",{text:"No task-shaped CSV files found.",cls:"csv-empty-state"});return}pn(this.asView,this.contentArea)}}openNoteExpander(e,i){var L;let n=this.refOf(e),o=this.sourceOf(e);if(!n||!o)return;let r=(L=n.map.Notes)!=null?L:"",a=l=>l===n.map.Notes;new me(this.app,n.srcRow,r,o.headers,o.file.path,a,()=>!1,l=>Array.from(new Set(o.rows.map(c=>{var d;return(d=c[l])!=null?d:""}).filter(Boolean))).sort(),l=>{var c;Object.assign(n.srcRow,l);for(let d of Object.keys(e)){let h=n.map[d];h&&(e[d]=(c=n.srcRow[h])!=null?c:"")}this.scheduleSave(),this.renderView()},()=>this.deleteRow(e),void 0,n.map.Title,void 0,l=>/(^|[_\s-])(date|due|deadline)([_\s-]|$)/i.test(l)).open()}async openOrCreateNotes(e){let i=this.sourceOf(e);if(!i)return;let n=this.notesFilePath(e,i),o=ml(this.app.vault.getAbstractFileByPath(n));if(!o){let r=["---",`source: "[[${i.file.path}]]"`,"---","",`# ${this.getTitle(e)}`,"",""].join(` +`),a=n.substring(0,n.lastIndexOf("/"));a&&!this.app.vault.getAbstractFileByPath(a)&&await this.app.vault.createFolder(a),o=await this.app.vault.create(n,r),new re.Notice(`Created: ${o.name}`)}await this.app.workspace.getLeaf("tab").openFile(o)}notesFileExists(e){let i=this.sourceOf(e);return!!i&&!!this.app.vault.getAbstractFileByPath(this.notesFilePath(e,i))}notesFilePath(e,i){var L,l;let n=Ie(this.getTitle(e)),o=(l=(L=i.file.parent)==null?void 0:L.path)!=null?l:"",r=this.settings.notesSubfolder.trim(),a=r?o?`${o}/${r}`:r:o;return(0,re.normalizePath)(`${a}/${n}.md`)}deleteRow(e){let i=this.refOf(e),n=this.sourceOf(e);if(!i||!n)return;let o=n.rows.indexOf(i.srcRow);o>=0&&n.rows.splice(o,1);let r=this.rows.indexOf(e);r>=0&&(this.rows.splice(r,1),this.refs.splice(r,1)),this.scheduleSave(),this.renderView(),new re.Notice(`Deleted \u201C${this.getTitle(e)}\u201D from ${n.file.name}`)}openRowContextMenu(e,i){let n=this.sourceOf(e),o=new re.Menu;o.addItem(r=>r.setTitle("Open entry").setIcon("maximize").onClick(()=>this.openNoteExpander(e,"Notes"))),n&&o.addItem(r=>r.setTitle(`Open source: ${n.file.name}`).setIcon("file-spreadsheet").onClick(()=>void this.app.workspace.getLeaf("tab").openFile(n.file))),o.addSeparator(),o.addItem(r=>r.setTitle("Delete").setIcon("trash").onClick(()=>this.deleteRow(e))),o.showAtMouseEvent(i)}};function vl(s,t,e){e("csv-tasks",(i,n,o)=>{o.addChild(new Uo(n,s,t,jd(i),o.sourcePath))})}var yl='';var As=class extends rt.FileView{constructor(e,i,n){super(e);this.headers=[];this.rows=[];this.saveTimer=null;this.searchQuery="";this.lastDiskContent=null;this.contentArea=null;this.selectedDate=null;this.selectedHabit=null;this.chartInstance=null;this.timelineYear=new Date().getFullYear();this.libraryStatusFilter="all";this.libraryGenreFilter="all";this.collapsedGroups=new Set;this.taskProjectFilter="all";this.taskTypeFilter="all";this.focusIndex=0;this.focusNavPending=!1;this.tableSortCol=null;this.tableSortDir="asc";this.settings=i,this.persistSettings=n,this.mode=i.defaultMode,this.renderComponent=new rt.Component,this.renderComponent.load()}getViewType(){return di}getDisplayText(){var e,i;return(i=(e=this.file)==null?void 0:e.basename)!=null?i:"Card View"}getIcon(){return"table"}onload(){super.onload(),this.registerEvent(this.app.vault.on("modify",e=>{!this.file||e.path!==this.file.path||this.syncFromDisk()}))}async syncFromDisk(){if(!this.file)return;let e=await this.app.vault.read(this.file);if(e===this.lastDiskContent||this.saveTimer)return;this.lastDiskContent=e;let i=Mt(e);this.headers=i.headers,this.rows=i.rows,this.renderViewPreservingScroll()}async onLoadFile(e){var o;try{let r=await this.app.vault.read(e),a=Mt(r);this.headers=a.headers,this.rows=a.rows,this.lastDiskContent=r}catch(r){console.error("CardView load error",r),this.headers=[],this.rows=[],this.lastDiskContent=null,new rt.Notice(`Couldn't read ${e.name}: ${r instanceof Error?r.message:String(r)}`,8e3)}this.file&&((o=this.settings.fileConfigs[this.file.path])!=null&&o.defaultMode)?this.mode=this.settings.fileConfigs[this.file.path].defaultMode:this.isTravelFile()?this.mode="travel":this.hasDateColumn()?this.mode="dashboard":this.mode=this.settings.defaultMode;let i=this.mode==="kanban-genre"||this.mode==="library",n=this.mode==="dashboard";(i&&!zt(this)||n&&!this.hasDateColumn()||this.mode==="travel"&&!this.isTravelFile()||this.mode==="stats"&&!xi(this)||this.mode==="chart"&&!hn(this)||this.mode==="tasks"&&!Fe(this))&&(this.mode="table"),this.selectedDate=null,this.focusIndex=0,this.tableSortCol=null,this.renderView()}async onUnloadFile(e){this.chartInstance&&(this.chartInstance.destroy(),this.chartInstance=null),this.headers=[],this.rows=[],this.contentEl.empty()}scheduleSave(){this.saveTimer&&window.clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>{this.doSave()},600)}async doSave(){if(this.file)try{let e=xl.default.unparse(this.rows,{columns:this.headers});try{let i=await this.app.vault.read(this.file);this.lastDiskContent!==null&&i!==this.lastDiskContent&&i!==e&&await rs(this.app,this.file,i)}catch(i){}this.lastDiskContent=e,await this.app.vault.modify(this.file,e)}catch(e){console.error("CardView save error",e),new rt.Notice(`Couldn't save ${this.file.name}: ${e instanceof Error?e.message:String(e)}`,8e3)}}get fileCfg(){var e;return this.file?(e=this.settings.fileConfigs[this.file.path])!=null?e:{}:{}}saveFileCfg(e){this.file&&(this.settings.fileConfigs[this.file.path]=e,this.persistSettings())}isHighlighted(e){var i;return((i=this.fileCfg.highlightedTitles)!=null?i:[]).includes(this.getTitle(e))}toggleHighlight(e){let i=this.getTitle(e),n=this.fileCfg,o=n.highlightedTitles?[...n.highlightedTitles]:[],r=o.indexOf(i);r>=0?o.splice(r,1):o.push(i),n.highlightedTitles=o,this.saveFileCfg(n)}addColumn(e){let i=e.trim();return i?this.headers.some(n=>n.toLowerCase()===i.toLowerCase())?`"${i}" already exists.`:(this.headers.push(i),this.rows.forEach(n=>{n[i]=""}),this.scheduleSave(),this.renderViewPreservingScroll(),null):"Column name can't be empty."}removeColumn(e){this.headers=this.headers.filter(n=>n!==e),this.rows.forEach(n=>{delete n[e]});let i=this.fileCfg;i.categoryColumn===e&&(i.categoryColumn=void 0),i.statusColumn===e&&(i.statusColumn=void 0),i.notesColumn===e&&(i.notesColumn=void 0),i.ankiFrontCol===e&&(i.ankiFrontCol=void 0),i.kanbanGroupCol===e&&(i.kanbanGroupCol=void 0),i.habitColumns&&(i.habitColumns=i.habitColumns.filter(n=>n!==e)),i.cardFields&&(i.cardFields=i.cardFields.filter(n=>n!==e)),i.categoricalColumns&&(i.categoricalColumns=i.categoricalColumns.filter(n=>n!==e)),this.saveFileCfg(i),this.scheduleSave(),this.renderViewPreservingScroll()}resolveCol(e){for(let i of e){let n=this.headers.find(o=>o.toLowerCase()===i.toLowerCase());if(n)return n}return null}getNotesCol(){return this.fileCfg.notesColumn!==void 0?this.fileCfg.notesColumn===""?null:this.fileCfg.notesColumn:this.resolveCol(pe)}isNotesCol(e){let i=this.getNotesCol();return i?e===i:this.settings.notesColumns.some(n=>n.toLowerCase()===e.toLowerCase())}isSelectCol(e){return this.settings.selectColumns.some(i=>i.toLowerCase()===e.toLowerCase())}isCategoricalCol(e){var n;let i=(n=this.titleKey())!=null?n:this.headers[0];return e===i||this.isDateCol(e)||vt(e)?!1:this.fileCfg.categoricalColumns?this.fileCfg.categoricalColumns.includes(e):this.isSelectCol(e)||qt(this.getColumnValues(e).length)}autoDetectCategoricalColumns(){var i;let e=(i=this.titleKey())!=null?i:this.headers[0];return this.headers.filter(n=>n===e||this.isDateCol(n)||vt(n)||this.isNotesCol(n)?!1:this.isSelectCol(n)||qt(this.getColumnValues(n).length))}isDateCol(e){var i;return(i=this.fileCfg.dateColumns)!=null&&i.includes(e)?!0:kt(e)}getStatusCol(){var e;return this.fileCfg.statusColumn!==void 0?this.fileCfg.statusColumn===""?null:(e=this.headers.find(i=>i.toLowerCase()===this.fileCfg.statusColumn.toLowerCase()))!=null?e:null:this.resolveCol(is)}getCategoryCol(){var e;return this.fileCfg.categoryColumn!==void 0?this.fileCfg.categoryColumn===""?null:(e=this.headers.find(i=>i.toLowerCase()===this.fileCfg.categoryColumn.toLowerCase()))!=null?e:null:this.resolveCol(ss)}titleKey(){var e,i;return this.fileCfg.titleColumn!==void 0?this.fileCfg.titleColumn===""?void 0:(e=this.headers.find(n=>n.toLowerCase()===this.fileCfg.titleColumn.toLowerCase()))!=null?e:void 0:(i=this.resolveCol(fe))!=null?i:void 0}authorKey(){var e;return(e=this.resolveCol(["Author","author","Authors","authors","Director","director","Artist","artist","Creator","creator","By","by"]))!=null?e:void 0}getTitle(e){var n;let i=this.titleKey();return(n=i?e[i]:e[this.headers[0]])!=null?n:"\u2014"}getSubtitle(e){var n;let i=this.authorKey();return i&&(n=e[i])!=null?n:""}getColumnValues(e){return Array.from(new Set(this.rows.map(i=>{var n;return(n=i[e])!=null?n:""}).filter(Boolean))).sort()}getImageCol(){var e;return this.fileCfg.imageColumn!==void 0?this.fileCfg.imageColumn===""?null:(e=this.headers.find(i=>i.toLowerCase()===this.fileCfg.imageColumn.toLowerCase()))!=null?e:null:this.resolveCol(es)}notesFilePath(e){var a,L,l;let i=Ie(this.getTitle(e)),n=(l=(L=(a=this.file)==null?void 0:a.parent)==null?void 0:L.path)!=null?l:"",o=this.settings.notesSubfolder.trim(),r=o?n?`${n}/${o}`:o:n;return(0,rt.normalizePath)(`${r}/${i}.md`)}notesFileExists(e){return!!this.app.vault.getAbstractFileByPath(this.notesFilePath(e))}deleteWithUndo(e){let i=this.rows.indexOf(e);if(i<0)return;this.rows.splice(i,1),this.scheduleSave(),this.renderViewPreservingScroll();let n=this.getTitle(e)||"entry",o=createFragment();o.createSpan({text:`Deleted \u201C${n}\u201D. `});let r=o.createEl("button",{text:"Undo",cls:"csv-notice-undo"}),a=new rt.Notice(o,6e3);r.addEventListener("click",()=>{if(r.hasAttribute("disabled"))return;r.setAttribute("disabled","true");let L=Math.min(i,this.rows.length);this.rows.splice(L,0,e),this.scheduleSave(),this.renderViewPreservingScroll(),a.hide(),new rt.Notice(`Restored \u201C${n}\u201D`,2500)})}openRowContextMenu(e,i){let n=new rt.Menu;n.addItem(a=>a.setTitle("Open / create notes file").setIcon("file-text").onClick(()=>this.openOrCreateNotes(e))),n.addItem(a=>a.setTitle("Open entry").setIcon("maximize").onClick(()=>{var L;return this.openNoteExpander(e,(L=this.getNotesCol())!=null?L:"")}));let o=this.getStatusCol();if(o){let a=this.getColumnValues(o);a.length&&(n.addSeparator(),a.forEach(L=>{L!==e[o]&&n.addItem(l=>l.setTitle(`Mark as: ${L}`).onClick(()=>{e[o]=L,this.scheduleSave(),this.renderViewPreservingScroll()}))}))}n.addSeparator();let r=this.isHighlighted(e);n.addItem(a=>a.setTitle(r?"Remove highlight":"Highlight").setIcon("highlighter").onClick(()=>{this.toggleHighlight(e),this.renderViewPreservingScroll()})),n.addSeparator(),n.addItem(a=>a.setTitle("Delete").setIcon("trash").onClick(()=>this.deleteWithUndo(e))),n.showAtMouseEvent(i)}async openOrCreateNotes(e){var o,r;let i=this.notesFilePath(e),n=this.app.vault.getAbstractFileByPath(i);if(!n){let a={},L=Fe(this)?Zo(this):null,l=L?((o=e[L])!=null?o:"").split(",").map(f=>Qo(f.trim())).filter(Boolean).map(f=>`project-${f}`):[];l.length&&(a.tags=l);for(let f of this.headers)!this.isNotesCol(f)&&e[f]&&(a[f]=e[f]);this.file&&!Object.keys(a).some(f=>f.toLowerCase()==="source")&&(a.source=`[[${this.file.path}]]`);let c=["---",(0,rt.stringifyYaml)(a).trimEnd(),"---","",`# ${this.getTitle(e)}`,"",""].join(` +`),d=this.headers.find(f=>this.isNotesCol(f)),h=c+(d&&((r=e[d])!=null&&r.trim())?e[d]:""),u=i.substring(0,i.lastIndexOf("/"));u&&!this.app.vault.getAbstractFileByPath(u)&&await this.app.vault.createFolder(u),n=await this.app.vault.create(i,h),new rt.Notice(`Created: ${n.name}`)}await this.app.workspace.getLeaf("tab").openFile(n)}openNoteExpander(e,i){var n,o;new me(this.app,e,i,this.headers,(o=(n=this.file)==null?void 0:n.path)!=null?o:"",this.isNotesCol.bind(this),this.isSelectCol.bind(this),this.getColumnValues.bind(this),r=>{Object.assign(e,r),this.scheduleSave(),this.renderViewPreservingScroll()},()=>this.deleteWithUndo(e),r=>this.isCategoricalCol(r),this.titleKey(),r=>this.getBooleanColumns().includes(r),r=>this.isDateCol(r)).open()}renderViewPreservingScroll(){var L,l,c,d,h;let e=this.contentEl,i=e.querySelector(".csv-content-area"),n=e.querySelector(".csv-table-wrapper"),o=e.querySelector(".csv-kanban-board"),r={contentTop:(L=i==null?void 0:i.scrollTop)!=null?L:0,contentLeft:(l=i==null?void 0:i.scrollLeft)!=null?l:0,tableLeft:(c=n==null?void 0:n.scrollLeft)!=null?c:0,tableTop:(d=n==null?void 0:n.scrollTop)!=null?d:0,boardLeft:(h=o==null?void 0:o.scrollLeft)!=null?h:0,cols:new Map};e.querySelectorAll(".csv-kanban-col").forEach(u=>{var m,g;let f=(g=(m=u.querySelector(".csv-kanban-col-title"))==null?void 0:m.textContent)!=null?g:"",p=u.querySelector(".csv-kanban-col-body");f&&p&&r.cols.set(f,p.scrollTop)}),this.renderView();let a=()=>{let u=this.contentEl.querySelector(".csv-content-area"),f=this.contentEl.querySelector(".csv-table-wrapper"),p=this.contentEl.querySelector(".csv-kanban-board");u&&(u.scrollTop=r.contentTop,u.scrollLeft=r.contentLeft),f&&(f.scrollLeft=r.tableLeft,f.scrollTop=r.tableTop),p&&(p.scrollLeft=r.boardLeft),this.contentEl.querySelectorAll(".csv-kanban-col").forEach(m=>{var S,C;let g=(C=(S=m.querySelector(".csv-kanban-col-title"))==null?void 0:S.textContent)!=null?C:"",b=m.querySelector(".csv-kanban-col-body"),_=r.cols.get(g);b&&_!=null&&(b.scrollTop=_)})};a(),window.requestAnimationFrame(()=>{a(),window.requestAnimationFrame(a)}),window.setTimeout(a,50)}openAddModal(){let e={};if(Fe(this)){let i=un(this);i&&(e[i]=["Task","Note","Idea"]);let n=fn(this);n&&(e[n]=["Low","Medium","High"])}new as(this.app,this.headers,this.isNotesCol.bind(this),this.isSelectCol.bind(this),this.getColumnValues.bind(this),i=>{this.rows.push(i),this.scheduleSave(),this.renderViewPreservingScroll(),new rt.Notice(`Added: ${this.getTitle(i)}`)},e,i=>this.getBooleanColumns().includes(i),i=>this.isCategoricalCol(i),this.titleKey(),i=>this.isDateCol(i)).open()}renderSelectField(e,i,n){var a;let o=(a=i[n])!=null?a:"",r=e.createDiv({cls:`csv-select-chip ${o?"":"empty"}`});return r.setText(o||"\u2014"),n.toLowerCase()==="status"&&o&&r.addClass(`status-chip-${o.toLowerCase().replace(/\s+/g,"-")}`),r.addEventListener("click",L=>{var l;L.stopPropagation(),Bt(r,(l=i[n])!=null?l:"",this.getColumnValues(n),c=>{i[n]=c,r.setText(c||"\u2014"),r.className=`csv-select-chip ${c?"":"empty"}`,n.toLowerCase()==="status"&&c&&r.addClass(`status-chip-${c.toLowerCase().replace(/\s+/g,"-")}`),this.scheduleSave()},this.contentEl,{multi:vt(n)})}),r}renderView(e=!1){var o;let i=this.contentEl;e?this.contentArea&&this.contentArea.empty():(i.empty(),i.addClass("datadeck-root"),this.renderComponent.unload(),this.renderComponent=new rt.Component,this.renderComponent.load(),al(this,i),this.contentArea=i.createDiv({cls:"csv-content-area"}),this.installTouchScrollGuard(this.contentArea));let n=this.contentArea;if(n){if(n.toggleClass("csv-content-area--no-yscroll",this.mode==="kanban-genre"||this.mode==="table"),!this.headers.length){let r=n.createDiv({cls:"csv-empty-state csv-empty-state--big"});r.createEl("h3",{text:"This file is empty"}),r.createEl("p",{text:"Add a header row in your spreadsheet app, then come back \u2014 or click + add in the toolbar to start fresh."});return}if(this.rows.length===0){let r=n.createDiv({cls:"csv-empty-state csv-empty-state--big"});r.createEl("h3",{text:"No entries yet"}),r.createEl("button",{cls:"csv-empty-state-action",text:"+ add the first entry"}).addEventListener("click",()=>this.openAddModal()),r.createEl("p",{cls:"csv-empty-state-hint",text:`${this.headers.length} column${this.headers.length===1?"":"s"} detected: ${this.headers.slice(0,5).join(", ")}${this.headers.length>5?"\u2026":""}`});return}this.mode==="travel"?ur(n,this.rows,()=>this.loadMapSvg(),()=>this.scheduleSave(),this.settings.showResidency===!1?null:(o=this.settings.residencyRules)!=null?o:null,r=>this.renderComponent.register(r)):this.mode==="dashboard"?ll(this,n):this.mode==="library"?_i(this,n):this.mode==="kanban-genre"?Ci(this,n):this.mode==="stats"?vr(this,n):this.mode==="chart"?sl(this,n):this.mode==="focus"?cl(this,n):this.mode==="tasks"?pn(this,n):yi(this,n)}}installTouchScrollGuard(e){if(!matchMedia("(pointer: coarse)").matches)return;let i=0,n=0,o=!1;e.addEventListener("touchstart",r=>{r.touches.length===1&&(i=r.touches[0].clientX,n=r.touches[0].clientY,o=!1)},{capture:!0,passive:!0}),e.addEventListener("touchmove",r=>{if(r.touches.length!==1||o)return;let a=Math.abs(r.touches[0].clientX-i),L=Math.abs(r.touches[0].clientY-n);(a>10||L>10)&&(o=!0)},{capture:!0,passive:!0}),e.addEventListener("click",r=>{o&&(r.preventDefault(),r.stopImmediatePropagation())},!0)}async backupToArchive(){var a,L;if(!this.file)return;let e=(L=(a=this.file.parent)==null?void 0:a.path)!=null?L:"",i=e?`${e}/Archive`:"Archive";await this.app.vault.adapter.exists(i)||await this.app.vault.adapter.mkdir(i);let n=this.formatDate(new Date),o=`${i}/${this.file.basename}_${n}.${this.file.extension}`;if(await this.app.vault.adapter.exists(o)){new rt.Notice(`Backup already exists for today: ${o}`);return}let r=await this.app.vault.readBinary(this.file);await this.app.vault.adapter.writeBinary(o,r),new rt.Notice(`Backed up to ${o}`)}hasDateColumn(){return this.getDateCol()!==null}isTravelFile(){let e=new Set(this.headers.map(i=>i.toLowerCase()));return e.has("country")&&e.has("date_entered")&&e.has("date_left")&&e.has("source")}async loadMapSvg(){return yl}getFilteredRows(){var n;let e=this.rows;if(this.searchQuery.trim()){let o=this.searchQuery.toLowerCase().trim();e=e.filter(r=>this.headers.some(a=>{var l;return((l=r[a])!=null?l:"").toLowerCase().includes(o)}))}if(this.mode==="table"&&this.tableSortCol&&this.headers.includes(this.tableSortCol))return Jo(e,this.tableSortCol,this.tableSortDir);let i=this.getDateCol();if(this.mode==="table"&&i){let o=(n=this.fileCfg.sortNewestFirst)!=null?n:!0;e=[...e].sort((r,a)=>{var d,h;let L=(d=r[i])!=null?d:"",l=(h=a[i])!=null?h:"",c=L.localeCompare(l);return o?-c:c})}return e}getDateCol(){var a;if(this.fileCfg.dateColumns&&this.fileCfg.dateColumns.length>0){let L=this.fileCfg.dateColumns[0];return(a=this.headers.find(l=>l===L))!=null?a:null}if(this.headers.length===0)return null;let e=this.headers[0],i=e.toLowerCase();if(["date","day","datum"].includes(i))return e;let n=this.rows.slice(0,5),o=/^\d{4}-\d{2}-\d{2}$/;return n.length>0&&n.every(L=>{var l;return o.test((l=L[e])!=null?l:"")})?e:null}getBooleanColumns(){return this.fileCfg.habitColumns?this.fileCfg.habitColumns.filter(e=>this.headers.includes(e)):this.autoDetectBooleanColumns()}cleanupBooleanColumn(e){let i=0;return this.rows.forEach(n=>{var r;let o=this.isTruthy((r=n[e])!=null?r:"")?"1":"0";n[e]!==o&&i++,n[e]=o}),i>0&&(this.scheduleSave(),this.renderViewPreservingScroll()),i}autoDetectBooleanColumns(){return this.headers.filter(e=>{if(e===this.getDateCol()||this.isNotesCol(e))return!1;let i=this.rows.map(n=>{var o;return((o=n[e])!=null?o:"").toLowerCase().trim()});return ns(i)})}parseDate(e){let i=e.match(/^(\d{4})-(\d{2})-(\d{2})$/);return i?new Date(parseInt(i[1]),parseInt(i[2])-1,parseInt(i[3])):null}formatDate(e){let i=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${i}-${n}-${o}`}isTruthy(e){return os(e)}renderMarkdownInto(e,i){var n,o;rt.MarkdownRenderer.render(this.app,i,e,(o=(n=this.file)==null?void 0:n.path)!=null?o:"",this.renderComponent)}cycleMode(){let e=gn(this);if(e.length<2)return;let i=e.findIndex(n=>n.id===this.mode);this.mode=e[(i+1)%e.length].id,this.renderView()}onunload(){this.renderComponent.unload(),this.saveTimer&&window.clearTimeout(this.saveTimer)}},Yd=[{id:"tasks",command:"Create tasks file",defaultName:"Tasks",headers:["Title","Type","Project","Priority","Due","Status","Notes"],mode:"tasks",configOverrides:{categoricalColumns:["Type","Priority"],dateColumns:["Due"],statusColumn:"Status",notesColumn:"Notes"}},{id:"travel",command:"Create travel file",defaultName:"Travel",headers:["date_entered","date_left","country","city","visa_status","notes","source","resolved"],mode:"travel"},{id:"habits",command:"Create habit tracker file",defaultName:"Habits",headers:["Date","Exercise","Meditate","Read","Notes"],mode:"dashboard",configOverrides:{habitColumns:["Exercise","Meditate","Read"],notesColumn:"Notes",statusColumn:""}},{id:"chart",command:"Create chart file",defaultName:"Measurements",headers:["Date","Value","Notes"],mode:"chart",configOverrides:{chartYCol:"Value",chartFit:"linear",notesColumn:"Notes"}}],vn=class extends rt.Plugin{constructor(){super(...arguments);this.settings=Sn}async onload(){await this.loadSettings(),this.registerView(di,e=>new As(e,this.settings,()=>this.saveSettings())),this.registerExtensions(["csv"],di),this.addSettingTab(new vi(this.app,this)),this.registerMarkdownCodeBlockProcessor("csv-add",async(e,i,n)=>{await pr(this.app,e.trim(),i,n,this.settings.fileConfigs)}),this.registerMarkdownCodeBlockProcessor("csv-random",async(e,i,n)=>{await Ll(this.app,e.trim(),i,n)}),ul(this.app,this.settings,()=>this.saveSettings(),(e,i)=>this.registerMarkdownCodeBlockProcessor(e,i)),gl(this.app,(e,i)=>this.registerMarkdownCodeBlockProcessor(e,i)),vl(this.app,this.settings,(e,i)=>this.registerMarkdownCodeBlockProcessor(e,i)),this.addCommand({id:"add-entry",name:"Add entry to current CSV",checkCallback:e=>{let i=this.app.workspace.getActiveViewOfType(As);return i?(e||i.openAddModal(),!0):!1}}),this.addCommand({id:"cycle-view-mode",name:"Cycle view mode",checkCallback:e=>{let i=this.app.workspace.getActiveViewOfType(As);return i?(e||i.cycleMode(),!0):!1}});for(let e of Yd)this.addCommand({id:`create-${e.id}`,name:e.command,callback:()=>this.createTemplateFile(e)});this.registerEvent(this.app.vault.on("rename",async(e,i)=>{e instanceof rt.TFile&&e.extension==="csv"&&this.settings.fileConfigs[i]&&(nr(this.settings.fileConfigs,i,e.path),await this.saveSettings())})),this.registerEvent(this.app.vault.on("delete",async e=>{e instanceof rt.TFile&&this.settings.fileConfigs[e.path]&&(delete this.settings.fileConfigs[e.path],await this.saveSettings())})),this.registerMarkdownCodeBlockProcessor("csv-refresh",(e,i,n)=>{i.createEl("button",{cls:"csv-refresh-btn",text:"\u21BB refresh"}).addEventListener("click",()=>{(async()=>{let r=n.sourcePath,a=this.app.vault.getAbstractFileByPath(r);a instanceof rt.TFile&&await this.app.workspace.getLeaf(!1).openFile(a,{state:{mode:"preview"}})})()})})}async createTemplateFile(e){new gi(this.app,e.command,e.defaultName,"File name (without .csv)",i=>{(async()=>{let n=this.app.workspace.getActiveFile(),o=n!=null&&n.parent&&n.parent.path!=="/"?`${n.parent.path}/`:"",r=Ie(i),a=(0,rt.normalizePath)(`${o}${r}.csv`);for(let c=2;this.app.vault.getAbstractFileByPath(a);c++)a=(0,rt.normalizePath)(`${o}${r} ${c}.csv`);let L=await this.app.vault.create(a,e.headers.join(",")+` +`),l=this.settings.fileConfigs[L.path]||{};this.settings.fileConfigs[L.path]={...l,defaultMode:e.mode,...e.configOverrides||{}},await this.saveSettings(),await this.app.workspace.getLeaf("tab").openFile(L),new rt.Notice(`Created: ${L.name}`)})()}).open()}async loadSettings(){var i;let e=await this.loadData();this.settings=Object.assign({},Sn,e),this.settings.residencyRules=JSON.parse(JSON.stringify((i=this.settings.residencyRules)!=null?i:[]))}async saveSettings(){await this.saveData(this.settings)}}; /*! Bundled license information: papaparse/papaparse.min.js: diff --git a/main.ts b/main.ts index a5d0f98..dff83f4 100644 --- a/main.ts +++ b/main.ts @@ -1,5 +1,4 @@ import { - App, Plugin, FileView, WorkspaceLeaf, @@ -19,9 +18,9 @@ import type { Chart as ChartType } from "chart.js"; // Import from src modules import { CSVRow, ViewMode, FileConfig, CardViewSettings, DEFAULT_SETTINGS, CARD_VIEW_TYPE } from "./src/types"; -import { sanitizeFilename, tagify, titleCase, formatRatingForDisplay, showSelectPicker, parseCSV, migrateFileConfigKey, sortRowsByColumn, isMultiValueColName, IMAGE_COL_ALIASES, TITLE_COL_ALIASES, CATEGORY_COL_ALIASES, STATUS_COL_ALIASES, NOTES_COL_ALIASES, looksBoolean, looksCategorical, isTruthyVal, stashSyncConflict } from "./src/utils"; +import { sanitizeFilename, tagify, showSelectPicker, parseCSV, migrateFileConfigKey, sortRowsByColumn, isMultiValueColName, IMAGE_COL_ALIASES, TITLE_COL_ALIASES, CATEGORY_COL_ALIASES, STATUS_COL_ALIASES, NOTES_COL_ALIASES, looksBoolean, looksCategorical, isTruthyVal, stashSyncConflict } from "./src/utils"; import { isDateCol } from "./src/field-types"; -import { AddEntryModal, NoteExpanderModal, FileConfigModal, SearchModal, PromptModal } from "./src/modals"; +import { AddEntryModal, NoteExpanderModal, PromptModal } from "./src/modals"; import { renderTravel } from "./src/travel-view"; import { CardViewSettingTab } from "./src/settings-tab"; import { renderAddEntryForm } from "./src/add-entry-form"; @@ -38,16 +37,7 @@ import { renderTasks, hasTaskColumns, taskProjectCol, taskTypeCol, taskPriorityC import { registerCsvViewBlock } from "./src/inline-view"; import { registerCsvChartBlock } from "./src/chart-block"; import { registerCsvTasksBlock } from "./src/tasks-block"; - -// World-map SVG asset, loaded lazily from the plugin dir and cached for the -// session (undefined = not yet read, null = read failed/missing). -let worldMapSvgCache: string | null | undefined = undefined; - -// Injected by esbuild at build time (see esbuild.config.mjs). Surfaced via -// the ⋯ menu so the user can confirm which build is actually loaded — -// handy on mobile where sync of the deployed bundle can lag. -declare const __BUILD_TIME__: string; - +import worldMapSvg from "./world-map.svg"; // ─── View ──────────────────────────────────────────────────────────────────── @@ -165,7 +155,7 @@ export class CardView extends FileView { scheduleSave(): void { if (this.saveTimer) window.clearTimeout(this.saveTimer); - this.saveTimer = window.setTimeout(() => this.doSave(), 600); + this.saveTimer = window.setTimeout(() => { void this.doSave(); }, 600); } private async doSave(): Promise { @@ -406,7 +396,7 @@ export class CardView extends FileView { this.renderViewPreservingScroll(); const title = this.getTitle(row) || "entry"; - const frag = document.createDocumentFragment(); + const frag = createFragment(); frag.createSpan({ text: `Deleted “${title}”. ` }); const undoBtn = frag.createEl("button", { text: "Undo", cls: "csv-notice-undo" }); const notice = new Notice(frag, 6000); @@ -433,7 +423,7 @@ export class CardView extends FileView { */ openRowContextMenu(row: CSVRow, e: MouseEvent): void { const menu = new Menu(); - menu.addItem(i => i.setTitle("Open / Create Notes file").setIcon("file-text").onClick(() => this.openOrCreateNotes(row))); + menu.addItem(i => i.setTitle("Open / create notes file").setIcon("file-text").onClick(() => this.openOrCreateNotes(row))); // Always offered — the expander edits every structured field; on files // without a notes column it simply omits the notes editor. menu.addItem(i => i.setTitle("Open entry").setIcon("maximize").onClick(() => this.openNoteExpander(row, this.getNotesCol() ?? ""))); @@ -488,7 +478,7 @@ export class CardView extends FileView { file = await this.app.vault.create(path,content); new Notice(`Created: ${file.name}`); } - await this.app.workspace.getLeaf("tab").openFile(file as TFile); + await this.app.workspace.getLeaf("tab").openFile(file); } openNoteExpander(row: CSVRow, notesCol: string): void { @@ -567,11 +557,11 @@ export class CardView extends FileView { }); }; restore(); - requestAnimationFrame(() => { + window.requestAnimationFrame(() => { restore(); - requestAnimationFrame(restore); + window.requestAnimationFrame(restore); }); - setTimeout(restore, 50); + window.setTimeout(restore, 50); } openAddModal(): void { @@ -663,7 +653,7 @@ export class CardView extends FileView { // a new xlsx in Numbers/Excel and there's nothing inside yet). const wrap = content.createDiv({ cls: "csv-empty-state csv-empty-state--big" }); wrap.createEl("h3", { text: "This file is empty" }); - wrap.createEl("p", { text: "Add a header row in your spreadsheet app, then come back — or click + Add in the toolbar to start fresh." }); + wrap.createEl("p", { text: "Add a header row in your spreadsheet app, then come back — or click + add in the toolbar to start fresh." }); return; } if (this.rows.length === 0) { @@ -672,7 +662,7 @@ export class CardView extends FileView { // "is this broken?" rather than "I haven't added anything yet." const wrap = content.createDiv({ cls: "csv-empty-state csv-empty-state--big" }); wrap.createEl("h3", { text: "No entries yet" }); - const addBtn = wrap.createEl("button", { cls: "csv-empty-state-action", text: "+ Add the first entry" }); + const addBtn = wrap.createEl("button", { cls: "csv-empty-state-action", text: "+ add the first entry" }); addBtn.addEventListener("click", () => this.openAddModal()); wrap.createEl("p", { cls: "csv-empty-state-hint", text: `${this.headers.length} column${this.headers.length === 1 ? "" : "s"} detected: ${this.headers.slice(0, 5).join(", ")}${this.headers.length > 5 ? "…" : ""}` }); return; @@ -775,21 +765,14 @@ export class CardView extends FileView { } /** - * Load the world-map SVG shipped alongside the plugin. Cached at module - * level so it's read once per session (it's ~110 KB). Kept out of the JS - * bundle deliberately — inlining it would only shrink the bundle by - * ~12 KB, not worth the size/complexity tradeoff. Returns null if the - * asset is missing. + * World-map SVG for the travel view. Inlined into the bundle at build + * time (esbuild text loader) rather than read from a separate release + * asset — Obsidian's plugin installer only ever downloads main.js, + * styles.css, and manifest.json, so a standalone world-map.svg release + * file would never reach community-store installs. */ private async loadMapSvg(): Promise { - if (worldMapSvgCache !== undefined) return worldMapSvgCache; - const path = normalizePath(`${this.app.vault.configDir}/plugins/datadeck/world-map.svg`); - try { - worldMapSvgCache = await this.app.vault.adapter.read(path); - } catch (_e) { - worldMapSvgCache = null; - } - return worldMapSvgCache; + return worldMapSvg; } // ── Search filtering ───────────────────────────────────────────────────────── @@ -1168,19 +1151,18 @@ export default class CardViewPlugin extends Plugin { // Register csv-refresh code block for manual refresh button this.registerMarkdownCodeBlockProcessor("csv-refresh", (source, el, ctx) => { const btn = el.createEl("button", { - cls: "csv-refresh-btn" + cls: "csv-refresh-btn", + text: "↻ refresh" }); - btn.innerHTML = "↻ refresh"; - btn.addEventListener("click", async () => { - // Close and reopen the note to force Dataview to re-read CSV - const currentPath = ctx.sourcePath; - const file = this.app.vault.getAbstractFileByPath(currentPath); - if (file instanceof TFile) { - const leaf = this.app.workspace.activeLeaf; - if (leaf) { - await leaf.openFile(file, { state: { mode: "preview" } }); + btn.addEventListener("click", () => { + void (async () => { + // Close and reopen the note to force Dataview to re-read CSV + const currentPath = ctx.sourcePath; + const file = this.app.vault.getAbstractFileByPath(currentPath); + if (file instanceof TFile) { + await this.app.workspace.getLeaf(false).openFile(file, { state: { mode: "preview" } }); } - } + })(); }); }); } @@ -1198,33 +1180,36 @@ export default class CardViewPlugin extends Plugin { tpl.command, tpl.defaultName, "File name (without .csv)", - async (name) => { - // Drop into the active file's folder so a tracker lands beside related - // notes; fall back to the vault root. - const active = this.app.workspace.getActiveFile(); - const folder = active?.parent && active.parent.path !== "/" ? `${active.parent.path}/` : ""; - const base = sanitizeFilename(name); - let path = normalizePath(`${folder}${base}.csv`); - for (let n = 2; this.app.vault.getAbstractFileByPath(path); n++) { - path = normalizePath(`${folder}${base} ${n}.csv`); - } - const file = await this.app.vault.create(path, tpl.headers.join(",") + "\n"); - // Pin the renderer up front so the file opens in its template's view - // even before the user adds a row that would trigger auto-detection. - const baseConfig = this.settings.fileConfigs[file.path] || {}; - this.settings.fileConfigs[file.path] = { ...baseConfig, defaultMode: tpl.mode, ...(tpl.configOverrides || {}) }; - await this.saveSettings(); - await this.app.workspace.getLeaf("tab").openFile(file); - new Notice(`Created: ${file.name}`); + (name) => { + void (async () => { + // Drop into the active file's folder so a tracker lands beside related + // notes; fall back to the vault root. + const active = this.app.workspace.getActiveFile(); + const folder = active?.parent && active.parent.path !== "/" ? `${active.parent.path}/` : ""; + const base = sanitizeFilename(name); + let path = normalizePath(`${folder}${base}.csv`); + for (let n = 2; this.app.vault.getAbstractFileByPath(path); n++) { + path = normalizePath(`${folder}${base} ${n}.csv`); + } + const file = await this.app.vault.create(path, tpl.headers.join(",") + "\n"); + // Pin the renderer up front so the file opens in its template's view + // even before the user adds a row that would trigger auto-detection. + const baseConfig = this.settings.fileConfigs[file.path] || {}; + this.settings.fileConfigs[file.path] = { ...baseConfig, defaultMode: tpl.mode, ...(tpl.configOverrides || {}) }; + await this.saveSettings(); + await this.app.workspace.getLeaf("tab").openFile(file); + new Notice(`Created: ${file.name}`); + })(); } ).open(); } async loadSettings(): Promise { - this.settings=Object.assign({},DEFAULT_SETTINGS,await this.loadData()); + const saved = await this.loadData() as Partial | null; + this.settings=Object.assign({},DEFAULT_SETTINGS,saved); // Deep-clone so the in-app editor mutates this file's settings, not the // shared DEFAULT_RESIDENCY_RULES constant (a reference when data.json has none). - this.settings.residencyRules = JSON.parse(JSON.stringify(this.settings.residencyRules ?? [])); + this.settings.residencyRules = JSON.parse(JSON.stringify(this.settings.residencyRules ?? [])) as CardViewSettings["residencyRules"]; } async saveSettings(): Promise { await this.saveData(this.settings); } } diff --git a/package-lock.json b/package-lock.json index 612bf51..332e833 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "datadeck", - "version": "1.5.0", + "version": "1.6.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "datadeck", - "version": "1.5.0", + "version": "1.6.0", "dependencies": { "@types/papaparse": "^5.5.2", "chart.js": "^4.5.1", @@ -14,7 +14,10 @@ }, "devDependencies": { "@types/node": "^18.0.0", + "@typescript-eslint/parser": "^8.64.0", "esbuild": "^0.19.0", + "eslint": "^9.39.5", + "eslint-plugin-obsidianmd": "^0.4.1", "jsdom": "^29.1.1", "obsidian": "latest", "typescript": "^5.0.0" @@ -640,6 +643,258 @@ "node": ">=12" } }, + "node_modules/@eslint-community/eslint-plugin-eslint-comments": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-4.7.2.tgz", + "integrity": "sha512-LF03qURSwEWm2dz5wtdDCzNk+7Opl0X7q6I3undsaIuNsEiNvRV3BCtqu14Q/6Pzg1tBj44LcxpW2EpSLZStZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^4.0.0", + "ignore": "^7.0.5" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0" + } + }, + "node_modules/@eslint-community/eslint-plugin-eslint-comments/node_modules/ignore": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.6.tgz", + "integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.21.2", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.2.tgz", + "integrity": "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.7", + "debug": "^4.3.1", + "minimatch": "^3.1.5" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-array/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.16.tgz", + "integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.6.tgz", + "integrity": "sha512-l2Ul9PrHsPCKcEY/ac7VgFj9D80C7S68sOKc618SyHDPK36s1XcFebXY0iTzUVn4Yq+YbwvSnDmCz9yxjX+QrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.14.0", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.3.0", + "minimatch": "^3.1.5", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.16.tgz", + "integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "9.39.5", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.5.tgz", + "integrity": "sha512-QywQuszQh77pIXCsq998c8hbhSTI/azTty1Z6N53dmAudKHhy573j3yvRLsX2BSp8YpLtoCEG8E9DJe+8zUh4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/json": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@eslint/json/-/json-0.14.0.tgz", + "integrity": "sha512-rvR/EZtvUG3p9uqrSmcDJPYSH7atmWr0RnFWN6m917MAPx82+zQgPUmDu0whPFG6XTyM0vB/hR6c1Q63OaYtCQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0", + "@eslint/plugin-kit": "^0.4.1", + "@humanwhocodes/momoa": "^3.3.10", + "natural-compare": "^1.4.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@exodus/bytes": { "version": "1.15.1", "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.1.tgz", @@ -658,6 +913,82 @@ } } }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/momoa": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/@humanwhocodes/momoa/-/momoa-3.3.10.tgz", + "integrity": "sha512-KWiFQpSAqEIyrTXko3hFNLeQvSK8zXlJQzhhxsyVn58WFRYXST99b3Nqnu+ttOtjds2Pl2grUHGpe2NzhPynuQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@kurkle/color": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.4.tgz", @@ -672,6 +1003,64 @@ "license": "MIT", "peer": true }, + "node_modules/@microsoft/eslint-plugin-sdl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@microsoft/eslint-plugin-sdl/-/eslint-plugin-sdl-1.1.0.tgz", + "integrity": "sha512-dxdNHOemLnBhfY3eByrujX9KyLigcNtW8sU+axzWv5nLGcsSBeKW2YYyTpfPo1hV8YPOmIGnfA4fZHyKVtWqBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-plugin-n": "17.10.3", + "eslint-plugin-react": "7.37.3", + "eslint-plugin-security": "1.4.0" + }, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "eslint": "^9" + } + }, + "node_modules/@microsoft/eslint-plugin-sdl/node_modules/eslint-plugin-security": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-security/-/eslint-plugin-security-1.4.0.tgz", + "integrity": "sha512-xlS7P2PLMXeqfhyf3NpqbvbnW04kN8M9NtmhpR3XGyOvt/vNKS7XPXT5EDbwKW9vCjWH4PpfQvgD/+JgN0VJKA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "safe-regex": "^1.1.0" + } + }, + "node_modules/@microsoft/eslint-plugin-sdl/node_modules/safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha512-aJXcif4xnaNUzvUuC5gcb46oTS7zvg4jpMTnuqtrEPlR3vFr4pxtdTwaF1Qs3Enjn9HK+ZlwQui+a7z0SywIzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ret": "~0.1.10" + } + }, + "node_modules/@pkgr/core": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.2.tgz", + "integrity": "sha512-fdDH1LSGfZdTH2sxdpVMw31BanV28K/Gry0cVFxaNP77neJSkd82mM8ErPNYs9e+0O7SdHBLTDzDgwUuy18RnQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/@rtsao/scc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", + "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/codemirror": { "version": "5.60.8", "resolved": "https://registry.npmjs.org/@types/codemirror/-/codemirror-5.60.8.tgz", @@ -682,6 +1071,17 @@ "@types/tern": "*" } }, + "node_modules/@types/eslint": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, "node_modules/@types/estree": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", @@ -689,6 +1089,20 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "18.19.130", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.130.tgz", @@ -717,6 +1131,495 @@ "@types/estree": "*" } }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.64.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.64.0.tgz", + "integrity": "sha512-CGvQPBxN3wZLu6Rz2kFUpZeoCm78xUic92ck39KPePkO1NPOwjCqdQnm5Q87tpWw9vcBvW8XLrDXjH9PWYtJ3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.64.0", + "@typescript-eslint/type-utils": "8.64.0", + "@typescript-eslint/utils": "8.64.0", + "@typescript-eslint/visitor-keys": "8.64.0", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.64.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.6.tgz", + "integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.64.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.64.0.tgz", + "integrity": "sha512-KA0OshtlcCCXmbfqyZkM5pV3/WNraJf7DkJRLpyrmwPtud57H5BDX7C3k0LPSPxpprfRL+cJDGabF10mvNCoCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.64.0", + "@typescript-eslint/types": "8.64.0", + "@typescript-eslint/typescript-estree": "8.64.0", + "@typescript-eslint/visitor-keys": "8.64.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.64.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.64.0.tgz", + "integrity": "sha512-tk4WpOJ6IEbGrVHaNmM0YRrwAD3exZlIK3iadQNAxh4YKk6jvUQ4ecq18n+v7+meh+cJ3j+D8nbk8sRKhlwLQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.64.0", + "@typescript-eslint/types": "^8.64.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.64.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.64.0.tgz", + "integrity": "sha512-CXEaFdYXjSTgKhisNkwCcJwTP8Pl+fmRrEQrri4nm3vU743bALrxzLmq7fHG/7e6a5xO0lDYeURpZmBuhHk54w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.64.0", + "@typescript-eslint/visitor-keys": "8.64.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.64.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.64.0.tgz", + "integrity": "sha512-2yo8rRNKuzbVWQp5kslhANqZ2uDAeROQHBRZNPu8JDsHmeFNj/XJJhX/FhNUWmkHHvoNsKa6+tHJiig87EzsQw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.64.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.64.0.tgz", + "integrity": "sha512-XWG4Fmmv/6SvyS9nH8jWrKs6terwJvE8cyRt1CzYYqzp9OrPhCT4cMc/f7C6RZCwG+qMmiffJS1/qJP8G1URtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.64.0", + "@typescript-eslint/typescript-estree": "8.64.0", + "@typescript-eslint/utils": "8.64.0", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.64.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.64.0.tgz", + "integrity": "sha512-qjhfuTfLXjA4IOzXvz0rTjT01BqEiIgPoUeMwiEjnaHKJMTNo8rH5pYW1a2L/0Dnux2fPC85AeyJoWaGa8WxTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.64.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.64.0.tgz", + "integrity": "sha512-Pztpsn1aCE1oWDvDEfUk31nngvvF7vUB5SwHFEaZIFpvw7WJtqUHHL4plBZDA9HfWJJjL13BdG0YrJInTUvoVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.64.0", + "@typescript-eslint/tsconfig-utils": "8.64.0", + "@typescript-eslint/types": "8.64.0", + "@typescript-eslint/visitor-keys": "8.64.0", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.64.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.64.0.tgz", + "integrity": "sha512-aJUGVB3+U0htrrCjoA8qukw8cm8fNCGAxK/tVoS70k8aeb7DETKeFozRiVFIwEeN9WJLsjaP3ph8I60tY2XZoQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.64.0", + "@typescript-eslint/types": "8.64.0", + "@typescript-eslint/typescript-estree": "8.64.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.64.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.64.0.tgz", + "integrity": "sha512-mrtuL8Nsn6gi2H4mo5KMTp823M+3Q19Ew/i+Zlikq20tIMm99C3Ez0dCmkWWnxut20esQvTg8aUSEhMcAOXhEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.64.0", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/acorn": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", + "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-includes": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.9.tgz", + "integrity": "sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.0", + "es-object-atoms": "^1.1.1", + "get-intrinsic": "^1.3.0", + "is-string": "^1.1.1", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.findlast": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", + "integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz", + "integrity": "sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-shim-unscopables": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", + "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", + "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.tosorted": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz", + "integrity": "sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.3", + "es-errors": "^1.3.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, "node_modules/bidi-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz", @@ -727,6 +1630,96 @@ "require-from-string": "^2.0.2" } }, + "node_modules/brace-expansion": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.7.tgz", + "integrity": "sha512-7oFy703dxfY3/NLxC1fh2SUCQ0H9rmAY+5EpDVfXjUTTs+HEwR2nYaqLv+GWcTsumwxPfiz6CzCNkwXwBUwqCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/call-bind": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.9.tgz", + "integrity": "sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "get-intrinsic": "^1.3.0", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/chart.js": { "version": "4.5.1", "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.5.1.tgz", @@ -739,6 +1732,33 @@ "pnpm": ">=8" } }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, "node_modules/crelt": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", @@ -747,6 +1767,21 @@ "license": "MIT", "peer": true }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/css-tree": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", @@ -775,6 +1810,78 @@ "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/decimal.js": { "version": "10.6.0", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", @@ -782,6 +1889,101 @@ "dev": true, "license": "MIT" }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/empathic": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/empathic/-/empathic-2.0.1.tgz", + "integrity": "sha512-YGRs8knHhKHVShLkFET/rWAU8kmHbOV5LwN938RHI0pljAJ1Gf6SzXsSmRaEzcXTtOOmVqJ5+WtQPL5uigY50Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.24.2", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.24.2.tgz", + "integrity": "sha512-rpsZEGT1jFuve6QlpyRp9ckQ+kN61hvF9BzCPyMdaKTm8UJce96KBn3sorXOFXlzjPrs3Vc4T1NsSroZ3PxlFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.3.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/entities": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/entities/-/entities-8.0.0.tgz", @@ -795,6 +1997,205 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/es-abstract": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.2.tgz", + "integrity": "sha512-2FpH9Q5i2RRwyEP1AylXe6nYLR5OhaJTZwmlcP0dL/+JCbgg7yyEo/sEK6HeGZRf3dFpWwThaRHVApXSkW3xeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-abstract-get": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-abstract-get/-/es-abstract-get-1.0.0.tgz", + "integrity": "sha512-6PMWXpdhshVvFp+FoWYs1EvG1Nj0tvk0dZM+XcK0xMEM1czRVcP6ohqPWHy6qPagSpC8j4+p89WXlT+xXJs/fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.2", + "is-callable": "^1.2.7", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-iterator-helpers": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.4.0.tgz", + "integrity": "sha512-c/A0P0oxkACDc+cKWw8evLXK83oBKgn0qPOqCYT4x9uolpCIJAcYvJC9QYKNDRPsTeGyCrQ326jrvgZWdCdK5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-errors": "^1.3.0", + "es-set-tostringtag": "^2.1.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.3.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "iterator.prototype": "^1.1.5", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.4.tgz", + "integrity": "sha512-yPDz7wqpg1/mmHLmS3tcfTfbw5f1eryXvyghYBffGdERwe+mV7ZcWzTR8LR17Kvqt3qfPurjlonmnq3MKXIOXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-abstract-get": "^1.0.0", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "is-callable": "^1.2.7", + "is-date-object": "^1.1.0", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/esbuild": { "version": "0.19.12", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", @@ -834,6 +2235,1137 @@ "@esbuild/win32-x64": "0.19.12" } }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.39.5", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.5.tgz", + "integrity": "sha512-DgZS62aPLXKlnxILS/AYCoRvHaZeXceIzlXPkkGGzJWSow1aEk0lbTlxUSlyjC8jcaKxAdOnTDz+o1JFSBsyjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.2", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.6", + "@eslint/js": "9.39.5", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.5", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-compat-utils": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/eslint-compat-utils/-/eslint-compat-utils-0.5.1.tgz", + "integrity": "sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "eslint": ">=6.0.0" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.10", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.10.tgz", + "integrity": "sha512-tRrKqFyCaKict5hOd244sL6EQFNycnMQnBe+j8uqGNXYzsImGbGUU4ibtoaBmv5FLwJwcFJNeg1GeVjQfbMrDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.16.1", + "resolve": "^2.0.0-next.6" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.14.0.tgz", + "integrity": "sha512-W2WCRZ9Dqntd+2u8jJcVMV2PKulc6RdLgUUoh/yQr3uB6lo/ZOeGx11sv60/8S4QFFKNslAlWhr9u0Ef7ZW6Ig==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-depend": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-depend/-/eslint-plugin-depend-1.3.1.tgz", + "integrity": "sha512-1uo2rFAr9vzNrCYdp7IBZRB54LiyVxfaIso0R6/QV3t6Dax6DTbW/EV2Hktf0f4UtmGHK8UyzJWI382pwW04jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "empathic": "^2.0.0", + "module-replacements": "^2.8.0", + "semver": "^7.6.3" + } + }, + "node_modules/eslint-plugin-es-x": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.8.0.tgz", + "integrity": "sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ==", + "dev": true, + "funding": [ + "https://github.com/sponsors/ota-meshi", + "https://opencollective.com/eslint" + ], + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.1.2", + "@eslint-community/regexpp": "^4.11.0", + "eslint-compat-utils": "^0.5.1" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": ">=8" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.32.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz", + "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rtsao/scc": "^1.1.0", + "array-includes": "^3.1.9", + "array.prototype.findlastindex": "^1.2.6", + "array.prototype.flat": "^1.3.3", + "array.prototype.flatmap": "^1.3.3", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.12.1", + "hasown": "^2.0.2", + "is-core-module": "^2.16.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.8", + "object.groupby": "^1.0.3", + "object.values": "^1.2.1", + "semver": "^6.3.1", + "string.prototype.trimend": "^1.0.9", + "tsconfig-paths": "^3.15.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" + } + }, + "node_modules/eslint-plugin-import/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint-plugin-import/node_modules/brace-expansion": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.16.tgz", + "integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-plugin-json-schema-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-json-schema-validator/-/eslint-plugin-json-schema-validator-5.1.0.tgz", + "integrity": "sha512-ZmVyxRIjm58oqe2kTuy90PpmZPrrKvOjRPXKzq8WCgRgAkidCgm5X8domL2KSfadZ3QFAmifMgGTcVNhZ5ez2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.3.0", + "ajv": "^8.0.0", + "debug": "^4.3.1", + "eslint-compat-utils": "^0.5.0", + "json-schema-migrate": "^2.0.0", + "jsonc-eslint-parser": "^2.0.0", + "minimatch": "^8.0.0", + "synckit": "^0.9.0", + "toml-eslint-parser": "^0.9.0", + "tunnel-agent": "^0.6.0", + "yaml-eslint-parser": "^1.0.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + }, + "peerDependencies": { + "eslint": ">=6.0.0" + } + }, + "node_modules/eslint-plugin-json-schema-validator/node_modules/ajv": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/eslint-plugin-json-schema-validator/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint-plugin-json-schema-validator/node_modules/brace-expansion": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.2.tgz", + "integrity": "sha512-w5JZcKgdhDOgOwm8H+KgbosopHMuGcl6qbulwjtz3SM7I7P3yW1eAjzMPLrIE+NQ9vjgANKHWeMHnrT0OXW1oA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/eslint-plugin-json-schema-validator/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint-plugin-json-schema-validator/node_modules/minimatch": { + "version": "8.0.7", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.7.tgz", + "integrity": "sha512-V+1uQNdzybxa14e/p00HZnQNNcTjnRJjDxg2V8wtkjFctq4M7hXFws4oekyTP0Jebeq7QYtpFyOeBAjc88zvYg==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/eslint-plugin-n": { + "version": "17.10.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-17.10.3.tgz", + "integrity": "sha512-ySZBfKe49nQZWR1yFaA0v/GsH6Fgp8ah6XV0WDz6CN8WO0ek4McMzb7A2xnf4DCYV43frjCygvb9f/wx7UUxRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "enhanced-resolve": "^5.17.0", + "eslint-plugin-es-x": "^7.5.0", + "get-tsconfig": "^4.7.0", + "globals": "^15.8.0", + "ignore": "^5.2.4", + "minimatch": "^9.0.5", + "semver": "^7.5.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": ">=8.23.0" + } + }, + "node_modules/eslint-plugin-n/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint-plugin-n/node_modules/brace-expansion": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.2.tgz", + "integrity": "sha512-w5JZcKgdhDOgOwm8H+KgbosopHMuGcl6qbulwjtz3SM7I7P3yW1eAjzMPLrIE+NQ9vjgANKHWeMHnrT0OXW1oA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/eslint-plugin-n/node_modules/globals": { + "version": "15.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-plugin-n/node_modules/minimatch": { + "version": "9.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", + "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/eslint-plugin-no-unsanitized": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-4.1.5.tgz", + "integrity": "sha512-MSB4hXPVFQrI8weqzs6gzl7reP2k/qSjtCoL2vUMSDejIIq9YL1ZKvq5/ORBXab/PvfBBrWO2jWviYpL+4Ghfg==", + "dev": true, + "license": "MPL-2.0", + "peerDependencies": { + "eslint": "^9 || ^10" + } + }, + "node_modules/eslint-plugin-obsidianmd": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-obsidianmd/-/eslint-plugin-obsidianmd-0.4.1.tgz", + "integrity": "sha512-Nv3593kVsFOS8kir/HWaJ5CR3xcyiPWEPyXst5Pib8mxRYYuLYPpJS2ALMoZXHulHyiGwoYW8AaxvLRc4rhrRg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-plugin-eslint-comments": "^4.7.2", + "@eslint/config-helpers": "^0.4.2", + "@eslint/js": "^9.30.1", + "@eslint/json": "0.14.0", + "@microsoft/eslint-plugin-sdl": "^1.1.0", + "@types/eslint": "9.6.1", + "@types/node": "20.12.12", + "@typescript-eslint/types": "^8.33.1", + "@typescript-eslint/utils": "^8.33.1", + "eslint": ">=9.19.0", + "eslint-plugin-depend": "1.3.1", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-json-schema-validator": "5.1.0", + "eslint-plugin-no-unsanitized": "^4.1.5", + "eslint-plugin-security": "2.1.1", + "globals": "14.0.0", + "obsidian": "1.12.3", + "semver": "^7.7.4", + "typescript": "5.4.5", + "typescript-eslint": "^8.35.1" + }, + "bin": { + "eslint-plugin-obsidian": "dist/lib/index.js" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@eslint/js": "^9.30.1", + "@eslint/json": "0.14.0", + "eslint": ">=9.19.0", + "obsidian": "1.8.7", + "typescript-eslint": "^8.35.1" + } + }, + "node_modules/eslint-plugin-obsidianmd/node_modules/@types/node": { + "version": "20.12.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz", + "integrity": "sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/eslint-plugin-obsidianmd/node_modules/typescript": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/eslint-plugin-react": { + "version": "7.37.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.3.tgz", + "integrity": "sha512-DomWuTQPFYZwF/7c9W2fkKkStqZmBd3uugfqBYLdkZ3Hii23WzZuOLUskGxB8qkSKqftxEeGL1TB2kMhrce0jA==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.8", + "array.prototype.findlast": "^1.2.5", + "array.prototype.flatmap": "^1.3.3", + "array.prototype.tosorted": "^1.1.4", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.2.1", + "estraverse": "^5.3.0", + "hasown": "^2.0.2", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.8", + "object.fromentries": "^2.0.8", + "object.values": "^1.2.1", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.5", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.12", + "string.prototype.repeat": "^1.0.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" + } + }, + "node_modules/eslint-plugin-react/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint-plugin-react/node_modules/brace-expansion": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.16.tgz", + "integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint-plugin-react/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint-plugin-react/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-plugin-security": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-security/-/eslint-plugin-security-2.1.1.tgz", + "integrity": "sha512-7cspIGj7WTfR3EhaILzAPcfCo5R9FbeWvbgsPYWivSurTBKW88VQxtP3c4aWMG9Hz/GfJlJVdXEJ3c8LqS+u2w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "safe-regex": "^2.1.1" + } + }, + "node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.16.tgz", + "integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.3.tgz", + "integrity": "sha512-i70LwGWUduXqzicKXWshooq+sWL1K3WUU5rKZNG/0i3a1OSoX3HqhH5WbWwTmqWfor4urUakGPiRQcleRZTwOg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz", + "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", + "dev": true, + "license": "ISC" + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.2.0.tgz", + "integrity": "sha512-jObKIik1P2QjPHP5nz5BaOtUlfgS0fWo8IUByNXkM+o+02sJOi94em77GwJKQSJ3gfPHdgzLNrHc1uokV4P/ew==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2", + "hasown": "^2.0.4", + "is-callable": "^1.2.7", + "is-document.all": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/generator-function": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", + "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-tsconfig": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.14.0.tgz", + "integrity": "sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/html-encoding-sniffer": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", @@ -847,6 +3379,311 @@ "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.2", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz", + "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-document.all": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-document.all/-/is-document.all-1.0.0.tgz", + "integrity": "sha512-+XSoyS05OdBbhFuELhgTCpFNHkpBOJqtsZfUFFpe5QTw+9Sjbh8zitxhQkYAo6wV7e1Vb8cAPvpCk9jGam/82g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", + "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4", + "generator-function": "^2.0.0", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-potential-custom-element-name": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", @@ -854,6 +3691,213 @@ "dev": true, "license": "MIT" }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/iterator.prototype": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", + "integrity": "sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "get-proto": "^1.0.0", + "has-symbols": "^1.1.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/jsdom": { "version": "29.1.1", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-29.1.1.tgz", @@ -895,6 +3939,200 @@ } } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-migrate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/json-schema-migrate/-/json-schema-migrate-2.0.0.tgz", + "integrity": "sha512-r38SVTtojDRp4eD6WsCqiE0eNDt4v1WalBXb9cyZYw9ai5cGtBwzRNWjHzJl38w6TxFkXAIA7h+fyX3tnrAFhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + } + }, + "node_modules/json-schema-migrate/node_modules/ajv": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/json-schema-migrate/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/jsonc-eslint-parser": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/jsonc-eslint-parser/-/jsonc-eslint-parser-2.4.2.tgz", + "integrity": "sha512-1e4qoRgnn448pRuMvKGsFFymUCquZV0mpGgOyIKNgD3JVDTsVJyRBGH/Fm0tBb8WsWGgmB1mDe6/yJMQM37DUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.5.0", + "eslint-visitor-keys": "^3.0.0", + "espree": "^9.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + } + }, + "node_modules/jsonc-eslint-parser/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/jsonc-eslint-parser/node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, "node_modules/lru-cache": { "version": "11.5.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", @@ -905,6 +4143,16 @@ "node": "20 || >=22" } }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/mdn-data": { "version": "2.27.1", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", @@ -912,6 +4160,39 @@ "dev": true, "license": "CC0-1.0" }, + "node_modules/minimatch": { + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.5" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/module-replacements": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/module-replacements/-/module-replacements-2.11.0.tgz", + "integrity": "sha512-j5sNQm3VCpQQ7nTqGeOZtoJtV3uKERgCBm9QRhmGRiXiqkf7iRFOkfxdJRZWLkqYY8PNf4cDQF/WfXUYLENrRA==", + "dev": true, + "license": "MIT" + }, "node_modules/moment": { "version": "2.29.4", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", @@ -922,6 +4203,172 @@ "node": "*" } }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-exports-info": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/node-exports-info/-/node-exports-info-1.6.2.tgz", + "integrity": "sha512-kXs9Go0cah0qHVV2v389IXQLdLCeE1xfFtjOAF+iobu0OIoG1pje8At2vMHyaPMiPMnG/LWP50twML21eMcAag==", + "dev": true, + "license": "MIT", + "dependencies": { + "array.prototype.flatmap": "^1.3.3", + "es-errors": "^1.3.0", + "object.entries": "^1.1.9", + "semver": "^6.3.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/node-exports-info/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.entries": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.9.tgz", + "integrity": "sha512-8u/hfXFRBD1O0hPUjioLhoWFHRmt6tKA4/vZPyckBr18l1KE9uHrFaFaUi8MDRTpi4uak2goyPTSNJLXX2k2Hw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.groupby": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.values": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/obsidian": { "version": "1.12.3", "resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.12.3.tgz", @@ -937,12 +4384,93 @@ "@codemirror/view": "6.38.6" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/papaparse": { "version": "5.5.3", "resolved": "https://registry.npmjs.org/papaparse/-/papaparse-5.5.3.tgz", "integrity": "sha512-5QvjGxYVjxO59MGU2lHVYpRWBBtKHnlIAcSe1uNFCkkptUh63NFRj0FJQm7nR67puEruUci/ZkjmEFrjCAyP4A==", "license": "MIT" }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parse5": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", @@ -956,6 +4484,78 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/picomatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", + "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -966,6 +4566,67 @@ "node": ">=6" } }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexp-tree": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.27.tgz", + "integrity": "sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==", + "dev": true, + "license": "MIT", + "bin": { + "regexp-tree": "bin/regexp-tree" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -976,6 +4637,146 @@ "node": ">=0.10.0" } }, + "node_modules/resolve": { + "version": "2.0.0-next.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.7.tgz", + "integrity": "sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "is-core-module": "^2.16.2", + "node-exports-info": "^1.6.0", + "object-keys": "^1.1.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.4.tgz", + "integrity": "sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "get-intrinsic": "^1.3.0", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-2.1.1.tgz", + "integrity": "sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==", + "dev": true, + "license": "MIT", + "dependencies": { + "regexp-tree": "~0.1.1" + } + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/saxes": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", @@ -989,6 +4790,167 @@ "node": ">=v12.22.7" } }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -999,6 +4961,142 @@ "node": ">=0.10.0" } }, + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/string.prototype.matchall": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.12.tgz", + "integrity": "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.6", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "regexp.prototype.flags": "^1.5.3", + "set-function-name": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.repeat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-1.0.0.tgz", + "integrity": "sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.11.tgz", + "integrity": "sha512-PwvK7BU+CMTJGYQCTZb5RWXIML92lftJLhQz1tBzgKiqGxJaMlBAa48POXaNAC2s4y8jr3EFqrkF9+44neS46w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-object-atoms": "^1.1.2", + "has-property-descriptors": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.10.tgz", + "integrity": "sha512-2+3aDAOmPTmuFwjDnmJG2ctEkQKVki7vOSqaxkv42Mowj1V6PnvuwFCRrR5lChUux1TBskPjfkeTOhqczDMxTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/style-mod": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.3.tgz", @@ -1007,6 +5105,32 @@ "license": "MIT", "peer": true }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", @@ -1014,6 +5138,54 @@ "dev": true, "license": "MIT" }, + "node_modules/synckit": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.3.tgz", + "integrity": "sha512-JJoOEKTfL1urb1mDoEblhD9NhEbWmq9jHEMEnxoC4ujUaZ4itA8vKgwkFAyNClgxplLi9tsUKX+EduK0p/l7sg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/tapable": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz", + "integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, "node_modules/tldts": { "version": "7.4.2", "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.2.tgz", @@ -1034,6 +5206,35 @@ "dev": true, "license": "MIT" }, + "node_modules/toml-eslint-parser": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/toml-eslint-parser/-/toml-eslint-parser-0.9.3.tgz", + "integrity": "sha512-moYoCvkNUAPCxSW9jmHmRElhm4tVJpHL8ItC/+uYD0EpPSFXbck7yREz9tNdJVTSpHVod8+HoipcpbQ0oE6gsw==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + } + }, + "node_modules/toml-eslint-parser/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/tough-cookie": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.1.tgz", @@ -1060,6 +5261,143 @@ "node": ">=20" } }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.8.tgz", + "integrity": "sha512-phPGCwqr2+Qo0fwniCE8e4pKnGu/yFb5nD5Y8bf0EEeiI5GklnACYA9GFy/DrAeRrKHXvHn+1SUsOWgJp6RO+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "for-each": "^0.3.5", + "gopd": "^1.2.0", + "is-typed-array": "^1.1.15", + "possible-typed-array-names": "^1.1.0", + "reflect.getprototypeof": "^1.0.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/typescript": { "version": "5.9.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", @@ -1074,6 +5412,49 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.64.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.64.0.tgz", + "integrity": "sha512-0qg+pDNMnqYzqH9AnNK+39tejHvsShUOUUoRUgtnTGE7QuMZhiFDnozq8nHJVq+Wae6NMLKNWLg5WmkcC/ndyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.64.0", + "@typescript-eslint/parser": "8.64.0", + "@typescript-eslint/typescript-estree": "8.64.0", + "@typescript-eslint/utils": "8.64.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/undici": { "version": "7.27.2", "resolved": "https://registry.npmjs.org/undici/-/undici-7.27.2.tgz", @@ -1090,6 +5471,16 @@ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "license": "MIT" }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/w3c-keyname": { "version": "2.2.8", "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", @@ -1146,6 +5537,121 @@ "node": "^20.19.0 || ^22.12.0 || >=24.0.0" } }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.22", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.22.tgz", + "integrity": "sha512-fvO4ExWMFsqyhG3AiPAObMuY1lxaqgYcxbc49CNdWDDECOJNgQyvsOWVwbZc+qf3rzRtxojBK+CMEv0Ld5CYpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/xml-name-validator": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", @@ -1162,6 +5668,65 @@ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", "dev": true, "license": "MIT" + }, + "node_modules/yaml": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz", + "integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==", + "dev": true, + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" + } + }, + "node_modules/yaml-eslint-parser": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/yaml-eslint-parser/-/yaml-eslint-parser-1.3.2.tgz", + "integrity": "sha512-odxVsHAkZYYglR30aPYRY4nUGJnoJ2y1ww2HDvZALo0BDETv9kWbi16J52eHs+PWRNmF4ub6nZqfVOeesOvntg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.0.0", + "yaml": "^2.0.0" + }, + "engines": { + "node": "^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + } + }, + "node_modules/yaml-eslint-parser/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index a1a639c..9a530c1 100644 --- a/package.json +++ b/package.json @@ -6,20 +6,24 @@ "scripts": { "build": "node esbuild.config.mjs", "dev": "node esbuild.config.mjs --watch", - "deploy": "cp main.js styles.css manifest.json world-map.svg datadeck/ && cp main.js styles.css manifest.json world-map.svg datadeck-work/", + "deploy": "cp main.js styles.css manifest.json datadeck/ && cp main.js styles.css manifest.json datadeck-work/", "build:deploy": "npm run build && npm run deploy", "test": "node test-plugin-logic.mjs", "test:csv": "node test-csv-parser.mjs", "test:view": "node test-view-smoke.mjs", "test:all": "node test-csv-parser.mjs && node test-plugin-logic.mjs && node test-view-smoke.mjs", "typecheck": "tsc --noEmit", - "check": "npm run typecheck && npm run test:all && npm run build:deploy", + "lint": "eslint main.ts \"src/**/*.ts\"", + "check": "npm run typecheck && npm run test:all && npm run lint && npm run build:deploy", "reload": "obsidian plugin:reload id=datadeck", "errors": "obsidian dev:errors" }, "devDependencies": { "@types/node": "^18.0.0", + "@typescript-eslint/parser": "^8.64.0", "esbuild": "^0.19.0", + "eslint": "^9.39.5", + "eslint-plugin-obsidianmd": "^0.4.1", "jsdom": "^29.1.1", "obsidian": "latest", "typescript": "^5.0.0" diff --git a/src/add-entry-form.ts b/src/add-entry-form.ts index 23fcc6b..1a5eb3e 100644 --- a/src/add-entry-form.ts +++ b/src/add-entry-form.ts @@ -53,7 +53,7 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme headers = parsed.headers; rows = parsed.rows; } catch (e) { - el.createEl("p", { text: `Error reading file: ${e}`, cls: "csv-add-error" }); + el.createEl("p", { text: `Error reading file: ${e instanceof Error ? e.message : String(e)}`, cls: "csv-add-error" }); return; } @@ -103,25 +103,24 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme // Default-open: the card is visible immediately; tapping × collapses it // to the trigger pill, and the pill re-opens it. (One menu, always one tap // away in either direction.) - const trigger = root.createEl("button", { cls: "csv-add-trigger", text: "+ New entry" }); - trigger.style.display = "none"; + const trigger = root.createEl("button", { cls: "csv-add-trigger is-hidden", text: "+ new entry" }); const card = root.createDiv({ cls: "csv-add-card" }); // Header bar: title + close (×). Re-uses the trigger to collapse. const header = card.createDiv({ cls: "csv-add-card-header" }); - header.createEl("span", { cls: "csv-add-card-title", text: "New entry" }); + header.createSpan({ cls: "csv-add-card-title", text: "New entry" }); const closeBtn = header.createEl("button", { cls: "csv-add-card-close", text: "×" }); // Rows live in one grouped list with hairline separators between them. const rowsWrap = card.createDiv({ cls: "csv-add-rows" }); - const inputs: Record = {}; + const inputs: Record = {}; const toggleStates: Record = {}; // Helper: a single row (label on the left, control on the right). const makeRow = (h: string, kind: string) => { const row = rowsWrap.createDiv({ cls: `csv-add-row csv-add-row-${kind}` }); - row.createEl("span", { cls: "csv-add-row-label", text: titleCase(h) }); + row.createSpan({ cls: "csv-add-row-label", text: titleCase(h) }); return row; }; @@ -139,7 +138,7 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme const row = makeRow(h, "toggle"); const switchWrap = row.createEl("label", { cls: "csv-add-switch" }); const checkbox = switchWrap.createEl("input", { type: "checkbox", cls: "csv-add-switch-input" }); - switchWrap.createEl("span", { cls: "csv-add-switch-track" }); + switchWrap.createSpan({ cls: "csv-add-switch-track" }); checkbox.addEventListener("change", () => { toggleStates[h] = checkbox.checked; }); inputs[h] = checkbox; }); @@ -157,19 +156,18 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme const select = row.createEl("select", { cls: "csv-add-row-control" }); select.createEl("option", { text: "—", value: "" }); Array.from(uniqueVals).sort().forEach(v => select.createEl("option", { text: v, value: v })); - select.createEl("option", { text: "+ Custom", value: "__custom__" }); + select.createEl("option", { text: "+ custom", value: "__custom__" }); // Custom input lives in its own row that appears just below when chosen. - const customRow = rowsWrap.createDiv({ cls: "csv-add-row csv-add-row-custom" }); - customRow.style.display = "none"; + const customRow = rowsWrap.createDiv({ cls: "csv-add-row csv-add-row-custom is-hidden" }); const customInput = customRow.createEl("input", { cls: "csv-add-row-control", type: "text", placeholder: `Custom ${titleCase(h).toLowerCase()}` }); // Keep the custom row visually adjacent to its parent select row. rowsWrap.insertBefore(customRow, row.nextSibling); select.addEventListener("change", () => { - customRow.style.display = select.value === "__custom__" ? "flex" : "none"; + customRow.classList.toggle("is-hidden", select.value !== "__custom__"); if (select.value === "__custom__") customInput.focus(); }); inputs[h] = select; - inputs[`${h}__custom`] = customInput as HTMLInputElement; + inputs[`${h}__custom`] = customInput; } else { inputs[h] = row.createEl("input", { cls: "csv-add-row-control", type: "text", placeholder: titleCase(h) }); } @@ -178,8 +176,8 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme // Notes row — full-width textarea, stacked below the inline label. notesCols.forEach(h => { const row = rowsWrap.createDiv({ cls: "csv-add-row csv-add-row-notes" }); - row.createEl("span", { cls: "csv-add-row-label", text: titleCase(h) }); - inputs[h] = row.createEl("textarea", { cls: "csv-add-row-textarea", placeholder: "Optional notes…" }) as any; + row.createSpan({ cls: "csv-add-row-label", text: titleCase(h) }); + inputs[h] = row.createEl("textarea", { cls: "csv-add-row-textarea", placeholder: "Optional notes…" }); }); // Submit lives inside the card so the whole menu reads as one unit. @@ -194,7 +192,7 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme // // Only runs when the file has a date column (i.e. habit-tracker shape); // library/generic dashboards have no date and skip naturally. - const titleEl = header.querySelector(".csv-add-card-title") as HTMLElement | null; + const titleEl = header.querySelector(".csv-add-card-title"); const syncFromExisting = (): void => { if (!dateCols.length) return; const dateInput = inputs[dateCols[0]] as HTMLInputElement | undefined; @@ -238,7 +236,7 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme if (opt) { input.value = val; // Hide any custom-row that was previously open. - if (customRow) customRow.style.display = "none"; + if (customRow) customRow.classList.add("is-hidden"); if (customInput) customInput.value = ""; } else if (val) { // Existing value isn't a known option — show it in the custom @@ -246,16 +244,16 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme // read as "nothing recorded" even when something was). input.value = "__custom__"; if (customInput) customInput.value = val; - if (customRow) customRow.style.display = "flex"; + if (customRow) customRow.classList.remove("is-hidden"); } else { input.value = ""; - if (customRow) customRow.style.display = "none"; + if (customRow) customRow.classList.add("is-hidden"); if (customInput) customInput.value = ""; } - } else if (input instanceof HTMLTextAreaElement) { + } else if (input.instanceOf(HTMLTextAreaElement)) { input.value = val; } else { - (input as HTMLInputElement).value = val; + (input).value = val; } }); }; @@ -270,28 +268,28 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme // Expand / collapse wiring. Focusing the first text-ish input on open // mirrors iOS sheet behaviour where the keyboard comes up immediately. const open = () => { - card.style.display = "block"; - trigger.style.display = "none"; - const first = card.querySelector(".csv-add-row-control") as HTMLElement | null; + card.classList.remove("is-hidden"); + trigger.classList.add("is-hidden"); + const first = card.querySelector(".csv-add-row-control"); first?.focus(); }; const close = () => { - card.style.display = "none"; - trigger.style.display = ""; + card.classList.add("is-hidden"); + trigger.classList.remove("is-hidden"); }; trigger.addEventListener("click", open); closeBtn.addEventListener("click", close); - submitBtn.addEventListener("click", async () => { + const handleSubmit = async () => { // Gather values const newRow: CSVRow = {}; headers.forEach(h => { if (binaryCols.includes(h)) { newRow[h] = toggleStates[h] ? "1" : "0"; - } else if (inputs[h] instanceof HTMLSelectElement && (inputs[h] as HTMLSelectElement).value === "__custom__") { + } else if (inputs[h] instanceof HTMLSelectElement && (inputs[h]).value === "__custom__") { newRow[h] = (inputs[`${h}__custom`] as HTMLInputElement)?.value ?? ""; } else if (inputs[h] instanceof HTMLTextAreaElement) { - newRow[h] = (inputs[h] as HTMLTextAreaElement).value; + newRow[h] = inputs[h].value; } else { newRow[h] = (inputs[h] as HTMLInputElement)?.value ?? ""; } @@ -313,7 +311,7 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme const text = await app.vault.read(file); currentRows = parseCSV(text).rows; } catch (e) { - new Notice(`Error reading file: ${e}`); + new Notice(`Error reading file: ${e instanceof Error ? e.message : String(e)}`); return; } @@ -375,18 +373,18 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme const input = inputs[h]; if (input instanceof HTMLSelectElement) { input.selectedIndex = 0; - } else if (input instanceof HTMLTextAreaElement) { + } else if (input.instanceOf(HTMLTextAreaElement)) { input.value = ""; } else if (input) { - (input as HTMLInputElement).value = ""; + (input).value = ""; } const customInput = inputs[`${h}__custom`]; if (customInput) { (customInput as HTMLInputElement).value = ""; // The custom input lives inside a .csv-add-row-custom wrapper — // hide the row itself so the layout stays in sync with the select. - const customRow = (customInput as HTMLInputElement).closest(".csv-add-row-custom") as HTMLElement | null; - if (customRow) customRow.style.display = "none"; + const customRow = (customInput as HTMLInputElement).closest(".csv-add-row-custom"); + if (customRow) customRow.classList.add("is-hidden"); } }); } @@ -394,17 +392,17 @@ export async function renderAddEntryForm(app: App, source: string, el: HTMLEleme // tap away; user can collapse with the × header button when finished. // Auto-refresh: reopen the note to force Dataview to re-read CSV - setTimeout(async () => { - const noteFile = app.vault.getAbstractFileByPath(ctx.sourcePath); - if (noteFile instanceof TFile) { - const leaf = app.workspace.activeLeaf; - if (leaf) { - await leaf.openFile(noteFile, { state: { mode: "preview" } }); + window.setTimeout(() => { + void (async () => { + const noteFile = app.vault.getAbstractFileByPath(ctx.sourcePath); + if (noteFile instanceof TFile) { + await app.workspace.getLeaf(false).openFile(noteFile, { state: { mode: "preview" } }); } - } + })(); }, 300); } catch (e) { - new Notice(`Error saving: ${e}`); + new Notice(`Error saving: ${e instanceof Error ? e.message : String(e)}`); } - }); + }; + submitBtn.addEventListener("click", () => { void handleSubmit(); }); } diff --git a/src/chart-block.ts b/src/chart-block.ts index 7899e87..39e2ef9 100644 --- a/src/chart-block.ts +++ b/src/chart-block.ts @@ -86,7 +86,7 @@ function parseBlockSource(source: string): ChartBlockOptions { /** Duck-typed TFile check — mirrors inline-view.ts (cross-bundle instanceof is unreliable). */ function asFile(f: unknown): TFile | null { - return f && typeof f === "object" && "basename" in (f as object) ? (f as TFile) : null; + return f && typeof f === "object" && "basename" in (f) ? (f as TFile) : null; } function parseIsoDate(s: string): Date | null { @@ -106,17 +106,19 @@ class ChartBlock extends MarkdownRenderChild { super(containerEl); } - async onload(): Promise { + onload(): void { this.containerEl.addClass("csv-chart-block"); - await this.render(); - if (this.opts.file) { - this.registerEvent(this.app.vault.on("modify", (f) => { - if (f.path === this.opts.file) void this.render(); - })); - this.registerEvent(this.app.vault.on("rename", (f, oldPath) => { - if (oldPath === this.opts.file) this.opts.file = f.path; - })); - } + void (async () => { + await this.render(); + if (this.opts.file) { + this.registerEvent(this.app.vault.on("modify", (f) => { + if (f.path === this.opts.file) void this.render(); + })); + this.registerEvent(this.app.vault.on("rename", (f, oldPath) => { + if (oldPath === this.opts.file) this.opts.file = f.path; + })); + } + })(); } onunload(): void { diff --git a/src/inline-view.ts b/src/inline-view.ts index 1b686c6..e1945b3 100644 --- a/src/inline-view.ts +++ b/src/inline-view.ts @@ -54,7 +54,7 @@ const MODE_LABELS: { id: InlineMode; label: string }[] = [ * with a stub vault in the smoke tests (cross-bundle instanceof is unreliable). */ function asFile(f: unknown): TFile | null { - return f && typeof f === "object" && "basename" in (f as object) ? (f as TFile) : null; + return f && typeof f === "object" && "basename" in (f) ? (f as TFile) : null; } interface BlockOptions { @@ -149,33 +149,35 @@ export class InlineCardHost extends MarkdownRenderChild { // isn't a structural CardView, so the cast is explicit and centralized here. private get asView(): CardView { return this as unknown as CardView; } - async onload(): Promise { + onload(): void { this.containerEl.addClass("csv-inline-view"); if (!this.opts.file) { this.renderError("No file specified. Use: file: yourfile.csv"); return; } - if (!(await this.reload())) return; - this.renderView(); - - // Re-sync when the source file changes underneath us (edited in a .csv - // tab, another csv-view block, or external sync). Skip our own writes. - this.registerEvent(this.app.vault.on("modify", async (f) => { - if (!this.file || f.path !== this.file.path) return; - const text = await this.app.vault.read(this.file); - if (text === this.lastWritten) return; // our own save — already rendered - // Accept the external version as the new sync anchor — without this, - // every save after an external change false-flagged a conflict. - this.lastWritten = text; - const parsed = parseCSV(text); - this.headers = parsed.headers; - this.rows = parsed.rows; + void (async () => { + if (!(await this.reload())) return; this.renderView(); - })); - // A rename of the source file invalidates our cached handle. - this.registerEvent(this.app.vault.on("rename", (f, oldPath) => { - if (this.file && oldPath === this.file.path) this.file = asFile(f); - })); + + // Re-sync when the source file changes underneath us (edited in a .csv + // tab, another csv-view block, or external sync). Skip our own writes. + this.registerEvent(this.app.vault.on("modify", async (f) => { + if (!this.file || f.path !== this.file.path) return; + const text = await this.app.vault.read(this.file); + if (text === this.lastWritten) return; // our own save — already rendered + // Accept the external version as the new sync anchor — without this, + // every save after an external change false-flagged a conflict. + this.lastWritten = text; + const parsed = parseCSV(text); + this.headers = parsed.headers; + this.rows = parsed.rows; + this.renderView(); + })); + // A rename of the source file invalidates our cached handle. + this.registerEvent(this.app.vault.on("rename", (f, oldPath) => { + if (this.file && oldPath === this.file.path) this.file = asFile(f); + })); + })(); } onunload(): void { @@ -426,7 +428,7 @@ export class InlineCardHost extends MarkdownRenderChild { this.scheduleSave(); this.renderView(); const title = this.getTitle(row) || "entry"; - const frag = document.createDocumentFragment(); + const frag = createFragment(); frag.createSpan({ text: `Deleted “${title}”. ` }); const undoBtn = frag.createEl("button", { text: "Undo", cls: "csv-notice-undo" }); const notice = new Notice(frag, 6000); @@ -443,7 +445,7 @@ export class InlineCardHost extends MarkdownRenderChild { openRowContextMenu(row: CSVRow, e: MouseEvent): void { const menu = new Menu(); - menu.addItem(i => i.setTitle("Open / Create Notes file").setIcon("file-text").onClick(() => void this.openOrCreateNotes(row))); + menu.addItem(i => i.setTitle("Open / create notes file").setIcon("file-text").onClick(() => void this.openOrCreateNotes(row))); // Always offered — the expander edits every structured field; on files // without a notes column it simply omits the notes editor. menu.addItem(i => i.setTitle("Open entry").setIcon("maximize").onClick(() => this.openNoteExpander(row, this.getNotesCol() ?? ""))); @@ -547,7 +549,7 @@ export class InlineCardHost extends MarkdownRenderChild { if (this.rows.length === 0) { const wrap = content.createDiv({ cls: "csv-empty-state" }); wrap.createEl("p", { text: "No entries yet." }); - wrap.createEl("button", { cls: "csv-empty-state-action", text: "+ Add the first entry" }) + wrap.createEl("button", { cls: "csv-empty-state-action", text: "+ add the first entry" }) .addEventListener("click", () => this.openAddModal()); return; } @@ -588,7 +590,7 @@ export class InlineCardHost extends MarkdownRenderChild { debounce = window.setTimeout(() => { debounce = null; this.renderView(true); }, 120); }); - ctrl.createEl("button", { cls: "csv-add-btn", text: "+ Add" }).addEventListener("click", () => this.openAddModal()); + ctrl.createEl("button", { cls: "csv-add-btn", text: "+ add" }).addEventListener("click", () => this.openAddModal()); } } diff --git a/src/modals.ts b/src/modals.ts index 10eb699..bb3fbf6 100644 --- a/src/modals.ts +++ b/src/modals.ts @@ -175,7 +175,7 @@ export class AddEntryModal extends Modal { const sel = row.createEl("select", { cls: "csv-modal-select" }); sel.createEl("option", { text: "—", value: "" }); merged.forEach(v => sel.createEl("option", { text: v, value: v })); - sel.createEl("option", { text: "+ Custom…", value: CUSTOM }); + sel.createEl("option", { text: "+ custom…", value: CUSTOM }); const customInput = row.createEl("input", { cls: "csv-modal-input csv-modal-custom", type: "text", placeholder: `Custom ${titleCase(h).toLowerCase()}` }); customInput.hide(); @@ -358,12 +358,10 @@ export class NoteExpanderModal extends Modal { // ── Header ────────────────────────────────────────────────────────────── const header = contentEl.createDiv({ cls: "csv-expander-header" }); header.createDiv({ cls: "csv-expander-title", text: this.row[this.titleCol ?? this.headers[0]] ?? "—" }); - const headerBtns = header.createDiv({ cls: "csv-expander-header-btns" }); // ── Fields section (non-notes columns) ────────────────────────────────── const fieldsEl = contentEl.createDiv({ cls: "csv-expander-fields" }); const titleKey = this.titleCol; - const authorKey = this.headers.find(h => ["author","Author","director","Director","artist","Artist","creator","Creator"].includes(h)); this.headers.forEach(h => { if (this.isNotesCol(h)) return; // notes rendered separately below @@ -443,15 +441,14 @@ export class NoteExpanderModal extends Modal { const rendered = contentEl.createDiv({ cls: "csv-expander-rendered markdown-rendered" }); rendered.title = "Click to edit"; - const editorWrap = contentEl.createDiv({ cls: "csv-expander-editor" }); - editorWrap.style.display = "none"; + const editorWrap = contentEl.createDiv({ cls: "csv-expander-editor is-hidden" }); const renderMarkdown = () => { rendered.empty(); if (currentText.trim()) { - MarkdownRenderer.render(this.app, currentText, rendered, this.filePath, this.renderComponent); + void MarkdownRenderer.render(this.app, currentText, rendered, this.filePath, this.renderComponent); } else { - rendered.createDiv({ cls: "csv-notes-empty", text: "+ Add note" }); + rendered.createDiv({ cls: "csv-notes-empty", text: "+ add note" }); } }; renderMarkdown(); @@ -463,16 +460,16 @@ export class NoteExpanderModal extends Modal { const enterEdit = () => { if (isEditing) return; isEditing = true; - rendered.style.display = "none"; - editorWrap.style.display = "flex"; + rendered.classList.add("is-hidden"); + editorWrap.classList.remove("is-hidden"); ta!.value = currentText; ta!.focus(); }; const exitEdit = () => { if (!isEditing) return; isEditing = false; - editorWrap.style.display = "none"; - rendered.style.display = ""; + editorWrap.classList.add("is-hidden"); + rendered.classList.remove("is-hidden"); currentText = ta!.value; renderMarkdown(); }; @@ -501,13 +498,20 @@ export class NoteExpanderModal extends Modal { if (this.onDelete) { const titleVal = String(this.row[this.titleCol ?? this.headers[0]] ?? "").trim(); - footer.createEl("button", { cls: "csv-expander-delete-btn", text: "Delete" }) - .addEventListener("click", () => { - const label = titleVal || "this entry"; - if (!window.confirm(`Delete "${label}"? This can't be undone.`)) return; + const deleteBtn = footer.createEl("button", { + cls: "csv-expander-delete-btn", text: "Delete", + attr: { title: `Delete "${titleVal || "this entry"}"? This can't be undone.` }, + }); + deleteBtn.addEventListener("click", () => { + if (deleteBtn.hasClass("confirm")) { this.onDelete!(); this.close(); - }); + return; + } + deleteBtn.addClass("confirm"); + deleteBtn.setText("Confirm?"); + window.setTimeout(() => { if (deleteBtn.isConnected) { deleteBtn.removeClass("confirm"); deleteBtn.setText("Delete"); } }, 3000); + }); } const rightBtns = footer.createDiv({ cls: "csv-expander-footer-right" }); @@ -581,22 +585,9 @@ export class SearchModal extends Modal { // underneath to near-black, which hides the filter results — the // user types but can't see the table updating. Tag the container so // a CSS rule (`.mod-csv-search-bg .modal-bg`) zeroes out the dim. - // Also defensively clear the inline opacity/background in case the - // CSS rule loses the cascade to a later !important. Tap-outside still - // closes because the bg element retains its click handler. + // Tap-outside still closes because the bg element retains its click + // handler. this.containerEl.addClass("mod-csv-search-bg"); - const clearBg = () => { - const bg = this.containerEl.querySelector(".modal-bg"); - if (bg) { - bg.style.opacity = "0"; - bg.style.background = "transparent"; - } - }; - clearBg(); - // Obsidian sometimes restyles the bg after onOpen runs; redo it on - // the next frame and a tick later for good measure. - requestAnimationFrame(clearBg); - setTimeout(clearBg, 50); // visualViewport pinning — same trick as NoteExpanderModal. Without // it, Obsidian centers the modal in window.innerHeight and the iOS @@ -680,7 +671,7 @@ export class SearchModal extends Modal { // Autofocus after one frame so iOS reliably opens the keyboard // (focus called synchronously sometimes gets dropped on modal-open). - requestAnimationFrame(() => { + window.requestAnimationFrame(() => { input.focus(); // Caret at the end of existing query so user can extend or backspace. input.setSelectionRange(input.value.length, input.value.length); @@ -823,7 +814,7 @@ export class FileConfigModal extends Modal { colSection.createEl("label", { text: "Columns", cls: "csv-modal-label" }); colSection.createEl("p", { cls: "csv-modal-hint", - text: "Type and Function are each exclusive per column — picking one clears it from whichever column held it before. \"auto\" means it's already doing that by column name, with nothing saved here yet. Card field is independent and can combine with anything. Checkbox columns get a \"Clean up\" action that rewrites every row to strict 1/0 right away — not deferred to Save.", + text: "Type and function are each exclusive per column — picking one clears it from whichever column held it before. \"auto\" means it's already doing that by column name, with nothing saved here yet. Card field is independent and can combine with anything. Checkbox columns get a \"clean up\" action that rewrites every row to strict 1/0 right away — not deferred to save.", }); type ColType = "text" | "checkbox" | "categorical" | "date"; @@ -972,7 +963,7 @@ export class FileConfigModal extends Modal { // ── Functions Table ── const funcSection = contentEl.createDiv({ cls: "csv-modal-section", attr: { style: "margin-top: 24px;" } }); - funcSection.createEl("h3", { text: "Column Functions", cls: "csv-modal-h3" }); + funcSection.createEl("h3", { text: "Column functions", cls: "csv-modal-h3" }); funcSection.createEl("p", { cls: "csv-modal-desc", text: "Assign specific roles to your columns. 'auto' means it's already doing that by column name. Selecting '— none —' disables the function entirely." @@ -1058,7 +1049,7 @@ export class FileConfigModal extends Modal { const addColWrap = colSection.createDiv({ cls: "csv-modal-add-column" }); const addColInput = addColWrap.createEl("input", { cls: "csv-modal-input", type: "text", placeholder: "New column name" }); - const addColBtn = addColWrap.createEl("button", { cls: "csv-modal-cancel", text: "+ Add column" }); + const addColBtn = addColWrap.createEl("button", { cls: "csv-modal-cancel", text: "+ add column" }); const doAdd = () => { const err = this.onAddColumn(addColInput.value); if (err) { new Notice(err); return; } diff --git a/src/random-block.ts b/src/random-block.ts index 83c38da..7321cc5 100644 --- a/src/random-block.ts +++ b/src/random-block.ts @@ -20,7 +20,7 @@ import { App, TFile, MarkdownPostProcessorContext } from "obsidian"; * the obsidian stub, which breaks cross-bundle instanceof identity. */ function asFile(f: unknown): TFile | null { - return f && typeof f === "object" && "basename" in (f as object) ? (f as TFile) : null; + return f && typeof f === "object" && "basename" in (f) ? (f as TFile) : null; } import { CSVRow } from "./types"; import { parseCSV, resolvePath } from "./utils"; @@ -52,7 +52,7 @@ export async function renderRandomCard(app: App, source: string, el: HTMLElement headers = parsed.headers; rows = parsed.rows; } catch (e) { - el.createEl("p", { text: `Error reading file: ${e}`, cls: "csv-add-error" }); + el.createEl("p", { text: `Error reading file: ${e instanceof Error ? e.message : String(e)}`, cls: "csv-add-error" }); return; } if (!rows.length) { diff --git a/src/settings-tab.ts b/src/settings-tab.ts index 5b11170..1b8161d 100644 --- a/src/settings-tab.ts +++ b/src/settings-tab.ts @@ -12,14 +12,13 @@ export class CardViewSettingTab extends PluginSettingTab { constructor(app: App, plugin: CardViewPlugin){super(app,plugin); this.plugin=plugin;} display(): void { const {containerEl}=this; containerEl.empty(); - containerEl.createEl("h2",{text:"DataDeck"}); new Setting(containerEl).setName("Default view mode") .addDropdown(d=>d.addOption("kanban-genre","Kanban").addOption("table","Table") .setValue(this.plugin.settings.defaultMode) .onChange(async v=>{ this.plugin.settings.defaultMode=v as ViewMode; await this.plugin.saveSettings(); })); new Setting(containerEl).setName("Status column name") .addText(t=>t.setValue(this.plugin.settings.statusColumn).onChange(async v=>{ this.plugin.settings.statusColumn=v; await this.plugin.saveSettings(); })); - new Setting(containerEl).setName("Category/Genre column name") + new Setting(containerEl).setName("Category/genre column name") .addText(t=>t.setValue(this.plugin.settings.categoryColumn).onChange(async v=>{ this.plugin.settings.categoryColumn=v; await this.plugin.saveSettings(); })); new Setting(containerEl).setName("Notes column names").setDesc("Comma-separated.") .addText(t=>t.setValue(this.plugin.settings.notesColumns.join(", ")).onChange(async v=>{ this.plugin.settings.notesColumns=v.split(",").map(s=>s.trim()); await this.plugin.saveSettings(); })); @@ -33,7 +32,7 @@ export class CardViewSettingTab extends PluginSettingTab { .setDesc("Show residency / tax day-gauges in the travel view.") .addToggle(t=>t.setValue(this.plugin.settings.showResidency!==false).onChange(async v=>{ this.plugin.settings.showResidency=v; await this.plugin.saveSettings(); })); - containerEl.createEl("h3",{text:"Residency rules"}); + new Setting(containerEl).setName("Residency rules").setHeading(); containerEl.createEl("p",{cls:"setting-item-description",text:"Each rule counts days in the listed countries within the window, minus exempt visa rows, against the threshold. Counts confirmed trips only. Indicators, not legal/tax advice."}); const rrWrap = containerEl.createDiv({cls:"csv-rr-wrap"}); this.renderResidencyRules(rrWrap); @@ -52,7 +51,9 @@ export class CardViewSettingTab extends PluginSettingTab { label.addEventListener("input", () => { rule.label = label.value; save(); }); const del = head.createEl("button", { cls: "csv-rr-del", text: "✕" }); del.setAttr("aria-label", "Remove rule"); - del.addEventListener("click", async () => { rules.splice(i, 1); await this.plugin.saveSettings(); this.renderResidencyRules(wrap); }); + del.addEventListener("click", () => { + void (async () => { rules.splice(i, 1); await this.plugin.saveSettings(); this.renderResidencyRules(wrap); })(); + }); const grid = card.createDiv({ cls: "csv-rr-grid" }); const field = (lbl: string, value: string, onChange: (v: string) => void, ph = "") => { @@ -89,10 +90,12 @@ export class CardViewSettingTab extends PluginSettingTab { }); const btns = wrap.createDiv({ cls: "csv-rr-btns" }); - btns.createEl("button", { cls: "csv-rr-add", text: "+ Add rule" }).addEventListener("click", async () => { - rules.push({ label: "New rule", scope: { countries: [] }, window: { type: "calendar-year" }, threshold: 183 }); - await this.plugin.saveSettings(); - this.renderResidencyRules(wrap); + btns.createEl("button", { cls: "csv-rr-add", text: "+ add rule" }).addEventListener("click", () => { + void (async () => { + rules.push({ label: "New rule", scope: { countries: [] }, window: { type: "calendar-year" }, threshold: 183 }); + await this.plugin.saveSettings(); + this.renderResidencyRules(wrap); + })(); }); } } diff --git a/src/tasks-block.ts b/src/tasks-block.ts index 5ddd437..a3a5b55 100644 --- a/src/tasks-block.ts +++ b/src/tasks-block.ts @@ -88,7 +88,7 @@ export function buildAggregate(sources: AggSource[]): Aggregate { src.rows.forEach(srcRow => { const canon: CSVRow = {}; for (const col of CANON) { - canon[col] = map[col] ? (srcRow[map[col] as string] ?? "") : ""; + canon[col] = map[col] ? (srcRow[map[col]] ?? "") : ""; } if (!map.Project) canon.Project = src.basename; rows.push(canon); @@ -123,7 +123,7 @@ function parseBlockSource(source: string): TasksBlockOptions { } function asFile(f: unknown): TFile | null { - return f && typeof f === "object" && "basename" in (f as object) ? (f as TFile) : null; + return f && typeof f === "object" && "basename" in (f) ? (f as TFile) : null; } // ── The block host ─────────────────────────────────────────────────────────── @@ -162,29 +162,31 @@ class TasksBlockHost extends MarkdownRenderChild { get contentEl(): HTMLElement { return this.containerEl; } private get asView(): CardView { return this as unknown as CardView; } - async onload(): Promise { + onload(): void { this.containerEl.addClass("csv-inline-view", "csv-tasks-block"); if (!this.opts.folder && !this.opts.files.length) { this.renderError(`Give a "folder:" line ("/" = whole vault) and/or a "files:" list.`); return; } - await this.reload(); - this.renderView(); - - // Re-sync when any source CSV changes underneath us; skip our own saves - // (text equality) and mid-edit states (doSave reconciles those). - this.registerEvent(this.app.vault.on("modify", async (f) => { - const src = this.sources.find(s => s.file.path === f.path); - if (!src || this.saveTimer) return; - const text = await this.app.vault.read(src.file); - if (text === src.lastText) return; - src.lastText = text; - const parsed = parseCSV(text); - src.headers = parsed.headers; - src.rows = parsed.rows; - this.rebuild(); + void (async () => { + await this.reload(); this.renderView(); - })); + + // Re-sync when any source CSV changes underneath us; skip our own saves + // (text equality) and mid-edit states (doSave reconciles those). + this.registerEvent(this.app.vault.on("modify", async (f) => { + const src = this.sources.find(s => s.file.path === f.path); + if (!src || this.saveTimer) return; + const text = await this.app.vault.read(src.file); + if (text === src.lastText) return; + src.lastText = text; + const parsed = parseCSV(text); + src.headers = parsed.headers; + src.rows = parsed.rows; + this.rebuild(); + this.renderView(); + })); + })(); } onunload(): void { diff --git a/src/travel-view.ts b/src/travel-view.ts index 8aa5cfd..e5c7887 100644 --- a/src/travel-view.ts +++ b/src/travel-view.ts @@ -175,7 +175,7 @@ export async function renderTravel( mapWrap.empty(); if (svg) injectMap(mapWrap, svg, model, select); else mapWrap.createDiv({ cls: "csv-tv-map-loading", text: "World map asset not found (world-map.svg)." }); - } catch (_e) { + } catch { mapWrap.empty(); mapWrap.createDiv({ cls: "csv-tv-map-loading", text: "Couldn't load world map." }); } @@ -230,7 +230,8 @@ function renderStats(root: HTMLElement, m: TravelModel): void { function injectMap(wrap: HTMLElement, svg: string, m: TravelModel, select: (iso: string | null) => void): void { const box = wrap.createDiv({ cls: "csv-tv-map" }); - box.innerHTML = svg; + const svgEl = new DOMParser().parseFromString(svg, "image/svg+xml").documentElement; + box.appendChild(svgEl); box.querySelectorAll(".country-path").forEach(p => { const iso = (p.getAttribute("data-iso") || "").toUpperCase(); p.classList.remove("cp-unvisited", "cp-confirmed", "cp-inferred"); @@ -266,11 +267,15 @@ function injectMap(wrap: HTMLElement, svg: string, m: TravelModel, select: (iso: try { const r = p.getBoundingClientRect(); if (r.width && r.height && Math.max(r.width, r.height) < 12) p.classList.add("cp-tiny"); - } catch (_e) { /* not measurable yet — skip, no halo */ } + } catch { /* not measurable yet — skip, no halo */ } }); const legend = wrap.createDiv({ cls: "csv-tv-map-legend" }); - legend.createSpan({ cls: "csv-tv-leg" }).innerHTML = ` Confirmed`; - legend.createSpan({ cls: "csv-tv-leg" }).innerHTML = ` Photo evidence`; + const confirmedLeg = legend.createSpan({ cls: "csv-tv-leg" }); + confirmedLeg.createSpan({ cls: "csv-tv-dot cp-confirmed" }); + confirmedLeg.appendText(" Confirmed"); + const inferredLeg = legend.createSpan({ cls: "csv-tv-leg" }); + inferredLeg.createSpan({ cls: "csv-tv-dot cp-inferred" }); + inferredLeg.appendText(" Photo evidence"); } /** @@ -431,7 +436,7 @@ function renderTimeline(root: HTMLElement, m: TravelModel, select: (iso: string } } const leg = wrap.createDiv({ cls: "csv-tv-tl-legend" }); - leg.setText("Confirmed (solid) · Photo inferred (outlined)"); + leg.setText("Confirmed (solid) · photo inferred (outlined)"); } function sortByDateDesc(arr: T[]): T[] { diff --git a/src/utils.ts b/src/utils.ts index 9d8547f..b1b257a 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -336,8 +336,6 @@ export function showSelectPicker( // for backward compatibility. document.body.querySelectorAll(".csv-select-picker").forEach(el => el.remove()); const picker = document.body.createDiv({ cls: "csv-select-picker" }); - picker.style.position = "fixed"; - picker.style.zIndex = "9999"; // Anchor below the chip by default, but flip above when there isn't room // below — keeps the dropdown inside the viewport on the bottom edge. @@ -481,7 +479,7 @@ export function showSelectPicker( // and nothing happens. On desktop the scroll/resize dismissal genuinely // fixes the picker-floating-detached-from-anchor case, so keep it there. const isTouch = typeof window !== "undefined" && window.matchMedia?.("(pointer: coarse)").matches; - setTimeout(() => { + window.setTimeout(() => { document.addEventListener("mousedown", onOutside); if (!isTouch) { window.addEventListener("scroll", onScroll, true); diff --git a/src/view/anki.ts b/src/view/anki.ts index 73ea87d..ea68ec6 100644 --- a/src/view/anki.ts +++ b/src/view/anki.ts @@ -27,7 +27,7 @@ async function ankiInvoke(action: string, params: Record): Prom body: JSON.stringify({ action, version: ANKI_CONNECT_VERSION, params }), throw: false, }); - } catch (e) { + } catch { // requestUrl rejects on connection refused — Anki closed or AnkiConnect // not installed. Rethrow with a message the user can act on. throw new Error("Couldn't reach Anki. Is the desktop app open with the AnkiConnect add-on installed?"); diff --git a/src/view/chart.ts b/src/view/chart.ts index 099ad49..e350098 100644 --- a/src/view/chart.ts +++ b/src/view/chart.ts @@ -57,8 +57,8 @@ export interface LinearFit { slope: number; intercept: number; r2: number; } export function linearFit(pts: { x: number; y: number }[]): LinearFit | null { const n = pts.length; if (n < 2) return null; - let sx = 0, sy = 0, sxx = 0, sxy = 0, syy = 0; - for (const p of pts) { sx += p.x; sy += p.y; sxx += p.x * p.x; sxy += p.x * p.y; syy += p.y * p.y; } + let sx = 0, sy = 0, sxx = 0, sxy = 0; + for (const p of pts) { sx += p.x; sy += p.y; sxx += p.x * p.x; sxy += p.x * p.y; } const denom = n * sxx - sx * sx; if (denom === 0) return null; const slope = (n * sxy - sx * sy) / denom; @@ -391,7 +391,7 @@ export function buildChartConfig(spec: ChartSpec, colors: ChartColors): BuiltCha }, }, }, - } as ChartConfiguration["options"], + }, }; return { config, fitText, formulaError }; } @@ -569,7 +569,7 @@ export function buildBarConfig(data: BarData, xLabel: string, yLabel: string, co plugins: { legend: { display: multi, labels: { color: colors.muted, boxWidth: 12 } }, }, - } as ChartConfiguration["options"], + }, }; } diff --git a/src/view/dashboard.ts b/src/view/dashboard.ts index a62256e..1bd0f0e 100644 --- a/src/view/dashboard.ts +++ b/src/view/dashboard.ts @@ -117,18 +117,18 @@ export async function renderDashboard(view: CardView, container: HTMLElement): P // ── Today's Habits ──────────────────────────────────────────────────────── if (currentRow) { const habitsSection = container.createDiv({ cls: "csv-dash-habits" }); - habitsSection.createEl("h3", { text: view.selectedDate === today ? "Today" : view.selectedDate!, cls: "csv-dash-section-title" }); + habitsSection.createEl("h3", { text: view.selectedDate === today ? "Today" : view.selectedDate, cls: "csv-dash-section-title" }); const habitsGrid = habitsSection.createDiv({ cls: "csv-dash-habits-grid" }); habitCols.forEach(h => { - const isChecked = view.isTruthy(currentRow![h]); + const isChecked = view.isTruthy(currentRow[h]); const habitEl = habitsGrid.createDiv({ cls: `csv-dash-habit ${isChecked ? "checked" : ""}` }); const checkbox = habitEl.createEl("button", { cls: "csv-dash-habit-check", text: isChecked ? "●" : "○" }); habitEl.createSpan({ cls: "csv-dash-habit-label", text: h }); checkbox.addEventListener("click", () => { - currentRow![h] = isChecked ? "0" : "1"; + currentRow[h] = isChecked ? "0" : "1"; view.scheduleSave(); // Toggling a habit on the current day shouldn't reset dashboard // scroll — the user may have been looking at habit stats below @@ -138,7 +138,7 @@ export async function renderDashboard(view: CardView, container: HTMLElement): P }); // Habits done count - const doneCount = habitCols.filter(h => view.isTruthy(currentRow![h])).length; + const doneCount = habitCols.filter(h => view.isTruthy(currentRow[h])).length; habitsSection.createDiv({ cls: "csv-dash-habits-count", text: `${doneCount} of ${habitCols.length} complete` }); // Notes preview @@ -269,7 +269,19 @@ export async function renderDashboard(view: CardView, container: HTMLElement): P // Format stats like Dataview: "105 days logged · 2.0 avg/day · 0 perfect days · current streak 8d · best streak 90d" const statsBar = statsSection.createDiv({ cls: "csv-dash-stats-bar" }); - statsBar.innerHTML = `${totalDays} days logged · ${avgPerDay} avg/day · ${perfectDays} perfect days · current streak ${currentStreak}d · best streak ${bestStreak}d`; + const addStat = (value: string, label: string) => { + statsBar.createEl("strong", { text: value }); + statsBar.appendText(` ${label}`); + }; + addStat(String(totalDays), "days logged"); + statsBar.appendText(" · "); + addStat(String(avgPerDay), "avg/day"); + statsBar.appendText(" · "); + addStat(String(perfectDays), "perfect days"); + statsBar.appendText(" · current streak "); + statsBar.createEl("strong", { text: `${currentStreak}d` }); + statsBar.appendText(" · best streak "); + statsBar.createEl("strong", { text: `${bestStreak}d` }); // ── Per-habit cards ─────────────────────────────────────────────────────── const cardsSection = container.createDiv({ cls: "csv-dash-cards-section" }); @@ -495,5 +507,9 @@ function renderHabitTimeline(view: CardView, container: HTMLElement, sortedRows: } const statsEl = timelineSection.createDiv({ cls: "csv-dash-timeline-stats" }); - statsEl.innerHTML = `${doneDays} of ${totalEntries} in ${view.timelineYear} · current streak ${habitStreak}d · best streak ${habitBestStreak}d`; + statsEl.createEl("strong", { text: String(doneDays) }); + statsEl.appendText(` of ${totalEntries} in ${view.timelineYear} · current streak `); + statsEl.createEl("strong", { text: `${habitStreak}d` }); + statsEl.appendText(" · best streak "); + statsEl.createEl("strong", { text: `${habitBestStreak}d` }); } diff --git a/src/view/kanban.ts b/src/view/kanban.ts index ae24ce3..ceda5f8 100644 --- a/src/view/kanban.ts +++ b/src/view/kanban.ts @@ -166,7 +166,7 @@ function renderKanbanCard(view: CardView, container: HTMLElement, row: CSVRow, s text: hasNotesFile ? "📄" : "+", title: hasNotesFile ? "Open notes file" : "Create notes file", }); - notesIconBtn.addEventListener("click", e => { e.stopPropagation(); view.openOrCreateNotes(row); }); + notesIconBtn.addEventListener("click", e => { e.stopPropagation(); void view.openOrCreateNotes(row); }); const sub = view.getSubtitle(row); if (sub) card.createDiv({cls:"csv-kanban-card-sub", text:sub}); @@ -205,7 +205,7 @@ function renderKanbanCard(view: CardView, container: HTMLElement, row: CSVRow, s const hasInlineNotes = !!(notesCol && row[notesCol]?.trim()); // The preview is itself the editor affordance — clicking opens the - // inline textarea. When there's no note yet, render a quiet "+ Add note" + // inline textarea. When there's no note yet, render a quiet "+ add note" // placeholder in the same slot so the click target is discoverable // without needing a separate "Edit note" button. const notesPreviewEl = card.createDiv({cls:"csv-kanban-notes-preview"}); @@ -215,26 +215,25 @@ function renderKanbanCard(view: CardView, container: HTMLElement, row: CSVRow, s notesPreviewEl.title = "Click to edit"; } else { notesPreviewEl.addClass("csv-kanban-notes-preview--empty"); - if (notesCol) notesPreviewEl.setText("+ Add note"); + if (notesCol) notesPreviewEl.setText("+ add note"); } - const notesEditorEl = card.createDiv({cls:"csv-kanban-notes-editor"}); - notesEditorEl.style.display = "none"; + const notesEditorEl = card.createDiv({cls:"csv-kanban-notes-editor is-hidden"}); const openInlineEditor = () => { // Save scroll position of the content area so we can restore it on close - const contentArea = view.contentEl.querySelector(".csv-content-area") as HTMLElement | null; + const contentArea = view.contentEl.querySelector(".csv-content-area"); const scrollLeft = contentArea?.scrollLeft ?? 0; const scrollTop = contentArea?.scrollTop ?? 0; - notesPreviewEl.style.display = "none"; - notesEditorEl.style.display = "block"; + notesPreviewEl.classList.add("is-hidden"); + notesEditorEl.classList.remove("is-hidden"); notesEditorEl.empty(); const ta = notesEditorEl.createEl("textarea", {cls:"csv-notes-textarea"}); ta.value = (notesCol ? row[notesCol] : "") ?? ""; ta.addEventListener("click", e => e.stopPropagation()); ta.addEventListener("mousedown", e => e.stopPropagation()); - ta.addEventListener("input", () => { ta.style.height="auto"; ta.style.height=ta.scrollHeight+"px"; }); + ta.addEventListener("input", () => { ta.style.removeProperty("height"); ta.style.height=ta.scrollHeight+"px"; }); // One close per open: Escape discards (closes with the original text) and // the hide triggers a blur, which must not commit a second time — without // the guard, Escape saved the edit anyway via the follow-up blur. @@ -259,8 +258,8 @@ function renderKanbanCard(view: CardView, container: HTMLElement, row: CSVRow, s // Size to content after a frame. Reading scrollHeight inline (before // layout) returns ~0, which made the height clamp to the 120 px floor // regardless of how long the note actually is. - requestAnimationFrame(() => { - ta.style.height = "auto"; + window.requestAnimationFrame(() => { + ta.style.removeProperty("height"); ta.style.height = Math.max(120, ta.scrollHeight) + "px"; }); }; @@ -269,18 +268,18 @@ function renderKanbanCard(view: CardView, container: HTMLElement, row: CSVRow, s // Only dirty the file on a real change — open-then-close shouldn't queue // a vault write (and the sync churn that follows). if (notesCol && newVal !== (row[notesCol] ?? "")) { row[notesCol]=newVal; view.scheduleSave(); } - notesEditorEl.style.display = "none"; - notesPreviewEl.style.display = ""; + notesEditorEl.classList.add("is-hidden"); + notesPreviewEl.classList.remove("is-hidden"); if (newVal.trim()) { const plain = newVal.replace(/#{1,6}\s/g,"").replace(/[*_>`]/g,"").replace(/\n+/g," ").trim(); notesPreviewEl.setText(plain.slice(0,120) + (plain.length > 120 ? "…" : "")); notesPreviewEl.removeClass("csv-kanban-notes-preview--empty"); notesPreviewEl.title = "Click to edit"; } else { - // Restore the "+ Add note" placeholder rather than leaving an empty, + // Restore the "+ add note" placeholder rather than leaving an empty, // invisible click target. Matches initial render exactly. notesPreviewEl.addClass("csv-kanban-notes-preview--empty"); - notesPreviewEl.setText(notesCol ? "+ Add note" : ""); + notesPreviewEl.setText(notesCol ? "+ add note" : ""); notesPreviewEl.removeAttribute("title"); } // Restore scroll position after the DOM settles @@ -288,15 +287,15 @@ function renderKanbanCard(view: CardView, container: HTMLElement, row: CSVRow, s if (contentArea) { contentArea.scrollLeft = scrollLeft; contentArea.scrollTop = scrollTop; - requestAnimationFrame(() => { + window.requestAnimationFrame(() => { contentArea.scrollLeft = scrollLeft; contentArea.scrollTop = scrollTop; - requestAnimationFrame(() => { + window.requestAnimationFrame(() => { contentArea.scrollLeft = scrollLeft; contentArea.scrollTop = scrollTop; }); }); - setTimeout(() => { + window.setTimeout(() => { contentArea.scrollLeft = scrollLeft; contentArea.scrollTop = scrollTop; }, 50); diff --git a/src/view/library.ts b/src/view/library.ts index 4903952..d9da042 100644 --- a/src/view/library.ts +++ b/src/view/library.ts @@ -14,7 +14,6 @@ export function renderLibrary(view: CardView, container: HTMLElement): void { const cc = effectiveGroupCol(view); const sc = view.getStatusCol(); const titleCol = view.titleKey() ?? view.headers[0]; - const authorCol = view.authorKey(); if (!cc) { container.createEl("p", { text: `No groupable column found.`, cls: "csv-empty-state" }); @@ -53,9 +52,9 @@ export function renderLibrary(view: CardView, container: HTMLElement): void { if (hasDone || hasInProgress) { statusSelect.createEl("option", { text: "───────", value: "", attr: { disabled: "true" } }); - if (hasDone) statusSelect.createEl("option", { text: "✓ Done", value: "__done__" }); - if (hasInProgress) statusSelect.createEl("option", { text: "◐ In Progress", value: "__inprogress__" }); - statusSelect.createEl("option", { text: "○ Not Started", value: "__notstarted__" }); + if (hasDone) statusSelect.createEl("option", { text: "✓ done", value: "__done__" }); + if (hasInProgress) statusSelect.createEl("option", { text: "◐ in progress", value: "__inprogress__" }); + statusSelect.createEl("option", { text: "○ not started", value: "__notstarted__" }); } if (allStatuses.size > 0) { diff --git a/src/view/table.ts b/src/view/table.ts index e63813c..3279ea1 100644 --- a/src/view/table.ts +++ b/src/view/table.ts @@ -101,15 +101,15 @@ export function renderTable(view: CardView, container: HTMLElement): void { const at = tr.createEl("td",{cls:"csv-table-action"}); const hasFile = view.notesFileExists(row); at.createEl("button",{cls:`csv-table-notes-btn ${hasFile?"exists":""}`,text:hasFile?"📄":"✚",title:hasFile?"Open notes":"Create notes"}) - .addEventListener("click",()=>view.openOrCreateNotes(row)); - at.createEl("button",{cls:"csv-table-del-btn",text:"✕",title:"Delete row (Undo available)"}) + .addEventListener("click",()=>void view.openOrCreateNotes(row)); + at.createEl("button",{cls:"csv-table-del-btn",text:"✕",title:"Delete row (undo available)"}) .addEventListener("click",()=>view.deleteWithUndo(row)); }); // Detect overflowing cells in one rAF instead of one per row. Single // querySelectorAll, single forced-layout batch — orders of magnitude // cheaper than per-row rAF on big files. Skipped entirely on touch. if (!isTouch) { - requestAnimationFrame(() => { + window.requestAnimationFrame(() => { tbody.querySelectorAll("td:not(.csv-table-notes-cell):not(.csv-table-action)").forEach(cell => { if (cell.scrollHeight > cell.clientHeight + 1) cell.addClass("csv-cell--clipped"); }); diff --git a/src/view/tasks.ts b/src/view/tasks.ts index f308ff7..f17a5e2 100644 --- a/src/view/tasks.ts +++ b/src/view/tasks.ts @@ -228,7 +228,7 @@ export function renderTasks(view: CardView, container: HTMLElement): void { // Done toggle (only when there's a status column to flip). if (statusCol) { const checkCell = tr.createEl("td", { cls: "csv-tasks-check-cell" }); - const box = checkCell.createEl("span", { cls: `csv-tasks-check ${done ? "is-done" : ""}`, text: done ? "✓" : "" }); + const box = checkCell.createSpan({ cls: `csv-tasks-check ${done ? "is-done" : ""}`, text: done ? "✓" : "" }); box.setAttr("title", done ? "Mark not done" : "Mark done"); box.addEventListener("click", e => { e.stopPropagation(); diff --git a/src/view/toolbar.ts b/src/view/toolbar.ts index 12e248f..792c0d3 100644 --- a/src/view/toolbar.ts +++ b/src/view/toolbar.ts @@ -228,17 +228,17 @@ export function renderToolbar(view: CardView, root: HTMLElement): void { (header) => view.cleanupBooleanColumn(header), ).open(); }; - const openBackup = () => view.backupToArchive(); - const openAnki = () => syncToAnki(view); + const openBackup = () => { void view.backupToArchive(); }; + const openAnki = () => { void syncToAnki(view); }; ctrl.createEl("button", { cls: "csv-cfg-btn csv-cfg-btn-secondary", text: "⚙ Config", title: "Configure this file's columns and views" }) .addEventListener("click", openColumns); - ctrl.createEl("button", { cls: "csv-cfg-btn csv-cfg-btn-secondary", text: "💾 Backup", title: "Copy this file to Archive/ with today's date" }) + ctrl.createEl("button", { cls: "csv-cfg-btn csv-cfg-btn-secondary", text: "💾 Backup", title: "Copy this file to archive/ with today's date" }) .addEventListener("click", openBackup); ctrl.createEl("button", { cls: "csv-cfg-btn csv-cfg-btn-secondary", text: "🎴 Anki", title: "Sync rows to Anki (needs Anki desktop + AnkiConnect)" }) .addEventListener("click", openAnki); - ctrl.createEl("button",{cls:"csv-add-btn",text:"+ Add"}).addEventListener("click",()=>view.openAddModal()); + ctrl.createEl("button",{cls:"csv-add-btn",text:"+ add"}).addEventListener("click",()=>view.openAddModal()); // ⋯ overflow lives after + Add so on mobile (where the secondary buttons // are hidden) the row reads `[modes] [search] [+ Add] [⋯]` — the primary diff --git a/styles.css b/styles.css index a701a7b..f54948f 100644 --- a/styles.css +++ b/styles.css @@ -1278,6 +1278,8 @@ td .csv-select-chip { /* ─── Picker dropdown ─────────────────────────────────────────────────────── */ .csv-select-picker { + position: fixed; + z-index: 9999; background: var(--background-primary); border: 1px solid var(--csv-border); border-radius: var(--csv-radius); @@ -1410,6 +1412,11 @@ td .csv-select-chip { margin-top: 8px; } +.csv-kanban-notes-editor.is-hidden, +.csv-kanban-notes-preview.is-hidden { + display: none; +} + .csv-kanban-notes-editor .csv-notes-textarea { width: 100%; min-height: 120px; @@ -1805,6 +1812,7 @@ td .csv-select-chip { } .csv-expander-rendered:hover { background: var(--csv-surface-2); } +.csv-expander-rendered.is-hidden { display: none; } /* Links/buttons inside the rendered note keep their own cursor and don't pick up the hover-tint from the editable container. */ .csv-expander-rendered a, @@ -1843,6 +1851,7 @@ td .csv-select-chip { flex-direction: column; padding: 16px 20px; } +.csv-expander-editor.is-hidden { display: none; } .csv-expander-textarea { flex: 1; @@ -2274,6 +2283,13 @@ td .csv-select-chip { color: white; } +.csv-expander-delete-btn.confirm { + background: var(--csv-red); + border-color: var(--csv-red); + color: white; + font-weight: 600; +} + /* Chip truncation in kanban */ .csv-chip-value { max-width: 200px; @@ -2793,6 +2809,7 @@ td .csv-select-chip { .csv-add-trigger:hover { background: var(--background-modifier-hover); } .csv-add-trigger:active { transform: scale(0.98); } +.csv-add-trigger.is-hidden { display: none; } /* Expanded card */ .csv-add-card { @@ -2802,6 +2819,7 @@ td .csv-select-chip { box-shadow: inset 0 0 0 1px transparent; transition: box-shadow 0.15s; } +.csv-add-card.is-hidden { display: none; } /* Update mode (date matches an existing row): subtle accent ring + tinted title so the user sees they're editing rather than creating. */ @@ -2866,6 +2884,7 @@ td .csv-select-chip { } .csv-add-row:last-child { border-bottom: none; } +.csv-add-row-custom.is-hidden { display: none; } .csv-add-row-label { flex: 0 0 auto; diff --git a/svg.d.ts b/svg.d.ts new file mode 100644 index 0000000..5e52f80 --- /dev/null +++ b/svg.d.ts @@ -0,0 +1,4 @@ +declare module "*.svg" { + const content: string; + export default content; +} diff --git a/test-support/dom-env.mjs b/test-support/dom-env.mjs index 3663d64..e8c2e05 100644 --- a/test-support/dom-env.mjs +++ b/test-support/dom-env.mjs @@ -34,6 +34,7 @@ export function setupDom() { HE.createDiv = function (opts, cb) { return this.createEl("div", opts, cb); }; HE.createSpan = function (opts, cb) { return this.createEl("span", opts, cb); }; HE.setText = function (t) { this.textContent = t == null ? "" : String(t); return this; }; + HE.appendText = function (t) { this.appendChild(doc.createTextNode(String(t))); return this; }; HE.empty = function () { while (this.firstChild) this.removeChild(this.firstChild); return this; }; HE.addClass = function (...c) { this.classList.add(...c.filter(Boolean)); return this; }; HE.removeClass = function (...c) { this.classList.remove(...c.filter(Boolean)); return this; }; @@ -52,6 +53,7 @@ export function setupDom() { globalThis.document = doc; globalThis.HTMLElement = window.HTMLElement; globalThis.Node = window.Node; + globalThis.DOMParser = window.DOMParser; globalThis.requestAnimationFrame = globalThis.requestAnimationFrame || ((fn) => setTimeout(() => fn(Date.now()), 0)); globalThis.matchMedia = globalThis.matchMedia || (() => ({ matches: false, addEventListener() {}, removeEventListener() {} })); window.matchMedia = window.matchMedia || globalThis.matchMedia; diff --git a/tsconfig.json b/tsconfig.json index 845ca1d..c6a17a3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,5 +12,5 @@ "declaration": false, "noEmit": true }, - "include": ["main.ts"] + "include": ["main.ts", "svg.d.ts"] }