template-obsidian-vault/.obsidian/plugins/qatt/main.js

374 lines
938 KiB
JavaScript
Raw Permalink Normal View History

2024-10-02 18:57:21 +00:00
var b8=Object.create;var Xu=Object.defineProperty;var y8=Object.getOwnPropertyDescriptor;var E8=Object.getOwnPropertyNames;var S8=Object.getPrototypeOf,v8=Object.prototype.hasOwnProperty;var D8=(e,t,r)=>t in e?Xu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Dr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Z2=(e,t)=>{for(var r in t)Xu(e,r,{get:t[r],enumerable:!0})},I0=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of E8(t))!v8.call(e,s)&&s!==r&&Xu(e,s,{get:()=>t[s],enumerable:!(i=y8(t,s))||i.enumerable});return e};var zr=(e,t,r)=>(r=e!=null?b8(S8(e)):{},I0(t||!e||!e.__esModule?Xu(r,"default",{value:e,enumerable:!0}):r,e)),T8=e=>I0(Xu({},"__esModule",{value:!0}),e);var K2=(e,t,r)=>(D8(e,typeof t!="symbol"?t+"":t,r),r),w8=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var N0=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)};var L0=(e,t,r)=>(w8(e,t,"access private method"),r);var si=Dr((wa,$o)=>{"use strict";(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof wa=="object"?$o.exports=t():e.alasql=t()})(wa,function(){var E2,R0,Qd;let e=function(n,c,u,l){if(c=c||[],typeof importScripts!="function"&&e.webworker){var f=e.lastid++;e.buffer[f]=u,e.webworker.postMessage({id:f,sql:n,params:c});return}return arguments.length===0?new L.Select({columns:[new L.Column({columnid:"*"})],from:[new L.ParamValue({param:0})]}):arguments.length===1&&n.constructor===Array?e.promise(n):(typeof c=="function"&&(l=u,u=c,c=[]),typeof c!="object"&&(c=[c]),typeof n=="string"&&n[0]==="#"&&typeof document=="object"?n=document.querySelector(n).textContent:typeof n=="object"&&n instanceof HTMLElement?n=n.textContent:typeof n=="function"&&(n=n.toString(),n=(/\/\*([\S\s]+)\*\//m.exec(n)||["","Function given as SQL. Plese Provide SQL string or have a /* ... */ syle comment with SQL in the function."])[1]),e.exec(n,c,u,l))};e.version="4.5.0",e.build="develop-85c24d42",e.debug=void 0;var t=function(){return null},r="",i=function(){var n=function(Gs,ir,pr,x){for(pr=pr||{},x=Gs.length;x--;pr[Gs[x]]=ir);return pr},c=[2,13],u=[1,104],l=[1,102],f=[1,103],m=[1,6],y=[1,42],E=[1,79],w=[1,76],R=[1,94],I=[1,93],F=[1,69],T=[1,101],D=[1,85],B=[1,64],$=[1,71],Y=[1,84],_=[1,66],j=[1,70],G=[1,68],rt=[1,61],pt=[1,74],Ct=[1,62],xt=[1,67],Ft=[1,83],Tt=[1,77],Rt=[1,86],Q=[1,87],Qt=[1,81],Gt=[1,82],Ze=[1,80],cr=[1,88],Tr=[1,89],Sn=[1,90],Wr=[1,91],wr=[1,92],nn=[1,98],Tn=[1,65],sn=[1,78],Ar=[1,72],Xr=[1,96],Br=[1,97],gn=[1,63],ni=[1,73],f1=[1,108],S2=[1,107],$a=[10,311,607,768],re=[10,311,315,607,768],oe=[1,115],Mn=[1,117],fe=[1,116],ue=[1,118],le=[1,119],ce=[1,120],he=[1,121],Zd=[130,358,415],Kd=[1,129],Xd=[1,128],ep=[1,136],Le=[1,166],de=[1,178],ae=[1,181],Re=[1,176],Z=[1,184],Ie=[1,188],_e=[1,162],K=[1,185],Me=[1,172],$e=[1,174],Pe=[1,177],X=[1,186],be=[1,203],ye=[1,204],qe=[1,168],Be=[1,169],Ue=[1,196],Ve=[1,191],He=[1,192],Ee=[1,197],Se=[1,198],ve=[1,199],De=[1,200],Te=[1,201],we=[1,202],ke=[1,205],Ce=[1,206],xe=[1,179],Fe=[1,180],se=[1,182],Ae=[1,183],We=[1,189],je=[1,195],ee=[1,187],Ge=[1,190],ze=[1,175],Je=[1,173],J=[1,194],z=[1,207],yi=[2,4,5],v2=[2,479],D2=[1,210],Nu=[1,215],d1=[1,224],p1=[1,220],ih=[10,72,78,93,98,118,128,162,168,169,183,198,232,249,251,311,315,607,768],tp=[2,4,5,10,72,76,77,78,112,115,116,118,122,123,124,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,148,149,150,152,154,156,162,164,166,168,169,170,171,172,173,175,183,185,187,198,244,245,285,286,287,288,289,290,291,292,311,315,425,429,607,768],Xt=[2,4,5,10,53,72,74,76,77,78,89,93,95,98,99,107,112,115,116,118,122,123,124,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,148,149,150,152,154,156,162,164,166,168,169,170,171,172,173,175,179,180,181,183,185,187,189,198,206,208,222,223,224,225,226,227,228,229,232,239,244,245,246,247,249,251,271,272,285,286,287,288,289,290,291,292,294,301,305,311,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,335,336,337,338,340,343,344,401,4
`+hn.showPosition()+`
Expecting `+Q2.join(", ")+", got '"+(this.terminals_[$n]||$n)+"'":Ku="Parse error on line "+(Ga+1)+": Unexpected "+($n==Ta?"end of input":"'"+(this.terminals_[$n]||$n)+"'"),this.parseError(Ku,{text:hn.match,token:this.terminals_[$n]||$n,line:hn.yylineno,loc:lo,expected:Q2,recoverable:Zu!==!1})}if(ds==3){if($n===Ta||A1===Ta)throw new Error(Ku||"Parsing halted while starting to recover from another error.");kn=hn.yyleng,b=hn.yytext,Ga=hn.yylineno,lo=hn.yylloc,$n=x0()}if(Zu===!1)throw new Error(Ku||"Parsing halted. No suitable error recovery rule available.");g8(Zu),A1=$n==Rs?null:$n,$n=Rs,zs=pr[pr.length-1],_s=ii[zs]&&ii[zs][Rs],ds=3}if(_s[0]instanceof Array&&_s.length>1)throw new Error("Parse Error: multiple actions possible at state: "+zs+", token: "+$n);switch(_s[0]){case 1:pr.push($n),an.push(hn.yytext),g.push(hn.yylloc),pr.push(_s[1]),$n=null,A1?($n=A1,A1=null):(kn=hn.yyleng,b=hn.yytext,Ga=hn.yylineno,lo=hn.yylloc,ds>0&&ds--);break;case 2:if(za=this.productions_[_s[1]][1],I1.$=an[an.length-za],I1._$={first_line:g[g.length-(za||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(za||1)].first_column,last_column:g[g.length-1].last_column},m8&&(I1._$.range=[g[g.length-(za||1)].range[0],g[g.length-1].range[1]]),Mh=this.performAction.apply(I1,[b,kn,Ga,ia.yy,_s[1],an,g].concat(_o)),typeof Mh<"u")return Mh;za&&(pr=pr.slice(0,-1*za*2),an=an.slice(0,-1*za),g=g.slice(0,-1*za)),pr.push(this.productions_[_s[1]][0]),an.push(I1.$),g.push(I1._$),F0=ii[pr[pr.length-2]][pr[pr.length-1]],pr.push(F0);break;case 3:return!0}}return!0}},d8=["A","ABSENT","ABSOLUTE","ACCORDING","ACTION","ADA","ADD","ADMIN","AFTER","ALWAYS","ASC","ASSERTION","ASSIGNMENT","ATTRIBUTE","ATTRIBUTES","BASE64","BEFORE","BERNOULLI","BLOCKED","BOM","BREADTH","C","CASCADE","CATALOG","CATALOG_NAME","CHAIN","CHARACTERISTICS","CHARACTERS","CHARACTER_SET_CATALOG","CHARACTER_SET_NAME","CHARACTER_SET_SCHEMA","CLASS_ORIGIN","COBOL","COLLATION","COLLATION_CATALOG","COLLATION_NAME","COLLATION_SCHEMA","COLUMNS","COLUMN_NAME","COMMAND_FUNCTION","COMMAND_FUNCTION_CODE","COMMITTED","CONDITION_NUMBER","CONNECTION","CONNECTION_NAME","CONSTRAINTS","CONSTRAINT_CATALOG","CONSTRAINT_NAME","CONSTRAINT_SCHEMA","CONSTRUCTOR","CONTENT","CONTINUE","CONTROL","CURSOR_NAME","DATA","DATETIME_INTERVAL_CODE","DATETIME_INTERVAL_PRECISION","DB","DEFAULTS","DEFERRABLE","DEFERRED","DEFINED","DEFINER","DEGREE","DEPTH","DERIVED","DESC","DESCRIPTOR","DIAGNOSTICS","DISPATCH","DOCUMENT","DOMAIN","DYNAMIC_FUNCTION","DYNAMIC_FUNCTION_CODE","EMPTY","ENCODING","ENFORCED","EXCLUDE","EXCLUDING","EXPRESSION","FILE","FINAL","FIRST","FLAG","FOLLOWING","FORTRAN","FOUND","FS","G","GENERAL","GENERATED","GO","GOTO","GRANTED","HEX","HIERARCHY","ID","IGNORE","IMMEDIATE","IMMEDIATELY","IMPLEMENTATION","INCLUDING","INCREMENT","INDENT","INITIALLY","INPUT","INSTANCE","INSTANTIABLE","INSTEAD","INTEGRITY","INVOKER","ISOLATION","K","KEY","KEY_MEMBER","KEY_TYPE","LAST","LENGTH","LEVEL","LIBRARY","LIMIT","LINK","LOCATION","LOCATOR","M","MAP","MAPPING","MATCHED","MAXVALUE","MESSAGE_LENGTH","MESSAGE_OCTET_LENGTH","MESSAGE_TEXT","MINVALUE","MORE","MUMPS","NAME","NAMES","NAMESPACE","NESTING","NEXT","NFC","NFD","NFKC","NFKD","NIL","NORMALIZED","NULLABLE","NULLS","NUMBER","OBJECT","OCTETS","OFF","OPTION","OPTIONS","ORDERING","ORDINALITY","OTHERS","OUTPUT","OVERRIDING","P","PAD","PARAMETER_MODE","PARAMETER_NAME","PARAMETER_ORDINAL_POSITION","PARAMETER_SPECIFIC_CATALOG","PARAMETER_SPECIFIC_NAME","PARAMETER_SPECIFIC_SCHEMA","PARTIAL","PASCAL","PASSING","PASSTHROUGH","PATH","PERMISSION","PLACING","PLI","PRECEDING","PRESERVE","PRIOR","PRIVILEGES","PUBLIC","READ","RECOVERY","RELATIVE","REPEATABLE","REQUIRING","RESPECT","RESTART","RESTORE","RESTRICT","RETURNED_CARDINALITY","RETURNED_LENGTH","RETURNED_OCTET_LENGTH","RETURNED_SQLSTATE","RETURNING","ROLE","ROUTINE","ROUTINE_CATALOG","ROUTINE_NAME","ROUTINE_SCHEMA","ROW_COUNT","SCALE","SCHEMA","SCHEMA_NAME","SCOPE_CATALOG","SCOPE_NAME","SCOPE_SCHEMA","SECTION","SECURITY","SELECTIVE","SELF","SEQUENCE","SERIALIZABLE","SERVER","SERVER_NAME","SESSION","SETS","SIMPLE","SIZE","SO
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(ir){this.unput(this.match.slice(ir))},pastInput:function(){var ir=this.matched.substr(0,this.matched.length-this.match.length);return(ir.length>20?"...":"")+ir.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var ir=this.match;return ir.length<20&&(ir+=this._input.substr(0,20-ir.length)),(ir.substr(0,20)+(ir.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var ir=this.pastInput(),pr=new Array(ir.length+1).join("-");return ir+this.upcomingInput()+`
`+pr+"^"},test_match:function(ir,pr){var x,an,g;if(this.options.backtrack_lexer&&(g={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(g.yylloc.range=this.yylloc.range.slice(0))),an=ir[0].match(/(?:\r\n?|\n).*/g),an&&(this.yylineno+=an.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:an?an[an.length-1].length-an[an.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+ir[0].length},this.yytext+=ir[0],this.match+=ir[0],this.matches=ir,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(ir[0].length),this.matched+=ir[0],x=this.performAction.call(this,this.yy,this,pr,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),x)return x;if(this._backtrack){for(var ii in g)this[ii]=g[ii];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var ir,pr,x,an;this._more||(this.yytext="",this.match="");for(var g=this._currentRules(),ii=0;ii<g.length;ii++)if(x=this._input.match(this.rules[g[ii]]),x&&(!pr||x[0].length>pr[0].length)){if(pr=x,an=ii,this.options.backtrack_lexer){if(ir=this.test_match(x,g[ii]),ir!==!1)return ir;if(this._backtrack){pr=!1;continue}else return!1}else if(!this.options.flex)break}return pr?(ir=this.test_match(pr,g[an]),ir!==!1?ir:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var ir=this.next();return ir||this.lex()},begin:function(ir){this.conditionStack.push(ir)},popState:function(){var ir=this.conditionStack.length-1;return ir>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(ir){return ir=this.conditionStack.length-1-Math.abs(ir||0),ir>=0?this.conditionStack[ir]:"INITIAL"},pushState:function(ir){this.begin(ir)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(ir,pr,x,an){var g=an;switch(x){case 0:return 271;case 1:return 307;case 2:return 425;case 3:return 304;case 4:return 5;case 5:return 5;case 6:return 301;case 7:return 301;case 8:return 132;case 9:return 132;case 10:return;case 11:break;case 12:return 321;case 13:return 324;case 14:return pr.yytext="VALUE",89;case 15:return pr.yytext="VALUE",189;case 16:return pr.yytext="ROW",189;case 17:return pr.yytext="COLUMN",189;case 18:return pr.yytext="MATRIX",189;case 19:return pr.yytext="INDEX",189;case 20:return pr.yytext="RECORDSET",189;case 21:return pr.yytext="TEXT",189;case 22:return pr.yytext="SELECT",189;case 23:return 525;case 24:return 386;case 25:return 407;case 26:return 520;case 27:return 291;case 28:return 274;case 29:return 274;case 30:return 164;case 31:return 405;case 32:return 170;case 33:return 229;case 34:return 166;case 35:return 207;case 36:return 292;case 37:return 76;case 38:return 423;case 39:return 246;case 40:return 409;case 41:return 361;case 42:return 290;case 43:return 519;case 44:return 442;case 45:return 335;case 46:return 446;case 47:return 336;case 48:return 320;case 49:return 119;case 50:return 112;case 51:return 320;case 52:return 112;case 53:return 320;case 54:return 112;case 55:return 320;case 56:return 513;case 57:return 308;case 58:return 276;case 59:return 373;case 60:return 130;case 61:return"CLOSE";case 62:return 247;case 63:return 190;case 64:return 190;case 65:return 439;case 66:return 372;case 67:return 475;case 68:return 445;case 69:return 278;case 70:return 240;case 71:return 287;case 72:return 272;case 73:return 206;case 74:return 238;case 75:return 269;case 76:return 270;case 77:return 270;case 78:return"CURSOR";case 79:return 410;case 80:return 295;case 81:return 296;case 82:return 297;case 83:return 453;case 84:return 348;case 85:return 343;case 86:return"DELETED";case 87:return 246;case 88:return 411;case 89:return 185;case 90:return 401;case 91:return 452;case 92:return 135;case 93:return 311;case 94:return 394;case 95:return 315;case 96:return 319;case 97:return 169;case 98:return 513;case 99:return 513;case 100:return 303;case 101:return 14;case 102:return 300;case 103:return 253;case 104:return 244;case 105:return 95;case 106:return 378;case 107:return 183;case 108:return 227;case 109:return 273;case 110:return 318;case 111:return 607;case 112:return 477;case 113:return 232;case 114:return 236;case 115:return 239;case 116:return 156;case 117:return 361;case 118:return 337;case 119:return 99;case 120:return 193;case 121:return 212;case 122:return 224;case 123:return 521;case 124:return 344;case 125:return 213;case 126:return 168;case 127:return 298;case 128:return 198;case 129:return 223;case 130:return 375;case 131:return 245;case 132:return"LET";case 133:return 225;case 134:return 112;case 135:return 249;case 136:return 465;case 137:return 191;case 138:return 289;case 139:return 395;case 140:return 288;case 141:return 457;case 142:return 169;case 143:return 408;case 144:return 222;case 145:return 650;case 146:return 275;case 147:return 248;case 148:return 385;case 149:return 154;case 150:return 302;case 151:return 243;case 152:return 438;case 153:return 230;case 154:return 420;case 155:return 129;case 156:return 251;case 157:return"OPEN";case 158:return 421;case 159:return 171;case 160:return 118;case 161:return
`:return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029"}})},v=s.undoubleq=function(n){return n.replace(/(\')/g,"''")},S=s.doubleq=function(n){return n.replace(/(\'\')/g,"\\'")},C=s.doubleqq=function(n){return n.replace(/\'/g,"'")},k=function(n){return n[0]==="\uFEFF"&&(n=n.substr(1)),n};s.global=function(){return typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Function("return this")()}();var N=s.isNativeFunction=function(n){return typeof n=="function"&&!!~n.toString().indexOf("[native code]")};s.isWebWorker=function(){try{var n=s.global.importScripts;return s.isNativeFunction(n)}catch(c){return!1}}(),s.isNode=function(){try{return!(typeof process>"u"||!process.versions||!process.versions.node)}catch(n){return!1}}(),s.isBrowser=function(){try{return s.isNativeFunction(s.global.location.reload)}catch(n){return!1}}(),s.isBrowserify=function(){return s.isBrowser&&typeof process<"u"&&process.browser}(),s.isRequireJS=function(){return s.isBrowser&&typeof t=="function"&&typeof t.specified=="function"}(),s.isMeteor=function(){return typeof Meteor<"u"&&Meteor.release}(),s.isMeteorClient=s.isMeteorClient=function(){return s.isMeteor&&Meteor.isClient}(),s.isMeteorServer=function(){return s.isMeteor&&Meteor.isServer}(),s.isCordova=function(){return typeof cordova=="object"}(),s.isReactNative=function(){var n=!1;return n}(),s.hasIndexedDB=function(){return!!s.global.indexedDB}(),s.isArray=function(n){return Object.prototype.toString.call(n)==="[object Array]"};let pe=/^[a-z]+:\/\//i,Ne=s.loadFile=function(n,c,u,l){var f,m;if(!(s.isNode||s.isMeteorServer)){if(s.isCordova){s.global.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(R){R.root.getFile(n,{create:!1},function(I){I.file(function(F){var T=new FileReader;T.onloadend=function(D){u(k(this.result))},T.readAsText(F)})})});return}if(typeof n=="string"){if(n.substr(0,1)==="#"&&typeof document<"u"){f=document.querySelector(n).textContent,u(f);return}tt(n,R=>u(k(R)),l,c);return}if(n instanceof Event){var y=n.target.files,E=new FileReader,w=y[0].name;E.onload=function(R){var I=R.target.result;u(k(I))},E.readAsText(y[0])}tt(n,R=>u(k(R)),l,c)}},me=typeof fetch<"u"?fetch:null;async function tt(n,c,u,l){return l?et(n,c,u):await et(n,c,u)}function et(n,c,u){return me(n).then(l=>l.arrayBuffer()).then(l=>{var f=new Uint8Array(l),m=[...f].map(y=>String.fromCharCode(y)).join("");c(m)}).catch(l=>{if(u)return u(l);throw console.error(l),l})}var te=s.loadBinaryFile=function(n,c,u,l=f=>{throw f}){var f;if(!(s.isNode||s.isMeteorServer))if(typeof n=="string"){var m=new XMLHttpRequest;m.open("GET",n,c),m.responseType="arraybuffer",m.onload=function(){for(var R=new Uint8Array(m.response),I=[],F=0;F<R.length;++F)I[F]=String.fromCharCode(R[F]);u(I.join(""))},m.onerror=l,m.send()}else if(n instanceof Event){var y=n.target.files,E=new FileReader,w=y[0].name;E.onload=function(R){var I=R.target.result;u(I)},E.onerror=l,E.readAsArrayBuffer(y[0])}else n instanceof Blob&&u(n)},Ye=s.removeFile=function(n,c){if(!s.isNode)throw new Error("You can remove files only in Node.js and Apache Cordova")},O=s.deleteFile=function(n,c){};s.autoExtFilename=function(n,c,u){return u=u||{},typeof n!="string"||n.match(/^[A-Z]+:\/\/|\n|\..{2,6}$/i)||u.autoExt===0||u.autoExt===!1?n:n+"."+c};var M=s.fileExists=function(n,c){if(!s.isNode)throw new Error("You can use exists() only in Node.js or Apach Cordova")},ge=s.saveFile=function(n,c,u,l){var f=1;if(n===void 0)f=c,u&&(f=u(f));else if(!s.isNode){var m={disableAutoBom:!1};e.utils.extend(m,l);var y=new Blob([c],{type:"text/plain;charset=utf-8"});Ns(y,n,m.disableAutoBom),u&&(f=u(f))}return f},Oe=s.hash=function(n){for(var c=2166136261,u=n.length;u;)c^=n.charCodeAt(--u),c+=(c<<1)+(c<<4)+(c<<7)+(c<<8)+(c<<24);return c},H=s.arrayUnion=function(n,c){var u=c.slice(0);return n.forEach(function(l){u.indexOf(l)<0&&u.push(l)}),u},kt=s.arrayDiff=function(n,c){return n.filter(function(u){return c.indexOf(u)<0})},bt=s.arrayIntersect=function(n,c){var u=[];return n.forEach(function(l){var f=!1;c.forEach(function(m){f=f||l===m}),f&
`||n[m+1]==="\r"||n.length-2===m)&&(f=!1),n[m]=""):n[m]==='"'||n[m]==="'"?(c=!0,u=n[m]):n[m]==="["&&n[m-1]!=="@"?(c=!0,u="]"):n[m]==="-"&&n[m+1]==="-"?(n[m]="",f=!0):n[m]==="/"&&n[m+1]==="*"&&(n[m]="",l=!0)}return n=n.join("").slice(2,-2),n},e.parser=i,e.parser.parseError=function(n,c){throw new Error("Have you used a reserved keyword without `escaping` it?\n"+n)},e.parse=function(n){return i.parse(e.utils.uncomment(n))},e.engines={},e.databases={},e.databasenum=0,e.options={errorlog:!1,valueof:!0,dropifnotexists:!1,datetimeformat:"sql",casesensitive:!0,logtarget:"output",logprompt:!0,progress:!1,modifier:void 0,columnlookup:10,autovertex:!0,usedbo:!0,autocommit:!0,cache:!0,tsql:!0,mysql:!0,postgres:!0,oracle:!0,sqlite:!0,orientdb:!0,nocount:!1,nan:!1,excel:{cellDates:!0},joinstar:"overwrite",loopbreak:1e5,dateAsString:!0},e.vars={},e.declares={},e.prompthistory=[],e.plugins={},e.from={},e.into={},e.fn={},e.aggr={},e.busy=0,e.MAXSQLCACHESIZE=1e4,e.DEFAULTDATABASEID="alasql",e.lastid=0,e.buffer={},e.private={externalXlsxLib:null},e.setXLSX=function(n){e.private.externalXlsxLib=n},e.use=function(n){if(n||(n=e.DEFAULTDATABASEID),e.useid!==n)if(e.databases[n]!==void 0){e.useid=n;let c=e.databases[e.useid];e.tables=c.tables,c.resetSqlCache(),e.options.usedbo&&(e.databases.dbo=c)}else throw Error("Database does not exist: "+n)},e.autoval=function(n,c,u,l){var f=l?e.databases[l]:e.databases[e.useid];if(!f.tables[n])throw new Error("Tablename not found: "+n);if(!f.tables[n].identities[c])throw new Error("Colname not found: "+c);return u?f.tables[n].identities[c].value||null:f.tables[n].identities[c].value-f.tables[n].identities[c].step||null},e.exec=function(n,c,u,l){if(typeof c=="function"&&(l=u,u=c,c={}),delete e.error,c=c||{},e.options.errorlog)try{return e.dexec(e.useid,n,c,u,l)}catch(f){e.error=f,u&&u(null,e.error)}else return e.dexec(e.useid,n,c,u,l)},e.dexec=function(n,c,u,l,f){var m=e.databases[n],y=Oe(c);if(e.options.cache){let I=m.sqlCache[y];if(I&&m.dbversion===I.dbversion)return I(u,l)}let E=m.astCache[y];if(e.options.cache&&!E?(E=e.parse(c),E&&(m.astCache[y]=E)):E=e.parse(c),!!E.statements){if(E.statements.length===0)return 0;if(E.statements.length===1){if(E.statements[0].compile){var w=E.statements[0].compile(n,u);if(!w)return;w.sql=c,w.dbversion=m.dbversion,e.options.cache&&(m.sqlCacheSize>e.MAXSQLCACHESIZE&&m.resetSqlCache(),m.sqlCacheSize++,m.sqlCache[y]=w);var R=e.res=w(u,l,f);return R}e.precompile(E.statements[0],e.useid,u);var R=e.res=E.statements[0].execute(n,u,l,f);return R}if(l){e.adrun(n,E,u,l,f);return}return e.drun(n,E,u,l,f)}},e.drun=function(n,c,u,l,f){var m=e.useid;m!==n&&e.use(n);for(var y=[],E=0,w=c.statements.length;E<w;E++)if(c.statements[E])if(c.statements[E].compile){var R=c.statements[E].compile(e.useid);y.push(e.res=R(u,null,f))}else e.precompile(c.statements[E],e.useid,u),y.push(e.res=c.statements[E].execute(e.useid,u));return m!==n&&e.use(m),l&&l(y),e.res=y,y},e.adrun=function(n,c,u,l,f){var m=0,y=c.statements.length;e.options.progress!==!1&&e.options.progress(y,m++);var E=e.useid;E!==n&&e.use(n);var w=[];function R(I){I!==void 0&&w.push(I);var F=c.statements.shift();if(!F){E!==n&&e.use(E),l(w);return}if(F.compile){var T=F.compile(e.useid);T(u,R,f),e.options.progress!==!1&&e.options.progress(y,m++);return}e.precompile(c.statements[0],e.useid,u),F.execute(e.useid,u,R),e.options.progress!==!1&&e.options.progress(y,m++)}R()},e.compile=function(n,c){c=c||e.useid;let u=e.parse(n);if(u.statements.length!==1)throw new Error("Cannot compile, because number of statements in SQL is not equal to 1");var l=u.statements[0].compile(c);return l.promise=function(f){return new Promise(function(m,y){l(f,function(E,w){w?y(w):m(E)})})},l},s.global.Promise||(s.global.Promise=Promise);var Mr=function(n,c,u,l){return new s.global.Promise(function(f,m){e(n,c,function(y,E){E?m(E):(u&&l&&e.options.progress!==!1&&e.options.progress(u,l),f(y))})})};let Lr=(n,c)=>{var u=c.resolve([]);return n.forEach(l=>{u=u.then(f=>Mr(l.sql,l.params,l.i,l.length).then(m=>[...f,m]))}),u};var Or=function(n){if(!(n.length<1)){for(var c,
(a[${JSON.stringify(E)}]||'')${y}
${m.direction==="ASC"?">":"<"}
(b[${JSON.stringify(E)}]||'')${y}
) return 1;
if(
(a[${JSON.stringify(E)}]||'')${y}
==
(b[${JSON.stringify(E)}]||'')${y}
){
`}else y=".valueOf()",m.nocase&&(y+=".toUpperCase()"),u+=`
if (
(${m.toJS("a","")} || '')${y}
${m.direction==="ASC"?">":"<"}
(${m.toJS("b","")} || '')${y}
) return 1;
if (
(${m.toJS("a","")} || '')${y} ==
(${m.toJS("b","")} || '')${y}
) {`;l+="}"}),u+="return 0;",u+=l+"return -1",new Function("a,b",u)}};function ln(n,c,u,l,f){n.sourceslen=n.sources.length;let m=n.sourceslen;n.query=n,n.A=l,n.B=f,n.cb=u,n.oldscope=c,n.queriesfn&&(n.sourceslen+=n.queriesfn.length,m+=n.queriesfn.length,n.queriesdata=[],n.queriesfn.forEach(function(E,w){E.query.params=n.params,ci([],-w-1,n)})),n.scope=c?Yt(c):{};let y;if(n.sources.forEach(function(E,w){E.query=n;var R=E.datafn(n,n.params,ci,w,e);typeof R<"u"&&((n.intofn||n.intoallfn)&&Array.isArray(R)&&(R=R.length),y=R),E.queriesdata=n.queriesdata}),n.sources.length==0||m===0)try{y=Rr(n)}catch(E){if(u)return u(null,E);throw E}return y}function ci(n,c,u){if(c>=0){let l=u.sources[c];l.data=n,typeof l.data=="function"&&(l.getfn=l.data,l.dontcache=l.getfn.dontcache,["OUTER","RIGHT","ANTI"].includes(l.joinmode)&&(l.dontcache=!1),l.data={})}else u.queriesdata[-c-1]=kr(n);if(u.sourceslen--,!(u.sourceslen>0))return Rr(u)}function Rr(n){var c=n.scope,u;Hn(n),n.data=[],n.xgroups={},n.groups=[];var l=0;if(Wn(n,c,l),n.groupfn){if(n.data=[],n.groups.length===0&&n.allgroups.length===0){var f={};n.selectGroup.length>0&&n.selectGroup.forEach(function(G){G.aggregatorid=="COUNT"||G.aggregatorid=="SUM"||G.aggregatorid=="TOTAL"?f[G.nick]=0:f[G.nick]=void 0}),n.groups=[f]}if(n.aggrKeys.length>0){var m="";n.aggrKeys.forEach(function(G){m+=`
g[${JSON.stringify(G.nick)}] = alasql.aggr[${JSON.stringify(G.funcid)}](undefined,g[${JSON.stringify(G.nick)}],3); `});var y=new Function("g,params,alasql","var y;"+m)}for(var E=0,w=n.groups.length;E<w;E++){var f=n.groups[E];if(y&&y(f,n.params,e),!n.havingfn||n.havingfn(f,n.params,e)){var R=n.selectgfn(f,n.params,e);for(let rt in n.groupColumns)n.groupColumns[rt]!==rt&&R[n.groupColumns[rt]]&&!n.groupColumns[n.groupColumns[rt]]&&delete R[n.groupColumns[rt]];n.data.push(R)}}}if(gi(n),n.unionallfn){var I,F;if(n.corresponding)n.unionallfn.query.modifier||(n.unionallfn.query.modifier=void 0),I=n.unionallfn(n.params);else{n.unionallfn.query.modifier||(n.unionallfn.query.modifier="RECORDSET"),F=n.unionallfn(n.params),I=[],w=F.data.length;for(var E=0;E<w;E++){var T={};if(n.columns.length){u=Math.min(n.columns.length,F.columns.length);for(var D=0;D<u;D++)T[n.columns[D].columnid]=F.data[E][F.columns[D].columnid]}else{u=F.columns.length;for(var D=0;D<u;D++)T[F.columns[D].columnid]=F.data[E][F.columns[D].columnid]}I.push(T)}}n.data=n.data.concat(I)}else if(n.unionfn){if(n.corresponding)n.unionfn.query.modifier||(n.unionfn.query.modifier="ARRAY"),I=n.unionfn(n.params);else{n.unionfn.query.modifier||(n.unionfn.query.modifier="RECORDSET"),F=n.unionfn(n.params),I=[],w=F.data.length;for(var E=0;E<w;E++){if(T={},n.columns.length){u=Math.min(n.columns.length,F.columns.length);for(var D=0;D<u;D++)T[n.columns[D].columnid]=F.data[E][F.columns[D].columnid]}else{u=F.columns.length;for(var D=0;D<u;D++)T[F.columns[D].columnid]=F.data[E][F.columns[D].columnid]}I.push(T)}}n.data=wt(n.data,I)}else if(n.exceptfn){if(n.corresponding){n.exceptfn.query.modifier||(n.exceptfn.query.modifier="ARRAY");var I=n.exceptfn(n.params)}else{n.exceptfn.query.modifier||(n.exceptfn.query.modifier="RECORDSET");for(var F=n.exceptfn(n.params),I=[],E=0,w=F.data.length;E<w;E++){for(var T={},D=Math.min(n.columns.length,F.columns.length)-1;0<=D;D--)T[n.columns[D].columnid]=F.data[E][F.columns[D].columnid];I.push(T)}}n.data=_t(n.data,I)}else if(n.intersectfn){if(n.corresponding)n.intersectfn.query.modifier||(n.intersectfn.query.modifier=void 0),I=n.intersectfn(n.params);else for(n.intersectfn.query.modifier||(n.intersectfn.query.modifier="RECORDSET"),F=n.intersectfn(n.params),I=[],w=F.data.length,E=0;E<w;E++){for(T={},u=Math.min(n.columns.length,F.columns.length),D=0;D<u;D++)T[n.columns[D].columnid]=F.data[E][F.columns[D].columnid];I.push(T)}n.data=nt(n.data,I)}if(n.orderfn){if(n.explain)var B=Date.now();n.data=n.data.sort(n.orderfn),n.explain&&n.explaination.push({explid:n.explid++,description:"QUERY BY",ms:Date.now()-B})}if(Vs(n),typeof angular<"u"&&n.removeKeys.push("$$hashKey"),n.removeKeys.length>0){var $=n.removeKeys;if(u=$.length,u>0)for(w=n.data.length,E=0;E<w;E++)for(D=0;D<u;D++)delete n.data[E][$[D]];n.columns.length>0&&(n.columns=n.columns.filter(function(G){var rt=!1;return $.forEach(function(pt){G.columnid==pt&&(rt=!0)}),!rt}))}if(typeof n.removeLikeKeys<"u"&&n.removeLikeKeys.length>0){for(var Y=n.removeLikeKeys,E=0,w=n.data.length;E<w;E++){T=n.data[E];for(var _ in T)for(D=0;D<n.removeLikeKeys.length;D++)e.utils.like(n.removeLikeKeys[D],_)&&delete T[_]}n.columns.length>0&&(n.columns=n.columns.filter(function(G){var rt=!1;return Y.forEach(function(pt){e.utils.like(pt,G.columnid)&&(rt=!0)}),!rt}))}if(n.pivotfn&&n.pivotfn(),n.unpivotfn&&n.unpivotfn(),n.intoallfn){var j=n.intoallfn(n.columns,n.cb,n.params,n.alasql);return j}if(n.intofn){for(w=n.data.length,E=0;E<w;E++)n.intofn(n.data[E],E,n.params,n.alasql);return n.cb&&n.cb(n.data.length,n.A,n.B),n.data.length}return j=n.data,n.cb&&(j=n.cb(n.data,n.A,n.B)),j}function Vs(n){if(n.limit){var c=0;n.offset&&(c=n.offset|0||0,c=c<0?0:c);var u;n.percent?u=(n.data.length*n.limit/100|0)+c:u=(n.limit|0)+c,n.data=n.data.slice(c,u)}}function gi(n){if(n.distinct){for(var c={},u=Object.keys(n.data[0]||[]),l=0,f=n.data.length;l<f;l++){var m=u.map(function(E){return n.data[l][E]}).join("`");c[m]=n.data[l]}n.data=[];for(var y in c)n.data.push(c[y])}}var Hn=function(n){for(var c=0,u=n.sources.length;c<u;c++){var l=n.sources[c];if
.engines[${JSON.stringify(e.databases[this.into.databaseid||n].engineid)}]
.intoTable(
${JSON.stringify(this.into.databaseid||n)},
${JSON.stringify(this.into.tableid)},
this.data,
columns,
cb
);`:l.intofns=`alasql
.databases[${JSON.stringify(this.into.databaseid||n)}]
.tables[${JSON.stringify(this.into.tableid)}]
.data.push(r);
`;else if(this.into instanceof L.VarValue)l.intoallfns=`
alasql.vars[${JSON.stringify(this.into.variable)}]=this.data;
res=this.data.length;
if(cb) res = cb(res);
return res;
`;else if(this.into instanceof L.FuncValue){var f="return alasql.into["+JSON.stringify(this.into.funcid.toUpperCase())+"](";this.into.args&&this.into.args.length>0?(f+=this.into.args[0].toJS()+",",this.into.args.length>1?f+=this.into.args[1].toJS()+",":f+="undefined,"):f+="undefined, undefined,",l.intoallfns=f+"this.data,columns,cb)"}else this.into instanceof L.ParamValue&&(l.intofns=`params[${JSON.stringify(this.into.param)}].push(r)`);l.intofns?l.intofn=new Function("r,i,params,alasql","var y;"+l.intofns):l.intoallfns&&(l.intoallfn=new Function("columns,cb,params,alasql","var y;"+l.intoallfns))}var m=function(y,E,w){l.params=y;var R=ln(l,w,function(I,F){if(F)return E(null,F);if(l.rownums.length>0)for(var T=0,D=I.length;T<D;T++)for(var B=0,$=l.rownums.length;B<$;B++)I[T][l.rownums[B]]=T+1;var Y=hi(l,I);return E&&E(Y),Y});return R};return m.query=l,m}execute(n,c,u){return this.compile(n)(c,u)}compileWhereExists(n){this.exists&&(n.existsfn=this.exists.map(function(c){var u=c.compile(n.database.databaseid);return u.query.modifier="RECORDSET",u}))}compileQueries(n){this.queries&&(n.queriesfn=this.queries.map(function(c){var u=c.compile(n.database.databaseid);return u.query.modifier="RECORDSET",u}))}};function hi(n,c){if(typeof c>"u"||typeof c=="number"||typeof c=="string"||typeof c=="boolean")return c;var u=n.modifier||e.options.modifier,l=n.columns;if(typeof l>"u"||l.length==0)if(c.length>0){for(var f={},m=Math.min(c.length,e.options.columnlookup||10)-1;0<=m;m--)for(var y in c[m])f[y]=!0;l=Object.keys(f).map(function(w){return{columnid:w}})}else l=[];switch(u){case"VALUE":if(c.length===0)return;let w=l&&l.length>0?l[0].columnid:Object.keys(c[0])[0];return c[0][w];case"ROW":return c.length===0?void 0:Object.values(c[0]);case"COLUMN":if(c.length===0)return[];let R;l&&l.length>0?R=l[0].columnid:R=Object.keys(c[0])[0];let I=[];for(var m=0,E=c.length;m<E;m++)I.push(c[m][R]);return I;case"MATRIX":return c.length===0?void 0:c.map(B=>l.map($=>B[$.columnid]));case"INDEX":if(c.length===0)return;let F=l&&l.length>0?l[0].columnid:Object.keys(c[0])[0],T=l&&l.length>1?l[1].columnid:Object.keys(c[0])[1];return c.reduce((B,$)=>({...B,[$[F]]:$[T]}),{});case"RECORDSET":return new e.Recordset({columns:l,data:c});case"TEXTSTRING":if(c.length===0)return;let D=l&&l.length>0?l[0].columnid:Object.keys(c[0])[0];return c.map(B=>B[D]).join(`
`)}return c}L.ExistsValue=class{constructor(n){Object.assign(this,n)}toString(){return"EXISTS("+this.value.toString()+")"}toType(){return"boolean"}toJS(n,c,u){return`!!this.existsfn[${this.existsidx}](params, null, ${n}).data.length`}},e.precompile=function(n,c,u){n&&(n.params=u,n.queries&&(n.queriesfn=n.queries.map(function(l){var f=l.compile(c||n.database.databaseid);return f.query.modifier="RECORDSET",f})),n.exists&&(n.existsfn=n.exists.map(function(l){var f=l.compile(c||n.database.databaseid);return f.query.modifier="RECORDSET",f})))},L.Select.prototype.compileFrom=function(n){let c=this;n.sources=[],n.aliases={},c.from&&(c.from.forEach(u=>{let l=u.as||u.tableid;if(u instanceof L.Table)n.aliases[l]={tableid:u.tableid,databaseid:u.databaseid||n.database.databaseid,type:"table"};else if(u instanceof L.Select)n.aliases[l]={type:"subquery"};else if(u instanceof L.Search)n.aliases[l]={type:"subsearch"};else if(u instanceof L.ParamValue)n.aliases[l]={type:"paramvalue"};else if(u instanceof L.FuncValue)n.aliases[l]={type:"funcvalue"};else if(u instanceof L.VarValue)n.aliases[l]={type:"varvalue"};else if(u instanceof L.FromData)n.aliases[l]={type:"fromdata"};else if(u instanceof L.Json)n.aliases[l]={type:"json"};else if(u.inserted)n.aliases[l]={type:"inserted"};else throw new Error("Wrong table at FROM");let f={alias:l,databaseid:u.databaseid||n.database.databaseid,tableid:u.tableid,joinmode:"INNER",onmiddlefn:h,srcwherefns:"",srcwherefn:h};if(u instanceof L.Table)f.columns=e.databases[f.databaseid].tables[f.tableid].columns,e.options.autocommit&&e.databases[f.databaseid].engineid&&!e.databases[f.databaseid].tables[f.tableid].view?f.datafn=(m,y,E,w,R)=>R.engines[R.databases[f.databaseid].engineid].fromTable(f.databaseid,f.tableid,E,w,m):e.databases[f.databaseid].tables[f.tableid].view?f.datafn=(m,y,E,w,R)=>{let I=R.databases[f.databaseid].tables[f.tableid].select(y);return E&&(I=E(I,w,m)),I}:f.datafn=(m,y,E,w,R)=>{let I=R.databases[f.databaseid].tables[f.tableid].data;return E&&(I=E(I,w,m)),I};else if(u instanceof L.Select)f.subquery=u.compile(n.database.databaseid),typeof f.subquery.query.modifier>"u"&&(f.subquery.query.modifier="RECORDSET"),f.columns=f.subquery.query.columns,f.datafn=(m,y,E,w,R)=>{let I;return f.subquery(m.params,F=>{I=F.data,E&&(I=E(I,w,m))}),I};else if(u instanceof L.Search)f.subsearch=u,f.columns=[],f.datafn=(m,y,E,w,R)=>{let I;return f.subsearch.execute(m.database.databaseid,m.params,F=>{I=F,E&&(I=E(I,w,m))}),I};else if(u instanceof L.ParamValue){let m=`var res = alasql.prepareFromData(params['${u.param}']`;u.array&&(m+=",true"),m+=");if(cb)res=cb(res,idx,query);return res",f.datafn=new Function("query,params,cb,idx,alasql",m)}else if(u.inserted){let m="var res = alasql.prepareFromData(alasql.inserted";u.array&&(m+=",true"),m+=");if(cb)res=cb(res,idx,query);return res",f.datafn=new Function("query,params,cb,idx,alasql",m)}else if(u instanceof L.Json){let m="var res = alasql.prepareFromData("+u.toJS();u.array&&(m+=",true"),m+=");if(cb)res=cb(res,idx,query);return res",f.datafn=new Function("query,params,cb,idx,alasql",m)}else if(u instanceof L.VarValue){let m=`var res = alasql.prepareFromData(alasql.vars['${u.variable}']`;u.array&&(m+=",true"),m+=");if(cb)res=cb(res,idx,query);return res",f.datafn=new Function("query,params,cb,idx,alasql",m)}else if(u instanceof L.FuncValue){let m="var res=alasql.from["+JSON.stringify(u.funcid.toUpperCase())+"](";u.args&&u.args.length>0?(u.args[0]?m+=u.args[0].toJS("query.oldscope")+",":m+="null,",u.args[1]?m+=u.args[1].toJS("query.oldscope")+",":m+="null,"):m+="null,null,",m+="cb,idx,query); return res",f.datafn=new Function("query,params,cb,idx,alasql",m)}else if(u instanceof L.FromData)f.datafn=(m,y,E,w,R)=>{let I=u.data;return E&&(I=E(I,w,m)),I};else throw new Error("Wrong table at FROM");n.sources.push(f)}),n.defaultTableid=n.sources[0].alias)},e.prepareFromData=function(n,c){let u=n;if(typeof n=="string")u=n.split(/\r?\n/),c&&(u=u.map(l=>[l]));else if(c)u=n.map(l=>[l]);else if(typeof n=="object"&&!Array.isArray(n))if(typeof Mongo<"u"&&typeof Mongo.Collection<"u"&
${$} : ${$} == 'string' && typeof Number(${$}) == 'number' ? Number(${$}) :
typeof ${$} == 'boolean' ? Number(${$}) : 0,`}return`'${D}':(${T})|| typeof ${T} == 'number' ?
${T} : ${T} == 'string' && typeof Number(${T}) == 'number' ? Number(${T}) :
typeof ${T} === 'boolean' ? Number(${T}) : 0,`}else{if(F.aggregatorid==="FIRST"||F.aggregatorid==="LAST")return"'"+D+"':"+T+",";if(F.aggregatorid==="MIN"){if("funcid"in F.expression){let $=B(F.expression);return`'${D}': (typeof ${$} == 'number' ? ${T} : typeof ${$} == 'object' ?
typeof Number(${$}) == 'number' && ${$}!== null? ${T} : null : null),`}return`'${D}': (typeof ${T} == 'number' ? ${T} : typeof ${T} == 'object' ?
typeof Number(${T}) == 'number' && ${T}!== null? ${T} : null : null),`}else if(F.aggregatorid==="MAX"){if("funcid"in F.expression){let $=B(F.expression);return`'${D}' : (typeof ${$} == 'number' ? ${T} : typeof ${$} == 'object' ?
typeof Number(${$}) == 'number' ? ${T} : null : null),`}return`'${D}' : (typeof ${T} == 'number' ? ${T} : typeof ${T} == 'object' ?
typeof Number(${T}) == 'number' ? ${T} : null : null),`}else{if(F.aggregatorid==="ARRAY")return`'${D}':[${T}],`;if(F.aggregatorid==="COUNT")return F.expression.columnid==="*"?`'${D}':1,`:`'${D}':(typeof ${T} == "undefined" || ${T} === null) ? 0 : 1,`;if(F.aggregatorid==="AVG")return n.removeKeys.push(`_SUM_${D}`),n.removeKeys.push(`_COUNT_${D}`),`'${D}':${T},'_SUM_${D}':(${T})||0,'_COUNT_${D}':(typeof ${T} == "undefined" || ${T} === null) ? 0 : 1,`;if(F.aggregatorid==="AGGR")return R+=`,g['${D}']=${F.expression.toJS("g",-1)}`,"";if(F.aggregatorid==="REDUCE")return n.aggrKeys.push(F),`'${D}':alasql.aggr['${F.funcid}'](${T},undefined,1),`}}return""}return""}).join(""),m+="}"+R+",g));"+I+"} else {",m+=n.selectGroup.map(function(F){var T=F.nick,D=F.expression.toJS("p",c,u);let B=_=>_.args[0].toJS("p",c,u);if(F instanceof L.AggrValue){var $="",Y="";if(F.distinct&&($=`if(typeof ${D}!="undefined" && (!g['$$_VALUES_${T}'][${D}])) {`,Y=`g['$$_VALUES_${T}'][${D}]=true;}`),F.aggregatorid==="SUM"){if("funcid"in F.expression){let _=B(F.expression);return $+`
{
const __g_colas = g['${T}'];
const __typeof_colexp1 = typeof ${_};
if (__g_colas == null && ${_} == null) {
g['${T}'] = null;
} else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp1 !== 'object' && __typeof_colexp1 !== 'number') ||
(__g_colas == null || (typeof __g_colas !== 'number' && typeof __g_colas !== 'object')) && (${_} == null || (__typeof_colexp1 !== 'number' && __typeof_colexp1 !== 'object'))) {
g['${T}'] = null;
} else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp1 == 'number') ||
(__g_colas == null && __typeof_colexp1 == 'number')) {
g['${T}'] = ${D};
} else if (typeof __g_colas == 'number' && ${_} == null) {
g['${T}'] = __g_colas;
} else {
g['${T}'] += ${D} || 0;
}
}
`+Y}return $+`
{
const __g_colas = g['${T}'];
const __typeof_colexp = typeof ${D};
if (__g_colas == null && ${D} == null) {
g['${T}'] = null;
} else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp !== 'object' && __typeof_colexp !== 'number') ||
(__g_colas == null || (typeof __g_colas !== 'number' && typeof __g_colas !== 'object')) && (${D} == null || (__typeof_colexp !== 'number' && __typeof_colexp !== 'object'))) {
g['${T}'] = null;
} else if (typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp == 'number') {
g['${T}'] = ${D};
} else if (typeof __g_colas == 'number' && ${D} == null) {
g['${T}'] = __g_colas;
} else if (__g_colas == null && __typeof_colexp == 'number') {
g['${T}'] = ${D};
} else {
g['${T}'] += ${D} || 0;
}
}
`+Y}else if(F.aggregatorid==="TOTAL"){if("funcid"in F.expression){let _=B(F.expression);return $+`{
const __g_colas = g['${T}'];
const __colexp1 = ${_};
const __typeof_g_colas = typeof __g_colas;
const __typeof_colexp1 = typeof __colexp1;
if (__typeof_g_colas == 'string' && !isNaN(__g_colas) && typeof Number(__g_colas) == 'number' &&
__typeof_colexp1 == 'string' && !isNaN(__colexp1) && typeof Number(__colexp1) == 'number') {
g['${T}'] = Number(__g_colas) + Number(__colexp1);
} else if (__typeof_g_colas == 'string' && __typeof_colexp1 == 'string') {
g['${T}'] = 0;
} else if (__typeof_g_colas == 'string' && __typeof_colexp1 == 'number') {
g['${T}'] = __colexp1;
} else if (__typeof_colexp1 == 'string' && __typeof_g_colas == 'number') {
g['${T}'] = __g_colas;
} else {
g['${T}'] += __colexp1 || 0;
}
}`+Y}return $+`{
const __g_colas = g['${T}'];
const __colexp = ${D};
const __typeof_g_colas = typeof __g_colas;
const __typeof_colexp = typeof __colexp;
if (__typeof_g_colas === 'string' && !isNaN(__g_colas) && typeof Number(__g_colas) === 'number' &&
__typeof_colexp === 'string' && !isNaN(__colexp) && typeof Number(__colexp) === 'number') {
g['${T}'] = Number(__g_colas) + Number(__colexp);
} else if (__typeof_g_colas === 'string' && __typeof_colexp === 'string') {
g['${T}'] = 0;
} else if (__typeof_g_colas === 'string' && __typeof_colexp === 'number') {
g['${T}'] = __colexp;
} else if (__typeof_colexp === 'string' && __typeof_g_colas === 'number') {
g['${T}'] = __g_colas;
} else {
g['${T}'] += __colexp || 0;
}
}
`+Y}else{if(F.aggregatorid==="COUNT")return F.expression.columnid==="*"?`${$}
g['${T}']++;
${Y}`:`${$}
if(typeof ${D}!="undefined" && ${D} !== null) g['${T}']++;
${Y}`;if(F.aggregatorid==="ARRAY")return $+"g['"+T+"'].push("+D+");"+Y;if(F.aggregatorid==="MIN"){if("funcid"in F.expression){let _=B(F.expression);return $+`if((g['${T}'] == null && ${_}!== null) ? y = ${D} : (g['${T}']!== null &&
${_} == null) ? y = g['${T}']:((y=${D}) < g['${T}'])){ if(typeof y == 'number')
{g['${T}'] = y;}else if(typeof y == 'object' && y instanceof Date){g['${T}'] = y;}
else if(typeof y == 'object' && typeof Number(y) == 'number'){g['${T}'] = Number(y);}}
else if(g['${T}']!== null && typeof g['${T}'] == 'object' && y instanceof Date){g['${T}'] = g['${T}']}
else if(g['${T}']!== null && typeof g['${T}'] == 'object'){g['${T}'] = Number(g['${T}'])}`+Y}return $+`if((g['${T}'] == null && ${D}!== null) ? y = ${D} : (g['${T}']!== null &&
${D} == null) ? y = g['${T}']:((y=${D}) < g['${T}'])){ if(typeof y == 'number')
{g['${T}'] = y;}else if(typeof y == 'object' && y instanceof Date){g['${T}'] = y;}
else if(typeof y == 'object' && typeof Number(y) == 'number'){g['${T}'] = Number(y);}}
else if(g['${T}']!== null && typeof g['${T}'] == 'object' && y instanceof Date){g['${T}'] = g['${T}']}
else if(g['${T}']!== null && typeof g['${T}'] == 'object'){g['${T}'] = Number(g['${T}'])}`+Y}else if(F.aggregatorid==="MAX"){if("funcid"in F.expression){let _=B(F.expression);return $+`if((g['${T}'] == null && ${_}!== null) ? y = ${D} : (g['${T}']!== null &&
${_} == null) ? y = g['${T}']:((y=${D}) > g['${T}'])){ if(typeof y == 'number')
{g['${T}'] = y;}else if(typeof y == 'object' && y instanceof Date){g['${T}'] = y;}
else if(typeof y == 'object' && typeof Number(y) == 'number'){g['${T}'] = Number(y);}}
else if(g['${T}']!== null && typeof g['${T}'] == 'object' && y instanceof Date){g['${T}'] = g['${T}']}
else if(g['${T}']!== null && typeof g['${T}'] == 'object'){g['${T}'] = Number(g['${T}'])}`+Y}return $+`if((g['${T}'] == null && ${D}!== null) ? y = ${D} : (g['${T}']!== null &&
${D} == null) ? y = g['${T}']:((y=${D}) > g['${T}'])){ if(typeof y == 'number')
{g['${T}'] = y;}else if(typeof y == 'object' && y instanceof Date){g['${T}'] = y;}
else if(typeof y == 'object' && typeof Number(y) == 'number'){g['${T}'] = Number(y);}}
else if(g['${T}']!== null && typeof g['${T}'] == 'object' && y instanceof Date){g['${T}'] = g['${T}']}
else if(g['${T}']!== null && typeof g['${T}'] == 'object'){g['${T}'] = Number(g['${T}'])}`+Y}else{if(F.aggregatorid==="FIRST")return"";if(F.aggregatorid==="LAST")return`${$}g['${T}']=${D};${Y}`;if(F.aggregatorid==="AVG")return`${$}
g['_SUM_${T}'] += (y=${D})||0;
g['_COUNT_${T}'] += (typeof y == "undefined" || y === null) ? 0 : 1;
g['${T}']=g['_SUM_${T}'] / g['_COUNT_${T}'];
${Y}`;if(F.aggregatorid==="AGGR")return`${$}
g['${T}']=${F.expression.toJS("g",-1)};
${Y}`;if(F.aggregatorid==="REDUCE")return`${$}
g['${T}'] = alasql.aggr.${F.funcid}(${D},g['${T}'],2);
${Y}`}}return""}return""}).join(""),m+="}"}),new Function("p,params,alasql","var y;"+m)};function Hs(n,c,u){var l="",f=[],m={};return c.forEach(function(y){n.ixsources={},n.sources.forEach(function(w){n.ixsources[w.alias]=w});var E;if(n.ixsources[y])var E=n.ixsources[y].columns;u&&e.options.joinstar=="json"&&(l+="r['"+y+"']={};"),E&&E.length>0?E.forEach(function(w){let R=p(w.columnid);if(u&&e.options.joinstar=="underscore")f.push("'"+y+"_"+R+"':p['"+y+"']['"+R+"']");else if(u&&e.options.joinstar=="json")l+="r['"+y+"']['"+R+"']=p['"+y+"']['"+R+"'];";else{var I="p['"+y+"']['"+R+"']";if(m[w.columnid]){var F=I+" !== undefined ? "+I+" : "+m[w.columnid].value;f[m[w.columnid].id]=m[w.columnid].key+F,m[w.columnid].value=F}else{var T="'"+R+"':";f.push(T+I),m[w.columnid]={id:f.length-1,value:I,key:T}}}n.selectColumns[R]=!0;var D={columnid:w.columnid,dbtypeid:w.dbtypeid,dbsize:w.dbsize,dbprecision:w.dbprecision,dbenum:w.dbenum};n.columns.push(D),n.xcolumns[D.columnid]=D}):(l+='var w=p["'+y+'"];for(var k in w){r[k]=w[k]};',n.dirtyColumns=!0)}),{s:f.join(","),sp:l}}L.Select.prototype.compileSelect1=function(n,c){var u=this;n.columns=[],n.xcolumns={},n.selectColumns={},n.dirtyColumns=!1;var l="var r={",f="",m=[];return this.columns.forEach(function(y){if(y instanceof L.Column)if(y.columnid==="*")if(y.func)f+="r=params['"+y.param+"'](p['"+n.sources[0].alias+"'],p,params,alasql);";else if(y.tableid){var E=Hs(n,[y.tableid],!1);E.s&&(m=m.concat(E.s)),f+=E.sp}else{var E=Hs(n,Object.keys(n.aliases),!0);E.s&&(m=m.concat(E.s)),f+=E.sp}else{var w=y.tableid,R=y.databaseid||n.sources[0].databaseid||n.database.databaseid;if(w||(w=n.defcols[y.columnid]),w||(w=n.defaultTableid),y.columnid!=="_"){var I=c&&c.length>1&&Array.isArray(c[0])&&c[0].length>=1&&c[0][0].hasOwnProperty("sheetid");I?f='var r={};var w=p["'+w+'"];var cols=['+u.columns.map(function($){return"'"+$.columnid+"'"}).join(",")+"];var colas=["+u.columns.map(function($){return"'"+($.as||$.columnid)+"'"}).join(",")+"];for (var i=0;i<Object.keys(p['"+w+"']).length;i++) for(var k=0;k<cols.length;k++){if (!r.hasOwnProperty(i)) r[i]={}; r[i][colas[k]]=w[i][cols[k]];}":m.push("'"+p(y.as||y.columnid)+"':p['"+w+"']['"+y.columnid+"']")}else m.push("'"+p(y.as||y.columnid)+"':p['"+w+"']");if(n.selectColumns[p(y.as||y.columnid)]=!0,n.aliases[w]&&n.aliases[w].type==="table"){if(!e.databases[R].tables[n.aliases[w].tableid])throw new Error("Table '"+w+"' does not exist in database");var F=e.databases[R].tables[n.aliases[w].tableid].columns,T=e.databases[R].tables[n.aliases[w].tableid].xcolumns;if(T&&F.length>0){var D=T[y.columnid];if(D===void 0)throw new Error("Column does not exist: "+y.columnid);var B={columnid:y.as||y.columnid,dbtypeid:D.dbtypeid,dbsize:D.dbsize,dbpecision:D.dbprecision,dbenum:D.dbenum};n.columns.push(B),n.xcolumns[B.columnid]=B}else{var B={columnid:y.as||y.columnid};n.columns.push(B),n.xcolumns[B.columnid]=B,n.dirtyColumns=!0}}else{var B={columnid:y.as||y.columnid};n.columns.push(B),n.xcolumns[B.columnid]=B}}else if(y instanceof L.AggrValue){u.group||(u.group=[""]),y.as||(y.as=p(y.toString())),y.aggregatorid==="SUM"||y.aggregatorid==="MAX"||y.aggregatorid==="MIN"||y.aggregatorid==="FIRST"||y.aggregatorid==="LAST"||y.aggregatorid==="AVG"||y.aggregatorid==="ARRAY"||y.aggregatorid==="REDUCE"||y.aggregatorid==="TOTAL"?m.push("'"+p(y.as)+"':"+a(y.expression.toJS("p",n.defaultTableid,n.defcols))):y.aggregatorid==="COUNT"&&m.push("'"+p(y.as)+"':1");var B={columnid:y.as||y.columnid||y.toString()};n.columns.push(B),n.xcolumns[B.columnid]=B}else{m.push("'"+p(y.as||y.columnid||y.toString())+"':"+a(y.toJS("p",n.defaultTableid,n.defcols))),n.selectColumns[p(y.as||y.columnid||y.toString())]=!0;var B={columnid:y.as||y.columnid||y.toString()};n.columns.push(B),n.xcolumns[B.columnid]=B}}),l+=m.join(",")+"};"+f,l},L.Select.prototype.compileSelect2=function(n,c){var u=n.selectfns;return this.orderColumns&&this.orderColumns.length>0&&this.orderColumns.forEach(function(l,f){var m="$$$"+f;l instanceof L.Column&&n.xcolumns[l.columnid]?u+="r['"+m+"']=r['"+l.columnid+"'];":l instanceof L.ParamValue
let y, r;`;return this.expression?(l+=`let v = ${this.expression.toJS(n,c,u)};`,this.whens.forEach((f,m)=>{let y=`v === ${f.when.toJS(n,c,u)}`,E=`r = ${f.then.toJS(n,c,u)}`;l+=`${m===0?"if":" else if"} (${y}) { ${E}; }`})):this.whens.forEach((f,m)=>{let y=f.when.toJS(n,c,u),E=`r = ${f.then.toJS(n,c,u)}`;l+=`${m===0?"if":" else if"} (${y}) { ${E}; }`}),this.elses&&(l+=` else { r = ${this.elses.toJS(n,c,u)}; }`),l+="; return r; }))("+n+", params, alasql)",l},L.Json=function(n){return Object.assign(this,n)},L.Json.prototype.toString=function(){var n="";return n+=lt(this.value),n+="",n};let lt=e.utils.JSONtoString=function(n){if(typeof n=="string")return`"${n}"`;if(typeof n=="number"||typeof n=="boolean")return String(n);if(Array.isArray(n))return`[${n.map(c=>lt(c)).join(",")}]`;if(typeof n=="object")if(!n.toJS||n instanceof L.Json){let c=[];for(let u in n){let l=typeof u=="string"?`"${u}"`:String(u),f=lt(n[u]);c.push(`${l}:${f}`)}return`{${c.join(",")}}`}else{if(n.toString)return n.toString();throw new Error(`1: Cannot show JSON object ${JSON.stringify(n)}`)}else throw new Error(`2: Cannot show JSON object ${JSON.stringify(n)}`)};function yt(n,c,u,l){var f="";if(typeof n=="string")f='"'+n+'"';else if(typeof n=="number")f="("+n+")";else if(typeof n=="boolean")f=n;else if(typeof n=="object")if(Array.isArray(n))f+=`[${n.map(m=>yt(m,c,u,l)).join(",")}]`;else if(!n.toJS||n instanceof L.Json){let m=[];for(let y in n){let E=typeof y=="string"?`"${y}"`:y.toString(),w=yt(n[y],c,u,l);m.push(`${E}:${w}`)}f=`{${m.join(",")}}`}else if(n.toJS)f=n.toJS(c,u,l);else throw new Error(`Cannot parse JSON object ${JSON.stringify(n)}`);else throw new Error("2Can not parse JSON object "+JSON.stringify(n));return f}L.Json.prototype.toJS=function(n,c,u){return yt(this.value,n,c,u)},L.Convert=function(n){return Object.assign(this,n)},L.Convert.prototype.toString=function(){var n="CONVERT(";return n+=this.dbtypeid,typeof this.dbsize<"u"&&(n+="("+this.dbsize,this.dbprecision&&(n+=","+this.dbprecision),n+=")"),n+=","+this.expression.toString(),this.style&&(n+=","+this.style),n+=")",n},L.Convert.prototype.toJS=function(n,c,u){return`alasql.stdfn.CONVERT(${this.expression.toJS(n,c,u)}, {
dbtypeid: "${this.dbtypeid}",
dbsize: ${this.dbsize},
dbprecision: ${this.dbprecision},
style: ${this.style}
})`};function ie(n){var c=n.getMonth()+1,u=n.getYear(),l=n.getFullYear(),f=n.getDate(),m=n.toString().substr(4,3),y=("0"+f).substr(-2),E=("0"+c).substr(-2),w=("0"+u).substr(-2),R=("0"+n.getHours()).substr(-2),I=("0"+n.getMinutes()).substr(-2),F=("0"+n.getSeconds()).substr(-2),T=("00"+n.getMilliseconds()).substr(-3);return{month:c,year:u,fullYear:l,date:f,day:m,formattedDate:y,formattedMonth:E,formattedYear:w,formattedHour:R,formattedMinutes:I,formattedSeconds:F,formattedMilliseconds:T}}e.stdfn.CONVERT=function(n,c){var E;var u=n,l=(E=c.dbtypeid)==null?void 0:E.toUpperCase(),f,m;if((c.style||c.dbtypeid=="Date"||["DATE","DATETIME","DATETIME2"].indexOf(l)>-1)&&(/\d{8}/.test(u)?f=new Date(+u.substr(0,4),+u.substr(4,2)-1,+u.substr(6,2)):f=Fr(u),m=ie(f)),c.style)switch(c.style){case 1:u=m.formattedMonth+"/"+m.formattedDate+"/"+m.formattedYear;break;case 2:u=m.formattedYear+"."+m.formattedMonth+"."+m.formattedDate;break;case 3:u=m.formattedDate+"/"+m.formattedMonth+"/"+m.formattedYear;break;case 4:u=m.formattedDate+"."+m.formattedMonth+"."+m.formattedYear;break;case 5:u=m.formattedDate+"-"+m.formattedMonth+"-"+m.formattedYear;break;case 6:u=m.formattedDate+" "+m.day.toLowerCase()+" "+m.formattedYear;break;case 7:u=m.day+" "+m.formattedDate+","+m.formattedYear;break;case 8:case 108:u=m.formattedHour+":"+m.formattedMinutes+":"+m.formattedSeconds;break;case 10:u=m.formattedMonth+"-"+m.formattedDate+"-"+m.formattedYear;break;case 11:u=m.formattedYear+"/"+m.formattedMonth+"/"+m.formattedDate;break;case 12:u=m.formattedYear+m.formattedMonth+m.formattedDate;break;case 101:u=m.formattedMonth+"/"+m.formattedDate+"/"+m.fullYear;break;case 102:u=m.fullYear+"."+m.formattedMonth+"."+m.formattedDate;break;case 103:u=m.formattedDate+"/"+m.formattedMonth+"/"+m.fullYear;break;case 104:u=m.formattedDate+"."+m.formattedMonth+"."+m.fullYear;break;case 105:u=m.formattedDate+"-"+m.formattedMonth+"-"+m.fullYear;break;case 106:u=m.formattedDate+" "+m.day.toLowerCase()+" "+m.fullYear;break;case 107:u=m.day+" "+m.formattedDate+","+m.fullYear;break;case 110:u=m.formattedMonth+"-"+m.formattedDate+"-"+m.fullYear;break;case 111:u=m.fullYear+"/"+m.formattedMonth+"/"+m.formattedDate;break;case 112:u=m.fullYear+m.formattedMonth+m.formattedDate;break;default:throw new Error("The CONVERT style "+c.style+" is not realized yet.")}switch(l){case"DATE":return`${m.formattedYear}.${m.formattedMonth}.${m.formattedDate}`;case"DATETIME":case"DATETIME2":return`${m.fullYear}.${m.formattedMonth}.${m.formattedDate} ${m.formattedHour}:${m.formattedMinutes}:${m.formattedSeconds}.${m.formattedMilliseconds}`;case"MONEY":var y=+u;return(y|0)+y*100%100/100;case"BOOLEAN":return!!u;case"INT":case"INTEGER":case"SMALLINT":case"BIGINT":case"SERIAL":case"SMALLSERIAL":case"BIGSERIAL":return u|0;case"STRING":case"VARCHAR":case"NVARCHAR":case"CHARACTER VARIABLE":return c.dbsize?String(u).substr(0,c.dbsize):String(u);case"CHAR":case"CHARACTER":case"NCHAR":return(u+" ".repeat(c.dbsize)).substr(0,c.dbsize);case"NUMBER":case"FLOAT":case"DECIMAL":case"NUMERIC":var y=+u;return c.dbsize!==void 0&&(y=parseFloat(y.toPrecision(c.dbsize))),c.dbprecision!==void 0&&(y=parseFloat(y.toFixed(c.dbprecision))),y;case"JSON":if(typeof u=="object")return u;try{return JSON.parse(u)}catch(w){throw new Error("Cannot convert string to JSON")}case"Date":return u;default:return u}},L.ColumnDef=function(n){return Object.assign(this,n)},L.ColumnDef.prototype.toString=function(){let n=this.columnid;return this.dbtypeid&&(n+=" "+this.dbtypeid),this.dbsize&&(n+="("+this.dbsize,this.dbprecision&&(n+=","+this.dbprecision),n+=")"),this.primarykey&&(n+=" PRIMARY KEY"),this.notnull&&(n+=" NOT NULL"),n},L.CreateTable=function(n){return Object.assign(this,n)},L.CreateTable.prototype.toString=function(){let n=`CREATE${this.temporary?" TEMPORARY":""}${this.view?" VIEW":` ${this.class?"CLASS":"TABLE"}`}${this.ifnotexists?" IF NOT EXISTS":""} ${this.table.toString()}`;return this.viewcolumns&&(n+=`(${this.viewcolumns.map(c=>c.toString()).join(",")})`),this.as?n+=` AS ${this.as}`:n+=` (${this.columns.map(c=>c.toString()).join("
`;return n=e.utils.autoExtFilename(n,"sql",c),m=e.utils.saveFile(n,E),f&&(m=f(m)),m},e.into.HTML=function(n,c,u,l,f){var m=1;if(typeof document!="object"){var y={headers:!0};e.utils.extend(y,c);var E=document.querySelector(n);if(!E)throw new Error("Selected HTML element is not found");l.length===0&&typeof u[0]=="object"&&(l=Object.keys(u[0]).map(function($){return{columnid:$}}));var w=document.createElement("table"),R=document.createElement("thead");if(w.appendChild(R),y.headers){for(var I=document.createElement("tr"),F=0;F<l.length;F++){var T=document.createElement("th");T.textContent=l[F].columnid,I.appendChild(T)}R.appendChild(I)}var D=document.createElement("tbody");w.appendChild(D);for(var B=0;B<u.length;B++){for(var I=document.createElement("tr"),F=0;F<l.length;F++){var T=document.createElement("td");T.textContent=u[B][l[F].columnid],I.appendChild(T)}D.appendChild(I)}e.utils.domEmptyChildren(E),E.appendChild(w)}return f&&(m=f(m)),m},e.into.JSON=function(n,c,u,l,f){var m=1;typeof n=="object"&&(c=n,n=void 0);var y=JSON.stringify(u);return n=e.utils.autoExtFilename(n,"json",c),m=e.utils.saveFile(n,y),f&&(m=f(m)),m},e.into.TXT=function(n,c,u,l,f){l.length===0&&u.length>0&&(l=Object.keys(u[0]).map(function(w){return{columnid:w}})),typeof n=="object"&&(c=n,n=void 0);var m=u.length,y="";if(u.length>0){var E=l[0].columnid;y+=u.map(function(w){return w[E]}).join(`
`)}return n=e.utils.autoExtFilename(n,"txt",c),m=e.utils.saveFile(n,y),f&&(m=f(m)),m},e.into.TAB=e.into.TSV=function(n,c,u,l,f){var m={};return e.utils.extend(m,c),m.separator=" ",n=e.utils.autoExtFilename(n,"tab",c),m.autoExt=!1,e.into.CSV(n,m,u,l,f)},e.into.CSV=function(n,c,u,l,f){l.length===0&&u.length>0&&(l=Object.keys(u[0]).map(function(w){return{columnid:w}})),typeof n=="object"&&(c=n,n=void 0);var m={headers:!0};m.separator=";",m.quote='"',m.utf8Bom=!0,c&&!c.headers&&typeof c.headers<"u"&&(m.utf8Bom=!1),e.utils.extend(m,c);var y=u.length,E=m.utf8Bom?"\uFEFF":"";return m.headers&&(E+=m.quote+l.map(function(w){return w.columnid.trim()}).join(m.quote+m.separator+m.quote)+m.quote+`\r
`),u.forEach(function(w){E+=l.map(function(R){var I=w[R.columnid];return m.quote!==""&&(I=(I+"").replace(new RegExp("\\"+m.quote,"g"),m.quote+m.quote)),+I!=I&&(I=m.quote+I+m.quote),I}).join(m.separator)+`\r
`}),n=e.utils.autoExtFilename(n,"csv",c),y=e.utils.saveFile(n,E,null,{disableAutoBom:!0}),f&&(y=f(y)),y},e.into.XLS=function(n,c,u,l,f){typeof n=="object"&&(c=n,n=void 0);var m={};c&&c.sheets&&(m=c.sheets);var y={headers:!0};typeof m.Sheet1<"u"?y=m[0]:typeof c<"u"&&(y=c),typeof y.sheetid>"u"&&(y.sheetid="Sheet1");var E=R();n=e.utils.autoExtFilename(n,"xls",c);var w=e.utils.saveFile(n,E);return f&&(w=f(w)),w;function R(){var F='<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head> <meta charset="utf-8" /> <!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets> ';if(F+=" <x:ExcelWorksheet><x:Name>"+y.sheetid+"</x:Name><x:WorksheetOptions><x:DisplayGridlines/> </x:WorksheetOptions> </x:ExcelWorksheet>",F+="</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head>",F+="<body",typeof y.style<"u"&&(F+=' style="',typeof y.style=="function"?F+=y.style(y):F+=y.style,F+='"'),F+=">",F+="<table>",typeof y.caption<"u"){var T=y.caption;typeof T=="string"&&(T={title:T}),F+="<caption",typeof T.style<"u"&&(F+=' style="',typeof T.style=="function"?F+=T.style(y,T):F+=T.style,F+='" '),F+=">",F+=T.title,F+="</caption>"}return typeof y.columns<"u"?l=y.columns:l.length==0&&u.length>0&&typeof u[0]=="object"&&(Array.isArray(u[0])?l=u[0].map(function(D,B){return{columnid:B}}):l=Object.keys(u[0]).map(function(D){return{columnid:D}})),l.forEach(function(D,B){typeof y.column<"u"&&lr(D,y.column),typeof D.width>"u"&&(y.column&&y.column.width!="undefined"?D.width=y.column.width:D.width="120px"),typeof D.width=="number"&&(D.width=D.width+"px"),typeof D.columnid>"u"&&(D.columnid=B),typeof D.title>"u"&&(D.title=""+D.columnid.trim()),y.headers&&Array.isArray(y.headers)&&(D.title=y.headers[B])}),F+="<colgroups>",l.forEach(function(D){F+='<col style="width: '+D.width+'"></col>'}),F+="</colgroups>",y.headers&&(F+="<thead>",F+="<tr>",l.forEach(function(D,B){F+="<th ",typeof D.style<"u"&&(F+=' style="',typeof D.style=="function"?F+=D.style(y,D,B):F+=D.style,F+='" '),F+=">",typeof D.title<"u"&&(typeof D.title=="function"?F+=D.title(y,D,B):F+=D.title),F+="</th>"}),F+="</tr>",F+="</thead>"),F+="<tbody>",u&&u.length>0&&u.forEach(function(D,B){if(!(B>y.limit)){F+="<tr";var $={};lr($,y.row),y.rows&&y.rows[B]&&lr($,y.rows[B]),typeof $<"u"&&typeof $.style<"u"&&(F+=' style="',typeof $.style=="function"?F+=$.style(y,D,B):F+=$.style,F+='" '),F+=">",l.forEach(function(Y,_){var j={};lr(j,y.cell),lr(j,$.cell),typeof y.column<"u"&&lr(j,y.column.cell),lr(j,Y.cell),y.cells&&y.cells[B]&&y.cells[B][_]&&lr(j,y.cells[B][_]);var G=D[Y.columnid];typeof j.value=="function"&&(G=j.value(G,y,D,Y,j,B,_));var rt=j.typeid;typeof rt=="function"&&(rt=rt(G,y,D,Y,j,B,_)),typeof rt>"u"&&(typeof G=="number"?rt="number":typeof G=="string"?rt="string":typeof G=="boolean"?rt="boolean":typeof G=="object"&&G instanceof Date&&(rt="date"));var pt="";rt=="money"?pt='mso-number-format:"\\#\\,\\#\\#0\\\\ _\u0440_\\.";white-space:normal;':rt=="number"?pt=" ":rt=="date"?pt='mso-number-format:"Short Date";':c.types&&c.types[rt]&&c.types[rt].typestyle&&(pt=c.types[rt].typestyle),pt=pt||'mso-number-format:"\\@";',F+="<td style='"+pt+"' ",typeof j.style<"u"&&(F+=' style="',typeof j.style=="function"?F+=j.style(G,y,D,Y,B,_):F+=j.style,F+='" '),F+=">";var Ct=j.format;if(typeof G>"u")F+="";else if(typeof Ct<"u")if(typeof Ct=="function")F+=Ct(G);else if(typeof Ct=="string")F+=G;else throw new Error("Unknown format type. Should be function or string");else rt=="number"||rt=="date"?F+=G.toString():rt=="money"?F+=(+G).toFixed(2):F+=G;F+="</td>"}),F+="</tr>"}}),F+="</tbody>",F+="</table>",F+="</body>",F+="</html>",F}function I(F){var T=' style="';return F&&typeof F.style<"u"&&(T+=F.style+";"),T+='" ',T}},e.into.XLSXML=function(n,c,u,l,f){c=c||{},typeof n=="object"&&(c=n,n=void 0);var m={},y,E;c&&c.sheets?(m=c.sheets,y=u,E=l):(m.Sheet1=c,y=[u],E=[l]),n=e.utils.autoExtFilename(n,"xls",c);var w=e.utils.saveFile(n,R());return f&&(w=f(w)),w;function R(){var I='<?xml version="1.0"?> <Workbook xmlns="urn:
<Column
ss:Index="${Ft+1}"
ss:AutoFitWidth="0"
ss:Width=${JSON.stringify(""+xt.width)}
/>`}),G.headers&&(T+='<Row ss:AutoFitHeight="0">',Ct.forEach(function(xt,Ft){if(T+="<Cell ",typeof xt.style<"u"){var Tt={};typeof xt.style=="function"?lr(Tt,xt.style(G,xt,Ft)):lr(Tt,xt.style),T+="ss:StyleID="+JSON.stringify($(Tt))}T+='><Data ss:Type="String">',typeof xt.title<"u"&&(typeof xt.title=="function"?T+=xt.title(G,xt,Ft):T+=xt.title),T+="</Data></Cell>"}),T+="</Row>"),pt&&pt.length>0&&pt.forEach(function(xt,Ft){if(!(Ft>G.limit)){var Tt={};if(lr(Tt,G.row),G.rows&&G.rows[Ft]&&lr(Tt,G.rows[Ft]),T+="<Row ",typeof Tt<"u"){var Rt={};typeof Tt.style<"u"&&(typeof Tt.style=="function"?lr(Rt,Tt.style(G,xt,Ft)):lr(Rt,Tt.style),T+="ss:StyleID="+JSON.stringify($(Rt)))}T+=">",Ct.forEach(function(Q,Qt){var Gt={};lr(Gt,G.cell),lr(Gt,Tt.cell),typeof G.column<"u"&&lr(Gt,G.column.cell),lr(Gt,Q.cell),G.cells&&G.cells[Ft]&&G.cells[Ft][Qt]&&lr(Gt,G.cells[Ft][Qt]);var Ze=xt[Q.columnid];typeof Gt.value=="function"&&(Ze=Gt.value(Ze,G,xt,Q,Gt,Ft,Qt));var cr=Gt.typeid;typeof cr=="function"&&(cr=cr(Ze,G,xt,Q,Gt,Ft,Qt)),typeof cr>"u"&&(typeof Ze=="number"?cr="number":typeof Ze=="string"?cr="string":typeof Ze=="boolean"?cr="boolean":typeof Ze=="object"&&Ze instanceof Date&&(cr="date"));var Tr="String";cr=="number"?Tr="Number":cr=="date"&&(Tr="Date");var Sn="";cr=="money"?Sn='mso-number-format:"\\#\\,\\#\\#0\\\\ _\u0440_\\.";white-space:normal;':cr=="number"?Sn=" ":cr=="date"?Sn='mso-number-format:"Short Date";':c.types&&c.types[cr]&&c.types[cr].typestyle&&(Sn=c.types[cr].typestyle),Sn=Sn||'mso-number-format:"\\@";',T+="<Cell ";var Wr={};typeof Gt.style<"u"&&(typeof Gt.style=="function"?lr(Wr,Gt.style(Ze,G,xt,Q,Ft,Qt)):lr(Wr,Gt.style),T+="ss:StyleID="+JSON.stringify($(Wr))),T+=">",T+="<Data ss:Type="+JSON.stringify(Tr)+">";var wr=Gt.format;if(typeof Ze>"u")T+="";else if(typeof wr<"u")if(typeof wr=="function")T+=wr(Ze);else if(typeof wr=="string")T+=Ze;else throw new Error("Unknown format type. Should be function or string");else cr=="number"||cr=="date"?T+=Ze.toString():cr=="money"?T+=(+Ze).toFixed(2):T+=Ze;T+="</Data></Cell>"}),T+="</Row>"}}),T+="</Table></Worksheet>"}return T+="</Workbook>",I+F+T}},e.into.XLSX=function(n,c,u,l,f){var m=1;c=c||{},Mt(l,[{columnid:"_"}])&&(u=u.map(function(F){return F._}),l=void 0),n=e.utils.autoExtFilename(n,"xlsx",c);var y=mr();typeof n=="object"&&(c=n,n=void 0);var E={SheetNames:[],Sheets:{}};return c.sourcefilename?e.utils.loadBinaryFile(c.sourcefilename,!!f,function(F){E=y.read(F,{type:"binary",...e.options.excel,...c}),w()}):w(),f&&(m=f(m)),m;function w(){typeof c=="object"&&Array.isArray(c)?u&&u.length>0&&u.forEach(function(F,T){R(c[T],F,void 0,T+1)}):R(c,u,l,1),I(f)}function R(F,T,D,B){var $={sheetid:"Sheet "+B,headers:!0};e.utils.extend($,F);var Y=Object.keys(T).length;(!D||D.length==0)&&(Y>0?D=Object.keys(T[0]).map(function(Gt){return{columnid:Gt}}):D=[]);var _={};E.SheetNames.indexOf($.sheetid)>-1||(E.SheetNames.push($.sheetid),E.Sheets[$.sheetid]={}),_=E.Sheets[$.sheetid];var j="A1";$.range&&(j=$.range);var G=e.utils.xlscn(j.match(/[A-Z]+/)[0]),rt=+j.match(/[0-9]+/)[0]-1;if(E.Sheets[$.sheetid]["!ref"])var pt=E.Sheets[$.sheetid]["!ref"],Ct=e.utils.xlscn(pt.match(/[A-Z]+/)[0]),xt=+pt.match(/[0-9]+/)[0]-1;else var Ct=1,xt=1;var Ft=D.length?0:1,Tt=Math.max(G+D.length-1+Ft,Ct),Rt=Math.max(rt+Y+2,xt),Q=rt+1;E.Sheets[$.sheetid]["!ref"]="A1:"+e.utils.xlsnc(Tt)+Rt,$.headers&&(D.forEach(function(Gt,Ze){_[e.utils.xlsnc(G+Ze)+""+Q]={v:Gt.columnid.trim()}}),Q++);for(var Qt=0;Qt<Y;Qt++)D.forEach(function(Gt,Ze){var cr={v:T[Qt][Gt.columnid]};typeof T[Qt][Gt.columnid]=="number"?cr.t="n":typeof T[Qt][Gt.columnid]=="string"?cr.t="s":typeof T[Qt][Gt.columnid]=="boolean"?cr.t="b":typeof T[Qt][Gt.columnid]=="object"&&T[Qt][Gt.columnid]instanceof Date&&(cr.t="d"),_[e.utils.xlsnc(G+Ze)+""+Q]=cr}),Q++}function I(F){var T;if(typeof n>"u")m=E;else if(T=mr(),s.isNode||s.isMeteorServer)T.writeFile(E,n);else{var D={bookType:"xlsx",bookSST:!1,type:"binary"},B=T.write(E,D),$=function(Y){for(var _=new ArrayBuffer(Y.length),j=new Uint8Array(_),G=0;G!=Y.length;++G)j[G]=Y.charCodeAt(G)&255;return _};Ns(new Blob([$(B)],{type:"a
`).test(n)?w(n):(n=e.utils.autoExtFilename(n,"csv",c),e.utils.loadFile(n,!!u,w,f.cb)),y};function As(n,c,u,l,f,m){var y={};u=u||{},e.utils.extend(y,u),typeof y.headers>"u"&&(y.headers=!0);var E;function w(I){for(var F="",T=0,D=10240;T<I.byteLength/D;++T)F+=String.fromCharCode.apply(null,new Uint8Array(I.slice(T*D,T*D+D)));return F+=String.fromCharCode.apply(null,new Uint8Array(I.slice(T*D))),F}function R(I){return I&&e.options.casesensitive===!1?I.toLowerCase():I}return c=e.utils.autoExtFilename(c,"xls",u),e.utils.loadBinaryFile(c,!!l,function(I){if(I instanceof ArrayBuffer)var F=w(I),T=n.read(btoa(F),{type:"base64",...e.options.excel,...u});else var T=n.read(I,{type:"binary",...e.options.excel,...u});var D;typeof y.sheetid>"u"?D=T.SheetNames[0]:typeof y.sheetid=="number"?D=T.SheetNames[y.sheetid]:D=y.sheetid;var B,$=[];if(typeof y.range>"u"?B=T.Sheets[D]["!ref"]:(B=y.range,T.Sheets[D][B]&&(B=T.Sheets[D][B])),B){for(var Y=B.split(":"),_=Y[0].match(/[A-Z]+/)[0],j=+Y[0].match(/[0-9]+/)[0],G=Y[1].match(/[A-Z]+/)[0],rt=+Y[1].match(/[0-9]+/)[0],pt={},Ct=e.utils.xlscn(_),xt=e.utils.xlscn(G),Ft=Ct;Ft<=xt;Ft++){var Tt=e.utils.xlsnc(Ft);y.headers?T.Sheets[D][Tt+""+j]?pt[Tt]=R(T.Sheets[D][Tt+""+j].v):pt[Tt]=R(Tt):pt[Tt]=Tt}y.headers&&j++;for(var Rt=j;Rt<=rt;Rt++){for(var Q={},Ft=Ct;Ft<=xt;Ft++){var Tt=e.utils.xlsnc(Ft);T.Sheets[D][Tt+""+Rt]&&(Q[pt[Tt]]=T.Sheets[D][Tt+""+Rt].v)}$.push(Q)}}else $.push([]);$.length>0&&$[$.length-1]&&Object.keys($[$.length-1]).length==0&&$.pop(),l&&($=l($,f,m))},function(I){throw I}),E}e.from.XLS=function(n,c,u,l,f){return c=c||{},n=e.utils.autoExtFilename(n,"xls",c),c.autoExt=!1,As(mr(),n,c,u,l,f)},e.from.XLSX=function(n,c,u,l,f){return c=c||{},n=e.utils.autoExtFilename(n,"xlsx",c),c.autoExt=!1,As(mr(),n,c,u,l,f)},e.from.ODS=function(n,c,u,l,f){return c=c||{},n=e.utils.autoExtFilename(n,"ods",c),c.autoExt=!1,As(mr(),n,c,u,l,f)},e.from.XML=function(n,c,u,l,f){var m;return e.utils.loadFile(n,!!u,function(y){m=h1(y).root,u&&(m=u(m,l,f))}),m};function h1(n){return n=n.trim(),n=n.replace(/<!--[\s\S]*?-->/g,""),c();function c(){return{declaration:u(),root:l()}}function u(){var I=E(/^<\?xml\s*/);if(I){for(var F={attributes:{}};!(w()||R("?>"));){var T=m();if(!T)return F;F.attributes[T.name]=T.value}return E(/\?>\s*/),F}}function l(){var I=E(/^<([\w-:.]+)\s*/);if(I){for(var F={name:I[1],attributes:{},children:[]};!(w()||R(">")||R("?>")||R("/>"));){var T=m();if(!T)return F;F.attributes[T.name]=T.value}if(E(/^\s*\/>\s*/))return F;E(/\??>\s*/),F.content=f();for(var D;D=l();)F.children.push(D);return E(/^<\/[\w-:.]+>\s*/),F}}function f(){var I=E(/^([^<]*)/);return I?I[1]:""}function m(){var I=E(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(I)return{name:I[1],value:y(I[2])}}function y(I){return I.replace(/^['"]|['"]$/g,"")}function E(I){var F=n.match(I);if(F)return n=n.slice(F[0].length),F}function w(){return n.length==0}function R(I){return n.indexOf(I)==0}}e.from.GEXF=function(n,c,u,l,f){var m;return e("SEARCH FROM XML("+n+")",[],function(y){m=y,u&&(m=u(m))}),m},L.Print=function(n){return Object.assign(this,n)},L.Print.prototype.toString=function(){var n="PRINT";return this.statement&&(n+=" "+this.statement.toString()),n},L.Print.prototype.execute=function(n,c,u){var l=this,f=1;if(e.precompile(this,n,c),this.exprs&&this.exprs.length>0){var m=this.exprs.map(function(E){var w=new Function("params,alasql,p","var y;return "+E.toJS("({})","",null)).bind(l),R=w(c,e);return lt(R)});console.log.apply(console,m)}else if(this.select){var y=this.select.execute(n,c);console.log(lt(y))}else console.log();return u&&(f=u(f)),f},L.Source=function(n){return Object.assign(this,n)},L.Source.prototype.toString=function(){var n="SOURCE";return this.url&&(n+=" '"+this.url+" '"),n},L.Source.prototype.execute=function(n,c,u){var l;return Ne(this.url,!!u,function(f){return l=e(f),u&&(l=u(l)),l},function(f){throw f}),l},L.Require=function(n){return Object.assign(this,n)},L.Require.prototype.toString=function(){var n="REQUIRE";return this.paths&&this.paths.length>0&&(n+=this.paths.map(function(c){return c.toString()}).join(",")),this.pl
`,bt='"',wt=bt+bt,_t=!1,nt=null,Yt=!1;(function(){if(typeof M=="object"){if(typeof M.delimiter!="string"||o.BAD_DELIMITERS.filter(function(P){return M.delimiter.indexOf(P)!==-1}).length||(H=M.delimiter),(typeof M.quotes=="boolean"||typeof M.quotes=="function"||Array.isArray(M.quotes))&&(ge=M.quotes),typeof M.skipEmptyLines!="boolean"&&typeof M.skipEmptyLines!="string"||(_t=M.skipEmptyLines),typeof M.newline=="string"&&(kt=M.newline),typeof M.quoteChar=="string"&&(bt=M.quoteChar),typeof M.header=="boolean"&&(Oe=M.header),Array.isArray(M.columns)){if(M.columns.length===0)throw new Error("Option columns is empty");nt=M.columns}M.escapeChar!==void 0&&(wt=M.escapeChar+bt),(typeof M.escapeFormulae=="boolean"||M.escapeFormulae instanceof RegExp)&&(Yt=M.escapeFormulae instanceof RegExp?M.escapeFormulae:/^[=+\-@\t\r].*$/)}})();var Mt=new RegExp(N(bt),"g");if(typeof O=="string"&&(O=JSON.parse(O)),Array.isArray(O)){if(!O.length||Array.isArray(O[0]))return jr(null,O,_t);if(typeof O[0]=="object")return jr(nt||Object.keys(O[0]),O,_t)}else if(typeof O=="object")return typeof O.data=="string"&&(O.data=JSON.parse(O.data)),Array.isArray(O.data)&&(O.fields||(O.fields=O.meta&&O.meta.fields||nt),O.fields||(O.fields=Array.isArray(O.data[0])?O.fields:typeof O.data[0]=="object"?Object.keys(O.data[0]):[]),Array.isArray(O.data[0])||typeof O.data[0]=="object"||(O.data=[O.data])),jr(O.fields||[],O.data||[],_t);throw new Error("Unable to serialize unrecognized input");function jr(P,kr,qr){var U="";typeof P=="string"&&(P=JSON.parse(P)),typeof kr=="string"&&(kr=JSON.parse(kr));var Cr=Array.isArray(P)&&0<P.length,rn=!Array.isArray(kr[0]);if(Cr&&Oe){for(var on=0;on<P.length;on++)0<on&&(U+=H),U+=lr(P[on],on);0<kr.length&&(U+=kt)}for(var dr=0;dr<kr.length;dr++){var mr=Cr?P.length:kr[dr].length,Mr=!1,Lr=Cr?Object.keys(kr[dr]).length===0:kr[dr].length===0;if(qr&&!Cr&&(Mr=qr==="greedy"?kr[dr].join("").trim()==="":kr[dr].length===1&&kr[dr][0].length===0),qr==="greedy"&&Cr){for(var Or=[],Vr=0;Vr<mr;Vr++){var Hr=rn?P[Vr]:Vr;Or.push(kr[dr][Hr])}Mr=Or.join("").trim()===""}if(!Mr){for(var Pr=0;Pr<mr;Pr++){0<Pr&&!Lr&&(U+=H);var bn=Cr&&rn?P[Pr]:Pr;U+=lr(kr[dr][bn],Pr)}dr<kr.length-1&&(!qr||0<mr&&!Lr)&&(U+=kt)}}return U}function lr(P,kr){if(P==null)return"";if(P.constructor===Date)return JSON.stringify(P).slice(1,25);var qr=!1;Yt&&typeof P=="string"&&Yt.test(P)&&(P="'"+P,qr=!0);var U=P.toString().replace(Mt,wt);return(qr=qr||ge===!0||typeof ge=="function"&&ge(P,kr)||Array.isArray(ge)&&ge[kr]||function(Cr,rn){for(var on=0;on<rn.length;on++)if(-1<Cr.indexOf(rn[on]))return!0;return!1}(U,o.BAD_DELIMITERS)||-1<U.indexOf(H)||U.charAt(0)===" "||U.charAt(U.length-1)===" ")?bt+U+bt:U}}};if(o.RECORD_SEP=String.fromCharCode(30),o.UNIT_SEP=String.fromCharCode(31),o.BYTE_ORDER_MARK="\uFEFF",o.BAD_DELIMITERS=["\r",`
`,'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!r&&!!t.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=pe,o.ParserHandle=k,o.NetworkStreamer=p,o.FileStreamer=v,o.StringStreamer=S,o.ReadableStreamStreamer=C,t.jQuery){var h=t.jQuery;h.fn.parse=function(O){var M=O.config||{},ge=[];return this.each(function(kt){if(!(h(this).prop("tagName").toUpperCase()==="INPUT"&&h(this).attr("type").toLowerCase()==="file"&&t.FileReader)||!this.files||this.files.length===0)return!0;for(var bt=0;bt<this.files.length;bt++)ge.push({file:this.files[bt],inputElem:this,instanceConfig:h.extend({},M)})}),Oe(),this;function Oe(){if(ge.length!==0){var kt,bt,wt,_t,nt=ge[0];if(Ye(O.before)){var Yt=O.before(nt.file,nt.inputElem);if(typeof Yt=="object"){if(Yt.action==="abort")return kt="AbortError",bt=nt.file,wt=nt.inputElem,_t=Yt.reason,void(Ye(O.error)&&O.error({name:kt},bt,wt,_t));if(Yt.action==="skip")return void H();typeof Yt.config=="object"&&(nt.instanceConfig=h.extend(nt.instanceConfig,Yt.config))}else if(Yt==="skip")return void H()}var Mt=nt.instanceConfig.complete;nt.instanceConfig.complete=function(jr){Ye(Mt)&&Mt(jr,nt.file,nt.inputElem),H()},o.parse(nt.file,nt.instanceConfig)}else Ye(O.complete)&&O.complete()}function H(){ge.splice(0,1),Oe()}}}function d(O){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(M){var ge=et(M);ge.chunkSize=parseInt(ge.chunkSize),M.step||M.chunk||(ge.chunkSize=null),this._handle=new k(ge),(this._handle.streamer=this)._config=ge}.call(this,O),this.parseChunk=function(M,ge){if(this.isFirstChunk&&Ye(this._config.beforeFirstChunk)){var Oe=this._config.beforeFirstChunk(M);Oe!==void 0&&(M=Oe)}this.isFirstChunk=!1,this._halted=!1;var H=this._partialLine+M;this._partialLine="";var kt=this._handle.parse(H,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var bt=kt.meta.cursor;this._finished||(this._partialLine=H.substring(bt-this._baseIndex),this._baseIndex=bt),kt&&kt.data&&(this._rowCount+=kt.data.length);var wt=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(i)t.postMessage({results:kt,workerId:o.WORKER_ID,finished:wt});else if(Ye(this._config.chunk)&&!ge){if(this._config.chunk(kt,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);kt=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(kt.data),this._completeResults.errors=this._completeResults.errors.concat(kt.errors),this._completeResults.meta=kt.meta),this._completed||!wt||!Ye(this._config.complete)||kt&&kt.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),wt||kt&&kt.meta.paused||this._nextChunk(),kt}this._halted=!0},this._sendError=function(M){Ye(this._config.error)?this._config.error(M):i&&this._config.error&&t.postMessage({workerId:o.WORKER_ID,error:M,finished:!1})}}function p(O){var M;(O=O||{}).chunkSize||(O.chunkSize=o.RemoteChunkSize),d.call(this,O),this._nextChunk=r?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(ge){this._input=ge,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(M=new XMLHttpRequest,this._config.withCredentials&&(M.withCredentials=this._config.withCredentials),r||(M.onload=te(this._chunkLoaded,this),M.onerror=te(this._chunkError,this)),M.open(this._config.downloadRequestBody?"POST":"GET",this._input,!r),this._config.downloadRequestHeaders){var ge=this._config.downloadRequestHeaders;for(var Oe in ge)M.setRequestHeader(Oe,ge[Oe])}if(this._config.chunkSize){var H=this._start+this._config.chunkSize-1;M.setRequestHeader("Range","bytes="+this._start+"-"+H)}try{M.send(this._config.downloadRequestBody)}catch(kt){this._chunkError(kt.message)}r&&M.status===0&&t
`),Qn=1<Vn.length&&Vn[0].length<yn[0].length;if(yn.length===1||Qn)return`
`;for(var L=0,Gr=0;Gr<yn.length;Gr++)yn[Gr][0]===`
`&&L++;return L>=yn.length/2?`\r
`:"\r"}(dr,Lr)),Oe=!1,O.delimiter)Ye(O.delimiter)&&(O.delimiter=O.delimiter(dr),P.meta.delimiter=O.delimiter);else{var Or=function(Hr,Pr,bn,yn,Vn){var Qn,L,Gr,ln;Vn=Vn||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var ci=0;ci<Vn.length;ci++){var Rr=Vn[ci],Vs=0,gi=0,Hn=0;Gr=void 0;for(var Wn=new pe({comments:yn,delimiter:Rr,newline:Pr,preview:10}).parse(Hr),Os=0;Os<Wn.data.length;Os++)if(bn&&qr(Wn.data[Os]))Hn++;else{var hi=Wn.data[Os].length;gi+=hi,Gr!==void 0?0<hi&&(Vs+=Math.abs(hi-Gr),Gr=hi):Gr=hi}0<Wn.data.length&&(gi/=Wn.data.length-Hn),(L===void 0||Vs<=L)&&(ln===void 0||ln<gi)&&1.99<gi&&(L=Vs,Qn=Rr,ln=gi)}return{successful:!!(O.delimiter=Qn),bestDelimiter:Qn}}(dr,O.newline,O.skipEmptyLines,O.comments,O.delimitersToGuess);Or.successful?O.delimiter=Or.bestDelimiter:(Oe=!0,O.delimiter=o.DefaultDelimiter),P.meta.delimiter=O.delimiter}var Vr=et(O);return O.preview&&O.header&&Vr.preview++,M=dr,ge=new pe(Vr),P=ge.parse(M,mr,Mr),U(),Mt?{meta:{paused:!0}}:P||{meta:{paused:!1}}},this.paused=function(){return Mt},this.pause=function(){Mt=!0,ge.abort(),M=Ye(O.chunk)?"":M.substring(ge.getCharIndex())},this.resume=function(){_t.streamer._halted?(Mt=!1,_t.streamer.parseChunk(M,!0)):setTimeout(_t.resume,3)},this.aborted=function(){return jr},this.abort=function(){jr=!0,ge.abort(),P.meta.aborted=!0,Ye(O.complete)&&O.complete(P),M=""}}function N(O){return O.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pe(O){var M,ge=(O=O||{}).delimiter,Oe=O.newline,H=O.comments,kt=O.step,bt=O.preview,wt=O.fastMode,_t=M=O.quoteChar===void 0||O.quoteChar===null?'"':O.quoteChar;if(O.escapeChar!==void 0&&(_t=O.escapeChar),(typeof ge!="string"||-1<o.BAD_DELIMITERS.indexOf(ge))&&(ge=","),H===ge)throw new Error("Comment character same as delimiter");H===!0?H="#":(typeof H!="string"||-1<o.BAD_DELIMITERS.indexOf(H))&&(H=!1),Oe!==`
`&&Oe!=="\r"&&Oe!==`\r
`&&(Oe=`
`);var nt=0,Yt=!1;this.parse=function(Mt,jr,lr){if(typeof Mt!="string")throw new Error("Input must be a string");var P=Mt.length,kr=ge.length,qr=Oe.length,U=H.length,Cr=Ye(kt),rn=[],on=[],dr=[],mr=nt=0;if(!Mt)return jn();if(O.header&&!jr){var Mr=Mt.split(Oe)[0].split(ge),Lr=[],Or={},Vr=!1;for(var Hr in Mr){var Pr=Mr[Hr];Ye(O.transformHeader)&&(Pr=O.transformHeader(Pr,Hr));var bn=Pr,yn=Or[Pr]||0;for(0<yn&&(Vr=!0,bn=Pr+"_"+yn),Or[Pr]=yn+1;Lr.includes(bn);)bn=bn+"_"+yn;Lr.push(bn)}if(Vr){var Vn=Mt.split(Oe);Vn[0]=Lr.join(ge),Mt=Vn.join(Oe)}}if(wt||wt!==!1&&Mt.indexOf(M)===-1){for(var Qn=Mt.split(Oe),L=0;L<Qn.length;L++){if(dr=Qn[L],nt+=dr.length,L!==Qn.length-1)nt+=Oe.length;else if(lr)return jn();if(!H||dr.substring(0,U)!==H){if(Cr){if(rn=[],Hn(dr.split(ge)),Hs(),Yt)return jn()}else Hn(dr.split(ge));if(bt&&bt<=L)return rn=rn.slice(0,bt),jn(!0)}}return jn()}for(var Gr=Mt.indexOf(ge,nt),ln=Mt.indexOf(Oe,nt),ci=new RegExp(N(_t)+N(M),"g"),Rr=Mt.indexOf(M,nt);;)if(Mt[nt]!==M)if(H&&dr.length===0&&Mt.substring(nt,nt+U)===H){if(ln===-1)return jn();nt=ln+qr,ln=Mt.indexOf(Oe,nt),Gr=Mt.indexOf(ge,nt)}else if(Gr!==-1&&(Gr<ln||ln===-1))dr.push(Mt.substring(nt,Gr)),nt=Gr+kr,Gr=Mt.indexOf(ge,nt);else{if(ln===-1)break;if(dr.push(Mt.substring(nt,ln)),hi(ln+qr),Cr&&(Hs(),Yt))return jn();if(bt&&rn.length>=bt)return jn(!0)}else for(Rr=nt,nt++;;){if((Rr=Mt.indexOf(M,Rr+1))===-1)return lr||on.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:rn.length,index:nt}),Os();if(Rr===P-1)return Os(Mt.substring(nt,Rr).replace(ci,M));if(M!==_t||Mt[Rr+1]!==_t){if(M===_t||Rr===0||Mt[Rr-1]!==_t){Gr!==-1&&Gr<Rr+1&&(Gr=Mt.indexOf(ge,Rr+1)),ln!==-1&&ln<Rr+1&&(ln=Mt.indexOf(Oe,Rr+1));var Vs=Wn(ln===-1?Gr:Math.min(Gr,ln));if(Mt.substr(Rr+1+Vs,kr)===ge){dr.push(Mt.substring(nt,Rr).replace(ci,M)),Mt[nt=Rr+1+Vs+kr]!==M&&(Rr=Mt.indexOf(M,nt)),Gr=Mt.indexOf(ge,nt),ln=Mt.indexOf(Oe,nt);break}var gi=Wn(ln);if(Mt.substring(Rr+1+gi,Rr+1+gi+qr)===Oe){if(dr.push(Mt.substring(nt,Rr).replace(ci,M)),hi(Rr+1+gi+qr),Gr=Mt.indexOf(ge,nt),Rr=Mt.indexOf(M,nt),Cr&&(Hs(),Yt))return jn();if(bt&&rn.length>=bt)return jn(!0);break}on.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:rn.length,index:nt}),Rr++}}else Rr++}return Os();function Hn(Gn){rn.push(Gn),mr=nt}function Wn(Gn){var Ma=0;if(Gn!==-1){var ba=Mt.substring(Rr+1,Gn);ba&&ba.trim()===""&&(Ma=ba.length)}return Ma}function Os(Gn){return lr||(Gn===void 0&&(Gn=Mt.substring(nt)),dr.push(Gn),nt=P,Hn(dr),Cr&&Hs()),jn()}function hi(Gn){nt=Gn,Hn(dr),dr=[],ln=Mt.indexOf(Oe,nt)}function jn(Gn){return{data:rn,errors:on,meta:{delimiter:ge,linebreak:Oe,aborted:Yt,truncated:!!Gn,cursor:mr+(jr||0)}}}function Hs(){kt(jn()),rn=[],on=[]}},this.abort=function(){Yt=!0},this.getCharIndex=function(){return nt}}function Ne(O){var M=O.data,ge=s[M.workerId],Oe=!1;if(M.error)ge.userError(M.error,M.file);else if(M.results&&M.results.data){var H={abort:function(){Oe=!0,me(M.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:tt,resume:tt};if(Ye(ge.userStep)){for(var kt=0;kt<M.results.data.length&&(ge.userStep({data:M.results.data[kt],errors:M.results.errors,meta:M.results.meta},H),!Oe);kt++);delete M.results}else Ye(ge.userChunk)&&(ge.userChunk(M.results,H,M.file),delete M.results)}M.finished&&!Oe&&me(M.workerId,M.results)}function me(O,M){var ge=s[O];Ye(ge.userComplete)&&ge.userComplete(M),ge.terminate(),delete s[O]}function tt(){throw new Error("Not implemented.")}function et(O){if(typeof O!="object"||O===null)return O;var M=Array.isArray(O)?[]:{};for(var ge in O)M[ge]=et(O[ge]);return M}function te(O,M){return function(){O.apply(M,arguments)}}function Ye(O){return typeof O=="function"}return i&&(t.onmessage=function(O){var M=O.data;if(o.WORKER_ID===void 0&&M&&(o.WORKER_ID=M.workerId),typeof M.input=="string")t.postMessage({workerId:o.WORKER_ID,results:o.parse(M.input,M.config),finished:!0});else if(t.File&&M.input instanceof File||M.input instanceof Object){var ge=o.parse(M.input,M.config);ge&&t.postMessage({workerId:o.WORKER_ID,results:ge,finished:!0})}}),(p.prototype=
`||A.charAt(ie)==="\r"&&A.charAt(ie+1)!==`
`)&&(lt++,yt===0&&(yt=ie+1)),ie--}var st=Qe+lt,xr=V-yt;return ne[V]={line:st,lineStart:yt},{offset:V,line:st+1,column:xr+1}}function bt(A){if(!te(A))throw new Error("not a parser: "+A)}function wt(A,V){return typeof A=="string"?A.charAt(V):A[V]}function _t(A){if(typeof A!="number")throw new Error("not a number: "+A)}function nt(A){if(typeof A!="function")throw new Error("not a function: "+A)}function Yt(A){if(typeof A!="string")throw new Error("not a string: "+A)}var Mt=2,jr=3,lr=8,P=5*lr,kr=4*lr,qr=" ";function U(A,V){return new Array(V+1).join(A)}function Cr(A,V,ne){var Qe=V-A.length;return Qe<=0?A:U(ne,Qe)+A}function rn(A,V,ne,Qe){return{from:A-V>0?A-V:0,to:A+ne>Qe?Qe:A+ne}}function on(A,V){var ne,Qe,lt,yt,ie,st=V.index,xr=st.offset,Fr=1;if(xr===A.length)return"Got the end of the input";if(O(A)){var Yr=xr-xr%lr,Dn=xr-Yr,un=rn(Yr,P,kr+lr,A.length),bi=p(function(Kr){return p(function(Ws){return Cr(Ws.toString(16),2,"0")},Kr)},function(Kr,Ws){var gr=Kr.length,Is=[],cn=0;if(gr<=Ws)return[Kr.slice()];for(var Ns=0;Ns<gr;Ns++)Is[cn]||Is.push([]),Is[cn].push(Kr[Ns]),(Ns+1)%Ws==0&&cn++;return Is}(A.slice(un.from,un.to).toJSON().data,lr));yt=function(Kr){return Kr.from===0&&Kr.to===1?{from:Kr.from,to:Kr.to}:{from:Kr.from/lr,to:Math.floor(Kr.to/lr)}}(un),Qe=Yr/lr,ne=3*Dn,Dn>=4&&(ne+=1),Fr=2,lt=p(function(Kr){return Kr.length<=4?Kr.join(" "):Kr.slice(0,4).join(" ")+" "+Kr.slice(4).join(" ")},bi),(ie=(8*(yt.to>0?yt.to-1:yt.to)).toString(16).length)<2&&(ie=2)}else{var As=A.split(/\r\n|[\n\r\u2028\u2029]/);ne=st.column-1,Qe=st.line-1,yt=rn(Qe,Mt,jr,As.length),lt=As.slice(yt.from,yt.to),ie=yt.to.toString().length}var h1=Qe-yt.from;return O(A)&&(ie=(8*(yt.to>0?yt.to-1:yt.to)).toString(16).length)<2&&(ie=2),d(function(Kr,Ws,gr){var Is,cn=gr===h1,Ns=cn?"> ":qr;return Is=O(A)?Cr((8*(yt.from+gr)).toString(16),ie,"0"):Cr((yt.from+gr+1).toString(),ie," "),[].concat(Kr,[Ns+Is+" | "+Ws],cn?[qr+U(" ",ie)+" | "+Cr("",ne," ")+U("^",Fr)]:[])},[],lt).join(`
`)}function dr(A,V){return[`
`,"-- PARSING FAILED "+U("-",50),`
`,on(A,V),`
`,(ne=V.expected,ne.length===1?`Expected:
`+ne[0]:`Expected one of the following:
`+ne.join(", ")),`
`].join("");var ne}function mr(A){return A.flags!==void 0?A.flags:[A.global?"g":"",A.ignoreCase?"i":"",A.multiline?"m":"",A.unicode?"u":"",A.sticky?"y":""].join("")}function Mr(){for(var A=[].slice.call(arguments),V=A.length,ne=0;ne<V;ne+=1)bt(A[ne]);return a(function(Qe,lt){for(var yt,ie=new Array(V),st=0;st<V;st+=1){if(!(yt=Oe(A[st]._(Qe,lt),yt)).status)return yt;ie[st]=yt.value,lt=yt.index}return Oe(M(lt,ie),yt)})}function Lr(){var A=[].slice.call(arguments);if(A.length===0)throw new Error("seqMap needs at least one argument");var V=A.pop();return nt(V),Mr.apply(null,A).map(function(ne){return V.apply(null,ne)})}function Or(){var A=[].slice.call(arguments),V=A.length;if(V===0)return Vn("zero alternates");for(var ne=0;ne<V;ne+=1)bt(A[ne]);return a(function(Qe,lt){for(var yt,ie=0;ie<A.length;ie+=1)if((yt=Oe(A[ie]._(Qe,lt),yt)).status)return yt;return yt})}function Vr(A,V){return Hr(A,V).or(yn([]))}function Hr(A,V){return bt(A),bt(V),Lr(A,V.then(A).many(),function(ne,Qe){return[ne].concat(Qe)})}function Pr(A){Yt(A);var V="'"+A+"'";return a(function(ne,Qe){var lt=Qe+A.length,yt=ne.slice(Qe,lt);return yt===A?M(lt,yt):ge(Qe,V)})}function bn(A,V){(function(lt){if(!(lt instanceof RegExp))throw new Error("not a regexp: "+lt);for(var yt=mr(lt),ie=0;ie<yt.length;ie++){var st=yt.charAt(ie);if(st!=="i"&&st!=="m"&&st!=="u"&&st!=="s")throw new Error('unsupported regexp flag "'+st+'": '+lt)}})(A),arguments.length>=2?_t(V):V=0;var ne=function(lt){return RegExp("^(?:"+lt.source+")",mr(lt))}(A),Qe=""+A;return a(function(lt,yt){var ie=ne.exec(lt.slice(yt));if(ie){if(0<=V&&V<=ie.length){var st=ie[0],xr=ie[V];return M(yt+st.length,xr)}return ge(yt,"valid match group (0 to "+ie.length+") in "+Qe)}return ge(yt,Qe)})}function yn(A){return a(function(V,ne){return M(ne,A)})}function Vn(A){return a(function(V,ne){return ge(ne,A)})}function Qn(A){if(te(A))return a(function(V,ne){var Qe=A._(V,ne);return Qe.index=ne,Qe.value="",Qe});if(typeof A=="string")return Qn(Pr(A));if(A instanceof RegExp)return Qn(bn(A));throw new Error("not a string, regexp, or parser: "+A)}function L(A){return bt(A),a(function(V,ne){var Qe=A._(V,ne),lt=V.slice(ne,Qe.index);return Qe.status?ge(ne,'not "'+lt+'"'):M(ne,null)})}function Gr(A){return nt(A),a(function(V,ne){var Qe=wt(V,ne);return ne<V.length&&A(Qe)?M(ne+1,Qe):ge(ne,"a character/byte matching "+A)})}function ln(A,V){arguments.length<2&&(V=A,A=void 0);var ne=a(function(Qe,lt){return ne._=V()._,ne._(Qe,lt)});return A?ne.desc(A):ne}function ci(){return Vn("fantasy-land/empty")}o.parse=function(A){if(typeof A!="string"&&!O(A))throw new Error(".parse must be called with a string or Buffer as its argument");var V,ne=this.skip(Hn)._(A,0);return V=ne.status?{status:!0,value:ne.value}:{status:!1,index:kt(A,ne.furthest),expected:ne.expected},delete H[A],V},o.tryParse=function(A){var V=this.parse(A);if(V.status)return V.value;var ne=dr(A,V),Qe=new Error(ne);throw Qe.type="ParsimmonError",Qe.result=V,Qe},o.assert=function(A,V){return this.chain(function(ne){return A(ne)?yn(ne):Vn(V)})},o.or=function(A){return Or(this,A)},o.trim=function(A){return this.wrap(A,A)},o.wrap=function(A,V){return Lr(A,this,V,function(ne,Qe){return Qe})},o.thru=function(A){return A(this)},o.then=function(A){return bt(A),Mr(this,A).map(function(V){return V[1]})},o.many=function(){var A=this;return a(function(V,ne){for(var Qe=[],lt=void 0;;){if(!(lt=Oe(A._(V,ne),lt)).status)return Oe(M(ne,Qe),lt);if(ne===lt.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");ne=lt.index,Qe.push(lt.value)}})},o.tieWith=function(A){return Yt(A),this.map(function(V){if(function(lt){if(!Ye(lt))throw new Error("not an array: "+lt)}(V),V.length){Yt(V[0]);for(var ne=V[0],Qe=1;Qe<V.length;Qe++)Yt(V[Qe]),ne+=A+V[Qe];return ne}return""})},o.tie=function(){return this.tieWith("")},o.times=function(A,V){var ne=this;return arguments.length<2&&(V=A),_t(A),_t(V),a(function(Qe,lt){for(var yt=[],ie=void 0,st=void 0,xr=0;xr<A;xr+=1){if(st=Oe(ie=ne._(Qe,lt),st),!ie.status)return st;lt=ie.
`),oo=Pr(`\r
`),uo=Or(oo,ba,Ma).desc("newline"),c1=Or(uo,Hn);a.all=gi,a.alt=Or,a.any=Vs,a.cr=Ma,a.createLanguage=function(A){var V={};for(var ne in A)({}).hasOwnProperty.call(A,ne)&&function(Qe){V[Qe]=ln(function(){return A[Qe](V)})}(ne);return V},a.crlf=oo,a.custom=function(A){return a(A(M,ge))},a.digit=Wn,a.digits=Os,a.empty=ci,a.end=c1,a.eof=Hn,a.fail=Vn,a.formatError=dr,a.index=Rr,a.isParser=te,a.lazy=ln,a.letter=hi,a.letters=jn,a.lf=ba,a.lookahead=Qn,a.makeFailure=ge,a.makeSuccess=M,a.newline=uo,a.noneOf=function(A){return Gr(function(V){return A.indexOf(V)<0}).desc("none of '"+A+"'")},a.notFollowedBy=L,a.of=yn,a.oneOf=function(A){for(var V=A.split(""),ne=0;ne<V.length;ne++)V[ne]="'"+V[ne]+"'";return Gr(function(Qe){return A.indexOf(Qe)>=0}).desc(V)},a.optWhitespace=Hs,a.Parser=a,a.range=function(A,V){return Gr(function(ne){return A<=ne&&ne<=V}).desc(A+"-"+V)},a.regex=bn,a.regexp=bn,a.sepBy=Vr,a.sepBy1=Hr,a.seq=Mr,a.seqMap=Lr,a.seqObj=function(){for(var A,V={},ne=0,Qe=(A=arguments,Array.prototype.slice.call(A)),lt=Qe.length,yt=0;yt<lt;yt+=1){var ie=Qe[yt];if(!te(ie)){if(Ye(ie)&&ie.length===2&&typeof ie[0]=="string"&&te(ie[1])){var st=ie[0];if(Object.prototype.hasOwnProperty.call(V,st))throw new Error("seqObj: duplicate key "+st);V[st]=!0,ne++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(ne===0)throw new Error("seqObj expects at least one named parser, found zero");return a(function(xr,Fr){for(var Yr,Dn={},un=0;un<lt;un+=1){var bi,As;if(Ye(Qe[un])?(bi=Qe[un][0],As=Qe[un][1]):(bi=null,As=Qe[un]),!(Yr=Oe(As._(xr,Fr),Yr)).status)return Yr;bi&&(Dn[bi]=Yr.value),Fr=Yr.index}return Oe(M(Fr,Dn),Yr)})},a.string=Pr,a.succeed=yn,a.takeWhile=function(A){return nt(A),a(function(V,ne){for(var Qe=ne;Qe<V.length&&A(wt(V,Qe));)Qe++;return M(Qe,V.slice(ne,Qe))})},a.test=Gr,a.whitespace=Gn,a["fantasy-land/empty"]=ci,a["fantasy-land/of"]=yn,a.Binary={bitSeq:k,bitSeqObj:function(A){C();var V={},ne=0,Qe=p(function(yt){if(Ye(yt)){var ie=yt;if(ie.length!==2)throw new Error("["+ie.join(", ")+"] should be length 2, got length "+ie.length);if(Yt(ie[0]),_t(ie[1]),Object.prototype.hasOwnProperty.call(V,ie[0]))throw new Error("duplicate key in bitSeqObj: "+ie[0]);return V[ie[0]]=!0,ne++,ie}return _t(yt),[null,yt]},A);if(ne<1)throw new Error("bitSeqObj expects at least one named pair, got ["+A.join(", ")+"]");var lt=p(function(yt){return yt[0]},Qe);return k(p(function(yt){return yt[1]},Qe)).map(function(yt){return d(function(ie,st){return st[0]!==null&&(ie[st[0]]=st[1]),ie},{},p(function(ie,st){return[ie,yt[st]]},lt))})},byte:function(A){if(C(),_t(A),A>255)throw new Error("Value specified to byte constructor ("+A+"=0x"+A.toString(16)+") is larger in value than a single byte.");var V=(A>15?"0x":"0x0")+A.toString(16);return a(function(ne,Qe){var lt=wt(ne,Qe);return lt===A?M(Qe+1,lt):ge(Qe,V)})},buffer:function(A){return N("buffer",A).map(function(V){return Buffer.from(V)})},encodedString:function(A,V){return N("string",V).map(function(ne){return ne.toString(A)})},uintBE:Ne,uint8BE:Ne(1),uint16BE:Ne(2),uint32BE:Ne(4),uintLE:me,uint8LE:me(1),uint16LE:me(2),uint32LE:me(4),intBE:tt,int8BE:tt(1),int16BE:tt(2),int32BE:tt(4),intLE:et,int8LE:et(1),int16LE:et(2),int32LE:et(4),floatBE:N("floatBE",4).map(function(A){return A.readFloatBE(0)}),floatLE:N("floatLE",4).map(function(A){return A.readFloatLE(0)}),doubleBE:N("doubleBE",8).map(function(A){return A.readDoubleBE(0)}),doubleLE:N("doubleLE",8).map(function(A){return A.readDoubleLE(0)})},r.exports=a}])})})(W);var g4=()=>/(?:[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u271
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`))}function kv(){Object.keys(s3).forEach(function(e){delete s3[e]})}});var o3=Dr(Ia=>{"use strict";Ia.__esModule=!0;Ia.HandlebarsEnvironment=N4;function q7(e){return e&&e.__esModule?e:{default:e}}var Ko=gs(),Cv=Xs(),A4=q7(Cv),xv=k4(),Fv=R7(),Ov=x4(),a3=q7(Ov),Av=O4(),Iv="4.7.8";Ia.VERSION=Iv;var Nv=8;Ia.COMPILER_REVISION=Nv;var Lv=7;Ia.LAST_COMPATIBLE_COMPILER_REVISION=Lv;var Rv={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};Ia.REVISION_CHANGES=Rv;var I4="[object Object]";function N4(e,t,r){this.helpers=e||{},this.partials=t||{},this.decorators=r||{},xv.registerDefaultHelpers(this),Fv.registerDefaultDecorators(this)}N4.prototype={constructor:N4,logger:a3.default,log:a3.default.log,registerHelper:function(t,r){if(Ko.toString.call(t)===I4){if(r)throw new A4.default("Arg not supported with multiple helpers");Ko.extend(this.helpers,t)}else this.helpers[t]=r},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,r){if(Ko.toString.call(t)===I4)Ko.extend(this.partials,t);else{if(typeof r=="undefined")throw new A4.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=r}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,r){if(Ko.toString.call(t)===I4){if(r)throw new A4.default("Arg not supported with multiple decorators");Ko.extend(this.decorators,t)}else this.decorators[t]=r},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){Av.resetLoggedProperties()}};var _v=a3.default.log;Ia.log=_v;Ia.createFrame=Ko.createFrame;Ia.logger=a3.default});var U7=Dr((u3,B7)=>{"use strict";u3.__esModule=!0;function L4(e){this.string=e}L4.prototype.toString=L4.prototype.toHTML=function(){return""+this.string};u3.default=L4;B7.exports=u3.default});var V7=Dr(R4=>{"use strict";R4.__esModule=!0;R4.wrapHelper=Mv;function Mv(e,t){if(typeof e!="function")return e;var r=function(){var s=arguments[arguments.length-1];return arguments[arguments.length-1]=t(s),e.apply(this,arguments)};return r}});var z7=Dr(vo=>{"use strict";vo.__esModule=!0;vo.checkRevision=Vv;vo.template=Hv;vo.wrapProgram=l3;vo.resolvePartial=Wv;vo.invokePartial=jv;vo.noop=j7;function $v(e){return e&&e.__esModule?e:{default:e}}function Pv(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}var qv=gs(),ro=Pv(qv),Bv=Xs(),no=$v(Bv),io=o3(),H7=k4(),Uv=V7(),W7=O4();function Vv(e){var t=e&&e[0]||1,r=io.COMPILER_REVISION;if(!(t>=io.LAST_COMPATIBLE_COMPILER_REVISION&&t<=io.COMPILER_REVISION))if(t<io.LAST_COMPATIBLE_COMPILER_REVISION){var i=io.REVISION_CHANGES[r],s=io.REVISION_CHANGES[t];throw new no.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+i+") or downgrade your runtime to an older version ("+s+").")}else throw new no.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}function Hv(e,t){if(!t)throw new no.default("No environment passed to template");if(!e||!e.main)throw new no.default("Unknown template object: "+typeof e);e.main.decorator=e.main_d,t.VM.checkRevision(e.compiler);var r=e.compiler&&e.compiler[0]===7;function i(o,h,d){d.hash&&(h=ro.extend({},h,d.hash),d.ids&&(d.ids[0]=!0)),o=t.VM.resolvePartial.call(this,o,h,d);var p=ro.extend({},d,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),v=t.VM.invokePartial.call(this,o,h,p);if(v==null&&t.compile&&(d.partials[d.name]=t.compile(o,e.compilerOptions,t),v=d.partials[d.name](h,p)),v!=null){if(d.indent){for(var S=v.split(`
`),C=0,k=S.length;C<k&&!(!S[C]&&C+1===k);C++)S[C]=d.indent+S[C];v=S.join(`
`)}return v}else throw new no.default("The partial "+d.name+" could not be compiled when running in runtime-only mode")}var s={strict:function(h,d,p){if(!h||!(d in h))throw new no.default('"'+d+'" not defined in '+h,{loc:p});return s.lookupProperty(h,d)},lookupProperty:function(h,d){var p=h[d];if(p==null||Object.prototype.hasOwnProperty.call(h,d)||W7.resultIsAllowed(p,s.protoAccessControl,d))return p},lookup:function(h,d){for(var p=h.length,v=0;v<p;v++){var S=h[v]&&s.lookupProperty(h[v],d);if(S!=null)return h[v][d]}},lambda:function(h,d){return typeof h=="function"?h.call(d):h},escapeExpression:ro.escapeExpression,invokePartial:i,fn:function(h){var d=e[h];return d.decorator=e[h+"_d"],d},programs:[],program:function(h,d,p,v,S){var C=this.programs[h],k=this.fn(h);return d||S||v||p?C=l3(this,h,k,d,p,v,S):C||(C=this.programs[h]=l3(this,h,k)),C},data:function(h,d){for(;h&&d--;)h=h._parent;return h},mergeIfNeeded:function(h,d){var p=h||d;return h&&d&&h!==d&&(p=ro.extend({},d,h)),p},nullContext:Object.seal({}),noop:t.VM.noop,compilerInfo:e.compiler};function a(o){var h=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],d=h.data;a._setup(h),!h.partial&&e.useData&&(d=Gv(o,d));var p=void 0,v=e.useBlockParams?[]:void 0;e.useDepths&&(h.depths?p=o!=h.depths[0]?[o].concat(h.depths):h.depths:p=[o]);function S(C){return""+e.main(s,C,s.helpers,s.partials,d,v,p)}return S=G7(e.main,S,s,h.depths||[],d,v),S(o,h)}return a.isTop=!0,a._setup=function(o){if(o.partial)s.protoAccessControl=o.protoAccessControl,s.helpers=o.helpers,s.partials=o.partials,s.decorators=o.decorators,s.hooks=o.hooks;else{var h=ro.extend({},t.helpers,o.helpers);zv(h,s),s.helpers=h,e.usePartial&&(s.partials=s.mergeIfNeeded(o.partials,t.partials)),(e.usePartial||e.useDecorators)&&(s.decorators=ro.extend({},t.decorators,o.decorators)),s.hooks={},s.protoAccessControl=W7.createProtoAccessControl(o);var d=o.allowCallsToHelperMissing||r;H7.moveHelperToHooks(s,"helperMissing",d),H7.moveHelperToHooks(s,"blockHelperMissing",d)}},a._child=function(o,h,d,p){if(e.useBlockParams&&!d)throw new no.default("must pass block params");if(e.useDepths&&!p)throw new no.default("must pass parent depths");return l3(s,o,e[o],h,0,d,p)},a}function l3(e,t,r,i,s,a,o){function h(d){var p=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],v=o;return o&&d!=o[0]&&!(d===e.nullContext&&o[0]===null)&&(v=[d].concat(o)),r(e,d,e.helpers,e.partials,p.data||i,a&&[p.blockParams].concat(a),v)}return h=G7(r,h,e,o,i,a),h.program=t,h.depth=o?o.length:0,h.blockParams=s||0,h}function Wv(e,t,r){return e?!e.call&&!r.name&&(r.name=e,e=r.partials[e]):r.name==="@partial-block"?e=r.data["partial-block"]:e=r.partials[r.name],e}function jv(e,t,r){var i=r.data&&r.data["partial-block"];r.partial=!0,r.ids&&(r.data.contextPath=r.ids[0]||r.data.contextPath);var s=void 0;if(r.fn&&r.fn!==j7&&function(){r.data=io.createFrame(r.data);var a=r.fn;s=r.data["partial-block"]=function(h){var d=arguments.length<=1||arguments[1]===void 0?{}:arguments[1];return d.data=io.createFrame(d.data),d.data["partial-block"]=i,a(h,d)},a.partials&&(r.partials=ro.extend({},r.partials,a.partials))}(),e===void 0&&s&&(e=s),e===void 0)throw new no.default("The partial "+r.name+" could not be found");if(e instanceof Function)return e(t,r)}function j7(){return""}function Gv(e,t){return(!t||!("root"in t))&&(t=t?io.createFrame(t):{},t.root=e),t}function G7(e,t,r,i,s,a){if(e.decorator){var o={};t=e.decorator(t,o,r,i&&i[0],s,a,i),ro.extend(t,o)}return t}function zv(e,t){Object.keys(e).forEach(function(r){var i=e[r];e[r]=Jv(i,t)})}function Jv(e,t){var r=t.lookupProperty;return Uv.wrapHelper(e,function(i){return ro.extend({lookupProperty:r},i)})}});var _4=Dr((c3,J7)=>{"use strict";c3.__esModule=!0;c3.default=function(e){(function(){typeof globalThis!="object"&&(Object.prototype.__defineGetter__("__magic__",function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var t=globalThis.Handlebars;e.noConflict=function(){return globalThis.Handlebars===e&&(globalThis.Handlebars=t),e}};J7.exports=c3.default});var X7=Dr((h3,K7
`+this.lexer.showPosition()+`
Expecting `+_t.join(", ")+", got '"+(this.terminals_[te]||te)+"'":nt="Parse error on line "+(S+1)+": Unexpected "+(te==1?"end of input":"'"+(this.terminals_[te]||te)+"'"),this.parseError(nt,{text:this.lexer.match,token:this.terminals_[te]||te,line:this.lexer.yylineno,loc:Ne,expected:_t})}}if(M[0]instanceof Array&&M.length>1)throw new Error("Parse Error: multiple actions possible at state: "+O+", token: "+te);switch(M[0]){case 1:o.push(te),h.push(this.lexer.yytext),d.push(this.lexer.yylloc),o.push(M[1]),te=null,Ye?(te=Ye,Ye=null):(C=this.lexer.yyleng,v=this.lexer.yytext,S=this.lexer.yylineno,Ne=this.lexer.yylloc,k>0&&k--);break;case 2:if(bt=this.productions_[M[1]][1],H.$=h[h.length-bt],H._$={first_line:d[d.length-(bt||1)].first_line,last_line:d[d.length-1].last_line,first_column:d[d.length-(bt||1)].first_column,last_column:d[d.length-1].last_column},me&&(H._$.range=[d[d.length-(bt||1)].range[0],d[d.length-1].range[1]]),Oe=this.performAction.call(H,v,C,S,this.yy,M[1],h,d),typeof Oe!="undefined")return Oe;bt&&(o=o.slice(0,-1*bt*2),h=h.slice(0,-1*bt),d=d.slice(0,-1*bt)),o.push(this.productions_[M[1]][0]),h.push(H.$),d.push(H._$),wt=p[o[o.length-2]][o[o.length-1]],o.push(wt);break;case 3:return!0}}return!0}},t=function(){var i={EOF:1,parseError:function(a,o){if(this.yy.parser)this.yy.parser.parseError(a,o);else throw new Error(a)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var o=a.match(/(?:\r\n?|\n).*/g);return o?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var o=a.length,h=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-o-1),this.offset-=o;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===d.length?this.yylloc.first_column:0)+d[d.length-h.length].length-h[0].length:this.yylloc.first_column-o},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-o]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),o=new Array(a.length+1).join("-");return a+this.upcomingInput()+`
`+o+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,o,h,d,p,v;this._more||(this.yytext="",this.match="");for(var S=this._currentRules(),C=0;C<S.length&&(h=this._input.match(this.rules[S[C]]),!(h&&(!o||h[0].length>o[0].length)&&(o=h,d=C,!this.options.flex)));C++);return o?(v=o[0].match(/(?:\r\n?|\n).*/g),v&&(this.yylineno+=v.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:v?v[v.length-1].length-v[v.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+o[0].length},this.yytext+=o[0],this.match+=o[0],this.matches=o,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(o[0].length),this.matched+=o[0],a=this.performAction.call(this,this.yy,this,S[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a||void 0):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return typeof a!="undefined"?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return i.options={},i.performAction=function(a,o,h,d){function p(S,C){return o.yytext=o.yytext.substring(S,o.yyleng-C+S)}var v=d;switch(h){case 0:if(o.yytext.slice(-2)==="\\\\"?(p(0,1),this.begin("mu")):o.yytext.slice(-1)==="\\"?(p(0,1),this.begin("emu")):this.begin("mu"),o.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;break;case 3:return this.begin("raw"),15;break;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw"?15:(p(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;break;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;break;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;break;case 16:return this.popState(),44;break;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(o.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;break;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;break;case 30:return this.popState(),33;break;case 31:return o.yytext=p(1,2).replace(/\\"/g,'"'),80;break;case 32:return o.yytext=p(1,2).replace(/\\'/g,"'"),80;break;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return o.yytext=o.yytext.replace(/\\([\\\]])/g,"$1"),72;break;case 43:return"INVALID";case 44:return 5}},i.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],i.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},i}();e.lexer=t;function r(){this.yy={}}return r.prototype=e,e.Parser=r,new r}();d3.default=iD;rg.exports=d3.default});var U4=Dr((g3,ag)=>{"use strict";g3.__esModule=!0;function sD(e){return e&&e.__esModule?e:{default:e}}var aD=Xs(),B4=sD(aD);function p3(){this.parents=[]}p3.prototype={constructor:p3,mutating:!1,acceptKey:function(t,r){var i=this.accept(t[r]);if(this.mutating){if(i&&!p3.prototype[i.type])throw new B4.default('Unexpected node type "'+i.type+'" found when accepting '+r+" on "+t.type);t[r]=i}},acceptRequired:function(t,r){if(this.acceptKey(t,r),!t[r])throw new B4.default(t.type+" requires "+r)},acceptArray:function(t){for(var r=0,i=t.length;r<i;r++)this.acceptKey(t,r),t[r]||(t.splice(r,1),r--,i--)},accept:function(t){if(
`])}),t},each:function(t){for(var r=0,i=this.source.length;r<i;r++)t(this.source[r])},empty:function(){var t=this.currentLocation||{start:{}};return new r1(t.start.line,t.start.column,this.srcFile)},wrap:function(t){var r=arguments.length<=1||arguments[1]===void 0?this.currentLocation||{start:{}}:arguments[1];return t instanceof r1?t:(t=od(t,this,r),new r1(r.start.line,r.start.column,this.srcFile,t))},functionCall:function(t,r,i){return i=this.generateList(i),this.wrap([t,r?"."+r+"(":"(",i,")"])},quotedString:function(t){return'"'+(t+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(t){var r=this,i=[];Object.keys(t).forEach(function(a){var o=od(t[a],r);o!=="undefined"&&i.push([r.quotedString(a),":",o])});var s=this.generateList(i);return s.prepend("{"),s.add("}"),s},generateList:function(t){for(var r=this.empty(),i=0,s=t.length;i<s;i++)i&&r.add(","),r.add(od(t[i],this));return r},generateArray:function(t){var r=this.generateList(t);return r.prepend("["),r.add("]"),r}};w3.default=Vg;Hg.exports=w3.default});var Yg=Dr((k3,Jg)=>{"use strict";k3.__esModule=!0;function zg(e){return e&&e.__esModule?e:{default:e}}var jg=o3(),eT=Xs(),ld=zg(eT),tT=gs(),rT=Wg(),Gg=zg(rT);function Eu(e){this.value=e}function Su(){}Su.prototype={nameLookup:function(t,r){return this.internalNameLookup(t,r)},depthedLookup:function(t){return[this.aliasable("container.lookup"),"(depths, ",JSON.stringify(t),")"]},compilerInfo:function(){var t=jg.COMPILER_REVISION,r=jg.REVISION_CHANGES[t];return[t,r]},appendToBuffer:function(t,r,i){return tT.isArray(t)||(t=[t]),t=this.source.wrap(t,r),this.environment.isSimple?["return ",t,";"]:i?["buffer += ",t,";"]:(t.appendToBuffer=!0,t)},initializeBuffer:function(){return this.quotedString("")},internalNameLookup:function(t,r){return this.lookupPropertyFunctionIsUsed=!0,["lookupProperty(",t,",",JSON.stringify(r),")"]},lookupPropertyFunctionIsUsed:!1,compile:function(t,r,i,s){this.environment=t,this.options=r,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!s,this.name=this.environment.name,this.isChild=!!i,this.context=i||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(t,r),this.useDepths=this.useDepths||t.useDepths||t.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||t.useBlockParams;var a=t.opcodes,o=void 0,h=void 0,d=void 0,p=void 0;for(d=0,p=a.length;d<p;d++)o=a[d],this.source.currentLocation=o.loc,h=h||o.loc,this[o.opcode].apply(this,o.args);if(this.source.currentLocation=h,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new ld.default("Compile completed with content left on stack");this.decorators.isEmpty()?this.decorators=void 0:(this.useDecorators=!0,this.decorators.prepend(["var decorators = container.decorators, ",this.lookupPropertyFunctionVarDeclaration(),`;
`]),this.decorators.push("return fn;"),s?this.decorators=Function.apply(this,["fn","props","container","depth0","data","blockParams","depths",this.decorators.merge()]):(this.decorators.prepend(`function(fn, props, container, depth0, data, blockParams, depths) {
`),this.decorators.push(`}
`),this.decorators=this.decorators.merge()));var v=this.createFunctionContext(s);if(this.isChild)return v;var S={compiler:this.compilerInfo(),main:v};this.decorators&&(S.main_d=this.decorators,S.useDecorators=!0);var C=this.context,k=C.programs,N=C.decorators;for(d=0,p=k.length;d<p;d++)k[d]&&(S[d]=k[d],N[d]&&(S[d+"_d"]=N[d],S.useDecorators=!0));return this.environment.usePartial&&(S.usePartial=!0),this.options.data&&(S.useData=!0),this.useDepths&&(S.useDepths=!0),this.useBlockParams&&(S.useBlockParams=!0),this.options.compat&&(S.compat=!0),s?S.compilerOptions=this.options:(S.compiler=JSON.stringify(S.compiler),this.source.currentLocation={start:{line:1,column:0}},S=this.objectLiteral(S),r.srcName?(S=S.toStringWithSourceMap({file:r.destName}),S.map=S.map&&S.map.toString()):S=S.toString()),S},preamble:function(){this.lastContext=0,this.source=new Gg.default(this.options.srcName),this.decorators=new Gg.default(this.options.srcName)},createFunctionContext:function(t){var r=this,i="",s=this.stackVars.concat(this.registers.list);s.length>0&&(i+=", "+s.join(", "));var a=0;Object.keys(this.aliases).forEach(function(d){var p=r.aliases[d];p.children&&p.referenceCount>1&&(i+=", alias"+ ++a+"="+d,p.children[0]="alias"+a)}),this.lookupPropertyFunctionIsUsed&&(i+=", "+this.lookupPropertyFunctionVarDeclaration());var o=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&o.push("blockParams"),this.useDepths&&o.push("depths");var h=this.mergeSource(i);return t?(o.push(h),Function.apply(this,o)):this.source.wrap(["function(",o.join(","),`) {
`,h,"}"])},mergeSource:function(t){var r=this.environment.isSimple,i=!this.forceBuffer,s=void 0,a=void 0,o=void 0,h=void 0;return this.source.each(function(d){d.appendToBuffer?(o?d.prepend(" + "):o=d,h=d):(o&&(a?o.prepend("buffer += "):s=!0,h.add(";"),o=h=void 0),a=!0,r||(i=!1))}),i?o?(o.prepend("return "),h.add(";")):a||this.source.push('return "";'):(t+=", buffer = "+(s?"":this.initializeBuffer()),o?(o.prepend("return buffer + "),h.add(";")):this.source.push("return buffer;")),t&&this.source.prepend("var "+t.substring(2)+(s?"":`;
`)),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return`
lookupProperty = container.lookupProperty || function(parent, propertyName) {
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
return parent[propertyName];
}
return undefined
}
`.trim()},blockValue:function(t){var r=this.aliasable("container.hooks.blockHelperMissing"),i=[this.contextName(0)];this.setupHelperArgs(t,0,i);var s=this.popStack();i.splice(1,0,s),this.push(this.source.functionCall(r,"call",i))},ambiguousBlockValue:function(){var t=this.aliasable("container.hooks.blockHelperMissing"),r=[this.contextName(0)];this.setupHelperArgs("",0,r,!0),this.flushInline();var i=this.topStack();r.splice(1,0,i),this.pushSource(["if (!",this.lastHelper,") { ",i," = ",this.source.functionCall(t,"call",r),"}"])},appendContent:function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},append:function(){if(this.isInline())this.replaceStack(function(r){return[" != null ? ",r,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(t){this.lastContext=t},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(t,r,i,s){var a=0;!s&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(t[a++])):this.pushContext(),this.resolvePath("context",t,a,r,i)},lookupBlockParam:function(t,r){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",r,1)},lookupData:function(t,r,i){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",r,0,!0,i)},resolvePath:function(t,r,i,s,a){var o=this;if(this.options.strict||this.options.assumeObjects){this.push(nT(this.options.strict&&a,this,r,i,t));return}for(var h=r.length;i<h;i++)this.replaceStack(function(d){var p=o.nameLookup(d,r[i],t);return s?[" && ",p]:[" != null ? ",p," : ",d]})},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(t,r){this.pushContext(),this.pushString(r),r!=="SubExpression"&&(typeof t=="string"?this.pushString(t):this.pushStackLiteral(t))},emptyHash:function(t){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(t?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var t=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(t.ids)),this.stringParams&&(this.push(this.objectLiteral(t.contexts)),this.push(this.objectLiteral(t.types))),this.push(this.objectLiteral(t.values))},pushString:function(t){this.pushStackLiteral(this.quotedString(t))},pushLiteral:function(t){this.pushStackLiteral(t)},pushProgram:function(t){t!=null?this.pushStackLiteral(this.programExpression(t)):this.pushStackLiteral(null)},registerDecorator:function(t,r){var i=this.nameLookup("decorators",r,"decorator"),s=this.setupHelperArgs(r,t);this.decorators.push(["fn = ",this.decorators.functionCall(i,"",["fn","props","container",s])," || fn;"])},invokeHelper:function(t,r,i){var s=this.popStack(),a=this.setupHelper(t,r),o=[];i&&o.push(a.name),o.push(s),this.options.strict||o.push(this.aliasable("container.hooks.helperMissing"));var h=["(",this.itemsSeparatedBy(o,"||"),")"],d=this.source.functionCall(h,"call",a.callParams);this.push(d)},itemsSeparatedBy:function(t,r){var i=[];i.push(t[0]);for(var s=1;s<t.length;s++)i.push(r,t[s]);return i},invokeKnownHelper:function(t,r){var i=this.setupHelper(t,r);this.push(this.source.functionCall(i.name,"call",i.callParams))},invokeAmbiguous:function(t,r){this.useRegister("helper");var i=this.popStack();this.emptyHash();var s=this.setupHelper(0,t,r),a=this.lastHelper=this.nameLookup("helpers",t,"helper"),o=["(","(helper = ",a," || ",i,")"];this.options.strict||(o[0]="(helper = ",o.push(" != null
`:`
`);await app.vault.adapter.write(r,p),app.workspace.trigger("dataview:refresh-views"),app.workspace.trigger("qatt:refresh-codeblocks")},window.qattUpdateOriginalTaskWithAppend=async function(r,i,s,a,o){a=a===""?" ":a;let h=await app.vault.adapter.read(r),d=h.contains("\r"),p=h.split(/\r?\n/u);if(p.length<i)return;p[i]=`${p[i].replace(`[${s}]`,`[${a}]`)}${o}`;let v=p.join(d?`\r
`:`
`);await app.vault.adapter.write(r,v),app.workspace.trigger("dataview:refresh-views"),app.workspace.trigger("qatt:refresh-codeblocks")},window.qattUpdateOriginalTaskWithDoneDate=async function(r,i,s,a){a=a===""?" ":a;let o=await app.vault.adapter.read(r),h=o.contains("\r"),d=o.split(/\r?\n/u);if(d.length<i)return;if(a==="x"&&!d[i].includes("\u2705")){let v=new Date().toISOString().split("T")[0];d[i]=`${d[i].replace(`[${s}]`,`[${a}]`)} \u2705 ${v}`}else d[i]=`${d[i].replace(`[${s}]`,`[${a}]`)}`;if(a!=="x"&&d[i].includes("\u2705")){let v=d[i].lastIndexOf("\u2705");d[i]=d[i].slice(0,v)+d[i].slice(v+12)}let p=d.join(h?`\r
`:`
`);await app.vault.adapter.write(r,p),app.workspace.trigger("dataview:refresh-views"),app.workspace.trigger("qatt:refresh-codeblocks")}}};var h6=require("obsidian");var ks=class extends Nr{constructor(){super();this.plugin=this.use(h6.Plugin);this.tableLoadTimes={};this.measurements={};this.metrics={};this.lastCreation=ct.now()}setTableLoadTime(r,i){this.tableLoadTimes[r]=i}addMetric(r,i,s){this.metrics[r]?this.metrics[r][0]=i:this.metrics[r]=[i,s]}setMetric(r,i){this.metrics[r][0]=i}getMetric(r){return this.metrics[r]}incrementMetric(r){this.metrics[r]&&(this.metrics[r][0]+=1)}startMeasurement(r){this.measurements[r]=performance.now()}endMeasurement(r){this.measurements[r]=performance.now()-this.measurements[r]}getMeasurement(r){return this.measurements[r]}getPluginMetrics(){let r=Object.entries(this.tableLoadTimes).map(([a,o])=>`${a}: ${o}ms`).join(`
`),i=Object.entries(this.measurements).map(([a,o])=>`${a}: ${o}ms`).join(`
`),s=Object.entries(this.metrics).map(([a,[o,h]])=>`${a}: ${o} ${h}`).join(`
`);return`
Plugin Load Time: ${this.pluginLoadTime}ms
Notes Cache Load Time: ${this.cacheLoadTime}ms
Table Load Times
${r}
Internal Measurements
${i}
Metrics
${s}`}};var kc=class extends Nr{constructor(){super(...arguments);this.plugin=this.use(f6.Plugin);this.logger=this.use(vr).getLogger("Qatt.CommandHandler");this.metrics=this.use(ks);this.windowFunctions=this.use(Z1)}setup(r){let i=[{id:"dump-metrics-to-console",name:"Report the metrics for the plugin to the console",callback:()=>{this.logger.info("Plugin Metrics",this.metrics.getPluginMetrics())}},{id:"force-codeblock-refresh",name:"Force a refresh of all blocks for QATT",callback:()=>{this.plugin.app.workspace.trigger("qatt:refresh-codeblocks")}},{id:"force-cache-reload",name:"Force the notes cache to be reloaded",callback:()=>{this.plugin.app.workspace.trigger("qatt:force-cache-reload")}},{id:"push-internal-events-to-console",name:"Will push all the internal events to the console for debugging.",callback:async()=>{let s=r,a=await _l.default.promise(`SELECT TOP ${s} * FROM qatt.Events ORDER BY date desc`);this.logger.info("Internal Events",a)}},{id:"dump-tasks-to-console",name:"Will push all the internal obsidian_markdown_tasks table to the console for debugging.",callback:async()=>{this.logger.info("tasks",await _l.default.promise("SELECT * FROM obsidian_markdown_tasks"))}},{id:"dump-lists-to-console",name:"Will push all the internal obsidian_markdown_lists table to the console for debugging.",callback:async()=>{this.logger.info("lists",await _l.default.promise("SELECT * FROM obsidian_markdown_lists"))}},{id:"dump-reference-calendar-to-console",name:"Will push all the internal qatt.ReferenceCalendar table to the console for debugging.",callback:async()=>{this.logger.info("qatt.ReferenceCalendar",await _l.default.promise("SELECT * FROM qatt.ReferenceCalendar"))}},{id:"qatt-internal-reload-window-functions",name:"Internal - Reload Window Level Functions",callback:()=>{this.windowFunctions.attachFunctions()}},{id:"qatt-show-updates",name:"Show recent updates to the plugin",callback:()=>{this.plugin.announceUpdate()}}];for(let s of i)this.plugin.addCommand(s)}};var d6=require("obsidian"),If=class extends Error{constructor(r,i){super(r);this.console_message=i;this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor)}},Cc=class extends d6.FuzzySuggestModal{constructor(r,i,s,a){super(app);this.text_items=r;this.items=i;this.submitted=!1;this.setPlaceholder(s),a&&(this.limit=a)}getItems(){return this.items}onClose(){this.submitted||this.reject(new If("Cancelled prompt"))}selectSuggestion(r,i){this.submitted=!0,this.close(),this.onChooseSuggestion(r,i)}getItemText(r){return this.text_items instanceof Function?this.text_items(r):this.text_items[this.items.indexOf(r)]||"Undefined Text Item"}onChooseItem(r){this.resolve(r)}async openAndGetValue(r,i){this.resolve=r,this.reject=i,this.open()}};function xc(e,t){var s,a;let r=e.split("."),i=window;for(let o=0;o<r.length-1;o++)i=i[s=r[o]]||(i[s]={});i[a=r[r.length-1]]||(i[a]=t===void 0?{}:t)}async function p6(e,t,r,i,s){r===void 0&&(r=!1),i===void 0&&(i="");let a=new Cc(e,t,i,s),o=new Promise(async(h,d)=>a.openAndGetValue(h,d));try{return await o}catch(h){if(r)throw h;return null}}var ms=require("obsidian");function Cs(e){return vc(e)(Nf).addProvider(e)}var ai=class{constructor(t){var r,i,s,a,o,h,d;this.text=(r=t.text)!=null?r:"",this.level=(i=t.level)!=null?i:"",this.class=(s=t.class)!=null?s:"",this.open=(a=t.open)!=null?a:!1,this.noticeClass=(o=t.noticeClass)!=null?o:"",this.noticeText=(h=t.noticeText)!=null?h:"",this.noticeHtml=(d=t.noticeHtml)!=null?d:""}},pn=class{constructor(t){var r,i,s,a,o,h,d,p,v,S,C,k;this.name=(r=t.name)!=null?r:"",this.description=(i=t.description)!=null?i:"",this.type=(s=t.type)!=null?s:"",this.value=(a=t.value)!=null?a:"",this.placeholder=(o=t.placeholder)!=null?o:"",this.settingName=(h=t.settingName)!=null?h:"",this.featureFlag=(d=t.featureFlag)!=null?d:"",this.noticeClass=(p=t.noticeClass)!=null?p:"",this.noticeText=(v=t.noticeText)!=null?v:"",this.noticeHtml=(S=t.noticeHtml)!=null?S:"",this.textAreaRows=(C=t.textAreaRows)!=null?C:8,this.textAreaCols=(k=t.textAreaCols)!=null?k:60}},Nf=class extends ms.PluginSettingTab{constructor(
`).filter(Boolean).includes(r.path):!1}async settingsInitialLoad(r){this.logger.info("Initialize Settings"),this.importFiles=r,await this.importAllFiles(),this.initialImportCompleted=!0}async settingsUpdateLoad(r){this.initialImportCompleted&&(this.logger.info("Updated Settings"),this.importFiles=r,await this.importAllFiles())}async importAllFiles(){var i;if(!this.importFiles)return;let r=(i=this.importFiles.split(`
`).filter(Boolean))!=null?i:[];for(let s of r)if(s.startsWith("WEB|")){let a=s.split("|"),o=a[1],h=new URL(a[2]);await this.importArrayToTableFromUrl(h,o,this.importCallback)}else{let a=this.plugin.app.vault.getAbstractFileByPath(s);if(!a){this.logger.warn(`Unable to find file ${s} for import, please check your settings.`);continue}try{await this.importArrayToTableFromFile(a,this.importCallback)}catch(o){this.logger.info(`Error processing ${s} for import`,o)}}}async importArrayToTableFromUrl(r,i,s){let o=await(await fetch(r)).text();await this.importArrayToTable(o,i,s)}async importArrayToTableFromFile(r,i){let s=r.basename;this.logger.info(`Loading '${r.path}' as table '${s}'`);let a=await this.plugin.app.vault.cachedRead(r);await this.importArrayToTable(a,s,i)}async importArrayToTable(r,i,s){let a=new Date(Date.now()),o=s(r,i);if(!o||o.length===0)return;this.logger.debug(`Loaded to table '${i}'`,o),await Ml.default.promise(`DROP TABLE IF EXISTS ${i}`),await Ml.default.promise(`CREATE TABLE IF NOT EXISTS ${i}`),Ml.default.tables[i].data=o;let d=(await Ml.default.promise(`SELECT COUNT(*) AS ImportedRows FROM ${i}`))[0].ImportedRows,p=new Date(Date.now());this.logger.info(`Imported ${d} rows to ${i} in ${p.getTime()-a.getTime()}ms`),this.plugin.app.workspace.trigger("qatt:refresh-codeblocks")}};var b6=zr(g6()),sy={csvFiles:"",csvLoaderSettingsOpen:!1},K1=class extends Ca{constructor(){super(...arguments);this.logger=this.use(vr).getLogger("Qatt.CsvLoaderService");this.settingsTab=Cs(this);this.settings=ws(this,sy,async r=>{this.csvLoaderSettingsOpen=r.csvLoaderSettingsOpen,await this.settingsUpdateLoad(r.csvFiles)},async r=>{this.csvLoaderSettingsOpen=r.csvLoaderSettingsOpen,await this.settingsInitialLoad(r.csvFiles)});this.importCallback=async(r,i)=>(0,b6.parse)(r,{header:!0,dynamicTyping:!0,skipEmptyLines:!0}).data}showSettings(){let r=this.settingsTab,{settings:i}=this,s=async d=>{await i.update(p=>{p.csvLoaderSettingsOpen=d})},a=r.addHeading(new ai({open:this.csvLoaderSettingsOpen,text:"CSV Loader Settings",level:"h2",class:"settings-heading"}),s),o=async d=>{await i.update(p=>{p.csvFiles=d})},h=r.addTextAreaInput(new pn({name:"CSV file to load on start",description:"Add the files you want added on load, one per line. The table name will be the name of the file minus the extension.",value:this.importFiles}),o,a)}};var qn=zr(si());var ri=zr(si()),h7=require("obsidian");var Fc=class{constructor(t,r,i,s,a,o,h,d,p){this.parent=t;this.task=r;this.content=i;this.line=s;this.column=a;this.path=o;this.modified=h;this.heading=d;this.note_name=p;this._textMatch=this.listMatcher.exec(this.content);this.isTopLevel=this.parent<0;this.page=this.path;this.text=this._textMatch===null?"":this._textMatch[5];this.isTask=this._textMatch===null?!1:this._textMatch[4]!==void 0;this.checked=this._textMatch===null?!1:this._textMatch[4]!==void 0;this.status=this.isTask&&this._textMatch!==null?this._textMatch[4]:""}get listMatcher(){return/^([\s\t>]*)([-*+]|\d+\.)? *(\[(.)])? *(.*)/gm}};var y6=["\u{1F4C5}","[due::","(due::"],E6=["\u2705","[completion::","(completion::"],S6=["\u{1F6EB}","[start::","(start::"],v6=["\u2795","[created::","(created::"],D6=["\u23F3","[scheduled::","(scheduled::"],T6=["\u{1F4A8}","[do::","(do::"],ay=!0,Oc=e=>{let t=[],r=[],i=e.split(" "),s,a,o,h,d,p,v,S=e;for(let C=0;C<i.length;C++)cy(i,C,t,r),s=s!=null?s:eu(i,C,y6),a=a!=null?a:eu(i,C,E6),o=o!=null?o:eu(i,C,S6),h=h!=null?h:eu(i,C,v6),d=d!=null?d:eu(i,C,D6),p=p!=null?p:eu(i,C,T6),v=v!=null?v:ay?ly(i,C):uy(i,C);if(s&&(S=X1(S,s,y6)),a&&(S=X1(S,a,E6)),o&&(S=X1(S,o,S6)),h&&(S=X1(S,h,v6)),d&&(S=X1(S,d,D6)),p&&(S=X1(S,p,T6)),v&&(S=S.replace("\u23EB",""),S=S.replace("\u{1F53C}",""),S=S.replace("\u{1F53D}",""),S=S.replace("[priority:: high]",""),S=S.replace("[priority:: medium]",""),S=S.replace("[priority:: low]",""),S=S.replace("(priority:: high)",""),S=S.replace("(priority:: medium)",""),S=S.replace("(priority:: low)","")),t.length>0)for(let C of t)S=S.replace(`#${C}`,"");return S=S.trim().slice(6),{tags:t,tagsNormalized:r,dueDate:s,doneDate:a,startDate:o,createDate:h,sched
`)}`}async hasValue(r){return await this.getValue(r)!==void 0}};var tu=require("obsidian"),xa=class extends Nr{constructor(){super();this.plugin=this.use(tu.Plugin);this.logger=this.use(vr).getLogger("Qatt.NotesCacheService");this.metrics=this.use(ks);this.internalConfig=this.use(Ac);this.enableAlaSqlTablePopulation=!0;this.disableContinualIndexNotifications=!1;this.allNotesLoaded=!1;this.cachingNotes=!1;this.settingsTab=Cs(this);this.settings=ws(this,{enableDataViewInlineFieldParsingForTasks:!1,notesCacheSettingsOpen:!1,enableAlaSqlTablePopulation:!0,disableContinualIndexNotifications:!1},async r=>{this.logger.info("NotesCacheService Updated Settings"),this.enableDataViewInlineFieldParsingForTasks=r.enableDataViewInlineFieldParsingForTasks,this.notesCacheSettingsOpen=r.notesCacheSettingsOpen,this.enableAlaSqlTablePopulation=r.enableAlaSqlTablePopulation,this.disableContinualIndexNotifications=r.disableContinualIndexNotifications},async r=>{this.logger.info("NotesCacheService Initialize Settings"),this.enableDataViewInlineFieldParsingForTasks=r.enableDataViewInlineFieldParsingForTasks,this.notesCacheSettingsOpen=r.notesCacheSettingsOpen,this.enableAlaSqlTablePopulation=r.enableAlaSqlTablePopulation,this.disableContinualIndexNotifications=r.disableContinualIndexNotifications});this.notes=[];this.notesMap=new Map;this.listItemsMap=new Map;this.taskItemMap=new Map;this.ignoredFiles={};this.lastUpdate=ct.now(),this.metrics.addMetric("NotesCacheService.create Event Count",0,"count"),this.metrics.addMetric("NotesCacheService.changed Event Count",0,"count"),this.metrics.addMetric("NotesCacheService.delete Event Count",0,"count"),this.metrics.addMetric("NotesCacheService.rename Event Count",0,"count"),this.metrics.addMetric("NotesCacheService.changed Ignored Count",0,"count")}get obsidianNotesTableName(){return"obsidian_notes"}get obsidianListsTableName(){return"obsidian_lists"}get obsidianTasksTableName(){return"obsidian_tasks"}showSettings(){let r=this.settingsTab,{settings:i}=this,s=async p=>{await i.update(v=>{v.notesCacheSettingsOpen=p})},a=r.addHeading(new ai({open:this.notesCacheSettingsOpen,text:"Notes Cache Settings",level:"h2",class:"settings-heading"}),s),o=r.addToggle(new pn({name:"Enable DataView Inline Field Parsing for Tasks (obsidian_markdown_tasks table)",description:"This enabled processing of any DataView Inline properties added to a task. The name of the property is added to the obsidian_markdown_tasks table as a column. Restart Obsidian to re-cache all files.",value:this.enableDataViewInlineFieldParsingForTasks}),async p=>{await i.update(v=>{v.enableDataViewInlineFieldParsingForTasks=p})},a),h=r.addToggle(new pn({name:"Enable direct creation of tables in AlaSQL",description:"This causes tables to be created and updated in memory so queries can be done directly to the AlaSQL database. Allows use in external plugins like templater.",value:this.enableAlaSqlTablePopulation}),async p=>{await i.update(v=>{v.enableAlaSqlTablePopulation=p})},a),d=r.addToggle(new pn({name:"Disable continual index notifications",description:"Disables the continual notifications that the index is being updated. Only two messages will be created, one on start and one on end.",value:this.disableContinualIndexNotifications}),async p=>{await i.update(v=>{v.disableContinualIndexNotifications=p})},a)}async layoutReady(){this.logger.info("Layout ready, registering for vault events"),this.registerEvent(this.plugin.app.vault.on("create",async r=>{if(this.logger.info(`create event detected for ${r.path}`),!this.allNotesLoaded)return;if(this.checkIfFileShouldBeIgnored(r.path)){this.logger.info(`skipping update for ${r.path} as it is being ignored for a period.`);return}let i=await this.createNoteFromPath(r.path);i&&await this.addNote(r.path,i),this.metrics.incrementMetric("NotesCacheService.create Event Count"),this.metrics.startMeasurement("NotesCacheService.create Event"),this.plugin.app.workspace.trigger("qatt:notes-store-update"),this.metrics.endMeasurement("NotesCacheService.create Event")})),this.registerEvent(this.plugin.app.vault.on("del
${i}/${s.length}`);let N=await this.createNoteFromFile(k);this.logger.debug("Caching:",k.path),this.logger.debug("Caching:",this.notesMap),N&&h.push(this.addNote(k.path,N,!1))}await Promise.all(h),await oi.default.promise(`SELECT * INTO ${this.obsidianNotesTableName} FROM ?`,[await this.getNotes()]),await oi.default.promise(`SELECT * INTO ${this.obsidianListsTableName} FROM ?`,[await this.getLists()]),await oi.default.promise(`SELECT * INTO ${this.obsidianTasksTableName} FROM ?`,[await this.getTasks()]),this.allNotesLoaded=!0;let p=(performance.now()-o)/1e3;a=new tu.Notice(`Indexing notes for Query All The Things took ${p.toLocaleString(void 0,{maximumFractionDigits:2,minimumFractionDigits:2})}s`,5e3),this.disableContinualIndexNotifications||a.hide();let v=await oi.default.promise(`SELECT COUNT(path) AS cached FROM ${this.obsidianNotesTableName}`),S=await oi.default.promise(`SELECT COUNT(path) AS cached FROM ${this.obsidianListsTableName}`),C=await oi.default.promise(`SELECT COUNT(path) AS cached FROM ${this.obsidianTasksTableName}`);this.metrics.addMetric("NotesCacheService Notes Count",v[0].cached,"count"),this.metrics.addMetric("NotesCacheService Lists Count",S[0].cached,"count"),this.metrics.addMetric("NotesCacheService Tasks Count",C[0].cached,"count"),this.plugin.app.workspace.trigger("qatt:all-notes-loaded"),this.metrics.endMeasurement("NotesCacheService.cacheAllNotes"),this.metrics.cacheLoadTime=this.metrics.getMeasurement("NotesCacheService.cacheAllNotes"),this.cachingNotes=!1}async getNotes(){return Array.from(this.notesMap.values())}async getLists(){return Array.from(this.listItemsMap.values())}async getTasks(){return Array.from(this.taskItemMap.values())}async getNoteIndex(r){return this.notes.findIndex(i=>i.path===r)}async deleteNote(r){this.notesMap.delete(r),this.deleteListItemsForPath(r),this.deleteTasksForPath(r),this.enableAlaSqlTablePopulation&&(await oi.default.promise(`DELETE FROM ${this.obsidianNotesTableName} WHERE path = ?;`,[r]),await oi.default.promise(`DELETE FROM ${this.obsidianListsTableName} WHERE path = ?;`,[r]),await oi.default.promise(`DELETE FROM ${this.obsidianTasksTableName} WHERE path = ?;`,[r]))}async replaceNote(r,i){this.notesMap.set(r,i),await this.updateNotesTable(i,r),this.deleteListItemsForPath(r),this.deleteTasksForPath(r);let s=[];for(let o of i.listItems)this.listItemsMap.set(`${r}:${o.line}`,o),s.push(this.upsertLists(!0,r,o));await Promise.all(s);let a=[];for(let o of i.tasks)this.taskItemMap.set(`${r}:${o.line}`,o),a.push(this.upsertTasks(!0,r,o));await Promise.all(a)}async addNote(r,i,s=!0){this.metrics.startMeasurement("addNote"),this.notesMap.set(r,i),await this.upsertNote(s,r,i);let a=[];for(let h of i.listItems){let d=`${r}:${h.line}`;this.listItemsMap.set(d,h),a.push(this.upsertLists(s,r,h))}await Promise.all(a);let o=[];for(let h of i.tasks)this.taskItemMap.set(`${r}:${h.line}`,h),o.push(this.upsertTasks(s,r,h));await Promise.all(o),this.metrics.endMeasurement("addNote")}async createNoteFromPath(r){let i=this.plugin.app.vault.getMarkdownFiles().find(s=>s.path===r);if(i)return this.createNoteFromFile(i)}async createNoteFromFile(r){var i;return this.createNoteFromFileAndCache(r,(i=this.plugin.app.metadataCache.getFileCache(r))!=null?i:void 0)}async createNoteFromFileAndCache(r,i){let s=await this.plugin.app.vault.cachedRead(r);return Wo.createNewNote(r,i,s)}async upsertTasks(r,i,s){r&&this.enableAlaSqlTablePopulation&&await this.upsertTable(this.obsidianTasksTableName,i,s.modified,s.line,async()=>{await this.updateTasksTable(s,i)},async()=>{await this.insertTasksTable(s)})}async upsertLists(r,i,s){r&&this.enableAlaSqlTablePopulation&&await this.upsertTable(this.obsidianListsTableName,i,s.modified,s.line,async()=>{await this.updateListsTable(s,i)},async()=>{await this.insertListsTable(s)})}async upsertNote(r,i,s){r&&this.enableAlaSqlTablePopulation&&await this.upsertTable(this.obsidianNotesTableName,i,s.modified,void 0,async()=>{await this.updateNotesTable(s,i)},async()=>{await this.insertNotesTable(s,i)})}async upsertTable(r,i,s,a,o,h){let d=a?`SELECT path, modified
`);return e<0||e>=r.length?"":r[e]}}var a7=zr(si());function SS(){a7.default.fn.JoinArray=function(e,t){return t===void 0&&(t=""),e!==void 0?e.join(t):""}}var o7=zr(si());function vS(){o7.default.fn.LINEINDEX=function(e,t,r){{let s=t.split(`
`);for(let[a,o]of s.entries())if(o.includes(e))return a;return-1}return-1}}var zc=zr(si());function DS(){zc.default.fn.parseWikiLinkLocation=function(e){let t=b4(e);return t?y4(t)[0]:""}}function TS(){zc.default.fn.parseWikiLinkDisplayName=function(e){var r;let t=b4(e);return t&&(r=y4(t)[1])!=null?r:""}}function wS(){zc.default.fn.wikiLinkHasDisplayName=function(e){let t=b4(e);if(!t)return!1;let r=y4(t);return r.length===2&&r[1]!==void 0}}function b4(e){let r=/\[\[([^\[\]]*?)\]\]/u.exec(e);if(r)return r[1]}function y4(e){let t=-1;for(;(t=e.indexOf("|",t+1))>=0;)if(!(t>0&&e[t-1]==="\\"))return[e.slice(0,Math.max(0,t)).replace(/\\\|/g,"|"),e.slice(Math.max(0,t+1))];return[e.replace(/\\\|/g,"|"),void 0]}var u7=zr(si());function kS(){u7.default.fn.REVERSE=function(e){return e.split("").reverse().join("")}}var l7=zr(si());function CS(){l7.default.fn.stringify=function(e){return JSON.stringify(e)}}var c7=zr(si());function xS(){c7.default.fn.updatePropertyFromList=function(e,t,r,i){let s=`['${r.join("', '")}']`,a="<a ";return a+='onclick="',a+="const fun = async() => { ",a+="let newValue = (await ",a+="_qatt.ui.promptWithSuggestions",a+=`(${s},${s})`,a+=");",a+=`if(newValue !== null) {app.fileManager.processFrontMatter(app.vault.getAbstractFileByPath('${t}'), (f) => { f.${i} = newValue; });}`,a+="}; fun();",a+='">',a+=e,a+="</a>",a}}var Qo=class extends Nr{constructor(){super(...arguments);this.plugin=this.use(h7.Plugin);this.logger=this.use(vr).getLogger("Qatt.AlaSqlQuery");this.notesCache=this.use(xa);this.dvService=this.use(to);this._error=void 0}static initialize(){xc("_qatt.query.alasql",ri.default),ri.default.fn.moment=window.moment,ri.default.fn.getNoteName=function(r){return r.split("/").slice(-1)[0].split(".")[0]},ri.default.fn.debugMe=function(){debugger};for(let r of Object.entries(E4))r[1]();ri.default.fn.objectFromMap=function(r){return Object.fromEntries(r)},ri.default.options.nocount=!0}async setupQuery(r,i,s,a){var o;if(this._name="QuerySql",this.codeblockConfiguration=r,this.sourcePath=i,this.frontmatter=s,this.codeBlockFile=this.plugin.app.vault.getAbstractFileByPath(this.sourcePath),this.codeblockConfiguration.query===void 0&&this.codeblockConfiguration.queryFile===void 0)throw new Error("Query is not defined in the code block, either the query or queryFile field is mandatory.");if(this.codeblockConfiguration.queryFile){this.queryFile=this.plugin.app.vault.getAbstractFileByPath(this.codeblockConfiguration.queryFile);let h=await this.plugin.app.vault.cachedRead(this.queryFile);this._sqlQuery=h}else this._sqlQuery=(o=this.codeblockConfiguration.query)!=null?o:"";if(this.codeblockConfiguration.logLevel&&this.logger.setLogLevel(this.codeblockConfiguration.logLevel),this._queryId=a,this.logger.groupId(this._queryId),this._customJsClasses=[],r.customJSForSql)for(let h of r.customJSForSql){let d=h.split(" ")[0],p=h.split(" ")[1];ri.default.fn[p]=window.customJS[d][p]}this.logger.infoWithId(this._queryId,`Setting up query on:${this.sourcePath}`),this.logger.debugWithId(this._queryId,"Source Path",this.sourcePath),this.logger.debugWithId(this._queryId,"Source Front Matter",this.frontmatter),this.logger.debugWithId(this._queryId,"Source Query",this._sqlQuery),this.logger.debugWithId(this._queryId,"codeblockConfiguration",r);try{let h=ri.default.parse(this._sqlQuery);this.logger.debugWithId(this._queryId,"Source Query",h)}catch(h){this._error=`Error with query: ${h}`,this.logger.errorWithId(this._queryId,`Error with query on page [${i}]:`,h)}this.logger.groupEndId()}get error(){return this._error}get name(){return this._name}get queryId(){return this._queryId}async query(){let r=this;this.logger.groupId(this._queryId),this.logger.infoWithId(this._queryId,`Running query on:${this.sourcePath}`),ri.default.fn.notePathWithFileExtension=function(){return r.sourcePath},ri.default.fn.notePathWithoutFileExtension=function(){return r.sourcePath.split(".")[0]},ri.default.fn.notePath=function(){return r.sourcePath.split("/").slice(0,-1).join("/")},ri.default.fn.noteFileName=function(){return r.sourcePath.split("/").slice(-1)[0].
`)}function Ye(){let ie=s[s.length-1],st=ie[ie.length-1],xr=st?st.charCodeAt(st.length-1):null;xr===10||xr===13||xr===null||te()}function O(ie){return pe("ignoreEncode")?ie:I3(ie)}function M(ie){o.push(!ie._loose),Ye(),tt("<ol"),N("expectFirstItem",!0)}function ge(ie){o.push(!ie._loose),Ye(),tt("<ul"),N("expectFirstItem",!0)}function Oe(ie){if(pe("expectFirstItem")){let st=Number.parseInt(this.sliceSerialize(ie),10);st!==1&&tt(' start="'+O(String(st))+'"')}}function H(){pe("expectFirstItem")?tt(">"):wt(),Ye(),tt("<li>"),N("expectFirstItem"),N("lastWasTag")}function kt(){wt(),o.pop(),te(),tt("</ol>")}function bt(){wt(),o.pop(),te(),tt("</ul>")}function wt(){pe("lastWasTag")&&!pe("slurpAllLineEndings")&&Ye(),tt("</li>"),N("slurpAllLineEndings")}function _t(){o.push(!1),Ye(),tt("<blockquote>")}function nt(){o.pop(),Ye(),tt("</blockquote>"),N("slurpAllLineEndings")}function Yt(){o[o.length-1]||(Ye(),tt("<p>")),N("slurpAllLineEndings")}function Mt(){o[o.length-1]?N("slurpAllLineEndings",!0):tt("</p>")}function jr(){Ye(),tt("<pre><code"),N("fencesCount",0)}function lr(){let ie=me();tt(' class="language-'+ie+'"')}function P(){let ie=pe("fencesCount")||0;ie||(tt(">"),N("slurpOneLineEnding",!0)),N("fencesCount",ie+1)}function kr(){Ye(),tt("<pre><code>")}function qr(){let ie=pe("fencesCount");ie!==void 0&&ie<2&&p.tightStack.length>0&&!pe("lastWasTag")&&te(),pe("flowCodeSeenData")&&Ye(),tt("</code></pre>"),ie!==void 0&&ie<2&&Ye(),N("flowCodeSeenData"),N("fencesCount"),N("slurpOneLineEnding")}function U(){a.push({image:!0}),r=void 0}function Cr(){a.push({})}function rn(ie){a[a.length-1].labelId=this.sliceSerialize(ie)}function on(){a[a.length-1].label=me()}function dr(ie){a[a.length-1].referenceId=this.sliceSerialize(ie)}function mr(){Ne(),a[a.length-1].destination=""}function Mr(){Ne(),N("ignoreEncode",!0)}function Lr(){a[a.length-1].destination=me(),N("ignoreEncode")}function Or(){a[a.length-1].title=me()}function Vr(){let ie=a.length-1,st=a[ie],xr=st.referenceId||st.labelId,Fr=st.destination===void 0?i[bs(xr)]:st;for(r=!0;ie--;)if(a[ie].image){r=void 0;break}st.image?(tt('<img src="'+La(Fr.destination,t.allowDangerousProtocol?void 0:AT)+'" alt="'),et(st.label),tt('"')):tt('<a href="'+La(Fr.destination,t.allowDangerousProtocol?void 0:l9)+'"'),tt(Fr.title?' title="'+Fr.title+'"':""),st.image?tt(" />"):(tt(">"),et(st.label),tt("</a>")),a.pop()}function Hr(){Ne(),a.push({})}function Pr(ie){me(),a[a.length-1].labelId=this.sliceSerialize(ie)}function bn(){Ne(),N("ignoreEncode",!0)}function yn(){a[a.length-1].destination=me(),N("ignoreEncode")}function Vn(){a[a.length-1].title=me()}function Qn(){let ie=a[a.length-1],st=bs(ie.labelId);me(),u9.call(i,st)||(i[st]=a[a.length-1]),a.pop()}function L(){N("slurpAllLineEndings",!0)}function Gr(ie){pe("headingRank")||(N("headingRank",this.sliceSerialize(ie).length),Ye(),tt("<h"+pe("headingRank")+">"))}function ln(){Ne(),N("slurpAllLineEndings")}function ci(){N("slurpAllLineEndings",!0)}function Rr(){tt("</h"+pe("headingRank")+">"),N("headingRank")}function Vs(ie){N("headingRank",this.sliceSerialize(ie).charCodeAt(0)===61?1:2)}function gi(){let ie=me();Ye(),tt("<h"+pe("headingRank")+">"),et(ie),tt("</h"+pe("headingRank")+">"),N("slurpAllLineEndings"),N("headingRank")}function Hn(ie){et(O(this.sliceSerialize(ie)))}function Wn(ie){if(!pe("slurpAllLineEndings")){if(pe("slurpOneLineEnding")){N("slurpOneLineEnding");return}if(pe("inCodeText")){et(" ");return}et(O(this.sliceSerialize(ie)))}}function Os(ie){et(O(this.sliceSerialize(ie))),N("flowCodeSeenData",!0)}function hi(){tt("<br />")}function jn(){Ye(),Gn()}function Hs(){N("ignoreEncode")}function Gn(){t.allowDangerousHtml&&N("ignoreEncode",!0)}function Ma(){tt("<em>")}function ba(){tt("<strong>")}function oo(){N("inCodeText",!0),tt("<code>")}function uo(){N("inCodeText"),tt("</code>")}function c1(){tt("</em>")}function A(){tt("</strong>")}function V(){Ye(),tt("<hr />")}function ne(ie){N("characterReferenceType",ie.type)}function Qe(ie){let st=this.sliceSerialize(ie);st=pe("characterReferenceType")?n9(st,pe("characterReferenceType")==="characterRef
`;break}case-3:{o=`\r
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(a)}s=a===-2,i.push(o)}return i.join("")}var wd={};Z2(wd,{attentionMarkers:()=>Jw,contentInitial:()=>Vw,disable:()=>Yw,document:()=>Uw,flow:()=>Ww,flowInitial:()=>Hw,insideSpan:()=>zw,string:()=>jw,text:()=>Gw});var Uw={[42]:mi,[43]:mi,[45]:mi,[48]:mi,[49]:mi,[50]:mi,[51]:mi,[52]:mi,[53]:mi,[54]:mi,[55]:mi,[56]:mi,[57]:mi,[62]:N3},Vw={[91]:gd},Hw={[-2]:g2,[-1]:g2,[32]:g2},Ww={[35]:yd,[42]:a1,[45]:[B3,a1],[60]:Sd,[61]:B3,[95]:a1,[96]:_3,[126]:_3},jw={[38]:R3,[92]:L3},Gw={[-5]:b2,[-4]:b2,[-3]:b2,[33]:Dd,[38]:R3,[42]:m2,[60]:[dd,vd],[91]:Td,[92]:[bd,L3],[93]:s1,[95]:m2,[96]:pd},zw={null:[m2,y9]},Jw={null:[42,95]},Yw={null:[]};function w9(e){let r=O3([wd,...(e||{}).extensions||[]]),i={defined:[],lazy:{},constructs:r,content:s(h9),document:s(d9),flow:s(b9),string:s(E9),text:s(S9)};return i;function s(a){return o;function o(h){return T9(i,a,h)}}}function k9(e){for(;!M3(e););return e}var C9=/[\0\t\n\r]/g;function x9(){let e=1,t="",r=!0,i;return s;function s(a,o,h){let d=[],p,v,S,C,k;for(a=t+a.toString(o),S=0,t="",r&&(a.charCodeAt(0)===65279&&S++,r=void 0);S<a.length;){if(C9.lastIndex=S,p=C9.exec(a),C=p&&p.index!==void 0?p.index:a.length,k=a.charCodeAt(C),!p){t=a.slice(S);break}if(k===10&&S===C&&i)d.push(-3),i=void 0;else switch(i&&(d.push(-5),i=void 0),S<C&&(d.push(a.slice(S,C)),e+=C-S),k){case 0:{d.push(65533),e++;break}case 9:{for(v=Math.ceil(e/4)*4,d.push(-2);e++<v;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:i=!0,e=1}S=C+1}return h&&(i&&d.push(-5),t&&d.push(t),d.push(null)),d}}function kd(e,t,r){return typeof t!="string"&&(r=t,t=void 0),c9(r)(k9(w9(r).document().write(x9()(e,t,!0))))}var Qw={tokenize:tk,partial:!0},F9={tokenize:rk,partial:!0},O9={tokenize:nk,partial:!0},A9={tokenize:ik,partial:!0},Zw={tokenize:sk,partial:!0},I9={tokenize:Xw,previous:L9},N9={tokenize:ek,previous:R9},ao={tokenize:Kw,previous:_9},_a={},xd={text:_a},o1=48;for(;o1<123;)_a[o1]=ao,o1++,o1===58?o1=65:o1===91&&(o1=97);_a[43]=ao;_a[45]=ao;_a[46]=ao;_a[95]=ao;_a[72]=[ao,N9];_a[104]=[ao,N9];_a[87]=[ao,I9];_a[119]=[ao,I9];function Kw(e,t,r){let i=this,s,a;return o;function o(S){return!Cd(S)||!_9.call(i,i.previous)||Fd(i.events)?r(S):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(S))}function h(S){return Cd(S)?(e.consume(S),h):S===64?(e.consume(S),d):r(S)}function d(S){return S===46?e.check(Zw,v,p)(S):S===45||S===95||Nn(S)?(a=!0,e.consume(S),d):v(S)}function p(S){return e.consume(S),s=!0,d}function v(S){return a&&s&&Yn(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(S)):r(S)}}function Xw(e,t,r){let i=this;return s;function s(o){return o!==87&&o!==119||!L9.call(i,i.previous)||Fd(i.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Qw,e.attempt(F9,e.attempt(O9,a),r),r)(o))}function a(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function ek(e,t,r){let i=this,s="",a=!1;return o;function o(S){return(S===72||S===104)&&R9.call(i,i.previous)&&!Fd(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(S),e.consume(S),h):r(S)}function h(S){if(Yn(S)&&s.length<5)return s+=String.fromCodePoint(S),e.consume(S),h;if(S===58){let C=s.toLowerCase();if(C==="http"||C==="https")return e.consume(S),d}return r(S)}function d(S){return S===47?(e.consume(S),a?p:(a=!0,d)):r(S)}function p(S){return S===null||n1(S)||_r(S)||To(S)||p2(S)?r(S):e.attempt(F9,e.attempt(O9,v),r)(S)}function v(S){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(S)}}function tk(e,t,r){let i=0;return s;function s(o){return(o===87||o===119)&&i<3?(i++,e.consume(o),s):o===46&&i===3?(e.consume(o),a):r(o)}function a(o){return o===null?r(o):t(o)}}function rk(e,t,r){let i,s,a;return o;function o(p){return p===46||p===95?e.check(A9,d,h)(p):p===null||_r(p)||To(p)||p!==45&&p2(p)?d(p):(a=!0,e.consume(p),o)}function h(p){return p===95?i=!0:(s=i,i=void 0),e.consume(p),o}function d(p){return s||i||!a?r(p):t(p)}}function nk(e,t){let r=0,i=0;return s;function s(o){retur
`)?i.replace(/<p>|<\/p>/g,""):i}};function Z9(e,t=!1){if(e==null)return"";let r=kd(e,{allowDangerousHtml:!0,extensions:[Wd({aliasDivider:"|"}),Bd()],htmlExtensions:[Hd({permalinks:[],wikiLinkClassName:"internal-link data-link-icon data-link-icon-after data-link-text",hrefTemplate:i=>`${i}`,pageResolver:i=>[i]}),Ud()]});return t&&!e.includes(`
`)?r.replace(/<p>|<\/p>/g,""):r}var K9=zr(Fs());function _k(e){var i;let t=((i=e.hash)==null?void 0:i.inline)==="true",r=Z9(e.fn(this),t);return new K9.default.SafeString(r)}var X9=zr(Fs());function Mk(e){return new X9.default.SafeString(`[[${e}]]`)}var H3=require("obsidian"),jd=zr(Fs());function $k(e){var i;let t=((i=e.hash)==null?void 0:i.inline)==="true",r=document.createElement("span");return H3.MarkdownPreviewView.renderMarkdown(e.fn(this),r,"",new H3.Component).catch(s=>{console.error(s)}),t?new jd.default.SafeString(r.innerHTML.replace(/<p>|<\/p>/g,"")):new jd.default.SafeString(r.innerHTML)}var e8=zr(Fs());function Pk(e,t){return new e8.default.SafeString(`<a data-tooltip-position="top" aria-label="${e}" data-href="${e}" href="${e}" class="internal-link" target="_blank" rel="noopener">${t}</a>`)}var t8=zr(Fs());function qk(e,t){var a,o;let r=t.fn,i=t.inverse,s=(o=(a=t.hash)==null?void 0:a.padWith)!=null?o:" ";return new t8.default.SafeString(s.repeat(e))}var r8=zr(Fs());function Bk(e){let t=[];function r(s,a){return i(a)?"[Cyclical]":a}function i(s){if(s&&typeof s=="object"){for(let a of t)if(a===s)return!0;t.push(s)}return!1}return new r8.default.SafeString(JSON.stringify(e,r,2))}var n8=zr(Fs());function Uk(e){let t="",r="task-list-item-checkbox",i="x",s=e.status;e.status!==" "&&(t="checked",r+=" is-checked",i=" ");let a=`<input class="${r}" type="checkbox" ${t} data-task="${s}" onclick="console.log(this.checked); qattUpdateOriginalTask('${e.page}',${e.line},'${s}','${i}');"></input>`;return new n8.default.SafeString(a)}var i8=zr(Fs());function Vk(e){let t="",r="task-list-item-checkbox",i="x",s=e.status,a=e.append;e.status!==" "&&(t="checked",r+=" is-checked",i=" ");let o=`<input class="${r}" type="checkbox" ${t} data-task="${s}" onclick="console.log(this.checked); qattUpdateOriginalTaskWithAppend('${e.page}',${e.line},'${s}','${i}','${a}');"></input>`;return new i8.default.SafeString(o)}function Hk(e){return Number.parseInt(e,10)}function Wk(e){return String(e).trim()}function jk(e){return e&&e.toUpperCase()}function Gk(e){return ct.fromMillis(e).toFormat("yyyy-MM-dd")}var u1=class extends Nr{constructor(){super(...arguments);this.defaultTemplate="{{stringify result}}";this.plugin=this.use(s8.Plugin);this.logger=this.use(vr).getLogger("Qatt.HandlebarsRenderer")}onload(){this.logger.info("Setting up inbuilt Handlebars helpers");for(let r of Object.entries(Gd))zd.default.registerHelper(r[0],r[1]);this.logger.info("HandlebarsRenderer loaded")}async renderTemplate(r,i){var o;r.logLevel&&this.logger.setLogLevel(r.logLevel);let s=this.defaultTemplate;if(r.templateFile){let h=this.plugin.app.vault.getAbstractFileByPath(r.templateFile);s=await this.plugin.app.vault.cachedRead(h)}else r.template&&(s=(o=r.template)!=null?o:"");return this.logger.debug("rendering compiled template:",s),zd.default.compile(s)({result:i})}};var zk={jsonFiles:"",jsonLoaderSettingsOpen:!1},Cu=class extends Ca{constructor(){super(...arguments);this.logger=this.use(vr).getLogger("Qatt.JsonLoaderService");this.settingsTab=Cs(this);this.settings=ws(this,zk,async r=>{this.jsonLoaderSettingsOpen=r.jsonLoaderSettingsOpen,await this.settingsUpdateLoad(r.jsonFiles)},async r=>{this.jsonLoaderSettingsOpen=r.jsonLoaderSettingsOpen,await this.settingsInitialLoad(r.jsonFiles)});this.importCallback=async(r,i)=>JSON.parse(r)}showSettings(){let r=this.settingsTab,{settings:i}=this,s=async d=>{await i.update(p=>{p.jsonLoaderSettingsOpen=d})},a=r.addHeading(new ai({open:this.jsonLoaderSettingsOpen,text:"JSON Loader Settings",level:"h2",class:"settings-heading"}),s),o=async d=>{await i.update(p=>{p.jsonFiles=d})},h=r.addTextAreaInput(new pn({name:"JSON file to load on start",description:"Add the files you want added on load, one per line. The table name will be the name of the file minus the extension.",value:this.importFiles}),o,a)}};var Jk={markdownTableFiles:"",markdownLoaderSettingsOpen:!1},xu=class extends Ca{constructor(){super(...arguments);this.logger=this.use(vr).getLogger("Qatt.MarkdownTableLoaderService");this.settingsTab=Cs(this);this.settings=ws(thi
`)[s].split("|").filter(Boolean),o=[];this.logger.info(`getFirstLineNumberWithContent ${s}`,a);for(let h of r.split(`
`).slice(s+1)){if(h.trim().length===0||!h.trim().startsWith("|"))break;let d=h.split("|").filter(Boolean);if(d.length!==a.length){this.logger.error(`Table ${i} has a row with ${d.length} columns, but the header has ${a.length} columns.`);continue}if(d[0].trim().startsWith("-"))continue;let p={};for(let[v,S]of a.entries()){let C=d[v].trim();+C==+C?p[S.trim()]=+C:p[S.trim()]=C}o.push(p)}return o}}showSettings(){let r=this.settingsTab,{settings:i}=this,s=async d=>{await i.update(p=>{p.markdownLoaderSettingsOpen=d})},a=r.addHeading(new ai({open:this.markdownLoaderSettingsOpen,text:"Markdown Table Loader Settings",level:"h2",class:"settings-heading"}),s),o=async d=>{await i.update(p=>{p.markdownTableFiles=d})},h=r.addTextAreaInput(new pn({name:"Markdown file to load on start",description:"Add the files you want added on load, one per line. The table name will be the name of the file minus the extension. Only a markdown table should exist on the page.",value:this.importFiles}),o,a)}getFirstLineNumberWithContent(r){let i=r.split(`
`),s=0;for(let a of i){if(a.trim()!==""&&a.trim().startsWith("|"))return s;s++}return s}};var Co=class extends Nr{constructor(){super(...arguments);this.logger=this.use(vr).getLogger("Qatt.QueryFactory")}async onload(){this.logger.info("QueryFactory loaded")}async getQuery(r,i,s,a){switch(r.queryEngine){case"alasql":{let o=this.use.fork().use(Qo);return await o.setupQuery(r,i,s,a!=null?a:""),o}default:{let o=this.use.fork().use(Qo);return await o.setupQuery(r,i,s,a!=null?a:""),o}}}};var c8=require("obsidian");var a8=require("obsidian"),W3=class{constructor(t,r){this.codeBlockContent=t;this.defaultInternalQueryRenderChildVersion=r;var o,h;let i=(0,a8.parseYaml)(t!=null?t:"");this.originalCodeBlockContent=t,this.customJSForSql=i.customJSForSql,this.customJSForHandlebars=i.customJSForHandlebars,this.query=i.query,this.queryFile=i.queryFile,this.queryEngine=i.queryEngine,this.template=i.template,this.templateFile=i.templateFile,this.postRenderFormat=i.postRenderFormat,this.renderEngine=i.renderEngine,this.id=(o=i.id)!=null?o:this.generateCodeblockId(10);let s=["trace","debug","info","warn","error"];this.logLevel=s.includes(i.logLevel)?i.logLevel:void 0;let a=["never","once","onceDaily","onceDailyAppend","onceDailyPrepend","onceWeekly","always","alwaysappend","alwaysprepend"];this.replaceType=a.includes(i.replaceType)?i.replaceType:"never",i.replaceCodeBlock===void 0?this.replaceCodeBlock=!1:(i.replaceCodeBlock==="true"||i.replaceCodeBlock===!0)&&(this.replaceCodeBlock=!0),this.replaceTargetPath=i.replaceTargetPath,this.queryDataSource=this.getParsedQuerySource((h=this.query)!=null?h:"qatt"),this.internalQueryRenderChildVersion=i.internalQueryRenderChildVersion===void 0?r!=null?r:2:Number(i.internalQueryRenderChildVersion)}getParsedQuerySource(t){return/\bobsidian_markdown_notes\b/gi.test(t)||/\bobsidian_markdown_lists\b/gi.test(t)||/\bobsidian_markdown_tasks\b/gi.test(t)?"qatt":/\bobsidian_markdown_files\b/gi.test(t)?"obsidian":/\bdataview_pages\b/gi.test(t)||/\bdataview_tasks\b/gi.test(t)||/\bdataview_lists\b/gi.test(t)?"dataview":"qatt"}generateCodeblockId(t){let r="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890";return Array.from({length:t},()=>r[Math.floor(Math.random()*r.length)]).join("")}};var l1=require("obsidian");var j3=class extends Nr{constructor(){super(...arguments);this.defaultTemplate="";this.logger=this.use(vr).getLogger("Qatt.TextRenderer")}async renderTemplate(r,i){return this.logger.debug("rendering template is just JSON.stringify"),JSON.stringify(i)}};var xo=class extends Nr{constructor(){super(...arguments);this.logger=this.use(vr).getLogger("Qatt.RenderFactory")}async onload(){this.logger.info("RenderFactory loaded")}async getRenderer(r){switch(r.renderEngine){case"handlebars":return this.use(u1);case"text":return this.use(j3);default:return this.use(u1)}}};var o8=require("obsidian"),Fu=class{async renderMarkdown(t,r,i,s){return await o8.MarkdownPreviewView.renderMarkdown(t,r,i,s),r.innerHTML}};var Ou=class{async renderMarkdown(t,r,i,s){return r.innerHTML=t,t}};var Fo=class{async renderMarkdown(t,r,i,s){return r.textContent=t,t}};var u8=require("obsidian");var G3=zr(si());var z3=class extends Nr{constructor(){super(...arguments);this.plugin=this.use(u8.Plugin);this.logger=this.use(vr).getLogger("Qatt.RenderTrackerService");this.metrics=this.use(ks);this.pageReplacement={};this.minDate=ct.fromSeconds(0)}async setReplacementTime(r,i,s){if(console.log("setReplacementTime",[r,i,s]),await this.hasReplacementTime(r,i)){let a=await G3.default.promise("UPDATE qatt.RenderTracker SET time = ?, page = ?, id = ? WHERE path = ? AND id = ?",[s,r,i,r,i]);console.log("setReplacementTime UPDATE",a)}else{let a=await G3.default.promise("INSERT INTO qatt.RenderTracker VALUES ?",[{time:s,page:r,id:i}]);console.log("setReplacementTime INSERT",a)}}async updatedToday(r,i){if(await this.hasReplacementTime(r,i)){let s=await this.getReplacementTime(r,i);if(s&&s.year===ct.now().year&&s.month===ct.now().month&&s.day===ct.now().day)return!0}return!1}getReplacementDetails(){return`
${Object.entries(this.pageReplacement).map(([i,[s,a]])=>`${i}: ${s.toString()} - ${a}`).join(`
`)}
`}async hasReplacementTime(r,i){return await this.getReplacementTime(r,i)!==void 0}async getReplacementTime(r,i){console.log("getReplacementTime",[r,i]),console.log("getReplacementTime",`SELECT TOP 1 time FROM qatt.RenderTracker WHERE page = '${r}' AND id = '${i}'`);let s=await G3.default.promise(`SELECT TOP 1 time FROM qatt.RenderTracker WHERE page = '${r}' AND id = '${i}'`);if(console.log("getReplacementTime timeForPageAndId",s),s.length>0)return s[0].time}};var Yk={sqlFiles:"",sqlLoaderSettingsOpen:!1},Au=class extends Ca{constructor(){super(...arguments);this.logger=this.use(vr).getLogger("Qatt.SqlLoaderService");this.dataTables=this.use(fu);this.settingsTab=Cs(this);this.settings=ws(this,Yk,async r=>{this.sqlLoaderSettingsOpen=r.sqlLoaderSettingsOpen,await this.settingsUpdateLoad(r.sqlFiles)},async r=>{this.sqlLoaderSettingsOpen=r.sqlLoaderSettingsOpen,await this.settingsInitialLoad(r.sqlFiles)});this.importCallback=async(r,i)=>{var a;let s=await((a=this.dataTables)==null?void 0:a.runAdhocQuery(r));return this.logger.info("SQL query result",s),[]}}showSettings(){let r=this.settingsTab,{settings:i}=this,s=async d=>{await i.update(p=>{p.sqlLoaderSettingsOpen=d})},a=r.addHeading(new ai({open:this.sqlLoaderSettingsOpen,text:"SQL Loader Settings",level:"h2",class:"settings-heading"}),s),o=async d=>{await i.update(p=>{p.sqlFiles=d})},h=r.addTextAreaInput(new pn({name:"SQL file to load on start",description:'Add the files you want added on load, one per line. The SQL commands will be executed in order. Use a ";" to separate commands.',value:this.importFiles}),o,a)}};function l8(e,t=50,r={}){var S,C;let i,s=(S=r.isImmediate)!=null?S:!1,a=(C=r.callback)!=null?C:!1,o=r.maxWait,h=Date.now(),d=[];function p(){if(o!==void 0){let k=Date.now()-h;if(k+t>=o)return o-k}return t}let v=function(...k){let N=this;return new Promise((pe,Ne)=>{let me=function(){if(i=void 0,h=Date.now(),!s){let et=e.apply(N,k);a&&a(et),d.forEach(({resolve:te})=>te(et)),d=[]}},tt=s&&i===void 0;if(i!==void 0&&clearTimeout(i),i=setTimeout(me,p()),tt){let et=e.apply(N,k);return a&&a(et),pe(et)}d.push({resolve:pe,reject:Ne})})};return v.cancel=function(k){i!==void 0&&clearTimeout(i),d.forEach(({reject:N})=>N(k)),d=[]},v}var J3=class extends l1.MarkdownRenderChild{constructor(r,i,s,a,o=5e3){super(r);this.rendering=!1;this.startTime=new Date(Date.now());this.render=async()=>{var h,d,p,v,S,C,k,N,pe;if(this.logger.groupId(this.renderId),this.startTime=new Date(Date.now()),this.container.innerHTML="",!this.notesCacheService.allNotesLoaded||!((h=this.csvLoaderService)!=null&&h.initialImportCompleted)||!((d=this.markdownTableLoaderService)!=null&&d.initialImportCompleted)||!((p=this.jsonLoaderService)!=null&&p.initialImportCompleted)||!((v=this.sqlLoaderService)!=null&&v.initialImportCompleted)){this.logger.infoWithId(this.renderId,"Waiting for all notes to load");let Ne=this.container.createEl("div");Ne.setAttr("data-query-id",this.renderId),Ne.className="qatt-loader";return}let r=(S=this.codeblockConfiguration.postRenderFormat)!=null?S:this.service.postRenderFormat,i=(C=this.codeblockConfiguration.replaceCodeBlock)!=null?C:!1,s=(k=this.codeblockConfiguration.replaceType)!=null?k:"never",a=this.container.createEl("div");if(a.setAttr("data-query-id",this.renderId),this.codeblockConfiguration.logLevel==="debug"){let Ne=this.container.createEl("sub");Ne.className="qatt-render-debugWrapper",Ne.innerHTML=`RenderID: ${this.renderId}<br />`,a.prepend(Ne)}try{let Ne=this.context.frontmatter;this.file instanceof l1.TFile&&(Ne=(N=this.plugin.app.metadataCache.getFileCache(this.file))==null?void 0:N.frontmatter);let me=await this.queryFactory.getQuery(this.codeblockConfiguration,this.context.sourcePath,Ne,this.renderId);if(this.queryResults=await me.applyQuery(this.renderId),me.error){a.setText(`QATT query error: ${me.error}`),this.logQueryRenderCompletion();return}}catch(Ne){this.logger.error("Unknown Query Failure",Ne),this.logQueryRenderCompletion();return}let o=await this.renderFactory.getRenderer(this.codeblockConfiguration);try{this.renderResults=(pe=await(o==null?void
`);if(s==="onceDailyAppend"||s==="onceWeeklyAppend"||s==="alwaysAppend"){let kt=(O=this.codeblockConfiguration.id)!=null?O:"";return H.splice(ge+1,0,`%%${kt}%%
${tt}
%%${kt}%%`),H.join(`
`)}return H.splice(M,Oe+1,`${tt}`),H.join(`
`)}return`${te}`});return}this.logger.debugWithId(this.renderId,"update fragment");let et=document.createDocumentFragment();for(let te of Array.from(me.children))et.append(te);a.append(et)}catch(Ne){this.logger.error("Unknown Render Failure",Ne),this.logQueryRenderCompletion();return}this.logQueryRenderCompletion()};this.container=r,this.codeblockConfiguration=i,this.context=s,this.service=a,this.debounceWindow=o,this.plugin=a.use(l1.Plugin),this.logger=a.use(vr).getLogger("Qatt.QueryRenderChildV2"),this.queryFactory=a.use(Co),this.renderFactory=a.use(xo),this.notesCacheService=a.use(xa),this.renderTrackerService=a.use(z3),this.csvLoaderService=a.use(K1),this.markdownTableLoaderService=a.use(xu),this.jsonLoaderService=a.use(Cu),this.sqlLoaderService=a.use(Au)}async onload(){var i,s;this.renderId=`${(i=this.codeblockConfiguration.id)!=null?i:""}:${this.context.sourcePath}`;let r=this.plugin.app.vault.getAbstractFileByPath(this.context.sourcePath);r instanceof l1.TFile&&(this.file=r,this.codeblockConfiguration.logLevel&&this.logger.setLogLevel(this.codeblockConfiguration.logLevel),this.logger.infoWithId(this.renderId,`Query Render generated for class ${this.container.className} -> ${(s=this.codeblockConfiguration.queryDataSource)!=null?s:""}`),this.registerEvent(this.plugin.app.workspace.on("qatt:notes-store-update",async()=>{await this.debouncedRender()})),this.registerEvent(this.plugin.app.workspace.on("qatt:all-notes-loaded",async()=>{await this.debouncedRender()})),this.registerEvent(this.plugin.app.workspace.on("qatt:refresh-codeblocks",async()=>{await this.debouncedRender()})),this.codeblockConfiguration.queryDataSource==="dataview"&&this.registerEvent(this.plugin.app.workspace.on("qatt:dataview-store-update",async()=>{await this.debouncedRender()})),this.debouncedRender=l8(this.render,this.debounceWindow,{isImmediate:!0}),await this.debouncedRender())}onunload(){this.debouncedRender.cancel(),this.logger.infoWithId(this.renderId,`QueryRenderChild unloaded for ${this.renderId}`)}logQueryRenderCompletion(){let r=new Date(Date.now());this.logger.infoWithId(this.renderId,`Render End: ${r.getTime()-this.startTime.getTime()}ms`),this.logger.groupEndId()}getCodeBlockEndLine(r,i,s=1){let a=i+1,o=r.split(`
`);for(;a<o.length;){if(s>500)return-1;if(o[a].startsWith("```")&&o[a].length===3)return a;a++,s++}return a}async writeRenderedOutputToFile(r,i,s){this.logger.infoWithId(this.renderId,`writeRenderedOutputToFile: ${r}`);let a=this.getTargetFile(r),o="",h=window.moment();if(a&&s==="once"){this.logger.debugWithId(this.renderId,`The file '${r}' already exists and replacement is once only.`);return}if(a&&(o=await this.getCachedContent(a),h=window.moment(a.stat.mtime)),h.isAfter(window.moment().subtract(1,"day"))&&s==="onceDaily"){this.logger.debugWithId(this.renderId,`The file '${r}' was updated less than a day ago and replacement is onceDaily only.`);return}if(h.isAfter(window.moment().subtract(1,"week"))&&s==="onceWeekly"){this.logger.debugWithId(this.renderId,`The file '${r}' was updated less than a week ago and replacement is onceWeekly only.`);return}let d="";s.toLowerCase().includes("append")?d=o+i:s.toLowerCase().includes("prepend")?d=i+o:d=i,await(a?this.modifyFile(a,d):this.createFile(r,d))}async createFile(r,i){return await this.service.notesCacheService.ignoreFileEventsForPeriod(r,1e3),this.plugin.app.vault.create(r,i)}async modifyFile(r,i){return await this.service.notesCacheService.ignoreFileEventsForPeriod(r.path,1e3),this.plugin.app.vault.modify(r,i)}async getCachedContent(r){return this.plugin.app.vault.cachedRead(r)}getTargetFile(r){return r=r.replace(/\\/g,"/"),this.plugin.app.vault.getFiles().find(i=>i.path===r)}async getPostRenderFormat(r,i,s,a){let o;switch(r){case"markdown":{o=new Fu;break}case"micromark":{o=new ku;break}case"html":{o=new Ou;break}case"raw":{o=new Fo;break}default:{o=new Fo;break}}let h=await o.renderMarkdown(i,s,a,this.plugin);return{renderedContent:s,rawPostRenderResult:h}}};var Q3=require("obsidian");var Y3=class{constructor(t,r,i,s){this.container=t;this.codeblockConfiguration=r;this.context=i;this.service=s;this.rendering=!1;this.plugin=s.use(Q3.Plugin),this.logger=s.use(vr).getLogger("Qatt.QueryRenderChildV2"),this.queryFactory=s.use(Co),this.renderFactory=s.use(xo)}async create(t,r,i){var h,d,p,v;r.empty(),this.logger.infoWithId("Source:",t),this.renderId=`${this.codeblockConfiguration.id}:${i.sourcePath}`;let s=this.plugin.app.vault.getAbstractFileByPath(i.sourcePath);if(!(s instanceof Q3.TFile))return;this.file=s,this.codeblockConfiguration.logLevel&&this.logger.setLogLevel(this.codeblockConfiguration.logLevel),this.logger.infoWithId(this.renderId,`Query Render generated for class ${r.className} -> ${this.codeblockConfiguration.queryDataSource}`),this.logger.groupId(this.renderId);let a=new Date(Date.now());try{this.codeblockConfiguration.replaceTargetPath&&await this.service.notesCacheService.ignoreFileEventsForPeriod(this.codeblockConfiguration.replaceTargetPath,1e3);let S=r.createEl("div");if(S.setAttr("data-query-id",this.renderId),this.codeblockConfiguration.logLevel==="debug"){let M=r.createEl("sub");M.className="qatt-render-debugWrapper",M.innerHTML=`RenderID: ${this.renderId}<br />`,S.prepend(M)}let C=await this.queryFactory.getQuery(this.codeblockConfiguration,i.sourcePath,i.frontmatter,this.renderId),k=await C.applyQuery(this.renderId);if(C.error){S.setText(`QATT query error: ${C.error}`);let M=new Date(Date.now());this.logger.infoWithId(this.renderId,`Render End: ${M.getTime()-a.getTime()}ms`),this.logger.groupEndId();return}let N=await this.renderFactory.getRenderer(this.codeblockConfiguration),pe=(h=await(N==null?void 0:N.renderTemplate(this.codeblockConfiguration,k)))!=null?h:"Unknown error or exception has occurred.";this.logger.debug("Render Results:",pe);let Ne=(d=this.codeblockConfiguration.postRenderFormat)!=null?d:this.service.postRenderFormat;this.logger.debug("postRenderFormat: ",Ne);let me=document.createElement("span"),{renderedContent:tt,rawPostRenderResult:et}=await this.getPostRenderFormat(Ne,pe,me,i.sourcePath);this.logger.debug("postRenderResults:",tt.outerHTML),this.logger.debug("rawPostRenderResult:",et);let te=(p=this.codeblockConfiguration.replaceCodeBlock)!=null?p:!1;this.logger.debug("replaceCodeBlock:",te);let Ye=(v=this.codeblockConfiguratio
`);return bt.splice(Oe,kt+1,`${et}`),bt.join(`
`)}return`${M}`});return}let O=document.createDocumentFragment();for(let M of Array.from(tt.children))O.append(M);S.append(O)}catch(S){this.logger.error("Render Failure",S)}let o=new Date(Date.now());this.logger.infoWithId(this.renderId,`Render End: ${o.getTime()-a.getTime()}ms`),this.logger.groupEndId()}getCodeBlockEndLine(t,r,i=1){let s=r+1,a=t.split(`
`);for(;s<a.length;){if(i>500)return-1;if(a[s].startsWith("```")&&a[s].length===3)return s;s++,i++}return s}async writeRenderedOutputToFile(t,r,i){this.logger.infoWithId(this.renderId,`writeRenderedOutputToFile: ${t}`);let s=this.getTargetFile(t),a="",o=window.moment();if(s&&i==="once"){this.logger.debugWithId(this.renderId,`The file '${t}' already exists and replacement is once only.`);return}if(s&&(a=await this.getCachedContent(s),o=window.moment(s.stat.mtime)),o.isAfter(window.moment().subtract(1,"day"))&&i==="onceDaily"){this.logger.debugWithId(this.renderId,`The file '${t}' was updated less than a day ago and replacement is onceDaily only.`);return}if(o.isAfter(window.moment().subtract(1,"week"))&&i==="onceWeekly"){this.logger.debugWithId(this.renderId,`The file '${t}' was updated less than a week ago and replacement is onceWeekly only.`);return}let h="";i.toLowerCase().includes("append")?h=a+r:i.toLowerCase().includes("prepend")?h=r+a:h=r,await(s?this.modifyFile(s,h):this.createFile(t,h))}async createFile(t,r){return await this.service.notesCacheService.ignoreFileEventsForPeriod(t,1e3),this.plugin.app.vault.create(t,r)}async modifyFile(t,r){return await this.service.notesCacheService.ignoreFileEventsForPeriod(t.path,1e3),this.plugin.app.vault.modify(t,r)}async getCachedContent(t){return this.plugin.app.vault.cachedRead(t)}getTargetFile(t){return t=t.replace(/\\/g,"/"),this.plugin.app.vault.getFiles().find(r=>r.path===t)}async getPostRenderFormat(t,r,i,s){let a;switch(t){case"markdown":{a=new Fu;break}case"micromark":{a=new ku;break}case"html":{a=new Ou;break}case"raw":{a=new Fo;break}default:{a=new Fo;break}}let o=await a.renderMarkdown(r,i,s,this.plugin);return{renderedContent:i,rawPostRenderResult:o}}};var ra=require("obsidian"),Z3=class extends ra.Modal{constructor(r,i,s,a,o){super(r);this.plugin=i,this.app=r,this.codeblockConfiguration=s,this.ctx=a,this.el=o}onOpen(){this.display()}display(){let{contentEl:r}=this;r.empty(),r.addEventListener("keydown",h=>{h.key==="Enter"&&this.close()}),r.createEl("h2",{text:"Query and Render Configuration"}),r.createEl("strong",{text:"Query"});let i=10,s=55,a=new ra.Setting(r).addTextArea(h=>{var d;h.setValue((d=this.codeblockConfiguration.query)!=null?d:"").onChange(async p=>{this.codeblockConfiguration.query=p,this.display(),await this.updateCodeblockConfiguration(this.plugin,this.ctx,this.el,this.codeblockConfiguration)}),h.inputEl.rows=i,h.inputEl.cols=s,h.inputEl.wrap="off",h.inputEl.style.fontFamily="monospace"});a.infoEl.remove(),a.controlEl.style.flex="",a.controlEl.style.display="block",r.createEl("strong",{text:"Render Template"});let o=new ra.Setting(r).addTextArea(h=>{var d;h.setValue((d=this.codeblockConfiguration.template)!=null?d:"").onChange(async p=>{this.codeblockConfiguration.query=p,this.display(),await this.updateCodeblockConfiguration(this.plugin,this.ctx,this.el,this.codeblockConfiguration)}),h.inputEl.rows=i,h.inputEl.cols=s,h.inputEl.wrap="off",h.inputEl.style.fontFamily="monospace"});o.infoEl.remove(),o.controlEl.style.flex="",o.controlEl.style.display="block",new ra.Setting(r).setName("Replace Codeblock?").setDesc("If set to true, the codeblock will be replaced with the render result. If set to false, the render result will replace the codeblock").addToggle(h=>h.setValue(this.codeblockConfiguration.replaceCodeBlock).onChange(async d=>{this.codeblockConfiguration.replaceCodeBlock=d,this.display()})),new ra.Setting(r).setName("Log Level").setDesc("'info' by default, det to 'debug' to see more detailed logs'").addText(h=>{var d;return h.setValue((d=this.codeblockConfiguration.logLevel)!=null?d:"info").onChange(async p=>{this.codeblockConfiguration.logLevel=p})}),new ra.Setting(r).addButton(h=>h.setButtonText("Save").setCta().onClick(async()=>{await this.updateCodeblockConfiguration(this.plugin,this.ctx,this.el,this.codeblockConfiguration),this.close()}))}onClose(){let{contentEl:r}=this;r.empty()}async updateCodeblockConfiguration(r,i,s,a){let o=r.app.vault.getAbstractFileByPath(i.sourcePath);if(!(o instanceof ra.TFile))return;delete a.originalCodeBlock
`)||(h+=`
`),p){let{lineStart:v}=p,S=this.getCodeBlockEndLine(d,v);if(S===-1||!S)return d;let C=S-v,k=d.split(`
`);return k.splice(v,C+1,`\`\`\`qatt
${h}\`\`\``),k.join(`
`)}return`\`\`\`qatt
${h}\`\`\``})}getCodeBlockEndLine(r,i,s=1){let a=i+1,o=r.split(`
`);for(;a<o.length;){if(s>500)return-1;if(o[a].startsWith("```"))return a;a++,s++}return a}};var Qk={postRenderFormat:"markdown",enableExperimentalRender:!1,renderingSettingsOpen:!1,internalQueryRenderChildVersion:2,enableCodeBlockEditor:!0,queryFileRoot:"",templateFileRoot:"",debounceWindow:5e3},K3=class extends Nr{constructor(){super();this.plugin=this.use(c8.Plugin);this.logger=this.use(vr).getLogger("Qatt.QueryRendererV2Service");this.notesCacheService=this.use(xa);this.settingsTab=Cs(this);this.settings=ws(this,Qk,r=>{var i,s,a;this.logger.info("QueryRendererV2Service Updated Settings"),this.postRenderFormat=(i=r.postRenderFormat)!=null?i:"markdown",this.renderingSettingsOpen=r.renderingSettingsOpen,this.internalQueryRenderChildVersion=r.internalQueryRenderChildVersion,this.enableCodeBlockEditor=r.enableCodeBlockEditor,this.queryFileRoot=(s=r.queryFileRoot)!=null?s:"",this.templateFileRoot=(a=r.templateFileRoot)!=null?a:"",this.debounceWindow=r.debounceWindow},r=>{var i,s,a;this.logger.info("QueryRendererV2Service Initialize Settings"),this.postRenderFormat=(i=r.postRenderFormat)!=null?i:"markdown",this.renderingSettingsOpen=r.renderingSettingsOpen,this.internalQueryRenderChildVersion=r.internalQueryRenderChildVersion,this.enableCodeBlockEditor=r.enableCodeBlockEditor,this.queryFileRoot=(s=r.queryFileRoot)!=null?s:"",this.templateFileRoot=(a=r.templateFileRoot)!=null?a:"",this.debounceWindow=r.debounceWindow});this.postRenderFormat="markdown";this.internalQueryRenderChildVersion=2;this.enableCodeBlockEditor=!1;this.queryFileRoot="";this.templateFileRoot="";this.debounceWindow=5e3;this.lastCreation=ct.now()}showSettings(){let r=this.settingsTab,{settings:i}=this,s=r.addHeading(new ai({open:this.renderingSettingsOpen,text:"Codeblock Rendering Settings",level:"h2",class:"settings-heading"}),async S=>{await i.update(C=>{C.renderingSettingsOpen=S})}),a=r.addDropdownInput(new pn({name:"Default Post Render Format",description:"Once the template has finished rendering the final output needs to be HTML. If the template returns markdown then it needs to be converted, this settings allows you to select the default processor so you do not have to set it in each codeblock.",placeholder:{markdown:"Obsidian Markdown",micromark:"Micromark",none:"None"},value:this.postRenderFormat}),async S=>{await i.update(C=>{C.postRenderFormat=S})},s),o=r.addTextInput(new pn({name:"Query File Root",description:"The root directory for the query files. This is the directory where the query files are stored. If this is not set the path must be relative to the root of the vault.",value:this.queryFileRoot}),async S=>{await i.update(C=>{C.queryFileRoot=S})},s),h=r.addTextInput(new pn({name:"Template File Root",description:"The root directory for the template files. This is the directory where the template files are stored. If this is not set the path must be relative to the root of the vault.",value:this.templateFileRoot}),async S=>{await i.update(C=>{C.templateFileRoot=S})},s),d=r.addTextInput(new pn({name:"Debounce Window",description:"The time to wait until queries will run while a user is updating the vault.",value:this.debounceWindow.toString()}),async S=>{await i.update(C=>{C.debounceWindow=Number.parseInt(S,10)})},s),p=r.addDropdownInput(new pn({name:"\u{1F9EA} Default Internal Query Render Child Version",description:"This allows use of an alternative way to render the results in Obsidian using a different method. This is experimental and may not work as expected.",placeholder:{2:"As child of MarkdownPostProcessorContext",3:"Independent container update"},value:this.internalQueryRenderChildVersion}),async S=>{await i.update(C=>{C.internalQueryRenderChildVersion=S})},s),v=r.addToggle(new pn({name:"\u{1F9EA} Enable Code Block Editor",description:"This will enable a button on the code block to allow you to edit the settings for the block. This is experimental and may not work as expected.",value:this.enableCodeBlockEditor}),async S=>{await i.update(C=>{C.enableCodeBlockEditor=S})},s)}async onload(){this.plugin.registerMarkdownCodeBlockProcessor("q
`);for(let i=0;i<r.length;i++)r[i].startsWith("#")&&(r[i]="#".repeat(t)+r[i]);return r.join(`
`)}var eh=class extends Iu.Modal{constructor(r,i){super(app);if(this.previousVersion=r,(r===void 0||r==="")&&(this.previousVersion="0.0.0"),this.releases=i.getChangesSince(this.previousVersion),this.releases.length===0){this.close();return}this.display()}onOpen(){let{contentEl:r}=this;r.empty()}onClose(){let{contentEl:r}=this;r.empty()}display(){if(this.releases.length===0){this.close();return}let{contentEl:r}=this;r.empty(),r.classList.add("qatt-update-modal-container");let i=this.releases.map(o=>`## Release v${o.version}
${o.body}`).join(`
---
`),s=`
### New in Query All the Things v${this.releases[0].version} \u{1F389}
Thank you for using Query All the Things! I hope you're enjoying it.
I'm always looking for ways to improve the plugin, so if you have any feedback, please let me know by creating an <a href="https://github.com/sytone/obsidian-queryallthethings/issues">issue</a>.
You can download the documentation and example vault to open in obsidian to see the queries in action <A href="https://github.com/sytone/obsidian-queryallthethings/releases/latest/download/obsidian-queryallthethings.vault.zip">here</a>.
And now, here is everything new in Query All the Things since your last update (v${this.previousVersion}).
*You can disable these announcements in the plugin settings under General*
---
${Zk(i)}
`,a=r.createDiv("qatt-update-modal");Iu.MarkdownRenderer.renderMarkdown(s,a,app.vault.getRoot().path,new Iu.Component)}};var rh=require("obsidian");var th=class extends Nr{constructor(){super(...arguments);this.plugin=this.use(rh.Plugin);this.logger=this.use(vr).getLogger("Qatt.EventHandler");this.debouncePeriod=1e3;this.debouncedRefresh=()=>null}setup(){this.updateRefreshSettings(),this.updateCreationEvent(),this.updateDeletionEvent(),this.updateModificationEvent(),this.updateRenameEvent()}updateCreationEvent(){this.creationEvent=this.plugin.app.vault.on("create",()=>{this.debouncedRefresh()}),this.plugin.registerEvent(this.creationEvent)}updateDeletionEvent(){this.deletionEvent=this.plugin.app.vault.on("delete",()=>{this.debouncedRefresh()}),this.plugin.registerEvent(this.deletionEvent)}updateModificationEvent(){this.modificationEvent=this.plugin.app.vault.on("modify",()=>{this.debouncedRefresh()}),this.plugin.registerEvent(this.modificationEvent)}updateRenameEvent(){this.renameEvent=this.plugin.app.vault.on("rename",()=>{this.debouncedRefresh()}),this.plugin.registerEvent(this.renameEvent)}updateRefreshSettings(){this.debouncedRefresh=(0,rh.debounce)(()=>{},this.debouncePeriod,!0)}};function f8(e,t){let r={"Capitalize the first letter of the string":"{{capitalize 'replace with property'}}","Start markdown code block with optional type":"{{codeBlockHeader 'text'}}","End markdown code block":"{{codeBlockFooter}}"},i={"Reverse characters in a string":"REVERSE ( basename )","Join array with optional separator":"JoinArray ( dataArray [ , separator ] )"},s={"Get 5 most recently changed notes":`
\`\`\`qatt
query: |
SELECT TOP 5 * FROM obsidian_notes ORDER BY modified DESC
template: |
{{#each result}}
[[{{basename}}]] - Last Updated: {{formatDate modified}}
{{/each}}
\`\`\``};e.addSeparator(),e.addItem(a=>{a.setTitle("QATT: Handlebars Helpers"),a.setIcon("layout-template");let o=a.setSubmenu();for(let[h,d]of Object.entries(r))o.addItem(p=>{p.setTitle(h),p.onClick(()=>{Jd(t,d)})})}),e.addItem(a=>{a.setTitle("QATT: SQL Functions"),a.setIcon("search");let o=a.setSubmenu();for(let[h,d]of Object.entries(i))o.addItem(p=>{p.setTitle(h),p.onClick(()=>{Jd(t,d)})})}),e.addItem(a=>{a.setTitle("QATT: Example Queries"),a.setIcon("gift");let o=a.setSubmenu();for(let[h,d]of Object.entries(s))o.addItem(p=>{p.setTitle(h),p.onClick(()=>{Jd(t,d)})})})}function Jd(e,t){e.replaceSelection(t)}var Yd=class{constructor(t,r){this.markdownFile=t;this.metadata=r}},nh=class extends y2.Plugin{constructor(){super(...arguments);this.use=Ka.plugin(this);this.loggingService=this.use(vr);this.logger=this.loggingService.getLogger("Qatt");this.metrics=this.use(ks);this.dataTables=this.use(fu);this.commandHandler=this.use(kc);this.eventHandler=this.use(th);this.releaseNotes=this.use(X3);this.windowFunctions=this.use(Z1);this.coreSystemInitialized=!1;this.layoutReady=!1;this.settingsTab=Cs(this);this.settings=ws(this,{onStartSqlQueries:`CREATE TABLE my_lookup(name,birthday);
INSERT INTO my_lookup VALUES ("fred", 2000-02-03);`,announceUpdates:!1,version:"",mainHeadingOpen:!0,generalHeadingOpen:!1,internalLoggingConsoleLogLimit:10,disableDataviewMissingNotification:!1,disableCustomJsMissingNotification:!1,enableEditorRightClickMenu:!0},async r=>{this.logger.info("Settings Updated",r),this.onStartSqlQueries=r.onStartSqlQueries,this.announceUpdates=r.announceUpdates,this.version=r.version,this.mainHeadingOpen=r.mainHeadingOpen,this.generalHeadingOpen=r.generalHeadingOpen,this.internalLoggingConsoleLogLimit=r.internalLoggingConsoleLogLimit,this.enableEditorRightClickMenu=r.enableEditorRightClickMenu,this.commandHandler.setup(r.internalLoggingConsoleLogLimit)},async r=>{if(this.logger.info("Settings Initialize",r),this.onStartSqlQueries=r.onStartSqlQueries,this.announceUpdates=r.announceUpdates,this.version=r.version,this.mainHeadingOpen=r.mainHeadingOpen,this.generalHeadingOpen=r.generalHeadingOpen,this.internalLoggingConsoleLogLimit=r.internalLoggingConsoleLogLimit,this.enableEditorRightClickMenu=r.enableEditorRightClickMenu,this.commandHandler.setup(r.internalLoggingConsoleLogLimit),await this.dataTables.setupLocalDatabase(),!app.plugins.enabledPlugins.has("dataview")&&!r.disableDataviewMissingNotification){let i=new y2.Notice("Dataview plugin is not installed. Dataview backed tables will be empty.")}if(!app.plugins.enabledPlugins.has("customjs")&&!r.disableCustomJsMissingNotification){let i=new y2.Notice("CustomJS plugin is not installed. Referencing custom scripts in your query blocks will not work.")}this.announceUpdate()});this.mainHeadingOpen=!0;this.enableEditorRightClickMenu=!0}showSettings(){var C,k;let r=this.settingsTab,{settings:i}=this;this.logger.info("Settings Updated",i),r.initializeTab();let s=`
<div>
<br />
<div align="center">
Query All the Things is a flexible way to query and render data in <a href="https://obsidian.md">Obsidian</a> and from other Obsidian plugins. For help on using the plugin please reference the online documentation <a href='https://sytone.github.io/obsidian-queryallthethings/' target='_blank'>here</a>.
<br />
<br />
<a href='https://github.com/sytone/obsidian-queryallthethings/releases/latest'><img src='https://img.shields.io/github/manifest-json/v/sytone/obsidian-queryallthethings?color=blue'></a>
<a href='https://github.com/sytone/obsidian-queryallthethings/releases/latest'><img src='https://img.shields.io/github/release-date/sytone/obsidian-queryallthethings'></a>
<a href='https://github.com/sytone/obsidian-queryallthethings/blob/main/LICENSE'><img src='https://img.shields.io/github/license/sytone/obsidian-queryallthethings'></a>
<a href='https://github.com/sytone/obsidian-queryallthethings'><img src='https://img.shields.io/github/downloads/sytone/obsidian-queryallthethings/total'></a>
<a href='https://github.com/sytone/obsidian-queryallthethings/issues'><img src='https://img.shields.io/github/issues/sytone/obsidian-queryallthethings'></a>
</div>
<br />
Some settings are experimental, these are indicated by a \u{1F9EA} at the start of the name.
</div>
`,a=async N=>{await i.update(pe=>{pe.mainHeadingOpen=N})};r.addHeading(new ai({open:this.mainHeadingOpen,text:`Query All The Things (v${this.manifest.version})`,level:"h1",noticeHtml:s}),a);let o=async N=>{await i.update(pe=>{pe.generalHeadingOpen=N})},h=r.addHeading(new ai({open:this.generalHeadingOpen,text:"General Settings",level:"h2",class:"settings-heading"}),o),d=async N=>{await i.update(pe=>{pe.onStartSqlQueries=N})},p=r.addTextAreaInput(new pn({name:"On Start SQL Queries",description:"If you want to create tables and set data so your queries can use it at a later time without having to duplicate the queries enter them here. These will be executed when the plugin is loaded after the data tables have been initialized.",value:this.onStartSqlQueries}),d,h),v=r.addToggle(new pn({name:"Announce Updates",description:"If you want to see a notification when the plugin is updated.",value:this.announceUpdates}),async N=>{await i.update(pe=>{pe.announceUpdates=N})},h),S=r.addTextInput(new pn({name:"Console Logging Limit",description:"The number of rows to show when dumping the internal logging to the console.",value:this.internalLoggingConsoleLogLimit}),async N=>{await i.update(pe=>{pe.internalLoggingConsoleLogLimit=N})},h);r.addToggle(new pn({name:"Disable Dataview Missing Notification",description:"Disables the Dataview plugin missing notification.",value:(C=i.current)==null?void 0:C.disableDataviewMissingNotification}),async N=>{await i.update(pe=>{pe.disableDataviewMissingNotification=N})},h),r.addToggle(new pn({name:"Disable CustomJS Missing Notification",description:"Disables the CustomJS plugin missing notification.",value:(k=i.current)==null?void 0:k.disableCustomJsMissingNotification}),async N=>{await i.update(pe=>{pe.disableCustomJsMissingNotification=N})},h)}async onload(){this.metrics.startMeasurement("plugin onload"),this.logger.info(`loading plugin "${this.manifest.name}" v${this.manifest.version}`),this.logger.debug(`debug level enabled "${this.manifest.name}" v${this.manifest.version}`),this.use(Co).load(),this.use(xo).load(),this.use(u1).load(),this.use(to).load(),xc("_qatt.ui.promptWithSuggestions",p6),this.registerEvent(this.app.workspace.on("qatt:data-local-database-setup-completed",async()=>{this.logger.info("qatt:data-local-database-setup-completed event detected.");let r=setInterval(async()=>{this.layoutReady&&(clearInterval(r),this.logger.info("Layout is ready, starting core setup."),await this.initializeCoreServices())},500),i=setInterval(async()=>{this.layoutReady&&this.coreSystemInitialized&&(clearInterval(i),this.logger.info("Layout is ready, starting cache loading."),this.metrics.startMeasurement("NotesCacheService Use"),this.notesCacheService=this.use(xa),this.metrics.endMeasurement("NotesCacheService Use"),await this.notesCacheService.layoutReady(),await this.notesCacheService.cacheAllNotes(this.app))},500)})),this.registerEvent(this.app.workspace.on("qatt:all-notes-loaded",async()=>{this.logger.info("qatt:all-notes-loaded event detected."),this.initializeSqlLoaderService()})),this.app.workspace.onLayoutReady(async()=>{this.logger.info(`onLayoutReady fired for workspace: ${this.app.vault.getName()}`),this.layoutReady=!0,this.use(to).dataViewEnabled&&(this.registerEvent(this.app.metadataCache.on("dataview:index-ready",async()=>{this.logger.info("dataview:index-ready event detected."),await this.dataTables.refreshTables("dataview:index-ready event detected")})),this.registerEvent(this.app.workspace.on("dataview:refresh-views",async()=>{this.logger.info("dataview:refresh-views event detected."),await this.dataTables.refreshTables("dataview:refresh-views event detected")}))),this.logger.info(`onLayoutReady completed for workspace: ${this.app.vault.getName()}`)}),this.addRibbonIcon("refresh-cw","Refresh QATT Tables",async r=>{this.logger.info(`Refresh QATT Tables: ${r.button}`),await this.dataTables.refreshTables("manual refresh")}),this.addRibbonIcon("list-restart","Refresh Views",async r=>{this.logger.info(`Refresh all Views: ${r.button}`),this.app.workspace.trigger("qatt:all-notes-loaded")}),thi
/*! Bundled license information:
alasql/dist/alasql.min.js:
(*! AlaSQL v4.5.0 build: develop-85c24d42 | © 2014-2024 Andrey Gershun & Mathias Wulff | License: MIT *)
(*
@module alasql
@version 4.5.0
AlaSQL - JavaScript SQL database
© 2014-2024 Andrey Gershun & Mathias Wulff
@license
The MIT License (MIT)
Copyright 2014-2024 Andrey Gershun (agershun@gmail.com) & Mathias Wulff (m@rawu.dk)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*)
(*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js *)
papaparse/papaparse.min.js:
(* @license
Papa Parse
v5.4.1
https://github.com/mholt/PapaParse
License: MIT
*)
*/