19 lines
71 KiB
JavaScript
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.o
|
||
|
`).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
|
||
|
*/
|