digital-garden/.obsidian/plugins/omnisearch/main.js

106 lines
595 KiB
JavaScript
Raw Normal View History

2024-06-13 21:01:37 +03:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
2024-08-16 21:46:33 +03:00
var By=Object.create;var Xs=Object.defineProperty,jy=Object.defineProperties,Hy=Object.getOwnPropertyDescriptor,Uy=Object.getOwnPropertyDescriptors,Gy=Object.getOwnPropertyNames,qh=Object.getOwnPropertySymbols,qy=Object.getPrototypeOf,zh=Object.prototype.hasOwnProperty,zy=Object.prototype.propertyIsEnumerable;var $c=(e,t,r)=>t in e?Xs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,J=(e,t)=>{for(var r in t||(t={}))zh.call(t,r)&&$c(e,r,t[r]);if(qh)for(var r of qh(t))zy.call(t,r)&&$c(e,r,t[r]);return e},Fe=(e,t)=>jy(e,Uy(t)),Vh=e=>Xs(e,"__esModule",{value:!0});var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var U=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Kh=(e,t)=>{Vh(e);for(var r in t)Xs(e,r,{get:t[r],enumerable:!0})},Vy=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Gy(t))!zh.call(e,n)&&n!=="default"&&Xs(e,n,{get:()=>t[n],enumerable:!(r=Hy(t,n))||r.enumerable});return e},Xe=e=>Vy(Vh(Xs(e!=null?By(qy(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var Wh=(e,t,r)=>($c(e,typeof t!="symbol"?t+"":t,r),r);function qe(){}function Ky(e,t){for(let r in t)e[r]=t[r];return e}function Xc(e){return e()}function Yh(){return Object.create(null)}function lr(e){e.forEach(Xc)}function Li(e){return typeof e=="function"}function ot(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Zc(e,t){return Su||(Su=document.createElement("a")),Su.href=t,e===Su.href}function Qh(e){return Object.keys(e).length===0}function $h(e,...t){if(e==null)return qe;let r=e.subscribe(...t);return r.unsubscribe?()=>r.unsubscribe():r}function xu(e,t,r){e.$$.on_destroy.push($h(t,r))}function Mi(e,t,r,n){if(e){let i=Xh(e,t,r,n);return e[0](i)}}function Xh(e,t,r,n){return e[1]&&n?Ky(r.ctx.slice(),e[1](n(t))):r.ctx}function ki(e,t,r,n){if(e[2]&&n){let i=e[2](n(r));if(t.dirty===void 0)return i;if(typeof i=="object"){let s=[],a=Math.max(t.dirty.length,i.length);for(let u=0;u<a;u+=1)s[u]=t.dirty[u]|i[u];return s}return t.dirty|i}return t.dirty}function Fi(e,t,r,n,i,s){if(i){let a=Xh(t,r,n,s);e.p(a,i)}}function Bi(e){if(e.ctx.length>32){let t=[],r=e.ctx.length/32;for(let n=0;n<r;n++)t[n]=-1;return t}return-1}function Zh(e){return e&&Li(e.destroy)?e.destroy:qe}function Wy(){e0=!0}function Yy(){e0=!1}function j(e,t){e.appendChild(t)}function ae(e,t,r){e.insertBefore(t,r||null)}function se(e){e.parentNode&&e.parentNode.removeChild(e)}function Nu(e,t){for(let r=0;r<e.length;r+=1)e[r]&&e[r].d(t)}function V(e){return document.createElement(e)}function dt(e){return document.createTextNode(e)}function ue(){return dt(" ")}function Zs(){return dt("")}function ht(e,t,r,n){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r,n)}function Z(e,t,r){r==null?e.removeAttribute(t):e.getAttribute(t)!==r&&e.setAttribute(t,r)}function Qy(e){return Array.from(e.childNodes)}function xr(e,t){t=""+t,e.data!==t&&(e.data=t)}function Jc(e,t){e.value=t??""}function zt(e,t,r,n){r==null?e.style.removeProperty(t):e.style.setProperty(t,r,n?"important":"")}function el(e,t,r){e.classList[r?"add":"remove"](t)}function $y(e,t,{bubbles:r=!1,cancelable:n=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(e,r,n,t),i}function ea(e){Js=e}function tl(){if(!Js)throw new Error("Function called outside component initialization");return Js}function ta(e){tl().$$.on_mount.push(e)}function ra(e){tl().$$.on_destroy.push(e)}function rl(){let e=tl();return(t,r,{cancelable:n=!1}={})=>{let i=e.$$.callbacks[t];if(i){let s=$y(t,r,{cancelable:n});return i.slice().forEach(a=>{a.call(e,s)}),!s.defaultPrevented}return!0}}function Vt(e,t){let r=e.$$.callbacks[t.type];r&&r.slice().forEach(n=>n.call(this,t))}function n0(){nl||(nl=!0,r0.then(i0))}function mn(){return n0(),r0}function il(e){Hi.push(e)}function i0(){if(Ui!==0)return;let e=Js;do{try{for(;Ui<ji.length;){let t=ji[Ui];Ui++,ea(t),Xy(t.$$)}}catch(t){throw ji.length=0,Ui=0,t}for(ea(null),ji.length=0,Ui=0;Yr.length;)Yr.pop()();for(let t=0;t<Hi.length;t+=1){let r=Hi[t];sl.has(r)||(sl.add(r),r())}Hi.length=0}while(ji.
2024-06-13 21:01:37 +03:00
<iframe sandbox="allow-top-navigation-by-user-activation" 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>
2024-08-16 21:46:33 +03:00
`,new ee.Setting(t).setName("Indexing").setHeading().setDesc(sr(`\u26A0\uFE0F <span style="color: var(--text-accent)">Changing indexing settings will clear the cache, and requires a restart of Obsidian.</span><br/><br/>
2024-08-09 08:39:12 +03:00
${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.
2024-08-16 21:46:33 +03:00
<br />Text extraction only works on desktop, but the cache can be synchronized with your mobile device.`:'\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(`PDFs content indexing ${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(`Images OCR indexing ${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(`Documents content indexing ${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(`Images AI indexing ${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(`
2024-06-13 21:01:37 +03:00
Omnisearch can index file<strong>names</strong> of "unsupported" files, such as e.g. <pre style="display:inline">.mp4</pre>
or non-extracted PDFs & images.<br/>
2024-08-16 21:46:33 +03:00
"Obsidian setting" will respect the value of "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(`If you have a custom property in your notes that you want to use as the title in search results.<br>
Leave empty to disable.`)).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(`In addition to standard <code>md</code> files, Omnisearch can also index other <strong style="color: var(--text-accent)">PLAINTEXT</strong> files.<br/>
2024-06-13 21:01:37 +03:00
Add extensions separated by a space, without the dot. Example: "<code>txt org csv</code>".<br />
\u26A0\uFE0F <span style="color: var(--text-accent)">Using extensions of non-plaintext files (like .pptx) WILL cause crashes,
2024-08-16 21:46:33 +03:00
because Omnisearch will try to index their content.</span>`)).addText(d=>{d.setValue(z.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org csv").onChange(async f=>{await r.clearCache(),z.indexedFileTypes=f.split(" "),await pe(this.plugin)})}),new ee.Setting(t).setName("Behavior").setHeading(),new ee.Setting(t).setName("Save index to cache").setDesc("Enable caching to speed up indexing time. In rare cases, the cache write may cause a crash in Obsidian. This option will disable itself if it happens.").addToggle(d=>d.setValue(z.useCache).onChange(async f=>{z.useCache=f,await pe(this.plugin)})),new ee.Setting(t).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(d=>d.setValue(z.showPreviousQueryResults).onChange(async f=>{z.showPreviousQueryResults=f,await pe(this.plugin)})),new ee.Setting(t).setName(`Respect Obsidian's "Excluded Files"`).setDesc(`By default, files 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(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(`Enable this if you want to be able to search for CamelCaseWords as separate words.<br/>
2024-06-13 21:01:37 +03:00
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
2024-08-16 21:46:33 +03:00
${mo}`)).addToggle(d=>d.setValue(z.splitCamelCase).onChange(async f=>{await r.clearCache(),z.splitCamelCase=f,await pe(this.plugin)})),new ee.Setting(t).setName("Simpler search").setDesc(`Enable this if Obsidian often freezes while making searches.
Words shorter than 3 characters won't be used as prefixes; this can reduce search delay but will return fewer results.`).addToggle(d=>d.setValue(z.simpleSearch).onChange(async f=>{z.simpleSearch=f,await pe(this.plugin)})),ee.Platform.isIosApp||new ee.Setting(t).setName("Tokenize URLs").setDesc(`Enable this if you want to be able to search for URLs as separate words.
This setting has a strong impact on indexing performance, and can crash Obsidian under certain conditions.`).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(`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.`)).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("Enable the HTTP server").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("HTTP Port").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("Show a notification when the server starts").setDesc("Will display a notification if the server is enabled, at Obsidian startup.").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("Enable verbose logging").setDesc("Adds a LOT of logs for debugging purposes. Don't forget to disable it.").addToggle(d=>d.setValue(z.verboseLogging).onChange(async f=>{z.verboseLogging=f,pl(f),await pe(this.plugin)})),new ee.Setting(t).setName("Danger Zone").setHeading(),new ee.Setting(t).setName("Ignore diacritics").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/>
2024-06-13 21:01:37 +03:00
\u26A0\uFE0F <span style="color: var(--text-accent)">You probably should <strong>NOT</strong> disable this.</span><br>
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
2024-08-16 21:46:33 +03:00
${mo}`)).addToggle(d=>d.setValue(z.ignoreDiacritics).onChange(async f=>{await r.clearCache(),z.ignoreDiacritics=f,await pe(this.plugin)})),new ee.Setting(t).setName("Ignore Arabic diacritics (beta)").addToggle(d=>d.setValue(z.ignoreArabicDiacritics).onChange(async f=>{await r.clearCache(),z.ignoreArabicDiacritics=f,await pe(this.plugin)}));let h=new DocumentFragment;h.createSpan({},d=>{d.innerHTML=`Disable Omnisearch on this device only.<br>
${mo}`}),new ee.Setting(t).setName("Disable on this device").setDesc(h).addToggle(d=>d.setValue(Yl(this.app)).onChange(async f=>{f?(this.app.saveLocalStorage(ia,"1"),new ee.Notice("Omnisearch - Disabled. Please restart Obsidian.")):(this.app.saveLocalStorage(ia),new ee.Notice("Omnisearch - Enabled. Please restart Obsidian."))})),new ee.Setting(t).setName("Force save the cache").setDesc(sr(`Omnisearch has a security feature that automatically disables cache writing if it cannot fully perform the operation.<br>
2024-08-09 08:39:12 +03:00
Use this option to force the cache to be saved, even if it causes a crash.<br>
2024-08-16 21:46:33 +03:00
\u26A0\uFE0F <span style="color: var(--text-accent)">Enabling this setting could lead to crash loops</span>`)).addToggle(d=>d.setValue(z.DANGER_forceSaveCache).onChange(async f=>{z.DANGER_forceSaveCache=f,await pe(this.plugin)})),Nn()&&new ee.Setting(t).setName("Clear cache data").setDesc(sr(`Erase all Omnisearch cache data.
2024-06-13 21:01:37 +03:00
Use this if Omnisearch results are inconsistent, missing, or appear outdated.<br>
2024-08-16 21:46:33 +03:00
${mo}`)).addButton(d=>{d.setButtonText("Clear cache"),d.onClick(async()=>{await r.clearCache()})})}weightSlider(t,r){t.setLimits(1,5,.1).setValue(z[r]).setDynamicTooltip().onChange(async n=>{z[r]=n,await pe(this.plugin)})}}});function YS(e){let t;return{c(){t=V("span"),t.innerHTML='<svg viewBox="0 0 100 100" class="add-note-glyph" width="16" height="16"><path fill="currentColor" stroke="currentColor" d="M23.3,6.7c-3.7,0-6.7,3-6.7,6.7v73.3c0,3.7,3,6.7,6.7,6.7h28.4c-3.2-4.8-5.1-10.5-5.1-16.7c0-16.6,13.4-30,30-30 c2.3,0,4.5,0.3,6.7,0.8V31.7c0-0.9-0.3-1.7-1-2.4L60.7,7.6c-0.6-0.6-1.5-1-2.4-1L23.3,6.7z M56.7,13L77,33.3H60 c-1.8,0-3.3-1.5-3.3-3.3L56.7,13z M76.7,53.3c-12.9,0-23.3,10.4-23.3,23.3S63.8,100,76.7,100S100,89.6,100,76.7 S89.6,53.3,76.7,53.3z M76.7,63.3c1.8,0,3.3,1.5,3.3,3.3v6.7h6.7c1.8,0,3.3,1.5,3.3,3.3c0,1.8-1.5,3.3-3.3,3.3H80v6.7 c0,1.8-1.5,3.3-3.3,3.3c-1.8,0-3.3-1.5-3.3-3.3V80h-6.7c-1.8,0-3.3-1.5-3.3-3.3s1.5-3.3,3.3-3.3h6.7v-6.7 C73.3,64.8,74.8,63.3,76.7,63.3L76.7,63.3z"></path></svg>',Z(t,"class","suggestion-flair"),Z(t,"aria-label","Not created yet, select to create")},m(r,n){ae(r,t,n)},p:qe,i:qe,o:qe,d(r){r&&se(t)}}}function QS(e){"use strict";return[]}var D_,S_,x_=x(()=>{nr();D_=class extends pt{constructor(t){super();bt(this,t,QS,YS,ot,{})}},S_=D_});function O_(e){let t,r;return t=new S_({}),{c(){Lt(t.$$.fragment)},m(n,i){Dt(t,n,i),r=!0},i(n){r||(Ee(t.$$.fragment,n),r=!0)},o(n){Oe(t.$$.fragment,n),r=!1},d(n){Tt(t,n)}}}function $S(e){let t,r,n,i,s,a=e[2]&&O_(e),u=e[4].default,o=Mi(u,e,e[3],null);return{c(){t=V("div"),a&&a.c(),r=ue(),o&&o.c(),Z(t,"data-result-id",e[0]),Z(t,"class","suggestion-item omnisearch-result"),el(t,"is-selected",e[1])},m(c,h){ae(c,t,h),a&&a.m(t,null),j(t,r),o&&o.m(t,null),n=!0,i||(s=[ht(t,"mousemove",e[5]),ht(t,"click",e[6]),ht(t,"keypress",e[7]),ht(t,"auxclick",e[8])],i=!0)},p(c,[h]){c[2]?a?h&4&&Ee(a,1):(a=O_(c),a.c(),Ee(a,1),a.m(t,r)):a&&(ei(),Oe(a,1,1,()=>{a=null}),ti()),o&&o.p&&(!n||h&8)&&Fi(o,u,c,c[3],n?ki(u,c[3],h,null):Bi(c[3]),null),(!n||h&1)&&Z(t,"data-result-id",c[0]),(!n||h&2)&&el(t,"is-selected",c[1])},i(c){n||(Ee(a),Ee(o,c),n=!0)},o(c){Oe(a),Oe(o,c),n=!1},d(c){c&&se(t),a&&a.d(),o&&o.d(c),i=!1,lr(s)}}}function XS(e,t,r){let{$$slots:n={},$$scope:i}=t,{id:s}=t,{selected:a=!1}=t,{glyph:u=!1}=t;function o(f){Vt.call(this,e,f)}function c(f){Vt.call(this,e,f)}function h(f){Vt.call(this,e,f)}function d(f){Vt.call(this,e,f)}return e.$$set=f=>{"id"in f&&r(0,s=f.id),"selected"in f&&r(1,a=f.selected),"glyph"in f&&r(2,u=f.glyph),"$$scope"in f&&r(3,i=f.$$scope)},[s,a,u,i,n,o,c,h,d]}var N_,_o,$l=x(()=>{nr();x_();N_=class extends pt{constructor(t){super();bt(this,t,XS,$S,ot,{id:0,selected:1,glyph:2})}},_o=N_});function w_(e){let t,r=e[1].matches.length+"",n,i,s=(e[1].matches.length>1?"matches":"match")+"",a;return{c(){t=V("span"),n=dt(r),i=dt("\xA0"),a=dt(s),Z(t,"class","omnisearch-result__counter")},m(u,o){ae(u,t,o),j(t,n),j(t,i),j(t,a)},p(u,o){o&2&&r!==(r=u[1].matches.length+"")&&xr(n,r),o&2&&s!==(s=(u[1].matches.length>1?"matches":"match")+"")&&xr(a,s)},d(u){u&&se(t)}}}function R_(e){let t,r,n,i,s=e[2].textProcessor.highlightText(e[4],e[10])+"";return{c(){t=V("div"),r=V("span"),n=ue(),i=V("span"),Z(t,"class","omnisearch-result__folder-path")},m(a,u){ae(a,t,u),j(t,r),e[14](r),j(t,n),j(t,i),i.innerHTML=s},p(a,u){u&1044&&s!==(s=a[2].textProcessor.highlightText(a[4],a[10])+"")&&(i.innerHTML=s)},d(a){a&&se(t),e[14](null)}}}function P_(e){let t,r=e[2].textProcessor.highlightText(e[9],e[1].matches)+"";return{c(){t=V("div"),Z(t,"class","omnisearch-result__body")},m(n,i){ae(n,t,i),t.innerHTML=r},p(n,i){i&518&&r!==(r=n[2].textProcessor.highlightText(n[9],n[1].matches)+"")&&(t.innerHTML=r)},d(n){n&&se(t)}}}function L_(e){let t,r,n;return{c(){t=V("div"),r=V("img"),zt(r,"width","100px"),Zc(r.src,n=e[7])||Z(r,"src",n),Z(r,"alt",""),Z(t,"class","omnisearch-result__image-container")},m(i,s){ae(i,t,s),j(t,r)},p(i,s){s&128&&!Zc(r.src,n=i[7])&&Z(r,"src",n)},d(i){i&&se(t)}}}function ZS(e){let t,r,n,i,s,a,u=e[2].textProcessor.highlightText(e[3],e[11])+"",o,c,h,d=En(e[1].path)+"",f,g,y,b,D,m,v=e[1].m
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var we=!0,tt=!1,Kr;return{s:function(){H=H.call(R)},n:function(){var X=H.next();return we=X.done,X},e:function(X){tt=!0,Kr=X},f:function(){try{!we&&H.return!=null&&H.return()}finally{if(tt)throw Kr}}}}function c(R,F){if(!!R){if(typeof R=="string")return h(R,F);var H=Object.prototype.toString.call(R).slice(8,-1);if(H==="Object"&&R.constructor&&(H=R.constructor.name),H==="Map"||H==="Set")return Array.from(R);if(H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H))return h(R,F)}}function h(R,F){(F==null||F>R.length)&&(F=R.length);for(var H=0,te=new Array(F);H<F;H++)te[H]=R[H];return te}function d(R,F){if(!(R instanceof F))throw new TypeError("Cannot call a class as a function")}function f(R,F){for(var H=0;H<F.length;H++){var te=F[H];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(R,te.key,te)}}function g(R,F,H){return F&&f(R.prototype,F),H&&f(R,H),Object.defineProperty(R,"prototype",{writable:!1}),R}function y(R,F,H){return F in R?Object.defineProperty(R,F,{value:H,enumerable:!0,configurable:!0,writable:!0}):R[F]=H,R}function b(R,F,H){D(R,F),F.set(R,H)}function D(R,F){if(F.has(R))throw new TypeError("Cannot initialize the same private elements twice on an object")}function m(R,F){var H=T(R,F,"get");return v(R,H)}function v(R,F){return F.get?F.get.call(R):F.value}function I(R,F,H){var te=T(R,F,"set");return E(R,te,H),H}function T(R,F,H){if(!F.has(R))throw new TypeError("attempted to "+H+" private field on non-instance");return F.get(R)}function E(R,F,H){if(F.set)F.set.call(R,H);else{if(!F.writable)throw new TypeError("attempted to set read only private field");F.value=H}}var C=typeof Symbol!="undefined"?Symbol.toStringTag:"@@toStringTag",S=new WeakMap,N=new WeakMap,P=function(){function R(F){var H=F.executor,te=H===void 0?function(){}:H,de=F.internals,we=de===void 0?Ke():de,tt=F.promise,Kr=tt===void 0?new Promise(function(_t,X){return te(_t,X,function($e){we.onCancelList.push($e)})}):tt;d(this,R),b(this,S,{writable:!0,value:void 0}),b(this,N,{writable:!0,value:void 0}),y(this,C,"CancelablePromise"),this.cancel=this.cancel.bind(this),I(this,S,we),I(this,N,Kr||new Promise(function(_t,X){return te(_t,X,function($e){we.onCancelList.push($e)})}))}return g(R,[{key:"then",value:function(H,te){return ke(m(this,N).then(he(H,m(this,S)),he(te,m(this,S))),m(this,S))}},{key:"catch",value:function(H){return ke(m(this,N).catch(he(H,m(this,S))),m(this,S))}},{key:"finally",value:function(H,te){var de=this;return te&&m(this,S).onCancelList.push(H),ke(m(this,N).finally(he(function(){if(H)return te&&(m(de,S).onCancelList=m(de,S).onCancelList.filter(function(we){return we!==H})),H()},m(this,S))),m(this,S))}},{key:"cancel",value:function(){m(this,S).isCanceled=!0;var H=m(this,S).onCancelList;m(this,S).onCancelList=[];var te=o(H),de;try{for(te.s();!(de=te.n()).done;){var we=de.value;if(typeof we=="function")try{we()}catch(tt){console.error(tt)}}}catch(tt){te.e(tt)}finally{te.f()}}},{key:"isCanceled",value:function(){return m(this,S).isCanceled===!0}}]),R}(),q=function(R){t(H,R);var F=n(H);function H(te){return d(this,H),F.call(this,{executor:te})}return g(H)}(P);e.CancelablePromise=q,y(q,"all",function(F){return Ie(F,Promise.all(F))}),y(q,"allSettled",function(F){return Ie(F,Promise.allSettled(F))}),y(q,"any",function(F){return Ie(F,Promise.any(F))}),y(q,"race",function(F){return Ie(F,Promise.race(F))}),y(q,"resolve",function(F){return ge(Promise.resolve(F))}),y(q,"reject",function(F){return ge(Promise.reject(F))}),y(q,"isCancelable",W);var $=q;e.default=$;function ge(R){return ke(R,Ke())}function W(R){return R instanceof q||R instanceof P}function he(R,F){if(R)return function(H){if(!F.isCanceled){var te=R(H);return W(te)&&F.onCancelList.push(te.cancel),te}return H}}function ke(R,F){return new P({internals:F,promise:R})}function Ie(R,F){var H=Ke();return H.onCancelList.push(function(){var te=o(R),de;try{for(te.s();!(de=te.n()).done;){var we=de.value;W(we)&&we.cancel()}}catch(tt){te.e(tt)}final
`),i&&i.c(),n=Zs()},m(s,a){ae(s,t,a),i&&i.m(s,a),ae(s,n,a)},p(s,a){a[0]&5&&(r=s[0].settings.simpleSearch&&s[2].split(sa).some(Q_)),r?i||(i=Y_(s),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null)},d(s){s&&se(t),i&&i.d(s),s&&se(n)}}}function Y_(e){let t,r,n;return{c(){t=V("br"),r=ue(),n=V("span"),n.textContent=`You have enabled "Simpler Search" in the settings, try to type more
characters.`,zt(n,"color","var(--text-accent)"),zt(n,"font-size","small")},m(i,s){ae(i,t,s),ae(i,r,s),ae(i,n,s)},d(i){i&&se(t),i&&se(r),i&&se(n)}}}function sx(e){let t,r,n,i=e[3],s=[];for(let h=0;h<i.length;h+=1)s[h]=W_(z_(e,i,h));let a=h=>Oe(s[h],1,1,()=>{s[h]=null});function u(h,d){if(!h[3].length&&h[2]&&!h[5])return ix;if(h[5])return nx}let o=u(e,[-1,-1]),c=o&&o(e);return{c(){for(let h=0;h<s.length;h+=1)s[h].c();t=ue(),r=V("div"),c&&c.c(),zt(r,"text-align","center")},m(h,d){for(let f=0;f<s.length;f+=1)s[f]&&s[f].m(h,d);ae(h,t,d),ae(h,r,d),c&&c.m(r,null),n=!0},p(h,d){if(d[0]&12299){i=h[3];let f;for(f=0;f<i.length;f+=1){let g=z_(h,i,f);s[f]?(s[f].p(g,d),Ee(s[f],1)):(s[f]=W_(g),s[f].c(),Ee(s[f],1),s[f].m(t.parentNode,t))}for(ei(),f=i.length;f<s.length;f+=1)a(f);ti()}o===(o=u(h,d))&&c?c.p(h,d):(c&&c.d(1),c=o&&o(h),c&&(c.c(),c.m(r,null)))},i(h){if(!n){for(let d=0;d<i.length;d+=1)Ee(s[d]);n=!0}},o(h){s=s.filter(Boolean);for(let d=0;d<s.length;d+=1)Oe(s[d]);n=!1},d(h){Nu(s,h),h&&se(t),h&&se(r),c&&c.d()}}}function ax(e){let t,r,n,i,s,a,u,o,c,h,d,f,g,y,b,D,m,v,I,T,E,C,S,N,P,q,$,ge,W,he,ke,Ie,Ke,R,F,H,te,de,we,tt,Kr,_t,X,$e,Wr,cr,Zn,Pi,pn,Fy={plugin:e[0],initialValue:e[2],placeholder:"Omnisearch - Vault",$$slots:{default:[rx]},$$scope:{ctx:e}};t=new Fu({props:Fy}),e[19](t),t.$on("input",e[20]);let Pt=e[4]&&K_(e);return i=new Bu({props:{$$slots:{default:[sx]},$$scope:{ctx:e}}}),{c(){Lt(t.$$.fragment),r=ue(),Pt&&Pt.c(),n=ue(),Lt(i.$$.fragment),s=ue(),a=V("div"),u=V("div"),u.innerHTML='<span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span>',o=ue(),c=V("div"),c.innerHTML=`<span class="prompt-instruction-command">alt \u2191\u2193</span>
<span>to cycle history</span>`,h=ue(),d=V("div"),f=V("span"),g=dt(e[8]),y=ue(),b=V("span"),b.textContent="to open",D=ue(),m=V("div"),m.innerHTML=`<span class="prompt-instruction-command">tab</span>
2024-08-09 08:39:12 +03:00
<span>to switch to In-File Search</span>`,v=ue(),I=V("div"),T=V("span"),E=dt(e[7]),C=ue(),S=V("span"),S.textContent="to open in a new pane",N=ue(),P=V("div"),q=V("span"),q.textContent=`${e[11]}`,$=ue(),ge=V("span"),ge.textContent="to open in a new split",W=ue(),he=V("div"),he.innerHTML=`<span class="prompt-instruction-command">alt o</span>
<span>to open in the background</span>`,ke=ue(),Ie=V("div"),Ke=V("span"),R=dt(e[10]),F=ue(),H=V("span"),H.textContent="to create",te=ue(),de=V("div"),we=V("span"),tt=dt(e[9]),Kr=ue(),_t=V("span"),_t.textContent="to create in a new pane",X=ue(),$e=V("div"),$e.innerHTML=`<span class="prompt-instruction-command">alt \u21B5</span>
<span>to insert a link</span>`,Wr=ue(),cr=V("div"),cr.innerHTML=`<span class="prompt-instruction-command">ctrl g</span>
2024-08-16 21:46:33 +03:00
<span>to toggle excerpts</span>`,Zn=ue(),Pi=V("div"),Pi.innerHTML='<span class="prompt-instruction-command">esc</span><span>to close</span>',Z(u,"class","prompt-instruction"),Z(c,"class","prompt-instruction"),Z(f,"class","prompt-instruction-command"),Z(d,"class","prompt-instruction"),Z(m,"class","prompt-instruction"),Z(T,"class","prompt-instruction-command"),Z(I,"class","prompt-instruction"),Z(q,"class","prompt-instruction-command"),Z(P,"class","prompt-instruction"),Z(he,"class","prompt-instruction"),Z(Ke,"class","prompt-instruction-command"),Z(Ie,"class","prompt-instruction"),Z(we,"class","prompt-instruction-command"),Z(de,"class","prompt-instruction"),Z($e,"class","prompt-instruction"),Z(cr,"class","prompt-instruction"),Z(Pi,"class","prompt-instruction"),Z(a,"class","prompt-instructions")},m(me,Ye){Dt(t,me,Ye),ae(me,r,Ye),Pt&&Pt.m(me,Ye),ae(me,n,Ye),Dt(i,me,Ye),ae(me,s,Ye),ae(me,a,Ye),j(a,u),j(a,o),j(a,c),j(a,h),j(a,d),j(d,f),j(f,g),j(d,y),j(d,b),j(a,D),j(a,m),j(a,v),j(a,I),j(I,T),j(T,E),j(I,C),j(I,S),j(a,N),j(a,P),j(P,q),j(P,$),j(P,ge),j(a,W),j(a,he),j(a,ke),j(a,Ie),j(Ie,Ke),j(Ke,R),j(Ie,F),j(Ie,H),j(a,te),j(a,de),j(de,we),j(we,tt),j(de,Kr),j(de,_t),j(a,X),j(a,$e),j(a,Wr),j(a,cr),j(a,Zn),j(a,Pi),pn=!0},p(me,Ye){let Du={};Ye[0]&1&&(Du.plugin=me[0]),Ye[0]&4&&(Du.initialValue=me[2]),Ye[0]&1|Ye[1]&4096&&(Du.$$scope={dirty:Ye,ctx:me}),t.$set(Du),me[4]?Pt?Pt.p(me,Ye):(Pt=K_(me),Pt.c(),Pt.m(n.parentNode,n)):Pt&&(Pt.d(1),Pt=null);let Gh={};Ye[0]&47|Ye[1]&4096&&(Gh.$$scope={dirty:Ye,ctx:me}),i.$set(Gh),(!pn||Ye[0]&256)&&xr(g,me[8]),(!pn||Ye[0]&128)&&xr(E,me[7]),(!pn||Ye[0]&1024)&&xr(R,me[10]),(!pn||Ye[0]&512)&&xr(tt,me[9])},i(me){pn||(Ee(t.$$.fragment,me),Ee(i.$$.fragment,me),pn=!0)},o(me){Oe(t.$$.fragment,me),Oe(i.$$.fragment,me),pn=!1},d(me){e[19](null),Tt(t,me),me&&se(r),Pt&&Pt.d(me),me&&se(n),Tt(i,me),me&&se(s),me&&se(a)}}}function ux(e,t,r){let n,i;xu(e,gn,X=>r(18,i=X));let{modal:s}=t,{previousQuery:a}=t,{plugin:u}=t,o=0,c=0,h,d=[],f,g="",y=!0,b,D,m,v,I,T=_n()+" alt \u21B5";ta(async()=>{ce.enable("vault"),ce.on("vault",_e.Enter,$),ce.on("vault",_e.OpenInBackground,ge),ce.on("vault",_e.CreateNote,R),ce.on("vault",_e.OpenInNewPane,W),ce.on("vault",_e.InsertLink,F),ce.on("vault",_e.Tab,H),ce.on("vault",_e.ArrowUp,()=>te(-1)),ce.on("vault",_e.ArrowDown,()=>te(1)),ce.on("vault",_e.PrevSearchHistory,E),ce.on("vault",_e.NextSearchHistory,C),ce.on("vault",_e.OpenInNewLeaf,he),await u.notesIndexer.refreshIndex(),await P()}),ra(()=>{ce.disable("vault")});async function E(){let X=(await u.cacheManager.getSearchHistory()).filter($e=>$e);++c>=X.length&&(c=0),r(2,h=X[c]),b?.setInputValue(h??"")}async function C(){let X=(await u.cacheManager.getSearchHistory()).filter($e=>$e);--c<0&&(c=X.length?X.length-1:0),r(2,h=X[c]),b?.setInputValue(h??"")}let S=null;async function N(){r(5,y=!0),S&&(S.cancel(),S=null),f=new ui(h,{ignoreDiacritics:u.settings.ignoreDiacritics,ignoreArabicDiacritics:u.settings.ignoreArabicDiacritics}),S=(0,q_.cancelable)(new Promise(X=>{X(u.searchEngine.getSuggestions(f))})),r(3,d=await S),r(1,o=0),await de(),r(5,y=!1)}let P=Ea(N,0);function q(X){!n||(X?.ctrlKey?W():$(),s.close())}function $(){!n||(Ie(n),s.close())}function ge(){!n||Ie(n,!0)}function W(){!n||(Ie(n,!0),s.close())}function he(){!n||(Ie(n,!0,!0),s.close())}function ke(){h&&u.cacheManager.addToSearchHistory(h)}function Ie(X,$e=!1,Wr=!1){ke();let cr=X.matches?.[0]?.offset??0;ju(u.app,X,cr,$e,Wr)}async function Ke(X){await R()}async function R(X){if(h){try{await I0(u.app,h,X?.newLeaf)}catch($e){new gr.Notice($e.message);return}s.close()}}function F(){if(!n)return;let X=u.app.vault.getMarkdownFiles().find(Pi=>Pi.path===n.path),$e=u.app.workspace.getActiveFile(),Wr=u.app.workspace.getActiveViewOfType(gr.MarkdownView);if(!Wr?.editor){new gr.Notice("Omnisearch - Error - No active editor",3e3);return}let cr;X&&$e?cr=u.app.fileManager.generateMarkdownLink(X,$e.path):cr=`[[${n.basename}.${En(n.path)}]]`;let Zn=Wr.editor.getCursor();Wr.editor.replaceRange(cr,Zn,Zn),Zn.ch+=cr.length,Wr.editor.setCursor(Zn),s.close()}function H(){if(!(n&&(bn(n?.path)||!n?.matches
<span>to switch to Vault Search</span>`,d=ue(),f=V("div"),g=V("span"),g.textContent="esc",y=ue(),S.c(),b=ue(),D=V("div"),m=V("span"),m.textContent=`${_n()} \u21B5`,v=ue(),I=V("span"),I.textContent="to open in a new pane",Z(a,"class","prompt-instruction"),Z(o,"class","prompt-instruction"),Z(h,"class","prompt-instruction"),Z(g,"class","prompt-instruction-command"),Z(f,"class","prompt-instruction"),Z(m,"class","prompt-instruction-command"),Z(D,"class","prompt-instruction"),Z(s,"class","prompt-instructions")},m(N,P){Dt(t,N,P),ae(N,r,P),Dt(n,N,P),ae(N,i,P),ae(N,s,P),j(s,a),j(s,u),j(s,o),j(s,c),j(s,h),j(s,d),j(s,f),j(f,g),j(f,y),S.m(f,null),j(s,b),j(s,D),j(D,m),j(D,v),j(D,I),T=!0},p(N,[P]){let q={};P&1&&(q.plugin=N[0]),P&4&&(q.initialValue=N[2]),P&8388608&&(q.$$scope={dirty:P,ctx:N}),t.$set(q);let $={};P&8388721&&($.$$scope={dirty:P,ctx:N}),n.$set($),C!==(C=E(N,P))&&(S.d(1),S=C(N),S&&(S.c(),S.m(f,null)))},i(N){T||(Ee(t.$$.fragment,N),Ee(n.$$.fragment,N),T=!0)},o(N){Oe(t.$$.fragment,N),Oe(n.$$.fragment,N),T=!1},d(N){Tt(t,N),N&&se(r),Tt(n,N),N&&se(i),N&&se(s),S.d()}}}function bx(e,t,r){let n=e.find(i=>i.offset>t);return n?e.filter(i=>i.offset>t&&i.offset<=n.offset+r):[]}function Ex(e,t,r){let{plugin:n}=t,{modal:i}=t,{parent:s=null}=t,{singleFilePath:a=""}=t,{previousQuery:u}=t,o,c=[],h=0,d,f;ta(()=>{ce.enable("infile"),ce.on("infile",_e.Enter,m),ce.on("infile",_e.OpenInNewPane,D),ce.on("infile",_e.ArrowUp,()=>y(-1)),ce.on("infile",_e.ArrowDown,()=>y(1)),ce.on("infile",_e.Tab,v)}),ra(()=>{ce.disable("infile")});function g(S){let N=[],P=-1,q=0;for(;++q<100;){let $=bx(S,P,na);if(!$.length)break;P=$.last().offset,N.push($)}return N}function y(S){r(6,h=ku(h+S,c.length)),b()}async function b(){await mn(),document.querySelector(`[data-result-id="${h}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function D(){return m(!0)}async function m(S=!1){if(d){i.close(),s&&s.close();let N=n.textProcessor.stringsToRegex(d.foundWords);N.exec(d.content),await ju(n.app,d,N.lastIndex,S);let P=n.app.workspace.getActiveViewOfType(Ia.MarkdownView);if(!P)return;let q=c[h]??0,$=P.editor.offsetToPos(q);$.ch=0,P.editor.setCursor($),P.editor.scrollIntoView({from:{line:$.line-10,ch:0},to:{line:$.line+10,ch:0}})}}function v(){new Rn(n,o??u).open(),i.close()}let I=S=>r(3,o=S.detail),T=(S,N)=>r(6,h=S),E=S=>m(S.ctrlKey),C=S=>{S.button==1&&m(!0)};return e.$$set=S=>{"plugin"in S&&r(0,n=S.plugin),"modal"in S&&r(9,i=S.modal),"parent"in S&&r(1,s=S.parent),"singleFilePath"in S&&r(10,a=S.singleFilePath),"previousQuery"in S&&r(2,u=S.previousQuery)},e.$$.update=()=>{if(e.$$.dirty&4){e:r(3,o=u??"")}if(e.$$.dirty&3081){e:(async()=>{o&&(r(11,f=new ui(o,{ignoreDiacritics:n.settings.ignoreDiacritics})),r(4,d=(await n.searchEngine.getSuggestions(f,{singleFilePath:a}))[0]??null)),r(6,h=0),await b()})()}if(e.$$.dirty&2064){e:if(d){let S=g(d.matches),N=f.getExactTerms();N.length&&(S=S.filter(P=>N.every(q=>P.some($=>$.match.includes(q))))),r(5,c=S.map(P=>Math.round(P.first().offset)))}}},[n,s,u,o,d,c,h,m,v,i,a,f,I,T,E,C]}var Ia,iT,sT,aT=x(()=>{nr();ml();Or();Kt();Ru();Ia=Xe(require("obsidian"));gl();ya();tT();bo();ca();iT=class extends pt{constructor(t){super();bt(this,t,Ex,Tx,ot,{plugin:0,modal:9,parent:1,singleFilePath:10,previousQuery:2})}},sT=iT});var Ao,Jl,Rn,us,ya=x(()=>{Ao=Xe(require("obsidian"));Z_();aT();Or();Jl=class extends Ao.Modal{constructor(t){super(t.app);let r=t.settings;this.modalEl.replaceChildren(),this.modalEl.addClass("omnisearch-modal","prompt"),this.modalEl.removeClass("modal"),this.modalEl.tabIndex=-1,this.scope.register([],"ArrowDown",o=>{o.preventDefault(),ce.emit(_e.ArrowDown)}),this.scope.register([],"ArrowUp",o=>{o.preventDefault(),ce.emit(_e.ArrowUp)});for(let o of[{k:"J",dir:"down"},{k:"K",dir:"up"}])for(let c of["Ctrl","Mod"])this.scope.register([c],o.k,h=>{r.vimLikeNavigationShortcut&&ce.emit("arrow-"+o.dir)});for(let o of[{k:"N",dir:"down"},{k:"P",dir:"up"}])for(let c of["Ctrl","Mod"])this.scope.register([c],o.k,h=>{r.vimLikeNavigationShortcut&&ce.emit("arrow-"+o.dir)});let n,i,s,a,u=["Mod","Alt"];r.openInNewPane?(n=["Mod"],i=[]
2024-06-13 21:01:37 +03:00
`).map(i=>{let s=i.match(/^\s+/);if(s===null)return i;let[a]=s;return a.length>=n.length?i.slice(n.length):i}).join(`
2024-08-16 21:46:33 +03:00
`)}var Es=class{options;rules;lexer;constructor(t){this.options=t||Re.defaults}space(t){let r=this.rules.block.newline.exec(t);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(t){let r=this.rules.block.code.exec(t);if(r){let n=r[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Zo(n,`
`)}}}fences(t){let r=this.rules.block.fences.exec(t);if(r){let n=r[0],i=o2(n,r[3]||"");return{type:"code",raw:n,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:i}}}heading(t){let r=this.rules.block.heading.exec(t);if(r){let n=r[2].trim();if(/#$/.test(n)){let i=Zo(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let r=this.rules.block.hr.exec(t);if(r)return{type:"hr",raw:r[0]}}blockquote(t){let r=this.rules.block.blockquote.exec(t);if(r){let n=r[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
$1`);n=Zo(n.replace(/^ *>[ \t]?/gm,""),`
`);let i=this.lexer.state.top;this.lexer.state.top=!0;let s=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:r[0],tokens:s,text:n}}}list(t){let r=this.rules.block.list.exec(t);if(r){let n=r[1].trim(),i=n.length>1,s={type:"list",raw:"",ordered:i,start:i?+n.slice(0,-1):"",loose:!1,items:[]};n=i?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=i?n:"[*+-]");let a=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),u="",o="",c=!1;for(;t;){let h=!1;if(!(r=a.exec(t))||this.rules.block.hr.test(t))break;u=r[0],t=t.substring(u.length);let d=r[2].split(`
`,1)[0].replace(/^\t+/,m=>" ".repeat(3*m.length)),f=t.split(`
`,1)[0],g=0;this.options.pedantic?(g=2,o=d.trimStart()):(g=r[2].search(/[^ ]/),g=g>4?1:g,o=d.slice(g),g+=r[1].length);let y=!1;if(!d&&/^ *$/.test(f)&&(u+=f+`
`,t=t.substring(f.length+1),h=!0),!h){let m=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),v=new RegExp(`^ {0,${Math.min(3,g-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),I=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:\`\`\`|~~~)`),T=new RegExp(`^ {0,${Math.min(3,g-1)}}#`);for(;t;){let E=t.split(`
`,1)[0];if(f=E,this.options.pedantic&&(f=f.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),I.test(f)||T.test(f)||m.test(f)||v.test(t))break;if(f.search(/[^ ]/)>=g||!f.trim())o+=`
`+f.slice(g);else{if(y||d.search(/[^ ]/)>=4||I.test(d)||T.test(d)||v.test(d))break;o+=`
`+f}!y&&!f.trim()&&(y=!0),u+=E+`
`,t=t.substring(E.length+1),d=f.slice(g)}}s.loose||(c?s.loose=!0:/\n *\n *$/.test(u)&&(c=!0));let b=null,D;this.options.gfm&&(b=/^\[[ xX]\] /.exec(o),b&&(D=b[0]!=="[ ] ",o=o.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:u,task:!!b,checked:D,loose:!1,text:o,tokens:[]}),s.raw+=u}s.items[s.items.length-1].raw=u.trimEnd(),s.items[s.items.length-1].text=o.trimEnd(),s.raw=s.raw.trimEnd();for(let h=0;h<s.items.length;h++)if(this.lexer.state.top=!1,s.items[h].tokens=this.lexer.blockTokens(s.items[h].text,[]),!s.loose){let d=s.items[h].tokens.filter(g=>g.type==="space"),f=d.length>0&&d.some(g=>/\n.*\n/.test(g.raw));s.loose=f}if(s.loose)for(let h=0;h<s.items.length;h++)s.items[h].loose=!0;return s}}html(t){let r=this.rules.block.html.exec(t);if(r)return{type:"html",block:!0,raw:r[0],pre:r[1]==="pre"||r[1]==="script"||r[1]==="style",text:r[0]}}def(t){let r=this.rules.block.def.exec(t);if(r){let n=r[1].toLowerCase().replace(/\s+/g," "),i=r[2]?r[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:n,raw:r[0],href:i,title:s}}}table(t){let r=this.rules.block.table.exec(t);if(!r||!/[:|]/.test(r[2]))return;let n=Eb(r[1]),i=r[2].replace(/^\||\| *$/g,"").split("|"),s=r[3]&&r[3].trim()?r[3].replace(/\n[ \t]*$/,"").split(`
`):[],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)===`
`?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let r=this.rules.block.text.exec(t);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(t){let r=this.rules.inline.escape.exec(t);if(r)return{type:"escape",raw:r[0],text:$t(r[1])}}tag(t){let r=this.rules.inline.tag.exec(t);if(r)return!this.lexer.state.inLink&&/^<a /i.test(r[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(t){let r=this.rules.inline.link.exec(t);if(r){let n=r[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;let a=Zo(n.slice(0,-1),"\\");if((n.length-a.length)%2==0)return}else{let a=u2(r[2],"()");if(a>-1){let o=(r[0].indexOf("!")===0?5:4)+r[1].length+a;r[2]=r[2].substring(0,a),r[0]=r[0].substring(0,o).trim(),r[3]=""}}let i=r[2],s="";if(this.options.pedantic){let a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a&&(i=a[1],s=a[3])}else s=r[3]?r[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),Ab(r,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer)}}reflink(t,r){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let i=(n[2]||n[1]).replace(/\s+/g," "),s=r[i.toLowerCase()];if(!s){let a=n[0].charAt(0);return{type:"text",raw:a,text:a}}return Ab(n,s,n[0],this.lexer)}}emStrong(t,r,n=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let a=[...i[0]].length-1,u,o,c=a,h=0,d=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,r=r.slice(-1*t.length+a);(i=d.exec(r))!=null;){if(u=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!u)continue;if(o=[...u].length,i[3]||i[4]){c+=o;continue}else if((i[5]||i[6])&&a%3&&!((a+o)%3)){h+=o;continue}if(c-=o,c>0)continue;o=Math.min(o,o+c+h);let f=[...i[0]][0].length,g=t.slice(0,a+i.index+f+o);if(Math.min(a,o)%2){let b=g.slice(1,-1);return{type:"em",raw:g,text:b,tokens:this.lexer.inlineTokens(b)}}let y=g.slice(2,-2);return{type:"strong",raw:g,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(t){let r=this.rules.inline.code.exec(t);if(r){let n=r[2].replace(/\n/g," "),i=/[^ ]/.test(n),s=/^ /.test(n)&&/ $/.test(n);return i&&s&&(n=n.substring(1,n.length-1)),n=$t(n,!0),{type:"codespan",raw:r[0],text:n}}}br(t){let r=this.rules.inline.br.exec(t);if(r)return{type:"br",raw:r[0]}}del(t){let r=this.rules.inline.del.exec(t);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(t){let r=this.rules.inline.autolink.exec(t);if(r){let n,i;return r[2]==="@"?(n=$t(r[1]),i="mailto:"+n):(n=$t(r[1]),i=n),{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let r;if(r=this.rules.inline.url.exec(t)){let n,i;if(r[2]==="@")n=$t(r[0]),i="mailto:"+n;else{let s;do s=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])?.[0]??"";while(s!==r[0]);n=$t(r[0]),r[1]==="www."?i="http://"+r[0]:i=r[0]}return{type:"link",raw:r[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let r=this.rules.inline.text.exec(t);if(r){let n;return this.lexer.state.inRawBlock?n=r[0]:n=$t(r[0]),{type:"text",raw:r[0],text:n}}}},c2=/^(?: *(?:\n|$))+/,l2=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,f2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Va=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,d2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,yb=/(?:[*+-]|\d{1,9}[.)])/,Ib=Se(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\
]`).replace("lheading",Ib).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Db=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,E2=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Sb=/^( {2,}|\\)\n(?!\s*$)/,A2=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ka="\\p{P}\\p{S}",y2=Se(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Ka).getRegex(),I2=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,v2=Se(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Ka).getRegex(),C2=Se("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Ka).getRegex(),D2=Se("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Ka).getRegex(),S2=Se(/\\([punct])/,"gu").replace(/punct/g,Ka).getRegex(),x2=Se(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),O2=Se(od).replace("(?:-->|$)","-->").getRegex(),N2=Se("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",O2).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ec=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,w2=Se(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",ec).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xb=Se(/^!?\[(label)\]\[(ref)\]/).replace("label",ec).replace("ref",ud).getRegex(),Ob=Se(/^!?\[(ref)\](?:\[\])?/).replace("ref",ud).getRegex(),R2=Se("reflink|nolink(?!\\()","g").replace("reflink",xb).replace("nolink",Ob).getRegex(),ld={_backpedal:za,anyPunctuation:S2,autolink:x2,blockSkip:I2,br:Sb,code:E2,del:za,emStrongLDelim:v2,emStrongRDelimAst:C2,emStrongRDelimUnd:D2,escape:Db,link:w2,nolink:Ob,punctuation:y2,reflink:xb,reflinkSearch:R2,tag:N2,text:A2,url:za},P2=Fe(J({},ld),{link:Se(/^!?\[(label)\]\((.*?)\)/).replace("label",ec).getRegex(),reflink:Se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ec).getRegex()}),fd=Fe(J({},ld),{escape:Se(Db).replace("])","~|])").getRegex(),url:Se(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),L2=Fe(J({},fd),{br:Se(Sb).replace("{2,}","*").getRegex(),text:Se(fd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),tc={normal:cd,gfm:T2,pedantic:b2},Wa={normal:ld,gfm:fd,breaks:L2,pedantic:P2},ar=class{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Re.defaults,this.options.tokenizer=this.options.tokenizer||new Es,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={block:tc.normal,inline:Wa.normal};this.options.pedantic?(r.block=tc.pedantic,r.inline=Wa.pedantic):this.options.gfm&&(r.block
2024-06-13 21:01:37 +03:00
`),this.blockTokens(t,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,r=[]){this.options.pedantic?t=t.replace(/\t/g," ").replace(/^ +$/gm,""):t=t.replace(/^( *)(\t+)/gm,(u,o,c)=>o+" ".repeat(c.length));let n,i,s,a;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(u=>(n=u.call({lexer:this},t,r))?(t=t.substring(n.raw.length),r.push(n),!0):!1))){if(n=this.tokenizer.space(t)){t=t.substring(n.raw.length),n.raw.length===1&&r.length>0?r[r.length-1].raw+=`
`:r.push(n);continue}if(n=this.tokenizer.code(t)){t=t.substring(n.raw.length),i=r[r.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+n.raw,i.text+=`
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):r.push(n);continue}if(n=this.tokenizer.fences(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.heading(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.hr(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.blockquote(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.list(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.html(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.def(t)){t=t.substring(n.raw.length),i=r[r.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
`+n.raw,i.text+=`
2024-08-16 21:46:33 +03:00
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.lheading(t)){t=t.substring(n.raw.length),r.push(n);continue}if(s=t,this.options.extensions&&this.options.extensions.startBlock){let u=1/0,o=t.slice(1),c;this.options.extensions.startBlock.forEach(h=>{c=h.call({lexer:this},o),typeof c=="number"&&c>=0&&(u=Math.min(u,c))}),u<1/0&&u>=0&&(s=t.substring(0,u+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s))){i=r[r.length-1],a&&i.type==="paragraph"?(i.raw+=`
2024-06-13 21:01:37 +03:00
`+n.raw,i.text+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):r.push(n),a=s.length!==t.length,t=t.substring(n.raw.length);continue}if(n=this.tokenizer.text(t)){t=t.substring(n.raw.length),i=r[r.length-1],i&&i.type==="text"?(i.raw+=`
`+n.raw,i.text+=`
2024-08-16 21:46:33 +03:00
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):r.push(n);continue}if(t){let u="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let n,i,s,a=t,u,o,c;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(u=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)h.includes(u[0].slice(u[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,u.index)+"["+"a".repeat(u[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(u=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,u.index)+"["+"a".repeat(u[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(u=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,u.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(o||(c=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(h=>(n=h.call({lexer:this},t,r))?(t=t.substring(n.raw.length),r.push(n),!0):!1))){if(n=this.tokenizer.escape(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.tag(t)){t=t.substring(n.raw.length),i=r[r.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):r.push(n);continue}if(n=this.tokenizer.link(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(n.raw.length),i=r[r.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):r.push(n);continue}if(n=this.tokenizer.emStrong(t,a,c)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.codespan(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.br(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.del(t)){t=t.substring(n.raw.length),r.push(n);continue}if(n=this.tokenizer.autolink(t)){t=t.substring(n.raw.length),r.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(t))){t=t.substring(n.raw.length),r.push(n);continue}if(s=t,this.options.extensions&&this.options.extensions.startInline){let h=1/0,d=t.slice(1),f;this.options.extensions.startInline.forEach(g=>{f=g.call({lexer:this},d),typeof f=="number"&&f>=0&&(h=Math.min(h,f))}),h<1/0&&h>=0&&(s=t.substring(0,h+1))}if(n=this.tokenizer.inlineText(s)){t=t.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(c=n.raw.slice(-1)),o=!0,i=r[r.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):r.push(n);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return r}},As=class{options;constructor(t){this.options=t||Re.defaults}code(t,r,n){let i=(r||"").match(/^\S*/)?.[0];return t=t.replace(/\n$/,"")+`
`,i?'<pre><code class="language-'+$t(i)+'">'+(n?t:$t(t,!0))+`</code></pre>
`:"<pre><code>"+(n?t:$t(t,!0))+`</code></pre>
2024-06-13 21:01:37 +03:00
`}blockquote(t){return`<blockquote>
${t}</blockquote>
`}html(t,r){return t}heading(t,r,n){return`<h${r}>${t}</h${r}>
`}hr(){return`<hr>
`}list(t,r,n){let i=r?"ol":"ul",s=r&&n!==1?' start="'+n+'"':"";return"<"+i+s+`>
`+t+"</"+i+`>
`}listitem(t,r,n){return`<li>${t}</li>
`}checkbox(t){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(t){return`<p>${t}</p>
`}table(t,r){return r&&(r=`<tbody>${r}</tbody>`),`<table>
<thead>
`+t+`</thead>
`+r+`</table>
`}tablerow(t){return`<tr>
${t}</tr>
`}tablecell(t,r){let n=r.header?"th":"td";return(r.align?`<${n} align="${r.align}">`:`<${n}>`)+t+`</${n}>
2024-08-16 21:46:33 +03:00
`}strong(t){return`<strong>${t}</strong>`}em(t){return`<em>${t}</em>`}codespan(t){return`<code>${t}</code>`}br(){return"<br>"}del(t){return`<del>${t}</del>`}link(t,r,n){let i=bb(t);if(i===null)return n;t=i;let s='<a href="'+t+'"';return r&&(s+=' title="'+r+'"'),s+=">"+n+"</a>",s}image(t,r,n){let i=bb(t);if(i===null)return n;t=i;let s=`<img src="${t}" alt="${n}"`;return r&&(s+=` title="${r}"`),s+=">",s}text(t){return t}},Ya=class{strong(t){return t}em(t){return t}codespan(t){return t}del(t){return t}html(t){return t}text(t){return t}link(t,r,n){return""+n}image(t,r,n){return""+n}br(){return""}},ur=class{options;renderer;textRenderer;constructor(t){this.options=t||Re.defaults,this.options.renderer=this.options.renderer||new As,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ya}static parse(t,r){return new ur(r).parse(t)}static parseInline(t,r){return new ur(r).parseInline(t)}parse(t,r=!0){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=s,u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){n+=u||"";continue}}switch(s.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{let a=s;n+=this.renderer.heading(this.parseInline(a.tokens),a.depth,s2(this.parseInline(a.tokens,this.textRenderer)));continue}case"code":{let a=s;n+=this.renderer.code(a.text,a.lang,!!a.escaped);continue}case"table":{let a=s,u="",o="";for(let h=0;h<a.header.length;h++)o+=this.renderer.tablecell(this.parseInline(a.header[h].tokens),{header:!0,align:a.align[h]});u+=this.renderer.tablerow(o);let c="";for(let h=0;h<a.rows.length;h++){let d=a.rows[h];o="";for(let f=0;f<d.length;f++)o+=this.renderer.tablecell(this.parseInline(d[f].tokens),{header:!1,align:a.align[f]});c+=this.renderer.tablerow(o)}n+=this.renderer.table(u,c);continue}case"blockquote":{let a=s,u=this.parse(a.tokens);n+=this.renderer.blockquote(u);continue}case"list":{let a=s,u=a.ordered,o=a.start,c=a.loose,h="";for(let d=0;d<a.items.length;d++){let f=a.items[d],g=f.checked,y=f.task,b="";if(f.task){let D=this.renderer.checkbox(!!g);c?f.tokens.length>0&&f.tokens[0].type==="paragraph"?(f.tokens[0].text=D+" "+f.tokens[0].text,f.tokens[0].tokens&&f.tokens[0].tokens.length>0&&f.tokens[0].tokens[0].type==="text"&&(f.tokens[0].tokens[0].text=D+" "+f.tokens[0].tokens[0].text)):f.tokens.unshift({type:"text",text:D+" "}):b+=D+" "}b+=this.parse(f.tokens,c),h+=this.renderer.listitem(b,y,!!g)}n+=this.renderer.list(h,u,o);continue}case"html":{let a=s;n+=this.renderer.html(a.text,a.block);continue}case"paragraph":{let a=s;n+=this.renderer.paragraph(this.parseInline(a.tokens));continue}case"text":{let a=s,u=a.tokens?this.parseInline(a.tokens):a.text;for(;i+1<t.length&&t[i+1].type==="text";)a=t[++i],u+=`
`+(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}' does not exist`);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}' does not exist`);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}' does not exist`);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
Please report this to https://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
`:lc(e.children):(0,Lr.isCDATA)(e)?lc(e.children):(0,Lr.isText)(e)?e.data:""}Ft.getText=lc;function wd(e){return Array.isArray(e)?e.map(wd).join(""):(0,Lr.hasChildren)(e)&&!(0,Lr.isComment)(e)?wd(e.children):(0,Lr.isText)(e)?e.data:""}Ft.textContent=wd;function Rd(e){return Array.isArray(e)?e.map(Rd).join(""):(0,Lr.hasChildren)(e)&&(e.type===RN.ElementType.Tag||(0,Lr.isCDATA)(e))?Rd(e.children):(0,Lr.isText)(e)?e.data:""}Ft.innerText=Rd});var TE=U(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.prevElementSibling=ft.nextElementSibling=ft.getName=ft.hasAttrib=ft.getAttributeValue=ft.getSiblings=ft.getParent=ft.getChildren=void 0;var Ld=yt();function gE(e){return(0,Ld.hasChildren)(e)?e.children:[]}ft.getChildren=gE;function _E(e){return e.parent||null}ft.getParent=_E;function LN(e){var t,r,n=_E(e);if(n!=null)return gE(n);for(var i=[e],s=e.prev,a=e.next;s!=null;)i.unshift(s),t=s,s=t.prev;for(;a!=null;)i.push(a),r=a,a=r.next;return i}ft.getSiblings=LN;function MN(e,t){var r;return(r=e.attribs)===null||r===void 0?void 0:r[t]}ft.getAttributeValue=MN;function kN(e,t){return e.attribs!=null&&Object.prototype.hasOwnProperty.call(e.attribs,t)&&e.attribs[t]!=null}ft.hasAttrib=kN;function FN(e){return e.name}ft.getName=FN;function BN(e){for(var t,r=e.next;r!==null&&!(0,Ld.isTag)(r);)t=r,r=t.next;return r}ft.nextElementSibling=BN;function jN(e){for(var t,r=e.prev;r!==null&&!(0,Ld.isTag)(r);)t=r,r=t.prev;return r}ft.prevElementSibling=jN});var bE=U(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.prepend=Bt.prependChild=Bt.append=Bt.appendChild=Bt.replaceElement=Bt.removeElement=void 0;function Ja(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){var t=e.parent.children,r=t.lastIndexOf(e);r>=0&&t.splice(r,1)}e.next=null,e.prev=null,e.parent=null}Bt.removeElement=Ja;function HN(e,t){var r=t.prev=e.prev;r&&(r.next=t);var n=t.next=e.next;n&&(n.prev=t);var i=t.parent=e.parent;if(i){var s=i.children;s[s.lastIndexOf(e)]=t,e.parent=null}}Bt.replaceElement=HN;function UN(e,t){if(Ja(t),t.next=null,t.parent=e,e.children.push(t)>1){var r=e.children[e.children.length-2];r.next=t,t.prev=r}else t.prev=null}Bt.appendChild=UN;function GN(e,t){Ja(t);var r=e.parent,n=e.next;if(t.next=n,t.prev=e,e.next=t,t.parent=r,n){if(n.prev=t,r){var i=r.children;i.splice(i.lastIndexOf(n),0,t)}}else r&&r.children.push(t)}Bt.append=GN;function qN(e,t){if(Ja(t),t.parent=e,t.prev=null,e.children.unshift(t)!==1){var r=e.children[1];r.prev=t,t.next=r}else t.next=null}Bt.prependChild=qN;function zN(e,t){Ja(t);var r=e.parent;if(r){var n=r.children;n.splice(n.indexOf(e),0,t)}e.prev&&(e.prev.next=t),t.parent=r,t.prev=e.prev,t.next=e,e.prev=t}Bt.prepend=zN});var Md=U(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.findAll=jt.existsOne=jt.findOne=jt.findOneChild=jt.find=jt.filter=void 0;var fc=yt();function VN(e,t,r,n){return r===void 0&&(r=!0),n===void 0&&(n=1/0),EE(e,Array.isArray(t)?t:[t],r,n)}jt.filter=VN;function EE(e,t,r,n){for(var i=[],s=[t],a=[0];;){if(a[0]>=s[0].length){if(a.length===1)return i;s.shift(),a.shift();continue}var u=s[0][a[0]++];if(e(u)&&(i.push(u),--n<=0))return i;r&&(0,fc.hasChildren)(u)&&u.children.length>0&&(a.unshift(0),s.unshift(u.children))}}jt.find=EE;function KN(e,t){return t.find(e)}jt.findOneChild=KN;function AE(e,t,r){r===void 0&&(r=!0);for(var n=null,i=0;i<t.length&&!n;i++){var s=t[i];if((0,fc.isTag)(s))e(s)?n=s:r&&s.children.length>0&&(n=AE(e,s.children,!0));else continue}return n}jt.findOne=AE;function yE(e,t){return t.some(function(r){return(0,fc.isTag)(r)&&(e(r)||yE(e,r.children))})}jt.existsOne=yE;function WN(e,t){for(var r=[],n=[t],i=[0];;){if(i[0]>=n[0].length){if(n.length===1)return r;n.shift(),i.shift();continue}var s=n[0][i[0]++];!(0,fc.isTag)(s)||(e(s)&&r.push(s),s.children.length>0&&(i.unshift(0),n.unshift(s.children)))}}jt.findAll=WN});var kd=U(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.getElementsByTagType=or.getElementsByTagName=or.getElementById=or.getElements=or.testElement=void 0;var bi=yt(),dc=Md(),hc={tag
2024-06-13 21:01:37 +03:00
:is(button, input, select, textarea, optgroup, option)[disabled],
optgroup[disabled] > option,
fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)
2024-08-16 21:46:33 +03:00
)`,enabled:":not(:disabled)",checked:":is(:is(input[type=radio], input[type=checkbox])[checked], option:selected)",required:":is(input, select, textarea)[required]",optional:":is(input, select, textarea):not([required])",selected:"option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",checkbox:"[type=checkbox]",file:"[type=file]",password:"[type=password]",radio:"[type=radio]",reset:"[type=reset]",image:"[type=image]",submit:"[type=submit]",parent:":not(:empty)",header:":is(h1, h2, h3, h4, h5, h6)",button:":is(button, input[type=button])",input:":is(input, textarea, select, button)",text:"input:is(:not([type!='']), [type=text])"}});var Dc=U(Nt=>{"use strict";var g1=Nt&&Nt.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,s;n<i;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))},fw=Nt&&Nt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.subselects=Nt.getNextSiblings=Nt.ensureIsTag=Nt.PLACEHOLDER_ELEMENT=void 0;var Ir=fw(zn()),dw=qd();Nt.PLACEHOLDER_ELEMENT={};function _1(e,t){return e===Ir.default.falseFunc?Ir.default.falseFunc:function(r){return t.isTag(r)&&e(r)}}Nt.ensureIsTag=_1;function T1(e,t){var r=t.getSiblings(e);if(r.length<=1)return[];var n=r.indexOf(e);return n<0||n===r.length-1?[]:r.slice(n+1).filter(t.isTag)}Nt.getNextSiblings=T1;function Kd(e){return{xmlMode:!!e.xmlMode,lowerCaseAttributeNames:!!e.lowerCaseAttributeNames,lowerCaseTags:!!e.lowerCaseTags,quirksMode:!!e.quirksMode,cacheResults:!!e.cacheResults,pseudos:e.pseudos,adapter:e.adapter,equals:e.equals}}var Wd=function(e,t,r,n,i){var s=i(t,Kd(r),n);return s===Ir.default.trueFunc?e:s===Ir.default.falseFunc?Ir.default.falseFunc:function(a){return s(a)&&e(a)}};Nt.subselects={is:Wd,matches:Wd,where:Wd,not:function(e,t,r,n,i){var s=i(t,Kd(r),n);return s===Ir.default.falseFunc?e:s===Ir.default.trueFunc?Ir.default.falseFunc:function(a){return!s(a)&&e(a)}},has:function(e,t,r,n,i){var s=r.adapter,a=Kd(r);a.relativeSelector=!0;var u=t.some(function(f){return f.some(dw.isTraversal)})?[Nt.PLACEHOLDER_ELEMENT]:void 0,o=i(t,a,u);if(o===Ir.default.falseFunc)return Ir.default.falseFunc;var c=_1(o,s);if(u&&o!==Ir.default.trueFunc){var h=o.shouldTestNextSiblings,d=h===void 0?!1:h;return function(f){if(!e(f))return!1;u[0]=f;var g=s.getChildren(f),y=d?g1(g1([],g,!0),T1(f,s),!0):g;return s.existsOne(c,y)}}return function(f){return e(f)&&s.existsOne(c,s.getChildren(f))}}}});var $d=U(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.compilePseudoSelector=Fr.aliases=Fr.pseudos=Fr.filters=void 0;var hw=Ps(),Yd=h1();Object.defineProperty(Fr,"filters",{enumerable:!0,get:function(){return Yd.filters}});var iu=p1();Object.defineProperty(Fr,"pseudos",{enumerable:!0,get:function(){return iu.pseudos}});var b1=m1();Object.defineProperty(Fr,"aliases",{enumerable:!0,get:function(){return b1.aliases}});var Qd=Dc();function pw(e,t,r,n,i){var s,a=t.name,u=t.data;if(Array.isArray(u)){if(!(a in Qd.subselects))throw new Error("Unknown pseudo-class :".concat(a,"(").concat(u,")"));return Qd.subselects[a](e,u,r,n,i)}var o=(s=r.pseudos)===null||s===void 0?void 0:s[a],c=typeof o=="string"?o:b1.aliases[a];if(typeof c=="string"){if(u!=null)throw new Error("Pseudo ".concat(a," doesn't have any arguments"));var h=(0,hw.parse)(c);return Qd.subselects.is(e,h,r,n,i)}if(typeof o=="function")return(0,iu.verifyPseudoArgs)(o,a,u,1),function(f){return o(f,u)&&e(f)};if(a in Yd.filters)return Yd.filters[a](e,u,r,n);if(a in iu.pseudos){var d=iu.pseudos[a];return(0,iu.verifyPseudoArgs)(d,a,u,2),function(f){return d(f,r,u)&&e(f)}}throw new Error("Unknown pseudo-class :".concat(a))}Fr.compilePseudoSelector=pw});var E1=U(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});Sc.compileGeneralSelector=void 0;var mw=a1(),gw=$d(),vr=Ps();function Xd(e,t){var r=t.getParent(e);return r&&t.isTag(r)?r:null}function _w(e,t,r,n,i){var s=r.adapter,a=r.equals;switch(t.type){case
`)}}):{name:s,value:a.replace($1,`\r
`)}}).toArray()}Us.serializeArray=KR});var Z1=U(Ur=>{"use strict";var WR=Ur&&Ur.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),YR=Ur&&Ur.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),cu=Ur&&Ur.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&WR(t,e,r);return YR(t,e),t};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.Cheerio=void 0;var QR=cu(GE()),$R=cu(j1()),XR=cu(V1()),ZR=cu(Y1()),JR=cu(X1()),lu=function(){function e(t,r,n){if(this.length=0,this.options=n,this._root=r,t){for(var i=0;i<t.length;i++)this[i]=t[i];this.length=t.length}}return e}();Ur.Cheerio=lu;lu.prototype.cheerio="[cheerio object]";lu.prototype.splice=Array.prototype.splice;lu.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator];Object.assign(lu.prototype,QR,$R,XR,ZR,JR)});var eA=U(Ut=>{"use strict";var eP=Ut&&Ut.__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)}}(),Gs=Ut&&Ut.__assign||function(){return Gs=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},Gs.apply(this,arguments)},tP=Ut&&Ut.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),rP=Ut&&Ut.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),J1=Ut&&Ut.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&tP(t,e,r);return rP(t,e),t};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.getLoad=void 0;var _h=J1(hd()),nP=J1(yi()),iP=Z1(),fu=vi();function sP(e,t){return function r(n,i,s){if(s===void 0&&(s=!0),n==null)throw new Error("cheerio.load() expects a string");var a=Gs(Gs({},_h.default),(0,_h.flatten)(i)),u=e(n,a,s,null),o=function(h){eP(d,h);function d(){return h!==null&&h.apply(this,arguments)||this}return d.prototype._make=function(f,g){var y=c(f,g);return y.prevObject=this,y},d.prototype._parse=function(f,g,y,b){return e(f,g,y,b)},d.prototype._render=function(f){return t(f,this.options)},d}(iP.Cheerio);function c(h,d,f,g){if(f===void 0&&(f=u),h&&(0,fu.isCheerio)(h))return h;var y=Gs(Gs({},a),(0,_h.flatten)(g)),b=typeof f=="string"?[e(f,y,!1,null)]:"length"in f?f:[f],D=(0,fu.isCheerio)(b)?b:new o(b,null,y);if(D._root=D,!h)return new o(void 0,D,y);var m=typeof h=="string"&&(0,fu.isHtml)(h)?e(h,y,!1,null).children:aP(h)?[h]:Array.isArray(h)?h:void 0,v=new o(m,D,y);if(m)return v;if(typeof h!="string")throw new Error("Unexpected type of selector");var I=h,T=d?typeof d=="string"?(0,fu.isHtml)(d)?new o([e(d,y,!1,null)],D,y):(I="".concat(d," ").concat(I),D):(0,fu.isCheerio)(d)?d:new o(Array.isArray(d)?d:[d],D,y):D;return T?T.find(I):v}return Object.assign(c,nP,{load:r,_root:u,_options:a,fn:o.prototype,prototype:o.prototype}),c}}Ut.getLoad=sP;function aP(e){return!!e.name||e.type==="root"||e.type==="text"||e.type==="comment"}});var Rc=U(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.
2024-06-13 21:01:37 +03:00
`).length),r.split(`
2024-08-16 21:46:33 +03:00
`).slice(t).filter(bT).map(n=>`
`+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(`
`)}function vo(e,t,r,n){this._e=oi(),this.failures=t,this.failedKeys=n,this.successCount=r,this.message=AT(e,t)}cs(vo).from(fs);function Sa(e,t){this._e=oi(),this.name="BulkError",this.failures=Object.keys(t).map(r=>t[r]),this.failuresByPos=t,this.message=AT(e,t)}cs(Sa).from(fs);var lf=cf.reduce((e,t)=>(e[t]=t+"Error",e),{}),Lx=fs,ie=cf.reduce((e,t)=>{var r=t+"Error";function n(i,s){this._e=oi(),this.name=r,i?typeof i=="string"?(this.message=`${i}${s?`
`+s:""}`,this.inner=s||null):typeof i=="object"&&(this.message=`${i.name} ${i.message}`,this.inner=i):(this.message=Px[t]||r,this.inner=null)}return cs(n).from(Lx),e[t]=n,e},{});ie.Syntax=SyntaxError;ie.Type=TypeError;ie.Range=RangeError;var yT=ET.reduce((e,t)=>(e[t+"Error"]=ie[t],e),{});function Mx(e,t){if(!e||e instanceof fs||e instanceof TypeError||e instanceof SyntaxError||!e.name||!yT[e.name])return e;var r=new yT[e.name](t||e.message,e);return"stack"in e&&Zr(r,"stack",{get:function(){return this.inner.stack}}),r}var Co=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;function Ne(){}function xa(e){return e}function kx(e,t){return e==null||e===xa?t:function(r){return t(e(r))}}function ci(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Fx(e,t){return e===Ne?t:function(){var r=e.apply(this,arguments);r!==void 0&&(arguments[0]=r);var n=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var s=t.apply(this,arguments);return n&&(this.onsuccess=this.onsuccess?ci(n,this.onsuccess):n),i&&(this.onerror=this.onerror?ci(i,this.onerror):i),s!==void 0?s:r}}function Bx(e,t){return e===Ne?t:function(){e.apply(this,arguments);var r=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)}}function jx(e,t){return e===Ne?t:function(r){var n=e.apply(this,arguments);xt(r,n);var i=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?ci(i,this.onsuccess):i),s&&(this.onerror=this.onerror?ci(s,this.onerror):s),n===void 0?a===void 0?void 0:a:xt(n,a)}}function Hx(e,t){return e===Ne?t:function(){return t.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}function ff(e,t){return e===Ne?t:function(){var r=e.apply(this,arguments);if(r&&typeof r.then=="function"){for(var n=this,i=arguments.length,s=new Array(i);i--;)s[i]=arguments[i];return r.then(function(){return t.apply(n,s)})}return t.apply(this,arguments)}}var Oa={},Ux=100,Gx=20,IT=100,[df,Do,hf]=typeof Promise=="undefined"?[]:(()=>{let e=Promise.resolve();if(typeof crypto=="undefined"||!crypto.subtle)return[e,va(e),e];let t=crypto.subtle.digest("SHA-512",new Uint8Array([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?()=>{var e=document.createElement("div");new MutationObserver(()=>{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=[];function Y(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=Ne,this._lib=!1;var t=this._PSD=ne;if(Nr&&(this._stackHolder=oi(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==Oa)throw new TypeError("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)}var bf={get:function(){var e=ne,t=Lo;function r(n,i){var s=!e.global&&(e!==ne||t!==Lo);let a=s&&!tn();var u=new Y((o,c)=>{Af(this,new CT(ko(n,e,s,a),ko(i,e,s,a),o,c,e))});return Nr&&OT(u,this),u}return r.prototype=Oa,r},set:function(e){Zr(this,"then",e&&e.prototype===Oa?bf:{get:function(){return e},set:bf.set})}};os(Y.prototype,{then:bf,_then:function(e,t){Af(this,new CT(null,null,e,t,ne))},catch:function(e){if(arguments.length===1)return this.then(null,e);var t=arguments[0],r=arguments[1];return typeof t=="function"?this.then(null,n=>n instanceof t?r(n):Ro(n)):this.then(null,n=>n&&n.name===t?r(n):Ro(n))},finally:function(e){return this.then(t
From previous: `);return this._state!==null&&(this._stack=t),t}finally{mf=!1}}},timeout:function(e,t){return e<1/0?new Y((r,n)=>{var i=setTimeout(()=>n(new ie.Timeout(t)),e);this.then(r,n).finally(clearTimeout.bind(null,i))}):this}});typeof Symbol!="undefined"&&Symbol.toStringTag&&Zr(Y.prototype,Symbol.toStringTag,"Dexie.Promise");ds.env=NT();function CT(e,t,r,n,i){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=r,this.reject=n,this.psd=i}os(Y,{all:function(){var e=en.apply(null,arguments).map(Mo);return new Y(function(t,r){e.length===0&&t([]);var n=e.length;e.forEach((i,s)=>Y.resolve(i).then(a=>{e[s]=a,--n||t(e)},r))})},resolve:e=>{if(e instanceof Y)return e;if(e&&typeof e.then=="function")return new Y((r,n)=>{e.then(r,n)});var t=new Y(Oa,!0,e);return OT(t,_f),t},reject:Ro,race:function(){var e=en.apply(null,arguments).map(Mo);return new Y((t,r)=>{e.map(n=>Y.resolve(n).then(t,r))})},PSD:{get:()=>ne,set:e=>ne=e},totalEchoes:{get:()=>Lo},newPSD:Ln,usePSD:ps,scheduler:{get:()=>Na,set:e=>{Na=e}},rejectionMapper:{get:()=>Tf,set:e=>{Tf=e}},follow:(e,t)=>new Y((r,n)=>Ln((i,s)=>{var a=ne;a.unhandleds=[],a.onunhandled=s,a.finalize=ci(function(){Vx(()=>{this.unhandleds.length===0?i():s(this.unhandleds[0])})},a.finalize),e()},t,r,n))});So&&(So.allSettled&&Zr(Y,"allSettled",function(){let e=en.apply(null,arguments).map(Mo);return new Y(t=>{e.length===0&&t([]);let r=e.length,n=new Array(r);e.forEach((i,s)=>Y.resolve(i).then(a=>n[s]={status:"fulfilled",value:a},a=>n[s]={status:"rejected",reason:a}).then(()=>--r||t(n)))})}),So.any&&typeof AggregateError!="undefined"&&Zr(Y,"any",function(){let e=en.apply(null,arguments).map(Mo);return new Y((t,r)=>{e.length===0&&r(new AggregateError([]));let n=e.length,i=new Array(n);e.forEach((s,a)=>Y.resolve(s).then(u=>t(u),u=>{i[a]=u,--n||r(new AggregateError(i))}))})}));function DT(e,t){try{t(r=>{if(e._state===null){if(r===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Ra();r&&typeof r.then=="function"?DT(e,(i,s)=>{r instanceof Y?r._then(i,s):r.then(i,s)}):(e._state=!0,e._value=r,ST(e)),n&&Pa()}},Ef.bind(null,e))}catch(r){Ef(e,r)}}function Ef(e,t){if(Oo.push(t),e._state===null){var r=e._lib&&Ra();t=Tf(t),e._state=!1,e._value=t,Nr&&t!==null&&typeof t=="object"&&!t._promise&&Cx(()=>{var n=rf(t,"stack");t._promise=e,Zr(t,"stack",{get:()=>mf?n&&(n.get?n.get.apply(t):n.value):e.stack})}),Kx(e),ST(e),r&&Pa()}}function ST(e){var t=e._listeners;e._listeners=[];for(var r=0,n=t.length;r<n;++r)Af(e,t[r]);var i=e._PSD;--i.ref||i.finalize(),fi===0&&(++fi,Na(()=>{--fi==0&&yf()},[]))}function Af(e,t){if(e._state===null){e._listeners.push(t);return}var r=e._state?t.onFulfilled:t.onRejected;if(r===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++fi,Na(zx,[r,e,t])}function zx(e,t,r){try{_f=t;var n,i=t._value;t._state?n=e(i):(Oo.length&&(Oo=[]),n=e(i),Oo.indexOf(i)===-1&&Wx(t)),r.resolve(n)}catch(s){r.reject(s)}finally{_f=null,--fi==0&&yf(),--r.psd.ref||r.psd.finalize()}}function xT(e,t,r){if(t.length===r)return t;var n="";if(e._state===!1){var i=e._value,s,a;i!=null?(s=i.name||"Error",a=i.message||i,n=of(i,0)):(s=i,a=""),t.push(s+(a?": "+a:"")+n)}return Nr&&(n=of(e._stackHolder,2),n&&t.indexOf(n)===-1&&t.push(n),e._prev&&xT(e._prev,t,r)),t}function OT(e,t){var r=t?t._numPrev+1:0;r<Ux&&(e._prev=t,e._numPrev=r)}function wo(){Ra()&&Pa()}function Ra(){var e=gf;return gf=!1,xo=!1,e}function Pa(){var e,t,r;do for(;wa.length>0;)for(e=wa,wa=[],r=e.length,t=0;t<r;++t){var n=e[t];n[0].apply(null,n[1])}while(wa.length>0);gf=!0,xo=!0}function yf(){var e=li;li=[],e.forEach(n=>{n._PSD.onunhandled.call(null,n._value,n)});for(var t=No.slice(0),r=t.length;r;)t[--r]()}function Vx(e){function t(){e(),No.splice(No.indexOf(t),1)}No.push(t),++fi,Na(()=>{--fi==0&&yf()},[])}function Kx(e){li.some(t=>t._value===e._value)||li.push(e)}function Wx(e){for(var t=li.length;t;)if(li[--t]._value===e._value){li.splice(t,1);return}}function Ro(e){return new Y(Oa,!1,e)}function ze(e,t){var r=ne;return function(){var n=Ra(),i=ne;try{return Mn(r,!0),
`)}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} content for file`,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-highlight omnisearch-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")))?`<span class="${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("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}stringsToRegex(t){if(!t.length)return/^$/g;t.sort((n,i)=>i.length-n.length);let r=`(${t.map(n=>`\\b${On(n)}\\b|${On(n)}`).join("|")})`;return new RegExp(`${r}`,"gui")}getMatches(t,r,n){let i=this.stringsToRegex(r),s=t;this.plugin.settings.ignoreDiacritics&&(t=Qr(t,this.plugin.settings.ignoreArabicDiacritics));l
2024-06-13 21:01:37 +03:00
`);let o=t.lastIndexOf(`
2024-08-16 21:46:33 +03:00
`,i-s);o>0&&(t=t.slice(o))}return t=BM(t),n.renderLineReturnInExcerpts&&(t=t.trim().replaceAll(`
`,"<br>")),t}catch(i){return new wy.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(i),""}}};function BM(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}var Uh=class extends Ri.Plugin{constructor(t,r){super(t,r);this.apiHttpServer=null;this.settings=go(this.app);this.database=new Wo(this);this.notesIndexer=new jh(this);this.textProcessor=new Hh(this);this.searchEngine=new Fh(this);this.cacheManager=new Bh(this)}async onload(){if(this.settings=await C_(this),this.addSettingTab(new Wl(this)),Ri.Platform.isMobile||Promise.resolve().then(()=>(ky(),My)).then(n=>this.apiHttpServer=n.getServer(this)),Yl(this.app)){console.log("Omnisearch - Plugin disabled");return}await HM(this.app),await this.database.clearOldDatabases(),lT(this);let t=this.settings;t.ribbonIcon&&this.addRibbonButton(),ce.disable("vault"),ce.disable("infile"),ce.on("global",Lu.ToggleExcerpts,()=>{ai.set(!t.showExcerpt)}),this.addCommand({id:"show-modal",name:"Vault search",callback:()=>{new Rn(this).open()}}),this.addCommand({id:"show-modal-infile",name:"In-file search",editorCallback:(n,i)=>{i.file&&new us(this,i.file).open()}});let r=this.searchEngine;this.app.workspace.onLayoutReady(async()=>{this.registerEvent(this.app.vault.on("create",n=>{this.notesIndexer.isFileIndexable(n.path)&&(ve("Indexing new file",n.path),r.addFromPaths([n.path]))})),this.registerEvent(this.app.vault.on("delete",n=>{ve("Removing file",n.path),this.cacheManager.removeFromLiveCache(n.path),r.removeFromPaths([n.path])})),this.registerEvent(this.app.vault.on("modify",async n=>{this.notesIndexer.isFileIndexable(n.path)&&this.notesIndexer.flagNoteForReindex(n)})),this.registerEvent(this.app.vault.on("rename",async(n,i)=>{this.notesIndexer.isFileIndexable(n.path)&&(ve("Renaming file",n.path),this.cacheManager.removeFromLiveCache(i),await this.cacheManager.addToLiveCache(n.path),r.removeFromPaths([i]),await r.addFromPaths([n.path]))})),this.refreshIndexCallback=this.notesIndexer.refreshIndex.bind(this.notesIndexer),addEventListener("blur",this.refreshIndexCallback),removeEventListener,await this.executeFirstLaunchTasks(),await this.populateIndex(),this.apiHttpServer&&t.httpApiEnabled&&this.apiHttpServer.listen(t.httpApiPort)})}async executeFirstLaunchTasks(){let t="1.21.0";this.settings.welcomeMessage=t,await this.saveData(this.settings)}async onunload(){delete globalThis.omnisearch,this.refreshIndexCallback&&removeEventListener("blur",this.refreshIndexCallback),await this.database.clearCache(),this.apiHttpServer.close()}addRibbonButton(){this.ribbonButton=this.addRibbonIcon("search","Omnisearch",t=>{new Rn(this).open()})}removeRibbonButton(){this.ribbonButton&&this.ribbonButton.parentNode?.removeChild(this.ribbonButton)}getChsSegmenter(){return this.app.plugins.plugins["cm-chs-patch"]}getTextExtractor(){return this.app.plugins?.plugins?.["text-extractor"]?.api}getAIImageAnalyzer(){return this.app.plugins?.plugins?.["ai-image-analyzer"]?.api}async populateIndex(){console.time("Omnisearch - Indexing total time"),gn.set(ir.ReadingFiles);let t=this.app.vault.getFiles().filter(i=>this.notesIndexer.isFileIndexable(i.path));console.log(`Omnisearch - ${t.length} files total`),console.log(`Omnisearch - Cache is ${Nn()?"enabled":"disabled"}`);let r=this.searchEngine;Nn()&&(console.time("Omnisearch - Loading index from cache"),gn.set(ir.LoadingCache),await r.loadCache()&&console.timeEnd("Omnisearch - Loading index from cache"));let n=r.getDiff(t.map(i=>({path:i.path,mtime:i.stat.mtime})));if(Nn()&&(n.toAdd.length&&console.log("Omnisearch - Total number of files to add/update: "+n.toAdd.length),n.toRemove.length&&console.log("Omnisearch - Total number of files to remove: "+n.toRemove.length)),n.toAdd.length>=1e3&&Nn()&&new Ri.Notice(`Omnisearch - ${n.toAdd.length} files need to be indexed. Obsidian may experience stutters and freezes during the process`,1e4),gn.set(ir.IndexingFiles),r.removeFromPaths(n.toRemove.map(i=