Notepad/enter/.obsidian/plugins/omnisearch/main.js

56 lines
1.3 MiB
JavaScript
Raw Permalink Normal View History

2023-07-05 18:29:11 +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
*/
var KJ=Object.create;var xQ=Object.defineProperty,gJ=Object.defineProperties,PJ=Object.getOwnPropertyDescriptor,qJ=Object.getOwnPropertyDescriptors,_J=Object.getOwnPropertyNames,zB=Object.getOwnPropertySymbols,AJ=Object.getPrototypeOf,FV=Object.prototype.hasOwnProperty,hd=Object.prototype.propertyIsEnumerable;var cd=(F,U,Q)=>U in F?xQ(F,U,{enumerable:!0,configurable:!0,writable:!0,value:Q}):F[U]=Q,z=(F,U)=>{for(var Q in U||(U={}))FV.call(U,Q)&&cd(F,Q,U[Q]);if(zB)for(var Q of zB(U))hd.call(U,Q)&&cd(F,Q,U[Q]);return F},q=(F,U)=>gJ(F,qJ(U)),rd=F=>xQ(F,"__esModule",{value:!0});var Cd=(F,U)=>{var Q={};for(var B in F)FV.call(F,B)&&U.indexOf(B)<0&&(Q[B]=F[B]);if(F!=null&&zB)for(var B of zB(F))U.indexOf(B)<0&&hd.call(F,B)&&(Q[B]=F[B]);return Q};var $J=(F,U)=>()=>(U||F((U={exports:{}}).exports,U),U.exports),UW=(F,U)=>{rd(F);for(var Q in U)xQ(F,Q,{get:U[Q],enumerable:!0})},FW=(F,U,Q)=>{if(U&&typeof U=="object"||typeof U=="function")for(let B of _J(U))!FV.call(F,B)&&B!=="default"&&xQ(F,B,{get:()=>U[B],enumerable:!(Q=PJ(U,B))||Q.enumerable});return F},XU=F=>FW(rd(xQ(F!=null?KJ(AJ(F)):{},"default",F&&F.__esModule&&"default"in F?{get:()=>F.default,enumerable:!0}:{value:F,enumerable:!0})),F);var Gl=$J((eB,V0)=>{(function(F,U){if(typeof eB=="object"&&typeof V0=="object")V0.exports=U();else if(typeof define=="function"&&define.amd)define([],U);else{var Q=U();for(var B in Q)(typeof eB=="object"?eB:F)[B]=Q[B]}})(typeof self!="undefined"?self:eB,function(){return function(F){var U={};function Q(B){if(U[B])return U[B].exports;var R=U[B]={i:B,l:!1,exports:{}};return F[B].call(R.exports,R,R.exports,Q),R.l=!0,R.exports}return Q.m=F,Q.c=U,Q.d=function(B,R,V){Q.o(B,R)||Object.defineProperty(B,R,{enumerable:!0,get:V})},Q.r=function(B){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(B,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(B,"__esModule",{value:!0})},Q.t=function(B,R){if(1&R&&(B=Q(B)),8&R||4&R&&typeof B=="object"&&B&&B.__esModule)return B;var V=Object.create(null);if(Q.r(V),Object.defineProperty(V,"default",{enumerable:!0,value:B}),2&R&&typeof B!="string")for(var d in B)Q.d(V,d,function(l){return B[l]}.bind(null,d));return V},Q.n=function(B){var R=B&&B.__esModule?function(){return B.default}:function(){return B};return Q.d(R,"a",R),R},Q.o=function(B,R){return Object.prototype.hasOwnProperty.call(B,R)},Q.p="",Q(Q.s=0)}([function(F,U,Q){"use strict";Q.r(U),Q.d(U,"md5",function(){return c});var B="0123456789abcdef".split(""),R=function(h){for(var N="",k=0;k<4;k++)N+=B[h>>8*k+4&15]+B[h>>8*k&15];return N},V=function(h){for(var N=h.length,k=0;k<N;k++)h[k]=R(h[k]);return h.join("")},d=function(h,N){return h+N&4294967295},l=function(h,N,k,t,S,a,T){return function(C,D,p){return d(C<<D|C>>>32-D,p)}(N=function(C,D,p,o){return D=d(d(D,C),d(p,o))}(h,N,t,a),S,k)},n=function(h,N,k,t,S,a,T,C){return l(k&t|~k&S,N,k,a,T,C,h)},J=function(h,N,k,t,S,a,T,C){return l(k&S|t&~S,N,k,a,T,C,h)},W=function(h,N,k,t,S,a,T,C){return l(k^t^S,N,k,a,T,C,h)},E=function(h,N,k,t,S,a,T,C){return l(t^(k|~S),N,k,a,T,C,h)},Z=function(h,N,k){k===void 0&&(k=d);var t=h[0],S=h[1],a=h[2],T=h[3],C=n.bind(null,k);t=C(t,S,a,T,N[0],7,-680876936),T=C(T,t,S,a,N[1],12,-389564586),a=C(a,T,t,S,N[2],17,606105819),S=C(S,a,T,t,N[3],22,-1044525330),t=C(t,S,a,T,N[4],7,-176418897),T=C(T,t,S,a,N[5],12,1200080426),a=C(a,T,t,S,N[6],17,-1473231341),S=C(S,a,T,t,N[7],22,-45705983),t=C(t,S,a,T,N[8],7,1770035416),T=C(T,t,S,a,N[9],12,-1958414417),a=C(a,T,t,S,N[10],17,-42063),S=C(S,a,T,t,N[11],22,-1990404162),t=C(t,S,a,T,N[12],7,1804603682),T=C(T,t,S,a,N[13],12,-40341101),a=C(a,T,t,S,N[14],17,-1502002290),S=C(S,a,T,t,N[15],22,1236535329);var D=J.bind(null,k);t=D(t,S,a,T,N[1],5,-165796510),T=D(T,t,S,a,N[6],9,-1069501632),a=D(a,T,t,S,N[11],14,643717713),S=D(S,a,T,t,N[0],20,-373897302),t=D(t,S,a,T,N[5],5,-701558691),T=D(T,t,S,a,N[10],9,38016083),a=D(a,T,t,S,N[15],14,-660478335),S=D(S,a,T,t,N[4],20,-405537848),t=D(t,S,a,T,N[9],5,568446438),T=D(T,t,S,a,N[14],9,-1019803690),a=D(a,T,t,S,N[3],14,-187363961),S=D(S,a,T,t,N[8],20,1163531501),t=D(t,S,a,T,N[13],5,-1444681467),T=D(T,t,S,a,N
`).length),Q.split(`
`).slice(U).filter(xd).map(B=>`
`+B).join("")):""}var hW=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],wd=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],aV=hW.concat(wd),cW={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function hQ(F,U){this._e=IF(),this.name=F,this.message=U}aQ(hQ).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+kV(this._e,2))}},toString:function(){return this.name+": "+this.message}});function Ld(F,U){return F+". Errors: "+Object.keys(U).map(Q=>U[Q].toString()).filter((Q,B,R)=>R.indexOf(Q)===B).join(`
`)}function PB(F,U,Q,B){this._e=IF(),this.failures=U,this.failedKeys=B,this.successCount=Q,this.message=Ld(F,U)}aQ(PB).from(hQ);function $Q(F,U){this._e=IF(),this.name="BulkError",this.failures=Object.keys(U).map(Q=>U[Q]),this.failuresByPos=U,this.message=Ld(F,U)}aQ($Q).from(hQ);var TV=aV.reduce((F,U)=>(F[U]=U+"Error",F),{}),rW=hQ,f=aV.reduce((F,U)=>{var Q=U+"Error";function B(R,V){this._e=IF(),this.name=Q,R?typeof R=="string"?(this.message=`${R}${V?`
`+V:""}`,this.inner=V||null):typeof R=="object"&&(this.message=`${R.name} ${R.message}`,this.inner=R):(this.message=cW[U]||Q,this.inner=null)}return aQ(B).from(rW),F[U]=B,F},{});f.Syntax=SyntaxError;f.Type=TypeError;f.Range=RangeError;var jd=wd.reduce((F,U)=>(F[U+"Error"]=f[U],F),{});function CW(F,U){if(!F||F instanceof hQ||F instanceof TypeError||F instanceof SyntaxError||!F.name||!jd[F.name])return F;var Q=new jd[F.name](U||F.message,F);return"stack"in F&&nF(Q,"stack",{get:function(){return this.inner.stack}}),Q}var qB=aV.reduce((F,U)=>(["Syntax","Type","Range"].indexOf(U)===-1&&(F[U+"Error"]=f[U]),F),{});qB.ModifyError=PB;qB.DexieError=hQ;qB.BulkError=$Q;function VU(){}function UB(F){return F}function DW(F,U){return F==null||F===UB?U:function(Q){return U(F(Q))}}function fF(F,U){return function(){F.apply(this,arguments),U.apply(this,arguments)}}function pW(F,U){return F===VU?U:function(){var Q=F.apply(this,arguments);Q!==void 0&&(arguments[0]=Q);var B=this.onsuccess,R=this.onerror;this.onsuccess=null,this.onerror=null;var V=U.apply(this,arguments);return B&&(this.onsuccess=this.onsuccess?fF(B,this.onsuccess):B),R&&(this.onerror=this.onerror?fF(R,this.onerror):R),V!==void 0?V:Q}}function mW(F,U){return F===VU?U:function(){F.apply(this,arguments);var Q=this.onsuccess,B=this.onerror;this.onsuccess=this.onerror=null,U.apply(this,arguments),Q&&(this.onsuccess=this.onsuccess?fF(Q,this.onsuccess):Q),B&&(this.onerror=this.onerror?fF(B,this.onerror):B)}}function MW(F,U){return F===VU?U:function(Q){var B=F.apply(this,arguments);yU(Q,B);var R=this.onsuccess,V=this.onerror;this.onsuccess=null,this.onerror=null;var d=U.apply(this,arguments);return R&&(this.onsuccess=this.onsuccess?fF(R,this.onsuccess):R),V&&(this.onerror=this.onerror?fF(V,this.onerror):V),B===void 0?d===void 0?void 0:d:yU(B,d)}}function oW(F,U){return F===VU?U:function(){return U.apply(this,arguments)===!1?!1:F.apply(this,arguments)}}function hV(F,U){return F===VU?U:function(){var Q=F.apply(this,arguments);if(Q&&typeof Q.then=="function"){for(var B=this,R=arguments.length,V=new Array(R);R--;)V[R]=arguments[R];return Q.then(function(){return U.apply(B,V)})}return U.apply(this,arguments)}}var FB={},iW=100,sW=20,Id=100,[cV,_B,rV]=typeof Promise=="undefined"?[]:(()=>{let F=Promise.resolve();if(typeof crypto=="undefined"||!crypto.subtle)return[F,qQ(F),F];let U=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[U,qQ(U),F]})(),fd=_B&&_B.then,AB=cV&&cV.constructor,CV=!!rV,DV=!1,YW=rV?()=>{rV.then(QR)}:nU.setImmediate?setImmediate.bind(null,QR):nU.MutationObserver?()=>{var F=document.createElement("div");new MutationObserver(()=>{QR(),F=null}).observe(F,{attributes:!0}),F.setAttribute("i","1")}:()=>{setTimeout(QR,0)},QB=function(F,U){BB.push([F,U]),$B&&(YW(),$B=!1)},pV=!0,$B=!0,KF=[],UR=[],mV=null,MV=UB,cQ={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Ql,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(F=>{try{Ql(F[0],F[1])}catch{}})}},u=cQ,BB=[],gF=0,FR=[];function G(F){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=VU,this._lib=!1;var U=this._PSD=u;if(QF&&(this._stackHolder=IF(),this._prev=null,this._numPrev=0),typeof F!="function"){if(F!==FB)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&iV(this,this._value);return}this._state=null,this._value=null,++U.ref,gd(this,F)}var oV={get:function(){var F=u,U=VR;function Q(B,R){var V=!F.global&&(F!==u||U!==VR);let d=V&&!ZF();var l=new G((n,J)=>{sV(this,new Kd(lR(B,F,V,d),lR(R,F,V,d),n,J,F))});return QF&&_d(l,this),l}return Q.prototype=FB,Q},set:function(F){nF(this,"then",F&&F.prototype===FB?oV:{get:function(){return F},set:oV.set})}};kQ(G.prototype,{then:oV,_then:function(F,U){sV(this,new Kd(null,null,F,U,u))},catch:function(F){if(arguments.length===1)return this.then(null,F);var U=arguments[0],Q=arguments[1];return typeof U=="function"?this.then(null,B=>B instanceof U?Q(B):BR(B)):this.then(null,B=>B&&B.name===U?Q(B):BR(B))},finally:function(F){return this.then(U=>(F(),U),
From previous: `);return this._state!==null&&(this._stack=U),U}finally{DV=!1}}},timeout:function(F,U){return F<1/0?new G((Q,B)=>{var R=setTimeout(()=>B(new f.Timeout(U)),F);this.then(Q,B).finally(clearTimeout.bind(null,R))}):this}});typeof Symbol!="undefined"&&Symbol.toStringTag&&nF(G.prototype,Symbol.toStringTag,"Dexie.Promise");cQ.env=Ad();function Kd(F,U,Q,B,R){this.onFulfilled=typeof F=="function"?F:null,this.onRejected=typeof U=="function"?U:null,this.resolve=Q,this.reject=B,this.psd=R}kQ(G,{all:function(){var F=WF.apply(null,arguments).map(dR);return new G(function(U,Q){F.length===0&&U([]);var B=F.length;F.forEach((R,V)=>G.resolve(R).then(d=>{F[V]=d,--B||U(F)},Q))})},resolve:F=>{if(F instanceof G)return F;if(F&&typeof F.then=="function")return new G((Q,B)=>{F.then(Q,B)});var U=new G(FB,!0,F);return _d(U,mV),U},reject:BR,race:function(){var F=WF.apply(null,arguments).map(dR);return new G((U,Q)=>{F.map(B=>G.resolve(B).then(U,Q))})},PSD:{get:()=>u,set:F=>u=F},totalEchoes:{get:()=>VR},newPSD:pF,usePSD:CQ,scheduler:{get:()=>QB,set:F=>{QB=F}},rejectionMapper:{get:()=>MV,set:F=>{MV=F}},follow:(F,U)=>new G((Q,B)=>pF((R,V)=>{var d=u;d.unhandleds=[],d.onunhandled=V,d.finalize=fF(function(){vW(()=>{this.unhandleds.length===0?R():V(this.unhandleds[0])})},d.finalize),F()},U,Q,B))});AB&&(AB.allSettled&&nF(G,"allSettled",function(){let F=WF.apply(null,arguments).map(dR);return new G(U=>{F.length===0&&U([]);let Q=F.length,B=new Array(Q);F.forEach((R,V)=>G.resolve(R).then(d=>B[V]={status:"fulfilled",value:d},d=>B[V]={status:"rejected",reason:d}).then(()=>--Q||U(B)))})}),AB.any&&typeof AggregateError!="undefined"&&nF(G,"any",function(){let F=WF.apply(null,arguments).map(dR);return new G((U,Q)=>{F.length===0&&Q(new AggregateError([]));let B=F.length,R=new Array(B);F.forEach((V,d)=>G.resolve(V).then(l=>U(l),l=>{R[d]=l,--B||Q(new AggregateError(R))}))})}));function gd(F,U){try{U(Q=>{if(F._state===null){if(Q===F)throw new TypeError("A promise cannot be resolved with itself.");var B=F._lib&&RB();Q&&typeof Q.then=="function"?gd(F,(R,V)=>{Q instanceof G?Q._then(R,V):Q.then(R,V)}):(F._state=!0,F._value=Q,Pd(F)),B&&VB()}},iV.bind(null,F))}catch(Q){iV(F,Q)}}function iV(F,U){if(UR.push(U),F._state===null){var Q=F._lib&&RB();U=MV(U),F._state=!1,F._value=U,QF&&U!==null&&typeof U=="object"&&!U._promise&&EW(()=>{var B=NV(U,"stack");U._promise=F,nF(U,"stack",{get:()=>DV?B&&(B.get?B.get.apply(U):B.value):F.stack})}),GW(F),Pd(F),Q&&VB()}}function Pd(F){var U=F._listeners;F._listeners=[];for(var Q=0,B=U.length;Q<B;++Q)sV(F,U[Q]);var R=F._PSD;--R.ref||R.finalize(),gF===0&&(++gF,QB(()=>{--gF==0&&YV()},[]))}function sV(F,U){if(F._state===null){F._listeners.push(U);return}var Q=F._state?U.onFulfilled:U.onRejected;if(Q===null)return(F._state?U.resolve:U.reject)(F._value);++U.psd.ref,++gF,QB(yW,[Q,F,U])}function yW(F,U,Q){try{mV=U;var B,R=U._value;U._state?B=F(R):(UR.length&&(UR=[]),B=F(R),UR.indexOf(R)===-1&&bW(U)),Q.resolve(B)}catch(V){Q.reject(V)}finally{mV=null,--gF==0&&YV(),--Q.psd.ref||Q.psd.finalize()}}function qd(F,U,Q){if(U.length===Q)return U;var B="";if(F._state===!1){var R=F._value,V,d;R!=null?(V=R.name||"Error",d=R.message||R,B=kV(R,0)):(V=R,d=""),U.push(V+(d?": "+d:"")+B)}return QF&&(B=kV(F._stackHolder,2),B&&U.indexOf(B)===-1&&U.push(B),F._prev&&qd(F._prev,U,Q)),U}function _d(F,U){var Q=U?U._numPrev+1:0;Q<iW&&(F._prev=U,F._numPrev=Q)}function QR(){RB()&&VB()}function RB(){var F=pV;return pV=!1,$B=!1,F}function VB(){var F,U,Q;do for(;BB.length>0;)for(F=BB,BB=[],Q=F.length,U=0;U<Q;++U){var B=F[U];B[0].apply(null,B[1])}while(BB.length>0);pV=!0,$B=!0}function YV(){var F=KF;KF=[],F.forEach(B=>{B._PSD.onunhandled.call(null,B._value,B)});for(var U=FR.slice(0),Q=U.length;Q;)U[--Q]()}function vW(F){function U(){F(),FR.splice(FR.indexOf(U),1)}FR.push(U),++gF,QB(()=>{--gF==0&&YV()},[])}function GW(F){KF.some(U=>U._value===F._value)||KF.push(F)}function bW(F){for(var U=KF.length;U;)if(KF[--U]._value===F._value){KF.splice(U,1);return}}function BR(F){return new G(FB,!1,F)}function WU(F,U){var Q=u;return function(){var B=RB(),R=u;try{return mF(Q,!0),F.appl
<iframe src="https://github.com/sponsors/scambier/button" title="Sponsor scambier" height="35" width="116" style="border: 0;"></iframe>
<a href='https://ko-fi.com/B0B6LQ2C' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi2.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
`,new QU.Setting(U).setName("Indexing").setHeading(),!QU.Platform.isMobileApp){let d=new DocumentFragment;d.createSpan({},l=>{l.innerHTML=`Omnisearch will include PDFs in search results.
<ul>
<li>\u26A0\uFE0F Each PDF can take anywhere from a few seconds to 2 minutes to be processed.</li>
<li>\u26A0\uFE0F Texts extracted from PDFs may contain errors such as missing spaces, or spaces in the middle of words.</li>
<li>\u26A0\uFE0F Some PDFs can't be processed correctly and will return an empty text.</li>
<li>This feature is currently a work-in-progress, please report issues that you might experience.</li>
</ul>
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>`}),new QU.Setting(U).setName("PDF Indexing").setDesc(d).addToggle(l=>l.setValue(O.PDFIndexing).onChange(async n=>{O.PDFIndexing=n,await HU(this.plugin)}))}if(!QU.Platform.isMobileApp){let d=new DocumentFragment;d.createSpan({},l=>{l.innerHTML=`Omnisearch will use <a href="https://en.wikipedia.org/wiki/Tesseract_(software)">Tesseract</a> to index images from their text.
<ul>
<li>Only English is supported at the moment.</li>
<li>Not all images can be correctly read by the OCR, this feature works best with scanned documents.</li>
</ul>
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>`}),new QU.Setting(U).setName("BETA - Images Indexing").setDesc(d).addToggle(l=>l.setValue(O.imagesIndexing).onChange(async n=>{O.imagesIndexing=n,await HU(this.plugin)}))}let B=new DocumentFragment;B.createSpan({},d=>{d.innerHTML=`In addition to standard <code>md</code> files, Omnisearch can also index other plain text files.<br/>
Add extensions separated by a space, without the dot. Example: "<code>txt org</code>".<br />
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>`}),new QU.Setting(U).setName("Additional files to index").setDesc(B).addText(d=>{d.setValue(O.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org").onChange(async l=>{O.indexedFileTypes=l.split(" "),await HU(this.plugin)})}),new QU.Setting(U).setName("Behavior").setHeading(),new QU.Setting(U).setName(`Respect Obsidian's "Excluded Files"`).setDesc(`By default, fFiles that are in Obsidian's "Options > Files & Links > Excluded Files" list are downranked in results.
Enable this option to completely hide them`).addToggle(d=>d.setValue(O.hideExcluded).onChange(async l=>{O.hideExcluded=l,await HU(this.plugin)}));let R=new DocumentFragment;R.createSpan({},d=>{d.innerHTML=`Normalize diacritics in search terms. Words like "br\xFBl\xE9e" or "\u017Elu\u0165ou\u010Dk\xFD" will be indexed as "brulee" and "zlutoucky".<br/>
<strong style="color: var(--text-accent)"><em>You probably shouldn't disable this</em>.<br>
Needs a restart to fully take effect.</strong>
`}),new QU.Setting(U).setName("Ignore diacritics").setDesc(R).addToggle(d=>d.setValue(O.ignoreDiacritics).onChange(async l=>{O.ignoreDiacritics=l,await HU(this.plugin)})),new QU.Setting(U).setName("Simpler search").setDesc("Enable this if Obsidian often freezes while making searches. This will return more strict results.").addToggle(d=>d.setValue(O.simpleSearch).onChange(async l=>{O.simpleSearch=l,await HU(this.plugin)})),new QU.Setting(U).setName("User Interface").setHeading(),new QU.Setting(U).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(d=>d.setValue(O.ribbonIcon).onChange(async l=>{O.ribbonIcon=l,await HU(this.plugin),l?this.plugin.addRibbonButton():this.plugin.removeRibbonButton()})),new QU.Setting(U).setName("Show excerpts").setDesc("Shows the contextual part of the note that matches the search. Disable this to only show filenames in results.").addToggle(d=>d.setValue(O.showExcerpt).onChange(async l=>{AF.set(l)})),new QU.Setting(U).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(d=>d.setValue(O.renderLineReturnInExcerpts).onChange(async l=>{O.renderLineReturnInExcerpts=l,await HU(this.plugin)})),new QU.Setting(U).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(d=>d.setValue(O.showPreviousQueryResults).onChange(async l=>{O.showPreviousQueryResults=l,await HU(this.plugin)}));let V=new DocumentFragment;if(V.createSpan({},d=>{d.innerHTML=`Shows a button next to the search input, to create a note.
Acts the same as the <code>shift \u21B5</code> shortcut, can be useful for mobile device users.`}),new QU.Setting(U).setName('Show "Create note" button').setDesc(V).addToggle(d=>d.setValue(O.showCreateButton).onChange(async l=>{O.showCreateButton=l,await HU(this.plugin)})),new QU.Setting(U).setName("Hide full path in results list").setDesc("In the search results, only show the note name, without the full path.").addToggle(d=>d.setValue(O.showShortName).onChange(async l=>{O.showShortName=l,await HU(this.plugin)})),new QU.Setting(U).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(d=>d.setValue(O.hightlight).onChange(async l=>{O.hightlight=l,await HU(this.plugin)})),new QU.Setting(U).setName("Results weighting").setHeading(),new QU.Setting(U).setName(`File name & declared aliases (default: ${MQ.weightBasename})`).addSlider(d=>this.weightSlider(d,"weightBasename")),new QU.Setting(U).setName(`Headings level 1 (default: ${MQ.weightH1})`).addSlider(d=>this.weightSlider(d,"weightH1")),new QU.Setting(U).setName(`Headings level 2 (default: ${MQ.weightH2})`).addSlider(d=>this.weightSlider(d,"weightH2")),new QU.Setting(U).setName(`Headings level 3 (default: ${MQ.weightH3})`).addSlider(d=>this.weightSlider(d,"weightH3")),!QU.Platform.isIosApp){new QU.Setting(U).setName("Danger Zone").setHeading();let d=new DocumentFragment;d.createSpan({},l=>{l.innerHTML=`Erase all Omnisearch cache data.
Use this if Omnisearch results are inconsistent, missing, or appear outdated.<br>
<strong style="color: var(--text-accent)">Needs a restart to fully take effect.</strong>`}),new QU.Setting(U).setName("Clear cache data").setDesc(d).addButton(l=>{l.setButtonText("Clear cache"),l.onClick(async()=>{await fU.clearCache(),new QU.Notice("Omnisearch - Cache cleared. Please restart Obsidian.")})})}}weightSlider(U,Q){U.setLimits(1,3,.1).setValue(O[Q]).setDynamicTooltip().onChange(B=>{O[Q]=B,HU(this.plugin)})}},MQ={hideExcluded:!1,ignoreDiacritics:!0,indexedFileTypes:[],PDFIndexing:!1,imagesIndexing:!1,showShortName:!1,ribbonIcon:!0,showExcerpt:!0,renderLineReturnInExcerpts:!0,showCreateButton:!1,hightlight:!0,showPreviousQueryResults:!0,simpleSearch:!1,weightBasename:2,weightH1:1.5,weightH2:1.3,weightH3:1.1,welcomeMessage:""},O=Object.assign({},MQ);async function ml(F){O=Object.assign({},MQ,await F.loadData()),AF.set(O.showExcerpt)}async function HU(F){await F.saveData(O)}var Ml=/^"|"$|^'|'$/g,ol=/[\u4e00-\u9fa5]/,tB=app.plugins.plugins["cm-chs-patch"],il=100,SB=300,sl=`suggestion-highlight omnisearch-highlight ${O.hightlight?"omnisearch-default-highlight":""}`,$=new ZV,aR={ToggleExcerpts:"toggle-excerpts"},KU=(V=>(V[V.Done=0]="Done",V[V.LoadingCache=1]="LoadingCache",V[V.ReadingFiles=2]="ReadingFiles",V[V.IndexingFiles=3]="IndexingFiles",V[V.WritingCache=4]="WritingCache",V))(KU||{});var sF=KB(0),Yl=!1;function R0(F){Yl=F}function yl(){return Yl}var vl=/[|\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var dJ=XU(require("obsidian"));var _U=XU(require("obsidian"));var bl=XU(require("crypto")),Xl=XU(Gl());function YF(F){return`<span class="${sl}">${F}</span>`}function vZ(F){return F.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function GZ(F){return F.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function yF(F){if(!F.length)return/^$/g;let U=F.map(B=>(tB?"":"\\b")+GZ(B)).join("|");return new RegExp(`(${U})`,"gi")}function TR(F,U){return F.headings?.filter(Q=>Q.level===U).map(Q=>Q.heading)??[]}function hR(F,U){return(F+U)%U}function cR(F,U){try{let Q=U??-1,B=Math.max(0,Q-il),R=Math.min(F.length,Q+SB);if(Q>-1?F=(B>0?"\u2026":"")+F.slice(B,R).trim()+(R<F.length-1?"\u2026":""):F=F.slice(0,SB),O.renderLineReturnInExcerpts){let V=new RegExp(/(?:\r\n|\r|\n)/g);F=F.split(V).filter(l=>l).join(`
`);let d=F.lastIndexOf(`
`,Q-B);d>0&&(F=F.slice(d))}return F=vZ(F),O.renderLineReturnInExcerpts&&(F=F.trim().replaceAll(`
`,"<br>")),F}catch(Q){return new _U.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(Q),""}}function Ol(F){return F.replace(Ml,"")}function d0(F){return F.replace(/(\*|_)+(.+?)(\*|_)+/g,(U,Q,B)=>B)}function Hl(F){return F?.frontmatter?(0,_U.parseFrontMatterAliases)(F.frontmatter)??[]:[]}function zl(F){return F?(0,_U.getAllTags)(F)??[]:[]}function $F(F){return F.normalize("NFD").replace(/\p{Diacritic}/gu,"")}function ul(){return _U.Platform.isMacOS?"\u2318":"ctrl"}function kB(F){return l0(F)||!_U.Platform.isMobileApp&&O.PDFIndexing&&TB(F)||!_U.Platform.isMobileApp&&O.imagesIndexing&&aB(F)}function aB(F){return F.endsWith(".png")||F.endsWith(".jpg")||F.endsWith(".jpeg")}function TB(F){return F.endsWith(".pdf")}function l0(F){return bZ().some(U=>F.endsWith(`.${U}`))}function bZ(){return[...O.indexedFileTypes,"md"]}function xl(F){let U=F.split(".");return U[U.length-1]??""}function wl(F){return _U.Platform.isMobileApp?(0,Xl.md5)(F.toString()):(0,bl.createHash)("md5").update(F).digest("hex")}function Ll(F,U){for(var Q=[],B=0,R=F.length;B<R;)Q.push(F.slice(B,B+=U));return Q}var hB=XU(require("obsidian")),jl=XU(require("crypto"));function XZ(F,U,Q){var B=U===void 0?null:U,R=function(n,J){var W=atob(n);if(J){for(var E=new Uint8Array(W.length),Z=0,e=W.length;Z<e;++Z)E[Z]=W.charCodeAt(Z);return String.fromCharCode.apply(null,new Uint16Array(E.buffer))}return W}(F,Q!==void 0&&Q),V=R.indexOf(`
`,10)+1,d=R.substring(V)+(B?"//# sourceMappingURL="+B:""),l=new Blob([d],{type:"application/javascript"});return URL.createObjectURL(l)}var Il,fl,Kl,n0,OZ=(Il="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7bGV0IEE7Y29uc3QgUT1uZXcgQXJyYXkoMzIpLmZpbGwodm9pZCAwKTtRLnB1c2godm9pZCAwLG51bGwsITAsITEpO2xldCBCPVEubGVuZ3RoO2Z1bmN0aW9uIGcoQSl7Qj09PVEubGVuZ3RoJiZRLnB1c2goUS5sZW5ndGgrMSk7Y29uc3QgZz1CO3JldHVybiBCPVFbZ10sUVtnXT1BLGd9Y29uc3QgST1uZXcgVGV4dERlY29kZXIoInV0Zi04Iix7aWdub3JlQk9NOiEwLGZhdGFsOiEwfSk7SS5kZWNvZGUoKTtsZXQgQz1uZXcgVWludDhBcnJheTtmdW5jdGlvbiBFKFEsQil7cmV0dXJuIEkuZGVjb2RlKCgwPT09Qy5ieXRlTGVuZ3RoJiYoQz1uZXcgVWludDhBcnJheShBLm1lbW9yeS5idWZmZXIpKSxDKS5zdWJhcnJheShRLFErQikpfWZ1bmN0aW9uIEQoQSl7cmV0dXJuIFFbQV19ZnVuY3Rpb24gTihBKXtjb25zdCBnPUQoQSk7cmV0dXJuIGZ1bmN0aW9uKEEpe0E8MzZ8fChRW0FdPUIsQj1BKX0oQSksZ31sZXQgRz1uZXcgSW50MzJBcnJheTtmdW5jdGlvbiB3KCl7cmV0dXJuIDA9PT1HLmJ5dGVMZW5ndGgmJihHPW5ldyBJbnQzMkFycmF5KEEubWVtb3J5LmJ1ZmZlcikpLEd9YXN5bmMgZnVuY3Rpb24gWShR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ive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],S0=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Vn),fZ={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function YQ(F,U){this._e=UQ(),this.name=F,this.message=U}function dn(F,U){return F+". Errors: "+Object.keys(U).map(Q=>U[Q].toString()).filter((Q,B,R)=>R.indexOf(Q)===B).join(`
`)}function CR(F,U,Q,B){this._e=UQ(),this.failures=U,this.failedKeys=B,this.successCount=Q,this.message=dn(F,U)}function DB(F,U){this._e=UQ(),this.name="BulkError",this.failures=Object.keys(U).map(Q=>U[Q]),this.failuresByPos=U,this.message=dn(F,U)}iQ(YQ).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+t0(this._e,2))}},toString:function(){return this.name+": "+this.message}}),iQ(CR).from(YQ),iQ(DB).from(YQ);var e0=S0.reduce((F,U)=>(F[U]=U+"Error",F),{}),KZ=YQ,K=S0.reduce((F,U)=>{var Q=U+"Error";function B(R,V){this._e=UQ(),this.name=Q,R?typeof R=="string"?(this.message=`${R}${V?`
`+V:""}`,this.inner=V||null):typeof R=="object"&&(this.message=`${R.name} ${R.message}`,this.inner=R):(this.message=fZ[U]||Q,this.inner=null)}return iQ(B).from(KZ),F[U]=B,F},{});K.Syntax=SyntaxError,K.Type=TypeError,K.Range=RangeError;var ln=Vn.reduce((F,U)=>(F[U+"Error"]=K[U],F),{}),DR=S0.reduce((F,U)=>(["Syntax","Type","Range"].indexOf(U)===-1&&(F[U+"Error"]=K[U]),F),{});function dU(){}function pB(F){return F}function gZ(F,U){return F==null||F===pB?U:function(Q){return U(F(Q))}}function FQ(F,U){return function(){F.apply(this,arguments),U.apply(this,arguments)}}function PZ(F,U){return F===dU?U:function(){var Q=F.apply(this,arguments);Q!==void 0&&(arguments[0]=Q);var B=this.onsuccess,R=this.onerror;this.onsuccess=null,this.onerror=null;var V=U.apply(this,arguments);return B&&(this.onsuccess=this.onsuccess?FQ(B,this.onsuccess):B),R&&(this.onerror=this.onerror?FQ(R,this.onerror):R),V!==void 0?V:Q}}function qZ(F,U){return F===dU?U:function(){F.apply(this,arguments);var Q=this.onsuccess,B=this.onerror;this.onsuccess=this.onerror=null,U.apply(this,arguments),Q&&(this.onsuccess=this.onsuccess?FQ(Q,this.onsuccess):Q),B&&(this.onerror=this.onerror?FQ(B,this.onerror):B)}}function _Z(F,U){return F===dU?U:function(Q){var B=F.apply(this,arguments);GU(Q,B);var R=this.onsuccess,V=this.onerror;this.onsuccess=null,this.onerror=null;var d=U.apply(this,arguments);return R&&(this.onsuccess=this.onsuccess?FQ(R,this.onsuccess):R),V&&(this.onerror=this.onerror?FQ(V,this.onerror):V),B===void 0?d===void 0?void 0:d:GU(B,d)}}function AZ(F,U){return F===dU?U:function(){return U.apply(this,arguments)!==!1&&F.apply(this,arguments)}}function k0(F,U){return F===dU?U:function(){var Q=F.apply(this,arguments);if(Q&&typeof Q.then=="function"){for(var B=this,R=arguments.length,V=new Array(R);R--;)V[R]=arguments[R];return Q.then(function(){return U.apply(B,V)})}return U.apply(this,arguments)}}DR.ModifyError=CR,DR.DexieError=YQ,DR.BulkError=DB;var mB={},[a0,pR,T0]=typeof Promise=="undefined"?[]:(()=>{let F=Promise.resolve();if(typeof crypto=="undefined"||!crypto.subtle)return[F,cB(F),F];let U=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[U,cB(U),F]})(),nn=pR&&pR.then,mR=a0&&a0.constructor,h0=!!T0,c0=!1,$Z=T0?()=>{T0.then(sR)}:JU.setImmediate?setImmediate.bind(null,sR):JU.MutationObserver?()=>{var F=document.createElement("div");new MutationObserver(()=>{sR(),F=null}).observe(F,{attributes:!0}),F.setAttribute("i","1")}:()=>{setTimeout(sR,0)},MB=function(F,U){oB.push([F,U]),MR&&($Z(),MR=!1)},r0=!0,MR=!0,QQ=[],oR=[],C0=null,D0=pB,yQ={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:kn,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(F=>{try{kn(F[0],F[1])}catch{}})}},x=yQ,oB=[],BQ=0,iR=[];function b(F){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=dU,this._lib=!1;var U=this._PSD=x;if(VF&&(this._stackHolder=UQ(),this._prev=null,this._numPrev=0),typeof F!="function"){if(F!==mB)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&m0(this,this._value))}this._state=null,this._value=null,++U.ref,Wn(this,F)}var p0={get:function(){var F=x,U=vR;function Q(B,R){var V=!F.global&&(F!==x||U!==vR);let d=V&&!TF();var l=new b((n,J)=>{M0(this,new Jn(bR(B,F,V,d),bR(R,F,V,d),n,J,F))});return VF&&En(l,this),l}return Q.prototype=mB,Q},set:function(F){eF(this,"then",F&&F.prototype===mB?p0:{get:function(){return F},set:p0.set})}};function Jn(F,U,Q,B,R){this.onFulfilled=typeof F=="function"?F:null,this.onRejected=typeof U=="function"?U:null,this.resolve=Q,this.reject=B,this.psd=R}function Wn(F,U){try{U(Q=>{if(F._state===null){if(Q===F)throw new TypeError("A promise cannot be resolved with itself.");var B=F._lib&&iB();Q&&typeof Q.then=="function"?Wn(F,(R,V)=>{Q instanceof b?Q._then(R,V):Q.then(R,V)}):(F._state=!0,F._value=Q,Zn(F)),B&&sB()}},m0.bind(null,F))}catch(Q){m0(F,Q)}}function m0(F,U){if(oR.push(U),F._state===null){var Q=F._lib&&iB();U=D0(U),F._state=!1,F._value=U,VF&&U!==null&&typeof U=="object"&&!U._promise&&fun
From previous: `);return this._state!==null&&(this._stack=F),F}finally{c0=!1}}},timeout:function(F,U){return F<1/0?new b((Q,B)=>{var R=setTimeout(()=>B(new K.Timeout(U)),F);this.then(Q,B).finally(clearTimeout.bind(null,R))}):this}}),typeof Symbol!="undefined"&&Symbol.toStringTag&&eF(b.prototype,Symbol.toStringTag,"Dexie.Promise"),yQ.env=tn(),oQ(b,{all:function(){var F=aF.apply(null,arguments).map(GR);return new b(function(U,Q){F.length===0&&U([]);var B=F.length;F.forEach((R,V)=>b.resolve(R).then(d=>{F[V]=d,--B||U(F)},Q))})},resolve:F=>{if(F instanceof b)return F;if(F&&typeof F.then=="function")return new b((Q,B)=>{F.then(Q,B)});var U=new b(mB,!0,F);return En(U,C0),U},reject:YR,race:function(){var F=aF.apply(null,arguments).map(GR);return new b((U,Q)=>{F.map(B=>b.resolve(B).then(U,Q))})},PSD:{get:()=>x,set:F=>x=F},totalEchoes:{get:()=>vR},newPSD:GF,usePSD:GQ,scheduler:{get:()=>MB,set:F=>{MB=F}},rejectionMapper:{get:()=>D0,set:F=>{D0=F}},follow:(F,U)=>new b((Q,B)=>GF((R,V)=>{var d=x;d.unhandleds=[],d.onunhandled=V,d.finalize=FQ(function(){(function(l){function n(){l(),iR.splice(iR.indexOf(n),1)}iR.push(n),++BQ,MB(()=>{--BQ==0&&o0()},[])})(()=>{this.unhandleds.length===0?R():V(this.unhandleds[0])})},d.finalize),F()},U,Q,B))}),mR&&(mR.allSettled&&eF(b,"allSettled",function(){let F=aF.apply(null,arguments).map(GR);return new b(U=>{F.length===0&&U([]);let Q=F.length,B=new Array(Q);F.forEach((R,V)=>b.resolve(R).then(d=>B[V]={status:"fulfilled",value:d},d=>B[V]={status:"rejected",reason:d}).then(()=>--Q||U(B)))})}),mR.any&&typeof AggregateError!="undefined"&&eF(b,"any",function(){let F=aF.apply(null,arguments).map(GR);return new b((U,Q)=>{F.length===0&&Q(new AggregateError([]));let B=F.length,R=new Array(B);F.forEach((V,d)=>b.resolve(V).then(l=>U(l),l=>{R[d]=l,--B||Q(new AggregateError(R))}))})}));var sU={awaits:0,echoes:0,id:0},FN=0,yR=[],i0=0,vR=0,QN=0;function GF(F,U,Q,B){var R=x,V=Object.create(R);V.parent=R,V.ref=0,V.global=!1,V.id=++QN;var d=yQ.env;V.env=h0?{Promise:b,PromiseProp:{value:b,configurable:!0,writable:!0},all:b.all,race:b.race,allSettled:b.allSettled,any:b.any,resolve:b.resolve,reject:b.reject,nthen:en(d.nthen,V),gthen:en(d.gthen,V)}:{},U&&GU(V,U),++R.ref,V.finalize=function(){--this.parent.ref||this.parent.finalize()};var l=GQ(V,F,Q,B);return V.ref===0&&V.finalize(),l}function vQ(){return sU.id||(sU.id=++FN),++sU.awaits,sU.echoes+=100,sU.id}function TF(){return!!sU.awaits&&(--sU.awaits==0&&(sU.id=0),sU.echoes=100*sU.awaits,!0)}function GR(F){return sU.echoes&&F&&F.constructor===mR?(vQ(),F.then(U=>(TF(),U),U=>(TF(),TU(U)))):F}function BN(F){++vR,sU.echoes&&--sU.echoes!=0||(sU.echoes=sU.id=0),yR.push(x),bF(F,!0)}function RN(){var F=yR[yR.length-1];yR.pop(),bF(F,!1)}function bF(F,U){var Q=x;if((U?!sU.echoes||i0++&&F===x:!i0||--i0&&F===x)||Sn(U?BN.bind(null,F):RN),F!==x&&(x=F,Q===yQ&&(yQ.env=tn()),h0)){var B=yQ.env.Promise,R=F.env;pR.then=R.nthen,B.prototype.then=R.gthen,(Q.global||F.global)&&(Object.defineProperty(JU,"Promise",R.PromiseProp),B.all=R.all,B.race=R.race,B.resolve=R.resolve,B.reject=R.reject,R.allSettled&&(B.allSettled=R.allSettled),R.any&&(B.any=R.any))}}function tn(){var F=JU.Promise;return h0?{Promise:F,PromiseProp:Object.getOwnPropertyDescriptor(JU,"Promise"),all:F.all,race:F.race,allSettled:F.allSettled,any:F.any,resolve:F.resolve,reject:F.reject,nthen:pR.then,gthen:F.prototype.then}:{}}function GQ(F,U,Q,B,R){var V=x;try{return bF(F,!0),U(Q,B,R)}finally{bF(V,!1)}}function Sn(F){nn.call(a0,F)}function bR(F,U,Q,B){return typeof F!="function"?F:function(){var R=x;Q&&vQ(),bF(U,!0);try{return F.apply(this,arguments)}finally{bF(R,!1),B&&Sn(TF)}}}function en(F,U){return function(Q,B){return F.call(this,bR(Q,U),bR(B,U))}}(""+nn).indexOf("[native code]")===-1&&(vQ=TF=dU);function kn(F,U){var Q;try{Q=U.onuncatched(F)}catch{}if(Q!==!1)try{var B,R={promise:U,reason:F};if(JU.document&&document.createEvent?((B=document.createEvent("Event")).initEvent("unhandledrejection",!0,!0),GU(B,R)):JU.CustomEvent&&GU(B=new CustomEvent("unhandledrejection",{detail:R}),R),B&&JU.dispatchEvent&&(dispatchEvent(B),!JU.Promise
<span>to cycle history</span>`,W=FU(),E=j("div"),E.innerHTML='<span class="prompt-instruction-command">\u21B5</span><span>to open</span>',Z=FU(),e=j("div"),e.innerHTML=`<span class="prompt-instruction-command">\u21B9</span>
<span>to switch to In-File Search</span>`,r=FU(),c=j("br"),h=FU(),N=j("div"),k=j("span"),k.textContent=`${ul()} \u21B5`,t=FU(),S=j("span"),S.textContent="to open in a new pane",a=FU(),T=j("div"),T.innerHTML=`<span class="prompt-instruction-command">shift \u21B5</span>
<span>to create</span>`,C=FU(),D=j("div"),D.innerHTML=`<span class="prompt-instruction-command">ctrl shift \u21B5</span>
<span>to create in a new pane</span>`,p=FU(),o=j("br"),s=FU(),v=j("div"),v.innerHTML=`<span class="prompt-instruction-command">alt \u21B5</span>
<span>to insert a link</span>`,y=FU(),i=j("div"),i.innerHTML=`<span class="prompt-instruction-command">ctrl+h</span>
<span>to toggle excerpts</span>`,w=FU(),g=j("div"),g.innerHTML='<span class="prompt-instruction-command">esc</span><span>to close</span>',P(l,"class","prompt-instruction"),P(J,"class","prompt-instruction"),P(E,"class","prompt-instruction"),P(e,"class","prompt-instruction"),P(k,"class","prompt-instruction-command"),P(N,"class","prompt-instruction"),P(T,"class","prompt-instruction"),P(D,"class","prompt-instruction"),P(v,"class","prompt-instruction"),P(i,"class","prompt-instruction"),P(g,"class","prompt-instruction"),P(d,"class","prompt-instructions")},m(m,Y){YU(U,m,Y),UU(m,Q,Y),M&&M.m(m,Y),UU(m,B,Y),YU(R,m,Y),UU(m,V,Y),UU(m,d,Y),H(d,l),H(d,n),H(d,J),H(d,W),H(d,E),H(d,Z),H(d,e),H(d,r),H(d,c),H(d,h),H(d,N),H(N,k),H(N,t),H(N,S),H(d,a),H(d,T),H(d,C),H(d,D),H(d,p),H(d,o),H(d,s),H(d,v),H(d,y),H(d,i),H(d,w),H(d,g),L=!0},p(m,[Y]){let I={};Y&2&&(I.initialValue=m[1]),Y&1073741824&&(I.$$scope={dirty:Y,ctx:m}),U.$set(I),m[3]?M?M.p(m,Y):(M=bJ(m),M.c(),M.m(B.parentNode,B)):M&&(M.d(1),M=null);let X={};Y&1073741847&&(X.$$scope={dirty:Y,ctx:m}),R.$set(X)},i(m){L||(BU(U.$$.fragment,m),BU(R.$$.fragment,m),L=!0)},o(m){RU(U.$$.fragment,m),RU(R.$$.fragment,m),L=!1},d(m){pU(U,m),m&&A(Q),M&&M.d(m),m&&A(B),pU(R,m),m&&A(V),m&&A(d)}}}function sE(F,U,Q){let B,R;xB(F,sF,i=>Q(9,R=i));let{modal:V}=U,{previousQuery:d}=U,l=0,n=0,J,W=[],E,Z="",e=!0;KQ(async()=>{$.enable("vault"),$.on("vault","enter",k),$.on("vault","create-note",C),$.on("vault","open-in-new-pane",t),$.on("vault","insert-link",D),$.on("vault","tab",p),$.on("vault","arrow-up",()=>o(-1)),$.on("vault","arrow-down",()=>o(1)),$.on("vault","prev-search-history",r),$.on("vault","next-search-history",c),await vJ(),O.showPreviousQueryResults&&Q(7,d=(await hU.getSearchHistory())[0])}),gQ(()=>{$.disable("vault")});async function r(){let i=(await hU.getSearchHistory()).filter(w=>w);++n>=i.length&&(n=0),Q(7,d=i[n])}async function c(){let i=(await hU.getSearchHistory()).filter(w=>w);--n<0&&(n=i.length?i.length-1:0),Q(7,d=i[n])}async function h(){E=new JQ(J),Q(2,W=(await cU.getSuggestions(E)).sort((i,w)=>w.score-i.score)),Q(0,l=0),await s()}function N(i){!B||(i?.ctrlKey?t():k(),V.close())}function k(){!B||(a(B),V.close())}function t(){!B||(a(B,!0),V.close())}function S(){J&&hU.addToSearchHistory(J)}function a(i,w=!1){S(),PR(i,w)}async function T(i){await C()}async function C(i){if(J){try{await ZJ(J,i?.newLeaf)}catch(w){new zF.Notice(w.message);return}V.close()}}function D(){if(!B)return;let i=app.vault.getMarkdownFiles().find(m=>m.path===B.path),w=app.workspace.getActiveFile(),g=app.workspace.getActiveViewOfType(zF.MarkdownView);if(!g?.editor){new zF.Notice("Omnisearch - Error - No active editor",3e3);return}let L;i&&w?L=app.fileManager.generateMarkdownLink(i,w.path):L=`[[${B.basename}.${xl(B.path)}]]`;let M=g.editor.getCursor();g.editor.replaceRange(L,M,M),M.ch+=L.length,g.editor.setCursor(M),V.close()}function p(){if(!(B&&(TB(B?.path)||!B?.matches.length)))if(S(),V.close(),B){let i=app.vault.getAbstractFileByPath(B.path);i&&i instanceof zF.TFile&&new zQ(app,i,J).open()}else{let i=app.workspace.getActiveViewOfType(zF.MarkdownView);i&&new zQ(app,i.file,J).open()}}function o(i){Q(0,l=hR(l+i,W.length)),s()}async function s(){await lF(),B&&document.querySelector(`[data-result-id="${B.path}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}let v=i=>Q(1,J=i.detail),y=(i,w)=>Q(0,l=i);return F.$$set=i=>{"modal"in i&&Q(8,V=i.modal),"previousQuery"in i&&Q(7,d=i.previousQuery)},F.$$.update=()=>{if(F.$$.dirty&130){U:Q(1,J=J??d)}if(F.$$.dirty&2){U:J?(Q(2,W=[]),Q(4,e=!0),h().then(()=>{Q(4,e=!1)})):(Q(4,e=!1),Q(2,W=[]))}if(F.$$.dirty&5){U:B=W[l]}if(F.$$.dirty&512){U:switch(R){case KU.LoadingCache:Q(3,Z="Loading cache...");break;case KU.ReadingFiles:Q(3,Z="Reading files...");break;case KU.IndexingFiles:Q(3,Z="Indexing files...");break;case KU.WritingCache:h(),Q(3,Z="Updating cache...");break;default:h(),Q(3,Z="");break}}},[l,J,W,Z,e,N,T,d,V,R,v,y]}var OJ=class extends CU{constructor(U){super();mU(this,U,sE,iE,rU,{modal:8,previousQuery:7})}},HJ=OJ;var xJ=XU(require("obsidian"));function YE(F){let U,Q=F[2].repla
<span>to switch to Vault Search</span>`,E=FU(),Z=j("div"),e=j("span"),e.textContent="esc",r=FU(),k.c(),P(d,"class","prompt-instruction"),P(n,"class","prompt-instruction"),P(W,"class","prompt-instruction"),P(e,"class","prompt-instruction-command"),P(Z,"class","prompt-instruction"),P(V,"class","prompt-instructions")},m(t,S){YU(U,t,S),UU(t,Q,S),YU(B,t,S),UU(t,R,S),UU(t,V,S),H(V,d),H(V,l),H(V,n),H(V,J),H(V,W),H(V,E),H(V,Z),H(Z,e),H(Z,r),k.m(Z,null),c=!0},p(t,[S]){let a={};S&2&&(a.initialValue=t[1]),U.$set(a);let T={};S&524344&&(T.$$scope={dirty:S,ctx:t}),B.$set(T),N!==(N=h(t,S))&&(k.d(1),k=N(t),k&&(k.c(),k.m(Z,null)))},i(t){c||(BU(U.$$.fragment,t),BU(B.$$.fragment,t),c=!0)},o(t){RU(U.$$.fragment,t),RU(B.$$.fragment,t),c=!1},d(t){pU(U,t),t&&A(Q),pU(B,t),t&&A(R),t&&A(V),k.d()}}}function uE(F,U,Q){let B=F.find(R=>R.offset>U);return B?F.filter(R=>R.offset>U&&R.offset<=B.offset+Q):[]}function xE(F,U,Q){let{modal:B}=U,{parent:R=null}=U,{singleFilePath:V=""}=U,{previousQuery:d}=U,l,n=[],J=0,W,E;KQ(()=>{$.enable("infile"),$.on("infile","enter",c),$.on("infile","arrow-up",()=>e(-1)),$.on("infile","arrow-down",()=>e(1)),$.on("infile","tab",h)}),gQ(()=>{$.disable("infile")});function Z(t){let S=[],a=-1,T=0;for(;;){let C=uE(t,a,SB);if(!C.length||(a=C.last().offset,S.push(C),++T>100))break}return S}function e(t){Q(5,J=hR(J+t,n.length)),r()}async function r(){await lF(),document.querySelector(`[data-result-id="${J}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function c(t){if(W){B.close(),R&&R.close(),await PR(W,t?.ctrlKey);let S=app.workspace.getActiveViewOfType(xJ.MarkdownView);if(!S)return;let a=n[J]??0,T=S.editor.offsetToPos(a);T.ch=0,S.editor.setCursor(T),S.editor.scrollIntoView({from:{line:T.line-10,ch:0},to:{line:T.line+10,ch:0}})}}function h(){new WQ(app,d).open(),B.close()}let N=t=>Q(2,l=t.detail),k=(t,S)=>Q(5,J=t);return F.$$set=t=>{"modal"in t&&Q(7,B=t.modal),"parent"in t&&Q(0,R=t.parent),"singleFilePath"in t&&Q(8,V=t.singleFilePath),"previousQuery"in t&&Q(1,d=t.previousQuery)},F.$$.update=()=>{if(F.$$.dirty&2){U:Q(2,l=d??"")}if(F.$$.dirty&772){U:(async()=>{l&&(Q(9,E=new JQ(l)),Q(3,W=(await cU.getSuggestions(E,{singleFilePath:V}))[0]??null)),Q(5,J=0),await r()})()}if(F.$$.dirty&8){U:if(W){let t=Z(W.matches);Q(4,n=t.map(S=>Math.round((S.first().offset+S.last().offset)/2)))}}},[R,d,l,W,n,J,c,B,V,E,N,k]}var jJ=class extends CU{constructor(U){super();mU(this,U,xE,zE,rU,{modal:7,parent:0,singleFilePath:8,previousQuery:1})}},IJ=jJ;var kd=class extends fJ.Modal{constructor(U){super(U);this.modalEl.replaceChildren(),this.modalEl.addClass("omnisearch-modal","prompt"),this.modalEl.removeClass("modal"),this.modalEl.tabIndex=-1,this.scope.register([],"ArrowDown",Q=>{Q.preventDefault(),$.emit("arrow-down")}),this.scope.register([],"ArrowUp",Q=>{Q.preventDefault(),$.emit("arrow-up")});for(let Q of[{k:"J",dir:"down"},{k:"K",dir:"up"}])for(let B of["Ctrl","Mod"])this.scope.register([B],Q.k,R=>{this.app.vault.getConfig("vimMode")&&$.emit("arrow-"+Q.dir)});for(let Q of[{k:"N",dir:"down"},{k:"P",dir:"up"}])for(let B of["Ctrl","Mod"])this.scope.register([B],Q.k,R=>{this.app.vault.getConfig("vimMode")&&$.emit("arrow-"+Q.dir)});this.scope.register(["Mod"],"Enter",Q=>{Q.preventDefault(),$.emit("open-in-new-pane")}),this.scope.register(["Alt"],"Enter",Q=>{Q.preventDefault(),$.emit("insert-link")}),this.scope.register(["Shift"],"Enter",Q=>{Q.preventDefault(),$.emit("create-note")}),this.scope.register(["Ctrl","Shift"],"Enter",Q=>{Q.preventDefault(),$.emit("create-note",{newLeaf:!0})}),this.scope.register([],"Enter",Q=>{yl()||(Q.preventDefault(),$.emit("enter"))}),this.scope.register([],"Tab",Q=>{Q.preventDefault(),$.emit("tab")}),this.scope.register(["Alt"],"ArrowDown",Q=>{Q.preventDefault(),$.emit("next-search-history")}),this.scope.register(["Alt"],"ArrowUp",Q=>{Q.preventDefault(),$.emit("prev-search-history")}),this.scope.register(["Ctrl"],"H",Q=>{$.emit(aR.ToggleExcerpts)})}},WQ=class extends kd{constructor(U,Q){super(U);let B=new HJ({target:this.modalEl,props:{modal:this,previousQuery:Q}});this.onClose=()=>{B.$destroy()}}},zQ=
You can now enable "Images Indexing" to use Optical Character Recognition on your scanned documents
\u{1F50E}\u{1F5BC}`}),new uF.Notice(Q,3e4)}O.welcomeMessage=U,F.saveData(O)}function KE(F){F.registerObsidianProtocolHandler("omnisearch",U=>{new WQ(app,U.query).open()}),globalThis.omnisearch=ad,app.plugins.plugins.omnisearch.api=ad}