<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>
${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.'}
${s?'<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.':'<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(`PDFscontentindexing${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(sr("Omnisearch will use Text Extractor to index the content of your PDFs.")).addToggle(d=>d.setValue(z.PDFIndexing).onChange(async f=>{await r.clearCache(),z.PDFIndexing=f,await pe(this.plugin)})).setDisabled(!n),new ee.Setting(t).setName(`ImagesOCRindexing${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(sr("Omnisearch will use Text Extractor to OCR your images and index their content.")).addToggle(d=>d.setValue(z.imagesIndexing).onChange(async f=>{await r.clearCache(),z.imagesIndexing=f,await pe(this.plugin)})).setDisabled(!n);let u=new DocumentFragment;u.createSpan({},d=>{d.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>).'}),new ee.Setting(t).setName(`Documentscontentindexing${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(u).addToggle(d=>d.setValue(z.officeIndexing).onChange(async f=>{await r.clearCache(),z.officeIndexing=f,await pe(this.plugin)})).setDisabled(!n);let o=new DocumentFragment;o.createSpan({},d=>{d.innerHTML="Omnisearch will use AI Image Analyzer to index the content of your images with ai."}),new ee.Setting(t).setName(`ImagesAIindexing${s?"":"\u26A0\uFE0F Disabled"}`).setDesc(o).addToggle(d=>d.setValue(z.aiImageIndexing).onChange(async f=>{await r.clearCache(),z.aiImageIndexing=f,await pe(this.plugin)})).setDisabled(!s),new ee.Setting(t).setName("Index paths of unsupported files").setDesc(sr(`
"Obsidian setting"willrespectthevalueof"Files & Links > Detect all file extensions".`)).addDropdown(d=>{d.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(z.unsupportedFilesIndexing).onChange(async f=>{await i(),z.unsupportedFilesIndexing=f,await pe(this.plugin)})}),new ee.Setting(t).setName("Set frontmatter property key as title").setDesc(sr(`Ifyouhaveacustompropertyinyournotesthatyouwanttouseasthetitleinsearchresults.<br>
Leaveemptytodisable.`)).addText(d=>{d.setValue(z.displayTitle).onChange(async f=>{await i(),z.displayTitle=f,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(d=>d.setValue(z.hideExcluded).onChange(async f=>{z.hideExcluded=f,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(d=>{d.setValue(z.downrankedFoldersFilters.join(",")).setPlaceholder("Example: src,p2/dir").onChange(async f=>{let g=f.split(",");g=g.map(y=>y.trim()),z.downrankedFoldersFilters=g,await pe(this.plugin)})}),new ee.Setting(t).setName("Split CamelCaseWords").setDesc(sr(`EnablethisifyouwanttobeabletosearchforCamelCaseWordsasseparatewords.<br/>
Thissettinghasastrongimpactonindexingperformance,andcancrashObsidianundercertainconditions.`).addToggle(d=>d.setValue(z.tokenizeUrls).onChange(async f=>{z.tokenizeUrls=f,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(d=>d.setValue(z.openInNewPane).onChange(async f=>{z.openInNewPane=f,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(d=>d.setValue(z.vimLikeNavigationShortcut).onChange(async f=>{z.vimLikeNavigationShortcut=f,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(d=>d.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(z.fuzziness).onChange(async f=>{["0","1","2"].includes(f)||(f="2"),z.fuzziness=f,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(d=>d.setValue(z.ribbonIcon).onChange(async f=>{z.ribbonIcon=f,await pe(this.plugin),f?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(d=>d.setValue(z.showExcerpt).onChange(async f=>{ai.set(f)})),new ee.Setting(t).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(d=>d.setValue(z.renderLineReturnInExcerpts).onChange(async f=>{z.renderLineReturnInExcerpts=f,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(d=>d.setValue(z.showCreateButton).onChange(async f=>{z.showCreateButton=f,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(d=>d.setValue(z.highlight).onChange(async f=>{z.highlight=f,await pe(this.plugin)}));let c=go(this.app);new ee.Setting(t).setName("Results weighting").setHeading(),new ee.Setting(t).setName(`File name & declared aliases (default: ${c.weightBasename})`).addSlider(d=>this.weightSlider(d,"weightBasename")),new ee.Setting(t).setName(`File directory (default: ${c.weightDirectory})`).addSlider(d=>this.weightSlider(d,"weightDirectory")),new ee.Setting(t).setName(`Headings level 1 (default: ${c.weightH1})`).addSlider(d=>this.weightSlider(d,"weightH1")),new ee.Setting(t).setName(`Headings level 2 (default: ${c.weightH2})`).addSlider(d=>this.weightSlider(d,"weightH2")),new ee.Setting(t).setName(`Headings level 3 (default: ${c.weightH3})`).addSlider(d=>this.weightSlider(d,"weightH3")),new ee.Setting(t).setName(`Tags (default: ${c.weightUnmarkedTags})`).addSlider(d=>this.weightSlider(d,"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 d=0;d<z.weightCustomProperties.length;d++){let f=z.weightCustomProperties[d];new ee.Setting(t).setName((d+1).toString()+".").addText(g=>{g.setPlaceholder("Property name").setValue(f.name).onChange(async y=>{f.name=y,await pe(this.plugin)})}).addSlider(g=>{g.setLimits(.1,5,.1).setValue(f.weight).setDynamicTooltip().onChange(async y=>{f.weight=y,await pe(this.plugin)})}).addButton(g=>{g.setButtonText("Remove"),g.onClick(async()=>{z.weightCustomProperties.splice(d,1),await pe(this.plugin),this.display()})})}new ee.Setting(t).addButton(d=>{d.setButtonText("Add a new property"),d.onClick(f=>{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(d=>d.setValue(z.httpApiEnabled).onChange(async f=>{z.httpApiEnabled=f,f?this.plugin.apiHttpServer.listen(z.httpApiPort):this.plugin.apiHttpServer.close(),await pe(this.plugin)})),new ee.Setting(t).setName("HTTPPort").addText(d=>{d.setValue(z.httpApiPort).setPlaceholder("51361").onChange(async f=>{parseInt(f)>65535&&(f=z.httpApiPort,d.setValue(z.httpApiPort)),z.httpApiPort=f,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(d=>d.setValue(z.httpApiNotice).onChange(async f=>{z.httpApiNotice=f,await pe(this.plugin)}))),new ee.Setting(t).setName("Debugging").setHeading(),new ee.Setting(t).setName("Enableverboselogging").setDesc("AddsaLOToflogsfordebuggingpurposes.Don'tforgettodisableit.").addToggle(d=>d.setValue(z.verboseLogging).onChange(async f=>{z.verboseLogging=f,pl(f),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(Eb(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}};Wh(mi,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var dd=class{defaults=Xo();options=this.setOptions;parse=this.#e(ar.lex,ur.parse);parseInline=this.#e(ar.lexInline,ur.parseInline);Parser=ur;Renderer=As;TextRenderer=Ya;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]=(...h)=>{let d=o.apply(s,h);return d===!1&&(d=c.apply(s,h)),d||""}}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]=(...h)=>{let d=o.apply(s,h);return d===!1&&(d=c.apply(s,h)),d}}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]=h=>{if(this.defaults.async)return Pr
Pleasereportthistohttps://github.com/markedjs/marked.`,t){let i="<p>An error occurred:</p><pre>"+$t(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},gi=new dd;function Ce(e,t){return gi.parse(e,t)}Ce.options=Ce.setOptions=function(e){return gi.setOptions(e),Ce.defaults=gi.defaults,mb(Ce.defaults),Ce};Ce.getDefaults=Xo;Ce.defaults=Re.defaults;Ce.use=function(...e){return gi.use(...e),Ce.defaults=gi.defaults,mb(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=Ya;Ce.Lexer=ar;Ce.lexer=ar.lex;Ce.Tokenizer=Es;Ce.Hooks=mi;Ce.parse=Ce;var M2=Ce.options,k2=Ce.setOptions,F2=Ce.use,B2=Ce.walkTokens,j2=Ce.parseInline,H2=Ce,U2=ur.parse,G2=ar.lex;Re.Hooks=mi;Re.Lexer=ar;Re.Marked=dd;Re.Parser=ur;Re.Renderer=As;Re.TextRenderer=Ya;Re.Tokenizer=Es;Re.getDefaults=Xo;Re.lexer=G2;Re.marked=Ce;Re.options=M2;Re.parse=H2;Re.parseInline=j2;Re.parser=U2;Re.setOptions=k2;Re.use=F2;Re.walkTokens=B2});var Rb=U(wb=>{"use strict";Object.defineProperty(wb,"__esModule",{value:!0})});var hd=U(_i=>{"use strict";var rc=_i&&_i.__assign||function(){return rc=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},rc.apply(this,arguments)};Object.defineProperty(_i,"__esModule",{value:!0});_i.flatten=void 0;var q2={xml:!1,decodeEntities:!0};_i.default=q2;var Pb={_useHtmlParser2:!0,xmlMode:!0};function z2(e){return(e==null?void 0:e.xml)?typeof e.xml=="boolean"?Pb:rc(rc({},Pb),e.xml):e??void 0}_i.flatten=z2});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 Xt;(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"})(Xt=He.ElementType||(He.ElementType={}));function V2(e){return e.type===Xt.Tag||e.type===Xt.Script||e.type===Xt.Style}He.isTag=V2;He.Root=Xt.Root;He.Text=Xt.Text;He.Directive=Xt.Directive;He.Comment=Xt.Comment;He.Script=Xt.Script;He.Style=Xt.Style;He.Tag=Xt.Tag;He.CDATA=Xt.CDATA;He.Doctype=Xt.Doctype});var _d=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)}}(),Qa=le&&le.__assign||function(){return Qa=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},Qa.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(),pd=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),md(this,t)},e}();le.Node=pd;var nc=function(e){jn(t,e);function t(r){var n=e.call(this)||this;ret
`+n).join("")):""}var Rx=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],ET=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],cf=Rx.concat(ET),Px={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+of(this._e,2))}},toString:function(){return this.name+": "+this.message}});function AT(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=Px[t]||r,this.inner=null)}returncs(n).from(Lx),e[t]=n,e},{});ie.Syntax=SyntaxError;ie.Type=TypeError;ie.Range=RangeError;varyT=ET.reduce((e,t)=>(e[t+"Error"]=ie[t],e),{});functionMx(e,t){if(!e||einstanceoffs||einstanceofTypeError||einstanceofSyntaxError||!e.name||!yT[e.name])returne;varr=newyT[e.name](t||e.message,e);return"stack"ine&&Zr(r,"stack",{get:function(){returnthis.inner.stack}}),r}varCo=cf.reduce((e,t)=>(["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=ie[t]),e),{});Co.ModifyError=vo;Co.DexieError=fs;Co.BulkError=Sa;functionNe(){}functionxa(e){returne}functionkx(e,t){returne==null||e===xa?t:function(r){returnt(e(r))}}functionci(e,t){returnfunction(){e.apply(this,arguments),t.apply(this,arguments)}}functionFx(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}}functionBx(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)}}functionjx(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)}}functionHx(e,t){returne===Ne?t:function(){returnt.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}functionff(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)}}varOa={},Ux=100,Gx=20,IT=100,[df,Do,hf]=typeofPromise=="undefined"?[]:(()=>{lete=Promise.resolve();if(typeofcrypto=="undefined"||!crypto.subtle)return[e,va(e),e];lett=crypto.subtle.digest("SHA-512",newUint8Array([0]));return[t,va(t),e]})(),vT=Do&&Do.then,So=df&&df.constructor,pf=!!hf,mf=!1,qx=hf?()=>{hf.then(wo)}:je.setImmediate?setImmediate.bind(null,wo):je.MutationObserver?()=>{vare=document.createElement("div");newMutationObserver(()=>{wo(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(wo,0)},Na=function(e,t){wa.push([e,t]),xo&&(qx(),xo=!1)},gf=!0,xo=!0,li=[],Oo=[],_f=null,Tf=xa,ds={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:LT,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(e=>{try{LT(e[0],e[1])}catch{}})}},ne=ds,wa=[],fi=0,No=[];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!==Oa)thrownewTypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Ef(this,this._value);return}this._state=null,this._value=null,++t.ref,DT(this,e)}varbf={get:function(){vare=ne,t=Lo;functionr(n,i){vars=!e.global&&(e!==ne||t!==Lo);leta=s&&!tn();varu=newY((o,c)=>{Af(this,newCT(ko(n,e,s,a),ko(i,e,s,a),o,c,e))});returnNr&&OT(u,this),u}returnr.prototype=Oa,r},set:function(e){Zr(this,"then",e&&e.prototype===Oa?bf:{get:function(){returne},set:bf.set})}};os(Y.prototype,{then:bf,_then:function(e,t){Af(this,newCT(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):Ro(n)):this.then(null,n=>n&&n.name===t?r(n):Ro(n))},finally:function(e){returnthis.then(t
`)}else if(ua(t))try{let h=JSON.parse(await r.vault.cachedRead(n)),d=[],f=g=>{for(let y in g)typeof g[y]=="object"?f(g[y]):y==="content"&&d.push(g[y])};f(h),i=d.join(`\r
`)}catch(h){console.error("Omnisearch: Error while parsing Dataloom file",t),console.error(h)}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):m0(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 h=v0(this.plugin.app,n,u);for(let d of h.filter(f=>!this.documents.has(f))){let f=this.plugin.notesIndexer.generateIndexableNonexistingDocument(d,n.path)}if(u.frontmatter?.["excalidraw-plugin"]){let d=u.sections?.filter(f=>f.type==="comment")??[];for(let{start:f,end:g}of d.map(y=>y.position))i=i.substring(0,f.offset-1)+i.substring(g.offset)}}let o=u?.frontmatter?.[this.plugin.settings.displayTitle]??"",c=p0(u);return{basename:n.basename,displayTitle:o,content:i,cleanedContent:d0(Qr(i)),path:n.path,mtime:n.stat.mtime,tags:c,unmarkedTags:c.map(h=>h.replace("#","")),aliases:h0(u).join(""),headings1:u?Mu(u,1).join(" "):"",headings2:u?Mu(u,2).join(" "):"",headings3:u?Mu(u,3).join(" "):""}}};Kt();ca();Kt();var jh=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)||ua(t)||s&&bn(t)||a&&Tn(t)||u&&Tn(t)}isFilenameIndexable(t){return this.canIndexUnsupportedFiles()||this.isFilePlaintext(t)||ri(t)||ua(t)}canIndexUnsupportedFiles(){return this.plugin.settings.unsupportedFilesIndexing==="yes"||this.plugin.settings.unsupportedFilesIndexing==="default"&&!!this.plugin.app.vault.getConfig("showUnsupportedFiles")}generateIndexableNonexistingDocument(t,r){return t=Tl(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();Kt();var wy=Xe(require("obsidian"));Aa();var Hh=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