planche 0.8.13 → 0.9.0

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.
Files changed (141) hide show
  1. package/app/assets/1p4z4GHT.js +2 -0
  2. package/app/assets/{DkPnEF-y.js → 6NUleTnS.js} +1 -1
  3. package/app/assets/ANL7Od0T.js +1 -0
  4. package/app/assets/B7zF7RU4.js +2 -0
  5. package/app/assets/B8zpsP_u.js +959 -0
  6. package/app/assets/B9DHeSQH.js +1 -0
  7. package/app/assets/B9NCreMu.js +1 -0
  8. package/app/assets/{CjoKIEBz.js → B9dhM8vw.js} +1 -1
  9. package/app/assets/BFw3KCAr.js +1 -0
  10. package/app/assets/BGuDcBB_.js +1 -0
  11. package/app/assets/BHe42P9W.js +1 -0
  12. package/app/assets/BJFk0Zzq.js +2 -0
  13. package/app/assets/BMGo7X_N.js +2 -0
  14. package/app/assets/BRZhVXRC.js +1 -0
  15. package/app/assets/BVwlLPu6.js +1 -0
  16. package/app/assets/BYWnKgIY.js +3 -0
  17. package/app/assets/BYvM8E39.js +1 -0
  18. package/app/assets/B_1rFijd.js +1 -0
  19. package/app/assets/Bgu3teFB.js +11 -0
  20. package/app/assets/BgvMpmFj.js +1 -0
  21. package/app/assets/BhPOHTk7.js +7 -0
  22. package/app/assets/BiyRPyXV.js +1 -0
  23. package/app/assets/Bkq2aetC.js +1 -0
  24. package/app/assets/BnI4D_rY.js +1 -0
  25. package/app/assets/BniymiMs.js +2 -0
  26. package/app/assets/Br4335vw.js +1 -0
  27. package/app/assets/BsYZ-U7K.js +1 -0
  28. package/app/assets/BvEGx3Si.js +4 -0
  29. package/app/assets/Bvu_eiyU.js +3 -0
  30. package/app/assets/C1gqjEN3.js +1 -0
  31. package/app/assets/C2S2GXdP.js +1 -0
  32. package/app/assets/C3w9xAkk.js +1 -0
  33. package/app/assets/C4QyqQoa.js +1 -0
  34. package/app/assets/C5Yv1gpQ.js +1 -0
  35. package/app/assets/CCQ6oQgi.js +1 -0
  36. package/app/assets/{Bajzqc8D.js → CDfSdkjY.js} +1 -1
  37. package/app/assets/CIIDOG9Y.js +1 -0
  38. package/app/assets/CP2U-viH.js +1 -0
  39. package/app/assets/CVZ3Bw6o.js +1 -0
  40. package/app/assets/CWb3a6Xp.js +1 -0
  41. package/app/assets/CWota0kb.js +1 -0
  42. package/app/assets/{B1pia_Rg.js → CYz610vE.js} +1 -1
  43. package/app/assets/Cdop6jK1.js +2 -0
  44. package/app/assets/CgQ0qqq4.js +1 -0
  45. package/app/assets/CiL8zoYm.js +1 -0
  46. package/app/assets/CkIm3SJy.js +1 -0
  47. package/app/assets/ClytWHSf.js +1 -0
  48. package/app/assets/CnoXRrek.js +1 -0
  49. package/app/assets/CqTgU2vp.css +2 -0
  50. package/app/assets/Cu_sGzNJ.js +1 -0
  51. package/app/assets/CwsH45Wr.js +2 -0
  52. package/app/assets/D3_CBO8-.js +1 -0
  53. package/app/assets/D4l4mWtD.js +1 -0
  54. package/app/assets/D6oRJsd8.js +1 -0
  55. package/app/assets/D8_hwGjG.js +1 -0
  56. package/app/assets/{CEtGUZGE.js → D8dVzi6I.js} +1 -1
  57. package/app/assets/DDeeBXtX.js +1 -0
  58. package/app/assets/DDjCZLb0.js +1 -0
  59. package/app/assets/DFeHpd8Y.js +1 -0
  60. package/app/assets/DKf3DkR6.js +1 -0
  61. package/app/assets/DO0W14Ho.js +1 -0
  62. package/app/assets/DPnYgSl3.js +1 -0
  63. package/app/assets/DU-Eln5x.js +1 -0
  64. package/app/assets/DY1k-USH.js +1 -0
  65. package/app/assets/DeNEO8HN.js +1 -0
  66. package/app/assets/DkqeIq13.js +1 -0
  67. package/app/assets/DnRoHgQS.js +1 -0
  68. package/app/assets/Dy6-E_uL.js +1 -0
  69. package/app/assets/DyQ8cEic.js +1 -0
  70. package/app/assets/DzRyVlxz.js +41 -0
  71. package/app/assets/FAouNaq9.js +1 -0
  72. package/app/assets/Nro86Y63.js +1 -0
  73. package/app/assets/Q6DQerac.js +8 -0
  74. package/app/assets/S7HbowYz.js +373 -0
  75. package/app/assets/UX-csQNt.js +2 -0
  76. package/app/assets/Udlj1Cgf.js +1 -0
  77. package/app/assets/{C0bzfYFC.js → XCH_yrJ8.js} +1 -1
  78. package/app/assets/_zaonxnw.js +1 -0
  79. package/app/assets/f6MhVR01.js +27 -0
  80. package/app/assets/tQiLT0zv.js +2 -0
  81. package/app/index.html +35 -27
  82. package/app/landing.css +17 -0
  83. package/dist/{chunk-XAI7WLQN.js → chunk-SDRLD5PK.js} +995 -121
  84. package/dist/embed.js +1 -1
  85. package/dist/index.js +1 -1
  86. package/package.json +6 -2
  87. package/app/assets/8RmjiG1u.js +0 -1
  88. package/app/assets/9kM6GVHV.js +0 -7
  89. package/app/assets/B2csuorb.js +0 -1
  90. package/app/assets/BCmzDvBt.js +0 -1
  91. package/app/assets/BHsXOlR9.js +0 -2
  92. package/app/assets/BO_H_8D-.js +0 -1
  93. package/app/assets/BRc4Nt6e.js +0 -1
  94. package/app/assets/BW4K9UH-.js +0 -1
  95. package/app/assets/BbdU8Zop.js +0 -2
  96. package/app/assets/BgkATqP8.js +0 -1
  97. package/app/assets/Bhquh17w.js +0 -959
  98. package/app/assets/Bjm-okwb.js +0 -1
  99. package/app/assets/Bs-p2SdN.js +0 -1
  100. package/app/assets/CF6jyexg.js +0 -41
  101. package/app/assets/CMoC9sLj.js +0 -1
  102. package/app/assets/COfwwXGO.js +0 -3
  103. package/app/assets/CS2mpWDL.js +0 -1
  104. package/app/assets/CUK2WAdf.js +0 -1
  105. package/app/assets/CVpOAP2j.js +0 -1
  106. package/app/assets/CVpzA8TC.js +0 -8
  107. package/app/assets/CZoj-eMm.js +0 -1
  108. package/app/assets/CbmIWIww.js +0 -1
  109. package/app/assets/CeXMO4BR.js +0 -1
  110. package/app/assets/Cf8o-5U6.js +0 -2
  111. package/app/assets/CiFkP-9S.js +0 -1
  112. package/app/assets/CpSudzcZ.js +0 -1
  113. package/app/assets/CqK9ewb_.js +0 -1
  114. package/app/assets/CrT26gRf.js +0 -1
  115. package/app/assets/D0jMUNSI.js +0 -2
  116. package/app/assets/D6kbK-ng.js +0 -1
  117. package/app/assets/DEEGN6UG.js +0 -6
  118. package/app/assets/DIJgEIiP.js +0 -27
  119. package/app/assets/DMRY-PmY.js +0 -1
  120. package/app/assets/DPdwSUSw.js +0 -1
  121. package/app/assets/DSmKDd5u.js +0 -1
  122. package/app/assets/DTDWV2fP.js +0 -2
  123. package/app/assets/DW8BZVdB.js +0 -1
  124. package/app/assets/DWMVPRon.js +0 -1
  125. package/app/assets/DbqogdCK.js +0 -356
  126. package/app/assets/Dc12Sye0.js +0 -1
  127. package/app/assets/DzVnJu74.js +0 -2
  128. package/app/assets/KuSp3gJs.css +0 -2
  129. package/app/assets/OjAiMU9J.js +0 -2
  130. package/app/assets/SFsWRs4-.js +0 -1
  131. package/app/assets/bgQ-QVd7.js +0 -1
  132. package/app/assets/fI8KJgQa.js +0 -1
  133. package/app/assets/hrOpaTVU.js +0 -1
  134. package/app/assets/p4yYbMPY.js +0 -2
  135. package/app/assets/pjlgs2cl.js +0 -1
  136. package/app/assets/pneb1la9.js +0 -1
  137. package/app/assets/qXWuX5B-.js +0 -1
  138. package/app/assets/useqs8Jk.js +0 -1
  139. package/app/assets/y4cmNs6-.js +0 -1
  140. package/app/assets/y664aOTm.js +0 -1
  141. package/app/assets/zspOy9D_.js +0 -2
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{i as r,n as i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,r as ee,t as u}from"./DzRyVlxz.js";import{t as d}from"./S7HbowYz.js";import{n as f}from"./DU-Eln5x.js";import{n as p,t as m}from"./D8_hwGjG.js";import{a as h}from"./BHe42P9W.js";import{a as g,f as _}from"./BvEGx3Si.js";import{It as v,Jt as y,Rt as b,Ut as x,Wt as S,f as C,h as w,ht as T,m as E,p as D}from"./B8zpsP_u.js";var O=i(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),k=e(t(),1);function A(e){let t=e.slice(e.indexOf(`(`)+1,e.lastIndexOf(`)`)),n=[],r=/'((?:[^']|'')*)'/g,i;for(;i=r.exec(t);)n.push(i[1].replaceAll(`''`,`'`));return n}function j(e,t={}){let{oracleDate:n=!1}=t,r=e.type.trim(),i=r.toLowerCase(),a=/\bunsigned\b/.test(i);if(/^enum\(/.test(i))return{kind:`enum`,options:A(r)};if(/^set\(/.test(i))return{kind:`set`,options:A(r)};if(/^(tinyint\(1\)|bool|boolean|bit\(1\)|bit)(?![\w(])/.test(i))return{kind:`boolean`};let o=/^number(?:\((\d+|\*)(?:,\s*(-?\d+))?\))?$/.exec(i);if(o)return o[2]&&Number(o[2])>0?{kind:`decimal`}:o[1]?{kind:`integer`}:{kind:`decimal`};if(/^(tinyint|smallint|mediumint|int|integer|bigint|int2|int4|int8|serial|bigserial|smallserial)\b/.test(i))return{kind:`integer`,unsigned:a};if(/^(decimal|numeric|float|double|real|money|float4|float8|double precision)\b/.test(i))return{kind:`decimal`,unsigned:a};if(/^(datetime2|datetime|timestamp|smalldatetime|datetimeoffset)\b/.test(i))return{kind:`datetime`};if(/^date\b/.test(i))return{kind:n?`datetime`:`date`};if(/^(time|timetz)\b/.test(i))return{kind:`time`};if(/^(json|jsonb)\b/.test(i))return{kind:`json`};if(/^(uuid|uniqueidentifier)\b/.test(i))return{kind:`uuid`};if(/^(blob|tinyblob|mediumblob|longblob|binary|varbinary|bytea|raw|image|bfile)\b/.test(i))return{kind:`binary`};if(/^(text|ntext|tinytext|mediumtext|longtext|clob|nclob|long)\b/.test(i)||/^n?(?:var)?char2?\(max\)/.test(i))return{kind:`text`};let s=/^n?(?:var)?char2?(?:acter)?(?:\s+varying)?\((\d+)(?:\s+(?:char|byte))?\)/.exec(i);return s?{kind:`string`,maxLength:Number(s[1])}:{kind:`string`}}var M=/auto_increment|identity|generated/i;function N(e){return M.test(e.extra)||/^(serial|bigserial|smallserial)\b/i.test(e.type)?{mode:`auto`,text:``}:e.defaultValue===null?e.nullable?{mode:`null`,text:``}:{mode:`value`,text:``}:{mode:`default`,text:``}}function P(e){return e==null?{mode:`keep`,text:``}:{mode:`keep`,text:F(e)}}function F(e){if(e==null)return``;if(typeof e==`object`){if(ArrayBuffer.isView(e))return``;if(e instanceof Date)return e.toISOString();try{return JSON.stringify(e,null,2)}catch{return String(e)}}return String(e)}function I(e,t){let n=t.trim();switch(e.kind){case`integer`:{if(!/^[+-]?\d+$/.test(n))return{error:`integer`};if(e.unsigned&&n.startsWith(`-`))return{error:`unsigned`};let t=Number(n);return{value:Number.isSafeInteger(t)?t:BigInt(n)}}case`decimal`:return n===``||Number.isNaN(Number(n))?{error:`number`}:{value:Number(n)};case`boolean`:return{value:n===`true`||n===`1`};case`json`:try{return{value:JSON.parse(n===``?`null`:n)}}catch{return{error:`json`}}case`set`:return{value:n};case`date`:return n&&!/^\d{4}-\d{2}-\d{2}$/.test(n)?{error:`date`}:{value:n};case`datetime`:return n&&!/^\d{4}-\d{2}-\d{2}([ T]\d{2}:\d{2}(:\d{2}(\.\d+)?)?)?([+-]\d{2}:?\d{2}|Z)?$/.test(n)?{error:`datetime`}:{value:n};case`time`:return n&&!/^-?\d{1,3}:\d{2}(:\d{2}(\.\d+)?)?$/.test(n)?{error:`time`}:{value:n};default:return{value:t}}}var L=a(),R={integer:`result.rowForm.invalid.integer`,unsigned:`result.rowForm.invalid.unsigned`,number:`result.rowForm.invalid.number`,json:`result.rowForm.invalid.json`,date:`result.rowForm.invalid.date`,datetime:`result.rowForm.invalid.datetime`,time:`result.rowForm.invalid.time`};function z(e){return String(e).padStart(2,`0`)}function B(e){let t=new Date,n=`${t.getFullYear()}-${z(t.getMonth()+1)}-${z(t.getDate())}`,r=`${z(t.getHours())}:${z(t.getMinutes())}:${z(t.getSeconds())}`;return e===`date`?n:e===`time`?r:`${n} ${r}`}function V(e){let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e.trim());if(!t)return;let n=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(n.getTime())?void 0:n}function H({spec:e,state:t,disabled:n,onText:i}){let{t:a}=r(),o=`w-full rounded border bg-background px-2 py-1 text-sm font-mono outline-none focus:ring-1 focus:ring-primary disabled:opacity-50`;switch(e.kind){case`boolean`:return(0,L.jsxs)(`select`,{className:o,value:t.text===`true`||t.text===`1`?`true`:`false`,onChange:e=>i(e.target.value),disabled:n,children:[(0,L.jsx)(`option`,{value:`true`,children:`TRUE`}),(0,L.jsx)(`option`,{value:`false`,children:`FALSE`})]});case`enum`:return(0,L.jsxs)(`select`,{className:o,value:t.text,onChange:e=>i(e.target.value),disabled:n,children:[!e.options?.includes(t.text)&&(0,L.jsx)(`option`,{value:t.text,children:t.text||`—`}),e.options?.map(e=>(0,L.jsx)(`option`,{value:e,children:e},e))]});case`set`:{let r=new Set(t.text.split(`,`).map(e=>e.trim()).filter(Boolean));return(0,L.jsx)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 rounded border bg-background px-2 py-1.5`,children:e.options?.map(t=>(0,L.jsxs)(`label`,{className:`flex items-center gap-1 text-xs font-mono`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-primary`,checked:r.has(t),disabled:n,onChange:n=>{let a=new Set(r);n.target.checked?a.add(t):a.delete(t),i(e.options.filter(e=>a.has(e)).join(`,`))}}),t]},t))})}case`integer`:case`decimal`:return(0,L.jsx)(`input`,{className:`${o} tabular-nums`,inputMode:`decimal`,value:t.text,onChange:e=>i(e.target.value),disabled:n,placeholder:e.kind===`integer`?`0`:`0.00`});case`date`:case`datetime`:{let[r,s]=t.text.trim().split(/[ T]/);return(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`input`,{className:`${o} flex-1`,value:t.text,onChange:e=>i(e.target.value),disabled:n,placeholder:e.kind===`date`?`YYYY-MM-DD`:`YYYY-MM-DD HH:MM:SS`}),(0,L.jsxs)(D,{children:[(0,L.jsx)(w,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background p-1.5 text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,title:a(`result.rowForm.pickDate`),children:(0,L.jsx)(y,{className:`size-3.5`})})}),(0,L.jsx)(E,{className:`w-auto p-0`,align:`end`,children:(0,L.jsx)(C,{mode:`single`,selected:V(r??``),defaultMonth:V(r??``),onSelect:t=>{if(!t)return;let n=`${t.getFullYear()}-${z(t.getMonth()+1)}-${z(t.getDate())}`;i(e.kind===`date`?n:`${n} ${s||`00:00:00`}`)}})})]}),(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background px-1.5 py-1 text-[10px] text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,onClick:()=>i(B(e.kind)),title:a(`result.rowForm.now`),children:(0,L.jsx)(x,{className:`size-3.5`})})]})}case`time`:return(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`input`,{className:`${o} flex-1`,value:t.text,onChange:e=>i(e.target.value),disabled:n,placeholder:`HH:MM:SS`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background px-1.5 py-1 text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,onClick:()=>i(B(`time`)),title:a(`result.rowForm.now`),children:(0,L.jsx)(x,{className:`size-3.5`})})]});case`json`:{let e=!0;try{t.text.trim()&&JSON.parse(t.text)}catch{e=!1}return(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`textarea`,{className:`${o} min-h-[96px] resize-y text-xs ${e?``:`border-destructive`}`,value:t.text,onChange:e=>i(e.target.value),disabled:n,spellCheck:!1,placeholder:`{}`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 rounded border bg-background px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n||!e||!t.text.trim(),onClick:()=>{try{i(JSON.stringify(JSON.parse(t.text),null,2))}catch{}},children:[(0,L.jsx)(O,{className:`size-3`}),a(`result.rowForm.formatJson`)]}),!e&&(0,L.jsx)(`span`,{className:`text-[10px] text-destructive`,children:a(`result.rowForm.invalid.json`)})]})]})}case`text`:return(0,L.jsx)(`textarea`,{className:`${o} min-h-[72px] resize-y`,value:t.text,onChange:e=>i(e.target.value),disabled:n,spellCheck:!1});case`binary`:return(0,L.jsx)(`div`,{className:`rounded border bg-muted/40 px-2 py-1 text-xs italic text-muted-foreground`,children:a(`result.rowForm.binaryUnsupported`)});case`uuid`:return(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsx)(`input`,{className:`${o} flex-1`,value:t.text,onChange:e=>i(e.target.value),disabled:n,placeholder:`00000000-0000-0000-0000-000000000000`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded border bg-background px-1.5 py-1 text-muted-foreground hover:text-foreground disabled:opacity-50`,disabled:n,onClick:()=>i(crypto.randomUUID()),title:a(`result.rowForm.generateUuid`),children:(0,L.jsx)(O,{className:`size-3.5`})})]});default:{let r=t.text.length>80||t.text.includes(`
2
+ `);return(0,L.jsxs)(`div`,{className:`space-y-0.5`,children:[r?(0,L.jsx)(`textarea`,{className:`${o} min-h-[56px] resize-y`,value:t.text,onChange:e=>i(e.target.value),disabled:n,spellCheck:!1}):(0,L.jsx)(`input`,{className:o,value:t.text,onChange:e=>i(e.target.value),disabled:n,maxLength:e.maxLength}),e.maxLength&&(0,L.jsxs)(`div`,{className:`text-right text-[10px] tabular-nums ${t.text.length>e.maxLength?`text-destructive`:`text-muted-foreground`}`,children:[t.text.length,`/`,e.maxLength]})]})}}}function U(){let{t:e}=r(),t=m(`row-form`),i=p(e=>e.closeDialog),a=p(e=>e.setFooterMessage),y=T(t?.connectionId??``),x=d(e=>t?e.transactionOpen[t.connectionId]:!1),[C,w]=(0,k.useState)(null),[E,D]=(0,k.useState)(null),[O,A]=(0,k.useState)({}),[M,F]=(0,k.useState)({}),[z,B]=(0,k.useState)(null),[V,U]=(0,k.useState)(!1),W=t?.mode===`edit`;(0,k.useEffect)(()=>{if(!t)return;let e=!1,n=h(t.serverConnectionId);return y.introspect.listColumns(n,t.database,t.table).then(n=>{if(e)return;w(n);let r={};for(let e of n)if(t.mode===`edit`){let n=t.fields.find(t=>t.orgName===e.name);r[e.name]=P(n?t.row?.[n.name]:void 0)}else r[e.name]=N(e);A(r)}).catch(t=>{e||D(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[t?.serverConnectionId,t?.database,t?.table,t?.mode]);let G=(0,k.useMemo)(()=>new Map((C??[]).map(e=>[e.name,j(e,{oracleDate:y.id===`oracle`})])),[C,y.id]),K=(0,k.useCallback)((e,t)=>{A(n=>({...n,[e]:{...n[e],mode:t}})),F(t=>{let n={...t};return delete n[e],n})},[]),q=(0,k.useCallback)((e,t)=>{A(n=>({...n,[e]:{mode:`value`,text:t}})),F(t=>{let n={...t};return delete n[e],n})},[]),J=(0,k.useMemo)(()=>({__default:!0}),[]),Y=(0,k.useCallback)(()=>{if(!C)return null;let t=new Map,n={};for(let r of C){let i=O[r.name],a=G.get(r.name);if(!i||i.mode===`auto`||i.mode===`keep`)continue;if(i.mode===`null`){t.set(r.name,null);continue}if(i.mode==="default"){t.set(r.name,J);continue}let o=I(a,i.text);if(`error`in o){n[r.name]=e(R[o.error]??`result.rowForm.invalid.number`);continue}if(a.maxLength&&typeof o.value==`string`&&o.value.length>a.maxLength){n[r.name]=e(`result.rowForm.invalid.length`,{max:a.maxLength});continue}t.set(r.name,o.value)}return F(n),Object.keys(n).length>0?null:{values:t}},[C,O,G,e,J]),X=(0,k.useCallback)(e=>{if(!t)return null;let n=e=>e===J?`DEFAULT`:y.quoteLiteral(e);if(t.mode===`insert`){let r=[...e];return r.length===0?y.getQuery(`INSERT_DEFAULT_VALUES`,t.database,t.table):y.getQuery(`INSERT_TABLE`,t.database,t.table,r.map(([e])=>y.quoteIdentifier(e)).join(`, `),r.map(([,e])=>n(e)).join(`, `))}return!t.where||e.size===0?null:y.getQuery(`UPDATE_TABLE`,t.database,t.table,[...e].map(([e,t])=>`${y.quoteIdentifier(e)} = ${n(t)}`).join(`, `),t.where)},[t,y,J]),Z=(0,k.useMemo)(()=>{if(!C)return``;let e=new Map;for(let t of C){let n=O[t.name];if(!(!n||n.mode===`auto`||n.mode===`keep`)){if(n.mode===`null`)e.set(t.name,null);else if(n.mode==="default")e.set(t.name,J);else{let r=I(G.get(t.name),n.text);e.set(t.name,`error`in r?n.text:r.value)}}}return X(e)??``},[C,O,G,X,J]),Q=e=>{let n={};for(let[r,i]of e){if(i===J)continue;let e=t?.fields.find(e=>e.orgName===r);n[e?.name??r]=typeof i==`bigint`?i.toString():i}return n},te=()=>{let e=Y();!e||!t||(t.onStage?.(t.mode,Q(e.values)),i())},ne=async()=>{let n=Y();if(!n||!t)return;let r=X(n.values);if(!r){B(e(`result.rowForm.nothingToWrite`));return}U(!0),B(null);try{if(f.getState().previewGridCommit&&!await p.getState().requestDestructiveConfirm({title:e(W?`result.rowForm.confirmUpdateTitle`:`result.rowForm.confirmInsertTitle`,{table:`${t.database}.${t.table}`}),statements:[r],confirmLabel:e(W?`result.rowForm.update`:`result.rowForm.insert`)}))return;await g(t.connectionId,r,{database:t.database,skipDestructiveConfirm:!0}),a(e(W?`result.rowForm.updated`:`result.rowForm.inserted`,{table:`${t.database}.${t.table}`})),t.onCommitted?.(t.mode,Q(n.values)),i()}catch(e){if(e instanceof _)return;B(e instanceof Error?e.message:String(e))}finally{U(!1)}};if(!t)return null;let $=(e,t,n,r)=>(0,L.jsx)(`button`,{type:`button`,className:`rounded px-1.5 py-0.5 text-[10px] font-medium ${r===t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`}`,onClick:()=>K(e,t),children:n});return(0,L.jsx)(u,{open:!0,onOpenChange:e=>{e||i()},children:(0,L.jsxs)(c,{className:`flex max-h-[90vh] flex-col sm:max-w-[860px]`,children:[(0,L.jsxs)(o,{children:[(0,L.jsx)(l,{children:e(W?`result.rowForm.editTitle`:`result.rowForm.insertTitle`)}),(0,L.jsxs)(ee,{className:`font-mono text-xs`,children:[t.database,`.`,t.table]})]}),(0,L.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto rounded-md border`,children:[E&&(0,L.jsx)(`div`,{className:`rounded border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:E}),!C&&!E&&(0,L.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground`,children:[(0,L.jsx)(v,{className:`size-4 animate-spin`}),e(`result.rowForm.loading`)]}),C&&(0,L.jsxs)(`table`,{className:`w-full border-separate border-spacing-0 text-sm`,children:[(0,L.jsx)(`thead`,{className:`sticky top-0 z-10 bg-background`,children:(0,L.jsxs)(`tr`,{className:`text-left text-[10px] uppercase tracking-wide text-muted-foreground`,children:[(0,L.jsx)(`th`,{className:`w-[38%] border-b px-2 py-1.5 font-medium`,children:e(`result.rowForm.colColumn`)}),(0,L.jsx)(`th`,{className:`border-b px-2 py-1.5 font-medium`,children:e(`result.rowForm.colValue`)})]})}),(0,L.jsx)(`tbody`,{children:C.map(n=>{let r=O[n.name]??{mode:`value`,text:``},i=G.get(n.name),a=r.mode===`auto`,o=M[n.name],s=n.key===`PRI`,c=t.fields.find(e=>e.orgName===n.name),l=!!c&&!!t.row&&t.row[c.name]===null;return(0,L.jsxs)(`tr`,{className:`align-top ${o?`bg-destructive/5`:`hover:bg-muted/30`}`,children:[(0,L.jsxs)(`td`,{className:`border-b border-border/60 px-2 py-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)(`span`,{className:`truncate font-mono text-sm font-medium`,title:n.name,children:n.name}),s&&(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 rounded border border-catppuccin-yellow/50 px-1 text-[9px] font-semibold text-catppuccin-yellow`,children:[(0,L.jsx)(b,{className:`size-2.5`}),`PK`]})]}),(0,L.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[10px] text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`rounded bg-muted px-1 py-px font-mono`,children:n.type}),!n.nullable&&(0,L.jsx)(`span`,{children:`NOT NULL`}),n.defaultValue!==null&&(0,L.jsxs)(`span`,{className:`font-mono`,title:e(`result.rowForm.defaultValue`),children:[`= `,n.defaultValue]}),n.extra&&(0,L.jsx)(`span`,{children:n.extra})]}),n.comment&&(0,L.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground/80`,children:n.comment})]}),(0,L.jsx)(`td`,{className:`border-b border-border/60 px-2 py-2`,children:(0,L.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r.mode===`keep`?(0,L.jsx)(`div`,{className:`cursor-text truncate rounded border border-dashed bg-muted/30 px-2 py-1 font-mono text-xs text-muted-foreground`,onClick:()=>K(n.name,`value`),title:e(`result.rowForm.clickToChange`),children:l?(0,L.jsx)(`span`,{className:`italic`,children:`NULL`}):r.text||(0,L.jsx)(`span`,{className:`italic`,children:e(`result.rowForm.empty`)})}):r.mode===`value`?(0,L.jsx)(H,{spec:i,state:r,disabled:!1,onText:e=>q(n.name,e)}):(0,L.jsx)(`div`,{className:`rounded border border-dashed bg-muted/30 px-2 py-1 font-mono text-xs italic text-muted-foreground`,children:r.mode===`null`?`NULL`:r.mode==="default"?`DEFAULT (${n.defaultValue??``})`:e(`result.rowForm.autoHint`)}),o&&(0,L.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-[11px] text-destructive`,children:[(0,L.jsx)(S,{className:`size-3`}),o]})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded border bg-background p-0.5`,children:[W&&$(n.name,`keep`,e(`result.rowForm.mode.keep`),r.mode),(a||!W&&/auto_increment|identity/i.test(n.extra))&&$(n.name,`auto`,e(`result.rowForm.mode.auto`),r.mode),$(n.name,`value`,e(`result.rowForm.mode.value`),r.mode),n.nullable&&$(n.name,`null`,`NULL`,r.mode),n.defaultValue!==null&&$(n.name,`default`,`DEFAULT`,r.mode)]})]})})]},n.name)})})]})]}),C&&(0,L.jsxs)(`div`,{className:`shrink-0 rounded-md border bg-muted/30`,children:[(0,L.jsx)(`div`,{className:`border-b px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e(`result.rowForm.preview`)}),(0,L.jsx)(`pre`,{className:`max-h-24 overflow-auto whitespace-pre-wrap break-words px-3 py-2 font-mono text-xs`,children:Z||(0,L.jsx)(`span`,{className:`italic text-muted-foreground`,children:e(`result.rowForm.nothingToWrite`)})})]}),z&&(0,L.jsx)(`div`,{className:`shrink-0 rounded border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:z}),(0,L.jsxs)(s,{className:`items-center`,children:[x&&(0,L.jsx)(`span`,{className:`mr-auto text-[11px] text-catppuccin-yellow`,children:e(`result.rowForm.inTransaction`)}),(0,L.jsx)(n,{variant:`outline`,onClick:()=>i(),disabled:V,children:e(`command.close`)}),t.onStage&&(0,L.jsx)(n,{variant:`outline`,onClick:te,disabled:V||!C,title:e(`result.rowForm.stageHint`),children:e(W?`result.rowForm.stageEdit`:`result.rowForm.stageInsert`)}),(0,L.jsxs)(n,{onClick:()=>void ne(),disabled:V||!C,children:[V&&(0,L.jsx)(v,{className:`mr-1 size-3.5 animate-spin`}),e(W?`result.rowForm.update`:`result.rowForm.insert`)]})]})]})})}export{U as RowFormDialog};
@@ -0,0 +1 @@
1
+ import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,r as s,t as c}from"./DzRyVlxz.js";import"./DU-Eln5x.js";import{n as l}from"./D8_hwGjG.js";import{Y as u}from"./B8zpsP_u.js";var d=`<a href="mailto:planche.dev@gmail.com">planche.dev@gmail.com</a>`,f=`2 September 2026`,p=`Planche is made and operated by <strong>deploy</strong>, a sole proprietorship registered in the Republic of Korea and owned by Juwon Jeong (“we”, “us”), at 1114 Gyeongui-ro, 4th floor, Room 405, Paju-si, Gyeonggi-do, Republic of Korea. Contact: ${d}.`,m={title:`Terms of Service — Planche`,description:`The terms under which the Planche SQL client, the local agent and Planche Pro are provided.`,ogTitle:`Planche terms of service`,h1:`Terms of Service`,intro:`Last updated ${f}. These terms cover the website and web application at planche.dev, the local agent published on npm as <code>planche</code> and by the install scripts, and the Planche Pro subscription. By using any of them you agree to these terms. ${p}`,cta:`Open Planche`,static:!0,sections:[{heading:`1. What Planche is`,body:[`Planche is a SQL client. The application runs in your browser. For MySQL, MariaDB, PostgreSQL, SQL Server, Oracle and the hosted services it supports, a small program — the local agent — runs on your own computer, holds the database connections and answers the browser over the loopback interface. SQLite files are opened inside the browser itself.`,`We host the application as a static site and nothing else. Your connection profiles, passwords, queries and results travel between your browser, the agent on your machine and your databases; none of them pass through a server of ours. The <a href="{privacy}">privacy policy</a> lists the few things that do reach us or a service we use.`,`Planche is free to use for personal and commercial purposes without an account. A set of advanced features, listed on the <a href="{pricing}">pricing page</a>, requires a Pro licence.`]},{heading:`2. Licence to use the software`,body:[`We grant you a non-exclusive, non-transferable licence to use the Planche application and the local agent, on any number of computers you own or control, for the purpose of working with databases you are authorised to access.`,`You may not redistribute, sell, rent or sublicense Planche or the agent, offer either to third parties as part of a product or service, modify or create derivative works of them, reverse engineer or decompile them except where the law grants you that right regardless of this clause, or remove any copyright or proprietary notice. Planche is proprietary software; it is not open source.`,`The agent package ships with its own licence agreement (the <code>LICENSE</code> file in the package). For the agent, that agreement applies together with these terms; if the two differ, the package licence prevails for the copy you installed.`,`Planche includes third-party open-source components, each under its own licence. Those licences govern those components and nothing here limits the rights they give you. The list is at <a href="/third-party-notices.txt">third-party-notices.txt</a>.`]},{heading:`3. Planche Pro`,body:[`Pro is a subscription, billed monthly or yearly, that unlocks the features listed on the <a href="{pricing}">pricing page</a>. It is sold through a payment provider acting as our merchant of record and authorised reseller: the provider is the seller on the transaction, processes the payment, and collects and remits any VAT or sales tax that applies. The provider’s name, the price, the currency and any tax are shown at checkout before you pay, and the provider’s own terms apply to the purchase itself.`,`After payment you receive a licence key, on the order page and by email. A key is a signed statement of who bought it, which plan and for which period; the application verifies it on your computer without contacting anyone. A key covers <strong>one person</strong> on every computer that person uses. It may not be shared, published, or resold, and a key found published may be excluded from renewal. For several people, buy one licence each or write to us about a team licence.`,`Because a key is verified offline, it cannot be withdrawn before it expires. Keys are therefore issued for exactly the period that was paid for. While your subscription stays paid you receive a key that covers each new period; when it ends, the Pro features stop at the end of the last paid period and everything else keeps working. Nothing you have stored — profiles, history, saved files — is touched.`,`You can cancel at any time from the customer portal linked in your receipt, or by writing to us. Cancelling stops future charges; the current period runs to its end. Refunds are described in the <a href="{refund}">refund policy</a>.`,`If we change the price of Pro, the new price applies from your next renewal at the earliest, and we tell you by email at least 30 days before that renewal so you can cancel first.`]},{heading:`4. Connection sync`,body:[`Connection sync is an optional Pro feature that keeps your connection profiles on more than one computer. Using it means signing in with a GitHub or Google account; that is the only case in which an account exists. Your profiles are encrypted in the browser with a passphrase you choose before they are uploaded, and the passphrase never leaves your machine. We cannot read the vault and we cannot recover it if you lose the passphrase.`,`Sync is only offered on planche.dev. You can delete your account and vault from the application at any time, or by writing to us. We may discontinue sync with at least 30 days’ notice, during which your profiles remain available on every signed-in computer.`]},{heading:`5. AI features`,body:[`Some features can ask a language model to explain a failed statement or a query plan. They only work if you configure a provider, and what is sent goes from the agent on your computer directly to that provider, under that provider’s terms and privacy policy — not through us. The material sent is narrow: the statement with its secrets masked, the database’s own error message, and the column names of the tables the statement refers to. No rows, hosts or credentials.`,`A model’s answer can be wrong. Suggested statements are shown for you to review; running them is your decision, and section 7 applies to it.`]},{heading:`6. Acceptable use`,body:[`You may only use Planche with databases you own or are authorised to access. You may not use it to gain access you do not have, to interfere with a service, or in breach of any law that applies to you. You may not circumvent or disable the licence check, and you may not expose the local agent to the network in a way that lets others use it as a proxy to your databases or to other hosts.`]},{heading:`7. Your data, your responsibility`,body:[`Planche executes the SQL you give it, and SQL can change or delete data. The safeguards in the application — read-only connections, confirmation of destructive statements, dry run — are aids and not guarantees. You are responsible for keeping backups of your databases and for reviewing statements before you run them, and we accept no responsibility for the effect of a statement you ran.`,`Planche stores your connection profiles, and if you choose so your passwords, in your browser’s storage and, for the agent, in a directory under your home folder. Protecting that computer is your responsibility.`]},{heading:`8. Changes to the service`,body:[`We improve Planche continuously and may add, change or remove features. A feature that is free today may become part of Pro in a later version; a version you already have keeps working as it did. We may stop offering the hosted application at planche.dev; the agent can serve its own copy of the application, so an installed Planche keeps working without it.`]},{heading:`9. No warranty`,body:[`PLANCHE IS PROVIDED “AS IS” AND “AS AVAILABLE”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. We do not promise that it will be uninterrupted, error-free or compatible with every database version.`]},{heading:`10. Limitation of liability`,body:[`TO THE EXTENT PERMITTED BY LAW, WE ARE NOT LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES, OR FOR LOSS OF DATA, PROFITS OR BUSINESS, ARISING FROM OR IN CONNECTION WITH PLANCHE. OUR TOTAL LIABILITY FOR ALL CLAIMS TOGETHER IS LIMITED TO THE AMOUNT YOU PAID US FOR PLANCHE IN THE TWELVE MONTHS BEFORE THE CLAIM AROSE.`,`Nothing in these terms excludes or limits liability that cannot be excluded under the law that applies to you, including liability for intent or gross negligence, or any right you have as a consumer under mandatory law.`]},{heading:`11. Termination`,body:[`You can stop using Planche at any time; there is no account to close unless you use sync. We may end your licence if you materially breach these terms, in which case you must stop using the software. Sections 7, 9, 10 and 13 survive termination.`]},{heading:`12. Changes to these terms`,body:[`We may update these terms. The date at the top says when they last changed. A change that affects Pro subscribers materially is announced by email at least 30 days before it takes effect; continued use after that date is acceptance. If you do not agree, cancel before the change takes effect.`]},{heading:`13. Governing law`,body:[`These terms are governed by the laws of the Republic of Korea, and disputes are subject to the courts of Seoul, Republic of Korea. If you are a consumer, this does not take away the protection of the mandatory consumer laws of the country you live in, or your right to bring a claim there.`]},{heading:`14. Contact`,body:[`Questions about these terms: ${d}.`]}]};`${f}${p}`,`${d}`,`${f}${p}`,`${d}`,`${d}`;var h=m.sections,g=n();function _(e){return e.replace(/\{([a-z]+)\}/g,(e,t)=>t in u?u[t]:e).replace(/<a href="/g,`<a target="_blank" rel="noreferrer" href="`)}function v(){let n=l(e=>e.activeDialog),d=l(e=>e.closeDialog),{t:p}=t();return(0,g.jsx)(c,{open:n===`terms`,onOpenChange:e=>{e||d()},children:(0,g.jsxs)(a,{className:`flex max-h-[85vh] flex-col sm:max-w-[640px]`,children:[(0,g.jsxs)(r,{children:[(0,g.jsx)(o,{children:p(`terms.title`)}),(0,g.jsxs)(s,{children:[p(`terms.version`,{version:1}),` · `,p(`terms.updated`,{date:f})]})]}),(0,g.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-md border bg-muted/40 p-4 text-sm`,children:[(0,g.jsx)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:p(`terms.englishOnly`)}),h.map(e=>(0,g.jsxs)(`section`,{className:`mb-4 last:mb-0`,children:[(0,g.jsx)(`h3`,{className:`mb-1 font-semibold`,children:e.heading}),e.body.map((e,t)=>(0,g.jsx)(`p`,{className:`mb-2 leading-relaxed text-muted-foreground last:mb-0 [&_a]:underline [&_a]:underline-offset-2 [&_code]:rounded [&_code]:bg-muted [&_code]:px-1`,dangerouslySetInnerHTML:{__html:_(e)}},t))]},e.heading))]}),(0,g.jsxs)(i,{className:`sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs`,children:[(0,g.jsx)(`a`,{href:u.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.online`)}),(0,g.jsx)(`a`,{href:u.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.privacyLink`)}),(0,g.jsx)(`a`,{href:u.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.refundLink`)})]}),(0,g.jsx)(e,{onClick:d,children:p(`settings.done`)})]})]})})}export{v as TermsDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{a as n,d as r,i,s as a,u as o}from"./CiL8zoYm.js";import{r as s}from"./Cu_sGzNJ.js";import{r as c,t as l}from"./BGuDcBB_.js";import{C as u,D as d,E as f,O as p,S as m,T as h,_ as g,b as _,g as v,v as y,w as b,x,y as S}from"./DzRyVlxz.js";import{n as C,t as w}from"./D8dVzi6I.js";import{t as T}from"./BFw3KCAr.js";import{Kt as E,an as D,in as O,on as k,qt as A,sn as j}from"./B8zpsP_u.js";var M=e(r(),1),N=e(t(),1),P=Object.defineProperty,ee=(e,t)=>P(e,`name`,{value:t,configurable:!0});function F(e){let t=N.useRef({value:e,previous:e});return N.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}ee(F,`usePrevious`);var I=s(),L=Object.defineProperty,R=(e,t)=>L(e,`name`,{value:t,configurable:!0}),z=[` `,`Enter`,`ArrowUp`,`ArrowDown`],B=[` `,`Enter`],V=`Select`,[H,U,W]=l(V),[G,te]=p(V,[W,j]),K=j(),[ne,q]=G(V),[re,ie]=G(V);function J(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:d,autoComplete:f,disabled:p,required:m,form:g,internal_do_not_use_render:_}=e,v=K(t),[y,b]=N.useState(null),[x,S]=N.useState(null),[w,T]=N.useState(!1),E=C(l),[D,O]=h({prop:r,defaultProp:i??!1,onChange:a,caller:V}),[A,j]=h({prop:o,defaultProp:s,onChange:c,caller:V}),M=N.useRef(null),P=N.useRef(A);N.useEffect(()=>{let e=g?y?.ownerDocument.getElementById(g):y?.form;if(e instanceof HTMLFormElement){let t=R(()=>j(P.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[g,y,j]);let ee=!y||!!g||!!y.closest(`form`),[F,L]=N.useState(new Set),z=u(),B=Array.from(F).map(e=>e.props.value).join(`;`),U=N.useCallback(e=>{L(t=>new Set(t).add(e))},[]),W=N.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:m,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:z,value:A,onValueChange:j,open:D,onOpenChange:O,dir:E,triggerPointerDownPosRef:M,disabled:p,name:d,autoComplete:f,form:g,nativeOptions:F,nativeSelectKey:B,isFormControl:ee};return(0,I.jsx)(k,{...v,children:(0,I.jsx)(ne,{scope:t,...G,children:(0,I.jsx)(H.Provider,{scope:t,children:(0,I.jsx)(re,{scope:t,onNativeOptionAdd:U,onNativeOptionRemove:W,children:Ve(_)?_(G):n})})})})}R(J,`SelectProvider`);var ae=R(e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,I.jsx)(J,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,I.jsxs)(I.Fragment,{children:[n,e?(0,I.jsx)(Be,{__scopeSelect:t}):null]})})},`Select`),oe=`SelectTrigger`,se=N.forwardRef(R(function(e,t){let{__scopeSelect:r,disabled:i=!1,...a}=e,s=K(r),c=q(oe,r),l=c.disabled||i,u=o(t,c.onTriggerChange),f=U(r),p=N.useRef(`touch`),[m,h,g]=He(e=>{let t=f().filter(e=>!e.disabled),n=Ue(t,e,t.find(e=>e.value===c.value));n!==void 0&&c.onValueChange(n.value)}),_=R(e=>{l||(c.onOpenChange(!0),g()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})},`handleOpen`);return(0,I.jsx)(O,{asChild:!0,...s,children:(0,I.jsx)(n.button,{type:`button`,role:`combobox`,"aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":`none`,dir:c.dir,"data-state":c.open?`open`:`closed`,disabled:l,"data-disabled":l?``:void 0,"data-placeholder":$(c.value)?``:void 0,...a,ref:u,onClick:d(a.onClick,e=>{e.currentTarget.focus(),p.current!==`mouse`&&_(e)}),onPointerDown:d(a.onPointerDown,e=>{p.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:d(a.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&z.includes(e.key)&&(_(),e.preventDefault())})})})},`SelectTrigger`)),ce=`SelectValue`,le=N.forwardRef(R(function(e,t){let{__scopeSelect:r,className:i,style:a,children:s,placeholder:c=``,...l}=e,u=q(ce,r),{onValueNodeHasChildrenChange:d}=u,p=s!==void 0,m=o(t,u.onValueNodeChange);f(()=>{d(p)},[d,p]);let h=$(u.value);return(0,I.jsx)(n.span,{...l,asChild:!h&&l.asChild,ref:m,style:{pointerEvents:`none`},children:(0,I.jsx)(N.Fragment,{children:h?c:s},h?`placeholder`:`value`)})},`SelectValue`)),ue=N.forwardRef(R(function(e,t){let{__scopeSelect:r,children:i,...a}=e;return(0,I.jsx)(n.span,{"aria-hidden":!0,...a,ref:t,children:i||`▼`})},`SelectIcon`)),[de,fe]=G(`SelectPortal`,{forceMount:void 0}),pe=R(e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,I.jsx)(de,{scope:e.__scopeSelect,forceMount:n,children:(0,I.jsx)(S,{asChild:!0,...r})})},`SelectPortal`),Y=`SelectContent`,me=N.forwardRef(R(function(e,t){let n=fe(Y,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=q(Y,e.__scopeSelect),[o,s]=N.useState();return f(()=>{s(new DocumentFragment)},[]),(0,I.jsx)(b,{present:r||a.open,children:({present:e})=>e?(0,I.jsx)(ve,{...i,ref:t}):(0,I.jsx)(he,{...i,fragment:o})})},`SelectContent`)),he=N.forwardRef(R(function(e,t){let{__scopeSelect:n,children:r,fragment:i}=e;return i?M.createPortal((0,I.jsx)(ge,{scope:n,children:(0,I.jsx)(H.Slot,{scope:n,children:(0,I.jsx)(`div`,{ref:t,children:r})})}),i):null},`SelectContentFragment`)),X=10,[ge,Z]=G(Y),_e=a(`SelectContent.RemoveScroll`),ve=N.forwardRef(R(function(e,t){let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:b,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=q(Y,n),[E,D]=N.useState(null),[O,k]=N.useState(null),A=o(t,D),[j,M]=N.useState(null),[P,ee]=N.useState(null),F=U(n),[L,z]=N.useState(!1),B=N.useRef(!1);N.useEffect(()=>{if(E)return v(E)},[E]),y();let V=N.useCallback(e=>{let[t,...n]=F().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[F,O]),H=N.useCallback(()=>V([j,E]),[V,j,E]);N.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:W,triggerPointerDownPosRef:G}=T;N.useEffect(()=>{if(E){let e={x:0,y:0},t=R(t=>{e={x:Math.abs(Math.round(t.pageX)-(G.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(G.current?.y??0))}},`handlePointerMove`),n=R(n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||W(!1),document.removeEventListener(`pointermove`,t),G.current=null},`handlePointerUp`);return G.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,W,G]),N.useEffect(()=>{let e=R(()=>W(!1),`close`);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[W]);let[te,K]=He(e=>{let t=F().filter(e=>!e.disabled),n=Ue(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ne=N.useCallback((e,t,n)=>{let r=!B.current&&!n;(T.value!==void 0&&T.value===t||r)&&(M(e),r&&(B.current=!0))},[T.value]),re=N.useCallback(()=>E?.focus(),[E]),ie=N.useCallback((e,t,n)=>{let r=!B.current&&!n;(T.value!==void 0&&T.value===t||r)&&ee(e)},[T.value]),J=r===`popper`?be:ye,ae=J===be?{side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:b,hideWhenDetached:S,avoidCollisions:C}:{};return(0,I.jsx)(ge,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:ne,selectedItem:j,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:H,selectedItemText:P,position:r,isPositioned:L,searchRef:te,children:(0,I.jsx)(g,{as:_e,allowPinchZoom:!0,children:(0,I.jsx)(_,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:d(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,I.jsx)(x,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,I.jsx)(J,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ae,onPlaced:()=>z(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:d(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&K(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=F().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})},`SelectContentImpl`)),ye=N.forwardRef(R(function(e,t){let{__scopeSelect:r,onPlaced:i,...a}=e,s=q(Y,r),c=Z(Y,r),[l,u]=N.useState(null),[d,p]=N.useState(null),m=o(t,p),h=U(r),g=N.useRef(!1),_=N.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=c,S=N.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&v&&y&&b){let e=s.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),r=b.getBoundingClientRect();if(s.dir!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),u=window.innerWidth-X,d=w(a,[X,Math.max(X,u-c)]);l.style.minWidth=s+`px`,l.style.left=d+`px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),u=window.innerWidth-X,d=w(a,[X,Math.max(X,u-c)]);l.style.minWidth=s+`px`,l.style.right=d+`px`}let a=h(),o=window.innerHeight-X*2,c=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=f+p+c+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),T=parseInt(C.paddingTop,10),E=parseInt(C.paddingBottom,10),D=e.top+e.height/2-X,O=o-D,k=y.offsetHeight/2,A=y.offsetTop+k,j=f+p+A,M=x-j;if(j<=D){let e=a.length>0&&y===a[a.length-1].ref.current;l.style.bottom=`0px`;let t=d.clientHeight-v.offsetTop-v.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+m);l.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;l.style.top=`0px`;let t=Math.max(D,f+v.offsetTop+(e?T:0)+k)+M;l.style.height=t+`px`,v.scrollTop=j-D+v.offsetTop}l.style.margin=`${X}px 0`,l.style.minHeight=S+`px`,l.style.maxHeight=o+`px`,i?.(),requestAnimationFrame(()=>g.current=!0)}},[h,s.trigger,s.valueNode,l,d,v,y,b,s.dir,i]);f(()=>S(),[S]);let[C,T]=N.useState();f(()=>{d&&T(window.getComputedStyle(d).zIndex)},[d]);let E=N.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]);return(0,I.jsx)(xe,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:E,children:(0,I.jsx)(`div`,{ref:u,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,I.jsx)(n.div,{...a,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})},`SelectItemAlignedPosition`)),be=N.forwardRef(R(function(e,t){let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=K(n);return(0,I.jsx)(D,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})},`SelectPopperPosition`)),[xe,Se]=G(Y,{}),Ce=`SelectViewport`,we=N.forwardRef(R(function(e,t){let{__scopeSelect:r,nonce:i,...a}=e,s=Z(Ce,r),c=Se(Ce,r),l=o(t,s.onViewportChange),u=N.useRef(0);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,I.jsx)(H.Slot,{scope:r,children:(0,I.jsx)(n.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:l,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:d(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=c;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})},`SelectViewport`)),[Te,Ee]=G(`SelectGroup`),De=`SelectItem`,[Oe,ke]=G(De),Ae=N.forwardRef(R(function(e,t){let{__scopeSelect:r,value:i,disabled:a=!1,textValue:s,...c}=e,l=q(De,r),f=Z(De,r),p=l.value===i,[h,g]=N.useState(s??``),[_,v]=N.useState(!1),y=m(e=>f.itemRefCallback?.(e,i,a)),b=o(t,y),x=u(),S=N.useRef(`touch`),C=R(()=>{a||(l.onValueChange(i),l.onOpenChange(!1))},`handleSelect`);return(0,I.jsx)(Oe,{scope:r,value:i,disabled:a,textId:x,isSelected:p,onItemTextChange:N.useCallback(e=>{g(t=>t||(e?.textContent??``).trim())},[]),children:(0,I.jsx)(H.ItemSlot,{scope:r,value:i,disabled:a,textValue:h,children:(0,I.jsx)(n.div,{role:`option`,"aria-labelledby":x,"data-highlighted":_?``:void 0,"aria-selected":p&&_,"data-state":p?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...c,ref:b,onFocus:d(c.onFocus,()=>v(!0)),onBlur:d(c.onBlur,()=>v(!1)),onClick:d(c.onClick,()=>{S.current!==`mouse`&&C()}),onPointerUp:d(c.onPointerUp,()=>{S.current===`mouse`&&C()}),onPointerDown:d(c.onPointerDown,e=>{S.current=e.pointerType}),onPointerMove:d(c.onPointerMove,e=>{S.current=e.pointerType,a?f.onItemLeave?.():S.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:d(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:d(c.onKeyDown,e=>{a||e.target!==e.currentTarget||(f.searchRef?.current===``||e.key!==` `)&&(B.includes(e.key)&&C(),e.key===` `&&e.preventDefault())})})})})},`SelectItem`)),Q=`SelectItemText`,je=N.forwardRef(R(function(e,t){let{__scopeSelect:r,className:i,style:a,...s}=e,c=q(Q,r),l=Z(Q,r),u=ke(Q,r),d=ie(Q,r),[p,h]=N.useState(null),g=m(e=>l.itemTextRefCallback?.(e,u.value,u.disabled)),_=o(t,h,u.onItemTextChange,g),v=p?.textContent,y=N.useMemo(()=>(0,I.jsx)(`option`,{value:u.value,disabled:u.disabled,children:v},u.value),[u.disabled,u.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return f(()=>(b(y),()=>x(y)),[b,x,y]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(n.span,{id:u.textId,...s,ref:_}),u.isSelected&&c.valueNode&&!c.valueNodeHasChildren&&!$(c.value)?M.createPortal(s.children,c.valueNode):null]})},`SelectItemText`)),Me=`SelectItemIndicator`,Ne=N.forwardRef(R(function(e,t){let{__scopeSelect:r,...i}=e;return ke(Me,r).isSelected?(0,I.jsx)(n.span,{"aria-hidden":!0,...i,ref:t}):null},`SelectItemIndicator`)),Pe=`SelectScrollUpButton`,Fe=N.forwardRef(R(function(e,t){let n=Z(Pe,e.__scopeSelect),r=Se(Pe,e.__scopeSelect),[i,a]=N.useState(!1),s=o(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Re,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null},`SelectScrollUpButton`)),Ie=`SelectScrollDownButton`,Le=N.forwardRef(R(function(e,t){let n=Z(Ie,e.__scopeSelect),r=Se(Ie,e.__scopeSelect),[i,a]=N.useState(!1),s=o(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};R(e,`handleScroll`);let t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,I.jsx)(Re,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null},`SelectScrollDownButton`)),Re=N.forwardRef(R(function(e,t){let{__scopeSelect:r,onAutoScroll:i,...a}=e,o=Z(`SelectScrollButton`,r),s=N.useRef(null),c=U(r),l=N.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return N.useEffect(()=>()=>l(),[l]),f(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,I.jsx)(n.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:d(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(i,50))}),onPointerMove:d(a.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(i,50))}),onPointerLeave:d(a.onPointerLeave,()=>{l()})})},`SelectScrollButtonImpl`)),ze=`SelectBubbleInput`,Be=N.forwardRef(R(function({__scopeSelect:e,...t},r){let i=q(ze,e),{value:a,onValueChange:s,required:l,disabled:u,name:d,autoComplete:f,form:p}=i,{nativeOptions:m,nativeSelectKey:h}=i,g=N.useRef(null),_=o(r,g),v=a??``,y=F(v),b=Array.from(m).some(e=>(e.props.value??``)===``);return N.useEffect(()=>{let e=g.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(y!==v&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,v),e.dispatchEvent(t)}},[y,v]),(0,I.jsxs)(n.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:d,autoComplete:f,disabled:u,form:p,onChange:e=>s(e.target.value),...t,style:{...c,...t.style},ref:_,defaultValue:v,children:[$(a)&&!b?(0,I.jsx)(`option`,{value:``}):null,Array.from(m)]},h)},`SelectBubbleInput`));function Ve(e){return typeof e==`function`}R(Ve,`isFunction`);function $(e){return e===``||e===void 0}R($,`shouldShowPlaceholder`);function He(e){let t=m(e),n=N.useRef(``),r=N.useRef(0),i=N.useCallback(e=>{let i=n.current+e;t(i),R((function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(i)},[t]),a=N.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return N.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}R(He,`useTypeaheadSearch`);function Ue(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=We(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}R(Ue,`findNextItem`);function We(e,t){return e.map((n,r)=>e[(t+r)%e.length])}R(We,`wrapArray`);function Ge({...e}){return(0,I.jsx)(ae,{"data-slot":`select`,...e})}function Ke({...e}){return(0,I.jsx)(le,{"data-slot":`select-value`,...e})}function qe({className:e,size:t=`default`,children:n,...r}){return(0,I.jsxs)(se,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,I.jsx)(ue,{asChild:!0,children:(0,I.jsx)(E,{className:`size-4 opacity-50`})})]})}function Je({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,I.jsx)(pe,{children:(0,I.jsxs)(me,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,I.jsx)(Xe,{}),(0,I.jsx)(we,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,I.jsx)(Ze,{})]})})}function Ye({className:e,children:t,...n}){return(0,I.jsxs)(Ae,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,I.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,I.jsx)(Ne,{children:(0,I.jsx)(A,{className:`size-4`})})}),(0,I.jsx)(je,{children:t})]})}function Xe({className:e,...t}){return(0,I.jsx)(Fe,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(T,{className:`size-4`})})}function Ze({className:e,...t}){return(0,I.jsx)(Le,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,I.jsx)(E,{className:`size-4`})})}export{Ke as a,qe as i,Je as n,Ye as r,Ge as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./CYz610vE.js";import{t}from"./CiL8zoYm.js";import{r as n,t as r}from"./BniymiMs.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./DzRyVlxz.js";import{a as f,i as p,n as m,r as h,t as g}from"./D4l4mWtD.js";import{n as _}from"./DU-Eln5x.js";import{n as v}from"./D8_hwGjG.js";import{t as y}from"./6NUleTnS.js";var b=a();function x(){let a=v(e=>e.activeDialog),x=v(e=>e.closeDialog),S=_(),{t:C}=i();return(0,b.jsx)(d,{open:a===`general-settings`,onOpenChange:e=>{e||x()},children:(0,b.jsxs)(c,{className:`sm:max-w-[560px]`,children:[(0,b.jsxs)(o,{children:[(0,b.jsx)(l,{children:C(`settings.general.title`)}),(0,b.jsx)(u,{children:C(`settings.general.description`)})]}),(0,b.jsxs)(`div`,{className:`grid gap-2`,children:[(0,b.jsx)(y,{id:`s-history`,checked:S.persistQueryHistory,onChange:e=>S.setPersistQueryHistory(e),label:C(`settings.persistHistory`),hint:C(`settings.persistHistoryHint`)}),(0,b.jsxs)(`div`,{className:`grid grid-cols-[1fr_200px] items-center gap-3 rounded-md border p-3`,children:[(0,b.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,b.jsx)(`span`,{className:`text-sm font-medium`,children:C(`settings.language`)}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:C(`settings.languageHint`)})]}),(0,b.jsxs)(g,{value:S.locale,onValueChange:e=>S.setLocale(e),children:[(0,b.jsx)(p,{children:(0,b.jsx)(f,{})}),(0,b.jsxs)(m,{children:[(0,b.jsx)(h,{value:`auto`,children:C(`language.auto`,{name:C(`language.${n()}`)})}),r.map(e=>(0,b.jsx)(h,{value:e,children:C(`language.${e}`)},e))]})]})]}),(0,b.jsx)(y,{id:`s-analytics`,checked:S.analyticsEnabled,onChange:S.setAnalyticsEnabled,label:C(`settings.analytics`),hint:e()?C(`settings.analyticsHint`):C(`settings.analyticsUnavailableHint`)})]}),(0,b.jsx)(s,{children:(0,b.jsx)(t,{onClick:x,children:C(`settings.done`)})})]})})}export{x as GeneralSettingsDialog};
@@ -0,0 +1 @@
1
+ import{o as e,t}from"./CYz610vE.js";var n=t()((t,n)=>({activeDialog:null,destructiveConfirm:null,dryRun:null,message:null,confirm:null,prompt:null,dialogProps:void 0,footerMessage:``,pendingGridEdits:{},transportVersion:0,isLoading:!1,welcomeVisible:!1,setWelcomeVisible:e=>t({welcomeVisible:e}),progress:0,contextMenu:{visible:!1,x:0,y:0,nodeType:null,nodeId:null},openDialog:(n,...r)=>{e(`dialog_open`,{dialog:n}),t({activeDialog:n,dialogProps:r[0]})},closeDialog:()=>t({activeDialog:null,dialogProps:void 0}),requestDestructiveConfirm:e=>{let r=n().destructiveConfirm;return r?.resolve(!1),new Promise(n=>{t({destructiveConfirm:{id:(r?.id??0)+1,request:e,resolve:n}})})},resolveDestructiveConfirm:e=>{let r=n().destructiveConfirm;r&&(t({destructiveConfirm:null}),r.resolve(e))},requestDryRun:e=>{let r=n().dryRun;return r?.resolve(!1),new Promise(n=>{t({dryRun:{id:(r?.id??0)+1,request:e,resolve:n}})})},resolveDryRun:e=>{let r=n().dryRun;r&&(t({dryRun:null}),r.resolve(e))},showMessage:e=>{let r=n().message;return r?.resolve(),new Promise(n=>{t({message:{id:(r?.id??0)+1,request:e,resolve:n}})})},resolveMessage:()=>{let e=n().message;e&&(t({message:null}),e.resolve())},requestConfirm:e=>{let r=n().confirm;return r?.resolve(!1),new Promise(n=>{t({confirm:{id:(r?.id??0)+1,request:e,resolve:n}})})},resolveConfirm:e=>{let r=n().confirm;r&&(t({confirm:null}),r.resolve(e))},requestPrompt:e=>{let r=n().prompt;return r?.resolve(null),new Promise(n=>{t({prompt:{id:(r?.id??0)+1,request:e,resolve:n}})})},resolvePrompt:e=>{let r=n().prompt;r&&(t({prompt:null}),r.resolve(e))},setFooterMessage:e=>t({footerMessage:e}),setPendingGridEdits:(e,n)=>t(t=>{if(!!t.pendingGridEdits[e]===n)return{};let r={...t.pendingGridEdits};return n?r[e]=!0:delete r[e],{pendingGridEdits:r}}),bumpTransportVersion:()=>t(e=>({transportVersion:e.transportVersion+1})),setLoading:e=>t({isLoading:e}),setProgress:e=>t({progress:e}),showContextMenu:(e,n,r,i)=>t({contextMenu:{visible:!0,x:e,y:n,nodeType:r,nodeId:i}}),hideContextMenu:()=>t(e=>({contextMenu:{...e.contextMenu,visible:!1}}))}));function r(...e){return n(t=>t.activeDialog&&e.includes(t.activeDialog)?t.dialogProps:void 0)}export{n,r as t};
@@ -1 +1 @@
1
- import{r as e}from"./hePW80VL.js";import{h as t}from"./B1pia_Rg.js";import{l as n}from"./pjlgs2cl.js";var r=e(t(),1);n();var i=Object.defineProperty,a=(e,t)=>i(e,`name`,{value:t,configurable:!0}),o=r.createContext(void 0);function s(e){let t=r.useContext(o);return e||t||`ltr`}a(s,`useDirection`);var c=Object.defineProperty,l=(e,t)=>c(e,`name`,{value:t,configurable:!0});function u(e,[t,n]){return Math.min(n,Math.max(t,e))}l(u,`clamp`);export{s as n,u as t};
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{r as n}from"./Cu_sGzNJ.js";var r=e(t(),1);n();var i=Object.defineProperty,a=(e,t)=>i(e,`name`,{value:t,configurable:!0}),o=r.createContext(void 0);function s(e){let t=r.useContext(o);return e||t||`ltr`}a(s,`useDirection`);var c=Object.defineProperty,l=(e,t)=>c(e,`name`,{value:t,configurable:!0});function u(e,[t,n]){return Math.min(n,Math.max(t,e))}l(u,`clamp`);export{s as n,u as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,r as s,t as c}from"./DzRyVlxz.js";import{n as l,t as u}from"./DU-Eln5x.js";import{n as d}from"./D8_hwGjG.js";import{t as f}from"./6NUleTnS.js";var p=n();function m(){let n=d(e=>e.activeDialog),m=d(e=>e.closeDialog),h=l(),g=h.update,{t:_}=t();return(0,p.jsx)(c,{open:n===`safety-settings`,onOpenChange:e=>{e||m()},children:(0,p.jsxs)(a,{className:`sm:max-w-[560px]`,children:[(0,p.jsxs)(r,{children:[(0,p.jsx)(o,{children:_(`settings.title`)}),(0,p.jsx)(s,{children:_(`settings.description`)})]}),(0,p.jsxs)(`div`,{className:`grid gap-2`,children:[(0,p.jsx)(f,{id:`s-confirm`,checked:h.confirmDestructive,onChange:e=>g({confirmDestructive:e}),label:`Confirm destructive statements`,hint:`Ask before DROP TABLE/DATABASE, TRUNCATE, DELETE or UPDATE without WHERE, and ALTER … DROP COLUMN.`}),(0,p.jsx)(f,{id:`s-warn`,checked:h.warnInEditor,onChange:e=>g({warnInEditor:e}),label:`Warn in the editor`,hint:`Underline destructive statements and statements a read-only connection would refuse.`}),(0,p.jsx)(f,{id:`s-override`,checked:h.allowReadOnlyOverride,onChange:e=>g({allowReadOnlyOverride:e}),label:`Allow "Run anyway" on read-only connections`,hint:`When off, writes on a read-only connection are refused with no override.`}),(0,p.jsx)(f,{id:`s-preview`,checked:h.previewGridCommit,onChange:e=>g({previewGridCommit:e}),label:`Preview SQL before committing grid edits`,hint:`Show the generated UPDATE statements and ask for confirmation.`})]}),(0,p.jsxs)(i,{children:[(0,p.jsx)(e,{variant:`ghost`,onClick:()=>g(u),children:_(`settings.resetDefaults`)}),(0,p.jsx)(e,{onClick:m,children:_(`settings.done`)})]})]})})}export{m as SafetySettingsDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{i as r,r as i}from"./Cu_sGzNJ.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./DzRyVlxz.js";import{n as d,t as f}from"./D8_hwGjG.js";import{B as p,H as m,V as h,c as g,t as _}from"./B8zpsP_u.js";import{t as v}from"./CDfSdkjY.js";var y=e(t(),1),b=i();function x(e){return e.state===`invalid`?e.reason===`no-public-key`?`pro.notConfigured`:e.reason===`no-webcrypto`?`pro.noWebcrypto`:`pro.invalidKey`:null}function S(){let e=d(e=>e.activeDialog),t=d(e=>e.closeDialog),i=f(`license`),{key:S,status:C,activate:w,clear:T}=p(),{t:E}=r(),[D,O]=(0,y.useState)(S),[k,A]=(0,y.useState)(!1),[j,M]=(0,y.useState)(!i?.feature||!!S),N=(0,y.useRef)(null),[P,F]=(0,y.useState)(h()?null:E(`pro.notConfigured`)),I=async()=>{A(!0);let e=x(await w(D.trim()));F(e?E(e):null),A(!1)},L=C.state===`valid`||C.state===`expired`?C.claim:null,R=i?.feature?E(`pro.blocked`,{feature:E(`pro.features.${i.feature}`)}):null;return(0,b.jsx)(u,{open:e===`license`,onOpenChange:e=>{e||t()},children:(0,b.jsxs)(s,{className:`max-h-[85vh] overflow-y-auto sm:max-w-[560px]`,onOpenAutoFocus:e=>{N.current&&(e.preventDefault(),N.current.focus())},children:[(0,b.jsx)(a,{children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,b.jsx)(_,{size:44}),(0,b.jsx)(m,{className:`absolute -right-2 -bottom-1 ml-0`})]}),(0,b.jsxs)(`div`,{className:`grid gap-1`,children:[(0,b.jsx)(c,{children:E(`pro.licenseTitle`)}),(0,b.jsx)(l,{children:R??E(`pro.licenseDescription`)})]})]})}),(0,b.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[C.state===`valid`&&(0,b.jsxs)(`div`,{className:`rounded-md border border-emerald-500/40 bg-emerald-500/5 p-3 text-xs`,children:[(0,b.jsx)(`p`,{className:`font-medium text-emerald-600 dark:text-emerald-400`,children:E(`pro.active`)}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.licensedTo`,{email:L?.sub})}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:E(`pro.validUntil`,{date:L?.exp})})]}),C.state===`expired`&&(0,b.jsx)(`p`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-amber-600 dark:text-amber-400`,children:E(`pro.expiredOn`,{date:L?.exp})}),R&&(0,b.jsx)(v,{highlight:i?.feature,innerRef:N}),!j&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>M(!0),className:`w-fit rounded-sm text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:E(`pro.haveKey`)}),(0,b.jsxs)(`div`,{className:j?`grid gap-1.5`:`hidden`,children:[(0,b.jsx)(g,{htmlFor:`license-key`,children:E(`pro.keyLabel`)}),(0,b.jsx)(`textarea`,{id:`license-key`,value:D,onChange:e=>{O(e.target.value),F(null)},spellCheck:!1,rows:3,className:`w-full resize-none rounded-md border bg-transparent p-2 font-mono text-xs outline-none focus-visible:ring-1 focus-visible:ring-ring`}),P&&(0,b.jsx)(`p`,{className:`text-xs text-destructive`,children:P})]})]}),(0,b.jsxs)(o,{children:[S&&(0,b.jsx)(n,{variant:`ghost`,onClick:()=>{T(),O(``)},children:E(`pro.remove`)}),j&&(0,b.jsx)(n,{disabled:k||!D.trim()||D.trim()===S,onClick:()=>{I()},children:E(`pro.activate`)}),(0,b.jsx)(n,{variant:`secondary`,onClick:t,children:E(`settings.done`)})]})]})})}export{S as LicenseDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CYz610vE.js";import{t as r}from"./CiL8zoYm.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as ee,n as te,o as ne,r as re,t as ie}from"./DzRyVlxz.js";import{a as s,i as c,n as l,r as u,t as d}from"./D4l4mWtD.js";import{t as f}from"./S7HbowYz.js";import{n as p,t as m}from"./D8_hwGjG.js";import{a as h}from"./BHe42P9W.js";import{r as g}from"./BRZhVXRC.js";import{n as ae,s as _}from"./BvEGx3Si.js";import{Rt as oe,c as v,dt as y,gt as se,l as ce,xt as le}from"./B8zpsP_u.js";var b=e(n(),1),ue=[`SUM`,`AVG`,`MIN`,`MAX`],x=`row_count`;function S(e,t){if(t.columns.length===0)return``;let n=t=>e.quoteIdentifier(t),r=t.columns.map(n),i=[...r,`COUNT(*) AS ${n(x)}`];if(t.aggregate){let{fn:e,column:r}=t.aggregate;i.push(`${e}(${n(r)}) AS ${n(`${e.toLowerCase()}_${r}`)}`)}let a=[];return t.where&&a.push(t.where),a.push(`GROUP BY ${r.join(`, `)}`),t.minCount&&t.minCount>1&&a.push(`HAVING COUNT(*) >= ${Math.floor(t.minCount)}`),a.push(`ORDER BY COUNT(*) DESC`),t.limit>0&&a.push(e.limitClause(t.limit)),e.getQuery(`SELECT_TABLE`,t.database,t.table,i.join(`, `),a.join(` `))}function C(e){let t=new Set;for(let n of e){let e=n.columns[0];e&&t.add(e.toLowerCase())}return t}function w(e,t){return t.has(e.toLowerCase())}function de(e,t){let n=C(t);return e.some(e=>w(e,n))}var T=a(),E=`none`,fe=/\b(int|dec|numeric|number|float|double|real|money|serial)/i;function D(){let{t:e}=i(),n=p(e=>e.activeDialog),a=p(e=>e.closeDialog),x=m(`group-by`),D=n===`group-by`,O=f(e=>e.activeConnections),pe=f(e=>e.activeConnectionId),me=(0,b.useMemo)(()=>O.filter(e=>e.serverConnectionId),[O]),[k,he]=(0,b.useState)(()=>x?.connectionId??pe??``),[A,j]=(0,b.useState)(()=>x?.database??``),[M,N]=(0,b.useState)(()=>x?.table??``),[P,F]=(0,b.useState)([]),[I,L]=(0,b.useState)([]),R=x&&k===x.connectionId&&A===x.database&&M===x.table?x.where??``:``,[z,ge]=(0,b.useState)([]),[B,_e]=(0,b.useState)([]),[V,H]=(0,b.useState)(()=>x?.column?[x.column]:[]),[U,ve]=(0,b.useState)(E),[W,ye]=(0,b.useState)(``),[G,be]=(0,b.useState)(`1`),[K,xe]=(0,b.useState)(!0),[q,J]=(0,b.useState)(``),[Se,Y]=(0,b.useState)(!1),X=e=>f.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;(0,b.useEffect)(()=>{if(!D||!k)return;let e=X(k);if(!e)return;let t=!1;return(async()=>{try{let n=await g(k).introspect.listDatabases(h(e));if(t)return;F(n),j(e=>e&&n.includes(e)?e:n[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[D,k]),(0,b.useEffect)(()=>{if(!D||!k||!A)return;let e=X(k);if(!e)return;let t=!1;return(async()=>{try{let n=await g(k).introspect.listTables(h(e),A);if(t)return;let r=n.map(e=>e.name);L(r),N(e=>e&&r.includes(e)?e:r[0]??``)}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[D,k,A]),(0,b.useEffect)(()=>{if(!D||!k||!M)return;let e=X(k);if(!e)return;let t=!1;return(async()=>{let n=h(e),r=g(k).introspect;try{let[e,i]=await Promise.all([r.listColumns(n,A,M),r.listIndexes(n,A,M).catch(()=>[])]);if(t)return;ge(e),_e(i),H(t=>t.filter(t=>e.some(e=>e.name===t)))}catch(e){t||J(e instanceof Error?e.message:String(e))}})(),()=>{t=!0}},[D,k,A,M]);let Ce=(0,b.useMemo)(()=>C(B),[B]),we=(0,b.useMemo)(()=>z.filter(e=>fe.test(e.type)),[z]),Z=(0,b.useMemo)(()=>!k||V.length===0?``:S(g(k),{database:A,table:M,columns:V,aggregate:U!==E&&W?{fn:U,column:W}:null,where:K?R:``,minCount:Number(G)||1,limit:_()}),[k,A,M,V,U,W,G,K,R]),Q=V.length>0&&B.length>0&&!de(V,B);function Te(e){H(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function $(e){t(`group_by`,{action:e,dbms:g(k).id,columns:V.length,aggregate:U,filtered:!!(K&&R),indexed:!Q})}function Ee(){Z&&($(`open`),y(k,Z,A,e(`database.groupBy.tabTitle`,{table:M})),a())}async function De(){if(!Z)return;$(`run`),Y(!0);let t=y(k,Z,A,e(`database.groupBy.tabTitle`,{table:M}));a();try{await ae(k,t)}finally{Y(!1)}}return(0,T.jsx)(ie,{open:D,onOpenChange:e=>{e||a()},children:(0,T.jsxs)(te,{className:`flex max-h-[85vh] flex-col sm:max-w-[720px]`,children:[(0,T.jsxs)(o,{children:[(0,T.jsx)(ne,{children:e(`database.groupBy.title`)}),(0,T.jsx)(re,{children:e(`database.groupBy.description`,{table:M})})]}),q&&(0,T.jsx)(`p`,{className:`rounded-md border border-destructive/40 px-3 py-2 text-xs text-destructive`,children:q}),(0,T.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(v,{className:`text-xs`,children:e(`database.groupBy.connection`)}),(0,T.jsxs)(d,{value:k,onValueChange:he,children:[(0,T.jsx)(c,{className:`h-8 text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsx)(l,{children:me.map(e=>(0,T.jsx)(u,{value:e.id,children:e.hostName||e.host||e.file||e.id},e.id))})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(v,{className:`text-xs`,children:e(`database.groupBy.database`)}),(0,T.jsxs)(d,{value:A,onValueChange:j,children:[(0,T.jsx)(c,{className:`h-8 text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsx)(l,{children:P.map(e=>(0,T.jsx)(u,{value:e,children:e},e))})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(v,{className:`text-xs`,children:e(`database.groupBy.table`)}),(0,T.jsxs)(d,{value:M,onValueChange:N,children:[(0,T.jsx)(c,{className:`h-8 text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsx)(l,{children:I.map(e=>(0,T.jsx)(u,{value:e,children:e},e))})]})]})]}),(0,T.jsxs)(`div`,{className:`grid min-h-0 grid-cols-[1fr_1fr] gap-4`,children:[(0,T.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-1.5`,children:[(0,T.jsx)(v,{className:`text-xs`,children:e(`database.groupBy.columns`)}),(0,T.jsx)(se,{className:`h-[260px] rounded-md border`,children:(0,T.jsx)(`ul`,{className:`p-1`,children:z.map(t=>{let n=w(t.name,Ce);return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1 text-xs hover:bg-accent`,children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:V.includes(t.name),onChange:()=>Te(t.name)}),(0,T.jsx)(`span`,{className:`truncate font-medium`,children:t.name}),(0,T.jsx)(`span`,{className:`truncate text-muted-foreground`,children:t.type}),n&&(0,T.jsx)(oe,{className:`ml-auto h-3 w-3 shrink-0 text-muted-foreground`,"aria-label":e(`database.groupBy.indexed`)})]})},t.name)})})})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(v,{className:`text-xs`,children:e(`database.groupBy.aggregate`)}),(0,T.jsxs)(`div`,{className:`flex gap-2`,children:[(0,T.jsxs)(d,{value:U,onValueChange:ve,children:[(0,T.jsx)(c,{className:`h-8 w-[110px] text-xs`,children:(0,T.jsx)(s,{})}),(0,T.jsxs)(l,{children:[(0,T.jsx)(u,{value:E,children:e(`database.groupBy.countOnly`)}),ue.map(e=>(0,T.jsx)(u,{value:e,children:e},e))]})]}),(0,T.jsxs)(d,{value:W,onValueChange:ye,disabled:U===E,children:[(0,T.jsx)(c,{className:`h-8 flex-1 text-xs`,children:(0,T.jsx)(s,{placeholder:e(`database.groupBy.column`)})}),(0,T.jsx)(l,{children:we.map(e=>(0,T.jsx)(u,{value:e.name,children:e.name},e.name))})]})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(v,{htmlFor:`gb-min`,className:`text-xs`,children:e(`database.groupBy.minCount`)}),(0,T.jsx)(ce,{id:`gb-min`,type:`number`,min:1,value:G,onChange:e=>be(e.target.value),className:`h-8 text-xs`})]}),R&&(0,T.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:K,onChange:e=>xe(e.target.checked)}),e(`database.groupBy.useFilter`)]}),Q&&(0,T.jsxs)(`p`,{className:`flex gap-1.5 rounded-md border border-dashed px-2 py-1.5 text-xs text-muted-foreground`,children:[(0,T.jsx)(le,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,T.jsx)(`span`,{children:e(`database.groupBy.noIndexWarning`)})]})]})]}),(0,T.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,T.jsx)(v,{className:`text-xs`,children:e(`database.groupBy.preview`)}),(0,T.jsx)(`pre`,{className:`max-h-[120px] overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap`,children:Z||e(`database.groupBy.pickColumn`)})]}),(0,T.jsxs)(ee,{children:[(0,T.jsx)(r,{variant:`outline`,onClick:a,children:e(`command.close`)}),(0,T.jsx)(r,{variant:`outline`,onClick:Ee,disabled:!Z,children:e(`database.groupBy.openInTab`)}),(0,T.jsx)(r,{onClick:De,disabled:!Z||Se,children:e(`database.groupBy.run`)})]})]})})}export{D as GroupByDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i}from"./S7HbowYz.js";import{ft as a,ut as o}from"./B8zpsP_u.js";import{r as s}from"./B7zF7RU4.js";import{t as c}from"./Br4335vw.js";import{t as l}from"./BYvM8E39.js";import{t as u}from"./CP2U-viH.js";import{t as d}from"./_zaonxnw.js";var f=e(t(),1);function p(e){let t=e.indexOf(`:`);return t===-1?`(no prefix)`:e.slice(0,t+1)}function m(e){return e<0?`none`:e<36e5?`lt1h`:e<864e5?`lt1d`:e<6048e5?`lt1w`:`ge1w`}function h(){let e=()=>({count:0,bytes:0});return{analyzed:0,totalBytes:0,byType:{},byPrefix:{},ttl:{none:e(),lt1h:e(),lt1d:e(),lt1w:e(),ge1w:e()},top:[],missingSizes:0}}function g(e,t,n){let r=e[t]??={count:0,bytes:0};r.count+=1,r.bytes+=n}function _(e,t){let n={...e,byType:{...e.byType},byPrefix:{...e.byPrefix},ttl:{...e.ttl},top:[...e.top]};for(let e of Object.keys(n.byType))n.byType[e]={...n.byType[e]};for(let e of Object.keys(n.byPrefix))n.byPrefix[e]={...n.byPrefix[e]};for(let e of Object.keys(n.ttl))n.ttl[e]={...n.ttl[e]};for(let e of t){if(e.ttlMs===-2||e.type===`none`)continue;let t=e.bytes??0;e.bytes===null&&(n.missingSizes+=1),n.analyzed+=1,n.totalBytes+=t,g(n.byType,e.type,t),g(n.byPrefix,p(e.key),t);let r=n.ttl[m(e.ttlMs)];r.count+=1,r.bytes+=t,e.bytes!==null&&(n.top.length<50||t>n.top[n.top.length-1].bytes)&&(n.top.push({key:e.key,type:e.type,bytes:t}),n.top.sort((e,t)=>t.bytes-e.bytes),n.top.length>50&&(n.top.length=50))}return n}function v(e){return Object.entries(e).sort((e,t)=>t[1].bytes-e[1].bytes||t[1].count-e[1].count)}var y=r(),b=300,x=[1e4,1e5,1e6];function S({title:e,rows:t,onRow:n}){return(0,y.jsxs)(`section`,{className:`min-w-0`,children:[(0,y.jsx)(`h3`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,y.jsx)(`table`,{className:`w-full border-collapse text-xs`,children:(0,y.jsx)(`tbody`,{children:t.map(([e,t,r,i])=>(0,y.jsxs)(`tr`,{className:`border-b border-border/50 ${n?`cursor-pointer hover:bg-muted/50`:``}`,onClick:n?()=>n(e):void 0,children:[(0,y.jsx)(`td`,{className:`max-w-0 truncate py-1 pr-2 font-mono`,title:e,children:e}),(0,y.jsx)(`td`,{className:`w-20 py-1 text-right tabular-nums text-muted-foreground`,children:t}),(0,y.jsx)(`td`,{className:`w-24 py-1 text-right tabular-nums`,children:r}),(0,y.jsx)(`td`,{className:`w-14 py-1 text-right tabular-nums text-muted-foreground`,children:i??``})]},e))})})]})}function C({connectionId:e,tabId:t,input:r}){let{t:p}=n(),m=c(e,t,``),[g,C]=(0,f.useState)(r.trim().split(/\s+/)[0]||`db0`),[w,T]=(0,f.useState)(x[1]),[E,D]=(0,f.useState)(null),[O,k]=(0,f.useState)(null),[A,j]=(0,f.useState)(!1),[M,N]=(0,f.useState)(null),P=(0,f.useRef)(!1),[F,I]=(0,f.useState)(0),L=async()=>{P.current=!1,j(!0),N(null);let e=h();D(e);try{let t=Number(await m.read(`DBSIZE`,g));k({scanned:0,total:Number.isFinite(t)?t:null});let n=`0`,r=0;do{let a=await m.read(`SCAN ${n} COUNT ${b}`,g);n=String(a[0]);let o=a[1].slice(0,Math.max(0,w-r));if(o.length>0){let t=await m.readBatch(o.flatMap(e=>{let t=i(e);return[`MEMORY USAGE ${t}`,`TYPE ${t}`,`PTTL ${t}`]}),g),n=o.map((e,n)=>{let[r,i,a]=t.slice(n*3,n*3+3);return{key:e,type:typeof i==`string`?i:`unknown`,bytes:r instanceof Error||r==null?null:Number(r),ttlMs:a instanceof Error?-1:Number(a)}});e=_(e,n),D(e)}r+=o.length,k({scanned:r,total:Number.isFinite(t)?t:null})}while(n!==`0`&&r<w&&!P.current)}catch(e){N(d(e))}finally{j(!1),I(e=>e+1)}},R=e=>E&&E.totalBytes>0?`${(e/E.totalBytes*100).toFixed(1)}%`:``,z={none:p(`tools.redis.ttlNone`),lt1h:`< 1h`,lt1d:`< 1d`,lt1w:`< 1w`,ge1w:`≥ 1w`},B=O?.total?Math.min(100,Math.round(O.scanned/O.total*100)):null;return(0,y.jsx)(u,{title:p(`tools.redis.memory`),onRefresh:async()=>{A||await L()},error:M,onDismissError:()=>N(null),actions:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l,{access:m,value:g,onChange:C,disabled:A,version:F}),(0,y.jsx)(`select`,{value:w,disabled:A,onChange:e=>T(Number(e.target.value)),className:`h-7 rounded border bg-background px-1 text-xs`,children:x.map(e=>(0,y.jsx)(`option`,{value:e,children:p(`tools.redis.upTo`,{count:e.toLocaleString()})},e))}),A?(0,y.jsx)(`button`,{type:`button`,onClick:()=>{P.current=!0},className:`flex h-7 items-center rounded border bg-background px-2 text-muted-foreground hover:text-foreground`,children:p(`tools.stop`)}):(0,y.jsx)(`button`,{type:`button`,onClick:()=>void L(),className:`flex h-7 items-center rounded border border-primary/30 bg-primary/10 px-2 text-primary hover:bg-primary/20`,children:p(`tools.redis.analyze`)})]}),children:(0,y.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:p(`tools.redis.memoryNote`)}),O&&(0,y.jsxs)(`div`,{className:`space-y-1`,children:[(0,y.jsx)(`div`,{className:`h-1.5 w-full max-w-xl overflow-hidden rounded bg-muted`,children:(0,y.jsx)(`div`,{className:`h-full bg-primary transition-all`,style:{width:`${B??(A?30:100)}%`}})}),(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[p(`tools.redis.scanned`,{scanned:O.scanned.toLocaleString(),total:O.total?.toLocaleString()??`?`}),!A&&O.total!==null&&O.scanned<O.total&&` · ${p(`tools.redis.partial`)}`]})]}),E&&E.analyzed===0&&!A&&(0,y.jsx)(`p`,{className:`rounded border border-dashed p-6 text-center text-sm text-muted-foreground`,children:p(`tools.redis.noKeys`,{database:g})}),E&&E.analyzed>0&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap gap-6 text-sm`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:p(`tools.redis.keysAnalyzed`)}),(0,y.jsx)(`div`,{className:`font-semibold tabular-nums`,children:E.analyzed.toLocaleString()})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:p(`tools.redis.totalMemory`)}),(0,y.jsx)(`div`,{className:`font-semibold`,children:s(E.totalBytes)})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:p(`tools.redis.average`)}),(0,y.jsx)(`div`,{className:`font-semibold`,children:s(Math.round(E.totalBytes/E.analyzed))})]})]}),E.missingSizes>0&&(0,y.jsx)(`p`,{className:`text-xs text-catppuccin-yellow`,children:p(`tools.redis.missingSizes`,{count:E.missingSizes})}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-6`,children:[(0,y.jsx)(S,{title:p(`tools.redis.byType`),rows:v(E.byType).map(([e,t])=>[e,t.count.toLocaleString(),s(t.bytes),R(t.bytes)])}),(0,y.jsx)(S,{title:p(`tools.redis.byTtl`),rows:Object.keys(z).map(e=>[z[e],E.ttl[e].count.toLocaleString(),s(E.ttl[e].bytes),R(E.ttl[e].bytes)])}),(0,y.jsx)(S,{title:p(`tools.redis.byPrefix`),rows:v(E.byPrefix).slice(0,100).map(([e,t])=>[e,t.count.toLocaleString(),s(t.bytes),R(t.bytes)]),onRow:m.readOnly?void 0:t=>{t.endsWith(`:`)&&a(e,`redis-delete`,p(`tools.redis.delete`),`${g} ${t}*`)}}),(0,y.jsx)(S,{title:p(`tools.redis.largest`),rows:E.top.map(e=>[e.key,e.type,s(e.bytes)]),onRow:t=>o(e,{database:g,name:t})})]}),!m.readOnly&&(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:p(`tools.redis.prefixHint`)})]})]})})}export{C as MemoryAnalysis};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{o as t,p as n}from"./CYz610vE.js";import{t as r}from"./CiL8zoYm.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,t as u}from"./DzRyVlxz.js";import{a as d,i as f,n as p,r as m,t as h}from"./D4l4mWtD.js";import{t as g}from"./S7HbowYz.js";import{n as _,t as ee}from"./D8_hwGjG.js";import{a as v}from"./BHe42P9W.js";import{r as y}from"./BRZhVXRC.js";import{t as te}from"./B9DHeSQH.js";import{G as b,_ as x,c as S,dt as C,g as ne,v as re}from"./B8zpsP_u.js";var w=e(n(),1),T=a(),E=e=>e instanceof Error?e.message:String(e),D=e=>e.hostName||e.host||e.file||e.id,O=5e4;function k({id:e,label:t,side:n,onChange:r,connections:a,disabled:o}){let{t:s}=i(),[c,l]=(0,w.useState)([]),[u,g]=(0,w.useState)([]),_=a.find(e=>e.id===n.connectionId);return(0,w.useEffect)(()=>{if(!_?.serverConnectionId)return;let e=!1;return(async()=>{try{let t=await y(_.id).introspect.listDatabases(v(_.serverConnectionId));if(e)return;l(t),t.includes(n.database)||r({connectionId:_.id,database:t[0]??``,table:``})}catch{e||l([])}})(),()=>{e=!0}},[_?.id,_?.serverConnectionId]),(0,w.useEffect)(()=>{if(!_?.serverConnectionId||!n.database)return;let e=!1;return(async()=>{try{let t=await y(_.id).introspect.listTables(v(_.serverConnectionId),n.database);if(e)return;let i=t.map(e=>e.name);g(i),n.table&&!i.includes(n.table)&&r({...n,table:``})}catch{e||g([])}})(),()=>{e=!0}},[_?.id,_?.serverConnectionId,n.database]),(0,T.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,children:[(0,T.jsx)(S,{className:`font-medium`,children:t}),(0,T.jsxs)(h,{value:n.connectionId,onValueChange:e=>r({connectionId:e,database:``,table:``}),disabled:o,children:[(0,T.jsx)(f,{id:`${e}-conn`,className:`w-full`,children:(0,T.jsx)(d,{placeholder:s(`database.diff.pickConnection`)})}),(0,T.jsx)(p,{children:a.map(e=>(0,T.jsx)(m,{value:e.id,children:D(e)},e.id))})]}),(0,T.jsxs)(h,{value:n.database,onValueChange:e=>r({...n,database:e,table:``}),disabled:o||c.length===0,children:[(0,T.jsx)(f,{id:`${e}-db`,className:`w-full`,children:(0,T.jsx)(d,{placeholder:s(`database.diff.pickDatabase`)})}),(0,T.jsx)(p,{children:c.map(e=>(0,T.jsx)(m,{value:e,children:e},e))})]}),(0,T.jsxs)(h,{value:n.table,onValueChange:e=>r({...n,table:e}),disabled:o||u.length===0,children:[(0,T.jsx)(f,{id:`${e}-table`,className:`w-full`,children:(0,T.jsx)(d,{placeholder:s(`database.dataDiff.pickTable`)})}),(0,T.jsx)(p,{children:u.map(e=>(0,T.jsx)(m,{value:e,children:e},e))})]})]})}async function A(e,t){let n=await b({connectionId:e.connectionId,database:e.database,table:e.table,limit:O,onProgress:t}),r=[];for await(let e of n.pages)r.push(...e);return{rows:r,columns:n.fields.map(e=>e.name),capped:r.length>=O}}function j({diff:e,row:t,other:n,changed:r}){let{t:a}=i(),o=[...e.keyColumns,...e.compareColumns];return(0,T.jsxs)(`table`,{className:`w-full text-xs font-mono`,children:[(0,T.jsx)(`thead`,{className:`text-muted-foreground`,children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{className:`text-left font-normal pr-2`,children:a(`database.diff.column`)}),(0,T.jsx)(`th`,{className:`text-left font-normal pr-2`,children:a(`database.diff.source`)}),(0,T.jsx)(`th`,{className:`text-left font-normal`,children:a(`database.diff.target`)})]})}),(0,T.jsx)(`tbody`,{children:o.map(e=>(0,T.jsxs)(`tr`,{className:r?.includes(e)?`text-amber-600 dark:text-amber-400`:``,children:[(0,T.jsx)(`td`,{className:`pr-2 align-top whitespace-nowrap`,children:e}),(0,T.jsx)(`td`,{className:`pr-2 align-top break-all`,children:x(t[e])}),(0,T.jsx)(`td`,{className:`align-top break-all`,children:n?x(n[e]):`—`})]},e))})]})}function M(){let{t:e}=i(),n=_(e=>e.activeDialog),a=_(e=>e.closeDialog),d=ee(`data-diff`),f=g(e=>e.activeConnections),p=(0,w.useMemo)(()=>f.filter(e=>e.serverConnectionId),[f]),m=g(e=>e.activeConnectionId),h=n===`data-diff`,[b,S]=(0,w.useState)(()=>d&&p.some(e=>e.id===d.connectionId)?{connectionId:d.connectionId,database:d.database,table:d.table}:{connectionId:m&&p.some(e=>e.id===m)?m:p[0]?.id??``,database:``,table:``}),[D,M]=(0,w.useState)(()=>({connectionId:p.find(e=>e.id!==b.connectionId)?.id??b.connectionId,database:``,table:``})),[N,ie]=(0,w.useState)([]),[P,F]=(0,w.useState)(null),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(`changed`),[B,V]=(0,w.useState)(0),[H,ae]=(0,w.useState)(!1),[U,W]=(0,w.useState)(!1),[G,K]=(0,w.useState)({source:null,target:null}),[q,J]=(0,w.useState)(null),oe=e=>M(e.database&&!e.table&&b.table?{...e,table:b.table}:e),Y=b.connectionId===D.connectionId&&b.database===D.database&&b.table===D.table,se=!!b.table&&!!D.table&&!Y,X=D.connectionId?y(D.connectionId):null;async function ce(){W(!0),J(null),F(null);try{let n=g.getState().activeConnections.find(e=>e.id===b.connectionId);if(!n?.serverConnectionId)throw Error(e(`services.query.notConnected`));let r=await y(b.connectionId).introspect.getPrimaryKeys(v(n.serverConnectionId),b.database,b.table);if(r.length===0)throw Error(e(`database.dataDiff.noPrimaryKey`,{table:b.table}));K({source:{loaded:0,total:null},target:{loaded:0,total:null}});let[i,a]=await Promise.all([A(b,e=>K(t=>({...t,source:e}))),A(D,e=>K(t=>({...t,target:e})))]);if(r.some(e=>!a.columns.includes(e)))throw Error(e(`database.dataDiff.keyMissingInTarget`,{columns:r.join(`, `)}));let o=re(i.rows,a.rows,r,i.columns,a.columns);ie(r),L(i.capped||a.capped),F(o),z(o.changed.length>0?`changed`:o.added.length>0?`added`:`removed`),V(0),te(`compare_data`),t(`data_diff`,{source_dbms:y(b.connectionId).id,target_dbms:X?.id??`unknown`,added:o.added.length,changed:o.changed.length,removed:o.removed.length})}catch(e){J(E(e))}finally{W(!1),K({source:null,target:null})}}let Z=e=>e?e.total===null?e.loaded.toLocaleString():`${e.loaded.toLocaleString()} / ${e.total.toLocaleString()}`:``,Q=(0,w.useMemo)(()=>P&&X?ne(P,X,{database:D.database,table:D.table},{includeDeletes:H}):``,[P,X,D.database,D.table,H]);function le(){Q&&(C(D.connectionId,Q,D.database,e(`database.dataDiff.tabTitle`,{table:D.table})),a())}let $=P?R===`added`?P.added:R===`removed`?P.removed:P.changed.map(e=>e.source):[],ue=!!P&&P.added.length+P.changed.length+P.removed.length>0,de=e=>N.map(t=>x(e[t])).join(`, `);return(0,T.jsx)(u,{open:h,onOpenChange:e=>{e||a()},children:(0,T.jsxs)(c,{className:`sm:max-w-[900px]`,children:[(0,T.jsx)(o,{children:(0,T.jsx)(l,{children:e(`database.dataDiff.title`)})}),(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsx)(k,{id:`ddiff-source`,label:e(`database.diff.source`),side:b,onChange:S,connections:p,disabled:U}),(0,T.jsx)(k,{id:`ddiff-target`,label:e(`database.diff.target`),side:D,onChange:oe,connections:p,disabled:U})]}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`database.dataDiff.hint`,{cap:O.toLocaleString()})}),Y&&b.table&&(0,T.jsx)(`p`,{className:`text-xs text-destructive`,children:e(`database.dataDiff.sameSide`)}),q&&(0,T.jsx)(`p`,{className:`text-sm text-destructive whitespace-pre-wrap`,children:q}),U&&(G.source||G.target)&&(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`database.dataDiff.loading`,{source:Z(G.source),target:Z(G.target)})}),P&&(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs`,children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:e(`database.dataDiff.summary`,{key:N.join(`, `),added:P.added.length,changed:P.changed.length,removed:P.removed.length,identical:P.identical})}),I&&(0,T.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:e(`database.dataDiff.capped`,{cap:O.toLocaleString()})}),(P.sourceOnlyColumns.length>0||P.targetOnlyColumns.length>0)&&(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:e(`database.dataDiff.ignoredColumns`,{columns:[...P.sourceOnlyColumns,...P.targetOnlyColumns].join(`, `)})})]}),(0,T.jsx)(`div`,{className:`flex gap-1 text-xs`,children:[`added`,`changed`,`removed`].map(t=>(0,T.jsx)(`button`,{type:`button`,onClick:()=>{z(t),V(0)},className:`rounded border px-2 py-0.5 ${R===t?`bg-accent`:``}`,children:e(`database.dataDiff.${t}`,{count:t===`added`?P.added.length:t===`removed`?P.removed.length:P.changed.length})},t))}),(0,T.jsxs)(`div`,{className:`grid grid-cols-[240px_1fr] gap-3 h-[280px]`,children:[(0,T.jsxs)(`ul`,{className:`overflow-auto rounded-md border text-sm font-mono`,children:[$.slice(0,2e3).map((e,t)=>(0,T.jsx)(`li`,{className:`px-2 py-1 cursor-pointer ${B===t?`bg-accent`:``}`,onClick:()=>V(t),children:de(e)},t)),$.length===0&&(0,T.jsx)(`li`,{className:`px-2 py-1 text-muted-foreground`,children:e(`database.dataDiff.none`)}),$.length>2e3&&(0,T.jsx)(`li`,{className:`px-2 py-1 text-muted-foreground`,children:e(`database.dataDiff.more`,{count:$.length-2e3})})]}),(0,T.jsx)(`div`,{className:`overflow-auto rounded-md border p-2`,children:$[B]?R===`changed`?(0,T.jsx)(j,{diff:P,row:P.changed[B].source,other:P.changed[B].target,changed:P.changed[B].columns}):R===`removed`?(0,T.jsx)(j,{diff:P,row:{},other:$[B]}):(0,T.jsx)(j,{diff:P,row:$[B]}):(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`database.diff.selectTable`)})})]}),(0,T.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[(0,T.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>ae(e.target.checked)}),(0,T.jsx)(`span`,{className:H?`text-destructive`:``,children:e(`database.dataDiff.includeDeletes`)})]})]})]}),(0,T.jsxs)(s,{children:[(0,T.jsx)(r,{variant:`outline`,onClick:a,children:e(`database.diff.close`)}),(0,T.jsx)(r,{variant:`secondary`,onClick:()=>{ce()},disabled:!se||U,children:e(U?`database.diff.comparing`:`database.diff.compare`)}),(0,T.jsx)(r,{onClick:le,disabled:!ue,children:e(`database.diff.openScript`)})]})]})})}export{M as DataDiffDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i}from"./S7HbowYz.js";import{n as a}from"./D8_hwGjG.js";import{t as o}from"./Br4335vw.js";import{s}from"./Udlj1Cgf.js";import{t as c}from"./CP2U-viH.js";import{t as l}from"./_zaonxnw.js";var u=e(t(),1),d=r(),f=128;function p({connectionId:e,tabId:t}){let{t:r}=n(),p=o(e,t,``),[m,h]=(0,u.useState)(null),[g,_]=(0,u.useState)(null),[v,y]=(0,u.useState)(null),b=(0,u.useCallback)(async()=>{try{h(s(await p.read(`SLOWLOG GET ${f}`)));let e=await p.tryRead(`CONFIG GET slowlog-log-slower-than`);_(Array.isArray(e)&&e.length===2?String(e[1]):null),y(null)}catch(e){y(l(e))}},[p]);(0,u.useEffect)(()=>{Promise.resolve().then(()=>b())},[b]);let x=async()=>{if(await a.getState().requestDestructiveConfirm({title:r(`tools.redis.slowlogResetTitle`),description:r(`tools.redis.slowlogResetDescription`),statements:[`SLOWLOG RESET`],confirmLabel:r(`tools.redis.slowlogReset`)}))try{await p.write(`SLOWLOG RESET`,{confirmed:!0}),await b()}catch(e){e instanceof Error&&e.name===`ExecutionCancelled`||y(l(e))}};return(0,d.jsxs)(c,{title:r(`tools.redis.slowlog`),onRefresh:b,error:v,onDismissError:()=>y(null),actions:(0,d.jsxs)(d.Fragment,{children:[g!==null&&(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:r(`tools.redis.slowlogThreshold`,{ms:(Number(g)/1e3).toLocaleString()})}),!p.readOnly&&(0,d.jsx)(`button`,{type:`button`,onClick:()=>void x(),className:`flex h-7 items-center rounded border bg-background px-2 text-muted-foreground hover:border-destructive/40 hover:text-destructive`,children:r(`tools.redis.slowlogReset`)})]}),children:[m&&m.length===0&&(0,d.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:r(`tools.redis.slowlogEmpty`)}),m&&m.length>0&&(0,d.jsxs)(`table`,{className:`w-full border-collapse text-xs`,children:[(0,d.jsx)(`thead`,{className:`sticky top-0 bg-muted text-left text-muted-foreground`,children:(0,d.jsxs)(`tr`,{children:[(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:`id`}),(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:r(`tools.redis.time`)}),(0,d.jsx)(`th`,{className:`px-3 py-1.5 text-right`,children:r(`tools.redis.duration`)}),(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:r(`tools.redis.command`)}),(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:r(`tools.redis.client`)})]})}),(0,d.jsx)(`tbody`,{children:m.map(e=>(0,d.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/40`,children:[(0,d.jsx)(`td`,{className:`px-3 py-1 tabular-nums text-muted-foreground`,children:e.id}),(0,d.jsx)(`td`,{className:`whitespace-nowrap px-3 py-1`,children:new Date(e.time*1e3).toLocaleString()}),(0,d.jsxs)(`td`,{className:`px-3 py-1 text-right tabular-nums`,children:[(e.durationMicros/1e3).toFixed(2),` ms`]}),(0,d.jsx)(`td`,{className:`break-all px-3 py-1 font-mono`,children:e.args.map(i).join(` `)}),(0,d.jsx)(`td`,{className:`px-3 py-1 font-mono text-muted-foreground`,children:[e.client,e.clientName].filter(Boolean).join(` · `)})]},e.id))})]})]})}export{p as SlowLog};
@@ -0,0 +1 @@
1
+ import{o as e,t}from"./CYz610vE.js";import{i as n,t as r}from"./eFSiW0Lh.js";var i={anthropic:`claude-opus-5`,"anthropic-profile":`claude-opus-5`,openai:`gpt-4o`,gemini:`gemini-2.5-flash`,cli:`claude`};function a(e,t){let n=e.trim();return n===``||Object.values(i).includes(n)?i[t]:e}var o=[{id:`2026-10-03`,agent:`0.9.0`,title:{en:`Redis, Elasticsearch and OpenSearch connections`,ko:`Redis, Elasticsearch, OpenSearch 연결 추가`,ja:`Redis・Elasticsearch・OpenSearch に接続できるようになりました`,zh:`现在可以连接 Redis、Elasticsearch 和 OpenSearch`,de:`Verbindungen zu Redis, Elasticsearch und OpenSearch`,fr:`Connexions Redis, Elasticsearch et OpenSearch`},items:{en:[`In “Connect to Database”, pick Redis and the tree on the left lists <code>db0</code>, <code>db1</code> and so on. Keys like <code>user:1</code> and <code>user:2</code> are grouped under a <code>user</code> folder. Double-click a key to edit it in a view that fits its type.`,`Type redis-cli commands in a console tab. Commands and the key names already loaded in the tree autocomplete.`,`Redis tools are in the Tools menu, or right-click an empty spot in the tree. Memory analysis shows how much memory each prefix and type takes and lists the 50 biggest keys; it analyses 20,000 keys in about a second. Delete by pattern shows the matching keys first and only deletes after you type the pattern again. Server info, slow log, client list, Pub/Sub and MONITOR are there too.`,`You can also pick Elasticsearch 8 or OpenSearch 2 in “Connect to Database”. Write requests the way you would in Kibana Dev Tools, e.g. <code>GET /orders/_search</code>, and press Ctrl+Enter (Cmd+Enter on a Mac); hits come back as a table. Right-click a row to open the document, edit its JSON and save. If someone changed it since you opened it, Planche reports a conflict instead of overwriting.`,`Click a grid cell that holds HTML and you see the rendered page; scripts in it do not run. The text, JSON and HTML viewers are bigger and have a full-screen button.`],ko:[`‘데이터베이스에 연결’ 창에서 Redis를 고르면 왼쪽 트리에 <code>db0</code>, <code>db1</code>…이 나옵니다. <code>user:1</code>, <code>user:2</code> 같은 키는 <code>user</code> 폴더 아래에 모입니다. 키를 더블클릭하면 타입에 맞는 편집 화면이 열립니다.`,`콘솔 탭에서는 redis-cli 명령을 그대로 입력하면 됩니다. 명령어와 트리에 불러온 키 이름이 자동완성됩니다.`,`Redis 도구는 도구 메뉴에서 열 수 있고, 트리 빈 곳을 우클릭해도 됩니다. 메모리 분석은 접두사와 타입별로 메모리를 얼마나 쓰는지, 가장 큰 키 50개가 무엇인지 보여 줍니다. 키 2만 개를 1초 정도면 훑습니다. 패턴으로 키 지우기는 지워질 키를 먼저 보여 주고, 패턴을 한 번 더 입력해야 지웁니다. 서버 정보, 슬로 로그, 클라이언트 목록, Pub/Sub, MONITOR도 여기서 엽니다.`,`Elasticsearch 8과 OpenSearch 2도 ‘데이터베이스에 연결’ 창에서 고를 수 있습니다. 콘솔에 Kibana Dev Tools처럼 <code>GET /orders/_search</code>를 쓰고 Ctrl+Enter(맥은 Cmd+Enter)를 누르면 검색 결과가 표로 나옵니다. 행을 우클릭해 문서를 열면 JSON을 고쳐서 저장할 수 있습니다. 문서를 연 뒤 다른 곳에서 내용이 바뀌었다면 덮어쓰지 않고 충돌이라고 알려 줍니다.`,`HTML이 든 그리드 셀을 클릭하면 렌더링된 페이지가 보입니다. 그 안의 스크립트는 실행되지 않습니다. 텍스트·JSON·HTML 뷰어 창도 커졌고 전체 화면 버튼이 생겼습니다.`],ja:[`「データベースに接続」で Redis を選ぶと、左のツリーに <code>db0</code>、<code>db1</code>… が並びます。<code>user:1</code> や <code>user:2</code> のようなキーは <code>user</code> フォルダにまとまります。キーをダブルクリックすると、型に合った編集画面が開きます。`,`コンソールタブには redis-cli のコマンドをそのまま入力できます。コマンド名と、ツリーに読み込んだキー名が補完されます。`,`Redis のツールは「ツール」メニューにあり、ツリーの空いているところを右クリックしても開けます。メモリ分析では、プレフィックスごと・型ごとのメモリ使用量と、大きいキーの上位 50 件が分かります。2 万キーなら 1 秒ほどで終わります。パターンによるキー削除は、削除対象のキーを先に一覧表示し、パターンをもう一度入力したときだけ削除します。サーバー情報、スローログ、クライアント一覧、Pub/Sub、MONITOR もここから開きます。`,`Elasticsearch 8 と OpenSearch 2 も「データベースに接続」から選べます。コンソールに Kibana Dev Tools と同じ書き方で <code>GET /orders/_search</code> と書き、Ctrl+Enter(Mac は Cmd+Enter)を押すと検索結果が表で返ってきます。行を右クリックしてドキュメントを開けば、JSON を直して保存できます。開いた後にほかで書き換えられていた場合は、上書きせず、競合が起きたことを知らせます。`,`HTML が入ったセルをクリックすると、描画されたページとして表示されます。中のスクリプトは実行されません。テキスト・JSON・HTML のビューアは大きくなり、全画面ボタンも付きました。`],zh:[`在“连接到数据库”中选择 Redis,左侧树中会列出 <code>db0</code>、<code>db1</code> 等数据库。像 <code>user:1</code>、<code>user:2</code> 这样的键会归到 <code>user</code> 文件夹下。双击一个键,会按它的类型打开对应的编辑界面。`,`在控制台标签页里可以直接输入 redis-cli 命令,命令名和树里已加载的键名都会自动补全。`,`Redis 工具在“工具”菜单里,在树的空白处右键也能找到。内存分析会告诉你每个前缀、每种类型各占多少内存,并列出最大的 50 个键;2 万个键大约 1 秒就能分析完。按模式删除键会先列出将被删除的键,要再输入一次模式才会真正删除。服务器信息、慢日志、客户端列表、Pub/Sub 和 MONITOR 也都从这里打开。`,`也可以在“连接到数据库”中选择 Elasticsearch 8 或 OpenSearch 2。在控制台里像在 Kibana Dev Tools 中那样写 <code>GET /orders/_search</code>,按 Ctrl+Enter(Mac 上是 Cmd+Enter),搜索结果会以表格返回。右键某一行可以打开该文档,修改 JSON 后保存;如果在你打开之后文档已被别人改过,Planche 会提示冲突,而不会直接覆盖。`,`单元格里存的是 HTML 时,点击即可看到渲染后的页面,其中的脚本不会执行。文本、JSON 和 HTML 查看器也变大了,并加了全屏按钮。`],de:[`Wählen Sie unter „Mit Datenbank verbinden“ Redis aus, dann zeigt der Baum links <code>db0</code>, <code>db1</code> usw. Schlüssel wie <code>user:1</code> und <code>user:2</code> landen in einem Ordner <code>user</code>. Ein Doppelklick auf einen Schlüssel öffnet ihn in einer Ansicht, die zu seinem Typ passt.`,`In einem Konsolen-Tab tippen Sie redis-cli-Befehle so, wie Sie es gewohnt sind. Befehle und die bereits im Baum geladenen Schlüsselnamen werden vervollständigt.`,`Die Redis-Werkzeuge finden Sie im Menü „Werkzeuge“ oder per Rechtsklick auf eine freie Stelle im Baum. Die Speicheranalyse zeigt, wie viel Speicher jedes Präfix und jeder Typ belegt, und listet die 50 größten Schlüssel; die Analyse von 20.000 Schlüsseln dauert etwa eine Sekunde. „Nach Muster löschen“ zeigt zuerst, welche Schlüssel betroffen sind, und löscht erst, wenn Sie das Muster noch einmal eingeben. Serverinfo, Slow Log, Client-Liste, Pub/Sub und MONITOR öffnen Sie dort ebenfalls.`,`Unter „Mit Datenbank verbinden“ können Sie auch Elasticsearch 8 oder OpenSearch 2 auswählen. Schreiben Sie Anfragen wie in den Kibana Dev Tools, etwa <code>GET /orders/_search</code>, und drücken Sie Strg+Enter (auf dem Mac Cmd+Enter); die Treffer kommen als Tabelle zurück. Per Rechtsklick auf eine Zeile öffnen Sie das Dokument, ändern das JSON und speichern. Hat jemand anderes es inzwischen geändert, meldet Planche einen Konflikt, statt es zu überschreiben.`,`Steht in einer Zelle HTML, sehen Sie nach einem Klick die gerenderte Seite; Skripte darin laufen nicht. Die Text-, JSON- und HTML-Viewer sind größer und haben jetzt eine Vollbild-Schaltfläche.`],fr:[`Choisissez Redis dans « Se connecter à une base de données » : l’arborescence à gauche affiche <code>db0</code>, <code>db1</code>, etc. Les clés comme <code>user:1</code> et <code>user:2</code> sont rangées dans un dossier <code>user</code>. Un double-clic sur une clé l’ouvre dans une vue adaptée à son type.`,`Dans un onglet console, tapez vos commandes redis-cli telles quelles. Les commandes et les noms de clés déjà chargés dans l’arborescence se complètent automatiquement.`,`Les outils Redis s’ouvrent depuis le menu Outils ou d’un clic droit sur une zone vide de l’arborescence. L’analyse mémoire montre combien de mémoire occupe chaque préfixe et chaque type, et liste les 50 plus grosses clés ; l’analyse de 20 000 clés prend environ une seconde. La suppression par motif affiche d’abord les clés concernées et ne supprime qu’une fois le motif retapé. Les infos serveur, le slow log, la liste des clients, Pub/Sub et MONITOR s’ouvrent au même endroit.`,`Vous pouvez aussi choisir Elasticsearch 8 ou OpenSearch 2 dans « Se connecter à une base de données ». Écrivez vos requêtes comme dans Kibana Dev Tools, par exemple <code>GET /orders/_search</code>, puis Ctrl+Entrée (Cmd+Entrée sur Mac) : les résultats arrivent sous forme de tableau. Faites un clic droit sur une ligne pour ouvrir le document, modifier son JSON et l’enregistrer. Si quelqu’un l’a modifié entre-temps, Planche signale un conflit au lieu de l’écraser.`,`Quand une cellule contient du HTML, un clic affiche la page rendue ; les scripts qu’elle contient ne s’exécutent pas. Les visionneuses texte, JSON et HTML sont plus grandes et ont un bouton plein écran.`]}}],s=[`en`,`ko`,`ja`,`zh`,`de`,`fr`];function c(){return o[0]?.id??``}function l(e,t=3){return o.filter(t=>!e||t.id>e).slice(0,t)}var u={confirmDestructive:!0,warnInEditor:!0,previewAffectedRows:!0,allowReadOnlyOverride:!0,previewGridCommit:!0,resultRowLimit:500,executeScope:`script`},d=t()(n(t=>({...u,locale:`auto`,onboardingDismissed:!1,termsAcceptedVersion:0,changelogSeen:``,analyticsEnabled:!0,persistQueryHistory:!0,aiPreferences:{provider:`anthropic`,model:i.anthropic,baseUrl:``,remember:!1},update:e=>t(e),setOnboardingDismissed:e=>t({onboardingDismissed:e}),acceptTerms:()=>{e(`terms_accept`,{version:1}),t(e=>({termsAcceptedVersion:1,changelogSeen:e.termsAcceptedVersion===0&&!e.changelogSeen?c():e.changelogSeen}))},markChangelogSeen:()=>t({changelogSeen:c()}),setLocale:n=>{e(`locale_change`,{locale:n}),t({locale:n})},setAnalyticsEnabled:e=>t({analyticsEnabled:e}),setPersistQueryHistory:e=>t({persistQueryHistory:e}),setAiPreferences:e=>t(t=>({aiPreferences:{...t.aiPreferences,...e}}))}),{name:`planche-settings`,storage:r()})),f=()=>d(e=>e.termsAcceptedVersion>=1);export{s as a,o as i,d as n,l as o,f as r,a as s,u as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r,t as i}from"./Cu_sGzNJ.js";import{t as a}from"./CgQ0qqq4.js";import{N as o,t as s}from"./S7HbowYz.js";import{n as c}from"./D8_hwGjG.js";import{n as l}from"./C1gqjEN3.js";import{a as u}from"./BHe42P9W.js";import{a as d}from"./BvEGx3Si.js";import{At as f,E as p,St as m,dt as h}from"./B8zpsP_u.js";var g=e(t(),1),_=r(),v=e=>e instanceof Error?e.message:String(e);function y({connectionId:e,tabId:t,item:r}){let{t:y}=n(),x=s(t=>t.activeConnections.find(t=>t.id===e)?.serverConnectionId??null),S=s(t=>t.activeConnections.find(t=>t.id===e)?.readOnly??!1),[C,w]=(0,g.useState)(null),[T,E]=(0,g.useState)(!1),[D,O]=(0,g.useState)(null),[k,A]=(0,g.useState)(`tree`),[j,M]=(0,g.useState)(``),[N,P]=(0,g.useState)(!1),F=o(r.database,r.name),I=(0,g.useCallback)(async()=>{if(x)try{let e=(await u(x)(`GET ${F}`,``)).reply;if(!e?.found){E(!0),w(null);return}E(!1),w({source:e._source,version:e._version??null,seqNo:e._seq_no??null,primaryTerm:e._primary_term??null}),M(JSON.stringify(e._source,null,2))}catch(e){/not_found|404/.test(v(e))?E(!0):O(v(e))}},[x,F]);(0,g.useEffect)(()=>{Promise.resolve().then(()=>I())},[I]);let L=(n,r=!1)=>d(e,n,{database:``,tabId:t,skipDestructiveConfirm:r}),R=async()=>{if(!C)return;let e;try{e=JSON.parse(j)}catch(e){O(y(`docViewer.invalidJson`,{message:v(e)}));return}P(!0),O(null);try{let t=C.seqNo!==null&&C.primaryTerm!==null?`?if_seq_no=${C.seqNo}&if_primary_term=${C.primaryTerm}`:``;await L(`PUT ${F}${t}\n${JSON.stringify(e,null,2)}`),await I(),A(`tree`)}catch(e){if(e instanceof Error&&e.name===`ExecutionCancelled`)return;let t=v(e);O(/version_conflict/.test(t)?y(`docViewer.conflict`):t)}finally{P(!1)}},z=async()=>{let n=`DELETE ${F}`;if(await c.getState().requestDestructiveConfirm({title:y(`docViewer.deleteTitle`,{id:r.name}),description:y(`docViewer.deleteDescription`,{index:r.database}),statements:[n],confirmLabel:y(`docViewer.delete`)}))try{await L(n,!0),l.getState().removeQueryTab(e,t)}catch(e){e instanceof Error&&e.name===`ExecutionCancelled`||O(v(e))}};if(!x)return(0,_.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:y(`keyViewer.notConnected`)});let B=`flex h-7 items-center gap-1 rounded border bg-background px-2 text-xs text-muted-foreground hover:text-foreground disabled:opacity-40`,V=e=>`rounded px-2 py-0.5 ${e?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`}`,H=C!==null&&j!==JSON.stringify(C.source,null,2);return(0,_.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,_.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-x-3 gap-y-1.5 border-b bg-muted/30 px-3 py-1.5 text-xs`,children:[(0,_.jsx)(`span`,{className:`rounded bg-primary/15 px-1.5 py-0.5 font-mono text-[10px] font-semibold uppercase text-primary`,children:`doc`}),(0,_.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[r.database,(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:` / `}),r.name]}),C&&(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:y(`docViewer.meta`,{version:C.version??`—`,seqNo:C.seqNo??`—`,primaryTerm:C.primaryTerm??`—`})}),(0,_.jsx)(`div`,{className:`flex-1`}),(0,_.jsxs)(`button`,{type:`button`,className:B,onClick:()=>{O(null),I()},children:[(0,_.jsx)(f,{className:`size-3`}),y(`keyViewer.refresh`)]}),(0,_.jsxs)(`button`,{type:`button`,className:B,onClick:()=>h(e,`GET ${F}`,``,r.name),children:[(0,_.jsx)(a,{className:`size-3`}),y(`keyViewer.openInConsole`)]}),!S&&!T&&(0,_.jsxs)(`button`,{type:`button`,className:`${B} hover:border-destructive/40 hover:text-destructive`,onClick:()=>void z(),children:[(0,_.jsx)(m,{className:`size-3`}),y(`docViewer.delete`)]})]}),D&&(0,_.jsxs)(`div`,{className:`flex flex-shrink-0 items-start gap-2 border-b border-destructive/30 bg-destructive/10 px-3 py-1.5 text-xs text-destructive`,children:[(0,_.jsx)(`span`,{className:`flex-1 whitespace-pre-wrap`,children:D}),(0,_.jsx)(`button`,{type:`button`,onClick:()=>O(null),children:(0,_.jsx)(i,{className:`size-3.5`})})]}),T?(0,_.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:y(`docViewer.gone`)}):C?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`flex flex-shrink-0 items-center gap-2 border-b px-3 py-1.5 text-xs`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-0.5 rounded border p-0.5`,children:[(0,_.jsx)(`button`,{type:`button`,className:V(k===`tree`),onClick:()=>A(`tree`),children:y(`keyViewer.viewTree`)}),(0,_.jsx)(`button`,{type:`button`,className:V(k===`text`),onClick:()=>A(`text`),children:y(`keyViewer.viewText`)})]}),(0,_.jsx)(`div`,{className:`flex-1`}),!S&&(0,_.jsxs)(_.Fragment,{children:[H&&(0,_.jsx)(`button`,{type:`button`,onClick:()=>M(JSON.stringify(C.source,null,2)),className:`rounded border bg-background px-2 py-0.5 text-muted-foreground hover:text-foreground`,children:y(`keyViewer.revert`)}),(0,_.jsx)(`button`,{type:`button`,disabled:!H||N,onClick:()=>void R(),className:`rounded border border-primary/30 bg-primary/10 px-2 py-0.5 text-primary hover:bg-primary/20 disabled:opacity-40`,children:y(`keyViewer.save`)})]})]}),k===`tree`?(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto py-3 pl-7 pr-3 font-mono text-xs`,children:(0,_.jsx)(p,{value:H?b(j)??C.source:C.source,defaultExpanded:!0})}):(0,_.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none bg-background p-3 font-mono text-xs outline-none`,spellCheck:!1,readOnly:S,value:j,onChange:e=>M(e.target.value)})]}):(0,_.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:y(`keyViewer.loading`)})]})}function b(e){try{return JSON.parse(e)}catch{return}}export{y as DocumentViewer};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{a as r}from"./BniymiMs.js";import{i,r as a}from"./Cu_sGzNJ.js";import{a as o,i as s,n as c,o as l,t as u}from"./DzRyVlxz.js";import{t as d}from"./S7HbowYz.js";import{n as f}from"./D8_hwGjG.js";import{l as p}from"./BHe42P9W.js";import{t as m}from"./BRZhVXRC.js";import{C as h,S as g,T as _,b as v,gt as y,l as b,w as x,x as S}from"./B8zpsP_u.js";var C=e(t(),1),w=a();function T(){let e=d.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function E(e){let t=T();if(!t)throw Error(r.t(`command.noActiveConnection`));let n=m().getQuery(e===`global`?`SHOW_GLOBAL_VARIABLES`:`SHOW_SESSION_VARIABLES`);return(await p(t,n)).records.map(e=>({Variable_name:e[0],Value:e[1]}))}function D(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:a}=f(),[d,p]=(0,C.useState)([]),[m,T]=(0,C.useState)(``),[D,O]=(0,C.useState)(`session`),k=t===`variables`,A=(0,C.useCallback)(t=>E(t).then(p).catch(t=>a(e(`command.variables.loadError`,{message:t instanceof Error?t.message:String(t)}))),[a,e]);(0,C.useEffect)(()=>{k&&A(D)},[k,D,A]);let j=(0,C.useMemo)(()=>{if(!m.trim())return d;let e=m.toLowerCase();return d.filter(t=>t.Variable_name.toLowerCase().includes(e)||t.Value.toLowerCase().includes(e))},[d,m]);function M(e){e||(T(``),r())}function N(e){O(e)}return(0,w.jsx)(u,{open:k,onOpenChange:M,children:(0,w.jsxs)(c,{className:`sm:max-w-[900px] max-h-[80vh] flex flex-col`,children:[(0,w.jsx)(o,{children:(0,w.jsx)(l,{children:e(`command.variables.title`)})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 pb-2`,children:[(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(n,{variant:D===`session`?`default`:`outline`,size:`sm`,onClick:()=>N(`session`),children:e(`command.scope.session`)}),(0,w.jsx)(n,{variant:D===`global`?`default`:`outline`,size:`sm`,onClick:()=>N(`global`),children:e(`command.scope.global`)})]}),(0,w.jsx)(b,{placeholder:e(`command.variables.filterPlaceholder`),value:m,onChange:e=>T(e.target.value),className:`max-w-xs`})]}),(0,w.jsx)(`div`,{className:`flex-1 border rounded-md overflow-hidden min-h-0`,children:(0,w.jsx)(y,{className:`h-[400px]`,children:(0,w.jsxs)(v,{children:[(0,w.jsx)(x,{children:(0,w.jsxs)(_,{children:[(0,w.jsx)(h,{className:`w-[300px]`,children:e(`command.variableName`)}),(0,w.jsx)(h,{children:e(`command.value`)})]})}),(0,w.jsx)(S,{children:j.length===0?(0,w.jsx)(_,{children:(0,w.jsx)(g,{colSpan:2,className:`text-center text-muted-foreground`,children:e(`command.variables.empty`)})}):j.map(e=>(0,w.jsxs)(_,{children:[(0,w.jsx)(g,{className:`font-mono text-xs`,children:e.Variable_name}),(0,w.jsx)(g,{className:`font-mono text-xs`,children:e.Value})]},e.Variable_name))})]})})}),(0,w.jsx)(s,{children:(0,w.jsx)(n,{variant:`outline`,onClick:()=>M(!1),children:e(`command.close`)})})]})})}export{D as VariablesDialog};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{F as i}from"./S7HbowYz.js";import{n as a}from"./C1gqjEN3.js";import{h as o}from"./BvEGx3Si.js";import{t as s}from"./Br4335vw.js";import{t as c}from"./BYvM8E39.js";import{t as l}from"./CP2U-viH.js";import{t as u}from"./_zaonxnw.js";var d=e(t(),1),f=r(),p=1e5,m=500,h=20;function g({connectionId:e,tabId:t,input:r}){let{t:g}=n(),_=s(e,t,``),[v,...y]=r.trim().split(/\s+/),[b,x]=(0,d.useState)(v||`db0`),[S,C]=(0,d.useState)(y.join(` `)||``),[w,T]=(0,d.useState)(null),[E,D]=(0,d.useState)(``),[O,k]=(0,d.useState)(null),[A,j]=(0,d.useState)(null),[M,N]=(0,d.useState)(null),P=(0,d.useRef)(!1),[F,I]=(0,d.useState)(0),L=async()=>{if(S.trim()){k(`preview`),N(null),j(null),D(``),P.current=!1;try{let e=new Set,t=`0`;do{let n=await _.read(`SCAN ${t} MATCH ${i(S)} COUNT 1000`,b);t=String(n[0]);for(let t of n[1])e.add(t)}while(t!==`0`&&e.size<p&&!P.current);T({pattern:S,database:b,keys:[...e].slice(0,p),capped:t!==`0`})}catch(e){N(u(e))}finally{k(null)}}},R=async()=>{if(!w||E!==w.pattern)return;k(`delete`),N(null),P.current=!1;let n=0,r=performance.now();try{for(let e=0;e<w.keys.length&&!P.current;e+=m){let t=w.keys.slice(e,e+m);await _.write(`UNLINK ${t.map(i).join(` `)}`,{confirmed:!0,database:w.database,skipHistory:!0}),n+=t.length,j(n)}}catch(e){e instanceof Error&&e.name===`ExecutionCancelled`||N(u(e))}finally{a.getState().recordExecution({connectionId:e,tabId:t,query:`UNLINK <${n} keys matching ${w.pattern}>`,database:w.database,executionTime:Math.round(performance.now()-r),kind:`UNLINK`,affectedRows:n}),k(null),T(null),D(``),I(e=>e+1),o(e)}};return _.readOnly?(0,f.jsx)(l,{title:g(`tools.redis.delete`),onRefresh:async()=>{},error:null,onDismissError:()=>{},children:(0,f.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:g(`tools.redis.deleteReadOnly`)})}):(0,f.jsx)(l,{title:g(`tools.redis.delete`),onRefresh:async()=>{O||await L()},error:M,onDismissError:()=>N(null),children:(0,f.jsxs)(`div`,{className:`max-w-3xl space-y-4 p-4 text-xs`,children:[(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:g(`tools.redis.deleteIntro`)}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(c,{access:_,value:b,onChange:e=>{x(e),T(null)},disabled:O!==null,version:F}),(0,f.jsx)(`input`,{className:`h-7 w-80 rounded border bg-background px-2 font-mono`,placeholder:`session:*`,value:S,disabled:O!==null,onChange:e=>{C(e.target.value),T(null)},onKeyDown:e=>{e.key===`Enter`&&L()}}),O===`preview`?(0,f.jsx)(`button`,{type:`button`,onClick:()=>{P.current=!0},className:`h-7 rounded border bg-background px-2 text-muted-foreground`,children:g(`tools.stop`)}):(0,f.jsx)(`button`,{type:`button`,disabled:!S.trim()||O!==null,onClick:()=>void L(),className:`h-7 rounded border border-primary/30 bg-primary/10 px-2 text-primary hover:bg-primary/20 disabled:opacity-40`,children:g(`tools.redis.preview`)})]}),S.trim()===`*`&&(0,f.jsx)(`p`,{className:`text-catppuccin-yellow`,children:g(`tools.redis.deleteAllWarning`)}),w&&(0,f.jsxs)(`div`,{className:`space-y-3 rounded-lg border p-3`,children:[(0,f.jsxs)(`p`,{children:[(0,f.jsx)(`strong`,{children:g(`tools.redis.matchCount`,{count:w.keys.length.toLocaleString(),database:w.database})}),w.capped&&(0,f.jsx)(`span`,{className:`ml-2 text-catppuccin-yellow`,children:g(`tools.redis.matchCapped`,{cap:p.toLocaleString()})})]}),w.keys.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`ul`,{className:`max-h-48 overflow-auto rounded bg-muted/40 p-2 font-mono`,children:[w.keys.slice(0,h).map(e=>(0,f.jsx)(`li`,{className:`truncate`,children:e},e)),w.keys.length>h&&(0,f.jsxs)(`li`,{className:`text-muted-foreground`,children:[`… `,(w.keys.length-h).toLocaleString()]})]}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:g(`tools.redis.deleteConfirm`,{pattern:w.pattern})}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`input`,{className:`h-7 w-80 rounded border bg-background px-2 font-mono`,value:E,onChange:e=>D(e.target.value),placeholder:w.pattern}),O===`delete`?(0,f.jsx)(`button`,{type:`button`,onClick:()=>{P.current=!0},className:`h-7 rounded border bg-background px-2 text-muted-foreground`,children:g(`tools.stop`)}):(0,f.jsx)(`button`,{type:`button`,disabled:E!==w.pattern,onClick:()=>void R(),className:`h-7 rounded bg-destructive px-3 text-white disabled:opacity-40`,children:g(`tools.redis.deleteKeys`,{count:w.keys.length.toLocaleString()})})]}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:g(`tools.redis.deleteNote`)})]})]}),A!==null&&(0,f.jsx)(`p`,{className:`text-primary`,children:g(`tools.redis.deletedCount`,{count:A.toLocaleString()})})]})})}export{g as BulkDelete};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{i as n,r}from"./Cu_sGzNJ.js";import{n as i}from"./D8_hwGjG.js";import{t as a}from"./Br4335vw.js";import{i as o,t as s}from"./Udlj1Cgf.js";import{t as c}from"./CP2U-viH.js";import{t as l}from"./_zaonxnw.js";var u=e(t(),1),d=r(),f=[`id`,`addr`,`name`,`user`,`db`,`age`,`idle`,`cmd`,`flags`];function p({connectionId:e,tabId:t}){let{t:r}=n(),p=a(e,t,``),[m,h]=(0,u.useState)(null),[g,_]=(0,u.useState)(null),[v,y]=(0,u.useState)(null),b=(0,u.useCallback)(async()=>{try{h(o(String(await p.read(`CLIENT LIST`))));let e=await p.tryRead(`CLIENT ID`);_(e===null?null:String(e)),y(null)}catch(e){y(l(e))}},[p]);(0,u.useEffect)(()=>{Promise.resolve().then(()=>b())},[b]);let x=async e=>{let t=`CLIENT KILL ID ${e.id}`;if(await i.getState().requestDestructiveConfirm({title:r(`tools.redis.killTitle`,{addr:e.addr}),description:r(`tools.redis.killDescription`),statements:[t],confirmLabel:r(`tools.redis.kill`)}))try{await p.write(t,{confirmed:!0}),await b()}catch(e){e instanceof Error&&e.name===`ExecutionCancelled`||y(l(e))}};return(0,d.jsx)(c,{title:r(`tools.redis.clients`),onRefresh:b,autoRefresh:!0,error:v,onDismissError:()=>y(null),children:m&&(0,d.jsxs)(`table`,{className:`w-full border-collapse text-xs`,children:[(0,d.jsx)(`thead`,{className:`sticky top-0 bg-muted text-left text-muted-foreground`,children:(0,d.jsxs)(`tr`,{children:[f.map(e=>(0,d.jsx)(`th`,{className:`px-3 py-1.5`,children:e},e)),(0,d.jsx)(`th`,{className:`w-20`})]})}),(0,d.jsx)(`tbody`,{children:m.map(e=>{let t=e.id===g;return(0,d.jsxs)(`tr`,{className:`border-b border-border/50 hover:bg-muted/40 ${t?`bg-primary/5`:``}`,children:[f.map(n=>(0,d.jsxs)(`td`,{className:`px-3 py-1 font-mono`,children:[n===`age`||n===`idle`?s(Number(e[n])):e[n]??``,n===`id`&&t&&(0,d.jsx)(`span`,{className:`ml-2 rounded bg-primary/15 px-1 text-[10px] text-primary`,children:r(`tools.redis.thisApp`)})]},n)),(0,d.jsx)(`td`,{className:`px-2 py-1 text-right`,children:!t&&!p.readOnly&&(0,d.jsx)(`button`,{type:`button`,onClick:()=>void x(e),className:`rounded border px-2 py-0.5 text-muted-foreground hover:border-destructive/40 hover:text-destructive`,children:r(`tools.redis.kill`)})})]},e.id)})})]})})}export{p as Clients};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{i as r,r as i}from"./Cu_sGzNJ.js";import{a,i as o,n as s,o as c,t as l}from"./DzRyVlxz.js";import{t as u}from"./S7HbowYz.js";import{n as d,t as f}from"./D8_hwGjG.js";import{a as p}from"./BHe42P9W.js";import{r as m}from"./BRZhVXRC.js";import{a as h,h as g}from"./BvEGx3Si.js";import{K as _,c as v,l as y,q as b}from"./B8zpsP_u.js";var x=e(t(),1),S=i();function C(){let{t:e}=r(),{activeDialog:t,closeDialog:i}=d(),C=f(`copy-database`),w=t===`copy-database`,T=C?.database??``,[E,D]=(0,x.useState)(``),[O,k]=(0,x.useState)(`structure_data`),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(null);function P(e){e||(i(),N(null),j(null),D(``),k(`structure_data`))}async function F(){let t=u.getState().activeConnectionId,n=E.trim();if(!t||!n||!T)return;N(null);let r=m(t),i=u.getState().activeConnections.find(e=>e.id===t);if(i?.serverConnectionId)try{j(e(`database.copy.creating`,{database:n})),await h(t,r.getQuery(`CREATE_DATABASE`,n,`utf8mb4`,`utf8mb4_general_ci`));let a=p(i.serverConnectionId),o=await r.introspect.listTables(a,T);for(let[r,i]of o.entries()){j(e(`database.copy.copying`,{table:i.name,index:r+1,total:o.length}));let a={connectionId:t,database:T,table:i.name},s={connectionId:t,database:n,table:i.name},c=await _(a,s);await b({source:a,target:s,mode:O,onConflict:`abort`,createSql:m(t).ddl.createTable(c)})}await g(t),P(!1)}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(null)}}return(0,S.jsx)(l,{open:w,onOpenChange:P,children:(0,S.jsxs)(s,{className:`sm:max-w-[450px]`,children:[(0,S.jsx)(a,{children:(0,S.jsx)(c,{children:e(`database.copy.title`)})}),(0,S.jsxs)(`div`,{className:`space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(v,{children:e(`database.copy.source`)}),(0,S.jsx)(y,{value:T,disabled:!0})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(v,{htmlFor:`target-db-name`,children:e(`database.copy.target`)}),(0,S.jsx)(y,{id:`target-db-name`,value:E,onChange:e=>D(e.target.value),placeholder:e(`database.copy.targetPlaceholder`)})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(v,{children:e(`database.copy.options`)}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`copy-option`,value:`structure_data`,checked:O===`structure_data`,onChange:()=>k(`structure_data`)}),e(`database.copy.structureAndData`)]}),(0,S.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer`,children:[(0,S.jsx)(`input`,{type:`radio`,name:`copy-option`,value:`structure_only`,checked:O===`structure_only`,onChange:()=>k(`structure_only`)}),e(`database.copy.structureOnly`)]})]})]})]}),A&&(0,S.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,children:A}),M&&(0,S.jsx)(`p`,{className:`px-1 text-xs text-destructive leading-relaxed`,children:M}),(0,S.jsxs)(o,{children:[(0,S.jsx)(n,{variant:`outline`,onClick:()=>P(!1),children:e(`database.copy.cancel`)}),(0,S.jsx)(n,{onClick:()=>void F(),disabled:!E.trim()||A!==null,children:e(`database.copy.copy`)})]})]})})}export{C as CopyDatabaseDialog};
@@ -0,0 +1 @@
1
+ import{t as e}from"./CiL8zoYm.js";import{i as t,r as n}from"./Cu_sGzNJ.js";import{a as r,i,n as a,o,r as s,t as c}from"./DzRyVlxz.js";import{n as l}from"./D8_hwGjG.js";import{Y as u,t as d}from"./B8zpsP_u.js";var f=n(),p=`https://planche.dev`,m=`/third-party-notices.txt`;function h(){let n=l(e=>e.activeDialog),h=l(e=>e.closeDialog),{t:g}=t();return(0,f.jsx)(c,{open:n===`about`,onOpenChange:e=>{e||h()},children:(0,f.jsxs)(a,{className:`sm:max-w-[440px]`,children:[(0,f.jsx)(r,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(d,{size:44,className:`shrink-0`}),(0,f.jsxs)(`div`,{className:`grid gap-1`,children:[(0,f.jsx)(o,{children:g(`about.title`)}),(0,f.jsx)(s,{children:g(`about.tagline`)})]})]})}),(0,f.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[(0,f.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1`,children:[(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.version`)}),(0,f.jsx)(`dd`,{children:`0.1.1`}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.website`)}),(0,f.jsx)(`dd`,{children:(0,f.jsx)(`a`,{href:p,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p})}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.licenses`)}),(0,f.jsx)(`dd`,{children:(0,f.jsx)(`a`,{href:m,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.licensesLink`)})}),(0,f.jsx)(`dt`,{className:`text-muted-foreground`,children:g(`about.legal`)}),(0,f.jsxs)(`dd`,{className:`flex gap-3`,children:[(0,f.jsx)(`a`,{href:u.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.terms`)}),(0,f.jsx)(`a`,{href:u.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.privacy`)}),(0,f.jsx)(`a`,{href:u.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.refund`)})]})]}),(0,f.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`© 2026 Juwon Jeong. `,g(`about.rights`)]}),(0,f.jsx)(`p`,{className:`rounded-md border bg-muted/40 p-3 text-xs text-muted-foreground`,children:g(`about.disclaimer`)}),(0,f.jsxs)(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/5 p-3 text-xs text-muted-foreground`,children:[(0,f.jsx)(`p`,{className:`mb-1 font-medium text-amber-600 dark:text-amber-400`,children:g(`pro.noticeTitle`)}),(0,f.jsx)(`p`,{children:g(`pro.notice`)})]})]}),(0,f.jsx)(i,{children:(0,f.jsx)(e,{onClick:h,children:g(`settings.done`)})})]})})}export{h as AboutDialog};
@@ -0,0 +1,41 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{a as n,d as r,i,o as a,s as o,t as s,u as c}from"./CiL8zoYm.js";import{r as l,t as u}from"./Cu_sGzNJ.js";var d=e(t(),1),f=l(),p=Object.defineProperty,m=(e,t)=>p(e,`name`,{value:t,configurable:!0});function h(e,t){let n=d.createContext(t);n.displayName=e+`Context`;let r=m(e=>{let{children:t,...r}=e,i=d.useMemo(()=>r,Object.values(r));return(0,f.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=d.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return m(i,`useContext`),[r,i]}m(h,`createContext`);function g(e,t=[]){let n=[];function r(t,r){let i=d.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=m(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=d.useMemo(()=>o,Object.values(o));return(0,f.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=d.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return m(s,`useContext`),[o,s]}m(r,`createContext`);let i=m(()=>{let t=n.map(e=>d.createContext(e));return m(function(n){let r=n?.[e]||t;return d.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,_(i,...t)]}m(g,`createContextScope`);function _(...e){let t=e[0];if(e.length===1)return t;let n=m(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return m(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}m(_,`composeContextScopes`);var v=Object.defineProperty,y=(e,t)=>v(e,`name`,{value:t,configurable:!0}),b=!!(typeof window<`u`&&window.document&&window.document.createElement);function x(e,t,{checkForDefaultPrevented:n=!0}={}){return y(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}y(x,`composeEventHandlers`);function ee(e){if(!b)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}y(ee,`getOwnerWindow`);function S(e){if(!b)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}y(S,`getOwnerDocument`);function C(e,t=!1){let{activeElement:n}=S(e);if(!n?.nodeName)return null;if(te(n)&&n.contentDocument)return C(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=S(n).getElementById(e);if(t)return t}}return n}y(C,`getActiveElement`);function te(e){return e.tagName===`IFRAME`}y(te,`isFrame`);var w=globalThis?.document?d.useLayoutEffect:()=>{},ne=Object.defineProperty,re=(e,t)=>ne(e,`name`,{value:t,configurable:!0}),T=d.useEffectEvent,E=d.useInsertionEffect;function D(e){if(typeof T==`function`)return T(e);let t=d.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof E==`function`?E(()=>{t.current=e}):w(()=>{t.current=e}),d.useMemo(()=>((...e)=>t.current?.(...e)),[])}re(D,`useEffectEvent`);var ie=Object.defineProperty,O=(e,t)=>ie(e,`name`,{value:t,configurable:!0}),ae=d.useInsertionEffect||w;function oe({prop:e,defaultProp:t,onChange:n=O(()=>{},`onChange`),caller:r}){let[i,a,o]=se({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,d.useCallback(t=>{if(s){let n=ce(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}O(oe,`useControllableState`);function se({defaultProp:e,onChange:t}){let[n,r]=d.useState(e),i=d.useRef(n),a=d.useRef(t);return ae(()=>{a.current=t},[t]),d.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}O(se,`useUncontrolledState`);function ce(e){return typeof e==`function`}O(ce,`isFunction`);var le=Symbol(`RADIX:SYNC_STATE`);function ue(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=D(o),u=[{...n,state:a}];r&&u.push(r);let[f,p]=d.useReducer((t,n)=>{if(n.type===le)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),m=f.state,h=d.useRef(m);d.useEffect(()=>{h.current!==m&&(h.current=m,c||l(m))},[m,h,c]);let g=d.useMemo(()=>i===void 0?f:{...f,state:i},[f,i]);return d.useEffect(()=>{c&&!Object.is(i,f.state)&&p({type:le,state:i})},[i,f.state,c]),[g,p]}O(ue,`useControllableStateReducer`);var de=e(r(),1),fe=Object.defineProperty,k=(e,t)=>fe(e,`name`,{value:t,configurable:!0});function pe(e,t){return d.useReducer((e,n)=>t[e][n]??e,e)}k(pe,`useStateMachine`);var A=k(e=>{let{present:t,children:n}=e,r=me(t),i=typeof n==`function`?n({present:r.isPresent}):d.Children.only(n),a=ge(r.ref,_e(i));return typeof n==`function`||r.isPresent?d.cloneElement(i,{ref:a}):null},`Presence`);function me(e){let[t,n]=d.useState(),r=d.useRef(null),i=d.useRef(e),a=d.useRef(`none`),o=d.useRef(void 0),[s,c]=pe(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return d.useEffect(()=>{s===`mounted`?(a.current=o.current??j(r.current),o.current=void 0):a.current=`none`},[s]),w(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=j(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),w(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=k(a=>{let o=j(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=k(e=>{e.target===t&&(a.current=j(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:d.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=j(t)}else r.current=null;n(e)},[])}}k(me,`usePresence`);function he(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}k(he,`setRef`);function ge(...e){let t=d.useRef(e);return t.current=e,d.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=he(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():he(n[e],null)}}},[])}k(ge,`useStableComposedRefs`);function j(e){return e?.animationName||`none`}k(j,`getAnimationName`);function _e(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}k(_e,`getElementRef`);var ve=Object.defineProperty,ye=(e,t)=>ve(e,`name`,{value:t,configurable:!0}),be=d.useId||(()=>void 0),xe=0;function M(e){let[t,n]=d.useState(be());return w(()=>{e||n(e=>e??String(xe++))},[e]),e||(t?`radix-${t}`:``)}ye(M,`useId`);var Se=Object.defineProperty,Ce=(e,t)=>Se(e,`name`,{value:t,configurable:!0});function N(e){let t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>((...e)=>t.current?.(...e)),[])}Ce(N,`useCallbackRef`);var we=Object.defineProperty,P=(e,t)=>we(e,`name`,{value:t,configurable:!0}),Te=`dismissableLayer.update`,Ee=`dismissableLayer.pointerDownOutside`,De=`dismissableLayer.focusOutside`,Oe,ke=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Ae=d.forwardRef(P(function(e,t){let{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:l,onDismiss:u,...p}=e,m=d.useContext(ke),[h,g]=d.useState(null),_=h?.ownerDocument??globalThis?.document,[,v]=d.useState({}),y=c(t,g),b=Array.from(m.layers),[ee]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),S=ee?b.indexOf(ee):-1,C=h?b.indexOf(h):-1,te=m.layersWithOutsidePointerEventsDisabled.size>0,w=C>=S,ne=d.useRef(!1),re=Ne(e=>{o?.(e),l?.(e),e.defaultPrevented||u?.()},{ownerDocument:_,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:ne,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:d.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...m.branches].some(t=>t.contains(e));return w&&!t},[m.branches,w])}),T=Pe(e=>{if(i&&ne.current)return;let t=e.target;[...m.branches].some(e=>e.contains(t))||(s?.(e),l?.(e),e.defaultPrevented||u?.())},_),E=h?C===b.length-1:!1,D=N(e=>{e.key===`Escape`&&(a?.(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))});return d.useEffect(()=>{if(E)return _.addEventListener(`keydown`,D,{capture:!0}),()=>_.removeEventListener(`keydown`,D,{capture:!0})},[_,E,D]),d.useEffect(()=>{if(h)return r&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Oe=_.body.style.pointerEvents,_.body.style.pointerEvents=`none`),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),Fe(),()=>{r&&(m.layersWithOutsidePointerEventsDisabled.delete(h),m.layersWithOutsidePointerEventsDisabled.size===0&&(_.body.style.pointerEvents=Oe))}},[h,_,r,m]),d.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),Fe())},[h,m]),d.useEffect(()=>{let e=P(()=>v({}),`handleUpdate`);return document.addEventListener(Te,e),()=>document.removeEventListener(Te,e)},[]),(0,f.jsx)(n.div,{...p,ref:y,style:{pointerEvents:te?w?`auto`:`none`:void 0,...e.style},onFocusCapture:x(e.onFocusCapture,T.onFocusCapture),onBlurCapture:x(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:x(e.onPointerDownCapture,re.onPointerDownCapture)})},`DismissableLayer`));function je(){let e=d.useContext(ke),[t,n]=d.useState(null);return d.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}P(je,`useDismissableLayerSurface`);var Me=P(()=>!0,`IS_TRUE`);function Ne(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Me}=t,s=N(e),c=d.useRef(!1),l=d.useRef(!1),u=d.useRef(new Map),f=d.useRef(()=>{});return d.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}P(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}P(t,`isOutsideInteractionIntercepted`);function d(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&f.current()},0)}P(d,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}P(p,`handleInteractionBubble`);let m=P(a=>{if(a.target&&!c.current){let d=function(){n.removeEventListener(`click`,f.current);let r=t();e(),r||Ie(Ee,s,p,{discrete:!0})};if(P(d,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,f.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?d():(n.removeEventListener(`click`,f.current),f.current=d,n.addEventListener(`click`,f.current,{once:!0}))}else n.removeEventListener(`click`,f.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,d,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,f.current);for(let e of h)n.removeEventListener(e,d,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:P(()=>c.current=!0,`onPointerDownCapture`)}}P(Ne,`usePointerDownOutside`);function Pe(e,t=globalThis?.document){let n=N(e),r=d.useRef(!1);return d.useEffect(()=>{let e=P(e=>{e.target&&!r.current&&Ie(De,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:P(()=>r.current=!0,`onFocusCapture`),onBlurCapture:P(()=>r.current=!1,`onBlurCapture`)}}P(Pe,`useFocusOutside`);function Fe(){let e=new CustomEvent(Te);document.dispatchEvent(e)}P(Fe,`dispatchUpdate`);function Ie(e,t,n,{discrete:r}){let i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?a(i,o):i.dispatchEvent(o)}P(Ie,`handleAndDispatchCustomEvent`);var Le=Object.defineProperty,F=(e,t)=>Le(e,`name`,{value:t,configurable:!0}),Re=`focusScope.autoFocusOnMount`,ze=`focusScope.autoFocusOnUnmount`,Be={bubbles:!1,cancelable:!0},Ve=d.forwardRef(F(function(e,t){let{loop:r=!1,trapped:i=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...s}=e,[l,u]=d.useState(null),p=N(a),m=N(o),h=d.useRef(null),g=c(t,u),_=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(i){let e=function(e){if(_.paused||!l)return;let t=e.target;l.contains(t)?h.current=t:I(h.current,{select:!0})},t=function(e){if(_.paused||!l)return;let t=e.relatedTarget;t!==null&&(l.contains(t)||I(h.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&I(l)};F(e,`handleFocusIn`),F(t,`handleFocusOut`),F(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return l&&r.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[i,l,_.paused]),d.useEffect(()=>{if(l){Je.add(_);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(Re,Be);l.addEventListener(Re,p),l.dispatchEvent(t),t.defaultPrevented||(He(Ze(We(l)),{select:!0}),document.activeElement===e&&I(l))}return()=>{l.removeEventListener(Re,p),setTimeout(()=>{let t=new CustomEvent(ze,Be);l.addEventListener(ze,m),l.dispatchEvent(t),t.defaultPrevented||I(e??document.body,{select:!0}),l.removeEventListener(ze,m),Je.remove(_)},0)}}},[l,p,m,_]);let v=d.useCallback(e=>{if(!r&&!i||_.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=document.activeElement;if(t&&n){let t=e.currentTarget,[i,a]=Ue(t);i&&a?!e.shiftKey&&n===a?(e.preventDefault(),r&&I(i,{select:!0})):e.shiftKey&&n===i&&(e.preventDefault(),r&&I(a,{select:!0})):n===t&&e.preventDefault()}},[r,i,_.paused]);return(0,f.jsx)(n.div,{tabIndex:-1,...s,ref:g,onKeyDown:v})},`FocusScope`));function He(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(I(r,{select:t}),document.activeElement!==n)return}F(He,`focusFirst`);function Ue(e){let t=We(e);return[Ge(t,e),Ge(t.reverse(),e)]}F(Ue,`getTabbableEdges`);function We(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:F(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}F(We,`getTabbableCandidates`);function Ge(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Ke(r,{upTo:t})))return r}F(Ge,`findVisible`);function Ke(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}F(Ke,`isHidden`);function qe(e){return e instanceof HTMLInputElement&&`select`in e}F(qe,`isSelectableInput`);function I(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&qe(e)&&t&&e.select()}}F(I,`focus`);var Je=Ye();function Ye(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Xe(e,t),e.unshift(t)},remove(t){e=Xe(e,t),e[0]?.resume()}}}F(Ye,`createFocusScopesStack`);function Xe(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}F(Xe,`arrayRemove`);function Ze(e){return e.filter(e=>e.tagName!==`A`)}F(Ze,`removeLinks`);var Qe=Object.defineProperty,$e=d.forwardRef(((e,t)=>Qe(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:r,...i}=e,[a,o]=d.useState(!1);w(()=>o(!0),[]);let s=r||a&&globalThis?.document?.body;return s?de.createPortal((0,f.jsx)(n.div,{...i,ref:t}),s):null},`Portal`)),et=Object.defineProperty,tt=(e,t)=>et(e,`name`,{value:t,configurable:!0}),L=0,R=null;function nt(e){return z(),e.children}tt(nt,`FocusGuards`);function z(){d.useEffect(()=>{R||={start:rt(),end:rt()};let{start:e,end:t}=R;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),L++,()=>{L===1&&(R?.start.remove(),R?.end.remove(),R=null),L=Math.max(0,L-1)}},[])}tt(z,`useFocusGuards`);function rt(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}tt(rt,`createFocusGuard`);var B=function(){return B=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},B.apply(this,arguments)};function it(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function at(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var V=`right-scroll-bar-position`,H=`width-before-scroll-bar`,ot=`with-scroll-bars-hidden`,st=`--removed-body-scroll-bar-size`;function ct(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function lt(e,t){var n=(0,d.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var ut=typeof window<`u`?d.useLayoutEffect:d.useEffect,dt=new WeakMap;function ft(e,t){var n=lt(t||null,function(t){return e.forEach(function(e){return ct(e,t)})});return ut(function(){var t=dt.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||ct(e,null)}),i.forEach(function(e){r.has(e)||ct(e,a)})}dt.set(n,e)},[e]),n}function pt(e){return e}function mt(e,t){t===void 0&&(t=pt);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function ht(e){e===void 0&&(e={});var t=mt(null);return t.options=B({async:!0,ssr:!1},e),t}var gt=function(e){var t=e.sideCar,n=it(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return d.createElement(r,B({},n))};gt.isSideCarExport=!0;function _t(e,t){return e.useMedium(t),gt}var vt=ht(),yt=function(){},U=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:yt,onWheelCapture:yt,onTouchMoveCapture:yt}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,_=e.allowPinchZoom,v=e.as,y=v===void 0?`div`:v,b=e.gapMode,x=it(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),ee=p,S=ft([n,t]),C=B(B({},x),i);return d.createElement(d.Fragment,null,u&&d.createElement(ee,{sideCar:vt,removeScrollBar:l,shards:f,noRelative:m,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!_,lockRef:n,gapMode:b}),o?d.cloneElement(d.Children.only(s),B(B({},C),{ref:S})):d.createElement(y,B({},C,{className:c,ref:S}),s))});U.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},U.classNames={fullWidth:H,zeroRight:V};var bt=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function xt(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=bt();return t&&e.setAttribute(`nonce`,t),e}function St(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ct(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var wt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=xt())&&(St(t,n),Ct(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Tt=function(){var e=wt();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Et=function(){var e=Tt();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Dt={left:0,top:0,right:0,gap:0},Ot=function(e){return parseInt(e||``,10)||0},kt=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Ot(n),Ot(r),Ot(i)]},At=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Dt;var t=kt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},jt=Et(),W=`data-scroll-locked`,Mt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
+ .${ot} {
3
+ overflow: hidden ${r};
4
+ padding-right: ${s}px ${r};
5
+ }
6
+ body[${W}] {
7
+ overflow: hidden ${r};
8
+ overscroll-behavior: contain;
9
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
10
+ padding-left: ${i}px;
11
+ padding-top: ${a}px;
12
+ padding-right: ${o}px;
13
+ margin-left:0;
14
+ margin-top:0;
15
+ margin-right: ${s}px ${r};
16
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
+ }
18
+
19
+ .${V} {
20
+ right: ${s}px ${r};
21
+ }
22
+
23
+ .${H} {
24
+ margin-right: ${s}px ${r};
25
+ }
26
+
27
+ .${V} .${V} {
28
+ right: 0 ${r};
29
+ }
30
+
31
+ .${H} .${H} {
32
+ margin-right: 0 ${r};
33
+ }
34
+
35
+ body[${W}] {
36
+ ${st}: ${s}px;
37
+ }
38
+ `},Nt=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Pt=function(){d.useEffect(function(){return document.body.setAttribute(W,(Nt()+1).toString()),function(){var e=Nt()-1;e<=0?document.body.removeAttribute(W):document.body.setAttribute(W,e.toString())}},[])},Ft=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Pt();var a=d.useMemo(function(){return At(i)},[i]);return d.createElement(jt,{styles:Mt(a,!t,i,n?``:`!important`)})},It=!1;if(typeof window<`u`)try{var G=Object.defineProperty({},"passive",{get:function(){return It=!0,!0}});window.addEventListener(`test`,G,G),window.removeEventListener(`test`,G,G)}catch{It=!1}var K=It?{passive:!1}:!1,Lt=function(e){return e.tagName===`TEXTAREA`},Rt=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Lt(e)&&n[t]===`visible`)},zt=function(e){return Rt(e,`overflowY`)},Bt=function(e){return Rt(e,`overflowX`)},Vt=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Wt(e,r)){var i=Gt(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ht=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Ut=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Wt=function(e,t){return e===`v`?zt(t):Bt(t)},Gt=function(e,t){return e===`v`?Ht(t):Ut(t)},Kt=function(e,t){return e===`h`&&t===`rtl`?-1:1},qt=function(e,t,n,r,i){var a=Kt(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Gt(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Wt(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Jt=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Yt=function(e){return[e.deltaX,e.deltaY]},Xt=function(e){return e&&`current`in e?e.current:e},Zt=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Qt=function(e){return`
39
+ .block-interactivity-${e} {pointer-events: none;}
40
+ .allow-interactivity-${e} {pointer-events: all;}
41
+ `},$t=0,q=[];function en(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),i=d.useState($t++)[0],a=d.useState(Et)[0],o=d.useRef(e);d.useEffect(function(){o.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=at([e.lockRef.current],(e.shards||[]).map(Xt),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=d.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Jt(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Vt(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Vt(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return qt(h,t,e,h===`h`?s:c,!0)},[]),c=d.useCallback(function(e){var n=e;if(!(!q.length||q[q.length-1]!==a)){var r=`deltaY`in n?Yt(n):Jt(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Zt(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Xt).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=d.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:tn(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=d.useCallback(function(e){n.current=Jt(e),r.current=void 0},[]),f=d.useCallback(function(t){l(t.type,Yt(t),t.target,s(t,e.lockRef.current))},[]),p=d.useCallback(function(t){l(t.type,Jt(t),t.target,s(t,e.lockRef.current))},[]);d.useEffect(function(){return q.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener(`wheel`,c,K),document.addEventListener(`touchmove`,c,K),document.addEventListener(`touchstart`,u,K),function(){q=q.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,K),document.removeEventListener(`touchmove`,c,K),document.removeEventListener(`touchstart`,u,K)}},[]);var m=e.removeScrollBar,h=e.inert;return d.createElement(d.Fragment,null,h?d.createElement(a,{styles:Qt(i)}):null,m?d.createElement(Ft,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function tn(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var nn=_t(vt,en),rn=d.forwardRef(function(e,t){return d.createElement(U,B({},e,{ref:t,sideCar:nn}))});rn.classNames=U.classNames;var an=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},J=new WeakMap,on=new WeakMap,Y={},sn=0,cn=function(e){return e&&(e.host||cn(e.parentNode))},ln=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=cn(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},un=function(e,t,n,r){var i=ln(t,Array.isArray(e)?e:[e]);Y[n]||(Y[n]=new WeakMap);var a=Y[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(J.get(e)||0)+1,l=(a.get(e)||0)+1;J.set(e,c),a.set(e,l),o.push(e),c===1&&i&&on.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),sn++,function(){o.forEach(function(e){var t=J.get(e)-1,i=a.get(e)-1;J.set(e,t),a.set(e,i),t||(on.has(e)||e.removeAttribute(r),on.delete(e)),i||e.removeAttribute(n)}),sn--,sn||(J=new WeakMap,J=new WeakMap,on=new WeakMap,Y={})}},dn=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||an(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),un(r,i,n,`aria-hidden`)):function(){return null}},fn=Object.defineProperty,X=(e,t)=>fn(e,`name`,{value:t,configurable:!0}),pn=`Dialog`,[mn,hn]=g(pn),[gn,Z]=mn(pn),_n=X(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=d.useRef(null),c=d.useRef(null),[l,u]=oe({prop:r,defaultProp:i??!1,onChange:a,caller:pn}),[p,m]=d.useState(0),[h,g]=d.useState(0);return(0,f.jsx)(gn,{scope:t,triggerRef:s,contentRef:c,contentId:M(),titleId:M(),descriptionId:M(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:l,onOpenChange:u,onOpenToggle:d.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),vn=`DialogTrigger`,yn=d.forwardRef(X(function(e,t){let{__scopeDialog:r,...i}=e,a=Z(vn,r),o=c(t,a.triggerRef);return(0,f.jsx)(n.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":$(a.open),...i,ref:o,onClick:x(e.onClick,a.onOpenToggle)})},`DialogTrigger`)),bn=`DialogPortal`,[xn,Sn]=mn(bn,{forceMount:void 0}),Cn=X(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Z(bn,t);return(0,f.jsx)(xn,{scope:t,forceMount:n,children:d.Children.map(r,e=>(0,f.jsx)(A,{present:n||a.open,children:(0,f.jsx)($e,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),wn=`DialogOverlay`,Tn=d.forwardRef(X(function(e,t){let n=Sn(wn,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Z(wn,e.__scopeDialog);return a.modal?(0,f.jsx)(A,{present:r||a.open,children:(0,f.jsx)(Dn,{...i,ref:t})}):null},`DialogOverlay`)),En=o(`DialogOverlay.RemoveScroll`),Dn=d.forwardRef(X(function(e,t){let{__scopeDialog:r,...i}=e,a=Z(wn,r),o=je(),s=c(t,o);return(0,f.jsx)(rn,{as:En,allowPinchZoom:!0,shards:[a.contentRef],children:(0,f.jsx)(n.div,{"data-state":$(a.open),...i,ref:s,style:{pointerEvents:`auto`,...i.style}})})},`DialogOverlayImpl`)),Q=`DialogContent`,On=d.forwardRef(X(function(e,t){let n=Sn(Q,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Z(Q,e.__scopeDialog);return(0,f.jsx)(A,{present:r||a.open,children:a.modal?(0,f.jsx)(kn,{...i,ref:t}):(0,f.jsx)(An,{...i,ref:t})})},`DialogContent`)),kn=d.forwardRef(X(function(e,t){let n=Z(Q,e.__scopeDialog),r=d.useRef(null),i=c(t,n.contentRef,r);return d.useEffect(()=>{let e=r.current;if(e)return dn(e)},[]),(0,f.jsx)(jn,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:x(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:x(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:x(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),An=d.forwardRef(X(function(e,t){let n=Z(Q,e.__scopeDialog),r=d.useRef(!1),i=d.useRef(!1);return(0,f.jsx)(jn,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),jn=d.forwardRef(X(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Z(Q,n);return z(),(0,f.jsx)(f.Fragment,{children:(0,f.jsx)(Ve,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,f.jsx)(Ae,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":$(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Mn=`DialogTitle`,Nn=d.forwardRef(X(function(e,t){let{__scopeDialog:r,...i}=e,a=Z(Mn,r),{setTitleCount:o}=a;return w(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),(0,f.jsx)(n.h2,{id:a.titleId,...i,ref:t})},`DialogTitle`)),Pn=`DialogDescription`,Fn=d.forwardRef(X(function(e,t){let{__scopeDialog:r,...i}=e,a=Z(Pn,r),{setDescriptionCount:o}=a;return w(()=>(o(e=>e+1),()=>o(e=>e-1)),[o]),(0,f.jsx)(n.p,{id:a.descriptionId,...i,ref:t})},`DialogDescription`)),In=`DialogClose`,Ln=d.forwardRef(X(function(e,t){let{__scopeDialog:r,...i}=e,a=Z(In,r);return(0,f.jsx)(n.button,{type:`button`,...i,ref:t,onClick:x(e.onClick,()=>a.onOpenChange(!1))})},`DialogClose`));function $(e){return e?`open`:`closed`}X($,`getState`);function Rn({...e}){return(0,f.jsx)(_n,{"data-slot":`dialog`,...e})}function zn({...e}){return(0,f.jsx)(Cn,{"data-slot":`dialog-portal`,...e})}function Bn({className:e,...t}){return(0,f.jsx)(Tn,{"data-slot":`dialog-overlay`,className:i(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Vn({className:e,children:t,showCloseButton:n=!0,...r}){return(0,f.jsxs)(zn,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(Bn,{}),(0,f.jsxs)(On,{"data-slot":`dialog-content`,className:i(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,f.jsxs)(Ln,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(u,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Hn({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:i(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Un({className:e,showCloseButton:t=!1,children:n,...r}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:i(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,f.jsx)(Ln,{asChild:!0,children:(0,f.jsx)(s,{variant:`outline`,children:`Close`})})]})}function Wn({className:e,...t}){return(0,f.jsx)(Nn,{"data-slot":`dialog-title`,className:i(`text-lg leading-none font-semibold`,e),...t})}function Gn({className:e,...t}){return(0,f.jsx)(Fn,{"data-slot":`dialog-description`,className:i(`text-sm text-muted-foreground`,e),...t})}export{M as C,x as D,w as E,g as O,N as S,oe as T,rn as _,Hn as a,Ve as b,Ln as c,Tn as d,Cn as f,dn as g,hn as h,Un as i,On as l,yn as m,Vn as n,Wn as o,Nn as p,Gn as r,_n as s,Rn as t,Fn as u,z as v,A as w,Ae as x,$e as y};
@@ -0,0 +1 @@
1
+ import{r as e}from"./hePW80VL.js";import{p as t}from"./CYz610vE.js";import{t as n}from"./CiL8zoYm.js";import{i as r,r as i}from"./Cu_sGzNJ.js";import{a,i as o,n as s,o as c,t as l}from"./DzRyVlxz.js";import{t as u}from"./S7HbowYz.js";import{n as d,t as f}from"./D8_hwGjG.js";import{r as p}from"./BRZhVXRC.js";import{a as m,h}from"./BvEGx3Si.js";import{c as g,ct as _,l as v}from"./B8zpsP_u.js";var y=e(t(),1),b=i();function x(){let{t:e}=r(),{activeDialog:t,closeDialog:i}=d(),x=f(`create-schema`),S=t===`create-schema`,[C,w]=(0,y.useState)(``),[T,E]=(0,y.useState)(!1),[D,O]=(0,y.useState)(null);function k(e){e||(i(),w(``),O(null))}async function A(){let e=x?.connectionId??u.getState().activeConnectionId,t=C.trim();if(!(!e||!t)){O(null),E(!0);try{await m(e,p(e).getQuery(`CREATE_SCHEMA`,t)),await h(e),k(!1)}catch(e){O(e instanceof Error?e.message:String(e))}finally{E(!1)}}}return(0,b.jsx)(l,{open:S,onOpenChange:k,children:(0,b.jsxs)(s,{className:`sm:max-w-[420px]`,children:[(0,b.jsx)(a,{children:(0,b.jsx)(c,{children:e(`database.schema.createTitle`)})}),(0,b.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,b.jsx)(g,{htmlFor:`schema-name`,children:e(`database.schema.name`)}),(0,b.jsx)(v,{id:`schema-name`,value:C,autoFocus:!0,placeholder:e(`database.schema.namePlaceholder`),onChange:e=>w(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!_(e)&&A()}})]}),D&&(0,b.jsx)(`p`,{className:`text-xs text-destructive leading-relaxed`,children:D}),(0,b.jsxs)(o,{children:[(0,b.jsx)(n,{variant:`outline`,onClick:()=>k(!1),children:e(`database.schema.cancel`)}),(0,b.jsx)(n,{onClick:()=>void A(),disabled:!C.trim()||T,children:e(`database.schema.create`)})]})]})})}export{x as CreateSchemaDialog};
@@ -0,0 +1 @@
1
+ var e=new Set([`neon`,`supabase`]);function t(e){return e.kind===`sql`}var n=`_rowid_`;export{n,t as r,e as t};
@@ -0,0 +1,8 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/R93pYE1w.js","assets/hePW80VL.js","assets/DeB5sJfy.js","assets/DOeLCbYG.js","assets/5E2RYjEs.js","assets/eRZ39OKr.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./hePW80VL.js";import{i as t}from"./BniymiMs.js";import{r as n}from"./Nro86Y63.js";import{t as r}from"./S7HbowYz.js";import{n as i}from"./C1gqjEN3.js";import{C as a,a as o}from"./BHe42P9W.js";import{n as s}from"./BRZhVXRC.js";import{i as c,r as l}from"./B9dhM8vw.js";var u=[`<=>`,`->>`,`->`,`<>`,`!=`,`<=`,`>=`,`<<`,`>>`,`:=`,`||`,`&&`];function d(e){return/[A-Za-z_$\u0080-\uFFFF]/.test(e)}function f(e){return/[A-Za-z0-9_$\u0080-\uFFFF]/.test(e)}function p(e){return e>=`0`&&e<=`9`}function m(e){return e===` `||e===` `||e===`
3
+ `||e===`\r`||e===`\f`||e===`\v`}var h=class{input;syntax;pos=0;delimiter;significantInStatement=0;constructor(e,t,n=`;`){this.input=e,this.syntax=t,this.delimiter=n}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.next();t.kind===`terminator`||t.kind===`delimiter_command`?this.significantInStatement=0:t.kind!==`space`&&t.kind!==`comment`&&this.significantInStatement++,e.push(t)}return e}atLineStart(e){let t=e-1;for(;t>=0&&(this.input[t]===` `||this.input[t]===` `);)t--;return t<0||this.input[t]===`
4
+ `}make(e,t,n){let r=this.input.slice(t,n),i={kind:e,value:r,start:t,end:n};return e===`identifier`&&(i.upper=r.toUpperCase()),i}next(){let e=this.input,t=this.pos,n=e[t];if(m(n)){let n=t+1;for(;n<e.length&&m(e[n]);)n++;return this.pos=n,this.make(`space`,t,n)}if(e.startsWith(this.delimiter,t))return this.pos=t+this.delimiter.length,this.make(`terminator`,t,this.pos);if(n===`#`&&this.syntax.hashComments)return this.lineComment(t);if(n===`-`&&e[t+1]===`-`){let n=e[t+2];if(!this.syntax.dashCommentNeedsSpace||n===void 0||m(n))return this.lineComment(t)}if(n===`/`&&e[t+1]===`*`){let n=e.indexOf(`*/`,t+2);return this.pos=n===-1?e.length:n+2,this.make(`comment`,t,this.pos)}if(n===`$`&&this.syntax.dollarQuotes){let n=/^\$([A-Za-z_\u0080-\uFFFF][A-Za-z0-9_\u0080-\uFFFF]*)?\$/.exec(e.slice(t,t+64));if(n){let r=e.indexOf(n[0],t+n[0].length);return this.pos=r===-1?e.length:r+n[0].length,this.make(`string`,t,this.pos)}}if((n===`e`||n===`E`)&&e[t+1]===`'`&&this.syntax.dollarQuotes){this.pos=t+1;let e=this.quoted(t+1,`'`,`string`,!0);return this.make(`string`,t,e.end)}if(n===`'`)return this.quoted(t,`'`,`string`,this.syntax.backslashEscapes);if(n===`"`)return this.syntax.doubleQuoteIsIdentifier?this.quoted(t,`"`,`quoted_identifier`,!1):this.quoted(t,`"`,`string`,this.syntax.backslashEscapes);if((n===`x`||n===`X`||n===`b`||n===`B`||n===`n`||n===`N`)&&e[t+1]===`'`){this.pos=t+1;let e=this.quoted(t+1,`'`,`string`,this.syntax.backslashEscapes);return this.make(`string`,t,e.end)}if(n==="`")return this.quoted(t,"`",`quoted_identifier`,!1);if(n===`[`&&this.syntax.bracketIdentifiers){let n=e.indexOf(`]`,t+1);return this.pos=n===-1?e.length:n+1,this.make(`quoted_identifier`,t,this.pos)}if(p(n)||n===`.`&&p(e[t+1]??``))return this.number(t);if(n===`@`){let n=t+1;if(e[n]===`@`&&n++,e[n]===`'`||e[n]===`"`||e[n]==="`"){let r=e[n];this.pos=n;let i=this.quoted(n,r,`string`,this.syntax.backslashEscapes);return this.make(`variable`,t,i.end)}for(;n<e.length&&(f(e[n])||e[n]===`.`);)n++;return this.pos=n,this.make(`variable`,t,n)}if((n===`:`||n===`$`)&&d(e[t+1]??``)&&e[t+1]!==`$`){let n=t+1;for(;n<e.length&&f(e[n]);)n++;return this.pos=n,this.make(`variable`,t,n)}if(n===`?`){let n=t+1;for(;n<e.length&&p(e[n]);)n++;return this.pos=n,this.make(`placeholder`,t,n)}if(d(n)){let n=t+1;for(;n<e.length&&f(e[n])&&!e.startsWith(this.delimiter,n);)n++;let r=e.slice(t,n).toUpperCase();if(r===`DELIMITER`&&this.syntax.delimiterCommand&&this.significantInStatement===0){let r=n;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;let i=r;for(;i<e.length&&!m(e[i]);)i++;if(i>r)return this.delimiter=e.slice(r,i),this.pos=i,this.make(`delimiter_command`,t,i)}if(r===`GO`&&this.syntax.goBatchSeparator&&this.atLineStart(t)){let r=n;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;for(;r<e.length&&p(e[r]);)r++;for(;r<e.length&&(e[r]===` `||e[r]===` `||e[r]===`\r`);)r++;if(r>=e.length||e[r]===`
5
+ `)return this.pos=r,this.make(`delimiter_command`,t,r)}return this.pos=n,this.make(`identifier`,t,n)}if(n===`/`&&this.syntax.plsqlBlocks&&this.atLineStart(t)){let n=t+1;for(;n<e.length&&(e[n]===` `||e[n]===` `||e[n]===`\r`);)n++;if(n>=e.length||e[n]===`
6
+ `)return this.pos=n,this.make(`delimiter_command`,t,n)}if(n===`(`)return this.pos=t+1,this.make(`lparen`,t,this.pos);if(n===`)`)return this.pos=t+1,this.make(`rparen`,t,this.pos);for(let n of u)if(e.startsWith(n,t))return this.pos=t+n.length,this.make(`operator`,t,this.pos);return`=<>!+-*/%^~&|`.includes(n)?(this.pos=t+1,this.make(`operator`,t,this.pos)):`,.;:[]{}`.includes(n)?(this.pos=t+1,this.make(`punct`,t,this.pos)):(this.pos=t+1,this.make(`unknown`,t,this.pos))}lineComment(e){let t=this.input,n=e;for(;n<t.length&&t[n]!==`
7
+ `;)n++;return this.pos=n,this.make(`comment`,e,n)}quoted(e,t,n,r){let i=this.input,a=e+1;for(;a<i.length;){let e=i[a];if(r&&e===`\\`){a+=2;continue}if(e===t){if(i[a+1]===t){a+=2;continue}a++;break}a++}return this.pos=Math.min(a,i.length),this.make(n,e,this.pos)}number(e){let t=this.input,n=e;if(t[n]===`0`&&(t[n+1]===`x`||t[n+1]===`X`))for(n+=2;n<t.length&&/[0-9A-Fa-f]/.test(t[n]);)n++;else if(t[n]===`0`&&(t[n+1]===`b`||t[n+1]===`B`)&&(t[n+2]===`0`||t[n+2]===`1`))for(n+=2;n<t.length&&(t[n]===`0`||t[n]===`1`);)n++;else{for(;n<t.length&&p(t[n]);)n++;if(t[n]===`.`)for(n++;n<t.length&&p(t[n]);)n++;if((t[n]===`e`||t[n]===`E`)&&(p(t[n+1]??``)||(t[n+1]===`+`||t[n+1]===`-`)&&p(t[n+2]??``)))for(n+=2;n<t.length&&p(t[n]);)n++}return this.pos=n,this.make(`number`,e,n)}},ee=new Set([`BEGIN`,`CASE`,`IF`,`LOOP`,`WHILE`,`REPEAT`]);function g(e){return e.kind!==`space`&&e.kind!==`comment`}function te(e,t){let n=[],r=[],i=[],a=0,o=!1,s=t=>{for(let n=t+1;n<e.length;n++)if(g(e[n]))return e[n]},c=e=>{r.length!==0&&(n.push({tokens:r,start:r[0].start,end:r[r.length-1].end,terminated:e}),r=[],i=[],a=0,o=!1)};for(let n=0;n<e.length;n++){let l=e[n];if(l.kind===`delimiter_command`){i.length>0?c(!1):r=[];continue}if(l.kind===`terminator`){if(a>0&&l.value===`;`){r.push({...l,kind:`punct`}),i.push(l);continue}r.push(l),c(!0);continue}if(r.push(l),g(l)){if(l.kind===`identifier`){let e=l.upper,r=i.length===0;if(o&&(o=!1,ee.has(e))){i.push(l);continue}if(e===`END`)a>0&&a--,o=!0;else if(e===`BEGIN`){let e=s(n),o=i[i.length-1];r?(t.plsqlBlocks||e?.kind===`identifier`&&e.upper===`NOT`)&&a++:!(e=>e!==void 0&&(e.kind===`operator`||e.kind===`rparen`||e.kind===`punct`&&(e.value===`,`||e.value===`.`)||e.kind===`identifier`&&e.upper===`FROM`))(e)&&!(o&&(o.kind===`operator`||o.kind===`punct`&&(o.value===`,`||o.value===`.`)))&&a++}else if(e===`CASE`)a++;else if(a>0&&(e===`IF`||e===`LOOP`||e===`WHILE`||e===`REPEAT`)){let e=s(n);e?.kind!==`lparen`&&(e?.kind!==`identifier`||e.upper!==`EXISTS`&&e.upper!==`NOT`)&&a++}}i.push(l)}}return c(!1),n}var ne=new Set([`SELECT`,`VALUES`,`TABLE`,`WITH`,`SHOW`,`EXPLAIN`,`DESCRIBE`,`DESC`,`HELP`,`CHECK`,`CHECKSUM`,`ANALYZE`,`OPTIMIZE`,`REPAIR`,`PRAGMA`]),re=new Set([`SELECT`,`INSERT`,`UPDATE`,`DELETE`,`REPLACE`,`VALUES`,`TABLE`,`MERGE`]),ie=new Set([`TABLE`,`DATABASE`,`SCHEMA`,`TABLESPACE`]),ae=new Set([`WHERE`,`SET`,`USING`,`ORDER`,`LIMIT`,`JOIN`,`INNER`,`LEFT`,`RIGHT`,`CROSS`,`NATURAL`,`STRAIGHT_JOIN`,`ON`,`PARTITION`,`AS`,`RETURNING`,`INDEXED`,`NOT`]);function _(e){if(e.kind!==`quoted_identifier`)return e.value;let t=e.value[0],n=t===`[`?`]`:t,r=e.value.slice(1,e.value.endsWith(n)?-1:void 0);return t!==`[`&&(r=r.replaceAll(n+n,n)),r}function v(e){return e.kind===`identifier`||e.kind===`quoted_identifier`}function y(e,t,n=ae){let r=[];for(;t<e.length;){let i=e[t];if(!v(i)||i.kind===`identifier`&&n.has(i.upper))break;let a=[_(i)];for(t++;t+1<e.length&&e[t].kind===`punct`&&e[t].value===`.`&&v(e[t+1]);)a.push(_(e[t+1])),t+=2;if(r.push(a.join(`.`)),e[t]?.kind===`punct`&&e[t].value===`,`){t++;continue}break}return{names:r,next:t}}function b(e,t,n=0){let r=0;for(let i=n;i<e.length;i++){let n=e[i];if(n.kind===`lparen`)r++;else if(n.kind===`rparen`)r=Math.max(0,r-1);else if(r===0&&n.kind===`identifier`&&n.upper===t)return i}return-1}function oe(e){let t=0;for(;t<e.length&&e[t].kind===`lparen`;)t++;if(t>=e.length||e[t].kind!==`identifier`)return{kind:``,index:t};if(e[t].upper!==`WITH`)return{kind:e[t].upper,index:t};let n=0,r=!1;for(let i=t+1;i<e.length;i++){let t=e[i];if(t.kind===`lparen`){n++,r=!1;continue}if(t.kind===`rparen`){n--,r=n===0;continue}if(n===0&&r&&t.kind===`identifier`&&re.has(t.upper))return{kind:t.upper,index:i};r=!1}return{kind:`WITH`,index:t}}function se(e,t){let n=b(e,`LIMIT`,t);if(n===-1)return null;let r=e[n+1];if(!r||r.kind!==`number`)return null;let i=e[n+2],a=e[n+3];return i?.kind===`punct`&&i.value===`,`&&a?.kind===`number`?{offset:Number(r.value),count:Number(a.value)}:i?.kind===`identifier`&&i.upper===`OFFSET`&&a?.kind===`number`?{offset:Number(a.value),count:Number(r.value)}:{offset:0,count:Number(r.value)}}function ce(e,t,n){let r=t=>e[t]?.kind===`identifier`?e[t].upper:void 0;switch(t){case`DROP`:{let t=n+1;r(t)===`TEMPORARY`&&t++;let i=r(t);if(!i)return null;t++,r(t)===`IF`&&(t+=2);let{names:a}=y(e,t,new Set([`ON`,`RESTRICT`,`CASCADE`]));return{action:`DROP`,objectType:i,names:a,dataLoss:ie.has(i)}}case`TRUNCATE`:{let t=n+1;r(t)===`TABLE`&&t++;let{names:i}=y(e,t);return{action:`TRUNCATE`,objectType:`TABLE`,names:i,dataLoss:!0}}case`DELETE`:{if(b(e,`WHERE`,n)!==-1)return null;let t=n+1;for(;r(t)===`LOW_PRIORITY`||r(t)===`QUICK`||r(t)===`IGNORE`;)t++;return{action:`DELETE_ALL`,names:r(t)===`FROM`?y(e,t+1).names:y(e,t,new Set([`FROM`])).names,dataLoss:!0}}case`UPDATE`:{if(b(e,`WHERE`,n)!==-1)return null;let t=n+1;for(;r(t)===`LOW_PRIORITY`||r(t)===`IGNORE`||r(t)===`OR`;)t+=r(t)===`OR`?2:1;let{names:i}=y(e,t);return{action:`UPDATE_ALL`,names:i,dataLoss:!0}}case`ALTER`:{if(r(n+1)!==`TABLE`)return null;let{names:t}=y(e,n+2,new Set([`ADD`,`DROP`,`MODIFY`,`CHANGE`,`RENAME`,`ALTER`])),i=[],a=0;for(let t=n+2;t<e.length;t++){let n=e[t];if(n.kind===`lparen`){a++;continue}if(n.kind===`rparen`){a--;continue}if(a!==0||n.kind!==`identifier`||n.upper!==`DROP`)continue;let r=e[t+1],o=r?.kind===`identifier`?r.upper:``;if(o===`COLUMN`){let n=e[t+2];n&&v(n)&&i.push(_(n))}else o===`PARTITION`?i.push(`PARTITION ${y(e,t+2).names.join(`, `)}`):r&&v(r)&&![`PRIMARY`,`FOREIGN`,`INDEX`,`KEY`,`CONSTRAINT`,`CHECK`,`DEFAULT`,`TABLESPACE`].includes(o)&&i.push(_(r))}return i.length===0?null:{action:`ALTER_DROP`,objectType:`TABLE`,names:t.map(e=>`${e} (${i.join(`, `)})`),dataLoss:!0}}default:return null}}function le(e,t){let n=e.tokens.filter(e=>g(e)&&e.kind!==`terminator`),r=e.terminated?e.tokens.slice(0,-1):e.tokens,i=r.length?r[r.length-1].end:e.start,a=t.slice(e.start,i).trim(),{kind:o,index:s}=oe(n),c=ne.has(o)||b(n,`RETURNING`,s)!==-1,l=c?se(n,s):null,u=ce(n,o,s);return{sql:a,raw:t.slice(e.start,e.end),start:e.start,end:e.end,tokens:e.tokens,kind:o,isEmpty:n.length===0,returnsRows:c,limit:l,destructive:u}}function ue(e,t){let n=e.tokens.filter(e=>g(e)&&e.kind!==`terminator`),r=n.findIndex(e=>e.kind!==`lparen`);return b(n,t.toUpperCase(),Math.max(0,r))!==-1}function x(e){return e.start+e.raw.indexOf(e.sql)}function de(e){let t=e.tokens.filter(e=>g(e)&&e.kind!==`terminator`),n=0;for(;n<t.length&&t[n].kind===`lparen`;)n++;let r=t[n];if(!r||r.kind!==`identifier`||r.upper!==`SELECT`)return-1;let i=r,a=t[n+1];return a?.kind===`identifier`&&(a.upper===`DISTINCT`||a.upper===`ALL`)&&(i=a),i.end-x(e)}var S=class{syntax;constructor(e){this.syntax=`syntax`in e?e.syntax:e}tokenize(e,t=`;`){return new h(e,this.syntax,t).tokenize()}parse(e,t=`;`){return te(this.tokenize(e,t),this.syntax).map(t=>le(t,e))}statements(e,t=`;`){return this.parse(e,t).filter(e=>!e.isEmpty)}},fe=new Set([`ORDER`,`LIMIT`,`RETURNING`,`OUTPUT`,`OPTION`]);function C(e,t,n,r){return n?e.slice(n.start-t,(r?r.start:2**53-1)-t).trim():``}function w(e,t,n){let r=t;for(;r<n&&e[r].kind===`identifier`&&(e[r].upper===`ONLY`||e[r].upper===`LOW_PRIORITY`||e[r].upper===`IGNORE`||e[r].upper===`QUICK`);)r++;if(r>=n||!v(e[r]))return null;let i=_(e[r]),a=e[r].kind===`quoted_identifier`;for(r++;r+1<n&&e[r].kind===`punct`&&e[r].value===`.`&&v(e[r+1]);)i=_(e[r+1]),a=e[r+1].kind===`quoted_identifier`,r+=2;return r<n&&e[r].kind===`identifier`&&e[r].upper===`AS`&&r++,r<n&&v(e[r])&&!(e[r].kind===`identifier`&&[`SET`,`WHERE`,`JOIN`,`INNER`,`LEFT`,`RIGHT`,`CROSS`,`USING`,`FROM`,`ON`,`NATURAL`,`STRAIGHT_JOIN`,`WITH`,`OUTPUT`].includes(e[r].upper))?(e[r].kind,e[r].value):a?`"${i.replaceAll(`"`,`""`)}"`:i}function pe(e,t=`"`){let n=e.tokens.filter(e=>g(e)&&e.kind!==`terminator`),r=x(e),i=e.sql,a=e=>(e.startsWith(t)||e.startsWith(`"`)||e.startsWith("`")||e.startsWith(`[`),e),o=n[0];if(!o||o.kind!==`identifier`||o.upper!==`UPDATE`&&o.upper!==`DELETE`)return null;let s=b(n,`WHERE`),c=-1;for(let e of fe){let t=b(n,e,s===-1?1:s);t!==-1&&(c===-1||t<c)&&(c=t)}let l=e=>e===-1?n.length:e,u=s===-1?``:` `+C(i,r,n[s],n[l(c)]),d=``;if(c!==-1&&(n[c].upper===`ORDER`||n[c].upper===`LIMIT`)){let e=[`RETURNING`,`OUTPUT`,`OPTION`].map(e=>b(n,e,c)).filter(e=>e!==-1);d=` `+C(i,r,n[c],e.length?n[Math.min(...e)]:void 0)}let f,p,m;if(o.upper===`UPDATE`){let e=b(n,`SET`);if(e===-1)return null;let t=b(n,`FROM`,e),a=e,o=C(i,r,n[1],n[a]);if(!o||n[1].kind===`lparen`)return null;if(p=w(n,1,a),m=o,t!==-1&&(s===-1||t<s)){let e=C(i,r,n[t+1],n[l(s===-1?c:s)]);f=p!==null&&RegExp(`(^|[\\s,])${p.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}(\\s|$|,)`,`i`).test(e)?e:`${o}, ${e}`}else f=o}else{let e=b(n,`FROM`);if(e===-1)return null;let t=b(n,`USING`,e),a=l(t===-1?s===-1?c:s:t),o=C(i,r,n[e+1],n[a]);if(!o||n[e+1]?.kind===`lparen`)return null;let u=C(i,r,n[1],n[e]),d=u?u.split(`,`)[0].trim().replace(/^(LOW_PRIORITY|QUICK|IGNORE)\s+/i,``):``;p=d||w(n,e+1,a),m=d||o;let h=t===-1?``:C(i,r,n[t+1],n[l(s===-1?c:s)]);f=h?`${o}, ${h}`:o}return p?{select:`SELECT ${a(p)}.* FROM ${f}${u}${d}`,count:d?`SELECT COUNT(*) AS affected FROM (SELECT 1 AS one FROM ${f}${u}${d}) planche_preview`:`SELECT COUNT(*) AS affected FROM ${f}${u}`,table:m,limited:/\bLIMIT\b/i.test(d)}:null}var me={mysql:`mysql`,maria:`mariadb`,postgres:`postgresql`,neon:`postgresql`,supabase:`postgresql`,mssql:`transactsql`,sqlite:`transactsql`,d1:`transactsql`,do:`transactsql`,oracle:null,redis:null,elasticsearch:null,opensearch:null},he={mysql:()=>t(()=>import(`./R93pYE1w.js`).then(t=>e(t.default,1)),__vite__mapDeps([0,1,2])),mariadb:()=>t(()=>import(`./DOeLCbYG.js`).then(t=>e(t.default,1)),__vite__mapDeps([3,1,2])),postgresql:()=>t(()=>import(`./5E2RYjEs.js`).then(t=>e(t.default,1)),__vite__mapDeps([4,1,2])),transactsql:()=>t(()=>import(`./eRZ39OKr.js`).then(t=>e(t.default,1)),__vite__mapDeps([5,1,2]))},T=new Map,ge={mysql:"`",mariadb:"`",postgresql:`"`,transactsql:`"`};function _e(e,t,n){if(!E.test(e))return e;let r=ge[t],i=``,a=0;for(let t of new S(n).tokenize(e))t.kind!==`identifier`||!E.test(t.value)||(i+=e.slice(a,t.start)+r+t.value+r,a=t.end);return i+e.slice(a)}var E=/[\u0080-\uffff]/;function ve(e){return me[e]??null}async function ye(e){let t=T.get(e);if(t)return t;let n=new(await(he[e]())).Parser;return T.set(e,n),n}function D(e){return typeof e==`object`&&!!e}function O(e){return D(e)&&e.type===`select`}function be(e){return D(e)&&O(e.ast)?e.ast:null}function xe(e){let t=e.name;return typeof t==`string`?t:t?.value??`cte`}function Se(e){let t=e.stmt;return D(t)?O(t.ast)?t.ast:O(t)?t:null:null}function Ce(e){if(!e)return null;let t=e.toUpperCase();return t===`JOIN`?`INNER JOIN`:t}function we(e){let t=e.db??e.schema??null;return t?`${t}.${e.table}`:String(e.table)}function k(e){if(!D(e))return!1;if(e.type===`star`)return!0;let t=e.column;return!!(t===`*`||D(t)&&D(t.expr)&&t.expr.value===`*`)}function A(e){return k(e)?!D(e)||e.table===null||e.table===void 0:!1}function Te(e){let t=e.columns;return t===`*`?{count:null,expandsSources:!0}:Array.isArray(t)?t.filter(e=>k(e)||k(e.expr)).length===0?{count:t.length,expandsSources:!1}:{count:null,expandsSources:t.length===1&&(A(t[0])||A(t[0].expr))}:{count:null,expandsSources:!1}}function j(e,t){if(Array.isArray(e)){for(let n of e)j(n,t);return}if(!D(e))return;let n=be(e);if(n){t.push(n);return}for(let[n,r]of Object.entries(e))n!==`loc`&&j(r,t)}var Ee=class{nodes=[];edges=[];groups=[];warnings=[];seq=0;nextId(e){return this.seq+=1,`${e}${this.seq}`}addGroup(e,t,n){let r={id:this.nextId(`g`),kind:e,label:t,parentId:n};return this.groups.push(r),r.id}addNode(e){let t={id:this.nextId(`n`),...e};return this.nodes.push(t),t}addEdge(e,t,n,r){this.edges.push({id:this.nextId(`e`),from:e,to:t,kind:n,label:r})}visitQuery(e,t,n,r,i,a){let o=[];for(let t=e;t;t=t._next)o.push(t);if(o.length===1)return this.visitSelect(e,t,n,r,i,a);let s=this.addGroup(`query`,r,t),c=(e.set_op??`union`).toUpperCase(),l=new Map(n);this.declareCtes(e,s,l);let u=o.map((e,t)=>this.visitSelect(e,s,new Map(l),`${c} (${t+1})`,`result`,`result`,t===0)),d=this.addNode({kind:i===`result`?`setop`:i,label:i===`result`?c:a,alias:null,qualifier:null,columnCount:u[0]?.columnCount??null,expandsSources:!1,groupId:s,range:null});for(let e of u)this.addEdge(e.id,d.id,`setop`,c);return d}declareCtes(e,t,n){if(Array.isArray(e.with))for(let r of e.with){let e=xe(r),i=Se(r);if(!i){this.warnings.push(`CTE ${e}: body not understood`);continue}let a=this.visitQuery(i,t,new Map(n),`WITH ${e}`,`cte`,e);n.set(e.toLowerCase(),a)}}visitSelect(e,t,n,r,i,a,o=!1){let s=this.addGroup(`query`,r,t),c=new Map(n);o||this.declareCtes(e,s,c);let l=[];if(Array.isArray(e.from)&&e.from.length>0){let t=this.addGroup(`from`,`FROM`,s);e.from.forEach((e,n)=>{let r=Ce(e.join),i=n===0&&!r?`from`:`join`,a=e.expr?.ast;if(a){let n=e.as??`subquery`,o=this.visitQuery(a,t,new Map(c),`FROM ${n}`,`derived`,n);l.push({node:o,kind:i,label:r});return}if(!e.table){this.warnings.push(`FROM entry not understood (function call or table expression)`);return}let o=c.get(e.table.toLowerCase()),s=this.addNode({kind:o?`cte-ref`:`table`,label:we(e),alias:e.as??null,qualifier:e.db??e.schema??null,columnCount:o?o.columnCount:null,expandsSources:!1,groupId:t,range:null});o&&this.addEdge(o.id,s.id,`cte`,null),l.push({node:s,kind:i,label:r})})}let u=[];for(let[t,n]of[[`SELECT`,e.columns],[`WHERE`,e.where],[`GROUP BY`,e.groupby],[`HAVING`,e.having],[`ORDER BY`,e.orderby]]){let e=[];j(n,e),e.forEach((n,r)=>{let i=e.length>1?`${t} (${r+1})`:t;u.push(this.visitQuery(n,s,new Map(c),i,`scalar`,`subquery`))})}let{count:d,expandsSources:f}=Te(e),p=this.addNode({kind:i,label:a,alias:null,qualifier:null,columnCount:d,expandsSources:f,groupId:s,range:null});for(let e of l)this.addEdge(e.node.id,p.id,e.kind,e.label);for(let e of u)this.addEdge(e.id,p.id,`scalar`,null);return p}};function De(e){let t=Array.isArray(e)?e[0]:e;if(!O(t))return null;let n=new Ee;return n.visitQuery(t,null,new Map,`query`,`result`,`result`),Array.isArray(e)&&e.length>1&&n.warnings.push(`only the first of ${e.length} statements is drawn`),{nodes:n.nodes,edges:n.edges,groups:n.groups,warnings:n.warnings}}var M=new Set([`WHERE`,`GROUP`,`HAVING`,`ORDER`,`CONNECT`,`START`,`MODEL`,`FETCH`,`OFFSET`,`FOR`,`UNION`,`INTERSECT`,`MINUS`,`EXCEPT`,`WITH`]),Oe=new Set([`UNION`,`INTERSECT`,`MINUS`,`EXCEPT`]),N=new Set([...M,`ON`,`USING`,`JOIN`,`INNER`,`LEFT`,`RIGHT`,`FULL`,`CROSS`,`NATURAL`,`OUTER`,`AND`,`OR`,`NOT`,`AS`,`PARTITION`,`PIVOT`,`UNPIVOT`,`SAMPLE`]),P=new Set([`INNER`,`LEFT`,`RIGHT`,`FULL`,`CROSS`,`NATURAL`,`OUTER`]);function F(e){return e?.kind===`identifier`?e.upper??e.value.toUpperCase():``}function I(e){return e!==void 0&&(e.kind===`identifier`||e.kind===`quoted_identifier`)}function L(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r].kind===`lparen`)n++;else if(e[r].kind===`rparen`&&--n===0)return r+1;return e.length}function R(e,t,n){let r=[];for(let i=t;i<n;i++){if(e[i].kind!==`lparen`)continue;let t=F(e[i+1]),a=Math.min(L(e,i),n);(t===`SELECT`||t===`WITH`)&&(r.push(B(e,i+1,a-1)),i=a-1)}return r}function ke(e,t,n,r){let i=[],a=0;for(let o=t;o<n;o++)e[o].kind===`lparen`?a++:e[o].kind===`rparen`?a--:a===0&&r(e[o])&&i.push(o);return i}function z(e,t,n,r){let i=0;for(let a=t;a<n;a++)if(e[a].kind===`lparen`)i++;else if(e[a].kind===`rparen`)i--;else if(i===0&&r(e[a]))return a;return n}function Ae(e,t){let n=[_(e[t])],r=t+1;for(;e[r]?.kind===`punct`&&e[r].value===`.`&&I(e[r+1]);)n.push(_(e[r+1])),r+=2;return{parts:n,next:r}}function je(e,t,n,r){let i=t;if(e[i]?.kind===`lparen`&&(F(e[i+1])===`SELECT`||F(e[i+1])===`WITH`)){let t=L(e,i),n=B(e,i+1,t-1),a=null,o=t;return F(e[o])===`AS`&&o++,I(e[o])&&!N.has(F(e[o]))&&(a=_(e[o])),{db:null,table:null,as:a,expr:{ast:n},...r?{join:r}:{}}}if(!I(e[i]))return null;let{parts:a,next:o}=Ae(e,i);if(i=o,e[i]?.kind===`lparen`)return null;let s=null;F(e[i])===`AS`&&i++,i<n&&I(e[i])&&!N.has(F(e[i]))&&(s=_(e[i]));let c=a[a.length-1];return{db:a.length>1?a.slice(0,-1).join(`.`):null,table:c,as:s,...r?{join:r}:{}}}function Me(e,t,n){let r=[],i=e=>e.kind===`punct`&&e.value===`,`,a=e=>F(e)===`JOIN`||P.has(F(e)),o=ke(e,t,n,e=>i(e)||a(e)),s=[{at:t,join:null}];for(let t=0;t<o.length;t++){let r=o[t];if(i(e[r])){s.push({at:r+1,join:null});continue}let a=[],c=r;for(;c<n&&(P.has(F(e[c]))||F(e[c])===`JOIN`);){if(a.push(F(e[c])),F(e[c])===`JOIN`){c++;break}c++}for(;t+1<o.length&&o[t+1]<c;)t++;s.push({at:c,join:a.join(` `)||`JOIN`})}for(let t=0;t<s.length;t++){let i=s[t],a=t+1<s.length?s[t+1].at:n,o=je(e,i.at,a,i.join);o&&r.push(o)}return r}function B(e,t,n){let r={type:`select`,with:null,columns:`*`,from:[],where:[]},i=t;if(F(e[i])===`WITH`)for(i++,F(e[i])===`RECURSIVE`&&i++,r.with=[];i<n&&I(e[i]);){let t=_(e[i]);if(i++,e[i]?.kind===`lparen`&&F(e[i+1])!==`SELECT`&&(i=L(e,i)),F(e[i])!==`AS`||(i++,(F(e[i])===`MATERIALIZED`||F(e[i])===`NOT`&&F(e[i+1])===`MATERIALIZED`)&&(i+=F(e[i])===`NOT`?2:1),e[i]?.kind!==`lparen`))break;let n=L(e,i);if(r.with.push({name:{value:t},stmt:{ast:B(e,i+1,n-1)}}),i=n,e[i]?.kind===`punct`&&e[i].value===`,`){i++;continue}break}if(F(e[i])!==`SELECT`)return r;i++,[`DISTINCT`,`ALL`,`UNIQUE`].includes(F(e[i]))&&i++;let a=z(e,i,n,e=>F(e)===`FROM`),o=ke(e,i,a,e=>e.kind===`punct`&&e.value===`,`),s=[],c=i;for(let e of o)s.push([c,e]),c=e+1;s.push([c,a]);let l=e=>e.kind===`operator`&&e.value===`*`,u=s.filter(([t,n])=>z(e,t,n,l)<n);if(r.columns=s.length===1&&u.length===1&&s[0][1]-s[0][0]===1?`*`:u.length>0?[{expr:{type:`star`}},...s.slice(1).map(()=>({}))]:s.map(([t,n])=>{let r=R(e,t,n);return r.length>0?{expr:{ast:r[0]}}:{}}),a>=n)return r;let d=z(e,a+1,n,e=>M.has(F(e)));r.from=Me(e,a+1,d);let f=z(e,d,n,e=>Oe.has(F(e)));if(r.where=R(e,d,f).map(e=>({ast:e})),f<n){let t=F(e[f]),i=F(e[f+1])===`ALL`;r.set_op=`${t.toLowerCase()}${i?` all`:``}`,r._next=B(e,f+(i?2:1),n)}return r}function Ne(e,t){let n=new S(t).tokenize(e).filter(e=>e.kind!==`space`&&e.kind!==`comment`&&e.kind!==`terminator`);if(n.length===0)return null;let r=F(n[0]);return r!==`SELECT`&&r!==`WITH`?null:B(n,0,n.length)}var Pe=new Set(`ON.USING.WHERE.GROUP.ORDER.HAVING.LIMIT.OFFSET.FETCH.WINDOW.JOIN.INNER.LEFT.RIGHT.FULL.CROSS.NATURAL.OUTER.STRAIGHT_JOIN.APPLY.UNION.INTERSECT.EXCEPT.MINUS.SELECT.FROM.WITH.AND.OR.NOT.SET.VALUES.WHEN.THEN.ELSE.END.FOR.INTO.START.CONNECT.PIVOT.AS.BY.DISTINCT.ALL.ANY.CASE.IS.NULL.IN.EXISTS.BETWEEN.LIKE.ASC.DESC.RECURSIVE.TOP.PERCENT.TIES.ROW.ROWS.ONLY.NEXT.FIRST.PARTITION.OVER.LATERAL.RETURNING.OUTPUT.PRIOR.MATERIALIZED.FILTER.INSERT.UPDATE.DELETE.CREATE.TABLE.VIEW.EXPLAIN.PRAGMA.MERGE`.split(`.`));function V(e){return e?.kind===`identifier`&&Pe.has(e.upper??e.value.toUpperCase())}function H(e){return e!==void 0&&(e.kind===`identifier`||e.kind===`quoted_identifier`)}function Fe(e){let t=e.filter(e=>e.kind!==`space`&&e.kind!==`comment`),n=[];for(let e=0;e<t.length;e++){let r=t[e];if(!H(r)||V(r))continue;let i=[_(r)],a=r;for(;H(t[e+2])&&t[e+1]?.kind===`punct`&&t[e+1].value===`.`;)a=t[e+2],i.push(_(a)),e+=2;let o=null,s=t[e+1];s?.kind===`identifier`&&s.upper===`AS`?(s=t[e+2],H(s)&&!V(s)&&(o=_(s),e+=2)):H(s)&&!V(s)&&(o=_(s),e+=1),n.push({name:i.join(`.`),alias:o,start:r.start,end:a.end,used:!1})}return n}function Ie(e){switch(e.kind){case`table`:case`cte-ref`:case`cte`:case`derived`:return e.label;default:return null}}function Le(e,t,n){let r=Fe(new S(n).tokenize(t)),i=e.nodes.map(e=>{let t=Ie(e);if(!t)return e;let n=t.toLowerCase(),i=e.alias?.toLowerCase()??null,a=r.find(e=>!e.used&&e.name.toLowerCase()===n&&(!i||e.alias?.toLowerCase()===i))??r.find(e=>!e.used&&e.alias?.toLowerCase()===n);return a?(a.used=!0,{...e,range:[a.start,a.end]}):e});return{...e,nodes:i}}function U(e){return e.label.toLowerCase()}function W(e){let t=new Map;for(let n of e.nodes){if(n.kind!==`table`)continue;let e=U(n);if(t.has(e))continue;let r=n.label.split(`.`);t.set(e,{key:e,qualifier:r.length>1?r.slice(0,-1).join(`.`):null,table:r[r.length-1]})}return[...t.values()]}function Re(e,t){let n=new Map,r=e.nodes.map(e=>{let r=e.kind===`table`&&e.columnCount===null&&t.has(U(e))?{...e,columnCount:t.get(U(e))??null}:{...e};return n.set(r.id,r),r}),i=new Set([`from`,`join`,`cte`,`setop`]);for(let t=0;t<r.length;t++){let t=!1;for(let a of r){if(a.columnCount!==null)continue;let r=e.edges.filter(e=>e.to===a.id&&i.has(e.kind)).map(e=>n.get(e.from)).filter(e=>e!==void 0),o=r.filter(e=>e.columnCount!==null);r.length!==0&&o.length===r.length&&(a.expandsSources?(a.columnCount=o.reduce((e,t)=>e+(t.columnCount??0),0),t=!0):r.length===1&&(a.columnCount=o[0].columnCount,t=!0))}if(!t)break}return{...e,nodes:r}}async function G(e,t){let n=ve(t.id),r;if(n)try{r=(await ye(n)).astify(_e(e,n,t.syntax),{database:n})}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message.split(`
8
+ `)[0]:String(e)}}else if(t.id===`oracle`)r=Ne(e,t.syntax);else return{ok:!1,reason:`unsupported-engine`,message:`No SQL grammar for ${t.label}`};let i=De(r);return i?{ok:!0,graph:Le(i,e,t.syntax)}:{ok:!1,reason:`not-a-query`,message:`Only SELECT statements have a structure graph`}}var ze=8,Be=3,Ve=[{kind:`column`,re:/unknown column '([^']+)'/i},{kind:`table`,re:/(?:unknown table|table) '([^']+)'(?: doesn't exist)?/i},{kind:`column`,re:/column "([^"]+)" does not exist/i},{kind:`table`,re:/relation "([^"]+)" does not exist/i},{kind:`column`,re:/no such column:\s*(\S+)/i},{kind:`table`,re:/no such table:\s*(\S+)/i},{kind:`column`,re:/invalid column name '([^']+)'/i},{kind:`table`,re:/invalid object name '([^']+)'/i},{kind:`column`,re:/ORA-00904:\s*"?([^":]+)"?:\s*invalid identifier/i}];function K(e){for(let{kind:t,re:n}of Ve){let r=n.exec(e);if(!r)continue;let i=r[1].trim().replace(/[`"'[\]]/g,``),a=i.split(`.`).pop()??i;if(a)return{kind:t,name:a}}return null}function q(e){return e.toLowerCase().replace(/[_\s-]/g,``)}function He(e,t,n){if(Math.abs(e.length-t.length)>n)return n+1;let r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i],o=i;for(let n=1;n<=t.length;n++){let s=e[i-1]===t[n-1]?0:1,c=Math.min(r[n]+1,a[n-1]+1,r[n-1]+s);a.push(c),c<o&&(o=c)}if(o>n)return n+1;r=a}return r[t.length]}function Ue(e){return e.length<=4?1:e.length<=8?2:3}function J(e,t,n=Be){let r=q(e);if(!r)return[];let i=Ue(r),a=[];for(let n of t){let t=q(n);if(!t||t===r){t===r&&n!==e&&a.push({name:n,d:0,prefix:!0});continue}let o=He(r,t,i);o>i||a.push({name:n,d:o,prefix:t.startsWith(r)||r.startsWith(t)})}a.sort((e,t)=>e.d-t.d||Number(t.prefix)-Number(e.prefix)||e.name.localeCompare(t.name));let o=a.filter(e=>e.d===0);return(o.length>0?o:a).slice(0,n).map(e=>e.name)}function We(e){return e.filter(e=>e.kind!==`space`&&e.kind!==`comment`)}function Y(e,t){let n=[],r;try{r=We(new S(t).tokenize(e))}catch{return n}let i=t.quoteIdentifier(`x`).startsWith("`");for(let e=0;e<r.length;e++){let a=r[e];if(a.kind===`quoted_identifier`&&a.value.startsWith("`")&&!i){let e=a.value.slice(1,-1);n.push({code:`syntaxSwap`,params:{engine:t.label,found:a.value,expected:t.quoteIdentifier(e)}});break}}for(let e=1;e<r.length;e++){let i=r[e];if(i.kind===`quoted_identifier`&&i.value.startsWith(`"`)&&t.syntax.doubleQuoteIsIdentifier){let a=r[e-1];if(a.kind===`operator`&&/^(=|<>|!=|<|>|<=|>=)$/.test(a.value)){n.push({code:`doubleQuotedLiteral`,params:{engine:t.label,value:i.value.slice(1,-1)}});break}}}let a=t.syntax.limitStyle;for(let e=0;e<r.length;e++){let i=r[e];if(i.kind!==`identifier`)continue;let o=r[e+1],s=o?.kind===`number`?o.value:`n`;if(i.upper===`LIMIT`&&a!==`limit`&&o?.kind===`number`){n.push({code:`syntaxSwap`,params:{engine:t.label,found:`LIMIT ${s}`,expected:a===`top`?`SELECT TOP ${s}`:`FETCH FIRST ${s} ROWS ONLY`}});break}if(i.upper===`TOP`&&a!==`top`&&o?.kind===`number`&&r[e-1]?.upper===`SELECT`){n.push({code:`syntaxSwap`,params:{engine:t.label,found:`TOP ${s}`,expected:a===`limit`?`LIMIT ${s}`:`FETCH FIRST ${s} ROWS ONLY`}});break}}return n}function Ge(e){let{message:t,sql:n,engine:r,columns:i,tables:a}=e,o=[],s=K(t);if(s?.kind===`column`){let e=i.size>1,t=[],n=new Map;for(let[e,r]of i)for(let i of r)t.push(i),n.has(i)||n.set(i,e);let r=J(s.name,[...new Set(t)]);r.length>0&&o.push({code:`unknownColumn`,params:{name:s.name,suggestions:r.map(t=>e?`${n.get(t)}.${t}`:t).join(`, `)}})}if(s?.kind===`table`){let e=J(s.name,a);e.length>0&&o.push({code:`unknownTable`,params:{name:s.name,suggestions:e.join(`, `)}})}return[...o,...Y(n,r)]}var X=new Map,Z=new Map;function Q(e){let t=a.getState(),n=t.trees[e];return n?c(n,t.selectedNodeId[e])??l(n)[0]??null:null}function Ke(e,t){let n=s(e),i=r.getState().activeConnections.find(t=>t.id===e),a=n.capabilities.schemas?null:i?.database;return t||a||Q(e)}async function $(e,t){let a=i.getState().tabs[e]?.find(e=>e.id===t);if(!a?.error||!a.errorSql)return null;let c=s(e);if(!n(c))return null;let l={engine:c,sql:a.errorSql,message:a.error,tables:new Map},u=r.getState().activeConnections.find(t=>t.id===e),d=c.capabilities.schemas?null:u?.database,f=a.database||d||Q(e);if(!u?.serverConnectionId||!f)return l;let p=o(u.serverConnectionId),m=await G(l.sql,c).catch(()=>null),h=m?.ok?W(m.graph).slice(0,ze):[];return await Promise.all(h.map(async({qualifier:e,table:t})=>{let n=e??f,r=`${u.serverConnectionId}|${n}|${t}`,i=X.get(r);if(i){l.tables.set(t,i);return}try{let e=await c.introspect.listColumns(p,n,t);e.length>0&&(X.set(r,e),l.tables.set(t,e))}catch{}})),l}async function qe(e,t){let a=i.getState().tabs[e]?.find(e=>e.id===t);if(!a?.error)return[];let c=a.errorSql??``,l=s(e);if(!n(l))return[];let u=K(a.error);if(!c)return[];if(!u)return Y(c,l);let d=r.getState().activeConnections.find(t=>t.id===e),f=l.capabilities.schemas?null:d?.database,p=a.database||f||Q(e),m=new Map,h=[];if(d?.serverConnectionId&&p){let n=o(d.serverConnectionId);if(u.kind===`column`){let n=await $(e,t);for(let[e,t]of n?.tables??[])m.set(e,t.map(e=>e.name))}if(u.kind===`table`){let e=`${d.serverConnectionId}|${p}`,t=Z.get(e);if(t)h=t;else try{h=(await l.introspect.listTables(n,p)).map(e=>e.name);let t=await l.introspect.listViews(n,p).catch(()=>[]);h=[...h,...t],Z.set(e,h)}catch{}}}return Ge({message:a.error,sql:c,engine:l,columns:m,tables:h})}function Je(e,t){let n=r.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId;if(!n)return;let i=t?`${n}|${t}|`:`${n}|`;for(let e of[...X.keys()])e.startsWith(i)&&X.delete(e);if(t){Z.delete(`${n}|${t}`);return}for(let e of[...Z.keys()])e.startsWith(`${n}|`)&&Z.delete(e)}export{G as a,S as c,ue as d,x as f,$ as i,pe as l,Ke as n,Re as o,de as p,qe as r,W as s,Je as t,_ as u};