@nice2dev/ui 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/CHANGELOG.md +476 -0
  2. package/dist/NiceButton-CnAIqCbd.js +101 -0
  3. package/dist/NiceButton-DzCqkG5a.cjs +1 -0
  4. package/dist/NiceCodeEditor-C43xFG8v.cjs +260 -0
  5. package/dist/NiceCodeEditor-CK6B54mu.js +1215 -0
  6. package/dist/NiceCodeEditor-CspuYLh6.js +1174 -0
  7. package/dist/NiceCodeEditor-bJReZPDO.cjs +268 -0
  8. package/dist/NiceColorPicker-BV3olE3M.cjs +1 -0
  9. package/dist/NiceColorPicker-CyY-4q89.js +552 -0
  10. package/dist/NiceDataGrid-BQIqitMM.cjs +10 -0
  11. package/dist/NiceDataGrid-C1eI6Pso.js +2267 -0
  12. package/dist/NiceDataGrid-CrD4HPlO.cjs +10 -0
  13. package/dist/NiceDataGrid-Dfg1DVbU.js +2224 -0
  14. package/dist/NiceForm-CISJyzoW.cjs +1 -0
  15. package/dist/NiceForm-CfAPcXdX.cjs +1 -0
  16. package/dist/NiceForm-DfKYNQti.js +5017 -0
  17. package/dist/NiceForm-DmH6k1b_.js +4775 -0
  18. package/dist/NiceGantt-CHnq-n8f.cjs +1 -0
  19. package/dist/NiceGantt-CX3jVNaF.js +330 -0
  20. package/dist/NiceGantt-TEXbAELi.js +333 -0
  21. package/dist/NiceGantt-s2cgt5zD.cjs +1 -0
  22. package/dist/NiceHtmlEditor-CDZeF_zG.cjs +10 -0
  23. package/dist/NiceHtmlEditor-CdWgddg3.js +901 -0
  24. package/dist/NiceHtmlEditor-DeK0Of98.js +883 -0
  25. package/dist/NiceHtmlEditor-DvVxl4Fu.cjs +10 -0
  26. package/dist/NiceLoginForm-CHXbz0eu.js +747 -0
  27. package/dist/NiceLoginForm-DRPldHXa.js +808 -0
  28. package/dist/NiceLoginForm-IGLUCQUE.cjs +1 -0
  29. package/dist/NiceLoginForm-ix6J1adA.cjs +1 -0
  30. package/dist/NiceMention-CgDp0sl9.cjs +430 -0
  31. package/dist/NiceMention-DBvFvx71.js +11653 -0
  32. package/dist/NiceMention-DKhk3xdM.js +11321 -0
  33. package/dist/NiceMention-wp1AJ5oh.cjs +430 -0
  34. package/dist/NiceMention.css +1 -1
  35. package/dist/NiceModal-BbQwiEOp.cjs +1 -0
  36. package/dist/NiceModal-BlYhFDhP.js +80 -0
  37. package/dist/NiceModal-DQEfTcnZ.js +85 -0
  38. package/dist/NiceModal-DmWz2PDM.cjs +1 -0
  39. package/dist/NiceModuleLifecyclePanel-22CEEVbA.cjs +1 -0
  40. package/dist/NiceModuleLifecyclePanel-BCd9Wv5Y.js +6825 -0
  41. package/dist/NiceModuleLifecyclePanel-D8EoXqBy.cjs +1 -0
  42. package/dist/NiceModuleLifecyclePanel-SN6G7t64.js +7189 -0
  43. package/dist/NiceModuleLifecyclePanel.css +1 -1
  44. package/dist/NicePagination-BFGt1v0a.js +165 -0
  45. package/dist/NicePagination-BJS65foT.js +200 -0
  46. package/dist/NicePagination-D_3GfWp5.cjs +1 -0
  47. package/dist/NicePagination-DltL3-Sz.cjs +1 -0
  48. package/dist/NicePivotGrid-BD87Na7P.js +1163 -0
  49. package/dist/NicePivotGrid-BPmnvbPQ.cjs +152 -0
  50. package/dist/NicePivotGrid-D_kRF1Dt.js +1180 -0
  51. package/dist/NicePivotGrid-DqluEkCI.cjs +152 -0
  52. package/dist/NiceSavedQueryPanel-BSTiZvFg.js +5130 -0
  53. package/dist/NiceSavedQueryPanel-C2Tn1cMW.js +5311 -0
  54. package/dist/NiceSavedQueryPanel-DDKtL1AA.cjs +586 -0
  55. package/dist/NiceSavedQueryPanel-DrR3sw4T.cjs +586 -0
  56. package/dist/NiceScheduler-DvxJ8N0I.js +1698 -0
  57. package/dist/NiceScheduler-GJLvkXJ3.cjs +5 -0
  58. package/dist/NiceScheduler-TIksdF0k.cjs +5 -0
  59. package/dist/NiceScheduler-UT49u2Vq.js +1710 -0
  60. package/dist/NiceSelect-CdUHd8rj.cjs +1 -0
  61. package/dist/NiceSelect-fOelG_QB.js +495 -0
  62. package/dist/NiceWindow-CqSsTjrS.cjs +1 -0
  63. package/dist/NiceWindow-DZLPhXbR.js +2223 -0
  64. package/dist/charts-BYQwl_GS.js +4789 -0
  65. package/dist/charts-BpELGDXh.cjs +768 -0
  66. package/dist/charts-C6iOu0H6.cjs +768 -0
  67. package/dist/charts-M6LuVI7F.js +4776 -0
  68. package/dist/charts.cjs +1 -1
  69. package/dist/charts.d.ts +1 -29
  70. package/dist/charts.mjs +1 -1
  71. package/dist/core-lazy-B_laOXNf.cjs +1 -0
  72. package/dist/core-lazy-Ctin_LwS.cjs +1 -0
  73. package/dist/core-lazy-VQEjdz0L.js +351 -0
  74. package/dist/core-lazy-iDiropM6.js +351 -0
  75. package/dist/data-branching-7rpktFJ-.cjs +1 -0
  76. package/dist/data-branching-BS0aFUMu.js +6428 -0
  77. package/dist/data-branching-BgIAw01q.cjs +1 -0
  78. package/dist/data-branching-bvB9K6KS.js +6386 -0
  79. package/dist/data-branching.cjs +1 -1
  80. package/dist/data-branching.mjs +1 -1
  81. package/dist/data.cjs +1 -1
  82. package/dist/data.mjs +3 -3
  83. package/dist/devops-Bp-_aA-9.js +8682 -0
  84. package/dist/devops-CFytAJQr.cjs +18 -0
  85. package/dist/devops-CW8YY_zA.js +9122 -0
  86. package/dist/devops-CXBSjnyX.cjs +17 -0
  87. package/dist/devops.cjs +1 -1
  88. package/dist/devops.css +1 -0
  89. package/dist/devops.mjs +5 -5
  90. package/dist/editors.cjs +1 -1
  91. package/dist/editors.mjs +8 -8
  92. package/dist/feedback.cjs +1 -1
  93. package/dist/feedback.d.ts +21 -16
  94. package/dist/feedback.mjs +3 -3
  95. package/dist/index.cjs +199 -194
  96. package/dist/index.css +1 -1
  97. package/dist/index.d.ts +378 -48
  98. package/dist/index.mjs +23248 -21783
  99. package/dist/lazy.cjs +1 -1
  100. package/dist/lazy.mjs +24 -24
  101. package/dist/navigation.cjs +1 -1
  102. package/dist/navigation.d.ts +31 -0
  103. package/dist/navigation.mjs +404 -354
  104. package/dist/no-code-BNFk_BDO.js +8275 -0
  105. package/dist/no-code-BaAI_sJR.js +8318 -0
  106. package/dist/no-code-CFdTp543.cjs +331 -0
  107. package/dist/no-code-oQTeAtnW.cjs +331 -0
  108. package/dist/no-code.cjs +1 -1
  109. package/dist/no-code.mjs +1 -1
  110. package/dist/overlays.cjs +1 -1
  111. package/dist/overlays.d.ts +5 -0
  112. package/dist/overlays.mjs +1 -1
  113. package/dist/pickerCommons-BQi6IEAt.js +661 -0
  114. package/dist/pickerCommons-CMxFt9SW.js +548 -0
  115. package/dist/pickerCommons-Dc_hlz-e.cjs +1 -0
  116. package/dist/pickerCommons-DvQptSPX.cjs +1 -0
  117. package/dist/style.css +7 -4
  118. package/package.json +4 -3
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),i=require("@nice2dev/ui-core"),u=require("react");function xe(f=new Date){const A=new Date().getTime()-f.getTime(),R=Math.floor(A/1e3),I=Math.floor(R/60),V=Math.floor(I/60),G=Math.floor(V/24);let L;return R<60?L="just now":I<60?L=`${I} minute${I>1?"s":""} ago`:V<24?L=`${V} hour${V>1?"s":""} ago`:G<30?L=`${G} day${G>1?"s":""} ago`:L=f.toLocaleDateString(),{date:f,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,relative:L}}function he(f){return f.substring(0,7)}function fe(f){const k=f||i.createId();return{id:k,shortId:he(k)}}const ee=["development","testing","uat","staging","production"],$={development:"var(--nice-success, #22c55e)",testing:"var(--nice-primary, #3b82f6)",uat:"var(--nice-warning, #f59e0b)",staging:"var(--nice-accent, #8b5cf6)",production:"var(--nice-danger, #ef4444)"},H={development:"settings",testing:"flask",uat:"users",staging:"rocket",production:"building"};function ne(f){return ee.indexOf(f)}function se(f,k){return ne(f)<ne(k)}const ye=[{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"}],me=[{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}}],de=({tenant:f,branches:k,currentUser:A={id:"user-1",name:"Current User"},availableTables:R=ye,readOnly:I=!1,onCreateBranch:V,onDeleteBranch:G,onSwitchBranch:L,onCloneBranch:Q,onSyncBranch:Y,onProtectBranch:o,onScheduleSync:m,className:x,style:z,"data-testid":y})=>{const{t:c}=i.useNiceTranslation(),[U,M=""]=c("dataBranchManager.confirmDeleteEnvironment","Are you sure you want to delete {name}?").split("{name}"),[D,C]=u.useState(k??me),[W,q]=u.useState(null),[F,S]=u.useState(null),[h,j]=u.useState("development"),[E,b]=u.useState(""),[P,B]=u.useState([]),[g,O]=u.useState(!0),[w,d]=u.useState({requireApproval:!0,approversCount:1,requireBackup:!0,allowDirectChanges:!1}),[t,r]=u.useState({enabled:!1,frequency:"daily",direction:"pull"}),n=u.useMemo(()=>D.find(a=>a.id===W),[D,W]),v=u.useMemo(()=>{const a={production:[],staging:[],uat:[],testing:[],development:[]};return D.forEach(N=>{a[N.environment].push(N)}),a},[D]),T=a=>a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:a<1024*1024*1024?`${(a/(1024*1024)).toFixed(1)} MB`:`${(a/(1024*1024*1024)).toFixed(1)} GB`,K=u.useCallback(()=>{const a={...fe(),name:E||`${h}-${Date.now()}`,displayName:E||h,isDefault:!1,isProtected:!1,createdBy:A,createdAt:xe(),status:"active",type:"data",environment:h,tenant:f,sourceSnapshot:n?.id,upstream:n?.id,tables:g?void 0:P,size:{records:0,bytes:0}};C(N=>[...N,a]),V?.(a),Q?.(n?.id??"",h,g?void 0:P),S(null),_()},[E,h,n,g,P,A,f,V,Q]),_=()=>{b(""),j("development"),B([]),O(!0)},X=u.useCallback(()=>{n&&(C(a=>a.filter(N=>N.id!==n.id)),G?.(n.id),q(null),S(null))},[n,G]),p=a=>{n&&(Y?.(n.id,a),S(null))},l=()=>{n&&(C(a=>a.map(N=>N.id===n.id?{...N,isProtected:!0}:N)),o?.(n.id,w),S(null))},s={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-text-muted, #888)"};return e.jsxs("div",{className:`nice-data-branch-manager ${x||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:s.bg,color:s.text,fontFamily:"system-ui, sans-serif",...z},"data-testid":y,children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${s.border}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsxs("h3",{style:{margin:0,fontSize:16},children:[e.jsx(i.NiceIcon,{name:"database",size:16})," ",c("dataBranchManager.dataEnvironments","Data Environments")]}),e.jsx("span",{style:{fontSize:12,color:s.textMuted},children:c("dataBranchManager.tenantEnvironments","Tenant: {tenant} • {branches} environments").replace("{tenant}",String(f)).replace("{branches}",String(D.length))})]}),!I&&e.jsx("button",{onClick:()=>{q(D.find(a=>a.isDefault)?.id??null),S("clone")},style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:c("dataBranchManager.newEnvironment","+ New Environment")})]}),e.jsx("div",{style:{padding:16,borderBottom:`1px solid ${s.border}`,display:"flex",alignItems:"center",gap:8,overflowX:"auto"},children:ee.map((a,N)=>{const Z=v[a],J=Z.length>0;return e.jsxs(u.Fragment,{children:[e.jsxs("div",{role:J?"button":void 0,tabIndex:J?0:void 0,onKeyDown:J?i.clickOnActivationKey:void 0,style:{padding:"8px 16px",borderRadius:6,background:J?$[a]+"20":s.cardBg,border:`2px solid ${J?$[a]:s.border}`,opacity:J?1:.5,cursor:J?"pointer":"default"},onClick:()=>J&&q(Z[0].id),children:[e.jsx(i.NiceIcon,{name:H[a],size:18}),e.jsx("div",{style:{fontSize:11,fontWeight:600,textTransform:"uppercase"},children:a}),J&&e.jsx("div",{style:{fontSize:10,color:s.textMuted},children:Z.length>1?c("dataBranchManager.branchesMany","{envBranches} branches").replace("{envBranches}",String(Z.length)):c("dataBranchManager.branchesOne","{envBranches} branch").replace("{envBranches}",String(Z.length))})]}),N<ee.length-1&&e.jsx("div",{style:{color:s.textMuted,fontSize:20},children:e.jsx(i.NiceIcon,{name:"arrow-right",size:20})})]},a)})}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.jsxs("div",{style:{width:300,borderRight:`1px solid ${s.border}`,overflow:"auto"},children:[e.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${s.border}`,fontSize:11,color:s.textMuted},children:c("dataBranchManager.allEnvironments","All Environments")}),D.map(a=>e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:i.clickOnActivationKey,onClick:()=>q(a.id),style:{padding:"12px 16px",borderBottom:`1px solid ${s.border}`,background:W===a.id?s.cardBg:"transparent",cursor:"pointer"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(i.NiceIcon,{name:H[a.environment],size:16}),e.jsx("span",{style:{fontWeight:500},children:a.displayName}),a.isProtected&&e.jsx("span",{style:{fontSize:12},children:e.jsx(i.NiceIcon,{name:"lock",size:12})}),a.isDefault&&e.jsx("span",{style:{padding:"2px 6px",background:$[a.environment],borderRadius:4,fontSize:9,fontWeight:600},children:c("dataBranchManager.default","DEFAULT")})]}),e.jsx("div",{style:{fontSize:11,color:s.textMuted,marginTop:4},children:c("dataBranchManager.records","{records} records • {bytes}").replace("{records}",String(a.size?.records.toLocaleString()??"")).replace("{bytes}",String(T(a.size?.bytes??0)))}),e.jsx("div",{style:{fontSize:10,color:s.textMuted,marginTop:2},children:a.lastActivity?.relative})]},a.id))]}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:n?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(i.NiceIcon,{name:H[n.environment],size:32}),e.jsxs("div",{children:[e.jsx("h2",{style:{margin:0,fontSize:20},children:n.displayName}),e.jsx("span",{style:{display:"inline-block",padding:"2px 8px",background:$[n.environment],borderRadius:4,fontSize:10,fontWeight:600,marginTop:4},children:n.environment.toUpperCase()})]})]}),n.description&&e.jsx("p",{style:{color:s.textMuted,margin:"8px 0"},children:n.description})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:12,marginBottom:24},children:[{label:c("dataBranchManager.records2","Records"),value:n.size?.records.toLocaleString()??"0"},{label:c("dataBranchManager.size","Size"),value:T(n.size?.bytes??0)},{label:c("dataBranchManager.tables","Tables"),value:n.tables?.length.toString()??"All"},{label:c("dataBranchManager.status","Status"),value:n.status}].map(a=>e.jsxs("div",{style:{padding:12,background:s.cardBg,borderRadius:8,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:18,fontWeight:600},children:a.value}),e.jsx("div",{style:{fontSize:11,color:s.textMuted},children:a.label})]},a.label))}),e.jsxs("div",{style:{marginBottom:24},children:[e.jsx("h4",{style:{margin:"0 0 12px 0",fontSize:14},children:c("dataBranchManager.details","Details")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr",gap:"8px 16px",fontSize:13},children:[e.jsx("span",{style:{color:s.textMuted},children:c("dataBranchManager.createdBy","Created by")}),e.jsx("span",{children:n.createdBy.name}),e.jsx("span",{style:{color:s.textMuted},children:c("dataBranchManager.createdAt","Created at")}),e.jsx("span",{children:n.createdAt.date?.toLocaleString()}),e.jsx("span",{style:{color:s.textMuted},children:c("dataBranchManager.lastActivity","Last activity")}),e.jsx("span",{children:n.lastActivity?.relative}),n.upstream&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:s.textMuted},children:c("dataBranchManager.source","Source")}),e.jsx("span",{children:D.find(a=>a.id===n.upstream)?.displayName??c("dataBranchManager.unknown","Unknown")})]}),n.sourceSnapshot&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:s.textMuted},children:c("dataBranchManager.snapshot","Snapshot")}),e.jsx("span",{children:n.sourceSnapshot})]})]})]}),n.tables&&e.jsxs("div",{style:{marginBottom:24},children:[e.jsx("h4",{style:{margin:"0 0 12px 0",fontSize:14},children:c("dataBranchManager.includedTables","Included Tables ({tables})").replace("{tables}",String(n.tables.length))}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:n.tables.map(a=>e.jsxs("span",{style:{padding:"4px 10px",background:s.cardBg,borderRadius:4,fontSize:12},children:[e.jsx(i.NiceIcon,{name:"database",size:14})," ",a]},a))})]}),!I&&e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("button",{onClick:()=>L?.(n.id),style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12},children:[e.jsx(i.NiceIcon,{name:"zap",size:14})," ",c("dataBranchManager.switchToThisEnvironment","Switch to this environment")]}),e.jsxs("button",{onClick:()=>S("clone"),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${s.border}`,background:"transparent",color:s.text,cursor:"pointer",fontSize:12},children:[e.jsx(i.NiceIcon,{name:"clipboard",size:14})," ",c("dataBranchManager.clone","Clone")]}),e.jsxs("button",{onClick:()=>S("sync"),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${s.border}`,background:"transparent",color:s.text,cursor:"pointer",fontSize:12},children:[e.jsx(i.NiceIcon,{name:"refresh",size:14})," ",c("dataBranchManager.sync","Sync")]}),!n.isProtected&&e.jsxs("button",{onClick:()=>S("protect"),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${s.border}`,background:"transparent",color:s.text,cursor:"pointer",fontSize:12},children:[e.jsx(i.NiceIcon,{name:"lock",size:14})," ",c("dataBranchManager.protect","Protect")]}),!n.isDefault&&!n.isProtected&&e.jsxs("button",{onClick:()=>S("delete"),style:{padding:"8px 16px",borderRadius:6,border:"1px solid var(--nice-danger, #ef4444)",background:"transparent",color:"var(--nice-color-error, #ef4444)",cursor:"pointer",fontSize:12},children:[e.jsx(i.NiceIcon,{name:"trash",size:14})," ",c("dataBranchManager.delete","Delete")]})]})]}):e.jsxs("div",{style:{padding:32,textAlign:"center",color:s.textMuted},children:[e.jsx("div",{style:{fontSize:48,marginBottom:16},children:e.jsx(i.NiceIcon,{name:"database",size:48})}),e.jsx("div",{children:c("dataBranchManager.selectAnEnvironmentToView","Select an environment to view details")})]})})]}),F==="clone"&&e.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,background:"var(--nice-overlay-75, rgba(0, 0, 0, 0.75))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>S(null),children:e.jsxs("div",{role:"presentation",onClick:a=>a.stopPropagation(),style:{background:s.cardBg,borderRadius:12,padding:24,width:500,maxHeight:"80vh",overflow:"auto"},children:[e.jsxs("h3",{style:{margin:"0 0 16px 0"},children:[e.jsx(i.NiceIcon,{name:"clipboard",size:14})," ",c("dataBranchManager.cloneEnvironment","Clone Environment")]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,color:s.textMuted},children:c("dataBranchManager.sourceEnvironment","Source Environment")}),e.jsxs("div",{style:{padding:12,background:s.bg,borderRadius:6,display:"flex",alignItems:"center",gap:8},children:[e.jsx(i.NiceIcon,{name:H[n?.environment??"production"],size:14}),e.jsx("span",{children:n?.displayName??c("dataBranchManager.production","Production")})]})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,color:s.textMuted},children:c("dataBranchManager.targetEnvironment","Target Environment")}),e.jsx("select",{value:h,onChange:a=>j(a.target.value),style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${s.border}`,background:s.bg,color:s.text,fontSize:13},children:ee.filter(a=>se(n?.environment??"production",a)||a==="development"||a==="testing").map(a=>e.jsx("option",{value:a,children:a.charAt(0).toUpperCase()+a.slice(1)},a))})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,color:s.textMuted},children:c("dataBranchManager.environmentName","Environment Name")}),e.jsx("input",{type:"text",value:E,onChange:a=>b(a.target.value),placeholder:`${h}-${new Date().toISOString().split("T")[0]}`,style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${s.border}`,background:s.bg,color:s.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:g,onChange:a=>O(a.target.checked)}),e.jsx("span",{style:{fontSize:13},children:c("dataBranchManager.includeAllTables","Include all tables")})]})}),!g&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,color:s.textMuted},children:c("dataBranchManager.selectTablesSelected","Select Tables ({selectedTables} selected)").replace("{selectedTables}",String(P.length))}),e.jsx("div",{style:{maxHeight:200,overflow:"auto",border:`1px solid ${s.border}`,borderRadius:6},children:R.map(a=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:`1px solid ${s.border}`,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:P.includes(a.name),onChange:N=>{N.target.checked?B(Z=>[...Z,a.name]):B(Z=>Z.filter(J=>J!==a.name))}}),e.jsx("span",{style:{flex:1,fontSize:13},children:a.displayName}),e.jsx("span",{style:{fontSize:11,color:s.textMuted},children:c("dataBranchManager.rows","{recordCount} rows").replace("{recordCount}",String(a.recordCount.toLocaleString()))})]},a.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>S(null),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${s.border}`,background:"transparent",color:s.text,cursor:"pointer",fontSize:13},children:c("dataBranchManager.cancel","Cancel")}),e.jsx("button",{onClick:K,style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:c("dataBranchManager.cloneEnvironment","Clone Environment")})]})]})}),F==="sync"&&n&&e.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,background:"var(--nice-overlay-75, rgba(0, 0, 0, 0.75))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>S(null),children:e.jsxs("div",{role:"presentation",onClick:a=>a.stopPropagation(),style:{background:s.cardBg,borderRadius:12,padding:24,width:400},children:[e.jsxs("h3",{style:{margin:"0 0 16px 0"},children:[e.jsx(i.NiceIcon,{name:"refresh",size:14})," ",c("dataBranchManager.syncEnvironment","Sync Environment")]}),e.jsx("p",{style:{color:s.textMuted,fontSize:13,marginBottom:16},children:c("dataBranchManager.synchronizeDataBetween","Synchronize data between {name} and its source.").replace("{name}",n.displayName??n.name)}),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 ${s.border}`,background:"transparent",color:s.text,cursor:"pointer",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:24,marginBottom:8},children:e.jsx(i.NiceIcon,{name:"arrow-down",size:24})}),e.jsx("div",{style:{fontWeight:500},children:c("dataBranchManager.pull","Pull")}),e.jsx("div",{style:{fontSize:11,color:s.textMuted},children:c("dataBranchManager.getChangesFromSource","Get changes from source")})]}),e.jsxs("button",{onClick:()=>p("push"),disabled:n.environment==="production",style:{flex:1,padding:"16px",borderRadius:8,border:`2px solid ${s.border}`,background:"transparent",color:n.environment==="production"?s.textMuted:s.text,cursor:n.environment==="production"?"not-allowed":"pointer",textAlign:"center",opacity:n.environment==="production"?.5:1},children:[e.jsx("div",{style:{fontSize:24,marginBottom:8},children:e.jsx(i.NiceIcon,{name:"arrow-up",size:24})}),e.jsx("div",{style:{fontWeight:500},children:c("dataBranchManager.push","Push")}),e.jsx("div",{style:{fontSize:11,color:s.textMuted},children:c("dataBranchManager.sendChangesToSource","Send changes to source")})]})]}),e.jsx("button",{onClick:()=>S(null),style:{width:"100%",padding:"8px 16px",borderRadius:6,border:`1px solid ${s.border}`,background:"transparent",color:s.text,cursor:"pointer",fontSize:13},children:c("dataBranchManager.cancel","Cancel")})]})}),F==="delete"&&n&&e.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,background:"var(--nice-overlay-75, rgba(0, 0, 0, 0.75))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>S(null),children:e.jsxs("div",{role:"presentation",onClick:a=>a.stopPropagation(),style:{background:s.cardBg,borderRadius:12,padding:24,width:400},children:[e.jsxs("h3",{style:{margin:"0 0 16px 0",color:"var(--nice-color-error, #ef4444)"},children:[e.jsx(i.NiceIcon,{name:"trash",size:14})," ",c("dataBranchManager.deleteEnvironment","Delete Environment")]}),e.jsxs("p",{style:{color:s.textMuted,fontSize:13,marginBottom:16},children:[U,e.jsx("strong",{children:n.displayName}),M," ",c("dataBranchManager.willRemoveAllRecords","This will remove all {count} records.").replace("{count}",n.size?.records.toLocaleString()??"")]}),e.jsxs("div",{style:{padding:12,background:"var(--nice-danger-tint-15, #ef444420)",border:"1px solid var(--nice-danger, #ef4444)",borderRadius:6,marginBottom:16,fontSize:12},children:[e.jsx(i.NiceIcon,{name:"warning",size:14})," ",c("dataBranchManager.thisActionCannotBeUndone","This action cannot be undone.")]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>S(null),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${s.border}`,background:"transparent",color:s.text,cursor:"pointer",fontSize:13},children:c("dataBranchManager.cancel","Cancel")}),e.jsx("button",{onClick:X,style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:c("dataBranchManager.deleteEnvironment","Delete Environment")})]})]})}),F==="protect"&&n&&e.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,background:"var(--nice-overlay-75, rgba(0, 0, 0, 0.75))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>S(null),children:e.jsxs("div",{role:"presentation",onClick:a=>a.stopPropagation(),style:{background:s.cardBg,borderRadius:12,padding:24,width:450},children:[e.jsxs("h3",{style:{margin:"0 0 16px 0"},children:[e.jsx(i.NiceIcon,{name:"lock",size:14})," ",c("dataBranchManager.protectEnvironment","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:w.requireApproval,onChange:a=>d(N=>({...N,requireApproval:a.target.checked}))}),e.jsx("span",{style:{fontSize:13},children:c("dataBranchManager.requireApprovalForChanges","Require approval for changes")})]}),w.requireApproval&&e.jsxs("div",{style:{marginLeft:24},children:[e.jsx("label",{style:{display:"block",marginBottom:4,fontSize:11,color:s.textMuted},children:c("dataBranchManager.minimumApprovers","Minimum approvers")}),e.jsx("input",{type:"number",min:1,max:5,value:w.approversCount,onChange:a=>d(N=>({...N,approversCount:parseInt(a.target.value)||1})),style:{width:80,padding:6,borderRadius:4,border:`1px solid ${s.border}`,background:s.bg,color:s.text}})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:w.requireBackup,onChange:a=>d(N=>({...N,requireBackup:a.target.checked}))}),e.jsx("span",{style:{fontSize:13},children:c("dataBranchManager.requireBackupBeforeChanges","Require backup before changes")})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:!w.allowDirectChanges,onChange:a=>d(N=>({...N,allowDirectChanges:!a.target.checked}))}),e.jsx("span",{style:{fontSize:13},children:c("dataBranchManager.blockDirectChangesRequireMerge","Block direct changes (require merge)")})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>S(null),style:{padding:"8px 16px",borderRadius:6,border:`1px solid ${s.border}`,background:"transparent",color:s.text,cursor:"pointer",fontSize:13},children:c("dataBranchManager.cancel","Cancel")}),e.jsx("button",{onClick:l,style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-warning, #f59e0b)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:c("dataBranchManager.applyProtection","Apply Protection")})]})]})})]})},be=Object.freeze(Object.defineProperty({__proto__:null,NiceDataBranchManager:de},Symbol.toStringTag,{value:"Module"})),ve=[{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"}]}],le=({sourceBranch:f,targetBranch:k,branches:A=[],diffItems:R=ve,onCompare:I,onExport:V,onSelectRecord:G,className:L,style:Q,"data-testid":Y})=>{const{t:o}=i.useNiceTranslation(),[m,x]=u.useState("summary"),[z,y]=u.useState("all"),[c,U]=u.useState(null),[M,D]=u.useState(null),[C,W]=u.useState(""),[q,F]=u.useState(!1),[S,h]=u.useState(f?.id??""),[j,E]=u.useState(k?.id??""),b=u.useMemo(()=>R.reduce((r,n)=>({tables:r.tables+1,added:r.added+n.added,modified:r.modified+n.modified,deleted:r.deleted+n.deleted}),{tables:0,added:0,modified:0,deleted:0}),[R]),P=u.useMemo(()=>R.filter(r=>{if(z==="added"&&r.added===0||z==="modified"&&r.modified===0||z==="deleted"&&r.deleted===0)return!1;if(C){const n=C.toLowerCase();return r.table.toLowerCase().includes(n)||r.displayName.toLowerCase().includes(n)||r.module?.toLowerCase().includes(n)}return!0}).sort((r,n)=>n.added+n.modified+n.deleted-(r.added+r.modified+r.deleted)),[R,z,C]),B=u.useMemo(()=>R.find(r=>r.table===c),[R,c]),g=u.useMemo(()=>B?B.records.filter(r=>z==="all"?!0:r.changeType===z):[],[B,z]),O=u.useCallback(()=>{S&&j&&I?.(S,j)},[S,j,I]),w=r=>{switch(r){case"added":return"var(--nice-color-success, #22c55e)";case"modified":return"var(--nice-color-warning, #f59e0b)";case"deleted":return"var(--nice-color-error, #ef4444)";default:return"var(--nice-text-muted, #888)"}},d=r=>{switch(r){case"added":return"+";case"modified":return"~";case"deleted":return"-";default:return" "}},t={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-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",...Q},"data-testid":Y,children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsxs("h3",{style:{margin:0,fontSize:16},children:[e.jsx(i.NiceIcon,{name:"bar-chart",size:16})," ",o("dataDiffViewer.dataDiffViewer","Data Diff Viewer")]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("select",{value:S,onChange:r=>h(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:o("dataDiffViewer.selectSource","Select source...")}),A.map(r=>e.jsx("option",{value:r.id,children:r.displayName},r.id))]}),e.jsx("span",{style:{color:t.textMuted},children:e.jsx(i.NiceIcon,{name:"arrow-right",size:12})}),e.jsxs("select",{value:j,onChange:r=>E(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:o("dataDiffViewer.selectTarget","Select target...")}),A.map(r=>e.jsx("option",{value:r.id,children:r.displayName},r.id))]}),e.jsx("button",{onClick:O,disabled:!S||!j,style:{padding:"6px 12px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:S&&j?"pointer":"not-allowed",fontSize:12,opacity:S&&j?1:.5},children:o("dataDiffViewer.compare","Compare")})]}),e.jsx("div",{style:{flex:1}}),e.jsxs("select",{onChange:r=>{r.target.value&&(V?.(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:o("dataDiffViewer.export","Export...")}),e.jsx("option",{value:"json",children:o("dataDiffViewer.json","JSON")}),e.jsx("option",{value:"csv",children:"CSV"}),e.jsx("option",{value:"sql",children:o("dataDiffViewer.sqlScript","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:o("dataDiffViewer.tables2","Tables:")}),e.jsx("span",{style:{fontWeight:600},children:b.tables})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:w("added")}}),e.jsx("span",{style:{fontSize:12},children:o("dataDiffViewer.added","+{added} added").replace("{added}",String(b.added))})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:w("modified")}}),e.jsx("span",{style:{fontSize:12},children:o("dataDiffViewer.modified","~{modified} modified").replace("{modified}",String(b.modified))})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:w("deleted")}}),e.jsx("span",{style:{fontSize:12},children:o("dataDiffViewer.deleted","-{deleted} deleted").replace("{deleted}",String(b.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:()=>y(r),style:{padding:"4px 12px",borderRadius:4,border:"none",background:z===r?"var(--nice-color-primary, #3b82f6)":t.cardBg,color:z===r?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:r},r))}),e.jsx("input",{type:"text",value:C,onChange:r=>W(r.target.value),placeholder:o("dataDiffViewer.searchTables","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.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`,fontSize:11,color:t.textMuted},children:o("dataDiffViewer.tables","Tables ({filteredTables})").replace("{filteredTables}",String(P.length))}),P.map(r=>e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:i.clickOnActivationKey,onClick:()=>{U(r.table),D(null),x("table")},style:{padding:"12px 16px",borderBottom:`1px solid ${t.border}`,background:c===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(i.NiceIcon,{name:"database",size:14})}),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:w("added")},children:["+",r.added]}),r.modified>0&&e.jsxs("span",{style:{color:w("modified")},children:["~",r.modified]}),r.deleted>0&&e.jsxs("span",{style:{color:w("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:[m==="summary"&&e.jsxs("div",{style:{padding:32,textAlign:"center",color:t.textMuted},children:[e.jsx("div",{style:{fontSize:48,marginBottom:16},children:e.jsx(i.NiceIcon,{name:"bar-chart",size:48})}),e.jsx("div",{children:o("dataDiffViewer.selectATableToView","Select a table to view changes")})]}),m==="table"&&B&&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:B.displayName}),e.jsxs("span",{style:{fontSize:11,color:t.textMuted},children:[B.table," • ",B.module]})]}),e.jsxs("div",{style:{display:"flex",gap:8,fontSize:12},children:[e.jsxs("span",{style:{color:w("added")},children:["+",B.added]}),e.jsxs("span",{style:{color:w("modified")},children:["~",B.modified]}),e.jsxs("span",{style:{color:w("deleted")},children:["-",B.deleted]})]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:g.length===0?e.jsx("div",{style:{padding:32,textAlign:"center",color:t.textMuted},children:o("dataDiffViewer.noRecordsMatchTheCurrent","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:o("dataDiffViewer.change","Change")}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:o("dataDiffViewer.recordId","Record ID")}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:o("dataDiffViewer.fieldsChanged","Fields Changed")}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:o("dataDiffViewer.changedBy","Changed By")}),e.jsx("th",{style:{padding:"8px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:o("dataDiffViewer.date","Date")})]})}),e.jsx("tbody",{children:g.map(r=>e.jsxs("tr",{onClick:()=>{D(r),x("record")},style:{cursor:"pointer",background:M?.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:w(r.changeType)+"30",color:w(r.changeType),fontWeight:600,fontSize:14},children:d(r.changeType)})}),e.jsx("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`,fontFamily:"monospace"},children:r.id}),e.jsx("td",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.border}`},children:r.fields.length!==1?o("dataDiffViewer.fieldsMany","{fields} fields").replace("{fields}",String(r.fields.length)):o("dataDiffViewer.fieldsOne","{fields} field").replace("{fields}",String(r.fields.length))}),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))})]})})]}),m==="record"&&M&&B&&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.jsxs("button",{onClick:()=>x("table"),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:"pointer",fontSize:12},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",o("dataDiffViewer.back","Back")]}),e.jsxs("div",{children:[e.jsxs("h4",{style:{margin:0,fontSize:14},children:[B.displayName," / ",M.id]}),e.jsx("span",{style:{display:"inline-block",padding:"2px 8px",background:w(M.changeType)+"30",color:w(M.changeType),borderRadius:4,fontSize:10,fontWeight:600,marginTop:4,textTransform:"uppercase"},children:M.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:o("dataDiffViewer.primaryKey","Primary Key")}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:12},children:Object.entries(M.primaryKey).map(([r,n])=>e.jsxs("span",{style:{marginRight:16},children:[e.jsxs("span",{style:{color:t.textMuted},children:[r,":"]})," ",String(n)]},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:o("dataDiffViewer.field","Field")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:o("dataDiffViewer.type","Type")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:o("dataDiffViewer.sourceValue","Source Value")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${t.border}`},children:o("dataDiffViewer.targetValue","Target Value")})]})}),e.jsx("tbody",{children:M.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:w(r.changeType)+"30",color:w(r.changeType),fontWeight:600,fontSize:12},children:d(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"?"var(--nice-danger-tint-15, #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"?"var(--nice-success-tint-12, #22c55e20)":r.changeType==="modified"?"var(--nice-warning-tint-15, #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:o("dataDiffViewer.changeMetadata","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:o("dataDiffViewer.changedBy2","Changed by")}),e.jsx("span",{children:M.changedBy??o("dataDiffViewer.unknown","Unknown")}),e.jsx("span",{style:{color:t.textMuted},children:o("dataDiffViewer.changedAt","Changed at")}),e.jsx("span",{children:M.changedAt?.toLocaleString()??o("dataDiffViewer.unknown","Unknown")})]})]})]})]})]})]})]})},je=Object.freeze(Object.defineProperty({__proto__:null,NiceDataDiffViewer:le},Symbol.toStringTag,{value:"Module"})),Se=[{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"]}],ce=({branches:f=[],commits:k=Se,selectedCommitId:A,viewMode:R,showLanes:I=!0,onSelectCommit:V,onSelectBranch:G,onCompare:L,onRestore:Q,className:Y,style:o,"data-testid":m})=>{const{t:x,lang:z}=i.useNiceTranslation(),[y,c]=u.useState("graph"),[U,M]=u.useState(null),[D,C]=u.useState(null),[W,q]=u.useState(null),F=R??y,S=A??U,h=u.useRef(null),j=u.useMemo(()=>[...k].sort((t,r)=>r.timestamp.getTime()-t.timestamp.getTime()),[k]),E=u.useMemo(()=>{const t={};return ee.forEach((r,n)=>{t[r]=n}),k.reduce((r,n)=>(r[n.id]=t[n.environment]??0,r),{})},[k]),b=u.useMemo(()=>k.find(t=>t.id===S),[k,S]),P=u.useCallback(t=>{D?(L?.(D,t),C(null)):(M(t),V?.(t))},[D,L,V]),B=t=>{const n=new Date().getTime()-t.getTime(),v=Math.floor(n/(1e3*60*60*24));if(v===0)return x("dataBranchGraph.today","Today");if(v===1)return x("dataBranchGraph.yesterday","Yesterday");const T=new Intl.RelativeTimeFormat(z);return v<7?T.format(-v,"day"):v<30?T.format(-Math.floor(v/7),"week"):T.format(-Math.floor(v/30),"month")},g={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-text-muted, #888)"},O=140,w=12,d=80;return e.jsxs("div",{className:`nice-data-branch-graph ${Y||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:g.bg,color:g.text,fontFamily:"system-ui, sans-serif",...o},"data-testid":m,children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:`1px solid ${g.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsxs("h3",{style:{margin:0,fontSize:16},children:[e.jsx(i.NiceIcon,{name:"bar-chart",size:16})," ",x("dataBranchGraph.dataHistory","Data History")]}),e.jsx("div",{style:{display:"flex",gap:4},children:["graph","timeline","list"].map(t=>e.jsxs("button",{onClick:()=>c(t),style:{padding:"4px 12px",borderRadius:4,border:"none",background:F===t?"var(--nice-color-primary, #3b82f6)":g.cardBg,color:F===t?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:[e.jsx(i.NiceIcon,{name:t==="graph"?"box":t==="timeline"?"calendar":"clipboard",size:14})," ",t]},t))}),e.jsx("div",{style:{flex:1}}),D?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:12,color:g.textMuted},children:x("dataBranchGraph.selectTargetToCompareWith","Select target to compare with {commit}").replace("{commit}",k.find(t=>t.id===D)?.shortId??"")}),e.jsx("button",{onClick:()=>C(null),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${g.border}`,background:"transparent",color:g.text,cursor:"pointer",fontSize:11},children:x("dataBranchGraph.cancel","Cancel")})]}):e.jsx("span",{style:{fontSize:12,color:g.textMuted},children:x("dataBranchGraph.snapshots","{sortedCommits} snapshots").replace("{sortedCommits}",String(j.length))})]}),I&&F==="graph"&&e.jsxs("div",{style:{display:"flex",borderBottom:`1px solid ${g.border}`,background:g.cardBg},children:[ee.map(t=>e.jsxs("div",{style:{width:O,padding:"8px 12px",textAlign:"center",borderRight:`1px solid ${g.border}`},children:[e.jsx(i.NiceIcon,{name:H[t],size:16}),e.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",color:$[t]},children:t})]},t)),e.jsx("div",{style:{flex:1,padding:"8px 12px"},children:e.jsx("div",{style:{fontSize:11,color:g.textMuted},children:x("dataBranchGraph.details","Details")})})]}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[F==="graph"&&e.jsx("div",{ref:h,style:{flex:1,overflow:"auto"},children:e.jsxs("div",{style:{position:"relative",minHeight:j.length*d},children:[e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:O*ee.length,height:j.length*d,pointerEvents:"none"},children:j.map((t,r)=>{const n=r*d+d/2,v=E[t.id]*O+O/2;return t.parents.map(T=>{const K=j.findIndex(s=>s.id===T);if(K===-1)return null;const _=K*d+d/2,X=E[T]*O+O/2,p=t.isMerge&&t.parents.indexOf(T)>0,l=v===X?`M ${v} ${n} L ${X} ${_}`:`M ${v} ${n} C ${v} ${(n+_)/2}, ${X} ${(n+_)/2}, ${X} ${_}`;return e.jsx("path",{d:l,fill:"none",stroke:p?"var(--nice-color-accent, #8b5cf6)":$[t.environment],strokeWidth:2,strokeDasharray:p?"4,4":void 0,opacity:.6},`${t.id}-${T}`)})})}),j.map((t,r)=>{const n=r*d+d/2,v=E[t.id]*O+O/2,T=t.id===S,K=t.id===W,_=t.id===D;return e.jsxs(u.Fragment,{children:[e.jsx("div",{role:"presentation",onClick:()=>P(t.id),onMouseEnter:()=>q(t.id),onMouseLeave:()=>q(null),style:{position:"absolute",left:v-w,top:n-w,width:w*2,height:w*2,borderRadius:t.isMerge?4:"50%",background:T||_?"var(--nice-bg-primary, #fff)":$[t.environment],border:`3px solid ${$[t.environment]}`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:600,color:T||_?"var(--nice-text-primary, #000)":"var(--nice-text-primary, #fff)",zIndex:K?10:1,transform:K?"scale(1.2)":"scale(1)",transition:"transform 0.1s",boxShadow:T?"0 0 0 3px color-mix(in srgb, var(--nice-color-primary, #3b82f6) 50%, transparent)":"none"},children:t.isSnapshot?e.jsx(i.NiceIcon,{name:"camera",size:12}):t.isMerge?e.jsx(i.NiceIcon,{name:"shuffle",size:12}):null}),e.jsxs("div",{style:{position:"absolute",left:O*ee.length+16,top:n-20,right:16,height:40,display:"flex",alignItems:"center",gap:12,padding:"4px 12px",background:T?g.cardBg:"transparent",borderRadius:6,borderLeft:T?`3px solid ${$[t.environment]}`:"none"},children:[e.jsx("span",{style:{fontFamily:"monospace",fontSize:11,color:$[t.environment]},children:t.shortId}),e.jsx("span",{style:{fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.message}),t.tags?.map(X=>e.jsxs("span",{style:{padding:"2px 6px",background:"var(--nice-warning-tint-20, #f59e0b30)",color:"var(--nice-color-warning, #f59e0b)",borderRadius:4,fontSize:9},children:[e.jsx(i.NiceIcon,{name:"tag",size:12})," ",X]},X)),e.jsx("span",{style:{fontSize:10,color:g.textMuted,whiteSpace:"nowrap"},children:B(t.timestamp)})]})]},t.id)})]})}),F==="timeline"&&e.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:j.map((t,r)=>{const n=t.id===S,v=j[r-1],T=!v||t.timestamp.toDateString()!==v.timestamp.toDateString();return e.jsxs(u.Fragment,{children:[T&&e.jsx("div",{style:{padding:"8px 0",fontSize:11,fontWeight:600,color:g.textMuted,borderBottom:`1px solid ${g.border}`,marginBottom:8},children:t.timestamp.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:i.clickOnActivationKey,onClick:()=>P(t.id),style:{display:"flex",gap:12,padding:12,marginBottom:8,background:n?g.cardBg:"transparent",borderRadius:8,cursor:"pointer",border:`1px solid ${n?$[t.environment]:"transparent"}`},children:[e.jsx("div",{style:{width:60,textAlign:"right",fontSize:11,color:g.textMuted},children:t.timestamp.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})}),e.jsxs("div",{style:{width:80,padding:"4px 8px",background:$[t.environment]+"30",color:$[t.environment],borderRadius:4,fontSize:10,textAlign:"center",fontWeight:600,textTransform:"uppercase"},children:[e.jsx(i.NiceIcon,{name:H[t.environment],size:14})," ",t.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:g.textMuted},children:t.shortId}),t.isSnapshot&&e.jsx("span",{style:{fontSize:12},children:e.jsx(i.NiceIcon,{name:"camera",size:12})}),t.isMerge&&e.jsx("span",{style:{fontSize:12},children:e.jsx(i.NiceIcon,{name:"shuffle",size:12})}),t.tags?.map(K=>e.jsx("span",{style:{padding:"1px 6px",background:"var(--nice-warning-tint-20, #f59e0b30)",color:"var(--nice-color-warning, #f59e0b)",borderRadius:3,fontSize:9},children:K},K))]}),e.jsx("div",{style:{fontSize:13,marginTop:4},children:t.message}),e.jsxs("div",{style:{fontSize:11,color:g.textMuted,marginTop:4},children:[x("dataBranchGraph.by","by {name} •").replace("{name}",String(t.author.name))," ",e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",t.stats.recordsAdded]})," ",e.jsxs("span",{style:{color:"var(--nice-color-warning, #f59e0b)"},children:["~",t.stats.recordsModified]})," ",e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",t.stats.recordsDeleted]})]})]})]})]},t.id)})}),F==="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:g.cardBg},children:[e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${g.border}`},children:"ID"}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${g.border}`},children:x("dataBranchGraph.environment","Environment")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${g.border}`},children:x("dataBranchGraph.message","Message")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${g.border}`},children:x("dataBranchGraph.author","Author")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"left",borderBottom:`1px solid ${g.border}`},children:x("dataBranchGraph.date","Date")}),e.jsx("th",{style:{padding:"10px 12px",textAlign:"right",borderBottom:`1px solid ${g.border}`},children:x("dataBranchGraph.changes","Changes")})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{onClick:()=>P(t.id),style:{cursor:"pointer",background:t.id===S?g.cardBg:"transparent"},children:[e.jsxs("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${g.border}`,fontFamily:"monospace"},children:[t.shortId,t.isSnapshot&&e.jsxs(e.Fragment,{children:[" ",e.jsx(i.NiceIcon,{name:"camera",size:12})]}),t.isMerge&&e.jsxs(e.Fragment,{children:[" ",e.jsx(i.NiceIcon,{name:"shuffle",size:12})]})]}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${g.border}`},children:e.jsx("span",{style:{padding:"2px 8px",background:$[t.environment]+"30",color:$[t.environment],borderRadius:4,fontSize:10,fontWeight:600},children:t.environment})}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${g.border}`},children:t.message}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${g.border}`,color:g.textMuted},children:t.author.name}),e.jsx("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${g.border}`,color:g.textMuted},children:t.timestamp.toLocaleString()}),e.jsxs("td",{style:{padding:"10px 12px",borderBottom:`1px solid ${g.border}`,textAlign:"right"},children:[e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",t.stats.recordsAdded]})," ",e.jsxs("span",{style:{color:"var(--nice-color-warning, #f59e0b)"},children:["~",t.stats.recordsModified]})," ",e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",t.stats.recordsDeleted]})]})]},t.id))})]})}),b&&e.jsxs("div",{style:{width:320,borderLeft:`1px solid ${g.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:e.jsx(i.NiceIcon,{name:b.isSnapshot?"camera":b.isMerge?"shuffle":"edit",size:24})}),e.jsx("span",{style:{padding:"4px 10px",background:$[b.environment]+"30",color:$[b.environment],borderRadius:6,fontSize:11,fontWeight:600,textTransform:"uppercase"},children:b.environment})]}),e.jsx("h4",{style:{margin:"0 0 8px 0",fontSize:14},children:b.message}),b.description&&e.jsx("p",{style:{margin:0,fontSize:12,color:g.textMuted},children:b.description})]}),b.tags&&b.tags.length>0&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:11,color:g.textMuted,marginBottom:4},children:x("dataBranchGraph.tags","Tags")}),e.jsx("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:b.tags.map(t=>e.jsxs("span",{style:{padding:"2px 8px",background:"var(--nice-warning-tint-20, #f59e0b30)",color:"var(--nice-color-warning, #f59e0b)",borderRadius:4,fontSize:11},children:[e.jsx(i.NiceIcon,{name:"tag",size:12})," ",t]},t))})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:11,color:g.textMuted,marginBottom:8},children:x("dataBranchGraph.changes","Changes")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8},children:[e.jsxs("div",{style:{padding:10,background:g.cardBg,borderRadius:6,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:16,fontWeight:600},children:b.stats.tables}),e.jsx("div",{style:{fontSize:10,color:g.textMuted},children:x("dataBranchGraph.tables","Tables")})]}),e.jsxs("div",{style:{padding:10,background:"var(--nice-success-tint-12, #22c55e20)",borderRadius:6,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:16,fontWeight:600,color:"var(--nice-color-success, #22c55e)"},children:["+",b.stats.recordsAdded]}),e.jsx("div",{style:{fontSize:10,color:g.textMuted},children:x("dataBranchGraph.added","Added")})]}),e.jsxs("div",{style:{padding:10,background:"var(--nice-warning-tint-15, #f59e0b20)",borderRadius:6,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:16,fontWeight:600,color:"var(--nice-color-warning, #f59e0b)"},children:["~",b.stats.recordsModified]}),e.jsx("div",{style:{fontSize:10,color:g.textMuted},children:x("dataBranchGraph.modified","Modified")})]}),e.jsxs("div",{style:{padding:10,background:"var(--nice-danger-tint-15, #ef444420)",borderRadius:6,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:16,fontWeight:600,color:"var(--nice-color-error, #ef4444)"},children:["-",b.stats.recordsDeleted]}),e.jsx("div",{style:{fontSize:10,color:g.textMuted},children:x("dataBranchGraph.deleted","Deleted")})]})]})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{fontSize:11,color:g.textMuted,marginBottom:8},children:x("dataBranchGraph.details","Details")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"80px 1fr",gap:"6px 12px",fontSize:12},children:[e.jsx("span",{style:{color:g.textMuted},children:"ID"}),e.jsx("span",{style:{fontFamily:"monospace"},children:b.shortId}),e.jsx("span",{style:{color:g.textMuted},children:x("dataBranchGraph.author","Author")}),e.jsx("span",{children:b.author.name}),e.jsx("span",{style:{color:g.textMuted},children:x("dataBranchGraph.date","Date")}),e.jsx("span",{children:b.timestamp.toLocaleString()}),e.jsx("span",{style:{color:g.textMuted},children:x("dataBranchGraph.type","Type")}),e.jsx("span",{children:b.isSnapshot?x("dataBranchGraph.snapshot","Snapshot"):b.isMerge?x("dataBranchGraph.merge","Merge"):x("dataBranchGraph.change","Change")}),b.parents.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:g.textMuted},children:x("dataBranchGraph.parents","Parents")}),e.jsx("span",{style:{fontFamily:"monospace"},children:b.parents.map(t=>k.find(r=>r.id===t)?.shortId??t).join(", ")})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsxs("button",{onClick:()=>C(b.id),style:{padding:"8px 12px",borderRadius:6,border:`1px solid ${g.border}`,background:"transparent",color:g.text,cursor:"pointer",fontSize:12},children:[e.jsx(i.NiceIcon,{name:"search",size:14})," ",x("dataBranchGraph.compareWith","Compare with...")]}),b.isSnapshot&&e.jsxs("button",{onClick:()=>Q?.(b.id),style:{padding:"8px 12px",borderRadius:6,border:"none",background:"var(--nice-color-warning, #f59e0b)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:[e.jsx(i.NiceIcon,{name:"reply",size:14})," ",x("dataBranchGraph.restoreThisSnapshot","Restore this snapshot")]})]})]})]})]})},ke=Object.freeze(Object.defineProperty({__proto__:null,NiceDataBranchGraph:ce},Symbol.toStringTag,{value:"Module"})),Be=[{target:".nice-data-merge-builder",titleKey:"tutorial.dataMergeBuilder.intro.title",title:"Data merge",contentKey:"tutorial.dataMergeBuilder.intro.content",content:"Walk through the steps: choose source and target branches, preview changes, resolve conflicts, set options, then confirm the merge.",placement:"auto"}],ze=[{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}}],ie={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},pe=({branches:f=ze,sourceBranchId:k,targetBranchId:A,onPreview:R,onMerge:I,onCancel:V,tutorial:G,className:L,style:Q,"data-testid":Y})=>{const{t:o}=i.useNiceTranslation(),[m,x]=u.useState("select"),[z,y]=u.useState(k??""),[c,U]=u.useState(A??""),[M,D]=u.useState(null),[C,W]=u.useState([]),[q,F]=u.useState("keep-source"),[S,h]=u.useState(!0),[j,E]=u.useState(!1),[b,P]=u.useState(null),[B,g]=u.useState({}),[O,w]=u.useState(!1),d=u.useMemo(()=>f.find(l=>l.id===z),[f,z]),t=u.useMemo(()=>f.find(l=>l.id===c),[f,c]),r=u.useMemo(()=>d?f.filter(l=>l.id!==z&&(se(d.environment,l.environment)||l.environment==="development"||l.environment==="testing")):f,[f,z,d]),n=u.useMemo(()=>M?M.tables.filter(s=>C.includes(s.table)).reduce((s,a)=>({inserts:s.inserts+a.inserts,updates:s.updates+a.updates,deletes:s.deletes+a.deletes,conflicts:s.conflicts+a.conflicts}),{inserts:0,updates:0,deletes:0,conflicts:0}):{inserts:0,updates:0,deletes:0,conflicts:0},[M,C]),v=u.useMemo(()=>M?M.conflicts.filter(l=>!B[l.id]):[],[M,B]),T=u.useCallback(async()=>{w(!0),R?.(z,c),await new Promise(l=>setTimeout(l,1e3)),D(ie),W(ie.tables.filter(l=>l.selected).map(l=>l.table)),w(!1),x("preview")},[z,c,R]),K=u.useCallback(()=>{const l={sourceId:z,targetId:c,strategy:q,tables:C,createBackup:S,dryRun:j,scheduledAt:b??void 0,conflictResolutions:Object.entries(B).reduce((s,[a,N])=>({...s,[a]:{conflictId:a,strategy:N}}),{})};I?.(l)},[z,c,q,C,S,j,b,B,I]),_=(l,s)=>{g(a=>({...a,[l]:s}))},X=l=>{if(!M)return;const s={};M.conflicts.forEach(a=>{s[a.id]=l}),g(s)},p={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-text-muted, #888)"};return e.jsxs("div",{className:`nice-data-merge-builder ${L||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:p.bg,color:p.text,fontFamily:"system-ui, sans-serif",...Q},"data-testid":Y,children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:`1px solid ${p.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsxs("h3",{style:{margin:0,fontSize:18},children:[e.jsx(i.NiceIcon,{name:"shuffle",size:16})," ",o("dataMergeBuilder.dataMerge","Data Merge")]}),e.jsx("div",{style:{display:"flex",gap:8,marginLeft:"auto"},children:["select","preview","conflicts","options","confirm"].map((l,s)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:m===l?"var(--nice-color-primary, #3b82f6)":["select","preview","conflicts","options","confirm"].indexOf(m)>s?"var(--nice-color-success, #22c55e)":p.cardBg,display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:600},children:["select","preview","conflicts","options","confirm"].indexOf(m)>s?e.jsx(i.NiceIcon,{name:"check",size:14}):s+1}),s<4&&e.jsx("div",{style:{width:24,height:2,background:["select","preview","conflicts","options","confirm"].indexOf(m)>s?"var(--nice-color-success, #22c55e)":p.border}})]},l))}),e.jsx(i.NiceTutorialButton,{steps:i.resolveTutorial(G,Be)})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[m==="select"&&e.jsxs("div",{style:{maxWidth:600,margin:"0 auto"},children:[e.jsx("h4",{style:{marginTop:0},children:o("dataMergeBuilder.selectEnvironments","Select Environments")}),e.jsx("p",{style:{color:p.textMuted,fontSize:13},children:o("dataMergeBuilder.chooseTheSourceAndTarget","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:p.textMuted},children:o("dataMergeBuilder.sourceEnvironment","Source Environment")}),e.jsxs("select",{value:z,onChange:l=>{y(l.target.value),U("")},style:{width:"100%",padding:12,borderRadius:8,border:`1px solid ${p.border}`,background:p.cardBg,color:p.text,fontSize:14},children:[e.jsx("option",{value:"",children:o("dataMergeBuilder.selectSource","Select source...")}),f.map(l=>e.jsx("option",{value:l.id,children:l.displayName},l.id))]}),d&&e.jsxs("div",{style:{marginTop:12,padding:12,background:$[d.environment]+"20",borderRadius:8,border:`1px solid ${$[d.environment]}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(i.NiceIcon,{name:H[d.environment],size:20}),e.jsx("span",{style:{fontWeight:600},children:d.displayName})]}),e.jsx("div",{style:{fontSize:11,color:p.textMuted,marginTop:4},children:o("dataMergeBuilder.records","{records} records").replace("{records}",String(d.size?.records.toLocaleString()??""))})]})]}),e.jsx("div",{style:{fontSize:24,color:p.textMuted},children:e.jsx(i.NiceIcon,{name:"arrow-right",size:24})}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:p.textMuted},children:o("dataMergeBuilder.targetEnvironment","Target Environment")}),e.jsxs("select",{value:c,onChange:l=>U(l.target.value),disabled:!z,style:{width:"100%",padding:12,borderRadius:8,border:`1px solid ${p.border}`,background:p.cardBg,color:p.text,fontSize:14,opacity:z?1:.5},children:[e.jsx("option",{value:"",children:o("dataMergeBuilder.selectTarget","Select target...")}),r.map(l=>e.jsx("option",{value:l.id,children:l.displayName},l.id))]}),t&&e.jsxs("div",{style:{marginTop:12,padding:12,background:$[t.environment]+"20",borderRadius:8,border:`1px solid ${$[t.environment]}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(i.NiceIcon,{name:H[t.environment],size:20}),e.jsx("span",{style:{fontWeight:600},children:t.displayName}),t.isProtected&&e.jsx("span",{children:e.jsx(i.NiceIcon,{name:"lock",size:16})})]}),e.jsx("div",{style:{fontSize:11,color:p.textMuted,marginTop:4},children:o("dataMergeBuilder.records","{records} records").replace("{records}",String(t.size?.records.toLocaleString()??""))})]})]})]}),e.jsxs("div",{style:{marginTop:32,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:V,style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13},children:o("dataMergeBuilder.cancel","Cancel")}),e.jsx("button",{onClick:T,disabled:!z||!c||O,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:z&&c&&!O?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:z&&c&&!O?1:.5},children:O?e.jsxs(e.Fragment,{children:[e.jsx(i.NiceIcon,{name:"clock",size:14})," ",o("dataMergeBuilder.loading","Loading...")]}):e.jsxs(e.Fragment,{children:[o("dataMergeBuilder.previewChanges","Preview Changes")," ",e.jsx(i.NiceIcon,{name:"arrow-right",size:14})]})})]})]}),m==="preview"&&M&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:24},children:[e.jsxs("button",{onClick:()=>x("select"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",o("dataMergeBuilder.back","Back")]}),e.jsx("h4",{style:{margin:0},children:o("dataMergeBuilder.previewChanges","Preview Changes")})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:12,marginBottom:24},children:[e.jsxs("div",{style:{padding:16,background:"var(--nice-success-tint-12, #22c55e20)",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--nice-color-success, #22c55e)"},children:["+",n.inserts]}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:o("dataMergeBuilder.inserts","Inserts")})]}),e.jsxs("div",{style:{padding:16,background:"var(--nice-warning-tint-15, #f59e0b20)",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--nice-color-warning, #f59e0b)"},children:["~",n.updates]}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:o("dataMergeBuilder.updates","Updates")})]}),e.jsxs("div",{style:{padding:16,background:"var(--nice-danger-tint-15, #ef444420)",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--nice-color-error, #ef4444)"},children:["-",n.deletes]}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:o("dataMergeBuilder.deletes","Deletes")})]}),e.jsxs("div",{style:{padding:16,background:"var(--nice-accent-tint-12, #8b5cf620)",borderRadius:8,textAlign:"center"},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:600,color:"var(--nice-color-accent, #8b5cf6)"},children:[e.jsx(i.NiceIcon,{name:"warning",size:14})," ",n.conflicts]}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:o("dataMergeBuilder.conflicts","Conflicts")})]})]}),e.jsxs("div",{style:{marginBottom:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("span",{style:{fontSize:12,color:p.textMuted},children:o("dataMergeBuilder.selectTablesToMerge","Select tables to merge ({selectedTables} / {tables})").replace("{selectedTables}",String(C.length)).replace("{tables}",String(M.tables.length))}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>W(M.tables.map(l=>l.table)),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:11},children:o("dataMergeBuilder.selectAll","Select All")}),e.jsx("button",{onClick:()=>W([]),style:{padding:"4px 8px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:11},children:o("dataMergeBuilder.clear","Clear")})]})]}),e.jsx("div",{style:{border:`1px solid ${p.border}`,borderRadius:8,overflow:"hidden"},children:M.tables.map(l=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",borderBottom:`1px solid ${p.border}`,cursor:"pointer",background:C.includes(l.table)?p.cardBg:"transparent"},children:[e.jsx("input",{type:"checkbox",checked:C.includes(l.table),onChange:s=>{s.target.checked?W(a=>[...a,l.table]):W(a=>a.filter(N=>N!==l.table))}}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:l.displayName}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:l.module})]}),e.jsxs("div",{style:{display:"flex",gap:12,fontSize:12},children:[l.inserts>0&&e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",l.inserts]}),l.updates>0&&e.jsxs("span",{style:{color:"var(--nice-color-warning, #f59e0b)"},children:["~",l.updates]}),l.deletes>0&&e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",l.deletes]}),l.conflicts>0&&e.jsxs("span",{style:{color:"var(--nice-color-accent, #8b5cf6)"},children:[e.jsx(i.NiceIcon,{name:"warning",size:14})," ",l.conflicts]})]})]},l.table))})]}),e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsxs("button",{onClick:()=>x("select"),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",o("dataMergeBuilder.back","Back")]}),e.jsxs("button",{onClick:()=>x(n.conflicts>0?"conflicts":"options"),disabled:C.length===0,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:C.length>0?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:C.length>0?1:.5},children:[n.conflicts>0?o("dataMergeBuilder.resolveConflicts","Resolve Conflicts"):o("dataMergeBuilder.configureMerge","Configure Merge")," ",e.jsx(i.NiceIcon,{name:"arrow-right",size:14})]})]})]}),m==="conflicts"&&M&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:24},children:[e.jsxs("button",{onClick:()=>x("preview"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",o("dataMergeBuilder.back","Back")]}),e.jsx("h4",{style:{margin:0},children:o("dataMergeBuilder.resolveConflictsRemaining","Resolve Conflicts ({unresolvedConflicts} remaining)").replace("{unresolvedConflicts}",String(v.length))})]}),e.jsxs("div",{style:{padding:16,background:p.cardBg,borderRadius:8,marginBottom:24,display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:13},children:o("dataMergeBuilder.applyToAllConflicts","Apply to all conflicts:")}),e.jsx("button",{onClick:()=>X("keep-source"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:o("dataMergeBuilder.keepSource","Keep Source")}),e.jsx("button",{onClick:()=>X("keep-target"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:o("dataMergeBuilder.keepTarget","Keep Target")})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:M.conflicts.map(l=>{const s=!!B[l.id];return e.jsxs("div",{style:{padding:16,background:p.cardBg,borderRadius:8,border:`1px solid ${s?"var(--nice-color-success, #22c55e)":"var(--nice-color-accent, #8b5cf6)"}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:12},children:[e.jsx("span",{style:{fontSize:16},children:e.jsx(i.NiceIcon,{name:s?"check":"warning",size:16})}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontWeight:500},children:[l.table,".",l.field]}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:o("dataMergeBuilder.record","Record: {recordId} • {type}").replace("{recordId}",String(l.recordId)).replace("{type}",String(l.type.replace("-"," ")))})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs("div",{role:"button",tabIndex:0,"aria-pressed":B[l.id]==="keep-source",onKeyDown:i.clickOnActivationKey,style:{padding:12,background:B[l.id]==="keep-source"?"var(--nice-success-tint-12, #22c55e20)":p.bg,borderRadius:6,border:`1px solid ${B[l.id]==="keep-source"?"var(--nice-color-success, #22c55e)":p.border}`,cursor:"pointer"},onClick:()=>_(l.id,"keep-source"),children:[e.jsx("div",{style:{fontSize:10,color:p.textMuted,marginBottom:4},children:o("dataMergeBuilder.source","Source ({displayName})").replace("{displayName}",String(d?.displayName??""))}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13},children:String(l.sourceValue)})]}),e.jsxs("div",{role:"button",tabIndex:0,"aria-pressed":B[l.id]==="keep-target",onKeyDown:i.clickOnActivationKey,style:{padding:12,background:B[l.id]==="keep-target"?"var(--nice-success-tint-12, #22c55e20)":p.bg,borderRadius:6,border:`1px solid ${B[l.id]==="keep-target"?"var(--nice-color-success, #22c55e)":p.border}`,cursor:"pointer"},onClick:()=>_(l.id,"keep-target"),children:[e.jsx("div",{style:{fontSize:10,color:p.textMuted,marginBottom:4},children:o("dataMergeBuilder.target","Target ({displayName})").replace("{displayName}",String(t?.displayName??""))}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13},children:String(l.targetValue)})]})]})]},l.id)})}),e.jsxs("div",{style:{marginTop:24,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsxs("button",{onClick:()=>x("preview"),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",o("dataMergeBuilder.back","Back")]}),e.jsxs("button",{onClick:()=>x("options"),disabled:v.length>0,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:v.length===0?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:v.length===0?1:.5},children:[o("dataMergeBuilder.configureMerge","Configure Merge")," ",e.jsx(i.NiceIcon,{name:"arrow-right",size:14})]})]})]}),m==="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.jsxs("button",{onClick:()=>x(n.conflicts>0?"conflicts":"preview"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",o("dataMergeBuilder.back","Back")]}),e.jsx("h4",{style:{margin:0},children:o("dataMergeBuilder.mergeOptions","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:S,onChange:l=>h(l.target.checked)}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13},children:o("dataMergeBuilder.createBackupBeforeMerge","Create backup before merge")}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:o("dataMergeBuilder.recommendedForProtectedEnvironments","Recommended for protected environments")})]})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:j,onChange:l=>E(l.target.checked)}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13},children:o("dataMergeBuilder.dryRunPreviewOnly","Dry run (preview only)")}),e.jsx("div",{style:{fontSize:11,color:p.textMuted},children:o("dataMergeBuilder.simulateMergeWithoutApplyingChanges","Simulate merge without applying changes")})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:p.textMuted},children:o("dataMergeBuilder.scheduleMergeOptional","Schedule merge (optional)")}),e.jsx("input",{type:"datetime-local",value:b?.toISOString().slice(0,16)??"",onChange:l=>P(l.target.value?new Date(l.target.value):null),style:{padding:10,borderRadius:6,border:`1px solid ${p.border}`,background:p.cardBg,color:p.text,fontSize:13}})]})]}),e.jsxs("div",{style:{marginTop:32,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsxs("button",{onClick:()=>x(n.conflicts>0?"conflicts":"preview"),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",o("dataMergeBuilder.back","Back")]}),e.jsxs("button",{onClick:()=>x("confirm"),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:[o("dataMergeBuilder.reviewAndConfirm","Review & Confirm")," ",e.jsx(i.NiceIcon,{name:"arrow-right",size:14})]})]})]}),m==="confirm"&&M&&e.jsxs("div",{style:{maxWidth:500,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:24},children:[e.jsxs("button",{onClick:()=>x("options"),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:12},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",o("dataMergeBuilder.back","Back")]}),e.jsx("h4",{style:{margin:0},children:o("dataMergeBuilder.confirmMerge","Confirm Merge")})]}),e.jsxs("div",{style:{padding:20,background:p.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:$[d?.environment??"development"]+"30",borderRadius:6},children:[e.jsx(i.NiceIcon,{name:H[d?.environment??"development"],size:14})," ",d?.displayName]}),e.jsx("span",{children:e.jsx(i.NiceIcon,{name:"arrow-right",size:12})}),e.jsxs("div",{style:{padding:"8px 12px",background:$[t?.environment??"production"]+"30",borderRadius:6},children:[e.jsx(i.NiceIcon,{name:H[t?.environment??"production"],size:14})," ",t?.displayName]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px 16px",fontSize:13},children:[e.jsx("span",{style:{color:p.textMuted},children:o("dataMergeBuilder.tables","Tables")}),e.jsx("span",{children:C.length}),e.jsx("span",{style:{color:p.textMuted},children:o("dataMergeBuilder.recordsAffected","Records affected")}),e.jsx("span",{children:n.inserts+n.updates+n.deletes}),e.jsx("span",{style:{color:p.textMuted},children:o("dataMergeBuilder.backup","Backup")}),e.jsx("span",{children:S?o("dataMergeBuilder.yes","Yes"):o("dataMergeBuilder.no","No")}),e.jsx("span",{style:{color:p.textMuted},children:o("dataMergeBuilder.mode","Mode")}),e.jsx("span",{children:j?o("dataMergeBuilder.dryRun","Dry run"):o("dataMergeBuilder.applyChanges","Apply changes")}),b&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:p.textMuted},children:o("dataMergeBuilder.scheduled","Scheduled")}),e.jsx("span",{children:b.toLocaleString()})]})]})]}),t?.isProtected&&e.jsxs("div",{style:{padding:12,background:"var(--nice-warning-tint-15, #f59e0b20)",border:"1px solid var(--nice-warning, #f59e0b)",borderRadius:6,marginBottom:24,fontSize:12},children:[e.jsx(i.NiceIcon,{name:"warning",size:14})," ",o("dataMergeBuilder.targetEnvironmentIsProtectedAnd","Target environment is protected and may require approval.")]}),e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:V,style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${p.border}`,background:"transparent",color:p.text,cursor:"pointer",fontSize:13},children:o("dataMergeBuilder.cancel","Cancel")}),e.jsx("button",{onClick:K,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:j?e.jsxs(e.Fragment,{children:[e.jsx(i.NiceIcon,{name:"search",size:14})," ",o("dataMergeBuilder.runDryMerge","Run Dry Merge")]}):b?e.jsxs(e.Fragment,{children:[e.jsx(i.NiceIcon,{name:"calendar",size:14})," ",o("dataMergeBuilder.scheduleMerge","Schedule Merge")]}):e.jsxs(e.Fragment,{children:[e.jsx(i.NiceIcon,{name:"shuffle",size:14})," ",o("dataMergeBuilder.executeMerge","Execute Merge")]})})]})]})]})]})},Me=Object.freeze(Object.defineProperty({__proto__:null,NiceDataMergeBuilder:pe},Symbol.toStringTag,{value:"Module"})),Ce=[{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"}],te={"concurrent-update":{label:"Concurrent Update",icon:"zap",description:"Record was modified in both environments"},"delete-update":{label:"Delete vs Update",icon:"trash",description:"Record deleted in source but updated in target"},"update-delete":{label:"Update vs Delete",icon:"edit",description:"Record updated in source but deleted in target"},"constraint-violation":{label:"Constraint Violation",icon:"slash",description:"Change violates database constraints"},"unique-key-conflict":{label:"Unique Key Conflict",icon:"lock",description:"Duplicate unique key detected"},"foreign-key-missing":{label:"Missing FK Reference",icon:"link",description:"Referenced record does not exist"},"type-mismatch":{label:"Type Mismatch",icon:"warning",description:"Data type incompatibility"},"schema-change":{label:"Schema Change",icon:"clipboard",description:"Schema differs between environments"}},re={low:"var(--nice-color-success, #22c55e)",medium:"var(--nice-color-warning, #f59e0b)",high:"var(--nice-warning, #f97316)",critical:"var(--nice-color-error, #ef4444)"},ue=({conflicts:f=Ce,sourceEnvironment:k="development",targetEnvironment:A="uat",showSuggestions:R=!0,allowCustomValues:I=!0,onResolve:V,onSkip:G,onCancel:L,className:Q,style:Y,"data-testid":o})=>{const{t:m}=i.useNiceTranslation(),[x,z]=u.useState(0),[y,c]=u.useState({}),[U,M]=u.useState({}),[D,C]=u.useState(null),[W,q]=u.useState(""),[F,S]=u.useState("single"),h=f[x],j=u.useMemo(()=>Object.keys(y).length,[y]),E=u.useMemo(()=>{if(!h)return!1;const r=U[h.id]||{};return h.fields.every(n=>r[n.field]?.resolution)},[h,U]),b=u.useCallback(r=>{if(U[r.id])return;const n={};r.fields.forEach(v=>{n[v.field]={resolution:"source",value:v.sourceValue}}),M(v=>({...v,[r.id]:n}))},[U]);u.useEffect(()=>{h&&b(h)},[h,b]);const P=(r,n,v)=>{if(!h)return;const T=h.fields.find(_=>_.field===r);if(!T)return;const K=n==="source"?T.sourceValue:n==="target"?T.targetValue:v;M(_=>({..._,[h.id]:{..._[h.id],[r]:{resolution:n,value:K}}}))},B=r=>{if(!h)return;const n={};h.fields.forEach(v=>{n[v.field]={resolution:r,value:r==="source"?v.sourceValue:v.targetValue}}),M(v=>({...v,[h.id]:n}))},g=()=>{if(!h||!E)return;const r={conflictId:h.id,strategy:"manual",fieldResolutions:U[h.id]};c(n=>({...n,[h.id]:r})),x<f.length-1&&z(x+1)},O=()=>{h&&(G?.(h.id),x<f.length-1&&z(x+1))},w=()=>{const r=Object.values(y);V?.(r)},d=(r,n)=>r===null?"null":r===void 0?"undefined":n==="date"?new Date(r).toLocaleDateString():n==="number"?Number(r).toLocaleString():typeof r=="boolean"?r?"true":"false":String(r),t={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-text-muted, #888)",source:$[k],target:$[A]};return f.length===0?e.jsxs("div",{className:`nice-data-conflict-resolver ${Q||""}`,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",background:t.bg,color:t.text,fontFamily:"system-ui, sans-serif",padding:40,...Y},"data-testid":o,children:[e.jsx("div",{style:{fontSize:48,marginBottom:16},children:e.jsx(i.NiceIcon,{name:"check",size:48})}),e.jsx("h3",{style:{margin:0},children:m("dataConflictResolver.noConflicts","No Conflicts")}),e.jsx("p",{style:{color:t.textMuted,marginTop:8},children:m("dataConflictResolver.allDataIsCompatibleFor","All data is compatible for merge.")})]}):e.jsxs("div",{className:`nice-data-conflict-resolver ${Q||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:t.bg,color:t.text,fontFamily:"system-ui, sans-serif",...Y},"data-testid":o,children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:`1px solid ${t.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsxs("h3",{style:{margin:0,fontSize:18},children:[e.jsx(i.NiceIcon,{name:"warning",size:16})," ",m("dataConflictResolver.resolveConflicts","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:[m("dataConflictResolver.resolved2","Resolved:")," ",e.jsx("strong",{style:{color:t.text},children:j})," / ",f.length]}),e.jsx("div",{style:{width:100,height:6,background:t.cardBg,borderRadius:3,overflow:"hidden"},children:e.jsx("div",{style:{width:`${j/f.length*100}%`,height:"100%",background:"var(--nice-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:()=>S("single"),style:{padding:"6px 12px",border:"none",background:F==="single"?t.cardBg:"transparent",color:t.text,cursor:"pointer",fontSize:12},children:m("dataConflictResolver.single","Single")}),e.jsx("button",{onClick:()=>S("list"),style:{padding:"6px 12px",border:"none",borderLeft:`1px solid ${t.border}`,background:F==="list"?t.cardBg:"transparent",color:t.text,cursor:"pointer",fontSize:12},children:m("dataConflictResolver.list","List")})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[F==="single"&&h&&e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:20},children:[e.jsxs("button",{onClick:()=>z(Math.max(0,x-1)),disabled:x===0,style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:x>0?"pointer":"not-allowed",opacity:x>0?1:.5,fontSize:12},children:[e.jsx(i.NiceIcon,{name:"arrow-left",size:14})," ",m("dataConflictResolver.previous","Previous")]}),e.jsx("span",{style:{fontSize:13,color:t.textMuted},children:m("dataConflictResolver.conflictOf","Conflict {current} of {total}").replace("{current}",String(x+1)).replace("{total}",String(f.length))}),e.jsxs("button",{onClick:()=>z(Math.min(f.length-1,x+1)),disabled:x===f.length-1,style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:x<f.length-1?"pointer":"not-allowed",opacity:x<f.length-1?1:.5,fontSize:12},children:[m("dataConflictResolver.next","Next")," ",e.jsx(i.NiceIcon,{name:"arrow-right",size:14})]}),y[h.id]&&e.jsxs("span",{style:{marginLeft:"auto",padding:"4px 8px",background:"color-mix(in srgb, var(--nice-color-success, #22c55e) 19%, transparent)",color:"var(--nice-color-success, #22c55e)",borderRadius:4,fontSize:11},children:[e.jsx(i.NiceIcon,{name:"check",size:14})," ",m("dataConflictResolver.resolved","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:e.jsx(i.NiceIcon,{name:te[h.type].icon,size:24})}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{fontWeight:600,fontSize:15},children:[h.tableName,":"," ",h.recordLabel??h.recordId]}),e.jsxs("div",{style:{fontSize:12,color:t.textMuted},children:[te[h.type].label," —"," ",te[h.type].description]})]}),e.jsx("div",{style:{padding:"4px 8px",background:re[h.severity]+"30",color:re[h.severity],borderRadius:4,fontSize:10,fontWeight:600,textTransform:"uppercase"},children:h.severity})]}),h.metadata&&e.jsxs("div",{style:{display:"flex",gap:24,marginTop:12,paddingTop:12,borderTop:`1px solid ${t.border}`,fontSize:11,color:t.textMuted},children:[h.metadata.sourceModifiedAt&&e.jsx("span",{children:m("dataConflictResolver.sourceModifiedBy","Source modified: {sourceModifiedAt} by {sourceModifiedBy}").replace("{sourceModifiedAt}",String(h.metadata.sourceModifiedAt.toLocaleString())).replace("{sourceModifiedBy}",String(h.metadata.sourceModifiedBy??""))}),h.metadata.targetModifiedAt&&e.jsx("span",{children:m("dataConflictResolver.targetModifiedBy","Target modified: {targetModifiedAt} by {targetModifiedBy}").replace("{targetModifiedAt}",String(h.metadata.targetModifiedAt.toLocaleString())).replace("{targetModifiedBy}",String(h.metadata.targetModifiedBy??""))})]}),R&&h.suggestion&&e.jsxs("div",{style:{marginTop:12,padding:12,background:"var(--nice-primary-tint-12, #3b82f620)",border:"1px solid var(--nice-primary, #3b82f6)",borderRadius:6,fontSize:12},children:[e.jsxs("strong",{children:[e.jsx(i.NiceIcon,{name:"lightbulb",size:14})," ",m("dataConflictResolver.suggestion","Suggestion:")]})," ",h.suggestionReason,e.jsx("button",{onClick:()=>B(h.suggestion==="keep-source"?"source":"target"),style:{marginLeft:12,padding:"4px 8px",borderRadius:4,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:11},children:m("dataConflictResolver.apply","Apply")})]})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:16},children:[e.jsx("span",{style:{fontSize:12,color:t.textMuted,lineHeight:"28px"},children:m("dataConflictResolver.applyToAllFields","Apply to all fields:")}),e.jsxs("button",{onClick:()=>B("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:[e.jsx(i.NiceIcon,{name:H[k],size:14})," ",m("dataConflictResolver.keepSource","Keep Source")]}),e.jsxs("button",{onClick:()=>B("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:[e.jsx(i.NiceIcon,{name:H[A],size:14})," ",m("dataConflictResolver.keepTarget","Keep Target")]})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:h.fields.map(r=>{const n=U[h.id]?.[r.field],v=D===`${h.id}-${r.field}`;return e.jsxs("div",{style:{background:t.cardBg,borderRadius:8,overflow:"hidden",border:`1px solid ${n?.resolution?"var(--nice-color-success, #22c55e)":t.border}`},children:[e.jsxs("div",{style:{padding:"10px 16px",background:n?.resolution?"var(--nice-success-tint-10, #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:n?.resolution?"var(--nice-color-success, #22c55e)":t.textMuted},children:e.jsx(i.NiceIcon,{name:n?.resolution?"check":"circle",size:14})}),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",{role:"button",tabIndex:0,"aria-pressed":n?.resolution==="source",onKeyDown:i.clickOnActivationKey,onClick:()=>P(r.field,"source"),style:{padding:16,background:n?.resolution==="source"?`${t.source}20`:t.bg,cursor:"pointer",border:n?.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:[e.jsx(i.NiceIcon,{name:H[k],size:14})," ",m("dataConflictResolver.source","Source"),n?.resolution==="source"&&e.jsx("span",{style:{marginLeft:4},children:e.jsx(i.NiceIcon,{name:"check",size:14})})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:14,wordBreak:"break-all"},children:d(r.sourceValue,r.dataType)})]}),e.jsxs("div",{role:"button",tabIndex:0,"aria-pressed":n?.resolution==="target",onKeyDown:i.clickOnActivationKey,onClick:()=>P(r.field,"target"),style:{padding:16,background:n?.resolution==="target"?`${t.target}20`:t.bg,cursor:"pointer",border:n?.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:[e.jsx(i.NiceIcon,{name:H[A],size:14})," ",m("dataConflictResolver.target","Target"),n?.resolution==="target"&&e.jsx("span",{style:{marginLeft:4},children:e.jsx(i.NiceIcon,{name:"check",size:14})})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:14,wordBreak:"break-all"},children:d(r.targetValue,r.dataType)})]})]}),I&&e.jsxs("div",{style:{padding:12,background:n?.resolution==="custom"?"var(--nice-accent-tint-12, #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:m("dataConflictResolver.customValue","Custom value:")}),v?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:W,onChange:T=>q(T.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:()=>{P(r.field,"custom",W),C(null)},style:{padding:"6px 12px",borderRadius:4,border:"none",background:"var(--nice-color-accent, #8b5cf6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12},children:m("dataConflictResolver.apply","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:m("dataConflictResolver.cancel","Cancel")})]}):e.jsx("button",{onClick:()=>{q(n?.resolution==="custom"?String(n.value):String(r.sourceValue)),C(`${h.id}-${r.field}`)},style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${t.border}`,background:n?.resolution==="custom"?"var(--nice-accent-tint-12, #8b5cf620)":"transparent",color:t.text,cursor:"pointer",fontSize:12},children:n?.resolution==="custom"?m("dataConflictResolver.using","Using: {value}").replace("{value}",String(d(n.value,r.dataType))):m("dataConflictResolver.enterCustom","Enter custom...")})]})]},r.field)})}),e.jsxs("div",{style:{marginTop:24,display:"flex",gap:12,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:O,style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${t.border}`,background:"transparent",color:t.text,cursor:"pointer",fontSize:13},children:m("dataConflictResolver.skip","Skip")}),e.jsx("button",{onClick:g,disabled:!E,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:E?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:E?1:.5},children:x<f.length-1?e.jsxs(e.Fragment,{children:[m("dataConflictResolver.confirmAndNext","Confirm & Next")," ",e.jsx(i.NiceIcon,{name:"arrow-right",size:14})]}):m("dataConflictResolver.confirm","Confirm")})]})]}),F==="list"&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:f.map((r,n)=>{const v=!!y[r.id];return e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:i.clickOnActivationKey,onClick:()=>{z(n),S("single")},style:{padding:16,background:t.cardBg,borderRadius:8,cursor:"pointer",border:`1px solid ${v?"var(--nice-color-success, #22c55e)":t.border}`,display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:20},children:e.jsx(i.NiceIcon,{name:v?"check":te[r.type].icon,size:14})}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{fontWeight:500},children:[r.tableName,": ",r.recordLabel??r.recordId]}),e.jsx("div",{style:{fontSize:11,color:t.textMuted},children:m("dataConflictResolver.fields","{fields} fields • {label}").replace("{fields}",String(r.fields.length)).replace("{label}",String(te[r.type].label))})]}),e.jsx("div",{style:{padding:"4px 8px",background:re[r.severity]+"30",color:re[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:m("dataConflictResolver.cancel","Cancel")}),e.jsx("button",{onClick:w,disabled:j===0,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:j>0?"pointer":"not-allowed",fontSize:13,fontWeight:500,opacity:j>0?1:.5},children:m("dataConflictResolver.finishResolved","Finish ({resolvedCount} resolved)").replace("{resolvedCount}",String(j))})]})]})},we=Object.freeze(Object.defineProperty({__proto__:null,NiceDataConflictResolver:ue},Symbol.toStringTag,{value:"Module"})),Re=[{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"}],Te=[{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}],Ie={enabled:!0,maxCount:30,maxAgeDays:90,keepTagged:!0,keepLocked:!0},ae=f=>{if(f===0)return"0 B";const k=1024,A=["B","KB","MB","GB","TB"],R=Math.floor(Math.log(f)/Math.log(k));return parseFloat((f/Math.pow(k,R)).toFixed(1))+" "+A[R]},oe=f=>{const A=new Date().getTime()-f.getTime(),R=Math.floor(A/(1e3*60*60)),I=Math.floor(R/24);return I>0?`${I} day${I>1?"s":""} ago`:R>0?`${R} hour${R>1?"s":""} ago`:"Just now"},De=f=>{const k=f.split(" ");if(k.length!==5)return f;const[A,R,I,V,G]=k;return I==="*"&&V==="*"&&G==="*"?`Daily at ${R.padStart(2,"0")}:${A.padStart(2,"0")}`:I==="*"&&V==="*"?`Weekly on ${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][parseInt(G)]} at ${R.padStart(2,"0")}:${A.padStart(2,"0")}`:V==="*"?`Monthly on day ${I} at ${R.padStart(2,"0")}:${A.padStart(2,"0")}`:f},Ne={creating:{icon:"clock",color:"var(--nice-color-warning, #f59e0b)",label:"Creating"},ready:{icon:"check",color:"var(--nice-color-success, #22c55e)",label:"Ready"},failed:{icon:"close",color:"var(--nice-color-error, #ef4444)",label:"Failed"},expired:{icon:"clock",color:"var(--nice-text-muted, #888)",label:"Expired"},locked:{icon:"lock",color:"var(--nice-color-primary, #3b82f6)",label:"Locked"}},$e={manual:{icon:"user",label:"Manual"},scheduled:{icon:"calendar",label:"Scheduled"},"pre-merge":{icon:"shuffle",label:"Pre-Merge"},"pre-restore":{icon:"reply",label:"Pre-Restore"}},ge=({environment:f="production",snapshots:k=Re,retentionPolicy:A=Ie,schedules:R=Te,onCreateSnapshot:I,onRestoreSnapshot:V,onDeleteSnapshot:G,onCompareSnapshots:L,onExportSnapshot:Q,onUpdateRetentionPolicy:Y,onUpdateSchedules:o,className:m,style:x,"data-testid":z})=>{const{t:y}=i.useNiceTranslation(),[c,U]=u.useState("snapshots"),[M,D]=u.useState(!1),[C,W]=u.useState([]),[q,F]=u.useState(""),[S,h]=u.useState(""),[j,E]=u.useState(A),[b,P]=u.useState(R),B=u.useMemo(()=>{const t=k.filter(n=>n.status==="ready").length,r=k.reduce((n,v)=>n+v.size.bytes,0);return{total:k.length,ready:t,totalSize:r}},[k]),g=()=>{I?.({name:q||`Snapshot ${new Date().toISOString()}`,description:S}),D(!1),F(""),h("")},O=()=>{C.length===2&&L?.(C[0],C[1])},w=t=>{const r=b.map(n=>n.id===t?{...n,enabled:!n.enabled}:n);P(r),o?.(r)},d={bg:"var(--nice-bg-elevated, #1e1e1e)",cardBg:"var(--nice-bg-elevated, #252525)",border:"var(--nice-bg-tertiary, #333)",text:"var(--nice-text-primary, #e0e0e0)",textMuted:"var(--nice-text-muted, #888)",env:$[f]};return e.jsxs("div",{className:`nice-data-snapshot ${m||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:d.bg,color:d.text,fontFamily:"system-ui, sans-serif",...x},"data-testid":z,children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:`1px solid ${d.border}`,display:"flex",alignItems:"center",gap:16},children:[e.jsxs("h3",{style:{margin:0,fontSize:18},children:[e.jsx(i.NiceIcon,{name:"camera",size:16})," ",y("dataSnapshot.snapshots","Snapshots")]}),e.jsxs("div",{style:{padding:"4px 10px",background:d.env+"30",borderRadius:4,fontSize:12,display:"flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:H[f],size:14})," ",f.charAt(0).toUpperCase()+f.slice(1)]}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:16,fontSize:12,color:d.textMuted},children:[e.jsxs("span",{children:[e.jsx("strong",{style:{color:d.text},children:B.total})," ",y("dataSnapshot.snapshots2","snapshots")]}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:d.text},children:ae(B.totalSize)})," ",y("dataSnapshot.total","total")]})]}),e.jsxs("button",{onClick:()=>D(!0),style:{padding:"8px 16px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500,display:"flex",alignItems:"center",gap:6},children:[e.jsx(i.NiceIcon,{name:"camera",size:14})," ",y("dataSnapshot.createSnapshot","Create Snapshot")]})]}),e.jsx("div",{style:{display:"flex",borderBottom:`1px solid ${d.border}`,padding:"0 20px"},children:["snapshots","schedules","settings"].map(t=>e.jsxs("button",{onClick:()=>U(t),style:{padding:"12px 20px",border:"none",background:"transparent",color:c===t?d.text:d.textMuted,cursor:"pointer",fontSize:13,fontWeight:c===t?600:400,borderBottom:c===t?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent",marginBottom:-1},children:[t==="snapshots"&&e.jsxs(e.Fragment,{children:[e.jsx(i.NiceIcon,{name:"folder",size:14})," ",y("dataSnapshot.snapshots","Snapshots")]}),t==="schedules"&&e.jsxs(e.Fragment,{children:[e.jsx(i.NiceIcon,{name:"calendar",size:14})," ",y("dataSnapshot.schedules","Schedules")]}),t==="settings"&&e.jsxs(e.Fragment,{children:[e.jsx(i.NiceIcon,{name:"settings",size:14})," ",y("dataSnapshot.settings","Settings")]})]},t))}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[c==="snapshots"&&e.jsxs("div",{children:[C.length>0&&e.jsxs("div",{style:{padding:12,background:d.cardBg,borderRadius:8,marginBottom:16,display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:13},children:y("dataSnapshot.selected","{selectedSnapshots} selected").replace("{selectedSnapshots}",String(C.length))}),C.length===2&&e.jsx("button",{onClick:O,style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${d.border}`,background:"transparent",color:d.text,cursor:"pointer",fontSize:12},children:y("dataSnapshot.compare","Compare")}),e.jsx("button",{onClick:()=>W([]),style:{padding:"6px 12px",borderRadius:4,border:`1px solid ${d.border}`,background:"transparent",color:d.text,cursor:"pointer",fontSize:12,marginLeft:"auto"},children:y("dataSnapshot.clear","Clear")})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:k.map(t=>{const r=C.includes(t.id),n=Ne[t.status],v=$e[t.type];return e.jsx("div",{style:{padding:16,background:d.cardBg,borderRadius:8,border:`1px solid ${r?"var(--nice-color-primary, #3b82f6)":d.border}`},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e.jsx("input",{type:"checkbox",checked:r,onChange:T=>{T.target.checked?W(K=>[...K,t.id]):W(K=>K.filter(_=>_!==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:n.color+"20",color:n.color,borderRadius:4,fontSize:10},children:[e.jsx(i.NiceIcon,{name:n.icon,size:14})," ",n.label]}),e.jsxs("span",{style:{padding:"2px 6px",background:d.bg,color:d.textMuted,borderRadius:4,fontSize:10},children:[e.jsx(i.NiceIcon,{name:v.icon,size:14})," ",v.label]})]}),t.description&&e.jsx("div",{style:{fontSize:12,color:d.textMuted,marginBottom:8},children:t.description}),e.jsxs("div",{style:{display:"flex",gap:16,fontSize:11,color:d.textMuted},children:[e.jsx("span",{children:oe(t.createdAt)}),e.jsx("span",{children:y("dataSnapshot.by","by {name}").replace("{name}",String(t.createdBy.name))}),e.jsx("span",{children:y("dataSnapshot.records","{records} records").replace("{records}",String(t.size.records.toLocaleString()))}),e.jsx("span",{children:ae(t.size.bytes)}),t.tables&&e.jsx("span",{children:y("dataSnapshot.tables","{tables} tables").replace("{tables}",String(t.tables.length))}),t.expiresAt&&e.jsx("span",{style:{color:"var(--nice-color-warning, #f59e0b)"},children:y("dataSnapshot.expires","Expires: {expiresAt}").replace("{expiresAt}",String(t.expiresAt.toLocaleDateString()))})]}),t.tags&&t.tags.length>0&&e.jsx("div",{style:{display:"flex",gap:6,marginTop:8},children:t.tags.map(T=>e.jsxs("span",{style:{padding:"2px 8px",background:"var(--nice-accent-tint-12, #8b5cf620)",color:"var(--nice-color-accent, #8b5cf6)",borderRadius:4,fontSize:10},children:["#",T]},T))})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[t.status==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>V?.(t.id),title:y("dataSnapshot.restore","Restore"),"aria-label":y("dataSnapshot.restore","Restore"),style:{padding:8,borderRadius:4,border:`1px solid ${d.border}`,background:"transparent",color:d.text,cursor:"pointer",fontSize:14},children:e.jsx(i.NiceIcon,{name:"reply",size:14})}),e.jsx("button",{onClick:()=>Q?.(t.id,"sql"),title:y("dataSnapshot.export","Export"),"aria-label":y("dataSnapshot.export","Export"),style:{padding:8,borderRadius:4,border:`1px solid ${d.border}`,background:"transparent",color:d.text,cursor:"pointer",fontSize:14},children:e.jsx(i.NiceIcon,{name:"upload",size:14})})]}),t.status!=="locked"&&e.jsx("button",{onClick:()=>G?.(t.id),title:y("dataSnapshot.delete","Delete"),"aria-label":y("dataSnapshot.delete","Delete"),style:{padding:8,borderRadius:4,border:`1px solid ${d.border}`,background:"transparent",color:"var(--nice-color-error, #ef4444)",cursor:"pointer",fontSize:14},children:e.jsx(i.NiceIcon,{name:"trash",size:14})})]})]})},t.id)})})]}),c==="schedules"&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[b.map(t=>e.jsx("div",{style:{padding:16,background:d.cardBg,borderRadius:8,border:`1px solid ${d.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:()=>w(t.id),style:{width:16,height:16}})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:t.name}),e.jsx("div",{style:{fontSize:12,color:d.textMuted},children:y("dataSnapshot.keepSnapshots","{cron} • Keep {retainCount} snapshots").replace("{cron}",String(De(t.cron))).replace("{retainCount}",String(t.retainCount??""))})]}),e.jsxs("div",{style:{textAlign:"right",fontSize:11,color:d.textMuted},children:[t.enabled&&t.nextRun&&e.jsx("div",{children:y("dataSnapshot.next","Next: {nextRun}").replace("{nextRun}",String(t.nextRun.toLocaleString()))}),t.lastRun&&e.jsx("div",{children:y("dataSnapshot.last","Last: {relativeTime}").replace("{relativeTime}",String(oe(t.lastRun)))})]})]})},t.id)),e.jsx("button",{style:{padding:16,borderRadius:8,border:`1px dashed ${d.border}`,background:"transparent",color:d.textMuted,cursor:"pointer",fontSize:13},children:y("dataSnapshot.addSchedule","+ Add Schedule")})]}),c==="settings"&&e.jsxs("div",{style:{maxWidth:500},children:[e.jsx("h4",{style:{marginTop:0},children:y("dataSnapshot.retentionPolicy","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:j.enabled,onChange:t=>E({...j,enabled:t.target.checked})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13},children:y("dataSnapshot.enableAutomaticCleanup","Enable automatic cleanup")}),e.jsx("div",{style:{fontSize:11,color:d.textMuted},children:y("dataSnapshot.automaticallyDeleteOldSnapshotsBased","Automatically delete old snapshots based on policy")})]})]}),j.enabled&&e.jsxs("div",{style:{padding:16,background:d.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:d.textMuted},children:y("dataSnapshot.maximumNumberOfSnapshots","Maximum number of snapshots")}),e.jsx("input",{type:"number",value:j.maxCount??"",onChange:t=>E({...j,maxCount:parseInt(t.target.value)||void 0}),placeholder:y("dataSnapshot.unlimited","Unlimited"),style:{padding:10,borderRadius:6,border:`1px solid ${d.border}`,background:d.bg,color:d.text,fontSize:13,width:150}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:d.textMuted},children:y("dataSnapshot.maximumAgeDays","Maximum age (days)")}),e.jsx("input",{type:"number",value:j.maxAgeDays??"",onChange:t=>E({...j,maxAgeDays:parseInt(t.target.value)||void 0}),placeholder:y("dataSnapshot.unlimited","Unlimited"),style:{padding:10,borderRadius:6,border:`1px solid ${d.border}`,background:d.bg,color:d.text,fontSize:13,width:150}})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:j.keepTagged??!1,onChange:t=>E({...j,keepTagged:t.target.checked})}),e.jsx("span",{style:{fontSize:13},children:y("dataSnapshot.keepTaggedSnapshots","Keep tagged snapshots")})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:j.keepLocked??!1,onChange:t=>E({...j,keepLocked:t.target.checked})}),e.jsx("span",{style:{fontSize:13},children:y("dataSnapshot.keepLockedSnapshots","Keep locked snapshots")})]})]}),e.jsx("button",{onClick:()=>Y?.(j),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500,alignSelf:"flex-start"},children:y("dataSnapshot.savePolicy","Save Policy")})]})]})]}),M&&e.jsx("div",{role:"presentation",style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>D(!1),children:e.jsxs("div",{role:"presentation",style:{background:d.cardBg,borderRadius:12,padding:24,width:400},onClick:t=>t.stopPropagation(),children:[e.jsxs("h4",{style:{margin:"0 0 16px"},children:[e.jsx(i.NiceIcon,{name:"camera",size:14})," ",y("dataSnapshot.createSnapshot","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:d.textMuted},children:y("dataSnapshot.snapshotName","Snapshot Name")}),e.jsx("input",{type:"text",value:q,onChange:t=>F(t.target.value),placeholder:y("dataSnapshot.snapshot","Snapshot {date}").replace("{date}",String(new Date().toISOString().split("T")[0])),style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${d.border}`,background:d.bg,color:d.text,fontSize:13,boxSizing:"border-box"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:8,fontSize:12,color:d.textMuted},children:y("dataSnapshot.descriptionOptional","Description (optional)")}),e.jsx("textarea",{value:S,onChange:t=>h(t.target.value),placeholder:y("dataSnapshot.whatsThisSnapshotFor","What's this snapshot for?"),rows:3,style:{width:"100%",padding:10,borderRadius:6,border:`1px solid ${d.border}`,background:d.bg,color:d.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:()=>D(!1),style:{padding:"10px 20px",borderRadius:6,border:`1px solid ${d.border}`,background:"transparent",color:d.text,cursor:"pointer",fontSize:13},children:y("dataSnapshot.cancel","Cancel")}),e.jsx("button",{onClick:g,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:13,fontWeight:500},children:y("dataSnapshot.create","Create")})]})]})})]})},Ae=Object.freeze(Object.defineProperty({__proto__:null,NiceDataSnapshot:ge},Symbol.toStringTag,{value:"Module"}));exports.NiceDataBranchGraph=ce;exports.NiceDataBranchGraph$1=ke;exports.NiceDataBranchManager=de;exports.NiceDataBranchManager$1=be;exports.NiceDataConflictResolver=ue;exports.NiceDataConflictResolver$1=we;exports.NiceDataDiffViewer=le;exports.NiceDataDiffViewer$1=je;exports.NiceDataMergeBuilder=pe;exports.NiceDataMergeBuilder$1=Me;exports.NiceDataSnapshot=ge;exports.NiceDataSnapshot$1=Ae;