orcaq 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{BJCrbji-.js → 5oARMrld.js} +1 -1
- package/.output/public/_nuxt/{kvtnkChG.js → 9sDqz0uT.js} +1 -1
- package/.output/public/_nuxt/{Bmgr9uz4.js → B-4cXhNx.js} +1 -1
- package/.output/public/_nuxt/{DpT8FO1Q.js → BC6CdfCG.js} +1 -1
- package/.output/public/_nuxt/{Ca0KO9Xq.js → BCAMWuzu.js} +1 -1
- package/.output/public/_nuxt/{Bq47tjcm.js → BG-rJefG.js} +1 -1
- package/.output/public/_nuxt/{BpvGVfME.js → BKFPmrcv.js} +1 -1
- package/.output/public/_nuxt/{COHOh4Oe.js → BMLhg7hE.js} +1 -1
- package/.output/public/_nuxt/{atdCACH-.js → BYOPXIhP.js} +1 -1
- package/.output/public/_nuxt/{B46blMXm.js → BYxQJ0gE.js} +1 -1
- package/.output/public/_nuxt/{BrNfge84.js → BZ4ThSRp.js} +1 -1
- package/.output/public/_nuxt/{Dq1JM9WZ.js → BZmDBfmV.js} +1 -1
- package/.output/public/_nuxt/{DHAL8jJG.js → B_ERKujF.js} +4 -4
- package/.output/public/_nuxt/{CycELG5y.js → BccuQbKA.js} +1 -1
- package/.output/public/_nuxt/{B6MkNyZd.js → BcyZ-eCi.js} +1 -1
- package/.output/public/_nuxt/{63YtjFEq.js → BdZsZgcB.js} +1 -1
- package/.output/public/_nuxt/{S1qa1a4x.js → BigePTMZ.js} +1 -1
- package/.output/public/_nuxt/{BL__uYa3.js → BkN-uAef.js} +1 -1
- package/.output/public/_nuxt/{BWZ7atse.js → BmAp-sfn.js} +1 -1
- package/.output/public/_nuxt/{BogEzQi9.js → BqHKqsJ5.js} +3 -3
- package/.output/public/_nuxt/{DpEV6S2O.js → BseVuOZ1.js} +1 -1
- package/.output/public/_nuxt/{B2IKcIj2.js → BtuY54_l.js} +1 -1
- package/.output/public/_nuxt/{B8TrrBEb.js → Buh0pI3n.js} +1 -1
- package/.output/public/_nuxt/{CAnr3OhD.js → BzVvHKKC.js} +1 -1
- package/.output/public/_nuxt/{DuCDilAk.js → BzywwPw6.js} +1 -1
- package/.output/public/_nuxt/BzzgEvr9.js +7 -0
- package/.output/public/_nuxt/{AymhMj9v.js → C-I81xfB.js} +1 -1
- package/.output/public/_nuxt/{DAr5YiBT.js → C-Pa1rIR.js} +1 -1
- package/.output/public/_nuxt/{CMkzSwnO.js → C-pX1zRI.js} +1 -1
- package/.output/public/_nuxt/{ioXB9E2w.js → C0vscAQB.js} +1 -1
- package/.output/public/_nuxt/C4FrpL8k.js +1 -0
- package/.output/public/_nuxt/{Cq-MDPLE.js → C4zYnWdF.js} +1 -1
- package/.output/public/_nuxt/{C_7gtl40.js → C9kgALYc.js} +1 -1
- package/.output/public/_nuxt/{Oe2GG0Lt.js → CCmd8DpQ.js} +1 -1
- package/.output/public/_nuxt/{DsmBazLf.js → CGq9Twnj.js} +1 -1
- package/.output/public/_nuxt/{BEyCol50.js → CHMlsxJw.js} +1 -1
- package/.output/public/_nuxt/{Y1gXUmjt.js → CLQzuV82.js} +1 -1
- package/.output/public/_nuxt/{BJVPtt2X.js → CL_1HDtg.js} +1 -1
- package/.output/public/_nuxt/{DVnDb6ua.js → CRqiHVA4.js} +1 -1
- package/.output/public/_nuxt/{ByibjLZn.js → CS4EJV3B.js} +1 -1
- package/.output/public/_nuxt/{Bf6Q3Zl5.js → CSExCj8O.js} +1 -1
- package/.output/public/_nuxt/{MeLWmO7R.js → CY_CG0AU.js} +1 -1
- package/.output/public/_nuxt/{D-9vaM6z.js → CbHZwHBV.js} +1 -1
- package/.output/public/_nuxt/{MW5K_zef.js → Cbo6GmdE.js} +1 -1
- package/.output/public/_nuxt/{dWu56FdP.js → Cf460dGA.js} +1 -1
- package/.output/public/_nuxt/{DcCF9IZB.js → CfseWBL0.js} +1 -1
- package/.output/public/_nuxt/{qzrMNYut.js → Ch0I4juX.js} +1 -1
- package/.output/public/_nuxt/Chvs1m1n.js +1 -0
- package/.output/public/_nuxt/{CHEpbbGc.js → Chx1IK9D.js} +1 -1
- package/.output/public/_nuxt/{ByiJDSw8.js → CjpXgncp.js} +1 -1
- package/.output/public/_nuxt/{BpUSbMUb.js → CkjXKCQH.js} +1 -1
- package/.output/public/_nuxt/{C3ZBsVV_.js → Ckry8tuC.js} +2 -2
- package/.output/public/_nuxt/{CsRSZpa6.js → CmOZ0DCP.js} +1 -1
- package/.output/public/_nuxt/{Bq7OeLM1.js → CmjR7OTc.js} +1 -1
- package/.output/public/_nuxt/{CDJKw_ak.js → Co7e2XML.js} +1 -1
- package/.output/public/_nuxt/{BzvSm28k.js → CqkctA6I.js} +1 -1
- package/.output/public/_nuxt/{DEZMnZ2r.js → CtB2-SFY.js} +1 -1
- package/.output/public/_nuxt/{dNPwafbq.js → CtCx-4nJ.js} +1 -1
- package/.output/public/_nuxt/{xOD4Ev56.js → CtkhwZY7.js} +1 -1
- package/.output/public/_nuxt/Cty7uMrC.js +1 -0
- package/.output/public/_nuxt/{C2XHqDOf.js → CvFjsYJZ.js} +1 -1
- package/.output/public/_nuxt/{D4pAW_0T.js → Czr647QE.js} +1 -1
- package/.output/public/_nuxt/{BcsKoAPU.js → D0lW43G8.js} +28 -28
- package/.output/public/_nuxt/{DDebxXP-.js → D28ykMUi.js} +1 -1
- package/.output/public/_nuxt/{Ci5B19-c.js → DA4Xn6lm.js} +1 -1
- package/.output/public/_nuxt/{BWebIWit.js → DChDHsIe.js} +1 -1
- package/.output/public/_nuxt/{DSaBCmOg.js → DJBO_9pO.js} +1 -1
- package/.output/public/_nuxt/{DPIEiNwW.js → DJXB1Li8.js} +1 -1
- package/.output/public/_nuxt/{DJH-4SVI.js → DKLk0T0H.js} +1 -1
- package/.output/public/_nuxt/{C6dIAdHr.js → DLBsdU7G.js} +1 -1
- package/.output/public/_nuxt/{BtyzMl9p.js → DOAixkpJ.js} +1 -1
- package/.output/public/_nuxt/{BoMjapT5.js → DPq8O9CC.js} +1 -1
- package/.output/public/_nuxt/{Bmx1kTaZ.js → DQdA5Twt.js} +1 -1
- package/.output/public/_nuxt/{DGvAu532.js → DRh-06Hb.js} +1 -1
- package/.output/public/_nuxt/{JOg_XIAv.js → DTvJImVU.js} +1 -1
- package/.output/public/_nuxt/{C7BQpy74.js → DVkCRFXi.js} +1 -1
- package/.output/public/_nuxt/{BjqbQLK3.js → DX8ecA59.js} +1 -1
- package/.output/public/_nuxt/DakKehZj.js +1 -0
- package/.output/public/_nuxt/{BoIj4dtd.js → Db3rTgnd.js} +1 -1
- package/.output/public/_nuxt/{BRFPdiIh.js → DfyynWBR.js} +1 -1
- package/.output/public/_nuxt/{B5WGo5x7.js → DgJOougY.js} +1 -1
- package/.output/public/_nuxt/DkQCknMw.js +1 -0
- package/.output/public/_nuxt/{Sf02B6Pt.js → DpBeiFQV.js} +1 -1
- package/.output/public/_nuxt/{sk7V7xQl.js → DrdbRRXx.js} +1 -1
- package/.output/public/_nuxt/{CS9hqyP3.js → Dtl3qje7.js} +1 -1
- package/.output/public/_nuxt/{DNoTlUiY.js → Du5Ka6uI.js} +1 -1
- package/.output/public/_nuxt/{B73IHAoF.js → Dunt8-TF.js} +1 -1
- package/.output/public/_nuxt/{CrNLwdoE.js → DvWEWtFg.js} +1 -1
- package/.output/public/_nuxt/{DkD29_YA.js → KynNdNgX.js} +1 -1
- package/.output/public/_nuxt/{BqU89KuH.js → MWrJVKEf.js} +2 -2
- package/.output/public/_nuxt/{DMmjWR_K.js → NYpsF1lW.js} +1 -1
- package/.output/public/_nuxt/{L2I3LmpB.js → Nof0nVJ6.js} +1 -1
- package/.output/public/_nuxt/{BTYBVtfa.js → Ohrg3hU7.js} +1 -1
- package/.output/public/_nuxt/{CerLmMsC.js → Rrce0BXL.js} +3 -3
- package/.output/public/_nuxt/{xp7rFxcm.js → VNOocds9.js} +1 -1
- package/.output/public/_nuxt/Y-MEKhtd.js +1 -0
- package/.output/public/_nuxt/{CSQ0xnqv.js → YdOCcCRS.js} +1 -1
- package/.output/public/_nuxt/bYQCSC5-.js +1 -0
- package/.output/public/_nuxt/{vhkvHdfO.js → bkzIFcLw.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/ad11b978-8fdd-4bb2-9b38-1d6fe93f994e.json +1 -0
- package/.output/public/_nuxt/{FDw04QOj.js → eOeO5uM0.js} +1 -1
- package/.output/public/_nuxt/{BPACuoI0.js → g9ZMnTLJ.js} +1 -1
- package/.output/public/_nuxt/{Cnfx1zWl.js → hIbRoJ89.js} +1 -1
- package/.output/public/_nuxt/{8tyEaimf.js → j23gQsG7.js} +1 -1
- package/.output/public/_nuxt/klVlxnpt.js +1 -0
- package/.output/public/_nuxt/{DWqOZJe7.js → qRiDKEr7.js} +1 -1
- package/.output/public/_nuxt/{iNy-Nl0_.js → syq5mCJi.js} +1 -1
- package/.output/public/_nuxt/{COq7mAG7.js → v41yYOa9.js} +1 -1
- package/.output/public/_nuxt/{B9uki8o2.js → vaJvtND9.js} +1 -1
- package/.output/public/_nuxt/{wRAs0MDn.js → wodl4bLW.js} +1 -1
- package/.output/server/chunks/build/client.manifest.mjs +675 -675
- package/.output/server/chunks/build/client.manifest.mjs.map +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +635 -635
- package/.output/server/package.json +1 -1
- package/package.json +1 -1
- package/.output/public/_nuxt/BS-LtKx4.js +0 -1
- package/.output/public/_nuxt/BTheloyh.js +0 -1
- package/.output/public/_nuxt/Bj7ctTfH.js +0 -1
- package/.output/public/_nuxt/BpLDGvqy.js +0 -1
- package/.output/public/_nuxt/CtWq1MER.js +0 -7
- package/.output/public/_nuxt/Cww9dXBK.js +0 -1
- package/.output/public/_nuxt/DfNTLojg.js +0 -1
- package/.output/public/_nuxt/M6bBaUHa.js +0 -1
- package/.output/public/_nuxt/_qKPTuua.js +0 -1
- package/.output/public/_nuxt/builds/meta/7c171291-8bbd-4c4c-8904-0afae065b82e.json +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cr as ct,cs as dt,ct as C,cu as d,cv as se,cw as ke,cx as pt,cy as H,cz as w,cA as v,cB as P,cC as L,cD as ft,cE as ee,cF as mt,cG as vt,cH as R,cI as ht,r as Y,ci as gt,c as V,cJ as re,au as yt}from"./
|
|
1
|
+
import{cr as ct,cs as dt,ct as C,cu as d,cv as se,cw as ke,cx as pt,cy as H,cz as w,cA as v,cB as P,cC as L,cD as ft,cE as ee,cF as mt,cG as vt,cH as R,cI as ht,r as Y,ci as gt,c as V,cJ as re,au as yt}from"./D0lW43G8.js";var G;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function a(s){throw new Error}e.assertNever=a,e.arrayToEnum=s=>{const o={};for(const i of s)o[i]=i;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(n=>typeof s[s[n]]!="number"),i={};for(const n of o)i[n]=s[n];return e.objectValues(i)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},e.find=(s,o)=>{for(const i of s)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(G||(G={}));var ge;(function(e){e.mergeShapes=(t,a)=>({...t,...a})})(ge||(ge={}));G.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);G.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ne extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=t}format(t){const a=t||function(o){return o.message},r={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(a(i));else{let n=r,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(n[l]=n[l]||{_errors:[]},n[l]._errors.push(a(i))):n[l]=n[l]||{_errors:[]},n=n[l],c++}}};return s(this),r}static assert(t){if(!(t instanceof ne))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,G.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=a=>a.message){const a=Object.create(null),r=[];for(const s of this.issues)if(s.path.length>0){const o=s.path[0];a[o]=a[o]||[],a[o].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:a}}get formErrors(){return this.flatten()}}ne.create=e=>new ne(e);var ye;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ye||(ye={}));var b;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(b||(b={}));class be extends Error{constructor(t,a){super(t),this.name="ParseError",this.type=a.type,this.field=a.field,this.value=a.value,this.line=a.line}}function ie(e){}function bt(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=ie,onError:a=ie,onRetry:r=ie,onComment:s}=e;let o="",i=!0,n,c="",l="";function p(m){const g=i?m.replace(/^\xEF\xBB\xBF/,""):m,[y,T]=_t(`${o}${g}`);for(const u of y)f(u);o=T,i=!1}function f(m){if(m===""){h();return}if(m.startsWith(":")){s&&s(m.slice(m.startsWith(": ")?2:1));return}const g=m.indexOf(":");if(g!==-1){const y=m.slice(0,g),T=m[g+1]===" "?2:1,u=m.slice(g+T);S(y,u,m);return}S(m,"",m)}function S(m,g,y){switch(m){case"event":l=g;break;case"data":c=`${c}${g}
|
|
2
2
|
`;break;case"id":n=g.includes("\0")?void 0:g;break;case"retry":/^\d+$/.test(g)?r(parseInt(g,10)):a(new be(`Invalid \`retry\` value: "${g}"`,{type:"invalid-retry",value:g,line:y}));break;default:a(new be(`Unknown field "${m.length>20?`${m.slice(0,20)}…`:m}"`,{type:"unknown-field",field:m,value:g,line:y}));break}}function h(){c.length>0&&t({id:n,event:l||void 0,data:c.endsWith(`
|
|
3
3
|
`)?c.slice(0,-1):c}),n=void 0,c="",l=""}function x(m={}){o&&m.consume&&f(o),i=!0,n=void 0,c="",l="",o=""}return{feed:p,reset:x}}function _t(e){const t=[];let a="",r=0;for(;r<e.length;){const s=e.indexOf("\r",r),o=e.indexOf(`
|
|
4
4
|
`,r);let i=-1;if(s!==-1&&o!==-1?i=Math.min(s,o):s!==-1?s===e.length-1?i=-1:i=s:o!==-1&&(i=o),i===-1){a=e.slice(r);break}else{const n=e.slice(r,i);t.push(n),r=i+1,e[r-1]==="\r"&&e[r]===`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b1 as V,r as T,a3 as X,aB as Y,G as $,c as N,K as G,au as j,b2 as m,b3 as q,b4 as Q,b5 as A,b6 as Z,b7 as J,b8 as ee,d as ae,b9 as te,e as se,f as H,g as _,i as le,aH as ne,P as oe,o as re}from"./
|
|
1
|
+
import{b1 as V,r as T,a3 as X,aB as Y,G as $,c as N,K as G,au as j,b2 as m,b3 as q,b4 as Q,b5 as A,b6 as Z,b7 as J,b8 as ee,d as ae,b9 as te,e as se,f as H,g as _,i as le,aH as ne,P as oe,o as re}from"./D0lW43G8.js";import{b as ce,_ as ie}from"./DChDHsIe.js";import{u as ue}from"./C0vscAQB.js";const de=V("erdStore",()=>{const i=T(""),s=T([]);function u(l){s.value=l}function f(l){i.value=l}return{currentConnectionId:i,tables:s,setTables:u,setCurrentConnectionId:f}},{persist:!1}),fe=()=>{var a;const i=X(),s=de();if(s.tables.length>0&&((a=i.selectedConnection)==null?void 0:a.id)===s.currentConnectionId)return{isFetching:!1,tableSchema:Y(s.tables||[])};const{data:u,status:f}=ue("/api/metadata/erd",{method:"POST",body:{...$(i.selectedConnection)},onResponseError({response:t}){G(t==null?void 0:t.statusText)},onResponse:({response:t})=>{var g;const d=t._data.tables||[];s.setTables(d),s.setCurrentConnectionId(((g=i.selectedConnection)==null?void 0:g.id)||"")}},"$13ug5ALprk"),l=N(()=>f.value==="pending"),n=N(()=>{var t;return((t=u.value)==null?void 0:t.tables)||[]});return{isFetching:l,tableSchema:n}},{HORIZONTAL_STEP:M,VERTICAL_STEP:W}=Z,D=(i,s)=>{const u=new Map(s.map(a=>[m({schemaName:a.schema,tableName:a.table}),a])),f=u.get(i);if(!f)return{leftTables:[],rightTables:[]};const l=[];for(const a of f.foreign_keys){const t=m({schemaName:a.reference_schema,tableName:a.reference_table}),d=u.get(t);d&&t!==i&&l.push(d)}const n=[];for(const a of s)if(m({schemaName:a.schema,tableName:a.table})!==i){for(const d of a.foreign_keys)if(m({schemaName:d.reference_schema,tableName:d.reference_table})===i){n.push(a);break}}return{leftTables:l,rightTables:n}},be=({mapTablesData:i,startId:s})=>{const u={},f=[{id:s,depth:0}],l=new Set;for(;f.length>0;){const{id:n,depth:a}=f.shift();if(l.has(n))continue;l.add(n),u[n]=a;const t=i.get(n);if(t)for(const d of t.foreign_keys){const g=m({schemaName:d.reference_schema,tableName:d.reference_table});i.has(g)&&!l.has(g)&&f.push({id:g,depth:a+1})}}return u},z=({mapTablesData:i,currentWeight:s,currentLeafId:u,currentMatrix:f,visited:l=new Set})=>{if(l.has(u)||(l.add(u),!i.get(u)))return f;f[u]=s+1;for(const[a,t]of i.entries())for(const d of t.foreign_keys)m({schemaName:d.reference_schema,tableName:d.reference_table})===u&&!l.has(a)&&z({mapTablesData:i,currentWeight:f[u],currentLeafId:a,currentMatrix:f,visited:l});return f};function he(i){const{allTables:s,initialTableId:u,autoExpandInitial:f=!0}=i,l=T(new Set),n=T(new Set),a=T(new Map),t=T({}),d=T(new Map),g=e=>{if(n.value.clear(),l.value.clear(),a.value.clear(),t.value={},d.value.clear(),!f){n.value.add(e),t.value[e]={x:0,y:0};return}const o=J(e,s.value);if(!o)return;const{nodes:h}=ee(o);for(const r of h)n.value.add(r.id),t.value[r.id]=r.position,a.value.set(r.id,new Set(["__initial__"]));l.value.add(e),y()},w=()=>{if(n.value.clear(),l.value.clear(),a.value.clear(),t.value={},d.value.clear(),s.value.length===0)return;const{nodes:e,edges:o,centerId:h}=ce(s.value);for(const r of e)n.value.add(r.id),t.value[r.id]=r.position,a.value.set(r.id,new Set(["__initial__"]));h&&l.value.add(h),y()},y=()=>{var o;d.value.clear();const e=new Map;for(const[h,r]of Object.entries(t.value)){const c=s.value.find(b=>m({schemaName:b.schema,tableName:b.table})===h);if(c){const b=A((o=c.columns)==null?void 0:o.length)+W,p=Math.round(r.x/M);e.has(p)||e.set(p,[]),e.get(p).push({y:r.y,height:b})}}for(const[h,r]of e.entries()){const c=Math.max(...r.map(b=>b.y+b.height));d.value.set(h,c)}},I=(e,o,h)=>{var B;const r=A((B=e.columns)==null?void 0:B.length)+W,c=new Map(s.value.map(x=>[m({schemaName:x.schema,tableName:x.table}),x])),b=m({schemaName:e.schema,tableName:e.table});let p=1;if(h==="left")p=(be({mapTablesData:c,startId:b})[b]??0)+1;else{const x={};z({mapTablesData:c,currentWeight:0,currentLeafId:b,currentMatrix:x}),p=x[b]??1}const K=t.value[o]||{x:0},L=Math.round(K.x/M),P=h==="left"?L-p:L+p,U=P*M,O=d.value.get(P)??0;return d.value.set(P,O+r),{x:U,y:O}};j([u,s],([e,o])=>{o.length!==0&&(e?g(e):w())},{immediate:!0});const S=N(()=>s.value.filter(e=>{const o=m({schemaName:e.schema,tableName:e.table});return n.value.has(o)})),R=N(()=>q(S.value,t.value)),E=N(()=>Q(S.value).filter(o=>n.value.has(o.source)&&n.value.has(o.target))),C=e=>{const{leftTables:o,rightTables:h}=D(e,s.value);return o.length>0||h.length>0},k=e=>l.value.has(e),F=e=>{if(l.value.has(e))return;const{leftTables:o,rightTables:h}=D(e,s.value);o.forEach(r=>{const c=m({schemaName:r.schema,tableName:r.table});a.value.has(c)||a.value.set(c,new Set),a.value.get(c).add(e),!n.value.has(c)&&(n.value.add(c),t.value[c]=I(r,e,"left"))}),h.forEach(r=>{const c=m({schemaName:r.schema,tableName:r.table});a.value.has(c)||a.value.set(c,new Set),a.value.get(c).add(e),!n.value.has(c)&&(n.value.add(c),t.value[c]=I(r,e,"right"))}),l.value.add(e)},v=e=>{if(!l.value.has(e))return;const{leftTables:o,rightTables:h}=D(e,s.value),r=[...o,...h];for(const c of r){const b=m({schemaName:c.schema,tableName:c.table}),p=a.value.get(b);p&&(p.delete(e),p.size===0&&b!==u.value&&(n.value.delete(b),delete t.value[b],a.value.delete(b),l.value.has(b)&&v(b)))}l.value.delete(e)};return{expandedTables:l,visibleNodes:R,visibleEdges:E,expandTable:F,collapseTable:v,isExpanded:k,hasRelations:C,matrixPosition:t}}const me=["id"],Te=ae({__name:"WrapperErdDiagram",props:{tableId:{}},setup(i){const s=i,u=T(),{tableSchema:f,isFetching:l}=fe(),n=N(()=>f.value||[]),a=N(()=>{if(!s.tableId)return;const v=n.value.find(e=>m({schemaName:e.schema,tableName:e.table})===s.tableId||e.table===s.tableId);return v?m({schemaName:v.schema,tableName:v.table}):s.tableId}),{visibleNodes:t,visibleEdges:d,expandTable:g,collapseTable:w,isExpanded:y,hasRelations:I,matrixPosition:S}=he({allTables:n,initialTableId:a,autoExpandInitial:!0}),R=N(()=>n.value.filter(v=>{const e=m({schemaName:v.schema,tableName:v.table});return t.value.some(o=>o.id===e)})),E=T(!1),C=()=>{E.value=!E.value},k=v=>{g(v)},F=v=>{w(v)};return te([{key:"meta+f",callback:()=>{C()},isPreventDefault:!0}],{target:u}),(v,e)=>{const o=oe;return re(),se("div",{class:"w-full h-full relative",ref_key:"wrapperRef",ref:u,id:_(ne)()},[H(o,{visible:_(l)},null,8,["visible"]),H(ie,{nodes:_(t),edges:_(d),matrixTablePosition:_(S),focusTableId:a.value,tables:R.value,tableId:s.tableId,isExpanded:_(y),hasRelations:_(I),isShowFilter:_(E),"onUpdate:isShowFilter":e[0]||(e[0]=h=>le(E)?E.value=h:null),onExpand:k,onCollapse:F},null,8,["nodes","edges","matrixTablePosition","focusTableId","tables","tableId","isExpanded","hasRelations","isShowFilter"])],8,me)}}});export{Te as _};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as Qe,d as U,r as L,au as re,c as T,e as _,m as e,l as N,f as S,a0 as ce,w as E,z as M,t as a,g as t,o as f,A as me,n as oe,df as De,bo as Fe,i as le,aZ as Se,dg as Xe,dh as ke,cq as we,bX as Ie,G as ne,K as fe,a3 as he,k as W,q as Te,J as te,aM as se,bm as _e,bq as Ce,bE as Le,bF as Re,F as D,s as F,bG as Ae,am as He,a6 as ue,a8 as We,a2 as Ye}from"./BcsKoAPU.js";import{g as Ve}from"./CHEpbbGc.js";import{t as K,i as Je,a as Ze,b as et,m as tt,k as st,g as ze,h as je,c as nt,d as Ee,e as ot,f as at,j as it,n as rt,l as lt,S as dt,o as ut,p as ct,_ as Ke,q as mt,r as Me,s as pt,C as ft,u as gt,v as vt,E as xe,w as bt,x as _t,y as ht,z as yt,A as xt,B as $t}from"./Cq-MDPLE.js";import{f as St}from"./-lZvfnzr.js";import{_ as ye}from"./CS9hqyP3.js";import{b as ge,a as Ue}from"./BVmBXPoG.js";import{u as kt}from"./D4pAW_0T.js";import{_ as wt}from"./C_7gtl40.js";import{_ as Pe}from"./BpvGVfME.js";import{_ as It,u as Tt}from"./xp7rFxcm.js";import"./dWu56FdP.js";import"./CS5akSNT.js";var Ne={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},Ct=function(){function n(i){var c=this._condVal=Ee(i)?new RegExp(i):ot(i)?i:null;if(c==null){var s="";K(s)}}return n.prototype.evaluate=function(i){var c=typeof i;return Ee(c)?this._condVal.test(i):at(c)?this._condVal.test(i+""):!1},n}(),Lt=function(){function n(){}return n.prototype.evaluate=function(){return this.value},n}(),Rt=function(){function n(){}return n.prototype.evaluate=function(){for(var i=this.children,c=0;c<i.length;c++)if(!i[c].evaluate())return!1;return!0},n}(),At=function(){function n(){}return n.prototype.evaluate=function(){for(var i=this.children,c=0;c<i.length;c++)if(i[c].evaluate())return!0;return!1},n}(),Pt=function(){function n(){}return n.prototype.evaluate=function(){return!this.child.evaluate()},n}(),Bt=function(){function n(){}return n.prototype.evaluate=function(){for(var i=!!this.valueParser,c=this.getValue,s=c(this.valueGetterParam),o=i?this.valueParser(s):null,h=0;h<this.subCondList.length;h++)if(!this.subCondList[h].evaluate(i?o:s))return!1;return!0},n}();function Be(n,i){if(n===!0||n===!1){var c=new Lt;return c.value=n,c}var s="";return Ge(n)||K(s),n.and?Oe("and",n,i):n.or?Oe("or",n,i):n.not?Et(n,i):Mt(n,i)}function Oe(n,i,c){var s=i[n],o="";et(s)||K(o),s.length||K(o);var h=n==="and"?new Rt:new At;return h.children=tt(s,function(p){return Be(p,c)}),h.children.length||K(o),h}function Et(n,i){var c=n.not,s="";Ge(c)||K(s);var o=new Pt;return o.child=Be(c,i),o.child||K(s),o}function Mt(n,i){for(var c="",s=i.prepareGetValue(n),o=[],h=st(n),p=n.parser,$=p?ze(p):null,b=0;b<h.length;b++){var u=h[b];if(!(u==="parser"||i.valueGetterAttrMap.get(u))){var k=je(Ne,u)?Ne[u]:u,w=n[u],y=$?$(w):w,m=nt(k,y)||k==="reg"&&new Ct(y);m||K(c),o.push(m)}}o.length||K(c);var v=new Bt;return v.valueGetterParam=s,v.valueParser=$,v.getValue=i.getValue,v.subCondList=o,v}function Ge(n){return Je(n)&&!Ze(n)}var Nt=function(){function n(i,c){this._cond=Be(i,c)}return n.prototype.evaluate=function(){return this._cond.evaluate()},n}();function Ot(n,i){return new Nt(n,i)}var Dt={type:"echarts:filter",transform:function(n){for(var i=n.upstream,c,s=Ot(n.config,{valueGetterAttrMap:it({dimension:!0}),prepareGetValue:function($){var b="",u=$.dimension;je($,"dimension")||K(b);var k=i.getDimensionInfo(u);return k||K(b),{dimIdx:k.index}},getValue:function($){return i.retrieveValueFromItem(c,$.dimIdx)}}),o=[],h=0,p=i.count();h<p;h++)c=i.getRawDataItem(h),s.evaluate()&&o.push(c);return{data:o}}},Ft={type:"echarts:sort",transform:function(n){var i=n.upstream,c=n.config,s="",o=rt(c);o.length||K(s);var h=[];lt(o,function(k){var w=k.dimension,y=k.order,m=k.parser,v=k.incomparable;if(w==null&&K(s),y!=="asc"&&y!=="desc"&&K(s),v&&v!=="min"&&v!=="max"){var l="";K(l)}if(y!=="asc"&&y!=="desc"){var r="";K(r)}var d=i.getDimensionInfo(w);d||K(s);var R=m?ze(m):null;m&&!R&&K(s),h.push({dimIdx:d.index,parser:R,comparator:new dt(y,v)})});var p=i.sourceFormat;p!==ut&&p!==ct&&K(s);for(var $=[],b=0,u=i.count();b<u;b++)$.push(i.getRawDataItem(b));return $.sort(function(k,w){for(var y=0;y<h.length;y++){var m=h[y],v=i.retrieveValueFromItem(k,m.dimIdx),l=i.retrieveValueFromItem(w,m.dimIdx);m.parser&&(v=m.parser(v),l=m.parser(l));var r=m.comparator.evaluate(v,l);if(r!==0)return r}return 0}),{data:$}}};function Ht(n){n.registerTransform(Dt),n.registerTransform(Ft)}var Vt=function(n){Ke(i,n);function i(){var c=n!==null&&n.apply(this,arguments)||this;return c.type="dataset",c}return i.prototype.init=function(c,s,o){n.prototype.init.call(this,c,s,o),this._sourceManager=new mt(this),Me(this)},i.prototype.mergeOption=function(c,s){n.prototype.mergeOption.call(this,c,s),Me(this)},i.prototype.optionUpdated=function(){this._sourceManager.dirty()},i.prototype.getSourceManager=function(){return this._sourceManager},i.type="dataset",i.defaultOption={seriesLayoutBy:pt},i}(ft),zt=function(n){Ke(i,n);function i(){var c=n!==null&&n.apply(this,arguments)||this;return c.type="dataset",c}return i.type="dataset",i}(gt);function jt(n){n.registerComponentModel(Vt),n.registerComponentView(zt)}const de=n=>St(n??0),ie=n=>n==null?"0.00/s":`${n.toFixed(2)}/s`,$e=n=>n==null?"0%":`${n.toFixed(2)}%`,ve=n=>{if(!n)return"-";const i=new Date(n);return Number.isNaN(i.getTime())?n:i.toLocaleString()},qe=n=>{if(n==null)return"-";if(n<60)return`${n}s`;const i=Math.floor(n/60),c=n%60;if(i<60)return`${i}m ${c}s`;const s=Math.floor(i/60),o=i%60;return`${s}h ${o}m`},Kt=n=>n==null||n<=0?"0 B":Qe(n).replace(" bytes"," B"),Ut=n=>{if(!n)return"-";const i=n.replace(/\s+/g," ").trim();return i?i.length>320?`${i.slice(0,320)}...`:i:"-"},Gt=n=>(n||"").toLowerCase().includes("idle in transaction"),qt={class:"space-y-4"},Qt={class:"flex items-center justify-between"},Xt={key:0,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},Wt={class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2.5"},Yt={class:"h-full border rounded-lg p-2.5 space-y-2"},Jt={class:"flex items-center gap-1"},Zt={class:"text-sm font-semibold leading-none tabular-nums"},es={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},ts={class:"text-muted-foreground"},ss={class:"tabular-nums text-foreground"},ns={class:"text-muted-foreground"},os={class:"tabular-nums text-foreground"},as={class:"text-muted-foreground"},is={class:"tabular-nums text-foreground"},rs={class:"text-muted-foreground"},ls={class:"tabular-nums text-foreground"},ds={class:"h-full border rounded-lg p-2.5 space-y-2"},us={class:"flex items-center gap-1"},cs={class:"text-sm font-semibold leading-none tabular-nums"},ms={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},ps={class:"text-muted-foreground"},fs={class:"tabular-nums text-foreground"},gs={class:"text-muted-foreground"},vs={class:"tabular-nums text-foreground"},bs={class:"text-muted-foreground"},_s={class:"tabular-nums text-foreground"},hs={class:"text-muted-foreground"},ys={class:"tabular-nums text-foreground"},xs={class:"h-full border rounded-lg p-2.5 space-y-2"},$s={class:"flex items-center gap-1"},Ss={class:"text-sm font-semibold leading-none tabular-nums"},ks={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},ws={class:"text-muted-foreground"},Is={class:"tabular-nums text-foreground"},Ts={class:"text-muted-foreground"},Cs={class:"tabular-nums text-foreground"},Ls={class:"text-muted-foreground"},Rs={class:"tabular-nums text-foreground"},As={class:"text-muted-foreground"},Ps={class:"tabular-nums text-foreground"},Bs={class:"h-full border rounded-lg p-2.5 space-y-2"},Es={class:"flex items-center gap-1"},Ms={class:"text-sm font-semibold leading-none tabular-nums"},Ns={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},Os={class:"text-muted-foreground"},Ds={class:"tabular-nums text-foreground"},Fs={class:"text-muted-foreground"},Hs={class:"tabular-nums text-foreground"},Vs={class:"text-muted-foreground"},zs={class:"tabular-nums text-foreground"},js={class:"text-muted-foreground"},Ks={class:"tabular-nums text-foreground"},Us={class:"grid grid-cols-1 xl:grid-cols-2 gap-3"},Gs={class:"border rounded-lg p-2.5"},qs={class:"insights-chart-container"},Qs={class:"border rounded-lg p-2.5"},Xs={class:"insights-chart-container"},Ws={class:"border rounded-lg p-2.5"},Ys={class:"insights-chart-container"},Js=U({__name:"InstanceInsightsActivitySection",props:{dashboard:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function}},setup(n){vt([bt,_t,ht,jt,Ht,yt,xt,$t]);const i=n,c=L({}),s=L({}),o=L({}),h=(l,r)=>{r!=null&&r.selected&&(l.value={...r.selected})},p=l=>h(c,l),$=l=>h(s,l),b=l=>h(o,l),u=L([]);re(()=>i.dashboard,l=>{if(!(l!=null&&l.capturedAt))return;const r=new Date(l.capturedAt).toLocaleTimeString(),d={capturedAt:l.capturedAt,label:r,sessionsTotal:l.sessions.total,sessionsActive:l.sessions.active,sessionsIdle:l.sessions.idle,tps:l.transactions.tps,commits:l.transactions.commitsPerSec,rollbacks:l.transactions.rollbacksPerSec,reads:l.blockIO.readsPerSec,hits:l.blockIO.hitsPerSec,hitRatio:l.blockIO.bufferHitRatio},R=u.value.findIndex(V=>V.capturedAt===d.capturedAt);if(R>=0){u.value[R]=d;return}u.value.push(d),u.value.length>80&&(u.value=u.value.slice(-80))},{immediate:!0,deep:!0});const k=T(()=>u.value.map((l,r)=>({...l,idx:r}))),w=l=>Object.keys(l).length?l:void 0,y=T(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:w(c.value)},dataset:[{id:"sessions_raw",source:k.value},{id:"sessions_filtered",fromDatasetId:"sessions_raw",transform:{type:"filter",config:{dimension:"idx",gte:0}}}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!1},yAxis:{type:"value"},series:[{name:"Total",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsTotal"}},{name:"Active",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsActive"}},{name:"Idle",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsIdle"}}]})),m=T(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:w(s.value)},dataset:[{id:"transactions_dataset",source:k.value}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!0},yAxis:[{type:"value",name:"TPS"},{type:"value",name:"Commit/Rollback"}],series:[{name:"TPS",type:"line",smooth:!0,yAxisIndex:0,datasetId:"transactions_dataset",encode:{x:"label",y:"tps"}},{name:"Commits/s",type:"bar",yAxisIndex:1,datasetId:"transactions_dataset",encode:{x:"label",y:"commits"}},{name:"Rollbacks/s",type:"bar",yAxisIndex:1,datasetId:"transactions_dataset",encode:{x:"label",y:"rollbacks"}}]})),v=T(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:w(o.value)},dataset:[{id:"block_io_dataset",source:k.value}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!0},yAxis:[{type:"value",name:"Blocks/s"},{type:"value",name:"Hit %",min:0,max:100}],series:[{name:"Reads/s",type:"bar",yAxisIndex:0,datasetId:"block_io_dataset",encode:{x:"label",y:"reads"}},{name:"Hits/s",type:"bar",yAxisIndex:0,datasetId:"block_io_dataset",encode:{x:"label",y:"hits"}},{name:"Buffer Hit Ratio",type:"line",smooth:!0,yAxisIndex:1,datasetId:"block_io_dataset",encode:{x:"label",y:"hitRatio"}}]}));return(l,r)=>{var V,x,g,C,O,H,j,z,q,Y,J,B,A,G,Z,ae,pe,I,P,X,Q;const d=me,R=ce;return f(),_("div",qt,[e("div",Qt,[r[2]||(r[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Activity Dashboard"),e("p",{class:"text-xs text-muted-foreground"}," Sessions, TPS, tuples and block I/O ")],-1)),S(R,{variant:"outline",size:"xs",disabled:l.isLoading||l.isActionLoading,class:"font-normal",onClick:r[0]||(r[0]=be=>l.onRefresh())},{default:E(()=>[S(d,{name:"hugeicons:redo",class:oe(["size-4",l.isLoading&&"animate-spin"])},null,8,["class"]),r[1]||(r[1]=M(" Refresh Activity "))]),_:1},8,["disabled"])]),(V=l.dashboard)!=null&&V.sessions.exceedsThreshold?(f(),_("div",Xt,[r[3]||(r[3]=M(" Total connections are at ")),e("strong",null,a(t($e)(l.dashboard.sessions.usagePercent)),1),r[4]||(r[4]=M(" of ")),r[5]||(r[5]=e("strong",null,"max_connections",-1)),r[6]||(r[6]=M(". Investigate connection pool usage. "))])):N("",!0),e("div",Wt,[e("div",Yt,[e("div",Jt,[r[7]||(r[7]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Sessions:",-1)),e("p",Zt,a(t(de)((x=l.dashboard)==null?void 0:x.sessions.total)),1)]),e("div",es,[e("p",ts,[r[8]||(r[8]=e("span",null,"Active: ",-1)),e("span",ss,a(t(de)((g=l.dashboard)==null?void 0:g.sessions.active)),1)]),e("p",ns,[r[9]||(r[9]=e("span",null,"Idle: ",-1)),e("span",os,a(t(de)((C=l.dashboard)==null?void 0:C.sessions.idle)),1)]),e("p",as,[r[10]||(r[10]=e("span",null,"Max: ",-1)),e("span",is,a(t(de)((O=l.dashboard)==null?void 0:O.sessions.maxConnections)),1)]),e("p",rs,[r[11]||(r[11]=e("span",null,"Usage: ",-1)),e("span",ls,a(t($e)((H=l.dashboard)==null?void 0:H.sessions.usagePercent)),1)])])]),e("div",ds,[e("div",us,[r[12]||(r[12]=e("p",{class:"text-xs uppercase text-muted-foreground"},"TPS:",-1)),e("p",cs,a(t(ie)((j=l.dashboard)==null?void 0:j.transactions.tps)),1)]),e("div",ms,[e("p",ps,[r[13]||(r[13]=e("span",null,"Commits/sec: ",-1)),e("span",fs,a(t(ie)((z=l.dashboard)==null?void 0:z.transactions.commitsPerSec)),1)]),e("p",gs,[r[14]||(r[14]=e("span",null,"Rollbacks/sec: ",-1)),e("span",vs,a(t(ie)((q=l.dashboard)==null?void 0:q.transactions.rollbacksPerSec)),1)]),e("p",bs,[r[15]||(r[15]=e("span",null,"Total Commits: ",-1)),e("span",_s,a(t(de)((Y=l.dashboard)==null?void 0:Y.transactions.totalCommits)),1)]),e("p",hs,[r[16]||(r[16]=e("span",null,"Total Rollbacks: ",-1)),e("span",ys,a(t(de)((J=l.dashboard)==null?void 0:J.transactions.totalRollbacks)),1)])])]),e("div",xs,[e("div",$s,[r[17]||(r[17]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Tuples:",-1)),e("p",Ss,a(t(ie)((B=l.dashboard)==null?void 0:B.tuples.insertsPerSec)),1)]),e("div",ks,[e("p",ws,[r[18]||(r[18]=e("span",null,"Updates: ",-1)),e("span",Is,a(t(ie)((A=l.dashboard)==null?void 0:A.tuples.updatesPerSec)),1)]),e("p",Ts,[r[19]||(r[19]=e("span",null,"Deletes: ",-1)),e("span",Cs,a(t(ie)((G=l.dashboard)==null?void 0:G.tuples.deletesPerSec)),1)]),e("p",Ls,[r[20]||(r[20]=e("span",null,"Fetched: ",-1)),e("span",Rs,a(t(ie)((Z=l.dashboard)==null?void 0:Z.tuples.fetchedPerSec)),1)]),e("p",As,[r[21]||(r[21]=e("span",null,"Returned: ",-1)),e("span",Ps,a(t(ie)((ae=l.dashboard)==null?void 0:ae.tuples.returnedPerSec)),1)])])]),e("div",Bs,[e("div",Es,[r[22]||(r[22]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Block I/O:",-1)),e("p",Ms,a(t($e)((pe=l.dashboard)==null?void 0:pe.blockIO.bufferHitRatio)),1)]),e("div",Ns,[e("p",Os,[r[23]||(r[23]=e("span",null,"Reads/sec: ",-1)),e("span",Ds,a(t(ie)((I=l.dashboard)==null?void 0:I.blockIO.readsPerSec)),1)]),e("p",Fs,[r[24]||(r[24]=e("span",null,"Hits/sec: ",-1)),e("span",Hs,a(t(ie)((P=l.dashboard)==null?void 0:P.blockIO.hitsPerSec)),1)]),e("p",Vs,[r[25]||(r[25]=e("span",null,"Total Reads: ",-1)),e("span",zs,a(t(de)((X=l.dashboard)==null?void 0:X.blockIO.totalReads)),1)]),e("p",js,[r[26]||(r[26]=e("span",null,"Total Hits: ",-1)),e("span",Ks,a(t(de)((Q=l.dashboard)==null?void 0:Q.blockIO.totalHits)),1)])])])]),e("div",Us,[e("div",Gs,[r[27]||(r[27]=e("p",{class:"text-sm font-medium mb-1.5"},"Sessions Timeline",-1)),e("div",qs,[S(t(xe),{option:t(y),autoresize:"",class:"insights-chart",onLegendselectchanged:p},null,8,["option"])])]),e("div",Qs,[r[28]||(r[28]=e("p",{class:"text-sm font-medium mb-1.5"},"Transactions Timeline",-1)),e("div",Xs,[S(t(xe),{option:t(m),autoresize:"",class:"insights-chart",onLegendselectchanged:$},null,8,["option"])])])]),e("div",Ws,[r[29]||(r[29]=e("p",{class:"text-sm font-medium mb-1.5"},"Block I/O Timeline",-1)),e("div",Ys,[S(t(xe),{option:t(v),autoresize:"",class:"insights-chart",onLegendselectchanged:b},null,8,["option"])])])])}}}),Zs=De(Js,[["__scopeId","data-v-ba36a884"]]),en={class:"space-y-4 h-full flex flex-col overflow-auto"},tn={class:"flex items-center justify-between gap-2 flex-wrap"},sn={class:"h-full"},nn={class:"flex flex-col sm:flex-row sm:items-center gap-2 mb-2"},on={class:"relative flex-1"},an=U({__name:"InstanceInsightsConfigurationSection",props:{configuration:{},search:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function}},emits:["update:search"],setup(n,{emit:i}){const c=n,s=i,o=T({get:()=>c.search,set:b=>s("update:search",b)}),h=T(()=>{var b;return((b=c.configuration)==null?void 0:b.rows)||[]}),p=T(()=>h.value.map(b=>({name:b.name,category:b.category,value:b.value,unit:b.unit||"-",requires_restart:b.pendingRestart?"yes":"no",description:b.description}))),$=T(()=>ge(p.value));return(b,u)=>{const k=me,w=ce,y=Fe,m=ye;return f(),_("div",en,[e("div",tn,[u[3]||(u[3]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Configuration"),e("p",{class:"text-xs text-muted-foreground"},"Searchable pg_settings")],-1)),S(w,{variant:"outline",size:"xs",disabled:b.isLoading||b.isActionLoading,class:"font-normal",onClick:u[0]||(u[0]=v=>b.onRefresh())},{default:E(()=>[S(k,{name:"hugeicons:redo",class:oe(["size-4",b.isLoading&&"animate-spin"])},null,8,["class"]),u[2]||(u[2]=M(" Refresh Configuration "))]),_:1},8,["disabled"])]),e("div",sn,[e("div",nn,[e("div",on,[S(k,{name:"hugeicons:search-01",class:"size-4 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),S(y,{type:"text",placeholder:"Search setting name, category, or description...",class:"h-8 w-full pl-8 pr-3",modelValue:t(o),"onUpdate:modelValue":u[1]||(u[1]=v=>le(o)?o.value=v:null)},null,8,["modelValue"])])]),S(m,{columns:t($),data:t(p),class:"h-full border rounded-md",columnKeyBy:"field"},null,8,["columns","data"])])])}}}),rn={class:"space-y-4"},ln={class:"flex items-center justify-between"},dn={key:0,class:"border border-orange-300 bg-orange-50 text-orange-700 rounded-lg p-3 text-sm"},un={class:"space-y-1.5"},cn={class:"space-y-1.5"},mn={key:1,class:"border rounded-lg p-2.5"},pn={class:"flex items-center justify-between gap-3 flex-wrap"},fn={class:"text-sm font-medium"},gn={class:"flex items-center gap-2"},vn=300,bn=120,_n=44,hn=36,yn=U({__name:"InstanceInsightsReplicationSection",props:{replication:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function},onToggleSlotStatus:{type:Function},onDropSlot:{type:Function}},setup(n){const i=n,c=T(()=>{var x;return((x=i.replication)==null?void 0:x.replicationStats)||[]}),s=T(()=>{var x;return((x=i.replication)==null?void 0:x.replicationSlots)||[]}),o=L([]),h=x=>{o.value=x},p=T(()=>c.value.map(x=>({pid:x.pid,client_addr:x.clientAddr||"-",application:x.applicationName||"-",state:x.state||"-",sync_state:x.syncState||"-",reply_time:ve(x.replyTime),write_lag:x.writeLag||"-",flush_lag:x.flushLag||"-",replay_lag:x.replayLag||"-"}))),$=["pid","client_addr","application","state","sync_state","reply_time","write_lag","flush_lag","replay_lag"],b=T(()=>p.value.length>0?ge(p.value):Ue($)),u=T(()=>s.value.map(x=>({slot_name:x.slotName,slot_type:x.slotType,status:x.active?"on":"off",active_pid:x.activePid??"-",restart_lsn:x.restartLsn||"-",retained_wal:Kt(x.retainedBytes),temporary:x.temporary?"yes":"no"}))),k=T(()=>ge(u.value)),w=x=>x<=0?bn:Math.min(vn,_n+x*hn),y=T(()=>`${w(p.value.length)}px`),m=T(()=>`${w(u.value.length)}px`),v=T(()=>{var g;const x=String(((g=o.value[0])==null?void 0:g.slot_name)||"");return x&&s.value.find(C=>C.slotName===x)||null}),l=T(()=>{var x;return(x=v.value)!=null&&x.active?"off":"on"}),r=T(()=>l.value==="off"?"Turn Off Slot":"Turn On Slot"),d=x=>window.confirm(x),R=async()=>{v.value&&d(`Drop replication slot "${v.value.slotName}"? This action cannot be undone.`)&&await i.onDropSlot(v.value.slotName)},V=async()=>{v.value&&d(`Switch replication slot "${v.value.slotName}" to ${l.value.toUpperCase()} status?`)&&await i.onToggleSlotStatus({slotName:v.value.slotName,desiredStatus:l.value,activePid:v.value.activePid,slotType:v.value.slotType})};return(x,g)=>{var j;const C=me,O=ce,H=ye;return f(),_("div",rn,[e("div",ln,[g[2]||(g[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Replication"),e("p",{class:"text-xs text-muted-foreground"},"Replication stats and slots")],-1)),S(O,{variant:"outline",size:"xs",disabled:x.isLoading||x.isActionLoading,class:"font-normal",onClick:g[0]||(g[0]=z=>x.onRefresh())},{default:E(()=>[S(C,{name:"hugeicons:redo",class:oe(["size-4",x.isLoading&&"animate-spin"])},null,8,["class"]),g[1]||(g[1]=M(" Refresh Replication "))]),_:1},8,["disabled"])]),(j=x.replication)!=null&&j.staleSlotWarning?(f(),_("div",dn,a(x.replication.staleSlotWarning),1)):N("",!0),e("div",un,[g[3]||(g[3]=e("p",{class:"text-sm"},"Replication Stats",-1)),e("div",{class:"max-h-[300px]",style:Se({height:t(y)})},[S(H,{columns:t(b),data:t(p),class:"h-full border rounded-md",columnKeyBy:"field"},null,8,["columns","data"])],4)]),e("div",cn,[g[4]||(g[4]=e("h4",{class:"text-sm font-normal"},"Replication Slots",-1)),e("div",{class:"max-h-[300px]",style:Se({height:t(m)})},[S(H,{columns:t(k),data:t(u),selectedRows:t(o),class:"h-full border rounded-md",columnKeyBy:"field",onOnSelectedRows:h},null,8,["columns","data","selectedRows"])],4)]),t(v)?(f(),_("div",mn,[e("div",pn,[e("p",fn," Selected Slot: "+a(t(v).slotName)+" ("+a(t(v).active?"on":"off")+") · Active PID: "+a(t(v).activePid??"-"),1),e("div",gn,[S(O,{variant:"outline",size:"sm",disabled:x.isActionLoading,onClick:V},{default:E(()=>[M(a(t(r)),1)]),_:1},8,["disabled"]),S(O,{variant:"outline",size:"sm",disabled:x.isActionLoading,onClick:R},{default:E(()=>g[5]||(g[5]=[M(" Drop Slot ")])),_:1},8,["disabled"])])])])):N("",!0)])}}}),xn={class:"space-y-4"},$n={class:"flex items-center justify-between"},Sn={class:"space-y-1.5"},kn={class:"h-[360px]"},wn={key:0,class:"border rounded-lg p-2.5 space-y-2"},In={class:"flex items-center justify-between gap-3 flex-wrap"},Tn={class:"text-sm font-medium"},Cn={class:"flex gap-2"},Ln=["innerHTML"],Rn={class:"grid grid-cols-1 xl:grid-cols-2 gap-3"},An={class:"space-y-1.5"},Pn={class:"h-[300px]"},Bn={class:"space-y-1.5"},En={class:"h-[300px]"},Mn=U({__name:"InstanceInsightsStateSection",props:{state:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function},onCancelQuery:{type:Function},onTerminateConnection:{type:Function}},setup(n){const i=n,{highlightSql:c}=kt(),s=T(()=>{var g;return((g=i.state)==null?void 0:g.sessions)||[]}),o=T(()=>{var g;return((g=i.state)==null?void 0:g.locks)||[]}),h=T(()=>{var g;return((g=i.state)==null?void 0:g.preparedTransactions)||[]}),p=L([]),$=g=>{p.value=g},b=T(()=>s.value.map(g=>({pid:g.pid,user:g.user,application:g.application||"-",client:g.client||"-",state:g.state||"-",wait_event:g.waitEvent||"-",blocking_pids:g.blockingPids.length?g.blockingPids.join(", "):"-",backend_start:ve(g.backendStart),transaction_start:ve(g.transactionStart),query_duration:qe(g.durationSeconds),sql:Ut(g.sql)}))),u=T(()=>ge(b.value)),k=T(()=>o.value.map(g=>({lock_type:g.lockType,target_relation:g.targetRelation||"-",mode:g.mode,granted:g.granted?"yes":"no",pid:g.pid??"-",user:g.user||"-",state:g.state||"-"}))),w=T(()=>ge(k.value)),y=T(()=>h.value.map(g=>({gid:g.gid,transaction:g.transaction,prepared:ve(g.prepared),owner:g.owner,database:g.database}))),m=T(()=>ge(y.value)),v=T(()=>{var C;const g=Number(((C=p.value[0])==null?void 0:C.pid)||0);return g&&s.value.find(O=>O.pid===g)||null}),l=g=>{if(!g||!g.trim())return"<pre><code>-</code></pre>";const C=g.replace(/\s+/g," ").trim(),O=C.length>900?`${C.slice(0,900)} ...`:C;return c(O)},r=T(()=>{var g;return l(((g=v.value)==null?void 0:g.sql)||null)}),d=(g,C)=>{const O=String(C.state||"");return Gt(O)?"insights-danger-cell":void 0},R=g=>window.confirm(g),V=async()=>{v.value&&R(`Cancel query for PID ${v.value.pid}?`)&&await i.onCancelQuery(v.value.pid)},x=async()=>{v.value&&R(`Terminate connection for PID ${v.value.pid}?`)&&await i.onTerminateConnection(v.value.pid)};return(g,C)=>{const O=me,H=ce,j=ye;return f(),_("div",xn,[e("div",$n,[C[2]||(C[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"State"),e("p",{class:"text-xs text-muted-foreground"}," Active sessions, locks, prepared transactions ")],-1)),S(H,{variant:"outline",size:"xs",disabled:g.isLoading||g.isActionLoading,class:"font-normal",onClick:C[0]||(C[0]=z=>g.onRefresh())},{default:E(()=>[S(O,{name:"hugeicons:redo",class:oe(["size-4",g.isLoading&&"animate-spin"])},null,8,["class"]),C[1]||(C[1]=M(" Refresh State "))]),_:1},8,["disabled"])]),e("div",Sn,[C[3]||(C[3]=e("h4",{class:"text-sm font-normal"},"Active Sessions",-1)),e("div",kn,[S(j,{columns:t(u),data:t(b),selectedRows:t(p),getCellClass:d,class:"h-full border rounded-md",columnKeyBy:"field",onOnSelectedRows:$},null,8,["columns","data","selectedRows"])])]),t(v)?(f(),_("div",wn,[e("div",In,[e("p",Tn," Selected PID: "+a(t(v).pid)+" ("+a(t(v).state||"-")+") ",1),e("div",Cn,[S(H,{variant:"outline",size:"sm",disabled:g.isActionLoading,onClick:V},{default:E(()=>C[4]||(C[4]=[M(" Cancel Query ")])),_:1},8,["disabled"]),S(H,{variant:"outline",size:"sm",disabled:g.isActionLoading,onClick:x},{default:E(()=>C[5]||(C[5]=[M(" Terminate Connection ")])),_:1},8,["disabled"])])]),e("div",null,[C[6]||(C[6]=e("p",{class:"text-xs text-muted-foreground mb-1"},"SQL Preview",-1)),e("div",{class:"sql-preview border rounded-md overflow-hidden",innerHTML:t(r)},null,8,Ln)])])):N("",!0),e("div",Rn,[e("div",An,[C[7]||(C[7]=e("h4",{class:"text-sm font-normal"},"Locks",-1)),e("div",Pn,[S(j,{columns:t(w),data:t(k),class:"h-full border rounded-md",columnKeyBy:"field"},null,8,["columns","data"])])]),e("div",Bn,[C[8]||(C[8]=e("h4",{class:"text-sm font-normal"},"Prepared Transactions",-1)),e("div",En,[S(j,{columns:t(m),data:t(y),class:"h-full border rounded-md",columnKeyBy:"field"},null,8,["columns","data"])])])])])}}}),Nn=De(Mn,[["__scopeId","data-v-2eab93d6"]]),On=5e3;function Dn(n){const i=L("activity"),c=L(!0),s=L(On),o=L(null),h=L(!1),p=L(!1),$=L(!1),b=L(!1),u=L(!1),k=L(!1),w=L(null),y=L(null),m=L(null),v=L(null),l=L(""),r=Xe(l,350),d=T(()=>!!n.value),R=L(!0);ke(()=>{R.value=!1}),we(()=>{R.value=!0});const V=()=>{o.value=null,w.value=null,y.value=null,m.value=null,v.value=null},x=async(I,P)=>{var X;try{return o.value=null,await I()}catch(Q){const be=((X=Q==null?void 0:Q.data)==null?void 0:X.message)||(Q==null?void 0:Q.message)||(Q==null?void 0:Q.statusMessage)||P;return o.value=be,null}},g=async(I={})=>{if(!d.value)return null;I.silent||($.value=!0);const P=await x(async()=>await $fetch("/api/instance-insights/dashboard",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch activity dashboard");return P&&(w.value=P),I.silent||($.value=!1),P},C=async(I={})=>{if(!d.value)return null;I.silent||(b.value=!0);const P=await x(async()=>await $fetch("/api/instance-insights/state",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch active sessions and locks");return P&&(y.value=P),I.silent||(b.value=!1),P},O=async(I={})=>{if(!d.value)return null;I.silent||(u.value=!0);const P=await x(async()=>await $fetch("/api/instance-insights/configuration",{method:"POST",body:{...ne(n.value),search:r.value||void 0}}),"Failed to fetch PostgreSQL settings");return P&&(m.value=P),I.silent||(u.value=!1),P},H=async(I={})=>{if(!d.value)return null;I.silent||(k.value=!0);const P=await x(async()=>await $fetch("/api/instance-insights/replication",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch replication status");return P&&(v.value=P),I.silent||(k.value=!1),P},j=async(I=i.value,P={})=>{switch(I){case"activity":await g(P);break;case"state":await Promise.all([g({silent:!0}),C(P)]);break;case"configuration":await Promise.all([g({silent:!0}),O(P)]);break;case"replication":await Promise.all([g({silent:!0}),H(P)]);break;default:await g(P);break}},z=async(I={})=>{await Promise.all([g(I),C(I),O(I),H(I)])},q=async(I,P)=>{if(!d.value)return!1;p.value=!0;const X=await x(I,"Action failed");return p.value=!1,X?(X.success?fe(P,{description:X.message}):fe(X.message,{description:"The server did not complete this action."}),X.success):(fe(o.value||"Action failed",{description:"Check database permissions and try again."}),!1)},Y=async I=>{await q(async()=>await $fetch("/api/instance-insights/cancel-query",{method:"POST",body:{...ne(n.value),pid:I}}),`Cancelled query for PID ${I}`)&&await C({silent:!0})},J=async I=>{await q(async()=>await $fetch("/api/instance-insights/terminate-connection",{method:"POST",body:{...ne(n.value),pid:I}}),`Terminated connection for PID ${I}`)&&(await C({silent:!0}),await g({silent:!0}))},B=async I=>{await q(async()=>await $fetch("/api/instance-insights/drop-slot",{method:"POST",body:{...ne(n.value),slotName:I}}),`Dropped replication slot "${I}"`)&&await H({silent:!0})},A=async I=>{await q(async()=>await $fetch("/api/instance-insights/toggle-slot-status",{method:"POST",body:{...ne(n.value),slotName:I.slotName,desiredStatus:I.desiredStatus,activePid:I.activePid??null,slotType:I.slotType??null}}),`Turned ${I.desiredStatus} slot "${I.slotName}"`)&&await H({silent:!0})},G=async()=>{if(!d.value){V();return}h.value=!0,await z(),h.value=!1};re(()=>n.value,async I=>{if(!I){V();return}await G()},{immediate:!0}),re(()=>r.value,async()=>{i.value!=="configuration"||!d.value||await O({silent:!0})}),re(()=>i.value,async I=>{d.value&&(I==="state"&&!y.value&&await C(),I==="configuration"&&!m.value&&await O(),I==="replication"&&!v.value&&await H())});const{pause:Z,resume:ae,isActive:pe}=Ie(async()=>{!d.value||!R.value||await j(i.value,{silent:!0})},s,{immediate:!1});return re(()=>c.value,I=>{I?ae():Z()},{immediate:!0}),{activeSection:i,autoRefresh:c,isAutoRefreshRunning:pe,error:o,isInitialLoading:h,isActionLoading:p,isDashboardLoading:$,isStateLoading:b,isConfigurationLoading:u,isReplicationLoading:k,dashboard:w,state:y,configuration:m,replication:v,configurationSearch:l,refreshSection:j,refreshAll:z,fetchDashboard:g,fetchState:C,fetchConfiguration:O,fetchReplication:H,cancelQuery:Y,terminateConnection:J,dropReplicationSlot:B,toggleReplicationSlotStatus:A}}const Fn={class:"flex flex-col h-full p-3 gap-3 overflow-hidden"},Hn={class:"flex flex-col lg:flex-row lg:items-start lg:justify-between border rounded-lg p-3 gap-3 bg-background"},Vn={class:"space-y-1"},zn={class:"flex items-center gap-2"},jn={class:"text-sm text-muted-foreground flex items-center gap-0.5"},Kn={class:"flex items-center gap-0.5"},Un={class:"font-medium text-foreground"},Gn={key:0,class:"flex items-center gap-1.5 mt-0.5"},qn={class:"flex items-center gap-2 flex-wrap"},Qn={class:"text-xs flex items-center gap-2"},Xn={class:"flex items-center justify-between gap-2"},Wn={class:"text-xs text-muted-foreground"},Yn={key:0,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},Jn={key:1,class:"border rounded-lg p-6 flex items-center justify-center gap-2 text-muted-foreground"},Zn={key:2,class:"flex-1 overflow-y-auto border rounded-lg p-3 bg-background"},eo=U({__name:"InstanceInsightsPanel",props:{dbConnectionString:{},databaseName:{},dbType:{}},setup(n){const i=[{id:"activity",tabLabel:"Activity",subtitle:"Sessions, TPS, tuples and block I/O",icon:"hugeicons:artificial-intelligence-08"},{id:"state",tabLabel:"State",subtitle:"Active sessions, locks, prepared transactions",icon:"hugeicons:shield-01"},{id:"configuration",tabLabel:"Config",subtitle:"Searchable pg_settings",icon:"hugeicons:settings-01"},{id:"replication",tabLabel:"Replication",subtitle:"Replication stats and slots",icon:"hugeicons:database"}],c=he(),s=T(()=>c.selectedConnection),{activeSection:o,autoRefresh:h,error:p,isInitialLoading:$,isActionLoading:b,isDashboardLoading:u,isStateLoading:k,isConfigurationLoading:w,isReplicationLoading:y,dashboard:m,state:v,configuration:l,replication:r,configurationSearch:d,refreshSection:R,refreshAll:V,cancelQuery:x,terminateConnection:g,dropReplicationSlot:C,toggleReplicationSlotStatus:O}=Dn(s);T(()=>i.find(B=>B.id===o.value));const H=T(()=>{var B,A,G,Z;return o.value==="activity"?(B=m.value)==null?void 0:B.capturedAt:o.value==="state"?(A=v.value)==null?void 0:A.capturedAt:o.value==="configuration"?(G=l.value)==null?void 0:G.capturedAt:(Z=r.value)==null?void 0:Z.capturedAt}),j=()=>R("activity"),z=()=>R("state"),q=()=>R("configuration"),Y=()=>R("replication"),J=B=>O(B);return(B,A)=>{var Q,be;const G=me,Z=_e,ae=Ce,pe=ce,I=Ae,P=Re,X=Le;return f(),_("div",Fn,[e("div",Hn,[e("div",Vn,[e("div",zn,[S(G,{name:"hugeicons:database",class:"size-5 text-primary"}),A[4]||(A[4]=e("h2",{class:"text-base font-medium"},"Instance Insights",-1))]),e("div",jn,[A[5]||(A[5]=M(" connection: ")),e("div",Kn,[B.dbType?(f(),W(Te((Q=t(Ve)(B.dbType))==null?void 0:Q.icon),{key:0,class:"size-4!"})):N("",!0),e("span",Un,a(B.databaseName),1)])]),(be=t(m))!=null&&be.version?(f(),_("div",Gn,[S(Z,{variant:"outline",class:"text-xxs h-5 px-1.5 font-normal"},{default:E(()=>[M(" PostgreSQL "+a(t(m).version),1)]),_:1})])):N("",!0)]),e("div",qn,[e("div",Qn,[S(ae,{id:"insights-auto-refresh","model-value":t(h),"onUpdate:modelValue":A[0]||(A[0]=ee=>le(h)?h.value=ee:null),class:"cursor-pointer"},null,8,["model-value"]),A[6]||(A[6]=e("label",{for:"insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),S(pe,{variant:"outline",size:"sm",disabled:t($)||t(b),onClick:A[1]||(A[1]=ee=>t(V)()),class:"font-normal"},{default:E(()=>[S(G,{name:"hugeicons:redo",class:"size-4"}),A[7]||(A[7]=M(" Refresh All "))]),_:1},8,["disabled"])])]),e("div",Xn,[S(X,{modelValue:t(o),"onUpdate:modelValue":A[2]||(A[2]=ee=>le(o)?o.value=ee:null),class:"gap-0 flex-1 min-w-0"},{default:E(()=>[S(P,{class:"h-8 max-w-full overflow-x-auto justify-start!"},{default:E(()=>[(f(),_(D,null,F(i,ee=>S(I,{key:ee.id,value:ee.id,class:"text-xs px-1.5 rounded-sm cursor-pointer min-w-fit shrink-0",onClick:mr=>t(R)(ee.id,{silent:!0})},{default:E(()=>[S(G,{name:ee.icon,class:"size-3.5!"},null,8,["name"]),M(" "+a(ee.tabLabel),1)]),_:2},1032,["value","onClick"])),64))]),_:1})]),_:1},8,["modelValue"]),e("div",Wn," Last updated: "+a(t(ve)(t(H))),1)]),t(p)?(f(),_("div",Yn,a(t(p)),1)):N("",!0),t($)&&!t(m)?(f(),_("div",Jn,[S(G,{name:"hugeicons:redo",class:"size-4 animate-spin"}),A[8]||(A[8]=M(" Loading instance insights... "))])):(f(),_("div",Zn,[te(S(Zs,{dashboard:t(m),isLoading:t(u),isActionLoading:t(b),onRefresh:j},null,8,["dashboard","isLoading","isActionLoading"]),[[se,t(o)==="activity"]]),te(S(Nn,{state:t(v),isLoading:t(k),isActionLoading:t(b),onRefresh:z,onCancelQuery:t(x),onTerminateConnection:t(g)},null,8,["state","isLoading","isActionLoading","onCancelQuery","onTerminateConnection"]),[[se,t(o)==="state"]]),te(S(an,{search:t(d),"onUpdate:search":A[3]||(A[3]=ee=>le(d)?d.value=ee:null),configuration:t(l),isLoading:t(w),isActionLoading:t(b),onRefresh:q},null,8,["search","configuration","isLoading","isActionLoading"]),[[se,t(o)==="configuration"]]),te(S(yn,{replication:t(r),isLoading:t(y),isActionLoading:t(b),onRefresh:Y,onDropSlot:t(C),onToggleSlotStatus:J},null,8,["replication","isLoading","isActionLoading","onDropSlot"]),[[se,t(o)==="replication"]])]))])}}}),to={key:0,class:"space-y-4"},so={class:"flex items-start justify-between gap-3 flex-wrap"},no={class:"text-sm font-medium"},oo={class:"text-xs text-muted-foreground"},ao={key:1,class:"flex gap-2 flex-wrap"},io={key:2,class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2.5"},ro={class:"text-xs uppercase text-muted-foreground"},lo={class:"text-sm font-semibold leading-none tabular-nums"},uo={key:0,class:"text-[11px] text-muted-foreground"},co={key:3,class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2.5"},mo={class:"text-xs uppercase text-muted-foreground"},po={class:"text-sm font-medium leading-tight break-words"},fo={key:0,class:"text-[11px] text-muted-foreground"},go={key:4,class:"space-y-2"},vo={class:"font-medium"},bo={class:"text-xs mt-1"},_o={class:"text-sm font-normal"},ho={key:0,class:"text-xs text-muted-foreground"},yo={key:0,class:"text-xs text-muted-foreground"},xo=360,$o=120,So=44,ko=36,wo=U({__name:"InstanceInsightsSectionRenderer",props:{section:{},search:{}},setup(n){const i=n,c=T(()=>{var u;return((u=i.search)==null?void 0:u.trim().toLowerCase())||""}),s=T(()=>i.section?!i.section.searchable||!c.value?i.section.tables||[]:(i.section.tables||[]).map(u=>({...u,rows:u.rows.filter(k=>Object.values(k).some(w=>String(w??"").toLowerCase().includes(c.value)))})):[]),o=u=>u<=0?$o:Math.min(xo,So+u*ko),h=u=>u==="supported"?"border-emerald-300 bg-emerald-50 text-emerald-700":u==="conditional"?"border-amber-300 bg-amber-50 text-amber-700":"border-slate-300 bg-slate-50 text-slate-700",p=u=>u==="success"?"border-emerald-200 bg-emerald-50":u==="warning"?"border-amber-200 bg-amber-50":u==="danger"?"border-red-200 bg-red-50":u==="info"?"border-sky-200 bg-sky-50":"border-border bg-background",$=u=>u==="unsupported"?"border-amber-300 bg-amber-50 text-amber-700":u==="unavailable"?"border-red-300 bg-red-50 text-red-700":"border-emerald-300 bg-emerald-50 text-emerald-700",b=u=>u==="pass"?"border-emerald-200 bg-emerald-50 text-emerald-700":u==="warn"?"border-amber-200 bg-amber-50 text-amber-700":u==="fail"?"border-red-200 bg-red-50 text-red-700":"border-sky-200 bg-sky-50 text-sky-700";return(u,k)=>{var m,v,l,r;const w=_e,y=ye;return u.section?(f(),_("div",to,[e("div",so,[e("div",null,[e("h3",no,a(u.section.title),1),e("p",oo,a(u.section.subtitle),1)]),S(w,{class:oe($(u.section.status)),variant:"outline"},{default:E(()=>[M(a(u.section.status),1)]),_:1},8,["class"])]),u.section.statusMessage?(f(),_("div",{key:0,class:oe(["border rounded-lg p-3 text-sm",$(u.section.status)])},a(u.section.statusMessage),3)):N("",!0),(m=u.section.actions)!=null&&m.length?(f(),_("div",ao,[(f(!0),_(D,null,F(u.section.actions,d=>(f(),W(w,{key:d.id,class:oe(h(d.state)),variant:"outline"},{default:E(()=>[M(a(d.label)+" · "+a(d.state),1)]),_:2},1032,["class"]))),128))])):N("",!0),(v=u.section.cards)!=null&&v.length?(f(),_("div",io,[(f(!0),_(D,null,F(u.section.cards,d=>(f(),_("div",{key:d.id,class:oe(["h-full border rounded-lg p-2.5 space-y-1.5",p(d.tone)])},[e("p",ro,a(d.label),1),e("p",lo,a(d.value),1),d.helperText?(f(),_("p",uo,a(d.helperText),1)):N("",!0)],2))),128))])):N("",!0),(l=u.section.details)!=null&&l.length?(f(),_("div",co,[(f(!0),_(D,null,F(u.section.details,d=>(f(),_("div",{key:`${d.label}-${d.value}`,class:oe(["border rounded-lg p-2.5 space-y-1",p(d.tone)])},[e("p",mo,a(d.label),1),e("p",po,a(d.value),1),d.helperText?(f(),_("p",fo,a(d.helperText),1)):N("",!0)],2))),128))])):N("",!0),(r=u.section.checks)!=null&&r.length?(f(),_("div",go,[(f(!0),_(D,null,F(u.section.checks,d=>(f(),_("div",{key:d.id,class:oe(["border rounded-lg p-3 text-sm",b(d.status)])},[e("p",vo,a(d.label),1),e("p",bo,a(d.detail),1)],2))),128))])):N("",!0),(f(!0),_(D,null,F(t(s),d=>(f(),_("div",{key:d.id,class:"space-y-1.5"},[e("div",null,[e("h4",_o,a(d.title),1),d.description?(f(),_("p",ho,a(d.description),1)):N("",!0)]),e("div",{class:"max-h-[360px]",style:Se({height:`${o(d.rows.length)}px`})},[S(y,{columns:t(Ue)(d.columns.map(R=>R.key)),data:d.rows,class:"h-full border rounded-md",columnKeyBy:"field"},null,8,["columns","data"])],4),d.emptyMessage&&d.rows.length===0?(f(),_("p",yo,a(d.emptyMessage),1)):N("",!0)]))),128))])):N("",!0)}}}),Io=5e3;function To(n){const i=L(null),c=L("overview"),s=L(!0),o=L(""),h=L(null),p=L(!1),$=L(!1),b=T(()=>!!n.value),u=L(!0);ke(()=>{u.value=!1}),we(()=>{u.value=!0});const k=()=>{h.value=null,i.value=null,o.value="",c.value="overview"},w=async(d={})=>{var R,V;if(!b.value)return k(),null;d.silent||($.value=!0);try{h.value=null;const x=await $fetch("/api/instance-insights/view",{method:"POST",body:{...ne(n.value)}});return i.value=x,x.sections.some(g=>g.id===c.value)||(c.value=((R=x.sections[0])==null?void 0:R.id)||"overview"),x}catch(x){const g=((V=x==null?void 0:x.data)==null?void 0:V.message)||(x==null?void 0:x.message)||(x==null?void 0:x.statusMessage)||"Failed to fetch instance insights";return h.value=g,null}finally{d.silent||($.value=!1)}},y=async(d=c.value,R={})=>w(R),m=async(d={})=>w(d),v=async()=>{if(!b.value){k();return}p.value=!0,await w(),p.value=!1};re(()=>n.value,async d=>{if(!d){k();return}await v()},{immediate:!0});const{pause:l,resume:r}=Ie(async()=>{!b.value||!u.value||await w({silent:!0})},Io,{immediate:!1});return re(()=>s.value,d=>{d?r():l()},{immediate:!0}),{view:i,activeSection:c,autoRefresh:s,configurationSearch:o,error:h,isInitialLoading:p,isViewLoading:$,refreshSection:y,refreshAll:m}}const Co={class:"flex flex-col h-full p-3 gap-3 overflow-hidden"},Lo={class:"flex flex-col lg:flex-row lg:items-start lg:justify-between border rounded-lg p-3 gap-3 bg-background"},Ro={class:"space-y-2"},Ao={class:"space-y-1"},Po={class:"flex items-center gap-2"},Bo={class:"text-sm text-muted-foreground flex items-center gap-0.5"},Eo={class:"flex items-center gap-0.5"},Mo={class:"font-medium text-foreground"},No={key:0,class:"flex items-center gap-1.5 mt-0.5"},Oo={key:0,class:"flex gap-2 flex-wrap"},Do={class:"flex items-center gap-2 flex-wrap"},Fo={class:"text-xs flex items-center gap-2"},Ho={class:"flex items-center justify-between gap-2"},Vo={class:"text-xs text-muted-foreground"},zo={key:0,class:"border rounded-lg p-3 bg-background"},jo={class:"relative"},Ko={key:1,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},Uo={key:2,class:"border rounded-lg p-6 flex items-center justify-center gap-2 text-muted-foreground"},Go={key:3,class:"flex-1 overflow-y-auto border rounded-lg p-3 bg-background"},qo=U({__name:"MultiDbInstanceInsightsPanel",props:{dbConnectionString:{},databaseName:{},dbType:{}},setup(n){const i=he(),{selectedConnection:c}=He(i),{view:s,activeSection:o,autoRefresh:h,configurationSearch:p,error:$,isInitialLoading:b,isViewLoading:u,refreshSection:k,refreshAll:w}=To(c),y=T(()=>{var l;return((l=s.value)==null?void 0:l.sections.find(r=>r.id===o.value))||null}),m=T(()=>{var l,r;return((l=y.value)==null?void 0:l.capturedAt)||((r=s.value)==null?void 0:r.capturedAt)||null}),v=l=>l==="supported"?"border-emerald-300 bg-emerald-50 text-emerald-700":l==="conditional"?"border-amber-300 bg-amber-50 text-amber-700":"border-slate-300 bg-slate-50 text-slate-700";return(l,r)=>{var j,z,q,Y,J;const d=me,R=_e,V=Ce,x=ce,g=Ae,C=Re,O=Le,H=Fe;return f(),_("div",Co,[e("div",Lo,[e("div",Ro,[e("div",Ao,[e("div",Po,[S(d,{name:"hugeicons:database",class:"size-5 text-primary"}),r[4]||(r[4]=e("h2",{class:"text-base font-medium"},"Instance Insights",-1))]),e("div",Bo,[r[5]||(r[5]=M(" connection: ")),e("div",Eo,[l.dbType?(f(),W(Te((j=t(Ve)(l.dbType))==null?void 0:j.icon),{key:0,class:"size-4!"})):N("",!0),e("span",Mo,a(l.databaseName),1)])]),(z=t(s))!=null&&z.version?(f(),_("div",No,[S(R,{variant:"outline",class:"text-xxs h-5 px-1.5 font-normal"},{default:E(()=>[M(a(l.dbType===t(ue).MARIADB?"MariaDB":l.dbType===t(ue).ORACLE?"Oracle":l.dbType===t(ue).SQLITE3?"SQLite":"MySQL")+" "+a(t(s).version),1)]),_:1})])):N("",!0)]),(Y=(q=t(s))==null?void 0:q.actions)!=null&&Y.length?(f(),_("div",Oo,[(f(!0),_(D,null,F(t(s).actions,B=>(f(),W(R,{key:B.id,class:oe(v(B.state)),variant:"outline"},{default:E(()=>[M(a(B.label)+" · "+a(B.state),1)]),_:2},1032,["class"]))),128))])):N("",!0)]),e("div",Do,[e("div",Fo,[S(V,{id:"insights-auto-refresh","model-value":t(h),"onUpdate:modelValue":r[0]||(r[0]=B=>le(h)?h.value=B:null),class:"cursor-pointer"},null,8,["model-value"]),r[6]||(r[6]=e("label",{for:"insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),S(x,{variant:"outline",size:"sm",disabled:t(b)||t(u),class:"font-normal",onClick:r[1]||(r[1]=B=>t(w)())},{default:E(()=>[S(d,{name:"hugeicons:redo",class:"size-4"}),r[7]||(r[7]=M(" Refresh All "))]),_:1},8,["disabled"])])]),e("div",Ho,[S(O,{modelValue:t(o),"onUpdate:modelValue":r[2]||(r[2]=B=>le(o)?o.value=B:null),class:"gap-0 flex-1 min-w-0"},{default:E(()=>[S(C,{class:"h-8 max-w-full overflow-x-auto justify-start!"},{default:E(()=>{var B;return[(f(!0),_(D,null,F(((B=t(s))==null?void 0:B.sections)||[],A=>(f(),W(g,{key:A.id,value:A.id,class:"text-xs px-1.5 rounded-sm cursor-pointer min-w-fit shrink-0",onClick:G=>t(k)(A.id,{silent:!0})},{default:E(()=>[M(a(A.title),1)]),_:2},1032,["value","onClick"]))),128))]}),_:1})]),_:1},8,["modelValue"]),e("div",Vo," Last updated: "+a(t(ve)(t(m))),1)]),(J=t(y))!=null&&J.searchable?(f(),_("div",zo,[e("div",jo,[S(d,{name:"hugeicons:search-01",class:"size-4 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),S(H,{modelValue:t(p),"onUpdate:modelValue":r[3]||(r[3]=B=>le(p)?p.value=B:null),type:"text",placeholder:t(y).searchPlaceholder||"Search...",class:"h-8 w-full pl-8 pr-3"},null,8,["modelValue","placeholder"])])])):N("",!0),t($)?(f(),_("div",Ko,a(t($)),1)):N("",!0),t(b)&&!t(s)?(f(),_("div",Uo,[S(d,{name:"hugeicons:redo",class:"size-4 animate-spin"}),r[8]||(r[8]=M(" Loading instance insights... "))])):(f(),_("div",Go,[S(wo,{section:t(y),search:t(p)},null,8,["section","search"])]))])}}}),Qo={class:"space-y-4"},Xo={class:"grid gap-3 md:grid-cols-2"},Wo={class:"rounded-lg border p-3"},Yo={class:"mt-1 text-lg font-medium"},Jo={class:"rounded-lg border p-3"},Zo={class:"mt-1 text-lg font-medium"},ea={key:0,class:"rounded-lg border p-3"},ta={class:"mt-3 space-y-2 text-xs"},sa={class:"rounded-lg border p-3"},na={class:"mt-3 space-y-2 text-xs"},oa={class:"flex items-start justify-between gap-3"},aa={class:"font-medium"},ia={class:"text-muted-foreground"},ra={class:"text-muted-foreground"},la=U({__name:"RedisClientsSection",props:{clients:{},isActionLoading:{type:Boolean}},emits:["kill-client"],setup(n,{emit:i}){const c=i,s=new Intl.NumberFormat;function o(h){return h==null||h===""?"0":s.format(Number(h))}return(h,p)=>{var b,u,k,w,y;const $=ce;return f(),_("div",Qo,[e("div",Xo,[e("div",Wo,[p[0]||(p[0]=e("p",{class:"text-xs text-muted-foreground"},"Connected clients",-1)),e("p",Yo,a(o((b=h.clients)==null?void 0:b.connectedClients)),1)]),e("div",Jo,[p[1]||(p[1]=e("p",{class:"text-xs text-muted-foreground"},"Suspicious clients",-1)),e("p",Zo,a(o((((u=h.clients)==null?void 0:u.suspiciousClients)||[]).length)),1)])]),(((k=h.clients)==null?void 0:k.suspiciousClients)||[]).length?(f(),_("div",ea,[p[2]||(p[2]=e("h3",{class:"text-sm font-medium"},"Suspicious clients",-1)),e("div",ta,[(f(!0),_(D,null,F(((w=h.clients)==null?void 0:w.suspiciousClients)||[],m=>(f(),_("div",{key:`${m.clientId}-${m.reason}`,class:"rounded-md bg-muted/20 px-3 py-2"},a(m.reason),1))),128))])])):N("",!0),e("div",sa,[p[4]||(p[4]=e("h3",{class:"text-sm font-medium"},"Client list",-1)),e("div",na,[(f(!0),_(D,null,F(((y=h.clients)==null?void 0:y.clients)||[],m=>(f(),_("div",{key:m.id,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",oa,[e("div",null,[e("p",aa,a(m.addr),1),e("p",ia,a(m.name)+" · db "+a(m.db)+" · "+a(m.cmd),1),e("p",ra," age "+a(o(m.ageSeconds))+"s · idle "+a(o(m.idleSeconds))+"s ",1)]),S($,{size:"sm",variant:"outline",disabled:h.isActionLoading,onClick:v=>c("kill-client",m.id)},{default:E(()=>p[3]||(p[3]=[M(" Kill client ")])),_:2},1032,["disabled","onClick"])])]))),128))])])])}}}),da={class:"space-y-2"},ua={class:"text-muted-foreground"},ca=U({__name:"RedisConfigSection",props:{config:{}},setup(n){return(i,c)=>(f(),_("div",da,[(f(!0),_(D,null,F(i.config||[],s=>(f(),_("div",{key:s.name,class:"flex items-center justify-between rounded-md border px-3 py-2 text-sm"},[e("span",null,a(s.name),1),e("span",ua,a(s.value||"not set"),1)]))),128))]))}}),ma={class:"space-y-4"},pa={class:"grid gap-3 md:grid-cols-4"},fa={class:"rounded-lg border p-3"},ga={class:"mt-1 text-lg font-medium"},va={class:"rounded-lg border p-3"},ba={class:"mt-1 text-lg font-medium"},_a={class:"rounded-lg border p-3"},ha={class:"mt-1 text-lg font-medium"},ya={class:"rounded-lg border p-3"},xa={class:"mt-1 text-lg font-medium"},$a={class:"grid gap-4 lg:grid-cols-2"},Sa={class:"rounded-lg border p-3"},ka={class:"mt-3 space-y-2 text-sm"},wa={class:"text-muted-foreground"},Ia={class:"rounded-lg border p-3"},Ta={class:"mt-3 space-y-2 text-sm"},Ca={class:"text-muted-foreground"},La={class:"rounded-lg border p-3"},Ra={class:"mt-3 flex flex-wrap gap-2"},Aa={class:"mt-3 text-xs text-muted-foreground"},Pa=U({__name:"RedisKeyspaceSection",props:{keyspace:{}},setup(n){const i=new Intl.NumberFormat;function c(s){return s==null||s===""?"0":i.format(Number(s))}return(s,o)=>{var p,$,b,u,k,w,y,m;const h=_e;return f(),_("div",ma,[e("div",pa,[e("div",fa,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Expired key count",-1)),e("p",ga,a(c((p=s.keyspace)==null?void 0:p.expiredKeyCount)),1)]),e("div",va,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Avg TTL",-1)),e("p",ba,a(c(($=s.keyspace)==null?void 0:$.avgTtl)),1)]),e("div",_a,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Keys without TTL",-1)),e("p",ha,a(c((b=s.keyspace)==null?void 0:b.keysWithoutTtl)),1)]),e("div",ya,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Sampled keys",-1)),e("p",xa,a(c((u=s.keyspace)==null?void 0:u.sampledKeys)),1)])]),e("div",$a,[e("div",Sa,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Databases",-1)),e("div",ka,[(f(!0),_(D,null,F(((k=s.keyspace)==null?void 0:k.databases)||[],v=>(f(),_("div",{key:v.database,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(v.database),1),e("span",wa,a(c(v.keyCount))+" keys · "+a(c(v.expires))+" expiring · avg TTL "+a(c(v.avgTtl)),1)]))),128))])]),e("div",Ia,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Top prefixes",-1)),e("div",Ta,[(f(!0),_(D,null,F(((w=s.keyspace)==null?void 0:w.topPrefixes)||[],v=>(f(),_("div",{key:v.prefix,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(v.prefix),1),e("span",Ca,a(c(v.keyCount))+" keys ",1)]))),128))])])]),e("div",La,[o[6]||(o[6]=e("h3",{class:"text-sm font-medium"},"Key type distribution",-1)),e("div",Ra,[(f(!0),_(D,null,F(((y=s.keyspace)==null?void 0:y.keyTypeDistribution)||[],v=>(f(),W(h,{key:v.type,variant:"outline"},{default:E(()=>[M(a(v.type)+" · "+a(c(v.count)),1)]),_:2},1024))),128))]),e("p",Aa,a((m=s.keyspace)==null?void 0:m.hotKeysNote),1)])])}}}),Ba={class:"space-y-4"},Ea={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Ma={class:"rounded-lg border p-3"},Na={class:"mt-1 text-lg font-medium"},Oa={class:"rounded-lg border p-3"},Da={class:"mt-1 text-lg font-medium"},Fa={class:"rounded-lg border p-3"},Ha={class:"mt-1 text-lg font-medium"},Va={class:"rounded-lg border p-3"},za={class:"mt-1 text-lg font-medium"},ja={class:"grid gap-4 lg:grid-cols-2"},Ka={class:"rounded-lg border p-3"},Ua={class:"mt-3 space-y-2 text-sm"},Ga={class:"text-muted-foreground"},qa={class:"rounded-lg border p-3"},Qa={class:"mt-3 space-y-2 text-sm"},Xa={class:"flex items-center justify-between gap-2"},Wa={class:"truncate"},Ya={class:"mt-1 text-xs text-muted-foreground"},Ja=U({__name:"RedisMemorySection",props:{memory:{}},setup(n){const i=new Intl.NumberFormat;function c(s){return s==null||s===""?"0":i.format(Number(s))}return(s,o)=>{var $,b,u,k,w,y,m,v;const h=Pe,p=_e;return f(),_("div",Ba,[e("div",Ea,[e("div",Ma,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Used memory",-1)),e("p",Na,a(($=s.memory)==null?void 0:$.usedMemoryHuman),1)]),e("div",Oa,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Peak memory",-1)),e("p",Da,a((b=s.memory)==null?void 0:b.usedMemoryPeakHuman),1)]),e("div",Fa,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Fragmentation",-1)),e("p",Ha,a((u=s.memory)==null?void 0:u.memoryFragmentationRatio.toFixed(2)),1)]),e("div",Va,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Maxmemory / policy",-1)),e("p",za,a((k=s.memory)==null?void 0:k.maxmemoryHuman)+" · "+a((w=s.memory)==null?void 0:w.maxmemoryPolicy),1)])]),(f(!0),_(D,null,F(((y=s.memory)==null?void 0:y.warnings)||[],l=>(f(),W(h,{key:l,variant:"secondary"},{default:E(()=>[M(a(l),1)]),_:2},1024))),128)),e("div",ja,[e("div",Ka,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Top prefixes by memory",-1)),e("div",Ua,[(f(!0),_(D,null,F(((m=s.memory)==null?void 0:m.topPrefixesByMemory)||[],l=>(f(),_("div",{key:l.prefix,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(l.prefix),1),e("span",Ga,a(c(l.keyCount))+" keys · "+a(c(l.memoryBytes))+" B ",1)]))),128))])]),e("div",qa,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Big keys detector",-1)),e("div",Qa,[(f(!0),_(D,null,F(((v=s.memory)==null?void 0:v.bigKeys)||[],l=>(f(),_("div",{key:l.key,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",Xa,[e("span",Wa,a(l.key),1),S(p,{variant:"outline"},{default:E(()=>[M(a(l.type),1)]),_:2},1024)]),e("p",Ya," TTL "+a(l.ttl>=0?l.ttl:"persisted")+" · "+a(c(l.memoryBytes))+" B ",1)]))),128))])])])])}}}),Za={class:"space-y-4"},ei={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},ti={class:"text-xs text-muted-foreground"},si={class:"mt-1 text-lg font-medium"},ni=U({__name:"RedisOverviewSection",props:{overview:{}},setup(n){const i=n,c=new Intl.NumberFormat;function s(p){return p==null||p===""?"0":c.format(Number(p))}function o(p){return`${(p*100).toFixed(1)}%`}const h=T(()=>{const p=i.overview;return p?[{label:"Redis version",value:p.redisVersion},{label:"Mode",value:p.mode},{label:"Uptime",value:qe(p.uptimeSeconds)},{label:"Connected clients",value:s(p.connectedClients)},{label:"Used memory",value:p.usedMemoryHuman},{label:"Total keys",value:s(p.totalKeys)},{label:"Hit rate",value:o(p.hitRate)},{label:"Ops/sec",value:s(p.opsPerSec)},{label:"Evicted keys",value:s(p.evictedKeys)},{label:"Expired keys",value:s(p.expiredKeys)},{label:"Rejected connections",value:s(p.rejectedConnections)}]:[]});return(p,$)=>(f(),_("div",Za,[e("div",ei,[(f(!0),_(D,null,F(t(h),b=>(f(),_("div",{key:b.label,class:"rounded-lg border p-3"},[e("p",ti,a(b.label),1),e("p",si,a(b.value),1)]))),128))])]))}}),oi={class:"space-y-4"},ai={class:"grid gap-3 md:grid-cols-3"},ii={class:"rounded-lg border p-3"},ri={class:"mt-1 text-lg font-medium"},li={class:"rounded-lg border p-3"},di={class:"mt-1 text-lg font-medium"},ui={class:"rounded-lg border p-3"},ci={class:"mt-1 text-lg font-medium"},mi={class:"rounded-lg border p-3"},pi={class:"mt-3 whitespace-pre-wrap text-xs text-muted-foreground"},fi={class:"grid gap-4 lg:grid-cols-2"},gi={class:"rounded-lg border p-3"},vi={class:"mt-3 space-y-2 text-xs"},bi={class:"flex items-center justify-between gap-2"},_i={class:"font-medium"},hi={class:"mt-1 text-muted-foreground"},yi={class:"rounded-lg border p-3"},xi={class:"mt-3 space-y-2 text-xs"},$i={class:"text-muted-foreground"},Si={class:"rounded-lg border p-3"},ki={class:"mt-3 space-y-2 text-xs"},wi={key:0,class:"text-muted-foreground"},Ii={class:"text-muted-foreground"},Ti=U({__name:"RedisPerformanceSection",props:{performance:{}},setup(n){const i=new Intl.NumberFormat;function c(s){return s==null||s===""?"0":i.format(Number(s))}return(s,o)=>{var h,p,$,b,u,k,w,y;return f(),_("div",oi,[e("div",ai,[e("div",ii,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Ops/sec",-1)),e("p",ri,a(c((h=s.performance)==null?void 0:h.instantaneousOpsPerSec)),1)]),e("div",li,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Total commands",-1)),e("p",di,a(c((p=s.performance)==null?void 0:p.totalCommandsProcessed)),1)]),e("div",ui,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Blocked clients",-1)),e("p",ci,a(c(($=s.performance)==null?void 0:$.blockedClients)),1)])]),e("div",mi,[o[3]||(o[3]=e("h3",{class:"text-sm font-medium"},"Latency doctor",-1)),e("pre",pi,a(((b=s.performance)==null?void 0:b.latencyDoctor)||"No latency doctor output available."),1)]),e("div",fi,[e("div",gi,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Slowlog",-1)),e("div",vi,[(f(!0),_(D,null,F(((u=s.performance)==null?void 0:u.slowlog)||[],m=>(f(),_("div",{key:m.id,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",bi,[e("span",_i,a(m.command||"unknown command"),1),e("span",null,a(c(m.durationMicros))+" µs",1)]),e("p",hi,a(m.clientAddr||"n/a")+" · "+a(m.timestamp||"unknown time"),1)]))),128))])]),e("div",yi,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Command stats",-1)),e("div",xi,[(f(!0),_(D,null,F(((k=s.performance)==null?void 0:k.commandStats)||[],m=>(f(),_("div",{key:m.command,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(m.command),1),e("span",$i,a(c(m.calls))+" calls · "+a(m.usecPerCall.toFixed(2))+" µs/call ",1)]))),128))])])]),e("div",Si,[o[6]||(o[6]=e("h3",{class:"text-sm font-medium"},"Long-running Lua scripts",-1)),e("div",ki,[(((w=s.performance)==null?void 0:w.longRunningLuaScripts)||[]).length?N("",!0):(f(),_("div",wi," No active Lua script clients detected. ")),(f(!0),_(D,null,F(((y=s.performance)==null?void 0:y.longRunningLuaScripts)||[],m=>(f(),_("div",{key:m.id,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(m.addr),1),e("span",Ii,a(m.cmd)+" · age "+a(c(m.ageSeconds))+"s ",1)]))),128))])])])}}}),Ci={class:"space-y-4"},Li={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Ri={class:"rounded-lg border p-3"},Ai={class:"mt-1 text-lg font-medium"},Pi={class:"rounded-lg border p-3"},Bi={class:"mt-1 text-lg font-medium"},Ei={class:"rounded-lg border p-3"},Mi={class:"mt-1 text-lg font-medium"},Ni={class:"rounded-lg border p-3"},Oi={class:"mt-1 text-lg font-medium"},Di={class:"rounded-lg border p-3 text-sm text-muted-foreground space-y-1"},Fi={key:0},Hi=U({__name:"RedisPersistenceSection",props:{persistence:{}},setup(n){const i=new Intl.NumberFormat;function c(s){return s==null||s===""?"0":i.format(Number(s))}return(s,o)=>{var p,$,b,u,k,w,y,m,v;const h=Pe;return f(),_("div",Ci,[e("div",Li,[e("div",Ri,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"RDB enabled",-1)),e("p",Ai,a((p=s.persistence)!=null&&p.rdbEnabled?"Yes":"No"),1)]),e("div",Pi,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"AOF enabled",-1)),e("p",Bi,a(($=s.persistence)!=null&&$.aofEnabled?"Yes":"No"),1)]),e("div",Ei,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"AOF rewrite",-1)),e("p",Mi,a((b=s.persistence)!=null&&b.aofRewriteInProgress?"In progress":"Idle"),1)]),e("div",Ni,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Changes since save",-1)),e("p",Oi,a(c((u=s.persistence)==null?void 0:u.changesSinceLastSave)),1)])]),(f(!0),_(D,null,F(((k=s.persistence)==null?void 0:k.warnings)||[],l=>(f(),W(h,{key:l,variant:"secondary"},{default:E(()=>[M(a(l),1)]),_:2},1024))),128)),e("div",Di,[e("p",null," Last save status: "+a(((w=s.persistence)==null?void 0:w.lastSaveStatus)||"unknown"),1),e("p",null," Last save time: "+a(((y=s.persistence)==null?void 0:y.lastSaveTime)||"unknown"),1),e("p",null," AOF last rewrite status: "+a(((m=s.persistence)==null?void 0:m.aofLastRewriteStatus)||"unknown"),1),(v=s.persistence)!=null&&v.lastBgsaveError?(f(),_("p",Fi," Last bgsave error: "+a(s.persistence.lastBgsaveError),1)):N("",!0)])])}}}),Vi={class:"space-y-4"},zi={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},ji={class:"rounded-lg border p-3"},Ki={class:"mt-1 text-lg font-medium"},Ui={class:"rounded-lg border p-3"},Gi={class:"mt-1 text-lg font-medium"},qi={class:"rounded-lg border p-3"},Qi={class:"mt-1 text-lg font-medium"},Xi={class:"rounded-lg border p-3"},Wi={class:"mt-1 text-lg font-medium"},Yi={class:"rounded-lg border p-3 text-sm text-muted-foreground space-y-1"},Ji={class:"rounded-lg border p-3"},Zi={class:"mt-3 space-y-2 text-xs"},er={key:0,class:"text-muted-foreground"},tr={class:"text-muted-foreground"},sr=U({__name:"RedisReplicationSection",props:{replication:{}},setup(n){const i=new Intl.NumberFormat;function c(s){return s==null||s===""?"0":i.format(Number(s))}return(s,o)=>{var h,p,$,b,u,k,w,y,m,v,l;return f(),_("div",Vi,[e("div",zi,[e("div",ji,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Role",-1)),e("p",Ki,a(((h=s.replication)==null?void 0:h.role)||"unknown"),1)]),e("div",Ui,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Connected replicas",-1)),e("p",Gi,a(c((p=s.replication)==null?void 0:p.connectedReplicas)),1)]),e("div",qi,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Master link status",-1)),e("p",Qi,a((($=s.replication)==null?void 0:$.masterLinkStatus)||"n/a"),1)]),e("div",Xi,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Cluster state",-1)),e("p",Wi,a(((b=s.replication)==null?void 0:b.clusterState)||((u=s.replication)!=null&&u.clusterEnabled?"enabled":"disabled")),1)])]),e("div",Yi,[e("p",null,"Replication lag: "+a(((k=s.replication)==null?void 0:k.replicationLag)??"n/a"),1),e("p",null,"Sentinel masters: "+a(((w=s.replication)==null?void 0:w.sentinelMasters)??"n/a"),1),e("p",null," Cluster slots assigned: "+a(((y=s.replication)==null?void 0:y.clusterSlotsAssigned)??"n/a"),1),e("p",null,"Cluster known nodes: "+a(((m=s.replication)==null?void 0:m.clusterKnownNodes)??"n/a"),1)]),e("div",Ji,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Replicas",-1)),e("div",Zi,[(((v=s.replication)==null?void 0:v.replicas)||[]).length?N("",!0):(f(),_("div",er," No replica nodes reported. ")),(f(!0),_(D,null,F(((l=s.replication)==null?void 0:l.replicas)||[],r=>(f(),_("div",{key:r.id,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(r.addr),1),e("span",tr,a(r.state)+" · lag "+a(r.lag??"n/a"),1)]))),128))])])])}}}),nr=5e3;function or(n){const i=L("overview"),c=L(!0),s=L(null),o=L(!1),h=L(!1),p=L(!1),$=L(null),b=L(!0),u=T(()=>!!n.connection.value);ke(()=>{b.value=!1}),we(()=>{b.value=!0});const k=async(l=!1)=>{var r;if(!n.connection.value)return $.value=null,null;l||(h.value=!0);try{s.value=null;const d=await $fetch("/api/redis/instance-insights/overview",{method:"POST",body:{...ne(n.connection.value),method:n.connection.value.method,databaseIndex:n.databaseIndex.value}});return $.value=d,d}catch(d){return s.value=((r=d==null?void 0:d.data)==null?void 0:r.message)||(d==null?void 0:d.message)||(d==null?void 0:d.statusMessage)||"Failed to fetch Redis instance insights.",null}finally{l||(h.value=!1)}},w=async l=>{var r;if(!n.connection.value)return!1;p.value=!0;try{const d=await $fetch("/api/redis/instance-insights/kill-client",{method:"POST",body:{...ne(n.connection.value),method:n.connection.value.method,databaseIndex:n.databaseIndex.value,clientId:l}});return d.success?(fe("Redis client terminated",{description:d.message}),await k(!0),!0):(fe("Failed to terminate client",{description:d.message}),!1)}catch(d){return fe("Failed to terminate client",{description:((r=d==null?void 0:d.data)==null?void 0:r.message)||(d==null?void 0:d.message)||"The Redis client could not be terminated."}),!1}finally{p.value=!1}},y=async()=>{await k()};re([()=>n.connection.value,()=>n.databaseIndex.value],async([l])=>{if(!l){$.value=null;return}o.value=!0,await k(),o.value=!1},{immediate:!0});const{pause:m,resume:v}=Ie(async()=>{!u.value||!b.value||await k(!0)},nr,{immediate:!1});return re(()=>c.value,l=>{l?v():m()},{immediate:!0}),{activeSection:i,autoRefresh:c,error:s,isInitialLoading:o,isLoading:h,isActionLoading:p,insights:$,refresh:y,killClient:w}}const ar={class:"flex h-full flex-col gap-3 overflow-hidden p-3"},ir={class:"flex items-center gap-2 text-xs"},rr={key:1,class:"flex flex-1 items-center justify-center gap-2 rounded-lg border bg-background text-muted-foreground"},lr={key:2,class:"flex-1 overflow-y-auto rounded-lg border bg-background p-3 mt-2"},dr=U({__name:"RedisInstanceInsightsPanel",props:{databaseName:{},databaseIndex:{},databases:{},dbType:{}},emits:["update:databaseIndex"],setup(n,{emit:i}){const c=n,s=i,o=[{id:"overview",label:"Overview"},{id:"keyspace",label:"Keyspace"},{id:"memory",label:"Memory"},{id:"performance",label:"Performance"},{id:"clients",label:"Clients"},{id:"persistence",label:"Persistence"},{id:"replication",label:"Replication / Cluster"},{id:"config",label:"Config"}],h=he(),p=T(()=>h.selectedConnection),{activeSection:$,autoRefresh:b,error:u,isInitialLoading:k,isLoading:w,isActionLoading:y,insights:m,refresh:v,killClient:l}=or({connection:p,databaseIndex:T(()=>c.databaseIndex)});return(r,d)=>{const R=Ce,V=me,x=ce,g=wt,C=Ae,O=Re,H=Pe,j=Le;return f(),_("div",ar,[S(g,{icon:"hugeicons:activity-02",title:"Instance Insights"},{context:E(()=>[r.dbType===t(ue).REDIS?(f(),W(Te("hugeicons:database-sync-01"),{key:0})):N("",!0)]),actions:E(()=>[S(It,{compact:"","trigger-id":"redis-instance-insights-db-index","trigger-class":"bg-background",databases:r.databases,"database-index":r.databaseIndex,"onUpdate:databaseIndex":d[0]||(d[0]=z=>s("update:databaseIndex",z))},null,8,["databases","database-index"]),e("div",ir,[S(R,{id:"redis-insights-auto-refresh","model-value":t(b),"onUpdate:modelValue":d[1]||(d[1]=z=>le(b)?b.value=z:null)},null,8,["model-value"]),d[3]||(d[3]=e("label",{for:"redis-insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),S(x,{size:"xxs",variant:"outline",disabled:t(w)||t(y),onClick:t(v)},{default:E(()=>[S(V,{name:"hugeicons:redo",class:"size-3.5!"}),d[4]||(d[4]=M(" Refresh "))]),_:1},8,["disabled","onClick"])]),_:1}),S(j,{modelValue:t($),"onUpdate:modelValue":d[2]||(d[2]=z=>le($)?$.value=z:null),class:"flex flex-1 min-h-0 flex-col gap-0"},{default:E(()=>{var z,q,Y,J,B,A,G,Z;return[S(O,{class:"h-8 max-w-full justify-start! shrink-0 overflow-x-auto"},{default:E(()=>[(f(),_(D,null,F(o,ae=>S(C,{key:ae.id,value:ae.id,class:"min-w-fit shrink-0 cursor-pointer rounded-sm px-1.5 text-xs"},{default:E(()=>[M(a(ae.label),1)]),_:2},1032,["value"])),64))]),_:1}),t(u)?(f(),W(H,{key:0,variant:"destructive"},{default:E(()=>[M(a(t(u)),1)]),_:1})):N("",!0),t(k)&&!t(m)?(f(),_("div",rr,[S(V,{name:"hugeicons:redo",class:"size-4 animate-spin"}),d[5]||(d[5]=M(" Loading Redis instance insights... "))])):(f(),_("div",lr,[te(S(ni,{overview:(z=t(m))==null?void 0:z.overview},null,8,["overview"]),[[se,t($)==="overview"]]),te(S(Pa,{keyspace:(q=t(m))==null?void 0:q.keyspace},null,8,["keyspace"]),[[se,t($)==="keyspace"]]),te(S(Ja,{memory:(Y=t(m))==null?void 0:Y.memory},null,8,["memory"]),[[se,t($)==="memory"]]),te(S(Ti,{performance:(J=t(m))==null?void 0:J.performance},null,8,["performance"]),[[se,t($)==="performance"]]),te(S(la,{clients:(B=t(m))==null?void 0:B.clients,"is-action-loading":t(y),onKillClient:t(l)},null,8,["clients","is-action-loading","onKillClient"]),[[se,t($)==="clients"]]),te(S(Hi,{persistence:(A=t(m))==null?void 0:A.persistence},null,8,["persistence"]),[[se,t($)==="persistence"]]),te(S(sr,{replication:(G=t(m))==null?void 0:G.replication},null,8,["replication"]),[[se,t($)==="replication"]]),te(S(ca,{config:(Z=t(m))==null?void 0:Z.config},null,8,["config"]),[[se,t($)==="config"]])]))]}),_:1},8,["modelValue"])])}}}),ur={class:"h-full"},cr={key:0,class:"h-full p-4 flex flex-col items-center justify-center text-muted-foreground"},wr=U({__name:"index",setup(n){const i=We(),c=he(),s=Ye(),{activeTab:o}=He(s),h=T(()=>String(i.params.connectionId||"")),p=T(()=>h.value?c.connections.find(y=>y.id===h.value):null),$=T(()=>{var y;return((y=p.value)==null?void 0:y.connectionString)||""}),b=T(()=>{var y;return(y=p.value)==null?void 0:y.type}),u=T(()=>{var y,m,v;return b.value===ue.REDIS?((y=p.value)==null?void 0:y.name)||"Redis":((m=p.value)==null?void 0:m.database)||((v=p.value)==null?void 0:v.name)||"database"}),k=T(()=>b.value===ue.REDIS?p.value??void 0:void 0),w=Tt({connection:k,mode:"meta"});return re(()=>{var y,m;return(m=(y=o.value)==null?void 0:y.metadata)==null?void 0:m.databaseIndex},y=>{typeof y=="number"&&(w.selectedDatabaseIndex.value=y)},{immediate:!0}),(y,m)=>{const v=me;return f(),_("div",ur,[t(p)?t(b)===t(ue).REDIS?(f(),W(dr,{key:1,"database-name":t(u),"database-index":t(w).selectedDatabaseIndex.value,databases:t(w).databases.value,"db-type":t(b),"onUpdate:databaseIndex":m[0]||(m[0]=l=>t(w).selectedDatabaseIndex.value=l)},null,8,["database-name","database-index","databases","db-type"])):t(b)===t(ue).POSTGRES?(f(),W(eo,{key:2,"db-connection-string":t($),"database-name":t(u),"db-type":t(b)},null,8,["db-connection-string","database-name","db-type"])):(f(),W(qo,{key:3,"db-connection-string":t($),"database-name":t(u),"db-type":t(b)},null,8,["db-connection-string","database-name","db-type"])):(f(),_("div",cr,[S(v,{name:"hugeicons:plug-socket",class:"size-12 mb-2 opacity-50"}),m[1]||(m[1]=e("p",{class:"text-sm"},"Select a connection to open Instance Insights",-1))]))])}}});export{wr as default};
|
|
1
|
+
import{H as Qe,d as U,r as L,au as re,c as T,e as _,m as e,l as N,f as S,a0 as ce,w as E,z as M,t as a,g as t,o as f,A as me,n as oe,df as De,bo as Fe,i as le,aZ as Se,dg as Xe,dh as ke,cq as we,bX as Ie,G as ne,K as fe,a3 as he,k as W,q as Te,J as te,aM as se,bm as _e,bq as Ce,bE as Le,bF as Re,F as D,s as F,bG as Ae,am as He,a6 as ue,a8 as We,a2 as Ye}from"./D0lW43G8.js";import{g as Ve}from"./Chx1IK9D.js";import{t as K,i as Je,a as Ze,b as et,m as tt,k as st,g as ze,h as je,c as nt,d as Ee,e as ot,f as at,j as it,n as rt,l as lt,S as dt,o as ut,p as ct,_ as Ke,q as mt,r as Me,s as pt,C as ft,u as gt,v as vt,E as xe,w as bt,x as _t,y as ht,z as yt,A as xt,B as $t}from"./C4zYnWdF.js";import{f as St}from"./-lZvfnzr.js";import{_ as ye}from"./Dtl3qje7.js";import{b as ge,a as Ue}from"./BVmBXPoG.js";import{u as kt}from"./Czr647QE.js";import{_ as wt}from"./C9kgALYc.js";import{_ as Pe}from"./BKFPmrcv.js";import{_ as It,u as Tt}from"./VNOocds9.js";import"./Cf460dGA.js";import"./CS5akSNT.js";var Ne={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},Ct=function(){function n(i){var c=this._condVal=Ee(i)?new RegExp(i):ot(i)?i:null;if(c==null){var s="";K(s)}}return n.prototype.evaluate=function(i){var c=typeof i;return Ee(c)?this._condVal.test(i):at(c)?this._condVal.test(i+""):!1},n}(),Lt=function(){function n(){}return n.prototype.evaluate=function(){return this.value},n}(),Rt=function(){function n(){}return n.prototype.evaluate=function(){for(var i=this.children,c=0;c<i.length;c++)if(!i[c].evaluate())return!1;return!0},n}(),At=function(){function n(){}return n.prototype.evaluate=function(){for(var i=this.children,c=0;c<i.length;c++)if(i[c].evaluate())return!0;return!1},n}(),Pt=function(){function n(){}return n.prototype.evaluate=function(){return!this.child.evaluate()},n}(),Bt=function(){function n(){}return n.prototype.evaluate=function(){for(var i=!!this.valueParser,c=this.getValue,s=c(this.valueGetterParam),o=i?this.valueParser(s):null,h=0;h<this.subCondList.length;h++)if(!this.subCondList[h].evaluate(i?o:s))return!1;return!0},n}();function Be(n,i){if(n===!0||n===!1){var c=new Lt;return c.value=n,c}var s="";return Ge(n)||K(s),n.and?Oe("and",n,i):n.or?Oe("or",n,i):n.not?Et(n,i):Mt(n,i)}function Oe(n,i,c){var s=i[n],o="";et(s)||K(o),s.length||K(o);var h=n==="and"?new Rt:new At;return h.children=tt(s,function(p){return Be(p,c)}),h.children.length||K(o),h}function Et(n,i){var c=n.not,s="";Ge(c)||K(s);var o=new Pt;return o.child=Be(c,i),o.child||K(s),o}function Mt(n,i){for(var c="",s=i.prepareGetValue(n),o=[],h=st(n),p=n.parser,$=p?ze(p):null,b=0;b<h.length;b++){var u=h[b];if(!(u==="parser"||i.valueGetterAttrMap.get(u))){var k=je(Ne,u)?Ne[u]:u,w=n[u],y=$?$(w):w,m=nt(k,y)||k==="reg"&&new Ct(y);m||K(c),o.push(m)}}o.length||K(c);var v=new Bt;return v.valueGetterParam=s,v.valueParser=$,v.getValue=i.getValue,v.subCondList=o,v}function Ge(n){return Je(n)&&!Ze(n)}var Nt=function(){function n(i,c){this._cond=Be(i,c)}return n.prototype.evaluate=function(){return this._cond.evaluate()},n}();function Ot(n,i){return new Nt(n,i)}var Dt={type:"echarts:filter",transform:function(n){for(var i=n.upstream,c,s=Ot(n.config,{valueGetterAttrMap:it({dimension:!0}),prepareGetValue:function($){var b="",u=$.dimension;je($,"dimension")||K(b);var k=i.getDimensionInfo(u);return k||K(b),{dimIdx:k.index}},getValue:function($){return i.retrieveValueFromItem(c,$.dimIdx)}}),o=[],h=0,p=i.count();h<p;h++)c=i.getRawDataItem(h),s.evaluate()&&o.push(c);return{data:o}}},Ft={type:"echarts:sort",transform:function(n){var i=n.upstream,c=n.config,s="",o=rt(c);o.length||K(s);var h=[];lt(o,function(k){var w=k.dimension,y=k.order,m=k.parser,v=k.incomparable;if(w==null&&K(s),y!=="asc"&&y!=="desc"&&K(s),v&&v!=="min"&&v!=="max"){var l="";K(l)}if(y!=="asc"&&y!=="desc"){var r="";K(r)}var d=i.getDimensionInfo(w);d||K(s);var R=m?ze(m):null;m&&!R&&K(s),h.push({dimIdx:d.index,parser:R,comparator:new dt(y,v)})});var p=i.sourceFormat;p!==ut&&p!==ct&&K(s);for(var $=[],b=0,u=i.count();b<u;b++)$.push(i.getRawDataItem(b));return $.sort(function(k,w){for(var y=0;y<h.length;y++){var m=h[y],v=i.retrieveValueFromItem(k,m.dimIdx),l=i.retrieveValueFromItem(w,m.dimIdx);m.parser&&(v=m.parser(v),l=m.parser(l));var r=m.comparator.evaluate(v,l);if(r!==0)return r}return 0}),{data:$}}};function Ht(n){n.registerTransform(Dt),n.registerTransform(Ft)}var Vt=function(n){Ke(i,n);function i(){var c=n!==null&&n.apply(this,arguments)||this;return c.type="dataset",c}return i.prototype.init=function(c,s,o){n.prototype.init.call(this,c,s,o),this._sourceManager=new mt(this),Me(this)},i.prototype.mergeOption=function(c,s){n.prototype.mergeOption.call(this,c,s),Me(this)},i.prototype.optionUpdated=function(){this._sourceManager.dirty()},i.prototype.getSourceManager=function(){return this._sourceManager},i.type="dataset",i.defaultOption={seriesLayoutBy:pt},i}(ft),zt=function(n){Ke(i,n);function i(){var c=n!==null&&n.apply(this,arguments)||this;return c.type="dataset",c}return i.type="dataset",i}(gt);function jt(n){n.registerComponentModel(Vt),n.registerComponentView(zt)}const de=n=>St(n??0),ie=n=>n==null?"0.00/s":`${n.toFixed(2)}/s`,$e=n=>n==null?"0%":`${n.toFixed(2)}%`,ve=n=>{if(!n)return"-";const i=new Date(n);return Number.isNaN(i.getTime())?n:i.toLocaleString()},qe=n=>{if(n==null)return"-";if(n<60)return`${n}s`;const i=Math.floor(n/60),c=n%60;if(i<60)return`${i}m ${c}s`;const s=Math.floor(i/60),o=i%60;return`${s}h ${o}m`},Kt=n=>n==null||n<=0?"0 B":Qe(n).replace(" bytes"," B"),Ut=n=>{if(!n)return"-";const i=n.replace(/\s+/g," ").trim();return i?i.length>320?`${i.slice(0,320)}...`:i:"-"},Gt=n=>(n||"").toLowerCase().includes("idle in transaction"),qt={class:"space-y-4"},Qt={class:"flex items-center justify-between"},Xt={key:0,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},Wt={class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2.5"},Yt={class:"h-full border rounded-lg p-2.5 space-y-2"},Jt={class:"flex items-center gap-1"},Zt={class:"text-sm font-semibold leading-none tabular-nums"},es={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},ts={class:"text-muted-foreground"},ss={class:"tabular-nums text-foreground"},ns={class:"text-muted-foreground"},os={class:"tabular-nums text-foreground"},as={class:"text-muted-foreground"},is={class:"tabular-nums text-foreground"},rs={class:"text-muted-foreground"},ls={class:"tabular-nums text-foreground"},ds={class:"h-full border rounded-lg p-2.5 space-y-2"},us={class:"flex items-center gap-1"},cs={class:"text-sm font-semibold leading-none tabular-nums"},ms={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},ps={class:"text-muted-foreground"},fs={class:"tabular-nums text-foreground"},gs={class:"text-muted-foreground"},vs={class:"tabular-nums text-foreground"},bs={class:"text-muted-foreground"},_s={class:"tabular-nums text-foreground"},hs={class:"text-muted-foreground"},ys={class:"tabular-nums text-foreground"},xs={class:"h-full border rounded-lg p-2.5 space-y-2"},$s={class:"flex items-center gap-1"},Ss={class:"text-sm font-semibold leading-none tabular-nums"},ks={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},ws={class:"text-muted-foreground"},Is={class:"tabular-nums text-foreground"},Ts={class:"text-muted-foreground"},Cs={class:"tabular-nums text-foreground"},Ls={class:"text-muted-foreground"},Rs={class:"tabular-nums text-foreground"},As={class:"text-muted-foreground"},Ps={class:"tabular-nums text-foreground"},Bs={class:"h-full border rounded-lg p-2.5 space-y-2"},Es={class:"flex items-center gap-1"},Ms={class:"text-sm font-semibold leading-none tabular-nums"},Ns={class:"grid grid-cols-2 gap-x-3 gap-y-1 text-[11px]"},Os={class:"text-muted-foreground"},Ds={class:"tabular-nums text-foreground"},Fs={class:"text-muted-foreground"},Hs={class:"tabular-nums text-foreground"},Vs={class:"text-muted-foreground"},zs={class:"tabular-nums text-foreground"},js={class:"text-muted-foreground"},Ks={class:"tabular-nums text-foreground"},Us={class:"grid grid-cols-1 xl:grid-cols-2 gap-3"},Gs={class:"border rounded-lg p-2.5"},qs={class:"insights-chart-container"},Qs={class:"border rounded-lg p-2.5"},Xs={class:"insights-chart-container"},Ws={class:"border rounded-lg p-2.5"},Ys={class:"insights-chart-container"},Js=U({__name:"InstanceInsightsActivitySection",props:{dashboard:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function}},setup(n){vt([bt,_t,ht,jt,Ht,yt,xt,$t]);const i=n,c=L({}),s=L({}),o=L({}),h=(l,r)=>{r!=null&&r.selected&&(l.value={...r.selected})},p=l=>h(c,l),$=l=>h(s,l),b=l=>h(o,l),u=L([]);re(()=>i.dashboard,l=>{if(!(l!=null&&l.capturedAt))return;const r=new Date(l.capturedAt).toLocaleTimeString(),d={capturedAt:l.capturedAt,label:r,sessionsTotal:l.sessions.total,sessionsActive:l.sessions.active,sessionsIdle:l.sessions.idle,tps:l.transactions.tps,commits:l.transactions.commitsPerSec,rollbacks:l.transactions.rollbacksPerSec,reads:l.blockIO.readsPerSec,hits:l.blockIO.hitsPerSec,hitRatio:l.blockIO.bufferHitRatio},R=u.value.findIndex(V=>V.capturedAt===d.capturedAt);if(R>=0){u.value[R]=d;return}u.value.push(d),u.value.length>80&&(u.value=u.value.slice(-80))},{immediate:!0,deep:!0});const k=T(()=>u.value.map((l,r)=>({...l,idx:r}))),w=l=>Object.keys(l).length?l:void 0,y=T(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:w(c.value)},dataset:[{id:"sessions_raw",source:k.value},{id:"sessions_filtered",fromDatasetId:"sessions_raw",transform:{type:"filter",config:{dimension:"idx",gte:0}}}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!1},yAxis:{type:"value"},series:[{name:"Total",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsTotal"}},{name:"Active",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsActive"}},{name:"Idle",type:"line",smooth:!0,datasetId:"sessions_filtered",encode:{x:"label",y:"sessionsIdle"}}]})),m=T(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:w(s.value)},dataset:[{id:"transactions_dataset",source:k.value}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!0},yAxis:[{type:"value",name:"TPS"},{type:"value",name:"Commit/Rollback"}],series:[{name:"TPS",type:"line",smooth:!0,yAxisIndex:0,datasetId:"transactions_dataset",encode:{x:"label",y:"tps"}},{name:"Commits/s",type:"bar",yAxisIndex:1,datasetId:"transactions_dataset",encode:{x:"label",y:"commits"}},{name:"Rollbacks/s",type:"bar",yAxisIndex:1,datasetId:"transactions_dataset",encode:{x:"label",y:"rollbacks"}}]})),v=T(()=>({tooltip:{trigger:"axis"},legend:{top:0,selected:w(o.value)},dataset:[{id:"block_io_dataset",source:k.value}],grid:{left:45,right:20,top:34,bottom:24},xAxis:{type:"category",boundaryGap:!0},yAxis:[{type:"value",name:"Blocks/s"},{type:"value",name:"Hit %",min:0,max:100}],series:[{name:"Reads/s",type:"bar",yAxisIndex:0,datasetId:"block_io_dataset",encode:{x:"label",y:"reads"}},{name:"Hits/s",type:"bar",yAxisIndex:0,datasetId:"block_io_dataset",encode:{x:"label",y:"hits"}},{name:"Buffer Hit Ratio",type:"line",smooth:!0,yAxisIndex:1,datasetId:"block_io_dataset",encode:{x:"label",y:"hitRatio"}}]}));return(l,r)=>{var V,x,g,C,O,H,j,z,q,Y,J,B,A,G,Z,ae,pe,I,P,X,Q;const d=me,R=ce;return f(),_("div",qt,[e("div",Qt,[r[2]||(r[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Activity Dashboard"),e("p",{class:"text-xs text-muted-foreground"}," Sessions, TPS, tuples and block I/O ")],-1)),S(R,{variant:"outline",size:"xs",disabled:l.isLoading||l.isActionLoading,class:"font-normal",onClick:r[0]||(r[0]=be=>l.onRefresh())},{default:E(()=>[S(d,{name:"hugeicons:redo",class:oe(["size-4",l.isLoading&&"animate-spin"])},null,8,["class"]),r[1]||(r[1]=M(" Refresh Activity "))]),_:1},8,["disabled"])]),(V=l.dashboard)!=null&&V.sessions.exceedsThreshold?(f(),_("div",Xt,[r[3]||(r[3]=M(" Total connections are at ")),e("strong",null,a(t($e)(l.dashboard.sessions.usagePercent)),1),r[4]||(r[4]=M(" of ")),r[5]||(r[5]=e("strong",null,"max_connections",-1)),r[6]||(r[6]=M(". Investigate connection pool usage. "))])):N("",!0),e("div",Wt,[e("div",Yt,[e("div",Jt,[r[7]||(r[7]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Sessions:",-1)),e("p",Zt,a(t(de)((x=l.dashboard)==null?void 0:x.sessions.total)),1)]),e("div",es,[e("p",ts,[r[8]||(r[8]=e("span",null,"Active: ",-1)),e("span",ss,a(t(de)((g=l.dashboard)==null?void 0:g.sessions.active)),1)]),e("p",ns,[r[9]||(r[9]=e("span",null,"Idle: ",-1)),e("span",os,a(t(de)((C=l.dashboard)==null?void 0:C.sessions.idle)),1)]),e("p",as,[r[10]||(r[10]=e("span",null,"Max: ",-1)),e("span",is,a(t(de)((O=l.dashboard)==null?void 0:O.sessions.maxConnections)),1)]),e("p",rs,[r[11]||(r[11]=e("span",null,"Usage: ",-1)),e("span",ls,a(t($e)((H=l.dashboard)==null?void 0:H.sessions.usagePercent)),1)])])]),e("div",ds,[e("div",us,[r[12]||(r[12]=e("p",{class:"text-xs uppercase text-muted-foreground"},"TPS:",-1)),e("p",cs,a(t(ie)((j=l.dashboard)==null?void 0:j.transactions.tps)),1)]),e("div",ms,[e("p",ps,[r[13]||(r[13]=e("span",null,"Commits/sec: ",-1)),e("span",fs,a(t(ie)((z=l.dashboard)==null?void 0:z.transactions.commitsPerSec)),1)]),e("p",gs,[r[14]||(r[14]=e("span",null,"Rollbacks/sec: ",-1)),e("span",vs,a(t(ie)((q=l.dashboard)==null?void 0:q.transactions.rollbacksPerSec)),1)]),e("p",bs,[r[15]||(r[15]=e("span",null,"Total Commits: ",-1)),e("span",_s,a(t(de)((Y=l.dashboard)==null?void 0:Y.transactions.totalCommits)),1)]),e("p",hs,[r[16]||(r[16]=e("span",null,"Total Rollbacks: ",-1)),e("span",ys,a(t(de)((J=l.dashboard)==null?void 0:J.transactions.totalRollbacks)),1)])])]),e("div",xs,[e("div",$s,[r[17]||(r[17]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Tuples:",-1)),e("p",Ss,a(t(ie)((B=l.dashboard)==null?void 0:B.tuples.insertsPerSec)),1)]),e("div",ks,[e("p",ws,[r[18]||(r[18]=e("span",null,"Updates: ",-1)),e("span",Is,a(t(ie)((A=l.dashboard)==null?void 0:A.tuples.updatesPerSec)),1)]),e("p",Ts,[r[19]||(r[19]=e("span",null,"Deletes: ",-1)),e("span",Cs,a(t(ie)((G=l.dashboard)==null?void 0:G.tuples.deletesPerSec)),1)]),e("p",Ls,[r[20]||(r[20]=e("span",null,"Fetched: ",-1)),e("span",Rs,a(t(ie)((Z=l.dashboard)==null?void 0:Z.tuples.fetchedPerSec)),1)]),e("p",As,[r[21]||(r[21]=e("span",null,"Returned: ",-1)),e("span",Ps,a(t(ie)((ae=l.dashboard)==null?void 0:ae.tuples.returnedPerSec)),1)])])]),e("div",Bs,[e("div",Es,[r[22]||(r[22]=e("p",{class:"text-xs uppercase text-muted-foreground"},"Block I/O:",-1)),e("p",Ms,a(t($e)((pe=l.dashboard)==null?void 0:pe.blockIO.bufferHitRatio)),1)]),e("div",Ns,[e("p",Os,[r[23]||(r[23]=e("span",null,"Reads/sec: ",-1)),e("span",Ds,a(t(ie)((I=l.dashboard)==null?void 0:I.blockIO.readsPerSec)),1)]),e("p",Fs,[r[24]||(r[24]=e("span",null,"Hits/sec: ",-1)),e("span",Hs,a(t(ie)((P=l.dashboard)==null?void 0:P.blockIO.hitsPerSec)),1)]),e("p",Vs,[r[25]||(r[25]=e("span",null,"Total Reads: ",-1)),e("span",zs,a(t(de)((X=l.dashboard)==null?void 0:X.blockIO.totalReads)),1)]),e("p",js,[r[26]||(r[26]=e("span",null,"Total Hits: ",-1)),e("span",Ks,a(t(de)((Q=l.dashboard)==null?void 0:Q.blockIO.totalHits)),1)])])])]),e("div",Us,[e("div",Gs,[r[27]||(r[27]=e("p",{class:"text-sm font-medium mb-1.5"},"Sessions Timeline",-1)),e("div",qs,[S(t(xe),{option:t(y),autoresize:"",class:"insights-chart",onLegendselectchanged:p},null,8,["option"])])]),e("div",Qs,[r[28]||(r[28]=e("p",{class:"text-sm font-medium mb-1.5"},"Transactions Timeline",-1)),e("div",Xs,[S(t(xe),{option:t(m),autoresize:"",class:"insights-chart",onLegendselectchanged:$},null,8,["option"])])])]),e("div",Ws,[r[29]||(r[29]=e("p",{class:"text-sm font-medium mb-1.5"},"Block I/O Timeline",-1)),e("div",Ys,[S(t(xe),{option:t(v),autoresize:"",class:"insights-chart",onLegendselectchanged:b},null,8,["option"])])])])}}}),Zs=De(Js,[["__scopeId","data-v-ba36a884"]]),en={class:"space-y-4 h-full flex flex-col overflow-auto"},tn={class:"flex items-center justify-between gap-2 flex-wrap"},sn={class:"h-full"},nn={class:"flex flex-col sm:flex-row sm:items-center gap-2 mb-2"},on={class:"relative flex-1"},an=U({__name:"InstanceInsightsConfigurationSection",props:{configuration:{},search:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function}},emits:["update:search"],setup(n,{emit:i}){const c=n,s=i,o=T({get:()=>c.search,set:b=>s("update:search",b)}),h=T(()=>{var b;return((b=c.configuration)==null?void 0:b.rows)||[]}),p=T(()=>h.value.map(b=>({name:b.name,category:b.category,value:b.value,unit:b.unit||"-",requires_restart:b.pendingRestart?"yes":"no",description:b.description}))),$=T(()=>ge(p.value));return(b,u)=>{const k=me,w=ce,y=Fe,m=ye;return f(),_("div",en,[e("div",tn,[u[3]||(u[3]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Configuration"),e("p",{class:"text-xs text-muted-foreground"},"Searchable pg_settings")],-1)),S(w,{variant:"outline",size:"xs",disabled:b.isLoading||b.isActionLoading,class:"font-normal",onClick:u[0]||(u[0]=v=>b.onRefresh())},{default:E(()=>[S(k,{name:"hugeicons:redo",class:oe(["size-4",b.isLoading&&"animate-spin"])},null,8,["class"]),u[2]||(u[2]=M(" Refresh Configuration "))]),_:1},8,["disabled"])]),e("div",sn,[e("div",nn,[e("div",on,[S(k,{name:"hugeicons:search-01",class:"size-4 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),S(y,{type:"text",placeholder:"Search setting name, category, or description...",class:"h-8 w-full pl-8 pr-3",modelValue:t(o),"onUpdate:modelValue":u[1]||(u[1]=v=>le(o)?o.value=v:null)},null,8,["modelValue"])])]),S(m,{columns:t($),data:t(p),class:"h-full border rounded-md",columnKeyBy:"field"},null,8,["columns","data"])])])}}}),rn={class:"space-y-4"},ln={class:"flex items-center justify-between"},dn={key:0,class:"border border-orange-300 bg-orange-50 text-orange-700 rounded-lg p-3 text-sm"},un={class:"space-y-1.5"},cn={class:"space-y-1.5"},mn={key:1,class:"border rounded-lg p-2.5"},pn={class:"flex items-center justify-between gap-3 flex-wrap"},fn={class:"text-sm font-medium"},gn={class:"flex items-center gap-2"},vn=300,bn=120,_n=44,hn=36,yn=U({__name:"InstanceInsightsReplicationSection",props:{replication:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function},onToggleSlotStatus:{type:Function},onDropSlot:{type:Function}},setup(n){const i=n,c=T(()=>{var x;return((x=i.replication)==null?void 0:x.replicationStats)||[]}),s=T(()=>{var x;return((x=i.replication)==null?void 0:x.replicationSlots)||[]}),o=L([]),h=x=>{o.value=x},p=T(()=>c.value.map(x=>({pid:x.pid,client_addr:x.clientAddr||"-",application:x.applicationName||"-",state:x.state||"-",sync_state:x.syncState||"-",reply_time:ve(x.replyTime),write_lag:x.writeLag||"-",flush_lag:x.flushLag||"-",replay_lag:x.replayLag||"-"}))),$=["pid","client_addr","application","state","sync_state","reply_time","write_lag","flush_lag","replay_lag"],b=T(()=>p.value.length>0?ge(p.value):Ue($)),u=T(()=>s.value.map(x=>({slot_name:x.slotName,slot_type:x.slotType,status:x.active?"on":"off",active_pid:x.activePid??"-",restart_lsn:x.restartLsn||"-",retained_wal:Kt(x.retainedBytes),temporary:x.temporary?"yes":"no"}))),k=T(()=>ge(u.value)),w=x=>x<=0?bn:Math.min(vn,_n+x*hn),y=T(()=>`${w(p.value.length)}px`),m=T(()=>`${w(u.value.length)}px`),v=T(()=>{var g;const x=String(((g=o.value[0])==null?void 0:g.slot_name)||"");return x&&s.value.find(C=>C.slotName===x)||null}),l=T(()=>{var x;return(x=v.value)!=null&&x.active?"off":"on"}),r=T(()=>l.value==="off"?"Turn Off Slot":"Turn On Slot"),d=x=>window.confirm(x),R=async()=>{v.value&&d(`Drop replication slot "${v.value.slotName}"? This action cannot be undone.`)&&await i.onDropSlot(v.value.slotName)},V=async()=>{v.value&&d(`Switch replication slot "${v.value.slotName}" to ${l.value.toUpperCase()} status?`)&&await i.onToggleSlotStatus({slotName:v.value.slotName,desiredStatus:l.value,activePid:v.value.activePid,slotType:v.value.slotType})};return(x,g)=>{var j;const C=me,O=ce,H=ye;return f(),_("div",rn,[e("div",ln,[g[2]||(g[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"Replication"),e("p",{class:"text-xs text-muted-foreground"},"Replication stats and slots")],-1)),S(O,{variant:"outline",size:"xs",disabled:x.isLoading||x.isActionLoading,class:"font-normal",onClick:g[0]||(g[0]=z=>x.onRefresh())},{default:E(()=>[S(C,{name:"hugeicons:redo",class:oe(["size-4",x.isLoading&&"animate-spin"])},null,8,["class"]),g[1]||(g[1]=M(" Refresh Replication "))]),_:1},8,["disabled"])]),(j=x.replication)!=null&&j.staleSlotWarning?(f(),_("div",dn,a(x.replication.staleSlotWarning),1)):N("",!0),e("div",un,[g[3]||(g[3]=e("p",{class:"text-sm"},"Replication Stats",-1)),e("div",{class:"max-h-[300px]",style:Se({height:t(y)})},[S(H,{columns:t(b),data:t(p),class:"h-full border rounded-md",columnKeyBy:"field"},null,8,["columns","data"])],4)]),e("div",cn,[g[4]||(g[4]=e("h4",{class:"text-sm font-normal"},"Replication Slots",-1)),e("div",{class:"max-h-[300px]",style:Se({height:t(m)})},[S(H,{columns:t(k),data:t(u),selectedRows:t(o),class:"h-full border rounded-md",columnKeyBy:"field",onOnSelectedRows:h},null,8,["columns","data","selectedRows"])],4)]),t(v)?(f(),_("div",mn,[e("div",pn,[e("p",fn," Selected Slot: "+a(t(v).slotName)+" ("+a(t(v).active?"on":"off")+") · Active PID: "+a(t(v).activePid??"-"),1),e("div",gn,[S(O,{variant:"outline",size:"sm",disabled:x.isActionLoading,onClick:V},{default:E(()=>[M(a(t(r)),1)]),_:1},8,["disabled"]),S(O,{variant:"outline",size:"sm",disabled:x.isActionLoading,onClick:R},{default:E(()=>g[5]||(g[5]=[M(" Drop Slot ")])),_:1},8,["disabled"])])])])):N("",!0)])}}}),xn={class:"space-y-4"},$n={class:"flex items-center justify-between"},Sn={class:"space-y-1.5"},kn={class:"h-[360px]"},wn={key:0,class:"border rounded-lg p-2.5 space-y-2"},In={class:"flex items-center justify-between gap-3 flex-wrap"},Tn={class:"text-sm font-medium"},Cn={class:"flex gap-2"},Ln=["innerHTML"],Rn={class:"grid grid-cols-1 xl:grid-cols-2 gap-3"},An={class:"space-y-1.5"},Pn={class:"h-[300px]"},Bn={class:"space-y-1.5"},En={class:"h-[300px]"},Mn=U({__name:"InstanceInsightsStateSection",props:{state:{},isLoading:{type:Boolean},isActionLoading:{type:Boolean},onRefresh:{type:Function},onCancelQuery:{type:Function},onTerminateConnection:{type:Function}},setup(n){const i=n,{highlightSql:c}=kt(),s=T(()=>{var g;return((g=i.state)==null?void 0:g.sessions)||[]}),o=T(()=>{var g;return((g=i.state)==null?void 0:g.locks)||[]}),h=T(()=>{var g;return((g=i.state)==null?void 0:g.preparedTransactions)||[]}),p=L([]),$=g=>{p.value=g},b=T(()=>s.value.map(g=>({pid:g.pid,user:g.user,application:g.application||"-",client:g.client||"-",state:g.state||"-",wait_event:g.waitEvent||"-",blocking_pids:g.blockingPids.length?g.blockingPids.join(", "):"-",backend_start:ve(g.backendStart),transaction_start:ve(g.transactionStart),query_duration:qe(g.durationSeconds),sql:Ut(g.sql)}))),u=T(()=>ge(b.value)),k=T(()=>o.value.map(g=>({lock_type:g.lockType,target_relation:g.targetRelation||"-",mode:g.mode,granted:g.granted?"yes":"no",pid:g.pid??"-",user:g.user||"-",state:g.state||"-"}))),w=T(()=>ge(k.value)),y=T(()=>h.value.map(g=>({gid:g.gid,transaction:g.transaction,prepared:ve(g.prepared),owner:g.owner,database:g.database}))),m=T(()=>ge(y.value)),v=T(()=>{var C;const g=Number(((C=p.value[0])==null?void 0:C.pid)||0);return g&&s.value.find(O=>O.pid===g)||null}),l=g=>{if(!g||!g.trim())return"<pre><code>-</code></pre>";const C=g.replace(/\s+/g," ").trim(),O=C.length>900?`${C.slice(0,900)} ...`:C;return c(O)},r=T(()=>{var g;return l(((g=v.value)==null?void 0:g.sql)||null)}),d=(g,C)=>{const O=String(C.state||"");return Gt(O)?"insights-danger-cell":void 0},R=g=>window.confirm(g),V=async()=>{v.value&&R(`Cancel query for PID ${v.value.pid}?`)&&await i.onCancelQuery(v.value.pid)},x=async()=>{v.value&&R(`Terminate connection for PID ${v.value.pid}?`)&&await i.onTerminateConnection(v.value.pid)};return(g,C)=>{const O=me,H=ce,j=ye;return f(),_("div",xn,[e("div",$n,[C[2]||(C[2]=e("div",null,[e("h3",{class:"text-sm font-medium"},"State"),e("p",{class:"text-xs text-muted-foreground"}," Active sessions, locks, prepared transactions ")],-1)),S(H,{variant:"outline",size:"xs",disabled:g.isLoading||g.isActionLoading,class:"font-normal",onClick:C[0]||(C[0]=z=>g.onRefresh())},{default:E(()=>[S(O,{name:"hugeicons:redo",class:oe(["size-4",g.isLoading&&"animate-spin"])},null,8,["class"]),C[1]||(C[1]=M(" Refresh State "))]),_:1},8,["disabled"])]),e("div",Sn,[C[3]||(C[3]=e("h4",{class:"text-sm font-normal"},"Active Sessions",-1)),e("div",kn,[S(j,{columns:t(u),data:t(b),selectedRows:t(p),getCellClass:d,class:"h-full border rounded-md",columnKeyBy:"field",onOnSelectedRows:$},null,8,["columns","data","selectedRows"])])]),t(v)?(f(),_("div",wn,[e("div",In,[e("p",Tn," Selected PID: "+a(t(v).pid)+" ("+a(t(v).state||"-")+") ",1),e("div",Cn,[S(H,{variant:"outline",size:"sm",disabled:g.isActionLoading,onClick:V},{default:E(()=>C[4]||(C[4]=[M(" Cancel Query ")])),_:1},8,["disabled"]),S(H,{variant:"outline",size:"sm",disabled:g.isActionLoading,onClick:x},{default:E(()=>C[5]||(C[5]=[M(" Terminate Connection ")])),_:1},8,["disabled"])])]),e("div",null,[C[6]||(C[6]=e("p",{class:"text-xs text-muted-foreground mb-1"},"SQL Preview",-1)),e("div",{class:"sql-preview border rounded-md overflow-hidden",innerHTML:t(r)},null,8,Ln)])])):N("",!0),e("div",Rn,[e("div",An,[C[7]||(C[7]=e("h4",{class:"text-sm font-normal"},"Locks",-1)),e("div",Pn,[S(j,{columns:t(w),data:t(k),class:"h-full border rounded-md",columnKeyBy:"field"},null,8,["columns","data"])])]),e("div",Bn,[C[8]||(C[8]=e("h4",{class:"text-sm font-normal"},"Prepared Transactions",-1)),e("div",En,[S(j,{columns:t(m),data:t(y),class:"h-full border rounded-md",columnKeyBy:"field"},null,8,["columns","data"])])])])])}}}),Nn=De(Mn,[["__scopeId","data-v-2eab93d6"]]),On=5e3;function Dn(n){const i=L("activity"),c=L(!0),s=L(On),o=L(null),h=L(!1),p=L(!1),$=L(!1),b=L(!1),u=L(!1),k=L(!1),w=L(null),y=L(null),m=L(null),v=L(null),l=L(""),r=Xe(l,350),d=T(()=>!!n.value),R=L(!0);ke(()=>{R.value=!1}),we(()=>{R.value=!0});const V=()=>{o.value=null,w.value=null,y.value=null,m.value=null,v.value=null},x=async(I,P)=>{var X;try{return o.value=null,await I()}catch(Q){const be=((X=Q==null?void 0:Q.data)==null?void 0:X.message)||(Q==null?void 0:Q.message)||(Q==null?void 0:Q.statusMessage)||P;return o.value=be,null}},g=async(I={})=>{if(!d.value)return null;I.silent||($.value=!0);const P=await x(async()=>await $fetch("/api/instance-insights/dashboard",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch activity dashboard");return P&&(w.value=P),I.silent||($.value=!1),P},C=async(I={})=>{if(!d.value)return null;I.silent||(b.value=!0);const P=await x(async()=>await $fetch("/api/instance-insights/state",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch active sessions and locks");return P&&(y.value=P),I.silent||(b.value=!1),P},O=async(I={})=>{if(!d.value)return null;I.silent||(u.value=!0);const P=await x(async()=>await $fetch("/api/instance-insights/configuration",{method:"POST",body:{...ne(n.value),search:r.value||void 0}}),"Failed to fetch PostgreSQL settings");return P&&(m.value=P),I.silent||(u.value=!1),P},H=async(I={})=>{if(!d.value)return null;I.silent||(k.value=!0);const P=await x(async()=>await $fetch("/api/instance-insights/replication",{method:"POST",body:{...ne(n.value)}}),"Failed to fetch replication status");return P&&(v.value=P),I.silent||(k.value=!1),P},j=async(I=i.value,P={})=>{switch(I){case"activity":await g(P);break;case"state":await Promise.all([g({silent:!0}),C(P)]);break;case"configuration":await Promise.all([g({silent:!0}),O(P)]);break;case"replication":await Promise.all([g({silent:!0}),H(P)]);break;default:await g(P);break}},z=async(I={})=>{await Promise.all([g(I),C(I),O(I),H(I)])},q=async(I,P)=>{if(!d.value)return!1;p.value=!0;const X=await x(I,"Action failed");return p.value=!1,X?(X.success?fe(P,{description:X.message}):fe(X.message,{description:"The server did not complete this action."}),X.success):(fe(o.value||"Action failed",{description:"Check database permissions and try again."}),!1)},Y=async I=>{await q(async()=>await $fetch("/api/instance-insights/cancel-query",{method:"POST",body:{...ne(n.value),pid:I}}),`Cancelled query for PID ${I}`)&&await C({silent:!0})},J=async I=>{await q(async()=>await $fetch("/api/instance-insights/terminate-connection",{method:"POST",body:{...ne(n.value),pid:I}}),`Terminated connection for PID ${I}`)&&(await C({silent:!0}),await g({silent:!0}))},B=async I=>{await q(async()=>await $fetch("/api/instance-insights/drop-slot",{method:"POST",body:{...ne(n.value),slotName:I}}),`Dropped replication slot "${I}"`)&&await H({silent:!0})},A=async I=>{await q(async()=>await $fetch("/api/instance-insights/toggle-slot-status",{method:"POST",body:{...ne(n.value),slotName:I.slotName,desiredStatus:I.desiredStatus,activePid:I.activePid??null,slotType:I.slotType??null}}),`Turned ${I.desiredStatus} slot "${I.slotName}"`)&&await H({silent:!0})},G=async()=>{if(!d.value){V();return}h.value=!0,await z(),h.value=!1};re(()=>n.value,async I=>{if(!I){V();return}await G()},{immediate:!0}),re(()=>r.value,async()=>{i.value!=="configuration"||!d.value||await O({silent:!0})}),re(()=>i.value,async I=>{d.value&&(I==="state"&&!y.value&&await C(),I==="configuration"&&!m.value&&await O(),I==="replication"&&!v.value&&await H())});const{pause:Z,resume:ae,isActive:pe}=Ie(async()=>{!d.value||!R.value||await j(i.value,{silent:!0})},s,{immediate:!1});return re(()=>c.value,I=>{I?ae():Z()},{immediate:!0}),{activeSection:i,autoRefresh:c,isAutoRefreshRunning:pe,error:o,isInitialLoading:h,isActionLoading:p,isDashboardLoading:$,isStateLoading:b,isConfigurationLoading:u,isReplicationLoading:k,dashboard:w,state:y,configuration:m,replication:v,configurationSearch:l,refreshSection:j,refreshAll:z,fetchDashboard:g,fetchState:C,fetchConfiguration:O,fetchReplication:H,cancelQuery:Y,terminateConnection:J,dropReplicationSlot:B,toggleReplicationSlotStatus:A}}const Fn={class:"flex flex-col h-full p-3 gap-3 overflow-hidden"},Hn={class:"flex flex-col lg:flex-row lg:items-start lg:justify-between border rounded-lg p-3 gap-3 bg-background"},Vn={class:"space-y-1"},zn={class:"flex items-center gap-2"},jn={class:"text-sm text-muted-foreground flex items-center gap-0.5"},Kn={class:"flex items-center gap-0.5"},Un={class:"font-medium text-foreground"},Gn={key:0,class:"flex items-center gap-1.5 mt-0.5"},qn={class:"flex items-center gap-2 flex-wrap"},Qn={class:"text-xs flex items-center gap-2"},Xn={class:"flex items-center justify-between gap-2"},Wn={class:"text-xs text-muted-foreground"},Yn={key:0,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},Jn={key:1,class:"border rounded-lg p-6 flex items-center justify-center gap-2 text-muted-foreground"},Zn={key:2,class:"flex-1 overflow-y-auto border rounded-lg p-3 bg-background"},eo=U({__name:"InstanceInsightsPanel",props:{dbConnectionString:{},databaseName:{},dbType:{}},setup(n){const i=[{id:"activity",tabLabel:"Activity",subtitle:"Sessions, TPS, tuples and block I/O",icon:"hugeicons:artificial-intelligence-08"},{id:"state",tabLabel:"State",subtitle:"Active sessions, locks, prepared transactions",icon:"hugeicons:shield-01"},{id:"configuration",tabLabel:"Config",subtitle:"Searchable pg_settings",icon:"hugeicons:settings-01"},{id:"replication",tabLabel:"Replication",subtitle:"Replication stats and slots",icon:"hugeicons:database"}],c=he(),s=T(()=>c.selectedConnection),{activeSection:o,autoRefresh:h,error:p,isInitialLoading:$,isActionLoading:b,isDashboardLoading:u,isStateLoading:k,isConfigurationLoading:w,isReplicationLoading:y,dashboard:m,state:v,configuration:l,replication:r,configurationSearch:d,refreshSection:R,refreshAll:V,cancelQuery:x,terminateConnection:g,dropReplicationSlot:C,toggleReplicationSlotStatus:O}=Dn(s);T(()=>i.find(B=>B.id===o.value));const H=T(()=>{var B,A,G,Z;return o.value==="activity"?(B=m.value)==null?void 0:B.capturedAt:o.value==="state"?(A=v.value)==null?void 0:A.capturedAt:o.value==="configuration"?(G=l.value)==null?void 0:G.capturedAt:(Z=r.value)==null?void 0:Z.capturedAt}),j=()=>R("activity"),z=()=>R("state"),q=()=>R("configuration"),Y=()=>R("replication"),J=B=>O(B);return(B,A)=>{var Q,be;const G=me,Z=_e,ae=Ce,pe=ce,I=Ae,P=Re,X=Le;return f(),_("div",Fn,[e("div",Hn,[e("div",Vn,[e("div",zn,[S(G,{name:"hugeicons:database",class:"size-5 text-primary"}),A[4]||(A[4]=e("h2",{class:"text-base font-medium"},"Instance Insights",-1))]),e("div",jn,[A[5]||(A[5]=M(" connection: ")),e("div",Kn,[B.dbType?(f(),W(Te((Q=t(Ve)(B.dbType))==null?void 0:Q.icon),{key:0,class:"size-4!"})):N("",!0),e("span",Un,a(B.databaseName),1)])]),(be=t(m))!=null&&be.version?(f(),_("div",Gn,[S(Z,{variant:"outline",class:"text-xxs h-5 px-1.5 font-normal"},{default:E(()=>[M(" PostgreSQL "+a(t(m).version),1)]),_:1})])):N("",!0)]),e("div",qn,[e("div",Qn,[S(ae,{id:"insights-auto-refresh","model-value":t(h),"onUpdate:modelValue":A[0]||(A[0]=ee=>le(h)?h.value=ee:null),class:"cursor-pointer"},null,8,["model-value"]),A[6]||(A[6]=e("label",{for:"insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),S(pe,{variant:"outline",size:"sm",disabled:t($)||t(b),onClick:A[1]||(A[1]=ee=>t(V)()),class:"font-normal"},{default:E(()=>[S(G,{name:"hugeicons:redo",class:"size-4"}),A[7]||(A[7]=M(" Refresh All "))]),_:1},8,["disabled"])])]),e("div",Xn,[S(X,{modelValue:t(o),"onUpdate:modelValue":A[2]||(A[2]=ee=>le(o)?o.value=ee:null),class:"gap-0 flex-1 min-w-0"},{default:E(()=>[S(P,{class:"h-8 max-w-full overflow-x-auto justify-start!"},{default:E(()=>[(f(),_(D,null,F(i,ee=>S(I,{key:ee.id,value:ee.id,class:"text-xs px-1.5 rounded-sm cursor-pointer min-w-fit shrink-0",onClick:mr=>t(R)(ee.id,{silent:!0})},{default:E(()=>[S(G,{name:ee.icon,class:"size-3.5!"},null,8,["name"]),M(" "+a(ee.tabLabel),1)]),_:2},1032,["value","onClick"])),64))]),_:1})]),_:1},8,["modelValue"]),e("div",Wn," Last updated: "+a(t(ve)(t(H))),1)]),t(p)?(f(),_("div",Yn,a(t(p)),1)):N("",!0),t($)&&!t(m)?(f(),_("div",Jn,[S(G,{name:"hugeicons:redo",class:"size-4 animate-spin"}),A[8]||(A[8]=M(" Loading instance insights... "))])):(f(),_("div",Zn,[te(S(Zs,{dashboard:t(m),isLoading:t(u),isActionLoading:t(b),onRefresh:j},null,8,["dashboard","isLoading","isActionLoading"]),[[se,t(o)==="activity"]]),te(S(Nn,{state:t(v),isLoading:t(k),isActionLoading:t(b),onRefresh:z,onCancelQuery:t(x),onTerminateConnection:t(g)},null,8,["state","isLoading","isActionLoading","onCancelQuery","onTerminateConnection"]),[[se,t(o)==="state"]]),te(S(an,{search:t(d),"onUpdate:search":A[3]||(A[3]=ee=>le(d)?d.value=ee:null),configuration:t(l),isLoading:t(w),isActionLoading:t(b),onRefresh:q},null,8,["search","configuration","isLoading","isActionLoading"]),[[se,t(o)==="configuration"]]),te(S(yn,{replication:t(r),isLoading:t(y),isActionLoading:t(b),onRefresh:Y,onDropSlot:t(C),onToggleSlotStatus:J},null,8,["replication","isLoading","isActionLoading","onDropSlot"]),[[se,t(o)==="replication"]])]))])}}}),to={key:0,class:"space-y-4"},so={class:"flex items-start justify-between gap-3 flex-wrap"},no={class:"text-sm font-medium"},oo={class:"text-xs text-muted-foreground"},ao={key:1,class:"flex gap-2 flex-wrap"},io={key:2,class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-2.5"},ro={class:"text-xs uppercase text-muted-foreground"},lo={class:"text-sm font-semibold leading-none tabular-nums"},uo={key:0,class:"text-[11px] text-muted-foreground"},co={key:3,class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2.5"},mo={class:"text-xs uppercase text-muted-foreground"},po={class:"text-sm font-medium leading-tight break-words"},fo={key:0,class:"text-[11px] text-muted-foreground"},go={key:4,class:"space-y-2"},vo={class:"font-medium"},bo={class:"text-xs mt-1"},_o={class:"text-sm font-normal"},ho={key:0,class:"text-xs text-muted-foreground"},yo={key:0,class:"text-xs text-muted-foreground"},xo=360,$o=120,So=44,ko=36,wo=U({__name:"InstanceInsightsSectionRenderer",props:{section:{},search:{}},setup(n){const i=n,c=T(()=>{var u;return((u=i.search)==null?void 0:u.trim().toLowerCase())||""}),s=T(()=>i.section?!i.section.searchable||!c.value?i.section.tables||[]:(i.section.tables||[]).map(u=>({...u,rows:u.rows.filter(k=>Object.values(k).some(w=>String(w??"").toLowerCase().includes(c.value)))})):[]),o=u=>u<=0?$o:Math.min(xo,So+u*ko),h=u=>u==="supported"?"border-emerald-300 bg-emerald-50 text-emerald-700":u==="conditional"?"border-amber-300 bg-amber-50 text-amber-700":"border-slate-300 bg-slate-50 text-slate-700",p=u=>u==="success"?"border-emerald-200 bg-emerald-50":u==="warning"?"border-amber-200 bg-amber-50":u==="danger"?"border-red-200 bg-red-50":u==="info"?"border-sky-200 bg-sky-50":"border-border bg-background",$=u=>u==="unsupported"?"border-amber-300 bg-amber-50 text-amber-700":u==="unavailable"?"border-red-300 bg-red-50 text-red-700":"border-emerald-300 bg-emerald-50 text-emerald-700",b=u=>u==="pass"?"border-emerald-200 bg-emerald-50 text-emerald-700":u==="warn"?"border-amber-200 bg-amber-50 text-amber-700":u==="fail"?"border-red-200 bg-red-50 text-red-700":"border-sky-200 bg-sky-50 text-sky-700";return(u,k)=>{var m,v,l,r;const w=_e,y=ye;return u.section?(f(),_("div",to,[e("div",so,[e("div",null,[e("h3",no,a(u.section.title),1),e("p",oo,a(u.section.subtitle),1)]),S(w,{class:oe($(u.section.status)),variant:"outline"},{default:E(()=>[M(a(u.section.status),1)]),_:1},8,["class"])]),u.section.statusMessage?(f(),_("div",{key:0,class:oe(["border rounded-lg p-3 text-sm",$(u.section.status)])},a(u.section.statusMessage),3)):N("",!0),(m=u.section.actions)!=null&&m.length?(f(),_("div",ao,[(f(!0),_(D,null,F(u.section.actions,d=>(f(),W(w,{key:d.id,class:oe(h(d.state)),variant:"outline"},{default:E(()=>[M(a(d.label)+" · "+a(d.state),1)]),_:2},1032,["class"]))),128))])):N("",!0),(v=u.section.cards)!=null&&v.length?(f(),_("div",io,[(f(!0),_(D,null,F(u.section.cards,d=>(f(),_("div",{key:d.id,class:oe(["h-full border rounded-lg p-2.5 space-y-1.5",p(d.tone)])},[e("p",ro,a(d.label),1),e("p",lo,a(d.value),1),d.helperText?(f(),_("p",uo,a(d.helperText),1)):N("",!0)],2))),128))])):N("",!0),(l=u.section.details)!=null&&l.length?(f(),_("div",co,[(f(!0),_(D,null,F(u.section.details,d=>(f(),_("div",{key:`${d.label}-${d.value}`,class:oe(["border rounded-lg p-2.5 space-y-1",p(d.tone)])},[e("p",mo,a(d.label),1),e("p",po,a(d.value),1),d.helperText?(f(),_("p",fo,a(d.helperText),1)):N("",!0)],2))),128))])):N("",!0),(r=u.section.checks)!=null&&r.length?(f(),_("div",go,[(f(!0),_(D,null,F(u.section.checks,d=>(f(),_("div",{key:d.id,class:oe(["border rounded-lg p-3 text-sm",b(d.status)])},[e("p",vo,a(d.label),1),e("p",bo,a(d.detail),1)],2))),128))])):N("",!0),(f(!0),_(D,null,F(t(s),d=>(f(),_("div",{key:d.id,class:"space-y-1.5"},[e("div",null,[e("h4",_o,a(d.title),1),d.description?(f(),_("p",ho,a(d.description),1)):N("",!0)]),e("div",{class:"max-h-[360px]",style:Se({height:`${o(d.rows.length)}px`})},[S(y,{columns:t(Ue)(d.columns.map(R=>R.key)),data:d.rows,class:"h-full border rounded-md",columnKeyBy:"field"},null,8,["columns","data"])],4),d.emptyMessage&&d.rows.length===0?(f(),_("p",yo,a(d.emptyMessage),1)):N("",!0)]))),128))])):N("",!0)}}}),Io=5e3;function To(n){const i=L(null),c=L("overview"),s=L(!0),o=L(""),h=L(null),p=L(!1),$=L(!1),b=T(()=>!!n.value),u=L(!0);ke(()=>{u.value=!1}),we(()=>{u.value=!0});const k=()=>{h.value=null,i.value=null,o.value="",c.value="overview"},w=async(d={})=>{var R,V;if(!b.value)return k(),null;d.silent||($.value=!0);try{h.value=null;const x=await $fetch("/api/instance-insights/view",{method:"POST",body:{...ne(n.value)}});return i.value=x,x.sections.some(g=>g.id===c.value)||(c.value=((R=x.sections[0])==null?void 0:R.id)||"overview"),x}catch(x){const g=((V=x==null?void 0:x.data)==null?void 0:V.message)||(x==null?void 0:x.message)||(x==null?void 0:x.statusMessage)||"Failed to fetch instance insights";return h.value=g,null}finally{d.silent||($.value=!1)}},y=async(d=c.value,R={})=>w(R),m=async(d={})=>w(d),v=async()=>{if(!b.value){k();return}p.value=!0,await w(),p.value=!1};re(()=>n.value,async d=>{if(!d){k();return}await v()},{immediate:!0});const{pause:l,resume:r}=Ie(async()=>{!b.value||!u.value||await w({silent:!0})},Io,{immediate:!1});return re(()=>s.value,d=>{d?r():l()},{immediate:!0}),{view:i,activeSection:c,autoRefresh:s,configurationSearch:o,error:h,isInitialLoading:p,isViewLoading:$,refreshSection:y,refreshAll:m}}const Co={class:"flex flex-col h-full p-3 gap-3 overflow-hidden"},Lo={class:"flex flex-col lg:flex-row lg:items-start lg:justify-between border rounded-lg p-3 gap-3 bg-background"},Ro={class:"space-y-2"},Ao={class:"space-y-1"},Po={class:"flex items-center gap-2"},Bo={class:"text-sm text-muted-foreground flex items-center gap-0.5"},Eo={class:"flex items-center gap-0.5"},Mo={class:"font-medium text-foreground"},No={key:0,class:"flex items-center gap-1.5 mt-0.5"},Oo={key:0,class:"flex gap-2 flex-wrap"},Do={class:"flex items-center gap-2 flex-wrap"},Fo={class:"text-xs flex items-center gap-2"},Ho={class:"flex items-center justify-between gap-2"},Vo={class:"text-xs text-muted-foreground"},zo={key:0,class:"border rounded-lg p-3 bg-background"},jo={class:"relative"},Ko={key:1,class:"border border-red-300 bg-red-50 text-red-700 rounded-lg p-3 text-sm"},Uo={key:2,class:"border rounded-lg p-6 flex items-center justify-center gap-2 text-muted-foreground"},Go={key:3,class:"flex-1 overflow-y-auto border rounded-lg p-3 bg-background"},qo=U({__name:"MultiDbInstanceInsightsPanel",props:{dbConnectionString:{},databaseName:{},dbType:{}},setup(n){const i=he(),{selectedConnection:c}=He(i),{view:s,activeSection:o,autoRefresh:h,configurationSearch:p,error:$,isInitialLoading:b,isViewLoading:u,refreshSection:k,refreshAll:w}=To(c),y=T(()=>{var l;return((l=s.value)==null?void 0:l.sections.find(r=>r.id===o.value))||null}),m=T(()=>{var l,r;return((l=y.value)==null?void 0:l.capturedAt)||((r=s.value)==null?void 0:r.capturedAt)||null}),v=l=>l==="supported"?"border-emerald-300 bg-emerald-50 text-emerald-700":l==="conditional"?"border-amber-300 bg-amber-50 text-amber-700":"border-slate-300 bg-slate-50 text-slate-700";return(l,r)=>{var j,z,q,Y,J;const d=me,R=_e,V=Ce,x=ce,g=Ae,C=Re,O=Le,H=Fe;return f(),_("div",Co,[e("div",Lo,[e("div",Ro,[e("div",Ao,[e("div",Po,[S(d,{name:"hugeicons:database",class:"size-5 text-primary"}),r[4]||(r[4]=e("h2",{class:"text-base font-medium"},"Instance Insights",-1))]),e("div",Bo,[r[5]||(r[5]=M(" connection: ")),e("div",Eo,[l.dbType?(f(),W(Te((j=t(Ve)(l.dbType))==null?void 0:j.icon),{key:0,class:"size-4!"})):N("",!0),e("span",Mo,a(l.databaseName),1)])]),(z=t(s))!=null&&z.version?(f(),_("div",No,[S(R,{variant:"outline",class:"text-xxs h-5 px-1.5 font-normal"},{default:E(()=>[M(a(l.dbType===t(ue).MARIADB?"MariaDB":l.dbType===t(ue).ORACLE?"Oracle":l.dbType===t(ue).SQLITE3?"SQLite":"MySQL")+" "+a(t(s).version),1)]),_:1})])):N("",!0)]),(Y=(q=t(s))==null?void 0:q.actions)!=null&&Y.length?(f(),_("div",Oo,[(f(!0),_(D,null,F(t(s).actions,B=>(f(),W(R,{key:B.id,class:oe(v(B.state)),variant:"outline"},{default:E(()=>[M(a(B.label)+" · "+a(B.state),1)]),_:2},1032,["class"]))),128))])):N("",!0)]),e("div",Do,[e("div",Fo,[S(V,{id:"insights-auto-refresh","model-value":t(h),"onUpdate:modelValue":r[0]||(r[0]=B=>le(h)?h.value=B:null),class:"cursor-pointer"},null,8,["model-value"]),r[6]||(r[6]=e("label",{for:"insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),S(x,{variant:"outline",size:"sm",disabled:t(b)||t(u),class:"font-normal",onClick:r[1]||(r[1]=B=>t(w)())},{default:E(()=>[S(d,{name:"hugeicons:redo",class:"size-4"}),r[7]||(r[7]=M(" Refresh All "))]),_:1},8,["disabled"])])]),e("div",Ho,[S(O,{modelValue:t(o),"onUpdate:modelValue":r[2]||(r[2]=B=>le(o)?o.value=B:null),class:"gap-0 flex-1 min-w-0"},{default:E(()=>[S(C,{class:"h-8 max-w-full overflow-x-auto justify-start!"},{default:E(()=>{var B;return[(f(!0),_(D,null,F(((B=t(s))==null?void 0:B.sections)||[],A=>(f(),W(g,{key:A.id,value:A.id,class:"text-xs px-1.5 rounded-sm cursor-pointer min-w-fit shrink-0",onClick:G=>t(k)(A.id,{silent:!0})},{default:E(()=>[M(a(A.title),1)]),_:2},1032,["value","onClick"]))),128))]}),_:1})]),_:1},8,["modelValue"]),e("div",Vo," Last updated: "+a(t(ve)(t(m))),1)]),(J=t(y))!=null&&J.searchable?(f(),_("div",zo,[e("div",jo,[S(d,{name:"hugeicons:search-01",class:"size-4 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),S(H,{modelValue:t(p),"onUpdate:modelValue":r[3]||(r[3]=B=>le(p)?p.value=B:null),type:"text",placeholder:t(y).searchPlaceholder||"Search...",class:"h-8 w-full pl-8 pr-3"},null,8,["modelValue","placeholder"])])])):N("",!0),t($)?(f(),_("div",Ko,a(t($)),1)):N("",!0),t(b)&&!t(s)?(f(),_("div",Uo,[S(d,{name:"hugeicons:redo",class:"size-4 animate-spin"}),r[8]||(r[8]=M(" Loading instance insights... "))])):(f(),_("div",Go,[S(wo,{section:t(y),search:t(p)},null,8,["section","search"])]))])}}}),Qo={class:"space-y-4"},Xo={class:"grid gap-3 md:grid-cols-2"},Wo={class:"rounded-lg border p-3"},Yo={class:"mt-1 text-lg font-medium"},Jo={class:"rounded-lg border p-3"},Zo={class:"mt-1 text-lg font-medium"},ea={key:0,class:"rounded-lg border p-3"},ta={class:"mt-3 space-y-2 text-xs"},sa={class:"rounded-lg border p-3"},na={class:"mt-3 space-y-2 text-xs"},oa={class:"flex items-start justify-between gap-3"},aa={class:"font-medium"},ia={class:"text-muted-foreground"},ra={class:"text-muted-foreground"},la=U({__name:"RedisClientsSection",props:{clients:{},isActionLoading:{type:Boolean}},emits:["kill-client"],setup(n,{emit:i}){const c=i,s=new Intl.NumberFormat;function o(h){return h==null||h===""?"0":s.format(Number(h))}return(h,p)=>{var b,u,k,w,y;const $=ce;return f(),_("div",Qo,[e("div",Xo,[e("div",Wo,[p[0]||(p[0]=e("p",{class:"text-xs text-muted-foreground"},"Connected clients",-1)),e("p",Yo,a(o((b=h.clients)==null?void 0:b.connectedClients)),1)]),e("div",Jo,[p[1]||(p[1]=e("p",{class:"text-xs text-muted-foreground"},"Suspicious clients",-1)),e("p",Zo,a(o((((u=h.clients)==null?void 0:u.suspiciousClients)||[]).length)),1)])]),(((k=h.clients)==null?void 0:k.suspiciousClients)||[]).length?(f(),_("div",ea,[p[2]||(p[2]=e("h3",{class:"text-sm font-medium"},"Suspicious clients",-1)),e("div",ta,[(f(!0),_(D,null,F(((w=h.clients)==null?void 0:w.suspiciousClients)||[],m=>(f(),_("div",{key:`${m.clientId}-${m.reason}`,class:"rounded-md bg-muted/20 px-3 py-2"},a(m.reason),1))),128))])])):N("",!0),e("div",sa,[p[4]||(p[4]=e("h3",{class:"text-sm font-medium"},"Client list",-1)),e("div",na,[(f(!0),_(D,null,F(((y=h.clients)==null?void 0:y.clients)||[],m=>(f(),_("div",{key:m.id,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",oa,[e("div",null,[e("p",aa,a(m.addr),1),e("p",ia,a(m.name)+" · db "+a(m.db)+" · "+a(m.cmd),1),e("p",ra," age "+a(o(m.ageSeconds))+"s · idle "+a(o(m.idleSeconds))+"s ",1)]),S($,{size:"sm",variant:"outline",disabled:h.isActionLoading,onClick:v=>c("kill-client",m.id)},{default:E(()=>p[3]||(p[3]=[M(" Kill client ")])),_:2},1032,["disabled","onClick"])])]))),128))])])])}}}),da={class:"space-y-2"},ua={class:"text-muted-foreground"},ca=U({__name:"RedisConfigSection",props:{config:{}},setup(n){return(i,c)=>(f(),_("div",da,[(f(!0),_(D,null,F(i.config||[],s=>(f(),_("div",{key:s.name,class:"flex items-center justify-between rounded-md border px-3 py-2 text-sm"},[e("span",null,a(s.name),1),e("span",ua,a(s.value||"not set"),1)]))),128))]))}}),ma={class:"space-y-4"},pa={class:"grid gap-3 md:grid-cols-4"},fa={class:"rounded-lg border p-3"},ga={class:"mt-1 text-lg font-medium"},va={class:"rounded-lg border p-3"},ba={class:"mt-1 text-lg font-medium"},_a={class:"rounded-lg border p-3"},ha={class:"mt-1 text-lg font-medium"},ya={class:"rounded-lg border p-3"},xa={class:"mt-1 text-lg font-medium"},$a={class:"grid gap-4 lg:grid-cols-2"},Sa={class:"rounded-lg border p-3"},ka={class:"mt-3 space-y-2 text-sm"},wa={class:"text-muted-foreground"},Ia={class:"rounded-lg border p-3"},Ta={class:"mt-3 space-y-2 text-sm"},Ca={class:"text-muted-foreground"},La={class:"rounded-lg border p-3"},Ra={class:"mt-3 flex flex-wrap gap-2"},Aa={class:"mt-3 text-xs text-muted-foreground"},Pa=U({__name:"RedisKeyspaceSection",props:{keyspace:{}},setup(n){const i=new Intl.NumberFormat;function c(s){return s==null||s===""?"0":i.format(Number(s))}return(s,o)=>{var p,$,b,u,k,w,y,m;const h=_e;return f(),_("div",ma,[e("div",pa,[e("div",fa,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Expired key count",-1)),e("p",ga,a(c((p=s.keyspace)==null?void 0:p.expiredKeyCount)),1)]),e("div",va,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Avg TTL",-1)),e("p",ba,a(c(($=s.keyspace)==null?void 0:$.avgTtl)),1)]),e("div",_a,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Keys without TTL",-1)),e("p",ha,a(c((b=s.keyspace)==null?void 0:b.keysWithoutTtl)),1)]),e("div",ya,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Sampled keys",-1)),e("p",xa,a(c((u=s.keyspace)==null?void 0:u.sampledKeys)),1)])]),e("div",$a,[e("div",Sa,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Databases",-1)),e("div",ka,[(f(!0),_(D,null,F(((k=s.keyspace)==null?void 0:k.databases)||[],v=>(f(),_("div",{key:v.database,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(v.database),1),e("span",wa,a(c(v.keyCount))+" keys · "+a(c(v.expires))+" expiring · avg TTL "+a(c(v.avgTtl)),1)]))),128))])]),e("div",Ia,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Top prefixes",-1)),e("div",Ta,[(f(!0),_(D,null,F(((w=s.keyspace)==null?void 0:w.topPrefixes)||[],v=>(f(),_("div",{key:v.prefix,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(v.prefix),1),e("span",Ca,a(c(v.keyCount))+" keys ",1)]))),128))])])]),e("div",La,[o[6]||(o[6]=e("h3",{class:"text-sm font-medium"},"Key type distribution",-1)),e("div",Ra,[(f(!0),_(D,null,F(((y=s.keyspace)==null?void 0:y.keyTypeDistribution)||[],v=>(f(),W(h,{key:v.type,variant:"outline"},{default:E(()=>[M(a(v.type)+" · "+a(c(v.count)),1)]),_:2},1024))),128))]),e("p",Aa,a((m=s.keyspace)==null?void 0:m.hotKeysNote),1)])])}}}),Ba={class:"space-y-4"},Ea={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Ma={class:"rounded-lg border p-3"},Na={class:"mt-1 text-lg font-medium"},Oa={class:"rounded-lg border p-3"},Da={class:"mt-1 text-lg font-medium"},Fa={class:"rounded-lg border p-3"},Ha={class:"mt-1 text-lg font-medium"},Va={class:"rounded-lg border p-3"},za={class:"mt-1 text-lg font-medium"},ja={class:"grid gap-4 lg:grid-cols-2"},Ka={class:"rounded-lg border p-3"},Ua={class:"mt-3 space-y-2 text-sm"},Ga={class:"text-muted-foreground"},qa={class:"rounded-lg border p-3"},Qa={class:"mt-3 space-y-2 text-sm"},Xa={class:"flex items-center justify-between gap-2"},Wa={class:"truncate"},Ya={class:"mt-1 text-xs text-muted-foreground"},Ja=U({__name:"RedisMemorySection",props:{memory:{}},setup(n){const i=new Intl.NumberFormat;function c(s){return s==null||s===""?"0":i.format(Number(s))}return(s,o)=>{var $,b,u,k,w,y,m,v;const h=Pe,p=_e;return f(),_("div",Ba,[e("div",Ea,[e("div",Ma,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Used memory",-1)),e("p",Na,a(($=s.memory)==null?void 0:$.usedMemoryHuman),1)]),e("div",Oa,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Peak memory",-1)),e("p",Da,a((b=s.memory)==null?void 0:b.usedMemoryPeakHuman),1)]),e("div",Fa,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Fragmentation",-1)),e("p",Ha,a((u=s.memory)==null?void 0:u.memoryFragmentationRatio.toFixed(2)),1)]),e("div",Va,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Maxmemory / policy",-1)),e("p",za,a((k=s.memory)==null?void 0:k.maxmemoryHuman)+" · "+a((w=s.memory)==null?void 0:w.maxmemoryPolicy),1)])]),(f(!0),_(D,null,F(((y=s.memory)==null?void 0:y.warnings)||[],l=>(f(),W(h,{key:l,variant:"secondary"},{default:E(()=>[M(a(l),1)]),_:2},1024))),128)),e("div",ja,[e("div",Ka,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Top prefixes by memory",-1)),e("div",Ua,[(f(!0),_(D,null,F(((m=s.memory)==null?void 0:m.topPrefixesByMemory)||[],l=>(f(),_("div",{key:l.prefix,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(l.prefix),1),e("span",Ga,a(c(l.keyCount))+" keys · "+a(c(l.memoryBytes))+" B ",1)]))),128))])]),e("div",qa,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Big keys detector",-1)),e("div",Qa,[(f(!0),_(D,null,F(((v=s.memory)==null?void 0:v.bigKeys)||[],l=>(f(),_("div",{key:l.key,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",Xa,[e("span",Wa,a(l.key),1),S(p,{variant:"outline"},{default:E(()=>[M(a(l.type),1)]),_:2},1024)]),e("p",Ya," TTL "+a(l.ttl>=0?l.ttl:"persisted")+" · "+a(c(l.memoryBytes))+" B ",1)]))),128))])])])])}}}),Za={class:"space-y-4"},ei={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},ti={class:"text-xs text-muted-foreground"},si={class:"mt-1 text-lg font-medium"},ni=U({__name:"RedisOverviewSection",props:{overview:{}},setup(n){const i=n,c=new Intl.NumberFormat;function s(p){return p==null||p===""?"0":c.format(Number(p))}function o(p){return`${(p*100).toFixed(1)}%`}const h=T(()=>{const p=i.overview;return p?[{label:"Redis version",value:p.redisVersion},{label:"Mode",value:p.mode},{label:"Uptime",value:qe(p.uptimeSeconds)},{label:"Connected clients",value:s(p.connectedClients)},{label:"Used memory",value:p.usedMemoryHuman},{label:"Total keys",value:s(p.totalKeys)},{label:"Hit rate",value:o(p.hitRate)},{label:"Ops/sec",value:s(p.opsPerSec)},{label:"Evicted keys",value:s(p.evictedKeys)},{label:"Expired keys",value:s(p.expiredKeys)},{label:"Rejected connections",value:s(p.rejectedConnections)}]:[]});return(p,$)=>(f(),_("div",Za,[e("div",ei,[(f(!0),_(D,null,F(t(h),b=>(f(),_("div",{key:b.label,class:"rounded-lg border p-3"},[e("p",ti,a(b.label),1),e("p",si,a(b.value),1)]))),128))])]))}}),oi={class:"space-y-4"},ai={class:"grid gap-3 md:grid-cols-3"},ii={class:"rounded-lg border p-3"},ri={class:"mt-1 text-lg font-medium"},li={class:"rounded-lg border p-3"},di={class:"mt-1 text-lg font-medium"},ui={class:"rounded-lg border p-3"},ci={class:"mt-1 text-lg font-medium"},mi={class:"rounded-lg border p-3"},pi={class:"mt-3 whitespace-pre-wrap text-xs text-muted-foreground"},fi={class:"grid gap-4 lg:grid-cols-2"},gi={class:"rounded-lg border p-3"},vi={class:"mt-3 space-y-2 text-xs"},bi={class:"flex items-center justify-between gap-2"},_i={class:"font-medium"},hi={class:"mt-1 text-muted-foreground"},yi={class:"rounded-lg border p-3"},xi={class:"mt-3 space-y-2 text-xs"},$i={class:"text-muted-foreground"},Si={class:"rounded-lg border p-3"},ki={class:"mt-3 space-y-2 text-xs"},wi={key:0,class:"text-muted-foreground"},Ii={class:"text-muted-foreground"},Ti=U({__name:"RedisPerformanceSection",props:{performance:{}},setup(n){const i=new Intl.NumberFormat;function c(s){return s==null||s===""?"0":i.format(Number(s))}return(s,o)=>{var h,p,$,b,u,k,w,y;return f(),_("div",oi,[e("div",ai,[e("div",ii,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Ops/sec",-1)),e("p",ri,a(c((h=s.performance)==null?void 0:h.instantaneousOpsPerSec)),1)]),e("div",li,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Total commands",-1)),e("p",di,a(c((p=s.performance)==null?void 0:p.totalCommandsProcessed)),1)]),e("div",ui,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Blocked clients",-1)),e("p",ci,a(c(($=s.performance)==null?void 0:$.blockedClients)),1)])]),e("div",mi,[o[3]||(o[3]=e("h3",{class:"text-sm font-medium"},"Latency doctor",-1)),e("pre",pi,a(((b=s.performance)==null?void 0:b.latencyDoctor)||"No latency doctor output available."),1)]),e("div",fi,[e("div",gi,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Slowlog",-1)),e("div",vi,[(f(!0),_(D,null,F(((u=s.performance)==null?void 0:u.slowlog)||[],m=>(f(),_("div",{key:m.id,class:"rounded-md bg-muted/20 px-3 py-2"},[e("div",bi,[e("span",_i,a(m.command||"unknown command"),1),e("span",null,a(c(m.durationMicros))+" µs",1)]),e("p",hi,a(m.clientAddr||"n/a")+" · "+a(m.timestamp||"unknown time"),1)]))),128))])]),e("div",yi,[o[5]||(o[5]=e("h3",{class:"text-sm font-medium"},"Command stats",-1)),e("div",xi,[(f(!0),_(D,null,F(((k=s.performance)==null?void 0:k.commandStats)||[],m=>(f(),_("div",{key:m.command,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(m.command),1),e("span",$i,a(c(m.calls))+" calls · "+a(m.usecPerCall.toFixed(2))+" µs/call ",1)]))),128))])])]),e("div",Si,[o[6]||(o[6]=e("h3",{class:"text-sm font-medium"},"Long-running Lua scripts",-1)),e("div",ki,[(((w=s.performance)==null?void 0:w.longRunningLuaScripts)||[]).length?N("",!0):(f(),_("div",wi," No active Lua script clients detected. ")),(f(!0),_(D,null,F(((y=s.performance)==null?void 0:y.longRunningLuaScripts)||[],m=>(f(),_("div",{key:m.id,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(m.addr),1),e("span",Ii,a(m.cmd)+" · age "+a(c(m.ageSeconds))+"s ",1)]))),128))])])])}}}),Ci={class:"space-y-4"},Li={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},Ri={class:"rounded-lg border p-3"},Ai={class:"mt-1 text-lg font-medium"},Pi={class:"rounded-lg border p-3"},Bi={class:"mt-1 text-lg font-medium"},Ei={class:"rounded-lg border p-3"},Mi={class:"mt-1 text-lg font-medium"},Ni={class:"rounded-lg border p-3"},Oi={class:"mt-1 text-lg font-medium"},Di={class:"rounded-lg border p-3 text-sm text-muted-foreground space-y-1"},Fi={key:0},Hi=U({__name:"RedisPersistenceSection",props:{persistence:{}},setup(n){const i=new Intl.NumberFormat;function c(s){return s==null||s===""?"0":i.format(Number(s))}return(s,o)=>{var p,$,b,u,k,w,y,m,v;const h=Pe;return f(),_("div",Ci,[e("div",Li,[e("div",Ri,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"RDB enabled",-1)),e("p",Ai,a((p=s.persistence)!=null&&p.rdbEnabled?"Yes":"No"),1)]),e("div",Pi,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"AOF enabled",-1)),e("p",Bi,a(($=s.persistence)!=null&&$.aofEnabled?"Yes":"No"),1)]),e("div",Ei,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"AOF rewrite",-1)),e("p",Mi,a((b=s.persistence)!=null&&b.aofRewriteInProgress?"In progress":"Idle"),1)]),e("div",Ni,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Changes since save",-1)),e("p",Oi,a(c((u=s.persistence)==null?void 0:u.changesSinceLastSave)),1)])]),(f(!0),_(D,null,F(((k=s.persistence)==null?void 0:k.warnings)||[],l=>(f(),W(h,{key:l,variant:"secondary"},{default:E(()=>[M(a(l),1)]),_:2},1024))),128)),e("div",Di,[e("p",null," Last save status: "+a(((w=s.persistence)==null?void 0:w.lastSaveStatus)||"unknown"),1),e("p",null," Last save time: "+a(((y=s.persistence)==null?void 0:y.lastSaveTime)||"unknown"),1),e("p",null," AOF last rewrite status: "+a(((m=s.persistence)==null?void 0:m.aofLastRewriteStatus)||"unknown"),1),(v=s.persistence)!=null&&v.lastBgsaveError?(f(),_("p",Fi," Last bgsave error: "+a(s.persistence.lastBgsaveError),1)):N("",!0)])])}}}),Vi={class:"space-y-4"},zi={class:"grid gap-3 md:grid-cols-2 xl:grid-cols-4"},ji={class:"rounded-lg border p-3"},Ki={class:"mt-1 text-lg font-medium"},Ui={class:"rounded-lg border p-3"},Gi={class:"mt-1 text-lg font-medium"},qi={class:"rounded-lg border p-3"},Qi={class:"mt-1 text-lg font-medium"},Xi={class:"rounded-lg border p-3"},Wi={class:"mt-1 text-lg font-medium"},Yi={class:"rounded-lg border p-3 text-sm text-muted-foreground space-y-1"},Ji={class:"rounded-lg border p-3"},Zi={class:"mt-3 space-y-2 text-xs"},er={key:0,class:"text-muted-foreground"},tr={class:"text-muted-foreground"},sr=U({__name:"RedisReplicationSection",props:{replication:{}},setup(n){const i=new Intl.NumberFormat;function c(s){return s==null||s===""?"0":i.format(Number(s))}return(s,o)=>{var h,p,$,b,u,k,w,y,m,v,l;return f(),_("div",Vi,[e("div",zi,[e("div",ji,[o[0]||(o[0]=e("p",{class:"text-xs text-muted-foreground"},"Role",-1)),e("p",Ki,a(((h=s.replication)==null?void 0:h.role)||"unknown"),1)]),e("div",Ui,[o[1]||(o[1]=e("p",{class:"text-xs text-muted-foreground"},"Connected replicas",-1)),e("p",Gi,a(c((p=s.replication)==null?void 0:p.connectedReplicas)),1)]),e("div",qi,[o[2]||(o[2]=e("p",{class:"text-xs text-muted-foreground"},"Master link status",-1)),e("p",Qi,a((($=s.replication)==null?void 0:$.masterLinkStatus)||"n/a"),1)]),e("div",Xi,[o[3]||(o[3]=e("p",{class:"text-xs text-muted-foreground"},"Cluster state",-1)),e("p",Wi,a(((b=s.replication)==null?void 0:b.clusterState)||((u=s.replication)!=null&&u.clusterEnabled?"enabled":"disabled")),1)])]),e("div",Yi,[e("p",null,"Replication lag: "+a(((k=s.replication)==null?void 0:k.replicationLag)??"n/a"),1),e("p",null,"Sentinel masters: "+a(((w=s.replication)==null?void 0:w.sentinelMasters)??"n/a"),1),e("p",null," Cluster slots assigned: "+a(((y=s.replication)==null?void 0:y.clusterSlotsAssigned)??"n/a"),1),e("p",null,"Cluster known nodes: "+a(((m=s.replication)==null?void 0:m.clusterKnownNodes)??"n/a"),1)]),e("div",Ji,[o[4]||(o[4]=e("h3",{class:"text-sm font-medium"},"Replicas",-1)),e("div",Zi,[(((v=s.replication)==null?void 0:v.replicas)||[]).length?N("",!0):(f(),_("div",er," No replica nodes reported. ")),(f(!0),_(D,null,F(((l=s.replication)==null?void 0:l.replicas)||[],r=>(f(),_("div",{key:r.id,class:"flex items-center justify-between rounded-md bg-muted/20 px-3 py-2"},[e("span",null,a(r.addr),1),e("span",tr,a(r.state)+" · lag "+a(r.lag??"n/a"),1)]))),128))])])])}}}),nr=5e3;function or(n){const i=L("overview"),c=L(!0),s=L(null),o=L(!1),h=L(!1),p=L(!1),$=L(null),b=L(!0),u=T(()=>!!n.connection.value);ke(()=>{b.value=!1}),we(()=>{b.value=!0});const k=async(l=!1)=>{var r;if(!n.connection.value)return $.value=null,null;l||(h.value=!0);try{s.value=null;const d=await $fetch("/api/redis/instance-insights/overview",{method:"POST",body:{...ne(n.connection.value),method:n.connection.value.method,databaseIndex:n.databaseIndex.value}});return $.value=d,d}catch(d){return s.value=((r=d==null?void 0:d.data)==null?void 0:r.message)||(d==null?void 0:d.message)||(d==null?void 0:d.statusMessage)||"Failed to fetch Redis instance insights.",null}finally{l||(h.value=!1)}},w=async l=>{var r;if(!n.connection.value)return!1;p.value=!0;try{const d=await $fetch("/api/redis/instance-insights/kill-client",{method:"POST",body:{...ne(n.connection.value),method:n.connection.value.method,databaseIndex:n.databaseIndex.value,clientId:l}});return d.success?(fe("Redis client terminated",{description:d.message}),await k(!0),!0):(fe("Failed to terminate client",{description:d.message}),!1)}catch(d){return fe("Failed to terminate client",{description:((r=d==null?void 0:d.data)==null?void 0:r.message)||(d==null?void 0:d.message)||"The Redis client could not be terminated."}),!1}finally{p.value=!1}},y=async()=>{await k()};re([()=>n.connection.value,()=>n.databaseIndex.value],async([l])=>{if(!l){$.value=null;return}o.value=!0,await k(),o.value=!1},{immediate:!0});const{pause:m,resume:v}=Ie(async()=>{!u.value||!b.value||await k(!0)},nr,{immediate:!1});return re(()=>c.value,l=>{l?v():m()},{immediate:!0}),{activeSection:i,autoRefresh:c,error:s,isInitialLoading:o,isLoading:h,isActionLoading:p,insights:$,refresh:y,killClient:w}}const ar={class:"flex h-full flex-col gap-3 overflow-hidden p-3"},ir={class:"flex items-center gap-2 text-xs"},rr={key:1,class:"flex flex-1 items-center justify-center gap-2 rounded-lg border bg-background text-muted-foreground"},lr={key:2,class:"flex-1 overflow-y-auto rounded-lg border bg-background p-3 mt-2"},dr=U({__name:"RedisInstanceInsightsPanel",props:{databaseName:{},databaseIndex:{},databases:{},dbType:{}},emits:["update:databaseIndex"],setup(n,{emit:i}){const c=n,s=i,o=[{id:"overview",label:"Overview"},{id:"keyspace",label:"Keyspace"},{id:"memory",label:"Memory"},{id:"performance",label:"Performance"},{id:"clients",label:"Clients"},{id:"persistence",label:"Persistence"},{id:"replication",label:"Replication / Cluster"},{id:"config",label:"Config"}],h=he(),p=T(()=>h.selectedConnection),{activeSection:$,autoRefresh:b,error:u,isInitialLoading:k,isLoading:w,isActionLoading:y,insights:m,refresh:v,killClient:l}=or({connection:p,databaseIndex:T(()=>c.databaseIndex)});return(r,d)=>{const R=Ce,V=me,x=ce,g=wt,C=Ae,O=Re,H=Pe,j=Le;return f(),_("div",ar,[S(g,{icon:"hugeicons:activity-02",title:"Instance Insights"},{context:E(()=>[r.dbType===t(ue).REDIS?(f(),W(Te("hugeicons:database-sync-01"),{key:0})):N("",!0)]),actions:E(()=>[S(It,{compact:"","trigger-id":"redis-instance-insights-db-index","trigger-class":"bg-background",databases:r.databases,"database-index":r.databaseIndex,"onUpdate:databaseIndex":d[0]||(d[0]=z=>s("update:databaseIndex",z))},null,8,["databases","database-index"]),e("div",ir,[S(R,{id:"redis-insights-auto-refresh","model-value":t(b),"onUpdate:modelValue":d[1]||(d[1]=z=>le(b)?b.value=z:null)},null,8,["model-value"]),d[3]||(d[3]=e("label",{for:"redis-insights-auto-refresh",class:"cursor-pointer"}," Auto refresh ",-1))]),S(x,{size:"xxs",variant:"outline",disabled:t(w)||t(y),onClick:t(v)},{default:E(()=>[S(V,{name:"hugeicons:redo",class:"size-3.5!"}),d[4]||(d[4]=M(" Refresh "))]),_:1},8,["disabled","onClick"])]),_:1}),S(j,{modelValue:t($),"onUpdate:modelValue":d[2]||(d[2]=z=>le($)?$.value=z:null),class:"flex flex-1 min-h-0 flex-col gap-0"},{default:E(()=>{var z,q,Y,J,B,A,G,Z;return[S(O,{class:"h-8 max-w-full justify-start! shrink-0 overflow-x-auto"},{default:E(()=>[(f(),_(D,null,F(o,ae=>S(C,{key:ae.id,value:ae.id,class:"min-w-fit shrink-0 cursor-pointer rounded-sm px-1.5 text-xs"},{default:E(()=>[M(a(ae.label),1)]),_:2},1032,["value"])),64))]),_:1}),t(u)?(f(),W(H,{key:0,variant:"destructive"},{default:E(()=>[M(a(t(u)),1)]),_:1})):N("",!0),t(k)&&!t(m)?(f(),_("div",rr,[S(V,{name:"hugeicons:redo",class:"size-4 animate-spin"}),d[5]||(d[5]=M(" Loading Redis instance insights... "))])):(f(),_("div",lr,[te(S(ni,{overview:(z=t(m))==null?void 0:z.overview},null,8,["overview"]),[[se,t($)==="overview"]]),te(S(Pa,{keyspace:(q=t(m))==null?void 0:q.keyspace},null,8,["keyspace"]),[[se,t($)==="keyspace"]]),te(S(Ja,{memory:(Y=t(m))==null?void 0:Y.memory},null,8,["memory"]),[[se,t($)==="memory"]]),te(S(Ti,{performance:(J=t(m))==null?void 0:J.performance},null,8,["performance"]),[[se,t($)==="performance"]]),te(S(la,{clients:(B=t(m))==null?void 0:B.clients,"is-action-loading":t(y),onKillClient:t(l)},null,8,["clients","is-action-loading","onKillClient"]),[[se,t($)==="clients"]]),te(S(Hi,{persistence:(A=t(m))==null?void 0:A.persistence},null,8,["persistence"]),[[se,t($)==="persistence"]]),te(S(sr,{replication:(G=t(m))==null?void 0:G.replication},null,8,["replication"]),[[se,t($)==="replication"]]),te(S(ca,{config:(Z=t(m))==null?void 0:Z.config},null,8,["config"]),[[se,t($)==="config"]])]))]}),_:1},8,["modelValue"])])}}}),ur={class:"h-full"},cr={key:0,class:"h-full p-4 flex flex-col items-center justify-center text-muted-foreground"},wr=U({__name:"index",setup(n){const i=We(),c=he(),s=Ye(),{activeTab:o}=He(s),h=T(()=>String(i.params.connectionId||"")),p=T(()=>h.value?c.connections.find(y=>y.id===h.value):null),$=T(()=>{var y;return((y=p.value)==null?void 0:y.connectionString)||""}),b=T(()=>{var y;return(y=p.value)==null?void 0:y.type}),u=T(()=>{var y,m,v;return b.value===ue.REDIS?((y=p.value)==null?void 0:y.name)||"Redis":((m=p.value)==null?void 0:m.database)||((v=p.value)==null?void 0:v.name)||"database"}),k=T(()=>b.value===ue.REDIS?p.value??void 0:void 0),w=Tt({connection:k,mode:"meta"});return re(()=>{var y,m;return(m=(y=o.value)==null?void 0:y.metadata)==null?void 0:m.databaseIndex},y=>{typeof y=="number"&&(w.selectedDatabaseIndex.value=y)},{immediate:!0}),(y,m)=>{const v=me;return f(),_("div",ur,[t(p)?t(b)===t(ue).REDIS?(f(),W(dr,{key:1,"database-name":t(u),"database-index":t(w).selectedDatabaseIndex.value,databases:t(w).databases.value,"db-type":t(b),"onUpdate:databaseIndex":m[0]||(m[0]=l=>t(w).selectedDatabaseIndex.value=l)},null,8,["database-name","database-index","databases","db-type"])):t(b)===t(ue).POSTGRES?(f(),W(eo,{key:2,"db-connection-string":t($),"database-name":t(u),"db-type":t(b)},null,8,["db-connection-string","database-name","db-type"])):(f(),W(qo,{key:3,"db-connection-string":t($),"database-name":t(u),"db-type":t(b)},null,8,["db-connection-string","database-name","db-type"])):(f(),_("div",cr,[S(v,{name:"hugeicons:plug-socket",class:"size-12 mb-2 opacity-50"}),m[1]||(m[1]=e("p",{class:"text-sm"},"Select a connection to open Instance Insights",-1))]))])}}});export{wr as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as eo,a as to,b as no}from"./
|
|
1
|
+
import{_ as eo,a as to,b as no}from"./DX8ecA59.js";import{eV as vn,a6 as Me,eW as he,a5 as ha,eX as ba,ci as xt,a3 as Ke,eY as ao,c as F,eZ as gn,d as re,ch as oo,J as Xe,e as L,o as T,m as S,l as X,F as pe,s as _e,k as ee,aY as De,w as d,f as l,a0 as xe,g as o,A as me,a_ as Ee,t as G,a$ as Ae,eg as yn,q as ut,df as hn,r as J,au as Te,bk as Ne,aZ as Ge,n as ge,L as so,bL as Rt,D as yt,ay as He,aP as Le,bZ as Fe,dq as lo,dh as ro,cq as io,av as co,e_ as uo,e$ as fo,z,az as wa,cb as an,bp as zn,u as Ut,a as xa,dT as po,bD as Pe,am as Ce,b as _a,_ as bn,i as Ie,h as wn,j as xn,v as Vn,x as _n,y as Sa,C as mo,B as Sn,ba as zt,al as Vt,bY as on,bW as Ta,bo as Tn,a2 as Je,dg as _t,dL as ft,ap as Z,b2 as jn,aq as We,eU as vo,f0 as et,aG as sn,aH as Bn,f1 as qn,f2 as qe,N as Cn,O as In,Q as Dn,R as En,S as An,T as kn,U as $n,V as Ca,P as Ia,G as Re,K as Oe,aB as Mt,c9 as go,aI as Ct,aC as It,a1 as yo,W as ho,X as bo,Y as wo,Z as xo,bn as _o,bS as So,bE as Da,bF as Ea,bG as Aa,dc as To,$ as Co,f3 as Io,aK as Rn,dZ as Do,H as Ot,a4 as Eo,a7 as Ao,ek as ko,dW as $o,el as Ro,em as Oo,en as Gn,eo as No,f4 as Lo,d8 as Po,f5 as Mo,f6 as Fo,ef as Uo,bQ as zo,f7 as ka,f8 as Vo,f9 as jo,fa as Bo,fb as ln,eq as Nt,ah as vt,fc as qo,a8 as $a,ai as Go,af as Ho,ag as Ko,fd as Wo,b9 as Qo,aM as Dt}from"./D0lW43G8.js";import{i as Yo,g as rn,a as Gt}from"./Chx1IK9D.js";import{_ as Xo}from"./CfseWBL0.js";import{b as jt,C as W,_ as Zo,a as Jo,c as es,d as ts,e as ns,g as Ht}from"./DVkCRFXi.js";import{b as as,c as os,d as ss,e as ls,f as rs}from"./COAycMg4.js";import{_ as is}from"./CLQzuV82.js";import{u as Ra,_ as Oa}from"./BCAMWuzu.js";import{g as Kt}from"./DfyynWBR.js";import{u as cs}from"./Ch0I4juX.js";import{_ as us}from"./BKFPmrcv.js";import{_ as ds}from"./Db3rTgnd.js";import{a as fs,b as ps,c as ms,d as vs,e as gs}from"./CHMlsxJw.js";import{R as Ze,u as Na,_ as ys}from"./VNOocds9.js";import{u as hs}from"./DJXB1Li8.js";import{_ as bs,a as ws,b as xs}from"./CRqiHVA4.js";import{_ as _s,j as Ss,k as Ts}from"./Dunt8-TF.js";import{_ as Wt}from"./CkjXKCQH.js";import{_ as Qt}from"./C-I81xfB.js";import"./C-Pa1rIR.js";import"./BMLhg7hE.js";import"./CS5akSNT.js";import"./Czr647QE.js";/**
|
|
2
2
|
* @license lucide-vue-next v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|