/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var Pt=Object.defineProperty;var ar=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var rr=Object.prototype.hasOwnProperty;var lr=(t,e,a)=>e in t?Pt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var sr=(t,e)=>{for(var a in e)Pt(t,a,{get:e[a],enumerable:!0})},nr=(t,e,a,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of or(e))!rr.call(t,r)&&r!==a&&Pt(t,r,{get:()=>e[r],enumerable:!(o=ar(e,r))||o.enumerable});return t};var ur=t=>nr(Pt({},"__esModule",{value:!0}),t);var $=(t,e,a)=>(lr(t,typeof e!="symbol"?e+"":e,a),a);var Cl={};sr(Cl,{default:()=>da});module.exports=ur(Cl);var tr=require("obsidian");var dr=require("obsidian");var Ya="obsidian-vertical-tabs-view";var Bt=t=>{console.log(`[${Ya}]: ${t}`)};var Y=require("obsidian");var Za={left:"left",right:"right"},pa={TARGET:{directory:"directory",title:"title"},CONDITION:{startsWith:"starts with",endsWith:"ends with",includes:"includes",equals:"equals",regexp:"regexp"}},ma={matchConfig:{target:"title",condition:"startsWith",value:""},priority:1,icon:"file"};var Et=require("obsidian"),Ja=(t,e,a,o,r)=>new Et.Setting(t).setName(e).setDesc(a).addText(l=>l.setValue(o).onChange(r)),ze=(t,e,a,o,r)=>new Et.Setting(t).setName(e).setDesc(a).addToggle(l=>l.setValue(o).onChange(r)),Qa=(t,e,a,o,r,l)=>new Et.Setting(t).setName(e).setDesc(a).addDropdown(s=>{s.addOptions(o).setValue(r).onChange(l)});var eo={defaultPosition:"left",showDirectory:!0,showCloseIcon:!0,showPinnedIcon:!0,showPinIconIfNotPinned:!0,showTabIcon:!0,defaultTabIcon:"file",tabIconRules:[]},Ot=class extends Y.PluginSettingTab{constructor(a,o){super(a,o);this.plugin=o,this.settings=structuredClone(o.settings)}save(){this.plugin.saveSettings(this.settings)}display(){let{containerEl:a}=this;if(a.empty(),Qa(a,"Default position","Default position of vertical tabs view opened",Za,this.settings.defaultPosition,o=>{this.settings.defaultPosition=o,this.save()}),ze(a,"Show directory","",this.settings.showDirectory,o=>{this.settings.showDirectory=o,this.save()}),ze(a,"Show close icon","",this.settings.showCloseIcon,o=>{this.settings.showCloseIcon=o,this.save()}),ze(a,"Show pinned icon","",this.settings.showPinnedIcon,o=>{this.settings.showPinnedIcon=o,this.save()}),ze(a,"Show pin icon if not pinned","",this.settings.showPinIconIfNotPinned,o=>{this.settings.showPinIconIfNotPinned=o,this.save()}),ze(a,"Show tab icon","",this.settings.showTabIcon,o=>{this.settings.showTabIcon=o,this.save(),this.display()}),this.settings.showTabIcon){let{previewIconWrapper:o,previewIcon:r,previewIconText:l}=this.createPreviewIcon(this.settings.defaultTabIcon);Ja(a,"Default tab icon","If you clear this field, icon will be hidden by default.",this.settings.defaultTabIcon,i=>{this.settings.defaultTabIcon=i,this.save(),(0,Y.setIcon)(r,i),r.children.length===0?l.innerText="Not found.":l.innerText="Preview: "}).setDesc("See https://lucide.dev/icons for available icons.").controlEl.prepend(o),new Y.Setting(a).setName("Icon rules for override icon");let n=a.createEl("div");n.className="vertical-tabs-view-settings-tab-icon-rules",this.settings.tabIconRules.length===0&&this.settings.tabIconRules.push(structuredClone(ma)),this.settings.tabIconRules.forEach((i,d)=>{this.addTabIconRule(n,i,d)}),new Y.Setting(n).addButton(i=>{i.setButtonText("Add").onClick(async()=>{this.settings.tabIconRules.push(structuredClone(ma)),this.display()})}).setClass("vertical-tabs-view-settings-tab-icon-rules-add-btn")}}createPreviewIcon(a){let o=document.createElement("div");o.className="vertical-tabs-view-settings-tab-preview-icon-wrapper";let r=document.createElement("div");r.className="vertical-tabs-view-settings-tab-preview-icon-text",r.innerText="Preview: ";let l=document.createElement("div");return(0,Y.setIcon)(l,a),l.children.length===0?r.innerText="Icon not found":r.innerText="Preview: ",o.setChildrenInPlace([r,l]),{previewIconWrapper:o,previewIcon:l,previewIconText:r}}addTabIconRule(a,o,r){let l=a.createEl("div");l.className="vertical-tabs-view-settings-tab-icon-rule-wrapper";let s=l.createEl("div");s.className="vertical-tabs-view-settings-tab-icon-rule-match-config-wrapper",new Y.Setting(s).addDropdown(f=>{f.addOptions(pa.TARGET).setValue(o.matchConfig.target).onChange(async x=>{o.matchConfig.target=x,this.save()})}).setName("Match target"),new Y.Setting(s).addDropdown(f=>{f.addOptions(pa.CONDITION).setValue(o.matchConfig.condition).onChange(async x=>{o.matchConfig.condition=x,this.save()})}).setName("Match condition"),new Y.Setting(s).addText(f=>{f.setValue(o.matchConfig.value).onChange(x=>{o.matchConfig.value=x,this.save()})}).setName("Match value").setDesc("For regexp, write like: /foo/i"),new Y.Setting(s).addSlider(f=>{f.setLimits(1,100,1).setValue(o.priority).onChange(x=>{o.priority=x,this.save()}).setDynamicTooltip()}).setName("Priority").setDesc("If there are multiple configs with the same priority, the one defined first will be prioritized.");let{previewIconWrapper:n,previewIcon:u,previewIconText:i}=this.createPreviewIcon(o.icon);new Y.Setting(s).addText(f=>{f.setValue(o.icon).onChange(x=>{o.icon=x,this.save(),(0,Y.setIcon)(u,x),u.children.length===0?i.innerText="Icon not found":i.innerText="Preview: "})}).setName("Icon").setDesc("See https://lucide.dev/icons for available icons.").controlEl.prepend(n);let c=l.createEl("div");c.className="vertical-tabs-view-settings-tab-icon-rule-remove-btn-wrapper";let h=c.createEl("button");h.setText("Remove"),h.onclick=()=>{this.settings.tabIconRules.splice(r,1),this.save(),this.display()}}};var Qo=require("obsidian");var ha=async(t,e)=>{t.workspace.setActiveLeaf(e,{focus:!0})},to=async(t,e)=>{let a=t.workspace.getLeafById(e);if(a)return await ha(t,a),a};function ce(){}function Z(t,e){for(let a in e)t[a]=e[a];return t}function ga(t){return t()}function Mt(){return Object.create(null)}function te(t){t.forEach(ga)}function dt(t){return typeof t=="function"}function pe(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function ao(t){return Object.keys(t).length===0}function Xe(t,e,a,o){if(t){let r=oo(t,e,a,o);return t[0](r)}}function oo(t,e,a,o){return t[1]&&o?Z(a.ctx.slice(),t[1](o(e))):a.ctx}function je(t,e,a,o){if(t[2]&&o){let r=t[2](o(a));if(e.dirty===void 0)return r;if(typeof r=="object"){let l=[],s=Math.max(e.dirty.length,r.length);for(let n=0;n32){let e=[],a=t.ctx.length/32;for(let o=0;o{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(a=>{var o;for(let r of a)Ze.entries.set(r.target,r),(o=this._listeners.get(r.target))==null||o(r)})}};Ze.entries="WeakMap"in La?new WeakMap:void 0;var Rt=!1;function ro(){Rt=!0}function lo(){Rt=!1}function pr(t,e,a,o){for(;t>1);a(r)<=o?t=r+1:e=r}return t}function mr(t){if(t.hydrate_init)return;t.hydrate_init=!0;let e=t.childNodes;if(t.nodeName==="HEAD"){let u=[];for(let i=0;i0&&e[a[r]].claim_order<=i?r+1:pr(1,r,h=>e[a[h]].claim_order,i))-1;o[u]=a[d]+1;let c=d+1;a[c]=u,r=Math.max(c,r)}let l=[],s=[],n=e.length-1;for(let u=a[r]+1;u!=0;u=o[u-1]){for(l.push(e[u-1]);n>=u;n--)s.push(e[n]);n--}for(;n>=0;n--)s.push(e[n]);l.reverse(),s.sort((u,i)=>u.claim_order-i.claim_order);for(let u=0,i=0;u=l[i].claim_order;)i++;let d=it.removeEventListener(e,a,o)}function U(t,e,a){a==null?t.removeAttribute(e):t.getAttribute(e)!==a&&t.setAttribute(e,a)}function mt(t,e){for(let a in e)U(t,a,e[a])}function ht(t){return Array.from(t.childNodes)}function gr(t){t.claim_info===void 0&&(t.claim_info={last_index:0,total_claimed:0})}function xr(t,e,a,o,r=!1){gr(t);let l=(()=>{for(let s=t.claim_info.last_index;s=0;s--){let n=t[s];if(e(n)){let u=a(n);return u===void 0?t.splice(s,1):t[s]=u,r?u===void 0&&t.claim_info.last_index--:t.claim_info.last_index=s,n}}return o()})();return l.claim_order=t.claim_info.total_claimed,t.claim_info.total_claimed+=1,l}function Lr(t,e,a,o){return xr(t,r=>r.nodeName===e,r=>{let l=[];for(let s=0;sr.removeAttribute(s))},()=>o(e))}function Ia(t,e,a){return Lr(t,e,a,Nt)}function Ca(t,e){e=""+e,t.data!==e&&(t.data=e)}function ba(t,e,a){t.classList.toggle(e,!!a)}function uo(t){let e={};return t.childNodes.forEach(a=>{e[a.slot||"default"]=!0}),e}var Fe;function we(t){Fe=t}function fo(){if(!Fe)throw new Error("Function called outside component initialization");return Fe}function Sa(t){fo().$$.on_mount.push(t)}var He=[];var qt=[],et=[],co=[],vr=Promise.resolve(),va=!1;function po(){va||(va=!0,vr.then(Vt))}function gt(t){et.push(t)}var wa=new Set,Qe=0;function Vt(){if(Qe!==0)return;let t=Fe;do{try{for(;Qet.indexOf(o)===-1?e.push(o):a.push(o)),a.forEach(o=>o()),et=e}var $t=new Set,Ne;function xt(){Ne={r:0,c:[],p:Ne}}function Lt(){Ne.r||te(Ne.c),Ne=Ne.p}function A(t,e){t&&t.i&&($t.delete(t),t.i(e))}function H(t,e,a,o){if(t&&t.o){if($t.has(t))return;$t.add(t),Ne.c.push(()=>{$t.delete(t),o&&(a&&t.d(1),o())}),t.o(e)}else o&&o()}function Ae(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function qe(t,e){let a={},o={},r={$$scope:1},l=t.length;for(;l--;){let s=t[l],n=e[l];if(n){for(let u in s)u in n||(o[u]=1);for(let u in n)r[u]||(a[u]=n[u],r[u]=1);t[l]=n}else for(let u in s)r[u]=1}for(let s in o)s in a||(a[s]=void 0);return a}function Gt(t){return typeof t=="object"&&t!==null?t:{}}var yr=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],kr=new Set([...yr]);function Pe(t){t&&t.c()}function Wt(t,e){t&&t.l(e)}function ve(t,e,a){let{fragment:o,after_update:r}=t.$$;o&&o.m(e,a),gt(()=>{let l=t.$$.on_mount.map(ga).filter(dt);t.$$.on_destroy?t.$$.on_destroy.push(...l):te(l),t.$$.on_mount=[]}),r.forEach(gt)}function _e(t,e){let a=t.$$;a.fragment!==null&&(mo(a.after_update),te(a.on_destroy),a.fragment&&a.fragment.d(e),a.on_destroy=a.fragment=null,a.ctx=[])}function Tr(t,e){t.$$.dirty[0]===-1&&(He.push(t),po(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{let x=f.length?f[0]:h;return i.ctx&&r(i.ctx[c],i.ctx[c]=x)&&(!i.skip_bound&&i.bound[c]&&i.bound[c](x),d&&Tr(t,c)),h}):[],i.update(),d=!0,te(i.before_update),i.fragment=o?o(i.ctx):!1,e.target){if(e.hydrate){ro();let c=ht(e.target);i.fragment&&i.fragment.l(c),c.forEach(R)}else i.fragment&&i.fragment.c();e.intro&&A(t.$$.fragment),ve(t,e.target,e.anchor),lo(),Vt()}we(u)}var Fr;typeof HTMLElement=="function"&&(Fr=class extends HTMLElement{constructor(e,a,o){super();$(this,"$$ctor");$(this,"$$s");$(this,"$$c");$(this,"$$cn",!1);$(this,"$$d",{});$(this,"$$r",!1);$(this,"$$p_d",{});$(this,"$$l",{});$(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=a,o&&this.attachShadow({mode:"open"})}addEventListener(e,a,o){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(a),this.$$c){let r=this.$$c.$on(e,a);this.$$l_u.set(a,r)}super.addEventListener(e,a,o)}removeEventListener(e,a,o){if(super.removeEventListener(e,a,o),this.$$c){let r=this.$$l_u.get(a);r&&(r(),this.$$l_u.delete(a))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(l){return()=>{let s;return{c:function(){s=z("slot"),l!=="default"&&U(s,"name",l)},m:function(i,d){ue(i,s,d)},d:function(i){i&&R(s)}}}};if(await Promise.resolve(),!this.$$cn)return;let a={},o=uo(this);for(let l of this.$$s)l in o&&(a[l]=[e(l)]);for(let l of this.attributes){let s=this.$$g_p(l.name);s in this.$$d||(this.$$d[s]=_a(s,l.value,this.$$p_d,"toProp"))}this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:a,$$scope:{ctx:[]}}});let r=()=>{this.$$r=!0;for(let l in this.$$p_d)if(this.$$d[l]=this.$$c.$$.ctx[this.$$c.$$.props[l]],this.$$p_d[l].reflect){let s=_a(l,this.$$d[l],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,s)}this.$$r=!1};this.$$c.$$.after_update.push(r),r();for(let l in this.$$l)for(let s of this.$$l[l]){let n=this.$$c.$on(l,s);this.$$l_u.set(s,n)}this.$$l={}}}attributeChangedCallback(e,a,o){var r;this.$$r||(e=this.$$g_p(e),this.$$d[e]=_a(e,o,this.$$p_d,"toProp"),(r=this.$$c)==null||r.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{this.$$cn||(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(a=>this.$$p_d[a].attribute===e||!this.$$p_d[a].attribute&&a.toLowerCase()===e)||e}});function _a(t,e,a,o){var l;let r=(l=a[t])==null?void 0:l.type;if(e=r==="Boolean"&&typeof e!="boolean"?e!=null:e,!o||!a[t])return e;if(o==="toAttribute")switch(r){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(r){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var me=class{constructor(){$(this,"$$");$(this,"$$set")}$destroy(){_e(this,1),this.$destroy=ce}$on(e,a){if(!dt(a))return ce;let o=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return o.push(a),()=>{let r=o.indexOf(a);r!==-1&&o.splice(r,1)}}$set(e){this.$$set&&!ao(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};var ho="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ho);function It(t,e,a,o){function r(l){return l instanceof a?l:new a(function(s){s(l)})}return new(a||(a=Promise))(function(l,s){function n(d){try{i(o.next(d))}catch(c){s(c)}}function u(d){try{i(o.throw(d))}catch(c){s(c)}}function i(d){d.done?l(d.value):r(d.value).then(n,u)}i((o=o.apply(t,e||[])).next())})}var ge=require("obsidian");function go(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),a.push.apply(a,o)}return a}function be(t){for(var e=1;e=0)&&(a[r]=t[r]);return a}function Br(t,e){if(t==null)return{};var a=Pr(t,e),o,r;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(a[o]=t[o])}return a}var Er="1.15.0";function ye(t){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var De=ye(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Dt=ye(/Edge/i),xo=ye(/firefox/i),wt=ye(/safari/i)&&!ye(/chrome/i)&&!ye(/android/i),_o=ye(/iP(ad|od|hone)/i),yo=ye(/chrome/i)&&ye(/android/i),ko={capture:!1,passive:!1};function k(t,e,a){t.addEventListener(e,a,!De&&ko)}function _(t,e,a){t.removeEventListener(e,a,!De&&ko)}function ta(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch(a){return!1}return!1}}function Or(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Ie(t,e,a,o){if(t){a=a||document;do{if(e!=null&&(e[0]===">"?t.parentNode===a&&ta(t,e):ta(t,e))||o&&t===a)return t;if(t===a)break}while(t=Or(t))}return null}var Lo=/\s+/g;function ae(t,e,a){if(t&&e)if(t.classList)t.classList[a?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Lo," ").replace(" "+e+" "," ");t.className=(o+(a?" "+e:"")).replace(Lo," ")}}function b(t,e,a){var o=t&&t.style;if(o){if(a===void 0)return document.defaultView&&document.defaultView.getComputedStyle?a=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(a=t.currentStyle),e===void 0?a:a[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=a+(typeof a=="string"?"":"px")}}function lt(t,e){var a="";if(typeof t=="string")a=t;else do{var o=b(t,"transform");o&&o!=="none"&&(a=o+" "+a)}while(!e&&(t=t.parentNode));var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(a)}function Do(t,e,a){if(t){var o=t.getElementsByTagName(e),r=0,l=o.length;if(a)for(;r=l:s=r<=l,!s)return o;if(o===Ce())break;o=Me(o,!1)}return!1}function st(t,e,a,o){for(var r=0,l=0,s=t.children;l2&&arguments[2]!==void 0?arguments[2]:{},r=o.evt,l=Br(o,$r);Tt.pluginEvent.bind(S)(e,a,be({dragEl:m,parentEl:O,ghostEl:w,rootEl:P,nextEl:Ge,lastDownEl:Zt,cloneEl:E,cloneHidden:Oe,dragStarted:Ct,putSortable:W,activeSortable:S.active,originalEvent:r,oldIndex:rt,oldDraggableIndex:_t,newIndex:oe,newDraggableIndex:Ee,hideGhostForTarget:Oo,unhideGhostForTarget:Mo,cloneNowHidden:function(){Oe=!0},cloneNowShown:function(){Oe=!1},dispatchSortableEvent:function(n){j({sortable:a,name:n,originalEvent:r})}},l))};function j(t){Vr(be({putSortable:W,cloneEl:E,targetEl:m,rootEl:P,oldIndex:rt,oldDraggableIndex:_t,newIndex:oe,newDraggableIndex:Ee},t))}var m,O,w,P,Ge,Zt,E,Oe,rt,oe,_t,Ee,zt,W,ot=!1,aa=!1,oa=[],Ve,he,Da,Ta,bo,So,Ct,at,yt,kt=!1,Xt=!1,Jt,X,Fa=[],Oa=!1,ra=[],sa=typeof document!="undefined",jt=_o,wo=Dt||De?"cssFloat":"float",Gr=sa&&!yo&&!_o&&"draggable"in document.createElement("div"),Po=function(){if(sa){if(De)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Bo=function(e,a){var o=b(e),r=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),l=st(e,0,a),s=st(e,1,a),n=l&&b(l),u=s&&b(s),i=n&&parseInt(n.marginLeft)+parseInt(n.marginRight)+q(l).width,d=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+q(s).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(l&&n.float&&n.float!=="none"){var c=n.float==="left"?"left":"right";return s&&(u.clear==="both"||u.clear===c)?"vertical":"horizontal"}return l&&(n.display==="block"||n.display==="flex"||n.display==="table"||n.display==="grid"||i>=r&&o[wo]==="none"||s&&o[wo]==="none"&&i+d>r)?"vertical":"horizontal"},Wr=function(e,a,o){var r=o?e.left:e.top,l=o?e.right:e.bottom,s=o?e.width:e.height,n=o?a.left:a.top,u=o?a.right:a.bottom,i=o?a.width:a.height;return r===n||l===u||r+s/2===n+i/2},zr=function(e,a){var o;return oa.some(function(r){var l=r[re].options.emptyInsertThreshold;if(!(!l||Ha(r))){var s=q(r),n=e>=s.left-l&&e<=s.right+l,u=a>=s.top-l&&a<=s.bottom+l;if(n&&u)return o=r}}),o},Eo=function(e){function a(l,s){return function(n,u,i,d){var c=n.options.group.name&&u.options.group.name&&n.options.group.name===u.options.group.name;if(l==null&&(s||c))return!0;if(l==null||l===!1)return!1;if(s&&l==="clone")return l;if(typeof l=="function")return a(l(n,u,i,d),s)(n,u,i,d);var h=(s?n:u).options.group.name;return l===!0||typeof l=="string"&&l===h||l.join&&l.indexOf(h)>-1}}var o={},r=e.group;(!r||Yt(r)!="object")&&(r={name:r}),o.name=r.name,o.checkPull=a(r.pull,!0),o.checkPut=a(r.put),o.revertClone=r.revertClone,e.group=o},Oo=function(){!Po&&w&&b(w,"display","none")},Mo=function(){!Po&&w&&b(w,"display","")};sa&&!yo&&document.addEventListener("click",function(t){if(aa)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),aa=!1,!1},!0);var $e=function(e){if(m){e=e.touches?e.touches[0]:e;var a=zr(e.clientX,e.clientY);if(a){var o={};for(var r in e)e.hasOwnProperty(r)&&(o[r]=e[r]);o.target=o.rootEl=a,o.preventDefault=void 0,o.stopPropagation=void 0,a[re]._onDragOver(o)}}},Xr=function(e){m&&m.parentNode[re]._isOutsideThisEl(e.target)};function S(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=ke({},e),t[re]=this;var a={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Bo(t,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,n){s.setData("Text",n.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:S.supportPointer!==!1&&"PointerEvent"in window&&!wt,emptyInsertThreshold:5};Tt.initializePlugins(this,t,a);for(var o in a)!(o in e)&&(e[o]=a[o]);Eo(e);for(var r in this)r.charAt(0)==="_"&&typeof this[r]=="function"&&(this[r]=this[r].bind(this));this.nativeDraggable=e.forceFallback?!1:Gr,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?k(t,"pointerdown",this._onTapStart):(k(t,"mousedown",this._onTapStart),k(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(k(t,"dragover",this),k(t,"dragenter",this)),oa.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),ke(this,Hr())}S.prototype={constructor:S,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(at=null)},_getDirection:function(e,a){return typeof this.options.direction=="function"?this.options.direction.call(this,e,a,m):this.options.direction},_onTapStart:function(e){if(e.cancelable){var a=this,o=this.el,r=this.options,l=r.preventOnFilter,s=e.type,n=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,u=(n||e).target,i=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||u,d=r.filter;if(tl(o),!m&&!(/mousedown|pointerdown/.test(s)&&e.button!==0||r.disabled)&&!i.isContentEditable&&!(!this.nativeDraggable&&wt&&u&&u.tagName.toUpperCase()==="SELECT")&&(u=Ie(u,r.draggable,o,!1),!(u&&u.animated)&&Zt!==u)){if(rt=ie(u),_t=ie(u,r.draggable),typeof d=="function"){if(d.call(this,e,u,this)){j({sortable:a,rootEl:i,name:"filter",targetEl:u,toEl:o,fromEl:o}),Q("filter",a,{evt:e}),l&&e.cancelable&&e.preventDefault();return}}else if(d&&(d=d.split(",").some(function(c){if(c=Ie(i,c.trim(),o,!1),c)return j({sortable:a,rootEl:c,name:"filter",targetEl:u,fromEl:o,toEl:o}),Q("filter",a,{evt:e}),!0}),d)){l&&e.cancelable&&e.preventDefault();return}r.handle&&!Ie(i,r.handle,o,!1)||this._prepareDragStart(e,n,u)}}},_prepareDragStart:function(e,a,o){var r=this,l=r.el,s=r.options,n=l.ownerDocument,u;if(o&&!m&&o.parentNode===l){var i=q(o);if(P=l,m=o,O=m.parentNode,Ge=m.nextSibling,Zt=o,zt=s.group,S.dragged=m,Ve={target:m,clientX:(a||e).clientX,clientY:(a||e).clientY},bo=Ve.clientX-i.left,So=Ve.clientY-i.top,this._lastX=(a||e).clientX,this._lastY=(a||e).clientY,m.style["will-change"]="all",u=function(){if(Q("delayEnded",r,{evt:e}),S.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!xo&&r.nativeDraggable&&(m.draggable=!0),r._triggerDragStart(e,a),j({sortable:r,name:"choose",originalEvent:e}),ae(m,s.chosenClass,!0)},s.ignore.split(",").forEach(function(d){Do(m,d.trim(),Aa)}),k(n,"dragover",$e),k(n,"mousemove",$e),k(n,"touchmove",$e),k(n,"mouseup",r._onDrop),k(n,"touchend",r._onDrop),k(n,"touchcancel",r._onDrop),xo&&this.nativeDraggable&&(this.options.touchStartThreshold=4,m.draggable=!0),Q("delayStart",this,{evt:e}),s.delay&&(!s.delayOnTouchOnly||a)&&(!this.nativeDraggable||!(Dt||De))){if(S.eventCanceled){this._onDrop();return}k(n,"mouseup",r._disableDelayedDrag),k(n,"touchend",r._disableDelayedDrag),k(n,"touchcancel",r._disableDelayedDrag),k(n,"mousemove",r._delayedDragTouchMoveHandler),k(n,"touchmove",r._delayedDragTouchMoveHandler),s.supportPointer&&k(n,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(u,s.delay)}else u()}},_delayedDragTouchMoveHandler:function(e){var a=e.touches?e.touches[0]:e;Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){m&&Aa(m),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;_(e,"mouseup",this._disableDelayedDrag),_(e,"touchend",this._disableDelayedDrag),_(e,"touchcancel",this._disableDelayedDrag),_(e,"mousemove",this._delayedDragTouchMoveHandler),_(e,"touchmove",this._delayedDragTouchMoveHandler),_(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,a){a=a||e.pointerType=="touch"&&e,!this.nativeDraggable||a?this.options.supportPointer?k(document,"pointermove",this._onTouchMove):a?k(document,"touchmove",this._onTouchMove):k(document,"mousemove",this._onTouchMove):(k(m,"dragend",this),k(P,"dragstart",this._onDragStart));try{document.selection?Qt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(o){}},_dragStarted:function(e,a){if(ot=!1,P&&m){Q("dragStarted",this,{evt:a}),this.nativeDraggable&&k(document,"dragover",Xr);var o=this.options;!e&&ae(m,o.dragClass,!1),ae(m,o.ghostClass,!0),S.active=this,e&&this._appendGhost(),j({sortable:this,name:"start",originalEvent:a})}else this._nulling()},_emulateDragOver:function(){if(he){this._lastX=he.clientX,this._lastY=he.clientY,Oo();for(var e=document.elementFromPoint(he.clientX,he.clientY),a=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(he.clientX,he.clientY),e!==a);)a=e;if(m.parentNode[re]._isOutsideThisEl(e),a)do{if(a[re]){var o=void 0;if(o=a[re]._onDragOver({clientX:he.clientX,clientY:he.clientY,target:e,rootEl:a}),o&&!this.options.dragoverBubble)break}e=a}while(a=a.parentNode);Mo()}},_onTouchMove:function(e){if(Ve){var a=this.options,o=a.fallbackTolerance,r=a.fallbackOffset,l=e.touches?e.touches[0]:e,s=w&<(w,!0),n=w&&s&&s.a,u=w&&s&&s.d,i=jt&&X&&Co(X),d=(l.clientX-Ve.clientX+r.x)/(n||1)+(i?i[0]-Fa[0]:0)/(n||1),c=(l.clientY-Ve.clientY+r.y)/(u||1)+(i?i[1]-Fa[1]:0)/(u||1);if(!S.active&&!ot){if(o&&Math.max(Math.abs(l.clientX-this._lastX),Math.abs(l.clientY-this._lastY))=0&&(j({rootEl:O,name:"add",toEl:O,fromEl:P,originalEvent:e}),j({sortable:this,name:"remove",toEl:O,originalEvent:e}),j({rootEl:O,name:"sort",toEl:O,fromEl:P,originalEvent:e}),j({sortable:this,name:"sort",toEl:O,originalEvent:e})),W&&W.save()):oe!==rt&&oe>=0&&(j({sortable:this,name:"update",toEl:O,originalEvent:e}),j({sortable:this,name:"sort",toEl:O,originalEvent:e})),S.active&&((oe==null||oe===-1)&&(oe=rt,Ee=_t),j({sortable:this,name:"end",toEl:O,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){Q("nulling",this),P=m=O=w=Ge=E=Zt=Oe=Ve=he=Ct=oe=Ee=rt=_t=at=yt=W=zt=S.dragged=S.ghost=S.clone=S.active=null,ra.forEach(function(e){e.checked=!0}),ra.length=Da=Ta=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":m&&(this._onDragOver(e),jr(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],a,o=this.el.children,r=0,l=o.length,s=this.options;ro.right+r||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+r}function Jr(t,e,a,o,r,l,s,n){var u=o?t.clientY:t.clientX,i=o?a.height:a.width,d=o?a.top:a.left,c=o?a.bottom:a.right,h=!1;if(!s){if(n&&Jtd+i*l/2:uc-Jt)return-yt}else if(u>d+i*(1-r)/2&&uc-i*l/2)?u>d+i/2?1:-1:0}function Qr(t){return ie(m){a(7,e=Z(Z({},e),Se(f))),a(6,r=xa(e,o)),"name"in f&&a(0,n=f.name),"color"in f&&a(1,u=f.color),"size"in f&&a(2,i=f.size),"strokeWidth"in f&&a(3,d=f.strokeWidth),"absoluteStrokeWidth"in f&&a(4,c=f.absoluteStrokeWidth),"iconNode"in f&&a(5,h=f.iconNode),"$$scope"in f&&a(8,s=f.$$scope)},e=Se(e),[n,u,i,d,c,h,r,e,s,l]}var Ga=class extends me{constructor(e){super(),Be(this,e,rl,ol,pe,{name:0,color:1,size:2,strokeWidth:3,absoluteStrokeWidth:4,iconNode:5})}},na=Ga;function ll(t){let e,a=t[2].default,o=Xe(a,t,t[3],null);return{c(){o&&o.c()},l(r){o&&o.l(r)},m(r,l){o&&o.m(r,l),e=!0},p(r,l){o&&o.p&&(!e||l&8)&&Ke(o,a,r,r[3],e?je(a,r[3],l,null):Ye(r[3]),null)},i(r){e||(A(o,r),e=!0)},o(r){H(o,r),e=!1},d(r){o&&o.d(r)}}}function sl(t){let e,a,o=[{name:"pin"},t[1],{iconNode:t[0]}],r={$$slots:{default:[ll]},$$scope:{ctx:t}};for(let l=0;l{a(1,e=Z(Z({},e),Se(s))),"$$scope"in s&&a(3,r=s.$$scope)},e=Se(e),[l,e,o,r]}var Wa=class extends me{constructor(e){super(),Be(this,e,nl,sl,pe,{})}},nt=Wa;function ul(t){let e,a=t[2].default,o=Xe(a,t,t[3],null);return{c(){o&&o.c()},l(r){o&&o.l(r)},m(r,l){o&&o.m(r,l),e=!0},p(r,l){o&&o.p&&(!e||l&8)&&Ke(o,a,r,r[3],e?je(a,r[3],l,null):Ye(r[3]),null)},i(r){e||(A(o,r),e=!0)},o(r){H(o,r),e=!1},d(r){o&&o.d(r)}}}function il(t){let e,a,o=[{name:"x"},t[1],{iconNode:t[0]}],r={$$slots:{default:[ul]},$$scope:{ctx:t}};for(let l=0;l{a(1,e=Z(Z({},e),Se(s))),"$$scope"in s&&a(3,r=s.$$scope)},e=Se(e),[l,e,o,r]}var za=class extends me{constructor(e){super(),Be(this,e,dl,il,pe,{})}},Ft=za;var ut=[];function ua(t,e=ce){let a,o=new Set;function r(n){if(pe(t,n)&&(t=n,a)){let u=!ut.length;for(let i of o)i[1](),ut.push(i,t);if(u){for(let i=0;i{o.delete(i),o.size===0&&a&&(a(),a=null)}}return{set:r,update:l,subscribe:s}}var fl=ua(),cl=ua([]),pl=ua(),ee={plugin:fl,leaves:cl,activeLeafId:pl};var qo=(t,e,a,o)=>{let r=s=>{if(o[s])return o[s];let[n,u,i]=s.split("/"),d=new RegExp(u,i);return o[s]=d,d},l=(s,n)=>{if(s.matchConfig.condition==="startsWith"&&n.startsWith(s.matchConfig.value)||s.matchConfig.condition==="endsWith"&&n.endsWith(s.matchConfig.value)||s.matchConfig.condition==="includes"&&n.includes(s.matchConfig.value)||s.matchConfig.condition==="equals"&&n===s.matchConfig.value||s.matchConfig.condition==="regexp"&&r(s.matchConfig.value).test(n))return!0};return t.find(s=>{if(s.matchConfig.target==="directory")return l(s,e);if(s.matchConfig.target==="title")return l(s,a)})};var Vo=(t,e)=>t.vault.getAbstractFileByPath(e),Xa=async(t,e,a)=>{let o=Vo(t,e);if(o)return await t.vault.trash(o,a)},$o=async(t,e)=>{let a=Vo(t,e);if(a)return await t.vault.delete(a)};function ml(t){so(t,"svelte-fthq2i",":root{--ctx-menu-font-size:0.9rem;--ctx-menu-margin:0.25rem 0;--ctx-menu-padding:0;--ctx-menu-item-padding:0 0.5rem;--ctx-menu-divider-margin:0.2rem 0}")}function Go(t,e,a){let o=t.slice();return o[35]=e[a],o}function Wo(t){let e,a,o,r,l;a=new Ft({props:{size:18,strokeWidth:2}});function s(...n){return t[15](t[35],...n)}return{c(){e=z("div"),Pe(a.$$.fragment),U(e,"class","vertical-tabs-view-list-item-close-btn vertical-tabs-view-list-item-icon")},m(n,u){ue(n,e,u),ve(a,e,null),o=!0,r||(l=Ue(e,"click",s),r=!0)},p(n,u){t=n},i(n){o||(A(a.$$.fragment,n),o=!0)},o(n){H(a.$$.fragment,n),o=!1},d(n){n&&R(e),_e(a),r=!1,l()}}}function zo(t){let e;return{c(){e=z("div"),U(e,"class","vertical-tabs-view-list-item-tab-icon vertical-tabs-view-list-item-icon")},m(a,o){ue(a,e,o)},d(a){a&&R(e)}}}function Xo(t){let e,a=t[4](t[35])+"",o;return{c(){e=z("span"),o=ct(a),U(e,"class","vertical-tabs-view-list-item-dirname")},m(r,l){ue(r,e,l),J(e,o)},p(r,l){l[0]&1&&a!==(a=r[4](r[35])+"")&&Ca(o,a)},d(r){r&&R(e)}}}function hl(t){let e,a,o,r,l;a=new nt({props:{size:20}});function s(...n){return t[17](t[35],...n)}return{c(){e=z("div"),Pe(a.$$.fragment),U(e,"class","vertical-tabs-view-list-item-icon vertical-tabs-view-list-item-icon-pinned vertical-tabs-view-list-item-pin-btn vertical-tabs-view-list-item-pin-btn-pin")},m(n,u){ue(n,e,u),ve(a,e,null),o=!0,r||(l=Ue(e,"click",s),r=!0)},p(n,u){t=n},i(n){o||(A(a.$$.fragment,n),o=!0)},o(n){H(a.$$.fragment,n),o=!1},d(n){n&&R(e),_e(a),r=!1,l()}}}function gl(t){let e,a,o,r,l;a=new nt({props:{size:20}});function s(...n){return t[16](t[35],...n)}return{c(){e=z("div"),Pe(a.$$.fragment),U(e,"class","vertical-tabs-view-list-item-icon vertical-tabs-view-list-item-pin-btn vertical-tabs-view-list-item-pin-btn-pin")},m(n,u){ue(n,e,u),ve(a,e,null),o=!0,r||(l=Ue(e,"click",s),r=!0)},p(n,u){t=n},i(n){o||(A(a.$$.fragment,n),o=!0)},o(n){H(a.$$.fragment,n),o=!1},d(n){n&&R(e),_e(a),r=!1,l()}}}function jo(t){let e,a,o,r,l,s,n,u=t[5](t[35])+"",i,d,c,h,f,x,C,y,V,v=t[2].settings.showCloseIcon&&Wo(t),T=t[2].settings.showTabIcon&&zo(t),D=t[2].settings.showDirectory&&Xo(t),le=[gl,hl],M=[];function K(F,B){return F[2].settings.showPinIconIfNotPinned&&!F[35].pinned?0:F[2].settings.showPinnedIcon&&F[35].pinned?1:-1}~(h=K(t,[-1,-1]))&&(f=M[h]=le[h](t));function de(...F){return t[18](t[35],...F)}function G(...F){return t[19](t[35],...F)}return{c(){e=z("li"),a=z("div"),v&&v.c(),o=Je(),T&&T.c(),r=Je(),l=z("div"),D&&D.c(),s=Je(),n=z("span"),i=ct(u),d=Je(),c=z("div"),f&&f.c(),U(n,"class","vertical-tabs-view-list-item-title"),U(l,"class","vertical-tabs-view-list-item-name-container"),U(a,"class","vertical-tabs-view-list-item-left-container"),U(c,"class","vertical-tabs-view-list-item-right-container"),U(e,"data-leaf-id",x=t[35].id),U(e,"class","vertical-tabs-view-list-item"),ba(e,"focused",t[35].id===t[1])},m(F,B){ue(F,e,B),J(e,a),v&&v.m(a,null),J(a,o),T&&T.m(a,null),J(a,r),J(a,l),D&&D.m(l,null),J(l,s),J(l,n),J(n,i),J(e,d),J(e,c),~h&&M[h].m(c,null),C=!0,y||(V=[Ue(e,"mousedown",de),Ue(e,"contextmenu",G)],y=!0)},p(F,B){t=F,t[2].settings.showCloseIcon?v?(v.p(t,B),B[0]&4&&A(v,1)):(v=Wo(t),v.c(),A(v,1),v.m(a,o)):v&&(xt(),H(v,1,1,()=>{v=null}),Lt()),t[2].settings.showTabIcon?T||(T=zo(t),T.c(),T.m(a,r)):T&&(T.d(1),T=null),t[2].settings.showDirectory?D?D.p(t,B):(D=Xo(t),D.c(),D.m(l,s)):D&&(D.d(1),D=null),(!C||B[0]&1)&&u!==(u=t[5](t[35])+"")&&Ca(i,u);let se=h;h=K(t,B),h===se?~h&&M[h].p(t,B):(f&&(xt(),H(M[se],1,1,()=>{M[se]=null}),Lt()),~h?(f=M[h],f?f.p(t,B):(f=M[h]=le[h](t),f.c()),A(f,1),f.m(c,null)):f=null),(!C||B[0]&1&&x!==(x=t[35].id))&&U(e,"data-leaf-id",x),(!C||B[0]&3)&&ba(e,"focused",t[35].id===t[1])},i(F){C||(A(v),A(f),C=!0)},o(F){H(v),H(f),C=!1},d(F){F&&R(e),v&&v.d(),T&&T.d(),D&&D.d(),~h&&M[h].d(),y=!1,te(V)}}}function Ko(t){let e;return{c(){e=z("div"),U(e,"class","vertical-tabs-view-list-mobile-margin-block")},m(a,o){ue(a,e,o)},d(a){a&&R(e)}}}function xl(t){let e,a,o,r=Ae(t[0]),l=[];for(let u=0;uH(l[u],1,1,()=>{l[u]=null}),n=t[0].length>0&&ge.Platform.isMobile&&Ko(t);return{c(){e=z("ul");for(let u=0;u0&&ge.Platform.isMobile?n||(n=Ko(u),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i(u){if(!o){for(let i=0;i{a(2,l=p)}),ee.leaves.subscribe(p=>{a(0,s=p)}),ee.activeLeafId.subscribe(p=>{a(1,n=p)});let{view:u}=e,{state:i={tabIdToIndex:{},sortedTabIds:[]}}=e,d,{viewContentId:c}=e,{updateView:h}=e,f=[],x=()=>l.settings.tabIconRules.sort((p,g)=>g.priority-p.priority),C={},y=p=>{let g=p.view.file;return g?g.parent.path:""},V=p=>{let g=p.view.file,I=p.view.titleContainerEl.querySelectorAll(`.${p.view.titleEl.className}`),L=Array.from(I).find(ne=>{if(!ne.hasAttribute("hidden"))return ne});return(L==null?void 0:L.getText())||g.name},v=(p,g)=>It(void 0,void 0,void 0,function*(){var I,L;p.stopPropagation(),p.button!==2&&(p.target instanceof SVGElement||(yield ha(l.app,g),a(1,n=g.id),l.app.isMobile&&(!((I=l.app.workspace.leftSplit)===null||I===void 0)&&I.collapsed||l.app.workspace.leftSplit.collapse(),!((L=l.app.workspace.rightSplit)===null||L===void 0)&&L.collapsed||l.app.workspace.rightSplit.collapse())))}),T=(p,g)=>{var I;if(g.detach(),g.id===n)if(g.id===s[0].id&&s[1])a(1,n=s[1].id);else if(g.id===((I=s.at(-1))===null||I===void 0?void 0:I.id)&&s.at(-2))a(1,n=s.at(-2).id);else{let L=i.tabIdToIndex[g.id];s[L-1]&&a(1,n=s[L-1].id)}},D=(p,g)=>{s.forEach(I=>{I.id!==g.id&&I.detach()}),a(1,n=g.id)},le=(p,g)=>{let I=i.tabIdToIndex[g.id],L=i.tabIdToIndex[n];0<=L&&L{ne.detach()})},M=(p,g)=>{let I=i.tabIdToIndex[g.id],L=i.tabIdToIndex[n];I+1<=L&&L<=s.length-1&&a(1,n=s[I].id),s.slice(I+1,s.length).forEach(ne=>{ne.detach()})},K=(p,g)=>{g.setPinned(!0),h.bind(u)()},de=(p,g)=>{g.setPinned(!1),h.bind(u)()},G=(p,g)=>It(void 0,void 0,void 0,function*(){yield $o(l.app,g.view.file.path),h.bind(u)()}),F=(p,g)=>It(void 0,void 0,void 0,function*(){yield Xa(l.app,g.view.file.path,!0),h.bind(u)()}),B=(p,g)=>It(void 0,void 0,void 0,function*(){yield Xa(l.app,g.view.file.path,!1),h.bind(u)()});function se(){var p;let g=document.querySelector(`li[data-leaf-id="${n}"]`);if(!g)return;let I=g.getBoundingClientRect();if(!I)return;let L=(p=g.parentElement)===null||p===void 0?void 0:p.getBoundingClientRect();L&&(I.top>L.top||I.bottom{a(11,i.tabIdToIndex={},i),a(11,i.sortedTabIds=[],i),p.forEach((g,I)=>{a(11,i.tabIdToIndex[g.id]=I,i),i.sortedTabIds.push(g.id)}),localStorage.setItem(r.LIST_STATE,JSON.stringify(i))},xe=()=>{s.forEach(p=>{let g=`li[data-leaf-id="${p.id}"] .${o}`,I=document.querySelector(g);if(!I)return;let L=qo(f,y(p),V(p),C);L?(0,ge.setIcon)(I,L.icon):l.settings.defaultTabIcon?(0,ge.setIcon)(I,l.settings.defaultTabIcon):p.getViewState().type==="markdown"&&(0,ge.setIcon)(I,"")})};Sa(()=>{Uo.create(d,{group:"vertical-tabs-view-list",delay:100,delayOnTouchOnly:!0,touchStartThreshold:3,animation:150,draggable:".vertical-tabs-view-list-item",direction:"vertical",ghostClass:"vertical-tabs-view-list-item-ghost",chosenClass:"vertical-tabs-view-list-item-chosen",forceFallback:!ge.Platform.isDesktop,fallbackOnBody:!ge.Platform.isDesktop,onChange:p=>{let g=document.querySelector(`#${c}`);if(!g)return;let I=g.getBoundingClientRect(),L=p.item.getBoundingClientRect(),ne=L.height*2;L.top{if(p.oldIndex==null||p.newIndex==null)return;let g=Math.min(p.oldIndex,p.newIndex),I=Math.max(p.oldIndex,p.newIndex);for(let L=g;L<=I;L++){let ca=d.children[L].getAttribute("data-leaf-id");ca&&(a(11,i.tabIdToIndex[ca]=L,i),a(11,i.sortedTabIds[L]=ca,i),localStorage.setItem(r.LIST_STATE,JSON.stringify(i)))}}}),xe(),se()});let Te=p=>{let g=new ge.Menu;return g.addItem(I=>I.setTitle("Close").setIcon("x").onClick(L=>{L.preventDefault(),T(L,p)})),g.addItem(I=>I.setTitle("Close others").setIcon("x").onClick(L=>{L.preventDefault(),D(L,p)})),g.addItem(I=>I.setTitle("Close to the top").setIcon("x").onClick(L=>{L.preventDefault(),le(L,p)})),g.addItem(I=>I.setTitle("Close to the bottom").setIcon("x").onClick(L=>{L.preventDefault(),M(L,p)})),g.addSeparator(),p&&!p.pinned&&g.addItem(I=>I.setTitle("Pin").setIcon("pin").onClick(L=>{L.preventDefault(),K(L,p)})),p&&p.pinned&&g.addItem(I=>I.setTitle("Unpin").setIcon("pin-off").onClick(L=>{L.preventDefault(),de(L,p)})),g.addSeparator(),g.addItem(I=>I.setTitle("Trach local").setIcon("trash").onClick(L=>{L.preventDefault(),B(L,p)})),g.addItem(I=>I.setTitle("Trach system").setIcon("trash").onClick(L=>{L.preventDefault(),F(L,p)})),g.addItem(I=>I.setTitle("Delete file").setIcon("trash-2").onClick(L=>{L.preventDefault(),G(L,p)})),g},Le=(p,g)=>T(g,p),We=(p,g)=>K(g,p),Re=(p,g)=>de(g,p),fa=(p,g)=>v(g,p),Ka=(p,g)=>{Te(p).showAtMouseEvent(g)};function At(p){qt[p?"unshift":"push"](()=>{d=p,a(3,d)})}t.$$set=p=>{"view"in p&&a(12,u=p.view),"state"in p&&a(11,i=p.state),"viewContentId"in p&&a(13,c=p.viewContentId),"updateView"in p&&a(14,h=p.updateView)},t.$$.update=()=>{if(t.$$.dirty[0]&1){e:fe(s),xe()}if(t.$$.dirty[0]&2){e:n&&se()}};e:f=x();return[s,n,l,d,y,V,v,T,K,de,Te,i,u,c,h,Le,We,Re,fa,Ka,At]}var ja=class extends me{constructor(e){super(),Be(this,e,Ll,xl,pe,{view:12,state:11,viewContentId:13,updateView:14},ml,[-1,-1])}},Zo=ja;var er="vertical-tabs-view",Jo=er+"-content",Il={LIST_STATE:er+"list-state"},it="vertical-tabs-view",ia=class extends Qo.ItemView{constructor(a,o){super(o);this.state={tabIdToIndex:{},sortedTabIds:[]};this.plugin=a,this.settings=a.settings;let r=localStorage.getItem(Il.LIST_STATE);if(r)try{this.state=JSON.parse(r)}catch(l){console.error(l)}this.registerEvent(this.app.workspace.on("layout-change",()=>{let l=this.getActiveLeaf();ee.activeLeafId.set(l.id),this.updateView()})),this.registerEvent(this.app.workspace.on("active-leaf-change",l=>{!l||l.getViewState().type===it||ee.activeLeafId.set(l.id)}))}setSettings(a){this.plugin.settings=a,ee.plugin.set(this.plugin),this.updateView()}getViewType(){return it}getIcon(){return"list"}getDisplayText(){return"Vertical Tabs"}async onClose(){this.Tabs.$destroy()}async onOpen(){ee.plugin.set(this.plugin),ee.leaves.set(this.getSortedLeaves()),ee.activeLeafId.set(this.getActiveLeaf().id);let a=this.contentEl;a.id=Jo,this.Tabs=new Zo({target:this.contentEl,props:{view:this,state:this.state,updateView:this.updateView,viewContentId:Jo}})}getActiveLeaf(){return this.app.workspace.getMostRecentLeaf()}async setActiveLeafById(a){await to(this.app,a),ee.activeLeafId.set(a)}updateView(){let a=this.getSortedLeaves();a.forEach(o=>{o.on("pinned-change",()=>{ee.leaves.set(a)})}),ee.leaves.set(a)}getActiveLeafIndex(){let a=this.getActiveLeaf();return a?this.state.tabIdToIndex[a.id]:0}async cycleNextTab(){let a=this.getActiveLeafIndex();if(a==null)return;let o=(a+1)%this.state.sortedTabIds.length;await this.setActiveLeafById(this.state.sortedTabIds[o])}async cyclePreviousTab(){let a=this.getActiveLeafIndex();if(a==null)return;let o=(a-1)%this.state.sortedTabIds.length;o<0&&(o+=this.state.sortedTabIds.length),await this.setActiveLeafById(this.state.sortedTabIds[o])}collectLeafIds(a,o=[]){return a.forEach(r=>{if(r.type==="leaf")o.push(r.id);else if("children"in r&&Array.isArray(r.children))return this.collectLeafIds(r.children,o)}),o}getLeaves(){let a=[],o=this.app.workspace.rootSplit,r=this.collectLeafIds(o.children);return this.app.workspace.iterateRootLeaves(l=>{r.includes(l.id)&&a.push(l)}),a}getSortedLeaves(){return this.getLeaves().slice().sort((a,o)=>{var s,n;let r=(s=this.state.tabIdToIndex[a.id])!=null?s:1/0,l=(n=this.state.tabIdToIndex[o.id])!=null?n:1/0;return r-l})}};var da=class extends tr.Plugin{async onload(){Bt("loading..."),await this.loadSettings(),this.addSettingTab(new Ot(this.app,this)),this.addCommands(),this.app.workspace.onLayoutReady(async()=>{this.registerViewExtension()}),Bt("loaded.")}onunload(){Bt("unloaded.")}async loadSettings(){this.settings=Object.assign({},eo,await this.loadData()),this.settings.tabIconRules.length===0&&"tabIconConfigs"in this.settings&&Array.isArray(this.settings.tabIconConfigs)&&this.settings.tabIconConfigs.length>0&&(this.settings.tabIconRules=structuredClone(this.settings.tabIconConfigs),delete this.settings.tabIconConfigs,this.saveSettings(this.settings))}async saveSettings(a){await this.saveData(a),this.settings=a;let o=this.getView();o&&o.updateView()}addCommands(){this.addCommand({id:"show-tabs-view",name:"Show vertical tabs view",callback:async()=>{this.openViewLeaf()}}),this.addCommand({id:"cycle-previous-tab",name:"Cycle previous tab",callback:async()=>{let a=this.getView();a&&await a.cyclePreviousTab()}}),this.addCommand({id:"cycle-next-tab",name:"Cycle next tab",callback:async()=>{let a=this.getView();a&&await a.cycleNextTab()}})}registerViewExtension(){this.registerView(it,a=>new ia(this,a))}getView(){let a=this.app.workspace.getLeavesOfType(it)[0];if(a)return a.view}async openViewLeaf(){let a=()=>this.settings.defaultPosition==="left"?this.app.workspace.getLeftLeaf(!1):this.settings.defaultPosition==="right"?this.app.workspace.getRightLeaf(!1):this.app.workspace.getLeftLeaf(!1),o=this.getView();if(o)return o.updateView(),this.app.workspace.revealLeaf(o.leaf);let r=a();await r.setViewState({type:it,active:!0}),this.app.workspace.revealLeaf(r)}}; /*! Bundled license information: sortablejs/modular/sortable.esm.js: (**! * Sortable 1.15.0 * @author RubaXa * @author owenm * @license MIT *) */