/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var ln=Object.create;var Le=Object.defineProperty;var cn=Object.getOwnPropertyDescriptor;var un=Object.getOwnPropertyNames,rr=Object.getOwnPropertySymbols,hn=Object.getPrototypeOf,nr=Object.prototype.hasOwnProperty,dn=Object.prototype.propertyIsEnumerable;var ir=(n,e,t)=>e in n?Le(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,he=(n,e)=>{for(var t in e||(e={}))nr.call(e,t)&&ir(n,t,e[t]);if(rr)for(var t of rr(e))dn.call(e,t)&&ir(n,t,e[t]);return n};var or=n=>Le(n,"__esModule",{value:!0});var fn=(n,e)=>{or(n);for(var t in e)Le(n,t,{get:e[t],enumerable:!0})},pn=(n,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of un(e))!nr.call(n,r)&&r!=="default"&&Le(n,r,{get:()=>e[r],enumerable:!(t=cn(e,r))||t.enumerable});return n},Tt=n=>pn(or(Le(n!=null?ln(hn(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var ye=(n,e,t)=>new Promise((r,i)=>{var o=l=>{try{a(t.next(l))}catch(c){i(c)}},s=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(o,s);a((t=t.apply(n,e)).next())});fn(exports,{default:()=>er});function de(n){return Array.isArray?Array.isArray(n):lr(n)==="[object Array]"}var gn=1/0;function mn(n){if(typeof n=="string")return n;let e=n+"";return e=="0"&&1/n==-gn?"-0":e}function bn(n){return n==null?"":mn(n)}function fe(n){return typeof n=="string"}function sr(n){return typeof n=="number"}function vn(n){return n===!0||n===!1||yn(n)&&lr(n)=="[object Boolean]"}function ar(n){return typeof n=="object"}function yn(n){return ar(n)&&n!==null}function U(n){return n!=null}function Dt(n){return!n.trim().length}function lr(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}var En="Incorrect 'index' type",Sn=n=>`Invalid value for key ${n}`,wn=n=>`Pattern length exceeds max of ${n}.`,Tn=n=>`Missing ${n} property in key`,Dn=n=>`Property 'weight' in key '${n}' must be a positive integer`,cr=Object.prototype.hasOwnProperty,ur=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(r=>{let i=hr(r);t+=i.weight,this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight}),this._keys.forEach(r=>{r.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function hr(n){let e=null,t=null,r=null,i=1;if(fe(n)||de(n))r=n,e=dr(n),t=Ct(n);else{if(!cr.call(n,"name"))throw new Error(Tn("name"));let o=n.name;if(r=o,cr.call(n,"weight")&&(i=n.weight,i<=0))throw new Error(Dn(o));e=dr(o),t=Ct(o)}return{path:e,id:t,weight:i,src:r}}function dr(n){return de(n)?n:n.split(".")}function Ct(n){return de(n)?n.join("."):n}function Cn(n,e){let t=[],r=!1,i=(o,s,a)=>{if(!!U(o))if(!s[a])t.push(o);else{let l=s[a],c=o[l];if(!U(c))return;if(a===s.length-1&&(fe(c)||sr(c)||vn(c)))t.push(bn(c));else if(de(c)){r=!0;for(let u=0,h=c.length;un.score===e.score?n.idx{this._keysMap[t.id]=r})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,fe(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){let t=this.size();fe(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,r=this.size();t{let s=this.getFn(e,i.path);if(!!U(s)){if(de(s)){let a=[],l=[{nestedArrIndex:-1,value:s}];for(;l.length;){let{nestedArrIndex:c,value:u}=l.pop();if(!!U(u))if(fe(u)&&!Dt(u)){let h={v:u,i:c,n:this.norm.get(u)};a.push(h)}else de(u)&&u.forEach((h,d)=>{l.push({nestedArrIndex:d,value:h})})}r.$[o]=a}else if(!Dt(s)){let a={v:s,n:this.norm.get(s)};r.$[o]=a}}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}};function fr(n,e,{getFn:t=y.getFn,fieldNormWeight:r=y.fieldNormWeight}={}){let i=new tt({getFn:t,fieldNormWeight:r});return i.setKeys(n.map(hr)),i.setSources(e),i.create(),i}function Fn(n,{getFn:e=y.getFn,fieldNormWeight:t=y.fieldNormWeight}={}){let{keys:r,records:i}=n,o=new tt({getFn:e,fieldNormWeight:t});return o.setKeys(r),o.setIndexRecords(i),o}function rt(n,{errors:e=0,currentLocation:t=0,expectedLocation:r=0,distance:i=y.distance,ignoreLocation:o=y.ignoreLocation}={}){let s=e/n.length;if(o)return s;let a=Math.abs(r-t);return i?s+a/i:a?1:s}function Nn(n=[],e=y.minMatchCharLength){let t=[],r=-1,i=-1,o=0;for(let s=n.length;o=e&&t.push([r,i]),r=-1)}return n[o-1]&&o-r>=e&&t.push([r,o-1]),t}var Te=32;function kn(n,e,t,{location:r=y.location,distance:i=y.distance,threshold:o=y.threshold,findAllMatches:s=y.findAllMatches,minMatchCharLength:a=y.minMatchCharLength,includeMatches:l=y.includeMatches,ignoreLocation:c=y.ignoreLocation}={}){if(e.length>Te)throw new Error(wn(Te));let u=e.length,h=n.length,d=Math.max(0,Math.min(r,h)),p=o,g=d,b=a>1||l,C=b?Array(h):[],O;for(;(O=n.indexOf(e,g))>-1;){let R=rt(e,{currentLocation:O,expectedLocation:d,distance:i,ignoreLocation:c});if(p=Math.min(R,p),g=O+u,b){let V=0;for(;V=ve;W-=1){let ae=W-1,te=t[n.charAt(ae)];if(b&&(C[ae]=+!!te),ee[W]=(ee[W+1]<<1|1)&te,R&&(ee[W]|=(_[W+1]|_[W])<<1|1|_[W+1]),ee[W]&J&&(F=rt(e,{errors:R,currentLocation:ae,expectedLocation:d,distance:i,ignoreLocation:c}),F<=p)){if(p=F,g=ae,g<=d)break;ve=Math.max(1,2*d-g)}}if(rt(e,{errors:R+1,currentLocation:d,expectedLocation:d,distance:i,ignoreLocation:c})>p)break;_=ee}let X={isMatch:g>=0,score:Math.max(.001,F)};if(b){let R=Nn(C,a);R.length?l&&(X.indices=R):X.isMatch=!1}return X}function Pn(n){let e={};for(let t=0,r=n.length;t{this.chunks.push({pattern:d,alphabet:Pn(d),startIndex:p})},h=this.pattern.length;if(h>Te){let d=0,p=h%Te,g=h-p;for(;d{let{isMatch:O,score:_,indices:F}=kn(e,g,b,{location:i+C,distance:o,threshold:s,findAllMatches:a,minMatchCharLength:l,includeMatches:r,ignoreLocation:c});O&&(d=!0),h+=_,O&&F&&(u=[...u,...F])});let p={isMatch:d,score:d?h/this.chunks.length:1};return d&&r&&(p.indices=u),p}},pe=class{constructor(e){this.pattern=e}static isMultiMatch(e){return pr(e,this.multiRegex)}static isSingleMatch(e){return pr(e,this.singleRegex)}search(){}};function pr(n,e){let t=n.match(e);return t?t[1]:null}var gr=class extends pe{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},mr=class extends pe{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let r=e.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}},br=class extends pe{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},vr=class extends pe{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},yr=class extends pe{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},Er=class extends pe{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},_t=class extends pe{constructor(e,{location:t=y.location,threshold:r=y.threshold,distance:i=y.distance,includeMatches:o=y.includeMatches,findAllMatches:s=y.findAllMatches,minMatchCharLength:a=y.minMatchCharLength,isCaseSensitive:l=y.isCaseSensitive,ignoreLocation:c=y.ignoreLocation}={}){super(e);this._bitapSearch=new xt(e,{location:t,threshold:r,distance:i,includeMatches:o,findAllMatches:s,minMatchCharLength:a,isCaseSensitive:l,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}},It=class extends pe{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,r,i=[],o=this.pattern.length;for(;(r=e.indexOf(this.pattern,t))>-1;)t=r+o,i.push([r,t-1]);let s=!!i.length;return{isMatch:s,score:s?0:1,indices:i}}},Mt=[gr,It,br,vr,Er,yr,mr,_t],Sr=Mt.length,Rn=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/,Ln="|";function Bn(n,e={}){return n.split(Ln).map(t=>{let r=t.trim().split(Rn).filter(o=>o&&!!o.trim()),i=[];for(let o=0,s=r.length;o!!(n[nt.AND]||n[nt.OR]),jn=n=>!!n[Ft.PATH],$n=n=>!de(n)&&ar(n)&&!Nt(n),Tr=n=>({[nt.AND]:Object.keys(n).map(e=>({[e]:n[e]}))});function Dr(n,e,{auto:t=!0}={}){let r=i=>{let o=Object.keys(i),s=jn(i);if(!s&&o.length>1&&!Nt(i))return r(Tr(i));if($n(i)){let l=s?i[Ft.PATH]:o[0],c=s?i[Ft.PATTERN]:i[l];if(!fe(c))throw new Error(Sn(l));let u={keyId:Ct(l),pattern:c};return t&&(u.searcher=Ot(c,e)),u}let a={children:[],operator:o[0]};return o.forEach(l=>{let c=i[l];de(c)&&c.forEach(u=>{a.children.push(r(u))})}),a};return Nt(n)||(n=Tr(n)),r(n)}function Gn(n,{ignoreFieldNorm:e=y.ignoreFieldNorm}){n.forEach(t=>{let r=1;t.matches.forEach(({key:i,norm:o,score:s})=>{let a=i?i.weight:null;r*=Math.pow(s===0&&a?Number.EPSILON:s,(a||1)*(e?1:o))}),t.score=r})}function Yn(n,e){let t=n.matches;e.matches=[],!!U(t)&&t.forEach(r=>{if(!U(r.indices)||!r.indices.length)return;let{indices:i,value:o}=r,s={indices:i,value:o};r.key&&(s.key=r.key.src),r.idx>-1&&(s.refIndex=r.idx),e.matches.push(s)})}function Xn(n,e){e.score=n.score}function Vn(n,e,{includeMatches:t=y.includeMatches,includeScore:r=y.includeScore}={}){let i=[];return t&&i.push(Yn),r&&i.push(Xn),n.map(o=>{let{idx:s}=o,a={item:e[s],refIndex:s};return i.length&&i.forEach(l=>{l(o,a)}),a})}var le=class{constructor(e,t={},r){this.options=he(he({},y),t),this.options.useExtendedSearch,this._keyStore=new ur(this.options.keys),this.setCollection(e,r)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof tt))throw new Error(En);this._myIndex=t||fr(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){!U(e)||(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){let t=[];for(let r=0,i=this._docs.length;r-1&&(l=l.slice(0,t)),Vn(l,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e){let t=Ot(e,this.options),{records:r}=this._myIndex,i=[];return r.forEach(({v:o,i:s,n:a})=>{if(!U(o))return;let{isMatch:l,score:c,indices:u}=t.searchIn(o);l&&i.push({item:o,idx:s,matches:[{score:c,value:o,norm:a,indices:u}]})}),i}_searchLogical(e){let t=Dr(e,this.options),r=(a,l,c)=>{if(!a.children){let{keyId:h,searcher:d}=a,p=this._findMatches({key:this._keyStore.get(h),value:this._myIndex.getValueForItemAtKeyId(l,h),searcher:d});return p&&p.length?[{idx:c,item:l,matches:p}]:[]}let u=[];for(let h=0,d=a.children.length;h{if(U(a)){let c=r(t,a,l);c.length&&(o[l]||(o[l]={idx:l,item:a,matches:[]},s.push(o[l])),c.forEach(({matches:u})=>{o[l].matches.push(...u)}))}}),s}_searchObjectList(e){let t=Ot(e,this.options),{keys:r,records:i}=this._myIndex,o=[];return i.forEach(({$:s,i:a})=>{if(!U(s))return;let l=[];r.forEach((c,u)=>{l.push(...this._findMatches({key:c,value:s[u],searcher:t}))}),l.length&&o.push({idx:a,item:s,matches:l})}),o}_findMatches({key:e,value:t,searcher:r}){if(!U(t))return[];let i=[];if(de(t))t.forEach(({v:o,i:s,n:a})=>{if(!U(o))return;let{isMatch:l,score:c,indices:u}=r.searchIn(o);l&&i.push({score:c,key:e,value:o,idx:s,norm:a,indices:u})});else{let{v:o,n:s}=t,{isMatch:a,score:l,indices:c}=r.searchIn(o);a&&i.push({score:l,key:e,value:o,norm:s,indices:c})}return i}};le.version="6.5.3";le.createIndex=fr;le.parseIndex=Fn;le.config=y;le.parseQuery=Dr;Wn(wr);function ge(n,e){let t=Object.keys(e).map(r=>Kn(n,r,e[r]));return t.length===1?t[0]:function(){t.forEach(r=>r())}}function Kn(n,e,t){let r=n[e],i=n.hasOwnProperty(e),o=t(r);return r&&Object.setPrototypeOf(o,r),Object.setPrototypeOf(s,o),n[e]=s,a;function s(...l){return o===r&&n[e]===s&&a(),o.apply(this,l)}function a(){n[e]===s&&(i?n[e]=r:delete n[e]),o!==r&&(o=r,Object.setPrototypeOf(s,r||Function))}}var x=Tt(require("obsidian"));function Cr(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ce(n){for(var e=1;e=0)&&(t[i]=n[i]);return t}function qn(n,e){if(n==null)return{};var t=Un(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i=0)&&(!Object.prototype.propertyIsEnumerable.call(n,r)||(t[r]=n[r]))}return t}function Qn(n){return Jn(n)||Zn(n)||ei(n)||ti()}function Jn(n){if(Array.isArray(n))return kt(n)}function Zn(n){if(typeof Symbol!="undefined"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function ei(n,e){if(!!n){if(typeof n=="string")return kt(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return kt(n,e)}}function kt(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t"&&(e=e.substring(1)),n)try{if(n.matches)return n.matches(e);if(n.msMatchesSelector)return n.msMatchesSelector(e);if(n.webkitMatchesSelector)return n.webkitMatchesSelector(e)}catch(t){return!1}return!1}}function ii(n){return n.host&&n!==document&&n.host.nodeType?n.host:n.parentNode}function ne(n,e,t,r){if(n){t=t||document;do{if(e!=null&&(e[0]===">"?n.parentNode===t&&ot(n,e):ot(n,e))||r&&n===t)return n;if(n===t)break}while(n=ii(n))}return null}var Mr=/\s+/g;function L(n,e,t){if(n&&e)if(n.classList)n.classList[t?"add":"remove"](e);else{var r=(" "+n.className+" ").replace(Mr," ").replace(" "+e+" "," ");n.className=(r+(t?" "+e:"")).replace(Mr," ")}}function m(n,e,t){var r=n&&n.style;if(r){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(n,""):n.currentStyle&&(t=n.currentStyle),e===void 0?t:t[e];!(e in r)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),r[e]=t+(typeof t=="string"?"":"px")}}function De(n,e){var t="";if(typeof n=="string")t=n;else do{var r=m(n,"transform");r&&r!=="none"&&(t=r+" "+t)}while(!e&&(n=n.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(t)}function Ar(n,e,t){if(n){var r=n.getElementsByTagName(e),i=0,o=r.length;if(t)for(;i=o:s=i<=o,!s)return r;if(r===ue())break;r=Ee(r,!1)}return!1}function Me(n,e,t,r){for(var i=0,o=0,s=n.children;o2&&arguments[2]!==void 0?arguments[2]:{},i=r.evt,o=qn(r,hi);je.pluginEvent.bind(v)(e,t,ce({dragEl:f,parentEl:k,ghostEl:S,rootEl:A,nextEl:Ce,lastDownEl:st,cloneEl:P,cloneHidden:Se,dragStarted:Ye,putSortable:j,activeSortable:v.active,originalEvent:i,oldIndex:Oe,oldDraggableIndex:Ge,newIndex:q,newDraggableIndex:we,hideGhostForTarget:$r,unhideGhostForTarget:Gr,cloneNowHidden:function(){Se=!0},cloneNowShown:function(){Se=!1},dispatchSortableEvent:function(a){Y({sortable:t,name:a,originalEvent:i})}},o))};function Y(n){$e(ce({putSortable:j,cloneEl:P,targetEl:f,rootEl:A,oldIndex:Oe,oldDraggableIndex:Ge,newIndex:q,newDraggableIndex:we},n))}var f,k,S,A,Ce,st,P,Se,Oe,q,Ge,we,at,j,Fe=!1,lt=!1,ct=[],xe,ie,Wt,jt,Rr,Lr,Ye,Ne,Xe,Ve=!1,ut=!1,ht,G,$t=[],Gt=!1,dt=[],ft=typeof document!="undefined",pt=_r,Br=Be||be?"cssFloat":"float",di=ft&&!ni&&!_r&&"draggable"in document.createElement("div"),Hr=function(){if(!!ft){if(be)return!1;var n=document.createElement("x");return n.style.cssText="pointer-events:auto",n.style.pointerEvents==="auto"}}(),Wr=function(e,t){var r=m(e),i=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),o=Me(e,0,t),s=Me(e,1,t),a=o&&m(o),l=s&&m(s),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+M(o).width,u=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+M(s).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&a.float&&a.float!=="none"){var h=a.float==="left"?"left":"right";return s&&(l.clear==="both"||l.clear===h)?"vertical":"horizontal"}return o&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||c>=i&&r[Br]==="none"||s&&r[Br]==="none"&&c+u>i)?"vertical":"horizontal"},fi=function(e,t,r){var i=r?e.left:e.top,o=r?e.right:e.bottom,s=r?e.width:e.height,a=r?t.left:t.top,l=r?t.right:t.bottom,c=r?t.width:t.height;return i===a||o===l||i+s/2===a+c/2},pi=function(e,t){var r;return ct.some(function(i){var o=i[$].options.emptyInsertThreshold;if(!(!o||Pt(i))){var s=M(i),a=e>=s.left-o&&e<=s.right+o,l=t>=s.top-o&&t<=s.bottom+o;if(a&&l)return r=i}}),r},jr=function(e){function t(o,s){return function(a,l,c,u){var h=a.options.group.name&&l.options.group.name&&a.options.group.name===l.options.group.name;if(o==null&&(s||h))return!0;if(o==null||o===!1)return!1;if(s&&o==="clone")return o;if(typeof o=="function")return t(o(a,l,c,u),s)(a,l,c,u);var d=(s?a:l).options.group.name;return o===!0||typeof o=="string"&&o===d||o.join&&o.indexOf(d)>-1}}var r={},i=e.group;(!i||it(i)!="object")&&(i={name:i}),r.name=i.name,r.checkPull=t(i.pull,!0),r.checkPut=t(i.put),r.revertClone=i.revertClone,e.group=r},$r=function(){!Hr&&S&&m(S,"display","none")},Gr=function(){!Hr&&S&&m(S,"display","")};ft&&document.addEventListener("click",function(n){if(lt)return n.preventDefault(),n.stopPropagation&&n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation(),lt=!1,!1},!0);var _e=function(e){if(f){e=e.touches?e.touches[0]:e;var t=pi(e.clientX,e.clientY);if(t){var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);r.target=r.rootEl=t,r.preventDefault=void 0,r.stopPropagation=void 0,t[$]._onDragOver(r)}}},gi=function(e){f&&f.parentNode[$]._isOutsideThisEl(e.target)};function v(n,e){if(!(n&&n.nodeType&&n.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(n));this.el=n,this.options=e=re({},e),n[$]=this;var t={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(n.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Wr(n,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(s,a){s.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:v.supportPointer!==!1&&"PointerEvent"in window&&!He,emptyInsertThreshold:5};je.initializePlugins(this,n,t);for(var r in t)!(r in e)&&(e[r]=t[r]);jr(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:di,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?T(n,"pointerdown",this._onTapStart):(T(n,"mousedown",this._onTapStart),T(n,"touchstart",this._onTapStart)),this.nativeDraggable&&(T(n,"dragover",this),T(n,"dragenter",this)),ct.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),re(this,li())}v.prototype={constructor:v,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(Ne=null)},_getDirection:function(e,t){return typeof this.options.direction=="function"?this.options.direction.call(this,e,t,f):this.options.direction},_onTapStart:function(e){if(!!e.cancelable){var t=this,r=this.el,i=this.options,o=i.preventOnFilter,s=e.type,a=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,l=(a||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,u=i.filter;if(Ti(r),!f&&!(/mousedown|pointerdown/.test(s)&&e.button!==0||i.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&He&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=ne(l,i.draggable,r,!1),!(l&&l.animated)&&st!==l)){if(Oe=B(l),Ge=B(l,i.draggable),typeof u=="function"){if(u.call(this,e,l,this)){Y({sortable:t,rootEl:c,name:"filter",targetEl:l,toEl:r,fromEl:r}),K("filter",t,{evt:e}),o&&e.cancelable&&e.preventDefault();return}}else if(u&&(u=u.split(",").some(function(h){if(h=ne(c,h.trim(),r,!1),h)return Y({sortable:t,rootEl:h,name:"filter",targetEl:l,fromEl:r,toEl:r}),K("filter",t,{evt:e}),!0}),u)){o&&e.cancelable&&e.preventDefault();return}i.handle&&!ne(c,i.handle,r,!1)||this._prepareDragStart(e,a,l)}}},_prepareDragStart:function(e,t,r){var i=this,o=i.el,s=i.options,a=o.ownerDocument,l;if(r&&!f&&r.parentNode===o){var c=M(r);if(A=o,f=r,k=f.parentNode,Ce=f.nextSibling,st=r,at=s.group,v.dragged=f,xe={target:f,clientX:(t||e).clientX,clientY:(t||e).clientY},Rr=xe.clientX-c.left,Lr=xe.clientY-c.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,f.style["will-change"]="all",l=function(){if(K("delayEnded",i,{evt:e}),v.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!xr&&i.nativeDraggable&&(f.draggable=!0),i._triggerDragStart(e,t),Y({sortable:i,name:"choose",originalEvent:e}),L(f,s.chosenClass,!0)},s.ignore.split(",").forEach(function(u){Ar(f,u.trim(),Yt)}),T(a,"dragover",_e),T(a,"mousemove",_e),T(a,"touchmove",_e),T(a,"mouseup",i._onDrop),T(a,"touchend",i._onDrop),T(a,"touchcancel",i._onDrop),xr&&this.nativeDraggable&&(this.options.touchStartThreshold=4,f.draggable=!0),K("delayStart",this,{evt:e}),s.delay&&(!s.delayOnTouchOnly||t)&&(!this.nativeDraggable||!(Be||be))){if(v.eventCanceled){this._onDrop();return}T(a,"mouseup",i._disableDelayedDrag),T(a,"touchend",i._disableDelayedDrag),T(a,"touchcancel",i._disableDelayedDrag),T(a,"mousemove",i._delayedDragTouchMoveHandler),T(a,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&T(a,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(l,s.delay)}else l()}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){f&&Yt(f),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;w(e,"mouseup",this._disableDelayedDrag),w(e,"touchend",this._disableDelayedDrag),w(e,"touchcancel",this._disableDelayedDrag),w(e,"mousemove",this._delayedDragTouchMoveHandler),w(e,"touchmove",this._delayedDragTouchMoveHandler),w(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||e.pointerType=="touch"&&e,!this.nativeDraggable||t?this.options.supportPointer?T(document,"pointermove",this._onTouchMove):t?T(document,"touchmove",this._onTouchMove):T(document,"mousemove",this._onTouchMove):(T(f,"dragend",this),T(A,"dragstart",this._onDragStart));try{document.selection?mt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(r){}},_dragStarted:function(e,t){if(Fe=!1,A&&f){K("dragStarted",this,{evt:t}),this.nativeDraggable&&T(document,"dragover",gi);var r=this.options;!e&&L(f,r.dragClass,!1),L(f,r.ghostClass,!0),v.active=this,e&&this._appendGhost(),Y({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(ie){this._lastX=ie.clientX,this._lastY=ie.clientY,$r();for(var e=document.elementFromPoint(ie.clientX,ie.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(ie.clientX,ie.clientY),e!==t);)t=e;if(f.parentNode[$]._isOutsideThisEl(e),t)do{if(t[$]){var r=void 0;if(r=t[$]._onDragOver({clientX:ie.clientX,clientY:ie.clientY,target:e,rootEl:t}),r&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Gr()}},_onTouchMove:function(e){if(xe){var t=this.options,r=t.fallbackTolerance,i=t.fallbackOffset,o=e.touches?e.touches[0]:e,s=S&&De(S,!0),a=S&&s&&s.a,l=S&&s&&s.d,c=pt&&G&&Fr(G),u=(o.clientX-xe.clientX+i.x)/(a||1)+(c?c[0]-$t[0]:0)/(a||1),h=(o.clientY-xe.clientY+i.y)/(l||1)+(c?c[1]-$t[1]:0)/(l||1);if(!v.active&&!Fe){if(r&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))=0&&(Y({rootEl:k,name:"add",toEl:k,fromEl:A,originalEvent:e}),Y({sortable:this,name:"remove",toEl:k,originalEvent:e}),Y({rootEl:k,name:"sort",toEl:k,fromEl:A,originalEvent:e}),Y({sortable:this,name:"sort",toEl:k,originalEvent:e})),j&&j.save()):q!==Oe&&q>=0&&(Y({sortable:this,name:"update",toEl:k,originalEvent:e}),Y({sortable:this,name:"sort",toEl:k,originalEvent:e})),v.active&&((q==null||q===-1)&&(q=Oe,we=Ge),Y({sortable:this,name:"end",toEl:k,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){K("nulling",this),A=f=k=S=Ce=P=st=Se=xe=ie=Ye=q=we=Oe=Ge=Ne=Xe=j=at=v.dragged=v.ghost=v.clone=v.active=null,dt.forEach(function(e){e.checked=!0}),dt.length=Wt=jt=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":f&&(this._onDragOver(e),mi(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],t,r=this.el.children,i=0,o=r.length,s=this.options;ir.right+i||n.clientX<=r.right&&n.clientY>r.bottom&&n.clientX>=r.left:n.clientX>r.right&&n.clientY>r.top||n.clientX<=r.right&&n.clientY>r.bottom+i}function Ei(n,e,t,r,i,o,s,a){var l=r?n.clientY:n.clientX,c=r?t.height:t.width,u=r?t.top:t.left,h=r?t.bottom:t.right,d=!1;if(!s){if(a&&htu+c*o/2:lh-ht)return-Xe}else if(l>u+c*(1-i)/2&&lh-c*o/2)?l>u+c/2?1:-1:0}function Si(n){return B(f)1&&(E.forEach(function(a){o.addAnimationState({target:a,rect:z?M(a):s}),Bt(a),a.fromRect=s,r.removeAnimationState(a)}),z=!1,Ci(!this.options.removeCloneOnHide,i))},dragOverCompleted:function(t){var r=t.sortable,i=t.isOwner,o=t.insertion,s=t.activeSortable,a=t.parentEl,l=t.putSortable,c=this.options;if(o){if(i&&s._hideClone(),qe=!1,c.animation&&E.length>1&&(z||!i&&!s.options.sort&&!l)){var u=M(I,!1,!0,!0);E.forEach(function(d){d!==I&&(Pr(d,u),a.appendChild(d))}),z=!0}if(!i)if(z||Et(),E.length>1){var h=yt;s._showClone(r),s.options.animation&&!yt&&h&&Q.forEach(function(d){s.addAnimationState({target:d,rect:Qe}),d.fromRect=Qe,d.thisAnimationDuration=null})}else s._showClone(r)}},dragOverAnimationCapture:function(t){var r=t.dragRect,i=t.isOwner,o=t.activeSortable;if(E.forEach(function(a){a.thisAnimationDuration=null}),o.options.animation&&!i&&o.multiDrag.isMultiDrag){Qe=re({},r);var s=De(I,!0);Qe.top-=s.f,Qe.left-=s.e}},dragOverAnimationComplete:function(){z&&(z=!1,Et())},drop:function(t){var r=t.originalEvent,i=t.rootEl,o=t.parentEl,s=t.sortable,a=t.dispatchSortableEvent,l=t.oldIndex,c=t.putSortable,u=c||this.sortable;if(!!r){var h=this.options,d=o.children;if(!ke)if(h.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),L(I,h.selectedClass,!~E.indexOf(I)),~E.indexOf(I))E.splice(E.indexOf(I),1),Ue=null,$e({sortable:s,rootEl:i,name:"deselect",targetEl:I,originalEvt:r});else{if(E.push(I),$e({sortable:s,rootEl:i,name:"select",targetEl:I,originalEvt:r}),r.shiftKey&&Ue&&s.el.contains(Ue)){var p=B(Ue),g=B(I);if(~p&&~g&&p!==g){var b,C;for(g>p?(C=p,b=g):(C=g,b=p+1);C1){var O=M(I),_=B(I,":not(."+this.options.selectedClass+")");if(!qe&&h.animation&&(I.thisAnimationDuration=null),u.captureAnimationState(),!qe&&(h.animation&&(I.fromRect=O,E.forEach(function(D){if(D.thisAnimationDuration=null,D!==I){var J=z?M(D):O;D.fromRect=J,u.addAnimationState({target:D,rect:J})}})),Et(),E.forEach(function(D){d[_]?o.insertBefore(D,d[_]):o.appendChild(D),_++}),l===B(I))){var F=!1;E.forEach(function(D){if(D.sortableIndex!==B(D)){F=!0;return}}),F&&a("update")}E.forEach(function(D){Bt(D)}),u.animateAll()}oe=u}(i===o||c&&c.lastPutMode!=="clone")&&Q.forEach(function(D){D.parentNode&&D.parentNode.removeChild(D)})}},nullingGlobal:function(){this.isMultiDrag=ke=!1,Q.length=0},destroyGlobal:function(){this._deselectMultiDrag(),w(document,"pointerup",this._deselectMultiDrag),w(document,"mouseup",this._deselectMultiDrag),w(document,"touchend",this._deselectMultiDrag),w(document,"keydown",this._checkKeyDown),w(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(t){if(!(typeof ke!="undefined"&&ke)&&oe===this.sortable&&!(t&&ne(t.target,this.options.draggable,this.sortable.el,!1))&&!(t&&t.button!==0))for(;E.length;){var r=E[0];L(r,this.options.selectedClass,!1),E.shift(),$e({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:r,originalEvt:t})}},_checkKeyDown:function(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!0)},_checkKeyUp:function(t){t.key===this.options.multiDragKey&&(this.multiDragKeyDown=!1)}},re(n,{pluginName:"multiDrag",utils:{select:function(t){var r=t.parentNode[$];!r||!r.options.multiDrag||~E.indexOf(t)||(oe&&oe!==r&&(oe.multiDrag._deselectMultiDrag(),oe=r),L(t,r.options.selectedClass,!0),E.push(t))},deselect:function(t){var r=t.parentNode[$],i=E.indexOf(t);!r||!r.options.multiDrag||!~i||(L(t,r.options.selectedClass,!1),E.splice(i,1))}},eventProperties:function(){var t=this,r=[],i=[];return E.forEach(function(o){r.push({multiDragElement:o,index:o.sortableIndex});var s;z&&o!==I?s=-1:z?s=B(o,":not(."+t.options.selectedClass+")"):s=B(o),i.push({multiDragElement:o,index:s})}),{items:Qn(E),clones:[].concat(Q),oldIndicies:r,newIndicies:i}},optionListeners:{multiDragKey:function(t){return t=t.toLowerCase(),t==="ctrl"?t="Control":t.length>1&&(t=t.charAt(0).toUpperCase()+t.substr(1)),t}}})}function Ci(n,e){E.forEach(function(t,r){var i=e.children[t.sortableIndex+(n?Number(r):0)];i?e.insertBefore(t,i):e.appendChild(t)})}function Kr(n,e){Q.forEach(function(t,r){var i=e.children[t.sortableIndex+(n?Number(r):0)];i?e.insertBefore(t,i):e.appendChild(t)})}function Et(){E.forEach(function(n){n!==I&&n.parentNode&&n.parentNode.removeChild(n)})}v.mount(new Di);v.mount(Jt,Qt);var Ie=v;var Je=Tt(require("obsidian")),zr=new Intl.Collator(void 0,{usage:"sort",sensitivity:"base",numeric:!0}).compare;var Ur=i18next.t.bind(i18next),xi="up-and-down-arrows",_i={alphabetical:"plugins.file-explorer.label-sort-a-to-z",alphabeticalReverse:"plugins.file-explorer.label-sort-z-to-a",byModifiedTime:"plugins.file-explorer.label-sort-new-to-old",byModifiedTimeReverse:"plugins.file-explorer.label-sort-old-to-new",byCreatedTime:"plugins.file-explorer.label-sort-created-new-to-old",byCreatedTimeReverse:"plugins.file-explorer.label-sort-created-old-to-new",custom:"Custom"},Ii=[["alphabetical","alphabeticalReverse"],["byModifiedTime","byModifiedTimeReverse"],["byCreatedTime","byCreatedTimeReverse"],["custom"]],qr=function(n,e){let t=this.fileExplorer,r=this.file.children.slice();r.sort(function(i,o){let s,a;if(e&&((s=i instanceof Je.TFolder)||(a=o instanceof Je.TFolder)))return s&&!a?1:a&&!s?-1:zr(i.name,o.name);{if(!n)return zr(i.name,o.name);let l=n.indexOf(i.path),c=n.indexOf(o.path);return(l>-1?l:1/0)-(c>-1?c:1/0)}}),this.children=r.map(i=>t.fileItems[i.path]).filter(i=>i)},Qr=function(n,e){let t=this,r=this.addNavButton(xi,Ur("plugins.file-explorer.action-change-sort"),function(i){i.preventDefault();let o=new Je.Menu(t.app);for(let s=e(),a=0,l=Ii;a{r.setAttribute("data-sort-method",e())},100),this.addNavButton("three-horizontal-bars","Drag to rearrange",function(i){i.preventDefault();let o=!this.hasClass("is-active");this.toggleClass("is-active",o),t.app.workspace.trigger("file-explorer-draggable-change",o)}).addClass("drag-to-rearrange"),this.addNavButton("search","Filter items",function(i){var a,l;i.preventDefault();let o=!this.hasClass("is-active");this.toggleClass("is-active",o);let s=document.body.querySelector('.workspace-leaf-content[data-type="file-explorer"] .search-input-container > input');s&&!o?((a=s.parentElement)==null||a.hide(),s.value="",s.dispatchEvent(new Event("input"))):((l=s==null?void 0:s.parentElement)==null||l.show(),s==null||s.focus()),t.app.workspace.trigger("file-explorer-draggable-change",o)}),r};var Pe=Tt(require("obsidian")),Jr={statusBarOrder:[],ribbonBarOrder:[],fileExplorerOrder:{},actionBarOrder:{},autoHide:!1,autoHideDelay:2e3,dragDelay:200},Zt=class extends Pe.PluginSettingTab{constructor(e,t){super(e,t);this.plugin=t}hide(){}display(){let{containerEl:e}=this;e.empty(),new Pe.Setting(e).setName("Auto Collapse").setDesc("Automatically hide ribbon and status bar items once your mouse leaves the icon container").addToggle(t=>t.setValue(this.plugin.settings.autoHide).onChange(r=>{this.plugin.settings.autoHide=r,this.plugin.saveSettings()})),new Pe.Setting(e).setName("Auto Collapse Delay").setDesc("How long to wait before auto collapsing hidden icons on the ribbon and status bar").addText(t=>{t.setPlaceholder(String(2e3)),t.inputEl.type="number",t.setValue(String(this.plugin.settings.autoHideDelay)),t.onChange(r=>ye(this,null,function*(){this.plugin.settings.autoHideDelay=Number(r),this.plugin.saveSettings()}))}),new Pe.Setting(e).setName("Drag Start Delay (ms)").setDesc("How long to wait before triggering the drag behavior after clicking. \u26A0\uFE0F Requires an app restart.").addText(t=>{t.setPlaceholder(String(200)),t.inputEl.type="number",t.setValue(String(this.plugin.settings.dragDelay)),t.onChange(r=>ye(this,null,function*(){this.plugin.settings.dragDelay=Number(r),this.plugin.saveSettings()}))})}};function Zr(n,e){for(var t=[];n=n.previousSibling;)n.nodeType!==3&&(!e||e(n))&&t.push(n);return t}function en(n,e){for(var t=[];n=n.nextSibling;)n.nodeType!==3&&(!e||e(n))&&t.push(n);return t}function tn(n,e){var i,o;let t=(e==null?void 0:e.useClass)?Array.from(n.classList).filter(s=>!s.startsWith("is-")).sort().join(" "):"",r=((e==null?void 0:e.useTag)?n.tagName:"")+((e==null?void 0:e.useClass)?t:"")+((e==null?void 0:e.useText)?n.textContent:"")+((e==null?void 0:e.useAria)?n.getAttr("aria-label"):"")+((e==null?void 0:e.useIcon)?(o=(i=n.querySelector("svg"))==null?void 0:i.className)==null?void 0:o.baseVal:"");return Mi(r)}var Mi=function(n,e=0){let t=3735928559^e,r=1103547991^e;for(let i=0,o;i>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),4294967296*(2097151&r)+(t>>>0).toString()};function St(n,e,t,r=1){return n.splice(t,0,...n.splice(e,r)),n}var wt=n=>{let e=[];return n.reduce((t,r)=>(r.children?r.children.length&&(e=[...e,...r.children]):t.push(r),t),[]).concat(e.length?wt(e):e)},rn=(n,e="suggestion-highlight")=>{let t=(i,o,s)=>{let a=o.split("."),l;for(l=0;lo.reduce((a,[l,c])=>(a[l]=`${a[l]}`,a[c]=`${a[c]}`,a),i.split("")).join("");return n.filter(({matches:i})=>i&&i.length).map(({item:i,matches:o})=>{let s=he({},i);return o.forEach(a=>{var l;s.titleInnerEl.origContent||(s.titleInnerEl.origContent=s.titleInnerEl.textContent),t(s,"titleInnerEl.innerHTML",r(a.value,a.indices)),(l=s.titleInnerEl)==null||l.addClass("has-matches")}),s})};function nn(n){return typeof n=="string"||n instanceof String?n.replace(/.md$/,""):n}function on(n,e){var t=le.config.getFn(n,e);return Array.isArray(t)?t.map(r=>nn(r)):nn(t)}Ie.mount(new Vr);var Ai="body > div.app-container div.status-bar",Oi="body > div.app-container div.side-dock-actions",so=(x.Platform.isMobile,200),Ze=500,er=class extends x.Plugin{constructor(){super(...arguments);this.fileExplorerFilter=function(){var t,r,i;if(!!((t=this==null?void 0:this.rootEl)==null?void 0:t.fileExplorer))if(((r=this.filter)==null?void 0:r.length)>=1){this.filtered||(this.rootEl._children=this.rootEl.children,this.filtered=!0);let o={includeScore:!0,includeMatches:!0,useExtendedSearch:!0,getFn:on,threshold:.1,ignoreLocation:!0,keys:["file.path"]},s=wt(this.rootEl._children),a=new le(s,o),l=200,c=a.search(this.filter).slice(0,l);this.rootEl.children=rn(c)}else((i=this.filter)==null?void 0:i.length)<1&&this.filtered&&(this.rootEl._children&&(this.rootEl.children=this.rootEl._children),wt(this.rootEl._children).map(s=>{s.titleInnerEl.origContent&&(s.titleInnerEl.setText(s.titleInnerEl.origContent),delete s.titleInnerEl.origContent,s.titleInnerEl.removeClass("has-matches"))}),this.filtered=!1)}}onload(){return ye(this,null,function*(){yield this.loadSettings(),this.registerMonkeyPatches(),this.registerEventHandlers(),this.registerSettingsTab(),this.initialize()})}loadSettings(){return ye(this,null,function*(){this.settings=Object.assign({},Jr,yield this.loadData())})}saveSettings(){return ye(this,null,function*(){yield this.saveData(this.settings)})}patchFileExplorerFolder(){let e=this,t=this.app.workspace.getLeaf(),r=this.app.viewRegistry.viewByType["file-explorer"](t),i=new x.TFolder(x.Vault,""),o=r.createFolderDom(i).constructor;this.register(ge(o.prototype,{sort(s){return function(...a){let l=e.settings.fileExplorerOrder[this.file.path];return this.fileExplorer.sortOrder==="custom"?qr.call(this,l,...a):s.call(this,...a)}}}))}initialize(){this.app.workspace.onLayoutReady(()=>{this.patchFileExplorerFolder(),setTimeout(()=>{if(x.Platform.isDesktop){this.insertSeparator(Ai,"status-bar-item",!0,16),this.setStatusBarSorter();let e=this.app.workspace.leftSplit.children,t=this.app.workspace.rightSplit.children;e.concat(t).forEach(r=>{r.hasOwnProperty("tabsInnerEl")&&!r.iconSorter&&(r.iconSorter=this.setTabBarSorter(r.tabsInnerEl,r))})}this.setFileExplorerSorter(),this.insertSeparator(Oi,"side-dock-ribbon-action",!1,18),this.setRibbonBarSorter(),this.app.workspace.iterateRootLeaves(e=>{var t,r;((t=e==null?void 0:e.view)==null?void 0:t.hasOwnProperty("actionsEl"))&&!((r=e==null?void 0:e.view)==null?void 0:r.hasOwnProperty("iconSorter"))&&(e.view.iconSorter=this.setViewActionSorter(e.view.actionsEl,e.view))})},x.Platform.isMobile?3e3:400)})}registerSettingsTab(){this.settingsTab=new Zt(this.app,this),this.addSettingTab(this.settingsTab)}clearFileExplorerFilter(){let e=this.getFileExplorer(),t=document.body.querySelector('.workspace-leaf-content[data-type="file-explorer"] .search-input-container > input');t&&(t.value=""),e.dom.infinityScroll.filter="",e.dom.infinityScroll.compute()}registerEventHandlers(){this.registerEvent(this.app.workspace.on("file-explorer-draggable-change",e=>{this.toggleFileExplorerSorters(e)})),this.registerEvent(this.app.workspace.on("file-explorer-sort-change",e=>{e==="custom"?setTimeout(()=>{this.setFileExplorerSorter()},10):this.cleanupFileExplorerSorters()})),this.registerEvent(this.app.workspace.on("file-explorer-load",e=>{setTimeout(()=>{this.setFileExplorerSorter(e)},1e3)})),this.registerEvent(this.app.workspace.on("bartender-leaf-split",(e,t)=>{let r=t.tabsInnerEl;t.type==="tabs"&&t instanceof x.WorkspaceTabs&&this.setTabBarSorter(r,t)})),this.registerEvent(this.app.workspace.on("ribbon-bar-updated",()=>{setTimeout(()=>{this.settings.ribbonBarOrder&&this.ribbonBarSorter&&(this.setElementIDs(this.ribbonBarSorter.el,{useClass:!0,useAria:!0,useIcon:!0}),this.ribbonBarSorter.sort(this.settings.ribbonBarOrder))},0)})),this.registerEvent(this.app.workspace.on("status-bar-updated",()=>{setTimeout(()=>{this.settings.statusBarOrder&&this.statusBarSorter&&(this.setElementIDs(this.statusBarSorter.el,{useClass:!0,useIcon:!0}),this.statusBarSorter.sort(this.settings.statusBarOrder))},0)}))}registerMonkeyPatches(){let e=this;if(this.register(ge(this.app.viewRegistry.constructor.prototype,{registerView(t){return function(r,i,...o){return e.app.workspace.trigger("view-registered",r,i),t.call(this,r,i,...o)}}})),this.app.workspace.layoutReady){let t=this.getFileExplorer();this.patchFileExplorer(t)}else{let t=this.app.workspace.on("view-registered",(r,i)=>{if(r!=="file-explorer")return;this.app.workspace.offref(t);let o=new x.WorkspaceLeaf(e.app),s=i(o);this.patchFileExplorer(s)})}this.register(ge(x.View.prototype,{onunload(t){return function(...r){try{this.iconSorter&&(this.iconSorter.destroy(),this.iconSorter=null)}catch(i){}return t.call(this,...r)}},onload(t){return function(...r){return setTimeout(()=>{if(this.app.workspace.layoutReady)try{this.leaf.parentSplit instanceof x.WorkspaceTabs||this.hasOwnProperty("actionsEl")&&!this.iconSorter&&(this.iconSorter=e.setViewActionSorter(this.actionsEl,this))}catch(i){}},200),t.call(this,...r)}}})),x.Platform.isDesktop&&this.register(ge(HTMLDivElement.prototype,{addEventListener(t){return function(r,i,o){if(r==="mousedown"&&i instanceof Function&&this.hasClass("workspace-tab-header")){let a=i;i=l=>{l instanceof MouseEvent&&((l==null?void 0:l.altKey)||(l==null?void 0:l.metaKey))||a(l)}}return t.call(this,r,i,o)}}})),this.register(ge(x.Workspace.prototype,{splitLeaf(t){return function(r,i,o,s,...a){let l=t.call(this,r,i,o,s,...a);return this.trigger("bartender-leaf-split",r,i),l}},changeLayout(t){return function(r,...i){return ye(this,null,function*(){let o=yield t.call(this,r,...i);return this.trigger("bartender-workspace-change"),o})}}})),this.register(ge(x.Plugin.prototype,{addStatusBarItem(t){return function(...r){let i=t.call(this,...r);return this.app.workspace.trigger("status-bar-updated"),i}},addRibbonIcon(t){return function(...r){let i=t.call(this,...r);return this.app.workspace.trigger("ribbon-bar-updated"),i}}}))}patchFileExplorer(e){let t=this;if(e){let r=e.dom.infinityScroll.constructor;this.register(()=>this.clearFileExplorerFilter()),this.register(ge(r.prototype,{compute(i){return function(...o){try{this.scrollEl.hasClass("nav-files-container")&&t.fileExplorerFilter.call(this)}catch(a){}return i.call(this,...o)}}})),this.register(ge(e.headerDom.constructor.prototype,{addSortButton(i){return function(...o){var s,a,l;return((l=(a=(s=this.navHeaderEl)==null?void 0:s.parentElement)==null?void 0:a.dataset)==null?void 0:l.type)==="file-explorer"?(t.setFileExplorerFilter(this),Qr.call(this,...o)):i.call(this,...o)}}}))}}insertSeparator(e,t,r,i=16){document.body.querySelectorAll(e).forEach(s=>{let a=r?Zr:en;if(s){let l=s.createDiv(`${t} separator`);r&&s.prepend(l);let c=l.createDiv("glyph");(0,x.setIcon)(c,"plus-with-circle",i),l.addClass("is-collapsed"),this.register(()=>l.detach());let h;l.onClickEvent(d=>{l.hasClass("is-collapsed")?(Array.from(s.children).forEach(p=>p.removeClass("is-hidden")),l.removeClass("is-collapsed")):(a(l).forEach(p=>p.addClass("is-hidden")),l.addClass("is-collapsed"))}),s.onmouseenter=d=>{h&&clearTimeout(h)},s.onmouseleave=d=>{this.settings.autoHide&&(h=setTimeout(()=>{a(l).forEach(p=>p.addClass("is-hidden")),l.addClass("is-collapsed")},this.settings.autoHideDelay))},setTimeout(()=>{a(l).forEach(d=>d.addClass("is-hidden")),l.addClass("is-collapsed")},0)}})}setElementIDs(e,t){Array.from(e.children).forEach(r=>{r instanceof HTMLElement&&(r.getAttribute("data-id")||r.setAttribute("data-id",tn(r,t)))})}setTabBarSorter(e,t){return this.setElementIDs(e,{useClass:!0,useIcon:!0}),Ie.create(e,{group:"leftTabBar",dataIdAttr:"data-id",delay:x.Platform.isMobile?200:this.settings.dragDelay,dropBubble:!1,dragoverBubble:!1,animation:Ze,onChoose:()=>{var i;return(i=e.parentElement)==null?void 0:i.addClass("is-dragging")},onUnchoose:()=>{var i;return(i=e.parentElement)==null?void 0:i.removeClass("is-dragging")},onStart:()=>{var i;document.body.addClass("is-dragging"),(i=e.querySelector(".separator"))==null||i.removeClass("is-collapsed"),Array.from(e.children).forEach(o=>o.removeClass("is-hidden"))},onEnd:i=>{document.body.removeClass("is-dragging"),i.oldIndex!==void 0&&i.newIndex!==void 0&&(St(t.children,i.oldIndex,i.newIndex),t.currentTab=i.newIndex,t.recomputeChildrenDimensions()),this.app.workspace.requestSaveLayout()}})}setStatusBarSorter(){let e=document.body.querySelector("body > div.app-container > div.status-bar");e&&(this.setElementIDs(e,{useClass:!0,useAria:!0,useIcon:!0}),this.statusBarSorter=Ie.create(e,{group:"statusBar",dataIdAttr:"data-id",delay:x.Platform.isMobile?200:this.settings.dragDelay,animation:Ze,onChoose:()=>{Array.from(e.children).forEach(t=>t.removeClass("is-hidden"))},onStart:()=>{var t;(t=e.querySelector(".separator"))==null||t.removeClass("is-collapsed"),Array.from(e.children).forEach(r=>r.removeClass("is-hidden"))},store:{get:t=>this.settings.statusBarOrder,set:t=>{this.settings.statusBarOrder=t.toArray(),this.saveSettings()}}}))}setViewActionSorter(e,t){if(this.setElementIDs(e,{useClass:!0,useIcon:!0}),Object.values(e).find(s=>s==null?void 0:s.hasOwnProperty("nativeDraggable")))return;let i=(t==null?void 0:t.getViewType())||"unknown";return new Ie(e,{group:"actionBar",dataIdAttr:"data-id",delay:x.Platform.isMobile?200:this.settings.dragDelay,sort:!0,animation:Ze,onStart:()=>{var s;(s=e.querySelector(".separator"))==null||s.removeClass("is-collapsed"),Array.from(e.children).forEach(a=>a.removeClass("is-hidden"))},store:{get:()=>this.settings.actionBarOrder[i],set:s=>{this.settings.actionBarOrder[i]=s.toArray(),this.saveSettings()}}})}setRibbonBarSorter(){let e=document.body.querySelector("body > div.app-container div.side-dock-actions");e&&(this.setElementIDs(e,{useClass:!0,useAria:!0,useIcon:!0}),this.ribbonBarSorter=Ie.create(e,{group:"ribbonBar",dataIdAttr:"data-id",delay:x.Platform.isMobile?200:this.settings.dragDelay,animation:Ze,onChoose:()=>{Array.from(e.children).forEach(t=>t.removeClass("is-hidden"))},onStart:()=>{var t;(t=e.querySelector(".separator"))==null||t.removeClass("is-collapsed"),Array.from(e.children).forEach(r=>r.removeClass("is-hidden"))},store:{get:t=>this.settings.ribbonBarOrder,set:t=>{this.settings.ribbonBarOrder=t.toArray(),this.saveSettings()}}}))}setFileExplorerFilter(e){let t=e.navHeaderEl;if(t){let r=t.createDiv("search-input-container");t.insertAdjacentElement("afterend",r);let i=r.createEl("input");i.placeholder="Type to filter...",i.type="text",r.hide(),i.oninput=s=>{let a=this.getFileExplorer();s.target instanceof HTMLInputElement&&(s.target.value.length?o.show():o.hide(),a.dom.infinityScroll.filter=s.target.value),a.dom.infinityScroll.compute()};let o=r.createDiv("search-input-clear-button",function(s){s.addEventListener("click",function(){i.value="",o.hide(),i.focus(),i.dispatchEvent(new Event("input"))}),s.hide()})}}setFileExplorerSorter(e){var r;if(e||(e=this.getFileExplorer()),!e||e.sortOrder!=="custom"||e.hasCustomSorter)return;let t=this.getRootFolders(e);if(!(!t||!t.length))for(let i of t){let o=i==null?void 0:i.childrenEl;if(!o)continue;let s;e.hasCustomSorter=!0;let a=!!((r=document.body.querySelector("div.nav-action-button.drag-to-rearrange"))==null?void 0:r.hasClass("is-active"));i.sorter=Ie.create(o,{group:"fileExplorer"+i.file.path,multiDrag:!0,multiDragKey:"alt",delay:x.Platform.isMobile?200:this.settings.dragDelay,sort:a,animation:Ze,onStart:l=>{l.items.length?s=l.items:s=[l.item]},onMove:l=>{if(!i.children||!(s==null?void 0:s.length))return;let c=i.children.map(b=>b.el),u=l.related,h=c.indexOf(u),d=s.first(),p=c.indexOf(d),g=s.slice();p>h&&g.reverse();for(let b of g){let C=c.indexOf(b);i.children=St(i.children,C,h),c=St(c,C,h)}this.settings.fileExplorerOrder[i.file.path]=i.children.map(b=>b.file.path),this.saveSettings()},onEnd:l=>{var c;s=[],(c=document.querySelector("body>div.drag-ghost"))==null||c.detach()}})}}getFileExplorer(){var t,r;return(r=(t=this.app.workspace.getLeavesOfType("file-explorer"))==null?void 0:t.first())==null?void 0:r.view}getRootFolders(e){var i,o;if(e||(e=this.getFileExplorer()),!e)return;let t=(o=(i=e.dom)==null?void 0:i.infinityScroll)==null?void 0:o.rootEl;return t&&this.traverseRoots(t)}traverseRoots(e,t){t||(t=[e]);for(let r of e.children||[])r.children&&t.push(r),this.traverseRoots(r,t);return t}toggleFileExplorerSorters(e){let t=this.getFileExplorer(),r=this.getRootFolders(t);if(r==null?void 0:r.length)for(let i of r)i.sorter&&i.sorter.option("sort",e)}cleanupFileExplorerSorters(){let e=this.getFileExplorer(),t=this.getRootFolders(e);if(t==null?void 0:t.length)for(let r of t)r.sorter&&(r.sorter.destroy(),delete r.sorter,Object.keys(r.childrenEl).forEach(i=>i.startsWith("Sortable")&&delete r.childrenEl[i]),r.childrenEl.querySelectorAll("div.nav-file-title").forEach(i=>i.draggable=!0),r.childrenEl.querySelectorAll("div.nav-folder-title").forEach(i=>i.draggable=!0));delete e.hasCustomSorter}onunload(){var e,t;(e=this.statusBarSorter)==null||e.destroy(),(t=this.ribbonBarSorter)==null||t.destroy(),this.app.workspace.iterateAllLeaves(r=>{var o,s,a;let i;if((i=(r==null?void 0:r.iconSorter)?r:!1)||(i=((o=r==null?void 0:r.view)==null?void 0:o.iconSorter)?r.view:!1)||(i=(r==null?void 0:r.parentSplit)instanceof x.WorkspaceTabs&&((s=r==null?void 0:r.parentSplit)==null?void 0:s.iconSorter)?r==null?void 0:r.parentSplit:!1))try{(a=i.iconSorter)==null||a.destroy()}catch(l){}finally{delete i.iconSorter}}),this.cleanupFileExplorerSorters()}}; /**! * Sortable 1.14.0 * @author RubaXa * @author owenm * @license MIT */