1
0
Fork 0
EdikoyoWiki-Ategon/Edikoyo/.obsidian/plugins/dataview-serializer/main.js

31 lines
130 KiB
JavaScript
Raw Permalink Normal View History

2024-09-07 03:01:42 +00:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
"use strict";var Js=Object.create;var zt=Object.defineProperty;var Ks=Object.getOwnPropertyDescriptor;var Xs=Object.getOwnPropertyNames;var ei=Object.getPrototypeOf,ti=Object.prototype.hasOwnProperty;var ri=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ni=(t,e)=>{for(var r in e)zt(t,r,{get:e[r],enumerable:!0})},Mn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of Xs(e))!ti.call(t,u)&&u!==r&&zt(t,u,{get:()=>e[u],enumerable:!(n=Ks(e,u))||n.enumerable});return t};var An=(t,e,r)=>(r=t!=null?Js(ei(t)):{},Mn(e||!t||!t.__esModule?zt(r,"default",{value:t,enumerable:!0}):r,t)),ui=t=>Mn(zt({},"__esModule",{value:!0}),t);var _s=ri(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});require("obsidian");var ve=class extends Error{},jr=class extends ve{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},Zr=class extends ve{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},qr=class extends ve{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},Ze=class extends ve{},ar=class extends ve{constructor(e){super(`Invalid unit ${e}`)}},H=class extends ve{},pe=class extends ve{constructor(){super("Zone is an abstract class")}},E="numeric",fe="short",ee="long",or={year:E,month:E,day:E},_u={year:E,month:fe,day:E},Ei={year:E,month:fe,day:E,weekday:fe},Mu={year:E,month:ee,day:E},Au={year:E,month:ee,day:E,weekday:ee},ku={hour:E,minute:E},Bu={hour:E,minute:E,second:E},Nu={hour:E,minute:E,second:E,timeZoneName:fe},Iu={hour:E,minute:E,second:E,timeZoneName:ee},Lu={hour:E,minute:E,hourCycle:"h23"},Pu={hour:E,minute:E,second:E,hourCycle:"h23"},Ru={hour:E,minute:E,second:E,hourCycle:"h23",timeZoneName:fe},Uu={hour:E,minute:E,second:E,hourCycle:"h23",timeZoneName:ee},zu={year:E,month:E,day:E,hour:E,minute:E},Vu={year:E,month:E,day:E,hour:E,minute:E,second:E},$u={year:E,month:fe,day:E,hour:E,minute:E},Wu={year:E,month:fe,day:E,hour:E,minute:E,second:E},Ci={year:E,month:fe,day:E,weekday:fe,hour:E,minute:E},ju={year:E,month:ee,day:E,hour:E,minute:E,timeZoneName:fe},Zu={year:E,month:ee,day:E,hour:E,minute:E,second:E,timeZoneName:fe},qu={year:E,month:ee,day:E,weekday:ee,hour:E,minute:E,timeZoneName:ee},Hu={year:E,month:ee,day:E,weekday:ee,hour:E,minute:E,second:E,timeZoneName:ee},Ye=class{get type(){throw new pe}get name(){throw new pe}get ianaName(){return this.name}get isUniversal(){throw new pe}offsetName(e,r){throw new pe}formatOffset(e,r){throw new pe}offset(e){throw new pe}equals(e){throw new pe}get isValid(){throw new pe}},Lr=null,lr=class t extends Ye{static get instance(){return Lr===null&&(Lr=new t),Lr}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Gu(e,r,n)}formatOffset(e,r){return Tt(this.offset(e),r)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}},sr={};function wi(t){return sr[t]||(sr[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),sr[t]}var bi={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function vi(t,e){let r=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r),[,u,s,i,l,f,d,g]=n;return[i,u,s,l,f,d,g]}function Ti(t,e){let r=t.formatToParts(e),n=[];for(let u=0;u<r.length;u++){let{type:s,value:i}=r[u],l=bi[s];s==="era"?n[l]=i:A(l)||(n[l]=parseInt(i,10))}return n}var Xt={},ke=class t extends Ye{static create(e){return Xt[e]||(Xt[e]=new t(e)),Xt[e]}static resetCache(){Xt={},sr={}}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=t.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:r,locale:n}){return Gu(e,r,n,this.name)}formatOffset(e,r){return Tt(this.offset(e),r)}offset(e){let r=new Date(e);
`||a.charAt(y)==="\r"&&a.charAt(y+1)!==`
`)&&(p++,F===0&&(F=y+1)),y--}var S=h+p,N=c-F;return D[c]={line:S,lineStart:F},{offset:c,line:S+1,column:N+1}}function ge(a){if(!m(a))throw new Error("not a parser: "+a)}function Ne(a,c){return typeof a=="string"?a.charAt(c):a[c]}function he(a){if(typeof a!="number")throw new Error("not a number: "+a)}function se(a){if(typeof a!="function")throw new Error("not a function: "+a)}function Se(a){if(typeof a!="string")throw new Error("not a string: "+a)}var At=2,ht=3,ie=8,kt=5*ie,ae=4*ie,Oe=" ";function Bt(a,c){return new Array(c+1).join(a)}function Nt(a,c,D){var h=c-a.length;return h<=0?a:Bt(D,h)+a}function En(a,c,D,h){return{from:a-c>0?a-c:0,to:a+D>h?h:a+D}}function zs(a,c){var D,h,p,F,y,S=c.index,N=S.offset,Z=1;if(N===a.length)return"Got the end of the input";if(z(a)){var W=N-N%ie,Ce=N-W,G=En(W,kt,ae+ie,a.length),we=d(function($){return d(function(Je){return Nt(Je.toString(16),2,"0")},$)},function($,Je){var Ke=$.length,Pe=[],Xe=0;if(Ke<=Je)return[$.slice()];for(var et=0;et<Ke;et++)Pe[Xe]||Pe.push([]),Pe[Xe].push($[et]),(et+1)%Je==0&&Xe++;return Pe}(a.slice(G.from,G.to).toJSON().data,ie));F=function($){return $.from===0&&$.to===1?{from:$.from,to:$.to}:{from:$.from/ie,to:Math.floor($.to/ie)}}(G),h=W/ie,D=3*Ce,Ce>=4&&(D+=1),Z=2,p=d(function($){return $.length<=4?$.join(" "):$.slice(0,4).join(" ")+" "+$.slice(4).join(" ")},we),(y=(8*(F.to>0?F.to-1:F.to)).toString(16).length)<2&&(y=2)}else{var Qe=a.split(/\r\n|[\n\r\u2028\u2029]/);D=S.column-1,h=S.line-1,F=En(h,At,ht,Qe.length),p=Qe.slice(F.from,F.to),y=F.to.toString().length}var Qs=h-F.from;return z(a)&&(y=(8*(F.to>0?F.to-1:F.to)).toString(16).length)<2&&(y=2),f(function($,Je,Ke){var Pe,Xe=Ke===Qs,et=Xe?"> ":Oe;return Pe=z(a)?Nt((8*(F.from+Ke)).toString(16),y,"0"):Nt((F.from+Ke+1).toString(),y," "),[].concat($,[et+Pe+" | "+Je],Xe?[Oe+Bt(" ",y)+" | "+Nt("",D," ")+Bt("^",Z)]:[])},[],p).join(`
`)}function Cn(a,c){return[`
`,"-- PARSING FAILED "+Bt("-",50),`
`,zs(a,c),`
`,(D=c.expected,D.length===1?`Expected:
`+D[0]:`Expected one of the following:
`+D.join(", ")),`
`].join("");var D}function wn(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 It(){for(var a=[].slice.call(arguments),c=a.length,D=0;D<c;D+=1)ge(a[D]);return s(function(h,p){for(var F,y=new Array(c),S=0;S<c;S+=1){if(!(F=B(a[S]._(h,p),F)).status)return F;y[S]=F.value,p=F.index}return B(w(p,y),F)})}function Ie(){var a=[].slice.call(arguments);if(a.length===0)throw new Error("seqMap needs at least one argument");var c=a.pop();return se(c),It.apply(null,a).map(function(D){return c.apply(null,D)})}function Lt(){var a=[].slice.call(arguments),c=a.length;if(c===0)return Pt("zero alternates");for(var D=0;D<c;D+=1)ge(a[D]);return s(function(h,p){for(var F,y=0;y<a.length;y+=1)if((F=B(a[y]._(h,p),F)).status)return F;return F})}function bn(a,c){return wr(a,c).or(Le([]))}function wr(a,c){return ge(a),ge(c),Ie(a,c.then(a).many(),function(D,h){return[D].concat(h)})}function mt(a){Se(a);var c="'"+a+"'";return s(function(D,h){var p=h+a.length,F=D.slice(h,p);return F===a?w(p,F):O(h,c)})}function Ee(a,c){(function(p){if(!(p instanceof RegExp))throw new Error("not a regexp: "+p);for(var F=wn(p),y=0;y<F.length;y++){var S=F.charAt(y);if(S!=="i"&&S!=="m"&&S!=="u"&&S!=="s")throw new Error('unsupported regexp flag "'+S+'": '+p)}})(a),arguments.length>=2?he(c):c=0;var D=function(p){return RegExp("^(?:"+p.source+")",wn(p))}(a),h=""+a;return s(function(p,F){var y=D.exec(p.slice(F));if(y){if(0<=c&&c<=y.length){var S=y[0],N=y[c];return w(F+S.length,N)}return O(F,"valid match group (0 to "+y.length+") in "+h)}return O(F,h)})}function Le(a){return s(function(c,D){return w(D,a)})}function Pt(a){return s(function(c,D){return O(D,a)})}function Rt(a){if(m(a))return s(function(c,D){var h=a._(c,D);return h.index=D,h.value="",h});if(typeof a=="string")return Rt(mt(a));if(a instanceof RegExp)return Rt(Ee(a));throw new Error("not a string, regexp, or parser: "+a)}function vn(a){return ge(a),s(function(c,D){var h=a._(c,D),p=c.slice(D,h.index);return h.status?O(D,'not "'+p+'"'):w(D,null)})}function Ut(a){return se(a),s(function(c,D){var h=Ne(c,D);return D<c.length&&a(h)?w(D+1,h):O(D,"a character/byte matching "+a)})}function Tn(a,c){arguments.length<2&&(c=a,a=void 0);var D=s(function(h,p){return D._=c()._,D._(h,p)});return a?D.desc(a):D}function br(){return Pt("fantasy-land/empty")}i.parse=function(a){if(typeof a!="string"&&!z(a))throw new Error(".parse must be called with a string or Buffer as its argument");var c,D=this.skip(vr)._(a,0);return c=D.status?{status:!0,value:D.value}:{status:!1,index:dt(a,D.furthest),expected:D.expected},delete ue[a],c},i.tryParse=function(a){var c=this.parse(a);if(c.status)return c.value;var D=Cn(a,c),h=new Error(D);throw h.type="ParsimmonError",h.result=c,h},i.assert=function(a,c){return this.chain(function(D){return a(D)?Le(D):Pt(c)})},i.or=function(a){return Lt(this,a)},i.trim=function(a){return this.wrap(a,a)},i.wrap=function(a,c){return Ie(a,this,c,function(D,h){return h})},i.thru=function(a){return a(this)},i.then=function(a){return ge(a),It(this,a).map(function(c){return c[1]})},i.many=function(){var a=this;return s(function(c,D){for(var h=[],p=void 0;;){if(!(p=B(a._(c,D),p)).status)return B(w(D,h),p);if(D===p.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");D=p.index,h.push(p.value)}})},i.tieWith=function(a){return Se(a),this.map(function(c){if(function(p){if(!_(p))throw new Error("not an array: "+p)}(c),c.length){Se(c[0]);for(var D=c[0],h=1;h<c.length;h++)Se(c[h]),D+=a+c[h];return D}return""})},i.tie=function(){return this.tieWith("")},i.times=function(a,c){var D=this;return arguments.length<2&&(c=a),he(a),he(c),s(function(h,p){for(var F=[],y=void 0,S=void 0,N=0;N<a;N+=1){if(S=B(y=D._(h,p),S),!y.status)return S;p=y.index,F.push(y.value)}for(;N<c&&(S=B(y=D._(h,p),S),y.status);N+=1)p=y.index,F.push(y.value);return B(w(p,F),S)})},i.result=function(a){return this.map(function(){return a})},i.atMost=function(a){return this.times(0,a
`),xn=mt(`\r
`),_n=Lt(xn,On,Sn).desc("newline"),Gs=Lt(_n,vr);s.all=$s,s.alt=Lt,s.any=Vs,s.cr=Sn,s.createLanguage=function(a){var c={};for(var D in a)({}).hasOwnProperty.call(a,D)&&function(h){c[h]=Tn(function(){return a[h](c)})}(D);return c},s.crlf=xn,s.custom=function(a){return s(a(w,O))},s.digit=Ws,s.digits=js,s.empty=br,s.end=Gs,s.eof=vr,s.fail=Pt,s.formatError=Cn,s.index=pt,s.isParser=m,s.lazy=Tn,s.letter=Zs,s.letters=qs,s.lf=On,s.lookahead=Rt,s.makeFailure=O,s.makeSuccess=w,s.newline=_n,s.noneOf=function(a){return Ut(function(c){return a.indexOf(c)<0}).desc("none of '"+a+"'")},s.notFollowedBy=vn,s.of=Le,s.oneOf=function(a){for(var c=a.split(""),D=0;D<c.length;D++)c[D]="'"+c[D]+"'";return Ut(function(h){return a.indexOf(h)>=0}).desc(c)},s.optWhitespace=Hs,s.Parser=s,s.range=function(a,c){return Ut(function(D){return a<=D&&D<=c}).desc(a+"-"+c)},s.regex=Ee,s.regexp=Ee,s.sepBy=bn,s.sepBy1=wr,s.seq=It,s.seqMap=Ie,s.seqObj=function(){for(var a,c={},D=0,h=(a=arguments,Array.prototype.slice.call(a)),p=h.length,F=0;F<p;F+=1){var y=h[F];if(!m(y)){if(_(y)&&y.length===2&&typeof y[0]=="string"&&m(y[1])){var S=y[0];if(Object.prototype.hasOwnProperty.call(c,S))throw new Error("seqObj: duplicate key "+S);c[S]=!0,D++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(D===0)throw new Error("seqObj expects at least one named parser, found zero");return s(function(N,Z){for(var W,Ce={},G=0;G<p;G+=1){var we,Qe;if(_(h[G])?(we=h[G][0],Qe=h[G][1]):(we=null,Qe=h[G]),!(W=B(Qe._(N,Z),W)).status)return W;we&&(Ce[we]=W.value),Z=W.index}return B(w(Z,Ce),W)})},s.string=mt,s.succeed=Le,s.takeWhile=function(a){return se(a),s(function(c,D){for(var h=D;h<c.length&&a(Ne(c,h));)h++;return w(h,c.slice(D,h))})},s.test=Ut,s.whitespace=Ys,s["fantasy-land/empty"]=br,s["fantasy-land/of"]=Le,s.Binary={bitSeq:C,bitSeqObj:function(a){b();var c={},D=0,h=d(function(F){if(_(F)){var y=F;if(y.length!==2)throw new Error("["+y.join(", ")+"] should be length 2, got length "+y.length);if(Se(y[0]),he(y[1]),Object.prototype.hasOwnProperty.call(c,y[0]))throw new Error("duplicate key in bitSeqObj: "+y[0]);return c[y[0]]=!0,D++,y}return he(F),[null,F]},a);if(D<1)throw new Error("bitSeqObj expects at least one named pair, got ["+a.join(", ")+"]");var p=d(function(F){return F[0]},h);return C(d(function(F){return F[1]},h)).map(function(F){return f(function(y,S){return S[0]!==null&&(y[S[0]]=S[1]),y},{},d(function(y,S){return[y,F[S]]},p))})},byte:function(a){if(b(),he(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 c=(a>15?"0x":"0x0")+a.toString(16);return s(function(D,h){var p=Ne(D,h);return p===a?w(h+1,p):O(h,c)})},buffer:function(a){return x("buffer",a).map(function(c){return Buffer.from(c)})},encodedString:function(a,c){return x("string",c).map(function(D){return D.toString(a)})},uintBE:U,uint8BE:U(1),uint16BE:U(2),uint32BE:U(4),uintLE:Y,uint8LE:Y(1),uint16LE:Y(2),uint32LE:Y(4),intBE:De,int8BE:De(1),int16BE:De(2),int32BE:De(4),intLE:de,int8LE:de(1),int16LE:de(2),int32LE:de(4),floatBE:x("floatBE",4).map(function(a){return a.readFloatBE(0)}),floatLE:x("floatLE",4).map(function(a){return a.readFloatLE(0)}),doubleBE:x("doubleBE",8).map(function(a){return a.readDoubleBE(0)}),doubleLE:x("doubleLE",8).map(function(a){return a.readDoubleLE(0)})},r.exports=s}])})})(hr,hr.exports);var o=hr.exports,yn=()=>/[#*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\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u32
`)[0];let n=r.substring(2).trim();return o.makeSuccess(e+r.length,n)}),namedField:t=>o.alt(t.explicitNamedField,go(ce.field).map(([e,r])=>pr.named(Eo(r),e))),sortField:t=>o.seqMap(ce.field.skip(o.optWhitespace),o.regexp(/ASCENDING|DESCENDING|ASC|DESC/i).atMost(1),(e,r)=>{let n=r.length==0?"ascending":r[0].toLowerCase();return n=="desc"&&(n="descending"),n=="asc"&&(n="ascending"),{field:e,direction:n}}),headerClause:t=>t.queryType.chain(e=>{switch(e){case"table":return xu(()=>({type:e,fields:[],showId:!0}),o.seqMap(o.regexp(/WITHOUT\s+ID/i).skip(o.optWhitespace).atMost(1),o.sepBy(t.namedField,o.string(",").trim(o.optWhitespace)),(r,n)=>({type:e,fields:n,showId:r.length==0})));case"list":return xu(()=>({type:e,format:void 0,showId:!0}),o.seqMap(o.regexp(/WITHOUT\s+ID/i).skip(o.optWhitespace).atMost(1),ce.field.atMost(1),(r,n)=>({type:e,format:n.length==1?n[0]:void 0,showId:r.length==0})));case"task":return o.succeed({type:e});case"calendar":return o.whitespace.then(o.seqMap(t.namedField,r=>({type:e,showId:!0,field:r})));default:return o.fail(`Unrecognized query type '${e}'`)}}).desc("TABLE or LIST or TASK or CALENDAR"),fromClause:t=>o.seqMap(o.regexp(/FROM/i),o.whitespace,ce.source,(e,r,n)=>n),whereClause:t=>o.seqMap(o.regexp(/WHERE/i),o.whitespace,ce.field,(e,r,n)=>({type:"where",clause:n})).desc("WHERE <expression>"),sortByClause:t=>o.seqMap(o.regexp(/SORT/i),o.whitespace,t.sortField.sepBy1(o.string(",").trim(o.optWhitespace)),(e,r,n)=>({type:"sort",fields:n})).desc("SORT field [ASC/DESC]"),limitClause:t=>o.seqMap(o.regexp(/LIMIT/i),o.whitespace,ce.field,(e,r,n)=>({type:"limit",amount:n})).desc("LIMIT <value>"),flattenClause:t=>o.seqMap(o.regexp(/FLATTEN/i).skip(o.whitespace),t.namedField,(e,r)=>({type:"flatten",field:r})).desc("FLATTEN <value> [AS <name>]"),groupByClause:t=>o.seqMap(o.regexp(/GROUP BY/i).skip(o.whitespace),t.namedField,(e,r)=>({type:"group",field:r})).desc("GROUP BY <value> [AS <name>]"),clause:t=>o.alt(t.fromClause,t.whereClause,t.sortByClause,t.limitClause,t.groupByClause,t.flattenClause),query:t=>o.seqMap(t.headerClause.trim(Wr),t.fromClause.trim(Wr).atMost(1),t.clause.trim(Wr).many(),(e,r,n)=>({header:e,source:r.length==0?Fe.folder(""):r[0],operations:n,settings:Fn}))}),Wr=o.alt(o.whitespace,xs.comment).many().map(t=>t.join("")),Co=t=>t?t.plugins.plugins.dataview?.api:window.DataviewAPI,wo=t=>t.plugins.enabledPlugins.has("dataview");ye.DATE_SHORTHANDS=ln;ye.DURATION_TYPES=on;ye.EXPRESSION=ce;ye.KEYWORDS=cn;ye.QUERY_LANGUAGE=xs;ye.getAPI=Co;ye.isPluginEnabled=wo;ye.parseField=yo});var To={};ni(To,{default:()=>vo});module.exports=ui(To);var Be=require("obsidian");var Ft={foldersToScan:[],ignoredFolders:[]};var xe=require("obsidian");var Pn=Symbol.for("immer-nothing"),kn=Symbol.for("immer-draftable"),Q=Symbol.for("immer-state"),si=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'l
<`,"<");let u=new RegExp(/\[\[(.+?)\\\|.+?\]\]/g),s=[...n.matchAll(u)];for(let i of s)r(gn.default.basename(i[1]))&&(n=n.replace(i[1]+"\\|",""))}else{let u=new RegExp(/\[\[(.+?)\|.+?\]\]/g),s=[...n.matchAll(u)];for(let i of s)r(gn.default.basename(i[1]))&&(n=n.replace(i[1]+"|",""))}}catch(u){j("Failed to serialize query","warn",u)}return n};var Is=t=>{let e=!1,r=t.toLowerCase();for(let n of Jn)r.startsWith(n)&&(e=!0);return e};var Ls=t=>{let e=[],r=t.split(`
`);for(let n of r){let u=n.trim();if(u.startsWith($e)&&u.endsWith(me)){let s=u.replace($e,"");s=s.replace(me,""),s=s.trim(),!e.includes(s)&&Is(s)&&e.push(s)}}return e};function Ps(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}var Rs=t=>{let e=!1;return t.toLowerCase().startsWith(Ir)&&(e=!0),e};var Cr=class extends Be.Plugin{constructor(){super(...arguments);this.settings=Ve(Ft,()=>Ft);this.nextPossibleUpdates=new Map;this.recentlyUpdatedFiles=new Set;this.scheduleUpdate=(0,Be.debounce)(this.processRecentlyUpdatedFiles.bind(this),Qn,!0)}async processRecentlyUpdatedFiles(){this.recentlyUpdatedFiles.forEach(r=>{this.processFile(r)}),this.recentlyUpdatedFiles.clear()}async onload(){if(j("Initializing","debug"),this.dataviewApi=(0,Us.getAPI)(),!this.dataviewApi){let r="The Dataview plugin is not installed or enabled. Please make sure it is installed and enabled, then restart Obsidian";j(r,"error"),new Be.Notice(r,5e3);return}await this.loadSettings(),this.setupEventHandlers(),this.addSettingTab(new Qt(this.app,this)),this.addCommand({id:"serialize-all-dataview-queries",name:"Scan and serialize all Dataview queries",callback:async()=>{j("Scanning and serializing all Dataview queries","debug");let r=this.app.vault.getMarkdownFiles();for(let n of r)await this.processFile(n)}})}onunload(){}async loadSettings(){j("Loading settings","debug");let r=await this.loadData();r||(j("Using default settings","debug"),r=Ve(Ft,()=>Ft));let n=!1;this.settings=Ve(this.settings,u=>{r.foldersToScan!==void 0&&r.foldersToScan!==null&&Array.isArray(r.foldersToScan)?u.foldersToScan=r.foldersToScan:(j("The loaded settings miss the [foldersToScan] property","debug"),n=!0),r.ignoredFolders!==void 0&&r.ignoredFolders!==null&&Array.isArray(r.ignoredFolders)?u.ignoredFolders=r.ignoredFolders:(j("The loaded settings miss the [ignoredFolders] property","debug"),n=!0)}),j("Settings loaded","debug",r),n&&this.saveSettings()}async saveSettings(){j("Saving settings","debug"),await this.saveData(this.settings),j("Settings saved","debug",this.settings)}setupEventHandlers(){this.app.workspace.onLayoutReady(async()=>{this.registerEvent(this.app.vault.on("create",r=>{this.recentlyUpdatedFiles.add(r),this.scheduleUpdate()})),this.registerEvent(this.app.vault.on("rename",r=>{this.recentlyUpdatedFiles.add(r),this.scheduleUpdate()})),this.registerEvent(this.app.vault.on("modify",r=>{this.recentlyUpdatedFiles.add(r),this.scheduleUpdate()}))})}async processFile(r){if(!(r instanceof Be.TFile))return;let n=r;if(!await this.shouldFileBeIgnored(n))try{let s=await this.app.vault.cachedRead(n),i=Ls(s);if(i.length===0)return;let l=`${s}`;l=l.replace(Yn,"");for(let d of i){let g=await Ns({query:d,originFile:n.path,dataviewApi:this.dataviewApi,app:this.app});if(g!==""){let T=Ps(d),b=new RegExp(`${$e}${T}.*${me}\\n`,"gm"),C="";Rs(d)?C=`${$e}${d}${me}
${Jt}${d}${me}
${g}${Kt}
`:C=`${$e}${d}${me}
${Jt}${d}${me}
${g}${Kt}
`,l=l.replace(b,C)}}let f=ks(new Date(n.stat.mtime),{seconds:Gn});this.nextPossibleUpdates.set(n.path,f),l!==s&&await this.app.vault.modify(n,l)}catch(s){j("Failed to process the file","warn",s)}}async shouldFileBeIgnored(r){if(!r.path||Hn!==r.extension||qn===r.name||(await this.app.vault.read(r)).trim().length===0||Zn(r))return!0;if(this.nextPossibleUpdates.has(r.path)){let u=this.nextPossibleUpdates.get(r.path);if(Bs(r.stat.mtime,u))return j("File has been updated recently. Ignoring","debug",r.path),!0;j("File has not been updated recently. Processing","debug",r.path)}return this.settings.ignoredFolders.some(u=>!!r.path.startsWith(u))}};var vo=Cr;