Files
my-vault/.obsidian/plugins/omnisearch/main.js
T

171 lines
602 KiB
JavaScript
Raw Normal View History

2026-01-05 13:03:55 +08:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
2026-01-21 08:46:13 +08:00
var uI=Object.create;var ku=Object.defineProperty;var cI=Object.getOwnPropertyDescriptor;var lI=Object.getOwnPropertyNames;var fI=Object.getPrototypeOf,dI=Object.prototype.hasOwnProperty;var hI=(e,t,r)=>t in e?ku(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var v=(e,t)=>()=>(e&&(t=e(e=0)),t);var Pi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Nn=(e,t)=>{for(var r in t)ku(e,r,{get:t[r],enumerable:!0})},B_=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lI(t))!dI.call(e,i)&&i!==r&&ku(e,i,{get:()=>t[i],enumerable:!(n=cI(t,i))||n.enumerable});return e};var ln=(e,t,r)=>(r=e!=null?uI(fI(e)):{},B_(t||!e||!e.__esModule?ku(r,"default",{value:e,enumerable:!0}):r,e)),$_=e=>B_(ku({},"__esModule",{value:!0}),e);var zl=(e,t,r)=>(hI(e,typeof t!="symbol"?t+"":t,r),r),hp=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Mi=(e,t,r)=>(hp(e,t,"read from private field"),r?r.call(e):t.get(e)),Ru=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},pp=(e,t,r,n)=>(hp(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);var H_=(e,t,r)=>(hp(e,t,"access private method"),r);var U_,V_=v(()=>{U_="5"});var Wn=v(()=>{V_();typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(U_)});var va,is,as,Fi,Pt,Ht,q_,z_,bt=v(()=>{va="[",is="[!",as="]",Fi={},Pt=Symbol(),Ht=Symbol("filename"),q_=Symbol("hmr"),z_="http://www.w3.org/1999/xhtml"});var Yl,Y_=v(()=>{Yl=!0});var K_,se,j_=v(()=>{K_=globalThis.process?.env?.NODE_ENV,se=K_&&!K_.toLowerCase().startsWith("prod")});var W_=v(()=>{});var mt=v(()=>{Y_();j_();W_()});var xr,ss,Lu,G_,Nt=v(()=>{xr=Symbol("$state"),ss=Symbol("$state metadata"),Lu=Symbol("legacy props"),G_=Symbol("")});function xa(e){return typeof e=="function"}function Z_(e){return e()}function os(e){for(var t=0;t<e.length;t++)e[t]()}var fn,Q_,Pu,mp,Kt,Kr,Kl,gp,X_,Ta,Ut,it=v(()=>{fn=Array.isArray,Q_=Array.prototype.indexOf,Pu=Array.from,mp=Object.keys,Kt=Object.defineProperty,Kr=Object.getOwnPropertyDescriptor,Kl=Object.getOwnPropertyDescriptors,gp=Object.prototype,X_=Array.prototype,Ta=Object.getPrototypeOf;Ut=()=>{}});function J_(){var e=Mu;Mu=[],os(e)}function eb(){var e=Fu;Fu=[],os(e)}function dn(e){Mu.length===0&&queueMicrotask(J_),Mu.push(e)}function tb(e){Fu.length===0&&pI(eb),Fu.push(e)}function _p(){Mu.length>0&&J_(),Fu.length>0&&eb()}var pI,Mu,Fu,On=v(()=>{it();pI=typeof requestIdleCallback>"u"?e=>setTimeout(e,1):requestIdleCallback,Mu=[],Fu=[]});function jl(e){return e===this.v}function eo(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function to(e){return!eo(e,this.v)}var us=v(()=>{});function bp(){if(se){let e=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function rb(){if(se){let e=new Error(`derived_references_self
2026-01-05 13:03:55 +08:00
A derived value cannot reference itself recursively
https://svelte.dev/e/derived_references_self`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/derived_references_self")}function nb(e){if(se){let t=new Error(`effect_in_teardown
\`${e}\` cannot be used inside an effect cleanup function
https://svelte.dev/e/effect_in_teardown`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function ib(){if(se){let e=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function ab(e){if(se){let t=new Error(`effect_orphan
\`${e}\` can only be used inside an effect (e.g. during component initialisation)
https://svelte.dev/e/effect_orphan`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_orphan")}function sb(){if(se){let e=new Error(`effect_update_depth_exceeded
Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops
https://svelte.dev/e/effect_update_depth_exceeded`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ob(){if(se){let e=new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/hydration_failed")}function ub(e){if(se){let t=new Error(`props_invalid_value
Cannot do \`bind:${e}={undefined}\` when \`${e}\` has a fallback value
https://svelte.dev/e/props_invalid_value`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/props_invalid_value")}function cb(e){if(se){let t=new Error(`rune_outside_svelte
The \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
https://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function lb(){if(se){let e=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function fb(){if(se){let e=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function db(){if(se){let e=new Error("state_unsafe_local_read\nReading state that was created inside the same derived is forbidden. Consider using `untrack` to read locally created state\nhttps://svelte.dev/e/state_unsafe_local_read");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function hb(){if(se){let e=new Error("state_unsafe_mutation\nUpdating state inside a derived or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}var hn=v(()=>{mt()});function pb(){mi=!0}var mi,gi,Bi=v(()=>{mi=!1,gi=!1});var Ep=v(()=>{mt()});var Bu=v(()=>{mt();Ep();it()});function $i(e){let t=Error(),r=t.stack;if(r){let n=r.split(`
`),i=[`
`];for(let a=0;a<n.length;a++){let o=n[a];if(o!=="Error"){if(o.includes("validate_each_keys"))return null;o.includes("svelte/src/internal")||i.push(o)}}if(i.length===1)return null;Kt(t,"stack",{value:i.join(`
2026-01-21 08:46:13 +08:00
`)}),Kt(t,"name",{value:`${e}Error`})}return t}var $u,ro=v(()=>{bt();Bu();it();Nt();He();Ge();$u=null});function yp(e){cs=e}function Mt(e,t){var r={f:0,v:e,reactions:null,equals:jl,rv:0,wv:0};return se&&gi&&(r.created=t??$i("CreatedAt"),r.debug=null),r}function Xn(e){return gb(Mt(e))}function _i(e,t=!1){let r=Mt(e);return t||(r.equals=to),mi&&Pe!==null&&Pe.l!==null&&(Pe.l.s??=[]).push(r),r}function ft(e,t=!1){return gb(_i(e,t))}function gb(e){return $e!==null&&!gn&&$e.f&2&&(Gn===null?bb([e]):Gn.push(e)),e}function oe(e,t){return $e!==null&&!gn&&bi()&&$e.f&18&&(Gn===null||!Gn.includes(e))&&hb(),io(e,t)}function io(e,t){if(!e.equals(t)){var r=e.v;if(fs?no.set(e,t):no.set(e,r),e.v=t,e.wv=Uu(),se&&gi&&(e.updated=$i("UpdatedAt"),Oe!=null&&(e.trace_need_increase=!0,e.trace_v??=r)),_b(e,2048),bi()&&Oe!==null&&Oe.f&1024&&!(Oe.f&96)&&(pn===null?Eb([e]):pn.push(e)),se&&cs.size>0){let n=Array.from(cs);for(let i of n)i.f&1024&&Ar(i,4096),Ui(i)&&ds(i);cs.clear()}}return t}function _b(e,t){var r=e.reactions;if(r!==null)for(var n=bi(),i=r.length,a=0;a<i;a++){var o=r[a],l=o.f;if(!(l&2048)&&!(!n&&o===Oe)){if(se&&l&262144){cs.add(o);continue}Ar(o,t),l&1280&&(l&2?_b(o,4096):ao(o))}}}var cs,no,yr=v(()=>{mt();Ge();us();Nt();hn();Bi();ro();Ot();cs=new Set,no=new Map});function kn(e){var t=2050,r=$e!==null&&$e.f&2?$e:null;Oe===null||r!==null&&r.f&256?t|=256:Oe.f|=1048576;let n={ctx:Pe,deps:null,effects:null,equals:jl,f:t,fn:e,reactions:null,rv:0,v:null,wv:0,parent:r??Oe};return se&&gi&&(n.created=$i("CreatedAt")),n}function Br(e){let t=kn(e);return t.equals=to,t}function Wl(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)lr(t[r])}}function mI(e){for(var t=e.parent;t!==null;){if(!(t.f&2))return t;t=t.parent}return null}function gI(e){var t,r=Oe;if(Wt(mI(e)),se){let n=cs;yp(new Set);try{Ap.includes(e)&&rb(),Ap.push(e),Wl(e),t=Gl(e)}finally{Wt(r),yp(n),Ap.pop()}}else try{Wl(e),t=Gl(e)}finally{Wt(r)}return t}function Sp(e){var t=gI(e),r=(Vi||e.f&256)&&e.deps!==null?4096:1024;Ar(e,r),e.equals(t)||(e.v=t,e.wv=Uu())}var Ap,hs=v(()=>{mt();Nt();Ge();us();hn();He();yr();ro();Bi();Ot();Ap=[]});function vb(e,t,r){se?console.warn(`%c[svelte] hydration_attribute_changed
2026-01-05 13:03:55 +08:00
%cThe \`${e}\` attribute on \`${t}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value
https://svelte.dev/e/hydration_attribute_changed`,so,oo):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Tb(e){se?console.warn(`%c[svelte] hydration_html_changed
%c${e?`The value of an \`{@html ...}\` block ${e} changed between server and client renders. The client value will be ignored in favour of the server value`:"The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value"}
https://svelte.dev/e/hydration_html_changed`,so,oo):console.warn("https://svelte.dev/e/hydration_html_changed")}function ps(e){se?console.warn(`%c[svelte] hydration_mismatch
%c${e?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${e}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
https://svelte.dev/e/hydration_mismatch`,so,oo):console.warn("https://svelte.dev/e/hydration_mismatch")}function xb(){se?console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
https://svelte.dev/e/lifecycle_double_unmount`,so,oo):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function Cp(e,t){se?console.warn(`%c[svelte] ownership_invalid_mutation
%c${e?`${e} mutated a value owned by ${t}. This is strongly discouraged. Consider passing values to child components with \`bind:\`, or use a callback instead`:"Mutating a value outside the component that created it is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead"}
https://svelte.dev/e/ownership_invalid_mutation`,so,oo):console.warn("https://svelte.dev/e/ownership_invalid_mutation")}function Ql(e){se?console.warn(`%c[svelte] state_proxy_equality_mismatch
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${e}\` will produce unexpected results
https://svelte.dev/e/state_proxy_equality_mismatch`,so,oo):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}var so,oo,Wr=v(()=>{mt();so="font-weight: bold",oo="font-weight: normal"});function $r(e){ge=e}function wt(e){if(e===null)throw ps(),Fi;return De=e}function Vt(){return wt(fr(De))}function Te(e){if(ge){if(fr(De)!==null)throw ps(),Fi;De=e}}function wr(e=1){if(ge){for(var t=e,r=De;t--;)r=fr(r);De=r}}function uo(){for(var e=0,t=De;;){if(t.nodeType===8){var r=t.data;if(r===as){if(e===0)return t;e-=1}else(r===va||r===is)&&(e+=1)}var n=fr(t);t.remove(),t=n}}var ge,De,Et=v(()=>{bt();Wr();Gr();ge=!1});function er(e,t=null,r){var n=null;if(se&&gi&&(n=$i("CreatedAt")),typeof e!="object"||e===null||xr in e)return e;let i=Ta(e);if(i!==gp&&i!==X_)return e;var a=new Map,o=fn(e),l=Mt(0);o&&a.set("length",Mt(e.length,n));var d;if(se)if(d={parent:t,owners:null},r){let p=r.v?.[ss]?.owners;d.owners=p?new Set(p):null}else d.owners=t===null?Pe!==null?new Set([Pe.function]):null:new Set;return new Proxy(e,{defineProperty(p,g,E){(!("value"in E)||E.configurable===!1||E.enumerable===!1||E.writable===!1)&&lb();var _=a.get(g);return _===void 0?(_=Mt(E.value,n),a.set(g,_)):oe(_,er(E.value,d)),!0},deleteProperty(p,g){var E=a.get(g);if(E===void 0)g in p&&a.set(g,Mt(Pt,n));else{if(o&&typeof g=="string"){var _=a.get("length"),y=Number(g);Number.isInteger(y)&&y<_.v&&oe(_,y)}oe(E,Pt),yb(l)}return!0},get(p,g,E){if(se&&g===ss)return d;if(g===xr)return e;var _=a.get(g),y=g in p;if(_===void 0&&(!y||Kr(p,g)?.writable)&&(_=Mt(er(y?p[g]:Pt,d),n),a.set(g,_)),_!==void 0){var C=q(_);if(se){var D=C?.[ss];D&&D?.parent!==d&&Ip(d,D)}return C===Pt?void 0:C}return Reflect.get(p,g,E)},getOwnPropertyDescriptor(p,g){var E=Reflect.getOwnPropertyDescriptor(p,g);if(E&&"value"in E){var _=a.get(g);_&&(E.value=q(_))}else if(E===void 0){var y=a.get(g),C=y?.v;if(y!==void 0&&C!==Pt)return{enumerable:!0,configurable:!0,value:C,writable:!0}}return E},has(p,g){if(se&&g===ss||g===xr)return!0;var E=a.get(g),_=E!==void 0&&E.v!==Pt||Reflect.has(p,g);if(E!==void 0||Oe!==null&&(!_||Kr(p,g)?.writable)){E===void 0&&(E=Mt(_?er(p[g],d):Pt,n),a.set(g,E));var y=q(E);if(y===Pt)return!1}return _},set(p,g,E,_){var y=a.get(g),C=g in p;if(o&&g==="length")for(var D=E;D<y.v;D+=1){var P=a.get(D+"");P!==void 0?oe(P,Pt):D in p&&(P=Mt(Pt,n),a.set(D+"",P))}if(y===void 0?(!C||Kr(p,g)?.writable)&&(y=Mt(void 0,n),oe(y,er(E,d)),a.set(g,y)):(C=y.v!==Pt,oe(y,er(E,d))),se){var N=E?.[ss];N&&N?.parent!==d&&Ip(d,N),Ab(d)}var L=Reflect.getOwnPropertyDescriptor(p,g);if(L?.set&&L.set.call(_,E),!C){if(o&&typeof g=="string"){var H=a.get("length"),R=Number(g);Number.isInteger(R)&&R>=H.v&&oe(H,R+1)}yb(l)}return!0},ownKeys(p){q(l);var g=Reflect.ownKeys(p).filter(y=>{var C=a.get(y);return C===void 0||C.v!==Pt});for(var[E,_]of a)_.v!==Pt&&!(E in p)&&g.push(E);return g},setPrototypeOf(){fb()}})}function yb(e,t=1){oe(e,e.v+t)}function Xl(e){return e!==null&&typeof e=="object"&&xr in e?e[xr]:e}var co=v(()=>{mt();Ge();Ot();it();Vu();yr();Nt();bt();hn();ro();Bi()});function wb(){let e=Array.prototype,t=Array.__svelte_cleanup;t&&t();let{indexOf:r,lastIndexOf:n,includes:i}=e;e.indexOf=function(a,o){let l=r.call(this,a,o);if(l===-1){for(let d=o??0;d<this.length;d+=1)if(Xl(this[d])===a){Ql("array.indexOf(...)");break}}return l},e.lastIndexOf=function(a,o){let l=n.call(this,a,o??this.length-1);if(l===-1){for(let d=0;d<=(o??this.length-1);d+=1)if(Xl(this[d])===a){Ql("array.lastIndexOf(...)");break}}return l},e.includes=function(a,o){let l=i.call(this,a,o);if(!l){for(let d=0;d<this.length;d+=1)if(Xl(this[d])===a){Ql("array.includes(...)");break}}return l},Array.__svelte_cleanup=()=>{e.indexOf=r,e.lastIndexOf=n,e.includes=i}}var Np=v(()=>{Wr();co()});function Zl(){if(Op===void 0){Op=window,Sb=document,qu=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype;Cb=Kr(t,"firstChild").get,Ib=Kr(t,"nextSibling").get,e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0,Text.prototype.__t=void 0,se&&(e.__svelte_meta=null,wb())}}function Qr(e=""){return document.create
${i.map(g=>`
${d}in ${g}`).join("")}
`}),Kt(e,"component_stack",{value:i});let p=e.stack;if(p){let g=p.split(`
`),E=[];for(let _=0;_<g.length;_++){let y=g[_];y.includes("svelte/src/internal")||E.push(y)}Kt(e,"stack",{value:E.join(`
2026-01-21 08:46:13 +08:00
`)})}if(Ob(e,t),Db(t))throw e}function Pb(e,t,r=!0){var n=e.reactions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];a.f&2?Pb(a,t,!1):t===a&&(r?Ar(a,2048):a.f&1024&&Ar(a,4096),ao(a))}}function Gl(e){var t=Hr,r=bn,n=pn,i=$e,a=Vi,o=Gn,l=Pe,d=gn,p=e.f;Hr=null,bn=0,pn=null,Vi=(p&256)!==0&&(gn||!ms||$e===null),$e=p&96?null:e,Gn=null,Gu(e.ctx),gn=!1,rf++;try{var g=(0,e.fn)(),E=e.deps;if(Hr!==null){var _;if(Wu(e,bn),E!==null&&bn>0)for(E.length=bn+Hr.length,_=0;_<Hr.length;_++)E[bn+_]=Hr[_];else e.deps=E=Hr;if(!Vi)for(_=bn;_<E.length;_++)(E[_].reactions??=[]).push(e)}else E!==null&&bn<E.length&&(Wu(e,bn),E.length=bn);if(bi()&&pn!==null&&!gn&&E!==null&&!(e.f&6146))for(_=0;_<pn.length;_++)Pb(pn[_],e);return i!==null&&(rf++,pn!==null&&(n===null?n=pn:n.push(...pn))),g}finally{Hr=t,bn=r,pn=n,$e=i,Vi=a,Gn=o,Gu(l),gn=d}}function _I(e,t){let r=t.reactions;if(r!==null){var n=Q_.call(r,e);if(n!==-1){var i=r.length-1;i===0?r=t.reactions=null:(r[n]=r[i],r.pop())}}r===null&&t.f&2&&(Hr===null||!Hr.includes(t))&&(Ar(t,4096),t.f&768||(t.f^=512),Wl(t),Wu(t,0))}function Wu(e,t){var r=e.deps;if(r!==null)for(var n=t;n<r.length;n++)_I(e,r[n])}function ds(e){var t=e.f;if(!(t&16384)){Ar(e,1024);var r=Oe,n=Pe,i=ms;if(Oe=e,ms=!0,se){var a=Xr;Qu(e.component_function)}try{t&16?Mb(e):Pp(e),Lp(e);var o=Gl(e);e.teardown=typeof o=="function"?o:null,e.wv=Lb;var l=e.deps;if(se&&gi&&e.f&2048&&l!==null)for(let p=0;p<l.length;p++){var d=l[p];d.trace_need_increase&&(d.wv=Uu(),d.trace_need_increase=void 0,d.trace_v=void 0)}se&&tf.push(e)}catch(p){fo(p,e,r,n||e.ctx)}finally{ms=i,Oe=r,se&&Qu(a)}}}function kb(){console.error("Last ten effects were: ",tf.slice(-10).map(e=>e.fn)),tf=[]}function bI(){try{sb()}catch(e){if(se&&Kt(e,"stack",{value:""}),Yu!==null)if(se)try{fo(e,Yu,null,null)}catch(t){throw kb(),t}else fo(e,Yu,null,null);else throw se&&kb(),e}}function Dp(){var e=ms;try{var t=0;for(ms=!0;Ku.length>0;){t++>1e3&&bI();var r=Ku,n=r.length;Ku=[];for(var i=0;i<n;i++){var a=vI(r[i]);EI(a)}}}finally{ju=!1,ms=e,Yu=null,se&&(tf=[]),no.clear()}}function EI(e){var t=e.length;if(t!==0)for(var r=0;r<t;r++){var n=e[r];if(!(n.f&24576))try{Ui(n)&&(ds(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?Mp(n):n.fn=null))}catch(i){fo(i,n,null,n.ctx)}}}function ao(e){ju||(ju=!0,queueMicrotask(Dp));for(var t=Yu=e;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024))return;t.f^=1024}}Ku.push(t)}function vI(e){for(var t=[],r=e;r!==null;){var n=r.f,i=(n&96)!==0,a=i&&(n&1024)!==0;if(!a&&!(n&8192)){if(n&4)t.push(r);else if(i)r.f^=1024;else{var o=$e;try{$e=r,Ui(r)&&ds(r)}catch(p){fo(p,r,null,r.ctx)}finally{$e=o}}var l=r.first;if(l!==null){r=l;continue}}var d=r.parent;for(r=r.next;r===null&&d!==null;)r=d.next,d=d.parent}return t}function ho(e){var t;for(e&&(ju=!0,Dp(),t=e()),_p();Ku.length>0;)ju=!0,Dp(),_p();return t}async function Ei(){await Promise.resolve(),ho()}function q(e){var t=e.f,r=(t&2)!==0;if(Hu!==null&&Hu.add(e),$e!==null&&!gn){Gn!==null&&Gn.includes(e)&&db();var n=$e.deps;e.rv<rf&&(e.rv=rf,Hr===null&&n!==null&&n[bn]===e?bn++:Hr===null?Hr=[e]:(!Vi||!Hr.includes(e))&&Hr.push(e))}else if(r&&e.deps===null&&e.effects===null){var i=e,a=i.parent;a!==null&&!(a.f&256)&&(i.f^=256)}if(r&&(i=e,Ui(i)&&Sp(i)),se&&gi&&$u!==null&&$e!==null&&$u.reaction===$e){if(e.debug)e.debug();else if(e.created){var o=$u.entries.get(e);o===void 0&&(o={read:[]},$u.entries.set(e,o)),o.read.push($i("TracedAt"))}}return fs&&no.has(e)?no.get(e):e.v}function at(e){var t=gn;try{return gn=!0,e()}finally{gn=t}}function Ar(e,t){e.f=e.f&TI|t}function vt(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(xr in e)nf(e);else if(!Array.isArray(e))for(let t in e){let r=e[t];typeof r=="object"&&r&&xr in r&&nf(r)}}}function nf(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{nf(e[n],t)}catch{}let r=Ta(e);if(r!==Object.prototype&&r!==Array.prototype&&r!==Map.prototype&&r!==Set.prototype&&r!==Date.prototype){let n=Kl(r);for(let i in n){let a=n[i].get;if(a)try{a.call(e)}catch{}}}}}var N
`)){let n=AI.exec(r)??wI.exec(r);n&&t.push({file:n[1],line:+n[2],column:+n[3]})}return t}function Hb(){let e=SI()?.slice(4);if(!e)return null;for(let t=0;t<e.length;t++){let r=e[t],n=yI[r.file];if(!n){if(t===0)return null;continue}for(let i of n){if(i.end==null)return null;if(i.start.line<r.line&&i.end.line>r.line)return i.component}}return null}function Ip(e,t){if(t.owners!==null)for(;e;){if(e.owners===null){t.owners=null;break}for(let r of e.owners)t.owners.add(r);e=e.parent}}function Ub(e,t){return e.owners===null?!0:e.owners.has(t)||Ht in t&&[...e.owners].some(r=>r[Ht]===t[Ht])||e.parent!==null&&Ub(e.parent,t)}function Vb(e){return e?.owners?.values().next().value??Vb(e.parent)}function Ab(e){if(II)return;let t=Hb();if(t&&!Ub(e,t)){let r=Vb(e);r[Ht]!==t[Ht]?Cp(t[Ht],r[Ht]):Cp()}}var yI,AI,wI,CI,II,Vu=v(()=>{Nt();He();Ot();it();Wr();bt();yI={},AI=/at (?:.+ \()?(.+):(\d+):(\d+)\)?$/,wI=/@(.+):(\d+):(\d+)$/;CI=Symbol("ADD_OWNER");II=!1});function mo(e){if(se){let t=new Error(`lifecycle_outside_component
2026-01-05 13:03:55 +08:00
\`${e}(...)\` can only be used during component initialisation
2026-01-21 08:46:13 +08:00
https://svelte.dev/e/lifecycle_outside_component`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}var go=v(()=>{mt()});function Gu(e){Pe=e}function Qu(e){Xr=e}function dr(e,t=!1,r){var n=Pe={p:Pe,c:null,d:!1,e:null,m:!1,s:e,x:null,l:null};mi&&!t&&(Pe.l={s:null,u:null,r1:[],r2:Mt(!1)}),Cr(()=>{n.d=!0}),se&&(Pe.function=r,Xr=r)}function hr(e){let t=Pe;if(t!==null){e!==void 0&&(t.x=e);let o=t.e;if(o!==null){var r=Oe,n=$e;t.e=null;try{for(var i=0;i<o.length;i++){var a=o[i];Wt(a.effect),tr(a.reaction),Gt(a.fn)}}finally{Wt(r),tr(n)}}Pe=t.p,se&&(Xr=t.p?.function??null),t.m=!0}return e||{}}function bi(){return!mi||Pe!==null&&Pe.l===null}var Pe,Xr,Ot=v(()=>{mt();Vu();go();yr();Ge();He();Bi();Pe=null;Xr=null});function qb(e){e=e.replace(DI,"");let t=5381,r=e.length;for(;r--;)t=(t<<5)-t^e.charCodeAt(r);return(t>>>0).toString(36)}function zb(e){return RI.includes(e)}function Hp(e){return e?.replace(/\//g,"/\u200B")}var DI,kI,mB,RI,_s=v(()=>{DI=/\r/g;kI=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"],mB=[...kI,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"],RI=["touchstart","touchmove"]});var Yb=v(()=>{_s();Ge();Wr()});var Up=v(()=>{});var Kb=v(()=>{bt();Et()});function uf(){jb||(jb=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t.__on_r?.()})},{capture:!0}))}var jb,cf=v(()=>{Et();Gr();On();jb=!1});function _o(e){var t=$e,r=Oe;tr(null),Wt(null);try{return e()}finally{tr(t),Wt(r)}}function Vp(e,t,r,n=r){e.addEventListener(t,()=>_o(r));let i=e.__on_r;i?e.__on_r=()=>{i(),n(!0)}:e.__on_r=()=>n(!0),uf()}var Ti=v(()=>{He();Ge();cf()});function Gb(e,t,r,n={}){function i(a){if(n.capture||bo.call(t,a),!a.cancelBubble)return _o(()=>r?.call(this,a))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?dn(()=>{t.addEventListener(e,i,n)}):t.addEventListener(e,i,n),i}function pr(e,t,r,n,i){var a={capture:n,passive:i},o=Gb(e,t,r,a);(t===document.body||t===window||t===document)&&Cr(()=>{t.removeEventListener(e,o,a)})}function bo(e){var t=this,r=t.ownerDocument,n=e.type,i=e.composedPath?.()||[],a=i[0]||e.target,o=0,l=e.__root;if(l){var d=i.indexOf(l);if(d!==-1&&(t===document||t===window)){e.__root=t;return}var p=i.indexOf(t);if(p===-1)return;d<=p&&(o=d)}if(a=i[o]||e.target,a!==t){Kt(e,"currentTarget",{configurable:!0,get(){return a||r}});var g=$e,E=Oe;tr(null),Wt(null);try{for(var _,y=[];a!==null;){var C=a.assignedSlot||a.parentNode||a.host||null;try{var D=a["__"+n];if(D!=null&&(!a.disabled||e.target===a))if(fn(D)){var[P,...N]=D;P.apply(a,[e,...N])}else D.call(a,e)}catch(L){_?y.push(L):_=L}if(e.cancelBubble||C===t||C===null)break;a=C}if(_){for(let L of y)queueMicrotask(()=>{throw L});throw _}}finally{e.__root=t,delete e.currentTarget,tr(g),Wt(E)}}}var Wb,qp,Zu=v(()=>{He();it();Et();On();bt();Wr();Ge();Ti();Wb=new Set,qp=new Set});function Qb(){LI=void 0}var LI,zp=v(()=>{Et();Gr();He();Nt();bt()});function Ju(e){var t=document.createElement("template");return t.innerHTML=e,t.content}var lf=v(()=>{});function Zr(e,t){var r=Oe;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function Le(e,t){var r=(t&1)!==0,n=(t&2)!==0,i,a=!e.startsWith("<!>");return()=>{if(ge)return Zr(De,null),De;i===void 0&&(i=Ju(a?e:"<!>"+e),r||(i=qt(i)));var o=n||qu?document.importNode(i,!0):i.cloneNode(!0);if(r){var l=qt(o),d=o.lastChild;Zr(l,d)}else Zr(o,o);return o}}function ec(e=""){if(!ge){var t=Qr(e+"");return Zr(t,t),t}var r=De;return r.nodeType!==3&&(r.before(r=Qr()),wt(r)),Zr(r,r),r}function qi(){if(ge)return Zr(De,null),De;var e=document.createDocumentFragment(),t=docume
\r\f\xA0\v\uFEFF`]});function Yi(e,t,r,n,i,a){var o=e.__className;if(ge||o!==r){var l=vE(r,n,a);(!ge||l!==e.getAttribute("class"))&&(l==null?e.removeAttribute("class"):t?e.className=l:e.setAttribute("class",l)),e.__className=r}else if(a&&i!==a)for(var d in a){var p=!!a[d];(i==null||p!==!!i[d])&&e.classList.toggle(d,p)}return a}var Zp=v(()=>{ic();Et()});function Jp(e,t={},r,n){for(var i in r){var a=r[i];t[i]!==a&&(r[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,n))}}function ac(e,t,r,n){var i=e.__style;if(ge||i!==t){var a=TE(t,n);(!ge||a!==e.getAttribute("style"))&&(a==null?e.removeAttribute("style"):e.style.cssText=a),e.__style=t}else n&&(Array.isArray(n)?(Jp(e,r?.[0],n[0]),Jp(e,r?.[1],n[1],"important")):Jp(e,r,n));return n}var em=v(()=>{ic();Et()});function rm(e){if(ge){var t=!1,r=()=>{if(!t){if(t=!0,e.hasAttribute("value")){var n=e.value;Ki(e,"value",null),e.value=n}if(e.hasAttribute("checked")){var i=e.checked;Ki(e,"checked",null),e.checked=i}}};e.__on_r=r,tb(r),uf()}}function Ki(e,t,r,n){var i=XI(e);if(ge&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")){n||JI(e,t,r??"");return}i[t]!==(i[t]=r)&&(t==="loading"&&(e[G_]=r),r==null?e.removeAttribute(t):typeof r!="string"&&ZI(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function XI(e){return e.__attributes??={[GI]:e.nodeName.includes("-"),[QI]:e.namespaceURI===z_}}function ZI(e){var t=xE.get(e.nodeName);if(t)return t;xE.set(e.nodeName,t=[]);for(var r,n=e,i=Element.prototype;i!==n;){r=Kl(n);for(var a in r)r[a].set&&t.push(a);n=Ta(n)}return t}function JI(e,t,r){se&&(t==="srcset"&&e3(e,r)||tm(e.getAttribute(t)??"",r)||vb(t,e.outerHTML.replace(e.innerHTML,e.innerHTML&&"..."),String(r)))}function tm(e,t){return e===t?!0:new URL(e,document.baseURI).href===new URL(t,document.baseURI).href}function yE(e){return e.split(",").map(t=>t.trim().split(" ").filter(Boolean))}function e3(e,t){var r=yE(e.srcset),n=yE(t);return n.length===r.length&&n.every(([i,a],o)=>a===r[o][1]&&(tm(r[o][0],i)||tm(i,r[o][0])))}var jI,WI,GI,QI,xE,AE=v(()=>{mt();Et();it();Zu();cf();Wr();Nt();On();_s();Ge();ic();Zp();em();bt();jI=Symbol("class"),WI=Symbol("style"),GI=Symbol("is custom element"),QI=Symbol("is html");xE=new Map});var t3,ei,nm=v(()=>{it();mt();t3=Yl?()=>performance.now():()=>Date.now(),ei={tick:e=>(Yl?requestAnimationFrame:Ut)(e),now:()=>t3(),tasks:new Set}});function wE(){let e=ei.now();ei.tasks.forEach(t=>{t.c(e)||(ei.tasks.delete(t),t.f())}),ei.tasks.size!==0&&ei.tick(wE)}function SE(e){let t;return ei.tasks.size===0&&ei.tick(wE),{promise:new Promise(r=>{ei.tasks.add(t={c:e,f:r})}),abort(){ei.tasks.delete(t)}}}var CE=v(()=>{nm()});function hf(e,t){_o(()=>{e.dispatchEvent(new CustomEvent(t))})}function a3(e){if(e==="float")return"cssFloat";if(e==="offset")return"cssOffset";if(e.startsWith("--"))return e;let t=e.split("-");return t.length===1?t[0]:t[0]+t.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function IE(e){let t={},r=e.split(";");for(let n of r){let[i,a]=n.split(":");if(!i||a===void 0)break;let o=a3(i.trim());t[o]=a.trim()}return t}function am(e,t,r,n){var i=(e&1)!==0,a=(e&2)!==0,o=i&&a,l=(e&4)!==0,d=o?"both":i?"in":"out",p,g=t.inert,E=t.style.overflow,_,y;function C(){var H=$e,R=Oe;tr(null),Wt(null);try{return p??=r()(t,n?.()??{},{direction:d})}finally{tr(H),Wt(R)}}var D={is_global:l,in(){if(t.inert=g,!i){y?.abort(),y?.reset?.();return}a||_?.abort(),hf(t,"introstart"),_=im(t,C(),y,1,()=>{hf(t,"introend"),_?.abort(),_=p=void 0,t.style.overflow=E})},out(H){if(!a){H?.(),p=void 0;return}t.inert=!0,hf(t,"outrostart"),y=im(t,C(),_,0,()=>{hf(t,"outroend"),H?.()})},stop:()=>{_?.abort(),y?.abort()}},P=Oe;if((P.transitions??=[]).push(D),i&&ff){var N=l;if(!N){for(var L=P.parent;L&&L.f&65536;)for(;(L=L.parent)&&!(L.f&16););N=!L||(L.f&32768)!==0}N&&Gt(()=>{at(()=>D.in())})}}function im(e,t,r,n,i){var a=n===1;if(xa(t)){var o,l=!1;return dn(()=>{if(!l){var P=t({direction:a?"in":"out"});o=im(e,P,r,n,i)}}),{abort:()=>{l=!0,o?.abort()},deactivate:()=>o.deactivate(),reset:()=>o.reset(),t:()=>o.t()}}if(r?.deactivate(),!t?.duration)return i(),{abort:U
2026-01-05 13:03:55 +08: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.
<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.'}
${i?'<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 Ji.Setting(r).setName(`PDFs content indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(ar("Omnisearch will use Text Extractor to index the content of your PDFs.")).addToggle(p=>p.setValue(t.PDFIndexing).onChange(async g=>{await a.clearCache(),t.PDFIndexing=g,await ke(e)})).setDisabled(!n),new Ji.Setting(r).setName(`Images OCR indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(ar("Omnisearch will use Text Extractor to OCR your images and index their content.")).addToggle(p=>p.setValue(t.imagesIndexing).onChange(async g=>{await a.clearCache(),t.imagesIndexing=g,await ke(e)})).setDisabled(!n);let l=new DocumentFragment;l.createSpan({},p=>{p.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 Ji.Setting(r).setName(`Documents content indexing ${n?"":"\u26A0\uFE0F Disabled"}`).setDesc(l).addToggle(p=>p.setValue(t.officeIndexing).onChange(async g=>{await a.clearCache(),t.officeIndexing=g,await ke(e)})).setDisabled(!n);let d=new DocumentFragment;d.createSpan({},p=>{p.innerHTML=`Omnisearch will use AI Image Analyzer to index the content of your images with ai.<br/>
\u26A0\uFE0F <span style="color: var(--text-accent)">If both AI Image Analyzer and Text Extractor are enabled, Text Extractor will only be used as a fallback.</span>`}),new Ji.Setting(r).setName(`Images AI indexing ${i?"":"\u26A0\uFE0F Disabled"}`).setDesc(d).addToggle(p=>p.setValue(t.aiImageIndexing).onChange(async g=>{await a.clearCache(),t.aiImageIndexing=g,await ke(e)})).setDisabled(!i),new Ji.Setting(r).setName("Index paths of unsupported files").setDesc(ar(`
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/>
"Obsidian setting" will respect the value of "Files & Links > Detect all file extensions".`)).addDropdown(p=>{p.addOptions({yes:"Yes",no:"No",default:"Obsidian setting"}).setValue(t.unsupportedFilesIndexing).onChange(async g=>{await o(),t.unsupportedFilesIndexing=g,await ke(e)})}),new Ji.Setting(r).setName("Set frontmatter property key as title").setDesc(ar(`If you have a custom property in your notes that you want to use as the title in search results. If you set this to '#heading', then use the first heading from a file as the title.<br>
Leave empty to disable.`)).addText(p=>{p.setValue(t.displayTitle).onChange(async g=>{await o(),t.displayTitle=g,await ke(e)})}),new Ji.Setting(r).setName("Additional TEXT files to index").setDesc(ar(`In addition to standard <code>md</code> files, Omnisearch can also index other <strong style="color: var(--text-accent)">PLAINTEXT</strong> files.<br/>
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,
2026-01-21 08:46:13 +08:00
because Omnisearch will try to index their content.</span>`)).addText(p=>{p.setValue(t.indexedFileTypes.join(" ")).setPlaceholder("Example: txt org csv").onChange(async g=>{await a.clearCache(),t.indexedFileTypes=g.split(" "),await ke(e)})})}var Ji,Ty=v(()=>{Ji=require("obsidian");mr();mr();Dc()});function xy(e,t,r){let n=e.database;new rn.Setting(r).setName("Behavior").setHeading(),new rn.Setting(r).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(i=>i.setValue(t.useCache).onChange(async a=>{t.useCache=a,await ke(e)})),new rn.Setting(r).setName("Show previous query results").setDesc("Re-executes the previous query when opening Omnisearch.").addToggle(i=>i.setValue(t.showPreviousQueryResults).onChange(async a=>{t.showPreviousQueryResults=a,await ke(e)})),new rn.Setting(r).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.
2026-01-05 13:03:55 +08:00
Enable this option to completely hide them.`).addToggle(i=>i.setValue(t.hideExcluded).onChange(async a=>{t.hideExcluded=a,await ke(e)})),new rn.Setting(r).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(i=>{i.setValue(t.downrankedFoldersFilters.join(",")).setPlaceholder("Example: src,p2/dir").onChange(async a=>{let o=a.split(",");o=o.map(l=>l.trim()),t.downrankedFoldersFilters=o,await ke(e)})}),new rn.Setting(r).setName("Split CamelCaseWords").setDesc(ar(`Enable this if you want to be able to search for CamelCaseWords as separate words.<br/>
\u26A0\uFE0F <span style="color: var(--text-accent)">Changing this setting will clear the cache.</span><br>
${Ao}`)).addToggle(i=>i.setValue(t.splitCamelCase).onChange(async a=>{await n.clearCache(),t.splitCamelCase=a,await ke(e)})),new rn.Setting(r).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(i=>i.setValue(t.simpleSearch).onChange(async a=>{t.simpleSearch=a,await ke(e)})),rn.Platform.isIosApp||new rn.Setting(r).setName("Tokenize URLs").setDesc(`Enable this if you want to be able to search for URLs as separate words.
2026-01-21 08:46:13 +08:00
This setting has a strong impact on indexing performance, and can crash Obsidian under certain conditions.`).addToggle(i=>i.setValue(t.tokenizeUrls).onChange(async a=>{t.tokenizeUrls=a,await ke(e)})),new rn.Setting(r).setName("Open in new pane").setDesc("Open and create files in a new pane instead of the current pane.").addToggle(i=>i.setValue(t.openInNewPane).onChange(async a=>{t.openInNewPane=a,await ke(e)})),new rn.Setting(r).setName("Set Vim like navigation keys").setDesc(`Navigate down the results with ${vn()} + J/N, or navigate up with ${vn()} + K/P.`).addToggle(i=>i.setValue(t.vimLikeNavigationShortcut).onChange(async a=>{t.vimLikeNavigationShortcut=a,await ke(e)})),new rn.Setting(r).setName("Fuzziness").setDesc("Define the level of fuzziness for the search. The higher the fuzziness, the more results you'll get.").addDropdown(i=>i.addOptions({0:"Exact match",1:"Not too fuzzy",2:"Fuzzy enough"}).setValue(t.fuzziness).onChange(async a=>{["0","1","2"].includes(a)||(a="2"),t.fuzziness=a,await ke(e)}))}var rn,yy=v(()=>{rn=require("obsidian");mr();mr();Nr()});function Ay(e,t,r){new Ma.Setting(r).setName("User Interface").setHeading(),new Ma.Setting(r).setName("Show ribbon button").setDesc("Add a button on the sidebar to open the Vault search modal.").addToggle(n=>n.setValue(t.ribbonIcon).onChange(async i=>{t.ribbonIcon=i,await ke(e),i?e.addRibbonButton():e.removeRibbonButton()})),new Ma.Setting(r).setName("Show excerpts").setDesc("Shows the contextual part of the note that matches the search. Disable this to only show filenames in results.").addToggle(n=>n.setValue(t.showExcerpt).onChange(async i=>{Fa.set(i)})),new Ma.Setting(r).setName("Show embed references").setDesc(ar(`Some results are <a href="https://help.obsidian.md/Linking+notes+and+files/Embed+files">embedded</a> in other notes.<br>
2026-01-05 13:03:55 +08:00
This setting controls the maximum number of embeds to show in the search results. Set to 0 to disable.<br>
Also works with Text Extractor for embedded images and documents.`)).addSlider(n=>{n.setLimits(0,10,1).setValue(t.maxEmbeds).setDynamicTooltip().onChange(async i=>{t.maxEmbeds=i,await ke(e)})}),new Ma.Setting(r).setName("Render line return in excerpts").setDesc("Activate this option to render line returns in result excerpts.").addToggle(n=>n.setValue(t.renderLineReturnInExcerpts).onChange(async i=>{t.renderLineReturnInExcerpts=i,await ke(e)})),new Ma.Setting(r).setName('Show "Create note" button').setDesc(ar(`Shows a button next to the search input, to create a note.
2026-01-21 08:46:13 +08:00
Acts the same as the <code>shift \u21B5</code> shortcut, can be useful for mobile device users.`)).addToggle(n=>n.setValue(t.showCreateButton).onChange(async i=>{t.showCreateButton=i,await ke(e)})),new Ma.Setting(r).setName("Highlight matching words in results").setDesc("Will highlight matching results when enabled. See README for more customization options.").addToggle(n=>n.setValue(t.highlight).onChange(async i=>{t.highlight=i,await ke(e)}))}var Ma,wy=v(()=>{Ma=require("obsidian");wo();mr();mr()});function Cy(e,t,r,n){function i(o,l){o.setLimits(1,10,.5).setValue(t[l]).setDynamicTooltip().onChange(async d=>{t[l]=d,await ke(e)})}let a=kc(e.app);new Fn.Setting(r).setName("Results weighting").setHeading(),new Fn.Setting(r).setName(`File name & declared aliases (default: ${a.weightBasename})`).addSlider(o=>i(o,"weightBasename")),new Fn.Setting(r).setName(`File directory (default: ${a.weightDirectory})`).addSlider(o=>i(o,"weightDirectory")),new Fn.Setting(r).setName(`Headings level 1 (default: ${a.weightH1})`).addSlider(o=>i(o,"weightH1")),new Fn.Setting(r).setName(`Headings level 2 (default: ${a.weightH2})`).addSlider(o=>i(o,"weightH2")),new Fn.Setting(r).setName(`Headings level 3 (default: ${a.weightH3})`).addSlider(o=>i(o,"weightH3")),new Fn.Setting(r).setName(`Tags (default: ${a.weightUnmarkedTags})`).addSlider(o=>i(o,"weightUnmarkedTags")),new Fn.Setting(r).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 o=0;o<t.weightCustomProperties.length;o++){let l=t.weightCustomProperties[o],d=new Fn.Setting(r).setName((o+1).toString()+".");d.settingEl.style.paddingLeft="2em",d.addText(p=>{p.setPlaceholder("Property name").setValue(l.name).onChange(async g=>{l.name=g,await ke(e)})}).addSlider(p=>{p.setLimits(.1,5,.1).setValue(l.weight).setDynamicTooltip().onChange(async g=>{l.weight=g,await ke(e)})}).addButton(p=>{p.setButtonText("Remove"),p.onClick(async()=>{t.weightCustomProperties.splice(o,1),await ke(e),n()})})}new Fn.Setting(r).addButton(o=>{o.setButtonText("Add a new property"),o.onClick(l=>{t.weightCustomProperties.push({name:"",weight:1}),n()})}),new Fn.Setting(r).setName("Recency boost (experimental)").setDesc("Files that have been modified more recently than [selected cutoff] are given a higher rank.").addDropdown(o=>o.addOptions({["0"]:"Disabled",["1"]:"24 hours",["2"]:"7 days",["3"]:"30 days"}).setValue(t.recencyBoost).onChange(async l=>{t.recencyBoost=l,await ke(e)}))}var Fn,Iy=v(()=>{Fn=require("obsidian");wo();mr();en()});function Ny(e,t,r){ks.Platform.isMobile||(new ks.Setting(r).setName("API Access Through HTTP").setHeading().setDesc(ar('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 ks.Setting(r).setName("Enable the HTTP server").addToggle(n=>n.setValue(t.httpApiEnabled).onChange(async i=>{t.httpApiEnabled=i,i?e.apiHttpServer.listen(t.httpApiPort):e.apiHttpServer.close(),await ke(e)})),new ks.Setting(r).setName("HTTP Port").addText(n=>{n.setValue(t.httpApiPort).setPlaceholder("51361").onChange(async i=>{parseInt(i)>65535&&(i=t.httpApiPort,n.setValue(t.httpApiPort)),t.httpApiPort=i,t.httpApiEnabled&&(e.apiHttpServer.close(),e.apiHttpServer.listen(t.httpApiPort)),await ke(e)})}),new ks.Setting(r).setName("Show a notification when the server starts").setDesc("Will display a notification if the server is enabled, at Obsidian startup.").addToggle(n=>n.setValue(t.httpApiNotice).onChange(async i=>{t.httpApiNotice=i,await ke(e)})))}var ks,Oy=v(()=>{ks=require("obsidian");mr();mr()});function Dy(e,t,r){let n=e.database;new wi.Setting(r).setName("Danger Zone").setHeading(),new wi.Setting(r).setName("Ignore diacritics").setDesc(ar(`Normalize diacritics in search terms. Words like "br\xFBl\xE9e" or "\u017Elu\u0165ou\u010Dk\xFD" will be indexed as "brulee" and "zlutoucky".<br/>
2026-01-05 13:03:55 +08: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>
${Ao}`)).addToggle(a=>a.setValue(t.ignoreDiacritics).onChange(async o=>{await n.clearCache(),t.ignoreDiacritics=o,await ke(e)})),new wi.Setting(r).setName("Ignore Arabic diacritics (beta)").addToggle(a=>a.setValue(t.ignoreArabicDiacritics).onChange(async o=>{await n.clearCache(),t.ignoreArabicDiacritics=o,await ke(e)}));let i=new DocumentFragment;i.createSpan({},a=>{a.innerHTML=`Disable Omnisearch on this device only.<br>
${Ao}`}),new wi.Setting(r).setName("Disable on this device").setDesc(i).addToggle(a=>a.setValue(Nf(e.app)).onChange(async o=>{o?(e.app.saveLocalStorage(Ss,"1"),new wi.Notice("Omnisearch - Disabled. Please restart Obsidian.")):(e.app.saveLocalStorage(Ss),new wi.Notice("Omnisearch - Enabled. Please restart Obsidian."))})),new wi.Setting(r).setName("Force save the cache").setDesc(ar(`Omnisearch has a security feature that automatically disables cache writing if it cannot fully perform the operation.<br>
Use this option to force the cache to be saved, even if it causes a crash.<br>
\u26A0\uFE0F <span style="color: var(--text-accent)">Enabling this setting could lead to crash loops</span>`)).addToggle(a=>a.setValue(t.DANGER_forceSaveCache).onChange(async o=>{t.DANGER_forceSaveCache=o,await ke(e)})),Qi()&&new wi.Setting(r).setName("Clear cache data").setDesc(ar(`Erase all Omnisearch cache data.
Use this if Omnisearch results are inconsistent, missing, or appear outdated.<br>
2026-01-21 08:46:13 +08:00
${Ao}`)).addButton(a=>{a.setButtonText("Clear cache"),a.onClick(async()=>{await n.clearCache()})})}var wi,ky=v(()=>{wi=require("obsidian");mr();mr();mr();en()});function kc(e){return{useCache:!0,hideExcluded:!1,recencyBoost:"0",downrankedFoldersFilters:[],ignoreDiacritics:!0,ignoreArabicDiacritics:!1,indexedFileTypes:[],displayTitle:"",PDFIndexing:!1,officeIndexing:!1,imagesIndexing:!1,aiImageIndexing:!1,unsupportedFilesIndexing:"default",splitCamelCase:!1,openInNewPane:!1,vimLikeNavigationShortcut:e.vault.getConfig("vimMode"),ribbonIcon:!0,showExcerpt:!0,maxEmbeds:5,renderLineReturnInExcerpts:!0,showCreateButton:!1,highlight:!0,showPreviousQueryResults:!0,simpleSearch:!1,tokenizeUrls:!1,fuzziness:"1",weightBasename:10,weightDirectory:7,weightH1:6,weightH2:5,weightH3:4,weightUnmarkedTags:2,weightCustomProperties:[],httpApiEnabled:!1,httpApiPort:"51361",httpApiNotice:!0,welcomeMessage:"",verboseLogging:!1,DANGER_httpHost:null,DANGER_forceSaveCache:!1}}async function Ry(e){return Or=Object.assign({},kc(e.app),await e.loadData()),Fa.set(Or.showExcerpt),Sm(Or.verboseLogging),Or}var Rc,Fa,id,Or,wo=v(()=>{Rc=require("obsidian");Em();en();Nr();Ty();mr();yy();wy();Iy();Oy();ky();Fa=yo(!1),id=class extends Rc.PluginSettingTab{constructor(r){super(r.app,r);this.plugin=r,Fa.subscribe(async n=>{Or.showExcerpt=n,await ke(this.plugin)})}display(){let{containerEl:r}=this,n=this.plugin.database;if(r.empty(),this.app.loadLocalStorage(Ss)=="1"){let a=r.createEl("span");a.innerHTML='<strong style="color: var(--text-accent)">\u26A0\uFE0F OMNISEARCH IS DISABLED \u26A0\uFE0F</strong>'}r.createEl("h1",{text:"Omnisearch"});let i=r.createDiv();i.innerHTML=`
2026-01-05 13:03:55 +08: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>
2026-01-21 08:46:13 +08:00
`,vy(this.plugin,Or,r),r.createEl("hr"),xy(this.plugin,Or,r),r.createEl("hr"),Ay(this.plugin,Or,r),r.createEl("hr"),Cy(this.plugin,Or,r,this.display),r.createEl("hr"),Ny(this.plugin,Or,r),r.createEl("hr"),Dy(this.plugin,Or,r),r.createEl("hr"),new Rc.Setting(r).setName("Debugging").setHeading(),new Rc.Setting(r).setName("Enable verbose logging").setDesc('Adds a LOT of logs for debugging purposes. You also need to enable "Verbose" logging in the console to see these logs.').addToggle(a=>a.setValue(Or.verboseLogging).onChange(async o=>{Or.verboseLogging=o,Sm(o),await ke(this.plugin)}))}}});function a0(e){var t=b6();we(e,t)}var b6,Ly=v(()=>{Wn();yi();Pn();b6=Le('<span class="suggestion-flair" aria-label="Not created yet, select to create"><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></span>')});function Lc(e,t){let r=ze(t,"id",8),n=ze(t,"selected",8,!1),i=ze(t,"glyph",8,!1),a=ze(t,"cssClass",8,"");var o=E6();let l;var d=xe(o);{var p=E=>{a0(E,{})};tt(d,E=>{i()&&E(p)})}var g=Ye(d,2);zi(g,t,"default",{},null),Te(o),rr(E=>{Ki(o,"data-result-id",r()),l=Yi(o,1,`suggestion-item omnisearch-result ${a()??""}`,null,l,E)},[()=>({"is-selected":n()})],Br),pr("mousemove",o,function(E){Jr.call(this,t,E)}),pr("click",o,function(E){Jr.call(this,t,E)}),pr("keypress",o,function(E){Jr.call(this,t,E)}),pr("auxclick",o,function(E){Jr.call(this,t,E)}),we(e,o)}var E6,s0=v(()=>{Wn();yi();Pn();Ly();E6=Le("<div><!> <!></div>")});function sd(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}var Py,ad,o0=v(()=>{en();Nr();Py=require("obsidian");Dc();ad=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{return t.replace(new RegExp(`(${r.map(i=>Oc(i.match)).join("|")})`,"giu"),`<span class="${n}">$1</span>`)}catch(i){return console.error("Omnisearch - Error in highlightText()",i),t}}stringsToRegex(t){if(!t.length)return/^$/g;t.sort((n,i)=>i.length-n.length);let r=`(${t.map(n=>`\\b${Oc(n)}\\b|${Oc(n)}`).join("|")})`;return new RegExp(`${r}`,"gui")}getMatches(t,r,n){r=r.map(sd);let i=this.stringsToRegex(r),a=t;this.plugin.settings.ignoreDiacritics&&(t=Wi(t,this.plugin.settings.ignoreArabicDiacritics));let o=new Date().getTime(),l=null,d=[],p=0;for(;(l=i.exec(t))!==null;){if(++p>=100||new Date().getTime()-o>50){Gi("Stopped getMatches at",p,"results");break}let g=l.index,E=g+l[0].length,_=a.substring(g,E).trim();_&&l.index>=0&&d.push({match:_,offset:l.index})}if(n&&(n.query.text.length>1||n.getExactTerms().length>0)){let g=t.indexOf(n.getBestStringForExcerpt());g>-1&&d.find(E=>E.offset===g)&&d.unshift({offset:g,match:n.getBestStringForExcerpt()})}return d}makeExcerpt(t,r){let n=this.plugin.settings;try{let i=r??-1,a=Math.max(0,i-av),o=Math.min(t.length,i+cc);if(i>-1?t=(a>0?"\u2026":"")+t.slice(a,o).trim()+(o<t.length-1?"\u2026":""):t=t.slice(0,cc),n.renderLineReturnInExcerpts){let l=new RegExp(/(?:\r\n|\r|\n)/g);t=t.split(l).filter(p=>p).join(`
2026-01-05 13:03:55 +08:00
`);let d=t.lastIndexOf(`
`,i-a);d>0&&(t=t.slice(d))}return t=sd(t),n.renderLineReturnInExcerpts&&(t=t.trim().replaceAll(`
2026-01-21 08:46:13 +08:00
`,"<br>")),t}catch(i){return new Py.Notice("Omnisearch - Error while creating excerpt, see developer console"),console.error("Omnisearch - Error while creating excerpt"),console.error(i),""}}}});async function My(e){let t=e.app;if(!t.plugins.getPlugin("obsidian-icon-folder"))return{};let n=`${t.vault.configDir}/plugins/obsidian-icon-folder/data.json`;try{let i=await t.vault.adapter.read(n),a=JSON.parse(i),o={};for(let l in a){let d=(0,qo.normalizePath)(l);o[d]=a[l]}return o}catch(i){return Gi("Failed to read data.json:",i),{}}}async function Fy(e){let t={Li:"lucide-icons"},r="icons",n=e.app,i=n.plugins.getPlugin("obsidian-icon-folder");if(i){r=i.settings?.iconPacksPath||"icons";let o=`${n.vault.configDir}/${r}`;try{let l=await n.vault.adapter.list(o);if(l.folders&&l.folders.length>0)for(let d of l.folders){let p=d.split("/"),g=p[p.length-1],E=v6(g);t[E]=g}}catch(l){Gi("Failed to list icon packs:",l)}}return{prefixToIconPack:t,iconsPath:r}}function v6(e){if(e.includes("-")){let t=e.split("-"),r=t[0].charAt(0).toUpperCase();for(let n=1;n<t.length;n++)r+=t[n].charAt(0).toLowerCase();return r}return e.charAt(0).toUpperCase()+e.charAt(1).toLowerCase()}function u0(e,t){let r=(0,qo.normalizePath)(e),n=t[r];if(n){if(typeof n=="string")return n;if(typeof n=="object"&&n.iconName)return n.iconName}return null}function T6(e){let t=e.match(/^[A-Z][a-z]*/);if(t){let r=t[0],n=e.substring(r.length);return{prefix:r,name:n}}else return{prefix:"",name:e}}async function c0(e,t,r,n){let i=T6(e),{prefix:a,name:o}=i;if(!a)return`<span class="omnisearch-result__icon--emoji">${sd(o)}</span>`;let l=n[a];if(!l)return Gi(`No icon pack found for prefix: ${a}`),null;if(l==="lucide-icons"){let d=o.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),p=(0,qo.getIcon)(d);return p?p.outerHTML:(Gi(`Lucide icon not found: ${d}`),null)}else{if(!r)return Gi("Icons path is not set. Cannot load icon SVG."),null;let d=`${t.app.vault.configDir}/${r}/${l}/${o}.svg`;try{return await t.app.vault.adapter.read(d)}catch(p){return Gi(`Failed to load icon SVG for ${e} at ${d}:`,p),null}}}function l0(e){let t="file";e==="folder"?t="folder":Mn(e)?t="image":ti(e)?t="file-text":(Ai(e)||dc(e)||Cs(e))&&(t="layout-dashboard");let r=(0,qo.getIcon)(t);return r?r.outerHTML:""}var qo,By=v(()=>{qo=require("obsidian");Nr();o0()});function f0(e,t){dr(t,!1);let[r,n]=uc(),i=()=>oc(Fa,"$showExcerpt",r),a=ft(),o=ft(),l=ft(),d=ft(),p=ze(t,"selected",8,!1),g=ze(t,"note",8),E=ze(t,"plugin",8),_=ft(null),y=ft(""),C=ft(""),D={},P=ft(null),N=ft(null),L={},H,R=ft(!1);As(async()=>{D=await My(E());let qe=await Fy(E());L=qe.prefixToIconPack,H=qe.iconsPath,oe(R,!0)});async function B(){let qe=u0(q(C),D);qe?oe(P,await c0(qe,E(),H,L)):oe(P,l0("folder"));let St=u0(g().path,D);St?oe(N,await c0(St,E(),H,L)):oe(N,l0(g().path))}function V(qe,St){return qe.innerHTML=St,{update(Dt){qe.innerHTML=Dt},destroy(){qe.innerHTML=""}}}let X=null,ce=null,ve=ft(null);Qt(()=>(vt(g()),q(R),fc),()=>{g()&&g().path&&q(R)&&(async()=>(oe(y,g().displayTitle||g().basename),oe(C,fc(g().path)),await B()))()}),Qt(()=>(Mn,vt(g()),vt(E()),oi.TFile),()=>{if(oe(_,null),Mn(g().path)){let qe=E().app.vault.getAbstractFileByPath(g().path);qe instanceof oi.TFile&&oe(_,E().app.vault.getResourcePath(qe))}}),Qt(()=>(vt(g()),fc,oi.setIcon,Mn,ti,Ai,dc,Cs,q(ve)),()=>{oe(y,g().displayTitle||g().basename),oe(C,fc(g().path)),X&&(0,oi.setIcon)(X,"folder-open"),ce&&(Mn(g().path)?(0,oi.setIcon)(ce,"image"):ti(g().path)?(0,oi.setIcon)(ce,"file-text"):Ai(g().path)||dc(g().path)||Cs(g().path)?(0,oi.setIcon)(ce,"layout-dashboard"):(0,oi.setIcon)(ce,"file")),q(ve)&&(0,oi.setIcon)(q(ve),"corner-down-right")}),Qt(()=>(vt(E()),q(y),vt(g())),()=>{oe(a,E().textProcessor.getMatches(q(y),g().foundWords))}),Qt(()=>(vt(E()),q(C),vt(g())),()=>{oe(o,E().textProcessor.getMatches(q(C),g().foundWords))}),Qt(()=>(vt(E()),vt(g())),()=>{oe(l,E().textProcessor.makeExcerpt(g().content,g().matches[0]?.offset??-1))}),Qt(()=>{},()=>{oe(d,!1)}),Jn(),En();let Re=Br(()=>g().isEmbed?"omnisearch-result__embed":"");Lc(e,{get glyph(){return q(d)},get id(){return g().path},get cssClass()
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Je=!0,Ue=!1,ot;return{s:function(){te=te.call(F)},n:function(){var _t=te.next();return Je=_t.done,_t},e:function(_t){Ue=!0,ot=_t},f:function(){try{!Je&&te.return!=null&&te.return()}finally{if(Ue)throw ot}}}}function p(F,K){if(F){if(typeof F=="string")return g(F,K);var te=Object.prototype.toString.call(F).slice(8,-1);if(te==="Object"&&F.constructor&&(te=F.constructor.name),te==="Map"||te==="Set")return Array.from(F);if(te==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(te))return g(F,K)}}function g(F,K){(K==null||K>F.length)&&(K=F.length);for(var te=0,fe=new Array(K);te<K;te++)fe[te]=F[te];return fe}function E(F,K){if(!(F instanceof K))throw new TypeError("Cannot call a class as a function")}function _(F,K){for(var te=0;te<K.length;te++){var fe=K[te];fe.enumerable=fe.enumerable||!1,fe.configurable=!0,"value"in fe&&(fe.writable=!0),Object.defineProperty(F,fe.key,fe)}}function y(F,K,te){return K&&_(F.prototype,K),te&&_(F,te),Object.defineProperty(F,"prototype",{writable:!1}),F}function C(F,K,te){return K in F?Object.defineProperty(F,K,{value:te,enumerable:!0,configurable:!0,writable:!0}):F[K]=te,F}function D(F,K,te){P(F,K),K.set(F,te)}function P(F,K){if(K.has(F))throw new TypeError("Cannot initialize the same private elements twice on an object")}function N(F,K){var te=R(F,K,"get");return L(F,te)}function L(F,K){return K.get?K.get.call(F):K.value}function H(F,K,te){var fe=R(F,K,"set");return B(F,fe,te),te}function R(F,K,te){if(!K.has(F))throw new TypeError("attempted to "+te+" private field on non-instance");return K.get(F)}function B(F,K,te){if(K.set)K.set.call(F,te);else{if(!K.writable)throw new TypeError("attempted to set read only private field");K.value=te}}var V=typeof Symbol<"u"?Symbol.toStringTag:"@@toStringTag",X=new WeakMap,ce=new WeakMap,ve=function(){function F(K){var te=K.executor,fe=te===void 0?function(){}:te,Fe=K.internals,Je=Fe===void 0?lt():Fe,Ue=K.promise,ot=Ue===void 0?new Promise(function(ut,_t){return fe(ut,_t,function(qr){Je.onCancelList.push(qr)})}):Ue;E(this,F),D(this,X,{writable:!0,value:void 0}),D(this,ce,{writable:!0,value:void 0}),C(this,V,"CancelablePromise"),this.cancel=this.cancel.bind(this),H(this,X,Je),H(this,ce,ot||new Promise(function(ut,_t){return fe(ut,_t,function(qr){Je.onCancelList.push(qr)})}))}return y(F,[{key:"then",value:function(te,fe){return et(N(this,ce).then(Se(te,N(this,X)),Se(fe,N(this,X))),N(this,X))}},{key:"catch",value:function(te){return et(N(this,ce).catch(Se(te,N(this,X))),N(this,X))}},{key:"finally",value:function(te,fe){var Fe=this;return fe&&N(this,X).onCancelList.push(te),et(N(this,ce).finally(Se(function(){if(te)return fe&&(N(Fe,X).onCancelList=N(Fe,X).onCancelList.filter(function(Je){return Je!==te})),te()},N(this,X))),N(this,X))}},{key:"cancel",value:function(){N(this,X).isCanceled=!0;var te=N(this,X).onCancelList;N(this,X).onCancelList=[];var fe=d(te),Fe;try{for(fe.s();!(Fe=fe.n()).done;){var Je=Fe.value;if(typeof Je=="function")try{Je()}catch(Ue){console.error(Ue)}}}catch(Ue){fe.e(Ue)}finally{fe.f()}}},{key:"isCanceled",value:function(){return N(this,X).isCanceled===!0}}]),F}(),Re=function(F){t(te,F);var K=n(te);function te(fe){return E(this,te),K.call(this,{executor:fe})}return y(te)}(ve);e.CancelablePromise=Re,C(Re,"all",function(K){return je(K,Promise.all(K))}),C(Re,"allSettled",function(K){return je(K,Promise.allSettled(K))}),C(Re,"any",function(K){return je(K,Promise.any(K))}),C(Re,"race",function(K){return je(K,Promise.race(K))}),C(Re,"resolve",function(K){return St(Promise.resolve(K))}),C(Re,"reject",function(K){return St(Promise.reject(K))}),C(Re,"isCancelable",Dt);var qe=Re;e.default=qe;function St(F){return et(F,lt())}function Dt(F){return F instanceof Re||F instanceof ve}function Se(F,K){if(F)return function(te){if(!K.isCanceled){var fe=F(te);return Dt(fe)&&K.onCancelList.push(fe.cancel),fe}return te}}function et(F,K){return new ve({internals:K,promise:F})}function je(F,K){var te=lt();return te.onCancelList.push(function(){var fe=d(F),Fe;try{for(
characters.</span>`,1),q6=Le("We found 0 results for your search here. <!>",1),z6=Le('<!> <div style="text-align: center;"><!></div>',1),Y6=Le('<!> <!> <!> <div class="prompt-instructions"><div class="prompt-instruction"><span class="prompt-instruction-command">\u2191\u2193</span><span>to navigate</span></div> <div class="prompt-instruction"><span class="prompt-instruction-command"> </span> <span>to cycle history</span></div> <div class="prompt-instruction"><span class="prompt-instruction-command"> </span> <span>to open</span></div> <div class="prompt-instruction"><span class="prompt-instruction-command">Tab</span> <span>to switch to In-File Search</span></div> <div class="prompt-instruction"><span class="prompt-instruction-command"> </span> <span>to open in a new pane</span></div> <div class="prompt-instruction"><span class="prompt-instruction-command"></span> <span>to open in a new split</span></div> <div class="prompt-instruction"><span class="prompt-instruction-command"> </span> <span>to open in the background</span></div> <div class="prompt-instruction"><span class="prompt-instruction-command"> </span> <span>to create</span></div> <div class="prompt-instruction"><span class="prompt-instruction-command"> </span> <span>to create in a new pane</span></div> <div class="prompt-instruction"><span class="prompt-instruction-command"> </span> <span>to insert a link</span></div> <div class="prompt-instruction"><span class="prompt-instruction-command"> </span> <span>to toggle excerpts</span></div> <div class="prompt-instruction"><span class="prompt-instruction-command">Esc</span><span>to close</span></div></div>',1)});function g0(e,t){dr(t,!1);let r=ft(),n=ze(t,"plugin",8),i=ze(t,"offset",8),a=ze(t,"note",8),o=ze(t,"index",8,0),l=ze(t,"selected",8,!1);Qt(()=>(vt(n()),vt(a()),vt(i())),()=>{oe(r,n().textProcessor.makeExcerpt(a()?.content??"",i()))}),Jn(),En();let d=Br(()=>o().toString());Lc(e,{get id(){return q(d)},get selected(){return l()},$$events:{auxclick(p){Jr.call(this,t,p)},click(p){Jr.call(this,t,p)},mousemove(p){Jr.call(this,t,p)}},children:(p,g)=>{var E=K6(),_=xe(E);Ts(_,()=>n().textProcessor.highlightText(q(r),a().matches),!1,!1),Te(E),we(p,E)},$$slots:{default:!0}}),hr()}var K6,Zy=v(()=>{Wn();yi();Pn();s0();K6=Le('<div class="omnisearch-result__body"><!></div>')});function _0(e,t){dr(t,!1);let r=ze(t,"plugin",8),n=ze(t,"modal",8),i=ze(t,"parent",8,null),a=ze(t,"singleFilePath",8,""),o=ze(t,"previousQuery",8),l=ft(),d=ft([]),p=ft(0),g=ft(),E=ft();As(()=>{Me.enable("infile"),Me.on("infile","enter",N),Me.on("infile","open-in-new-pane",P),Me.on("infile","arrow-up",()=>C(-1)),Me.on("infile","arrow-down",()=>C(1)),Me.on("infile","tab",L)}),gf(()=>{Me.disable("infile")});function _(Se){let et=[],je=-1,lt=0;for(;++lt<100;){let F=y(Se,je,cc);if(!F.length)break;je=F.last().offset,et.push(F)}return et}function y(Se,et,je){let lt=Se.find(F=>F.offset>et);return lt?Se.filter(F=>F.offset>et&&F.offset<=lt.offset+je):[]}function C(Se){oe(p,Sf(q(p)+Se,q(d).length)),D()}async function D(){await Ei(),document.querySelector(`[data-result-id="${q(p)}"]`)?.scrollIntoView({behavior:"auto",block:"nearest"})}async function P(){return N(!0)}async function N(Se=!1){if(q(g)){n().close(),i()&&i().close();let et=r().textProcessor.stringsToRegex(q(g).foundWords);et.exec(q(g).content),await If(r().app,q(g),et.lastIndex,Se);let je=r().app.workspace.getActiveViewOfType(fd.MarkdownView);if(!je)return;let lt=q(d)[q(p)]??0,F=je.editor.offsetToPos(lt);F.ch=0,je.editor.setCursor(F),je.editor.scrollIntoView({from:{line:F.line-10,ch:0},to:{line:F.line+10,ch:0}})}}function L(){new ta(r(),q(l)??o()).open(),n().close()}Qt(()=>vt(o()),()=>{oe(l,o()??"")}),Qt(()=>(q(l),q(E),ea,vt(r()),vt(a())),()=>{(async()=>(q(l)&&(oe(E,new ea(q(l),{ignoreDiacritics:r().settings.ignoreDiacritics,ignoreArabicDiacritics:r().settings.ignoreArabicDiacritics})),oe(g,(await r().searchEngine.getSuggestions(q(E),{singleFilePath:a()}))[0]??null)),oe(p,0),await D()))()}),Qt(()=>(q(g),q(E)),()=>{if(q(g)){let Se=_(q(g).matches),et=q(E).getExactTerms();et.length&&(Se=Se.filter(je
2026-01-05 13:03:55 +08:00
`)}function zr(s,u,f,h){this.failures=u,this.failedKeys=h,this.successCount=f,this.message=Pr(s,u)}C(zr).from(Er);function Ct(s,u){this.name="BulkError",this.failures=Object.keys(u).map(function(f){return u[f]}),this.failuresByPos=u,this.message=Pr(s,this.failures)}C(Ct).from(Er);var $t=ct.reduce(function(s,u){return s[u]=u+"Error",s},{}),Di=Er,me=ct.reduce(function(s,u){var f=u+"Error";function h(m,b){this.name=f,m?typeof m=="string"?(this.message="".concat(m).concat(b?`
2026-01-21 08:46:13 +08:00
`+b:""),this.inner=b||null):typeof m=="object"&&(this.message="".concat(m.name," ").concat(m.message),this.inner=m):(this.message=Xt[u]||f,this.inner=null)}return C(h).from(Di),s[u]=h,s},{});me.Syntax=SyntaxError,me.Type=TypeError,me.Range=RangeError;var _u=rt.reduce(function(s,u){return s[u+"Error"]=me[u],s},{});function Nh(s,u){if(!s||s instanceof Er||s instanceof TypeError||s instanceof SyntaxError||!s.name||!_u[s.name])return s;var f=new _u[s.name](u||s.message,s);return"stack"in s&&y(f,"stack",{get:function(){return this.inner.stack}}),f}var ca=ct.reduce(function(s,u){return["Syntax","Type","Range"].indexOf(u)===-1&&(s[u+"Error"]=me[u]),s},{});ca.ModifyError=zr,ca.DexieError=Er,ca.BulkError=Ct;function nt(){}function Qa(s){return s}function bu(s,u){return s==null||s===Qa?u:function(f){return u(s(f))}}function fi(s,u){return function(){s.apply(this,arguments),u.apply(this,arguments)}}function Oh(s,u){return s===nt?u:function(){var f=s.apply(this,arguments);f!==void 0&&(arguments[0]=f);var h=this.onsuccess,m=this.onerror;this.onsuccess=null,this.onerror=null;var b=u.apply(this,arguments);return h&&(this.onsuccess=this.onsuccess?fi(h,this.onsuccess):h),m&&(this.onerror=this.onerror?fi(m,this.onerror):m),b!==void 0?b:f}}function Eu(s,u){return s===nt?u:function(){s.apply(this,arguments);var f=this.onsuccess,h=this.onerror;this.onsuccess=this.onerror=null,u.apply(this,arguments),f&&(this.onsuccess=this.onsuccess?fi(f,this.onsuccess):f),h&&(this.onerror=this.onerror?fi(h,this.onerror):h)}}function El(s,u){return s===nt?u:function(f){var h=s.apply(this,arguments);l(f,h);var m=this.onsuccess,b=this.onerror;this.onsuccess=null,this.onerror=null;var T=u.apply(this,arguments);return m&&(this.onsuccess=this.onsuccess?fi(m,this.onsuccess):m),b&&(this.onerror=this.onerror?fi(b,this.onerror):b),h===void 0?T===void 0?void 0:T:l(h,T)}}function Dh(s,u){return s===nt?u:function(){return u.apply(this,arguments)===!1?!1:s.apply(this,arguments)}}function js(s,u){return s===nt?u:function(){var f=s.apply(this,arguments);if(f&&typeof f.then=="function"){for(var h=this,m=arguments.length,b=new Array(m);m--;)b[m]=arguments[m];return f.then(function(){return u.apply(h,b)})}return u.apply(this,arguments)}}var on=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function vl(s,u){on=s}var Ne={},kt=100,Rt=typeof Promise>"u"?[]:function(){var s=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[s,d(s),s];var u=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[u,d(u),s]}(),ur=Rt[0],Sn=Rt[1],ki=Rt[2],vu=Sn&&Sn.then,cr=ur&&ur.constructor,Zt=!!ki;function la(){queueMicrotask(GS)}var Cn=function(s,u){Tu.push([s,u]),Kn&&(la(),Kn=!1)},Yn=!0,Kn=!0,un=[],Xa=[],kh=Qa,fa={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:nt,pgp:!1,env:{},finalize:nt},be=fa,Tu=[],Za=0,Tl=[];function de(s){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var u=this._PSD=be;if(typeof s!="function"){if(s!==Ne)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Lh(this,this._value);return}this._state=null,this._value=null,++u.ref,o_(this,s)}var Rh={get:function(){var s=be,u=wl;function f(h,m){var b=this,T=!s.global&&(s!==be||u!==wl),A=T&&!ha(),S=new de(function(O,$){Ph(b,new s_(l_(h,s,T,A),l_(m,s,T,A),O,$,s))});return this._consoleTask&&(S._consoleTask=this._consoleTask),S}return f.prototype=Ne,f},set:function(s){y(this,"then",s&&s.prototype===Ne?Rh:{get:function(){return s},set:Rh.set})}};E(de.prototype,{then:Rh,_then:function(s,u){Ph(this,new s_(null,null,s,u,be))},catch:function(s){if(arguments.length===1)return this.then(null,s);var u=arguments[0],f=arguments[1];return typeof u=="function"?this.then(null,function(h){return h instanceof u?f(h):xl(h)}):this.then(null,function(h){return h&&h.name===u?f(h):xl(h)})},finally:function(s){return this.then(function(u){return de.resolve(s()).then(function(){return u})},function(u){return de.resolve(s()).then(function(){return xl(u)})})},timeout:function(s,
2026-01-05 13:03:55 +08:00
`).map(i=>{let a=i.match(/^\s+/);if(a===null)return i;let[o]=a;return o.length>=n.length?i.slice(n.length):i}).join(`
`)}var Ls=class{options;rules;lexer;constructor(t){this.options=t||Tt.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:Td(n,`
2026-01-21 08:46:13 +08:00
`)}}}fences(t){let r=this.rules.block.fences.exec(t);if(r){let n=r[0],i=bR(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=Td(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,`
2026-01-05 13:03:55 +08:00
$1`);n=Td(n.replace(/^ *>[ \t]?/gm,""),`
`);let i=this.lexer.state.top;this.lexer.state.top=!0;let a=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:r[0],tokens:a,text:n}}}list(t){let r=this.rules.block.list.exec(t);if(r){let n=r[1].trim(),i=n.length>1,a={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 o=new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),l="",d="",p=!1;for(;t;){let g=!1;if(!(r=o.exec(t))||this.rules.block.hr.test(t))break;l=r[0],t=t.substring(l.length);let E=r[2].split(`
`,1)[0].replace(/^\t+/,N=>" ".repeat(3*N.length)),_=t.split(`
`,1)[0],y=0;this.options.pedantic?(y=2,d=E.trimStart()):(y=r[2].search(/[^ ]/),y=y>4?1:y,d=E.slice(y),y+=r[1].length);let C=!1;if(!E&&/^ *$/.test(_)&&(l+=_+`
`,t=t.substring(_.length+1),g=!0),!g){let N=new RegExp(`^ {0,${Math.min(3,y-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),L=new RegExp(`^ {0,${Math.min(3,y-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),H=new RegExp(`^ {0,${Math.min(3,y-1)}}(?:\`\`\`|~~~)`),R=new RegExp(`^ {0,${Math.min(3,y-1)}}#`);for(;t;){let B=t.split(`
`,1)[0];if(_=B,this.options.pedantic&&(_=_.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),H.test(_)||R.test(_)||N.test(_)||L.test(t))break;if(_.search(/[^ ]/)>=y||!_.trim())d+=`
`+_.slice(y);else{if(C||E.search(/[^ ]/)>=4||H.test(E)||R.test(E)||L.test(E))break;d+=`
`+_}!C&&!_.trim()&&(C=!0),l+=B+`
2026-01-21 08:46:13 +08:00
`,t=t.substring(B.length+1),E=_.slice(y)}}a.loose||(p?a.loose=!0:/\n *\n *$/.test(l)&&(p=!0));let D=null,P;this.options.gfm&&(D=/^\[[ xX]\] /.exec(d),D&&(P=D[0]!=="[ ] ",d=d.replace(/^\[[ xX]\] +/,""))),a.items.push({type:"list_item",raw:l,task:!!D,checked:P,loose:!1,text:d,tokens:[]}),a.raw+=l}a.items[a.items.length-1].raw=l.trimEnd(),a.items[a.items.length-1].text=d.trimEnd(),a.raw=a.raw.trimEnd();for(let g=0;g<a.items.length;g++)if(this.lexer.state.top=!1,a.items[g].tokens=this.lexer.blockTokens(a.items[g].text,[]),!a.loose){let E=a.items[g].tokens.filter(y=>y.type==="space"),_=E.length>0&&E.some(y=>/\n.*\n/.test(y.raw));a.loose=_}if(a.loose)for(let g=0;g<a.items.length;g++)a.items[g].loose=!0;return a}}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"):"",a=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:a}}}table(t){let r=this.rules.block.table.exec(t);if(!r||!/[:|]/.test(r[2]))return;let n=vA(r[1]),i=r[2].replace(/^\||\| *$/g,"").split("|"),a=r[3]&&r[3].trim()?r[3].replace(/\n[ \t]*$/,"").split(`
`):[],o={type:"table",raw:r[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let l of i)/^ *-+: *$/.test(l)?o.align.push("right"):/^ *:-+: *$/.test(l)?o.align.push("center"):/^ *:-+ *$/.test(l)?o.align.push("left"):o.align.push(null);for(let l of n)o.header.push({text:l,tokens:this.lexer.inline(l)});for(let l of a)o.rows.push(vA(l,o.header.length).map(d=>({text:d,tokens:this.lexer.inline(d)})));return o}}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:xn(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 o=Td(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=_R(r[2],"()");if(o>-1){let d=(r[0].indexOf("!")===0?5:4)+r[1].length+o;r[2]=r[2].substring(0,o),r[0]=r[0].substring(0,d).trim(),r[3]=""}}let i=r[2],a="";if(this.options.pedantic){let o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);o&&(i=o[1],a=o[3])}else a=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)),TA(r,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.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," "),a=r[i.toLowerCase()];if(!a){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return TA(n,a,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 o=[...i[0]].length-1,l,d,p=o,g=0,E=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(E.lastIndex=0,r=r.slice(-1*t.length+o);(i=E.exec(r))!=null;){if(l=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!l)continue;if(d=[...l].length,i[3]||i[4]){p+=d;continue}else if((i[5]||i[6])&&o%3&&!((o+d)%3)){g+=d;continue}if(p-=d,p>0)continue;d=Math.min(d,d+p+g);let _=[...i[0]][0].length,y=t.slice(0,o+i.index+_+d);if(Math.min(o,d)%2){let D=y.slice(1,-1);return{type:"em",raw:y,text:D,tokens:this.lexer.inlineTokens(D)}}let C=y.slice(2,-2);return{type:"strong",raw:y,text:C,tokens:this.lexer.inlineTokens(C)}}}}codespan(t){let r=this.rules.inline.code.exec(t);if(r){let n=r[2].replace(/\n/g," "),i=/[^ ]/.test(n),a=/^ /.test(n)&&/ $/.test(n);return i&&a&&(n=n.substring(1,n.length-1)),n=xn(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=xn(r[1]),i="mailto:"+n):(n=xn(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=xn(r[0]),i="mailto:"+n;else{let a;do a=r[0],r[0]=this.rules.inline._backpedal.exec(r[0])?.[0]??"";while(a!==r[0]);n=xn(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=xn(r[0]),{type:"text",raw:r[0],text:n}}}},ER=/^(?: *(?:\n|$))+/,vR=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,TR=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Hc=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,xR=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,SA=/(?:[*+-]|\d{1,9}[.)])/,CA=dt(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!
]`).replace("lheading",CA).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},NA=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,OR=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,OA=/^( {2,}|\\)\n(?!\s*$)/,DR=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Uc="\\p{P}\\p{S}",kR=dt(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Uc).getRegex(),RR=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,LR=dt(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Uc).getRegex(),PR=dt("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Uc).getRegex(),MR=dt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Uc).getRegex(),FR=dt(/\\([punct])/,"gu").replace(/punct/g,Uc).getRegex(),BR=dt(/^<(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(),$R=dt(P0).replace("(?:-->|$)","-->").getRegex(),HR=dt("^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",$R).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),yd=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,UR=dt(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",yd).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),DA=dt(/^!?\[(label)\]\[(ref)\]/).replace("label",yd).replace("ref",L0).getRegex(),kA=dt(/^!?\[(ref)\](?:\[\])?/).replace("ref",L0).getRegex(),VR=dt("reflink|nolink(?!\\()","g").replace("reflink",DA).replace("nolink",kA).getRegex(),F0={_backpedal:$c,anyPunctuation:FR,autolink:BR,blockSkip:RR,br:OA,code:OR,del:$c,emStrongLDelim:LR,emStrongRDelimAst:PR,emStrongRDelimUnd:MR,escape:NA,link:UR,nolink:kA,punctuation:kR,reflink:DA,reflinkSearch:VR,tag:HR,text:DR,url:$c},qR={...F0,link:dt(/^!?\[(label)\]\((.*?)\)/).replace("label",yd).getRegex(),reflink:dt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",yd).getRegex()},k0={...F0,escape:dt(NA).replace("])","~|])").getRegex(),url:dt(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},zR={...k0,br:dt(OA).replace("{2,}","*").getRegex(),text:dt(k0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},xd={normal:M0,gfm:IR,pedantic:NR},Bc={normal:F0,gfm:k0,breaks:zR,pedantic:qR},yn=class{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Tt.defaults,this.options.tokenizer=this.options.tokenizer||new Ls,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:xd.normal,inline:Bc.normal};this.options.pedantic?(r.block=xd.pedantic,r.inline=Bc.pedantic):this.options.gfm&&(r.block=xd.gfm,this.options.b
2026-01-05 13:03:55 +08: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,(l,d,p)=>d+" ".repeat(p.length));let n,i,a,o;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(n=l.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+=`
`+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(a=t,this.options.extensions&&this.options.extensions.startBlock){let l=1/0,d=t.slice(1),p;this.options.extensions.startBlock.forEach(g=>{p=g.call({lexer:this},d),typeof p=="number"&&p>=0&&(l=Math.min(l,p))}),l<1/0&&l>=0&&(a=t.substring(0,l+1))}if(this.state.top&&(n=this.tokenizer.paragraph(a))){i=r[r.length-1],o&&i.type==="paragraph"?(i.raw+=`
`+n.raw,i.text+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):r.push(n),o=a.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+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):r.push(n);continue}if(t){let l="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let n,i,a,o=t,l,d,p;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)g.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,l.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(d||(p=""),d=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(g=>(n=g.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,o,p)){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(a=t,this.options.extensions&&this.options.extensions.startInline){let g=1/0,E=t.slice(1),_;this.options.extensions.startInline.forEach(y=>{_=y.call({lexer:this},E),typeof _=="number"&&_>=0&&(g=Math.min(g,_))}),g<1/0&&g>=0&&(a=t.substring(0,g+1))}if(n=this.tokenizer.inlineText(a)){t=t.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(p=n.raw.slice(-1)),d=!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 g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return r}},Ps=class{options;constructor(t){this.options=t||Tt.defaults}code(t,r,n){let i=(r||"").match(/^\S*/)?.[0];return t=t.replace(/\n$/,"")+`
`,i?'<pre><code class="language-'+xn(i)+'">'+(n?t:xn(t,!0))+`</code></pre>
`:"<pre><code>"+(n?t:xn(t,!0))+`</code></pre>
`}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",a=r&&n!==1?' start="'+n+'"':"";return"<"+i+a+`>
`+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}>
2026-01-21 08:46:13 +08: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=EA(t);if(i===null)return n;t=i;let a='<a href="'+t+'"';return r&&(a+=' title="'+r+'"'),a+=">"+n+"</a>",a}image(t,r,n){let i=EA(t);if(i===null)return n;t=i;let a=`<img src="${t}" alt="${n}"`;return r&&(a+=` title="${r}"`),a+=">",a}text(t){return t}},Ko=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""}},An=class{options;renderer;textRenderer;constructor(t){this.options=t||Tt.defaults,this.options.renderer=this.options.renderer||new Ps,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ko}static parse(t,r){return new An(r).parse(t)}static parseInline(t,r){return new An(r).parseInline(t)}parse(t,r=!0){let n="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[a.type]){let o=a,l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(o.type)){n+=l||"";continue}}switch(a.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{let o=a;n+=this.renderer.heading(this.parseInline(o.tokens),o.depth,mR(this.parseInline(o.tokens,this.textRenderer)));continue}case"code":{let o=a;n+=this.renderer.code(o.text,o.lang,!!o.escaped);continue}case"table":{let o=a,l="",d="";for(let g=0;g<o.header.length;g++)d+=this.renderer.tablecell(this.parseInline(o.header[g].tokens),{header:!0,align:o.align[g]});l+=this.renderer.tablerow(d);let p="";for(let g=0;g<o.rows.length;g++){let E=o.rows[g];d="";for(let _=0;_<E.length;_++)d+=this.renderer.tablecell(this.parseInline(E[_].tokens),{header:!1,align:o.align[_]});p+=this.renderer.tablerow(d)}n+=this.renderer.table(l,p);continue}case"blockquote":{let o=a,l=this.parse(o.tokens);n+=this.renderer.blockquote(l);continue}case"list":{let o=a,l=o.ordered,d=o.start,p=o.loose,g="";for(let E=0;E<o.items.length;E++){let _=o.items[E],y=_.checked,C=_.task,D="";if(_.task){let P=this.renderer.checkbox(!!y);p?_.tokens.length>0&&_.tokens[0].type==="paragraph"?(_.tokens[0].text=P+" "+_.tokens[0].text,_.tokens[0].tokens&&_.tokens[0].tokens.length>0&&_.tokens[0].tokens[0].type==="text"&&(_.tokens[0].tokens[0].text=P+" "+_.tokens[0].tokens[0].text)):_.tokens.unshift({type:"text",text:P+" "}):D+=P+" "}D+=this.parse(_.tokens,p),g+=this.renderer.listitem(D,C,!!y)}n+=this.renderer.list(g,l,d);continue}case"html":{let o=a;n+=this.renderer.html(o.text,o.block);continue}case"paragraph":{let o=a;n+=this.renderer.paragraph(this.parseInline(o.tokens));continue}case"text":{let o=a,l=o.tokens?this.parseInline(o.tokens):o.text;for(;i+1<t.length&&t[i+1].type==="text";)o=t[++i],l+=`
2026-01-05 13:03:55 +08:00
`+(o.tokens?this.parseInline(o.tokens):o.text);n+=r?this.renderer.paragraph(l):l;continue}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(t,r){r=r||this.renderer;let n="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[a.type]){let o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=o||"";continue}}switch(a.type){case"escape":{let o=a;n+=r.text(o.text);break}case"html":{let o=a;n+=r.html(o.text);break}case"link":{let o=a;n+=r.link(o.href,o.title,this.parseInline(o.tokens,r));break}case"image":{let o=a;n+=r.image(o.href,o.title,o.text);break}case"strong":{let o=a;n+=r.strong(this.parseInline(o.tokens,r));break}case"em":{let o=a;n+=r.em(this.parseInline(o.tokens,r));break}case"codespan":{let o=a;n+=r.codespan(o.text);break}case"br":{n+=r.br();break}case"del":{let o=a;n+=r.del(this.parseInline(o.tokens,r));break}case"text":{let o=a;n+=r.text(o.text);break}default:{let o='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}},Ba=class{options;constructor(t){this.options=t||Tt.defaults}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}};zl(Ba,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var Ad=class{defaults=wd();options=this.setOptions;parse=this.#e(yn.lex,An.parse);parseInline=this.#e(yn.lexInline,An.parseInline);Parser=An;Renderer=Ps;TextRenderer=Ko;Lexer=yn;Tokenizer=Ls;Hooks=Ba;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 a=i;for(let o of a.header)n=n.concat(this.walkTokens(o.tokens,r));for(let o of a.rows)for(let l of o)n=n.concat(this.walkTokens(l.tokens,r));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,r));break}default:{let a=i;this.defaults.extensions?.childTokens?.[a.type]?this.defaults.extensions.childTokens[a.type].forEach(o=>{let l=a[o].flat(1/0);n=n.concat(this.walkTokens(l,r))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,r)))}}return n}use(...t){let r=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let i={...n};if(i.async=this.defaults.async||i.async||!1,n.extensions&&(n.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){let o=r.renderers[a.name];o?r.renderers[a.name]=function(...l){let d=a.renderer.apply(this,l);return d===!1&&(d=o.apply(this,l)),d}:r.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=r[a.level];o?o.unshift(a.tokenizer):r[a.level]=[a.tokenizer],a.start&&(a.level==="block"?r.startBlock?r.startBlock.push(a.start):r.startBlock=[a.start]:a.level==="inline"&&(r.startInline?r.startInline.push(a.start):r.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(r.childTokens[a.name]=a.childTokens)}),i.extensions=r),n.renderer){let a=this.defaults.renderer||new Ps(this.defaults);for(let o in n.renderer){if(!(o in a))throw new Error(`renderer '${o}' does not exist`);if(o==="options")continue;let l=o,d=n.renderer[l],p=a[l];a[l]=(...g)=>{let E=d.apply(a,g);return E===!1&&(E=p.apply(a,g)),E||""}}i.renderer=a}if(n.tokenizer){let a=this.defaults.tokenizer||new Ls(this.defaults);for(let o in n.tokenizer){if(!(o in a))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let l=o,d=n.tokenizer[l],p=a[l];a[l]=(...g)=>{let E=d.apply(a,g);return E===!1&&(E=p.apply(a,g)),E}}i.tokenizer=a}if(n.hooks){let a=this.defaults.hooks||new Ba;for(let o in n.hooks){if(!(o in a))throw new Error(`hook '${o}' does not exist`);if(o==="options")continue;let l=o,d=n.hooks[l],p=a[l];Ba.passThroughHooks.has(o)?a[l]=g=>{if(this.defaults.async)return Pro
2026-01-21 08:46:13 +08:00
Please report this to https://github.com/markedjs/marked.`,t){let i="<p>An error occurred:</p><pre>"+xn(n.message+"",!0)+"</pre>";return r?Promise.resolve(i):i}if(r)return Promise.reject(n);throw n}}},Ms=new Ad;function st(e,t){return Ms.parse(e,t)}st.options=st.setOptions=function(e){return Ms.setOptions(e),st.defaults=Ms.defaults,yA(st.defaults),st};st.getDefaults=wd;st.defaults=Tt.defaults;st.use=function(...e){return Ms.use(...e),st.defaults=Ms.defaults,yA(st.defaults),st};st.walkTokens=function(e,t){return Ms.walkTokens(e,t)};st.parseInline=Ms.parseInline;st.Parser=An;st.parser=An.parse;st.Renderer=Ps;st.TextRenderer=Ko;st.Lexer=yn;st.lexer=yn.lex;st.Tokenizer=Ls;st.Hooks=Ba;st.parse=st;var YR=st.options,KR=st.setOptions,jR=st.use,WR=st.walkTokens,GR=st.parseInline,QR=st,XR=An.parse,ZR=yn.lex;Tt.Hooks=Ba;Tt.Lexer=yn;Tt.Marked=Ad;Tt.Parser=An;Tt.Renderer=Ps;Tt.TextRenderer=Ko;Tt.Tokenizer=Ls;Tt.getDefaults=wd;Tt.lexer=ZR;Tt.marked=st;Tt.options=YR;Tt.parse=QR;Tt.parseInline=GR;Tt.parser=XR;Tt.setOptions=KR;Tt.use=jR;Tt.walkTokens=WR});function LA(e){return e.type===Ze.Tag||e.type===Ze.Script||e.type===Ze.Style}var Ze,PA,MA,FA,BA,$A,HA,UA,VA,qA,jo=v(()=>{(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"})(Ze||(Ze={}));PA=Ze.Root,MA=Ze.Text,FA=Ze.Directive,BA=Ze.Comment,$A=Ze.Script,HA=Ze.Style,UA=Ze.Tag,VA=Ze.CDATA,qA=Ze.Doctype});function _e(e){return LA(e)}function Wo(e){return e.type===Ze.CDATA}function nn(e){return e.type===Ze.Text}function Hs(e){return e.type===Ze.Comment}function Id(e){return e.type===Ze.Directive}function Bn(e){return e.type===Ze.Root}function ht(e){return Object.prototype.hasOwnProperty.call(e,"children")}function Go(e,t=!1){let r;if(nn(e))r=new Ni(e.data);else if(Hs(e))r=new Fs(e.data);else if(_e(e)){let n=t?B0(e.children):[],i=new $s(e.name,{...e.attribs},n);n.forEach(a=>a.parent=i),e.namespace!=null&&(i.namespace=e.namespace),e["x-attribsNamespace"]&&(i["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(i["x-attribsPrefix"]={...e["x-attribsPrefix"]}),r=i}else if(Wo(e)){let n=t?B0(e.children):[],i=new zc(n);n.forEach(a=>a.parent=i),r=i}else if(Bn(e)){let n=t?B0(e.children):[],i=new wn(n);n.forEach(a=>a.parent=i),e["x-mode"]&&(i["x-mode"]=e["x-mode"]),r=i}else if(Id(e)){let n=new Bs(e.name,e.data);e["x-name"]!=null&&(n["x-name"]=e["x-name"],n["x-publicId"]=e["x-publicId"],n["x-systemId"]=e["x-systemId"]),r=n}else throw new Error(`Not implemented yet: ${e.type}`);return r.startIndex=e.startIndex,r.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(r.sourceCodeLocation=e.sourceCodeLocation),r}function B0(e){let t=e.map(r=>Go(r,!0));for(let r=1;r<t.length;r++)t[r].prev=t[r-1],t[r-1].next=t[r];return t}var Cd,Vc,Ni,Fs,Bs,qc,zc,wn,$s,$0=v(()=>{jo();Cd=class{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(t){this.parent=t}get previousSibling(){return this.prev}set previousSibling(t){this.prev=t}get nextSibling(){return this.next}set nextSibling(t){this.next=t}cloneNode(t=!1){return Go(this,t)}},Vc=class extends Cd{constructor(t){super(),this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t}},Ni=class extends Vc{constructor(){super(...arguments),this.type=Ze.Text}get nodeType(){return 3}},Fs=class extends Vc{constructor(){super(...arguments),this.type=Ze.Comment}get nodeType(){return 8}},Bs=class extends Vc{constructor(t,r){super(r),this.name=t,this.type=Ze.Directive}get nodeType(){return 1}},qc=class extends Cd{constructor(t){super(),this.children=t}get firstChild(){var t;return(t=this.children[0])!==null&&t!==void 0?t:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(t){this.children=t}},zc=class extends qc{constructor(){super(...arguments),this.type=Ze.CDATA}get nodeType(){return 4}},wn=class extends qc{constructor(){super(...arguments),this.
`:kd(e.children):Wo(e)?kd(e.children):nn(e)?e.data:""}function ra(e){return Array.isArray(e)?e.map(ra).join(""):ht(e)&&!Hs(e)?ra(e.children):nn(e)?e.data:""}function jc(e){return Array.isArray(e)?e.map(jc).join(""):ht(e)&&(e.type===Ze.Tag||Wo(e))?jc(e.children):nn(e)?e.data:""}var X0=v(()=>{_r();Q0();jo()});function ru(e){return ht(e)?e.children:[]}function c2(e){return e.parent||null}function Z0(e){let t=c2(e);if(t!=null)return ru(t);let r=[e],{prev:n,next:i}=e;for(;n!=null;)r.unshift(n),{prev:n}=n;for(;i!=null;)r.push(i),{next:i}=i;return r}function EL(e,t){var r;return(r=e.attribs)===null||r===void 0?void 0:r[t]}function vL(e,t){return e.attribs!=null&&Object.prototype.hasOwnProperty.call(e.attribs,t)&&e.attribs[t]!=null}function TL(e){return e.name}function Rd(e){let{next:t}=e;for(;t!==null&&!_e(t);)({next:t}=t);return t}function Ld(e){let{prev:t}=e;for(;t!==null&&!_e(t);)({prev:t}=t);return t}var l2=v(()=>{_r()});function na(e){if(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.parent){let t=e.parent.children,r=t.lastIndexOf(e);r>=0&&t.splice(r,1)}e.next=null,e.prev=null,e.parent=null}function xL(e,t){let r=t.prev=e.prev;r&&(r.next=t);let n=t.next=e.next;n&&(n.prev=t);let i=t.parent=e.parent;if(i){let a=i.children;a[a.lastIndexOf(e)]=t,e.parent=null}}function yL(e,t){if(na(t),t.next=null,t.parent=e,e.children.push(t)>1){let r=e.children[e.children.length-2];r.next=t,t.prev=r}else t.prev=null}function AL(e,t){na(t);let{parent:r}=e,n=e.next;if(t.next=n,t.prev=e,e.next=t,t.parent=r,n){if(n.prev=t,r){let i=r.children;i.splice(i.lastIndexOf(n),0,t)}}else r&&r.children.push(t)}function wL(e,t){if(na(t),t.parent=e,t.prev=null,e.children.unshift(t)!==1){let r=e.children[1];r.prev=t,t.next=r}else t.next=null}function SL(e,t){na(t);let{parent:r}=e;if(r){let 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}var f2=v(()=>{});function nu(e,t,r=!0,n=1/0){return Pd(e,Array.isArray(t)?t:[t],r,n)}function Pd(e,t,r,n){let i=[],a=[Array.isArray(t)?t:[t]],o=[0];for(;;){if(o[0]>=a[0].length){if(o.length===1)return i;a.shift(),o.shift();continue}let l=a[0][o[0]++];if(e(l)&&(i.push(l),--n<=0))return i;r&&ht(l)&&l.children.length>0&&(o.unshift(0),a.unshift(l.children))}}function CL(e,t){return t.find(e)}function Md(e,t,r=!0){let n=Array.isArray(t)?t:[t];for(let i=0;i<n.length;i++){let a=n[i];if(_e(a)&&e(a))return a;if(r&&ht(a)&&a.children.length>0){let o=Md(e,a.children,!0);if(o)return o}}return null}function d2(e,t){return(Array.isArray(t)?t:[t]).some(r=>_e(r)&&e(r)||ht(r)&&d2(e,r.children))}function IL(e,t){let r=[],n=[Array.isArray(t)?t:[t]],i=[0];for(;;){if(i[0]>=n[0].length){if(n.length===1)return r;n.shift(),i.shift();continue}let a=n[0][i[0]++];_e(a)&&e(a)&&r.push(a),ht(a)&&a.children.length>0&&(i.unshift(0),n.unshift(a.children))}}var J0=v(()=>{_r()});function eg(e,t){return typeof t=="function"?r=>_e(r)&&t(r.attribs[e]):r=>_e(r)&&r.attribs[e]===t}function NL(e,t){return r=>e(r)||t(r)}function h2(e){let t=Object.keys(e).map(r=>{let n=e[r];return Object.prototype.hasOwnProperty.call(Fd,r)?Fd[r](n):eg(r,n)});return t.length===0?null:t.reduce(NL)}function OL(e,t){let r=h2(e);return r?r(t):!0}function DL(e,t,r,n=1/0){let i=h2(e);return i?nu(i,t,r,n):[]}function kL(e,t,r=!0){return Array.isArray(t)||(t=[t]),Md(eg("id",e),t,r)}function Us(e,t,r=!0,n=1/0){return nu(Fd.tag_name(e),t,r,n)}function RL(e,t,r=!0,n=1/0){return nu(eg("class",e),t,r,n)}function LL(e,t,r=!0,n=1/0){return nu(Fd.tag_type(e),t,r,n)}var Fd,tg=v(()=>{_r();J0();Fd={tag_name(e){return typeof e=="function"?t=>_e(t)&&e(t.name):e==="*"?_e:t=>_e(t)&&t.name===e},tag_type(e){return typeof e=="function"?t=>e(t.type):t=>t.type===e},tag_contains(e){return typeof e=="function"?t=>nn(t)&&e(t.data):t=>nn(t)&&t.data===e}}});function PL(e){let t=e.length;for(;--t>=0;){let r=e[t];if(t>0&&e.lastIndexOf(r,t-1)>=0){e.splice(t,1);continue}for(let n=r.parent;n;n=n.parent)if(e.includes(n)){e.splice(t,1);break}}return e}function p2(e,t){let r=[],n=[];if(e===t)return 0;let i=ht(e)?e:e.parent;for(;i;)r.unshift(i),i=i.parent;f
2026-01-05 13:03:55 +08:00
:is(button, input, select, textarea, optgroup, option)[disabled],
optgroup[disabled] > option,
fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)
2026-01-21 08:46:13 +08: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])"}});function vg(e,t){return e===Un.default.falseFunc?Un.default.falseFunc:r=>t.isTag(r)&&e(r)}function Tg(e,t){let r=t.getSiblings(e);if(r.length<=1)return[];let n=r.indexOf(e);return n<0||n===r.length-1?[]:r.slice(n+1).filter(t.isTag)}function bg(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 Un,Eg,_g,qd,zd=v(()=>{Un=ln(za(),1);hg();Eg={};_g=(e,t,r,n,i)=>{let a=i(t,bg(r),n);return a===Un.default.trueFunc?e:a===Un.default.falseFunc?Un.default.falseFunc:o=>a(o)&&e(o)},qd={is:_g,matches:_g,where:_g,not(e,t,r,n,i){let a=i(t,bg(r),n);return a===Un.default.falseFunc?e:a===Un.default.trueFunc?Un.default.falseFunc:o=>!a(o)&&e(o)},has(e,t,r,n,i){let{adapter:a}=r,o=bg(r);o.relativeSelector=!0;let l=t.some(g=>g.some(el))?[Eg]:void 0,d=i(t,o,l);if(d===Un.default.falseFunc)return Un.default.falseFunc;let p=vg(d,a);if(l&&d!==Un.default.trueFunc){let{shouldTestNextSiblings:g=!1}=d;return E=>{if(!e(E))return!1;l[0]=E;let _=a.getChildren(E),y=g?[..._,...Tg(E,a)]:_;return a.existsOne(p,y)}}return g=>e(g)&&a.existsOne(p,a.getChildren(g))}}});function G2(e,t,r,n,i){var a;let{name:o,data:l}=t;if(Array.isArray(l)){if(!(o in qd))throw new Error(`Unknown pseudo-class :${o}(${l})`);return qd[o](e,l,r,n,i)}let d=(a=r.pseudos)===null||a===void 0?void 0:a[o],p=typeof d=="string"?d:Vd[o];if(typeof p=="string"){if(l!=null)throw new Error(`Pseudo ${o} doesn't have any arguments`);let g=ia(p);return qd.is(e,g,r,n,i)}if(typeof d=="function")return gg(d,o,l,1),g=>d(g,l)&&e(g);if(o in cu)return cu[o](e,l,r,n);if(o in rl){let g=rl[o];return gg(g,o,l,2),E=>g(E,r,l)&&e(E)}throw new Error(`Unknown pseudo-class :${o}`)}var xg=v(()=>{ou();K2();j2();W2();zd()});function yg(e,t){let r=t.getParent(e);return r&&t.isTag(r)?r:null}function Q2(e,t,r,n,i){let{adapter:a,equals:o}=r;switch(t.type){case Ee.PseudoElement:throw new Error("Pseudo-elements are not supported by css-select");case Ee.ColumnCombinator:throw new Error("Column combinators are not yet supported by css-select");case Ee.Attribute:{if(t.namespace!=null)throw new Error("Namespaced attributes are not yet supported by css-select");return(!r.xmlMode||r.lowerCaseAttributeNames)&&(t.name=t.name.toLowerCase()),B2[t.action](e,t,r)}case Ee.Pseudo:return G2(e,t,r,n,i);case Ee.Tag:{if(t.namespace!=null)throw new Error("Namespaced tag names are not yet supported by css-select");let{name:l}=t;return(!r.xmlMode||r.lowerCaseTags)&&(l=l.toLowerCase()),function(p){return a.getName(p)===l&&e(p)}}case Ee.Descendant:{if(r.cacheResults===!1||typeof WeakSet>"u")return function(p){let g=p;for(;g=yg(g,a);)if(e(g))return!0;return!1};let l=new WeakSet;return function(p){let g=p;for(;g=yg(g,a);)if(!l.has(g)){if(a.isTag(g)&&e(g))return!0;l.add(g)}return!1}}case"_flexibleDescendant":return function(d){let p=d;do if(e(p))return!0;while(p=yg(p,a));return!1};case Ee.Parent:return function(d){return a.getChildren(d).some(p=>a.isTag(p)&&e(p))};case Ee.Child:return function(d){let p=a.getParent(d);return p!=null&&a.isTag(p)&&e(p)};case Ee.Sibling:return function(d){let p=a.getSiblings(d);for(let g=0;g<p.length;g++){let E=p[g];if(o(d,E))break;if(a.isTag(E)&&e(E))return!0}return!1};case Ee.Adjacent:return a.prevElementSibling?function(d){let p=a.prevElementSibling(d);return p!=null&&e(p)}:funct
`)})):{name:i,value:a.replace(Tw,`\r
`)}}).toArray()}var vw,C4,Tw,xw=v(()=>{_r();vw="input,select,textarea,keygen",C4=/%20/g,Tw=/\r?\n/g});var Vg={};Nn(Vg,{extract:()=>D4});function O4(e){var t;return typeof e=="string"?{selector:e,value:"textContent"}:{selector:e.selector,value:(t=e.value)!==null&&t!==void 0?t:"textContent"}}function D4(e){let t={};for(let r in e){let n=e[r],i=Array.isArray(n),{selector:a,value:o}=O4(i?n[0]:n),l=typeof o=="function"?o:typeof o=="string"?d=>this._make(d).prop(o):d=>this._make(d).extract(o);if(i)t[r]=this._findBySelector(a,Number.POSITIVE_INFINITY).map((d,p)=>l(p,r,t)).get();else{let d=this._findBySelector(a,1);t[r]=d.length>0?l(d[0],r,t):void 0}}return t}var yw=v(()=>{});var ja,Aw=v(()=>{N2();dw();gw();Ew();xw();yw();ja=class{constructor(t,r,n){if(this.length=0,this.options=n,this._root=r,t){for(let i=0;i<t.length;i++)this[i]=t[i];this.length=t.length}}};ja.prototype.cheerio="[cheerio object]";ja.prototype.splice=Array.prototype.splice;ja.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator];Object.assign(ja.prototype,cg,Fg,$g,Hg,Ug,Vg)});function ww(e,t){return function r(n,i,a=!0){if(n==null)throw new Error("cheerio.load() expects a string");let o=Wc(i),l=e(n,o,a,null);class d extends ja{_make(E,_){let y=p(E,_);return y.prevObject=this,y}_parse(E,_,y,C){return e(E,_,y,C)}_render(E){return t(E,this.options)}}function p(g,E,_=l,y){if(g&&Hn(g))return g;let C=Wc(y,o),D=typeof _=="string"?[e(_,C,!1,null)]:"length"in _?_:[_],P=Hn(D)?D:new d(D,null,C);if(P._root=P,!g)return new d(void 0,P,C);let N=typeof g=="string"&&Qc(g)?e(g,C,!1,null).children:k4(g)?[g]:Array.isArray(g)?g:void 0,L=new d(N,P,C);if(N)return L;if(typeof g!="string")throw new TypeError("Unexpected type of selector");let H=g,R=E?typeof E=="string"?Qc(E)?new d([e(E,C,!1,null)],P,C):(H=`${E} ${H}`,P):Hn(E)?E:new d(Array.isArray(E)?E:[E],P,C):P;return R?R.find(H):L}return Object.assign(p,ag,{load:r,_root:l,_options:o,fn:d.prototype,prototype:d.prototype}),p}}function k4(e){return!!e.name||e.type==="root"||e.type==="text"||e.type==="comment"}var Sw=v(()=>{ng();iu();Aw();au()});function Zd(e){return e>=55296&&e<=57343}function Cw(e){return e>=56320&&e<=57343}function Iw(e,t){return(e-55296)*1024+9216+t}function Jd(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function eh(e){return e>=64976&&e<=65007||R4.has(e)}var R4,xt,x,Vr,th=v(()=>{R4=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),xt="\uFFFD";(function(e){e[e.EOF=-1]="EOF",e[e.NULL=0]="NULL",e[e.TABULATION=9]="TABULATION",e[e.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",e[e.LINE_FEED=10]="LINE_FEED",e[e.FORM_FEED=12]="FORM_FEED",e[e.SPACE=32]="SPACE",e[e.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",e[e.QUOTATION_MARK=34]="QUOTATION_MARK",e[e.AMPERSAND=38]="AMPERSAND",e[e.APOSTROPHE=39]="APOSTROPHE",e[e.HYPHEN_MINUS=45]="HYPHEN_MINUS",e[e.SOLIDUS=47]="SOLIDUS",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_9=57]="DIGIT_9",e[e.SEMICOLON=59]="SEMICOLON",e[e.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",e[e.EQUALS_SIGN=61]="EQUALS_SIGN",e[e.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",e[e.QUESTION_MARK=63]="QUESTION_MARK",e[e.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",e[e.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",e[e.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",e[e.GRAVE_ACCENT=96]="GRAVE_ACCENT",e[e.LATIN_SMALL_A=97]="LATIN_SMALL_A",e[e.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(x||(x={}));Vr={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"}});var Y,al=v(()=>{(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolid
2026-01-05 13:03:55 +08:00
`)}else if(hc(t))try{let g=JSON.parse(await r.vault.cachedRead(n)),E=[],_=y=>{for(let C in y)typeof y[C]=="object"?_(y[C]):C==="content"&&E.push(y[C])};_(g),i=E.join(`\r
2026-01-21 08:46:13 +08:00
`)}catch(g){console.error("Omnisearch: Error while parsing Dataloom file",t),console.error(g)}else Mn(t)?this.plugin.settings.aiImageIndexing&&o?.canBeAnalyzed(n)?i=await o.analyzeImage(n):this.plugin.settings.imagesIndexing&&a?.canFileBeExtracted(t)&&(i=await a.extractText(n)):ti(t)&&this.plugin.settings.PDFIndexing&&a?.canFileBeExtracted(t)?i=await a.extractText(n):dv(t)&&this.plugin.settings.officeIndexing&&a?.canFileBeExtracted(t)?i=await a.extractText(n):this.plugin.notesIndexer.isFilenameIndexable(t)&&(i=n.path);i==null&&(console.warn(`Omnisearch: ${i} content for file`,n.path),i="");let l=r.metadataCache.getFileCache(n);if(l){let g=bv(this.plugin.app,n,l);for(let E of g.filter(_=>!this.documents.has(_))){let _=this.plugin.notesIndexer.generateIndexableNonexistingDocument(E,n.path)}if(l.frontmatter?.["excalidraw-plugin"]){let E=l.sections?.filter(_=>_.type==="comment")??[];for(let{start:_,end:y}of E.map(C=>C.position))i=i.substring(0,_.offset-1)+i.substring(y.offset)}}let d;this.plugin.settings.displayTitle==="#heading"?d=l?.headings?.find(g=>g.level===1)?.heading??"":d=l?.frontmatter?.[this.plugin.settings.displayTitle]??"";let p=fv(l);return{basename:n.basename,displayTitle:d,content:i,cleanedContent:cv(Wi(i)),path:n.path,mtime:n.stat.mtime,tags:p,unmarkedTags:p.map(g=>g.replace("#","")),aliases:lv(l).join(""),headings1:l?wf(l,1).join(" "):"",headings2:l?wf(l,2).join(" "):"",headings3:l?wf(l,3).join(" "):""}}};Nr();bc();Nr();var Ah=class{constructor(t){this.plugin=t;this.notesToReindex=new Set}flagNoteForReindex(t){this.notesToReindex.add(t)}async refreshIndex(){for(let r of this.notesToReindex)Ke("Updating file",r.path),await this.plugin.documentsRepository.addDocument(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(),a=n&&r.PDFIndexing,o=n&&r.imagesIndexing,l=i&&r.aiImageIndexing;return this.isFilePlaintext(t)||Ai(t)||hc(t)||a&&ti(t)||o&&Mn(t)||l&&Mn(t)}isFilenameIndexable(t){return this.canIndexUnsupportedFiles()||this.isFilePlaintext(t)||Ai(t)||Cs(t)||hc(t)}canIndexUnsupportedFiles(){return this.plugin.settings.unsupportedFilesIndexing==="yes"||this.plugin.settings.unsupportedFilesIndexing==="default"&&!!this.plugin.app.vault.getConfig("showUnsupportedFiles")}generateIndexableNonexistingDocument(t,r){return t=Om(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}`))}};o0();var Sh=require("obsidian");Nr();var wh=class{constructor(t){this.plugin=t;this.embeds=new Map}addEmbed(t,r){this.embeds.has(t)||this.embeds.set(t,new Set),this.embeds.get(t).add(r)}removeFile(t){this.embeds.delete(t),this.refreshEmbedsForNote(t)}renameFile(t,r){this.embeds.has(t)&&(this.embeds.set(r,this.embeds.get(t)),this.embeds.delete(t)),this.embeds.forEach((n,i)=>{n.has(t)&&(n.delete(t),n.add(r))})}refreshEmbedsForNote(t){this.embeds.forEach((r,n)=>{r.has(t)&&r.delete(t)}),this.addEmbedsForNote(t)}getEmbeds(t){return this.embeds.has(t)?[...this.embeds.get(t)]:[]}async writeToCache(){Ke("Writing embeds to cache");let t=this.plugin.database,r=[];for(let[n,i]of this.embeds)r.push({embedded:n,referencedBy:[...i]});await t.embeds.clear(),await t.embeds.bulkAdd(r)}async loadFromCache(){try{let t=this.plugin.database;if(!t.embeds){Ke("No embeds in cache");return}Ke("Loading embeds from cache");let r=await t.embeds.toArray();for(let{embedded:n,referencedBy:i}of r)for(let a of i)this.addEmbed(n,a)}catch{this.plugin.database.clearCache(),console.error("Omnisearch - Error while loading embeds cache"),new Sh.Notice("Omnisearch - There was an error while loading the cac
2026-01-05 13:03:55 +08:00
/*! Bundled license information:
lodash-es/lodash.js:
(**
* @license
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*)
search-query-parser/lib/search-query-parser.js:
(*!
* search-query-parser.js
* Copyright(c) 2014-2019
* MIT Licensed
*)
dexie/dist/dexie.js:
(*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** *)
*/
/* nosourcemap */