@nice2dev/ui 1.0.8 → 1.0.11
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/dist/NiceErrorBoundary-B5nF-OVn.cjs +1 -0
- package/dist/NiceErrorBoundary-BZEHCXNM.cjs +1 -0
- package/dist/NiceErrorBoundary-D6jw6wwD.js +762 -0
- package/dist/NiceErrorBoundary-D75yr_WE.js +762 -0
- package/dist/NiceForm-BgR-m8T9.cjs +382 -0
- package/dist/NiceForm-CKoJA6NG.js +5131 -0
- package/dist/NiceForm-D7xnpnRJ.cjs +382 -0
- package/dist/NiceForm-DYKciCeR.js +5131 -0
- package/dist/NiceForm.css +1 -0
- package/dist/NiceModal-1QX7NhyH.js +95 -0
- package/dist/NiceModal-Br3J9jOV.cjs +1 -0
- package/dist/NiceModal-CAwsKVQ2.cjs +1 -0
- package/dist/NiceModal-DVAsBzHP.js +95 -0
- package/dist/NiceModuleLifecyclePanel-C9xMSjOF.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-CMrPbSw9.js +5249 -0
- package/dist/NiceModuleLifecyclePanel-D3azLDdj.js +5249 -0
- package/dist/NiceModuleLifecyclePanel-DEfAIhFf.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -0
- package/dist/NicePagination-CbB5P1N_.js +171 -0
- package/dist/NicePagination-DbE-uOkl.js +171 -0
- package/dist/NicePagination-DlealakT.cjs +1 -0
- package/dist/NicePagination-UGjzvRUS.cjs +1 -0
- package/dist/NicePinCodeInput-B8cI8zu8.js +11830 -0
- package/dist/NicePinCodeInput-BmRO9HSQ.js +11830 -0
- package/dist/NicePinCodeInput-D91uvVsF.cjs +419 -0
- package/dist/NicePinCodeInput-SGQaHvpE.cjs +419 -0
- package/dist/NicePinCodeInput.css +1 -1
- package/dist/NiceSavedQueryPanel-7nZe46t8.cjs +596 -0
- package/dist/NiceSavedQueryPanel-BSGzs7Oc.js +6449 -0
- package/dist/NiceSavedQueryPanel-CZ5bYOe_.js +6449 -0
- package/dist/NiceSavedQueryPanel-Ce2s060j.cjs +596 -0
- package/dist/NiceTabs-BeaxZzAO.js +1636 -0
- package/dist/NiceTabs-DcbYFIWR.cjs +1 -0
- package/dist/NiceTabs-DvOmxKyQ.cjs +1 -0
- package/dist/NiceTabs-DzLHzwuA.js +1636 -0
- package/dist/NiceWindow-Bga9fOkg.js +1409 -0
- package/dist/NiceWindow-CVgkxcCz.cjs +1 -0
- package/dist/NiceWindow-CxWTj5xH.cjs +1 -0
- package/dist/NiceWindow-DeC83yfE.js +1409 -0
- package/dist/charts-BAS21jkC.js +4621 -0
- package/dist/charts-BcvKWYUl.cjs +759 -0
- package/dist/charts-DShUbWrP.cjs +759 -0
- package/dist/charts-DZvmvfhM.js +4621 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.d.ts +42 -45
- package/dist/charts.mjs +1 -1
- package/dist/core-B4b1BmHt.js +22177 -0
- package/dist/core-C2ZmWe_u.cjs +96 -0
- package/dist/core-CjmLbclt.cjs +96 -0
- package/dist/core-Da43q-pO.js +22094 -0
- package/dist/data-branching-CJlrg8qf.cjs +1 -0
- package/dist/data-branching-DCUwI53s.js +6121 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.d.ts +1 -38
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +206 -192
- package/dist/data.mjs +1 -1
- package/dist/devops-CXynFG3X.cjs +17 -0
- package/dist/devops-D0TfzV5B.js +7660 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.d.ts +1 -38
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +311 -393
- package/dist/editors.mjs +61 -64
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +3 -44
- package/dist/feedback.mjs +11 -10
- package/dist/index-B8wxZ8Ps.cjs +5192 -0
- package/dist/index-DlHlXz8e.js +57319 -0
- package/dist/index-Dx726U90.cjs +5192 -0
- package/dist/index-pAuGTbuB.js +57319 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2249 -11141
- package/dist/index.mjs +880 -1018
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +7 -39
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +151 -216
- package/dist/navigation.mjs +52 -46
- package/dist/no-code-B5bzduNP.cjs +332 -0
- package/dist/no-code-D8RJ7lx0.js +7064 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.d.ts +1 -38
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +13 -45
- package/dist/overlays.mjs +243 -233
- package/package.json +5 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),a=require("react");function ce(p=new Date){const T=new Date().getTime()-p.getTime(),v=Math.floor(T/1e3),B=Math.floor(v/60),I=Math.floor(B/60),q=Math.floor(I/24);let L;return v<60?L="just now":B<60?L=`${B} minute${B>1?"s":""} ago`:I<24?L=`${I} hour${I>1?"s":""} ago`:q<30?L=`${q} day${q>1?"s":""} ago`:L=p.toLocaleDateString(),{date:p,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,relative:L}}function pe(p){return p.substring(0,7)}function xe(p){const f=p||crypto.randomUUID();return{id:f,shortId:pe(f)}}const Y=["development","testing","uat","staging","production"],R={development:"#22c55e",testing:"#3b82f6",uat:"#f59e0b",staging:"#8b5cf6",production:"#ef4444"},F={development:"🛠️",testing:"🧪",uat:"👥",staging:"🚀",production:"🏭"};function Z(p){return Y.indexOf(p)}function ne(p,f){return Z(p)<Z(f)}const ue=[{name:"customers",displayName:"Customers",recordCount:15420,sizeBytes:256e5,module:"CRM"},{name:"products",displayName:"Products",recordCount:3200,sizeBytes:85e5,module:"Inventory"},{name:"orders",displayName:"Orders",recordCount:48500,sizeBytes:125e6,module:"Sales"},{name:"order_items",displayName:"Order Items",recordCount:156e3,sizeBytes:45e6,module:"Sales",hasForeignKeys:!0},{name:"invoices",displayName:"Invoices",recordCount:42e3,sizeBytes:85e6,module:"Finance"},{name:"employees",displayName:"Employees",recordCount:450,sizeBytes:25e5,module:"HR"},{name:"config",displayName:"Configuration",recordCount:1200,sizeBytes:5e5,module:"System"}],ge=[{id:"prod-1",shortId:"prod-1",name:"production",displayName:"Production",description:"Live production environment",isDefault:!0,isProtected:!0,createdBy:{id:"system",name:"System"},createdAt:{date:new Date("2024-01-01"),relative:"1 year ago"},lastActivity:{date:new Date,relative:"just now"},status:"active",type:"data",environment:"production",tenant:"tenant-1",size:{records:265770,bytes:2921e5}},{id:"uat-1",shortId:"uat-1",name:"uat",displayName:"UAT",description:"User Acceptance Testing",isDefault:!1,isProtected:!0,createdBy:{id:"admin",name:"Admin"},createdAt:{date:new Date("2025-01-15"),relative:"3 months ago"},lastActivity:{date:new Date,relative:"2 days ago"},upstream:"prod-1",status:"active",type:"data",environment:"uat",tenant:"tenant-1",sourceSnapshot:"snapshot-prod-20250115",size:{records:265e3,bytes:29e7}},{id:"dev-1",shortId:"dev-1",name:"development",displayName:"Development",description:"Development environment",isDefault:!1,isProtected:!1,createdBy:{id:"dev-1",name:"Developer"},createdAt:{date:new Date("2025-03-01"),relative:"1 month ago"},lastActivity:{date:new Date,relative:"1 hour ago"},upstream:"uat-1",status:"active",type:"data",environment:"development",tenant:"tenant-1",tables:["customers","products","orders"],size:{records:67120,bytes:1591e5}}],oe=({tenant:p,branches:f,currentUser:T={id:"user-1",name:"Current User"},availableTables:v=ue,readOnly:B=!1,onCreateBranch:I,onDeleteBranch:q,onSwitchBranch:L,onCloneBranch:H,onSyncBranch:W,onProtectBranch:$,onScheduleSync:g,className:N,style:D,"data-testid":O})=>{const[b,S]=a.useState(f??ge),[k,C]=a.useState(null),[_,j]=a.useState(null),[M,V]=a.useState("development"),[c,m]=a.useState(""),[x,E]=a.useState([]),[w,i]=a.useState(!0),[z,U]=a.useState({requireApproval:!0,approversCount:1,requireBackup:!0,allowDirectChanges:!1}),[u,n]=a.useState({enabled:!1,frequency:"daily",direction:"pull"}),t=a.useMemo(()=>b.find(d=>d.id===k),[b,k]),r=a.useMemo(()=>{const d={production:[],staging:[],uat:[],testing:[],development:[]};return b.forEach(y=>{d[y.environment].push(y)}),d},[b]),s=d=>d<1024?`${d} B`:d<1024*1024?`${(d/1024).toFixed(1)} KB`:d<1024*1024*1024?`${(d/(1024*1024)).toFixed(1)} MB`:`${(d/(1024*1024*1024)).toFixed(1)} GB`,h=a.useCallback(()=>{const d={...xe(),name:c||`${M}-${Date.now()}`,displayName:c||M,isDefault:!1,isProtected:!1,createdBy:T,createdAt:ce(),status:"active",type:"data",environment:M,tenant:p,sourceSnapshot:t?.id,upstream:t?.id,tables:w?void 0:x,size:{records:0,bytes:0}};S(y=>[...y,d]),I?.(d),H?.(t?.id??"",M,w?void 0:x),j(null),A()},[c,M,t,w,x,T,p,I,H]),A=()=>{m(""),V("development"),E([]),i(!0)},K=a.useCallback(()=>{t&&(S(d=>d.filter(y=>y.id!==t.id)),q?.(t.id),C(null),j(null))},[t,q]),P=d=>{t&&(W?.(t.id,d),j(null))},l=()=>{t&&(S(d=>d.map(y=>y.id===t.id?{...y,isProtected:!0}:y)),$?.(t.id,z),j(null))},o={bg:"var(--bg-elevated, #1e1e1e)",cardBg:"var(--bg-elevated, #252525)",border:"var(--bg-tertiary, #333)",text:"var(--text-primary, #e0e0e0)",textMuted:"var(--text-muted, #888)"};return e.jsxs("div",{className:`nice-data-branch-manager ${N||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:o.bg,color:o.text,fontFamily:"system-ui, sans-serif",...D},"data-testid":O,children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${o.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx("h3",{style:{margin:0,fontSize:16},children:"🗃️ Data Environments"}),e.jsxs("span",{style:{fontSize:12,color:o.textMuted},children:["Tenant: ",p," • ",b.length," environments"]})]}),!B&&e.jsx("button",{onClick:()=>{C(b.find(d=>d.isDefault)?.id??null),j("clone")},style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:"+ New Environment"})]}),e.jsx("div",{style:{padding:16,borderBottom:`1px solid ${o.border}`,display:"flex",alignItems:"center",gap:8,overflowX:"auto"},children:Y.map((d,y)=>{const G=r[d],Q=G.length>0;return e.jsxs(a.Fragment,{children:[e.jsxs("div",{style:{padding:"8px 16px",borderRadius:6,background:Q?R[d]+"20":o.cardBg,border:`2px solid ${Q?R[d]:o.border}`,opacity:Q?1:.5,cursor:Q?"pointer":"default"},onClick:()=>Q&&C(G[0].id),children:[e.jsx("div",{style:{fontSize:18},children:F[d]}),e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase"},children:d}),Q&&e.jsxs("div",{style:{fontSize:10,color:o.textMuted},children:[G.length," branch",G.length>1?"es":""]})]}),y<Y.length-1&&e.jsx("div",{style:{color:o.textMuted,fontSize:20},children:"→"})]},d)})}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.jsxs("div",{style:{width:300,borderRight:`1px solid ${o.border}`,overflow:"auto"},children:[e.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${o.border}`,fontSize:11,color:o.textMuted},children:"All Environments"}),b.map(d=>e.jsxs("div",{onClick:()=>C(d.id),style:{padding:"12px 16px",borderBottom:`1px solid ${o.border}`,background:k===d.id?o.cardBg:"transparent",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:16},children:F[d.environment]}),e.jsx("span",{style:{fontWeight:500},children:d.displayName}),d.isProtected&&e.jsx("span",{style:{fontSize:12},children:"🔒"}),d.isDefault&&e.jsx("span",{style:{padding:"2px 6px",background:R[d.environment],borderRadius:4,fontSize:9,fontWeight:600},children:"DEFAULT"})]}),e.jsxs("div",{style:{fontSize:11,color:o.textMuted,marginTop:4},children:[d.size?.records.toLocaleString()," records •"," ",s(d.size?.bytes??0)]}),e.jsx("div",{style:{fontSize:10,color:o.textMuted,marginTop:2},children:d.lastActivity?.relative})]},d.id))]}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:t?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{marginBottom:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:8},children:[e.jsx("span",{style:{fontSize:32},children:F[t.environment]}),e.jsxs("div",{children:[e.jsx("h2",{style:{margin:0,fontSize:20},children:t.displayName}),e.jsx("span",{style:{display:"inline-block",padding:"2px 8px",background:R[t.environment],borderRadius:4,fontSize:10,fontWeight:600,marginTop:4},children:t.environment.toUpperCase()})]})]}),t.description&&e.jsx("p",{style:{color:o.textMuted,margin:"8px 0"},children:t.description})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:12,marginBottom:24},children:[{label:"Records",value:t.size?.records.toLocaleString()??"0"},{label:"Size",value:s(t.size?.bytes??0)},{label:"Tables",value:t.tables?.length.toString()??"All"},{label:"Status",value:t.status}].map(d=>e.jsxs("div",{style:{padding:12,background:o.cardBg,borderRadius:8,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:18,fontWeight:600},children:d.value}),e.jsx("div",{style:{fontSize:11,color:o.textMuted},children:d.label})]},d.label))}),e.jsxs("div",{style:{marginBottom:24},children:[e.jsx("h4",{style:{margin:"0 0 12px 0",fontSize:14},children:"Details"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr",gap:"8px 16px",fontSize:13},children:[e.jsx("span",{style:{color:o.textMuted},children:"Created by"}),e.jsx("span",{children:t.createdBy.name}),e.jsx("span",{style:{color:o.textMuted},children:"Created at"}),e.jsx("span",{children:t.createdAt.date?.toLocaleString()}),e.jsx("span",{style:{color:o.textMuted},children:"Last activity"}),e.jsx("span",{children:t.lastActivity?.relative}),t.upstream&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:o.textMuted},children:"Source"}),e.jsx("span",{children:b.find(d=>d.id===t.upstream)?.displayName??"Unknown"})]}),t.sourceSnapshot&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:o.textMuted},children:"Snapshot"}),e.jsx("span",{children:t.sourceSnapshot})]})]})]}),t.tables&&e.jsxs("div",{style:{marginBottom:24},children:[e.jsxs("h4",{style:{margin:"0 0 12px 0",fontSize:14},children:["Included Tables (",t.tables.length,")"]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:t.tables.map(d=>e.jsxs("span",{style:{padding:"4px 10px",background:o.cardBg,borderRadius:4,fontSize:12},children:["🗃️ ",d]},d))})]}),!B&&e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("button",{onClick:()=>L?.(t.id),style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--color-success, #22c55e)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"⚡ Switch to this environment"}),e.jsx("button",{onClick:()=>j("clone"),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${o.border}`,background:"transparent",color:o.text,cursor:"pointer",fontSize:12},children:"📋 Clone"}),e.jsx("button",{onClick:()=>j("sync"),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${o.border}`,background:"transparent",color:o.text,cursor:"pointer",fontSize:12},children:"🔄 Sync"}),!t.isProtected&&e.jsx("button",{onClick:()=>j("protect"),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${o.border}`,background:"transparent",color:o.text,cursor:"pointer",fontSize:12},children:"🔒 Protect"}),!t.isDefault&&!t.isProtected&&e.jsx("button",{onClick:()=>j("delete"),style:{padding:"8px 16px",borderRadius:6,border:"1px solid #ef4444",background:"transparent",color:"var(--color-error, #ef4444)",cursor:"pointer",fontSize:12},children:"🗑️ Delete"})]})]}):e.jsxs("div",{style:{padding:32,textAlign:"center",color:o.textMuted},children:[e.jsx("div",{style:{fontSize:48,marginBottom:16},children:"🗃️"}),e.jsx("div",{children:"Select an environment to view details"})]})})]}),_==="clone"&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>j(null),children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:o.cardBg,borderRadius:12,padding:24,width:500,maxHeight:"80vh",overflow:"auto"},children:[e.jsx("h3",{style:{margin:"0 0 16px 0"},children:"📋 Clone Environment"}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,color:o.textMuted},children:"Source Environment"}),e.jsxs("div",{style:{padding:12,background:o.bg,borderRadius:6,display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:F[t?.environment??"production"]}),e.jsx("span",{children:t?.displayName??"Production"})]})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,color:o.textMuted},children:"Target Environment"}),e.jsx("select",{value:M,onChange:d=>V(d.target.value),style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${o.border}`,background:o.bg,color:o.text,fontSize:13},children:Y.filter(d=>ne(t?.environment??"production",d)||d==="development"||d==="testing").map(d=>e.jsxs("option",{value:d,children:[F[d]," ",d.charAt(0).toUpperCase()+d.slice(1)]},d))})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,color:o.textMuted},children:"Environment Name"}),e.jsx("input",{type:"text",value:c,onChange:d=>m(d.target.value),placeholder:`${M}-${new Date().toISOString().split("T")[0]}`,style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${o.border}`,background:o.bg,color:o.text,fontSize:13}})]}),e.jsx("div",{style:{marginBottom:16},children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:w,onChange:d=>i(d.target.checked)}),e.jsx("span",{style:{fontSize:13},children:"Include all tables"})]})}),!w&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsxs("label",{style:{display:"block",marginBottom:6,fontSize:12,color:o.textMuted},children:["Select Tables (",x.length," selected)"]}),e.jsx("div",{style:{maxHeight:200,overflow:"auto",border:`1px solid ${o.border}`,borderRadius:6},children:v.map(d=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:`1px solid ${o.border}`,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:x.includes(d.name),onChange:y=>{y.target.checked?E(G=>[...G,d.name]):E(G=>G.filter(Q=>Q!==d.name))}}),e.jsx("span",{style:{flex:1,fontSize:13},children:d.displayName}),e.jsxs("span",{style:{fontSize:11,color:o.textMuted},children:[d.recordCount.toLocaleString()," rows"]})]},d.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>j(null),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${o.border}`,background:"transparent",color:o.text,cursor:"pointer",fontSize:13},children:"Cancel"}),e.jsx("button",{onClick:h,style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:"Clone Environment"})]})]})}),_==="sync"&&t&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>j(null),children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:o.cardBg,borderRadius:12,padding:24,width:400},children:[e.jsx("h3",{style:{margin:"0 0 16px 0"},children:"🔄 Sync Environment"}),e.jsxs("p",{style:{color:o.textMuted,fontSize:13,marginBottom:16},children:["Synchronize data between ",t.displayName," and its source."]}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:16},children:[e.jsxs("button",{onClick:()=>P("pull"),style:{flex:1,padding:"16px",borderRadius:8,border:`2px solid ${o.border}`,background:"transparent",color:o.text,cursor:"pointer",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:24,marginBottom:8},children:"⬇️"}),e.jsx("div",{style:{fontWeight:500},children:"Pull"}),e.jsx("div",{style:{fontSize:11,color:o.textMuted},children:"Get changes from source"})]}),e.jsxs("button",{onClick:()=>P("push"),disabled:t.environment==="production",style:{flex:1,padding:"16px",borderRadius:8,border:`2px solid ${o.border}`,background:"transparent",color:t.environment==="production"?o.textMuted:o.text,cursor:t.environment==="production"?"not-allowed":"pointer",textAlign:"center",opacity:t.environment==="production"?.5:1},children:[e.jsx("div",{style:{fontSize:24,marginBottom:8},children:"⬆️"}),e.jsx("div",{style:{fontWeight:500},children:"Push"}),e.jsx("div",{style:{fontSize:11,color:o.textMuted},children:"Send changes to source"})]})]}),e.jsx("button",{onClick:()=>j(null),style:{width:"100%",padding:"8px 16px",borderRadius:6,border:`1px solid ${o.border}`,background:"transparent",color:o.text,cursor:"pointer",fontSize:13},children:"Cancel"})]})}),_==="delete"&&t&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>j(null),children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:o.cardBg,borderRadius:12,padding:24,width:400},children:[e.jsx("h3",{style:{margin:"0 0 16px 0",color:"var(--color-error, #ef4444)"},children:"🗑️ Delete Environment"}),e.jsxs("p",{style:{color:o.textMuted,fontSize:13,marginBottom:16},children:["Are you sure you want to delete ",e.jsx("strong",{children:t.displayName}),"? This will remove all ",t.size?.records.toLocaleString()," records."]}),e.jsx("div",{style:{padding:12,background:"#ef444420",border:"1px solid #ef4444",borderRadius:6,marginBottom:16,fontSize:12},children:"⚠️ This action cannot be undone."}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>j(null),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${o.border}`,background:"transparent",color:o.text,cursor:"pointer",fontSize:13},children:"Cancel"}),e.jsx("button",{onClick:K,style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--color-error, #ef4444)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:"Delete Environment"})]})]})}),_==="protect"&&t&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.75)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>j(null),children:e.jsxs("div",{onClick:d=>d.stopPropagation(),style:{background:o.cardBg,borderRadius:12,padding:24,width:450},children:[e.jsx("h3",{style:{margin:"0 0 16px 0"},children:"🔒 Protect Environment"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,marginBottom:16},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:z.requireApproval,onChange:d=>U(y=>({...y,requireApproval:d.target.checked}))}),e.jsx("span",{style:{fontSize:13},children:"Require approval for changes"})]}),z.requireApproval&&e.jsxs("div",{style:{marginLeft:24},children:[e.jsx("label",{style:{display:"block",marginBottom:4,fontSize:11,color:o.textMuted},children:"Minimum approvers"}),e.jsx("input",{type:"number",min:1,max:5,value:z.approversCount,onChange:d=>U(y=>({...y,approversCount:parseInt(d.target.value)||1})),style:{width:80,padding:6,borderRadius:4,border:`1px solid ${o.border}`,background:o.bg,color:o.text}})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:z.requireBackup,onChange:d=>U(y=>({...y,requireBackup:d.target.checked}))}),e.jsx("span",{style:{fontSize:13},children:"Require backup before changes"})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!z.allowDirectChanges,onChange:d=>U(y=>({...y,allowDirectChanges:!d.target.checked}))}),e.jsx("span",{style:{fontSize:13},children:"Block direct changes (require merge)"})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>j(null),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${o.border}`,background:"transparent",color:o.text,cursor:"pointer",fontSize:13},children:"Cancel"}),e.jsx("button",{onClick:l,style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--color-warning, #f59e0b)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:"Apply Protection"})]})]})})]})},he=Object.freeze(Object.defineProperty({__proto__:null,NiceDataBranchManager:oe},Symbol.toStringTag,{value:"Module"})),ye=[{table:"customers",displayName:"Customers",module:"CRM",added:15,modified:42,deleted:3,records:[{id:"CUST-001",changeType:"added",primaryKey:{customer_id:"CUST-001"},fields:[{field:"name",fieldType:"string",oldValue:void 0,newValue:"Acme Corp",changeType:"added"},{field:"email",fieldType:"string",oldValue:void 0,newValue:"info@acme.com",changeType:"added"},{field:"status",fieldType:"string",oldValue:void 0,newValue:"active",changeType:"added"}],changedAt:new Date,changedBy:"admin"},{id:"CUST-042",changeType:"modified",primaryKey:{customer_id:"CUST-042"},fields:[{field:"email",fieldType:"string",oldValue:"old@email.com",newValue:"new@email.com",changeType:"modified"},{field:"phone",fieldType:"string",oldValue:"+1-555-0100",newValue:"+1-555-0199",changeType:"modified"},{field:"updated_at",fieldType:"datetime",oldValue:"2025-01-01",newValue:"2025-04-01",changeType:"modified"}],changedAt:new Date,changedBy:"user1"},{id:"CUST-099",changeType:"deleted",primaryKey:{customer_id:"CUST-099"},fields:[{field:"name",fieldType:"string",oldValue:"Old Customer",newValue:void 0,changeType:"deleted"},{field:"status",fieldType:"string",oldValue:"inactive",newValue:void 0,changeType:"deleted"}],changedAt:new Date,changedBy:"admin"}]},{table:"products",displayName:"Products",module:"Inventory",added:8,modified:25,deleted:0,records:[{id:"PROD-NEW-1",changeType:"added",primaryKey:{product_id:"PROD-NEW-1"},fields:[{field:"name",fieldType:"string",oldValue:void 0,newValue:"New Product",changeType:"added"},{field:"price",fieldType:"decimal",oldValue:void 0,newValue:99.99,changeType:"added"}],changedAt:new Date,changedBy:"inventory_admin"}]},{table:"orders",displayName:"Orders",module:"Sales",added:156,modified:12,deleted:0,records:[]},{table:"config",displayName:"Configuration",module:"System",added:0,modified:3,deleted:0,records:[{id:"CFG-TAX-RATE",changeType:"modified",primaryKey:{config_key:"tax_rate"},fields:[{field:"value",fieldType:"decimal",oldValue:.2,newValue:.21,changeType:"modified"}],changedAt:new Date,changedBy:"admin"}]}],de=({sourceBranch:p,targetBranch:f,branches:T=[],diffItems:v=ye,onCompare:B,onExport:I,onSelectRecord:q,className:L,style:H,"data-testid":W})=>{const[$,g]=a.useState("summary"),[N,D]=a.useState("all"),[O,b]=a.useState(null),[S,k]=a.useState(null),[C,_]=a.useState(""),[j,M]=a.useState(!1),[V,c]=a.useState(p?.id??""),[m,x]=a.useState(f?.id??""),E=a.useMemo(()=>v.reduce((r,s)=>({tables:r.tables+1,added:r.added+s.added,modified:r.modified+s.modified,deleted:r.deleted+s.deleted}),{tables:0,added:0,modified:0,deleted:0}),[v]),w=a.useMemo(()=>v.filter(r=>{if(N==="added"&&r.added===0||N==="modified"&&r.modified===0||N==="deleted"&&r.deleted===0)return!1;if(C){const s=C.toLowerCase();return r.table.toLowerCase().includes(s)||r.displayName.toLowerCase().includes(s)||r.module?.toLowerCase().includes(s)}return!0}).sort((r,s)=>s.added+s.modified+s.deleted-(r.added+r.modified+r.deleted)),[v,N,C]),i=a.useMemo(()=>v.find(r=>r.table===O),[v,O]),z=a.useMemo(()=>i?i.records.filter(r=>N==="all"?!0:r.changeType===N):[],[i,N]),U=a.useCallback(()=>{V&&m&&B?.(V,m)},[V,m,B]),u=r=>{switch(r){case"added":return"var(--color-success, #22c55e)";case"modified":return"var(--color-warning, #f59e0b)";case"deleted":return"var(--color-error, #ef4444)";default:return"var(--text-muted, #888)"}},n=r=>{switch(r){case"added":return"+";case"modified":return"~";case"deleted":return"-";default:return" "}},t={bg:"var(--bg-elevated, #1e1e1e)",cardBg:"var(--bg-elevated, #252525)",border:"var(--bg-tertiary, #333)",text:"var(--text-primary, #e0e0e0)",textMuted:"var(--text-muted, #888)"};return e.jsxs("div",{className:`nice-data-diff-viewer ${L||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:t.bg,color:t.text,fontFamily:"system-ui, sans-serif",...H},"data-testid":W,children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsx("h3",{style:{margin:0,fontSize:16},children:"📊 Data Diff Viewer"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("select",{value:V,onChange:r=>c(r.target.value),style:{padding:"6px 12px",borderRadius:6,border:`1px solid ${t.border}`,background:t.cardBg,color:t.text,fontSize:12},children:[e.jsx("option",{value:"",children:"Select source..."}),T.map(r=>e.jsxs("option",{value:r.id,children:[F[r.environment]," ",r.displayName]},r.id))]}),e.jsx("span",{style:{color:t.textMuted},children:"→"}),e.jsxs("select",{value:m,onChange:r=>x(r.target.value),style:{padding:"6px 12px",borderRadius:6,border:`1px solid ${t.border}`,background:t.cardBg,color:t.text,fontSize:12},children:[e.jsx("option",{value:"",children:"Select target..."}),T.map(r=>e.jsxs("option",{value:r.id,children:[F[r.environment]," ",r.displayName]},r.id))]}),e.jsx("button",{onClick:U,disabled:!V||!m,style:{padding:"6px 12px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:V&&m?"pointer":"not-allowed",fontSize:12,opacity:V&&m?1:.5},children:"Compare"})]}),e.jsx("div",{style:{flex:1}}),e.jsxs("select",{onChange:r=>{r.target.value&&(I?.(r.target.value),r.target.value="")},style:{padding:"6px 12px",borderRadius:6,border:`1px solid ${t.border}`,background:t.cardBg,color:t.text,fontSize:12},children:[e.jsx("option",{value:"",children:"📥 Export..."}),e.jsx("option",{value:"json",children:"JSON"}),e.jsx("option",{value:"csv",children:"CSV"}),e.jsx("option",{value:"sql",children:"SQL Script"})]})]}),e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{color:t.textMuted,fontSize:12},children:"Tables:"}),e.jsx("span",{style:{fontWeight:600},children:E.tables})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:u("added")}}),e.jsxs("span",{style:{fontSize:12},children:["+",E.added," added"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:u("modified")}}),e.jsxs("span",{style:{fontSize:12},children:["~",E.modified," modified"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:u("deleted")}}),e.jsxs("span",{style:{fontSize:12},children:["-",E.deleted," deleted"]})]}),e.jsx("div",{style:{flex:1}}),e.jsx("div",{style:{display:"flex",gap:4},children:["all","added","modified","deleted"].map(r=>e.jsx("button",{onClick:()=>D(r),style:{padding:"4px 12px",borderRadius:4,border:"none",background:N===r?"var(--color-primary, #3b82f6)":t.cardBg,color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:r},r))}),e.jsx("input",{type:"text",value:C,onChange:r=>_(r.target.value),placeholder:"Search tables...",style:{padding:"6px 12px",borderRadius:6,border:`1px solid ${t.border}`,background:t.cardBg,color:t.text,fontSize:12,width:180}})]}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.jsxs("div",{style:{width:280,borderRight:`1px solid ${t.border}`,overflow:"auto"},children:[e.jsxs("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`,fontSize:11,color:t.textMuted},children:["Tables (",w.length,")"]}),w.map(r=>e.jsxs("div",{onClick:()=>{b(r.table),k(null),g("table")},style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,background:O===r.table?t.cardBg:"transparent",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[e.jsx("span",{style:{fontSize:14},children:"🗃️"}),e.jsx("span",{style:{fontWeight:500,fontSize:13},children:r.displayName})]}),e.jsxs("div",{style:{display:"flex",gap:12,fontSize:11},children:[r.added>0&&e.jsxs("span",{style:{color:u("added")},children:["+",r.added]}),r.modified>0&&e.jsxs("span",{style:{color:u("modified")},children:["~",r.modified]}),r.deleted>0&&e.jsxs("span",{style:{color:u("deleted")},children:["-",r.deleted]})]}),r.module&&e.jsx("div",{style:{fontSize:10,color:t.textMuted,marginTop:4},children:r.module})]},r.table))]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[$==="summary"&&e.jsxs("div",{style:{padding:32,textAlign:"center",color:t.textMuted},children:[e.jsx("div",{style:{fontSize:48,marginBottom:16},children:"📊"}),e.jsx("div",{children:"Select a table to view changes"})]}),$==="table"&&i&&e.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx("h4",{style:{margin:0,fontSize:14},children:i.displayName}),e.jsxs("span",{style:{fontSize:11,color:t.textMuted},children:[i.table," • ",i.module]})]}),e.jsxs("div",{style:{display:"flex",gap:8,fontSize:12},children:[e.jsxs("span",{style:{color:u("added")},children:["+",i.added]}),e.jsxs("span",{style:{color:u("modified")},children:["~",i.modified]}),e.jsxs("span",{style:{color:u("deleted")},children:["-",i.deleted]})]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:z.length===0?e.jsx("div",{style:{padding:32,textAlign:"center",color:t.textMuted},children:"No records match the current filter"}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:t.cardBg},children:[e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:"Change"}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:"Record ID"}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:"Fields Changed"}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:"Changed By"}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:"Date"})]})}),e.jsx("tbody",{children:z.map(r=>e.jsxs("tr",{onClick:()=>{k(r),g("record")},style:{cursor:"pointer",background:S?.id===r.id?t.cardBg:"transparent"},children:[e.jsx("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`},children:e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:4,background:u(r.changeType)+"30",color:u(r.changeType),fontWeight:600,fontSize:14},children:n(r.changeType)})}),e.jsx("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`,fontFamily:"monospace"},children:r.id}),e.jsxs("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`},children:[r.fields.length," field",r.fields.length!==1?"s":""]}),e.jsx("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`},children:r.changedBy??"-"}),e.jsx("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`,color:t.textMuted},children:r.changedAt?.toLocaleString()??"-"})]},r.id))})]})})]}),$==="record"&&S&&i&&e.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:12},children:[e.jsx("button",{onClick:()=>g("table"),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:"pointer",fontSize:12},children:"← Back"}),e.jsxs("div",{children:[e.jsxs("h4",{style:{margin:0,fontSize:14},children:[i.displayName," / ",S.id]}),e.jsx("span",{style:{display:"inline-block",padding:"2px 8px",background:u(S.changeType)+"30",color:u(S.changeType),borderRadius:4,fontSize:10,fontWeight:600,marginTop:4,textTransform:"uppercase"},children:S.changeType})]})]}),e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,background:t.cardBg},children:[e.jsx("div",{style:{fontSize:11,color:t.textMuted,marginBottom:4},children:"Primary Key"}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:12},children:Object.entries(S.primaryKey).map(([r,s])=>e.jsxs("span",{style:{marginRight:16},children:[e.jsxs("span",{style:{color:t.textMuted},children:[r,":"]})," ",String(s)]},r))})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:16},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:t.cardBg},children:[e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`,width:30}}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:"Field"}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:"Type"}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:"Source Value"}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:"Target Value"})]})}),e.jsx("tbody",{children:S.fields.map(r=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${t.border}`},children:e.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:20,height:20,borderRadius:4,background:u(r.changeType)+"30",color:u(r.changeType),fontWeight:600,fontSize:12},children:n(r.changeType)})}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${t.border}`,fontWeight:500},children:r.field}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${t.border}`,color:t.textMuted},children:r.fieldType}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${t.border}`,fontFamily:"monospace",background:r.changeType==="deleted"?"#ef444420":"transparent"},children:r.oldValue!==void 0?String(r.oldValue):e.jsx("span",{style:{color:t.textMuted,fontStyle:"italic"},children:"null"})}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${t.border}`,fontFamily:"monospace",background:r.changeType==="added"?"#22c55e20":r.changeType==="modified"?"#f59e0b20":"transparent"},children:r.newValue!==void 0?String(r.newValue):e.jsx("span",{style:{color:t.textMuted,fontStyle:"italic"},children:"null"})})]},r.field))})]}),e.jsxs("div",{style:{marginTop:24,padding:16,background:t.cardBg,borderRadius:8},children:[e.jsx("div",{style:{fontSize:11,color:t.textMuted,marginBottom:8},children:"Change Metadata"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"100px 1fr",gap:"8px 16px",fontSize:12},children:[e.jsx("span",{style:{color:t.textMuted},children:"Changed by"}),e.jsx("span",{children:S.changedBy??"Unknown"}),e.jsx("span",{style:{color:t.textMuted},children:"Changed at"}),e.jsx("span",{children:S.changedAt?.toLocaleString()??"Unknown"})]})]})]})]})]})]})]})},fe=Object.freeze(Object.defineProperty({__proto__:null,NiceDataDiffViewer:de},Symbol.toStringTag,{value:"Module"})),be=[{id:"commit-1",shortId:"c1a2b3c",message:"Initial production snapshot",branch:"production",environment:"production",author:{id:"system",name:"System"},timestamp:new Date("2025-01-01T10:00:00"),parents:[],isMerge:!1,isSnapshot:!0,stats:{tables:25,recordsAdded:265770,recordsModified:0,recordsDeleted:0},tags:["v1.0.0"]},{id:"commit-2",shortId:"d4e5f6g",message:"Clone to UAT for Q1 testing",branch:"uat",environment:"uat",author:{id:"admin",name:"Admin"},timestamp:new Date("2025-01-15T09:00:00"),parents:["commit-1"],isMerge:!1,isSnapshot:!0,stats:{tables:25,recordsAdded:265e3,recordsModified:0,recordsDeleted:0}},{id:"commit-3",shortId:"h7i8j9k",message:"Customer data migration",branch:"uat",environment:"uat",author:{id:"user1",name:"Data Engineer"},timestamp:new Date("2025-02-01T14:30:00"),parents:["commit-2"],isMerge:!1,isSnapshot:!1,stats:{tables:1,recordsAdded:500,recordsModified:1200,recordsDeleted:50}},{id:"commit-4",shortId:"l0m1n2o",message:"Clone to development",branch:"development",environment:"development",author:{id:"dev1",name:"Developer"},timestamp:new Date("2025-03-01T08:00:00"),parents:["commit-3"],isMerge:!1,isSnapshot:!0,stats:{tables:15,recordsAdded:67120,recordsModified:0,recordsDeleted:0}},{id:"commit-5",shortId:"p3q4r5s",message:"New product catalog import",branch:"development",environment:"development",author:{id:"dev1",name:"Developer"},timestamp:new Date("2025-03-10T16:45:00"),parents:["commit-4"],isMerge:!1,isSnapshot:!1,stats:{tables:2,recordsAdded:350,recordsModified:0,recordsDeleted:0}},{id:"commit-6",shortId:"t6u7v8w",message:"Tax rate configuration update",branch:"development",environment:"development",author:{id:"dev2",name:"Config Admin"},timestamp:new Date("2025-03-15T11:20:00"),parents:["commit-5"],isMerge:!1,isSnapshot:!1,stats:{tables:1,recordsAdded:0,recordsModified:3,recordsDeleted:0}},{id:"commit-7",shortId:"x9y0z1a",message:"Merge development changes to UAT",branch:"uat",environment:"uat",author:{id:"admin",name:"Admin"},timestamp:new Date("2025-03-20T09:00:00"),parents:["commit-3","commit-6"],isMerge:!0,isSnapshot:!1,stats:{tables:3,recordsAdded:350,recordsModified:3,recordsDeleted:0},tags:["uat-release-1"]},{id:"commit-8",shortId:"b2c3d4e",message:"Production weekly backup",branch:"production",environment:"production",author:{id:"system",name:"System"},timestamp:new Date("2025-03-25T02:00:00"),parents:["commit-1"],isMerge:!1,isSnapshot:!0,stats:{tables:25,recordsAdded:0,recordsModified:5420,recordsDeleted:120},tags:["backup-2025-03-25"]}],se=({branches:p=[],commits:f=be,selectedCommitId:T,viewMode:v,showLanes:B=!0,onSelectCommit:I,onSelectBranch:q,onCompare:L,onRestore:H,className:W,style:$,"data-testid":g})=>{const[N,D]=a.useState("graph"),[O,b]=a.useState(null),[S,k]=a.useState(null),[C,_]=a.useState(null),j=v??N,M=T??O,V=a.useRef(null),c=a.useMemo(()=>[...f].sort((n,t)=>t.timestamp.getTime()-n.timestamp.getTime()),[f]),m=a.useMemo(()=>{const n={};return Y.forEach((t,r)=>{n[t]=r}),f.reduce((t,r)=>(t[r.id]=n[r.environment]??0,t),{})},[f]),x=a.useMemo(()=>f.find(n=>n.id===M),[f,M]),E=a.useCallback(n=>{S?(L?.(S,n),k(null)):(b(n),I?.(n))},[S,L,I]),w=n=>{const r=new Date().getTime()-n.getTime(),s=Math.floor(r/(1e3*60*60*24));return s===0?"Today":s===1?"Yesterday":s<7?`${s} days ago`:s<30?`${Math.floor(s/7)} weeks ago`:`${Math.floor(s/30)} months ago`},i={bg:"var(--bg-elevated, #1e1e1e)",cardBg:"var(--bg-elevated, #252525)",border:"var(--bg-tertiary, #333)",text:"var(--text-primary, #e0e0e0)",textMuted:"var(--text-muted, #888)"},z=140,U=12,u=80;return e.jsxs("div",{className:`nice-data-branch-graph ${W||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:i.bg,color:i.text,fontFamily:"system-ui, sans-serif",...$},"data-testid":g,children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${i.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsx("h3",{style:{margin:0,fontSize:16},children:"📈 Data History"}),e.jsx("div",{style:{display:"flex",gap:4},children:["graph","timeline","list"].map(n=>e.jsxs("button",{onClick:()=>D(n),style:{padding:"4px 12px",borderRadius:4,border:"none",background:j===n?"var(--color-primary, #3b82f6)":i.cardBg,color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:[n==="graph"?"🌳":n==="timeline"?"📅":"📋"," ",n]},n))}),e.jsx("div",{style:{flex:1}}),S?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{style:{fontSize:12,color:i.textMuted},children:["Select target to compare with ",f.find(n=>n.id===S)?.shortId]}),e.jsx("button",{onClick:()=>k(null),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${i.border}`,background:"transparent",color:i.text,cursor:"pointer",fontSize:11},children:"Cancel"})]}):e.jsxs("span",{style:{fontSize:12,color:i.textMuted},children:[c.length," snapshots"]})]}),B&&j==="graph"&&e.jsxs("div",{style:{display:"flex",borderBottom:`1px solid ${i.border}`,background:i.cardBg},children:[Y.map(n=>e.jsxs("div",{style:{width:z,padding:"8px 12px",textAlign:"center",borderRight:`1px solid ${i.border}`},children:[e.jsx("span",{style:{fontSize:16},children:F[n]}),e.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",color:R[n]},children:n})]},n)),e.jsx("div",{style:{flex:1,padding:"8px 12px"},children:e.jsx("div",{style:{fontSize:11,color:i.textMuted},children:"Details"})})]}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[j==="graph"&&e.jsx("div",{ref:V,style:{flex:1,overflow:"auto"},children:e.jsxs("div",{style:{position:"relative",minHeight:c.length*u},children:[e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:z*Y.length,height:c.length*u,pointerEvents:"none"},children:c.map((n,t)=>{const r=t*u+u/2,s=m[n.id]*z+z/2;return n.parents.map(h=>{const A=c.findIndex(d=>d.id===h);if(A===-1)return null;const K=A*u+u/2,P=m[h]*z+z/2,l=n.isMerge&&n.parents.indexOf(h)>0,o=s===P?`M ${s} ${r} L ${P} ${K}`:`M ${s} ${r} C ${s} ${(r+K)/2}, ${P} ${(r+K)/2}, ${P} ${K}`;return e.jsx("path",{d:o,fill:"none",stroke:l?"var(--color-accent, #8b5cf6)":R[n.environment],strokeWidth:2,strokeDasharray:l?"4,4":void 0,opacity:.6},`${n.id}-${h}`)})})}),c.map((n,t)=>{const r=t*u+u/2,s=m[n.id]*z+z/2,h=n.id===M,A=n.id===C,K=n.id===S;return e.jsxs(a.Fragment,{children:[e.jsx("div",{onClick:()=>E(n.id),onMouseEnter:()=>_(n.id),onMouseLeave:()=>_(null),style:{position:"absolute",left:s-U,top:r-U,width:U*2,height:U*2,borderRadius:n.isMerge?4:"50%",background:h||K?"var(--bg-primary, #fff)":R[n.environment],border:`3px solid ${R[n.environment]}`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,color:h||K?"var(--text-primary, #000)":"var(--bg-primary, #fff)",zIndex:A?10:1,transform:A?"scale(1.2)":"scale(1)",transition:"transform 0.1s",boxShadow:h?"0 0 0 3px rgba(59, 130, 246, 0.5)":"none"},children:n.isSnapshot?"📷":n.isMerge?"🔀":""}),e.jsxs("div",{style:{position:"absolute",left:z*Y.length+16,top:r-20,right:16,height:40,display:"flex",alignItems:"center",gap:12,padding:"4px 12px",background:h?i.cardBg:"transparent",borderRadius:6,borderLeft:h?`3px solid ${R[n.environment]}`:"none"},children:[e.jsx("span",{style:{fontFamily:"monospace",fontSize:11,color:R[n.environment]},children:n.shortId}),e.jsx("span",{style:{fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.message}),n.tags?.map(P=>e.jsxs("span",{style:{padding:"2px 6px",background:"#f59e0b30",color:"var(--color-warning, #f59e0b)",borderRadius:4,fontSize:9},children:["🏷️ ",P]},P)),e.jsx("span",{style:{fontSize:10,color:i.textMuted,whiteSpace:"nowrap"},children:w(n.timestamp)})]})]},n.id)})]})}),j==="timeline"&&e.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:c.map((n,t)=>{const r=n.id===M,s=c[t-1],h=!s||n.timestamp.toDateString()!==s.timestamp.toDateString();return e.jsxs(a.Fragment,{children:[h&&e.jsx("div",{style:{padding:"8px 0",fontSize:11,fontWeight:600,color:i.textMuted,borderBottom:`1px solid ${i.border}`,marginBottom:8},children:n.timestamp.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),e.jsxs("div",{onClick:()=>E(n.id),style:{display:"flex",gap:12,padding:12,marginBottom:8,background:r?i.cardBg:"transparent",borderRadius:8,cursor:"pointer",border:`1px solid ${r?R[n.environment]:"transparent"}`},children:[e.jsx("div",{style:{width:60,textAlign:"right",fontSize:11,color:i.textMuted},children:n.timestamp.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}),e.jsxs("div",{style:{width:80,padding:"4px 8px",background:R[n.environment]+"30",color:R[n.environment],borderRadius:4,fontSize:10,textAlign:"center",fontWeight:600,textTransform:"uppercase"},children:[F[n.environment]," ",n.environment.substring(0,4)]}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontFamily:"monospace",fontSize:11,color:i.textMuted},children:n.shortId}),n.isSnapshot&&e.jsx("span",{style:{fontSize:12},children:"📷"}),n.isMerge&&e.jsx("span",{style:{fontSize:12},children:"🔀"}),n.tags?.map(A=>e.jsx("span",{style:{padding:"1px 6px",background:"#f59e0b30",color:"var(--color-warning, #f59e0b)",borderRadius:3,fontSize:9},children:A},A))]}),e.jsx("div",{style:{fontSize:13,marginTop:4},children:n.message}),e.jsxs("div",{style:{fontSize:11,color:i.textMuted,marginTop:4},children:["by ",n.author.name," •"," ",e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["+",n.stats.recordsAdded]})," ",e.jsxs("span",{style:{color:"var(--color-warning, #f59e0b)"},children:["~",n.stats.recordsModified]})," ",e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["-",n.stats.recordsDeleted]})]})]})]})]},n.id)})}),j==="list"&&e.jsx("div",{style:{flex:1,overflow:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:i.cardBg},children:[e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${i.border}`},children:"ID"}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${i.border}`},children:"Environment"}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${i.border}`},children:"Message"}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${i.border}`},children:"Author"}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${i.border}`},children:"Date"}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"right",borderBottom:`1px solid ${i.border}`},children:"Changes"})]})}),e.jsx("tbody",{children:c.map(n=>e.jsxs("tr",{onClick:()=>E(n.id),style:{cursor:"pointer",background:n.id===M?i.cardBg:"transparent"},children:[e.jsxs("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${i.border}`,fontFamily:"monospace"},children:[n.shortId,n.isSnapshot&&" 📷",n.isMerge&&" 🔀"]}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${i.border}`},children:e.jsx("span",{style:{padding:"2px 8px",background:R[n.environment]+"30",color:R[n.environment],borderRadius:4,fontSize:10,fontWeight:600},children:n.environment})}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${i.border}`},children:n.message}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${i.border}`,color:i.textMuted},children:n.author.name}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${i.border}`,color:i.textMuted},children:n.timestamp.toLocaleString()}),e.jsxs("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${i.border}`,textAlign:"right"},children:[e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["+",n.stats.recordsAdded]})," ",e.jsxs("span",{style:{color:"var(--color-warning, #f59e0b)"},children:["~",n.stats.recordsModified]})," ",e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["-",n.stats.recordsDeleted]})]})]},n.id))})]})}),x&&e.jsxs("div",{style:{width:320,borderLeft:`1px solid ${i.border}`,overflow:"auto",padding:16},children:[e.jsxs("div",{style:{marginBottom:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("span",{style:{fontSize:24},children:x.isSnapshot?"📷":x.isMerge?"🔀":"📝"}),e.jsx("span",{style:{padding:"4px 10px",background:R[x.environment]+"30",color:R[x.environment],borderRadius:6,fontSize:11,fontWeight:600,textTransform:"uppercase"},children:x.environment})]}),e.jsx("h4",{style:{margin:"0 0 8px 0",fontSize:14},children:x.message}),x.description&&e.jsx("p",{style:{margin:0,fontSize:12,color:i.textMuted},children:x.description})]}),x.tags&&x.tags.length>0&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:11,color:i.textMuted,marginBottom:4},children:"Tags"}),e.jsx("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:x.tags.map(n=>e.jsxs("span",{style:{padding:"2px 8px",background:"#f59e0b30",color:"var(--color-warning, #f59e0b)",borderRadius:4,fontSize:11},children:["🏷️ ",n]},n))})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:11,color:i.textMuted,marginBottom:8},children:"Changes"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8},children:[e.jsxs("div",{style:{padding:10,background:i.cardBg,borderRadius:6,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:600},children:x.stats.tables}),e.jsx("div",{style:{fontSize:10,color:i.textMuted},children:"Tables"})]}),e.jsxs("div",{style:{padding:10,background:"#22c55e20",borderRadius:6,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:16,fontWeight:600,color:"var(--color-success, #22c55e)"},children:["+",x.stats.recordsAdded]}),e.jsx("div",{style:{fontSize:10,color:i.textMuted},children:"Added"})]}),e.jsxs("div",{style:{padding:10,background:"#f59e0b20",borderRadius:6,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:16,fontWeight:600,color:"var(--color-warning, #f59e0b)"},children:["~",x.stats.recordsModified]}),e.jsx("div",{style:{fontSize:10,color:i.textMuted},children:"Modified"})]}),e.jsxs("div",{style:{padding:10,background:"#ef444420",borderRadius:6,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:16,fontWeight:600,color:"var(--color-error, #ef4444)"},children:["-",x.stats.recordsDeleted]}),e.jsx("div",{style:{fontSize:10,color:i.textMuted},children:"Deleted"})]})]})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:11,color:i.textMuted,marginBottom:8},children:"Details"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"80px 1fr",gap:"6px 12px",fontSize:12},children:[e.jsx("span",{style:{color:i.textMuted},children:"ID"}),e.jsx("span",{style:{fontFamily:"monospace"},children:x.shortId}),e.jsx("span",{style:{color:i.textMuted},children:"Author"}),e.jsx("span",{children:x.author.name}),e.jsx("span",{style:{color:i.textMuted},children:"Date"}),e.jsx("span",{children:x.timestamp.toLocaleString()}),e.jsx("span",{style:{color:i.textMuted},children:"Type"}),e.jsx("span",{children:x.isSnapshot?"Snapshot":x.isMerge?"Merge":"Change"}),x.parents.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:i.textMuted},children:"Parents"}),e.jsx("span",{style:{fontFamily:"monospace"},children:x.parents.map(n=>f.find(t=>t.id===n)?.shortId??n).join(", ")})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsx("button",{onClick:()=>k(x.id),style:{padding:"8px 12px",borderRadius:6,border:`1px solid ${i.border}`,background:"transparent",color:i.text,cursor:"pointer",fontSize:12},children:"🔍 Compare with..."}),x.isSnapshot&&e.jsx("button",{onClick:()=>H?.(x.id),style:{padding:"8px 12px",borderRadius:6,border:"none",background:"var(--color-warning, #f59e0b)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:"⏪ Restore this snapshot"})]})]})]})]})},me=Object.freeze(Object.defineProperty({__proto__:null,NiceDataBranchGraph:se},Symbol.toStringTag,{value:"Module"})),ve=[{id:"prod-1",shortId:"prod-1",name:"production",displayName:"Production",isDefault:!0,isProtected:!0,createdBy:{id:"system",name:"System"},createdAt:{date:new Date,relative:"1 year ago"},status:"active",type:"data",environment:"production",tenant:"tenant-1",size:{records:265770,bytes:2921e5}},{id:"uat-1",shortId:"uat-1",name:"uat",displayName:"UAT",isDefault:!1,isProtected:!0,createdBy:{id:"admin",name:"Admin"},createdAt:{date:new Date,relative:"3 months ago"},upstream:"prod-1",status:"active",type:"data",environment:"uat",tenant:"tenant-1",size:{records:265e3,bytes:29e7}},{id:"dev-1",shortId:"dev-1",name:"development",displayName:"Development",isDefault:!1,isProtected:!1,createdBy:{id:"dev1",name:"Developer"},createdAt:{date:new Date,relative:"1 month ago"},upstream:"uat-1",status:"active",type:"data",environment:"development",tenant:"tenant-1",size:{records:67120,bytes:1591e5}}],ee={sourceId:"dev-1",targetId:"uat-1",tables:[{table:"customers",displayName:"Customers",module:"CRM",inserts:15,updates:42,deletes:3,conflicts:2,selected:!0},{table:"products",displayName:"Products",module:"Inventory",inserts:350,updates:25,deletes:0,conflicts:0,selected:!0},{table:"config",displayName:"Configuration",module:"System",inserts:0,updates:3,deletes:0,conflicts:1,selected:!0},{table:"orders",displayName:"Orders",module:"Sales",inserts:0,updates:0,deletes:0,conflicts:0,selected:!1}],conflicts:[{id:"conflict-1",table:"customers",recordId:"CUST-042",field:"email",sourceValue:"new@email.com",targetValue:"different@email.com",type:"concurrent-update"},{id:"conflict-2",table:"customers",recordId:"CUST-099",field:"status",sourceValue:"deleted",targetValue:"active",type:"delete-update"},{id:"conflict-3",table:"config",recordId:"CFG-TAX-RATE",field:"value",sourceValue:.21,targetValue:.22,type:"concurrent-update"}],estimatedDuration:45,requiresApproval:!0},ie=({branches:p=ve,sourceBranchId:f,targetBranchId:T,onPreview:v,onMerge:B,onCancel:I,className:q,style:L,"data-testid":H})=>{const[W,$]=a.useState("select"),[g,N]=a.useState(f??""),[D,O]=a.useState(T??""),[b,S]=a.useState(null),[k,C]=a.useState([]),[_,j]=a.useState("keep-source"),[M,V]=a.useState(!0),[c,m]=a.useState(!1),[x,E]=a.useState(null),[w,i]=a.useState({}),[z,U]=a.useState(!1),u=a.useMemo(()=>p.find(o=>o.id===g),[p,g]),n=a.useMemo(()=>p.find(o=>o.id===D),[p,D]),t=a.useMemo(()=>u?p.filter(o=>o.id!==g&&(ne(u.environment,o.environment)||o.environment==="development"||o.environment==="testing")):p,[p,g,u]),r=a.useMemo(()=>b?b.tables.filter(d=>k.includes(d.table)).reduce((d,y)=>({inserts:d.inserts+y.inserts,updates:d.updates+y.updates,deletes:d.deletes+y.deletes,conflicts:d.conflicts+y.conflicts}),{inserts:0,updates:0,deletes:0,conflicts:0}):{inserts:0,updates:0,deletes:0,conflicts:0},[b,k]),s=a.useMemo(()=>b?b.conflicts.filter(o=>!w[o.id]):[],[b,w]),h=a.useCallback(async()=>{U(!0),v?.(g,D),await new Promise(o=>setTimeout(o,1e3)),S(ee),C(ee.tables.filter(o=>o.selected).map(o=>o.table)),U(!1),$("preview")},[g,D,v]),A=a.useCallback(()=>{const o={sourceId:g,targetId:D,strategy:_,tables:k,createBackup:M,dryRun:c,scheduledAt:x??void 0,conflictResolutions:Object.entries(w).reduce((d,[y,G])=>({...d,[y]:{conflictId:y,strategy:G}}),{})};B?.(o)},[g,D,_,k,M,c,x,w,B]),K=(o,d)=>{i(y=>({...y,[o]:d}))},P=o=>{if(!b)return;const d={};b.conflicts.forEach(y=>{d[y.id]=o}),i(d)},l={bg:"var(--bg-elevated, #1e1e1e)",cardBg:"var(--bg-elevated, #252525)",border:"var(--bg-tertiary, #333)",text:"var(--text-primary, #e0e0e0)",textMuted:"var(--text-muted, #888)"};return e.jsxs("div",{className:`nice-data-merge-builder ${q||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:l.bg,color:l.text,fontFamily:"system-ui, sans-serif",...L},"data-testid":H,children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:`1px solid ${l.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsx("h3",{style:{margin:0,fontSize:18},children:"🔀 Data Merge"}),e.jsx("div",{style:{display:"flex",gap:8,marginLeft:"auto"},children:["select","preview","conflicts","options","confirm"].map((o,d)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:W===o?"var(--color-primary, #3b82f6)":["select","preview","conflicts","options","confirm"].indexOf(W)>d?"var(--color-success, #22c55e)":l.cardBg,display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:600},children:["select","preview","conflicts","options","confirm"].indexOf(W)>d?"✓":d+1}),d<4&&e.jsx("div",{style:{width:24,height:2,background:["select","preview","conflicts","options","confirm"].indexOf(W)>d?"var(--color-success, #22c55e)":l.border}})]},o))})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[W==="select"&&e.jsxs("div",{style:{maxWidth:600,margin:"0 auto"},children:[e.jsx("h4",{style:{marginTop:0},children:"Select Environments"}),e.jsx("p",{style:{color:l.textMuted,fontSize:13},children:"Choose the source and target environments for the merge operation."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:16,alignItems:"center",marginTop:24},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:l.textMuted},children:"Source Environment"}),e.jsxs("select",{value:g,onChange:o=>{N(o.target.value),O("")},style:{width:"100%",padding:12,borderRadius:8,border:`1px solid ${l.border}`,background:l.cardBg,color:l.text,fontSize:14},children:[e.jsx("option",{value:"",children:"Select source..."}),p.map(o=>e.jsxs("option",{value:o.id,children:[F[o.environment]," ",o.displayName]},o.id))]}),u&&e.jsxs("div",{style:{marginTop:12,padding:12,background:R[u.environment]+"20",borderRadius:8,border:`1px solid ${R[u.environment]}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:20},children:F[u.environment]}),e.jsx("span",{style:{fontWeight:600},children:u.displayName})]}),e.jsxs("div",{style:{fontSize:11,color:l.textMuted,marginTop:4},children:[u.size?.records.toLocaleString()," records"]})]})]}),e.jsx("div",{style:{fontSize:24,color:l.textMuted},children:"→"}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:l.textMuted},children:"Target Environment"}),e.jsxs("select",{value:D,onChange:o=>O(o.target.value),disabled:!g,style:{width:"100%",padding:12,borderRadius:8,border:`1px solid ${l.border}`,background:l.cardBg,color:l.text,fontSize:14,opacity:g?1:.5},children:[e.jsx("option",{value:"",children:"Select target..."}),t.map(o=>e.jsxs("option",{value:o.id,children:[F[o.environment]," ",o.displayName]},o.id))]}),n&&e.jsxs("div",{style:{marginTop:12,padding:12,background:R[n.environment]+"20",borderRadius:8,border:`1px solid ${R[n.environment]}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:20},children:F[n.environment]}),e.jsx("span",{style:{fontWeight:600},children:n.displayName}),n.isProtected&&e.jsx("span",{children:"🔒"})]}),e.jsxs("div",{style:{fontSize:11,color:l.textMuted,marginTop:4},children:[n.size?.records.toLocaleString()," records"]})]})]})]}),e.jsxs("div",{style:{marginTop:32,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:I,style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:13},children:"Cancel"}),e.jsx("button",{onClick:h,disabled:!g||!D||z,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:g&&D&&!z?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:g&&D&&!z?1:.5},children:z?"⏳ Loading...":"Preview Changes →"})]})]}),W==="preview"&&b&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:24},children:[e.jsx("button",{onClick:()=>$("select"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:12},children:"← Back"}),e.jsx("h4",{style:{margin:0},children:"Preview Changes"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:12,marginBottom:24},children:[e.jsxs("div",{style:{padding:16,background:"#22c55e20",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--color-success, #22c55e)"},children:["+",r.inserts]}),e.jsx("div",{style:{fontSize:11,color:l.textMuted},children:"Inserts"})]}),e.jsxs("div",{style:{padding:16,background:"#f59e0b20",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--color-warning, #f59e0b)"},children:["~",r.updates]}),e.jsx("div",{style:{fontSize:11,color:l.textMuted},children:"Updates"})]}),e.jsxs("div",{style:{padding:16,background:"#ef444420",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--color-error, #ef4444)"},children:["-",r.deletes]}),e.jsx("div",{style:{fontSize:11,color:l.textMuted},children:"Deletes"})]}),e.jsxs("div",{style:{padding:16,background:"#8b5cf620",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--color-accent, #8b5cf6)"},children:["⚠️ ",r.conflicts]}),e.jsx("div",{style:{fontSize:11,color:l.textMuted},children:"Conflicts"})]})]}),e.jsxs("div",{style:{marginBottom:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsxs("span",{style:{fontSize:12,color:l.textMuted},children:["Select tables to merge (",k.length," / ",b.tables.length,")"]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>C(b.tables.map(o=>o.table)),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:11},children:"Select All"}),e.jsx("button",{onClick:()=>C([]),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:11},children:"Clear"})]})]}),e.jsx("div",{style:{border:`1px solid ${l.border}`,borderRadius:8,overflow:"hidden"},children:b.tables.map(o=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",borderBottom:`1px solid ${l.border}`,cursor:"pointer",background:k.includes(o.table)?l.cardBg:"transparent"},children:[e.jsx("input",{type:"checkbox",checked:k.includes(o.table),onChange:d=>{d.target.checked?C(y=>[...y,o.table]):C(y=>y.filter(G=>G!==o.table))}}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:o.displayName}),e.jsx("div",{style:{fontSize:11,color:l.textMuted},children:o.module})]}),e.jsxs("div",{style:{display:"flex",gap:12,fontSize:12},children:[o.inserts>0&&e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["+",o.inserts]}),o.updates>0&&e.jsxs("span",{style:{color:"var(--color-warning, #f59e0b)"},children:["~",o.updates]}),o.deletes>0&&e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["-",o.deletes]}),o.conflicts>0&&e.jsxs("span",{style:{color:"var(--color-accent, #8b5cf6)"},children:["⚠️ ",o.conflicts]})]})]},o.table))})]}),e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>$("select"),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:13},children:"← Back"}),e.jsx("button",{onClick:()=>$(r.conflicts>0?"conflicts":"options"),disabled:k.length===0,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:k.length>0?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:k.length>0?1:.5},children:r.conflicts>0?"Resolve Conflicts →":"Configure Merge →"})]})]}),W==="conflicts"&&b&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:24},children:[e.jsx("button",{onClick:()=>$("preview"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:12},children:"← Back"}),e.jsxs("h4",{style:{margin:0},children:["Resolve Conflicts (",s.length," remaining)"]})]}),e.jsxs("div",{style:{padding:16,background:l.cardBg,borderRadius:8,marginBottom:24,display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:13},children:"Apply to all conflicts:"}),e.jsx("button",{onClick:()=>P("keep-source"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:12},children:"Keep Source"}),e.jsx("button",{onClick:()=>P("keep-target"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:12},children:"Keep Target"})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:b.conflicts.map(o=>{const d=!!w[o.id];return e.jsxs("div",{style:{padding:16,background:l.cardBg,borderRadius:8,border:`1px solid ${d?"var(--color-success, #22c55e)":"var(--color-accent, #8b5cf6)"}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:12},children:[e.jsx("span",{style:{fontSize:16},children:d?"✅":"⚠️"}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontWeight:500},children:[o.table,".",o.field]}),e.jsxs("div",{style:{fontSize:11,color:l.textMuted},children:["Record: ",o.recordId," • ",o.type.replace("-"," ")]})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs("div",{style:{padding:12,background:w[o.id]==="keep-source"?"#22c55e20":l.bg,borderRadius:6,border:`1px solid ${w[o.id]==="keep-source"?"var(--color-success, #22c55e)":l.border}`,cursor:"pointer"},onClick:()=>K(o.id,"keep-source"),children:[e.jsxs("div",{style:{fontSize:10,color:l.textMuted,marginBottom:4},children:["Source (",u?.displayName,")"]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13},children:String(o.sourceValue)})]}),e.jsxs("div",{style:{padding:12,background:w[o.id]==="keep-target"?"#22c55e20":l.bg,borderRadius:6,border:`1px solid ${w[o.id]==="keep-target"?"var(--color-success, #22c55e)":l.border}`,cursor:"pointer"},onClick:()=>K(o.id,"keep-target"),children:[e.jsxs("div",{style:{fontSize:10,color:l.textMuted,marginBottom:4},children:["Target (",n?.displayName,")"]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13},children:String(o.targetValue)})]})]})]},o.id)})}),e.jsxs("div",{style:{marginTop:24,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>$("preview"),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:13},children:"← Back"}),e.jsx("button",{onClick:()=>$("options"),disabled:s.length>0,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:s.length===0?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:s.length===0?1:.5},children:"Configure Merge →"})]})]}),W==="options"&&e.jsxs("div",{style:{maxWidth:500,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:24},children:[e.jsx("button",{onClick:()=>$(r.conflicts>0?"conflicts":"preview"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:12},children:"← Back"}),e.jsx("h4",{style:{margin:0},children:"Merge Options"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:M,onChange:o=>V(o.target.checked)}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13},children:"Create backup before merge"}),e.jsx("div",{style:{fontSize:11,color:l.textMuted},children:"Recommended for protected environments"})]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:c,onChange:o=>m(o.target.checked)}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13},children:"Dry run (preview only)"}),e.jsx("div",{style:{fontSize:11,color:l.textMuted},children:"Simulate merge without applying changes"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:l.textMuted},children:"Schedule merge (optional)"}),e.jsx("input",{type:"datetime-local",value:x?.toISOString().slice(0,16)??"",onChange:o=>E(o.target.value?new Date(o.target.value):null),style:{padding:10,borderRadius:6,border:`1px solid ${l.border}`,background:l.cardBg,color:l.text,fontSize:13}})]})]}),e.jsxs("div",{style:{marginTop:32,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>$(r.conflicts>0?"conflicts":"preview"),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:13},children:"← Back"}),e.jsx("button",{onClick:()=>$("confirm"),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:"Review & Confirm →"})]})]}),W==="confirm"&&b&&e.jsxs("div",{style:{maxWidth:500,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:24},children:[e.jsx("button",{onClick:()=>$("options"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:12},children:"← Back"}),e.jsx("h4",{style:{margin:0},children:"Confirm Merge"})]}),e.jsxs("div",{style:{padding:20,background:l.cardBg,borderRadius:8,marginBottom:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:16},children:[e.jsxs("div",{style:{padding:"8px 12px",background:R[u?.environment??"development"]+"30",borderRadius:6},children:[F[u?.environment??"development"]," ",u?.displayName]}),e.jsx("span",{children:"→"}),e.jsxs("div",{style:{padding:"8px 12px",background:R[n?.environment??"production"]+"30",borderRadius:6},children:[F[n?.environment??"production"]," ",n?.displayName]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px 16px",fontSize:13},children:[e.jsx("span",{style:{color:l.textMuted},children:"Tables"}),e.jsx("span",{children:k.length}),e.jsx("span",{style:{color:l.textMuted},children:"Records affected"}),e.jsx("span",{children:r.inserts+r.updates+r.deletes}),e.jsx("span",{style:{color:l.textMuted},children:"Backup"}),e.jsx("span",{children:M?"Yes":"No"}),e.jsx("span",{style:{color:l.textMuted},children:"Mode"}),e.jsx("span",{children:c?"Dry run":"Apply changes"}),x&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:l.textMuted},children:"Scheduled"}),e.jsx("span",{children:x.toLocaleString()})]})]})]}),n?.isProtected&&e.jsx("div",{style:{padding:12,background:"#f59e0b20",border:"1px solid #f59e0b",borderRadius:6,marginBottom:24,fontSize:12},children:"⚠️ Target environment is protected and may require approval."}),e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:I,style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${l.border}`,background:"transparent",color:l.text,cursor:"pointer",fontSize:13},children:"Cancel"}),e.jsx("button",{onClick:A,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--color-success, #22c55e)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:c?"🔍 Run Dry Merge":x?"📅 Schedule Merge":"🔀 Execute Merge"})]})]})]})]})},je=Object.freeze(Object.defineProperty({__proto__:null,NiceDataMergeBuilder:ie},Symbol.toStringTag,{value:"Module"})),Se=[{id:"conflict-1",table:"customers",tableName:"Customers",recordId:"CUST-042",recordLabel:"Acme Corp",type:"concurrent-update",severity:"high",fields:[{field:"email",fieldLabel:"Email Address",dataType:"string",sourceValue:"new.contact@acme.com",targetValue:"old.contact@acme.com",baseValue:"original@acme.com"},{field:"phone",fieldLabel:"Phone Number",dataType:"string",sourceValue:"+1-555-NEW-0000",targetValue:"+1-555-OLD-0000",baseValue:"+1-555-000-0000"},{field:"credit_limit",fieldLabel:"Credit Limit",dataType:"number",sourceValue:75e3,targetValue:5e4,baseValue:25e3}],metadata:{sourceModifiedAt:new Date("2024-01-15T10:30:00"),sourceModifiedBy:"john.dev",targetModifiedAt:new Date("2024-01-15T14:45:00"),targetModifiedBy:"mary.sales"},suggestion:"keep-target",suggestionReason:"Target was modified more recently"},{id:"conflict-2",table:"products",tableName:"Products",recordId:"PRD-1337",recordLabel:"Widget Pro Max",type:"delete-update",severity:"critical",fields:[{field:"_deleted",fieldLabel:"Record Status",dataType:"boolean",sourceValue:!0,targetValue:!1},{field:"name",fieldLabel:"Product Name",dataType:"string",sourceValue:"[DELETED]",targetValue:"Widget Pro Max v2"}],suggestion:"keep-target",suggestionReason:"Record was updated in target, deletion may be accidental"},{id:"conflict-3",table:"config",tableName:"Configuration",recordId:"CFG-TAX-RATE",recordLabel:"Tax Rate Settings",type:"concurrent-update",severity:"medium",fields:[{field:"value",fieldLabel:"Value",dataType:"number",sourceValue:.21,targetValue:.22,baseValue:.2},{field:"effective_date",fieldLabel:"Effective Date",dataType:"date",sourceValue:"2024-02-01",targetValue:"2024-03-01"}],suggestion:"keep-source",suggestionReason:"Source has the newer effective date"}],X={"concurrent-update":{label:"Concurrent Update",icon:"⚡",description:"Record was modified in both environments"},"delete-update":{label:"Delete vs Update",icon:"🗑️",description:"Record deleted in source but updated in target"},"update-delete":{label:"Update vs Delete",icon:"✏️",description:"Record updated in source but deleted in target"},"constraint-violation":{label:"Constraint Violation",icon:"🚫",description:"Change violates database constraints"},"unique-key-conflict":{label:"Unique Key Conflict",icon:"🔑",description:"Duplicate unique key detected"},"foreign-key-missing":{label:"Missing FK Reference",icon:"🔗",description:"Referenced record does not exist"},"type-mismatch":{label:"Type Mismatch",icon:"⚠️",description:"Data type incompatibility"},"schema-change":{label:"Schema Change",icon:"📋",description:"Schema differs between environments"}},J={low:"var(--color-success, #22c55e)",medium:"var(--color-warning, #f59e0b)",high:"#f97316",critical:"var(--color-error, #ef4444)"},le=({conflicts:p=Se,sourceEnvironment:f="development",targetEnvironment:T="uat",showSuggestions:v=!0,allowCustomValues:B=!0,onResolve:I,onSkip:q,onCancel:L,className:H,style:W,"data-testid":$})=>{const[g,N]=a.useState(0),[D,O]=a.useState({}),[b,S]=a.useState({}),[k,C]=a.useState(null),[_,j]=a.useState(""),[M,V]=a.useState("single"),c=p[g],m=a.useMemo(()=>Object.keys(D).length,[D]),x=a.useMemo(()=>{if(!c)return!1;const r=b[c.id]||{};return c.fields.every(s=>r[s.field]?.resolution)},[c,b]),E=a.useCallback(r=>{if(b[r.id])return;const s={};r.fields.forEach(h=>{s[h.field]={resolution:"source",value:h.sourceValue}}),S(h=>({...h,[r.id]:s}))},[b]);a.useEffect(()=>{c&&E(c)},[c,E]);const w=(r,s,h)=>{if(!c)return;const A=c.fields.find(P=>P.field===r);if(!A)return;const K=s==="source"?A.sourceValue:s==="target"?A.targetValue:h;S(P=>({...P,[c.id]:{...P[c.id],[r]:{resolution:s,value:K}}}))},i=r=>{if(!c)return;const s={};c.fields.forEach(h=>{s[h.field]={resolution:r,value:r==="source"?h.sourceValue:h.targetValue}}),S(h=>({...h,[c.id]:s}))},z=()=>{if(!c||!x)return;const r={conflictId:c.id,strategy:"manual",fieldResolutions:b[c.id]};O(s=>({...s,[c.id]:r})),g<p.length-1&&N(g+1)},U=()=>{c&&(q?.(c.id),g<p.length-1&&N(g+1))},u=()=>{const r=Object.values(D);I?.(r)},n=(r,s)=>r===null?"null":r===void 0?"undefined":s==="date"?new Date(r).toLocaleDateString():s==="number"?Number(r).toLocaleString():typeof r=="boolean"?r?"true":"false":String(r),t={bg:"var(--bg-elevated, #1e1e1e)",cardBg:"var(--bg-elevated, #252525)",border:"var(--bg-tertiary, #333)",text:"var(--text-primary, #e0e0e0)",textMuted:"var(--text-muted, #888)",source:R[f],target:R[T]};return p.length===0?e.jsxs("div",{className:`nice-data-conflict-resolver ${H||""}`,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",background:t.bg,color:t.text,fontFamily:"system-ui, sans-serif",padding:40,...W},"data-testid":$,children:[e.jsx("div",{style:{fontSize:48,marginBottom:16},children:"✅"}),e.jsx("h3",{style:{margin:0},children:"No Conflicts"}),e.jsx("p",{style:{color:t.textMuted,marginTop:8},children:"All data is compatible for merge."})]}):e.jsxs("div",{className:`nice-data-conflict-resolver ${H||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:t.bg,color:t.text,fontFamily:"system-ui, sans-serif",...W},"data-testid":$,children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsx("h3",{style:{margin:0,fontSize:18},children:"⚠️ Resolve Conflicts"}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:12},children:[e.jsxs("div",{style:{fontSize:13,color:t.textMuted},children:["Resolved: ",e.jsx("strong",{style:{color:t.text},children:m})," /"," ",p.length]}),e.jsx("div",{style:{width:100,height:6,background:t.cardBg,borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${m/p.length*100}%`,height:"100%",background:"var(--color-success, #22c55e)",transition:"width 0.2s"}})})]}),e.jsxs("div",{style:{display:"flex",border:`1px solid ${t.border}`,borderRadius:6,overflow:"hidden"},children:[e.jsx("button",{onClick:()=>V("single"),style:{padding:"6px 12px",border:"none",background:M==="single"?t.cardBg:"transparent",color:t.text,cursor:"pointer",fontSize:12},children:"Single"}),e.jsx("button",{onClick:()=>V("list"),style:{padding:"6px 12px",border:"none",borderLeft:`1px solid ${t.border}`,background:M==="list"?t.cardBg:"transparent",color:t.text,cursor:"pointer",fontSize:12},children:"List"})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[M==="single"&&c&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:20},children:[e.jsx("button",{onClick:()=>N(Math.max(0,g-1)),disabled:g===0,style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:g>0?"pointer":"not-allowed",opacity:g>0?1:.5,fontSize:12},children:"← Previous"}),e.jsxs("span",{style:{fontSize:13,color:t.textMuted},children:["Conflict ",g+1," of ",p.length]}),e.jsx("button",{onClick:()=>N(Math.min(p.length-1,g+1)),disabled:g===p.length-1,style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:g<p.length-1?"pointer":"not-allowed",opacity:g<p.length-1?1:.5,fontSize:12},children:"Next →"}),D[c.id]&&e.jsx("span",{style:{marginLeft:"auto",padding:"4px 8px",background:"#22c55e30",color:"var(--color-success, #22c55e)",borderRadius:4,fontSize:11},children:"✓ Resolved"})]}),e.jsxs("div",{style:{padding:16,background:t.cardBg,borderRadius:8,marginBottom:20},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:24},children:X[c.type].icon}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{fontWeight:600,fontSize:15},children:[c.tableName,":"," ",c.recordLabel??c.recordId]}),e.jsxs("div",{style:{fontSize:12,color:t.textMuted},children:[X[c.type].label," —"," ",X[c.type].description]})]}),e.jsx("div",{style:{padding:"4px 8px",background:J[c.severity]+"30",color:J[c.severity],borderRadius:4,fontSize:10,fontWeight:600,textTransform:"uppercase"},children:c.severity})]}),c.metadata&&e.jsxs("div",{style:{display:"flex",gap:24,marginTop:12,paddingTop:12,borderTop:`1px solid ${t.border}`,fontSize:11,color:t.textMuted},children:[c.metadata.sourceModifiedAt&&e.jsxs("span",{children:["Source modified: ",c.metadata.sourceModifiedAt.toLocaleString()," ","by ",c.metadata.sourceModifiedBy]}),c.metadata.targetModifiedAt&&e.jsxs("span",{children:["Target modified: ",c.metadata.targetModifiedAt.toLocaleString()," ","by ",c.metadata.targetModifiedBy]})]}),v&&c.suggestion&&e.jsxs("div",{style:{marginTop:12,padding:12,background:"#3b82f620",border:"1px solid #3b82f6",borderRadius:6,fontSize:12},children:[e.jsx("strong",{children:"💡 Suggestion:"})," ",c.suggestionReason,e.jsx("button",{onClick:()=>i(c.suggestion==="keep-source"?"source":"target"),style:{marginLeft:12,padding:"4px 8px",borderRadius:4,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Apply"})]})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:16},children:[e.jsx("span",{style:{fontSize:12,color:t.textMuted,lineHeight:"28px"},children:"Apply to all fields:"}),e.jsxs("button",{onClick:()=>i("source"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.source}`,background:`${t.source}20`,color:t.text,cursor:"pointer",fontSize:12,display:"flex",alignItems:"center",gap:6},children:[F[f]," Keep Source"]}),e.jsxs("button",{onClick:()=>i("target"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.target}`,background:`${t.target}20`,color:t.text,cursor:"pointer",fontSize:12,display:"flex",alignItems:"center",gap:6},children:[F[T]," Keep Target"]})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:c.fields.map(r=>{const s=b[c.id]?.[r.field],h=k===`${c.id}-${r.field}`;return e.jsxs("div",{style:{background:t.cardBg,borderRadius:8,overflow:"hidden",border:`1px solid ${s?.resolution?"var(--color-success, #22c55e)":t.border}`},children:[e.jsxs("div",{style:{padding:"10px 16px",background:s?.resolution?"#22c55e10":"transparent",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:s?.resolution?"var(--color-success, #22c55e)":t.textMuted},children:s?.resolution?"✓":"○"}),e.jsx("span",{style:{fontWeight:500},children:r.fieldLabel}),e.jsxs("span",{style:{fontSize:11,color:t.textMuted},children:["(",r.field,")"]}),e.jsx("span",{style:{marginLeft:"auto",fontSize:10,padding:"2px 6px",background:t.bg,borderRadius:4,color:t.textMuted},children:r.dataType})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1,background:t.border},children:[e.jsxs("div",{onClick:()=>w(r.field,"source"),style:{padding:16,background:s?.resolution==="source"?`${t.source}20`:t.bg,cursor:"pointer",border:s?.resolution==="source"?`2px solid ${t.source}`:"2px solid transparent"},children:[e.jsxs("div",{style:{fontSize:10,color:t.source,marginBottom:8,display:"flex",alignItems:"center",gap:4},children:[F[f]," Source",s?.resolution==="source"&&e.jsx("span",{style:{marginLeft:4},children:"✓"})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:14,wordBreak:"break-all"},children:n(r.sourceValue,r.dataType)})]}),e.jsxs("div",{onClick:()=>w(r.field,"target"),style:{padding:16,background:s?.resolution==="target"?`${t.target}20`:t.bg,cursor:"pointer",border:s?.resolution==="target"?`2px solid ${t.target}`:"2px solid transparent"},children:[e.jsxs("div",{style:{fontSize:10,color:t.target,marginBottom:8,display:"flex",alignItems:"center",gap:4},children:[F[T]," Target",s?.resolution==="target"&&e.jsx("span",{style:{marginLeft:4},children:"✓"})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:14,wordBreak:"break-all"},children:n(r.targetValue,r.dataType)})]})]}),B&&e.jsxs("div",{style:{padding:12,background:s?.resolution==="custom"?"#8b5cf620":t.bg,borderTop:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:12,color:t.textMuted},children:"Custom value:"}),h?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:_,onChange:A=>j(A.target.value),style:{flex:1,padding:8,borderRadius:4,border:`1px solid ${t.border}`,background:t.cardBg,color:t.text,fontFamily:"monospace",fontSize:13},autoFocus:!0}),e.jsx("button",{onClick:()=>{w(r.field,"custom",_),C(null)},style:{padding:"6px 12px",borderRadius:4,border:"none",background:"var(--color-accent, #8b5cf6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"Apply"}),e.jsx("button",{onClick:()=>C(null),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:"pointer",fontSize:12},children:"Cancel"})]}):e.jsx("button",{onClick:()=>{j(s?.resolution==="custom"?String(s.value):String(r.sourceValue)),C(`${c.id}-${r.field}`)},style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.border}`,background:s?.resolution==="custom"?"#8b5cf620":"transparent",color:t.text,cursor:"pointer",fontSize:12},children:s?.resolution==="custom"?`Using: ${n(s.value,r.dataType)}`:"Enter custom..."})]})]},r.field)})}),e.jsxs("div",{style:{marginTop:24,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:U,style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:"pointer",fontSize:13},children:"Skip"}),e.jsx("button",{onClick:z,disabled:!x,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--color-success, #22c55e)",color:"var(--bg-primary, #fff)",cursor:x?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:x?1:.5},children:g<p.length-1?"Confirm & Next →":"Confirm"})]})]}),M==="list"&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:p.map((r,s)=>{const h=!!D[r.id];return e.jsxs("div",{onClick:()=>{N(s),V("single")},style:{padding:16,background:t.cardBg,borderRadius:8,cursor:"pointer",border:`1px solid ${h?"var(--color-success, #22c55e)":t.border}`,display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:20},children:h?"✅":X[r.type].icon}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{fontWeight:500},children:[r.tableName,": ",r.recordLabel??r.recordId]}),e.jsxs("div",{style:{fontSize:11,color:t.textMuted},children:[r.fields.length," fields • ",X[r.type].label]})]}),e.jsx("div",{style:{padding:"4px 8px",background:J[r.severity]+"30",color:J[r.severity],borderRadius:4,fontSize:10,fontWeight:600,textTransform:"uppercase"},children:r.severity})]},r.id)})})]}),e.jsxs("div",{style:{padding:"16px 20px",borderTop:`1px solid ${t.border}`,display:"flex",justifyContent:"space-between"},children:[e.jsx("button",{onClick:L,style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:"pointer",fontSize:13},children:"Cancel"}),e.jsxs("button",{onClick:u,disabled:m===0,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:m>0?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:m>0?1:.5},children:["Finish (",m," resolved)"]})]})]})},ke=Object.freeze(Object.defineProperty({__proto__:null,NiceDataConflictResolver:le},Symbol.toStringTag,{value:"Module"})),Ce=[{id:"snap-001",name:"Q1 Release Backup",description:"Backup before Q1 2024 release deployment",environment:"production",createdAt:new Date("2024-01-15T06:00:00"),createdBy:{id:"admin",name:"Admin"},size:{records:265770,bytes:2921e5},type:"manual",status:"ready",tags:["release","q1-2024"]},{id:"snap-002",name:"Daily Backup 2024-01-20",environment:"production",createdAt:new Date("2024-01-20T02:00:00"),createdBy:{id:"system",name:"System"},size:{records:267e3,bytes:2942e5},type:"scheduled",status:"ready",expiresAt:new Date("2024-02-20T02:00:00")},{id:"snap-003",name:"Pre-Merge: UAT to Prod",description:"Automatic backup before merge operation",environment:"production",createdAt:new Date("2024-01-22T10:30:00"),createdBy:{id:"system",name:"System"},size:{records:267500,bytes:295e6},type:"pre-merge",status:"locked",tags:["merge","automatic"]},{id:"snap-004",name:"Selected Tables Only",description:"Partial snapshot of CRM module",environment:"production",createdAt:new Date("2024-01-23T14:00:00"),createdBy:{id:"dev1",name:"John"},size:{records:15e3,bytes:185e5},type:"manual",status:"ready",tables:["customers","contacts","opportunities"],tags:["crm","partial"]},{id:"snap-005",name:"Failed Backup",environment:"production",createdAt:new Date("2024-01-24T02:00:00"),createdBy:{id:"system",name:"System"},size:{records:0,bytes:0},type:"scheduled",status:"failed"}],ze=[{id:"sched-daily",name:"Daily Backup",cron:"0 2 * * *",enabled:!0,nextRun:new Date(Date.now()+480*60*1e3),lastRun:new Date(Date.now()-960*60*1e3),retainCount:7},{id:"sched-weekly",name:"Weekly Full Backup",cron:"0 4 * * 0",enabled:!0,nextRun:new Date(Date.now()+4320*60*1e3),lastRun:new Date(Date.now()-5760*60*1e3),retainCount:4},{id:"sched-monthly",name:"Monthly Archive",cron:"0 6 1 * *",enabled:!1,lastRun:new Date(Date.now()-360*60*60*1e3),retainCount:12}],Be={enabled:!0,maxCount:30,maxAgeDays:90,keepTagged:!0,keepLocked:!0},te=p=>{if(p===0)return"0 B";const f=1024,T=["B","KB","MB","GB","TB"],v=Math.floor(Math.log(p)/Math.log(f));return parseFloat((p/Math.pow(f,v)).toFixed(1))+" "+T[v]},re=p=>{const T=new Date().getTime()-p.getTime(),v=Math.floor(T/(1e3*60*60)),B=Math.floor(v/24);return B>0?`${B} day${B>1?"s":""} ago`:v>0?`${v} hour${v>1?"s":""} ago`:"Just now"},Me=p=>{const f=p.split(" ");if(f.length!==5)return p;const[T,v,B,I,q]=f;return B==="*"&&I==="*"&&q==="*"?`Daily at ${v.padStart(2,"0")}:${T.padStart(2,"0")}`:B==="*"&&I==="*"?`Weekly on ${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][parseInt(q)]} at ${v.padStart(2,"0")}:${T.padStart(2,"0")}`:I==="*"?`Monthly on day ${B} at ${v.padStart(2,"0")}:${T.padStart(2,"0")}`:p},we={creating:{icon:"⏳",color:"var(--color-warning, #f59e0b)",label:"Creating"},ready:{icon:"✅",color:"var(--color-success, #22c55e)",label:"Ready"},failed:{icon:"❌",color:"var(--color-error, #ef4444)",label:"Failed"},expired:{icon:"⏰",color:"var(--text-muted, #888)",label:"Expired"},locked:{icon:"🔒",color:"var(--color-primary, #3b82f6)",label:"Locked"}},Re={manual:{icon:"👤",label:"Manual"},scheduled:{icon:"📅",label:"Scheduled"},"pre-merge":{icon:"🔀",label:"Pre-Merge"},"pre-restore":{icon:"⏮️",label:"Pre-Restore"}},ae=({environment:p="production",snapshots:f=Ce,retentionPolicy:T=Be,schedules:v=ze,onCreateSnapshot:B,onRestoreSnapshot:I,onDeleteSnapshot:q,onCompareSnapshots:L,onExportSnapshot:H,onUpdateRetentionPolicy:W,onUpdateSchedules:$,className:g,style:N,"data-testid":D})=>{const[O,b]=a.useState("snapshots"),[S,k]=a.useState(!1),[C,_]=a.useState([]),[j,M]=a.useState(""),[V,c]=a.useState(""),[m,x]=a.useState(T),[E,w]=a.useState(v),i=a.useMemo(()=>{const t=f.filter(s=>s.status==="ready").length,r=f.reduce((s,h)=>s+h.size.bytes,0);return{total:f.length,ready:t,totalSize:r}},[f]),z=()=>{B?.({name:j||`Snapshot ${new Date().toISOString()}`,description:V}),k(!1),M(""),c("")},U=()=>{C.length===2&&L?.(C[0],C[1])},u=t=>{const r=E.map(s=>s.id===t?{...s,enabled:!s.enabled}:s);w(r),$?.(r)},n={bg:"var(--bg-elevated, #1e1e1e)",cardBg:"var(--bg-elevated, #252525)",border:"var(--bg-tertiary, #333)",text:"var(--text-primary, #e0e0e0)",textMuted:"var(--text-muted, #888)",env:R[p]};return e.jsxs("div",{className:`nice-data-snapshot ${g||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:n.bg,color:n.text,fontFamily:"system-ui, sans-serif",...N},"data-testid":D,children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:`1px solid ${n.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsx("h3",{style:{margin:0,fontSize:18},children:"📸 Snapshots"}),e.jsxs("div",{style:{padding:"4px 10px",background:n.env+"30",borderRadius:4,fontSize:12,display:"flex",alignItems:"center",gap:6},children:[F[p]," ",p.charAt(0).toUpperCase()+p.slice(1)]}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:16,fontSize:12,color:n.textMuted},children:[e.jsxs("span",{children:[e.jsx("strong",{style:{color:n.text},children:i.total})," snapshots"]}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:n.text},children:te(i.totalSize)})," total"]})]}),e.jsx("button",{onClick:()=>k(!0),style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500,display:"flex",alignItems:"center",gap:6},children:"📸 Create Snapshot"})]}),e.jsx("div",{style:{display:"flex",borderBottom:`1px solid ${n.border}`,padding:"0 20px"},children:["snapshots","schedules","settings"].map(t=>e.jsxs("button",{onClick:()=>b(t),style:{padding:"12px 20px",border:"none",background:"transparent",color:O===t?n.text:n.textMuted,cursor:"pointer",fontSize:13,fontWeight:O===t?600:400,borderBottom:O===t?"2px solid #3b82f6":"2px solid transparent",marginBottom:-1},children:[t==="snapshots"&&"📁 Snapshots",t==="schedules"&&"📅 Schedules",t==="settings"&&"⚙️ Settings"]},t))}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[O==="snapshots"&&e.jsxs("div",{children:[C.length>0&&e.jsxs("div",{style:{padding:12,background:n.cardBg,borderRadius:8,marginBottom:16,display:"flex",alignItems:"center",gap:12},children:[e.jsxs("span",{style:{fontSize:13},children:[C.length," selected"]}),C.length===2&&e.jsx("button",{onClick:U,style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${n.border}`,background:"transparent",color:n.text,cursor:"pointer",fontSize:12},children:"Compare"}),e.jsx("button",{onClick:()=>_([]),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${n.border}`,background:"transparent",color:n.text,cursor:"pointer",fontSize:12,marginLeft:"auto"},children:"Clear"})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:f.map(t=>{const r=C.includes(t.id),s=we[t.status],h=Re[t.type];return e.jsx("div",{style:{padding:16,background:n.cardBg,borderRadius:8,border:`1px solid ${r?"var(--color-primary, #3b82f6)":n.border}`},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e.jsx("input",{type:"checkbox",checked:r,onChange:A=>{A.target.checked?_(K=>[...K,t.id]):_(K=>K.filter(P=>P!==t.id))},style:{marginTop:4}}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[e.jsx("span",{style:{fontWeight:600},children:t.name}),e.jsxs("span",{style:{padding:"2px 6px",background:s.color+"20",color:s.color,borderRadius:4,fontSize:10},children:[s.icon," ",s.label]}),e.jsxs("span",{style:{padding:"2px 6px",background:n.bg,color:n.textMuted,borderRadius:4,fontSize:10},children:[h.icon," ",h.label]})]}),t.description&&e.jsx("div",{style:{fontSize:12,color:n.textMuted,marginBottom:8},children:t.description}),e.jsxs("div",{style:{display:"flex",gap:16,fontSize:11,color:n.textMuted},children:[e.jsx("span",{children:re(t.createdAt)}),e.jsxs("span",{children:["by ",t.createdBy.name]}),e.jsxs("span",{children:[t.size.records.toLocaleString()," records"]}),e.jsx("span",{children:te(t.size.bytes)}),t.tables&&e.jsxs("span",{children:[t.tables.length," tables"]}),t.expiresAt&&e.jsxs("span",{style:{color:"var(--color-warning, #f59e0b)"},children:["Expires: ",t.expiresAt.toLocaleDateString()]})]}),t.tags&&t.tags.length>0&&e.jsx("div",{style:{display:"flex",gap:6,marginTop:8},children:t.tags.map(A=>e.jsxs("span",{style:{padding:"2px 8px",background:"#8b5cf620",color:"var(--color-accent, #8b5cf6)",borderRadius:4,fontSize:10},children:["#",A]},A))})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[t.status==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>I?.(t.id),title:"Restore",style:{padding:8,borderRadius:4,border:`1px solid ${n.border}`,background:"transparent",color:n.text,cursor:"pointer",fontSize:14},children:"⏮️"}),e.jsx("button",{onClick:()=>H?.(t.id,"sql"),title:"Export",style:{padding:8,borderRadius:4,border:`1px solid ${n.border}`,background:"transparent",color:n.text,cursor:"pointer",fontSize:14},children:"📤"})]}),t.status!=="locked"&&e.jsx("button",{onClick:()=>q?.(t.id),title:"Delete",style:{padding:8,borderRadius:4,border:`1px solid ${n.border}`,background:"transparent",color:"var(--color-error, #ef4444)",cursor:"pointer",fontSize:14},children:"🗑️"})]})]})},t.id)})})]}),O==="schedules"&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[E.map(t=>e.jsx("div",{style:{padding:16,background:n.cardBg,borderRadius:8,border:`1px solid ${n.border}`,opacity:t.enabled?1:.6},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("label",{className:"toggle",style:{display:"flex",alignItems:"center",cursor:"pointer"},children:e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:()=>u(t.id),style:{width:16,height:16}})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:t.name}),e.jsxs("div",{style:{fontSize:12,color:n.textMuted},children:[Me(t.cron)," • Keep ",t.retainCount," snapshots"]})]}),e.jsxs("div",{style:{textAlign:"right",fontSize:11,color:n.textMuted},children:[t.enabled&&t.nextRun&&e.jsxs("div",{children:["Next: ",t.nextRun.toLocaleString()]}),t.lastRun&&e.jsxs("div",{children:["Last: ",re(t.lastRun)]})]})]})},t.id)),e.jsx("button",{style:{padding:16,borderRadius:8,border:`1px dashed ${n.border}`,background:"transparent",color:n.textMuted,cursor:"pointer",fontSize:13},children:"+ Add Schedule"})]}),O==="settings"&&e.jsxs("div",{style:{maxWidth:500},children:[e.jsx("h4",{style:{marginTop:0},children:"Retention Policy"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:m.enabled,onChange:t=>x({...m,enabled:t.target.checked})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13},children:"Enable automatic cleanup"}),e.jsx("div",{style:{fontSize:11,color:n.textMuted},children:"Automatically delete old snapshots based on policy"})]})]}),m.enabled&&e.jsxs("div",{style:{padding:16,background:n.cardBg,borderRadius:8,display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:n.textMuted},children:"Maximum number of snapshots"}),e.jsx("input",{type:"number",value:m.maxCount??"",onChange:t=>x({...m,maxCount:parseInt(t.target.value)||void 0}),placeholder:"Unlimited",style:{padding:10,borderRadius:6,border:`1px solid ${n.border}`,background:n.bg,color:n.text,fontSize:13,width:150}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:n.textMuted},children:"Maximum age (days)"}),e.jsx("input",{type:"number",value:m.maxAgeDays??"",onChange:t=>x({...m,maxAgeDays:parseInt(t.target.value)||void 0}),placeholder:"Unlimited",style:{padding:10,borderRadius:6,border:`1px solid ${n.border}`,background:n.bg,color:n.text,fontSize:13,width:150}})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:m.keepTagged??!1,onChange:t=>x({...m,keepTagged:t.target.checked})}),e.jsx("span",{style:{fontSize:13},children:"Keep tagged snapshots"})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:m.keepLocked??!1,onChange:t=>x({...m,keepLocked:t.target.checked})}),e.jsx("span",{style:{fontSize:13},children:"Keep locked snapshots"})]})]}),e.jsx("button",{onClick:()=>W?.(m),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500,alignSelf:"flex-start"},children:"Save Policy"})]})]})]}),S&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>k(!1),children:e.jsxs("div",{style:{background:n.cardBg,borderRadius:12,padding:24,width:400},onClick:t=>t.stopPropagation(),children:[e.jsx("h4",{style:{margin:"0 0 16px"},children:"📸 Create Snapshot"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:n.textMuted},children:"Snapshot Name"}),e.jsx("input",{type:"text",value:j,onChange:t=>M(t.target.value),placeholder:`Snapshot ${new Date().toISOString().split("T")[0]}`,style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${n.border}`,background:n.bg,color:n.text,fontSize:13,boxSizing:"border-box"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:n.textMuted},children:"Description (optional)"}),e.jsx("textarea",{value:V,onChange:t=>c(t.target.value),placeholder:"What's this snapshot for?",rows:3,style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${n.border}`,background:n.bg,color:n.text,fontSize:13,resize:"vertical",boxSizing:"border-box"}})]})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginTop:24,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>k(!1),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${n.border}`,background:"transparent",color:n.text,cursor:"pointer",fontSize:13},children:"Cancel"}),e.jsx("button",{onClick:z,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:"Create"})]})]})})]})},Te=Object.freeze(Object.defineProperty({__proto__:null,NiceDataSnapshot:ae},Symbol.toStringTag,{value:"Module"}));exports.NiceDataBranchGraph=se;exports.NiceDataBranchGraph$1=me;exports.NiceDataBranchManager=oe;exports.NiceDataBranchManager$1=he;exports.NiceDataConflictResolver=le;exports.NiceDataConflictResolver$1=ke;exports.NiceDataDiffViewer=de;exports.NiceDataDiffViewer$1=fe;exports.NiceDataMergeBuilder=ie;exports.NiceDataMergeBuilder$1=je;exports.NiceDataSnapshot=ae;exports.NiceDataSnapshot$1=Te;
|