<ahref='https://ko-fi.com/B0B6LQ2C'target='_blank'><imgheight='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 DocumentFragment().createSpan({},f=>{f.innerHTML='\u26A0\uFE0F <span style="color: var(--text-accent)">Changing indexing settings will clear the cache, and requires a restart of Obsidian.</span><br/><br/>',n?f.innerHTML+=`
<br/>Textextractiononlyworksondesktop,butthecachecanbesynchronizedwithyourmobiledevice.`:f.innerHTML+='\u26A0\uFE0F Omnisearch requires <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a> to index PDFs and images.',s?f.innerHTML+='<br/>\u{1F44D} You have installed <a href="https://github.com/Swaggeroo/obsidian-ai-image-analyzer">AI Image Analyzer</a>, Omnisearch can use it to index images contents with ai.':f.innerHTML+='<br/>\u26A0\uFE0F Omnisearch requires <a href="https://github.com/Swaggeroo/obsidian-ai-image-analyzer">AI Image Analyzer</a> to index images with ai.'}),new ee.Setting(t).setName("Indexing").setHeading().setDesc(sr(`\u26A0\uFE0F<spanstyle="color: var(--text-accent)">Changingindexingsettingswillclearthecache,andrequiresarestartofObsidian.</span><br/><br/>
${n?`\u{1F44D} You have installed <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a>, Omnisearch can use it to index PDFs and images contents.
<br/>Textextractiononlyworksondesktop,butthecachecanbesynchronizedwithyourmobiledevice.`:'\u26A0\uFE0F Omnisearch requires <a href="https://github.com/scambier/obsidian-text-extractor">Text Extractor</a> to index PDFs and images.'}`)),newee.Setting(t).setName(`PDFs content indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(sr("Omnisearch will use Text Extractor to index the content of your PDFs.")).addToggle(f=>f.setValue(z.PDFIndexing).onChange(asyncp=>{awaitr.clearCache(),z.PDFIndexing=p,awaitpe(this.plugin)})).setDisabled(!n),newee.Setting(t).setName(`Images OCR indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(sr("Omnisearch will use Text Extractor to OCR your images and index their content.")).addToggle(f=>f.setValue(z.imagesIndexing).onChange(asyncp=>{awaitr.clearCache(),z.imagesIndexing=p,awaitpe(this.plugin)})).setDisabled(!n);leto=newDocumentFragment;o.createSpan({},f=>{f.innerHTML='Omnisearch will use Text Extractor to index the content of your office documents (currently <pre style="display:inline">.docx</pre> and <pre style="display:inline">.xlsx</pre>).'}),newee.Setting(t).setName(`Documents content indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(o).addToggle(f=>f.setValue(z.officeIndexing).onChange(asyncp=>{awaitr.clearCache(),z.officeIndexing=p,awaitpe(this.plugin)})).setDisabled(!n);letc=newDocumentFragment;c.createSpan({},f=>{f.innerHTML="Omnisearch will use AI Image Analyzer to index the content of your images with ai."}),newee.Setting(t).setName(`Images AI indexing ${s?"":"\u26A0\uFE0F Disabled"}`).setDesc(c).addToggle(f=>f.setValue(z.aiImageIndexing).onChange(asyncp=>{awaitr.clearCache(),z.aiImageIndexing=p,awaitpe(this.plugin)})).setDisabled(!s),newee.Setting(t).setName("Index paths of unsupported files").setDesc(sr(`
"Obsidian setting"willrespectthevalueof"Files & Links > Detect all file extensions".`)).addDropdown(f=>{f.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(z.unsupportedFilesIndexing).onChange(async p=>{await i(),z.unsupportedFilesIndexing=p,await pe(this.plugin)})}),new ee.Setting(t).setName("Set frontmatter property key as title").setDesc(sr(`Ifyouhaveacustompropertyinyournotesthatyouwanttouseasthetitleinsearchresults.<br>
Leaveemptytodisable.`)).addText(f=>{f.setValue(z.displayTitle).onChange(async p=>{await i(),z.displayTitle=p,await pe(this.plugin)})}),new ee.Setting(t).setName("Additional TEXT files to index").setDesc(sr(`Inadditiontostandard<code>md</code>files,Omnisearchcanalsoindexother<strongstyle="color:var(--text-accent)">PLAINTEXT</strong>files.<br/>
Enablethisoptiontocompletelyhidethem.`).addToggle(f=>f.setValue(z.hideExcluded).onChange(async p=>{z.hideExcluded=p,await pe(this.plugin)})),new ee.Setting(t).setName("Folders to downrank in search results").setDesc("Folders to downrank in search results. Files in these folders will be downranked in results. They will still be indexed for tags, unlike excluded files. Folders should be comma delimited.").addText(f=>{f.setValue(z.downrankedFoldersFilters.join(",")).setPlaceholder("Example: src,p2/dir").onChange(async p=>{let A=p.split(",");A=A.map(b=>b.trim()),z.downrankedFoldersFilters=A,await pe(this.plugin)})}),new ee.Setting(t).setName("Split CamelCaseWords").setDesc(sr(`EnablethisifyouwanttobeabletosearchforCamelCaseWordsasseparatewords.<br/>
Thissettinghasastrongimpactonindexingperformance,andcancrashObsidianundercertainconditions.`).addToggle(f=>f.setValue(z.tokenizeUrls).onChange(async p=>{z.tokenizeUrls=p,await pe(this.plugin)})),new ee.Setting(t).setName("Open in new pane").setDesc("Open and create files in a new pane instead of the current pane.").addToggle(f=>f.setValue(z.openInNewPane).onChange(async p=>{z.openInNewPane=p,await pe(this.plugin)})),new ee.Setting(t).setName("Set Vim like navigation keys").setDesc("Navigate down the results with Ctrl/\u2318 + J/N, or navigate up with Ctrl/\u2318 + K/P").addToggle(f=>f.setValue(z.vimLikeNavigationShortcut).onChange(async p=>{z.vimLikeNavigationShortcut=p,await pe(this.plugin)})),new ee.Setting(t).setName("Fuzziness").setDesc("Define the level of fuzziness for the search. The higher the fuzziness, the more results you'll get.").addDropdown(f=>f.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(z.fuzziness).onChange(async p=>{["0","1","2"].includes(p)||(p="2"),z.fuzziness=p,await pe(this.plugin)})),new ee.Setting(t).setName("User Interface").setHeading(),new ee.Setting(t).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(f=>f.setValue(z.ribbonIcon).onChange(async p=>{z.ribbonIcon=p,await pe(this.plugin),p?this.plugin.addRibbonButton():this.plugin.removeRibbonButton()})),new ee.Setting(t).setName("Show excerpts").setDesc("Shows the contextual part of the note that matches the search. Disable this to only show filenames in results.").addToggle(f=>f.setValue(z.showExcerpt).onChange(async p=>{ai.set(p)})),new ee.Setting(t).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(f=>f.setValue(z.renderLineReturnInExcerpts).onChange(async p=>{z.renderLineReturnInExcerpts=p,await pe(this.plugin)})),new ee.Setting(t).setName('Show "Create note" button').setDesc(sr(`Showsabuttonnexttothesearchinput,tocreateanote.
Actsthesameasthe<code>shift\u21B5</code> shortcut, can be useful for mobile device users.`)).addToggle(f=>f.setValue(z.showCreateButton).onChange(async p=>{z.showCreateButton=p,await pe(this.plugin)})),new ee.Setting(t).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(f=>f.setValue(z.highlight).onChange(async p=>{z.highlight=p,await pe(this.plugin)}));let d=mo(this.app);new ee.Setting(t).setName("Results weighting").setHeading(),new ee.Setting(t).setName(`File name & declared aliases (default: ${d.weightBasename})`).addSlider(f=>this.weightSlider(f,"weightBasename")),new ee.Setting(t).setName(`File directory (default: ${d.weightDirectory})`).addSlider(f=>this.weightSlider(f,"weightDirectory")),new ee.Setting(t).setName(`Headings level 1 (default: ${d.weightH1})`).addSlider(f=>this.weightSlider(f,"weightH1")),new ee.Setting(t).setName(`Headings level 2 (default: ${d.weightH2})`).addSlider(f=>this.weightSlider(f,"weightH2")),new ee.Setting(t).setName(`Headings level 3 (default: ${d.weightH3})`).addSlider(f=>this.weightSlider(f,"weightH3")),new ee.Setting(t).setName(`Tags (default: ${d.weightUnmarkedTags})`).addSlider(f=>this.weightSlider(f,"weightUnmarkedTags")),new ee.Setting(t).setName("Header properties fields").setDesc('You can set custom weights for values of header properties (e.g. "keywords"). Weights under 1.0 will downrank the results.');for(let f=0;f<z.weightCustomProperties.length;f++){let p=z.weightCustomProperties[f];new ee.Setting(t).setName((f+1).toString()+".").addText(A=>{A.setPlaceholder("Property name").setValue(p.name).onChange(async b=>{p.name=b,await pe(this.plugin)})}).addSlider(A=>{A.setLimits(.1,5,.1).setValue(p.weight).setDynamicTooltip().onChange(async b=>{p.weight=b,await pe(this.plugin)})}).addButton(A=>{A.setButtonText("Remove"),A.onClick(async()=>{z.weightCustomProperties.splice(f,1),await pe(this.plugin),this.display()})})}new ee.Setting(t).addButton(f=>{f.setButtonText("Add a new property"),f.onClick(p=>{z.weightCustomProperties.push({name:"",weight:1}),this.display()})}),ee.Platform.isMobile||(new ee.Setting(t).setName("API Access Through HTTP").setHeading().setDesc(sr('Omnisearch can be used through a simple HTTP server (<a href="https://publish.obsidian.md/omnisearch/Public+API+%26+URL+Scheme#HTTP+Server">more information</a>).')),new ee.Setting(t).setName("EnabletheHTTPserver").addToggle(f=>f.setValue(z.httpApiEnabled).onChange(async p=>{z.httpApiEnabled=p,p?this.plugin.apiHttpServer.listen(z.httpApiPort):this.plugin.apiHttpServer.close(),await pe(this.plugin)})),new ee.Setting(t).setName("HTTPPort").addText(f=>{f.setValue(z.httpApiPort).setPlaceholder("51361").onChange(async p=>{parseInt(p)>65535&&(p=z.httpApiPort,f.setValue(z.httpApiPort)),z.httpApiPort=p,z.httpApiEnabled&&(this.plugin.apiHttpServer.close(),this.plugin.apiHttpServer.listen(z.httpApiPort)),await pe(this.plugin)})}),new ee.Setting(t).setName("Showanotificationwhentheserverstarts").setDesc("Willdisplayanotificationiftheserverisenabled,atObsidianstartup.").addToggle(f=>f.setValue(z.httpApiNotice).onChange(async p=>{z.httpApiNotice=p,await pe(this.plugin)}))),new ee.Setting(t).setName("Debugging").setHeading(),new ee.Setting(t).setName("Enableverboselogging").setDesc("AddsaLOToflogsfordebuggingpurposes.Don'tforgettodisableit.").addToggle(f=>f.setValue(z.verboseLogging).onChange(async p=>{z.verboseLogging=p,gl(p),await pe(this.plugin)})),new ee.Setting(t).setName("DangerZone").setHeading(),new ee.Setting(t).setName("Ignorediacritics").setDesc(sr(`Normalize diacritics in search terms. Words like "br\xFBl\xE9e" or "\u017Elu\u0165ou\u010Dk\xFD" will be indexed as "brulee" and "zlutoucky".<br/>
`):[],a={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let u of i)/^ *-+: *$/.test(u)?a.align.push("right"):/^ *:-+: *$/.test(u)?a.align.push("center"):/^ *:-+ *$/.test(u)?a.align.push("left"):a.align.push(null);for(let u of n)a.header.push({text:u,tokens:this.lexer.inline(u)});for(let u of s)a.rows.push(bb(u,a.header.length).map(o=>({text:o,tokens:this.lexer.inline(o)})));return a}}lheading(t){let r=this.rules.block.lheading.exec(t);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(t){let r=this.rules.block.paragraph.exec(t);if(r){let n=r[1].charAt(r[1].length-1)===`
`+(a.tokens?this.parseInline(a.tokens):a.text);n+=r?this.renderer.paragraph(u):u;continue}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(t,r){r=r||this.renderer;let n="";for(let i=0;i<t.length;i++){let s=t[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){let a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){n+=a||"";continue}}switch(s.type){case"escape":{let a=s;n+=r.text(a.text);break}case"html":{let a=s;n+=r.html(a.text);break}case"link":{let a=s;n+=r.link(a.href,a.title,this.parseInline(a.tokens,r));break}case"image":{let a=s;n+=r.image(a.href,a.title,a.text);break}case"strong":{let a=s;n+=r.strong(this.parseInline(a.tokens,r));break}case"em":{let a=s;n+=r.em(this.parseInline(a.tokens,r));break}case"codespan":{let a=s;n+=r.codespan(a.text);break}case"br":{n+=r.br();break}case"del":{let a=s;n+=r.del(this.parseInline(a.tokens,r));break}case"text":{let a=s;n+=r.text(a.text);break}default:{let a='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}},mi=class{options;constructor(t){this.options=t||Re.defaults}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}};Vh(mi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var ld=class{defaults=$o();options=this.setOptions;parse=this.#e(ar.lex,ur.parse);parseInline=this.#e(ar.lexInline,ur.parseInline);Parser=ur;Renderer=As;TextRenderer=Wa;Lexer=ar;Tokenizer=Es;Hooks=mi;constructor(...t){this.use(...t)}walkTokens(t,r){let n=[];for(let i of t)switch(n=n.concat(r.call(this,i)),i.type){case"table":{let s=i;for(let a of s.header)n=n.concat(this.walkTokens(a.tokens,r));for(let a of s.rows)for(let u of a)n=n.concat(this.walkTokens(u.tokens,r));break}case"list":{let s=i;n=n.concat(this.walkTokens(s.items,r));break}default:{let s=i;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(a=>{let u=s[a].flat(1/0);n=n.concat(this.walkTokens(u,r))}):s.tokens&&(n=n.concat(this.walkTokens(s.tokens,r)))}}return n}use(...t){let r=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let i=J({},n);if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let a=r.renderers[s.name];a?r.renderers[s.name]=function(...u){let o=s.renderer.apply(this,u);return o===!1&&(o=a.apply(this,u)),o}:r.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=r[s.level];a?a.unshift(s.tokenizer):r[s.level]=[s.tokenizer],s.start&&(s.level==="block"?r.startBlock?r.startBlock.push(s.start):r.startBlock=[s.start]:s.level==="inline"&&(r.startInline?r.startInline.push(s.start):r.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(r.childTokens[s.name]=s.childTokens)}),i.extensions=r),n.renderer){let s=this.defaults.renderer||new As(this.defaults);for(let a in n.renderer){if(!(a in s))throw new Error(`renderer'${a}'doesnotexist`);if(a==="options")continue;let u=a,o=n.renderer[u],c=s[u];s[u]=(...d)=>{let h=o.apply(s,d);return h===!1&&(h=c.apply(s,d)),h||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Es(this.defaults);for(let a in n.tokenizer){if(!(a in s))throw new Error(`tokenizer'${a}'doesnotexist`);if(["options","rules","lexer"].includes(a))continue;let u=a,o=n.tokenizer[u],c=s[u];s[u]=(...d)=>{let h=o.apply(s,d);return h===!1&&(h=c.apply(s,d)),h}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new mi;for(let a in n.hooks){if(!(a in s))throw new Error(`hook'${a}'doesnotexist`);if(a==="options")continue;let u=a,o=n.hooks[u],c=s[u];mi.passThroughHooks.has(a)?s[u]=d=>{if(this.defaults.async)return Pr
Pleasereportthistohttps://github.com/markedjs/marked.`,t){let i="<p>An error occurred:</p><pre>"+Qt(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},gi=new ld;function Ce(e,t){return gi.parse(e,t)}Ce.options=Ce.setOptions=function(e){return gi.setOptions(e),Ce.defaults=gi.defaults,pb(Ce.defaults),Ce};Ce.getDefaults=$o;Ce.defaults=Re.defaults;Ce.use=function(...e){return gi.use(...e),Ce.defaults=gi.defaults,pb(Ce.defaults),Ce};Ce.walkTokens=function(e,t){return gi.walkTokens(e,t)};Ce.parseInline=gi.parseInline;Ce.Parser=ur;Ce.parser=ur.parse;Ce.Renderer=As;Ce.TextRenderer=Wa;Ce.Lexer=ar;Ce.lexer=ar.lex;Ce.Tokenizer=Es;Ce.Hooks=mi;Ce.parse=Ce;var L2=Ce.options,M2=Ce.setOptions,k2=Ce.use,F2=Ce.walkTokens,B2=Ce.parseInline,j2=Ce,H2=ur.parse,U2=ar.lex;Re.Hooks=mi;Re.Lexer=ar;Re.Marked=ld;Re.Parser=ur;Re.Renderer=As;Re.TextRenderer=Wa;Re.Tokenizer=Es;Re.getDefaults=$o;Re.lexer=U2;Re.marked=Ce;Re.options=L2;Re.parse=j2;Re.parseInline=B2;Re.parser=H2;Re.setOptions=M2;Re.use=k2;Re.walkTokens=F2});var wb=U(Nb=>{"use strict";Object.defineProperty(Nb,"__esModule",{value:!0})});var fd=U(_i=>{"use strict";var tc=_i&&_i.__assign||function(){return tc=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},tc.apply(this,arguments)};Object.defineProperty(_i,"__esModule",{value:!0});_i.flatten=void 0;var G2={xml:!1,decodeEntities:!0};_i.default=G2;var Rb={_useHtmlParser2:!0,xmlMode:!0};function q2(e){return(e==null?void 0:e.xml)?typeof e.xml=="boolean"?Rb:tc(tc({},Rb),e.xml):e??void 0}_i.flatten=q2});var ys=U(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.Doctype=He.CDATA=He.Tag=He.Style=He.Script=He.Comment=He.Directive=He.Text=He.Root=He.isTag=He.ElementType=void 0;var $t;(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})($t=He.ElementType||(He.ElementType={}));function z2(e){return e.type===$t.Tag||e.type===$t.Script||e.type===$t.Style}He.isTag=z2;He.Root=$t.Root;He.Text=$t.Text;He.Directive=$t.Directive;He.Comment=$t.Comment;He.Script=$t.Script;He.Style=$t.Style;He.Tag=$t.Tag;He.CDATA=$t.CDATA;He.Doctype=$t.Doctype});var md=U(le=>{"use strict";var jn=le&&le.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ya=le&&le.__assign||function(){return Ya=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Ya.apply(this,arguments)};Object.defineProperty(le,"__esModule",{value:!0});le.cloneNode=le.hasChildren=le.isDocument=le.isDirective=le.isComment=le.isText=le.isCDATA=le.isTag=le.Element=le.Document=le.CDATA=le.NodeWithChildren=le.ProcessingInstruction=le.Comment=le.Text=le.DataNode=le.Node=void 0;var kt=ys(),dd=function(){function e(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent},set:function(t){this.parent=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(t){this.prev=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(t){this.next=t},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(t){return t===void 0&&(t=!1),hd(this,t)},e}();le.Node=dd;var rc=function(e){jn(t,e);function t(r){var n=e.call(this)||this;ret
`+n).join("")):""}var wx=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],bT=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],uf=wx.concat(bT),Rx={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 fs(e,t){this._e=oi(),this.name=e,this.message=t}cs(fs).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+af(this._e,2))}},toString:function(){return this.name+": "+this.message}});function ET(e,t){return e+". Errors: "+Object.keys(t).map(r=>t[r].toString()).filter((r,n,i)=>i.indexOf(r)===n).join(`
`+s:""}`,this.inner=s||null):typeofi=="object"&&(this.message=`${i.name}${i.message}`,this.inner=i):(this.message=Rx[t]||r,this.inner=null)}returncs(n).from(Px),e[t]=n,e},{});ie.Syntax=SyntaxError;ie.Type=TypeError;ie.Range=RangeError;varAT=bT.reduce((e,t)=>(e[t+"Error"]=ie[t],e),{});functionLx(e,t){if(!e||einstanceoffs||einstanceofTypeError||einstanceofSyntaxError||!e.name||!AT[e.name])returne;varr=newAT[e.name](t||e.message,e);return"stack"ine&&Zr(r,"stack",{get:function(){returnthis.inner.stack}}),r}varvo=uf.reduce((e,t)=>(["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=ie[t]),e),{});vo.ModifyError=Io;vo.DexieError=fs;vo.BulkError=Da;functionNe(){}functionSa(e){returne}functionMx(e,t){returne==null||e===Sa?t:function(r){returnt(e(r))}}functionci(e,t){returnfunction(){e.apply(this,arguments),t.apply(this,arguments)}}functionkx(e,t){returne===Ne?t:function(){varr=e.apply(this,arguments);r!==void0&&(arguments[0]=r);varn=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;vars=t.apply(this,arguments);returnn&&(this.onsuccess=this.onsuccess?ci(n,this.onsuccess):n),i&&(this.onerror=this.onerror?ci(i,this.onerror):i),s!==void0?s:r}}functionFx(e,t){returne===Ne?t:function(){e.apply(this,arguments);varr=this.onsuccess,n=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),r&&(this.onsuccess=this.onsuccess?ci(r,this.onsuccess):r),n&&(this.onerror=this.onerror?ci(n,this.onerror):n)}}functionBx(e,t){returne===Ne?t:function(r){varn=e.apply(this,arguments);xt(r,n);vari=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;vara=t.apply(this,arguments);returni&&(this.onsuccess=this.onsuccess?ci(i,this.onsuccess):i),s&&(this.onerror=this.onerror?ci(s,this.onerror):s),n===void0?a===void0?void0:a:xt(n,a)}}functionjx(e,t){returne===Ne?t:function(){returnt.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}functioncf(e,t){returne===Ne?t:function(){varr=e.apply(this,arguments);if(r&&typeofr.then=="function"){for(varn=this,i=arguments.length,s=newArray(i);i--;)s[i]=arguments[i];returnr.then(function(){returnt.apply(n,s)})}returnt.apply(this,arguments)}}varxa={},Hx=100,Ux=20,yT=100,[lf,Co,ff]=typeofPromise=="undefined"?[]:(()=>{lete=Promise.resolve();if(typeofcrypto=="undefined"||!crypto.subtle)return[e,Ia(e),e];lett=crypto.subtle.digest("SHA-512",newUint8Array([0]));return[t,Ia(t),e]})(),IT=Co&&Co.then,Do=lf&&lf.constructor,df=!!ff,hf=!1,Gx=ff?()=>{ff.then(No)}:je.setImmediate?setImmediate.bind(null,No):je.MutationObserver?()=>{vare=document.createElement("div");newMutationObserver(()=>{No(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(No,0)},Oa=function(e,t){Na.push([e,t]),So&&(Gx(),So=!1)},pf=!0,So=!0,li=[],xo=[],mf=null,gf=Sa,ds={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:PT,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{PT(e[0],e[1])}catch{}})}},ne=ds,Na=[],fi=0,Oo=[];functionY(e){if(typeofthis!="object")thrownewTypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=Ne,this._lib=!1;vart=this._PSD=ne;if(Nr&&(this._stackHolder=oi(),this._prev=null,this._numPrev=0),typeofe!="function"){if(e!==xa)thrownewTypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Tf(this,this._value);return}this._state=null,this._value=null,++t.ref,CT(this,e)}var_f={get:function(){vare=ne,t=Po;functionr(n,i){vars=!e.global&&(e!==ne||t!==Po);leta=s&&!tn();varu=newY((o,c)=>{bf(this,newvT(Mo(n,e,s,a),Mo(i,e,s,a),o,c,e))});returnNr&&xT(u,this),u}returnr.prototype=xa,r},set:function(e){Zr(this,"then",e&&e.prototype===xa?_f:{get:function(){returne},set:_f.set})}};os(Y.prototype,{then:_f,_then:function(e,t){bf(this,newvT(null,null,e,t,ne))},catch:function(e){if(arguments.length===1)returnthis.then(null,e);vart=arguments[0],r=arguments[1];returntypeoft=="function"?this.then(null,n=>ninstanceoft?r(n):wo(n)):this.then(null,n=>n&&n.name===t?r(n):wo(n))},finally:function(e){returnthis.then(t
`)}else if(oa(t))try{let d=JSON.parse(await r.vault.cachedRead(n)),h=[],f=p=>{for(let A in p)typeof p[A]=="object"?f(p[A]):A==="content"&&h.push(p[A])};f(d),i=h.join(`\r
`)}catch(d){console.error("Omnisearch: Error while parsing Dataloom file",t),console.error(d)}else Tn(t)&&(this.plugin.settings.imagesIndexing&&s?.canFileBeExtracted(t)||this.plugin.settings.aiImageIndexing&&a?.canBeAnalyzed(n))?(this.plugin.settings.imagesIndexing&&s?.canFileBeExtracted(t)&&(i=await s.extractText(n)),this.plugin.settings.aiImageIndexing&&a?.canBeAnalyzed(n)&&(i=await a.analyzeImage(n)+(i??""))):bn(t)&&this.plugin.settings.PDFIndexing&&s?.canFileBeExtracted(t)?i=await s.extractText(n):T0(t)&&this.plugin.settings.officeIndexing&&s?.canFileBeExtracted(t)?i=await s.extractText(n):this.plugin.notesIndexer.isFilenameIndexable(t)&&(i=n.path);i==null&&(console.warn(`Omnisearch:${i}contentforfile`,n.path),i="");let u=r.metadataCache.getFileCache(n);if(u){let d=d0(this.plugin.app,n,u);for(let h of d.filter(f=>!this.documents.has(f))){let f=this.plugin.notesIndexer.generateIndexableNonexistingDocument(h,n.path)}if(u.frontmatter?.["excalidraw-plugin"]){let h=u.sections?.filter(f=>f.type==="comment")??[];for(let{start:f,end:p}of h.map(A=>A.position))i=i.substring(0,f.offset-1)+i.substring(p.offset)}}let o=u?.frontmatter?.[this.plugin.settings.displayTitle]??"",c=_0(u);return{basename:n.basename,displayTitle:o,content:i,cleanedContent:m0(Qr(i)),path:n.path,mtime:n.stat.mtime,tags:c,unmarkedTags:c.map(d=>d.replace("#","")),aliases:g0(u).join(""),headings1:u?Fu(u,1).join(" "):"",headings2:u?Fu(u,2).join(" "):"",headings3:u?Fu(u,3).join(" "):""}}};ir();aa();ir();var Fh=class{constructor(t){this.plugin=t;this.notesToReindex=new Set}flagNoteForReindex(t){this.notesToReindex.add(t)}async refreshIndex(){for(let r of this.notesToReindex)ve("Updating file",r.path),await this.plugin.cacheManager.addToLiveCache(r.path);let t=[...this.notesToReindex].map(r=>r.path);t.length&&(this.plugin.searchEngine.removeFromPaths(t),await this.plugin.searchEngine.addFromPaths(t),this.notesToReindex.clear())}isFileIndexable(t){return this.isFilenameIndexable(t)||this.isContentIndexable(t)}isContentIndexable(t){let r=this.plugin.settings,n=!!this.plugin.getTextExtractor(),i=!!this.plugin.getAIImageAnalyzer(),s=n&&r.PDFIndexing,a=n&&r.imagesIndexing,u=i&&r.aiImageIndexing;return this.isFilePlaintext(t)||ri(t)||oa(t)||s&&bn(t)||a&&Tn(t)||u&&Tn(t)}isFilenameIndexable(t){return this.canIndexUnsupportedFiles()||this.isFilePlaintext(t)||ri(t)||oa(t)}canIndexUnsupportedFiles(){return this.plugin.settings.unsupportedFilesIndexing==="yes"||this.plugin.settings.unsupportedFilesIndexing==="default"&&!!this.plugin.app.vault.getConfig("showUnsupportedFiles")}generateIndexableNonexistingDocument(t,r){return t=dl(t),{path:t+(t.endsWith(".md")?"":".md"),basename:t,displayTitle:"",mtime:0,content:"",cleanedContent:"",tags:[],unmarkedTags:[],aliases:"",headings1:"",headings2:"",headings3:"",doesNotExist:!0,parent:r}}isFilePlaintext(t){return[...this.plugin.settings.indexedFileTypes,"md"].some(r=>t.endsWith(`.${r}`))}};Or();ir();var Ny=Xe(require("obsidian"));Ea();var Bh=class{constructor(t){this.plugin=t}highlightText(t,r){let n=`suggestion-highlightomnisearch-highlight${this.plugin.settings.highlight?"omnisearch-default-highlight":""}`;if(!r.length)return t;try{let i=new RegExp(r.map(u=>{let o=On(u.match);return`\\b${o}\\b${/[a-zA-Z]/.test(u.match)?"":`|${o}`}`}).join("|"),"giu"),s=u=>r.find(c=>u.match(new RegExp(`\\b${On(c.match)}\\b${/[a-zA-Z]/.test(c.match)?"":`|${On(c.match)}`}`,"giu")))?`<spanclass="${n}">${u}</span>`:u,a=t.replace(i,s);if(a===t){let u=new RegExp(r.map(o=>On(o.match)).join("|"),"giu");a=t.replace(u,s)}return a}catch(i){return console.error("Omnisearch - Error in highlightText()",i),t}}escapeHTML(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}stringsToRegex(t){if(!t.length)return/^$/g;t.sort((n,i)=>i.length-n.length);letr=`(${t.map(n=>`\\b${On(n)}\\b|${On(n)}`).join("|")})`;returnnewRegExp(`${r}`,"gui")}getMatches(t,r,n){leti=this.stringsToRegex(r),s=t;this.plugin.settings.ignoreDiacritics&&(t=Qr(t,this.plugin.settings.ignoreArabicDiacritics));l