planche 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/assets/{aL0ab6hA.js → 1E6FYbv2.js} +1 -1
- package/app/assets/B-Mrqvrb.css +2 -0
- package/app/assets/{C-MJZp-k.js → B3uI9Ppb.js} +1 -1
- package/app/assets/{g4S828aR.js → B5OocgEJ.js} +1 -1
- package/app/assets/{B6gKGoJk.js → B8xQ2o-X.js} +1 -1
- package/app/assets/{3tVT9YMh.js → BGOnv2_O.js} +1 -1
- package/app/assets/{B2VNJYl8.js → BIjF9ulh.js} +1 -1
- package/app/assets/{DURNOOys.js → Bpg8LzYe.js} +1 -1
- package/app/assets/{BxOkJTYb.js → BunrDTHn.js} +1 -1
- package/app/assets/{Brk9GcZh.js → C3bMAsUp.js} +1 -1
- package/app/assets/{BQ74FNAM.js → C4il2fft.js} +1 -1
- package/app/assets/{1qhRpHKv.js → COIa4uoZ.js} +1 -1
- package/app/assets/{8OZbP3hw.js → CkgLFvM5.js} +1 -1
- package/app/assets/{nij0MMY5.js → Cx_chT_j.js} +1 -1
- package/app/assets/{2sxOfzyn.js → D7Ze5md9.js} +5 -5
- package/app/assets/{D2AdQhHv.js → DFNc4ghA.js} +1 -1
- package/app/assets/{vIgrQ7V1.js → DGD5v9rw.js} +1 -1
- package/app/assets/{f1Yh3VFu.js → DZH-tLW-.js} +1 -1
- package/app/assets/{DkdStXtl.js → D_2UqK4k.js} +1 -1
- package/app/assets/{BCZ2DwDi.js → Dd9Cr3e8.js} +1 -1
- package/app/assets/{7D95fvkQ.js → Dh3YJ3G1.js} +1 -1
- package/app/assets/{BrwCR6-9.js → DiaA_DOW.js} +1 -1
- package/app/assets/{D98JmiqU.js → DlKZCiMg.js} +2 -2
- package/app/assets/{MdnUPkBs.js → DmejZTwI.js} +1 -1
- package/app/assets/{OQSC6nip.js → DnjY8W6t.js} +1 -1
- package/app/assets/{C3uDTQB5.js → FnB_uI57.js} +1 -1
- package/app/assets/{oSIomP-s.js → IzH8qyLi.js} +1 -1
- package/app/assets/{CCBE6CSG.js → NY_tAtcY.js} +1 -1
- package/app/assets/{q4qvsmm4.js → QBd1UkiI.js} +1 -1
- package/app/assets/{DCkfyKy4.js → RIOwEE7M.js} +1 -1
- package/app/assets/{Bfw0mW2q.js → S4Oofhu9.js} +1 -1
- package/app/assets/{B4qi_yRV.js → cc05Z2oj.js} +1 -1
- package/app/assets/{B_0rFJQl.js → dxLVUFtU.js} +1 -1
- package/app/assets/{Clm7zeUD.js → fCzQKDqY.js} +1 -1
- package/app/assets/{BmSO6bVX.js → og5dTmtH.js} +1 -1
- package/app/assets/{Bfuq7Ecs.js → qbvehL2h.js} +1 -1
- package/app/index.html +3 -3
- package/package.json +1 -1
- package/app/assets/ZV96pIZb.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./DTxGpkJp.js";import{a as c}from"./Cw_LYT6k.js";import{n as l}from"./DbRMSZEW.js";import{l as u,m as d}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{t as s}from"./DTxGpkJp.js";import{a as c}from"./Cw_LYT6k.js";import{n as l}from"./DbRMSZEW.js";import{l as u,m as d}from"./DlKZCiMg.js";import{H as f,U as p,c as m,l as h}from"./D7Ze5md9.js";import{a as g,i as _,n as v,o as y,t as b}from"./DxuXBECK.js";var x=e(t(),1),S=i();function C(){let{t:e}=a(),{activeDialog:t,closeDialog:i}=n(),C=r(`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=s.getState().activeConnectionId,n=E.trim();if(!t||!n||!T)return;N(null);let r=l(t),i=s.getState().activeConnections.find(e=>e.id===t);if(i?.serverConnectionId)try{j(e(`database.copy.creating`,{database:n})),await u(t,r.getQuery(`CREATE_DATABASE`,n,`utf8mb4`,`utf8mb4_general_ci`));let a=c(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 f(a,s);await p({source:a,target:s,mode:O,onConflict:`abort`,createSql:l(t).ddl.createTable(c)})}await d(t),P(!1)}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(null)}}return(0,S.jsx)(b,{open:w,onOpenChange:P,children:(0,S.jsxs)(v,{className:`sm:max-w-[450px]`,children:[(0,S.jsx)(g,{children:(0,S.jsx)(y,{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)(m,{children:e(`database.copy.source`)}),(0,S.jsx)(h,{value:T,disabled:!0})]}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(m,{htmlFor:`target-db-name`,children:e(`database.copy.target`)}),(0,S.jsx)(h,{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)(m,{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)(_,{children:[(0,S.jsx)(o,{variant:`outline`,onClick:()=>P(!1),children:e(`database.copy.cancel`)}),(0,S.jsx)(o,{onClick:()=>void F(),disabled:!E.trim()||A!==null,children:e(`database.copy.copy`)})]})]})})}export{C as CopyDatabaseDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{S as o,p as s}from"./BdPEUnLq.js";import{Lt as c,Mt as l}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{S as o,p as s}from"./BdPEUnLq.js";import{Lt as c,Mt as l}from"./D7Ze5md9.js";import{a as u,i as d,n as f,o as p,r as m,t as h}from"./DxuXBECK.js";var g=e(t(),1),_=r();function v({text:e,label:t}){let[n,r]=(0,g.useState)(!1),i=(0,g.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1600)})},[e]);return(0,_.jsxs)(`div`,{className:`grid gap-1`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,_.jsx)(`span`,{className:`text-xs font-medium`,children:t}),(0,_.jsx)(a,{variant:`ghost`,size:`sm`,className:`h-6 gap-1 px-2 text-xs`,onClick:i,children:n?(0,_.jsx)(c,{className:`size-3`}):(0,_.jsx)(l,{className:`size-3`})})]}),(0,_.jsx)(`pre`,{"data-selectable":!0,className:`max-h-32 overflow-auto whitespace-pre-wrap break-all rounded-md border bg-muted/40 p-2 text-[11px] leading-snug`,children:e})]})}function y(){let e=n(e=>e.activeDialog),t=n(e=>e.closeDialog),{t:r}=i(),[c,l]=(0,g.useState)(null),[y,b]=(0,g.useState)(null),[x,S]=(0,g.useState)(!1),C=e===`mcp-setup`;(0,g.useEffect)(()=>{C&&s().then(e=>{l(e),S(!1)}).catch(e=>b(e instanceof Error?e.message:String(e)))},[C]);let w=(0,g.useCallback)(()=>{o().then(()=>{l(null),S(!0)})},[]),T=c?`claude mcp add --transport http planche ${c.url} \\\n -H "Authorization: Bearer ${c.token}"`:``,E=c?JSON.stringify({mcpServers:{planche:{type:`http`,url:c.url,headers:{Authorization:`Bearer ${c.token}`}}}},null,2):``;return(0,_.jsx)(h,{open:C,onOpenChange:e=>{e||t()},children:(0,_.jsxs)(f,{className:`sm:max-w-[620px]`,children:[(0,_.jsxs)(u,{children:[(0,_.jsx)(p,{children:r(`mcp.title`)}),(0,_.jsx)(m,{children:r(`mcp.description`)})]}),(0,_.jsxs)(`div`,{className:`grid gap-3`,children:[(0,_.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 text-xs`,children:[[`readsLabel`,`reads`],[`writesLabel`,`writes`],[`needsLabel`,`needs`],[`tokenLabel`,`token`]].map(([e,t])=>(0,_.jsxs)(g.Fragment,{children:[(0,_.jsx)(`dt`,{className:`font-medium`,children:r(`mcp.${e}`)}),(0,_.jsx)(`dd`,{className:`text-muted-foreground`,children:r(`mcp.${t}`)})]},e))}),y&&(0,_.jsx)(`p`,{className:`rounded-md border border-destructive/40 p-2 text-xs text-destructive`,children:y}),x&&(0,_.jsx)(`p`,{className:`rounded-md border p-2 text-xs text-muted-foreground`,children:r(`mcp.revoked`)}),c&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(v,{text:T,label:r(`mcp.command`)}),(0,_.jsx)(v,{text:E,label:r(`mcp.json`)}),(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`mcp.stored`,{path:c.path})})]})]}),(0,_.jsxs)(d,{children:[c&&(0,_.jsx)(a,{variant:`ghost`,size:`sm`,onClick:w,children:r(`mcp.revoke`)}),(0,_.jsx)(a,{size:`sm`,onClick:t,children:r(`settings.done`)})]})]})})}export{y as McpSetupDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{a as r,l as i,m as a,o,t as s}from"./CKOS5Y-e.js";import{t as c}from"./DTxGpkJp.js";import{a as l}from"./Cw_LYT6k.js";import{i as u}from"./C1RY7wUM.js";import{n as d}from"./DbRMSZEW.js";import{l as f}from"./D98JmiqU.js";import{Ft as p,c as m,ct as h,gt as g,jt as _,mt as v}from"./2sxOfzyn.js";import{a as y,i as b,n as x,o as S,t as C}from"./DxuXBECK.js";import{n as w,t as T}from"./rcI4Fmt0.js";var E=r(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),D=r(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),O=e(t(),1),k=i();function A({databases:e,tables:t,onSelectScope:n}){let{t:r}=a(),[i,s]=(0,O.useState)(new Set),[c,l]=(0,O.useState)(`global`),u=(0,O.useCallback)(e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),d=[{id:`global`,text:r(`user.grantTree.globalPrivileges`),type:`global`,children:e.map(e=>({id:`db:${e}`,text:e,type:`database`,database:e,children:(t[e]??[]).map(t=>({id:`tbl:${e}.${t}`,text:t,type:`table`,database:e,table:t}))}))}];function f(e){l(e.id),n({level:e.type,database:e.database,table:e.table})}function m(e,t){let n=e.children&&e.children.length>0,r=i.has(e.id),a=c===e.id,s=E;return e.type===`database`&&(s=_),e.type===`table`&&(s=g),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`div`,{className:o(`flex items-center gap-1 px-2 py-0.5 cursor-pointer text-sm hover:bg-accent rounded-sm`,a&&`bg-accent text-accent-foreground`),style:{paddingLeft:`${t*16+4}px`},onClick:()=>{f(e),n&&u(e.id)},children:[n?(0,k.jsx)(p,{className:o(`h-3 w-3 transition-transform shrink-0`,r&&`rotate-90`)}):(0,k.jsx)(`span`,{className:`w-3 shrink-0`}),(0,k.jsx)(s,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,k.jsx)(`span`,{className:`truncate`,children:e.text})]}),r&&e.children?.map(e=>m(e,t+1))]},e.id)}return(0,k.jsx)(h,{className:`h-full`,children:(0,k.jsx)(`div`,{className:`py-1`,children:d.map(e=>m(e,0))})})}var j={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`SUPER`,`PROCESS`,`RELOAD`,`SHUTDOWN`,`SHOW DATABASES`,`LOCK TABLES`,`EXECUTE`,`REPLICATION SLAVE`,`REPLICATION CLIENT`,`CREATE VIEW`,`SHOW VIEW`,`CREATE ROUTINE`,`ALTER ROUTINE`,`CREATE USER`,`EVENT`,`TRIGGER`,`CREATE TABLESPACE`]},M={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`LOCK TABLES`,`EXECUTE`,`CREATE VIEW`,`SHOW VIEW`,`CREATE ROUTINE`,`ALTER ROUTINE`,`EVENT`,`TRIGGER`]},N={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`TRIGGER`]},P={global:`user.privileges.globalTitle`,database:`user.privileges.databaseTitle`,table:`user.privileges.tableTitle`},F={Data:`user.privileges.categoryData`,Structure:`user.privileges.categoryStructure`,Administration:`user.privileges.categoryAdministration`};function I({scope:e,privileges:t,onChange:n}){let{t:r}=a(),i=(0,O.useMemo)(()=>e===`global`?j:e===`database`?M:N,[e]),o=(0,O.useMemo)(()=>Object.values(i).flat(),[i]);function c(e){n({...t,[e]:!t[e]})}function l(){let e={...t};for(let t of o)e[t]=!0;n(e)}function u(){let e={...t};for(let t of o)e[t]=!1;n(e)}return(0,k.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium`,children:r(P[e])}),(0,k.jsxs)(`div`,{className:`ml-auto flex gap-1`,children:[(0,k.jsx)(s,{variant:`outline`,size:`sm`,onClick:l,children:r(`user.privileges.checkAll`)}),(0,k.jsx)(s,{variant:`outline`,size:`sm`,onClick:u,children:r(`user.privileges.uncheckAll`)})]})]}),(0,k.jsx)(h,{className:`flex-1`,children:(0,k.jsx)(`div`,{className:`p-3 space-y-4`,children:Object.entries(i).map(([e,n])=>(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2`,children:F[e]?r(F[e]):e}),(0,k.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:n.map(e=>(0,k.jsxs)(m,{className:`flex items-center gap-2 text-sm font-normal cursor-pointer py-1`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:t[e]??!1,onChange:()=>c(e),className:`rounded border-input`}),e]},e))})]},e))})})]})}var L={SELECT:`Select_priv`,INSERT:`Insert_priv`,UPDATE:`Update_priv`,DELETE:`Delete_priv`,CREATE:`Create_priv`,ALTER:`Alter_priv`,DROP:`Drop_priv`,INDEX:`Index_priv`,REFERENCES:`References_priv`,"GRANT OPTION":`Grant_priv`,SUPER:`Super_priv`,PROCESS:`Process_priv`,RELOAD:`Reload_priv`,SHUTDOWN:`Shutdown_priv`,"SHOW DATABASES":`Show_db_priv`,"LOCK TABLES":`Lock_tables_priv`,EXECUTE:`Execute_priv`,"REPLICATION SLAVE":`Repl_slave_priv`,"REPLICATION CLIENT":`Repl_client_priv`,"CREATE VIEW":`Create_view_priv`,"SHOW VIEW":`Show_view_priv`,"CREATE ROUTINE":`Create_routine_priv`,"ALTER ROUTINE":`Alter_routine_priv`,"CREATE USER":`Create_user_priv`,EVENT:`Event_priv`,TRIGGER:`Trigger_priv`,"CREATE TABLESPACE":`Create_tablespace_priv`,"CREATE TEMPORARY TABLES":`Create_tmp_table_priv`,FILE:`File_priv`};function R(e){let t={};for(let n of e.split(`,`)){let e=n.trim().toUpperCase();e&&(t[e]=!0)}return t}function z(e){let t={};for(let[n,r]of Object.entries(L)){let i=e[r];i!==void 0&&(t[n]=String(i).toUpperCase()===`Y`)}return t}function B(e,t){let n=t=>e.quoteIdentifier(t);return t.level===`global`?`*.*`:t.level===`database`?`${n(t.database??``)}.*`:`${n(t.database??``)}.${n(t.table??``)}`}async function V(e,t,n,r,i){if(i.level===`global`){let i=await e(t.getQuery(`USER_PRIV`,n,r)),a=u(i)[0];return a?z(a):{}}if(i.level===`database`){let a=await e(t.getQuery(`USER_DATABASE_PRIV`,n,r)),o=u(a).find(e=>String(e.Db)===i.database);return o?z(o):{}}let a=await e(t.getQuery(`USER_TABLE_PRIV`,n,r)),o=u(a).find(e=>String(e.Db)===i.database&&String(e.Table_name)===i.table);return o?R(String(o.Table_priv??``)):{}}function H(e,t,n,r,i,a){let o=B(e,r),s=[],c=[],l=null;for(let e of new Set([...Object.keys(i),...Object.keys(a)])){let t=i[e]===!0,n=a[e]===!0;if(t!==n){if(e===`GRANT OPTION`){l=n;continue}(n?s:c).push(e)}}let u=[];if(s.length>0||l===!0){let r=s.length>0?s.join(`, `):`USAGE`;u.push(e.getQuery(`GRANT`,r,t,n,o,l===!0?`WITH GRANT OPTION`:``))}return c.length>0&&u.push(e.getQuery(`REVOKE`,c.join(`, `),t,n,o)),l===!1&&u.push(e.getQuery(`REVOKE`,`GRANT OPTION`,t,n,o)),u}function U(e){return c.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId??null}function W(){let{t:e}=a(),{activeDialog:t,closeDialog:r,openDialog:i,setFooterMessage:u}=n(),p=c(e=>e.activeConnectionId)??``,m=w(e=>e.users[p]??T),g=w(e=>e.selectedUser[p]??null),_=w(e=>e.setSelectedUser),E=w(e=>e.removeUser),j=e=>_(p,e),M=(e,t)=>E(p,e,t),[N,P]=(0,O.useState)({level:`global`}),[F,L]=(0,O.useState)({}),[R,z]=(0,O.useState)([]),[B,W]=(0,O.useState)({}),[G,K]=(0,O.useState)({}),[q,J]=(0,O.useState)(!1),Y=t===`user-manager`;(0,O.useEffect)(()=>{if(!Y||!p)return;let e=U(p);if(!e)return;let t=!1;return d(p).introspect.listDatabases(l(e)).then(e=>{t||z(e)}).catch(()=>{t||z([])}),()=>{t=!0}},[Y,p]),(0,O.useEffect)(()=>{let e=N.database;if(!Y||!p||!e||B[e])return;let t=U(p);if(!t)return;let n=!1;return d(p).introspect.listTables(l(t),e).then(t=>{n||W(n=>({...n,[e]:t.map(e=>e.name)}))}).catch(()=>void 0),()=>{n=!0}},[Y,p,N.database,B]),(0,O.useEffect)(()=>{if(!Y||!p||!g){K({}),L({});return}let e=U(p);if(!e)return;let t=!1;return V(l(e),d(p),g.user,g.host,N).then(e=>{t||(K(e),L(e))}).catch(()=>{t||(K({}),L({}))}),()=>{t=!0}},[Y,p,g,N]);function X(e){e||(r(),j(null),P({level:`global`}),L({}))}let Z=(0,O.useCallback)(e=>{P(e),L({})},[]);function Q(){i(`user-add`)}async function $(){if(!g||!p)return;let{user:t,host:n}=g;J(!0);try{await f(p,d(p).getQuery(`DELETE_USER`,t,n)),M(n,t),j(null),u(e(`user.manager.removed`,{user:t,host:n}))}catch(e){u(e instanceof Error?e.message:String(e))}finally{J(!1)}}async function ee(){if(!g||!p){u(e(`user.manager.selectUserFirst`));return}let t=H(d(p),g.user,g.host,N,G,F);if(t.length===0){u(e(`user.manager.noChanges`));return}J(!0);try{for(let e of t)await f(p,e);K(F),u(e(`user.manager.applied`))}catch(e){u(e instanceof Error?e.message:String(e))}finally{J(!1)}}return(0,k.jsx)(C,{open:Y,onOpenChange:X,children:(0,k.jsxs)(x,{className:`sm:max-w-[80vw] max-h-[70vh] flex flex-col`,children:[(0,k.jsx)(y,{children:(0,k.jsx)(S,{children:e(`user.manager.title`)})}),(0,k.jsxs)(`div`,{className:`flex flex-1 gap-0 overflow-hidden min-h-0 border rounded-md`,children:[(0,k.jsxs)(`div`,{className:`w-[200px] shrink-0 border-r flex flex-col`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1 p-2 border-b`,children:[(0,k.jsx)(s,{variant:`ghost`,size:`sm`,onClick:Q,title:e(`user.manager.addUser`),children:(0,k.jsx)(D,{className:`h-4 w-4`})}),(0,k.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void $(),disabled:!g||q,title:e(`user.manager.removeUser`),children:(0,k.jsx)(v,{className:`h-4 w-4`})})]}),(0,k.jsx)(h,{className:`flex-1`,children:(0,k.jsx)(`div`,{className:`py-1`,children:m.length===0?(0,k.jsx)(`div`,{className:`px-3 py-4 text-sm text-muted-foreground text-center`,children:e(`user.manager.noUsers`)}):m.map(e=>{let t=g?.user===e.user&&g?.host===e.host;return(0,k.jsx)(`div`,{className:o(`flex items-center gap-2 px-3 py-1.5 cursor-pointer text-sm hover:bg-accent`,t&&`bg-accent text-accent-foreground`),onClick:()=>j(e),children:(0,k.jsxs)(`span`,{className:`truncate`,children:[e.user,`@`,e.host]})},`${e.user}@${e.host}`)})})})]}),(0,k.jsxs)(`div`,{className:`w-[250px] shrink-0 border-r`,children:[(0,k.jsx)(`div`,{className:`p-2 border-b text-sm font-medium`,children:e(`user.manager.grantScope`)}),(0,k.jsx)(A,{connectionId:``,databases:R,tables:B,onSelectScope:Z})]}),(0,k.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,k.jsx)(I,{scope:N.level,privileges:F,onChange:L})})]}),(0,k.jsxs)(b,{children:[(0,k.jsx)(s,{onClick:()=>void ee(),disabled:q,children:e(`user.manager.apply`)}),(0,k.jsx)(s,{variant:`outline`,onClick:()=>X(!1),children:e(`user.manager.close`)})]})]})})}export{W as UserManagerDialog};
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{a as r,l as i,m as a,o,t as s}from"./CKOS5Y-e.js";import{t as c}from"./DTxGpkJp.js";import{a as l}from"./Cw_LYT6k.js";import{i as u}from"./C1RY7wUM.js";import{n as d}from"./DbRMSZEW.js";import{l as f}from"./DlKZCiMg.js";import{Ft as p,c as m,ct as h,gt as g,jt as _,mt as v}from"./D7Ze5md9.js";import{a as y,i as b,n as x,o as S,t as C}from"./DxuXBECK.js";import{n as w,t as T}from"./rcI4Fmt0.js";var E=r(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),D=r(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),O=e(t(),1),k=i();function A({databases:e,tables:t,onSelectScope:n}){let{t:r}=a(),[i,s]=(0,O.useState)(new Set),[c,l]=(0,O.useState)(`global`),u=(0,O.useCallback)(e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),d=[{id:`global`,text:r(`user.grantTree.globalPrivileges`),type:`global`,children:e.map(e=>({id:`db:${e}`,text:e,type:`database`,database:e,children:(t[e]??[]).map(t=>({id:`tbl:${e}.${t}`,text:t,type:`table`,database:e,table:t}))}))}];function f(e){l(e.id),n({level:e.type,database:e.database,table:e.table})}function m(e,t){let n=e.children&&e.children.length>0,r=i.has(e.id),a=c===e.id,s=E;return e.type===`database`&&(s=_),e.type===`table`&&(s=g),(0,k.jsxs)(`div`,{children:[(0,k.jsxs)(`div`,{className:o(`flex items-center gap-1 px-2 py-0.5 cursor-pointer text-sm hover:bg-accent rounded-sm`,a&&`bg-accent text-accent-foreground`),style:{paddingLeft:`${t*16+4}px`},onClick:()=>{f(e),n&&u(e.id)},children:[n?(0,k.jsx)(p,{className:o(`h-3 w-3 transition-transform shrink-0`,r&&`rotate-90`)}):(0,k.jsx)(`span`,{className:`w-3 shrink-0`}),(0,k.jsx)(s,{className:`h-4 w-4 text-muted-foreground shrink-0`}),(0,k.jsx)(`span`,{className:`truncate`,children:e.text})]}),r&&e.children?.map(e=>m(e,t+1))]},e.id)}return(0,k.jsx)(h,{className:`h-full`,children:(0,k.jsx)(`div`,{className:`py-1`,children:d.map(e=>m(e,0))})})}var j={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`SUPER`,`PROCESS`,`RELOAD`,`SHUTDOWN`,`SHOW DATABASES`,`LOCK TABLES`,`EXECUTE`,`REPLICATION SLAVE`,`REPLICATION CLIENT`,`CREATE VIEW`,`SHOW VIEW`,`CREATE ROUTINE`,`ALTER ROUTINE`,`CREATE USER`,`EVENT`,`TRIGGER`,`CREATE TABLESPACE`]},M={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`LOCK TABLES`,`EXECUTE`,`CREATE VIEW`,`SHOW VIEW`,`CREATE ROUTINE`,`ALTER ROUTINE`,`EVENT`,`TRIGGER`]},N={Data:[`SELECT`,`INSERT`,`UPDATE`,`DELETE`],Structure:[`CREATE`,`ALTER`,`DROP`,`INDEX`,`REFERENCES`],Administration:[`GRANT OPTION`,`TRIGGER`]},P={global:`user.privileges.globalTitle`,database:`user.privileges.databaseTitle`,table:`user.privileges.tableTitle`},F={Data:`user.privileges.categoryData`,Structure:`user.privileges.categoryStructure`,Administration:`user.privileges.categoryAdministration`};function I({scope:e,privileges:t,onChange:n}){let{t:r}=a(),i=(0,O.useMemo)(()=>e===`global`?j:e===`database`?M:N,[e]),o=(0,O.useMemo)(()=>Object.values(i).flat(),[i]);function c(e){n({...t,[e]:!t[e]})}function l(){let e={...t};for(let t of o)e[t]=!0;n(e)}function u(){let e={...t};for(let t of o)e[t]=!1;n(e)}return(0,k.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2 p-2 border-b`,children:[(0,k.jsx)(`span`,{className:`text-sm font-medium`,children:r(P[e])}),(0,k.jsxs)(`div`,{className:`ml-auto flex gap-1`,children:[(0,k.jsx)(s,{variant:`outline`,size:`sm`,onClick:l,children:r(`user.privileges.checkAll`)}),(0,k.jsx)(s,{variant:`outline`,size:`sm`,onClick:u,children:r(`user.privileges.uncheckAll`)})]})]}),(0,k.jsx)(h,{className:`flex-1`,children:(0,k.jsx)(`div`,{className:`p-3 space-y-4`,children:Object.entries(i).map(([e,n])=>(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`h4`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2`,children:F[e]?r(F[e]):e}),(0,k.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:n.map(e=>(0,k.jsxs)(m,{className:`flex items-center gap-2 text-sm font-normal cursor-pointer py-1`,children:[(0,k.jsx)(`input`,{type:`checkbox`,checked:t[e]??!1,onChange:()=>c(e),className:`rounded border-input`}),e]},e))})]},e))})})]})}var L={SELECT:`Select_priv`,INSERT:`Insert_priv`,UPDATE:`Update_priv`,DELETE:`Delete_priv`,CREATE:`Create_priv`,ALTER:`Alter_priv`,DROP:`Drop_priv`,INDEX:`Index_priv`,REFERENCES:`References_priv`,"GRANT OPTION":`Grant_priv`,SUPER:`Super_priv`,PROCESS:`Process_priv`,RELOAD:`Reload_priv`,SHUTDOWN:`Shutdown_priv`,"SHOW DATABASES":`Show_db_priv`,"LOCK TABLES":`Lock_tables_priv`,EXECUTE:`Execute_priv`,"REPLICATION SLAVE":`Repl_slave_priv`,"REPLICATION CLIENT":`Repl_client_priv`,"CREATE VIEW":`Create_view_priv`,"SHOW VIEW":`Show_view_priv`,"CREATE ROUTINE":`Create_routine_priv`,"ALTER ROUTINE":`Alter_routine_priv`,"CREATE USER":`Create_user_priv`,EVENT:`Event_priv`,TRIGGER:`Trigger_priv`,"CREATE TABLESPACE":`Create_tablespace_priv`,"CREATE TEMPORARY TABLES":`Create_tmp_table_priv`,FILE:`File_priv`};function R(e){let t={};for(let n of e.split(`,`)){let e=n.trim().toUpperCase();e&&(t[e]=!0)}return t}function z(e){let t={};for(let[n,r]of Object.entries(L)){let i=e[r];i!==void 0&&(t[n]=String(i).toUpperCase()===`Y`)}return t}function B(e,t){let n=t=>e.quoteIdentifier(t);return t.level===`global`?`*.*`:t.level===`database`?`${n(t.database??``)}.*`:`${n(t.database??``)}.${n(t.table??``)}`}async function V(e,t,n,r,i){if(i.level===`global`){let i=await e(t.getQuery(`USER_PRIV`,n,r)),a=u(i)[0];return a?z(a):{}}if(i.level===`database`){let a=await e(t.getQuery(`USER_DATABASE_PRIV`,n,r)),o=u(a).find(e=>String(e.Db)===i.database);return o?z(o):{}}let a=await e(t.getQuery(`USER_TABLE_PRIV`,n,r)),o=u(a).find(e=>String(e.Db)===i.database&&String(e.Table_name)===i.table);return o?R(String(o.Table_priv??``)):{}}function H(e,t,n,r,i,a){let o=B(e,r),s=[],c=[],l=null;for(let e of new Set([...Object.keys(i),...Object.keys(a)])){let t=i[e]===!0,n=a[e]===!0;if(t!==n){if(e===`GRANT OPTION`){l=n;continue}(n?s:c).push(e)}}let u=[];if(s.length>0||l===!0){let r=s.length>0?s.join(`, `):`USAGE`;u.push(e.getQuery(`GRANT`,r,t,n,o,l===!0?`WITH GRANT OPTION`:``))}return c.length>0&&u.push(e.getQuery(`REVOKE`,c.join(`, `),t,n,o)),l===!1&&u.push(e.getQuery(`REVOKE`,`GRANT OPTION`,t,n,o)),u}function U(e){return c.getState().activeConnections.find(t=>t.id===e)?.serverConnectionId??null}function W(){let{t:e}=a(),{activeDialog:t,closeDialog:r,openDialog:i,setFooterMessage:u}=n(),p=c(e=>e.activeConnectionId)??``,m=w(e=>e.users[p]??T),g=w(e=>e.selectedUser[p]??null),_=w(e=>e.setSelectedUser),E=w(e=>e.removeUser),j=e=>_(p,e),M=(e,t)=>E(p,e,t),[N,P]=(0,O.useState)({level:`global`}),[F,L]=(0,O.useState)({}),[R,z]=(0,O.useState)([]),[B,W]=(0,O.useState)({}),[G,K]=(0,O.useState)({}),[q,J]=(0,O.useState)(!1),Y=t===`user-manager`;(0,O.useEffect)(()=>{if(!Y||!p)return;let e=U(p);if(!e)return;let t=!1;return d(p).introspect.listDatabases(l(e)).then(e=>{t||z(e)}).catch(()=>{t||z([])}),()=>{t=!0}},[Y,p]),(0,O.useEffect)(()=>{let e=N.database;if(!Y||!p||!e||B[e])return;let t=U(p);if(!t)return;let n=!1;return d(p).introspect.listTables(l(t),e).then(t=>{n||W(n=>({...n,[e]:t.map(e=>e.name)}))}).catch(()=>void 0),()=>{n=!0}},[Y,p,N.database,B]),(0,O.useEffect)(()=>{if(!Y||!p||!g){K({}),L({});return}let e=U(p);if(!e)return;let t=!1;return V(l(e),d(p),g.user,g.host,N).then(e=>{t||(K(e),L(e))}).catch(()=>{t||(K({}),L({}))}),()=>{t=!0}},[Y,p,g,N]);function X(e){e||(r(),j(null),P({level:`global`}),L({}))}let Z=(0,O.useCallback)(e=>{P(e),L({})},[]);function Q(){i(`user-add`)}async function $(){if(!g||!p)return;let{user:t,host:n}=g;J(!0);try{await f(p,d(p).getQuery(`DELETE_USER`,t,n)),M(n,t),j(null),u(e(`user.manager.removed`,{user:t,host:n}))}catch(e){u(e instanceof Error?e.message:String(e))}finally{J(!1)}}async function ee(){if(!g||!p){u(e(`user.manager.selectUserFirst`));return}let t=H(d(p),g.user,g.host,N,G,F);if(t.length===0){u(e(`user.manager.noChanges`));return}J(!0);try{for(let e of t)await f(p,e);K(F),u(e(`user.manager.applied`))}catch(e){u(e instanceof Error?e.message:String(e))}finally{J(!1)}}return(0,k.jsx)(C,{open:Y,onOpenChange:X,children:(0,k.jsxs)(x,{className:`sm:max-w-[80vw] max-h-[70vh] flex flex-col`,children:[(0,k.jsx)(y,{children:(0,k.jsx)(S,{children:e(`user.manager.title`)})}),(0,k.jsxs)(`div`,{className:`flex flex-1 gap-0 overflow-hidden min-h-0 border rounded-md`,children:[(0,k.jsxs)(`div`,{className:`w-[200px] shrink-0 border-r flex flex-col`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1 p-2 border-b`,children:[(0,k.jsx)(s,{variant:`ghost`,size:`sm`,onClick:Q,title:e(`user.manager.addUser`),children:(0,k.jsx)(D,{className:`h-4 w-4`})}),(0,k.jsx)(s,{variant:`ghost`,size:`sm`,onClick:()=>void $(),disabled:!g||q,title:e(`user.manager.removeUser`),children:(0,k.jsx)(v,{className:`h-4 w-4`})})]}),(0,k.jsx)(h,{className:`flex-1`,children:(0,k.jsx)(`div`,{className:`py-1`,children:m.length===0?(0,k.jsx)(`div`,{className:`px-3 py-4 text-sm text-muted-foreground text-center`,children:e(`user.manager.noUsers`)}):m.map(e=>{let t=g?.user===e.user&&g?.host===e.host;return(0,k.jsx)(`div`,{className:o(`flex items-center gap-2 px-3 py-1.5 cursor-pointer text-sm hover:bg-accent`,t&&`bg-accent text-accent-foreground`),onClick:()=>j(e),children:(0,k.jsxs)(`span`,{className:`truncate`,children:[e.user,`@`,e.host]})},`${e.user}@${e.host}`)})})})]}),(0,k.jsxs)(`div`,{className:`w-[250px] shrink-0 border-r`,children:[(0,k.jsx)(`div`,{className:`p-2 border-b text-sm font-medium`,children:e(`user.manager.grantScope`)}),(0,k.jsx)(A,{connectionId:``,databases:R,tables:B,onSelectScope:Z})]}),(0,k.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,k.jsx)(I,{scope:N.level,privileges:F,onChange:L})})]}),(0,k.jsxs)(b,{children:[(0,k.jsx)(s,{onClick:()=>void ee(),disabled:q,children:e(`user.manager.apply`)}),(0,k.jsx)(s,{variant:`outline`,onClick:()=>X(!1),children:e(`user.manager.close`)})]})]})})}export{W as UserManagerDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{a as i,i as a,n as o,r as s,t as c}from"./
|
|
1
|
+
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{a as i,i as a,n as o,r as s,t as c}from"./D_2UqK4k.js";import{n as l}from"./BBSxV90W.js";import{c as u,l as d}from"./D7Ze5md9.js";import{a as f,i as p,n as m,o as h,r as g,t as _}from"./DxuXBECK.js";import{t as v}from"./NY_tAtcY.js";var y=t();function b(){let t=e(e=>e.activeDialog),b=e(e=>e.closeDialog),x=l(),S=x.update,{t:C}=n();return(0,y.jsx)(_,{open:t===`query-settings`,onOpenChange:e=>{e||b()},children:(0,y.jsxs)(m,{className:`sm:max-w-[560px]`,children:[(0,y.jsxs)(f,{children:[(0,y.jsx)(h,{children:C(`settings.query.title`)}),(0,y.jsx)(g,{children:C(`settings.query.description`)})]}),(0,y.jsxs)(`div`,{className:`grid gap-2`,children:[(0,y.jsx)(v,{id:`s-dryrun`,checked:x.previewAffectedRows,onChange:e=>S({previewAffectedRows:e}),pro:!0,label:`Dry run`,hint:`Before an UPDATE or DELETE runs, read its WHERE (joins included) as a SELECT and show how many rows it would change, with a sample of them, to confirm.`}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[1fr_140px] items-center gap-3 rounded-md border p-3`,children:[(0,y.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,y.jsx)(u,{htmlFor:`s-limit`,className:`text-sm font-medium`,children:`Result row limit`}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`LIMIT appended to SELECTs that have none. 0 disables.`})]}),(0,y.jsx)(d,{id:`s-limit`,type:`number`,min:0,step:100,value:x.resultRowLimit,onChange:e=>S({resultRowLimit:Math.max(0,Number(e.target.value)||0)})})]}),(0,y.jsxs)(`div`,{className:`grid grid-cols-[1fr_200px] items-center gap-3 rounded-md border p-3`,children:[(0,y.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,y.jsx)(`span`,{className:`text-sm font-medium`,children:`F9 / Run button executes`}),(0,y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Ctrl+Enter always runs the statement at the cursor; Ctrl+Shift+Enter the whole script.`})]}),(0,y.jsxs)(c,{value:x.executeScope,onValueChange:e=>S({executeScope:e}),children:[(0,y.jsx)(a,{children:(0,y.jsx)(i,{})}),(0,y.jsxs)(o,{children:[(0,y.jsx)(s,{value:`script`,children:`Whole script`}),(0,y.jsx)(s,{value:`statement`,children:`Statement at cursor`})]})]})]})]}),(0,y.jsx)(p,{children:(0,y.jsx)(r,{onClick:b,children:C(`settings.done`)})})]})})}export{b as QuerySettingsDialog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{a as s,i as c,n as l,r as u,t as d}from"./DkdStXtl.js";import{t as f}from"./DTxGpkJp.js";import{a as p}from"./Cw_LYT6k.js";import{n as m}from"./DbRMSZEW.js";import{l as h,p as g}from"./D98JmiqU.js";import{C as _,D as v,E as y,O as b,S as x,T as ee,W as te,X as S,Xt as C,b as w,c as T,ct as E,l as D,ot as O,st as k,v as A,x as j,y as M}from"./2sxOfzyn.js";import{a as N,i as ne,n as re,o as P,t as F}from"./DxuXBECK.js";var I=e(t(),1);function L(){return{id:crypto.randomUUID(),field:``,type:`varchar`,length:``,defaultValue:``,pk:!1,notNull:!1,unsigned:!1,autoIncrement:!1,zerofill:!1,comment:``}}function R(){return{id:crypto.randomUUID(),name:``,type:`INDEX`,columns:[]}}function z(){return{engine:`InnoDB`,charset:`utf8mb4`,collation:`utf8mb4_general_ci`,autoIncrement:``,comment:``}}function B(e,t,n,r,i){return{database:e,name:t,columns:n.map(e=>({name:e.field,type:e.type,length:e.length,defaultValue:e.defaultValue,primaryKey:e.pk,notNull:e.notNull,unsigned:e.unsigned,autoIncrement:e.autoIncrement,zerofill:e.zerofill,comment:e.comment})),indexes:r.map(e=>({name:e.name,type:e.type,columns:[...e.columns]})),options:{...i}}}var V=i(),H=`w-auto min-w-full [&_td]:bg-muted [&_td]:border-r [&_td]:border-border/60 [&_td:last-child]:border-r-0 [&_td]:p-0 [&_td]:h-8 [&_tr:nth-child(even)_td]:bg-muted/60 [&_tr:focus-within_td]:bg-primary/5`,U=`sticky top-0 z-10 bg-catppuccin-crust shadow-[inset_0_-1px_0_var(--border)] [&_th]:h-8 [&_th]:bg-catppuccin-crust [&_th]:font-semibold [&_th]:text-foreground [&_th]:uppercase [&_th]:tracking-wide [&_th]:text-[11px]`,W=`h-8 w-full min-w-0 rounded-none border-0 bg-transparent px-2 text-xs shadow-none ring-0 focus-visible:bg-primary/10 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary dark:bg-transparent`,G=`h-8 w-full min-w-0 rounded-none border-0 bg-transparent px-2 text-xs shadow-none focus-visible:bg-primary/10 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary data-[state=open]:bg-primary/10 dark:bg-transparent dark:hover:bg-transparent`;function ie({columns:e,onChange:t}){let{t:n}=a(),r=O().getDataTypes(),i=(0,I.useCallback)((n,r,i)=>{t(e.map(e=>e.id===n?{...e,[r]:i}:e))},[e,t]);function f(){t([...e,L()])}function p(){e.length>0&&t(e.slice(0,-1))}return(0,V.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,V.jsx)(E,{className:`flex-1`,children:(0,V.jsxs)(A,{className:H,children:[(0,V.jsx)(x,{className:U,children:(0,V.jsxs)(_,{children:[(0,V.jsx)(j,{className:`w-[120px]`,children:n(`table.schema.colField`)}),(0,V.jsx)(j,{className:`w-[120px]`,children:n(`table.schema.colType`)}),(0,V.jsx)(j,{className:`w-[60px]`,children:n(`table.schema.colLength`)}),(0,V.jsx)(j,{className:`w-[100px]`,children:n(`table.schema.colDefault`)}),(0,V.jsx)(j,{className:`w-[40px]`,children:n(`table.schema.colPk`)}),(0,V.jsx)(j,{className:`w-[60px]`,children:n(`table.schema.colNotNull`)}),(0,V.jsx)(j,{className:`w-[60px]`,children:n(`table.schema.colUnsigned`)}),(0,V.jsx)(j,{className:`w-[70px]`,children:n(`table.schema.colAutoIncrement`)}),(0,V.jsx)(j,{className:`w-[60px]`,children:n(`table.schema.colZerofill`)}),(0,V.jsx)(j,{children:n(`table.schema.colComment`)})]})}),(0,V.jsx)(M,{children:e.length===0?(0,V.jsx)(_,{children:(0,V.jsx)(w,{colSpan:10,className:`text-center text-muted-foreground`,children:n(`table.schema.empty`)})}):e.map(e=>(0,V.jsxs)(_,{children:[(0,V.jsx)(w,{children:(0,V.jsx)(D,{className:W,value:e.field,onChange:t=>i(e.id,`field`,t.target.value),placeholder:`column_name`})}),(0,V.jsx)(w,{children:(0,V.jsxs)(d,{value:e.type,onValueChange:t=>i(e.id,`type`,t),children:[(0,V.jsx)(c,{className:G,children:(0,V.jsx)(s,{})}),(0,V.jsx)(l,{children:r.map(e=>(0,V.jsx)(u,{value:e,children:e},e))})]})}),(0,V.jsx)(w,{children:(0,V.jsx)(D,{className:W,value:e.length,onChange:t=>i(e.id,`length`,t.target.value)})}),(0,V.jsx)(w,{children:(0,V.jsx)(D,{className:W,value:e.defaultValue,onChange:t=>i(e.id,`defaultValue`,t.target.value),placeholder:`NULL`})}),(0,V.jsx)(w,{className:`text-center`,children:(0,V.jsx)(`input`,{type:`checkbox`,checked:e.pk,onChange:t=>i(e.id,`pk`,t.target.checked)})}),(0,V.jsx)(w,{className:`text-center`,children:(0,V.jsx)(`input`,{type:`checkbox`,checked:e.notNull,onChange:t=>i(e.id,`notNull`,t.target.checked)})}),(0,V.jsx)(w,{className:`text-center`,children:(0,V.jsx)(`input`,{type:`checkbox`,checked:e.unsigned,onChange:t=>i(e.id,`unsigned`,t.target.checked)})}),(0,V.jsx)(w,{className:`text-center`,children:(0,V.jsx)(`input`,{type:`checkbox`,checked:e.autoIncrement,onChange:t=>i(e.id,`autoIncrement`,t.target.checked)})}),(0,V.jsx)(w,{className:`text-center`,children:(0,V.jsx)(`input`,{type:`checkbox`,checked:e.zerofill,onChange:t=>i(e.id,`zerofill`,t.target.checked)})}),(0,V.jsx)(w,{children:(0,V.jsx)(D,{className:W,value:e.comment,onChange:t=>i(e.id,`comment`,t.target.value)})})]},e.id))})]})}),(0,V.jsxs)(`div`,{className:`flex gap-2 p-2 border-t`,children:[(0,V.jsx)(o,{size:`sm`,variant:`outline`,onClick:f,children:n(`table.schema.add`)}),(0,V.jsx)(o,{size:`sm`,variant:`outline`,onClick:p,disabled:e.length===0,children:n(`table.schema.remove`)})]})]})}var K=[`PRIMARY`,`UNIQUE`,`INDEX`,`FULLTEXT`];function q({open:e,index:t,availableColumns:n,onSave:r,onClose:i}){let{t:f}=a(),[p,m]=(0,I.useState)(t.name),[h,g]=(0,I.useState)(t.type),[_,v]=(0,I.useState)(t.columns);function y(e){v(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function b(){r({id:t.id,name:h===`PRIMARY`?`PRIMARY`:p,type:h,columns:_})}return(0,V.jsx)(F,{open:e,onOpenChange:e=>{e||i()},children:(0,V.jsxs)(re,{className:`sm:max-w-[500px]`,children:[(0,V.jsx)(N,{children:(0,V.jsx)(P,{children:t.name?f(`table.index.editTitle`):f(`table.index.addTitle`)})}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`idx-name`,children:f(`table.index.name`)}),(0,V.jsx)(D,{id:`idx-name`,value:h===`PRIMARY`?`PRIMARY`:p,onChange:e=>m(e.target.value),disabled:h===`PRIMARY`,placeholder:f(`table.index.namePlaceholder`)})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`idx-type`,children:f(`table.index.type`)}),(0,V.jsxs)(d,{value:h,onValueChange:e=>g(e),children:[(0,V.jsx)(c,{id:`idx-type`,className:`w-full`,children:(0,V.jsx)(s,{})}),(0,V.jsx)(l,{children:K.map(e=>(0,V.jsx)(u,{value:e,children:e},e))})]})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{children:f(`table.index.columns`)}),(0,V.jsx)(`div`,{className:`border rounded-md p-2 max-h-[200px] overflow-y-auto space-y-1`,children:n.length===0?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f(`table.index.noColumns`)}):n.map(e=>(0,V.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer hover:bg-muted/50 rounded px-1 py-0.5`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:_.includes(e.field),onChange:()=>y(e.field)}),(0,V.jsx)(`span`,{children:e.field||f(`table.index.unnamed`)}),(0,V.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.type,`)`]})]},e.id))})]})]}),(0,V.jsxs)(ne,{children:[(0,V.jsx)(o,{variant:`outline`,onClick:i,children:f(`table.index.cancel`)}),(0,V.jsx)(o,{onClick:b,disabled:_.length===0,children:f(`table.index.ok`)})]})]})})}function ae({indexes:e,availableColumns:t,onChange:n}){let{t:r}=a(),[i,s]=(0,I.useState)(null),[c,l]=(0,I.useState)(!1);function u(){let e=R();s(e),l(!0)}function d(e){s({...e}),l(!0)}function f(){e.length>0&&n(e.slice(0,-1))}function p(t){e.find(e=>e.id===t.id)?n(e.map(e=>e.id===t.id?t:e)):n([...e,t]),l(!1),s(null)}function m(){l(!1),s(null)}return(0,V.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,V.jsx)(E,{className:`flex-1`,children:(0,V.jsxs)(A,{className:H+` [&_td]:px-2`,children:[(0,V.jsx)(x,{className:U,children:(0,V.jsxs)(_,{children:[(0,V.jsx)(j,{className:`w-[150px]`,children:r(`table.indexes.colName`)}),(0,V.jsx)(j,{className:`w-[120px]`,children:r(`table.indexes.colType`)}),(0,V.jsx)(j,{children:r(`table.indexes.colColumns`)})]})}),(0,V.jsx)(M,{children:e.length===0?(0,V.jsx)(_,{children:(0,V.jsx)(w,{colSpan:3,className:`text-center text-muted-foreground`,children:r(`table.indexes.empty`)})}):e.map(e=>(0,V.jsxs)(_,{className:`cursor-pointer`,onDoubleClick:()=>d(e),children:[(0,V.jsx)(w,{children:e.name}),(0,V.jsx)(w,{children:e.type}),(0,V.jsx)(w,{children:e.columns.join(`, `)})]},e.id))})]})}),(0,V.jsxs)(`div`,{className:`flex gap-2 p-2 border-t`,children:[(0,V.jsx)(o,{size:`sm`,variant:`outline`,onClick:u,children:r(`table.indexes.add`)}),(0,V.jsx)(o,{size:`sm`,variant:`outline`,onClick:f,disabled:e.length===0,children:r(`table.indexes.remove`)})]}),i&&(0,V.jsx)(q,{open:c,index:i,availableColumns:t,onSave:p,onClose:m})]})}var J=[`InnoDB`,`MyISAM`,`MEMORY`,`CSV`,`ARCHIVE`,`BLACKHOLE`,`MRG_MYISAM`,`FEDERATED`,`PERFORMANCE_SCHEMA`],Y=[`utf8mb4`,`utf8`,`latin1`,`ascii`,`binary`,`cp1251`,`euckr`,`gb2312`,`gbk`,`sjis`,`ucs2`,`utf16`,`utf32`],X={utf8mb4:[`utf8mb4_general_ci`,`utf8mb4_unicode_ci`,`utf8mb4_bin`,`utf8mb4_0900_ai_ci`],utf8:[`utf8_general_ci`,`utf8_unicode_ci`,`utf8_bin`],latin1:[`latin1_swedish_ci`,`latin1_general_ci`,`latin1_bin`],ascii:[`ascii_general_ci`,`ascii_bin`],binary:[`binary`],cp1251:[`cp1251_general_ci`,`cp1251_bin`],euckr:[`euckr_korean_ci`,`euckr_bin`],gb2312:[`gb2312_chinese_ci`,`gb2312_bin`],gbk:[`gbk_chinese_ci`,`gbk_bin`],sjis:[`sjis_japanese_ci`,`sjis_bin`],ucs2:[`ucs2_general_ci`,`ucs2_unicode_ci`,`ucs2_bin`],utf16:[`utf16_general_ci`,`utf16_unicode_ci`,`utf16_bin`],utf32:[`utf32_general_ci`,`utf32_unicode_ci`,`utf32_bin`]};function oe({properties:e,onChange:t}){let{t:n}=a();function r(n,r){let i={...e,[n]:r};n===`charset`&&(i.collation=X[r]?.[0]??``),t(i)}let i=X[e.charset]??[];return(0,V.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`prop-engine`,children:n(`table.properties.engine`)}),(0,V.jsxs)(d,{value:e.engine,onValueChange:e=>r(`engine`,e),children:[(0,V.jsx)(c,{id:`prop-engine`,className:`w-full`,children:(0,V.jsx)(s,{})}),(0,V.jsx)(l,{children:J.map(e=>(0,V.jsx)(u,{value:e,children:e},e))})]})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`prop-charset`,children:n(`table.properties.charset`)}),(0,V.jsxs)(d,{value:e.charset,onValueChange:e=>r(`charset`,e),children:[(0,V.jsx)(c,{id:`prop-charset`,className:`w-full`,children:(0,V.jsx)(s,{})}),(0,V.jsx)(l,{children:Y.map(e=>(0,V.jsx)(u,{value:e,children:e},e))})]})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`prop-collation`,children:n(`table.properties.collation`)}),(0,V.jsxs)(d,{value:e.collation,onValueChange:e=>r(`collation`,e),children:[(0,V.jsx)(c,{id:`prop-collation`,className:`w-full`,children:(0,V.jsx)(s,{})}),(0,V.jsx)(l,{children:i.map(e=>(0,V.jsx)(u,{value:e,children:e},e))})]})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`prop-auto-incr`,children:n(`table.properties.autoIncrement`)}),(0,V.jsx)(D,{id:`prop-auto-incr`,type:`number`,value:e.autoIncrement,onChange:e=>r(`autoIncrement`,e.target.value),placeholder:n(`table.properties.autoIncrementPlaceholder`)})]})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`prop-comment`,children:n(`table.properties.comment`)}),(0,V.jsx)(D,{id:`prop-comment`,value:e.comment,onChange:e=>r(`comment`,e.target.value)})]})]})}function se({connectionId:e,database:t,tableName:n,columns:r,indexes:i,properties:a}){let o=S(e=>e.themeId),s=k(e),c=o===`light`||o===`light-blue`||o===`solarized-light`?`vs`:`vs-dark`,l=(0,I.useMemo)(()=>s.ddl.createTable(B(t,n,r,i,a)),[s,t,n,r,i,a]);return(0,V.jsx)(`div`,{className:`h-[320px]`,children:(0,V.jsx)(C,{height:`100%`,language:`sql`,theme:c,value:l,options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineNumbers:`on`,wordWrap:`on`}})})}function Z(e){return JSON.stringify([e.type,e.length,e.defaultValue,e.pk,e.notNull,e.unsigned,e.autoIncrement,e.zerofill,e.comment])}function Q(e){return{name:e.field,type:e.length?`${e.type}(${e.length})`:e.type,nullable:!e.notNull,key:e.pk?`PRI`:``,defaultValue:e.defaultValue===``?null:e.defaultValue,extra:e.autoIncrement?`auto_increment`:``,comment:e.comment,collation:null}}function $(e){return{name:e.name,type:e.type,columns:[...e.columns]}}function ce(e,t){return e.name===t.name&&e.type===t.type&&e.columns.join(`,`)===t.columns.join(`,`)}function le({engine:e,database:t,table:n,before:r,after:i}){let{ddl:a}=e,o=[],s=[],c=[],l=new Map(r.columns.map(e=>[e.id,e])),u=new Map(i.columns.map(e=>[e.id,e])),d=new Map(r.indexes.map(e=>[e.id,e])),f=new Map(i.indexes.map(e=>[e.id,e])),p=[];for(let[e,r]of d){let i=f.get(e);i?ce(r,i)||(o.push(a.dropIndex(t,n,r.name)),p.push(i)):o.push(a.dropIndex(t,n,r.name))}for(let[e,r]of u){let i=l.get(e);if(!i){r.field.trim()&&o.push(a.addColumn(t,n,Q(r)));continue}if(i.field!==r.field&&o.push(a.renameColumn(t,n,i.field,r.field)),Z(i)!==Z(r)){let e=a.alterColumn(t,n,Q(r));e?o.push(e):c.push(r.field)}}for(let[e,r]of l)if(!u.has(e)){let e=a.dropColumn(t,n,r.field);o.push(e),s.push(e)}for(let e of p)o.push(a.createIndex(t,n,$(e)));for(let[e,r]of f)!d.has(e)&&r.columns.length>0&&o.push(a.createIndex(t,n,$(r)));return{statements:o,destructive:s,unsupported:c}}function ue(){let{t:e}=a(),{activeDialog:t,closeDialog:i}=n(),s=r(`create-table`,`alter-table`,`duplicate-table-structure`),c=t===`create-table`||t===`alter-table`||t===`duplicate-table-structure`,l=t===`alter-table`,u=t===`duplicate-table-structure`,d=s?.nodeText??``,_=s?.metadata?.database??``,[x,S]=(0,I.useState)(``),[C,w]=(0,I.useState)([L()]),[E,O]=(0,I.useState)([]),[A,j]=(0,I.useState)(z()),[M,R]=(0,I.useState)(!1),[H,U]=(0,I.useState)(!1),[W,G]=(0,I.useState)(null),[K,q]=(0,I.useState)(null),J=s?.connectionId??f.getState().activeConnectionId,Y=k(J);(0,I.useEffect)(()=>{c&&(G(null),q(null),l||u?(S(u?`${d}_copy`:d),X()):(S(``),w([L()]),O([]),j(z())))},[c,t]);async function X(){let e=f.getState(),t=s?.connectionId??e.activeConnectionId,n=e.activeConnections.find(e=>e.id===t)?.serverConnectionId;if(!n||!_||!d)return;R(!0);let{introspect:r,capabilities:i}=m(t),a=p(n);try{let e=await r.listColumns(a,_,d),t=[];if(e.length>0){let n=e.map(e=>{let t=e.type,n=t.match(/^(\w+)(?:\(([^)]+)\))?/);return{id:crypto.randomUUID(),field:e.name,type:n?.[1]?.toLowerCase()??t.toLowerCase(),length:n?.[2]??``,defaultValue:e.defaultValue??``,pk:e.key===`PRI`,notNull:!e.nullable,unsigned:t.includes(`unsigned`),autoIncrement:e.extra.includes(`auto_increment`),zerofill:t.includes(`zerofill`),comment:e.comment}});w(n),t=n}let n=await r.listIndexes(a,_,d),o=[];if(n.length>0&&(o=n.map(e=>({id:crypto.randomUUID(),name:e.name,type:e.type===`SPATIAL`?`INDEX`:e.type,columns:[...e.columns]})),O(o)),q({columns:t,indexes:o}),i.tableProperties){let e=await r.getTableInfo(a,_,d);e&&j({engine:e.engine??`InnoDB`,charset:(e.collation??`utf8mb4`).replace(/_.*/,``),collation:e.collation??`utf8mb4_unicode_ci`,autoIncrement:e.autoIncrement??``,comment:e.comment})}}catch(e){console.error(`Failed to load table schema:`,e),G(e instanceof Error?e.message:String(e))}finally{R(!1)}}function Z(e){e||i()}async function Q(){let t=s?.connectionId??f.getState().activeConnectionId;if(!t||!x.trim())return;let n=m(t);G(null);let r,a=[];if(l){if(!K)return;let t=le({engine:n,database:_,table:d,before:K,after:{columns:C,indexes:E}});if(t.unsupported.length>0){G(e(`table.dialog.cannotAlterColumns`,{engine:n.label,columns:t.unsupported.join(`, `)}));return}if(t.statements.length===0){i();return}r=t.statements.join(`
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n,t as r}from"./XzPc-eVf.js";import{l as i,m as a,t as o}from"./CKOS5Y-e.js";import{a as s,i as c,n as l,r as u,t as d}from"./D_2UqK4k.js";import{t as f}from"./DTxGpkJp.js";import{a as p}from"./Cw_LYT6k.js";import{n as m}from"./DbRMSZEW.js";import{l as h,p as g}from"./DlKZCiMg.js";import{C as _,D as v,E as y,O as b,S as x,T as ee,W as te,X as S,Xt as C,b as w,c as T,ct as E,l as D,ot as O,st as k,v as A,x as j,y as M}from"./D7Ze5md9.js";import{a as N,i as ne,n as re,o as P,t as F}from"./DxuXBECK.js";var I=e(t(),1);function L(){return{id:crypto.randomUUID(),field:``,type:`varchar`,length:``,defaultValue:``,pk:!1,notNull:!1,unsigned:!1,autoIncrement:!1,zerofill:!1,comment:``}}function R(){return{id:crypto.randomUUID(),name:``,type:`INDEX`,columns:[]}}function z(){return{engine:`InnoDB`,charset:`utf8mb4`,collation:`utf8mb4_general_ci`,autoIncrement:``,comment:``}}function B(e,t,n,r,i){return{database:e,name:t,columns:n.map(e=>({name:e.field,type:e.type,length:e.length,defaultValue:e.defaultValue,primaryKey:e.pk,notNull:e.notNull,unsigned:e.unsigned,autoIncrement:e.autoIncrement,zerofill:e.zerofill,comment:e.comment})),indexes:r.map(e=>({name:e.name,type:e.type,columns:[...e.columns]})),options:{...i}}}var V=i(),H=`w-auto min-w-full [&_td]:bg-muted [&_td]:border-r [&_td]:border-border/60 [&_td:last-child]:border-r-0 [&_td]:p-0 [&_td]:h-8 [&_tr:nth-child(even)_td]:bg-muted/60 [&_tr:focus-within_td]:bg-primary/5`,U=`sticky top-0 z-10 bg-catppuccin-crust shadow-[inset_0_-1px_0_var(--border)] [&_th]:h-8 [&_th]:bg-catppuccin-crust [&_th]:font-semibold [&_th]:text-foreground [&_th]:uppercase [&_th]:tracking-wide [&_th]:text-[11px]`,W=`h-8 w-full min-w-0 rounded-none border-0 bg-transparent px-2 text-xs shadow-none ring-0 focus-visible:bg-primary/10 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary dark:bg-transparent`,G=`h-8 w-full min-w-0 rounded-none border-0 bg-transparent px-2 text-xs shadow-none focus-visible:bg-primary/10 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary data-[state=open]:bg-primary/10 dark:bg-transparent dark:hover:bg-transparent`;function ie({columns:e,onChange:t}){let{t:n}=a(),r=O().getDataTypes(),i=(0,I.useCallback)((n,r,i)=>{t(e.map(e=>e.id===n?{...e,[r]:i}:e))},[e,t]);function f(){t([...e,L()])}function p(){e.length>0&&t(e.slice(0,-1))}return(0,V.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,V.jsx)(E,{className:`flex-1`,children:(0,V.jsxs)(A,{className:H,children:[(0,V.jsx)(x,{className:U,children:(0,V.jsxs)(_,{children:[(0,V.jsx)(j,{className:`w-[120px]`,children:n(`table.schema.colField`)}),(0,V.jsx)(j,{className:`w-[120px]`,children:n(`table.schema.colType`)}),(0,V.jsx)(j,{className:`w-[60px]`,children:n(`table.schema.colLength`)}),(0,V.jsx)(j,{className:`w-[100px]`,children:n(`table.schema.colDefault`)}),(0,V.jsx)(j,{className:`w-[40px]`,children:n(`table.schema.colPk`)}),(0,V.jsx)(j,{className:`w-[60px]`,children:n(`table.schema.colNotNull`)}),(0,V.jsx)(j,{className:`w-[60px]`,children:n(`table.schema.colUnsigned`)}),(0,V.jsx)(j,{className:`w-[70px]`,children:n(`table.schema.colAutoIncrement`)}),(0,V.jsx)(j,{className:`w-[60px]`,children:n(`table.schema.colZerofill`)}),(0,V.jsx)(j,{children:n(`table.schema.colComment`)})]})}),(0,V.jsx)(M,{children:e.length===0?(0,V.jsx)(_,{children:(0,V.jsx)(w,{colSpan:10,className:`text-center text-muted-foreground`,children:n(`table.schema.empty`)})}):e.map(e=>(0,V.jsxs)(_,{children:[(0,V.jsx)(w,{children:(0,V.jsx)(D,{className:W,value:e.field,onChange:t=>i(e.id,`field`,t.target.value),placeholder:`column_name`})}),(0,V.jsx)(w,{children:(0,V.jsxs)(d,{value:e.type,onValueChange:t=>i(e.id,`type`,t),children:[(0,V.jsx)(c,{className:G,children:(0,V.jsx)(s,{})}),(0,V.jsx)(l,{children:r.map(e=>(0,V.jsx)(u,{value:e,children:e},e))})]})}),(0,V.jsx)(w,{children:(0,V.jsx)(D,{className:W,value:e.length,onChange:t=>i(e.id,`length`,t.target.value)})}),(0,V.jsx)(w,{children:(0,V.jsx)(D,{className:W,value:e.defaultValue,onChange:t=>i(e.id,`defaultValue`,t.target.value),placeholder:`NULL`})}),(0,V.jsx)(w,{className:`text-center`,children:(0,V.jsx)(`input`,{type:`checkbox`,checked:e.pk,onChange:t=>i(e.id,`pk`,t.target.checked)})}),(0,V.jsx)(w,{className:`text-center`,children:(0,V.jsx)(`input`,{type:`checkbox`,checked:e.notNull,onChange:t=>i(e.id,`notNull`,t.target.checked)})}),(0,V.jsx)(w,{className:`text-center`,children:(0,V.jsx)(`input`,{type:`checkbox`,checked:e.unsigned,onChange:t=>i(e.id,`unsigned`,t.target.checked)})}),(0,V.jsx)(w,{className:`text-center`,children:(0,V.jsx)(`input`,{type:`checkbox`,checked:e.autoIncrement,onChange:t=>i(e.id,`autoIncrement`,t.target.checked)})}),(0,V.jsx)(w,{className:`text-center`,children:(0,V.jsx)(`input`,{type:`checkbox`,checked:e.zerofill,onChange:t=>i(e.id,`zerofill`,t.target.checked)})}),(0,V.jsx)(w,{children:(0,V.jsx)(D,{className:W,value:e.comment,onChange:t=>i(e.id,`comment`,t.target.value)})})]},e.id))})]})}),(0,V.jsxs)(`div`,{className:`flex gap-2 p-2 border-t`,children:[(0,V.jsx)(o,{size:`sm`,variant:`outline`,onClick:f,children:n(`table.schema.add`)}),(0,V.jsx)(o,{size:`sm`,variant:`outline`,onClick:p,disabled:e.length===0,children:n(`table.schema.remove`)})]})]})}var K=[`PRIMARY`,`UNIQUE`,`INDEX`,`FULLTEXT`];function q({open:e,index:t,availableColumns:n,onSave:r,onClose:i}){let{t:f}=a(),[p,m]=(0,I.useState)(t.name),[h,g]=(0,I.useState)(t.type),[_,v]=(0,I.useState)(t.columns);function y(e){v(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function b(){r({id:t.id,name:h===`PRIMARY`?`PRIMARY`:p,type:h,columns:_})}return(0,V.jsx)(F,{open:e,onOpenChange:e=>{e||i()},children:(0,V.jsxs)(re,{className:`sm:max-w-[500px]`,children:[(0,V.jsx)(N,{children:(0,V.jsx)(P,{children:t.name?f(`table.index.editTitle`):f(`table.index.addTitle`)})}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`idx-name`,children:f(`table.index.name`)}),(0,V.jsx)(D,{id:`idx-name`,value:h===`PRIMARY`?`PRIMARY`:p,onChange:e=>m(e.target.value),disabled:h===`PRIMARY`,placeholder:f(`table.index.namePlaceholder`)})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`idx-type`,children:f(`table.index.type`)}),(0,V.jsxs)(d,{value:h,onValueChange:e=>g(e),children:[(0,V.jsx)(c,{id:`idx-type`,className:`w-full`,children:(0,V.jsx)(s,{})}),(0,V.jsx)(l,{children:K.map(e=>(0,V.jsx)(u,{value:e,children:e},e))})]})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{children:f(`table.index.columns`)}),(0,V.jsx)(`div`,{className:`border rounded-md p-2 max-h-[200px] overflow-y-auto space-y-1`,children:n.length===0?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f(`table.index.noColumns`)}):n.map(e=>(0,V.jsxs)(`label`,{className:`flex items-center gap-2 text-sm cursor-pointer hover:bg-muted/50 rounded px-1 py-0.5`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:_.includes(e.field),onChange:()=>y(e.field)}),(0,V.jsx)(`span`,{children:e.field||f(`table.index.unnamed`)}),(0,V.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.type,`)`]})]},e.id))})]})]}),(0,V.jsxs)(ne,{children:[(0,V.jsx)(o,{variant:`outline`,onClick:i,children:f(`table.index.cancel`)}),(0,V.jsx)(o,{onClick:b,disabled:_.length===0,children:f(`table.index.ok`)})]})]})})}function ae({indexes:e,availableColumns:t,onChange:n}){let{t:r}=a(),[i,s]=(0,I.useState)(null),[c,l]=(0,I.useState)(!1);function u(){let e=R();s(e),l(!0)}function d(e){s({...e}),l(!0)}function f(){e.length>0&&n(e.slice(0,-1))}function p(t){e.find(e=>e.id===t.id)?n(e.map(e=>e.id===t.id?t:e)):n([...e,t]),l(!1),s(null)}function m(){l(!1),s(null)}return(0,V.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,V.jsx)(E,{className:`flex-1`,children:(0,V.jsxs)(A,{className:H+` [&_td]:px-2`,children:[(0,V.jsx)(x,{className:U,children:(0,V.jsxs)(_,{children:[(0,V.jsx)(j,{className:`w-[150px]`,children:r(`table.indexes.colName`)}),(0,V.jsx)(j,{className:`w-[120px]`,children:r(`table.indexes.colType`)}),(0,V.jsx)(j,{children:r(`table.indexes.colColumns`)})]})}),(0,V.jsx)(M,{children:e.length===0?(0,V.jsx)(_,{children:(0,V.jsx)(w,{colSpan:3,className:`text-center text-muted-foreground`,children:r(`table.indexes.empty`)})}):e.map(e=>(0,V.jsxs)(_,{className:`cursor-pointer`,onDoubleClick:()=>d(e),children:[(0,V.jsx)(w,{children:e.name}),(0,V.jsx)(w,{children:e.type}),(0,V.jsx)(w,{children:e.columns.join(`, `)})]},e.id))})]})}),(0,V.jsxs)(`div`,{className:`flex gap-2 p-2 border-t`,children:[(0,V.jsx)(o,{size:`sm`,variant:`outline`,onClick:u,children:r(`table.indexes.add`)}),(0,V.jsx)(o,{size:`sm`,variant:`outline`,onClick:f,disabled:e.length===0,children:r(`table.indexes.remove`)})]}),i&&(0,V.jsx)(q,{open:c,index:i,availableColumns:t,onSave:p,onClose:m})]})}var J=[`InnoDB`,`MyISAM`,`MEMORY`,`CSV`,`ARCHIVE`,`BLACKHOLE`,`MRG_MYISAM`,`FEDERATED`,`PERFORMANCE_SCHEMA`],Y=[`utf8mb4`,`utf8`,`latin1`,`ascii`,`binary`,`cp1251`,`euckr`,`gb2312`,`gbk`,`sjis`,`ucs2`,`utf16`,`utf32`],X={utf8mb4:[`utf8mb4_general_ci`,`utf8mb4_unicode_ci`,`utf8mb4_bin`,`utf8mb4_0900_ai_ci`],utf8:[`utf8_general_ci`,`utf8_unicode_ci`,`utf8_bin`],latin1:[`latin1_swedish_ci`,`latin1_general_ci`,`latin1_bin`],ascii:[`ascii_general_ci`,`ascii_bin`],binary:[`binary`],cp1251:[`cp1251_general_ci`,`cp1251_bin`],euckr:[`euckr_korean_ci`,`euckr_bin`],gb2312:[`gb2312_chinese_ci`,`gb2312_bin`],gbk:[`gbk_chinese_ci`,`gbk_bin`],sjis:[`sjis_japanese_ci`,`sjis_bin`],ucs2:[`ucs2_general_ci`,`ucs2_unicode_ci`,`ucs2_bin`],utf16:[`utf16_general_ci`,`utf16_unicode_ci`,`utf16_bin`],utf32:[`utf32_general_ci`,`utf32_unicode_ci`,`utf32_bin`]};function oe({properties:e,onChange:t}){let{t:n}=a();function r(n,r){let i={...e,[n]:r};n===`charset`&&(i.collation=X[r]?.[0]??``),t(i)}let i=X[e.charset]??[];return(0,V.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`prop-engine`,children:n(`table.properties.engine`)}),(0,V.jsxs)(d,{value:e.engine,onValueChange:e=>r(`engine`,e),children:[(0,V.jsx)(c,{id:`prop-engine`,className:`w-full`,children:(0,V.jsx)(s,{})}),(0,V.jsx)(l,{children:J.map(e=>(0,V.jsx)(u,{value:e,children:e},e))})]})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`prop-charset`,children:n(`table.properties.charset`)}),(0,V.jsxs)(d,{value:e.charset,onValueChange:e=>r(`charset`,e),children:[(0,V.jsx)(c,{id:`prop-charset`,className:`w-full`,children:(0,V.jsx)(s,{})}),(0,V.jsx)(l,{children:Y.map(e=>(0,V.jsx)(u,{value:e,children:e},e))})]})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`prop-collation`,children:n(`table.properties.collation`)}),(0,V.jsxs)(d,{value:e.collation,onValueChange:e=>r(`collation`,e),children:[(0,V.jsx)(c,{id:`prop-collation`,className:`w-full`,children:(0,V.jsx)(s,{})}),(0,V.jsx)(l,{children:i.map(e=>(0,V.jsx)(u,{value:e,children:e},e))})]})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`prop-auto-incr`,children:n(`table.properties.autoIncrement`)}),(0,V.jsx)(D,{id:`prop-auto-incr`,type:`number`,value:e.autoIncrement,onChange:e=>r(`autoIncrement`,e.target.value),placeholder:n(`table.properties.autoIncrementPlaceholder`)})]})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)(T,{htmlFor:`prop-comment`,children:n(`table.properties.comment`)}),(0,V.jsx)(D,{id:`prop-comment`,value:e.comment,onChange:e=>r(`comment`,e.target.value)})]})]})}function se({connectionId:e,database:t,tableName:n,columns:r,indexes:i,properties:a}){let o=S(e=>e.themeId),s=k(e),c=o===`light`||o===`light-blue`||o===`solarized-light`?`vs`:`vs-dark`,l=(0,I.useMemo)(()=>s.ddl.createTable(B(t,n,r,i,a)),[s,t,n,r,i,a]);return(0,V.jsx)(`div`,{className:`h-[320px]`,children:(0,V.jsx)(C,{height:`100%`,language:`sql`,theme:c,value:l,options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineNumbers:`on`,wordWrap:`on`}})})}function Z(e){return JSON.stringify([e.type,e.length,e.defaultValue,e.pk,e.notNull,e.unsigned,e.autoIncrement,e.zerofill,e.comment])}function Q(e){return{name:e.field,type:e.length?`${e.type}(${e.length})`:e.type,nullable:!e.notNull,key:e.pk?`PRI`:``,defaultValue:e.defaultValue===``?null:e.defaultValue,extra:e.autoIncrement?`auto_increment`:``,comment:e.comment,collation:null}}function $(e){return{name:e.name,type:e.type,columns:[...e.columns]}}function ce(e,t){return e.name===t.name&&e.type===t.type&&e.columns.join(`,`)===t.columns.join(`,`)}function le({engine:e,database:t,table:n,before:r,after:i}){let{ddl:a}=e,o=[],s=[],c=[],l=new Map(r.columns.map(e=>[e.id,e])),u=new Map(i.columns.map(e=>[e.id,e])),d=new Map(r.indexes.map(e=>[e.id,e])),f=new Map(i.indexes.map(e=>[e.id,e])),p=[];for(let[e,r]of d){let i=f.get(e);i?ce(r,i)||(o.push(a.dropIndex(t,n,r.name)),p.push(i)):o.push(a.dropIndex(t,n,r.name))}for(let[e,r]of u){let i=l.get(e);if(!i){r.field.trim()&&o.push(a.addColumn(t,n,Q(r)));continue}if(i.field!==r.field&&o.push(a.renameColumn(t,n,i.field,r.field)),Z(i)!==Z(r)){let e=a.alterColumn(t,n,Q(r));e?o.push(e):c.push(r.field)}}for(let[e,r]of l)if(!u.has(e)){let e=a.dropColumn(t,n,r.field);o.push(e),s.push(e)}for(let e of p)o.push(a.createIndex(t,n,$(e)));for(let[e,r]of f)!d.has(e)&&r.columns.length>0&&o.push(a.createIndex(t,n,$(r)));return{statements:o,destructive:s,unsupported:c}}function ue(){let{t:e}=a(),{activeDialog:t,closeDialog:i}=n(),s=r(`create-table`,`alter-table`,`duplicate-table-structure`),c=t===`create-table`||t===`alter-table`||t===`duplicate-table-structure`,l=t===`alter-table`,u=t===`duplicate-table-structure`,d=s?.nodeText??``,_=s?.metadata?.database??``,[x,S]=(0,I.useState)(``),[C,w]=(0,I.useState)([L()]),[E,O]=(0,I.useState)([]),[A,j]=(0,I.useState)(z()),[M,R]=(0,I.useState)(!1),[H,U]=(0,I.useState)(!1),[W,G]=(0,I.useState)(null),[K,q]=(0,I.useState)(null),J=s?.connectionId??f.getState().activeConnectionId,Y=k(J);(0,I.useEffect)(()=>{c&&(G(null),q(null),l||u?(S(u?`${d}_copy`:d),X()):(S(``),w([L()]),O([]),j(z())))},[c,t]);async function X(){let e=f.getState(),t=s?.connectionId??e.activeConnectionId,n=e.activeConnections.find(e=>e.id===t)?.serverConnectionId;if(!n||!_||!d)return;R(!0);let{introspect:r,capabilities:i}=m(t),a=p(n);try{let e=await r.listColumns(a,_,d),t=[];if(e.length>0){let n=e.map(e=>{let t=e.type,n=t.match(/^(\w+)(?:\(([^)]+)\))?/);return{id:crypto.randomUUID(),field:e.name,type:n?.[1]?.toLowerCase()??t.toLowerCase(),length:n?.[2]??``,defaultValue:e.defaultValue??``,pk:e.key===`PRI`,notNull:!e.nullable,unsigned:t.includes(`unsigned`),autoIncrement:e.extra.includes(`auto_increment`),zerofill:t.includes(`zerofill`),comment:e.comment}});w(n),t=n}let n=await r.listIndexes(a,_,d),o=[];if(n.length>0&&(o=n.map(e=>({id:crypto.randomUUID(),name:e.name,type:e.type===`SPATIAL`?`INDEX`:e.type,columns:[...e.columns]})),O(o)),q({columns:t,indexes:o}),i.tableProperties){let e=await r.getTableInfo(a,_,d);e&&j({engine:e.engine??`InnoDB`,charset:(e.collation??`utf8mb4`).replace(/_.*/,``),collation:e.collation??`utf8mb4_unicode_ci`,autoIncrement:e.autoIncrement??``,comment:e.comment})}}catch(e){console.error(`Failed to load table schema:`,e),G(e instanceof Error?e.message:String(e))}finally{R(!1)}}function Z(e){e||i()}async function Q(){let t=s?.connectionId??f.getState().activeConnectionId;if(!t||!x.trim())return;let n=m(t);G(null);let r,a=[];if(l){if(!K)return;let t=le({engine:n,database:_,table:d,before:K,after:{columns:C,indexes:E}});if(t.unsupported.length>0){G(e(`table.dialog.cannotAlterColumns`,{engine:n.label,columns:t.unsupported.join(`, `)}));return}if(t.statements.length===0){i();return}r=t.statements.join(`
|
|
2
2
|
`),a=t.destructive}else{let e=u?E.map(e=>({...e,name:te(e.name,d,x.trim())})):E;r=n.ddl.createTable(B(_,x.trim(),C,e,A))}U(!0);try{await h(t,r,{skipDestructiveConfirm:a.length===0}),await g(t,_),i()}catch(e){G(e instanceof Error?e.message:String(e))}finally{U(!1)}}let $=e(l?`table.dialog.alterTitle`:u?`table.dialog.duplicateTitle`:`table.dialog.createTitle`),ce=e(l?`table.dialog.alter`:`table.dialog.create`);return(0,V.jsx)(F,{open:c,onOpenChange:Z,children:(0,V.jsxs)(re,{className:`sm:max-w-[1000px] max-h-[80vh] flex flex-col`,children:[(0,V.jsx)(N,{children:(0,V.jsx)(P,{children:$})}),(0,V.jsxs)(`div`,{className:`space-y-3 flex-1 overflow-hidden flex flex-col min-h-0`,children:[(0,V.jsxs)(`div`,{className:`space-y-1.5 px-1`,children:[(0,V.jsx)(T,{htmlFor:`table-name`,children:e(`table.dialog.tableName`)}),(0,V.jsx)(D,{id:`table-name`,value:x,onChange:e=>S(e.target.value),placeholder:e(`table.dialog.tableNamePlaceholder`),disabled:l})]}),M?(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-muted-foreground text-sm`,children:e(`table.dialog.loading`)}):(0,V.jsxs)(ee,{defaultValue:`schema`,className:`flex-1 min-h-0 flex flex-col`,children:[(0,V.jsxs)(v,{children:[(0,V.jsx)(b,{value:`schema`,children:e(`table.dialog.tabSchema`)}),(0,V.jsx)(b,{value:`indexes`,children:e(`table.dialog.tabIndexes`)}),Y.capabilities.tableProperties&&(0,V.jsx)(b,{value:`properties`,children:e(`table.dialog.tabProperties`)}),(0,V.jsx)(b,{value:`sql`,children:`SQL`})]}),(0,V.jsx)(y,{value:`schema`,className:`flex-1 min-h-0 overflow-auto border rounded-md`,children:(0,V.jsx)(ie,{columns:C,onChange:w})}),(0,V.jsx)(y,{value:`indexes`,className:`flex-1 min-h-0 overflow-auto border rounded-md`,children:(0,V.jsx)(ae,{indexes:E,availableColumns:C,onChange:O})}),(0,V.jsx)(y,{value:`properties`,className:`flex-1 min-h-0 overflow-auto border rounded-md`,children:(0,V.jsx)(oe,{properties:A,onChange:j})}),(0,V.jsx)(y,{value:`sql`,className:`flex-1 min-h-0 border rounded-md`,children:(0,V.jsx)(se,{connectionId:J,database:_,tableName:x,columns:C,indexes:E,properties:A})})]})]}),W&&(0,V.jsx)(`p`,{className:`px-1 text-xs text-destructive leading-relaxed`,children:W}),(0,V.jsxs)(ne,{children:[(0,V.jsx)(o,{variant:`outline`,onClick:()=>Z(!1),children:e(`table.dialog.cancel`)}),(0,V.jsx)(o,{onClick:()=>void Q(),disabled:M||H||!x.trim(),children:H?e(`table.dialog.applying`):ce})]})]})})}export{ue as EditSchemaDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import"./BBSxV90W.js";import{G as i}from"./2sxOfzyn.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./DxuXBECK.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=t();function _(e){return e.replace(/\{([a-z]+)\}/g,(e,t)=>t in i?i[t]:e).replace(/<a href="/g,`<a target="_blank" rel="noreferrer" href="`)}function v(){let t=e(e=>e.activeDialog),d=e(e=>e.closeDialog),{t:p}=n();return(0,g.jsx)(u,{open:t===`terms`,onOpenChange:e=>{e||d()},children:(0,g.jsxs)(s,{className:`flex max-h-[85vh] flex-col sm:max-w-[640px]`,children:[(0,g.jsxs)(a,{children:[(0,g.jsx)(c,{children:p(`terms.title`)}),(0,g.jsxs)(l,{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)(o,{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:i.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.online`)}),(0,g.jsx)(`a`,{href:i.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.privacyLink`)}),(0,g.jsx)(`a`,{href:i.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.refundLink`)})]}),(0,g.jsx)(r,{onClick:d,children:p(`settings.done`)})]})]})})}export{v as TermsDialog};
|
|
1
|
+
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import"./BBSxV90W.js";import{G as i}from"./D7Ze5md9.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./DxuXBECK.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=t();function _(e){return e.replace(/\{([a-z]+)\}/g,(e,t)=>t in i?i[t]:e).replace(/<a href="/g,`<a target="_blank" rel="noreferrer" href="`)}function v(){let t=e(e=>e.activeDialog),d=e(e=>e.closeDialog),{t:p}=n();return(0,g.jsx)(u,{open:t===`terms`,onOpenChange:e=>{e||d()},children:(0,g.jsxs)(s,{className:`flex max-h-[85vh] flex-col sm:max-w-[640px]`,children:[(0,g.jsxs)(a,{children:[(0,g.jsx)(c,{children:p(`terms.title`)}),(0,g.jsxs)(l,{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)(o,{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:i.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.online`)}),(0,g.jsx)(`a`,{href:i.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.privacyLink`)}),(0,g.jsx)(`a`,{href:i.refund,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:p(`terms.refundLink`)})]}),(0,g.jsx)(r,{onClick:d,children:p(`settings.done`)})]})]})})}export{v as TermsDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{G as i,t as a}from"./
|
|
1
|
+
import{n as e}from"./XzPc-eVf.js";import{l as t,m as n,t as r}from"./CKOS5Y-e.js";import{G as i,t as a}from"./D7Ze5md9.js";import{a as o,i as s,n as c,o as l,r as u,t as d}from"./DxuXBECK.js";var f=t(),p=`https://planche.dev`,m=`/third-party-notices.txt`;function h(){let t=e(e=>e.activeDialog),h=e(e=>e.closeDialog),{t:g}=n();return(0,f.jsx)(d,{open:t===`about`,onOpenChange:e=>{e||h()},children:(0,f.jsxs)(c,{className:`sm:max-w-[440px]`,children:[(0,f.jsx)(o,{children:(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(a,{size:44,className:`shrink-0`}),(0,f.jsxs)(`div`,{className:`grid gap-1`,children:[(0,f.jsx)(l,{children:g(`about.title`)}),(0,f.jsx)(u,{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:i.terms,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.terms`)}),(0,f.jsx)(`a`,{href:i.privacy,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2`,children:g(`about.privacy`)}),(0,f.jsx)(`a`,{href:i.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)(s,{children:(0,f.jsx)(r,{onClick:h,children:g(`settings.done`)})})]})})}export{h as AboutDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o,i as s,n as c,r as l,t as u}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o,i as s,n as c,r as l,t as u}from"./D_2UqK4k.js";import{t as d}from"./DTxGpkJp.js";import{c as f,l as p}from"./D7Ze5md9.js";import{a as m,i as h,n as g,o as _,t as v}from"./DxuXBECK.js";import{n as y}from"./rcI4Fmt0.js";var b=e(t(),1),x=r();function S(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:S}=n(),C=d(e=>e.activeConnectionId)??``,w=y(e=>e.addUser),[T,E]=(0,b.useState)(``),[D,O]=(0,b.useState)(`%`),[k,A]=(0,b.useState)(``),[j,M]=(0,b.useState)(``),[N,P]=(0,b.useState)(`caching_sha2_password`),F=t===`user-add`;function I(e){e||(L(),r())}function L(){E(``),O(`%`),A(``),M(``),P(`caching_sha2_password`)}function R(){if(!T.trim()){S(e(`user.add.usernameRequired`));return}if(k!==j){S(e(`user.add.passwordMismatch`));return}w(C,{user:T.trim(),host:D.trim()||`%`,privileges:[],maxQuestions:0,maxUpdates:0,maxConnections:0,maxUserConnections:0,plugin:N,authenticationString:``,passwordExpired:!1,accountLocked:!1}),S(e(`user.add.added`,{user:T,host:D})),L(),r()}return(0,x.jsx)(v,{open:F,onOpenChange:I,children:(0,x.jsxs)(g,{className:`sm:max-w-[450px]`,children:[(0,x.jsx)(m,{children:(0,x.jsx)(_,{children:e(`user.add.title`)})}),(0,x.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-username`,children:e(`user.add.username`)}),(0,x.jsx)(p,{id:`user-add-username`,value:T,onChange:e=>E(e.target.value),placeholder:e(`user.add.usernamePlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-host`,children:e(`user.add.host`)}),(0,x.jsx)(p,{id:`user-add-host`,value:D,onChange:e=>O(e.target.value),placeholder:`%`})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-password`,children:e(`user.add.password`)}),(0,x.jsx)(p,{id:`user-add-password`,type:`password`,value:k,onChange:e=>A(e.target.value),placeholder:e(`user.add.passwordPlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{htmlFor:`user-add-confirm-password`,children:e(`user.add.confirmPassword`)}),(0,x.jsx)(p,{id:`user-add-confirm-password`,type:`password`,value:j,onChange:e=>M(e.target.value),placeholder:e(`user.add.confirmPasswordPlaceholder`)})]}),(0,x.jsxs)(`div`,{className:`space-y-2`,children:[(0,x.jsx)(f,{children:e(`user.add.plugin`)}),(0,x.jsxs)(u,{value:N,onValueChange:P,children:[(0,x.jsx)(s,{className:`w-full`,children:(0,x.jsx)(o,{})}),(0,x.jsxs)(c,{children:[(0,x.jsx)(l,{value:`mysql_native_password`,children:`mysql_native_password`}),(0,x.jsx)(l,{value:`caching_sha2_password`,children:`caching_sha2_password`})]})]})]})]}),(0,x.jsxs)(h,{children:[(0,x.jsx)(a,{variant:`outline`,onClick:()=>I(!1),children:e(`user.add.cancel`)}),(0,x.jsx)(a,{onClick:R,children:e(`user.add.add`)})]})]})})}export{S as UserAddDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{c as t,h as n,i as r,n as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{i as c,t as l}from"./DTxGpkJp.js";import{n as u}from"./BBSxV90W.js";import{n as d,t as f}from"./CChaTOPr.js";import{X as p,Zt as m,at as h,bt as g,ct as _,l as v,mt as y}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{c as t,h as n,i as r,n as i}from"./XzPc-eVf.js";import{l as a,m as o,t as s}from"./CKOS5Y-e.js";import{i as c,t as l}from"./DTxGpkJp.js";import{n as u}from"./BBSxV90W.js";import{n as d,t as f}from"./CChaTOPr.js";import{X as p,Zt as m,at as h,bt as g,ct as _,l as v,mt as y}from"./D7Ze5md9.js";import{a as b,i as x,n as ee,o as S,r as C,t as w}from"./DxuXBECK.js";var T=e(n(),1),E=a(),D={execute:`command.localHistory.reason.execute`,edit:`command.localHistory.reason.edit`,replaced:`command.localHistory.reason.replaced`,restore:`command.localHistory.reason.restore`,close:`command.localHistory.reason.close`},O=Object.freeze([]);function k(e){let t=(Date.now()-e)/36e5;return t<1?`<1h`:t<24?`1-24h`:t<168?`1-7d`:`7d+`}function A(){let{t:e}=o(),n=i(e=>e.activeDialog),a=i(e=>e.closeDialog),A=i(e=>e.setFooterMessage),j=l(e=>e.activeConnectionId),M=d(e=>j?e.activeTabId[j]:null),N=d(e=>j?e.tabs[j]??f:f),P=c(e=>j?e.revisions[j]??O:O),F=u(e=>e.persistQueryHistory),I=p(e=>e.themeId),L=I===`light`||I===`light-blue`||I===`solarized-light`?`vs`:`vs-dark`,[R,z]=(0,T.useState)(!0),[B,V]=(0,T.useState)(``),[H,U]=(0,T.useState)(null),[W,G]=(0,T.useState)(`current`),K=N.find(e=>e.id===M),q=n===`local-history`;(0,T.useEffect)(()=>{if(!q)return;let e=M?P.filter(e=>e.docId===M).length:0;t(`local_history_open`,{revisions:r(P.length),tab_revisions:r(e)})},[q]);let J=(0,T.useMemo)(()=>{let e=B.trim().toLowerCase();return P.filter(t=>R&&M&&t.docId!==M?!1:!e||t.text.toLowerCase().includes(e)||t.title.toLowerCase().includes(e))},[P,B,R,M]),Y=K?.query??``,X=J.find(e=>e.id===H)??J.find(e=>e.text!==Y)??J[0],Z=(0,T.useMemo)(()=>{if(!X)return;let e=P.filter(e=>e.docId===X.docId);return e[e.findIndex(e=>e.id===X.id)+1]},[P,X]),Q=W===`current`?Y:Z?.text??``;function $(e,n){t(`local_history_recover`,{action:e,reason:n.reason,age:k(n.timestamp),same_tab:n.docId===M,compare:W})}function te(){if(!j||!M||!X)return;$(`restore`,X);let t=d.getState();t.captureRevision(j,M,`restore`),t.setEditorContent(j,M,X.text),A(e(`command.localHistory.restored`)),a()}function ne(){!j||!X||($(`new_tab`,X),h(j,X.text,X.database,X.title),A(e(`command.localHistory.openedInTab`)),a())}function re(e){j&&(c.getState().removeRevision(j,e.id),H===e.id&&U(null))}function ie(){j&&(c.getState().clearRevisions(j),U(null))}return(0,E.jsx)(w,{open:q,onOpenChange:e=>{e||a()},children:(0,E.jsxs)(ee,{className:`flex max-h-[85vh] flex-col sm:max-w-[1000px]`,children:[(0,E.jsxs)(b,{children:[(0,E.jsx)(S,{children:e(`command.localHistory.title`)}),(0,E.jsx)(C,{children:e(`command.localHistory.description`)})]}),!F&&(0,E.jsx)(`p`,{className:`rounded-md border border-dashed px-3 py-2 text-xs text-muted-foreground`,children:e(`command.localHistory.notPersisted`)}),(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsxs)(`div`,{className:`relative min-w-[200px] flex-1`,children:[(0,E.jsx)(g,{className:`absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,E.jsx)(v,{value:B,onChange:e=>V(e.target.value),placeholder:e(`command.localHistory.searchPlaceholder`),className:`h-8 pl-7 text-xs`})]}),(0,E.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:()=>z(!0),className:`px-2 py-1 text-xs ${R?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.scopeTab`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>z(!1),className:`border-l px-2 py-1 text-xs ${R?`hover:bg-accent/50`:`bg-accent`}`,children:e(`command.localHistory.scopeAll`)})]}),(0,E.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border`,children:[(0,E.jsx)(`button`,{type:`button`,onClick:()=>G(`current`),className:`px-2 py-1 text-xs ${W===`current`?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.compareCurrent`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>G(`previous`),className:`border-l px-2 py-1 text-xs ${W===`previous`?`bg-accent`:`hover:bg-accent/50`}`,children:e(`command.localHistory.comparePrevious`)})]})]}),J.length===0?(0,E.jsx)(`div`,{className:`py-10 text-center text-sm text-muted-foreground`,children:P.length===0?e(`command.localHistory.empty`):e(`command.localHistory.noMatch`)}):(0,E.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[260px_1fr] gap-3`,children:[(0,E.jsx)(_,{className:`h-[440px] rounded-md border`,children:(0,E.jsx)(`ul`,{className:`divide-y`,children:J.map(t=>(0,E.jsxs)(`li`,{className:`group relative`,children:[(0,E.jsxs)(`button`,{type:`button`,onClick:()=>U(t.id),className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 pr-8 text-left text-xs hover:bg-accent ${t.id===X?.id?`bg-accent`:``}`,children:[(0,E.jsx)(`span`,{className:`font-medium`,children:new Date(t.timestamp).toLocaleString()}),(0,E.jsxs)(`span`,{className:`w-full truncate text-muted-foreground`,children:[t.title,` · `,e(D[t.reason]),` · `,e(`command.localHistory.chars`,{count:t.text.length})]})]}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>re(t),title:e(`command.localHistory.delete`),className:`absolute right-1.5 top-1.5 rounded p-1 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100`,children:(0,E.jsx)(y,{className:`h-3.5 w-3.5`})})]},t.id))})}),(0,E.jsxs)(`div`,{className:`flex h-[440px] flex-col overflow-hidden rounded-md border`,children:[(0,E.jsx)(`div`,{className:`border-b bg-muted/40 px-3 py-1.5 text-xs text-muted-foreground`,children:W===`current`?e(`command.localHistory.diffAgainstCurrent`):Z?e(`command.localHistory.diffAgainstPrevious`,{time:new Date(Z.timestamp).toLocaleString()}):e(`command.localHistory.noPrevious`)}),(0,E.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,E.jsx)(m,{language:`sql`,theme:L,original:X?.text??``,modified:Q,options:{readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,renderOverviewRuler:!1}})})]})]}),(0,E.jsxs)(x,{className:`sm:justify-between`,children:[(0,E.jsx)(s,{variant:`ghost`,onClick:ie,disabled:P.length===0,children:e(`command.localHistory.clearAll`)}),(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(s,{variant:`outline`,onClick:a,children:e(`command.close`)}),(0,E.jsx)(s,{variant:`outline`,onClick:ne,disabled:!X,children:e(`command.localHistory.openInNewTab`)}),(0,E.jsx)(s,{onClick:te,disabled:!X||!K,children:e(`command.localHistory.restore`)})]})]})]})})}export{A as LocalHistoryDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e,m as t}from"./CKOS5Y-e.js";import{t as n}from"./neLPq0_M.js";import{Lt as r}from"./
|
|
1
|
+
import{l as e,m as t}from"./CKOS5Y-e.js";import{t as n}from"./neLPq0_M.js";import{Lt as r}from"./D7Ze5md9.js";var i={currency:`USD`,annualPerMonth:8,annualTotal:96,monthly:10},a=e=>`$${e}`,o=e(),s=`https://planche.dev/pricing/`;function c({highlight:e,innerRef:c}){let{t:l}=t(),u=e?[e,...n.filter(t=>t!==e)]:[...n];return(0,o.jsxs)(`div`,{className:`grid gap-3 rounded-xl border border-primary/50 bg-muted/20 p-4 shadow-[inset_0_0_0_1px_hsl(var(--primary)/0.15)]`,children:[(0,o.jsx)(`p`,{className:`text-[0.7rem] font-semibold uppercase tracking-[0.09em] text-muted-foreground`,children:`Pro`}),(0,o.jsxs)(`div`,{className:`grid gap-1`,children:[(0,o.jsxs)(`p`,{className:`flex items-baseline gap-1.5`,children:[(0,o.jsx)(`span`,{className:`text-3xl font-semibold leading-none text-foreground`,children:a(i.annualPerMonth)}),(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l(`pro.perMonth`)})]}),(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l(`pro.priceNote`,{annual:a(i.annualTotal),monthly:a(i.monthly)})})]}),(0,o.jsx)(`ul`,{className:`grid gap-2 text-xs`,children:u.map(t=>(0,o.jsxs)(`li`,{className:`flex gap-2`,children:[(0,o.jsx)(r,{className:`mt-0.5 size-3 shrink-0 ${t===e?`text-primary`:`text-emerald-500/80`}`}),(0,o.jsxs)(`span`,{className:`grid gap-0.5`,children:[(0,o.jsx)(`span`,{className:t===e?`font-medium text-foreground`:`text-foreground/90`,children:l(`pro.features.${t}`)}),(0,o.jsx)(`span`,{className:`text-muted-foreground`,children:l(`pro.featureDetails.${t}`)})]})]},t))}),(0,o.jsx)(`a`,{ref:c,href:s,target:`_blank`,rel:`noreferrer`,className:`rounded-md bg-primary px-4 py-2 text-center text-sm font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:l(`pro.pricing`)})]})}export{c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o}from"./ClyAuDY9.js";import{t as s}from"./DTxGpkJp.js";import{c}from"./Cw_LYT6k.js";import{t as l}from"./DbRMSZEW.js";import{C as u,S as d,b as f,ct as p,l as m,v as h,x as g,y as _}from"./
|
|
1
|
+
import{r as e}from"./hePW80VL.js";import{h as t,n}from"./XzPc-eVf.js";import{l as r,m as i,t as a}from"./CKOS5Y-e.js";import{a as o}from"./ClyAuDY9.js";import{t as s}from"./DTxGpkJp.js";import{c}from"./Cw_LYT6k.js";import{t as l}from"./DbRMSZEW.js";import{C as u,S as d,b as f,ct as p,l as m,v as h,x as g,y as _}from"./D7Ze5md9.js";import{a as v,i as y,n as b,o as x,t as S}from"./DxuXBECK.js";var C=e(t(),1),w=r();function T(){let e=s.getState();return e.activeConnections.find(t=>t.id===e.activeConnectionId)?.serverConnectionId??null}async function E(e){let t=T();if(!t)throw Error(o.t(`command.noActiveConnection`));let n=l().getQuery(e===`global`?`SHOW_GLOBAL_STATUS`:`SHOW_SESSION_STATUS`);return(await c(t,n)).records.map(e=>({Variable_name:e[0],Value:e[1]}))}function D(){let{t:e}=i(),{activeDialog:t,closeDialog:r,setFooterMessage:o}=n(),[s,c]=(0,C.useState)([]),[l,T]=(0,C.useState)(``),[D,O]=(0,C.useState)(`session`),k=t===`status`,A=(0,C.useCallback)(t=>E(t).then(c).catch(t=>o(e(`command.status.loadError`,{message:t instanceof Error?t.message:String(t)}))),[o,e]);(0,C.useEffect)(()=>{k&&A(D)},[k,D,A]);let j=(0,C.useMemo)(()=>{if(!l.trim())return s;let e=l.toLowerCase();return s.filter(t=>t.Variable_name.toLowerCase().includes(e)||t.Value.toLowerCase().includes(e))},[s,l]);function M(e){e||(T(``),r())}function N(e){O(e)}return(0,w.jsx)(S,{open:k,onOpenChange:M,children:(0,w.jsxs)(b,{className:`sm:max-w-[900px] max-h-[80vh] flex flex-col`,children:[(0,w.jsx)(v,{children:(0,w.jsx)(x,{children:e(`command.status.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)(a,{variant:D===`session`?`default`:`outline`,size:`sm`,onClick:()=>N(`session`),children:e(`command.scope.session`)}),(0,w.jsx)(a,{variant:D===`global`?`default`:`outline`,size:`sm`,onClick:()=>N(`global`),children:e(`command.scope.global`)})]}),(0,w.jsx)(m,{placeholder:e(`command.status.filterPlaceholder`),value:l,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)(p,{className:`h-[400px]`,children:(0,w.jsxs)(h,{children:[(0,w.jsx)(d,{children:(0,w.jsxs)(u,{children:[(0,w.jsx)(g,{className:`w-[300px]`,children:e(`command.variableName`)}),(0,w.jsx)(g,{children:e(`command.value`)})]})}),(0,w.jsx)(_,{children:j.length===0?(0,w.jsx)(u,{children:(0,w.jsx)(f,{colSpan:2,className:`text-center text-muted-foreground`,children:e(`command.status.empty`)})}):j.map(e=>(0,w.jsxs)(u,{children:[(0,w.jsx)(f,{className:`font-mono text-xs`,children:e.Variable_name}),(0,w.jsx)(f,{className:`font-mono text-xs`,children:e.Value})]},e.Variable_name))})]})})}),(0,w.jsx)(y,{children:(0,w.jsx)(a,{variant:`outline`,onClick:()=>M(!1),children:e(`command.close`)})})]})})}export{D as StatusDialog};
|