Skip to content

The only tool you need to know what is happening and how to fix it.

42.0 KB
Raw Blame
import"./DsnmJJEf.js";import{u as x,g as a,l as b,ai as ir,j as X,b as Le,k as oe,ar as gt,p as $,e as k,h as T,s as R,x as K,r as D,d as l,a as j,c as S,f as h,m as E,n as vt,t as Pt,o as ot,q as at}from"./BKFspo1J.js";import{i as L}from"./COK9M2N0.js";import{e as se}from"./DpeZtIXD.js";import{c as A}from"./CWm9VMfX.js";import{p as m,r as F,s as et}from"./CARHnQ8P.js";import{a as Ee,g as Re}from"./CqMCVSVw.js";import{c as Ft}from"./BXr1Q65P.js";import{d as _t,s as lr}from"./DwMHXN8q.js";import{s as dr}from"./MFbBgGAD.js";import{C as ge,w as Wt,X as Dt,ai as cr,E as ur,O as hr,L as fr,_ as mr,H as pr,aj as vr,ak as gr,al as _r,$ as Sr,I as xr,am as yr,an as Ir,ao as wr,e as br,n as me,k as Ue,P as Cr}from"./R7BU62x2.js";import{d as Pr,a as it,h as pe,e as Oe,c as St,b as y,m as xt}from"./BoImjCaE.js";import{s as Ar}from"./BJiluzmF.js";import{D as kr,d as Vr}from"./huo5A2Em.js";import{d as Mr,e as Nr,D as Gr}from"./BkacRNkO.js";import{S as Er}from"./DTBc2VHy.js";import{b as Rr}from"./BTMTgYTv.js";import{a as $t,p as Te,t as jt}from"./BrdmM8Kw.js";import{a as Or,g as Tr}from"./BHvJp7nu.js";import{p as De}from"./F6fhTWnB.js";import{a as Dr}from"./h7yRWCtK.js";import{P as $r}from"./MS5-RPlv.js";import{I as ee}from"./CM27iA0o.js";import{C as jr}from"./CPab3OUN.js";import{C as Br}from"./Bpxj4ei_.js";function Fr(u,t){let e=u.nextElementSibling;for(;e;){if(e.matches(t))return e;e=e.nextElementSibling}}function Lr(u,t){let e=u.previousElementSibling;for(;e;){if(e.matches(t))return e;e=e.previousElementSibling}}function He(u){if(typeof CSS<"u"&&typeof CSS.escape=="function")return CSS.escape(u);const t=u.length;let e=-1,r,s="";const n=u.charCodeAt(0);if(t===1&&n===45)return"\\"+u;for(;++e<t;){if(r=u.charCodeAt(e),r===0){s+="�";continue}if(r>=1&&r<=31||r===127||e===0&&r>=48&&r<=57||e===1&&r>=48&&r<=57&&n===45){s+="\\"+r.toString(16)+" ";continue}if(r>=128||r===45||r===95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){s+=u.charAt(e);continue}s+="\\"+u.charAt(e)}return s}const Bt="data-value",q=Pr({component:"command",parts:["root","list","input","separator","loading","empty","group","group-items","group-heading","item","viewport","input-label"]}),Kt=q.selector("group"),ce=q.selector("group-items"),$e=q.selector("group-heading"),ze=q.selector("item"),ue=`${q.selector("item")}:not([aria-disabled="true"])`,At=new ge("Command.Root"),Ke=new ge("Command.List"),te=new ge("Command.Group"),je={search:"",value:"",filtered:{count:0,items:new Map,groups:new Set}};class _e{static create(t){return At.set(new _e(t))}opts;attachment;#t=!1;#e=!0;sortAfterTick=!1;sortAndFilterAfterTick=!1;allItems=new Set;allGroups=new Map;allIds=new Map;#r=X(0);get key(){return a(this.#r)}set key(t){b(this.#r,t,!0)}#s=X(null);get viewportNode(){return a(this.#s)}set viewportNode(t){b(this.#s,t,!0)}#n=X(null);get inputNode(){return a(this.#n)}set inputNode(t){b(this.#n,t,!0)}#l=X(null);get labelNode(){return a(this.#l)}set labelNode(t){b(this.#l,t,!0)}#o=X(je);get commandState(){return a(this.#o)}set commandState(t){b(this.#o,t)}#i=X(oe(je));get _commandState(){return a(this.#i)}set _commandState(t){b(this.#i,t,!0)}#C(){return dr(this._commandState)}#f(){this.#t||(this.#t=!0,Dt(()=>{this.#t=!1;const t=this.#C();!Object.is(this.commandState,t)&&(this.commandState=t,this.opts.onStateChange?.current?.(t))}))}setState(t,e,r){Object.is(this._commandState[t],e)||(this._commandState[t]=e,t==="search"?(this.#v(),this.#m()):t==="value"&&(r||this.#_()),this.#f())}constructor(t){this.opts=t,this.attachment=it(this.opts.ref);const e={...this._commandState,value:this.opts.value.current??""};this._commandState=e,this.commandState=e,this.onkeydown=this.onkeydown.bind(this)}#g(t,e){const r=this.opts.filter.current??Je;return t?r(t,this._commandState.search,e):0}#m(){if(!this._commandState.search||this.opts.shouldFilter.current===!1){!this._commandState.value||!this.#e?this.#p():this.#e&&this._commandState.value&&this.#P();return}const t=this._commandState.filtered.items,e=[];for(const o of this._commandState.filtered.groups){const i=this.allGroups.get(o);let c=0;if(!i){e.push([o,c]);continue}for(const d of i){const p=t.get(d);c=Math.max(p??0,c)}e.push([o,c])}const r=this.viewportNode,s=this.getValidItems().sort((o,i)=>{const c=o.getAttribute("data-value"),d=i.getAttribute("data-value"),p=t.get(c)??0;return(t.get(d)??0)-p});for(const o of s){const i=o.closest(ce);if(i){const c=o.parentElement===i?o:o.closest(`${ce} > *`);c&&i.appendChild(c)}else{const c=o.parentElement===r?o:o.closest(`${ce} > *`);c&&r?.appendChild(c)}}const n=e.sort((o,i)=>i[1]-o[1]);for(const o of n){const i=r?.querySelector(`${Kt}[${Bt}="${He(o[0])}"]`);i?.parentElement?.appendChild(i)}this.#p()}setValue(t,e){t!==this.opts.value.current&&t===""&&Dt(()=>{this.key++}),this.setState("value",t,e),this.opts.value.current=t}#p(){Dt(()=>{const e=this.getValidItems().find(s=>s.getAttribute("aria-disabled")!=="true")?.getAttribute(Bt),r=this.#e&&this.opts.disableInitialScroll.current;this.setValue(e??"",r),this.#e=!1})}#P(){Dt(()=>{this.opts.disableInitialScroll.current||this.#_(),this.#e=!1})}#v(){if(!this._commandState.search||this.opts.shouldFilter.current===!1){this._commandState.filtered.count=this.allItems.size;return}this._commandState.filtered.groups=new Set;let t=0;for(const e of this.allItems){const r=this.allIds.get(e)?.value??"",s=this.allIds.get(e)?.keywords??[],n=this.#g(r,s);this._commandState.filtered.items.set(e,n),n>0&&t++}for(const[e,r]of this.allGroups)for(const s of r){const n=this._commandState.filtered.items.get(s);if(n&&n>0){this._commandState.filtered.groups.add(e);break}}this._commandState.filtered.count=t}getValidItems(){const t=this.opts.ref.current;return t?Array.from(t.querySelectorAll(ue)).filter(r=>!!r):[]}getVisibleItems(){const t=this.opts.ref.current;return t?Array.from(t.querySelectorAll(ze)).filter(r=>!!r):[]}get itemsGrid(){if(!this.isGrid)return[];const t=this.opts.columns.current??1,e=this.getVisibleItems(),r=[[]];let s=e[0]?.getAttribute("data-group"),n=0,o=0;for(let i=0;i<e.length;i++){const c=e[i],d=c?.getAttribute("data-group");s!==d?(s=d,n=1,o++,r.push([{index:i,firstRowOfGroup:!0,ref:c}])):(n++,n>t&&(o++,n=1,r.push([])),r[o]?.push({index:i,firstRowOfGroup:r[o]?.[0]?.firstRowOfGroup??i===0,ref:c}))}return r}#a(){const t=this.opts.ref.current;if(!t)return;const e=t.querySelector(`${ue}[data-selected]`);if(e)return e}#_(){Dt(()=>{const t=this.#a();if(!t)return;const e=t.parentElement?.parentElement;if(e){if(this.isGrid){const r=this.#A(t);if(t.scrollIntoView({block:"nearest"}),r){t?.closest(Kt)?.querySelector($e)?.scrollIntoView({block:"nearest"});return}}else{const r=cr(e);if(r&&r.dataset?.value===t.dataset?.value){t?.closest(Kt)?.querySelector($e)?.scrollIntoView({block:"nearest"});return}}t.scrollIntoView({block:"nearest"})}})}#A(t){const e=this.itemsGrid;if(e.length===0)return!1;for(let r=0;r<e.length;r++){const s=e[r];if(s!==void 0)for(let n=0;n<s.length;n++){const o=s[n];if(!(o===void 0||o.ref!==t))return o.firstRowOfGroup}}return!1}updateSelectedToIndex(t){const e=this.getValidItems()[t];e&&this.setValue(e.getAttribute(Bt)??"")}updateSelectedByItem(t){const e=this.#a(),r=this.getValidItems(),s=r.findIndex(o=>o===e);let n=r[s+t];this.opts.loop.current&&(n=s+t<0?r[r.length-1]:s+t===r.length?r[0]:r[s+t]),n&&this.setValue(n.getAttribute(Bt)??"")}updateSelectedByGroup(t){let r=this.#a()?.closest(Kt),s;for(;r&&!s;)r=t>0?Fr(r,Kt):Lr(r,Kt),s=r?.querySelector(ue);s?this.setValue(s.getAttribute(Bt)??""):this.updateSelectedByItem(t)}registerValue(t,e){return t&&t===this.allIds.get(t)?.value||this.allIds.set(t,{value:t,keywords:e}),this._commandState.filtered.items.set(t,this.#g(t,e)),this.sortAfterTick||(this.sortAfterTick=!0,Dt(()=>{this.#m(),this.sortAfterTick=!1})),()=>{this.allIds.delete(t)}}registerItem(t,e){return this.allItems.add(t),e&&(this.allGroups.has(e)?this.allGroups.get(e).add(t):this.allGroups.set(e,new Set([t]))),this.sortAndFilterAfterTick||(this.sortAndFilterAfterTick=!0,Dt(()=>{this.#v(),this.#m(),this.sortAndFilterAfterTick=!1})),this.#f(),()=>{const r=this.#a();this.allItems.delete(t),this.commandState.filtered.items.delete(t),this.#v(),r?.getAttribute("id")===t&&this.#p(),this.#f()}}registerGroup(t){return this.allGroups.has(t)||this.allGroups.set(t,new Set),()=>{this.allIds.delete(t),this.allGroups.delete(t)}}get isGrid(){return this.opts.columns.current!==null}#S(){return this.updateSelectedToIndex(this.getValidItems().length-1)}#d(t){t.preventDefault(),t.metaKey?this.#S():t.altKey?this.updateSelectedByGroup(1):this.updateSelectedByItem(1)}#x(t){this.opts.columns.current!==null&&(t.preventDefault(),t.metaKey?this.updateSelectedByGroup(1):this.updateSelectedByItem(this.#k(t)))}#y(t,e){if(e.length===0)return null;for(let r=0;r<e.length;r++){const s=e[r];if(s!==void 0)for(let n=0;n<s.length;n++){const o=s[n];if(!(o===void 0||o.ref!==t))return{columnIndex:n,rowIndex:r}}}return null}#k(t){const e=this.itemsGrid,r=this.#a();if(!r)return 0;const s=this.#y(r,e);if(!s)return 0;let n=null;const o=t.altKey?1:0;if(t.altKey&&s.rowIndex===e.length-2&&!this.opts.loop.current)n=this.#c({start:e.length-1,end:e.length,expectedColumnIndex:s.columnIndex,grid:e});else if(s.rowIndex===e.length-1){if(!this.opts.loop.current)return 0;n=this.#c({start:0+o,end:s.rowIndex,expectedColumnIndex:s.columnIndex,grid:e})}else n=this.#c({start:s.rowIndex+1+o,end:e.length,expectedColumnIndex:s.columnIndex,grid:e}),n===null&&this.opts.loop.current&&(n=this.#c({start:0,end:s.rowIndex,expectedColumnIndex:s.columnIndex,grid:e}));return this.#I(r,n)}#c({start:t,end:e,grid:r,expectedColumnIndex:s}){let n=null;for(let o=t;o<e;o++){const i=r[o];if(n=i[s]?.ref??null,n!==null&&ae(n)){n=null;continue}if(n===null)for(let c=i.length-1;c>=0;c--){const d=i[i.length-1];if(!(d===void 0||ae(d.ref))){n=d.ref;break}}break}return n}#I(t,e){if(e===null)return 0;const r=this.getValidItems(),s=r.findIndex(o=>o===t);return r.findIndex(o=>o===e)-s}#w(t){this.opts.columns.current!==null&&(t.preventDefault(),t.metaKey?this.updateSelectedByGroup(-1):this.updateSelectedByItem(this.#V(t)))}#V(t){const e=this.itemsGrid,r=this.#a();if(r===void 0)return 0;const s=this.#y(r,e);if(s===null)return 0;let n=null;const o=t.altKey?1:0;if(t.altKey&&s.rowIndex===1&&this.opts.loop.current===!1)n=this.#u({start:0,end:0,expectedColumnIndex:s.columnIndex,grid:e});else if(s.rowIndex===0){if(this.opts.loop.current===!1)return 0;n=this.#u({start:e.length-1-o,end:s.rowIndex+1,expectedColumnIndex:s.columnIndex,grid:e})}else n=this.#u({start:s.rowIndex-1-o,end:0,expectedColumnIndex:s.columnIndex,grid:e}),n===null&&this.opts.loop.current&&(n=this.#u({start:e.length-1,end:s.rowIndex+1,expectedColumnIndex:s.columnIndex,grid:e}));return this.#I(r,n)}#u({start:t,end:e,grid:r,expectedColumnIndex:s}){let n=null;for(let o=t;o>=e;o--){const i=r[o];if(i!==void 0){if(n=i[s]?.ref??null,n!==null&&ae(n)){n=null;continue}if(n===null)for(let c=i.length-1;c>=0;c--){const d=i[i.length-1];if(!(d===void 0||ae(d.ref))){n=d.ref;break}}break}}return n}#h(t){t.preventDefault(),t.metaKey?this.updateSelectedToIndex(0):t.altKey?this.updateSelectedByGroup(-1):this.updateSelectedByItem(-1)}onkeydown(t){const e=this.opts.vimBindings.current&&t.ctrlKey;switch(t.key){case wr:case Ir:{e&&(this.isGrid?this.#x(t):this.#d(t));break}case yr:{e&&this.isGrid&&this.#d(t);break}case xr:this.isGrid?this.#x(t):this.#d(t);break;case Sr:if(!this.isGrid)break;this.#d(t);break;case _r:case gr:{e&&(this.isGrid?this.#w(t):this.#h(t));break}case vr:{e&&this.isGrid&&this.#h(t);break}case pr:this.isGrid?this.#w(t):this.#h(t);break;case mr:if(!this.isGrid)break;this.#h(t);break;case fr:t.preventDefault(),this.updateSelectedToIndex(0);break;case hr:t.preventDefault(),this.#S();break;case ur:if(!t.isComposing&&t.keyCode!==229){t.preventDefault();const r=this.#a();r&&r?.click()}}}#b=x(()=>({id:this.opts.id.current,role:"application",[q.root]:"",tabindex:-1,onkeydown:this.onkeydown,...this.attachment}));get props(){return a(this.#b)}set props(t){b(this.#b,t)}}function ae(u){return u.getAttribute("aria-disabled")==="true"}class Se{static create(t){return new Se(t,At.get())}opts;root;attachment;#t=x(()=>this.root._commandState.filtered.count===0&&this.#e===!1||this.opts.forceMount.current);get shouldRender(){return a(this.#t)}set shouldRender(t){b(this.#t,t)}#e=!0;constructor(t,e){this.opts=t,this.root=e,this.attachment=it(this.opts.ref),ir(()=>{this.#e=!1})}#r=x(()=>({id:this.opts.id.current,role:"presentation",[q.empty]:"",...this.attachment}));get props(){return a(this.#r)}set props(t){b(this.#r,t)}}class xe{static create(t){return te.set(new xe(t,At.get()))}opts;root;attachment;#t=x(()=>this.opts.forceMount.current||this.root.opts.shouldFilter.current===!1||!this.root.commandState.search?!0:this.root._commandState.filtered.groups.has(this.trueValue));get shouldRender(){return a(this.#t)}set shouldRender(t){b(this.#t,t)}#e=X(null);get headingNode(){return a(this.#e)}set headingNode(t){b(this.#e,t,!0)}#r=X("");get trueValue(){return a(this.#r)}set trueValue(t){b(this.#r,t,!0)}constructor(t,e){this.opts=t,this.root=e,this.attachment=it(this.opts.ref),this.trueValue=t.value.current??t.id.current,Wt(()=>this.trueValue,()=>this.root.registerGroup(this.trueValue)),Le(()=>this.opts.value.current?(this.trueValue=this.opts.value.current,this.root.registerValue(this.opts.value.current)):this.headingNode&&this.headingNode.textContent?(this.trueValue=this.headingNode.textContent.trim().toLowerCase(),this.root.registerValue(this.trueValue)):(this.trueValue=`-----${this.opts.id.current}`,this.root.registerValue(this.trueValue)))}#s=x(()=>({id:this.opts.id.current,role:"presentation",hidden:this.shouldRender?void 0:!0,"data-value":this.trueValue,[q.group]:"",...this.attachment}));get props(){return a(this.#s)}set props(t){b(this.#s,t)}}class ye{static create(t){return new ye(t,te.get())}opts;group;attachment;constructor(t,e){this.opts=t,this.group=e,this.attachment=it(this.opts.ref,r=>this.group.headingNode=r)}#t=x(()=>({id:this.opts.id.current,[q["group-heading"]]:"",...this.attachment}));get props(){return a(this.#t)}set props(t){b(this.#t,t)}}class Ie{static create(t){return new Ie(t,te.get())}opts;group;attachment;constructor(t,e){this.opts=t,this.group=e,this.attachment=it(this.opts.ref)}#t=x(()=>({id:this.opts.id.current,role:"group",[q["group-items"]]:"","aria-labelledby":this.group.headingNode?.id??void 0,...this.attachment}));get props(){return a(this.#t)}set props(t){b(this.#t,t)}}class we{static create(t){return new we(t,At.get())}opts;root;attachment;#t=x(()=>{const t=this.root.viewportNode?.querySelector(`${ze}[${Bt}="${He(this.root.opts.value.current)}"]`);if(t!=null)return t.getAttribute("id")??void 0});constructor(t,e){this.opts=t,this.root=e,this.attachment=it(this.opts.ref,r=>this.root.inputNode=r),Wt(()=>this.opts.ref.current,()=>{const r=this.opts.ref.current;r&&this.opts.autofocus.current&&br(10,()=>r.focus())}),Wt(()=>this.opts.value.current,()=>{this.root.commandState.search!==this.opts.value.current&&this.root.setState("search",this.opts.value.current)})}#e=x(()=>({id:this.opts.id.current,type:"text",[q.input]:"",autocomplete:"off",autocorrect:"off",spellcheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":pe(!0),"aria-controls":this.root.viewportNode?.id??void 0,"aria-labelledby":this.root.labelNode?.id??void 0,"aria-activedescendant":a(this.#t),...this.attachment}));get props(){return a(this.#e)}set props(t){b(this.#e,t)}}class be{static create(t){const e=te.getOr(null);return new be({...t,group:e},At.get())}opts;root;attachment;#t=null;#e=x(()=>this.opts.forceMount.current||this.#t?.opts.forceMount.current===!0);#r=x(()=>{if(this.opts.ref.current,a(this.#e)||this.root.opts.shouldFilter.current===!1||!this.root.commandState.search)return!0;const t=this.root.commandState.filtered.items.get(this.trueValue);return t===void 0?!1:t>0});get shouldRender(){return a(this.#r)}set shouldRender(t){b(this.#r,t)}#s=x(()=>this.root.opts.value.current===this.trueValue&&this.trueValue!=="");get isSelected(){return a(this.#s)}set isSelected(t){b(this.#s,t)}#n=X("");get trueValue(){return a(this.#n)}set trueValue(t){b(this.#n,t,!0)}constructor(t,e){this.opts=t,this.root=e,this.#t=te.getOr(null),this.trueValue=t.value.current,this.attachment=it(this.opts.ref),Wt([()=>this.trueValue,()=>this.#t?.trueValue,()=>this.opts.forceMount.current],()=>{if(!(this.opts.forceMount.current||!this.trueValue))return this.root.registerItem(this.trueValue,this.#t?.trueValue)}),Wt([()=>this.opts.value.current,()=>this.opts.ref.current],()=>{this.opts.value.current?this.trueValue=this.opts.value.current:this.opts.ref.current?.textContent&&(this.trueValue=this.opts.ref.current.textContent.trim()),this.trueValue&&(this.root.registerValue(this.trueValue,t.keywords.current.map(r=>r.trim())),this.opts.ref.current?.setAttribute(Bt,this.trueValue))}),this.onclick=this.onclick.bind(this),this.onpointermove=this.onpointermove.bind(this)}#l(){this.opts.disabled.current||(this.#o(),this.opts.onSelect?.current())}#o(){this.opts.disabled.current||this.root.setValue(this.trueValue,!0)}onpointermove(t){this.opts.disabled.current||this.root.opts.disablePointerSelection.current||this.#o()}onclick(t){this.opts.disabled.current||this.#l()}#i=x(()=>({id:this.opts.id.current,"aria-disabled":pe(this.opts.disabled.current),"aria-selected":pe(this.isSelected),"data-disabled":Oe(this.opts.disabled.current),"data-selected":Oe(this.isSelected),"data-value":this.trueValue,"data-group":this.#t?.trueValue,[q.item]:"",role:"option",onpointermove:this.onpointermove,onclick:this.onclick,...this.attachment}));get props(){return a(this.#i)}set props(t){b(this.#i,t)}}class qe{static create(t){return new qe(t,At.get())}opts;root;attachment;#t=x(()=>!this.root._commandState.search||this.opts.forceMount.current);get shouldRender(){return a(this.#t)}set shouldRender(t){b(this.#t,t)}constructor(t,e){this.opts=t,this.root=e,this.attachment=it(this.opts.ref)}#e=x(()=>({id:this.opts.id.current,"aria-hidden":"true",[q.separator]:"",...this.attachment}));get props(){return a(this.#e)}set props(t){b(this.#e,t)}}class Ce{static create(t){return Ke.set(new Ce(t,At.get()))}opts;root;attachment;constructor(t,e){this.opts=t,this.root=e,this.attachment=it(this.opts.ref)}#t=x(()=>({id:this.opts.id.current,role:"listbox","aria-label":this.opts.ariaLabel.current,[q.list]:"",...this.attachment}));get props(){return a(this.#t)}set props(t){b(this.#t,t)}}class Pe{static create(t){return new Pe(t,At.get())}opts;root;attachment;constructor(t,e){this.opts=t,this.root=e,this.attachment=it(this.opts.ref,r=>this.root.labelNode=r)}#t=x(()=>({id:this.opts.id.current,[q["input-label"]]:"",for:this.opts.for?.current,style:Ar,...this.attachment}));get props(){return a(this.#t)}set props(t){b(this.#t,t)}}class Ae{static create(t){return new Ae(t,Ke.get())}opts;list;attachment;constructor(t,e){this.opts=t,this.list=e,this.attachment=it(this.opts.ref,r=>this.list.root.viewportNode=r),Wt([()=>this.opts.ref.current,()=>this.list.opts.ref.current],([r,s])=>{if(r===null||s===null)return;let n;const o=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{const i=r.offsetHeight;s.style.setProperty("--bits-command-list-height",`${i.toFixed(1)}px`)})});return o.observe(r),()=>{cancelAnimationFrame(n),o.unobserve(r)}})}#t=x(()=>({id:this.opts.id.current,[q.viewport]:"",...this.attachment}));get props(){return a(this.#t)}set props(t){b(this.#t,t)}}var Ur=k("<label><!></label>");function Hr(u,t){const e=gt();$(t,!0);let r=m(t,"id",19,()=>St(e)),s=m(t,"ref",15,null),n=F(t,["$$slots","$$events","$$legacy","id","ref","children"]);const o=Pe.create({id:y(()=>r()),ref:y(()=>s(),p=>s(p))}),i=x(()=>xt(n,o.props));var c=Ur();_t(c,()=>({...a(i)}));var d=T(c);R(d,()=>t.children??K),D(c),l(u,c),j()}var zr=k("<!> <!>",1),Kr=k("<div><!> <!></div>");function qr(u,t){const e=gt();$(t,!0);const r=G=>{Hr(G,{children:(Q,z)=>{vt();var B=Pt();ot(()=>at(B,f())),l(Q,B)},$$slots:{default:!0}})};let s=m(t,"id",19,()=>St(e)),n=m(t,"ref",15,null),o=m(t,"value",15,""),i=m(t,"onValueChange",3,me),c=m(t,"onStateChange",3,me),d=m(t,"loop",3,!1),p=m(t,"shouldFilter",3,!0),_=m(t,"filter",3,Je),f=m(t,"label",3,""),g=m(t,"vimBindings",3,!0),v=m(t,"disablePointerSelection",3,!1),I=m(t,"disableInitialScroll",3,!1),w=m(t,"columns",3,null),V=F(t,["$$slots","$$events","$$legacy","id","ref","value","onValueChange","onStateChange","loop","shouldFilter","filter","label","vimBindings","disablePointerSelection","disableInitialScroll","columns","children","child"]);const O=_e.create({id:y(()=>s()),ref:y(()=>n(),G=>n(G)),filter:y(()=>_()),shouldFilter:y(()=>p()),loop:y(()=>d()),value:y(()=>o(),G=>{o()!==G&&(o(G),i()(G))}),vimBindings:y(()=>g()),disablePointerSelection:y(()=>v()),disableInitialScroll:y(()=>I()),onStateChange:y(()=>c()),columns:y(()=>w())}),Y=G=>O.updateSelectedToIndex(G),rt=G=>O.updateSelectedByGroup(G),lt=G=>O.updateSelectedByItem(G),P=()=>O.getValidItems(),C=x(()=>xt(V,O.props));var N={updateSelectedToIndex:Y,updateSelectedByGroup:rt,updateSelectedByItem:lt,getValidItems:P},U=S(),dt=h(U);{var Jt=G=>{var Q=zr(),z=h(Q);r(z);var B=E(z,2);R(B,()=>t.child,()=>({props:a(C)})),l(G,Q)},kt=G=>{var Q=Kr();_t(Q,()=>({...a(C)}));var z=T(Q);r(z);var B=E(z,2);R(B,()=>t.children??K),D(Q),l(G,Q)};L(dt,G=>{t.child?G(Jt):G(kt,!1)})}return l(u,U),j(N)}var Wr=k("<div><!></div>");function Jr(u,t){const e=gt();$(t,!0);let r=m(t,"id",19,()=>St(e)),s=m(t,"ref",15,null),n=m(t,"forceMount",3,!1),o=F(t,["$$slots","$$events","$$legacy","id","ref","children","child","forceMount"]);const i=Se.create({id:y(()=>r()),ref:y(()=>s(),f=>s(f)),forceMount:y(()=>n())}),c=x(()=>xt(i.props,o));var d=S(),p=h(d);{var _=f=>{var g=S(),v=h(g);{var I=V=>{var O=S(),Y=h(O);R(Y,()=>t.child,()=>({props:a(c)})),l(V,O)},w=V=>{var O=Wr();_t(O,()=>({...a(c)}));var Y=T(O);R(Y,()=>t.children??K),D(O),l(V,O)};L(v,V=>{t.child?V(I):V(w,!1)})}l(f,g)};L(p,f=>{i.shouldRender&&f(_)})}l(u,d),j()}var Xr=k("<div><!></div>");function Yr(u,t){const e=gt();$(t,!0);let r=m(t,"id",19,()=>St(e)),s=m(t,"ref",15,null),n=m(t,"value",3,""),o=m(t,"forceMount",3,!1),i=F(t,["$$slots","$$events","$$legacy","id","ref","value","forceMount","children","child"]);const c=xe.create({id:y(()=>r()),ref:y(()=>s(),v=>s(v)),forceMount:y(()=>o()),value:y(()=>n())}),d=x(()=>xt(i,c.props));var p=S(),_=h(p);{var f=v=>{var I=S(),w=h(I);R(w,()=>t.child,()=>({props:a(d)})),l(v,I)},g=v=>{var I=Xr();_t(I,()=>({...a(d)}));var w=T(I);R(w,()=>t.children??K),D(I),l(v,I)};L(_,v=>{t.child?v(f):v(g,!1)})}l(u,p),j()}var Qr=k("<div><!></div>");function Zr(u,t){const e=gt();$(t,!0);let r=m(t,"id",19,()=>St(e)),s=m(t,"ref",15,null),n=F(t,["$$slots","$$events","$$legacy","id","ref","children","child"]);const o=ye.create({id:y(()=>r()),ref:y(()=>s(),f=>s(f))}),i=x(()=>xt(n,o.props));var c=S(),d=h(c);{var p=f=>{var g=S(),v=h(g);R(v,()=>t.child,()=>({props:a(i)})),l(f,g)},_=f=>{var g=Qr();_t(g,()=>({...a(i)}));var v=T(g);R(v,()=>t.children??K),D(g),l(f,g)};L(d,f=>{t.child?f(p):f(_,!1)})}l(u,c),j()}var ts=k("<div><!></div>"),es=k('<div style="display: contents;"><!></div>');function rs(u,t){const e=gt();$(t,!0);let r=m(t,"id",19,()=>St(e)),s=m(t,"ref",15,null),n=F(t,["$$slots","$$events","$$legacy","id","ref","children","child"]);const o=Ie.create({id:y(()=>r()),ref:y(()=>s(),f=>s(f))}),i=x(()=>xt(n,o.props));var c=es(),d=T(c);{var p=f=>{var g=S(),v=h(g);R(v,()=>t.child,()=>({props:a(i)})),l(f,g)},_=f=>{var g=ts();_t(g,()=>({...a(i)}));var v=T(g);R(v,()=>t.children??K),D(g),l(f,g)};L(d,f=>{t.child?f(p):f(_,!1)})}D(c),l(u,c),j()}var ss=k("<input/>");function as(u,t){const e=gt();$(t,!0);let r=m(t,"value",15,""),s=m(t,"autofocus",3,!1),n=m(t,"id",19,()=>St(e)),o=m(t,"ref",15,null),i=F(t,["$$slots","$$events","$$legacy","value","autofocus","id","ref","child"]);const c=we.create({id:y(()=>n()),ref:y(()=>o(),v=>o(v)),value:y(()=>r(),v=>{r(v)}),autofocus:y(()=>s()??!1)}),d=x(()=>xt(i,c.props));var p=S(),_=h(p);{var f=v=>{var I=S(),w=h(I);R(w,()=>t.child,()=>({props:a(d)})),l(v,I)},g=v=>{var I=ss();_t(I,()=>({...a(d)}),void 0,void 0,void 0,void 0,!0),Rr(I,r),l(v,I)};L(_,v=>{t.child?v(f):v(g,!1)})}l(u,p),j()}var ns=k("<div><!></div>"),os=k('<div style="display: contents;" data-item-wrapper=""><!></div>');function is(u,t){const e=gt();$(t,!0);let r=m(t,"id",19,()=>St(e)),s=m(t,"ref",15,null),n=m(t,"value",3,""),o=m(t,"disabled",3,!1),i=m(t,"onSelect",3,me),c=m(t,"forceMount",3,!1),d=m(t,"keywords",19,()=>[]),p=F(t,["$$slots","$$events","$$legacy","id","ref","value","disabled","children","child","onSelect","forceMount","keywords"]);const _=be.create({id:y(()=>r()),ref:y(()=>s(),I=>s(I)),value:y(()=>n()),disabled:y(()=>o()),onSelect:y(()=>i()),forceMount:y(()=>c()),keywords:y(()=>d())}),f=x(()=>xt(p,_.props));var g=S(),v=h(g);Ue(v,()=>_.root.key,I=>{var w=os(),V=T(w);{var O=Y=>{var rt=S(),lt=h(rt);{var P=N=>{var U=S(),dt=h(U);R(dt,()=>t.child,()=>({props:a(f)})),l(N,U)},C=N=>{var U=ns();_t(U,()=>({...a(f)}));var dt=T(U);R(dt,()=>t.children??K),D(U),l(N,U)};L(lt,N=>{t.child?N(P):N(C,!1)})}l(Y,rt)};L(V,Y=>{_.shouldRender&&Y(O)})}D(w),ot(()=>lr(w,"data-value",_.trueValue)),l(I,w)}),l(u,g),j()}var ls=k("<div><!></div>");function ds(u,t){const e=gt();$(t,!0);let r=m(t,"id",19,()=>St(e)),s=m(t,"ref",15,null),n=F(t,["$$slots","$$events","$$legacy","id","ref","child","children","aria-label"]);const o=Ce.create({id:y(()=>r()),ref:y(()=>s(),p=>s(p)),ariaLabel:y(()=>t["aria-label"]??"Suggestions...")}),i=x(()=>xt(n,o.props));var c=S(),d=h(c);Ue(d,()=>o.root._commandState.search==="",p=>{var _=S(),f=h(_);{var g=I=>{var w=S(),V=h(w);R(V,()=>t.child,()=>({props:a(i)})),l(I,w)},v=I=>{var w=ls();_t(w,()=>({...a(i)}));var V=T(w);R(V,()=>t.children??K),D(w),l(I,w)};L(f,I=>{t.child?I(g):I(v,!1)})}l(p,_)}),l(u,c),j()}var cs=k("<div><!></div>");function us(u,t){const e=gt();$(t,!0);let r=m(t,"id",19,()=>St(e)),s=m(t,"ref",15,null),n=F(t,["$$slots","$$events","$$legacy","id","ref","children","child"]);const o=Ae.create({id:y(()=>r()),ref:y(()=>s(),f=>s(f))}),i=x(()=>xt(n,o.props));var c=S(),d=h(c);{var p=f=>{var g=S(),v=h(g);R(v,()=>t.child,()=>({props:a(i)})),l(f,g)},_=f=>{var g=cs();_t(g,()=>({...a(i)}));var v=T(g);R(v,()=>t.children??K),D(g),l(f,g)};L(d,f=>{t.child?f(p):f(_,!1)})}l(u,c),j()}const Be=1,hs=.9,fs=.8,ms=.17,he=.1,fe=.999,ps=.9999,vs=.99,gs=/[\\/_+.#"@[({&]/,_s=/[\\/_+.#"@[({&]/g,Ss=/[\s-]/,We=/[\s-]/g;function ve(u,t,e,r,s,n,o){if(n===t.length)return s===u.length?Be:vs;const i=`${s},${n}`;if(o[i]!==void 0)return o[i];const c=r.charAt(n);let d=e.indexOf(c,s),p=0,_,f,g,v;for(;d>=0;)_=ve(u,t,e,r,d+1,n+1,o),_>p&&(d===s?_*=Be:gs.test(u.charAt(d-1))?(_*=fs,g=u.slice(s,d-1).match(_s),g&&s>0&&(_*=fe**g.length)):Ss.test(u.charAt(d-1))?(_*=hs,v=u.slice(s,d-1).match(We),v&&s>0&&(_*=fe**v.length)):(_*=ms,s>0&&(_*=fe**(d-s))),u.charAt(d)!==t.charAt(n)&&(_*=ps)),(_<he&&e.charAt(d-1)===r.charAt(n+1)||r.charAt(n+1)===r.charAt(n)&&e.charAt(d-1)!==r.charAt(n))&&(f=ve(u,t,e,r,d+1,n+2,o),f*he>_&&(_=f*he)),_>p&&(p=_),d=e.indexOf(c,d+1);return o[i]=p,p}function Fe(u){return u.toLowerCase().replace(We," ")}function Je(u,t,e){return u=e&&e.length>0?`${`${u} ${e?.join(" ")}`}`:u,ve(u,t,Fe(u),Fe(t),0,0,{})}function xs(u,t){$(t,!0);let e=F(t,["$$slots","$$events","$$legacy"]);const r=[["path",{d:"M10 12h4"}],["path",{d:"M10 8h4"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16"}]];ee(u,et({name:"building-2"},()=>e,{get iconNode(){return r},children:(s,n)=>{var o=S(),i=h(o);R(i,()=>t.children??K),l(s,o)},$$slots:{default:!0}})),j()}function ys(u,t){$(t,!0);let e=F(t,["$$slots","$$events","$$legacy"]);const r=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1"}],["path",{d:"M2 13h10"}],["path",{d:"m9 16 3-3-3-3"}]];ee(u,et({name:"folder-input"},()=>e,{get iconNode(){return r},children:(s,n)=>{var o=S(),i=h(o);R(i,()=>t.children??K),l(s,o)},$$slots:{default:!0}})),j()}function Is(u,t){$(t,!0);let e=F(t,["$$slots","$$events","$$legacy"]);const r=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1"}]];ee(u,et({name:"layout-dashboard"},()=>e,{get iconNode(){return r},children:(s,n)=>{var o=S(),i=h(o);R(i,()=>t.children??K),l(s,o)},$$slots:{default:!0}})),j()}function ws(u,t){$(t,!0);let e=F(t,["$$slots","$$events","$$legacy"]);const r=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05"}]];ee(u,et({name:"store"},()=>e,{get iconNode(){return r},children:(s,n)=>{var o=S(),i=h(o);R(i,()=>t.children??K),l(s,o)},$$slots:{default:!0}})),j()}function bs(u,t){$(t,!0);let e=F(t,["$$slots","$$events","$$legacy"]);const r=[["path",{d:"M12 3v12"}],["path",{d:"m17 8-5-5-5 5"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}]];ee(u,et({name:"upload"},()=>e,{get iconNode(){return r},children:(s,n)=>{var o=S(),i=h(o);R(i,()=>t.children??K),l(s,o)},$$slots:{default:!0}})),j()}function Cs(u,t){$(t,!0);let e=m(t,"ref",15,null),r=m(t,"value",15,""),s=F(t,["$$slots","$$events","$$legacy","ref","value","class"]);var n=S(),o=h(n);{let i=x(()=>Ft("flex size-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t.class));A(o,()=>qr,(c,d)=>{d(c,et({"data-slot":"command",get class(){return a(i)}},()=>s,{get ref(){return e()},set ref(p){e(p)},get value(){return r()},set value(p){r(p)}}))})}l(u,n),j()}var Ps=k("<!> <!> <!>",1),As=k("<!> <!>",1);function ks(u,t){$(t,!0);let e=m(t,"open",15,!1),r=m(t,"ref",15,null),s=m(t,"value",15,""),n=m(t,"title",3,"Command Palette"),o=m(t,"description",3,"Search for a command to run"),i=F(t,["$$slots","$$events","$$legacy","open","ref","value","title","description","class","portalProps","children"]);var c=S(),d=h(c);A(d,()=>kr,(p,_)=>{_(p,et(()=>i,{get open(){return e()},set open(f){e(f)},children:(f,g)=>{var v=S(),I=h(v);A(I,()=>Cr,(w,V)=>{V(w,et(()=>t.portalProps,{children:(O,Y)=>{var rt=As(),lt=h(rt);A(lt,()=>Mr,(C,N)=>{N(C,{class:"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0"})});var P=E(lt,2);{let C=x(()=>Ft("fixed top-1/2 left-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-hidden border bg-background p-0 shadow-lg duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:rounded-md",t.class));A(P,()=>Vr,(N,U)=>{U(N,{get class(){return a(C)},children:(dt,Jt)=>{var kt=Ps(),G=h(kt);A(G,()=>Nr,(B,Lt)=>{Lt(B,{class:"sr-only",children:(Vt,Ut)=>{vt();var bt=Pt();ot(()=>at(bt,n())),l(Vt,bt)},$$slots:{default:!0}})});var Q=E(G,2);A(Q,()=>Gr,(B,Lt)=>{Lt(B,{class:"sr-only",children:(Vt,Ut)=>{vt();var bt=Pt();ot(()=>at(bt,o())),l(Vt,bt)},$$slots:{default:!0}})});var z=E(Q,2);Cs(z,{class:"[&_[data-command-group]]:px-2 [&_[data-command-group]:not([hidden])_~[data-command-group]]:pt-0 [&_[data-command-input-wrapper]_svg]:h-5 [&_[data-command-input-wrapper]_svg]:w-5 [&_[data-command-input]]:h-12 [&_[data-command-item]]:px-2 [&_[data-command-item]]:py-3 [&_[data-command-item]_svg]:h-5 [&_[data-command-item]_svg]:w-5",get ref(){return r()},set ref(B){r(B)},get value(){return s()},set value(B){s(B)},children:(B,Lt)=>{var Vt=S(),Ut=h(Vt);R(Ut,()=>t.children??K),l(B,Vt)},$$slots:{default:!0}}),l(dt,kt)},$$slots:{default:!0}})})}l(O,rt)},$$slots:{default:!0}}))}),l(f,v)},$$slots:{default:!0}}))}),l(u,c),j()}function Vs(u,t){$(t,!0);let e=m(t,"ref",15,null),r=F(t,["$$slots","$$events","$$legacy","ref","class"]);var s=S(),n=h(s);{let o=x(()=>Ft("py-6 text-center text-sm",t.class));A(n,()=>Jr,(i,c)=>{c(i,et({"data-slot":"command-empty",get class(){return a(o)}},()=>r,{get ref(){return e()},set ref(d){e(d)}}))})}l(u,s),j()}var Ms=k("<!> <!>",1);function ne(u,t){$(t,!0);let e=m(t,"ref",15,null),r=F(t,["$$slots","$$events","$$legacy","ref","class","children","heading","value"]);var s=S(),n=h(s);{let o=x(()=>Ft("overflow-hidden p-1 text-foreground",t.class)),i=x(()=>t.value??t.heading??`----${crypto.randomUUID()}`);A(n,()=>Yr,(c,d)=>{d(c,et({"data-slot":"command-group","data-command-group":"",get class(){return a(o)},get value(){return a(i)}},()=>r,{get ref(){return e()},set ref(p){e(p)},children:(p,_)=>{var f=Ms(),g=h(f);{var v=w=>{var V=S(),O=h(V);A(O,()=>Zr,(Y,rt)=>{rt(Y,{class:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:(lt,P)=>{vt();var C=Pt();ot(()=>at(C,t.heading)),l(lt,C)},$$slots:{default:!0}})}),l(w,V)};L(g,w=>{t.heading&&w(v)})}var I=E(g,2);A(I,()=>rs,(w,V)=>{V(w,{get children(){return t.children}})}),l(p,f)},$$slots:{default:!0}}))})}l(u,s),j()}var Ns=k('<div class="flex items-center border-b px-3" data-command-input-wrapper=""><!> <!></div>');function Gs(u,t){$(t,!0);let e=m(t,"ref",15,null),r=m(t,"value",15,""),s=F(t,["$$slots","$$events","$$legacy","ref","class","value"]);var n=Ns(),o=T(n);Er(o,{class:"mr-2 h-4 w-4 shrink-0 opacity-50"});var i=E(o,2);{let c=x(()=>Ft("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t.class));A(i,()=>as,(d,p)=>{p(d,et({"data-slot":"command-input","data-command-input":"",get class(){return a(c)}},()=>s,{get ref(){return e()},set ref(_){e(_)},get value(){return r()},set value(_){r(_)}}))})}D(n),l(u,n),j()}function qt(u,t){$(t,!0);let e=m(t,"ref",15,null),r=F(t,["$$slots","$$events","$$legacy","ref","class"]);var s=S(),n=h(s);{let o=x(()=>Ft("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none hover:bg-accent hover:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t.class));A(n,()=>is,(i,c)=>{c(i,et({"data-slot":"command-item","data-command-item":"",get class(){return a(o)}},()=>r,{get ref(){return e()},set ref(d){e(d)}}))})}l(u,s),j()}function Es(u,t){$(t,!0);let e=m(t,"ref",15,null),r=F(t,["$$slots","$$events","$$legacy","ref","class","children"]);var s=S(),n=h(s);{let o=x(()=>Ft("max-h-80 overflow-x-hidden overflow-y-auto",t.class));A(n,()=>ds,(i,c)=>{c(i,et({"data-slot":"command-list",get class(){return a(o)}},()=>r,{get ref(){return e()},set ref(d){e(d)},children:(d,p)=>{var _=S(),f=h(_);A(f,()=>us,(g,v)=>{v(g,{children:(I,w)=>{var V=S(),O=h(V);R(O,()=>t.children??K),l(I,V)},$$slots:{default:!0}})}),l(d,_)},$$slots:{default:!0}}))})}l(u,s),j()}var Rs=k("<!> <span>New Dashboard</span>",1),Os=k("<!> <span>Import JSON</span>",1),Ts=k("<!> <span>Import from Grafana</span>",1),Ds=k("<!> <!> <!>",1),$s=k('<span class="flex items-center gap-1 text-xs text-muted-foreground"><!> will copy</span>'),js=k('<span class="flex items-center gap-1 text-xs text-muted-foreground"><!> applied</span>'),Bs=k('<!> <div class="flex min-w-0 flex-1 flex-col"><span class="truncate"> </span> <span class="truncate text-xs text-muted-foreground"> <!></span></div> <!>',1),Fs=k('<!> <div class="flex min-w-0 flex-1 flex-col"><span class="truncate"> </span> <span class="truncate text-xs text-muted-foreground"> <!></span></div>',1),Ls=k('<!> <div class="flex min-w-0 flex-1 flex-col"><span class="truncate"> </span> <span class="truncate text-xs text-muted-foreground">Add as a widget <!></span></div>',1),Us=k("<!> <!> <!> <!> <!>",1),Hs=k('<div class="border-t px-3 py-2 text-xs text-muted-foreground">Metrics from your 25 most recent projects</div>'),zs=k("<!> <!> <!>",1);function ga(u,t){$(t,!0);let e=m(t,"open",15,!1),r=X(oe([])),s=X(oe([])),n=X(oe([])),o=X(!1),i=X(!1),c=X(!1);const d=x(()=>Te.currentProjectId),p=x(()=>Te.currentProject?.organizationId??null),_=x(()=>Dr.organizations.length>1);Le(()=>{e()&&!a(i)&&f(),e()||b(i,!1)});async function f(){b(i,!0);const P=a(d)??void 0,[C,N,U]=await Promise.all([$t.get("/dashboards/library",{projectId:P}).catch(()=>({organizations:[]})),$t.get("/dashboard-templates",{projectId:P}).catch(()=>({templates:[]})),a(p)?$t.get(`/metrics/discover/org?organizationId=${a(p)}`,{projectId:P}).catch(()=>({metrics:[],truncated:!1})):Promise.resolve({metrics:[],truncated:!1})]);b(r,C.organizations??[],!0),b(s,N.templates??[],!0),b(n,U.metrics??[],!0),b(o,!!U.truncated)}function g(){e(!1)}function v(P){const C=Or(`/dashboards${P}`,"preset","from","to");De.url.pathname+De.url.search!==C&&Tr(C)}function I(P){if(g(),P==="create"&&t.onCreateNew)return t.onCreateNew();if(P==="import"&&t.onImportJson)return t.onImportJson();if(P==="grafana"&&t.onImportGrafana)return t.onImportGrafana();v(`?action=${P}`)}function w(P){g(),t.onApplied?t.onApplied(P):v(`?dashboard=${P}`)}async function V(P,C){if(!a(d)){jt.error("Select a project first");return}if(C.appliedProjectIds.includes(a(d))){w(C.id);return}b(c,!0);try{if(a(p)!==null&&P.id!==a(p)){const N=await $t.post(`/dashboards/${C.id}/copy`,{organizationId:a(p),applyToProjectIds:[a(d)]},{projectId:a(d)});jt.success("Successfully copied the Dashboard"),w(N.id)}else{const U=(await $t.get(`/dashboards/${C.id}`,{projectId:a(d)})).appliedProjectIds??C.appliedProjectIds;U.includes(a(d))||await $t.put(`/dashboards/${C.id}/apply`,{projectIds:[...U,a(d)]},{projectId:a(d)}),jt.success("Successfully applied the Dashboard"),w(C.id)}}catch(N){Ee(N)!==403&&jt.error(Re(N)||"Failed to add the dashboard")}finally{b(c,!1)}}async function O(P){if(!a(d)){jt.error("Select a project first");return}b(c,!0);try{const C=await $t.post(`/dashboard-templates/${P.key}/install`,{},{projectId:a(d)});jt.success("Successfully installed the Dashboard"),w(C.id)}catch(C){Ee(C)!==403&&jt.error(Re(C)||"Failed to install the template")}finally{b(c,!1)}}function Y(P){g(),t.onAddMetric?t.onAddMetric(P.name):v(`?addMetric=${encodeURIComponent(P.name)}`)}var rt=S(),lt=h(rt);A(lt,()=>ks,(P,C)=>{C(P,{title:"Add Dashboard",description:"Search dashboards, templates and metrics",get open(){return e()},set open(N){e(N)},children:(N,U)=>{var dt=zs(),Jt=h(dt);A(Jt,()=>Gs,(z,B)=>{B(z,{placeholder:"Search dashboards, templates, metrics..."})});var kt=E(Jt,2);A(kt,()=>Es,(z,B)=>{B(z,{children:(Lt,Vt)=>{var Ut=Us(),bt=h(Ut);A(bt,()=>Vs,(W,H)=>{H(W,{children:(ct,Mt)=>{vt();var ut=Pt("No results found.");l(ct,ut)},$$slots:{default:!0}})});var ke=E(bt,2);A(ke,()=>ne,(W,H)=>{H(W,{heading:"Actions",children:(ct,Mt)=>{var ut=Ds(),ht=h(ut);A(ht,()=>qt,(nt,J)=>{J(nt,{value:"action-new-dashboard",keywords:["new","create","dashboard"],onSelect:()=>I("create"),children:(M,ft)=>{var tt=Rs(),st=h(tt);$r(st,{}),vt(2),l(M,tt)},$$slots:{default:!0}})});var Nt=E(ht,2);A(Nt,()=>qt,(nt,J)=>{J(nt,{value:"action-import-json",keywords:["import","json","file"],onSelect:()=>I("import"),children:(M,ft)=>{var tt=Os(),st=h(tt);bs(st,{}),vt(2),l(M,tt)},$$slots:{default:!0}})});var yt=E(Nt,2);A(yt,()=>qt,(nt,J)=>{J(nt,{value:"action-import-grafana",keywords:["import","grafana","convert"],onSelect:()=>I("grafana"),children:(M,ft)=>{var tt=Ts(),st=h(tt);ys(st,{}),vt(2),l(M,tt)},$$slots:{default:!0}})}),l(ct,ut)},$$slots:{default:!0}})});var Ve=E(ke,2);se(Ve,17,()=>a(r),W=>W.id,(W,H)=>{var ct=S(),Mt=h(ct);{var ut=ht=>{var Nt=S(),yt=h(Nt);{let nt=x(()=>a(_)?`Dashboards: ${a(H).name}`:"Your Dashboards");A(yt,()=>ne,(J,M)=>{M(J,{get heading(){return a(nt)},children:(ft,tt)=>{var st=S(),Xt=h(st);se(Xt,17,()=>a(H).dashboards,Gt=>Gt.id,(Gt,Z)=>{const Yt=x(()=>a(d)?a(Z).appliedProjectIds.includes(a(d)):!1);var re=S(),Et=h(re);{let Rt=x(()=>`dashboard-${a(H).id}-${a(Z).id}`),Ot=x(()=>[a(Z).name,a(Z).description,a(H).name]);A(Et,()=>qt,(It,Qt)=>{Qt(It,{get value(){return a(Rt)},get keywords(){return a(Ot)},get disabled(){return a(c)},onSelect:()=>V(a(H),a(Z)),children:(Tt,Zt)=>{var Ht=Bs(),Ct=h(Ht);Is(Ct,{});var mt=E(Ct,2),zt=T(mt),Ze=T(zt,!0);D(zt);var Ne=E(zt,2),Ge=T(Ne),tr=E(Ge);{var er=pt=>{var wt=Pt();ot(()=>at(wt,`· ${a(Z).description??""}`)),l(pt,wt)};L(tr,pt=>{a(Z).description&&pt(er)})}D(Ne),D(mt);var rr=E(mt,2);{var sr=pt=>{var wt=$s(),ie=T(wt);xs(ie,{class:"h-3 w-3"}),vt(),D(wt),l(pt,wt)},ar=pt=>{var wt=S(),ie=h(wt);{var nr=le=>{var de=js(),or=T(de);Br(or,{class:"h-3 w-3"}),vt(),D(de),l(le,de)};L(ie,le=>{a(Yt)&&le(nr)},!0)}l(pt,wt)};L(rr,pt=>{a(p)!==null&&a(H).id!==a(p)?pt(sr):pt(ar,!1)})}ot(()=>{at(Ze,a(Z).name),at(Ge,`${a(Z).widgetCount??""} widget${a(Z).widgetCount===1?"":"s"} `)}),l(Tt,Ht)},$$slots:{default:!0}})})}l(Gt,re)}),l(ft,st)},$$slots:{default:!0}})})}l(ht,Nt)};L(Mt,ht=>{a(H).dashboards.length>0&&ht(ut)})}l(W,ct)});var Me=E(Ve,2);{var Xe=W=>{var H=S(),ct=h(H);A(ct,()=>ne,(Mt,ut)=>{ut(Mt,{heading:"Templates",children:(ht,Nt)=>{var yt=S(),nt=h(yt);se(nt,17,()=>a(s),J=>J.key,(J,M)=>{var ft=S(),tt=h(ft);{let st=x(()=>`template-${a(M).key}`),Xt=x(()=>[a(M).name,a(M).description,a(M).category,"template"]);A(tt,()=>qt,(Gt,Z)=>{Z(Gt,{get value(){return a(st)},get keywords(){return a(Xt)},get disabled(){return a(c)},onSelect:()=>O(a(M)),children:(Yt,re)=>{var Et=Fs(),Rt=h(Et);ws(Rt,{});var Ot=E(Rt,2),It=T(Ot),Qt=T(It,!0);D(It);var Tt=E(It,2),Zt=T(Tt),Ht=E(Zt);{var Ct=mt=>{var zt=Pt();ot(()=>at(zt,`· ${a(M).description??""}`)),l(mt,zt)};L(Ht,mt=>{a(M).description&&mt(Ct)})}D(Tt),D(Ot),ot(()=>{at(Qt,a(M).name),at(Zt,`${a(M).category??""} · ${a(M).widgetCount??""} widget${a(M).widgetCount===1?"":"s"} `)}),l(Yt,Et)},$$slots:{default:!0}})})}l(J,ft)}),l(ht,yt)},$$slots:{default:!0}})}),l(W,H)};L(Me,W=>{a(s).length>0&&W(Xe)})}var Ye=E(Me,2);{var Qe=W=>{var H=S(),ct=h(H);A(ct,()=>ne,(Mt,ut)=>{ut(Mt,{heading:"Metrics",children:(ht,Nt)=>{var yt=S(),nt=h(yt);se(nt,17,()=>a(n),J=>J.name,(J,M)=>{var ft=S(),tt=h(ft);{let st=x(()=>`metric-${a(M).name}`),Xt=x(()=>[a(M).name,"metric","chart"]);A(tt,()=>qt,(Gt,Z)=>{Z(Gt,{get value(){return a(st)},get keywords(){return a(Xt)},get disabled(){return a(c)},onSelect:()=>Y(a(M)),children:(Yt,re)=>{var Et=Ls(),Rt=h(Et);jr(Rt,{});var Ot=E(Rt,2),It=T(Ot),Qt=T(It,!0);D(It);var Tt=E(It,2),Zt=E(T(Tt));{var Ht=Ct=>{var mt=Pt();ot(()=>at(mt,`· seen in ${a(M).projectIds.length??""} projects`)),l(Ct,mt)};L(Zt,Ct=>{a(M).projectIds.length>1&&Ct(Ht)})}D(Tt),D(Ot),ot(()=>at(Qt,a(M).name)),l(Yt,Et)},$$slots:{default:!0}})})}l(J,ft)}),l(ht,yt)},$$slots:{default:!0}})}),l(W,H)};L(Ye,W=>{a(n).length>0&&W(Qe)})}l(Lt,Ut)},$$slots:{default:!0}})});var G=E(kt,2);{var Q=z=>{var B=Hs();l(z,B)};L(G,z=>{a(o)&&a(n).length>0&&z(Q)})}l(N,dt)},$$slots:{default:!0}})}),l(u,rt),j()}export{xs as B,qe as C,ga as D,Is as L,bs as U,Cs as a,Gs as b,Es as c,Vs as d,ne as e,qt as f};