1
0
Fork 0
digital-art-composition-book/.obsidian/plugins/note-gallery/main.js
2024-09-14 11:25:13 -04:00

19 lines
71 KiB
JavaScript

/*
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 Yn=Object.create;var Te=Object.defineProperty,jn=Object.defineProperties,Qn=Object.getOwnPropertyDescriptor,Xn=Object.getOwnPropertyDescriptors,Jn=Object.getOwnPropertyNames,Re=Object.getOwnPropertySymbols,Zn=Object.getPrototypeOf,st=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable;var Zt=(e,r,t)=>r in e?Te(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,X=(e,r)=>{for(var t in r||(r={}))st.call(r,t)&&Zt(e,t,r[t]);if(Re)for(var t of Re(r))er.call(r,t)&&Zt(e,t,r[t]);return e},ne=(e,r)=>jn(e,Xn(r));var Ne=(e,r)=>{var t={};for(var o in e)st.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&Re)for(var o of Re(e))r.indexOf(o)<0&&er.call(e,o)&&(t[o]=e[o]);return t};var ut=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),eo=(e,r)=>{for(var t in r)Te(e,t,{get:r[t],enumerable:!0})},tr=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of Jn(r))!st.call(e,s)&&s!==t&&Te(e,s,{get:()=>r[s],enumerable:!(o=Qn(r,s))||o.enumerable});return e};var ct=(e,r,t)=>(t=e!=null?Yn(Zn(e)):{},tr(r||!e||!e.__esModule?Te(t,"default",{value:e,enumerable:!0}):t,e)),to=e=>tr(Te({},"__esModule",{value:!0}),e);var K=(e,r,t)=>new Promise((o,s)=>{var a=v=>{try{p(t.next(v))}catch(D){s(D)}},h=v=>{try{p(t.throw(v))}catch(D){s(D)}},p=v=>v.done?o(v.value):Promise.resolve(v.value).then(a,h);p((t=t.apply(e,r)).next())});var qe=ut((zr,Mt)=>{(function(e){if(typeof zr=="object"&&typeof Mt!="undefined")Mt.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var r;typeof window!="undefined"?r=window:typeof global!="undefined"?r=global:typeof self!="undefined"?r=self:r=this,r.localforage=e()}})(function(){var e,r,t;return function o(s,a,h){function p(x,f){if(!a[x]){if(!s[x]){var m=typeof require=="function"&&require;if(!f&&m)return m(x,!0);if(v)return v(x,!0);var g=new Error("Cannot find module '"+x+"'");throw g.code="MODULE_NOT_FOUND",g}var _=a[x]={exports:{}};s[x][0].call(_.exports,function(y){var w=s[x][1][y];return p(w||y)},_,_.exports,o,s,a,h)}return a[x].exports}for(var v=typeof require=="function"&&require,D=0;D<h.length;D++)p(h[D]);return p}({1:[function(o,s,a){(function(h){"use strict";var p=h.MutationObserver||h.WebKitMutationObserver,v;if(p){var D=0,x=new p(y),f=h.document.createTextNode("");x.observe(f,{characterData:!0}),v=function(){f.data=D=++D%2}}else if(!h.setImmediate&&typeof h.MessageChannel!="undefined"){var m=new h.MessageChannel;m.port1.onmessage=y,v=function(){m.port2.postMessage(0)}}else"document"in h&&"onreadystatechange"in h.document.createElement("script")?v=function(){var T=h.document.createElement("script");T.onreadystatechange=function(){y(),T.onreadystatechange=null,T.parentNode.removeChild(T),T=null},h.document.documentElement.appendChild(T)}:v=function(){setTimeout(y,0)};var g,_=[];function y(){g=!0;for(var T,M,L=_.length;L;){for(M=_,_=[],T=-1;++T<L;)M[T]();L=_.length}g=!1}s.exports=w;function w(T){_.push(T)===1&&!g&&v()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(o,s,a){"use strict";var h=o(1);function p(){}var v={},D=["REJECTED"],x=["FULFILLED"],f=["PENDING"];s.exports=m;function m(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=f,this.queue=[],this.outcome=void 0,S!==p&&w(this,S)}m.prototype.catch=function(S){return this.then(null,S)},m.prototype.then=function(S,k){if(typeof S!="function"&&this.state===x||typeof k!="function"&&this.state===D)return this;var A=new this.constructor(p);if(this.state!==f){var N=this.state===x?S:k;_(A,N,this.outcome)}else this.queue.push(new g(A,S,k));return A};function g(S,k,A){this.promise=S,typeof k=="function"&&(this.onFulfilled=k,this.callFulfilled=this.otherCallFulfilled),typeof A=="function"&&(this.onRejected=A,this.callRejected=this.otherCallRejected)}g.prototype.callFulfilled=function(S){v.resolve(this.promise,S)},g.prototype.otherCallFulfilled=function(S){_(this.promise,this.onFulfilled,S)},g.prototype.callRejected=function(S){v.reject(this.promise,S)},g.prototype.otherCallRejected=function(S){_(this.promise,this.onRejected,S)};function _(S,k,A){h(function(){var N;try{N=k(A)}catch(z){return v.reject(S,z)}N===S?v.reject(S,new TypeError("Cannot resolve promise with itself")):v.resolve(S,N)})}v.resolve=function(S,k){var A=T(y,k);if(A.status==="error")return v.reject(S,A.value);var N=A.value;if(N)w(S,N);else{S.state=x,S.outcome=k;for(var z=-1,$=S.queue.length;++z<$;)S.queue[z].callFulfilled(k)}return S},v.reject=function(S,k){S.state=D,S.outcome=k;for(var A=-1,N=S.queue.length;++A<N;)S.queue[A].callRejected(k);return S};function y(S){var k=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof k=="function")return function(){k.apply(S,arguments)}}function w(S,k){var A=!1;function N(G){A||(A=!0,v.reject(S,G))}function z(G){A||(A=!0,v.resolve(S,G))}function $(){k(z,N)}var Y=T($);Y.status==="error"&&N(Y.value)}function T(S,k){var A={};try{A.value=S(k),A.status="success"}catch(N){A.status="error",A.value=N}return A}m.resolve=M;function M(S){return S instanceof this?S:v.resolve(new this(p),S)}m.reject=L;function L(S){var k=new this(p);return v.reject(k,S)}m.all=B;function B(S){var k=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=S.length,N=!1;if(!A)return this.resolve([]);for(var z=new Array(A),$=0,Y=-1,G=new this(p);++Y<A;)Z(S[Y],Y);return G;function Z(oe,ie){k.resolve(oe).then(Xe,function(ye){N||(N=!0,v.reject(G,ye))});function Xe(ye){z[ie]=ye,++$===A&&!N&&(N=!0,v.resolve(G,z))}}}m.race=H;function H(S){var k=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var A=S.length,N=!1;if(!A)return this.resolve([]);for(var z=-1,$=new this(p);++z<A;)Y(S[z]);return $;function Y(G){k.resolve(G).then(function(Z){N||(N=!0,v.resolve($,Z))},function(Z){N||(N=!0,v.reject($,Z))})}}},{1:1}],3:[function(o,s,a){(function(h){"use strict";typeof h.Promise!="function"&&(h.Promise=o(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(o,s,a){"use strict";var h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function p(n,u){if(!(n instanceof u))throw new TypeError("Cannot call a class as a function")}function v(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(n){return}}var D=v();function x(){try{if(!D||!D.open)return!1;var n=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),u=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!n||u)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(i){return!1}}function f(n,u){n=n||[],u=u||{};try{return new Blob(n,u)}catch(c){if(c.name!=="TypeError")throw c;for(var i=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,l=new i,d=0;d<n.length;d+=1)l.append(n[d]);return l.getBlob(u.type)}}typeof Promise=="undefined"&&o(3);var m=Promise;function g(n,u){u&&n.then(function(i){u(null,i)},function(i){u(i)})}function _(n,u,i){typeof u=="function"&&n.then(u),typeof i=="function"&&n.catch(i)}function y(n){return typeof n!="string"&&(console.warn(n+" used as a key, but it is not a string."),n=String(n)),n}function w(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var T="local-forage-detect-blob-support",M=void 0,L={},B=Object.prototype.toString,H="readonly",S="readwrite";function k(n){for(var u=n.length,i=new ArrayBuffer(u),l=new Uint8Array(i),d=0;d<u;d++)l[d]=n.charCodeAt(d);return i}function A(n){return new m(function(u){var i=n.transaction(T,S),l=f([""]);i.objectStore(T).put(l,"key"),i.onabort=function(d){d.preventDefault(),d.stopPropagation(),u(!1)},i.oncomplete=function(){var d=navigator.userAgent.match(/Chrome\/(\d+)/),c=navigator.userAgent.match(/Edge\//);u(c||!d||parseInt(d[1],10)>=43)}}).catch(function(){return!1})}function N(n){return typeof M=="boolean"?m.resolve(M):A(n).then(function(u){return M=u,M})}function z(n){var u=L[n.name],i={};i.promise=new m(function(l,d){i.resolve=l,i.reject=d}),u.deferredOperations.push(i),u.dbReady?u.dbReady=u.dbReady.then(function(){return i.promise}):u.dbReady=i.promise}function $(n){var u=L[n.name],i=u.deferredOperations.pop();if(i)return i.resolve(),i.promise}function Y(n,u){var i=L[n.name],l=i.deferredOperations.pop();if(l)return l.reject(u),l.promise}function G(n,u){return new m(function(i,l){if(L[n.name]=L[n.name]||Nt(),n.db)if(u)z(n),n.db.close();else return i(n.db);var d=[n.name];u&&d.push(n.version);var c=D.open.apply(D,d);u&&(c.onupgradeneeded=function(b){var E=c.result;try{E.createObjectStore(n.storeName),b.oldVersion<=1&&E.createObjectStore(T)}catch(C){if(C.name==="ConstraintError")console.warn('The database "'+n.name+'" has been upgraded from version '+b.oldVersion+" to version "+b.newVersion+', but the storage "'+n.storeName+'" already exists.');else throw C}}),c.onerror=function(b){b.preventDefault(),l(c.error)},c.onsuccess=function(){var b=c.result;b.onversionchange=function(E){E.target.close()},i(b),$(n)}})}function Z(n){return G(n,!1)}function oe(n){return G(n,!0)}function ie(n,u){if(!n.db)return!0;var i=!n.db.objectStoreNames.contains(n.storeName),l=n.version<n.db.version,d=n.version>n.db.version;if(l&&(n.version!==u&&console.warn('The database "'+n.name+`" can't be downgraded from version `+n.db.version+" to version "+n.version+"."),n.version=n.db.version),d||i){if(i){var c=n.db.version+1;c>n.version&&(n.version=c)}return!0}return!1}function Xe(n){return new m(function(u,i){var l=new FileReader;l.onerror=i,l.onloadend=function(d){var c=btoa(d.target.result||"");u({__local_forage_encoded_blob:!0,data:c,type:n.type})},l.readAsBinaryString(n)})}function ye(n){var u=k(atob(n.data));return f([u],{type:n.type})}function Rt(n){return n&&n.__local_forage_encoded_blob}function Yr(n){var u=this,i=u._initReady().then(function(){var l=L[u._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return _(i,n,n),i}function jr(n){z(n);for(var u=L[n.name],i=u.forages,l=0;l<i.length;l++){var d=i[l];d._dbInfo.db&&(d._dbInfo.db.close(),d._dbInfo.db=null)}return n.db=null,Z(n).then(function(c){return n.db=c,ie(n)?oe(n):c}).then(function(c){n.db=u.db=c;for(var b=0;b<i.length;b++)i[b]._dbInfo.db=c}).catch(function(c){throw Y(n,c),c})}function ae(n,u,i,l){l===void 0&&(l=1);try{var d=n.db.transaction(n.storeName,u);i(null,d)}catch(c){if(l>0&&(!n.db||c.name==="InvalidStateError"||c.name==="NotFoundError"))return m.resolve().then(function(){if(!n.db||c.name==="NotFoundError"&&!n.db.objectStoreNames.contains(n.storeName)&&n.version<=n.db.version)return n.db&&(n.version=n.db.version+1),oe(n)}).then(function(){return jr(n).then(function(){ae(n,u,i,l-1)})}).catch(i);i(c)}}function Nt(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Qr(n){var u=this,i={db:null};if(n)for(var l in n)i[l]=n[l];var d=L[i.name];d||(d=Nt(),L[i.name]=d),d.forages.push(u),u._initReady||(u._initReady=u.ready,u.ready=Yr);var c=[];function b(){return m.resolve()}for(var E=0;E<d.forages.length;E++){var C=d.forages[E];C!==u&&c.push(C._initReady().catch(b))}var I=d.forages.slice(0);return m.all(c).then(function(){return i.db=d.db,Z(i)}).then(function(P){return i.db=P,ie(i,u._defaultConfig.version)?oe(i):P}).then(function(P){i.db=d.db=P,u._dbInfo=i;for(var R=0;R<I.length;R++){var U=I[R];U!==u&&(U._dbInfo.db=i.db,U._dbInfo.version=i.version)}})}function Xr(n,u){var i=this;n=y(n);var l=new m(function(d,c){i.ready().then(function(){ae(i._dbInfo,H,function(b,E){if(b)return c(b);try{var C=E.objectStore(i._dbInfo.storeName),I=C.get(n);I.onsuccess=function(){var P=I.result;P===void 0&&(P=null),Rt(P)&&(P=ye(P)),d(P)},I.onerror=function(){c(I.error)}}catch(P){c(P)}})}).catch(c)});return g(l,u),l}function Jr(n,u){var i=this,l=new m(function(d,c){i.ready().then(function(){ae(i._dbInfo,H,function(b,E){if(b)return c(b);try{var C=E.objectStore(i._dbInfo.storeName),I=C.openCursor(),P=1;I.onsuccess=function(){var R=I.result;if(R){var U=R.value;Rt(U)&&(U=ye(U));var W=n(U,R.key,P++);W!==void 0?d(W):R.continue()}else d()},I.onerror=function(){c(I.error)}}catch(R){c(R)}})}).catch(c)});return g(l,u),l}function Zr(n,u,i){var l=this;n=y(n);var d=new m(function(c,b){var E;l.ready().then(function(){return E=l._dbInfo,B.call(u)==="[object Blob]"?N(E.db).then(function(C){return C?u:Xe(u)}):u}).then(function(C){ae(l._dbInfo,S,function(I,P){if(I)return b(I);try{var R=P.objectStore(l._dbInfo.storeName);C===null&&(C=void 0);var U=R.put(C,n);P.oncomplete=function(){C===void 0&&(C=null),c(C)},P.onabort=P.onerror=function(){var W=U.error?U.error:U.transaction.error;b(W)}}catch(W){b(W)}})}).catch(b)});return g(d,i),d}function en(n,u){var i=this;n=y(n);var l=new m(function(d,c){i.ready().then(function(){ae(i._dbInfo,S,function(b,E){if(b)return c(b);try{var C=E.objectStore(i._dbInfo.storeName),I=C.delete(n);E.oncomplete=function(){d()},E.onerror=function(){c(I.error)},E.onabort=function(){var P=I.error?I.error:I.transaction.error;c(P)}}catch(P){c(P)}})}).catch(c)});return g(l,u),l}function tn(n){var u=this,i=new m(function(l,d){u.ready().then(function(){ae(u._dbInfo,S,function(c,b){if(c)return d(c);try{var E=b.objectStore(u._dbInfo.storeName),C=E.clear();b.oncomplete=function(){l()},b.onabort=b.onerror=function(){var I=C.error?C.error:C.transaction.error;d(I)}}catch(I){d(I)}})}).catch(d)});return g(i,n),i}function rn(n){var u=this,i=new m(function(l,d){u.ready().then(function(){ae(u._dbInfo,H,function(c,b){if(c)return d(c);try{var E=b.objectStore(u._dbInfo.storeName),C=E.count();C.onsuccess=function(){l(C.result)},C.onerror=function(){d(C.error)}}catch(I){d(I)}})}).catch(d)});return g(i,n),i}function nn(n,u){var i=this,l=new m(function(d,c){if(n<0){d(null);return}i.ready().then(function(){ae(i._dbInfo,H,function(b,E){if(b)return c(b);try{var C=E.objectStore(i._dbInfo.storeName),I=!1,P=C.openKeyCursor();P.onsuccess=function(){var R=P.result;if(!R){d(null);return}n===0||I?d(R.key):(I=!0,R.advance(n))},P.onerror=function(){c(P.error)}}catch(R){c(R)}})}).catch(c)});return g(l,u),l}function on(n){var u=this,i=new m(function(l,d){u.ready().then(function(){ae(u._dbInfo,H,function(c,b){if(c)return d(c);try{var E=b.objectStore(u._dbInfo.storeName),C=E.openKeyCursor(),I=[];C.onsuccess=function(){var P=C.result;if(!P){l(I);return}I.push(P.key),P.continue()},C.onerror=function(){d(C.error)}}catch(P){d(P)}})}).catch(d)});return g(i,n),i}function an(n,u){u=w.apply(this,arguments);var i=this.config();n=typeof n!="function"&&n||{},n.name||(n.name=n.name||i.name,n.storeName=n.storeName||i.storeName);var l=this,d;if(!n.name)d=m.reject("Invalid arguments");else{var c=n.name===i.name&&l._dbInfo.db,b=c?m.resolve(l._dbInfo.db):Z(n).then(function(E){var C=L[n.name],I=C.forages;C.db=E;for(var P=0;P<I.length;P++)I[P]._dbInfo.db=E;return E});n.storeName?d=b.then(function(E){if(!!E.objectStoreNames.contains(n.storeName)){var C=E.version+1;z(n);var I=L[n.name],P=I.forages;E.close();for(var R=0;R<P.length;R++){var U=P[R];U._dbInfo.db=null,U._dbInfo.version=C}var W=new m(function(V,Q){var j=D.open(n.name,C);j.onerror=function(ee){var Ie=j.result;Ie.close(),Q(ee)},j.onupgradeneeded=function(){var ee=j.result;ee.deleteObjectStore(n.storeName)},j.onsuccess=function(){var ee=j.result;ee.close(),V(ee)}});return W.then(function(V){I.db=V;for(var Q=0;Q<P.length;Q++){var j=P[Q];j._dbInfo.db=V,$(j._dbInfo)}}).catch(function(V){throw(Y(n,V)||m.resolve()).catch(function(){}),V})}}):d=b.then(function(E){z(n);var C=L[n.name],I=C.forages;E.close();for(var P=0;P<I.length;P++){var R=I[P];R._dbInfo.db=null}var U=new m(function(W,V){var Q=D.deleteDatabase(n.name);Q.onerror=function(){var j=Q.result;j&&j.close(),V(Q.error)},Q.onblocked=function(){console.warn('dropInstance blocked for database "'+n.name+'" until all open connections are closed')},Q.onsuccess=function(){var j=Q.result;j&&j.close(),W(j)}});return U.then(function(W){C.db=W;for(var V=0;V<I.length;V++){var Q=I[V];$(Q._dbInfo)}}).catch(function(W){throw(Y(n,W)||m.resolve()).catch(function(){}),W})})}return g(d,u),d}var sn={_driver:"asyncStorage",_initStorage:Qr,_support:x(),iterate:Jr,getItem:Xr,setItem:Zr,removeItem:en,clear:tn,length:rn,key:nn,keys:on,dropInstance:an};function un(){return typeof openDatabase=="function"}var ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cn="~~local_forage_type~",Lt=/^~~local_forage_type~([^~]+)~/,Me="__lfsc__:",Je=Me.length,Ze="arbf",et="blob",kt="si08",Ot="ui08",Ft="uic8",Bt="si16",Ht="si32",zt="ur16",Ut="ui32",Wt="fl32",Vt="fl64",Kt=Je+Ze.length,$t=Object.prototype.toString;function qt(n){var u=n.length*.75,i=n.length,l,d=0,c,b,E,C;n[n.length-1]==="="&&(u--,n[n.length-2]==="="&&u--);var I=new ArrayBuffer(u),P=new Uint8Array(I);for(l=0;l<i;l+=4)c=ce.indexOf(n[l]),b=ce.indexOf(n[l+1]),E=ce.indexOf(n[l+2]),C=ce.indexOf(n[l+3]),P[d++]=c<<2|b>>4,P[d++]=(b&15)<<4|E>>2,P[d++]=(E&3)<<6|C&63;return I}function tt(n){var u=new Uint8Array(n),i="",l;for(l=0;l<u.length;l+=3)i+=ce[u[l]>>2],i+=ce[(u[l]&3)<<4|u[l+1]>>4],i+=ce[(u[l+1]&15)<<2|u[l+2]>>6],i+=ce[u[l+2]&63];return u.length%3===2?i=i.substring(0,i.length-1)+"=":u.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function ln(n,u){var i="";if(n&&(i=$t.call(n)),n&&(i==="[object ArrayBuffer]"||n.buffer&&$t.call(n.buffer)==="[object ArrayBuffer]")){var l,d=Me;n instanceof ArrayBuffer?(l=n,d+=Ze):(l=n.buffer,i==="[object Int8Array]"?d+=kt:i==="[object Uint8Array]"?d+=Ot:i==="[object Uint8ClampedArray]"?d+=Ft:i==="[object Int16Array]"?d+=Bt:i==="[object Uint16Array]"?d+=zt:i==="[object Int32Array]"?d+=Ht:i==="[object Uint32Array]"?d+=Ut:i==="[object Float32Array]"?d+=Wt:i==="[object Float64Array]"?d+=Vt:u(new Error("Failed to get type for BinaryArray"))),u(d+tt(l))}else if(i==="[object Blob]"){var c=new FileReader;c.onload=function(){var b=cn+n.type+"~"+tt(this.result);u(Me+et+b)},c.readAsArrayBuffer(n)}else try{u(JSON.stringify(n))}catch(b){console.error("Couldn't convert value into a JSON string: ",n),u(null,b)}}function fn(n){if(n.substring(0,Je)!==Me)return JSON.parse(n);var u=n.substring(Kt),i=n.substring(Je,Kt),l;if(i===et&&Lt.test(u)){var d=u.match(Lt);l=d[1],u=u.substring(d[0].length)}var c=qt(u);switch(i){case Ze:return c;case et:return f([c],{type:l});case kt:return new Int8Array(c);case Ot:return new Uint8Array(c);case Ft:return new Uint8ClampedArray(c);case Bt:return new Int16Array(c);case zt:return new Uint16Array(c);case Ht:return new Int32Array(c);case Ut:return new Uint32Array(c);case Wt:return new Float32Array(c);case Vt:return new Float64Array(c);default:throw new Error("Unkown type: "+i)}}var rt={serialize:ln,deserialize:fn,stringToBuffer:qt,bufferToString:tt};function Gt(n,u,i,l){n.executeSql("CREATE TABLE IF NOT EXISTS "+u.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,l)}function dn(n){var u=this,i={db:null};if(n)for(var l in n)i[l]=typeof n[l]!="string"?n[l].toString():n[l];var d=new m(function(c,b){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(E){return b(E)}i.db.transaction(function(E){Gt(E,i,function(){u._dbInfo=i,c()},function(C,I){b(I)})},b)});return i.serializer=rt,d}function le(n,u,i,l,d,c){n.executeSql(i,l,d,function(b,E){E.code===E.SYNTAX_ERR?b.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[u.storeName],function(C,I){I.rows.length?c(C,E):Gt(C,u,function(){C.executeSql(i,l,d,c)},c)},c):c(b,E)},c)}function pn(n,u){var i=this;n=y(n);var l=new m(function(d,c){i.ready().then(function(){var b=i._dbInfo;b.db.transaction(function(E){le(E,b,"SELECT * FROM "+b.storeName+" WHERE key = ? LIMIT 1",[n],function(C,I){var P=I.rows.length?I.rows.item(0).value:null;P&&(P=b.serializer.deserialize(P)),d(P)},function(C,I){c(I)})})}).catch(c)});return g(l,u),l}function hn(n,u){var i=this,l=new m(function(d,c){i.ready().then(function(){var b=i._dbInfo;b.db.transaction(function(E){le(E,b,"SELECT * FROM "+b.storeName,[],function(C,I){for(var P=I.rows,R=P.length,U=0;U<R;U++){var W=P.item(U),V=W.value;if(V&&(V=b.serializer.deserialize(V)),V=n(V,W.key,U+1),V!==void 0){d(V);return}}d()},function(C,I){c(I)})})}).catch(c)});return g(l,u),l}function Yt(n,u,i,l){var d=this;n=y(n);var c=new m(function(b,E){d.ready().then(function(){u===void 0&&(u=null);var C=u,I=d._dbInfo;I.serializer.serialize(u,function(P,R){R?E(R):I.db.transaction(function(U){le(U,I,"INSERT OR REPLACE INTO "+I.storeName+" (key, value) VALUES (?, ?)",[n,P],function(){b(C)},function(W,V){E(V)})},function(U){if(U.code===U.QUOTA_ERR){if(l>0){b(Yt.apply(d,[n,C,i,l-1]));return}E(U)}})})}).catch(E)});return g(c,i),c}function mn(n,u,i){return Yt.apply(this,[n,u,i,1])}function _n(n,u){var i=this;n=y(n);var l=new m(function(d,c){i.ready().then(function(){var b=i._dbInfo;b.db.transaction(function(E){le(E,b,"DELETE FROM "+b.storeName+" WHERE key = ?",[n],function(){d()},function(C,I){c(I)})})}).catch(c)});return g(l,u),l}function vn(n){var u=this,i=new m(function(l,d){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(b){le(b,c,"DELETE FROM "+c.storeName,[],function(){l()},function(E,C){d(C)})})}).catch(d)});return g(i,n),i}function yn(n){var u=this,i=new m(function(l,d){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(b){le(b,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(E,C){var I=C.rows.item(0).c;l(I)},function(E,C){d(C)})})}).catch(d)});return g(i,n),i}function gn(n,u){var i=this,l=new m(function(d,c){i.ready().then(function(){var b=i._dbInfo;b.db.transaction(function(E){le(E,b,"SELECT key FROM "+b.storeName+" WHERE id = ? LIMIT 1",[n+1],function(C,I){var P=I.rows.length?I.rows.item(0).key:null;d(P)},function(C,I){c(I)})})}).catch(c)});return g(l,u),l}function bn(n){var u=this,i=new m(function(l,d){u.ready().then(function(){var c=u._dbInfo;c.db.transaction(function(b){le(b,c,"SELECT key FROM "+c.storeName,[],function(E,C){for(var I=[],P=0;P<C.rows.length;P++)I.push(C.rows.item(P).key);l(I)},function(E,C){d(C)})})}).catch(d)});return g(i,n),i}function En(n){return new m(function(u,i){n.transaction(function(l){l.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(d,c){for(var b=[],E=0;E<c.rows.length;E++)b.push(c.rows.item(E).name);u({db:n,storeNames:b})},function(d,c){i(c)})},function(l){i(l)})})}function wn(n,u){u=w.apply(this,arguments);var i=this.config();n=typeof n!="function"&&n||{},n.name||(n.name=n.name||i.name,n.storeName=n.storeName||i.storeName);var l=this,d;return n.name?d=new m(function(c){var b;n.name===i.name?b=l._dbInfo.db:b=openDatabase(n.name,"","",0),n.storeName?c({db:b,storeNames:[n.storeName]}):c(En(b))}).then(function(c){return new m(function(b,E){c.db.transaction(function(C){function I(W){return new m(function(V,Q){C.executeSql("DROP TABLE IF EXISTS "+W,[],function(){V()},function(j,ee){Q(ee)})})}for(var P=[],R=0,U=c.storeNames.length;R<U;R++)P.push(I(c.storeNames[R]));m.all(P).then(function(){b()}).catch(function(W){E(W)})},function(C){E(C)})})}):d=m.reject("Invalid arguments"),g(d,u),d}var Sn={_driver:"webSQLStorage",_initStorage:dn,_support:un(),iterate:hn,getItem:pn,setItem:mn,removeItem:_n,clear:vn,length:yn,key:gn,keys:bn,dropInstance:wn};function Cn(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(n){return!1}}function jt(n,u){var i=n.name+"/";return n.storeName!==u.storeName&&(i+=n.storeName+"/"),i}function In(){var n="_localforage_support_test";try{return localStorage.setItem(n,!0),localStorage.removeItem(n),!1}catch(u){return!0}}function Tn(){return!In()||localStorage.length>0}function Pn(n){var u=this,i={};if(n)for(var l in n)i[l]=n[l];return i.keyPrefix=jt(n,u._defaultConfig),Tn()?(u._dbInfo=i,i.serializer=rt,m.resolve()):m.reject()}function Dn(n){var u=this,i=u.ready().then(function(){for(var l=u._dbInfo.keyPrefix,d=localStorage.length-1;d>=0;d--){var c=localStorage.key(d);c.indexOf(l)===0&&localStorage.removeItem(c)}});return g(i,n),i}function xn(n,u){var i=this;n=y(n);var l=i.ready().then(function(){var d=i._dbInfo,c=localStorage.getItem(d.keyPrefix+n);return c&&(c=d.serializer.deserialize(c)),c});return g(l,u),l}function Mn(n,u){var i=this,l=i.ready().then(function(){for(var d=i._dbInfo,c=d.keyPrefix,b=c.length,E=localStorage.length,C=1,I=0;I<E;I++){var P=localStorage.key(I);if(P.indexOf(c)===0){var R=localStorage.getItem(P);if(R&&(R=d.serializer.deserialize(R)),R=n(R,P.substring(b),C++),R!==void 0)return R}}});return g(l,u),l}function An(n,u){var i=this,l=i.ready().then(function(){var d=i._dbInfo,c;try{c=localStorage.key(n)}catch(b){c=null}return c&&(c=c.substring(d.keyPrefix.length)),c});return g(l,u),l}function Rn(n){var u=this,i=u.ready().then(function(){for(var l=u._dbInfo,d=localStorage.length,c=[],b=0;b<d;b++){var E=localStorage.key(b);E.indexOf(l.keyPrefix)===0&&c.push(E.substring(l.keyPrefix.length))}return c});return g(i,n),i}function Nn(n){var u=this,i=u.keys().then(function(l){return l.length});return g(i,n),i}function Ln(n,u){var i=this;n=y(n);var l=i.ready().then(function(){var d=i._dbInfo;localStorage.removeItem(d.keyPrefix+n)});return g(l,u),l}function kn(n,u,i){var l=this;n=y(n);var d=l.ready().then(function(){u===void 0&&(u=null);var c=u;return new m(function(b,E){var C=l._dbInfo;C.serializer.serialize(u,function(I,P){if(P)E(P);else try{localStorage.setItem(C.keyPrefix+n,I),b(c)}catch(R){(R.name==="QuotaExceededError"||R.name==="NS_ERROR_DOM_QUOTA_REACHED")&&E(R),E(R)}})})});return g(d,i),d}function On(n,u){if(u=w.apply(this,arguments),n=typeof n!="function"&&n||{},!n.name){var i=this.config();n.name=n.name||i.name,n.storeName=n.storeName||i.storeName}var l=this,d;return n.name?d=new m(function(c){n.storeName?c(jt(n,l._defaultConfig)):c(n.name+"/")}).then(function(c){for(var b=localStorage.length-1;b>=0;b--){var E=localStorage.key(b);E.indexOf(c)===0&&localStorage.removeItem(E)}}):d=m.reject("Invalid arguments"),g(d,u),d}var Fn={_driver:"localStorageWrapper",_initStorage:Pn,_support:Cn(),iterate:Mn,getItem:xn,setItem:kn,removeItem:Ln,clear:Dn,length:Nn,key:An,keys:Rn,dropInstance:On},Bn=function(u,i){return u===i||typeof u=="number"&&typeof i=="number"&&isNaN(u)&&isNaN(i)},Hn=function(u,i){for(var l=u.length,d=0;d<l;){if(Bn(u[d],i))return!0;d++}return!1},Qt=Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"},Ce={},Xt={},ge={INDEXEDDB:sn,WEBSQL:Sn,LOCALSTORAGE:Fn},zn=[ge.INDEXEDDB._driver,ge.WEBSQL._driver,ge.LOCALSTORAGE._driver],Ae=["dropInstance"],nt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Ae),Un={description:"",driver:zn.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Wn(n,u){n[u]=function(){var i=arguments;return n.ready().then(function(){return n[u].apply(n,i)})}}function ot(){for(var n=1;n<arguments.length;n++){var u=arguments[n];if(u)for(var i in u)u.hasOwnProperty(i)&&(Qt(u[i])?arguments[0][i]=u[i].slice():arguments[0][i]=u[i])}return arguments[0]}var Vn=function(){function n(u){p(this,n);for(var i in ge)if(ge.hasOwnProperty(i)){var l=ge[i],d=l._driver;this[i]=d,Ce[d]||this.defineDriver(l)}this._defaultConfig=ot({},Un),this._config=ot({},this._defaultConfig,u),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return n.prototype.config=function(i){if((typeof i=="undefined"?"undefined":h(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var l in i){if(l==="storeName"&&(i[l]=i[l].replace(/\W/g,"_")),l==="version"&&typeof i[l]!="number")return new Error("Database version must be a number.");this._config[l]=i[l]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},n.prototype.defineDriver=function(i,l,d){var c=new m(function(b,E){try{var C=i._driver,I=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){E(I);return}for(var P=nt.concat("_initStorage"),R=0,U=P.length;R<U;R++){var W=P[R],V=!Hn(Ae,W);if((V||i[W])&&typeof i[W]!="function"){E(I);return}}var Q=function(){for(var Ie=function(qn){return function(){var Gn=new Error("Method "+qn+" is not implemented by the current driver"),Jt=m.reject(Gn);return g(Jt,arguments[arguments.length-1]),Jt}},it=0,$n=Ae.length;it<$n;it++){var at=Ae[it];i[at]||(i[at]=Ie(at))}};Q();var j=function(Ie){Ce[C]&&console.info("Redefining LocalForage driver: "+C),Ce[C]=i,Xt[C]=Ie,b()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(j,E):j(!!i._support):j(!0)}catch(ee){E(ee)}});return _(c,l,d),c},n.prototype.driver=function(){return this._driver||null},n.prototype.getDriver=function(i,l,d){var c=Ce[i]?m.resolve(Ce[i]):m.reject(new Error("Driver not found."));return _(c,l,d),c},n.prototype.getSerializer=function(i){var l=m.resolve(rt);return _(l,i),l},n.prototype.ready=function(i){var l=this,d=l._driverSet.then(function(){return l._ready===null&&(l._ready=l._initDriver()),l._ready});return _(d,i,i),d},n.prototype.setDriver=function(i,l,d){var c=this;Qt(i)||(i=[i]);var b=this._getSupportedDrivers(i);function E(){c._config.driver=c.driver()}function C(R){return c._extend(R),E(),c._ready=c._initStorage(c._config),c._ready}function I(R){return function(){var U=0;function W(){for(;U<R.length;){var V=R[U];return U++,c._dbInfo=null,c._ready=null,c.getDriver(V).then(C).catch(W)}E();var Q=new Error("No available storage method found.");return c._driverSet=m.reject(Q),c._driverSet}return W()}}var P=this._driverSet!==null?this._driverSet.catch(function(){return m.resolve()}):m.resolve();return this._driverSet=P.then(function(){var R=b[0];return c._dbInfo=null,c._ready=null,c.getDriver(R).then(function(U){c._driver=U._driver,E(),c._wrapLibraryMethodsWithReady(),c._initDriver=I(b)})}).catch(function(){E();var R=new Error("No available storage method found.");return c._driverSet=m.reject(R),c._driverSet}),_(this._driverSet,l,d),this._driverSet},n.prototype.supports=function(i){return!!Xt[i]},n.prototype._extend=function(i){ot(this,i)},n.prototype._getSupportedDrivers=function(i){for(var l=[],d=0,c=i.length;d<c;d++){var b=i[d];this.supports(b)&&l.push(b)}return l},n.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,l=nt.length;i<l;i++)Wn(this,nt[i])},n.prototype.createInstance=function(i){return new n(i)},n}(),Kn=new Vn;s.exports=Kn},{3:3}]},{},[4])(4)})});var Wr=ut((Ge,Ur)=>{(function(e,r){typeof Ge=="object"&&typeof Ur!="undefined"?r(Ge,qe()):typeof define=="function"&&define.amd?define(["exports","localforage"],r):r(e.localforageGetItems=e.localforageGetItems||{},e.localforage)})(Ge,function(e,r){"use strict";r="default"in r?r.default:r;function t(_){return t.result?t.result:!_||typeof _.getSerializer!="function"?Promise.reject(new Error("localforage.getSerializer() was not available! localforage v1.4+ is required!")):(t.result=_.getSerializer(),t.result)}function o(_,y){return y&&_.then(function(w){y(null,w)},function(w){y(w)}),_}function s(_,y){var w=this,T=w.getItem(_).then(function(M){return{key:_,value:M}});return o(T,y),T}function a(_){var y=this,w=new Promise(function(T,M){for(var L=[],B=0,H=_.length;B<H;B++)L.push(s.call(y,_[B]));Promise.all(L).then(function(S){for(var k={},A=0,N=S.length;A<N;A++){var z=S[A];k[z.key]=z.value}T(k)}).catch(M)});return w}function h(){var _=this,y={};return _.iterate(function(w,T){y[T]=w}).then(function(){return y})}function p(){if(typeof IDBKeyRange!="undefined")return IDBKeyRange;if(typeof webkitIDBKeyRange!="undefined")return webkitIDBKeyRange;if(typeof mozIDBKeyRange!="undefined")return mozIDBKeyRange}var v=p();function D(_){_=_.slice();var y=this;function w(M,L){return M<L?-1:M>L?1:0}var T=new Promise(function(M,L){y.ready().then(function(){var B=y._dbInfo,H=B.db.transaction(B.storeName,"readonly").objectStore(B.storeName),S=_.sort(w),k=v.bound(_[0],_[_.length-1],!1,!1),A=H.openCursor(k),N={},z=0;A.onsuccess=function(){var $=A.result;if(!$){M(N);return}for(var Y=$.key;Y>S[z];)if(z++,z===S.length){M(N);return}if(Y===S[z]){var G=$.value;G===void 0&&(G=null),N[Y]=G,$.continue()}else $.continue(S[z])},A.onerror=function(){L(A.error)}}).catch(L)});return T}function x(_){var y=this,w=new Promise(function(T,M){y.ready().then(function(){return t(y)}).then(function(L){var B=y._dbInfo;B.db.transaction(function(H){for(var S=new Array(_.length),k=0,A=_.length;k<A;k++)S[k]="?";H.executeSql("SELECT * FROM "+B.storeName+" WHERE (key IN ("+S.join(",")+"))",_,function(N,z){for(var $={},Y=z.rows,G=0,Z=Y.length;G<Z;G++){var oe=Y.item(G),ie=oe.value;ie&&(ie=L.deserialize(ie)),$[oe.key]=ie}T($)},function(N,z){M(z)})})}).catch(M)});return w}function f(_,y){var w=this,T;if(!arguments.length||_===null)T=h.apply(w);else{var M=w.driver();M===w.INDEXEDDB?T=D.apply(w,arguments):M===w.WEBSQL?T=x.apply(w,arguments):T=a.apply(w,arguments)}return o(T,y),T}function m(_){var y=Object.getPrototypeOf(_);y&&(y.getItems=f,y.getItems.indexedDB=function(){return D.apply(this,arguments)},y.getItems.websql=function(){return x.apply(this,arguments)},y.getItems.generic=function(){return a.apply(this,arguments)})}var g=m(r);e.localforageGetItems=f,e.extendPrototype=m,e.extendPrototypeResult=g,e.getItemsGeneric=a,Object.defineProperty(e,"__esModule",{value:!0})})});var Kr=ut((Ye,Vr)=>{(function(e,r){typeof Ye=="object"&&typeof Vr!="undefined"?r(Ye,qe()):typeof define=="function"&&define.amd?define(["exports","localforage"],r):r(e.localforageSetItems=e.localforageSetItems||{},e.localforage)})(Ye,function(e,r){"use strict";r="default"in r?r.default:r;function t(f){return t.result?t.result:!f||typeof f.getSerializer!="function"?Promise.reject(new Error("localforage.getSerializer() was not available! localforage v1.4+ is required!")):(t.result=f.getSerializer(),t.result)}function o(f,m){m&&f.then(function(g){m(null,g)},function(g){m(g)})}function s(f,m,g,_){function y(H,S){var k=H||S;return(!H||typeof H!="function")&&typeof k=="string"&&(H=function(N){return N[k]}),H}var w=[];if(Object.prototype.toString.call(f)==="[object Array]"){m=y(m,"key"),g=y(g,"value");for(var T=0,M=f.length;T<M;T++){var L=f[T];w.push(_(m(L),g(L)))}}else for(var B in f)f.hasOwnProperty(B)&&w.push(_(B,f[B]));return w}function a(f,m,g,_){var y=this,w=y.ready().then(function(){return new Promise(function(T,M){var L=y._dbInfo,B=L.db.transaction(L.storeName,"readwrite"),H=B.objectStore(L.storeName),S;B.oncomplete=function(){T(f)},B.onabort=B.onerror=function(A){M(S||A.target)};function k(A){var N=A.target||this;S=N.error||N.transaction.error,M(S)}s(f,m,g,function(A,N){N===null&&(N=void 0);var z=H.put(N,A);z.onerror=k})})});return o(w,_),w}function h(f,m,g,_){var y=this,w=new Promise(function(T,M){y.ready().then(function(){return t(y)}).then(function(L){var B=y._dbInfo;B.db.transaction(function(H){var S="INSERT OR REPLACE INTO "+B.storeName+" (key, value) VALUES (?, ?)",k=s(f,m,g,function(A,N){return new Promise(function(z,$){L.serialize(N,function(Y,G){G?$(G):H.executeSql(S,[A,Y],function(){z()},function(Z,oe){$(oe)})})})});Promise.all(k).then(function(){T(f)},M)},function(H){M(H)})}).catch(M)});return o(w,_),w}function p(f,m,g,_){var y=this,w=s(f,m,g,function(M,L){return y.setItem(M,L)}),T=Promise.all(w);return o(T,_),T}function v(f,m,g,_){var y=this,w=y.driver();return w===y.INDEXEDDB?a.call(y,f,m,g,_):w===y.WEBSQL?h.call(y,f,m,g,_):p.call(y,f,m,g,_)}function D(f){var m=Object.getPrototypeOf(f);m&&(m.setItems=v,m.setItems.indexedDB=function(){return a.apply(this,arguments)},m.setItems.websql=function(){return h.apply(this,arguments)},m.setItems.generic=function(){return p.apply(this,arguments)})}var x=D(r);e.setItemsGeneric=p,e.localforageSetItems=v,e.extendPrototype=D,e.extendPrototypeResult=x,Object.defineProperty(e,"__esModule",{value:!0})})});var xo={};eo(xo,{default:()=>Qe,extractValue:()=>Gr});module.exports=to(xo);function Le(e,r){let t=Object.keys(r).map(o=>ro(e,o,r[o]));return t.length===1?t[0]:function(){t.forEach(o=>o())}}function ro(e,r,t){let o=e[r],s=e.hasOwnProperty(r),a=t(o);return o&&Object.setPrototypeOf(a,o),Object.setPrototypeOf(h,a),e[r]=h,p;function h(...v){return a===o&&e[r]===h&&p(),a.apply(this,v)}function p(){e[r]===h&&(s?e[r]=o:delete e[r]),a!==o&&(a=o,Object.setPrototypeOf(h,o||Function))}}var ue=require("obsidian");var Hr=require("obsidian");var Be,O,ar,no,he,rr,sr,lt,ur,be={},cr=[],oo=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,He=Array.isArray;function fe(e,r){for(var t in r)e[t]=r[t];return e}function lr(e){var r=e.parentNode;r&&r.removeChild(e)}function pt(e,r,t){var o,s,a,h={};for(a in r)a=="key"?o=r[a]:a=="ref"?s=r[a]:h[a]=r[a];if(arguments.length>2&&(h.children=arguments.length>3?Be.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)h[a]===void 0&&(h[a]=e.defaultProps[a]);return ke(e,h,o,s,null)}function ke(e,r,t,o,s){var a={type:e,props:r,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:s==null?++ar:s,__i:-1};return s==null&&O.vnode!=null&&O.vnode(a),a}function fr(){return{current:null}}function se(e){return e.children}function Ee(e,r){this.props=e,this.context=r}function Pe(e,r){if(r==null)return e.__?Pe(e.__,e.__i+1):null;for(var t;r<e.__k.length;r++)if((t=e.__k[r])!=null&&t.__e!=null)return t.__e;return typeof e.type=="function"?Pe(e):null}function dr(e){var r,t;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,r=0;r<e.__k.length;r++)if((t=e.__k[r])!=null&&t.__e!=null){e.__e=e.__c.base=t.__e;break}return dr(e)}}function ft(e){(!e.__d&&(e.__d=!0)&&he.push(e)&&!Oe.__r++||rr!==O.debounceRendering)&&((rr=O.debounceRendering)||sr)(Oe)}function Oe(){var e,r,t,o,s,a,h,p,v;for(he.sort(lt);e=he.shift();)e.__d&&(r=he.length,o=void 0,s=void 0,a=void 0,p=(h=(t=e).__v).__e,(v=t.__P)&&(o=[],s=[],(a=fe({},h)).__v=h.__v+1,mt(v,a,h,t.__n,v.ownerSVGElement!==void 0,h.__h!=null?[p]:null,o,p==null?Pe(h):p,h.__h,s),a.__.__k[a.__i]=a,_r(o,a,s),a.__e!=p&&dr(a)),he.length>r&&he.sort(lt));Oe.__r=0}function pr(e,r,t,o,s,a,h,p,v,D,x){var f,m,g,_,y,w,T,M,L,B=0,H=o&&o.__k||cr,S=H.length,k=S,A=r.length;for(t.__k=[],f=0;f<A;f++)(_=t.__k[f]=(_=r[f])==null||typeof _=="boolean"||typeof _=="function"?null:_.constructor==String||typeof _=="number"||typeof _=="bigint"?ke(null,_,null,null,_):He(_)?ke(se,{children:_},null,null,null):_.__b>0?ke(_.type,_.props,_.key,_.ref?_.ref:null,_.__v):_)!=null?(_.__=t,_.__b=t.__b+1,_.__i=f,(M=io(_,H,T=f+B,k))===-1?g=be:(g=H[M]||be,H[M]=void 0,k--),mt(e,_,g,s,a,h,p,v,D,x),y=_.__e,(m=_.ref)&&g.ref!=m&&(g.ref&&_t(g.ref,null,_),x.push(m,_.__c||y,_)),w==null&&y!=null&&(w=y),(L=g===be||g.__v===null)?M==-1&&B--:M!==T&&(M===T+1?B++:M>T?k>A-T?B+=M-T:B--:B=M<T&&M==T-1?M-T:0),T=f+B,typeof _.type=="function"?(M!==T||g.__k===_.__k?v=hr(_,v,e):_.__d!==void 0?v=_.__d:y&&(v=y.nextSibling),_.__d=void 0):y&&(v=M!==T||L?mr(e,y,v):y.nextSibling),typeof t.type=="function"&&(t.__d=v)):(g=H[f])&&g.key==null&&g.__e&&(g.__e==v&&(v=Pe(g),typeof t.type=="function"&&(t.__d=v)),dt(g,g,!1),H[f]=null);for(t.__e=w,f=S;f--;)H[f]!=null&&(typeof t.type=="function"&&H[f].__e!=null&&H[f].__e==v&&(t.__d=H[f].__e.nextSibling),dt(H[f],H[f]))}function hr(e,r,t){for(var o,s=e.__k,a=0;s&&a<s.length;a++)(o=s[a])&&(o.__=e,r=typeof o.type=="function"?hr(o,r,t):mr(t,o.__e,r));return r}function ht(e,r){return r=r||[],e==null||typeof e=="boolean"||(He(e)?e.some(function(t){ht(t,r)}):r.push(e)),r}function mr(e,r,t){return r!=t&&e.insertBefore(r,t||null),r.nextSibling}function io(e,r,t,o){var s=e.key,a=e.type,h=t-1,p=t+1,v=r[t];if(v===null||v&&s==v.key&&a===v.type)return t;if(o>(v!=null?1:0))for(;h>=0||p<r.length;){if(h>=0){if((v=r[h])&&s==v.key&&a===v.type)return h;h--}if(p<r.length){if((v=r[p])&&s==v.key&&a===v.type)return p;p++}}return-1}function ao(e,r,t,o,s){var a;for(a in t)a==="children"||a==="key"||a in r||Fe(e,a,null,t[a],o);for(a in r)s&&typeof r[a]!="function"||a==="children"||a==="key"||a==="value"||a==="checked"||t[a]===r[a]||Fe(e,a,r[a],t[a],o)}function nr(e,r,t){r[0]==="-"?e.setProperty(r,t==null?"":t):e[r]=t==null?"":typeof t!="number"||oo.test(r)?t:t+"px"}function Fe(e,r,t,o,s){var a;e:if(r==="style")if(typeof t=="string")e.style.cssText=t;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(r in o)t&&r in t||nr(e.style,r,"");if(t)for(r in t)o&&t[r]===o[r]||nr(e.style,r,t[r])}else if(r[0]==="o"&&r[1]==="n")a=r!==(r=r.replace(/(PointerCapture)$|Capture$/,"$1")),r=r.toLowerCase()in e?r.toLowerCase().slice(2):r.slice(2),e.l||(e.l={}),e.l[r+a]=t,t?o?t.u=o.u:(t.u=Date.now(),e.addEventListener(r,a?ir:or,a)):e.removeEventListener(r,a?ir:or,a);else if(r!=="dangerouslySetInnerHTML"){if(s)r=r.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(r!=="width"&&r!=="height"&&r!=="href"&&r!=="list"&&r!=="form"&&r!=="tabIndex"&&r!=="download"&&r!=="rowSpan"&&r!=="colSpan"&&r!=="role"&&r in e)try{e[r]=t==null?"":t;break e}catch(h){}typeof t=="function"||(t==null||t===!1&&r[4]!=="-"?e.removeAttribute(r):e.setAttribute(r,t))}}function or(e){var r=this.l[e.type+!1];if(e.t){if(e.t<=r.u)return}else e.t=Date.now();return r(O.event?O.event(e):e)}function ir(e){return this.l[e.type+!0](O.event?O.event(e):e)}function mt(e,r,t,o,s,a,h,p,v,D){var x,f,m,g,_,y,w,T,M,L,B,H,S,k,A,N=r.type;if(r.constructor!==void 0)return null;t.__h!=null&&(v=t.__h,p=r.__e=t.__e,r.__h=null,a=[p]),(x=O.__b)&&x(r);e:if(typeof N=="function")try{if(T=r.props,M=(x=N.contextType)&&o[x.__c],L=x?M?M.props.value:x.__:o,t.__c?w=(f=r.__c=t.__c).__=f.__E:("prototype"in N&&N.prototype.render?r.__c=f=new N(T,L):(r.__c=f=new Ee(T,L),f.constructor=N,f.render=uo),M&&M.sub(f),f.props=T,f.state||(f.state={}),f.context=L,f.__n=o,m=f.__d=!0,f.__h=[],f._sb=[]),f.__s==null&&(f.__s=f.state),N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=fe({},f.__s)),fe(f.__s,N.getDerivedStateFromProps(T,f.__s))),g=f.props,_=f.state,f.__v=r,m)N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(N.getDerivedStateFromProps==null&&T!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(T,L),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(T,f.__s,L)===!1||r.__v===t.__v)){for(r.__v!==t.__v&&(f.props=T,f.state=f.__s,f.__d=!1),r.__e=t.__e,r.__k=t.__k,r.__k.forEach(function(z){z&&(z.__=r)}),B=0;B<f._sb.length;B++)f.__h.push(f._sb[B]);f._sb=[],f.__h.length&&h.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(T,f.__s,L),f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,_,y)})}if(f.context=L,f.props=T,f.__P=e,f.__e=!1,H=O.__r,S=0,"prototype"in N&&N.prototype.render){for(f.state=f.__s,f.__d=!1,H&&H(r),x=f.render(f.props,f.state,f.context),k=0;k<f._sb.length;k++)f.__h.push(f._sb[k]);f._sb=[]}else do f.__d=!1,H&&H(r),x=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++S<25);f.state=f.__s,f.getChildContext!=null&&(o=fe(fe({},o),f.getChildContext())),m||f.getSnapshotBeforeUpdate==null||(y=f.getSnapshotBeforeUpdate(g,_)),pr(e,He(A=x!=null&&x.type===se&&x.key==null?x.props.children:x)?A:[A],r,t,o,s,a,h,p,v,D),f.base=r.__e,r.__h=null,f.__h.length&&h.push(f),w&&(f.__E=f.__=null)}catch(z){r.__v=null,v||a!=null?(r.__e=p,r.__h=!!v,a[a.indexOf(p)]=null):(r.__e=t.__e,r.__k=t.__k),O.__e(z,r,t)}else a==null&&r.__v===t.__v?(r.__k=t.__k,r.__e=t.__e):r.__e=so(t.__e,r,t,o,s,a,h,v,D);(x=O.diffed)&&x(r)}function _r(e,r,t){r.__d=void 0;for(var o=0;o<t.length;o++)_t(t[o],t[++o],t[++o]);O.__c&&O.__c(r,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(a){a.call(s)})}catch(a){O.__e(a,s.__v)}})}function so(e,r,t,o,s,a,h,p,v){var D,x,f,m=t.props,g=r.props,_=r.type,y=0;if(_==="svg"&&(s=!0),a!=null){for(;y<a.length;y++)if((D=a[y])&&"setAttribute"in D==!!_&&(_?D.localName===_:D.nodeType===3)){e=D,a[y]=null;break}}if(e==null){if(_===null)return document.createTextNode(g);e=s?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,g.is&&g),a=null,p=!1}if(_===null)m===g||p&&e.data===g||(e.data=g);else{if(a=a&&Be.call(e.childNodes),x=(m=t.props||be).dangerouslySetInnerHTML,f=g.dangerouslySetInnerHTML,!p){if(a!=null)for(m={},y=0;y<e.attributes.length;y++)m[e.attributes[y].name]=e.attributes[y].value;(f||x)&&(f&&(x&&f.__html==x.__html||f.__html===e.innerHTML)||(e.innerHTML=f&&f.__html||""))}if(ao(e,g,m,s,p),f)r.__k=[];else if(pr(e,He(y=r.props.children)?y:[y],r,t,o,s&&_!=="foreignObject",a,h,a?a[0]:t.__k&&Pe(t,0),p,v),a!=null)for(y=a.length;y--;)a[y]!=null&&lr(a[y]);p||("value"in g&&(y=g.value)!==void 0&&(y!==e.value||_==="progress"&&!y||_==="option"&&y!==m.value)&&Fe(e,"value",y,m.value,!1),"checked"in g&&(y=g.checked)!==void 0&&y!==e.checked&&Fe(e,"checked",y,m.checked,!1))}return e}function _t(e,r,t){try{typeof e=="function"?e(r):e.current=r}catch(o){O.__e(o,t)}}function dt(e,r,t){var o,s;if(O.unmount&&O.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||_t(o,null,r)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){O.__e(a,r)}o.base=o.__P=null,e.__c=void 0}if(o=e.__k)for(s=0;s<o.length;s++)o[s]&&dt(o[s],r,t||typeof e.type!="function");t||e.__e==null||lr(e.__e),e.__=e.__e=e.__d=void 0}function uo(e,r,t){return this.constructor(e,t)}function vt(e,r,t){var o,s,a,h;O.__&&O.__(e,r),s=(o=typeof t=="function")?null:t&&t.__k||r.__k,a=[],h=[],mt(r,e=(!o&&t||r).__k=pt(se,null,[e]),s||be,be,r.ownerSVGElement!==void 0,!o&&t?[t]:s?null:r.firstChild?Be.call(r.childNodes):null,a,!o&&t?t:s?s.__e:r.firstChild,o,h),_r(a,e,h)}function vr(e,r){var t={__c:r="__cC"+ur++,__:e,Consumer:function(o,s){return o.children(s)},Provider:function(o){var s,a;return this.getChildContext||(s=[],(a={})[r]=this,this.getChildContext=function(){return a},this.shouldComponentUpdate=function(h){this.props.value!==h.value&&s.some(function(p){p.__e=!0,ft(p)})},this.sub=function(h){s.push(h);var p=h.componentWillUnmount;h.componentWillUnmount=function(){s.splice(s.indexOf(h),1),p&&p.call(h)}}),o.children}};return t.Provider.__=t.Consumer.contextType=t}Be=cr.slice,O={__e:function(e,r,t,o){for(var s,a,h;r=r.__;)if((s=r.__c)&&!s.__)try{if((a=s.constructor)&&a.getDerivedStateFromError!=null&&(s.setState(a.getDerivedStateFromError(e)),h=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,o||{}),h=s.__d),h)return s.__E=s}catch(p){e=p}throw e}},ar=0,no=function(e){return e!=null&&e.constructor==null},Ee.prototype.setState=function(e,r){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=fe({},this.state),typeof e=="function"&&(e=e(fe({},t),this.props)),e&&fe(t,e),e!=null&&this.__v&&(r&&this._sb.push(r),ft(this))},Ee.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ft(this))},Ee.prototype.render=se,he=[],sr=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,lt=function(e,r){return e.__v.__b-r.__v.__b},Oe.__r=0,ur=0;var me,q,yt,yr,We=0,Ir=[],ze=[],gr=O.__b,br=O.__r,Er=O.diffed,wr=O.__c,Sr=O.unmount;function De(e,r){O.__h&&O.__h(q,e,We||r),We=0;var t=q.__H||(q.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({__V:ze}),t.__[e]}function J(e){return We=1,co(Dr,e)}function co(e,r,t){var o=De(me++,2);if(o.t=e,!o.__c&&(o.__=[t?t(r):Dr(void 0,r),function(p){var v=o.__N?o.__N[0]:o.__[0],D=o.t(v,p);v!==D&&(o.__N=[D,o.__[1]],o.__c.setState({}))}],o.__c=q,!q.u)){var s=function(p,v,D){if(!o.__c.__H)return!0;var x=o.__c.__H.__.filter(function(m){return m.__c});if(x.every(function(m){return!m.__N}))return!a||a.call(this,p,v,D);var f=!1;return x.forEach(function(m){if(m.__N){var g=m.__[0];m.__=m.__N,m.__N=void 0,g!==m.__[0]&&(f=!0)}}),!(!f&&o.__c.props===p)&&(!a||a.call(this,p,v,D))};q.u=!0;var a=q.shouldComponentUpdate,h=q.componentWillUpdate;q.componentWillUpdate=function(p,v,D){if(this.__e){var x=a;a=void 0,s(p,v,D),a=x}h&&h.call(this,p,v,D)},q.shouldComponentUpdate=s}return o.__N||o.__}function de(e,r){var t=De(me++,3);!O.__s&&bt(t.__H,r)&&(t.__=e,t.i=r,q.__H.__h.push(t))}function Tr(e,r){var t=De(me++,4);!O.__s&&bt(t.__H,r)&&(t.__=e,t.i=r,q.__h.push(t))}function _e(e){return We=5,lo(function(){return{current:e}},[])}function lo(e,r){var t=De(me++,7);return bt(t.__H,r)?(t.__V=e(),t.i=r,t.__h=e,t.__V):t.__}function Pr(e){var r=q.context[e.__c],t=De(me++,9);return t.c=e,r?(t.__==null&&(t.__=!0,r.sub(q)),r.props.value):e.__}function fo(){for(var e;e=Ir.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ue),e.__H.__h.forEach(gt),e.__H.__h=[]}catch(r){e.__H.__h=[],O.__e(r,e.__v)}}O.__b=function(e){q=null,gr&&gr(e)},O.__r=function(e){br&&br(e),me=0;var r=(q=e.__c).__H;r&&(yt===q?(r.__h=[],q.__h=[],r.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=ze,t.__N=t.i=void 0})):(r.__h.forEach(Ue),r.__h.forEach(gt),r.__h=[],me=0)),yt=q},O.diffed=function(e){Er&&Er(e);var r=e.__c;r&&r.__H&&(r.__H.__h.length&&(Ir.push(r)!==1&&yr===O.requestAnimationFrame||((yr=O.requestAnimationFrame)||po)(fo)),r.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==ze&&(t.__=t.__V),t.i=void 0,t.__V=ze})),yt=q=null},O.__c=function(e,r){r.some(function(t){try{t.__h.forEach(Ue),t.__h=t.__h.filter(function(o){return!o.__||gt(o)})}catch(o){r.some(function(s){s.__h&&(s.__h=[])}),r=[],O.__e(o,t.__v)}}),wr&&wr(e,r)},O.unmount=function(e){Sr&&Sr(e);var r,t=e.__c;t&&t.__H&&(t.__H.__.forEach(function(o){try{Ue(o)}catch(s){r=s}}),t.__H=void 0,r&&O.__e(r,t.__v))};var Cr=typeof requestAnimationFrame=="function";function po(e){var r,t=function(){clearTimeout(o),Cr&&cancelAnimationFrame(r),setTimeout(e)},o=setTimeout(t,100);Cr&&(r=requestAnimationFrame(t))}function Ue(e){var r=q,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),q=r}function gt(e){var r=q;e.__c=e.__(),q=r}function bt(e,r){return!e||e.length!==r.length||r.some(function(t,o){return t!==e[o]})}function Dr(e,r){return typeof r=="function"?r(e):r}var ho=0;function F(e,r,t,o,s,a){var h,p,v={};for(p in r)p=="ref"?h=r[p]:v[p]=r[p];var D={type:e,props:v,key:t,ref:h,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--ho,__i:-1,__source:s,__self:a};if(typeof e=="function"&&(h=e.defaultProps))for(p in h)v[p]===void 0&&(v[p]=h[p]);return O.vnode&&O.vnode(D),D}var xr=vr(null),te=()=>{let e=Pr(xr);if(e===null)throw new Error("useAppMount() called without a <AppMountProvider /> in the tree.");return e};function Et(e){return F(xr.Provider,{value:X({},e),children:e.children})}var Or=require("obsidian");var wt=2,Ve=class extends Ee{constructor(t){super(t);this.reCalculateColumnCount=this.reCalculateColumnCount.bind(this),this.reCalculateColumnCountDebounce=this.reCalculateColumnCountDebounce.bind(this);let{breakpointCols:o}=t,s;typeof o=="number"?s=o:o&&o.hasOwnProperty("default")?s=o.default:s=wt,this.ref=fr(),this.resizeObserver=null,this.state={columnCount:s}}componentDidMount(){this.reCalculateColumnCount(),this.resizeObserver=new ResizeObserver(()=>{this.reCalculateColumnCountDebounce()});let t=this.ref.current;this.resizeObserver.observe(t)}componentDidUpdate(){this.reCalculateColumnCount()}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect()}reCalculateColumnCountDebounce(){if(!window||!window.requestAnimationFrame){this.reCalculateColumnCount();return}window.cancelAnimationFrame&&window.cancelAnimationFrame(this._lastRecalculateAnimationFrame),this._lastRecalculateAnimationFrame=window.requestAnimationFrame(()=>{this.reCalculateColumnCount()})}reCalculateColumnCount(){let t=this.ref.current&&this.ref.current.offsetWidth||1/0,{breakpointCols:o}=this.props;if(t===1/0)return;typeof o=="number"&&(o={default:o||wt});let s=1/0,a=(o==null?void 0:o.default)||wt;for(let h in o){let p=parseInt(h);p>0&&t<=p&&p<s&&(s=p,a=o[p])}a=Math.max(1,a||1),this.state.columnCount!==a&&this.setState({columnCount:a})}itemsInColumns(){let t=this.state.columnCount,o=new Array(t),s=ht(this.props.children);for(let a=0;a<s.length;a++){let h=a%t;o[h]||(o[h]=[]),o[h].push(s[a])}return o}renderColumns(){let{column:t,columnAttrs:o={},columnClassName:s}=this.props,a=this.itemsInColumns(),h=`${100/a.length}%`,p=s;p&&typeof p!="string"&&(this.logDeprecated('The property "columnClassName" requires a string'),typeof p=="undefined"&&(p="my-masonry-grid_column"));let v=ne(X(X({},t),o),{style:ne(X({},o.style),{width:h}),className:p});return a.map((D,x)=>pt("div",ne(X({},v),{key:x}),D))}logDeprecated(t){console.error("[Masonry]",t)}render(){let x=this.props,{children:t,breakpointCols:o,columnClassName:s,columnAttrs:a,column:h,className:p}=x,v=Ne(x,["children","breakpointCols","columnClassName","columnAttrs","column","className"]),D=p;return typeof p!="string"&&(this.logDeprecated('The property "className" requires a string'),typeof p=="undefined"&&(D="my-masonry-grid")),F("div",ne(X({},v),{ref:this.ref,className:D,children:this.renderColumns()}))}};Ve.defaultProps={breakpointCols:void 0,className:void 0,columnClassName:void 0,children:void 0,columnAttrs:void 0,column:void 0};var Mr=Ve;function we(e){let h=e,{file:r}=h,t=Ne(h,["file"]),{app:o,sourcePath:s}=te(),a=p=>{let v=p.altKey&&(p.ctrlKey||p.metaKey)?"split":p.ctrlKey||p.metaKey?"tab":!1;r&&o.workspace.openLinkText(r.path,s,v)};return F("div",ne(X({},t),{className:"note-card",onClick:a,children:e.children}))}var Nr=require("obsidian");var Se=require("obsidian");var St=(e,r)=>{e!==null&&r!==null&&(e&&!e.firstChild?e.appendChild(r):e.firstChild&&e.firstChild!==r&&e.replaceChild(r,e.firstChild))},mo=(e,r,t,o)=>K(void 0,null,function*(){let s=document.createElement("div");s.style.height="100%",s.style.width="100%";try{t instanceof Se.MarkdownRenderChild&&(yield Se.MarkdownRenderer.render(e,o,s,r,t))}catch(a){console.error(a)}return s}),_o=e=>{let r=new DOMParser,t=document.createElement("div"),o=r.parseFromString(e,"text/html"),s=Array.from(o.body.children);for(let a of s)t.appendChild(a);return t.style.height="100%",t.style.width="100%",t},Ar=(e,r)=>{let{app:t,db:o,component:s,sourcePath:a}=te(),h=_e(null),p=_e(null),[v,D]=J(!1),[x,f]=J(!0);return Tr(()=>{K(void 0,null,function*(){let m=null;if(e.rendered&&e.innerHTML)m=_o(e.innerHTML);else if(e.hasMarkdown&&e.markdown&&e.markdownMobile){let g=Se.Platform.isDesktopApp?e.markdown:e.markdownMobile;if(m=yield mo(t,a,s,g),!m.innerHTML.includes("pdf-embed")&&!m.innerHTML.includes("pdf-viewer")&&!m.innerHTML.includes("block-language-note-gallery")){let _=ne(X({},e),{rendered:!0,innerHTML:m.innerHTML});o.storeKey(r.path,_,r.stat.mtime,!1)}f(!1)}m&&m.innerHTML&&(p.current=m,h.current&&St(h.current,m),D(!0))})},[e,a]),{containerRef:h,renderRef:p,rendered:v,cached:x}},Rr=(e,r)=>e.vault.adapter.getResourcePath(r);function Ke(e,{threshold:r=0,root:t=null,rootMargin:o="0%",freezeOnceVisible:s=!1}){let[a,h]=J(),p=(a==null?void 0:a.isIntersecting)&&s,v=([D])=>{h(D)};return de(()=>{let D=e==null?void 0:e.current;if(!!!window.IntersectionObserver||p||!D)return;let f={threshold:r,root:t,rootMargin:o},m=new IntersectionObserver(v,f);return m.observe(D),()=>m.disconnect()},[e,r,t,o,p]),a}function Ct(e){let{db:r,settings:t}=te(),{file:o}=e,s=r.getItem(o.path),{data:a}=s,{containerRef:h,renderRef:p,rendered:v,cached:D}=Ar(a,o),x=_e(null),f=Ke(x,{rootMargin:"33%",freezeOnceVisible:!0}),m=!!(f!=null&&f.isIntersecting);return F(se,{children:F("div",{ref:x,children:[t.showtitle&&F("hr",{style:{borderTop:D?"":"1px solid var(--interactive-accent)"}}),F("div",{style:{opacity:m?1:0,transition:"opacity ease-in 100ms"},className:"card-content-container",ref:g=>{a.hasMarkdown&&a.markdown!==""&&v&&m&&(h.current=g,St(g,p.current))},children:F("div",{style:{opacity:0,whiteSpace:"pre-wrap"},children:Nr.Platform.isDesktopApp?a.text:a.textMobile})})]})})}function It(e){let{settings:r}=te(),{file:t}=e;return F(se,{children:[r.showtitle&&F("div",{className:"inline-title",children:t.basename}),F("div",{className:"card-content",children:[F("div",{className:"card-content-wall"}),F(Ct,{file:t})]})]})}function Tt(e){let{hasMore:r,loadMore:t}=e,o=_e(null),s=Ke(o,{}),a=!!(s!=null&&s.isIntersecting);return de(()=>{r&&a&&t()},[a,r,t]),F("div",{ref:o,children:r&&F(we,{children:[F("h1",{children:"Hold on a second..."}),F("h6",{children:"There are more files!"})]})})}var ve=require("obsidian");var vo=["jpeg","jpg","gif","png","webp","tiff","tif","md"],Lr=(e,r=!1)=>e.reduce((t,o)=>(r&&o instanceof ve.TFolder?t=t.concat(Lr(o.children,!0)):o instanceof ve.TFile&&t.push(o),t),[]),yo=(e,r)=>{let{vault:t}=e,o=t;return o.getAbstractFileByPathInsensitive?o.getAbstractFileByPathInsensitive(r):t.getAbstractFileByPath(r)},go=(e,r)=>{let t=null,o=yo(e,r.path);return o instanceof ve.TFolder?{files:Lr(o.children,r.recursive),error:t}:(r.path&&r.path!==""&&(t="The folder specified in `path` doesn't exist!"),{files:[],error:t})},bo=(e,r,t,o)=>{let s=e.filter(a=>a.path!==t&&vo.includes(a.extension)).filter(a=>{if(a.extension!=="md")return!0;let h=r.getItem(a.path);if(!h)return!1;let{data:p}=h;return!p.markdown||!p.hasMarkdown?!1:!(p.markdown.contains("```note-gallery")||p.markdown.contains("~~~note-gallery"))}).sort((a,h)=>{let p=o.sortby==="name"?a.name.toUpperCase():a.stat[o.sortby],v=o.sortby==="name"?h.name.toUpperCase():h.stat[o.sortby],D=o.sort==="asc"?-1:1;return p<v?D:p>v?D*-1:0});return o.limit===0?s:s.splice(0,o.limit)},Eo=e=>{switch(`${e.sortby}:${e.sort}`){case"mtime:desc":return"byModifiedTime";case"mtime:asc":return"byModifiedTimeReverse";case"ctime:desc":return"byCreatedTime";case"ctime:asc":return"byCreatedTimeReverse";case"name:desc":return"alphabeticalReverse";case"name:asc":return"alphabetical";default:return"byModifiedTime"}},wo=(e,r)=>{if(!!e){if(r.debugquery)e.el.style.maxHeight="300px",e.el.style.padding="10px",e.el.style.marginBottom="12px",e.el.style.border="1px solid var(--background-modifier-border)",e.el.style.borderRadius="5px";else{e.el.style.height="8px";let t=e.el.firstChild;t&&t.remove()}e.el.style.removeProperty("display")}},kr=()=>{let{app:e,db:r,sourcePath:t,settings:o,embeddedSearch:s}=te(),[a,h]=J(null),[p,v]=J([]),D=100;return de(()=>{let x=()=>{let{files:y,error:w}=go(e,o);return w?(h(w),[]):y},f=y=>{let w=s==null?void 0:s.dom;if(!w||!w.parent)return[];if(!y||!y.parent)return[];if(!y.parent.sourcePath||y.parent.sourcePath!==w.parent.sourcePath)return[];let T=Eo(o);w.setSortOrder&&w.sortOrder!==T&&w.setSortOrder(T);let M=y!=null&&y.resultDomLookup?y.resultDomLookup:w==null?void 0:w.resultDomLookup;return M?Array.from(M.keys()):[]},m=(y,w)=>{w&&wo(y,o);let T=[...p,...x(),...f(y)],M=[...new Map(T.map(B=>[B.path,B])).values()],L=bo(M,r,t,o);L.length&&v(L)};p.length||m(s==null?void 0:s.dom,!0);let g=(0,ve.debounce)(m,D,!0),_=()=>g(s==null?void 0:s.dom,!0);return e.workspace.on("search:onChange",g),r.on("database-update",_),()=>{e.workspace.off("search:onChange",g),r.off("database-update",_)}}),{error:a,files:p}};var So=({error:e})=>F("p",{style:{borderRadius:"4px",padding:"2px 16px",backgroundColor:"#e50914",color:"#fff",fontWeight:"bolder"},children:["(Error) Note Gallery: ",e]});function Pt(){let{app:e,settings:r}=te(),t=Or.Platform.isDesktopApp?100:10,{error:o,files:s}=kr(),[a,h]=J(!0),[p,v]=J(t),D=()=>{p>=s.length?h(!1):setTimeout(()=>{v(p+t)},100)},x=f=>{let m=[];for(let g=0;g<p;g++){let _=f[g];_&&_.extension==="md"?m.push(F(we,{file:_,children:F(It,{file:_})},_.name)):_&&m.push(F(we,{file:_,children:F("img",{src:Rr(e,_.path)})},_.name))}return m};return F("div",{children:[o&&F(So,{error:o}),s.length>0&&F(Mr,{breakpointCols:r.breakpoints,className:"masonry-grid",columnClassName:"masonry-grid_column",children:[x(s),F(Tt,{hasMore:a,loadMore:D})]})]})}function Dt({app:e,plugin:r,component:t,containerEl:o,searchEl:s,sourcePath:a,settings:h,db:p}){let[v,D]=J(!1),[x,f]=J(void 0);return de(()=>{o.style.setProperty("--note-card-font-size",h.fontsize);let m=y=>{if(!x){let w=t.addChild(new y(e,s,h.query,a));f(w)}},g=()=>{v||D(!0),r.EmbeddedSearch&&m(r.EmbeddedSearch)},_=()=>{v&&D(!1)};return p.ready&&g(),p.on("database-update",g),p.on("database-drop",_),e.workspace.on("catchEmbeddedSearch",m),()=>{p.off("database-update",g),p.off("database-drop",_),e.workspace.off("catchEmbeddedSearch",m)}}),F(Et,{app:e,component:t,sourcePath:a,db:p,embeddedSearch:x,settings:h,children:[!v&&F("div",{children:F("h1",{children:"Note Gallery: Indexing Database..."})}),v&&F(Pt,{})]})}var $e=require("obsidian");var Co=(e,r)=>{let t=e.createEl("div");t.createEl("p",{text:`(Error) Note Gallery: ${r}`}),t.style.borderRadius="var(--callout-radius)",t.style.padding="var(--callout-padding)",t.style.backgroundColor="var(--background-modifier-error)",t.style.color="var(--text-on-accent-inverted)",t.style.fontWeight="var(--font-bold)"},xt=Co;var Io={path:"",query:"",limit:0,recursive:!0,sort:"desc",sortby:"mtime",fontsize:"6pt",showtitle:!0,debugquery:!1,breakpoints:{default:4,1e5:10,3500:10,3100:9,2700:8,2300:7,1900:6,1500:5,1e3:4,700:3,400:2,200:1}},Fr=(e,r=!1)=>Object.keys(e).reduce((t,o)=>(t[o.toLowerCase()]=r&&typeof e[o]=="object"?Fr(e[o]):e[o],t),{}),To=(e,r,t,o)=>{let s;try{s=(0,$e.parseYaml)(e)}catch(h){let p="Cannot parse YAML!";throw h instanceof Error&&(p=h.message),xt(t,p),h}if(s===void 0){let h="Cannot parse YAML!";throw xt(t,h),new Error(h)}s!==null&&(s=Fr(s));let a=X(X({},Io),s);if(s===null||!s.path&&!s.query){let h=r.vault.getAbstractFileByPath(o.sourcePath).parent;a.path=h.path}return a.path&&(a.path=(0,$e.normalizePath)(a.path)),a.path||(a.path=""),a.query||(a.query=""),a},Br=To;var xe=class extends Hr.MarkdownRenderChild{constructor(t,o,s,a,h){super(s);this.plugin=t;this.src=o;this.containerEl=s;this.app=a;this.ctx=h;this.settings=Br(o,a,s,h)}onload(){return K(this,null,function*(){this.searchEl=this.containerEl.createEl("div"),this.reactEl=this.containerEl.createEl("div"),this.searchEl.style.display="none",this.searchEl.style.overflowY="scroll",this.plugin.EmbeddedSearch||(yield this.plugin.triggerEmbeddedSearchPatch()),vt(F(Dt,{app:this.app,plugin:this.plugin,component:this,containerEl:this.reactEl,searchEl:this.searchEl,sourcePath:this.ctx.sourcePath,settings:this.settings,db:this.plugin.db}),this.reactEl)})}onunload(){return K(this,null,function*(){vt(null,this.reactEl)})}};var pe=ct(qe()),re=require("obsidian"),$r=ct(Wr()),qr=ct(Kr());(0,qr.extendPrototype)(pe.default);(0,$r.extendPrototype)(pe.default);var At=class extends re.Events{constructor(){super(...arguments);this._events=[]}onunload(){}unload(){for(;this._events.length>0;)this._events.pop()()}register(t){this._events.push(t)}registerEvent(t){this.register(()=>t.e.offref(t))}},je=class extends At{constructor(t,o,s,a,h,p,v,D=2,x=f=>f){super();this.plugin=t;this.name=o;this.title=s;this.version=a;this.description=h;this.defaultValue=p;this.extractValue=v;this.workers=D;this.loadValue=x;this.memory=new Map;this.deleted_keys=new Set;this.ready=!1;this.databaseUpdate=(0,re.debounce)(()=>{this.trigger("database-update",this.allEntries()),this.flushChanges()},100,!0);this.flushChanges=(0,re.debounce)(()=>K(this,null,function*(){yield this.persistMemory(),this.trigger("database-update",this.allEntries())}),1e3,!0);let f=this.plugin.app.loadLocalStorage(o+"-version"),m=f?parseInt(f):null;this.persist=pe.default.createInstance({name:this.name+`/${this.plugin.app.appId}`,driver:pe.default.INDEXEDDB,description:h,version:a}),this.plugin.app.workspace.onLayoutReady(()=>K(this,null,function*(){yield this.persist.ready(()=>K(this,null,function*(){yield this.loadDatabase(),this.trigger("database-update",this.allEntries());let g=m!==null&&m<a?"Migrating":this.isEmpty()?"Initializing":"Syncing",{progress_bar:_,notice:y}=this.createNotice(g,s);m!==null&&m<a&&!this.isEmpty()?(yield this.clearDatabase(),yield this.rebuildDatabase(_,y),this.trigger("database-migrate"),this.trigger("database-update",this.allEntries())):this.isEmpty()?(yield this.rebuildDatabase(_,y),this.trigger("database-create"),this.trigger("database-update",this.allEntries())):yield this.syncDatabase(_,y),this.ready=!0,this.registerEvent(this.plugin.app.vault.on("modify",w=>K(this,null,function*(){var T;if(w instanceof re.TFile&&w.extension==="md"){let M=this.plugin.app.workspace.activeEditor,L=M&&((T=M.file)==null?void 0:T.path)===w.path&&M.editor?M.editor.cm.state:void 0,B=yield this.plugin.app.vault.cachedRead(w);this.storeKey(w.path,yield this.extractValue(B,w,L),w.stat.mtime)}}))),this.registerEvent(this.plugin.app.vault.on("delete",w=>K(this,null,function*(){w instanceof re.TFile&&w.extension==="md"&&this.deleteKey(w.path)}))),this.registerEvent(this.plugin.app.vault.on("rename",(w,T)=>K(this,null,function*(){w instanceof re.TFile&&w.extension==="md"&&this.renameKey(T,w.path,w.stat.mtime)}))),this.registerEvent(this.plugin.app.vault.on("create",w=>K(this,null,function*(){w instanceof re.TFile&&w.extension==="md"&&this.storeKey(w.path,this.defaultValue(),w.stat.mtime)})))}))}))}on(t,o,s){return super.on(t,o,s)}loadDatabase(){return K(this,null,function*(){this.memory=new Map(Object.entries(yield this.persist.getItems()).map(([t,o])=>(o.data=this.loadValue(o.data),[t,o])))})}regularParseFiles(t,o){return K(this,null,function*(){for(let s=0;s<t.length;s++){let a=t[s],h=this.getItem(a.path);if(h===null||h.mtime<a.stat.mtime){let p=yield this.plugin.app.vault.cachedRead(a);this.storeKey(a.path,yield this.extractValue(p,a),a.stat.mtime,!0)}o.setAttribute("value",(s+1).toString())}})}syncDatabase(t,o){return K(this,null,function*(){let s=this.plugin.app.vault.getMarkdownFiles();this.initializeProgressBar(t,s.length),this.allKeys().forEach(h=>{s.some(p=>p.path===h)||this.deleteKey(h)});let a=s.filter(h=>!this.memory.has(h.path)||this.memory.get(h.path).mtime<h.stat.mtime);yield this.regularParseFiles(a,t),this.plugin.app.saveLocalStorage(this.name+"-version",this.version.toString()),o.hide()})}rebuildDatabase(t,o){return K(this,null,function*(){let s=this.plugin.app.vault.getMarkdownFiles();this.initializeProgressBar(t,s.length),yield this.regularParseFiles(s,t),this.plugin.app.saveLocalStorage(this.name+"-version",this.version.toString()),o.hide()})}persistMemory(){return K(this,null,function*(){let t={};for(let[o,s]of this.memory.entries())s.dirty&&(t[o]={data:s.data,mtime:s.mtime},this.memory.set(o,{data:s.data,mtime:s.mtime,dirty:!1}));yield this.persist.setItems(t),yield Promise.all(Array.from(this.deleted_keys.values()).map(o=>K(this,null,function*(){return yield this.persist.removeItem(o)}))),this.deleted_keys.clear()})}createNotice(t,o){let s=new DocumentFragment,a=s.createEl("div"),h=s.createEl("div",{cls:"commentator-progress-bar"}),p=new re.Notice(s,0),v=h.createEl("progress");return a.textContent=`${t} ${o} database...`,{progress_bar:v,notice:p}}initializeProgressBar(t,o){t.setAttribute("max",o.toString()),t.setAttribute("value","0")}storeKey(t,o,s,a=!0){this.memory.set(t,{data:o,mtime:s!=null?s:Date.now(),dirty:a}),this.databaseUpdate()}deleteKey(t){if(this.getItem(t)==null)throw new Error("Key does not exist");this.memory.delete(t),this.deleted_keys.add(t),this.databaseUpdate()}renameKey(t,o,s){let a=this.getItem(t);if(a==null)throw new Error("Key does not exist");this.storeKey(o,a.data,s),this.deleteKey(t),this.databaseUpdate()}allKeys(){return Array.from(this.memory.keys())}getValue(t){var o,s;return(s=(o=this.memory.get(t))==null?void 0:o.data)!=null?s:null}allValues(){return Array.from(this.memory.values()).map(t=>t.data)}getItem(t){var o;return(o=this.memory.get(t))!=null?o:null}allItems(){return Array.from(this.memory.values())}allEntries(){return Array.from(this.memory.entries())}dropDatabase(){return K(this,null,function*(){this.trigger("database-drop"),this.memory.clear(),yield pe.default.dropInstance({name:this.name+`/${this.plugin.app.appId}`}),localStorage.removeItem(this.plugin.app.appId+"-"+this.name+"-version")})}reinitializeDatabase(){return K(this,null,function*(){yield this.dropDatabase(),this.persist=pe.default.createInstance({name:this.name+`/${this.plugin.app.appId}`,driver:pe.default.INDEXEDDB,version:this.version,description:this.description});let t="Initializing",{progress_bar:o,notice:s}=this.createNotice(t,this.title);yield this.rebuildDatabase(o,s),this.trigger("database-update",this.allEntries())})}clearDatabase(){return K(this,null,function*(){this.trigger("database-drop"),this.memory.clear(),yield this.persist.clear()})}isEmpty(){return this.memory.size===0}};var Po={text:null,textMobile:null,markdown:null,markdownMobile:null,innerHTML:null,hasMarkdown:!1,rendered:!1};function Gr(e,r,t){return K(this,null,function*(){let a="";if(e.startsWith("---")){let D=e.indexOf("---",3);a=e.slice(0,D+3).trim(),e=e.slice(D+3,e.length).trim()}let h=e.split(`
`).slice(0,200).join(`
`),p=e.split(`
`).slice(0,30).join(`
`);e=[a,h].join(`
`).trim();let v=[a,p].join(`
`).trim();return{text:h,textMobile:p,markdown:e,markdownMobile:v,hasMarkdown:!0,innerHTML:null,rendered:!1}})}function Do(e){return(e.innerHTML||e.rendered)&&(e=ne(X({},e),{innerHTML:null,rendered:!1})),e}var Qe=class extends ue.Plugin{constructor(){super(...arguments);this.EmbeddedSearchLeafInitializer=null;this.EmbeddedSearch=null;this.isEmbeddedSearchPatched=!1}onload(){return K(this,null,function*(){this.db=this.registerDb(),this.patchCatchEmbeddedSearch(),this.registerMarkdownCodeBlockProcessor("note-gallery",(t,o,s)=>K(this,null,function*(){let a=new xe(this,t,o,this.app,s);s.addChild(a)})),this.addCommand({id:"drop-database",name:"Drop all cache and re-initialize database",callback:()=>{this.db.reinitializeDatabase()}})})}onunload(){return K(this,null,function*(){})}registerDb(){return new je(this,"render-store","Render Store",6,"Stores text and renderedHTML of a file to be rendered by the note gallery",()=>Po,Gr,2,Do)}patchCatchEmbeddedSearch(){let t=this;t.register(Le(ue.Component.prototype,{addChild(o){return function(s,...a){try{if(s instanceof ue.Component&&s.hasOwnProperty("searchQuery")&&s.hasOwnProperty("sourcePath")&&s.hasOwnProperty("dom")){let p=s;t.EmbeddedSearch||(t.EmbeddedSearch=p.constructor,t.app.workspace.trigger("catchEmbeddedSearch",p.constructor)),t.EmbeddedSearchLeafInitializer&&setTimeout(()=>{var v;(v=t.EmbeddedSearchLeafInitializer)==null||v.detach(),t.EmbeddedSearchLeafInitializer=null},100),t.isEmbeddedSearchPatched||(t.patchEmbeddedSearch(p),t.isEmbeddedSearchPatched=!0)}}catch(p){console.log({type:"Patching CatchEmbeddedSearch Error",err:p})}return o.call(this,s,...a)}}}))}patchEmbeddedSearch(t){let o=this,s=t.dom.constructor;this.register(Le(t.constructor.prototype,{onload(a){return function(...h){try{this.dom&&(this.dom.parent=this)}catch(p){console.log({type:"Patching EmbeddedSearch Error",err:p})}return a.call(this,...h)}}})),o.patchEmbeddedSearchDOM(s)}patchEmbeddedSearchDOM(t){let o=this;o.register(Le(t.prototype,{startLoader(s){return function(...a){var h,p;try{!this.patched&&((h=this.el.parentElement)==null?void 0:h.hasClass("block-language-note-gallery"))&&((p=this.el)==null?void 0:p.closest(".block-language-note-gallery"))&&(this.patched=!0,this.setSortOrder=v=>{console.log(`Note Gallery: Setting native search sort order ${v}`),this.sortOrder=v,this.changed(),this.infinityScroll.invalidateAll()})}catch(v){console.log({type:"Patching EmbeddedSearchDOM.startLoader Error",err:v})}return s.call(this,...a)}},addResult(s){return function(a,h,p,...v){let D;return p.contains("note-gallery")?(D=s.call(this,a,h,p.replace("note-gallery","note-gallery".toUpperCase().replace("-","_")),...v),D):(D=s.call(this,a,h,p,...v),D)}},onChange(s){return function(...a){try{o.app.workspace.trigger("search:onChange",this)}catch(h){console.log({type:"Patching EmbeddedSearchDOM.onChange Error",err:h})}return s.call(this,...a)}}}))}triggerEmbeddedSearchPatch(){return K(this,null,function*(){let t=new ue.WorkspaceSplit(this.app.workspace,"vertical"),o=this.EmbeddedSearchLeafInitializer=this.attachLeaf(t),s=new ue.MarkdownView(o);s.setViewData("```query\n```",!0),yield o.open(s);let a=o.getViewState();a.state.source=!1,o.setViewState(a)})}attachLeaf(t){return t.getRoot=()=>this.app.workspace.rootSplit,t.getContainer=()=>this.app.workspace.rootSplit,this.app.workspace.createLeafInParent(t,0)}};
/*!
localForage -- Offline Storage, Improved
Version 1.10.0
https://localforage.github.io/localForage
(c) 2013-2017 Mozilla, Apache License 2.0
*/