p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
3 lines • 92.6 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/i18n.store-DddRY7Ub.js","assets/chunk-62oNxeRG.js","assets/preload-helper-Cw3XWEoE.js"])))=>i.map(i=>d[i]);
import{i as e,t}from"./chunk-62oNxeRG.js";import{$ as n,O as r,b as i,t as a}from"./Box-BaSrhk2N.js";import{n as o,o as s}from"./i18n.store-DddRY7Ub.js";import{l as c,r as l}from"./KeyboardArrowDown-DRnBl6aB.js";import{n as u,t as d}from"./useMediaQuery-Ow4vREJD.js";import{c as f,n as p,s as m,t as h}from"./TextField-CqJ7jHNF.js";import{a as g,c as _,d as v,f as y,g as b,h as x,i as S,l as C,m as w,n as T,o as E,p as D,r as ee,s as O,t as k,u as A}from"./esm-BHS_Z9K8.js";import{i as j,n as M,r as te,t as N}from"./Delete-CP6_9peX.js";import{t as P}from"./Divider-BKbyRhME.js";import{t as F}from"./List-1xudU9gc.js";import{t as I}from"./ListItem-BTuo1Zbk.js";import{t as L}from"./preload-helper-Cw3XWEoE.js";import{a as R,i as z,r as B}from"./main-command.store-igXkbxKx.js";import{i as V,n as H,r as U,t as ne}from"./Save-VGmu59Jp.js";import{t as re}from"./Download-DYe5WdYz.js";import{i as ie,n as ae,r as oe,t as W}from"./SkipPrevious-DQqgpwJ1.js";import{t as se}from"./Refresh-ZqRU9xtj.js";import{i as G,r as K}from"./redis-state.store-BAzm-x3w.js";import{r as q}from"./common.store-CndSqFlu.js";import{t as ce}from"./overlay.store-BfandeAM.js";import{r as J}from"./socket.service-5KD-6c7U.js";import{E as le,T as ue,_ as de,a as fe,b as pe,f as me,g as he,i as ge,p as _e,r as Y,u as ve,v as ye,x as be}from"./index-B1JaIwjF.js";import{t as xe}from"./redis-version-wablgnRn.js";/* empty css */import{t as Se}from"./P3xrAccordion-RAwQBOM-.js";var X=n(),Ce=i((0,X.jsx)(`path`,{d:`M4 9h4v11H4zm12 4h4v7h-4zm-6-9h4v16h-4z`}),`BarChart`),we=i((0,X.jsx)(`path`,{d:`M15 4v2h3v12h-3v2h5V4zM4 20h5v-2H6V6h3V4H4z`}),`DataArray`),Z=i((0,X.jsx)(`path`,{d:`M17.81 4.47c-.08 0-.16-.02-.23-.06C15.66 3.42 14 3 12.01 3c-1.98 0-3.86.47-5.57 1.41-.24.13-.54.04-.68-.2-.13-.24-.04-.55.2-.68C7.82 2.52 9.86 2 12.01 2c2.13 0 3.99.47 6.03 1.52.25.13.34.43.21.67-.09.18-.26.28-.44.28M3.5 9.72c-.1 0-.2-.03-.29-.09-.23-.16-.28-.47-.12-.7.99-1.4 2.25-2.5 3.75-3.27C9.98 4.04 14 4.03 17.15 5.65c1.5.77 2.76 1.86 3.75 3.25.16.22.11.54-.12.7s-.54.11-.7-.12c-.9-1.26-2.04-2.25-3.39-2.94-2.87-1.47-6.54-1.47-9.4.01-1.36.7-2.5 1.7-3.4 2.96-.08.14-.23.21-.39.21m6.25 12.07c-.13 0-.26-.05-.35-.15-.87-.87-1.34-1.43-2.01-2.64-.69-1.23-1.05-2.73-1.05-4.34 0-2.97 2.54-5.39 5.66-5.39s5.66 2.42 5.66 5.39c0 .28-.22.5-.5.5s-.5-.22-.5-.5c0-2.42-2.09-4.39-4.66-4.39s-4.66 1.97-4.66 4.39c0 1.44.32 2.77.93 3.85.64 1.15 1.08 1.64 1.85 2.42.19.2.19.51 0 .71-.11.1-.24.15-.37.15m7.17-1.85c-1.19 0-2.24-.3-3.1-.89-1.49-1.01-2.38-2.65-2.38-4.39 0-.28.22-.5.5-.5s.5.22.5.5c0 1.41.72 2.74 1.94 3.56.71.48 1.54.71 2.54.71.24 0 .64-.03 1.04-.1.27-.05.53.13.58.41.05.27-.13.53-.41.58-.57.11-1.07.12-1.21.12M14.91 22c-.04 0-.09-.01-.13-.02-1.59-.44-2.63-1.03-3.72-2.1-1.4-1.39-2.17-3.24-2.17-5.22 0-1.62 1.38-2.94 3.08-2.94s3.08 1.32 3.08 2.94c0 1.07.93 1.94 2.08 1.94s2.08-.87 2.08-1.94c0-3.77-3.25-6.83-7.25-6.83-2.84 0-5.44 1.58-6.61 4.03-.39.81-.59 1.76-.59 2.8 0 .78.07 2.01.67 3.61.1.26-.03.55-.29.64-.26.1-.55-.04-.64-.29-.49-1.31-.73-2.61-.73-3.96 0-1.2.23-2.29.68-3.24 1.33-2.79 4.28-4.6 7.51-4.6 4.55 0 8.25 3.51 8.25 7.83 0 1.62-1.38 2.94-3.08 2.94s-3.08-1.32-3.08-2.94c0-1.07-.93-1.94-2.08-1.94s-2.08.87-2.08 1.94c0 1.71.66 3.31 1.87 4.51.95.94 1.86 1.46 3.27 1.85.27.07.42.35.35.61-.05.23-.26.38-.47.38`}),`Fingerprint`),Te=i((0,X.jsx)(`path`,{d:`M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.5 13.5l2.5 3.01L14.5 12l4.5 6H5z`}),`Image`),Ee=i((0,X.jsx)(`path`,{d:`m20.5 10 .5-2h-4l1-4h-2l-1 4h-4l1-4h-2L9 8H5l-.5 2h4l-1 4h-4L3 16h4l-1 4h2l1-4h4l-1 4h2l1-4h4l.5-2h-4l1-4zm-7 4h-4l1-4h4z`}),`Numbers`),De=i((0,X.jsx)(`path`,{d:`M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61M13 14h-2V8h2z`}),`Timer`),Oe=i((0,X.jsx)(`path`,{d:`M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8`}),`Undo`),ke=i((0,X.jsx)(`path`,{d:`M7.41 18.59 8.83 20 12 16.83 15.17 20l1.41-1.41L12 14zm9.18-13.18L15.17 4 12 7.17 8.83 4 7.41 5.41 12 10z`}),`UnfoldLess`),Ae=i((0,X.jsx)(`path`,{d:`M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15z`}),`UnfoldMore`),Q=e(s()),je=e(E());function Me(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);return t.length<4?{ext:`bin`,mime:`application/octet-stream`}:t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71?{ext:`png`,mime:`image/png`}:t[0]===255&&t[1]===216&&t[2]===255?{ext:`jpg`,mime:`image/jpeg`}:t[0]===71&&t[1]===73&&t[2]===70&&t[3]===56?{ext:`gif`,mime:`image/gif`}:t[0]===66&&t[1]===77?{ext:`bmp`,mime:`image/bmp`}:t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t.length>=12&&t[8]===87&&t[9]===69&&t[10]===66&&t[11]===80?{ext:`webp`,mime:`image/webp`}:t[0]===73&&t[1]===73&&t[2]===42&&t[3]===0||t[0]===77&&t[1]===77&&t[2]===0&&t[3]===42?{ext:`tiff`,mime:`image/tiff`}:t[0]===0&&t[1]===0&&t[2]===1&&t[3]===0?{ext:`ico`,mime:`image/x-icon`}:t[0]===37&&t[1]===80&&t[2]===68&&t[3]===70?{ext:`pdf`,mime:`application/pdf`}:t[0]===80&&t[1]===75&&t[2]===3&&t[3]===4?{ext:`zip`,mime:`application/zip`}:t[0]===31&&t[1]===139?{ext:`gz`,mime:`application/gzip`}:t[0]===66&&t[1]===90&&t[2]===104?{ext:`bz2`,mime:`application/x-bzip2`}:t[0]===253&&t[1]===55&&t[2]===122&&t[3]===88&&t.length>=6&&t[4]===90&&t[5]===0?{ext:`xz`,mime:`application/x-xz`}:t[0]===40&&t[1]===181&&t[2]===47&&t[3]===253?{ext:`zst`,mime:`application/zstd`}:t[0]===4&&t[1]===34&&t[2]===77&&t[3]===24?{ext:`lz4`,mime:`application/x-lz4`}:t[0]===55&&t[1]===122&&t[2]===188&&t[3]===175&&t.length>=6&&t[4]===39&&t[5]===28?{ext:`7z`,mime:`application/x-7z-compressed`}:t[0]===82&&t[1]===97&&t[2]===114&&t[3]===33?{ext:`rar`,mime:`application/x-rar-compressed`}:t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t.length>=12&&t[8]===87&&t[9]===65&&t[10]===86&&t[11]===69?{ext:`wav`,mime:`audio/wav`}:t[0]===82&&t[1]===73&&t[2]===70&&t[3]===70&&t.length>=12&&t[8]===65&&t[9]===86&&t[10]===73&&t[11]===32?{ext:`avi`,mime:`video/x-msvideo`}:t[0]===255&&(t[1]===251||t[1]===243||t[1]===242)||t[0]===73&&t[1]===68&&t[2]===51?{ext:`mp3`,mime:`audio/mpeg`}:t[0]===102&&t[1]===76&&t[2]===97&&t[3]===67?{ext:`flac`,mime:`audio/flac`}:t[0]===79&&t[1]===103&&t[2]===103&&t[3]===83?{ext:`ogg`,mime:`audio/ogg`}:t[0]===26&&t[1]===69&&t[2]===223&&t[3]===163?{ext:`webm`,mime:`video/webm`}:t.length>=8&&t[4]===102&&t[5]===116&&t[6]===121&&t[7]===112?{ext:`mp4`,mime:`video/mp4`}:t[0]===0&&t[1]===97&&t[2]===115&&t[3]===109?{ext:`wasm`,mime:`application/wasm`}:t[0]===127&&t[1]===69&&t[2]===76&&t[3]===70?{ext:`elf`,mime:`application/x-elf`}:t.length>=6&&t[0]===83&&t[1]===81&&t[2]===76&&t[3]===105&&t[4]===116&&t[5]===101?{ext:`sqlite`,mime:`application/x-sqlite3`}:t[0]===56&&t[1]===66&&t[2]===80&&t[3]===83?{ext:`psd`,mime:`image/vnd.adobe.photoshop`}:Ne(t)||{ext:`bin`,mime:`application/octet-stream`}}function Ne(e){let t=e[0];if(t===123||t===91)return{ext:`json`,mime:`application/json`};if(t===60){let t=new TextDecoder(`utf-8`,{fatal:!1}).decode(e.slice(0,Math.min(e.length,256))).toLowerCase();if(t.includes(`<svg`))return{ext:`svg`,mime:`image/svg+xml`};if(t.includes(`<!doctype html`)||t.includes(`<html`))return{ext:`html`,mime:`text/html`};if(t.includes(`<?xml`))return{ext:`xml`,mime:`application/xml`}}if(e[0]===239&&e[1]===187&&e[2]===191){if(e.length>3){if(e[3]===123||e[3]===91)return{ext:`json`,mime:`application/json`};if(e[3]===60)return{ext:`xml`,mime:`application/xml`}}return{ext:`txt`,mime:`text/plain`}}return null}function Pe(e,t=!1){let n=G.getState().keyPageCount??5,r=t?Math.ceil(e/2):e;return{page:1,pages:Math.max(Math.ceil(r/n),1),pageCount:n,startIndex:0,endIndex:n}}function Fe(e,t,n=!1){let r=e.pageCount,i=n?Math.ceil(t/2):t,a=Math.max(Math.ceil(i/r),1),o=e.page;o>a&&(o=a),o<1&&(o=1);let s=r*(o-1),c=s+r;return{page:o,pages:a,pageCount:r,startIndex:s,endIndex:c}}function Ie(e,t){let{page:n,pages:r,pageCount:i}=e;switch(t){case`first`:n=1;break;case`prev`:n>1&&n--;break;case`next`:n<r&&n++;break;case`last`:n=r;break}n<1&&(n=1),n>r&&(n=r);let a=i*(n-1),o=a+i;return{...e,page:n,startIndex:a,endIndex:o}}function Le(e,t){let n=t;n<1&&(n=1),n>e.pages&&(n=e.pages);let r=e.pageCount*(n-1),i=r+e.pageCount;return{...e,page:n,startIndex:r,endIndex:i}}function Re(e,t){if(e==null)return``;let n=String(e);switch(t){case`json`:try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}case`base64`:{let e=new TextEncoder().encode(n),t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}default:return n}}function $(e){let t=G.getState().maxValueDisplay??1024;if(e==null)return``;let n=String(e);return t<=0?n:n.length>t?n.substring(0,t):n}function ze(e){let t=G.getState().maxValueDisplay??1024;return e==null||t<=0?!1:String(e).length>t}async function Be(e){try{await navigator.clipboard.writeText(String(e??``))}catch{}let t=(await L(async()=>{let{useI18nStore:e}=await import(`./i18n.store-DddRY7Ub.js`).then(e=>e.t);return{useI18nStore:e}},__vite__mapDeps([0,1,2]))).useI18nStore.getState().strings;q.getState().toast(t?.status?.dataCopied)}function Ve(e,t,n){let r=e instanceof Uint8Array?e:new Uint8Array(e),{ext:i,mime:a}=Me(r),o=new Blob([r],{type:a}),s=URL.createObjectURL(o),c=document.createElement(`a`);c.href=s,c.download=`${n||t}.${i}`,c.click(),URL.revokeObjectURL(s)}function He(e){if(!e)return[];let t=new TextEncoder().encode(e),n=[];for(let e=0;e<t.length;e+=16){let r=t.slice(e,e+16),i=r.length,a=e.toString(16).padStart(8,`0`),o=new Uint8Array(16);o.set(r);let s=Array.from(o.slice(0,8)).map(e=>e.toString(16).padStart(2,`0`)).join(` `),c=Array.from(o.slice(8)).map(e=>e.toString(16).padStart(2,`0`)).join(` `),l=s+` `+c,u=Array.from(o).map(e=>e>=32&&e<=126?String.fromCharCode(e):`.`).join(``);if(i===16)n.push({addr:a,hexReal:l,hexPad:``,asciiReal:u,asciiPad:``});else{let e=i<=8?3*i-1:25+3*(i-8)-1;n.push({addr:a,hexReal:l.substring(0,e),hexPad:l.substring(e),asciiReal:u.substring(0,i),asciiPad:u.substring(i)})}}return n}var Ue={fontFamily:`'Roboto Mono', monospace`,fontSize:16,lineHeight:`22px`},We={overflow:`hidden`},Ge={display:`flex`,whiteSpace:`nowrap`},Ke={opacity:.5,paddingRight:12,flexShrink:0},qe={paddingRight:12,flexShrink:0,whiteSpace:`pre`},Je={borderLeft:`1px solid var(--p3xr-fieldset-border, rgba(255,255,255,0.25))`,paddingLeft:12,flexShrink:0},Ye={opacity:.5},Xe={overflowX:`auto`,overflowY:`hidden`,position:`sticky`,bottom:0};function Ze({value:e,truncated:t,style:n}){let r=(0,Q.useMemo)(()=>He(e),[e]),i=(0,Q.useRef)(null),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useCallback)(()=>{let e=i.current;e&&s(e.scrollWidth)},[]);(0,Q.useEffect)(()=>{c();let e=i.current;if(!e)return;let t=new ResizeObserver(()=>c());return t.observe(e),()=>t.disconnect()},[e,c]);let l=(0,Q.useCallback)(()=>{i.current&&a.current&&(i.current.scrollLeft=a.current.scrollLeft)},[]);return(0,X.jsxs)(`div`,{style:n?{...Ue,...n}:Ue,children:[(0,X.jsx)(`div`,{ref:i,style:We,children:r.map(e=>(0,X.jsxs)(`div`,{style:Ge,children:[(0,X.jsx)(`span`,{style:Ke,children:e.addr}),(0,X.jsxs)(`span`,{style:qe,children:[e.hexReal,(0,X.jsx)(`span`,{style:Ye,children:e.hexPad})]}),(0,X.jsxs)(`span`,{style:Je,children:[e.asciiReal,(0,X.jsx)(`span`,{style:Ye,children:e.asciiPad})]})]},e.addr))}),(0,X.jsx)(`div`,{ref:a,style:Xe,onScroll:l,children:(0,X.jsx)(`div`,{style:{height:1,width:o}})})]})}function Qe({response:e,value:t,valueBuffer:n,keyName:r,valueFormat:i,onRefresh:s}){let c=o(e=>e.strings),f=K(e=>e.connection),p=G(),{toast:m,generalHandleError:b,confirm:x}=q(),C=ce(),T=d(`(min-width: 960px)`),E=f?.readonly===!0,[O,k]=(0,Q.useState)(!1),[A,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(t),[L,R]=(0,Q.useState)(n),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(!1),[oe,W]=(0,Q.useState)(!1),[se,le]=(0,Q.useState)({oldValue:``,newValue:``}),ue=(0,Q.useRef)(null),de=(0,Q.useCallback)(()=>{typeof F==`string`&&F.length>=p.maxValueAsBuffer?(M(!0),B(structuredClone(L))):(M(!1),B(structuredClone(F))),k(!0)},[F,L,p.maxValueAsBuffer]),pe=(0,Q.useCallback)(()=>{A?R(z):I(z),k(!1),M(!1)},[A,z]),me=(0,Q.useCallback)((e,t)=>!G.getState().showDiffBeforeSave||e===t?Promise.resolve(!0):(le({oldValue:e,newValue:t}),W(!0),new Promise(e=>{ue.current=e})),[]),he=(0,Q.useCallback)(async()=>{let t=A?L:F,n=z;try{if(N&&JSON.parse(t),n!=null&&!await me(n,t))return;if(C.show({message:c?.intention?.save}),await J({action:`key/set`,payload:{type:e?.type,key:r,value:t}}),fe(`/key-set`),k(!1),M(!1),s(),C.hide(),p.undoEnabled&&n!==void 0&&n!==t&&await q.getState().toastWithUndo(c?.status?.saved))try{C.show({message:`Undo...`}),await J({action:`key/set`,payload:{type:e?.type,key:r,value:n}}),I(n),B(n),s(),C.hide(),q.getState().toast(c?.status?.reverted)}catch(e){q.getState().generalHandleError(e),C.hide()}}catch(e){b(e),C.hide()}},[A,F,L,N,e,r,c,s,b,z,p.undoEnabled]),ge=(0,Q.useCallback)(()=>{let t=document.createElement(`input`);t.type=`file`,t.onchange=async()=>{let n=t.files?.[0];if(!n)return;let i=new FileReader;i.onerror=e=>b(e),i.onload=async t=>{let n=t.target.result;try{if(O){await x({message:c?.confirm?.uploadBuffer}),A?R(n):I(n),m(c?.confirm?.uploadBufferDone);return}await x({message:c?.confirm?.uploadBuffer}),C.show(),await J({action:`key/set`,payload:{type:e?.type,value:n,key:r}}),fe(`/key-set`),m(c?.confirm?.uploadBufferDoneAndSave),s()}catch(e){b(e)}finally{C.hide()}},i.readAsArrayBuffer(n)},t.click()},[O,A,e,r,c,x,m,b,s]),_e=(0,Q.useCallback)(()=>H(!0),[]),Y=(0,Q.useCallback)(()=>ae(!0),[]),ve=(0,Q.useCallback)(async()=>{try{let t=JSON.stringify(JSON.parse(F),null,p.jsonFormat||2);I(t),C.show({message:c?.intention?.save}),await J({action:`key/set`,payload:{type:e?.type,key:r,value:t}}),fe(`/key-set`),s()}catch{m(c?.label?.jsonViewNotParsable)}finally{C.hide()}},[F,p.jsonFormat,e,r,c,s]),be=(0,Q.useCallback)(async()=>{try{m((await J({action:`key/string-digest`,payload:{key:r}})).digest||`No digest`)}catch(e){b(e)}},[r,m,b]),Se=(0,Q.useCallback)(()=>Be(F),[F]),Ce=(0,Q.useCallback)(()=>Ve(L,r),[L,r]),we=()=>L?.byteLength===void 0?``:`(`+(p.prettyBytes?.(L.byteLength)??`${L.byteLength} bytes`)+`)`,Z=({icon:e,label:t,color:n=`primary`,onClick:r})=>T?(0,X.jsxs)(u,{variant:`contained`,color:n,size:`small`,onClick:r,sx:{gap:`3px`},children:[e,(0,X.jsx)(`span`,{children:t})]}):(0,X.jsx)(l,{title:t,placement:`top`,children:(0,X.jsx)(u,{variant:`contained`,color:n,onClick:r,sx:{minWidth:40,width:40,height:40,p:0,borderRadius:`4px`},children:e})});return(0,X.jsxs)(a,{children:[!O&&(0,X.jsxs)(a,{className:`p3xr-key-type-actions`,children:[!E&&(0,X.jsx)(Z,{icon:(0,X.jsx)(_,{fontSize:`small`}),label:c?.intention?.setBuffer,onClick:ge}),(0,X.jsx)(Z,{icon:(0,X.jsx)(re,{fontSize:`small`}),label:c?.intention?.downloadBuffer,color:`secondary`,onClick:Ce}),(0,X.jsx)(Z,{icon:(0,X.jsx)(w,{fontSize:`small`}),label:c?.intention?.jsonViewShow,color:`secondary`,onClick:_e}),(0,X.jsx)(Z,{icon:(0,X.jsx)(D,{fontSize:`small`}),label:c?.intention?.copy,color:`secondary`,onClick:Se}),!E&&(0,X.jsx)(Z,{icon:(0,X.jsx)(v,{fontSize:`small`}),label:c?.intention?.formatJson,onClick:ve}),(0,X.jsx)(Z,{icon:(0,X.jsx)(y,{fontSize:`small`}),label:c?.intention?.jsonViewEditor,onClick:Y}),xe(K.getState().info?.server?.redis_version).isAtLeast(8,4)&&(0,X.jsx)(Z,{icon:(0,X.jsx)(Ee,{fontSize:`small`}),label:`Digest`,color:`secondary`,onClick:be}),!E&&(0,X.jsx)(Z,{icon:(0,X.jsx)(U,{fontSize:`small`}),label:c?.intention?.edit,onClick:de})]}),O&&(0,X.jsxs)(a,{className:`p3xr-key-type-actions`,children:[!E&&(0,X.jsx)(j,{sx:{mr:1},control:(0,X.jsx)(te,{checked:N,onChange:(e,t)=>P(t),color:`secondary`}),label:c?.label?.validateJson}),(0,X.jsx)(Z,{icon:(0,X.jsx)(ye,{fontSize:`small`}),label:c?.intention?.cancel,color:`error`,onClick:pe}),!E&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Z,{icon:(0,X.jsx)(_,{fontSize:`small`}),label:c?.intention?.setBuffer,onClick:ge}),(0,X.jsx)(Z,{icon:(0,X.jsx)(ne,{fontSize:`small`}),label:c?.intention?.save,onClick:he})]})]}),(0,X.jsx)(a,{className:`p3xr-key-type-content`,children:O?(0,X.jsxs)(a,{className:`p3xr-key-type-editor`,children:[String(F)===`[object ArrayBuffer]`&&(0,X.jsxs)(a,{className:`p3xr-key-type-buffer-info`,children:[typeof c?.label?.isBuffer==`function`?c.label.isBuffer({maxValueAsBuffer:p.prettyBytes(p.maxValueAsBuffer)}):``,` `,we()]}),A&&(0,X.jsxs)(a,{className:`p3xr-key-type-buffer-info`,children:[typeof c?.label?.isBuffer==`function`?c.label.isBuffer({maxValueAsBuffer:p.prettyBytes(p.maxValueAsBuffer)}):``,` `,we()]}),A?(0,X.jsx)(h,{fullWidth:!0,multiline:!0,minRows:4,value:String(L??``),onChange:e=>R(e.target.value),slotProps:{input:{sx:{fontFamily:`'Roboto Mono', monospace`,fontSize:13}}}}):(0,X.jsx)(h,{fullWidth:!0,multiline:!0,minRows:4,value:typeof F==`string`?F:String(F??``),onChange:e=>I(e.target.value),slotProps:{input:{sx:{fontFamily:`'Roboto Mono', monospace`,fontSize:13}}}})]}):(0,X.jsx)(a,{className:`p3xr-key-type-display`,onClick:E?void 0:de,sx:{cursor:E?`default`:`pointer`,maxWidth:`100%`,overflow:i===`hex`?`visible`:`auto`},children:p.maxValueDisplay===-1?(0,X.jsx)(a,{sx:{opacity:.5,fontStyle:`italic`},children:c?.label?.hiddenUntilEdit}):i===`hex`?(0,X.jsx)(Ze,{value:$(typeof F==`string`?F:``),truncated:ze(F)}):(0,X.jsxs)(a,{component:`span`,className:`p3xr-pre`,sx:{wordBreak:`break-all`,whiteSpace:`pre-wrap`,fontFamily:`'Roboto Mono', monospace`,fontSize:16,lineHeight:`18px`},children:[$(Re(typeof F==`string`?F:``,i)),ze(F)&&(0,X.jsx)(a,{component:`span`,sx:{opacity:.5},children:`...`})]})})}),(0,X.jsx)(g,{open:V,value:String(F??``),onClose:()=>H(!1)}),(0,X.jsx)(ee,{open:ie,value:String(F??``),onClose:async t=>{if(ae(!1),t?.obj){let n=String(F??``);B(null),k(!1),M(!1),I(t.obj),C.show({message:c?.intention?.save});try{await J({action:`key/set`,payload:{type:e?.type,key:r,value:t.obj}}),fe(`/key-set`),s(),C.hide(),p.undoEnabled&&n!==t.obj&&await q.getState().toastWithUndo(c?.status?.saved)&&(C.show({message:`Undo...`}),await J({action:`key/set`,payload:{type:e?.type,key:r,value:n}}),s(),C.hide(),q.getState().toast(c?.status?.reverted))}catch(e){b(e),C.hide()}}}}),(0,X.jsx)(S,{open:oe,keyName:r,oldValue:se.oldValue,newValue:se.newValue,onConfirm:()=>{W(!1),ue.current?.(!0)},onCancel:()=>{W(!1),ue.current?.(!1)}})]})}function $e({paging:e,onPageChange:t}){let n=o(e=>e.strings),i=r();if(e.pages<=1)return null;let s={background:`none`,border:`none`,cursor:`pointer`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,height:28,width:28,margin:0,padding:0,color:i.p3xr.inputBorderColor},c=n=>t(Ie(e,n));return(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,py:`4px`},children:[(0,X.jsx)(l,{title:n?.page?.treeControls?.pager?.first,placement:`top`,children:(0,X.jsx)(`button`,{style:s,onClick:()=>c(`first`),children:(0,X.jsx)(W,{sx:{fontSize:24}})})}),(0,X.jsx)(l,{title:n?.page?.treeControls?.pager?.prev,placement:`top`,children:(0,X.jsx)(`button`,{style:s,onClick:()=>c(`prev`),children:(0,X.jsx)(ie,{sx:{fontSize:24}})})}),(0,X.jsx)(`input`,{type:`number`,step:1,min:1,max:e.pages,value:e.page,onChange:n=>{let r=parseInt(n.target.value,10);isNaN(r)||t(Le(e,r))},className:`p3xr-pager-input`,style:{width:64,margin:`0 4px`,verticalAlign:`middle`,textAlign:`center`,padding:0,boxSizing:`border-box`,borderStyle:`solid`,borderWidth:2,borderColor:i.p3xr.inputBorderColor,background:i.p3xr.inputBg,color:i.p3xr.inputColor,outline:`none`,fontFamily:`'Roboto Mono', monospace`,fontSize:12,MozAppearance:`textfield`}}),(0,X.jsxs)(`span`,{style:{margin:`0 4px`,color:i.p3xr.inputColor},children:[`/ `,e.pages]}),(0,X.jsx)(l,{title:n?.page?.treeControls?.pager?.next,placement:`top`,children:(0,X.jsx)(`button`,{style:s,onClick:()=>c(`next`),children:(0,X.jsx)(oe,{sx:{fontSize:24}})})}),(0,X.jsx)(l,{title:n?.page?.treeControls?.pager?.last,placement:`top`,children:(0,X.jsx)(`button`,{style:s,onClick:()=>c(`last`),children:(0,X.jsx)(ae,{sx:{fontSize:24}})})})]})}function et({response:e,value:t,valueBuffer:n,keyName:i,valueFormat:s,onRefresh:c}){let u=o(e=>e.strings),d=K(e=>e.connection),{toast:f,confirm:p,generalHandleError:m}=q(),h=r(),_=d?.readonly===!0,v=h.palette.mode===`dark`,[y,b]=(0,Q.useState)(()=>Pe(t?.length??0)),[x,S]=(0,Q.useState)([]),[C,E]=(0,Q.useState)(!1),[ee,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,te]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{if(!t)return;let e=Fe(y,t.length);b(e),S(t.slice(e.startIndex,e.endIndex).map((t,n)=>({index:e.startIndex+n,value:t})))},[t]);let P=(0,Q.useCallback)(e=>{if(b(e),!t){S([]);return}S(t.slice(e.startIndex,e.endIndex).map((t,n)=>({index:e.startIndex+n,value:t})))},[t]),F=(0,Q.useCallback)(()=>{O({type:`append`,model:{type:`list`,key:i}}),E(!0)},[i]),I=(0,Q.useCallback)(async e=>{try{await p({message:u?.confirm?.deleteListItem??u?.confirm?.areYouSure??`Are you sure?`}),await J({action:`key/list-delete-index`,payload:{key:i,index:e}}),f(u?.status?.deletedListElement),c()}catch(e){m(e)}},[i,u,p,f,c,m]),L=(0,Q.useCallback)((e,t)=>{O({type:`edit`,model:{type:`list`,key:i,index:e,value:typeof t==`string`&&t.length>=K.getState().maxValueAsBuffer?n?.[e]:t}}),E(!0)},[i,n]),R=(0,Q.useCallback)(e=>{E(!1),O(null),e&&c()},[c]),z=v?`rgba(255,255,255,0.1)`:`rgba(0,0,0,0.1)`,B=v?`rgba(255,255,255,0.05)`:`rgba(0,0,0,0.04)`,V=v?`rgba(255,255,255,0.05)`:`rgba(0,0,0,0.06)`;return(0,X.jsxs)(a,{children:[(0,X.jsx)($e,{paging:y,onPageChange:P}),(0,X.jsxs)(a,{className:`p3xr-key-type-table`,children:[(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`center`,gap:1,px:2,py:1,fontWeight:`bold`,bgcolor:h.palette.primary.main,color:h.palette.primary.contrastText,borderBottom:`2px solid ${V}`},children:[(0,X.jsx)(a,{component:`span`,sx:{flex:`20%`},children:u?.page?.key?.list?.table?.index??`Index`}),(0,X.jsx)(a,{component:`span`,sx:{flex:`60%`},children:u?.page?.key?.list?.table?.value??`Value`}),(0,X.jsx)(a,{component:`span`,sx:{flex:`20%`,textAlign:`right`,display:`flex`,justifyContent:`flex-end`,alignItems:`center`},children:!_&&(0,X.jsx)(l,{title:u?.intention?.add,children:(0,X.jsx)(M,{sx:{cursor:`pointer`,color:`inherit`},onClick:F})})})]}),x.map((e,t)=>(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`flex-start`,gap:1,px:2,py:`6px`,borderBottom:`1px solid ${V}`,bgcolor:t%2==0?B:`transparent`,"&:hover":{bgcolor:`${z} !important`}},children:[(0,X.jsx)(a,{component:`span`,sx:{flex:`20%`,cursor:`pointer`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,userSelect:`text`},onClick:()=>L(e.index,e.value),children:e.index}),(0,X.jsx)(a,{component:`span`,sx:{flex:`60%`,cursor:`pointer`,overflow:`auto`,maxHeight:200,...s===`hex`?{}:{whiteSpace:`pre-wrap`,wordBreak:`break-all`,fontFamily:`'Roboto Mono', monospace`},userSelect:`text`},onClick:()=>L(e.index,e.value),children:s===`hex`?(0,X.jsx)(Ze,{value:$(e.value),truncated:ze(e.value)}):(0,X.jsxs)(X.Fragment,{children:[$(Re(e.value,s)),ze(e.value)&&(0,X.jsx)(`span`,{style:{opacity:.5},children:`...`})]})}),(0,X.jsxs)(a,{component:`span`,sx:{flex:`20%`,textAlign:`right`,whiteSpace:`nowrap`},children:[!_&&(0,X.jsx)(l,{title:u?.intention?.delete,children:(0,X.jsx)(N,{sx:{fontSize:24,cursor:`pointer`,mx:`2px`,opacity:.7,color:`error.main`,"&:hover":{opacity:1}},onClick:()=>I(e.index)})}),(0,X.jsx)(l,{title:u?.intention?.jsonViewShow,children:(0,X.jsx)(w,{sx:{fontSize:24,cursor:`pointer`,mx:`2px`,opacity:.7,color:`secondary.main`,"&:hover":{opacity:1}},onClick:()=>{te(String(e.value??``)),A(!0)}})}),(0,X.jsx)(l,{title:u?.intention?.copy,children:(0,X.jsx)(D,{sx:{fontSize:24,cursor:`pointer`,mx:`2px`,opacity:.7,color:`secondary.main`,"&:hover":{opacity:1}},onClick:()=>Be(e.value)})}),(0,X.jsx)(l,{title:u?.intention?.downloadBuffer,children:(0,X.jsx)(re,{sx:{fontSize:24,cursor:`pointer`,mx:`2px`,opacity:.7,color:`secondary.main`,"&:hover":{opacity:1}},onClick:()=>Ve(n?.[e.index],i)})}),!_&&(0,X.jsx)(l,{title:u?.intention?.edit,children:(0,X.jsx)(U,{sx:{fontSize:24,cursor:`pointer`,mx:`2px`,opacity:.7,color:`primary.main`,"&:hover":{opacity:1}},onClick:()=>L(e.index,e.value)})})]})]},e.index))]}),(0,X.jsx)(T,{open:C,data:ee,onClose:R}),(0,X.jsx)(g,{open:k,value:j,onClose:()=>A(!1)})]})}var tt=e(t(((e,t)=>{t.exports=i;var n={hoursPerDay:24,daysPerWeek:7,weeksPerMonth:4,monthsPerYear:12,daysPerYear:365.25},r={ms:[`ms`,`milli`,`millisecond`,`milliseconds`],s:[`s`,`sec`,`secs`,`second`,`seconds`],m:[`m`,`min`,`mins`,`minute`,`minutes`],h:[`h`,`hr`,`hrs`,`hour`,`hours`],d:[`d`,`day`,`days`],w:[`w`,`week`,`weeks`],mth:[`mon`,`mth`,`mths`,`month`,`months`],y:[`y`,`yr`,`yrs`,`year`,`years`]};function i(e,t,r){r=Object.assign({},n,r||{}),(typeof e==`number`||e.match(/^[-+]?[0-9.]+$/g))&&(e=parseInt(e)+`ms`);let i=0,o=a(r),l=e.toLowerCase().replace(/[^.\w+-]+/g,``).match(/[-+]?[0-9.]+[a-z]+/g);if(l===null)throw Error(`The value [${e}] could not be parsed by timestring`);return l.forEach(e=>{let t=e.match(/[0-9.]+/g)[0],n=e.match(/[a-z]+/g)[0];i+=s(t,n,o)}),t?c(i,t,o):i}function a(e){let t={ms:.001,s:1,m:60,h:3600};return t.d=e.hoursPerDay*t.h,t.w=e.daysPerWeek*t.d,t.mth=e.daysPerYear/e.monthsPerYear*t.d,t.y=e.daysPerYear*t.d,t}function o(e){for(let t of Object.keys(r))if(r[t].indexOf(e)>-1)return t;throw Error(`The unit [${e}] is not supported by timestring`)}function s(e,t,n){return e*n[o(t)]}function c(e,t,n){return e/n[o(t)]}}))());function nt({open:e,ttl:t,onClose:n}){let r=o(e=>e.strings),[i,s]=(0,Q.useState)(-1),[c,l]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{if(!e)return;let n=t??-1;if(s(n),typeof n==`number`&&n>0)try{let e=G.getState().getHumanizeDurationOptions();l((0,je.default)(n*1e3,{...e,delimiter:` `}))}catch{l(``)}else l(``)},[e,t]);let d=e=>{l(e);try{s((0,tt.default)(String(e),`s`))}catch{}};return e?(0,X.jsxs)(ge,{open:!0,onClose:()=>n(),width:`600px`,title:r?.confirm?.ttl?.title,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(u,{variant:`contained`,color:`error`,size:`small`,onClick:()=>n(),children:[(0,X.jsx)(ye,{fontSize:`small`}),(0,X.jsx)(`span`,{style:{marginLeft:3},children:r?.intention?.cancel})]}),(0,X.jsxs)(u,{variant:`contained`,color:`primary`,size:`small`,onClick:()=>{let e=Number(i);isNaN(e)&&(e=Math.round(e)),n({model:{ttl:e}})},children:[(0,X.jsx)(De,{fontSize:`small`}),(0,X.jsx)(`span`,{style:{marginLeft:3},children:r?.intention?.ttl})]})]}),children:[(0,X.jsx)(a,{sx:{mb:2},children:r?.confirm?.ttl?.textContent}),(0,X.jsx)(h,{fullWidth:!0,margin:`dense`,type:`number`,label:r?.confirm?.ttl?.placeholder,value:i,onChange:e=>s(e.target.value===``?``:Number(e.target.value)),placeholder:r?.confirm?.ttl?.placeholderPlaceholder??`-1`,slotProps:{htmlInput:{min:-1}}}),(0,X.jsx)(h,{fullWidth:!0,margin:`dense`,label:r?.confirm?.ttl?.convertTextToTime,value:c,onChange:e=>d(e.target.value),placeholder:r?.confirm?.ttl?.convertTextToTimePlaceholder??`1h 30m`}),(0,X.jsx)(u,{variant:`text`,color:`secondary`,size:`small`,sx:{mt:1,textTransform:`none`},onClick:()=>window.open(`https://www.npmjs.com/package/timestring#keywords`,`_blank`),children:`https://www.npmjs.com/package/timestring`})]}):null}function rt({response:e,value:t,valueBuffer:n,keyName:i,valueFormat:s,onRefresh:c}){let u=o(e=>e.strings),d=K(e=>e.connection),{toast:f,confirm:p,generalHandleError:m}=q(),h=r(),_=d?.readonly===!0,v=h.palette.mode===`dark`,[y,b]=(0,Q.useState)(()=>Pe(t?Object.keys(t).length:0)),[x,S]=(0,Q.useState)([]),[E,ee]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[te,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(``),[z,B]=(0,Q.useState)(-1),[V,H]=(0,Q.useState)({}),ne=(0,Q.useRef)(0),[ie,ae]=(0,Q.useState)(0),oe=(0,Q.useRef)(c);oe.current=c;let W=(0,Q.useCallback)(async e=>{if(!(!t||!xe(K.getState().info?.server?.redis_version).isAtLeast(8,0)))try{let t=(e||x).map(e=>e.key);if(t.length===0)return;H((await J({action:`hash-field/ttls`,payload:{key:i,fields:t}})).fieldTtls||{}),ne.current=Date.now()}catch{H({})}},[t,i,x]);(0,Q.useEffect)(()=>{if(document.getElementById(`p3xr-hash-ttl-pulse-css`))return;let e=document.createElement(`style`);e.id=`p3xr-hash-ttl-pulse-css`,e.textContent=`@keyframes p3xr-hash-ttl-pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }`,document.head.appendChild(e)},[]),(0,Q.useEffect)(()=>{if(!Object.values(V).some(e=>e>0))return;let e=setInterval(()=>{let t=Math.floor((Date.now()-ne.current)/1e3);if(Object.values(V).some(e=>e>0&&e-t<=0)){clearInterval(e),oe.current();return}ae(e=>e+1)},1e3);return()=>clearInterval(e)},[V]),(0,Q.useEffect)(()=>{if(!t)return;let e=Object.keys(t),n=Fe(y,e.length);b(n);let r=e.slice(n.startIndex,n.endIndex).map(e=>({key:e,value:t[e]}));S(r),W(r)},[t]);let se=(0,Q.useCallback)(e=>{if(b(e),!t){S([]);return}let n=Object.keys(t).slice(e.startIndex,e.endIndex).map(e=>({key:e,value:t[e]}));S(n),W(n)},[t,W]),ce=(0,Q.useCallback)(()=>{k({type:`append`,model:{type:`hash`,key:i}}),ee(!0)},[i]),le=(0,Q.useCallback)(async e=>{try{await p({message:u?.confirm?.deleteHashKey??u?.confirm?.areYouSure??`Are you sure?`}),await J({action:`key/hash-delete-field`,payload:{key:i,hashKey:e}}),f(u?.status?.deletedHashKey),c()}catch(e){m(e)}},[i,u,p,f,c,m]),ue=(0,Q.useCallback)((e,t)=>{k({type:`edit`,model:{type:`hash`,key:i,hashKey:e,value:typeof t==`string`&&t.length>=K.getState().maxValueAsBuffer?n?.[e]:t}}),ee(!0)},[i,n]),de=(0,Q.useCallback)(e=>{ee(!1),k(null),e&&c()},[c]),fe=(0,Q.useCallback)(async e=>{try{let t=await J({action:`hash-field/ttl-get`,payload:{key:i,field:e}});R(e),B(t.ttl??-1),I(!0)}catch(e){m(e)}},[i,m]),pe=(0,Q.useCallback)(async e=>{if(I(!1),e)try{await J({action:`hash-field/ttl`,payload:{key:i,field:L,ttl:e.model.ttl}}),f(`${L}: TTL ${e.model.ttl===-1?`removed`:e.model.ttl+`s`}`),W()}catch(e){m(e)}},[i,L,f,m,W]),me=e=>{let t=V[e];if(!t||t<=0)return-1;let n=t-Math.floor((Date.now()-ne.current)/1e3);return n>0?n:-1},he=e=>{let t=me(e);return t<=0?``:t<300?`#f44336`:t<3600?`#ff9800`:`#4caf50`},ge=e=>me(e)>0&&me(e)<30,_e=e=>me(e)>0,Y=e=>{let t=me(e);if(t<=0)return``;let n=G.getState().getHumanizeDurationOptions();return(0,je.default)(t*1e3,{...n,largest:2,round:!0,delimiter:` `})},ve=v?`rgba(255,255,255,0.1)`:`rgba(0,0,0,0.1)`,ye=v?`rgba(255,255,255,0.05)`:`rgba(0,0,0,0.04)`,be=v?`rgba(255,255,255,0.05)`:`rgba(0,0,0,0.06)`,Se=e=>({fontSize:24,cursor:`pointer`,mx:`2px`,opacity:.7,color:e,"&:hover":{opacity:1}});return(0,X.jsxs)(a,{children:[(0,X.jsx)($e,{paging:y,onPageChange:se}),(0,X.jsxs)(a,{children:[(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`center`,gap:1,px:2,py:1,fontWeight:`bold`,bgcolor:h.palette.primary.main,color:h.palette.primary.contrastText,borderBottom:`2px solid ${be}`},children:[(0,X.jsx)(a,{component:`span`,sx:{flex:`20%`},children:u?.page?.key?.hash?.table?.hashkey??`Hash Key`}),(0,X.jsx)(a,{component:`span`,sx:{flex:`60%`},children:u?.page?.key?.hash?.table?.value??`Value`}),(0,X.jsx)(a,{component:`span`,sx:{flex:`20%`,textAlign:`right`,display:`flex`,justifyContent:`flex-end`,alignItems:`center`},children:!_&&(0,X.jsx)(l,{title:u?.intention?.add,children:(0,X.jsx)(M,{sx:{cursor:`pointer`,color:`inherit`},onClick:ce})})})]}),x.map((e,t)=>(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`flex-start`,gap:1,px:2,py:`6px`,borderBottom:`1px solid ${be}`,bgcolor:t%2==0?ye:`transparent`,"&:hover":{bgcolor:`${ve} !important`}},children:[(0,X.jsx)(a,{component:`span`,sx:{flex:`20%`,cursor:`pointer`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,userSelect:`text`},onClick:()=>ue(e.key,e.value),children:e.key}),(0,X.jsx)(a,{component:`span`,sx:{flex:`60%`,cursor:`pointer`,overflow:`auto`,maxHeight:200,...s===`hex`?{}:{whiteSpace:`pre-wrap`,wordBreak:`break-all`,fontFamily:`'Roboto Mono', monospace`},userSelect:`text`},onClick:()=>ue(e.key,e.value),children:s===`hex`?(0,X.jsx)(Ze,{value:$(e.value),truncated:ze(e.value)}):(0,X.jsxs)(X.Fragment,{children:[$(Re(e.value,s)),ze(e.value)&&(0,X.jsx)(`span`,{style:{opacity:.5},children:`...`})]})}),(0,X.jsxs)(a,{component:`span`,sx:{flex:`20%`,textAlign:`right`,whiteSpace:`nowrap`},children:[!_&&xe(K.getState().info?.server?.redis_version).isAtLeast(8,0)&&(0,X.jsx)(l,{title:_e(e.key)?`TTL: ${Y(e.key)}`:u?.intention?.ttl,children:(0,X.jsx)(C,{style:{fontSize:24,cursor:`pointer`,marginLeft:2,marginRight:2,color:he(e.key)||void 0,opacity:_e(e.key)?.7:.3,animation:ge(e.key)?`p3xr-hash-ttl-pulse 1s infinite`:`none`},onClick:()=>fe(e.key)})}),!_&&(0,X.jsx)(l,{title:u?.intention?.delete,children:(0,X.jsx)(N,{sx:Se(`error.main`),onClick:()=>le(e.key)})}),(0,X.jsx)(l,{title:u?.intention?.jsonViewShow,children:(0,X.jsx)(w,{sx:Se(`secondary.main`),onClick:()=>{P(String(e.value??``)),j(!0)}})}),(0,X.jsx)(l,{title:u?.intention?.copy,children:(0,X.jsx)(D,{sx:Se(`secondary.main`),onClick:()=>Be(e.value)})}),(0,X.jsx)(l,{title:u?.intention?.downloadBuffer,children:(0,X.jsx)(re,{sx:Se(`secondary.main`),onClick:()=>Ve(n?.[e.key],i,`${i}-${e.key}`)})}),!_&&(0,X.jsx)(l,{title:u?.intention?.edit,children:(0,X.jsx)(U,{sx:Se(`primary.main`),onClick:()=>ue(e.key,e.value)})})]})]},e.key))]}),(0,X.jsx)(T,{open:E,data:O,onClose:de}),(0,X.jsx)(g,{open:A,value:te,onClose:()=>j(!1)}),(0,X.jsx)(nt,{open:F,ttl:z,onClose:pe})]})}function it({response:e,value:t,valueBuffer:n,keyName:i,valueFormat:s,onRefresh:c}){let u=o(e=>e.strings),d=K(e=>e.connection),{toast:f,confirm:p,generalHandleError:m}=q(),h=r(),_=d?.readonly===!0,v=h.palette.mode===`dark`,[y,b]=(0,Q.useState)(()=>Pe(t?.length??0)),[x,S]=(0,Q.useState)([]),[C,E]=(0,Q.useState)(!1),[ee,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,te]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{if(!t)return;let e=Fe(y,t.length);b(e),S(t.slice(e.startIndex,e.endIndex).map((t,n)=>({index:e.startIndex+n,value:t})))},[t]);let P=(0,Q.useCallback)(e=>{if(b(e),!t){S([]);return}S(t.slice(e.startIndex,e.endIndex).map((t,n)=>({index:e.startIndex+n,value:t})))},[t]),F=(0,Q.useCallback)(()=>{O({type:`append`,model:{type:`set`,key:i}}),E(!0)},[i]),I=(0,Q.useCallback)(async e=>{try{await p({message:u?.confirm?.deleteSetMember??u?.confirm?.areYouSure??`Are you sure?`}),await J({action:`key/set-delete-member`,payload:{key:i,value:n?.[e]}}),f(u?.status?.deletedSetMember),c()}catch(e){m(e)}},[i,n,u,p,f,c,m]),L=(0,Q.useCallback)((e,t)=>{O({type:`edit`,model:{type:`set`,key:i,value:typeof t==`string`&&t.length>=K.getState().maxValueAsBuffer?n?.[e]:t}}),E(!0)},[i,n]),R=(0,Q.useCallback)(e=>{E(!1),O(null),e&&c()},[c]),z=v?`rgba(255,255,255,0.1)`:`rgba(0,0,0,0.1)`,B=v?`rgba(255,255,255,0.05)`:`rgba(0,0,0,0.04)`,V=v?`rgba(255,255,255,0.05)`:`rgba(0,0,0,0.06)`,H=e=>({fontSize:24,cursor:`pointer`,mx:`2px`,opacity:.7,color:e,"&:hover":{opacity:1}});return(0,X.jsxs)(a,{children:[(0,X.jsx)($e,{paging:y,onPageChange:P}),(0,X.jsxs)(a,{children:[(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`center`,gap:1,px:2,py:1,fontWeight:`bold`,bgcolor:h.palette.primary.main,color:h.palette.primary.contrastText,borderBottom:`2px solid ${V}`},children:[(0,X.jsx)(a,{component:`span`,sx:{flex:`95%`},children:u?.page?.key?.set?.table?.value??`Member`}),(0,X.jsx)(a,{component:`span`,sx:{flex:`5%`,textAlign:`right`,display:`flex`,justifyContent:`flex-end`,alignItems:`center`},children:!_&&(0,X.jsx)(l,{title:u?.intention?.add,children:(0,X.jsx)(M,{sx:{cursor:`pointer`,color:`inherit`},onClick:F})})})]}),x.map((e,t)=>(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`flex-start`,gap:1,px:2,py:`6px`,borderBottom:`1px solid ${V}`,bgcolor:t%2==0?B:`transparent`,"&:hover":{bgcolor:`${z} !important`}},children:[(0,X.jsx)(a,{component:`span`,sx:{flex:`95%`,cursor:`pointer`,overflow:`auto`,maxHeight:200,...s===`hex`?{}:{whiteSpace:`pre-wrap`,wordBreak:`break-all`,fontFamily:`'Roboto Mono', monospace`},userSelect:`text`},onClick:()=>L(e.index,e.value),children:s===`hex`?(0,X.jsx)(Ze,{value:$(e.value),truncated:ze(e.value)}):(0,X.jsxs)(X.Fragment,{children:[$(Re(e.value,s)),ze(e.value)&&(0,X.jsx)(`span`,{style:{opacity:.5},children:`...`})]})}),(0,X.jsxs)(a,{component:`span`,sx:{flex:`5%`,textAlign:`right`,whiteSpace:`nowrap`},children:[!_&&(0,X.jsx)(l,{title:u?.intention?.delete,children:(0,X.jsx)(N,{sx:H(`error.main`),onClick:()=>I(e.index)})}),(0,X.jsx)(l,{title:u?.intention?.jsonViewShow,children:(0,X.jsx)(w,{sx:H(`secondary.main`),onClick:()=>{te(String(e.value??``)),A(!0)}})}),(0,X.jsx)(l,{title:u?.intention?.copy,children:(0,X.jsx)(D,{sx:H(`secondary.main`),onClick:()=>Be(e.value)})}),(0,X.jsx)(l,{title:u?.intention?.downloadBuffer,children:(0,X.jsx)(re,{sx:H(`secondary.main`),onClick:()=>Ve(n?.[e.index],i)})}),!_&&(0,X.jsx)(l,{title:u?.intention?.edit,children:(0,X.jsx)(U,{sx:H(`primary.main`),onClick:()=>L(e.index,e.value)})})]})]},e.index))]}),(0,X.jsx)(T,{open:C,data:ee,onClose:R}),(0,X.jsx)(g,{open:k,value:j,onClose:()=>A(!1)})]})}function at(e,t){if(!e)return[];let n=[];for(let t=0;t<e.length;t+=2)n.push({member:e[t],score:e[t+1],index:t/2});return n.slice(t.startIndex,t.endIndex)}function ot({response:e,value:t,valueBuffer:n,keyName:i,valueFormat:s,onRefresh:c}){let u=o(e=>e.strings),d=K(e=>e.connection),{toast:f,confirm:p,generalHandleError:m}=q(),h=r(),_=d?.readonly===!0,v=h.palette.mode===`dark`,[y,b]=(0,Q.useState)(()=>Pe(t?.length??0,!0)),[x,S]=(0,Q.useState)([]),[C,E]=(0,Q.useState)(!1),[ee,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[j,te]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{if(!t)return;let e=Fe(y,t.length,!0);b(e),S(at(t,e))},[t]);let P=(0,Q.useCallback)(e=>{b(e),S(at(t,e))},[t]),F=(0,Q.useCallback)(()=>{O({type:`append`,model:{type:`zset`,key:i}}),E(!0)},[i]),I=(0,Q.useCallback)(async e=>{try{await p({message:u?.confirm?.deleteZSetMember??u?.confirm?.areYouSure??`Are you sure?`}),await J({action:`key/zset-delete-member`,payload:{key:i,value:n?.[e.index*2]}}),f(u?.status?.deletedZSetMember),c()}catch(e){m(e)}},[i,n,u,p,f,c,m]),L=(0,Q.useCallback)(e=>{O({type:`edit`,model:{type:`zset`,key:i,value:typeof e.member==`string`&&e.member.length>=K.getState().maxValueAsBuffer?n?.[e.index*2]:e.member,score:e.score}}),E(!0)},[i,n]),R=(0,Q.useCallback)(e=>{E(!1),O(null),e&&c()},[c]),z=v?`rgba(255,255,255,0.1)`:`rgba(0,0,0,0.1)`,B=v?`rgba(255,255,255,0.05)`:`rgba(0,0,0,0.04)`,V=v?`rgba(255,255,255,0.05)`:`rgba(0,0,0,0.06)`,H=e=>({fontSize:24,cursor:`pointer`,mx:`2px`,opacity:.7,color:e,"&:hover":{opacity:1}});return(0,X.jsxs)(a,{children:[(0,X.jsx)($e,{paging:y,onPageChange:P}),(0,X.jsxs)(a,{children:[(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`center`,gap:1,px:2,py:1,fontWeight:`bold`,bgcolor:h.palette.primary.main,color:h.palette.primary.contrastText,borderBottom:`2px solid ${V}`},children:[(0,X.jsx)(a,{component:`span`,sx:{flex:`20%`},children:u?.page?.key?.zset?.table?.score??`Score`}),(0,X.jsx)(a,{component:`span`,sx:{flex:`60%`},children:u?.page?.key?.zset?.table?.value??`Member`}),(0,X.jsx)(a,{component:`span`,sx:{flex:`20%`,textAlign:`right`,display:`flex`,justifyContent:`flex-end`,alignItems:`center`},children:!_&&(0,X.jsx)(l,{title:u?.intention?.add,children:(0,X.jsx)(M,{sx:{cursor:`pointer`,color:`inherit`},onClick:F})})})]}),x.map((e,t)=>(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`flex-start`,gap:1,px:2,py:`6px`,borderBottom:`1px solid ${V}`,bgcolor:t%2==0?B:`transparent`,"&:hover":{bgcolor:`${z} !important`}},children:[(0,X.jsx)(a,{component:`span`,sx:{flex:`20%`,cursor:`pointer`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,userSelect:`text`},onClick:()=>L(e),children:e.score}),(0,X.jsx)(a,{component:`span`,sx:{flex:`60%`,cursor:`pointer`,overflow:`auto`,maxHeight:200,...s===`hex`?{}:{whiteSpace:`pre-wrap`,wordBreak:`break-all`,fontFamily:`'Roboto Mono', monospace`},userSelect:`text`},onClick:()=>L(e),children:s===`hex`?(0,X.jsx)(Ze,{value:$(e.member),truncated:ze(e.member)}):(0,X.jsxs)(X.Fragment,{children:[$(Re(e.member,s)),ze(e.member)&&(0,X.jsx)(`span`,{style:{opacity:.5},children:`...`})]})}),(0,X.jsxs)(a,{component:`span`,sx:{flex:`20%`,textAlign:`right`,whiteSpace:`nowrap`},children:[!_&&(0,X.jsx)(l,{title:u?.intention?.delete,children:(0,X.jsx)(N,{sx:H(`error.main`),onClick:()=>I(e)})}),(0,X.jsx)(l,{title:u?.intention?.jsonViewShow,children:(0,X.jsx)(w,{sx:H(`secondary.main`),onClick:()=>{te(String(e.member??``)),A(!0)}})}),(0,X.jsx)(l,{title:u?.intention?.copy,children:(0,X.jsx)(D,{sx:H(`secondary.main`),onClick:()=>Be(e.member)})}),(0,X.jsx)(l,{title:u?.intention?.downloadBuffer,children:(0,X.jsx)(re,{sx:H(`secondary.main`),onClick:()=>Ve(n?.[e.index*2],i)})}),!_&&(0,X.jsx)(l,{title:u?.intention?.edit,children:(0,X.jsx)(U,{sx:H(`primary.main`),onClick:()=>L(e)})})]})]},e.index))]}),(0,X.jsx)(T,{open:C,data:ee,onClose:R}),(0,X.jsx)(g,{open:k,value:j,onClose:()=>A(!1)})]})}var st={zn:`zh-CN`,no:`nb`,fil:`tl`};function ct(e){try{return JSON.parse(e)}catch{return e}}function lt(e){let t=new Set;for(let[n]of e){if(t.has(n))return!0;t.add(n)}return!1}function ut(e){let t={};for(let[n,r]of e)t[n]=ct(r);return t}function dt(e){return e.map(([e,t])=>({field:e,value:ct(t)}))}function ft(e){return e?e.map(e=>{let t=e[0],n=e[1],r=[];for(let e=0;e<n.length;e+=2)r.push([n[e],n[e+1]]);let i=lt(r);return{id:t,fields:r,data:i?dt(r):ut(r),hasDuplicateFields:i}}):[]}function pt(e){return e.hasDuplicateFields?{id:e.id,fields:e.data}:{id:e.id,...e.data}}function mt({response:e,value:t,valueBuffer:n,keyName:i,valueFormat:s,onRefresh:c}){let u=o(e=>e.strings),d=o(e=>e.currentLang),f=K(e=>e.connection),{toast:p,confirm:m,generalHandleError:h}=q(),_=r(),v=f?.readonly===!0,y=_.palette.mode===`dark`,[b,x]=(0,Q.useState)([]),[S,C]=(0,Q.useState)(()=>Pe(0)),[E,ee]=(0,Q.useState)([]),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(null),[te,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{let e=ft(t);x(e);let n=Fe(S,e.length);C(n),ee(e.slice(n.startIndex,n.endIndex))},[t]);let L=(0,Q.useCallback)(e=>{C(e),ee(b.slice(e.startIndex,e.endIndex))},[b]),R=(0,Q.useCallback)(e=>{try{let t=parseInt(e.slice(0,e.indexOf(`-`))),n=d||`en`,r=st[n]||n;return new Date(t).toLocaleString(r,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return e}},[d]),z=(0,Q.useCallback)(()=>{j({type:`append`,model:{type:`stream`,key:i}}),k(!0)},[i]),B=(0,Q.useCallback)(async e=>{try{await m({message:u?.confirm?.deleteStreamTimestamp??u?.confirm?.areYouSure??`Are you sure?`}),await J({action:`key/stream-delete-timestamp`,payload:{key:i,streamTimestamp:e}}),p(u?.status?.deletedStreamTimestamp??u?.status?.deletedKey),c()}catch(e){e&&h(e)}},[i,u,m,p,c,h]),V=(0,Q.useCallback)(e=>{Be(JSON.stringify(pt(e),null,2))},[]),H=(0,Q.useCallback)(e=>{let t=[e.id];for(let[n,r]of e.fields)t.push(n),t.push(r);let n=new Blob([t.join(`
`)],{type:`text/plain`}),r=URL.createObjectURL(n),a=document.createElement(`a`);a.href=r,a.download=`${i}-${e.id}.txt`,a.click(),URL.revokeObjectURL(r)},[i]),U=(0,Q.useCallback)(e=>{I(JSON.stringify(pt(e))),P(!0)},[]),ne=(0,Q.useCallback)(e=>{k(!1),j(null),e&&c()},[c]),ie=y?`rgba(255,255,255,0.05)`:`rgba(0,0,0,0.04)`,ae=y?`rgba(255,255,255,0.1)`:`rgba(0,0,0,0.1)`,oe=y?`rgba(255,255,255,0.05)`:`rgba(0,0,0,0.06)`,W=e=>({fontSize:24,cursor:`pointer`,mx:`2px`,opacity:.7,color:e,"&:hover":{opacity:1}});return(0,X.jsxs)(a,{children:[(0,X.jsx)($e,{paging:S,onPageChange:L}),(0,X.jsxs)(a,{children:[(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`center`,gap:1,px:2,py:1,fontWeight:`bold`,bgcolor:_.palette.primary.main,color:_.palette.primary.contrastText,borderBottom:`2px solid ${oe}`},children:[(0,X.jsx)(a,{component:`span`,sx:{flex:1},children:u?.page?.key?.stream?.table?.timestamp??`Timestamp ID`}),(0,X.jsx)(a,{component:`span`,sx:{textAlign:`right`},children:!v&&(0,X.jsx)(l,{title:u?.intention?.add,children:(0,X.jsx)(M,{sx:{cursor:`pointer`,color:`inherit`},onClick:z})})})]}),E.map((e,t)=>(0,X.jsxs)(a,{sx:{borderBottom:`1px solid ${oe}`,bgcolor:t%2==0?ie:`transparent`,"&:hover":{bgcolor:`${ae} !important`}},children:[(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,px:2,py:`6px`,fontSize:13},children:[(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`center`,gap:1.5},children:[(0,X.jsx)(`strong`,{children:e.id}),(0,X.jsx)(a,{component:`span`,sx:{opacity:.5,fontSize:12},children:R(e.id)})]}),(0,X.jsxs)(a,{sx:{whiteSpace:`nowrap`},children:[!v&&(0,X.jsx)(l,{title:u?.intention?.delete,children:(0,X.jsx)(N,{sx:W(`error.main`),onClick:()=>B(e.id)})}),(0,X.jsx)(l,{title:u?.intention?.jsonViewShow,children:(0,X.jsx)(w,{sx:W(`secondary.main`),onClick:()=>U(e)})}),(0,X.jsx)(l,{title:u?.intention?.copy,children:(0,X.jsx)(D,{sx:W(`secondary.main`),onClick:()=>V(e)})}),(0,X.jsx)(l,{title:u?.intention?.downloadBuffer,children:(0,X.jsx)(re,{sx:W(`secondary.main`),onClick:()=>H(e)})})]})]}),(0,X.jsx)(a,{sx:{px:2,pb:1,overflow:`auto`,maxHeight:300},children:e.fields.map(([e,t],n)=>(0,X.jsxs)(a,{sx:{display:`flex`,gap:1,py:`2px`},children:[(0,X.jsx)(a,{component:`span`,sx:{minWidth:120,opacity:.7},children:e}),(0,X.jsx)(a,{component:`span`,sx:{flex:1,maxHeight:200,overflow:`auto`,...s===`hex`?{}:{whiteSpace:`pre-wrap`,wordBreak:`break-all`,fontFamily:`'Roboto Mono', monospace`}},children:s===`hex`?(0,X.jsx)(Ze,{value:$(t),truncated:ze(t)}):(0,X.jsxs)(X.Fragment,{children:[$(Re(t,s)),ze(t)&&(0,X.jsx)(`span`,{style:{opacity:.5},children:`...`})]})})]},`${e}-${n}`))})]},e.id))]}),(0,X.jsx)(T,{open:O,data:A,onClose:ne}),(0,X.jsx)(g,{open:te,value:F,onClose:()=>P(!1)})]})}function ht(e,t){if(t===null)return{key:e,value:null,type:`null`};if(Array.isArray(t)){let n=t.map((e,t)=>ht(String(t),e));return{key:e,value:t,type:`array`,children:n,childCount:n.length}}if(typeof t==`object`){let n=Object.keys(t).map(e=>ht(e,t[e]));return{key:e,value:t,type:`object`,children:n,childCount:n.length}}return{key:e,value:t,type:typeof t}}function gt(e){return e.type===`null`?`null`:e.type===`string`?`"${e.value}"`:String(e.value)}function _t(){let{palette:e}=r(),t=e.mode===`dark`;return{key:t?`white`:`black`,string:e.secondary.main,number:e.primary.main,boolean:e.error.main,null:t?`rgba(255,255,255,0.4)`:`rgba(0,0,0,0.4)`}}function vt({node:e,level:t,expandedKeys:n,toggleExpand:r,wrap:i}){let o=_t(),s=`${t}-${e.key}`,c=e.type===`object`||e.type===`array`,l=n.has(s),u=c?void 0:o[e.type]??`inherit`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`flex-start`,minHeight:24,lineHeight:1.6,pl:`${t*20}px`,fontFamily:`'Roboto Mono', monospace`,fontSize:13},children:[c?(0,X.jsx)(a,{component:`span`,onClick:()=>r(s),sx:{width:24,height:24,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,flexShrink:0,opacity:.6},children:l?(0,X.jsx)(H,{sx:{fontSize:18}}):(0,X.jsx)(V,{sx:{fontSize:18}})}):(0,X.jsx)(a,{sx:{width:24,height:24,flexShrink:0}}),(0,X.jsxs)(a,{sx:{display:`flex`,alignItems:`flex-start`,gap:`6px`,flex:1,minWidth:0,flexWrap:`nowrap`},children:[(0,X.jsxs)(a,{component:`span`,sx:{flexShrink:0,whiteSpace:`nowrap`},children:[(0,X.jsx)(a,{component:`span`,sx:{fontWeight:`bold`,color:o.key},children:e.key}),(0,X.jsx)(a,{component:`span`,sx:{opacity:.6},children:`:`})]}),c?l?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(a,{component:`span`,sx:{opacity:.5},children:e.type===`array`?`[`:`{`}),(0,X.jsx)(a,{component:`span`,sx:{opacity:.4},children:`...`}),(0,X.jsx)(a,{component:`span`,sx:{opacity:.5},children:e.type===`array`?`]`:`}`}),(0,X.jsxs)(a,{component:`span`,sx:{opacity:.4,fontSize:11,ml:`4px`},children:[`(`,e.childCount,`)`]})]}):(0,X.jsx)(a,{component:`span`,sx:{wordBreak:i?`break-word`:`normal`,whiteSpace:i?`normal`:`nowrap`,minWidth:0,color:u,fontStyle:e.type===`null`?`italic`:`normal`},children:gt(e)})]})]}),c&&l&&e.children?.map((e,a)=>(0,X.jsx)(vt,{node:e,level:t+1,expandedKeys:n,toggleExpand:r,wrap:i},`${e.key}-${a}`))]})}function yt({response:e,value:t,valueBuffer:n,keyName:r,valueFormat:i,onRefresh:s}){let c=o(e=>e.strings),f=K(e=>e.connection),{toast:p,generalHandleError:m}=q(),h=ce(),g=d(`(min-width: 960px)`),_=f?.readonly===!0,[v,y]=(0,Q.useState)(void 0),[b,x]=(0,Q.useState)(!0),[C,w]=(0,Q.useState)(new Set),[T,E]=(0,Q.useState)(!1),[k,j]=(0,Q.useState)(!1),[M,te]=(0,Q.useState)({oldValue:``,newValue:``}),N=(0,Q.useRef)(null),P=c?.label?.tree??`root`;(0,Q.useEffect)(()=>{try{y(JSON.parse(t)),w(new Set([`0-${P}`]))}catch{y(void 0)}},[t,P]);let F=(0,Q.useCallback)(e=>{w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),I=(0,Q.useCallback)(()=>{if(v===void 0)return;let e=ht(P,v),t=new Set,n=(e,r)=>{let i=`${r}-${e.key}`;(e.type===`object`||e.type===`array`)&&(t.add(i),e.children?.forEach(e=>n(e,r+1)))};n(e,0),w(t)},[v,P]),L=(0,Q.useCallback)(()=>{w(new Set([`0-${P}`]))},[P]),R=(0,Q.useCallback)(()=>Be(t),[t]),z=(0,Q.useCallback)(()=>{let e=new Blob([t],{type:`application/json`}),n=URL.createObjectURL(e),i=document.createElement(`a`);i.href=n,i.download=`${r}.json`,i.click(),URL.revokeObjectURL(n)},[t,r]);(0,Q.useCallback)((e,t)=>!G.getState().showDiffBeforeSave||e===t?Promise.resolve(!0):(te({oldValue:e,newValue:t}),j(!0),new Promise(e=>{N.current=e})),[]);let B=(0,Q.useCallback)(async e=>{if(E(!1),!e?.obj)return;let n=t;try{let t=typeof e.obj==`string`?e.obj:JSON.stringify(e.obj);h.show(),await J({action:`key/json-set`,payload:{key:r,path:`$`,value:t}}),fe(`/key-json-set`),s(),h.hide(),G.getState().undoEnabled&&n!==void 0&&n!==t&&await q.getState().toastWithUndo(c?.status?.set)&&(h.show({message:`Undo...`}),await J({action:`key/json-set`,payload:{key:r,path:`$`,value:n}}),s(),h.hide(),q.getState().toast(c?.status?.reverted))}catch(e){e&&m(e),h.hide()}},[r,c,t,s,m]),V=({icon:e,label:t,color:n=`secondary`,onClick:r})=>g?(0,X.jsxs)(u,{variant:`contained`,color:n,onClick:r,children:[e,(0,X.jsx)(`span`,{children:t})]}):(0,X.jsx)(l,{title:t,placement:`top`,children:(0,X.jsx)(u,{variant:`contained`,color:n,onClick:r,sx:{minWidth:40,width:40,height:40,p:0,borderRadius:`4px`},children:e})}),H=v===void 0?null:ht(P,v);return(0,X.jsxs)(a,{children:[(0,X.jsxs)(a,{className:`p3xr-key-type-ac