@theobourgeois/ytdb 0.2.17 → 0.2.18

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 (199) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +3 -1
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/routes-manifest.json +12 -0
  5. package/.next/server/app/[connectionId]/[schema]/[table]/page.js +1 -1
  6. package/.next/server/app/[connectionId]/[schema]/[table]/page.js.nft.json +1 -1
  7. package/.next/server/app/[connectionId]/[schema]/[table]/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/[connectionId]/diff/page.js +2 -2
  9. package/.next/server/app/[connectionId]/diff/page.js.nft.json +1 -1
  10. package/.next/server/app/[connectionId]/diff/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/[connectionId]/migrations/[setId]/page.js +1 -1
  12. package/.next/server/app/[connectionId]/migrations/[setId]/page.js.nft.json +1 -1
  13. package/.next/server/app/[connectionId]/migrations/[setId]/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/[connectionId]/migrations/page.js +1 -1
  15. package/.next/server/app/[connectionId]/migrations/page.js.nft.json +1 -1
  16. package/.next/server/app/[connectionId]/migrations/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/[connectionId]/page.js +1 -1
  18. package/.next/server/app/[connectionId]/page.js.nft.json +1 -1
  19. package/.next/server/app/[connectionId]/page_client-reference-manifest.js +1 -1
  20. package/.next/server/app/[connectionId]/query/page.js +1 -1
  21. package/.next/server/app/[connectionId]/query/page.js.nft.json +1 -1
  22. package/.next/server/app/[connectionId]/query/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/_global-error/page.js +2 -2
  24. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  25. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  26. package/.next/server/app/_global-error.html +1 -1
  27. package/.next/server/app/_global-error.rsc +1 -1
  28. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  29. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  30. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  31. package/.next/server/app/_not-found/page.js +1 -1
  32. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  33. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  34. package/.next/server/app/_not-found.html +1 -1
  35. package/.next/server/app/_not-found.rsc +2 -2
  36. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  37. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  38. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  39. package/.next/server/app/api/activity/route.js +2 -2
  40. package/.next/server/app/api/activity/route.js.nft.json +1 -1
  41. package/.next/server/app/api/adopt/route.js +1 -1
  42. package/.next/server/app/api/adopt/route.js.nft.json +1 -1
  43. package/.next/server/app/api/cell/route.js +2 -2
  44. package/.next/server/app/api/cell/route.js.nft.json +1 -1
  45. package/.next/server/app/api/definition/route.js +2 -2
  46. package/.next/server/app/api/definition/route.js.nft.json +1 -1
  47. package/.next/server/app/api/delete-rows/route.js +2 -2
  48. package/.next/server/app/api/delete-rows/route.js.nft.json +1 -1
  49. package/.next/server/app/api/detect/route.js +1 -133
  50. package/.next/server/app/api/detect/route.js.nft.json +1 -1
  51. package/.next/server/app/api/health/route.js +1 -1
  52. package/.next/server/app/api/health/route.js.nft.json +1 -1
  53. package/.next/server/app/api/insert-row/route.js +3 -3
  54. package/.next/server/app/api/insert-row/route.js.nft.json +1 -1
  55. package/.next/server/app/api/ledger/route.js +1 -1
  56. package/.next/server/app/api/ledger/route.js.nft.json +1 -1
  57. package/.next/server/app/api/lookup/route.js +3 -3
  58. package/.next/server/app/api/lookup/route.js.nft.json +1 -1
  59. package/.next/server/app/api/migrate/route.js +1 -1
  60. package/.next/server/app/api/migrate/route.js.nft.json +1 -1
  61. package/.next/server/app/api/note/route.js +1 -1
  62. package/.next/server/app/api/note/route.js.nft.json +1 -1
  63. package/.next/server/app/api/query/route.js +3 -3
  64. package/.next/server/app/api/query/route.js.nft.json +1 -1
  65. package/.next/server/app/api/reconcile/route.js +20 -0
  66. package/.next/server/app/api/reconcile/route.js.nft.json +1 -0
  67. package/.next/server/app/api/reconcile/route_client-reference-manifest.js +1 -0
  68. package/.next/server/app/api/rehearse/route.js +1 -0
  69. package/.next/server/app/api/rehearse/route.js.nft.json +1 -0
  70. package/.next/server/app/api/rehearse/route_client-reference-manifest.js +1 -0
  71. package/.next/server/app/api/related/route.js +3 -3
  72. package/.next/server/app/api/related/route.js.nft.json +1 -1
  73. package/.next/server/app/api/repo/route.js +1 -1
  74. package/.next/server/app/api/repo/route.js.nft.json +1 -1
  75. package/.next/server/app/api/rows/route.js +2 -2
  76. package/.next/server/app/api/rows/route.js.nft.json +1 -1
  77. package/.next/server/app/api/schema/route.js +3 -3
  78. package/.next/server/app/api/schema/route.js.nft.json +1 -1
  79. package/.next/server/app/api/tables/route.js +3 -3
  80. package/.next/server/app/api/tables/route.js.nft.json +1 -1
  81. package/.next/server/app/api/timeline/route.js +1 -1
  82. package/.next/server/app/api/timeline/route.js.nft.json +1 -1
  83. package/.next/server/app/api/update-row/route.js +3 -3
  84. package/.next/server/app/api/update-row/route.js.nft.json +1 -1
  85. package/.next/server/app/favicon.ico/route.js +1 -1
  86. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  87. package/.next/server/app/icon.svg/route.js +1 -1
  88. package/.next/server/app/icon.svg/route.js.nft.json +1 -1
  89. package/.next/server/app/index.html +1 -1
  90. package/.next/server/app/index.rsc +3 -3
  91. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  92. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  93. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  94. package/.next/server/app/page.js +2 -2
  95. package/.next/server/app/page.js.nft.json +1 -1
  96. package/.next/server/app/page_client-reference-manifest.js +1 -1
  97. package/.next/server/app-paths-manifest.json +3 -1
  98. package/.next/server/chunks/1421.js +1 -0
  99. package/.next/server/chunks/1813.js +1 -0
  100. package/.next/server/chunks/{430.js → 2430.js} +1 -1
  101. package/.next/server/chunks/{741.js → 4741.js} +1 -1
  102. package/.next/server/chunks/{125.js → 5125.js} +11 -7
  103. package/.next/server/chunks/5417.js +133 -0
  104. package/.next/server/chunks/5816.js +1 -0
  105. package/.next/server/chunks/6433.js +2 -0
  106. package/.next/server/chunks/6635.js +1 -0
  107. package/.next/server/chunks/6729.js +1 -0
  108. package/.next/server/chunks/7593.js +1 -0
  109. package/.next/server/chunks/7605.js +2 -0
  110. package/.next/server/chunks/7875.js +1 -0
  111. package/.next/server/chunks/{928.js → 7928.js} +1 -1
  112. package/.next/server/chunks/8161.js +2 -0
  113. package/.next/server/chunks/8202.js +1 -0
  114. package/.next/server/chunks/8842.js +1 -0
  115. package/.next/server/middleware-build-manifest.js +1 -1
  116. package/.next/server/middleware.js +1 -1
  117. package/.next/server/pages/404.html +1 -1
  118. package/.next/server/pages/500.html +1 -1
  119. package/.next/server/webpack-runtime.js +1 -1
  120. package/.next/static/bmRCG7iMkzXVlg-XFxDlO/_buildManifest.js +1 -0
  121. package/.next/static/chunks/1981-806ce42b1641772f.js +1 -0
  122. package/.next/static/chunks/9532-d620e60587f422d7.js +1 -0
  123. package/.next/static/chunks/app/[connectionId]/migrations/[setId]/page-e5120de390d302f1.js +1 -0
  124. package/.next/static/chunks/app/[connectionId]/migrations/page-b7e1a0568b6704d5.js +1 -0
  125. package/.next/static/chunks/app/_global-error/page-ad3ae203c81de67b.js +1 -0
  126. package/.next/static/chunks/app/api/activity/route-ad3ae203c81de67b.js +1 -0
  127. package/.next/static/chunks/app/api/adopt/route-ad3ae203c81de67b.js +1 -0
  128. package/.next/static/chunks/app/api/cell/route-ad3ae203c81de67b.js +1 -0
  129. package/.next/static/chunks/app/api/definition/route-ad3ae203c81de67b.js +1 -0
  130. package/.next/static/chunks/app/api/delete-rows/route-ad3ae203c81de67b.js +1 -0
  131. package/.next/static/chunks/app/api/detect/route-ad3ae203c81de67b.js +1 -0
  132. package/.next/static/chunks/app/api/health/route-ad3ae203c81de67b.js +1 -0
  133. package/.next/static/chunks/app/api/insert-row/route-ad3ae203c81de67b.js +1 -0
  134. package/.next/static/chunks/app/api/ledger/route-ad3ae203c81de67b.js +1 -0
  135. package/.next/static/chunks/app/api/lookup/route-ad3ae203c81de67b.js +1 -0
  136. package/.next/static/chunks/app/api/migrate/route-ad3ae203c81de67b.js +1 -0
  137. package/.next/static/chunks/app/api/note/route-ad3ae203c81de67b.js +1 -0
  138. package/.next/static/chunks/app/api/query/route-ad3ae203c81de67b.js +1 -0
  139. package/.next/static/chunks/app/api/reconcile/route-ad3ae203c81de67b.js +1 -0
  140. package/.next/static/chunks/app/api/rehearse/route-ad3ae203c81de67b.js +1 -0
  141. package/.next/static/chunks/app/api/related/route-ad3ae203c81de67b.js +1 -0
  142. package/.next/static/chunks/app/api/repo/route-ad3ae203c81de67b.js +1 -0
  143. package/.next/static/chunks/app/api/rows/route-ad3ae203c81de67b.js +1 -0
  144. package/.next/static/chunks/app/api/schema/route-ad3ae203c81de67b.js +1 -0
  145. package/.next/static/chunks/app/api/tables/route-ad3ae203c81de67b.js +1 -0
  146. package/.next/static/chunks/app/api/timeline/route-ad3ae203c81de67b.js +1 -0
  147. package/.next/static/chunks/app/api/update-row/route-ad3ae203c81de67b.js +1 -0
  148. package/.next/static/chunks/f97e080b-0509045eeda7ac08.js +1 -0
  149. package/.next/static/chunks/next/dist/client/components/builtin/app-error-ad3ae203c81de67b.js +1 -0
  150. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-ad3ae203c81de67b.js +1 -0
  151. package/.next/static/chunks/next/dist/client/components/builtin/not-found-ad3ae203c81de67b.js +1 -0
  152. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-ad3ae203c81de67b.js +1 -0
  153. package/.next/static/css/54a62baacc492c6d.css +1 -0
  154. package/package.json +1 -1
  155. package/.next/server/chunks/161.js +0 -2
  156. package/.next/server/chunks/202.js +0 -1
  157. package/.next/server/chunks/208.js +0 -1
  158. package/.next/server/chunks/421.js +0 -1
  159. package/.next/server/chunks/593.js +0 -1
  160. package/.next/server/chunks/605.js +0 -2
  161. package/.next/server/chunks/635.js +0 -1
  162. package/.next/server/chunks/729.js +0 -1
  163. package/.next/server/chunks/813.js +0 -1
  164. package/.next/server/chunks/814.js +0 -2
  165. package/.next/server/chunks/842.js +0 -1
  166. package/.next/server/chunks/875.js +0 -1
  167. package/.next/static/Rs4wmCBhbkxl8S4ZIgteG/_buildManifest.js +0 -1
  168. package/.next/static/chunks/1981-f89f2873291b0dfe.js +0 -1
  169. package/.next/static/chunks/8098-f4a0693371faa888.js +0 -1
  170. package/.next/static/chunks/app/[connectionId]/migrations/[setId]/page-696ad0a48678eac9.js +0 -1
  171. package/.next/static/chunks/app/[connectionId]/migrations/page-b731d6df40cedc5e.js +0 -1
  172. package/.next/static/chunks/app/_global-error/page-f8c12c454482851d.js +0 -1
  173. package/.next/static/chunks/app/api/activity/route-f8c12c454482851d.js +0 -1
  174. package/.next/static/chunks/app/api/adopt/route-f8c12c454482851d.js +0 -1
  175. package/.next/static/chunks/app/api/cell/route-f8c12c454482851d.js +0 -1
  176. package/.next/static/chunks/app/api/definition/route-f8c12c454482851d.js +0 -1
  177. package/.next/static/chunks/app/api/delete-rows/route-f8c12c454482851d.js +0 -1
  178. package/.next/static/chunks/app/api/detect/route-f8c12c454482851d.js +0 -1
  179. package/.next/static/chunks/app/api/health/route-f8c12c454482851d.js +0 -1
  180. package/.next/static/chunks/app/api/insert-row/route-f8c12c454482851d.js +0 -1
  181. package/.next/static/chunks/app/api/ledger/route-f8c12c454482851d.js +0 -1
  182. package/.next/static/chunks/app/api/lookup/route-f8c12c454482851d.js +0 -1
  183. package/.next/static/chunks/app/api/migrate/route-f8c12c454482851d.js +0 -1
  184. package/.next/static/chunks/app/api/note/route-f8c12c454482851d.js +0 -1
  185. package/.next/static/chunks/app/api/query/route-f8c12c454482851d.js +0 -1
  186. package/.next/static/chunks/app/api/related/route-f8c12c454482851d.js +0 -1
  187. package/.next/static/chunks/app/api/repo/route-f8c12c454482851d.js +0 -1
  188. package/.next/static/chunks/app/api/rows/route-f8c12c454482851d.js +0 -1
  189. package/.next/static/chunks/app/api/schema/route-f8c12c454482851d.js +0 -1
  190. package/.next/static/chunks/app/api/tables/route-f8c12c454482851d.js +0 -1
  191. package/.next/static/chunks/app/api/timeline/route-f8c12c454482851d.js +0 -1
  192. package/.next/static/chunks/app/api/update-row/route-f8c12c454482851d.js +0 -1
  193. package/.next/static/chunks/f97e080b-e536bdbfe64c5a7e.js +0 -1
  194. package/.next/static/chunks/next/dist/client/components/builtin/app-error-f8c12c454482851d.js +0 -1
  195. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-f8c12c454482851d.js +0 -1
  196. package/.next/static/chunks/next/dist/client/components/builtin/not-found-f8c12c454482851d.js +0 -1
  197. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-f8c12c454482851d.js +0 -1
  198. package/.next/static/css/5612558bae080ad4.css +0 -1
  199. /package/.next/static/{Rs4wmCBhbkxl8S4ZIgteG → bmRCG7iMkzXVlg-XFxDlO}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (()=>{var a={};a.id=838,a.ids=[838],a.modules={3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10410:(a,b,c)=>{Promise.resolve().then(c.bind(c,57803))},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12229:(a,b,c)=>{"use strict";c.d(b,{En:()=>k,Pc:()=>j,jl:()=>i});var d=c(31417),e=c(300),f=c(14490),g=c(15445);let h="ytdb:queries";(0,g.q)("db-studio:queries",h);let i=144,j=800,k=(0,d.v)()((0,e.Zr)(a=>({drafts:{},editorHeight:224,history:[],setDraft:(b,c)=>a(a=>({drafts:{...a.drafts,[b]:c}})),setEditorHeight:b=>a({editorHeight:Math.min(j,Math.max(i,Math.round(b)))}),record:(b,c)=>a(a=>{let d=c.trim();if(!d)return a;let e=a.history.find(a=>a.connectionId===b&&a.sql===d),g={id:e?.id??(0,f.z)(),connectionId:b,sql:d,executedAt:Date.now()},h=0,i=0;return{history:[g,...a.history.filter(a=>a.id!==g.id)].filter(a=>!(h>=200)&&!(i+a.sql.length>1e6)&&(h+=1,i+=a.sql.length,!0))}}),remove:b=>a(a=>({history:a.history.filter(a=>a.id!==b)}))}),{name:h}))},18583:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>t,handler:()=>v,routeModule:()=>u});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,35780))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,1777))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),r={children:["",{children:["[connectionId]",{children:["migrations",{children:["[setId]",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,26926))),"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/migrations/[setId]/page.tsx"]}]},{"global-error":[q,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[p,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/layout.tsx"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a),async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,59645)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},["_not-found","_global-error","api","favicon.ico","icon.svg"]]},{layout:[i,"/Users/theobourgeois/code/db-studio/src/app/layout.tsx"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a),async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,59645)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},[]]}.children,s=(0,e.H)({tree:r,page:"/[connectionId]/migrations/[setId]/page",pathname:"/[connectionId]/migrations/[setId]",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),t=s.__next_app__,u=s.routeModule,v=s.handler},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},26926:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>f});var d=c(5735),e=c(97182);async function f({params:a}){let{setId:b}=await a;return(0,d.jsx)(e.MigrationDetail,{setId:decodeURIComponent(b)})}},28354:a=>{"use strict";a.exports=require("util")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},38522:a=>{"use strict";a.exports=require("node:zlib")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},57803:(a,b,c)=>{"use strict";c.d(b,{MigrationDetail:()=>X});var d=c(48249),e=c(2116),f=c.n(e),g=c(19099),h=c(67484),i=c(23171),j=c(44231),k=c(60671),l=c(86229),m=c(25297),n=c(82244),o=c(53286),p=c(20886),q=c(21883),r=c(78931),s=c(72428),t=c(99598),u=c(453),v=c(66280),w=c(12229),x=c(14490),y=c(30770),z=c(13367),A=c(37654),B=c(67657),C=c(23742);let D="w-24",E="w-[104px]";function F({checked:a,label:b,onToggle:c}){return(0,d.jsx)("button",{type:"button",role:"checkbox","aria-checked":a,"aria-label":b,title:b,onMouseDown:a=>a.shiftKey&&a.preventDefault(),onClick:a=>c(a.shiftKey),className:(0,x.cn)("flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-[5px] border outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring/60",a?"border-foreground bg-foreground text-background":"border-input hover:border-foreground/50"),children:"mixed"===a?(0,d.jsx)(i.uPM,{className:"size-3"}):a?(0,d.jsx)(i.wiW,{className:"size-3"}):null})}let G={applied:"applied",drifted:"applied, but the file changed since",pending:"not applied",unknown:"not read yet"};function H({status:a}){return"applied"===a?(0,d.jsx)(i.wiW,{className:"size-4 text-emerald-600 dark:text-emerald-400"}):"drifted"===a?(0,d.jsx)(i.e5t,{className:"size-3.5 text-amber-600 dark:text-amber-400"}):"unknown"===a?(0,d.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}):(0,d.jsx)(i.uPM,{className:"size-3.5 text-muted-foreground/40"})}function I({step:a,environments:b,targetId:c,status:e,isNewestApplied:f,expanded:g,busy:j,editable:k=!0,drift:l,selected:o,onSelect:p,onToggle:q,actions:r}){let[s,t]=(0,h.useState)(null),u="changes"!==s||l?s??(l?"changes":"apply"):"apply",v="revert"===u?"revert":"apply",[w,y]=(0,h.useState)(!1),J="revert"===v?a.revertSql??"":a.applySql,K=(0,B.qb)(a.transaction),L=(0,B.TA)(a.transaction),M=[];async function N(){await (0,z.mw)(J),y(!0),window.setTimeout(()=>y(!1),1500)}return"drifted"===e&&"changes"!==u&&M.push("This file changed after it was applied here, so it is no longer the migration that ran."),L&&M.push(L),(0,d.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,d.jsxs)("div",{className:(0,x.cn)("flex h-10 items-center transition-colors hover:bg-muted/40",o&&"bg-muted/30",j&&"opacity-60"),children:[(0,d.jsx)("span",{className:"flex h-10 shrink-0 items-center pl-3",children:(0,d.jsx)(F,{checked:o,label:o?`Deselect ${a.version}`:`Select ${a.version}`,onToggle:p})}),(0,d.jsxs)("button",{type:"button","aria-expanded":g,"aria-label":g?`Hide SQL for ${a.version}`:`Show SQL for ${a.version}`,onClick:q,className:"flex h-8 min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[(0,d.jsx)(i.nNJ,{className:(0,x.cn)("size-3.5 shrink-0 text-muted-foreground/70 transition-transform",g&&"rotate-90")}),(0,d.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:a.version}),(0,d.jsx)("span",{className:"min-w-0 truncate text-sm",children:a.name}),K&&(0,d.jsx)("span",{className:"shrink-0 rounded border border-amber-600/25 bg-amber-500/10 px-1.5 text-[10px] text-amber-700 dark:text-amber-400",children:K})]}),b.map(b=>{let e=b.connection.id===c;return(0,d.jsx)("span",{title:b.error?`${b.connection.name}: ${b.error}`:`${a.version} is ${G[b.status]} on ${b.connection.name}${b.entry?` — ${function(a){if(!a)return"";let b=new Date(a.appliedAt);return Number.isNaN(b.getTime())?a.appliedAt:b.toLocaleString()}(b.entry)}`:""}`,className:(0,x.cn)("flex h-10 shrink-0 items-center justify-center",D,e&&"bg-foreground/[0.04]"),children:(0,d.jsx)(H,{status:b.status})},b.connection.id)}),(0,d.jsxs)("div",{className:(0,x.cn)("flex shrink-0 items-center justify-end gap-1 pr-2 pl-1",E),children:["pending"===e&&(0,d.jsx)(m.$,{size:"xs",variant:"outline",disabled:j,onClick:r.onApplyThrough,children:"Apply"}),f&&a.revertSql&&(0,d.jsxs)(m.$,{size:"xs",variant:"ghost",disabled:j,onClick:r.onRevertThrough,children:[(0,d.jsx)(i.ij9,{"data-icon":"inline-start"}),"Revert"]}),(0,d.jsxs)(n.rI,{children:[(0,d.jsx)(n.ty,{render:(0,d.jsx)(m.$,{size:"icon-xs",variant:"ghost","aria-label":`Actions for ${a.version}`}),className:"cursor-pointer",children:(0,d.jsx)(i.YKd,{})}),(0,d.jsxs)(n.SQ,{align:"end",className:"min-w-56",children:[(0,d.jsx)(n._2,{disabled:j||"applied"===e,onClick:r.onApplyThrough,children:"Apply everything through here"}),(0,d.jsx)(n._2,{disabled:j||"applied"===e,onClick:r.onApplyOne,children:"Apply only this one"}),(0,d.jsx)(n._2,{disabled:j||"pending"===e||!a.revertSql,onClick:r.onRevertThrough,children:"Revert back through here"}),(0,d.jsx)(n.mB,{}),(0,d.jsxs)(n._2,{disabled:j||"applied"===e,onClick:r.onMarkApplied,children:[(0,d.jsx)(i.nXx,{}),"Mark as already applied"]}),(0,d.jsxs)(n._2,{disabled:j||"pending"===e,onClick:r.onMarkPending,children:[(0,d.jsx)(i.fJ4,{}),"Mark as not applied"]}),(0,d.jsx)(n.mB,{}),k&&(0,d.jsxs)(n._2,{onClick:r.onAttachRevert,children:[(0,d.jsx)(i.W4E,{}),a.revertSql?"Replace revert file…":"Add a revert file…"]}),(0,d.jsxs)(n._2,{onClick:()=>r.onOpenInEditor(J),children:[(0,d.jsx)(i.Uoo,{}),"Open ",v," SQL in editor"]}),(0,d.jsxs)(n._2,{onClick:()=>void N(),children:[(0,d.jsx)(i.hX7,{}),"Copy ",v," SQL"]}),k&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.mB,{}),(0,d.jsx)(n._2,{variant:"destructive",onClick:r.onRemove,children:"Remove from this set"})]})]})]})]})]}),g&&(0,d.jsxs)("div",{className:"border-t bg-muted/25",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[(0,d.jsx)(A.x,{label:`SQL for ${a.version}`,value:u,onChange:t,options:[...l?[{value:"changes",label:"Changes"}]:[],{value:"apply",label:"Apply"},{value:"revert",label:"Revert"}]}),"changes"===u&&l?(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-3 font-mono text-[11px]",children:[(0,d.jsxs)("span",{className:"shrink-0 text-red-600 dark:text-red-400",children:["− ran on ",l.connectionName]}),(0,d.jsxs)("span",{className:"truncate text-emerald-600 dark:text-emerald-400",children:["+ ",a.applyPath]})]}):(0,d.jsx)("span",{className:"min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:"revert"===u?a.revertPath??"no revert file":a.applyPath}),"changes"!==u&&(0,d.jsxs)(m.$,{size:"xs",variant:"ghost",className:"ml-auto",onClick:()=>void N(),children:[w?(0,d.jsx)(i.wiW,{"data-icon":"inline-start"}):(0,d.jsx)(i.hX7,{"data-icon":"inline-start"}),w?"Copied":"Copy"]})]}),M.length>0&&(0,d.jsx)("ul",{className:"space-y-1 px-3 pb-2",children:M.map(a=>(0,d.jsxs)("li",{className:"flex gap-1.5 text-[11px] text-amber-700 dark:text-amber-400",children:[(0,d.jsx)(i.e5t,{className:"mt-px size-3 shrink-0"}),(0,d.jsx)("span",{children:a})]},a))}),"changes"===u&&l?l.error?(0,d.jsx)("p",{className:"px-3 pb-3 font-mono text-xs text-destructive",children:l.error}):void 0===l.appliedSql?(0,d.jsxs)("p",{className:"px-3 pb-3 text-xs text-muted-foreground",children:["Reading what ran on ",l.connectionName,"…"]}):null===l.appliedSql?(0,d.jsxs)("p",{className:"px-3 pb-3 text-xs text-muted-foreground",children:[l.connectionName," did not keep the SQL it ran, so there is nothing to compare against."]}):(0,d.jsx)(C.u,{before:l.appliedSql,after:a.applySql,className:"max-h-96 pb-2"}):J?(0,d.jsx)(z.os,{sql:J,className:"max-h-72 overflow-auto px-3 pb-3"}):(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 pb-3 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{children:"No revert file, so this one cannot be undone from here."}),k&&(0,d.jsxs)(m.$,{size:"xs",variant:"outline",onClick:r.onAttachRevert,children:[(0,d.jsx)(i.W4E,{"data-icon":"inline-start"}),"Add one"]})]})]})]})}function J({environments:a,targetId:b,onSelect:c}){let e=a.find(a=>a.connection.id===b);return e?(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"Running against"}),(0,d.jsxs)(n.rI,{children:[(0,d.jsxs)(n.ty,{disabled:a.length<2,className:"flex h-7 cursor-pointer items-center gap-1.5 rounded-lg border bg-background px-2 text-xs font-medium outline-none hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default data-open:bg-muted/60",children:[(0,d.jsx)(y.F,{connection:e.connection}),(0,d.jsx)("span",{className:"max-w-32 truncate",children:e.connection.name})]}),(0,d.jsx)(n.SQ,{align:"start",className:"min-w-52",children:a.map(a=>(0,d.jsxs)(n._2,{onClick:()=>c(a.connection.id),className:a.connection.id===b?"font-medium":void 0,children:[(0,d.jsx)(y.F,{connection:a.connection}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a.connection.name}),(0,d.jsxs)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:[a.summary.applied,"/",a.summary.total]})]},a.connection.id))})]})]}):null}function K({environments:a,targetId:b,caption:c,loading:e,selection:f,onSelect:g,onCompare:h}){return(0,d.jsxs)("div",{className:"flex h-11 shrink-0 items-center border-b bg-muted/20",children:[(0,d.jsx)("span",{className:"flex h-11 shrink-0 items-center pl-3",children:(0,d.jsx)(F,{checked:f.checked,label:f.checked?"Clear selection":"Select all",onToggle:()=>f.onToggle()})}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate px-2 text-xs text-muted-foreground",children:c}),a.map(a=>{let{connection:c,summary:f,ledger:h,error:i}=a,j=c.id===b;return(0,d.jsxs)("button",{type:"button",disabled:j,"aria-current":j?"true":void 0,title:j?`${c.name} is what Apply and Revert run against`:`Run against ${c.name} instead`,onClick:()=>g(c.id),className:(0,x.cn)("flex h-11 shrink-0 flex-col items-center justify-center gap-0.5 border-l text-[11px] outline-none",D,j?"cursor-default bg-foreground/[0.04] font-medium":"cursor-pointer text-muted-foreground hover:bg-muted/60 hover:text-foreground",e&&"opacity-60"),children:[(0,d.jsxs)("span",{className:"flex max-w-full items-center gap-1",children:[(0,d.jsx)(y.F,{connection:c,className:"size-1.5"}),(0,d.jsx)("span",{className:"truncate",children:c.name})]}),i?(0,d.jsx)("span",{className:"text-destructive",children:"unreachable"}):h?(0,d.jsxs)("span",{className:"tabular-nums text-muted-foreground/80",children:[f.applied,"/",f.total,f.drifted>0&&(0,d.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:" !"})]}):(0,d.jsx)("span",{className:"text-muted-foreground/70",children:"reading…"})]},c.id)}),(0,d.jsx)("div",{className:(0,x.cn)("flex shrink-0 items-center justify-end border-l pr-2 pl-1",E),children:a.length>1&&(0,d.jsx)(m.$,{size:"icon-xs",variant:"ghost",title:"Compare the two schemas","aria-label":"Compare schemas",onClick:()=>{let c=a.find(a=>a.connection.id!==b);c&&h(c.connection.id)},children:(0,d.jsx)(i.R4X,{})})})]})}var L=c(38393),M=c(88877),N=c(90863);function O({schema:a,found:b,onOpenChange:c,onSave:e}){let[f,g]=(0,h.useState)(a),i=f.trim(),j=(0,s.hD)(i),k=b.filter(a=>a.schema!==i);function l(){j&&(e(i),c(!1))}return(0,d.jsx)(L.lG,{open:!0,onOpenChange:c,children:(0,d.jsxs)(L.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(L.c7,{children:[(0,d.jsx)(L.L3,{children:"Ledger schema"}),(0,d.jsx)(L.rr,{children:"Where each database keeps its record of what has run. Created on the first apply."})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)(N.J,{htmlFor:"ledger-schema",children:"Schema"}),(0,d.jsx)(M.p,{id:"ledger-schema",value:f,spellCheck:!1,autoComplete:"off","aria-invalid":i.length>0&&!j,onChange:a=>g(a.target.value),onKeyDown:a=>"Enter"===a.key&&l()}),(0,d.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:j?`${i}.${s.R9}`:"\xa0"}),i.length>0&&!j&&(0,d.jsx)("p",{className:"text-xs text-destructive",children:"Letters, digits and underscores only, starting with a letter or underscore."})]}),k.length>0&&(0,d.jsxs)("p",{className:"rounded-md border border-amber-600/25 bg-amber-500/8 px-3 py-2 text-xs",children:[k.map(a=>`${a.name} keeps its ledger in ${a.schema}`).join("; "),". That one stays where it is."]}),(0,d.jsxs)(L.Es,{children:[i!==s.aC&&(0,d.jsx)(m.$,{variant:"ghost",onClick:()=>g(s.aC),children:"Reset"}),(0,d.jsx)(m.$,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,d.jsx)(m.$,{disabled:!j,onClick:l,children:"Save"})]})]})})}var P=c(97197),Q=c(76829),R=c(65292),S=c(29613),T=c(86871);function U({initial:a,file:b,onOpenChange:c,onSave:e}){let[f,g]=(0,h.useState)(a),[i,j]=(0,h.useState)(!1),[k,l]=(0,h.useState)(null),n=f.trim()!==a.trim();async function o(a){if(a?.preventDefault(),n&&!i){j(!0),l(null);try{await e(f.trim()),c(!1)}catch(a){l(a instanceof Error?a.message:String(a))}finally{j(!1)}}}return(0,d.jsx)(L.lG,{open:!0,onOpenChange:a=>!i&&c(a),children:(0,d.jsx)(L.Cf,{className:"sm:max-w-lg",showCloseButton:!1,children:(0,d.jsxs)("form",{onSubmit:a=>void o(a),className:"flex flex-col gap-4",children:[(0,d.jsx)(L.c7,{children:(0,d.jsxs)("div",{className:"flex items-baseline gap-3",children:[(0,d.jsx)(L.L3,{children:"Note"}),b&&(0,d.jsx)("span",{className:"ml-auto truncate font-mono text-[11px] text-muted-foreground",title:"Written into the migration's folder, to commit with the SQL",children:b})]})}),(0,d.jsx)(T.T,{autoFocus:!0,"aria-label":"Note",value:f,maxLength:s.XG,placeholder:"Apply 0001–0007, deploy the app, then apply 0008.",className:"max-h-[50vh] min-h-32",onChange:a=>g(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.metaKey||a.ctrlKey)&&o()}}),k&&(0,d.jsx)("p",{className:"text-xs text-destructive",children:k}),(0,d.jsxs)(L.Es,{children:[(0,d.jsx)(m.$,{type:"button",variant:"ghost",disabled:i,onClick:()=>c(!1),children:"Cancel"}),(0,d.jsx)(m.$,{type:"submit",disabled:!n||i,children:i?"Saving…":"Save"})]})]})})})}var V=c(78394),W=c(30904);function X({setId:a}){let b=(0,g.useRouter)(),{connection:c,tables:e}=(0,j.k)(),l=(0,v.jV)(a=>a.addFiles),y=(0,v.jV)(a=>a.renameSet),z=(0,v.jV)(a=>a.setNote),A=(0,v.jV)(a=>a.removeSet),B=(0,v.jV)(a=>a.removeStep),C=(0,v.jV)(a=>a.record),D=(0,v.jV)(a=>a.ledgerSchema),E=(0,v.jV)(a=>a.setLedgerSchema),F=(0,v.Ss)(a),{root:G,checkout:H}=(0,v.ox)(c.id),L=(0,W.y)((0,s.km)(a)?G:null,H),M=(0,s.km)(a)?L.data?.sets.find(b=>b.id===a)??null:F,N=!!M?.source,T=(0,t.gz)(c.id),aa=(0,w.En)(a=>a.setDraft),ab=(0,k.$C)(),[ac,ad]=(0,h.useState)("migrations"),[ae,af]=(0,h.useState)([]),[ag,ah]=(0,h.useState)([]),ai=(0,h.useRef)(null),[aj,ak]=(0,h.useState)(null),[al,am]=(0,h.useState)(null),[an,ao]=(0,h.useState)(!1),[ap,aq]=(0,h.useState)(!1),[ar,as]=(0,h.useState)(null),[at,au]=(0,h.useState)(null),[av,aw]=(0,h.useState)(!1),[ax,ay]=(0,h.useState)(!1),[az,aA]=(0,h.useState)(!1),aB=(0,h.useRef)(null),aC=(0,h.useRef)(!1),aD=(0,h.useMemo)(()=>[c,...T],[c,T]),aE=aD.map(a=>a.url).join("|"),aF=(0,p.Y)(`ledgers:${D}:${aE}`,async a=>Object.fromEntries(await Promise.all(aD.map(async b=>{try{return[b.id,{ledger:await q.F.ledger(b.url,D,a),error:null}]}catch(c){if(a.aborted)throw c;return[b.id,{ledger:null,error:c instanceof Error?c.message:String(c)}]}})))),aG=aF.data?.[c.id]??null,aH=M?.name??"",aI=(0,h.useMemo)(()=>(0,r.Gf)(aG?.ledger,aH),[aG?.ledger,aH]),aJ=(0,h.useMemo)(()=>aD.map(a=>{let b=aF.data?.[a.id]??null,c=(0,r.Gf)(b?.ledger,aH);return{connection:a,ledger:c,error:b?.error??null,summary:(0,r.eh)(M,c)}}),[aD,aF.data,M,aH]),aK=(0,h.useMemo)(()=>{let a=new Set;for(let b of M?.steps??[])if(ae.includes(b.version))for(let c of aJ)"drifted"===(0,r.FY)(b,c.ledger)&&a.add(c.connection.id);return aD.filter(b=>a.has(b.id))},[M,ae,aJ,aD]),aL=(0,p.Y)(`stored:${D}:${aK.map(a=>a.url).join("|")}`,async a=>Object.fromEntries(await Promise.all(aK.map(async b=>{try{return[b.id,{ledger:await q.F.ledger(b.url,D,a,!0),error:null}]}catch(c){if(a.aborted)throw c;return[b.id,{ledger:null,error:c instanceof Error?c.message:String(c)}]}})))),aM=`/${encodeURIComponent(c.id)}/migrations`,aN=(0,v.jV)(a=>a.history),aO=(0,h.useMemo)(()=>(0,u.x)(aJ.map(a=>({connection:a.connection,ledger:a.ledger})),aN).filter(a=>a.setName===aH),[aJ,aN,aH]),aP=(0,r.eh)(M,aI),aQ=(0,h.useMemo)(()=>(0,r.nb)(M,aI),[M,aI]),aR=(0,r.kB)(M,aI),aS=(0,h.useCallback)(b=>{as(l(a,b.files)),ad("migrations")},[l,a]),aT=(0,R.$)(aS);function aU(a,b,c=!1){(0!==b.steps.length||b.blockedBy)&&(am(null),ak({...b,direction:a,recordOnly:c}))}function aV(a){return{steps:a,blockedBy:null}}async function aW(){if(!aj||!M)return;aC.current=!1,ao(!0);let a=aj.steps.map(a=>({version:a.version,name:a.name,status:"waiting"}));am(a);let b=(b,c)=>{am(a=a.map((a,d)=>d===b?{...a,...c}:a))},d=b=>{am(a=a.map((a,c)=>c>=b&&"waiting"===a.status?{...a,status:"skipped"}:a))};for(let[a,e]of aj.steps.entries()){if(aC.current){d(a);break}let f="apply"===aj.direction?e.applySql:e.revertSql;if(!f&&!aj.recordOnly){b(a,{status:"failed",error:"No revert file for this migration."}),d(a+1);break}b(a,{status:"running"});let g=crypto.randomUUID();try{let d=await q.F.migrate(c.url,{runId:g,direction:aj.direction,version:e.version,name:e.name,checksum:e.checksum,setName:M.name,sql:f??"",revertSql:"apply"===aj.direction?e.revertSql:void 0,ledgerSchema:D,recordOnly:aj.recordOnly});b(a,{status:"ok",durationMs:d.durationMs}),C({runId:d.runId??g,setId:M.id,setName:M.name,connectionId:c.id,connectionName:c.name,direction:aj.direction,version:e.version,name:e.name,status:"ok",recorded:aj.recordOnly,durationMs:d.durationMs})}catch(h){let f=h instanceof Error?h.message:String(h);b(a,{status:"failed",error:f}),d(a+1),C({runId:g,setId:M.id,setName:M.name,connectionId:c.id,connectionName:c.name,direction:aj.direction,version:e.version,name:e.name,status:"failed",durationMs:0,error:f});break}}ao(!1),aF.reload(),aL.reload(),e.reload(),a.every(a=>"ok"===a.status)&&ah([])}function aX(a){aa(c.id,a),b.push(`/${encodeURIComponent(c.id)}/query`)}function aY(a){ab(a)}async function aZ(a){M&&(M.source?(await q.F.note(M.source.root,M.source.path,a),L.reload()):z(M.id,a))}async function a$(a){let b=a?.[0];au(null),b&&at&&M&&as(l(M.id,[{path:`revert/${at}_${b.name}`,text:await b.text()}]))}if(!M){let b=(0,s.km)(a)&&L.loading;return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsx)(Y,{name:b?"Reading…":"Not found"}),(0,d.jsx)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-muted-foreground",children:b?(0,d.jsx)("p",{className:"text-sm",children:"Reading the folder…"}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-sm",children:L.error?L.error:(0,s.km)(a)?"That migration is not in the folder on the branch you have checked out.":"That migration is no longer here."}),(0,d.jsx)(f(),{href:aM,className:"text-foreground underline underline-offset-4",children:"All migrations"})]})})]})}let a_=new Set(ag),a0=M.steps.filter(a=>a_.has(a.version)).length,a1=a0>0,a2=a1?(0,r.DM)(M,aI,a_):(0,r.gj)(M,aI),a3=a1?(0,r.n9)(M,aI,a_):(0,r.e)(M,aI),a4=an||aF.loading||L.loading;return(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",onDragOver:a=>{!N&&a.dataTransfer.types.includes("Files")&&(a.preventDefault(),aq(!0))},children:[(0,d.jsxs)(Y,{name:M?.name??"",indexHref:aM,children:[M.source&&(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1 text-[11px] text-muted-foreground",title:`Read from ${M.source.path}`,children:[(0,d.jsx)(i.WzY,{className:"size-3.5 shrink-0"}),(0,d.jsx)("span",{className:"max-w-48 truncate font-mono",children:M.source.path}),L.data?.git&&(0,d.jsxs)("span",{className:"shrink-0 rounded border px-1.5 font-mono text-[10px]",children:[L.data.git.branch,L.data.git.dirty&&"*"]})]}),(0,d.jsx)(J,{environments:aJ,targetId:c.id,onSelect:aY}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,d.jsx)(m.$,{size:"icon-sm",variant:"ghost",disabled:aF.loading||L.loading,"aria-label":"Refresh",title:N?"Re-read the files and every environment's ledger":"Re-read every environment's ledger",onClick:function(){aF.reload(),aL.reload(),N&&L.reload()},children:(0,d.jsx)(i.oS8,{className:(0,x.cn)((aF.loading||L.loading)&&"animate-spin")})}),!N&&(0,d.jsxs)(m.$,{size:"sm",variant:"ghost",onClick:()=>aq(!0),children:[(0,d.jsx)(i.FeY,{"data-icon":"inline-start"}),"Import"]}),(0,d.jsxs)(n.rI,{children:[(0,d.jsx)(n.ty,{render:(0,d.jsx)(m.$,{size:"icon-sm",variant:"ghost","aria-label":"More migration actions"}),className:"cursor-pointer",children:(0,d.jsx)(i.YKd,{})}),(0,d.jsxs)(n.SQ,{align:"end",className:"min-w-64",children:[(0,d.jsxs)(n._2,{disabled:a4||0===a2.steps.length,onClick:()=>aU("apply",aV(a2.steps),!0),children:[(0,d.jsx)(i.nXx,{}),"Mark ",a2.steps.length," as already applied"]}),(0,d.jsx)(n.mB,{}),(0,d.jsxs)(n._2,{disabled:a4||0===a3.steps.length,onClick:()=>aU("revert",a3),children:[(0,d.jsx)(i.ij9,{}),a1?`Revert ${a3.steps.length} selected on ${c.name}`:`Revert everything on ${c.name}`]}),(0,d.jsx)(n.mB,{}),(0,d.jsxs)(n._2,{onClick:()=>aA(!0),children:[(0,d.jsx)(i.UA_,{}),M.note?"Edit note":"Add note"]}),!N&&(0,d.jsxs)(n._2,{onClick:()=>ay(!0),children:[(0,d.jsx)(i.NOV,{}),"Rename"]}),(0,d.jsxs)(n._2,{onClick:()=>aw(!0),children:[(0,d.jsx)(i.ooN,{}),"Ledger table",(0,d.jsxs)("span",{className:"ml-auto pl-3 font-mono text-[11px] text-muted-foreground",children:[D,".",s.R9]})]}),!N&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.mB,{}),(0,d.jsx)(n._2,{variant:"destructive",onClick:function(){M&&(A(M.id),b.push(aM))},children:"Forget this migration"})]})]})]}),(0,d.jsxs)(m.$,{size:"sm",disabled:a4||0===a2.steps.length,onClick:()=>aU("apply",a2),children:[(0,d.jsx)(i.eGB,{"data-icon":"inline-start"}),0===a2.steps.length?a1?"Nothing selected to apply":"Up to date":`Apply ${a2.steps.length}${a1?" selected":""} to ${c.name}`]})]})]}),ar&&(0,d.jsx)($,{report:ar,onDismiss:()=>as(null)}),aT.error&&(0,d.jsx)("p",{className:"border-b bg-destructive/5 px-4 py-1.5 text-xs text-destructive",children:aT.error}),"migrations"===ac&&M.note&&(0,d.jsx)(Z,{note:M.note,notePath:M.source?.notePath??null,onEdit:()=>aA(!0)}),(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:["history"===ac?(0,d.jsx)(o.F,{className:"min-h-0 flex-1",children:(0,d.jsx)(P.H,{events:aO,connections:aD,loading:aF.loading,ledgerSchema:D,setName:aH})}):aG?.error?(0,d.jsx)("p",{className:"flex-1 px-4 py-6 font-mono text-xs text-destructive",children:aG.error}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(K,{environments:aJ,targetId:c.id,caption:a1?`${a0} selected`:function(a,b){if(b&&0===a.total)return"Reading…";let c=`${a.total} migration${1===a.total?"":"s"}`;return a.foreign>0?`${c} \xb7 ${a.foreign} not in this folder`:c}(aP,aF.loading),loading:aF.loading,selection:{checked:0!==a0&&(a0===M.steps.length||"mixed"),onToggle:function(){if(!M)return;let a=M.steps.map(a=>a.version);ah(b=>b.some(b=>a.includes(b))?[]:a)}},onSelect:aY,onCompare:function(a){t.lz.getState().setCompareTarget(c.id,a),b.push(`/${encodeURIComponent(c.id)}/diff`)}}),(0,d.jsxs)(o.F,{className:(0,x.cn)("min-h-0 flex-1",aF.loading&&"opacity-70"),children:[(M?.steps.length??0)===0&&!N&&(0,d.jsx)("div",{className:"p-6",children:(0,d.jsx)(R.k,{onFiles:aS,compact:!0})}),M.skipped.length>0&&N&&(0,d.jsxs)("div",{className:"border-b bg-muted/20 px-4 py-2 text-xs text-muted-foreground",children:[(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(i.e5t,{className:"size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),"Skipped ",M.skipped.length," file",1===M.skipped.length?"":"s"]}),(0,d.jsx)("ul",{className:"mt-1 space-y-0.5 pl-5 font-mono text-[11px]",children:M.skipped.map(a=>(0,d.jsx)("li",{children:a},a))})]}),(M?.steps??[]).map(a=>(0,d.jsx)(I,{step:a,targetId:c.id,status:(0,r.FY)(a,aI),environments:aJ.map(b=>({connection:b.connection,status:(0,r.FY)(a,b.ledger),entry:(0,r.ay)(a,b.ledger),error:b.error})),isNewestApplied:aR?.version===a.version,expanded:ae.includes(a.version),busy:a4,editable:!N,drift:function(a){let b=aJ.filter(b=>"drifted"===(0,r.FY)(a,b.ledger)),d=b.find(a=>a.connection.id===c.id)??b[0];if(!d)return null;let e=aL.data?.[d.connection.id],f=e?.ledger?.entries.find(b=>b.setName===aH&&b.version===a.version);return{connectionName:d.connection.name,appliedSql:e?.ledger?f?.applySql??null:void 0,error:e?.error??null}}(a),selected:a_.has(a.version),onSelect:b=>(function(a,b){if(!M)return;let c=M.steps.map(a=>a.version),d=ai.current;ai.current=a,ah(e=>{let f=!e.includes(a),g=[a];if(b&&d&&d!==a&&c.includes(d)){let[b,e]=[c.indexOf(d),c.indexOf(a)].sort((a,b)=>a-b);g=c.slice(b,e+1)}let h=new Set(e);for(let a of g)f?h.add(a):h.delete(a);return c.filter(a=>h.has(a))})})(a.version,b),onToggle:()=>{var b;return b=a.version,void af(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},actions:{onApplyThrough:()=>aU("apply",(0,r.gj)(M,aI,a.version)),onApplyOne:()=>aU("apply",{steps:[a],blockedBy:null}),onRevertThrough:()=>aU("revert",(0,r.e)(M,aI,a.version)),onMarkApplied:()=>aU("apply",aV([a]),!0),onMarkPending:()=>aU("revert",aV([a]),!0),onAttachRevert:()=>{au(a.version),window.requestAnimationFrame(()=>aB.current?.click())},onRemove:()=>M&&B(M.id,a.version),onOpenInEditor:aX}},a.version)),aQ.length>0&&(0,d.jsx)(_,{entries:aQ,connectionName:c.name})]})]}),ap&&!N&&(0,d.jsx)("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/85 p-6",onDragOver:a=>a.preventDefault(),onDragLeave:()=>aq(!1),onDrop:a=>{a.preventDefault(),aq(!1),aT.importFrom(a.dataTransfer)},children:(0,d.jsx)(R.k,{onFiles:aS,className:"w-full max-w-xl bg-background"})})]}),(0,d.jsx)(Q.l,{pane:ac,onPaneChange:ad,historyCount:aO.length,migrationsLabel:"Files",caption:function({connectionName:a,summary:b,initialized:c,loading:d,foundIn:e,configuredSchema:f}){if(d&&null===c)return"Reading ledgers…";let g=[];return!1===c||b.pending>0?g.push(`${b.pending} of ${b.total} pending on ${a}`):g.push(`${a} is up to date`),b.drifted>0&&g.push(`${b.drifted} changed since applied`),e&&e!==f&&g.push(`ledger in ${e}`),g.join(" \xb7 ")}({connectionName:c.name,summary:aP,initialized:aI?.initialized??null,loading:aF.loading,foundIn:aI?.initialized?aI.schema:null,configuredSchema:D})}),(0,d.jsx)("input",{ref:aB,type:"file",accept:".sql",className:"sr-only",onChange:a=>{a$(a.target.files),a.target.value=""}}),(0,d.jsx)(S.K,{open:ax,title:"Rename migration",initial:M.name,submitLabel:"Rename",onOpenChange:ay,onSubmit:function(a){M&&y(M.id,a)}}),az&&(0,d.jsx)(U,{initial:M.note??"",file:M.source?M.source.notePath?.split(/[\\/]/).at(-1)??"README.md":null,onOpenChange:aA,onSave:aZ}),av&&(0,d.jsx)(O,{schema:D,found:aJ.filter(a=>a.ledger?.initialized).map(a=>({name:a.connection.name,schema:a.ledger?.schema??D})),onOpenChange:aw,onSave:a=>{E(a),aF.reload()}}),aj&&(0,d.jsx)(V.I,{open:!0,direction:aj.direction,connection:c,steps:aj.steps,blockedBy:aj.blockedBy,progress:al,running:an,recordOnly:aj.recordOnly??!1,note:M.note,onRun:()=>void aW(),onStop:()=>{aC.current=!0},onClose:function(){an||(ak(null),am(null))}})]})}function Y({name:a,indexHref:b,children:c}){let e=(0,d.jsx)(i.olY,{className:"size-4 shrink-0 text-muted-foreground"});return(0,d.jsxs)(l.X,{children:[b?(0,d.jsx)(f(),{href:b,title:"All migrations","aria-label":"All migrations",className:"flex size-6 shrink-0 items-center justify-center rounded-md outline-none hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring/60",children:e}):e,(0,d.jsx)("span",{className:"min-w-0 truncate font-medium",children:a}),c]})}function Z({note:a,notePath:b,onEdit:c}){return(0,d.jsxs)("button",{type:"button",title:b?`${b} \xb7 click to edit`:"Click to edit",onClick:c,className:"group flex w-full cursor-pointer items-start gap-2 border-b px-4 py-2.5 text-left text-xs outline-none hover:bg-muted/30 focus-visible:bg-muted/30",children:[(0,d.jsx)(i.UA_,{className:"mt-px size-3.5 shrink-0 text-muted-foreground"}),(0,d.jsx)("span",{className:"max-h-40 min-w-0 flex-1 overflow-y-auto whitespace-pre-wrap break-words",children:a}),(0,d.jsx)(i.NOV,{className:"mt-px size-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100"})]})}function $({report:a,onDismiss:b}){let c=[];return a.added>0&&c.push(`added ${a.added}`),a.updated>0&&c.push(`updated ${a.updated}`),a.reverts>0&&c.push(`${a.reverts} revert file${1===a.reverts?"":"s"}`),(0,d.jsxs)("div",{className:"flex items-start gap-2 border-b bg-muted/30 px-4 py-1.5 text-xs",children:[(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[c.length>0?`Imported: ${c.join(", ")}`:"Nothing new in those files",a.skipped.length>0&&(0,d.jsxs)("span",{className:"text-muted-foreground",children:[" ","\xb7 skipped ",a.skipped.slice(0,2).join(", "),a.skipped.length>2&&` and ${a.skipped.length-2} more`]})]}),(0,d.jsx)(m.$,{size:"xs",variant:"ghost",onClick:b,children:"Dismiss"})]})}function _({entries:a,connectionName:b}){return(0,d.jsxs)("div",{className:"border-t bg-muted/20",children:[(0,d.jsxs)("p",{className:"flex items-center gap-2 px-4 py-2 text-xs text-muted-foreground",children:[(0,d.jsx)(i.e5t,{className:"size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),"Applied on ",b,", not in this folder"]}),a.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-2 px-4 py-1.5 text-xs opacity-70",children:[(0,d.jsx)(H,{status:"applied"}),(0,d.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground",children:a.version}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a.name||"—"}),(0,d.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:new Date(a.appliedAt).toLocaleString()})]},a.version))]})}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},92258:(a,b,c)=>{Promise.resolve().then(c.bind(c,97182))},97182:(a,b,c)=>{"use strict";c.d(b,{MigrationDetail:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call MigrationDetail() from the server but MigrationDetail is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/theobourgeois/code/db-studio/src/components/migrations/migration-detail.tsx","MigrationDetail")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[741,430,928,842,202,421,593,729,208],()=>b(b.s=18583));module.exports=c})();
1
+ (()=>{var a={};a.id=5838,a.ids=[5838],a.modules={3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10410:(a,b,c)=>{Promise.resolve().then(c.bind(c,57803))},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12229:(a,b,c)=>{"use strict";c.d(b,{En:()=>k,Pc:()=>j,jl:()=>i});var d=c(31417),e=c(300),f=c(14490),g=c(15445);let h="ytdb:queries";(0,g.q)("db-studio:queries",h);let i=144,j=800,k=(0,d.v)()((0,e.Zr)(a=>({drafts:{},editorHeight:224,history:[],setDraft:(b,c)=>a(a=>({drafts:{...a.drafts,[b]:c}})),setEditorHeight:b=>a({editorHeight:Math.min(j,Math.max(i,Math.round(b)))}),record:(b,c)=>a(a=>{let d=c.trim();if(!d)return a;let e=a.history.find(a=>a.connectionId===b&&a.sql===d),g={id:e?.id??(0,f.z)(),connectionId:b,sql:d,executedAt:Date.now()},h=0,i=0;return{history:[g,...a.history.filter(a=>a.id!==g.id)].filter(a=>!(h>=200)&&!(i+a.sql.length>1e6)&&(h+=1,i+=a.sql.length,!0))}}),remove:b=>a(a=>({history:a.history.filter(a=>a.id!==b)}))}),{name:h}))},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},26926:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>f});var d=c(5735),e=c(97182);async function f({params:a}){let{setId:b}=await a;return(0,d.jsx)(e.MigrationDetail,{setId:decodeURIComponent(b)})}},28354:a=>{"use strict";a.exports=require("util")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},38522:a=>{"use strict";a.exports=require("node:zlib")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},55560:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>t,handler:()=>v,routeModule:()=>u});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,35780))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,1777))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),r={children:["",{children:["[connectionId]",{children:["migrations",{children:["[setId]",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,26926))),"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/migrations/[setId]/page.tsx"]}]},{"global-error":[q,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[p,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/layout.tsx"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a),async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,59645)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},["_not-found","_global-error","api","favicon.ico","icon.svg"]]},{layout:[i,"/Users/theobourgeois/code/db-studio/src/app/layout.tsx"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a),async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,59645)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},[]]}.children,s=(0,e.H)({tree:r,page:"/[connectionId]/migrations/[setId]/page",pathname:"/[connectionId]/migrations/[setId]",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),t=s.__next_app__,u=s.routeModule,v=s.handler},57803:(a,b,c)=>{"use strict";c.d(b,{MigrationDetail:()=>Y});var d=c(48249),e=c(2116),f=c.n(e),g=c(19099),h=c(67484),i=c(23171),j=c(44231),k=c(60671),l=c(86229),m=c(25297),n=c(82244),o=c(53286),p=c(20886),q=c(21883),r=c(67657),s=c(78931),t=c(72428),u=c(99598),v=c(453),w=c(66280),x=c(12229),y=c(14490),z=c(30770),A=c(13367),B=c(37654),C=c(23742);let D="w-24",E="w-[104px]";function F({checked:a,label:b,onToggle:c}){return(0,d.jsx)("button",{type:"button",role:"checkbox","aria-checked":a,"aria-label":b,title:b,onMouseDown:a=>a.shiftKey&&a.preventDefault(),onClick:a=>c(a.shiftKey),className:(0,y.cn)("flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-[5px] border outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring/60",a?"border-foreground bg-foreground text-background":"border-input hover:border-foreground/50"),children:"mixed"===a?(0,d.jsx)(i.uPM,{className:"size-3"}):a?(0,d.jsx)(i.wiW,{className:"size-3"}):null})}let G={applied:"applied",drifted:"applied, but the file changed since",pending:"not applied",unknown:"not read yet"};function H({status:a}){return"applied"===a?(0,d.jsx)(i.wiW,{className:"size-4 text-emerald-600 dark:text-emerald-400"}):"drifted"===a?(0,d.jsx)(i.e5t,{className:"size-3.5 text-amber-600 dark:text-amber-400"}):"unknown"===a?(0,d.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground/30"}):(0,d.jsx)(i.uPM,{className:"size-3.5 text-muted-foreground/40"})}function I({step:a,environments:b,targetId:c,status:e,isNewestApplied:f,expanded:g,busy:j,editable:k=!0,drift:l,selected:o,onSelect:p,onToggle:q,actions:s}){let[t,u]=(0,h.useState)(null),v="changes"!==t||l?t??(l?"changes":"apply"):"apply",w="revert"===v?"revert":"apply",[x,z]=(0,h.useState)(!1),J="revert"===w?a.revertSql??"":a.applySql,K=(0,r.qb)(a.transaction),L=(0,r.TA)(a.transaction),M=[];async function N(){await (0,A.mw)(J),z(!0),window.setTimeout(()=>z(!1),1500)}return"drifted"===e&&"changes"!==v&&M.push("This file changed after it was applied here, so it is no longer the migration that ran."),L&&M.push(L),(0,d.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,d.jsxs)("div",{className:(0,y.cn)("flex h-10 items-center transition-colors hover:bg-muted/40",o&&"bg-muted/30",j&&"opacity-60"),children:[(0,d.jsx)("span",{className:"flex h-10 shrink-0 items-center pl-3",children:(0,d.jsx)(F,{checked:o,label:o?`Deselect ${a.version}`:`Select ${a.version}`,onToggle:p})}),(0,d.jsxs)("button",{type:"button","aria-expanded":g,"aria-label":g?`Hide SQL for ${a.version}`:`Show SQL for ${a.version}`,onClick:q,className:"flex h-8 min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[(0,d.jsx)(i.nNJ,{className:(0,y.cn)("size-3.5 shrink-0 text-muted-foreground/70 transition-transform",g&&"rotate-90")}),(0,d.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:a.version}),(0,d.jsx)("span",{className:"min-w-0 truncate text-sm",children:a.name}),K&&(0,d.jsx)("span",{className:"shrink-0 rounded border border-amber-600/25 bg-amber-500/10 px-1.5 text-[10px] text-amber-700 dark:text-amber-400",children:K})]}),b.map(b=>{let e=b.connection.id===c;return(0,d.jsx)("span",{title:b.error?`${b.connection.name}: ${b.error}`:`${a.version} is ${G[b.status]} on ${b.connection.name}${b.entry?` — ${function(a){if(!a)return"";let b=new Date(a.appliedAt);return Number.isNaN(b.getTime())?a.appliedAt:b.toLocaleString()}(b.entry)}`:""}`,className:(0,y.cn)("flex h-10 shrink-0 items-center justify-center",D,e&&"bg-foreground/[0.04]"),children:(0,d.jsx)(H,{status:b.status})},b.connection.id)}),(0,d.jsxs)("div",{className:(0,y.cn)("flex shrink-0 items-center justify-end gap-1 pr-2 pl-1",E),children:["pending"===e&&(0,d.jsx)(m.$,{size:"xs",variant:"outline",disabled:j,onClick:s.onApplyThrough,children:"Apply"}),f&&a.revertSql&&(0,d.jsxs)(m.$,{size:"xs",variant:"ghost",disabled:j,onClick:s.onRevertThrough,children:[(0,d.jsx)(i.ij9,{"data-icon":"inline-start"}),"Revert"]}),(0,d.jsxs)(n.rI,{children:[(0,d.jsx)(n.ty,{render:(0,d.jsx)(m.$,{size:"icon-xs",variant:"ghost","aria-label":`Actions for ${a.version}`}),className:"cursor-pointer",children:(0,d.jsx)(i.YKd,{})}),(0,d.jsxs)(n.SQ,{align:"end",className:"min-w-56",children:[(0,d.jsx)(n._2,{disabled:j||"applied"===e,onClick:s.onApplyThrough,children:"Apply everything through here"}),(0,d.jsx)(n._2,{disabled:j||"applied"===e,onClick:s.onApplyOne,children:"Apply only this one"}),(0,d.jsx)(n._2,{disabled:j||"pending"===e||!a.revertSql,onClick:s.onRevertThrough,children:"Revert back through here"}),(0,d.jsx)(n.mB,{}),(0,d.jsxs)(n._2,{disabled:j||"applied"===e,onClick:s.onMarkApplied,children:[(0,d.jsx)(i.nXx,{}),"Mark as already applied"]}),(0,d.jsxs)(n._2,{disabled:j||"pending"===e,onClick:s.onMarkPending,children:[(0,d.jsx)(i.fJ4,{}),"Mark as not applied"]}),(0,d.jsx)(n.mB,{}),k&&(0,d.jsxs)(n._2,{onClick:s.onAttachRevert,children:[(0,d.jsx)(i.W4E,{}),a.revertSql?"Replace revert file…":"Add a revert file…"]}),(0,d.jsxs)(n._2,{onClick:()=>s.onOpenInEditor(J),children:[(0,d.jsx)(i.Uoo,{}),"Open ",w," SQL in editor"]}),(0,d.jsxs)(n._2,{onClick:()=>void N(),children:[(0,d.jsx)(i.hX7,{}),"Copy ",w," SQL"]}),k&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.mB,{}),(0,d.jsx)(n._2,{variant:"destructive",onClick:s.onRemove,children:"Remove from this set"})]})]})]})]})]}),g&&(0,d.jsxs)("div",{className:"border-t bg-muted/25",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[(0,d.jsx)(B.x,{label:`SQL for ${a.version}`,value:v,onChange:u,options:[...l?[{value:"changes",label:"Changes"}]:[],{value:"apply",label:"Apply"},{value:"revert",label:"Revert"}]}),"changes"===v&&l?(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-3 font-mono text-[11px]",children:[(0,d.jsxs)("span",{className:"shrink-0 text-red-600 dark:text-red-400",children:["− ran on ",l.connectionName]}),(0,d.jsxs)("span",{className:"truncate text-emerald-600 dark:text-emerald-400",children:["+ ",a.applyPath]})]}):(0,d.jsx)("span",{className:"min-w-0 truncate font-mono text-[11px] text-muted-foreground",children:"revert"===v?a.revertPath??"no revert file":a.applyPath}),"changes"!==v&&(0,d.jsxs)(m.$,{size:"xs",variant:"ghost",className:"ml-auto",onClick:()=>void N(),children:[x?(0,d.jsx)(i.wiW,{"data-icon":"inline-start"}):(0,d.jsx)(i.hX7,{"data-icon":"inline-start"}),x?"Copied":"Copy"]})]}),M.length>0&&(0,d.jsx)("ul",{className:"space-y-1 px-3 pb-2",children:M.map(a=>(0,d.jsxs)("li",{className:"flex gap-1.5 text-[11px] text-amber-700 dark:text-amber-400",children:[(0,d.jsx)(i.e5t,{className:"mt-px size-3 shrink-0"}),(0,d.jsx)("span",{children:a})]},a))}),"changes"===v&&l?l.error?(0,d.jsx)("p",{className:"px-3 pb-3 font-mono text-xs text-destructive",children:l.error}):void 0===l.appliedSql?(0,d.jsxs)("p",{className:"px-3 pb-3 text-xs text-muted-foreground",children:["Reading what ran on ",l.connectionName,"…"]}):null===l.appliedSql?(0,d.jsxs)("p",{className:"px-3 pb-3 text-xs text-muted-foreground",children:[l.connectionName," did not keep the SQL it ran, so there is nothing to compare against."]}):(0,d.jsx)(C.u,{before:l.appliedSql,after:a.applySql,className:"max-h-96 pb-2"}):J?(0,d.jsx)(A.os,{sql:J,className:"max-h-72 overflow-auto px-3 pb-3"}):(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 pb-3 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{children:"No revert file, so this one cannot be undone from here."}),k&&(0,d.jsxs)(m.$,{size:"xs",variant:"outline",onClick:s.onAttachRevert,children:[(0,d.jsx)(i.W4E,{"data-icon":"inline-start"}),"Add one"]})]})]})]})}function J({environments:a,targetId:b,onSelect:c}){let e=a.find(a=>a.connection.id===b);return e?(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"Running against"}),(0,d.jsxs)(n.rI,{children:[(0,d.jsxs)(n.ty,{disabled:a.length<2,className:"flex h-7 cursor-pointer items-center gap-1.5 rounded-lg border bg-background px-2 text-xs font-medium outline-none hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default data-open:bg-muted/60",children:[(0,d.jsx)(z.F,{connection:e.connection}),(0,d.jsx)("span",{className:"max-w-32 truncate",children:e.connection.name})]}),(0,d.jsx)(n.SQ,{align:"start",className:"min-w-52",children:a.map(a=>(0,d.jsxs)(n._2,{onClick:()=>c(a.connection.id),className:a.connection.id===b?"font-medium":void 0,children:[(0,d.jsx)(z.F,{connection:a.connection}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a.connection.name}),(0,d.jsxs)("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:[a.summary.applied,"/",a.summary.total]})]},a.connection.id))})]})]}):null}function K({environments:a,targetId:b,caption:c,loading:e,selection:f,onSelect:g,onCompare:h}){return(0,d.jsxs)("div",{className:"flex h-11 shrink-0 items-center border-b bg-muted/20",children:[(0,d.jsx)("span",{className:"flex h-11 shrink-0 items-center pl-3",children:(0,d.jsx)(F,{checked:f.checked,label:f.checked?"Clear selection":"Select all",onToggle:()=>f.onToggle()})}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate px-2 text-xs text-muted-foreground",children:c}),a.map(a=>{let{connection:c,summary:f,ledger:h,error:i}=a,j=c.id===b;return(0,d.jsxs)("button",{type:"button",disabled:j,"aria-current":j?"true":void 0,title:j?`${c.name} is what Apply and Revert run against`:`Run against ${c.name} instead`,onClick:()=>g(c.id),className:(0,y.cn)("flex h-11 shrink-0 flex-col items-center justify-center gap-0.5 border-l text-[11px] outline-none",D,j?"cursor-default bg-foreground/[0.04] font-medium":"cursor-pointer text-muted-foreground hover:bg-muted/60 hover:text-foreground",e&&"opacity-60"),children:[(0,d.jsxs)("span",{className:"flex max-w-full items-center gap-1",children:[(0,d.jsx)(z.F,{connection:c,className:"size-1.5"}),(0,d.jsx)("span",{className:"truncate",children:c.name})]}),i?(0,d.jsx)("span",{className:"text-destructive",children:"unreachable"}):h?(0,d.jsxs)("span",{className:"tabular-nums text-muted-foreground/80",children:[f.applied,"/",f.total,f.drifted>0&&(0,d.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:" !"})]}):(0,d.jsx)("span",{className:"text-muted-foreground/70",children:"reading…"})]},c.id)}),(0,d.jsx)("div",{className:(0,y.cn)("flex shrink-0 items-center justify-end border-l pr-2 pl-1",E),children:a.length>1&&(0,d.jsx)(m.$,{size:"icon-xs",variant:"ghost",title:"Compare the two schemas","aria-label":"Compare schemas",onClick:()=>{let c=a.find(a=>a.connection.id!==b);c&&h(c.connection.id)},children:(0,d.jsx)(i.R4X,{})})})]})}var L=c(38393),M=c(88877),N=c(90863);function O({schema:a,found:b,onOpenChange:c,onSave:e}){let[f,g]=(0,h.useState)(a),i=f.trim(),j=(0,t.hD)(i),k=b.filter(a=>a.schema!==i);function l(){j&&(e(i),c(!1))}return(0,d.jsx)(L.lG,{open:!0,onOpenChange:c,children:(0,d.jsxs)(L.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(L.c7,{children:[(0,d.jsx)(L.L3,{children:"Ledger schema"}),(0,d.jsx)(L.rr,{children:"Where each database keeps its record of what has run. Created on the first apply."})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)(N.J,{htmlFor:"ledger-schema",children:"Schema"}),(0,d.jsx)(M.p,{id:"ledger-schema",value:f,spellCheck:!1,autoComplete:"off","aria-invalid":i.length>0&&!j,onChange:a=>g(a.target.value),onKeyDown:a=>"Enter"===a.key&&l()}),(0,d.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:j?`${i}.${t.R9}`:"\xa0"}),i.length>0&&!j&&(0,d.jsx)("p",{className:"text-xs text-destructive",children:"Letters, digits and underscores only, starting with a letter or underscore."})]}),k.length>0&&(0,d.jsxs)("p",{className:"rounded-md border border-amber-600/25 bg-amber-500/8 px-3 py-2 text-xs",children:[k.map(a=>`${a.name} keeps its ledger in ${a.schema}`).join("; "),". That one stays where it is."]}),(0,d.jsxs)(L.Es,{children:[i!==t.aC&&(0,d.jsx)(m.$,{variant:"ghost",onClick:()=>g(t.aC),children:"Reset"}),(0,d.jsx)(m.$,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,d.jsx)(m.$,{disabled:!j,onClick:l,children:"Save"})]})]})})}var P=c(60101),Q=c(76829),R=c(65292),S=c(29613),T=c(86871);function U({initial:a,file:b,onOpenChange:c,onSave:e}){let[f,g]=(0,h.useState)(a),[i,j]=(0,h.useState)(!1),[k,l]=(0,h.useState)(null),n=f.trim()!==a.trim();async function o(a){if(a?.preventDefault(),n&&!i){j(!0),l(null);try{await e(f.trim()),c(!1)}catch(a){l(a instanceof Error?a.message:String(a))}finally{j(!1)}}}return(0,d.jsx)(L.lG,{open:!0,onOpenChange:a=>!i&&c(a),children:(0,d.jsx)(L.Cf,{className:"sm:max-w-lg",showCloseButton:!1,children:(0,d.jsxs)("form",{onSubmit:a=>void o(a),className:"flex flex-col gap-4",children:[(0,d.jsx)(L.c7,{children:(0,d.jsxs)("div",{className:"flex items-baseline gap-3",children:[(0,d.jsx)(L.L3,{children:"Note"}),b&&(0,d.jsx)("span",{className:"ml-auto truncate font-mono text-[11px] text-muted-foreground",title:"Written into the migration's folder, to commit with the SQL",children:b})]})}),(0,d.jsx)(T.T,{autoFocus:!0,"aria-label":"Note",value:f,maxLength:t.XG,placeholder:"Apply 0001–0007, deploy the app, then apply 0008.",className:"max-h-[50vh] min-h-32",onChange:a=>g(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.metaKey||a.ctrlKey)&&o()}}),k&&(0,d.jsx)("p",{className:"text-xs text-destructive",children:k}),(0,d.jsxs)(L.Es,{children:[(0,d.jsx)(m.$,{type:"button",variant:"ghost",disabled:i,onClick:()=>c(!1),children:"Cancel"}),(0,d.jsx)(m.$,{type:"submit",disabled:!n||i,children:i?"Saving…":"Save"})]})]})})})}var V=c(76349),W=c(78394),X=c(30904);function Y({setId:a}){let b=(0,g.useRouter)(),{connection:c,tables:e}=(0,j.k)(),l=(0,w.jV)(a=>a.addFiles),z=(0,w.jV)(a=>a.renameSet),A=(0,w.jV)(a=>a.setNote),B=(0,w.jV)(a=>a.removeSet),C=(0,w.jV)(a=>a.removeStep),D=(0,w.jV)(a=>a.record),E=(0,w.jV)(a=>a.ledgerSchema),F=(0,w.jV)(a=>a.setLedgerSchema),G=(0,w.Ss)(a),{root:H,checkout:L}=(0,w.ox)(c.id),M=(0,X.y)((0,t.km)(a)?H:null,L),N=(0,t.km)(a)?M.data?.sets.find(b=>b.id===a)??null:G,T=!!N?.source,V=(0,u.gz)(c.id),ab=(0,x.En)(a=>a.setDraft),ac=(0,k.$C)(),[ad,ae]=(0,h.useState)("migrations"),[af,ag]=(0,h.useState)([]),[ah,ai]=(0,h.useState)([]),aj=(0,h.useRef)(null),[ak,al]=(0,h.useState)(null),[am,an]=(0,h.useState)(null),[ao,ap]=(0,h.useState)(!1),[aq,ar]=(0,h.useState)(!1),[as,at]=(0,h.useState)(!1),[au,av]=(0,h.useState)(null),[aw,ax]=(0,h.useState)(null),[ay,az]=(0,h.useState)(!1),[aA,aB]=(0,h.useState)(!1),[aC,aD]=(0,h.useState)(!1),aE=(0,h.useRef)(null),aF=(0,h.useRef)(!1),aG=(0,h.useMemo)(()=>[c,...V],[c,V]),aH=aG.map(a=>a.url).join("|"),aI=(0,p.Y)(`ledgers:${E}:${aH}`,async a=>Object.fromEntries(await Promise.all(aG.map(async b=>{try{return[b.id,{ledger:await q.F.ledger(b.url,E,a),error:null}]}catch(c){if(a.aborted)throw c;return[b.id,{ledger:null,error:c instanceof Error?c.message:String(c)}]}})))),aJ=aI.data?.[c.id]??null,aK=N?.name??"",aL=(0,h.useMemo)(()=>(0,s.Gf)(aJ?.ledger,aK),[aJ?.ledger,aK]),aM=(0,h.useMemo)(()=>aG.map(a=>{let b=aI.data?.[a.id]??null,c=(0,s.Gf)(b?.ledger,aK);return{connection:a,ledger:c,error:b?.error??null,summary:(0,s.eh)(N,c)}}),[aG,aI.data,N,aK]),aN=(0,h.useMemo)(()=>{let a=new Set;for(let b of N?.steps??[])if(af.includes(b.version))for(let c of aM)"drifted"===(0,s.FY)(b,c.ledger)&&a.add(c.connection.id);return aG.filter(b=>a.has(b.id))},[N,af,aM,aG]),aO=(0,p.Y)(`stored:${E}:${aN.map(a=>a.url).join("|")}`,async a=>Object.fromEntries(await Promise.all(aN.map(async b=>{try{return[b.id,{ledger:await q.F.ledger(b.url,E,a,!0),error:null}]}catch(c){if(a.aborted)throw c;return[b.id,{ledger:null,error:c instanceof Error?c.message:String(c)}]}})))),aP=`/${encodeURIComponent(c.id)}/migrations`,aQ=(0,w.jV)(a=>a.history),aR=(0,h.useMemo)(()=>(0,v.x)(aM.map(a=>({connection:a.connection,ledger:a.ledger})),aQ).filter(a=>a.setName===aK),[aM,aQ,aK]),aS=(0,s.eh)(N,aL),aT=(0,h.useMemo)(()=>(0,s.nb)(N,aL),[N,aL]),aU=(0,s.kB)(N,aL),aV=(0,h.useCallback)(a=>{ae("migrations"),an(null),ar(!1),al({steps:[a],blockedBy:null,direction:"apply"})},[]),aW=(0,h.useCallback)((a,b)=>N&&N.name===a?N.steps.find(a=>a.version===b)??null:null,[N]),aX=(0,h.useCallback)(b=>{av(l(a,b.files)),ae("migrations")},[l,a]),aY=(0,R.$)(aX);function aZ(a,b,c=!1){(0!==b.steps.length||b.blockedBy)&&(an(null),ar(!1),al({...b,direction:a,recordOnly:c}))}function a$(a,b){return"apply"===b?a.applySql:a.revertSql}async function a_(){if(!ak||!N)return;ar(!0),ap(!0);let a=ak.steps.map(a=>({version:a.version,name:a.name,status:"running"}));an(a);try{let b=await q.F.rehearse(c.url,{steps:ak.steps.map(a=>({version:a.version,name:a.name,sql:a$(a,ak.direction)??""}))}),d=new Map(b.steps.map(a=>[a.version,a]));a=a.map(a=>{let c=d.get(a.version);return c?{...a,status:"ok",durationMs:c.durationMs}:b.failed?.version===a.version?{...a,status:"failed",error:b.failed.error}:{...a,status:"skipped"}})}catch(c){let b=c instanceof Error?c.message:String(c);a=a.map((a,c)=>0===c?{...a,status:"failed",error:b}:{...a,status:"skipped"})}an(a),ap(!1)}function a0(a){return{steps:a,blockedBy:null}}async function a1(){if(!ak||!N)return;aF.current=!1,ar(!1),ap(!0);let a=ak.steps.map(a=>({version:a.version,name:a.name,status:"waiting"}));an(a);let b=(b,c)=>{an(a=a.map((a,d)=>d===b?{...a,...c}:a))},d=b=>{an(a=a.map((a,c)=>c>=b&&"waiting"===a.status?{...a,status:"skipped"}:a))};for(let[a,e]of ak.steps.entries()){if(aF.current){d(a);break}let f="apply"===ak.direction?e.applySql:e.revertSql;if(!f&&!ak.recordOnly){b(a,{status:"failed",error:"No revert file for this migration."}),d(a+1);break}b(a,{status:"running"});let g=crypto.randomUUID();try{let d=await q.F.migrate(c.url,{runId:g,direction:ak.direction,version:e.version,name:e.name,checksum:e.checksum,setName:N.name,sql:f??"",revertSql:"apply"===ak.direction?e.revertSql:void 0,ledgerSchema:E,recordOnly:ak.recordOnly});b(a,{status:"ok",durationMs:d.durationMs}),D({runId:d.runId??g,setId:N.id,setName:N.name,connectionId:c.id,connectionName:c.name,direction:ak.direction,version:e.version,name:e.name,status:"ok",recorded:ak.recordOnly,durationMs:d.durationMs})}catch(h){let f=h instanceof Error?h.message:String(h);b(a,{status:"failed",error:f}),d(a+1),D({runId:g,setId:N.id,setName:N.name,connectionId:c.id,connectionName:c.name,direction:ak.direction,version:e.version,name:e.name,status:"failed",durationMs:0,error:f});break}}ap(!1),aI.reload(),aO.reload(),e.reload(),a.every(a=>"ok"===a.status)&&ai([])}function a2(a){ab(c.id,a),b.push(`/${encodeURIComponent(c.id)}/query`)}function a3(a){ac(a)}async function a4(a){N&&(N.source?(await q.F.note(N.source.root,N.source.path,a),M.reload()):A(N.id,a))}async function a5(a){let b=a?.[0];ax(null),b&&aw&&N&&av(l(N.id,[{path:`revert/${aw}_${b.name}`,text:await b.text()}]))}if(!N){let b=(0,t.km)(a)&&M.loading;return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsx)(Z,{name:b?"Reading…":"Not found"}),(0,d.jsx)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-muted-foreground",children:b?(0,d.jsx)("p",{className:"text-sm",children:"Reading the folder…"}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-sm",children:M.error?M.error:(0,t.km)(a)?"That migration is not in the folder on the branch you have checked out.":"That migration is no longer here."}),(0,d.jsx)(f(),{href:aP,className:"text-foreground underline underline-offset-4",children:"All migrations"})]})})]})}let a6=new Set(ah),a7=N.steps.filter(a=>a6.has(a.version)).length,a8=a7>0,a9=a8?(0,s.DM)(N,aL,a6):(0,s.gj)(N,aL),ba=a8?(0,s.n9)(N,aL,a6):(0,s.e)(N,aL),bb=ao||aI.loading||M.loading;return(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",onDragOver:a=>{!T&&a.dataTransfer.types.includes("Files")&&(a.preventDefault(),at(!0))},children:[(0,d.jsxs)(Z,{name:N?.name??"",indexHref:aP,children:[N.source&&(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1 text-[11px] text-muted-foreground",title:`Read from ${N.source.path}`,children:[(0,d.jsx)(i.WzY,{className:"size-3.5 shrink-0"}),(0,d.jsx)("span",{className:"max-w-48 truncate font-mono",children:N.source.path}),M.data?.git&&(0,d.jsxs)("span",{className:"shrink-0 rounded border px-1.5 font-mono text-[10px]",children:[M.data.git.branch,M.data.git.dirty&&"*"]})]}),(0,d.jsx)(J,{environments:aM,targetId:c.id,onSelect:a3}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,d.jsx)(m.$,{size:"icon-sm",variant:"ghost",disabled:aI.loading||M.loading,"aria-label":"Refresh",title:T?"Re-read the files and every environment's ledger":"Re-read every environment's ledger",onClick:function(){aI.reload(),aO.reload(),T&&M.reload()},children:(0,d.jsx)(i.oS8,{className:(0,y.cn)((aI.loading||M.loading)&&"animate-spin")})}),!T&&(0,d.jsxs)(m.$,{size:"sm",variant:"ghost",onClick:()=>at(!0),children:[(0,d.jsx)(i.FeY,{"data-icon":"inline-start"}),"Import"]}),(0,d.jsxs)(n.rI,{children:[(0,d.jsx)(n.ty,{render:(0,d.jsx)(m.$,{size:"icon-sm",variant:"ghost","aria-label":"More migration actions"}),className:"cursor-pointer",children:(0,d.jsx)(i.YKd,{})}),(0,d.jsxs)(n.SQ,{align:"end",className:"min-w-64",children:[(0,d.jsxs)(n._2,{disabled:bb||0===a9.steps.length,onClick:()=>aZ("apply",a0(a9.steps),!0),children:[(0,d.jsx)(i.nXx,{}),"Mark ",a9.steps.length," as already applied"]}),(0,d.jsx)(n.mB,{}),(0,d.jsxs)(n._2,{disabled:bb||0===ba.steps.length,onClick:()=>aZ("revert",ba),children:[(0,d.jsx)(i.ij9,{}),a8?`Revert ${ba.steps.length} selected on ${c.name}`:`Revert everything on ${c.name}`]}),(0,d.jsx)(n.mB,{}),(0,d.jsxs)(n._2,{onClick:()=>aD(!0),children:[(0,d.jsx)(i.UA_,{}),N.note?"Edit note":"Add note"]}),!T&&(0,d.jsxs)(n._2,{onClick:()=>aB(!0),children:[(0,d.jsx)(i.NOV,{}),"Rename"]}),(0,d.jsxs)(n._2,{onClick:()=>az(!0),children:[(0,d.jsx)(i.ooN,{}),"Ledger table",(0,d.jsxs)("span",{className:"ml-auto pl-3 font-mono text-[11px] text-muted-foreground",children:[E,".",t.R9]})]}),!T&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.mB,{}),(0,d.jsx)(n._2,{variant:"destructive",onClick:function(){N&&(B(N.id),b.push(aP))},children:"Forget this migration"})]})]})]}),(0,d.jsxs)(m.$,{size:"sm",disabled:bb||0===a9.steps.length,onClick:()=>aZ("apply",a9),children:[(0,d.jsx)(i.eGB,{"data-icon":"inline-start"}),0===a9.steps.length?a8?"Nothing selected to apply":"Up to date":`Apply ${a9.steps.length}${a8?" selected":""} to ${c.name}`]})]})]}),au&&(0,d.jsx)(_,{report:au,onDismiss:()=>av(null)}),aY.error&&(0,d.jsx)("p",{className:"border-b bg-destructive/5 px-4 py-1.5 text-xs text-destructive",children:aY.error}),"migrations"===ad&&N.note&&(0,d.jsx)($,{note:N.note,notePath:N.source?.notePath??null,onEdit:()=>aD(!0)}),(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:["history"===ad?(0,d.jsx)(o.F,{className:"min-h-0 flex-1",children:(0,d.jsx)(P.H,{events:aR,connections:aG,loading:aI.loading,ledgerSchema:E,setName:aK,findStep:aW,onLedgerChange:aI.reload,onRetry:aV})}):aJ?.error?(0,d.jsx)("p",{className:"flex-1 px-4 py-6 font-mono text-xs text-destructive",children:aJ.error}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(K,{environments:aM,targetId:c.id,caption:a8?`${a7} selected`:function(a,b){if(b&&0===a.total)return"Reading…";let c=`${a.total} migration${1===a.total?"":"s"}`;return a.foreign>0?`${c} \xb7 ${a.foreign} not in this folder`:c}(aS,aI.loading),loading:aI.loading,selection:{checked:0!==a7&&(a7===N.steps.length||"mixed"),onToggle:function(){if(!N)return;let a=N.steps.map(a=>a.version);ai(b=>b.some(b=>a.includes(b))?[]:a)}},onSelect:a3,onCompare:function(a){u.lz.getState().setCompareTarget(c.id,a),b.push(`/${encodeURIComponent(c.id)}/diff`)}}),(0,d.jsxs)(o.F,{className:(0,y.cn)("min-h-0 flex-1",aI.loading&&"opacity-70"),children:[(N?.steps.length??0)===0&&!T&&(0,d.jsx)("div",{className:"p-6",children:(0,d.jsx)(R.k,{onFiles:aX,compact:!0})}),N.skipped.length>0&&T&&(0,d.jsxs)("div",{className:"border-b bg-muted/20 px-4 py-2 text-xs text-muted-foreground",children:[(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(i.e5t,{className:"size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),"Skipped ",N.skipped.length," file",1===N.skipped.length?"":"s"]}),(0,d.jsx)("ul",{className:"mt-1 space-y-0.5 pl-5 font-mono text-[11px]",children:N.skipped.map(a=>(0,d.jsx)("li",{children:a},a))})]}),(N?.steps??[]).map(a=>(0,d.jsx)(I,{step:a,targetId:c.id,status:(0,s.FY)(a,aL),environments:aM.map(b=>({connection:b.connection,status:(0,s.FY)(a,b.ledger),entry:(0,s.ay)(a,b.ledger),error:b.error})),isNewestApplied:aU?.version===a.version,expanded:af.includes(a.version),busy:bb,editable:!T,drift:function(a){let b=aM.filter(b=>"drifted"===(0,s.FY)(a,b.ledger)),d=b.find(a=>a.connection.id===c.id)??b[0];if(!d)return null;let e=aO.data?.[d.connection.id],f=e?.ledger?.entries.find(b=>b.setName===aK&&b.version===a.version);return{connectionName:d.connection.name,appliedSql:e?.ledger?f?.applySql??null:void 0,error:e?.error??null}}(a),selected:a6.has(a.version),onSelect:b=>(function(a,b){if(!N)return;let c=N.steps.map(a=>a.version),d=aj.current;aj.current=a,ai(e=>{let f=!e.includes(a),g=[a];if(b&&d&&d!==a&&c.includes(d)){let[b,e]=[c.indexOf(d),c.indexOf(a)].sort((a,b)=>a-b);g=c.slice(b,e+1)}let h=new Set(e);for(let a of g)f?h.add(a):h.delete(a);return c.filter(a=>h.has(a))})})(a.version,b),onToggle:()=>{var b;return b=a.version,void ag(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},actions:{onApplyThrough:()=>aZ("apply",(0,s.gj)(N,aL,a.version)),onApplyOne:()=>aZ("apply",{steps:[a],blockedBy:null}),onRevertThrough:()=>aZ("revert",(0,s.e)(N,aL,a.version)),onMarkApplied:()=>aZ("apply",a0([a]),!0),onMarkPending:()=>aZ("revert",a0([a]),!0),onAttachRevert:()=>{ax(a.version),window.requestAnimationFrame(()=>aE.current?.click())},onRemove:()=>N&&C(N.id,a.version),onOpenInEditor:a2}},a.version)),aT.length>0&&(0,d.jsx)(aa,{entries:aT,connectionName:c.name})]})]}),as&&!T&&(0,d.jsx)("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-background/85 p-6",onDragOver:a=>a.preventDefault(),onDragLeave:()=>at(!1),onDrop:a=>{a.preventDefault(),at(!1),aY.importFrom(a.dataTransfer)},children:(0,d.jsx)(R.k,{onFiles:aX,className:"w-full max-w-xl bg-background"})})]}),(0,d.jsx)(Q.l,{pane:ad,onPaneChange:ae,historyCount:aR.length,migrationsLabel:"Files",caption:function({connectionName:a,summary:b,initialized:c,loading:d,foundIn:e,configuredSchema:f}){if(d&&null===c)return"Reading ledgers…";let g=[];return!1===c||b.pending>0?g.push(`${b.pending} of ${b.total} pending on ${a}`):g.push(`${a} is up to date`),b.drifted>0&&g.push(`${b.drifted} changed since applied`),e&&e!==f&&g.push(`ledger in ${e}`),g.join(" \xb7 ")}({connectionName:c.name,summary:aS,initialized:aL?.initialized??null,loading:aI.loading,foundIn:aL?.initialized?aL.schema:null,configuredSchema:E})}),(0,d.jsx)("input",{ref:aE,type:"file",accept:".sql",className:"sr-only",onChange:a=>{a5(a.target.files),a.target.value=""}}),(0,d.jsx)(S.K,{open:aA,title:"Rename migration",initial:N.name,submitLabel:"Rename",onOpenChange:aB,onSubmit:function(a){N&&z(N.id,a)}}),aC&&(0,d.jsx)(U,{initial:N.note??"",file:N.source?N.source.notePath?.split(/[\\/]/).at(-1)??"README.md":null,onOpenChange:aD,onSave:a4}),ay&&(0,d.jsx)(O,{schema:E,found:aM.filter(a=>a.ledger?.initialized).map(a=>({name:a.connection.name,schema:a.ledger?.schema??E})),onOpenChange:az,onSave:a=>{F(a),aI.reload()}}),ak&&(0,d.jsx)(W.I,{open:!0,direction:ak.direction,connection:c,steps:ak.steps,blockedBy:ak.blockedBy,progress:am,running:ao,recordOnly:ak.recordOnly??!1,note:N.note,outOfOrder:"apply"!==ak.direction||ak.recordOnly?null:(0,s.nj)(aL,ak.steps),rehearsal:aq,onRun:()=>void a1(),onRehearse:!ak.recordOnly&&0!==ak.steps.length&&ak.steps.every(a=>{let b=a$(a,ak.direction);return!!b&&(0,r.Ol)(b).atomic})?()=>void a_():null,onStop:()=>{aF.current=!0},onClose:function(){ao||(al(null),an(null),ar(!1))}})]})}function Z({name:a,indexHref:b,children:c}){let e=(0,d.jsx)(i.olY,{className:"size-4 shrink-0 text-muted-foreground"});return(0,d.jsxs)(l.X,{children:[b?(0,d.jsx)(f(),{href:b,title:"All migrations","aria-label":"All migrations",className:"flex size-6 shrink-0 items-center justify-center rounded-md outline-none hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring/60",children:e}):e,(0,d.jsx)("span",{className:"min-w-0 truncate font-medium",children:a}),c]})}function $({note:a,notePath:b,onEdit:c}){return(0,d.jsxs)("div",{title:b?`${b} \xb7 click to edit`:"Click to edit",onClick:a=>{a.target.closest("a")||c()},className:"group flex w-full cursor-pointer items-start gap-2 border-b px-4 py-2.5 text-left text-xs hover:bg-muted/30",children:[(0,d.jsx)(i.UA_,{className:"mt-px size-3.5 shrink-0 text-muted-foreground"}),(0,d.jsx)(V.o,{text:a,className:"max-h-40 min-w-0 flex-1 overflow-y-auto"}),(0,d.jsx)("button",{type:"button","aria-label":"Edit note",onClick:a=>{a.stopPropagation(),c()},className:"mt-px shrink-0 rounded-sm text-muted-foreground opacity-0 outline-none group-hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring",children:(0,d.jsx)(i.NOV,{className:"size-3.5"})})]})}function _({report:a,onDismiss:b}){let c=[];return a.added>0&&c.push(`added ${a.added}`),a.updated>0&&c.push(`updated ${a.updated}`),a.reverts>0&&c.push(`${a.reverts} revert file${1===a.reverts?"":"s"}`),(0,d.jsxs)("div",{className:"flex items-start gap-2 border-b bg-muted/30 px-4 py-1.5 text-xs",children:[(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[c.length>0?`Imported: ${c.join(", ")}`:"Nothing new in those files",a.skipped.length>0&&(0,d.jsxs)("span",{className:"text-muted-foreground",children:[" ","\xb7 skipped ",a.skipped.slice(0,2).join(", "),a.skipped.length>2&&` and ${a.skipped.length-2} more`]})]}),(0,d.jsx)(m.$,{size:"xs",variant:"ghost",onClick:b,children:"Dismiss"})]})}function aa({entries:a,connectionName:b}){return(0,d.jsxs)("div",{className:"border-t bg-muted/20",children:[(0,d.jsxs)("p",{className:"flex items-center gap-2 px-4 py-2 text-xs text-muted-foreground",children:[(0,d.jsx)(i.e5t,{className:"size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}),"Applied on ",b,", not in this folder"]}),a.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-2 px-4 py-1.5 text-xs opacity-70",children:[(0,d.jsx)(H,{status:"applied"}),(0,d.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground",children:a.version}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a.name||"—"}),(0,d.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:new Date(a.appliedAt).toLocaleString()})]},a.version))]})}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},92258:(a,b,c)=>{Promise.resolve().then(c.bind(c,97182))},97182:(a,b,c)=>{"use strict";c.d(b,{MigrationDetail:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call MigrationDetail() from the server but MigrationDetail is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/theobourgeois/code/db-studio/src/components/migrations/migration-detail.tsx","MigrationDetail")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,2430,7928,8842,8202,1421,7593,6729,5816],()=>b(b.s=55560));module.exports=c})();
@@ -1 +1 @@
1
- {"version":1,"files":["../../../../../../node_modules/@swc/helpers/_/_interop_require_default/package.json","../../../../../../node_modules/@swc/helpers/cjs/_interop_require_default.cjs","../../../../../../node_modules/@swc/helpers/package.json","../../../../../../node_modules/next/dist/build/adapter/setup-node-env.external.js","../../../../../../node_modules/next/dist/client/components/hooks-server-context.js","../../../../../../node_modules/next/dist/client/components/static-generation-bailout.js","../../../../../../node_modules/next/dist/client/lib/console.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../node_modules/next/dist/compiled/jsonwebtoken/index.js","../../../../../../node_modules/next/dist/compiled/jsonwebtoken/package.json","../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../node_modules/next/dist/compiled/source-map/package.json","../../../../../../node_modules/next/dist/compiled/source-map/source-map.js","../../../../../../node_modules/next/dist/compiled/stacktrace-parser/package.json","../../../../../../node_modules/next/dist/compiled/stacktrace-parser/stack-trace-parser.cjs.js","../../../../../../node_modules/next/dist/compiled/ws/index.js","../../../../../../node_modules/next/dist/compiled/ws/package.json","../../../../../../node_modules/next/dist/lib/client-and-server-references.js","../../../../../../node_modules/next/dist/lib/constants.js","../../../../../../node_modules/next/dist/lib/framework/boundary-constants.js","../../../../../../node_modules/next/dist/lib/interop-default.js","../../../../../../node_modules/next/dist/lib/is-error.js","../../../../../../node_modules/next/dist/lib/picocolors.js","../../../../../../node_modules/next/dist/lib/scheduler.js","../../../../../../node_modules/next/dist/lib/semver-noop.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../../../../node_modules/next/dist/server/app-render/blocking-route-messages.js","../../../../../../node_modules/next/dist/server/app-render/cache-signal.js","../../../../../../node_modules/next/dist/server/app-render/console-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/console-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/dynamic-access-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/dynamic-access-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/dynamic-rendering.js","../../../../../../node_modules/next/dist/server/app-render/instant-validation/boundary-constants.js","../../../../../../node_modules/next/dist/server/app-render/instant-validation/boundary-tracking.js","../../../../../../node_modules/next/dist/server/app-render/module-loading/track-module-loading.external.js","../../../../../../node_modules/next/dist/server/app-render/module-loading/track-module-loading.instance.js","../../../../../../node_modules/next/dist/server/app-render/staged-rendering.js","../../../../../../node_modules/next/dist/server/app-render/sync-io-messages.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../../../../node_modules/next/dist/server/dev/browser-logs/file-logger.js","../../../../../../node_modules/next/dist/server/dynamic-rendering-utils.js","../../../../../../node_modules/next/dist/server/lib/incremental-cache/memory-cache.external.js","../../../../../../node_modules/next/dist/server/lib/incremental-cache/shared-cache-controls.external.js","../../../../../../node_modules/next/dist/server/lib/incremental-cache/tags-manifest.external.js","../../../../../../node_modules/next/dist/server/lib/lru-cache.js","../../../../../../node_modules/next/dist/server/lib/parse-stack.js","../../../../../../node_modules/next/dist/server/lib/router-utils/instrumentation-globals.external.js","../../../../../../node_modules/next/dist/server/lib/router-utils/instrumentation-node-extensions.js","../../../../../../node_modules/next/dist/server/lib/source-maps.js","../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../node_modules/next/dist/server/load-manifest.external.js","../../../../../../node_modules/next/dist/server/node-environment-baseline.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/console-dim.external.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/console-exit.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/console-file.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/date.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/error-inspect.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/fast-set-immediate.external.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/io-utils.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/node-crypto.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/random.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/unhandled-rejection.external.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/web-crypto.js","../../../../../../node_modules/next/dist/server/node-environment.js","../../../../../../node_modules/next/dist/server/node-polyfill-crypto.js","../../../../../../node_modules/next/dist/server/patch-error-inspect.js","../../../../../../node_modules/next/dist/server/require-hook.js","../../../../../../node_modules/next/dist/server/response-cache/types.js","../../../../../../node_modules/next/dist/server/runtime-reacts.external.js","../../../../../../node_modules/next/dist/shared/lib/deep-freeze.js","../../../../../../node_modules/next/dist/shared/lib/instant-messages.js","../../../../../../node_modules/next/dist/shared/lib/invariant-error.js","../../../../../../node_modules/next/dist/shared/lib/is-plain-object.js","../../../../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../../../../node_modules/next/dist/shared/lib/lazy-dynamic/bailout-to-csr.js","../../../../../../node_modules/next/dist/shared/lib/no-fallback-error.external.js","../../../../../../node_modules/next/dist/shared/lib/promise-with-resolvers.js","../../../../../../node_modules/next/dist/shared/lib/server-reference-info.js","../../../../../../node_modules/next/package.json","../../../../../../node_modules/react/cjs/react.development.js","../../../../../../node_modules/react/cjs/react.production.js","../../../../../../node_modules/react/index.js","../../../../../../node_modules/react/package.json","../../../../../../package.json","../../../../../package.json","../../../../chunks/202.js","../../../../chunks/208.js","../../../../chunks/421.js","../../../../chunks/430.js","../../../../chunks/593.js","../../../../chunks/729.js","../../../../chunks/741.js","../../../../chunks/842.js","../../../../chunks/928.js","../../../../webpack-runtime.js","page_client-reference-manifest.js"]}
1
+ {"version":1,"files":["../../../../../../node_modules/@swc/helpers/_/_interop_require_default/package.json","../../../../../../node_modules/@swc/helpers/cjs/_interop_require_default.cjs","../../../../../../node_modules/@swc/helpers/package.json","../../../../../../node_modules/next/dist/build/adapter/setup-node-env.external.js","../../../../../../node_modules/next/dist/client/components/hooks-server-context.js","../../../../../../node_modules/next/dist/client/components/static-generation-bailout.js","../../../../../../node_modules/next/dist/client/lib/console.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../node_modules/next/dist/compiled/jsonwebtoken/index.js","../../../../../../node_modules/next/dist/compiled/jsonwebtoken/package.json","../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../node_modules/next/dist/compiled/source-map/package.json","../../../../../../node_modules/next/dist/compiled/source-map/source-map.js","../../../../../../node_modules/next/dist/compiled/stacktrace-parser/package.json","../../../../../../node_modules/next/dist/compiled/stacktrace-parser/stack-trace-parser.cjs.js","../../../../../../node_modules/next/dist/compiled/ws/index.js","../../../../../../node_modules/next/dist/compiled/ws/package.json","../../../../../../node_modules/next/dist/lib/client-and-server-references.js","../../../../../../node_modules/next/dist/lib/constants.js","../../../../../../node_modules/next/dist/lib/framework/boundary-constants.js","../../../../../../node_modules/next/dist/lib/interop-default.js","../../../../../../node_modules/next/dist/lib/is-error.js","../../../../../../node_modules/next/dist/lib/picocolors.js","../../../../../../node_modules/next/dist/lib/scheduler.js","../../../../../../node_modules/next/dist/lib/semver-noop.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/action-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/after-task-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/async-local-storage.js","../../../../../../node_modules/next/dist/server/app-render/blocking-route-messages.js","../../../../../../node_modules/next/dist/server/app-render/cache-signal.js","../../../../../../node_modules/next/dist/server/app-render/console-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/console-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/dynamic-access-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/dynamic-access-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/dynamic-rendering.js","../../../../../../node_modules/next/dist/server/app-render/instant-validation/boundary-constants.js","../../../../../../node_modules/next/dist/server/app-render/instant-validation/boundary-tracking.js","../../../../../../node_modules/next/dist/server/app-render/module-loading/track-module-loading.external.js","../../../../../../node_modules/next/dist/server/app-render/module-loading/track-module-loading.instance.js","../../../../../../node_modules/next/dist/server/app-render/staged-rendering.js","../../../../../../node_modules/next/dist/server/app-render/sync-io-messages.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-async-storage.external.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js","../../../../../../node_modules/next/dist/server/app-render/work-unit-async-storage.external.js","../../../../../../node_modules/next/dist/server/dev/browser-logs/file-logger.js","../../../../../../node_modules/next/dist/server/dynamic-rendering-utils.js","../../../../../../node_modules/next/dist/server/lib/incremental-cache/memory-cache.external.js","../../../../../../node_modules/next/dist/server/lib/incremental-cache/shared-cache-controls.external.js","../../../../../../node_modules/next/dist/server/lib/incremental-cache/tags-manifest.external.js","../../../../../../node_modules/next/dist/server/lib/lru-cache.js","../../../../../../node_modules/next/dist/server/lib/parse-stack.js","../../../../../../node_modules/next/dist/server/lib/router-utils/instrumentation-globals.external.js","../../../../../../node_modules/next/dist/server/lib/router-utils/instrumentation-node-extensions.js","../../../../../../node_modules/next/dist/server/lib/source-maps.js","../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../node_modules/next/dist/server/load-manifest.external.js","../../../../../../node_modules/next/dist/server/node-environment-baseline.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/console-dim.external.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/console-exit.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/console-file.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/date.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/error-inspect.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/fast-set-immediate.external.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/io-utils.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/node-crypto.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/random.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/unhandled-rejection.external.js","../../../../../../node_modules/next/dist/server/node-environment-extensions/web-crypto.js","../../../../../../node_modules/next/dist/server/node-environment.js","../../../../../../node_modules/next/dist/server/node-polyfill-crypto.js","../../../../../../node_modules/next/dist/server/patch-error-inspect.js","../../../../../../node_modules/next/dist/server/require-hook.js","../../../../../../node_modules/next/dist/server/response-cache/types.js","../../../../../../node_modules/next/dist/server/runtime-reacts.external.js","../../../../../../node_modules/next/dist/shared/lib/deep-freeze.js","../../../../../../node_modules/next/dist/shared/lib/instant-messages.js","../../../../../../node_modules/next/dist/shared/lib/invariant-error.js","../../../../../../node_modules/next/dist/shared/lib/is-plain-object.js","../../../../../../node_modules/next/dist/shared/lib/is-thenable.js","../../../../../../node_modules/next/dist/shared/lib/lazy-dynamic/bailout-to-csr.js","../../../../../../node_modules/next/dist/shared/lib/no-fallback-error.external.js","../../../../../../node_modules/next/dist/shared/lib/promise-with-resolvers.js","../../../../../../node_modules/next/dist/shared/lib/server-reference-info.js","../../../../../../node_modules/next/package.json","../../../../../../node_modules/react/cjs/react.development.js","../../../../../../node_modules/react/cjs/react.production.js","../../../../../../node_modules/react/index.js","../../../../../../node_modules/react/package.json","../../../../../../package.json","../../../../../package.json","../../../../chunks/1421.js","../../../../chunks/2430.js","../../../../chunks/4741.js","../../../../chunks/5816.js","../../../../chunks/6729.js","../../../../chunks/7593.js","../../../../chunks/7928.js","../../../../chunks/8202.js","../../../../chunks/8842.js","../../../../webpack-runtime.js","page_client-reference-manifest.js"]}
@@ -1 +1 @@
1
- globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/[connectionId]/migrations/[setId]/page"]={"moduleLoading":{"prefix":"/_next/"},"ssrModuleMapping":{"6044":{"*":{"id":"70344","name":"*","chunks":[],"async":false}},"21890":{"*":{"id":"41390","name":"*","chunks":[],"async":false}},"23042":{"*":{"id":"86104","name":"*","chunks":[],"async":false}},"27123":{"*":{"id":"81921","name":"*","chunks":[],"async":false}},"37875":{"*":{"id":"53371","name":"*","chunks":[],"async":false}},"48491":{"*":{"id":"8419","name":"*","chunks":[],"async":false}},"57121":{"*":{"id":"35421","name":"*","chunks":[],"async":false}},"61304":{"*":{"id":"60440","name":"*","chunks":[],"async":false}},"61929":{"*":{"id":"77645","name":"*","chunks":[],"async":false}},"64777":{"*":{"id":"82265","name":"*","chunks":[],"async":false}},"65377":{"*":{"id":"19047","name":"*","chunks":[],"async":false}},"69063":{"*":{"id":"81040","name":"*","chunks":[],"async":false}},"72737":{"*":{"id":"4833","name":"*","chunks":[],"async":false}},"74581":{"*":{"id":"61335","name":"*","chunks":[],"async":false}},"78616":{"*":{"id":"84342","name":"*","chunks":[],"async":false}},"86869":{"*":{"id":"74661","name":"*","chunks":[],"async":false}},"90484":{"*":{"id":"70664","name":"*","chunks":[],"async":false}},"92666":{"*":{"id":"57803","name":"*","chunks":[],"async":false}},"94821":{"*":{"id":"80189","name":"*","chunks":[],"async":false}},"96365":{"*":{"id":"61314","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/builtin/global-error.js":{"id":27123,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/builtin/global-error.js":{"id":27123,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/client-page.js":{"id":61304,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":61304,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/client-segment.js":{"id":78616,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":78616,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":64777,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":64777,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/layout-router.js":{"id":57121,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":57121,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":74581,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":74581,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/lib/framework/boundary-components.js":{"id":90484,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/lib/framework/boundary-components.js":{"id":90484,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/lib/metadata/generate/icon-mark.js":{"id":86869,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/lib/metadata/generate/icon-mark.js":{"id":86869,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.tsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"sans\"}":{"id":34244,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.tsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"mono\"}":{"id":64939,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/app/globals.css":{"id":51743,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/ConvexClientProvider.tsx":{"id":94821,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/local-bridge-gate.tsx":{"id":65377,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/navigation-tracker.tsx":{"id":48491,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/theme-provider.tsx":{"id":72737,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/app/page.tsx":{"id":23042,"name":"*","chunks":["4506","static/chunks/f97e080b-e536bdbfe64c5a7e.js","1731","static/chunks/1731-6dec4b981289174f.js","8026","static/chunks/8026-d0db1e7b45d32046.js","2435","static/chunks/2435-240bc4349cace375.js","8361","static/chunks/8361-d0f8ce41b74637bf.js","7709","static/chunks/7709-b2eee040599bab79.js","6782","static/chunks/6782-c8b44f7f0d19d8e4.js","8974","static/chunks/app/page-957b7639b047ba08.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/explorer/explorer-shell.tsx":{"id":37875,"name":"*","chunks":["4506","static/chunks/f97e080b-e536bdbfe64c5a7e.js","1731","static/chunks/1731-6dec4b981289174f.js","8026","static/chunks/8026-d0db1e7b45d32046.js","2435","static/chunks/2435-240bc4349cace375.js","8361","static/chunks/8361-d0f8ce41b74637bf.js","8322","static/chunks/8322-ed3deecf058cc11c.js","1981","static/chunks/1981-f89f2873291b0dfe.js","9243","static/chunks/9243-9f0f2534090c6124.js","7709","static/chunks/7709-b2eee040599bab79.js","6782","static/chunks/6782-c8b44f7f0d19d8e4.js","7123","static/chunks/app/%5BconnectionId%5D/layout-06d736d4773bd4a8.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/table/table-view.tsx":{"id":61929,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/src/components/diff/schema-diff-view.tsx":{"id":6044,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/src/components/migrations/migration-detail.tsx":{"id":92666,"name":"*","chunks":["4506","static/chunks/f97e080b-e536bdbfe64c5a7e.js","1731","static/chunks/1731-6dec4b981289174f.js","8026","static/chunks/8026-d0db1e7b45d32046.js","2435","static/chunks/2435-240bc4349cace375.js","8361","static/chunks/8361-d0f8ce41b74637bf.js","8322","static/chunks/8322-ed3deecf058cc11c.js","1981","static/chunks/1981-f89f2873291b0dfe.js","9243","static/chunks/9243-9f0f2534090c6124.js","7709","static/chunks/7709-b2eee040599bab79.js","1520","static/chunks/1520-1d9fc8b9ea29f3aa.js","8098","static/chunks/8098-f4a0693371faa888.js","5838","static/chunks/app/%5BconnectionId%5D/migrations/%5BsetId%5D/page-696ad0a48678eac9.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/migrations/migrations-index.tsx":{"id":69063,"name":"*","chunks":["4506","static/chunks/f97e080b-e536bdbfe64c5a7e.js","1731","static/chunks/1731-6dec4b981289174f.js","8026","static/chunks/8026-d0db1e7b45d32046.js","2435","static/chunks/2435-240bc4349cace375.js","8361","static/chunks/8361-d0f8ce41b74637bf.js","8322","static/chunks/8322-ed3deecf058cc11c.js","3960","static/chunks/3960-1b1a9a0ae3f12118.js","1981","static/chunks/1981-f89f2873291b0dfe.js","9243","static/chunks/9243-9f0f2534090c6124.js","7709","static/chunks/7709-b2eee040599bab79.js","1520","static/chunks/1520-1d9fc8b9ea29f3aa.js","8098","static/chunks/8098-f4a0693371faa888.js","9820","static/chunks/app/%5BconnectionId%5D/migrations/page-b731d6df40cedc5e.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/explorer/connection-home.tsx":{"id":21890,"name":"*","chunks":["1731","static/chunks/1731-6dec4b981289174f.js","1981","static/chunks/1981-f89f2873291b0dfe.js","2336","static/chunks/app/%5BconnectionId%5D/page-8f68a2646e2f3eaa.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/query/query-view.tsx":{"id":96365,"name":"*","chunks":[],"async":false}},"entryCSSFiles":{"/Users/theobourgeois/code/db-studio/src/":[],"/Users/theobourgeois/code/db-studio/src/app/layout":[{"inlined":false,"path":"static/css/e02ab5db9ff2dca2.css"},{"inlined":false,"path":"static/css/5612558bae080ad4.css"}],"/Users/theobourgeois/code/db-studio/src/app/page":[],"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/layout":[],"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/page":[],"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/migrations/page":[],"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/migrations/[setId]/page":[]},"rscModuleMapping":{"6044":{"*":{"id":"58977","name":"*","chunks":[],"async":false}},"21890":{"*":{"id":"52468","name":"*","chunks":[],"async":false}},"23042":{"*":{"id":"4494","name":"*","chunks":[],"async":false}},"27123":{"*":{"id":"95547","name":"*","chunks":[],"async":false}},"37875":{"*":{"id":"34766","name":"*","chunks":[],"async":false}},"48491":{"*":{"id":"19933","name":"*","chunks":[],"async":false}},"51743":{"*":{"id":"61135","name":"*","chunks":[],"async":false}},"57121":{"*":{"id":"98099","name":"*","chunks":[],"async":false}},"61304":{"*":{"id":"15098","name":"*","chunks":[],"async":false}},"61929":{"*":{"id":"12377","name":"*","chunks":[],"async":false}},"64777":{"*":{"id":"33859","name":"*","chunks":[],"async":false}},"65377":{"*":{"id":"17569","name":"*","chunks":[],"async":false}},"69063":{"*":{"id":"99432","name":"*","chunks":[],"async":false}},"72737":{"*":{"id":"65223","name":"*","chunks":[],"async":false}},"74581":{"*":{"id":"16237","name":"*","chunks":[],"async":false}},"78616":{"*":{"id":"47644","name":"*","chunks":[],"async":false}},"86869":{"*":{"id":"36675","name":"*","chunks":[],"async":false}},"90484":{"*":{"id":"98562","name":"*","chunks":[],"async":false}},"92666":{"*":{"id":"97182","name":"*","chunks":[],"async":false}},"94821":{"*":{"id":"88331","name":"*","chunks":[],"async":false}},"96365":{"*":{"id":"2781","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}};
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/[connectionId]/migrations/[setId]/page"]={"moduleLoading":{"prefix":"/_next/"},"ssrModuleMapping":{"6044":{"*":{"id":"70344","name":"*","chunks":[],"async":false}},"21890":{"*":{"id":"41390","name":"*","chunks":[],"async":false}},"23042":{"*":{"id":"86104","name":"*","chunks":[],"async":false}},"27123":{"*":{"id":"81921","name":"*","chunks":[],"async":false}},"37875":{"*":{"id":"53371","name":"*","chunks":[],"async":false}},"48491":{"*":{"id":"8419","name":"*","chunks":[],"async":false}},"57121":{"*":{"id":"35421","name":"*","chunks":[],"async":false}},"61304":{"*":{"id":"60440","name":"*","chunks":[],"async":false}},"61929":{"*":{"id":"77645","name":"*","chunks":[],"async":false}},"64777":{"*":{"id":"82265","name":"*","chunks":[],"async":false}},"65377":{"*":{"id":"19047","name":"*","chunks":[],"async":false}},"69063":{"*":{"id":"81040","name":"*","chunks":[],"async":false}},"72737":{"*":{"id":"4833","name":"*","chunks":[],"async":false}},"74581":{"*":{"id":"61335","name":"*","chunks":[],"async":false}},"78616":{"*":{"id":"84342","name":"*","chunks":[],"async":false}},"86869":{"*":{"id":"74661","name":"*","chunks":[],"async":false}},"90484":{"*":{"id":"70664","name":"*","chunks":[],"async":false}},"92666":{"*":{"id":"57803","name":"*","chunks":[],"async":false}},"94821":{"*":{"id":"80189","name":"*","chunks":[],"async":false}},"96365":{"*":{"id":"61314","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/builtin/global-error.js":{"id":27123,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/builtin/global-error.js":{"id":27123,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/client-page.js":{"id":61304,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/client-page.js":{"id":61304,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/client-segment.js":{"id":78616,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/client-segment.js":{"id":78616,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":64777,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":64777,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/layout-router.js":{"id":57121,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/layout-router.js":{"id":57121,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/client/components/render-from-template-context.js":{"id":74581,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":74581,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/lib/framework/boundary-components.js":{"id":90484,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/lib/framework/boundary-components.js":{"id":90484,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/lib/metadata/generate/icon-mark.js":{"id":86869,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/dist/esm/lib/metadata/generate/icon-mark.js":{"id":86869,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.tsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"sans\"}":{"id":34244,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.tsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"mono\"}":{"id":64939,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/app/globals.css":{"id":51743,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/ConvexClientProvider.tsx":{"id":94821,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/local-bridge-gate.tsx":{"id":65377,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/navigation-tracker.tsx":{"id":48491,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/theme-provider.tsx":{"id":72737,"name":"*","chunks":["223","static/chunks/223-a4fca67d979d899d.js","7177","static/chunks/app/layout-e3fdecae5544dc60.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/app/page.tsx":{"id":23042,"name":"*","chunks":["4506","static/chunks/f97e080b-0509045eeda7ac08.js","1731","static/chunks/1731-6dec4b981289174f.js","8026","static/chunks/8026-d0db1e7b45d32046.js","2435","static/chunks/2435-240bc4349cace375.js","8361","static/chunks/8361-d0f8ce41b74637bf.js","7709","static/chunks/7709-b2eee040599bab79.js","6782","static/chunks/6782-c8b44f7f0d19d8e4.js","8974","static/chunks/app/page-957b7639b047ba08.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/explorer/explorer-shell.tsx":{"id":37875,"name":"*","chunks":["4506","static/chunks/f97e080b-0509045eeda7ac08.js","1731","static/chunks/1731-6dec4b981289174f.js","8026","static/chunks/8026-d0db1e7b45d32046.js","2435","static/chunks/2435-240bc4349cace375.js","8361","static/chunks/8361-d0f8ce41b74637bf.js","8322","static/chunks/8322-ed3deecf058cc11c.js","1981","static/chunks/1981-806ce42b1641772f.js","9243","static/chunks/9243-9f0f2534090c6124.js","7709","static/chunks/7709-b2eee040599bab79.js","6782","static/chunks/6782-c8b44f7f0d19d8e4.js","7123","static/chunks/app/%5BconnectionId%5D/layout-06d736d4773bd4a8.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/table/table-view.tsx":{"id":61929,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/src/components/diff/schema-diff-view.tsx":{"id":6044,"name":"*","chunks":[],"async":false},"/Users/theobourgeois/code/db-studio/src/components/migrations/migration-detail.tsx":{"id":92666,"name":"*","chunks":["4506","static/chunks/f97e080b-0509045eeda7ac08.js","1731","static/chunks/1731-6dec4b981289174f.js","8026","static/chunks/8026-d0db1e7b45d32046.js","2435","static/chunks/2435-240bc4349cace375.js","8361","static/chunks/8361-d0f8ce41b74637bf.js","8322","static/chunks/8322-ed3deecf058cc11c.js","1981","static/chunks/1981-806ce42b1641772f.js","9243","static/chunks/9243-9f0f2534090c6124.js","7709","static/chunks/7709-b2eee040599bab79.js","1520","static/chunks/1520-1d9fc8b9ea29f3aa.js","9532","static/chunks/9532-d620e60587f422d7.js","5838","static/chunks/app/%5BconnectionId%5D/migrations/%5BsetId%5D/page-e5120de390d302f1.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/migrations/migrations-index.tsx":{"id":69063,"name":"*","chunks":["4506","static/chunks/f97e080b-0509045eeda7ac08.js","1731","static/chunks/1731-6dec4b981289174f.js","8026","static/chunks/8026-d0db1e7b45d32046.js","2435","static/chunks/2435-240bc4349cace375.js","8361","static/chunks/8361-d0f8ce41b74637bf.js","8322","static/chunks/8322-ed3deecf058cc11c.js","3960","static/chunks/3960-1b1a9a0ae3f12118.js","1981","static/chunks/1981-806ce42b1641772f.js","9243","static/chunks/9243-9f0f2534090c6124.js","7709","static/chunks/7709-b2eee040599bab79.js","1520","static/chunks/1520-1d9fc8b9ea29f3aa.js","9532","static/chunks/9532-d620e60587f422d7.js","9820","static/chunks/app/%5BconnectionId%5D/migrations/page-b7e1a0568b6704d5.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/explorer/connection-home.tsx":{"id":21890,"name":"*","chunks":["1731","static/chunks/1731-6dec4b981289174f.js","1981","static/chunks/1981-806ce42b1641772f.js","2336","static/chunks/app/%5BconnectionId%5D/page-8f68a2646e2f3eaa.js"],"async":false},"/Users/theobourgeois/code/db-studio/src/components/query/query-view.tsx":{"id":96365,"name":"*","chunks":[],"async":false}},"entryCSSFiles":{"/Users/theobourgeois/code/db-studio/src/":[],"/Users/theobourgeois/code/db-studio/src/app/layout":[{"inlined":false,"path":"static/css/e02ab5db9ff2dca2.css"},{"inlined":false,"path":"static/css/54a62baacc492c6d.css"}],"/Users/theobourgeois/code/db-studio/src/app/page":[],"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/layout":[],"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/page":[],"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/migrations/page":[],"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/migrations/[setId]/page":[]},"rscModuleMapping":{"6044":{"*":{"id":"58977","name":"*","chunks":[],"async":false}},"21890":{"*":{"id":"52468","name":"*","chunks":[],"async":false}},"23042":{"*":{"id":"4494","name":"*","chunks":[],"async":false}},"27123":{"*":{"id":"95547","name":"*","chunks":[],"async":false}},"37875":{"*":{"id":"34766","name":"*","chunks":[],"async":false}},"48491":{"*":{"id":"19933","name":"*","chunks":[],"async":false}},"51743":{"*":{"id":"61135","name":"*","chunks":[],"async":false}},"57121":{"*":{"id":"98099","name":"*","chunks":[],"async":false}},"61304":{"*":{"id":"15098","name":"*","chunks":[],"async":false}},"61929":{"*":{"id":"12377","name":"*","chunks":[],"async":false}},"64777":{"*":{"id":"33859","name":"*","chunks":[],"async":false}},"65377":{"*":{"id":"17569","name":"*","chunks":[],"async":false}},"69063":{"*":{"id":"99432","name":"*","chunks":[],"async":false}},"72737":{"*":{"id":"65223","name":"*","chunks":[],"async":false}},"74581":{"*":{"id":"16237","name":"*","chunks":[],"async":false}},"78616":{"*":{"id":"47644","name":"*","chunks":[],"async":false}},"86869":{"*":{"id":"36675","name":"*","chunks":[],"async":false}},"90484":{"*":{"id":"98562","name":"*","chunks":[],"async":false}},"92666":{"*":{"id":"97182","name":"*","chunks":[],"async":false}},"94821":{"*":{"id":"88331","name":"*","chunks":[],"async":false}},"96365":{"*":{"id":"2781","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}};
@@ -1 +1 @@
1
- (()=>{var a={};a.id=820,a.ids=[820],a.modules={3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},5681:(a,b,c)=>{"use strict";c.d(b,{G3:()=>A,h5:()=>E,$U:()=>H,oK:()=>D,x4:()=>G,ex:()=>F});var d=c(48249);c(67484);var e=c(90038),f=c(61903),g=c(62379),h=c(89265),i=c(52899),j=c(48607),k=c(26447),l=c(1359),m=c(30250),n=c(35116),o=c(84412),p=c(14490),q=c(25297),r=c(21654),s=c(88877);function t({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,p.cn)("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...b})}c(86871);let u=(0,r.F)("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function v({className:a,align:b="inline-start",...c}){return(0,d.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":b,className:(0,p.cn)(u({align:b}),a),onClick:a=>{a.target.closest("button")||a.currentTarget.parentElement?.querySelector("input")?.focus()},...c})}let w=(0,r.F)("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function x({className:a,type:b="button",variant:c="ghost",size:e="xs",...f}){return(0,d.jsx)(q.$,{type:b,"data-size":e,variant:c,className:(0,p.cn)(w({size:e}),a),...f})}function y({className:a,...b}){return(0,d.jsx)(s.p,{"data-slot":"input-group-control",className:(0,p.cn)("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",a),...b})}var z=c(23171);let A=e.i;function B({className:a,children:b,...c}){return(0,d.jsxs)(f.M,{"data-slot":"combobox-trigger",className:(0,p.cn)("[&_svg:not([class*='size-'])]:size-4",a),...c,children:[b,(0,d.jsx)(z.RQe,{className:"pointer-events-none size-4 text-muted-foreground"})]})}function C({className:a,...b}){return(0,d.jsx)(g.V,{"data-slot":"combobox-clear",render:(0,d.jsx)(x,{variant:"ghost",size:"icon-xs"}),className:(0,p.cn)(a),...b,children:(0,d.jsx)(z.yBK,{className:"pointer-events-none"})})}function D({className:a,children:b,disabled:c=!1,showTrigger:e=!0,showClear:f=!1,inputRef:g,...i}){return(0,d.jsxs)(t,{className:(0,p.cn)("w-auto",a),children:[(0,d.jsx)(h.o,{ref:g,render:(0,d.jsx)(y,{disabled:c}),...i}),(0,d.jsxs)(v,{align:"inline-end",children:[e&&(0,d.jsx)(x,{size:"icon-xs",variant:"ghost",render:(0,d.jsx)(B,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:c}),f&&(0,d.jsx)(C,{disabled:c})]}),b]})}function E({className:a,side:b="bottom",sideOffset:c=6,align:e="start",alignOffset:f=0,anchor:g,...h}){return(0,d.jsx)(i.K,{children:(0,d.jsx)(j.o,{side:b,sideOffset:c,align:e,alignOffset:f,anchor:g,className:"isolate z-80",children:(0,d.jsx)(k.I,{"data-slot":"combobox-content","data-chips":!!g,className:(0,p.cn)("group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...h})})})}function F({className:a,...b}){return(0,d.jsx)(l.e,{"data-slot":"combobox-list",className:(0,p.cn)("no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0",a),...b})}function G({className:a,children:b,...c}){return(0,d.jsxs)(m.x,{"data-slot":"combobox-item",className:(0,p.cn)("relative flex h-8 w-full cursor-pointer items-center gap-2 rounded-lg pr-8 pl-2 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...c,children:[b,(0,d.jsx)(n.Q,{render:(0,d.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,d.jsx)(z.wiW,{className:"pointer-events-none"})})]})}function H({className:a,...b}){return(0,d.jsx)(o.$,{"data-slot":"combobox-empty",className:(0,p.cn)("hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex",a),...b})}},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},24358:(a,b,c)=>{Promise.resolve().then(c.bind(c,99432))},27815:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>s,handler:()=>u,routeModule:()=>t});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,35780))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,1777))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),q={children:["",{children:["[connectionId]",{children:["migrations",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,38632))),"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/migrations/page.tsx"]}]},{"global-error":[p,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/layout.tsx"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a),async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,59645)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},["_not-found","_global-error","api","favicon.ico","icon.svg"]]},{layout:[i,"/Users/theobourgeois/code/db-studio/src/app/layout.tsx"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a),async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,59645)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},[]]}.children,r=(0,e.H)({tree:q,page:"/[connectionId]/migrations/page",pathname:"/[connectionId]/migrations",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),s=r.__next_app__,t=r.routeModule,u=r.handler},28354:a=>{"use strict";a.exports=require("util")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},38522:a=>{"use strict";a.exports=require("node:zlib")},38632:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>f});var d=c(5735),e=c(99432);function f(){return(0,d.jsx)(e.MigrationsIndex,{})}},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},81040:(a,b,c)=>{"use strict";c.d(b,{MigrationsIndex:()=>P});var d=c(48249),e=c(2116),f=c.n(e),g=c(19099),h=c(67484),i=c(23171),j=c(30770),k=c(44231),l=c(86229),m=c(25297),n=c(82244),o=c(61903),p=c(89265),q=c(5681),r=c(53286),s=c(1814),t=c(20886),u=c(21883),v=c(453),w=c(78931),x=c(99598),y=c(66280),z=c(14490),A=c(97197),B=c(56918),C=c(65292),D=c(29613),E=c(76829),F=c(38393),G=c(78394);let H=[{verdict:"applied",title:"Already there",hint:"Everything these create or change is in the database.",preselected:!0},{verdict:"partial",title:"Partly there",hint:"Some of what these do is in the database and some is not — often a later migration changed it again.",preselected:!1},{verdict:"unknown",title:"Leaves no trace",hint:"Data changes, seeds, and grants cannot be seen in the schema. Include them if you know they ran.",preselected:!1},{verdict:"pending",title:"Not there",hint:"Nothing these do is in the database. Marking these hides work that still needs to run.",preselected:!1}];function I(a){return`${a.setName}\0${a.version}`}function J({connection:a,ledgerSchema:b,plan:c,onDone:e,onOpenChange:f}){let[g,k]=(0,h.useState)(null),[l,n]=(0,h.useState)(null),[o,p]=(0,h.useState)(new Set),[q,r]=(0,h.useState)([]),[s,t]=(0,h.useState)(!1),[v,w]=(0,h.useState)(null),[x,y]=(0,h.useState)(null),A=(0,h.useMemo)(()=>{if(!g)return[];let a=new Map(c.entries.map(a=>[I(a),a]));return H.map(b=>({verdict:b.verdict,title:b.title,hint:b.hint,entries:g.filter(a=>a.verdict===b.verdict).flatMap(b=>{let c=a.get(I(b));return c?[{entry:c,result:b}]:[]})})).filter(a=>a.entries.length>0)},[g,c.entries]),B=c.entries.filter(a=>o.has(I(a)));async function C(c){t(!0),y(null);try{w(await u.F.adopt(a.url,{ledgerSchema:b,entries:c})),e()}catch(a){y(a instanceof Error?a.message:String(a))}finally{t(!1)}}let D=!g&&!l;return(0,d.jsx)(F.lG,{open:!0,onOpenChange:a=>!s&&f(a),children:(0,d.jsxs)(F.Cf,{className:"sm:max-w-xl",children:[(0,d.jsxs)(F.c7,{children:[(0,d.jsx)(F.L3,{children:v?`Marked ${v.recorded} as applied`:D?`Checking ${a.name}…`:`Mark as already applied on ${a.name}`}),(0,d.jsx)(F.rr,{children:(0,d.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{children:v?"Recorded on":"Records on"}),(0,d.jsx)(j.F,{connection:a}),(0,d.jsx)("span",{className:"font-medium text-foreground",children:a.name}),(0,d.jsx)("span",{className:"font-mono text-[11px]",children:(0,G.p)(a.url)})]})})]}),v?(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:v.existing>0?`${v.existing} were already in the ledger and were left as they were.`:"Every one of them was new to the ledger."}):D?(0,d.jsxs)("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)(i.gnh,{className:"size-3.5 animate-spin"}),"Reading the schema to see which of the ",c.entries.length," have already run…"]}):l?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"max-h-32 overflow-auto rounded-md border border-destructive/25 bg-destructive/5 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap text-destructive",children:l}),(0,d.jsxs)("p",{className:"text-xs text-muted-foreground",children:["The check could not run. You can still mark all ",c.entries.length," as applied if you know the database already has these changes."]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"max-h-80 overflow-y-auto rounded-md border",children:A.map(a=>{let b=a.entries.filter(({entry:a})=>o.has(I(a))).length,c=q.includes(a.verdict);return(0,d.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":`Include ${a.title}`,className:"size-3.5 cursor-pointer accent-primary",checked:b===a.entries.length,ref:c=>{c&&(c.indeterminate=b>0&&b<a.entries.length)},onChange:b=>{var c;return c=b.target.checked,void p(b=>{let d=new Set(b);for(let{entry:b}of a.entries)c?d.add(I(b)):d.delete(I(b));return d})}}),(0,d.jsxs)("button",{type:"button","aria-expanded":c,onClick:()=>{var b;return b=a.verdict,void r(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-left",children:[(0,d.jsx)(i.nNJ,{className:(0,z.cn)("size-3.5 shrink-0 text-muted-foreground/70 transition-transform",c&&"rotate-90")}),(0,d.jsx)("span",{className:"text-sm",children:a.title}),(0,d.jsxs)("span",{className:"tabular-nums text-xs text-muted-foreground",children:[b,"/",a.entries.length]})]}),(0,d.jsx)(K,{verdict:a.verdict})]}),!c&&(0,d.jsx)("p",{className:"px-9 pb-2 text-[11px] text-muted-foreground",children:a.hint}),c&&(0,d.jsxs)("div",{className:"bg-muted/25",children:[(0,d.jsx)("p",{className:"px-9 py-1.5 text-[11px] text-muted-foreground",children:a.hint}),a.entries.map(({entry:a,result:b})=>{let c=b.evidence.filter(a=>!a.satisfied),e=b.evidence.find(a=>a.note)?.note;return(0,d.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 border-t px-3 py-1.5 text-xs hover:bg-muted/40",children:[(0,d.jsx)("input",{type:"checkbox",className:"mt-0.5 size-3.5 cursor-pointer accent-primary",checked:o.has(I(a)),onChange:()=>{p(b=>{let c=new Set(b),d=I(a);return c.has(d)?c.delete(d):c.add(d),c})}}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"shrink-0 text-muted-foreground",children:a.setName}),(0,d.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground",children:a.version}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:a.name})]}),(c.length>0||e)&&(0,d.jsxs)("span",{className:"mt-0.5 block truncate text-[11px] text-muted-foreground",children:[c.length>0&&(0,d.jsxs)(d.Fragment,{children:["Missing: ",c.slice(0,2).map(a=>a.description).join(", "),c.length>2&&` and ${c.length-2} more`]}),c.length>0&&e&&" \xb7 ",e]})]})]},I(a))})]})]},a.verdict)})}),(0,d.jsxs)("p",{className:"rounded-md border border-amber-600/25 bg-amber-500/8 px-3 py-2 text-xs",children:[(0,d.jsx)("span",{className:"font-medium",children:"No SQL runs."})," Only the ledger on"," ",a.name," changes, in one transaction. Rows already there are not touched."]})]}),x&&(0,d.jsx)("p",{className:"max-h-32 overflow-auto rounded-md border border-destructive/25 bg-destructive/5 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap text-destructive",children:x}),(0,d.jsx)(F.Es,{children:v?(0,d.jsx)(m.$,{onClick:()=>f(!1),children:"Close"}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(m.$,{variant:"outline",disabled:s,onClick:()=>f(!1),children:"Cancel"}),l?(0,d.jsx)(m.$,{disabled:s,onClick:()=>void C(c.entries),children:s?"Marking…":`Mark all ${c.entries.length} as applied`}):(0,d.jsx)(m.$,{disabled:s||D||0===B.length,onClick:()=>void C(B),children:s?"Marking…":`Mark as applied (${B.length})`})]})})]})})}function K({verdict:a}){return"applied"===a?(0,d.jsx)(i.wiW,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):"partial"===a?(0,d.jsx)(i.e5t,{className:"size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}):"pending"===a?(0,d.jsx)(i.e5t,{className:"size-3.5 shrink-0 text-destructive"}):(0,d.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"})}var L=c(88877),M=c(90863);function N({root:a,environmentNames:b,onOpenChange:c,onSave:e}){let[f,g]=(0,h.useState)(a??""),i=f.trim(),j=i.startsWith("/")||i.startsWith("~")||/^[A-Za-z]:[\\/]/.test(i);function k(){i&&j&&(e(i),c(!1))}return(0,d.jsx)(F.lG,{open:!0,onOpenChange:c,children:(0,d.jsxs)(F.Cf,{className:"sm:max-w-lg",children:[(0,d.jsxs)(F.c7,{children:[(0,d.jsx)(F.L3,{children:"Migrations folder"}),(0,d.jsxs)(F.rr,{children:["A folder on this computer. Each folder inside it that holds .sql files is one migration, read fresh from disk every time — whatever branch is checked out is what shows. ",b.join(", ")," will all read from it."]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)(M.J,{htmlFor:"repo-root",children:"Path"}),(0,d.jsx)(L.p,{id:"repo-root",value:f,placeholder:"~/code/app/src/lib/supabase/migrations",spellCheck:!1,autoComplete:"off",autoFocus:!0,"aria-invalid":i.length>0&&!j,onChange:a=>g(a.target.value),onKeyDown:a=>"Enter"===a.key&&k()}),i.length>0&&!j&&(0,d.jsx)("p",{className:"text-xs text-destructive",children:"An absolute path, or one starting with ~."})]}),(0,d.jsxs)(F.Es,{children:[a&&(0,d.jsx)(m.$,{variant:"ghost",className:"mr-auto",onClick:function(){e(null),c(!1)},children:"Stop reading from disk"}),(0,d.jsx)(m.$,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,d.jsx)(m.$,{disabled:!i||!j,onClick:k,children:"Save"})]})]})})}var O=c(30904);function P(){let a=(0,g.useRouter)(),{connection:b}=(0,k.k)(),c=(0,y.jV)(a=>a.sets),e=(0,y.jV)(a=>a.createSet),f=(0,y.jV)(a=>a.adoptSet),j=(0,y.jV)(a=>a.addFiles),o=(0,y.jV)(a=>a.removeSet),p=(0,y.jV)(a=>a.ledgerSchema),q=(0,y.jV)(a=>a.history),s=(0,x.gz)(b.id),[F,G]=(0,h.useState)("migrations"),[H,I]=(0,h.useState)(null),[K,L]=(0,h.useState)(null),[M,P]=(0,h.useState)(!1),[Q,V]=(0,h.useState)(!1),[W,X]=(0,h.useState)(null),Y=(0,h.useMemo)(()=>[b,...s],[b,s]),Z=Y.map(a=>a.url).join("|"),{scope:$,root:_,checkout:aa}=(0,y.ox)(b.id),ab=(0,y.jV)(a=>a.setRepoRoot),ac=(0,y.jV)(a=>a.setRepoCheckout),ad=(0,y.kG)($),ae=(0,y.jV)(a=>a.setListFilter),af=(0,O.y)(_,aa),ag=(0,h.useMemo)(()=>[...af.data?.sets??[]].sort((a,b)=>b.importedAt-a.importedAt),[af.data]),ah=(0,t.Y)(`ledgers:${p}:${Z}`,async a=>Object.fromEntries(await Promise.all(Y.map(async b=>{try{return[b.id,{ledger:await u.F.ledger(b.url,p,a),error:null}]}catch(c){if(a.aborted)throw c;return[b.id,{ledger:null,error:c instanceof Error?c.message:String(c)}]}})))),ai=(0,h.useMemo)(()=>(0,v.x)(Y.map(a=>({connection:a,ledger:ah.data?.[a.id]?.ledger??null})),q),[Y,ah.data,q]),aj=`/${encodeURIComponent(b.id)}/migrations`,ak=(0,h.useCallback)(b=>{let c=e(b.name);j(c,b.files),a.push(`${aj}/${encodeURIComponent(c)}`)},[e,j,a,aj]);async function al(b){I(b),L(null);try{let c=await Promise.all(Y.map(async a=>{try{return{read:await u.F.ledger(a.url,p,void 0,!0),error:null}}catch(a){return{read:null,error:a instanceof Error?a.message:String(a)}}})),d=c.find(a=>a.error);if(d?.error)return void L(d.error);let e=c.some(a=>a.read&&void 0===a.read.withSql),g=new Map;for(let{read:a}of c)for(let c of a?.entries??[]){if(c.setName.trim()!==b)continue;let a=g.get(c.version);a?.applySql||g.set(c.version,c)}let{set:h,missing:i}=(0,B.wQ)(b,[...g.values()]);if(0===h.steps.length)return void L(e?"The YTDB running on your machine is older than this page and cannot send stored SQL. Restart it with `npx @theobourgeois/ytdb@latest`.":`${b} was applied before YTDB stored SQL, so it cannot be rebuilt. Drop its folder instead.`);f(h),i.length>0&&L(`Rebuilt ${h.steps.length} of ${h.steps.length+i.length}. No SQL was stored for ${i.join(", ")}.`),a.push(`${aj}/${encodeURIComponent(h.id)}`)}catch(a){L(a instanceof Error?a.message:String(a))}finally{I(null)}}let am=(0,h.useMemo)(()=>[...c].sort((a,b)=>b.importedAt-a.importedAt),[c]),an=(0,h.useMemo)(()=>(0,w.lF)(Y.map(a=>({connection:a,ledger:ah.data?.[a.id]?.ledger??null})),[...ag,...c].map(a=>a.name)),[Y,ah.data,ag,c]),ao=(0,h.useMemo)(()=>{let a=ah.data?.[b.id]?.ledger??null,c=[],d=0;if(!a)return{sets:0,entries:c};for(let b of ag){let e=(0,w.gj)(b,(0,w.Gf)(a,b.name));if(0!==e.steps.length)for(let a of(d+=1,e.steps))c.push({setName:b.name,version:a.version,name:a.name,checksum:a.checksum,applySql:a.applySql,revertSql:a.revertSql})}return{sets:d,entries:c}},[ah.data,b.id,ag]),ap=ah.loading||af.loading,aq=0===ag.length&&0===c.length&&0===an.length,ar=(0,h.useCallback)(a=>Y.map(b=>({connection:b,summary:(0,w.eh)(a,ah.data?.[b.id]?.ledger??null),read:!!ah.data?.[b.id]?.ledger,error:ah.data?.[b.id]?.error??null})),[Y,ah.data]),as=(0,h.useCallback)(a=>(0,w.yy)(a,ar(a).map(a=>({connectionId:a.connection.id,summary:a.summary,read:a.read})),ad),[ar,ad]),at=(0,h.useMemo)(()=>ag.filter(as),[ag,as]),au=(0,h.useMemo)(()=>am.filter(as),[am,as]),av=""!==ad.query.trim()||"all"!==ad.status,aw=ag.length+am.length-at.length-au.length;return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsxs)(l.X,{children:[(0,d.jsx)(i.olY,{className:"size-4 shrink-0 text-muted-foreground"}),(0,d.jsx)("span",{className:"font-medium",children:"Migrations"}),_&&(0,d.jsx)(S,{root:af.data?.root??_,git:af.data?.git??null,checkouts:af.data?.checkouts??[],checkout:af.data?.checkout??null,onEdit:()=>V(!0),onPick:a=>ac($,a)}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,d.jsx)(m.$,{size:"icon-sm",variant:"ghost",disabled:ap,"aria-label":"Refresh",title:_?"Re-read the folder and every environment's ledger":"Re-read every environment's ledger",onClick:function(){ah.reload(),af.reload()},children:(0,d.jsx)(i.oS8,{className:(0,z.cn)(ap&&"animate-spin")})}),!_&&(0,d.jsxs)(m.$,{size:"sm",variant:"ghost",onClick:()=>V(!0),children:[(0,d.jsx)(i.WzY,{"data-icon":"inline-start"}),"Read from a folder"]}),(0,d.jsxs)(m.$,{size:"sm",variant:"ghost",onClick:()=>P(!0),children:[(0,d.jsx)(i.enO,{"data-icon":"inline-start"}),"New migration"]}),(_||c.length>0)&&(0,d.jsxs)(n.rI,{children:[(0,d.jsx)(n.ty,{render:(0,d.jsx)(m.$,{size:"icon-sm",variant:"ghost","aria-label":"More migration actions"}),className:"cursor-pointer",children:(0,d.jsx)(i.YKd,{})}),(0,d.jsxs)(n.SQ,{align:"end",className:"min-w-72",children:[_&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(n._2,{disabled:ap||0===ao.entries.length,onClick:()=>X(ao),children:[(0,d.jsx)(i.nXx,{}),"Mark everything as applied on ",b.name,(0,d.jsx)("span",{className:"ml-auto pl-3 font-mono text-[11px] text-muted-foreground",children:ao.entries.length})]}),(0,d.jsx)(n.mB,{}),(0,d.jsxs)(n._2,{onClick:()=>V(!0),children:[(0,d.jsx)(i.WzY,{}),"Change folder…"]})]}),c.length>0&&(0,d.jsxs)(d.Fragment,{children:[_&&(0,d.jsx)(n.mB,{}),(0,d.jsxs)(n._2,{variant:"destructive",onClick:function(){for(let a of c)o(a.id)},children:["Forget ",c.length," imported migration",1===c.length?"":"s"]})]})]})]})]})]}),af.error&&(0,d.jsxs)("p",{className:"flex items-start gap-2 border-b bg-destructive/5 px-4 py-1.5 text-xs text-destructive",children:[(0,d.jsx)(i.e5t,{className:"mt-px size-3.5 shrink-0"}),(0,d.jsx)("span",{className:"min-w-0 flex-1",children:af.error}),(0,d.jsx)(m.$,{size:"xs",variant:"ghost",onClick:()=>V(!0),children:"Change folder"})]}),"history"===F?(0,d.jsx)(r.F,{className:"min-h-0 flex-1",children:(0,d.jsx)(A.H,{events:ai,connections:Y,loading:ah.loading,ledgerSchema:p})}):aq&&_&&af.loading?(0,d.jsxs)("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:["Reading ",_,"…"]}):aq&&_?(0,d.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 p-6 text-center",children:[(0,d.jsxs)("p",{className:"text-sm",children:["Nothing in ",_," yet."]}),(0,d.jsx)("p",{className:"max-w-md text-xs text-muted-foreground",children:"Each folder inside it that holds .sql files becomes a migration here, the moment it exists on the branch you have checked out."})]}):aq?(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4 p-6",children:[(0,d.jsx)(C.k,{onFiles:ak,className:"w-full max-w-xl"}),(0,d.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Or"," ",(0,d.jsx)("button",{type:"button",className:"cursor-pointer underline underline-offset-4 hover:text-foreground",onClick:()=>V(!0),children:"read straight from a folder on this computer"}),", so nothing has to be imported."]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(R,{filter:ad,environments:Y,hidden:aw,onChange:a=>ae($,a)}),(0,d.jsxs)(r.F,{className:"min-h-0 flex-1",children:[at.map(a=>(0,d.jsx)(T,{set:a,href:`${aj}/${encodeURIComponent(a.id)}`,environments:ar(a)},a.id)),au.length>0&&_&&(0,d.jsx)("p",{className:"border-b px-4 pt-2.5 pb-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",title:"Imported into this browser rather than read from the folder.",children:"Imported"}),au.map(a=>(0,d.jsx)(T,{set:a,href:`${aj}/${encodeURIComponent(a.id)}`,environments:ar(a)},a.id)),av&&0===at.length&&0===au.length&&(0,d.jsxs)("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:["Nothing matches."," ",(0,d.jsx)("button",{type:"button",className:"cursor-pointer underline underline-offset-4 hover:text-foreground",onClick:()=>ae($,{query:"",status:"all"}),children:"Clear the filter"})]}),an.length>0&&(0,d.jsxs)("div",{className:"border-b bg-muted/20",children:[(0,d.jsx)("p",{className:"px-4 pt-2.5 pb-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",title:"Applied to a database from elsewhere. The SQL is kept in its ledger, so it opens without the folder.",children:"In the ledger only"}),an.map(a=>(0,d.jsx)(U,{migration:a,busy:H===a.name,onOpen:()=>void al(a.name)},a.name)),K&&(0,d.jsx)("p",{className:"px-4 pt-1 pb-2 text-xs text-destructive",children:K})]}),!_&&(0,d.jsx)("div",{className:"p-4",children:(0,d.jsx)(C.k,{onFiles:ak,compact:!0,className:"w-full"})})]})]}),(0,d.jsx)(E.l,{caption:function(a,b,c,d){if(d&&0===a)return"Reading folder…";if(0===a&&0===b&&0===c)return"No migrations yet";let e=[];return a>0&&e.push(`${a} migration${1===a?"":"s"} on disk`),b>0&&e.push(`${b} imported`),c>0&&e.push(`${c} in the ledger only`),e.join(" \xb7 ")}(ag.length,c.length,an.length,null!==_&&af.loading),pane:F,onPaneChange:G,historyCount:ai.length}),Q&&(0,d.jsx)(N,{root:_,environmentNames:Y.map(a=>a.name),onOpenChange:V,onSave:a=>ab($,a)}),W&&(0,d.jsx)(J,{connection:b,ledgerSchema:p,plan:W,onDone:()=>ah.reload(),onOpenChange:a=>!a&&X(null)}),(0,d.jsx)(D.K,{open:M,title:"New migration",submitLabel:"Create",onOpenChange:P,onSubmit:function(b){let c=e(b);a.push(`${aj}/${encodeURIComponent(c)}`)}})]})}let Q={all:"All",pending:"Not fully applied",untouched:"Not started anywhere",complete:"Applied everywhere"};function R({filter:a,environments:b,hidden:c,onChange:e}){let f="all"!==a.status;return(0,d.jsxs)("div",{className:"flex items-center gap-1 border-b px-2 py-1",children:[(0,d.jsx)(s.L,{value:a.query,onChange:a=>e({query:a.target.value}),placeholder:"Search migrations","aria-label":"Search migrations",className:"min-w-0 flex-1",trailing:a.query?(0,d.jsx)("button",{type:"button","aria-label":"Clear search",className:"cursor-pointer rounded p-0.5 hover:text-foreground",onClick:()=>e({query:""}),children:(0,d.jsx)(i.yBK,{className:"size-3.5"})}):null}),(0,d.jsxs)(n.rI,{children:[(0,d.jsxs)(n.ty,{render:(0,d.jsx)(m.$,{size:"sm",variant:f?"outline":"ghost"}),className:"cursor-pointer",children:[function(a,b){if(a.startsWith("pending:")){let c=b.find(b=>b.id===a.slice(8));return c?`Pending on ${c.name}`:Q.pending}return Q[a]}(a.status,b),(0,d.jsx)(i.RQe,{"data-icon":"inline-end"})]}),(0,d.jsx)(n.SQ,{align:"end",className:"min-w-56",children:(0,d.jsxs)(n.Hr,{value:a.status,onValueChange:a=>e({status:a}),children:[Object.keys(Q).map(a=>(0,d.jsx)(n.Ht,{value:a,children:Q[a]},a)),b.length>1&&(0,d.jsx)(n.mB,{}),b.length>1&&b.map(a=>(0,d.jsxs)(n.Ht,{value:`pending:${a.id}`,children:[(0,d.jsx)(j.F,{connection:a,className:"size-1.5"}),"Pending on ",a.name]},a.id))]})})]}),c>0&&(0,d.jsxs)("span",{className:"shrink-0 pr-1 text-[11px] tabular-nums text-muted-foreground",children:[c," hidden"]})]})}function S({root:a,git:b,checkouts:c,checkout:e,onEdit:f,onPick:g}){var j;let k,[l,m]=(0,h.useState)(""),n=(0,h.useMemo)(()=>{let a=l.trim().toLowerCase();return a?c.filter(b=>b.branch.toLowerCase().includes(a)||b.path.toLowerCase().includes(a)):c},[c,l]),r="cursor-pointer rounded-md outline-none hover:bg-muted/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60",s=b&&(0,d.jsxs)("span",{className:"shrink-0 rounded border px-1.5 font-mono text-[10px]",children:[b.branch,b.dirty&&"*"]});return(0,d.jsxs)("div",{className:"flex min-w-0 items-center text-xs text-muted-foreground",children:[(0,d.jsxs)("button",{type:"button",title:`Reading from ${a}. Click to change.`,onClick:f,className:(0,z.cn)("flex min-w-0 items-center gap-1.5 px-1.5 py-0.5",r),children:[(0,d.jsx)(i.WzY,{className:"size-3.5 shrink-0"}),(0,d.jsx)("span",{className:"max-w-64 truncate font-mono text-[11px]",children:(k=(j=a).split(/[\/]/).filter(Boolean)).length>2?`…/${k.slice(-2).join("/")}`:j})]}),b&&c.length>1?(0,d.jsxs)(q.G3,{items:n,filter:null,value:c.find(a=>a.path===e)??null,inputValue:l,onInputValueChange:a=>m(a),onOpenChange:a=>a&&m(""),itemToStringLabel:a=>a.branch,isItemEqualToValue:(a,b)=>a.path===b.path,onValueChange:a=>a&&g(a.path),children:[(0,d.jsxs)(o.M,{title:`${b.branch} (${b.commit}${b.dirty?", uncommitted changes":""}). Read from another worktree.`,className:(0,z.cn)("flex shrink-0 items-center gap-0.5 px-1 py-0.5",r),children:[s,(0,d.jsx)(i.klM,{className:"size-3"})]}),(0,d.jsxs)(q.h5,{className:"w-max min-w-56",children:[(0,d.jsxs)("div",{className:"m-1 mb-0 flex h-8 items-center gap-1.5 rounded-lg px-2 text-muted-foreground focus-within:bg-muted/60",children:[(0,d.jsx)(i.TfF,{className:"size-3.5 shrink-0"}),(0,d.jsx)(p.o,{placeholder:"Search worktrees",spellCheck:!1,autoComplete:"off",className:"h-full min-w-0 flex-1 bg-transparent text-[0.8rem] text-foreground outline-none placeholder:text-muted-foreground"})]}),(0,d.jsx)(q.$U,{children:"No matching worktrees"}),(0,d.jsx)(q.ex,{children:a=>(0,d.jsx)(q.x4,{value:a,title:a.path,children:(0,d.jsx)("span",{className:"font-mono text-xs",children:a.branch})},a.path)})]})]}):b&&(0,d.jsx)("span",{className:"px-1",title:`${b.branch} (${b.commit}${b.dirty?", uncommitted changes":""})`,children:s})]})}function T({set:a,href:b,environments:c}){return(0,d.jsxs)(f(),{href:b,className:"flex items-center gap-3 border-b px-4 py-3 outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("p",{className:"flex min-w-0 items-center gap-1.5 text-sm font-medium",children:[(0,d.jsx)("span",{className:"truncate",children:a.name}),a.note&&(0,d.jsx)("span",{title:a.note,className:"shrink-0 text-muted-foreground",children:(0,d.jsx)(i.UA_,{className:"size-3.5"})})]}),(0,d.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[0===a.steps.length?"No files yet":`${a.steps.length} migration${1===a.steps.length?"":"s"}`,a.steps.length>0&&` \xb7 ${a.steps[0].version}–${a.steps.at(-1)?.version}`,a.skipped.length>0&&` \xb7 ${a.skipped.length} skipped`]})]}),(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1.5",children:c.map(a=>(0,d.jsx)(V,{environment:a},a.connection.id))}),(0,d.jsx)(i.nNJ,{className:"size-4 shrink-0 text-muted-foreground/60"})]})}function U({migration:a,busy:b,onOpen:c}){return(0,d.jsxs)("div",{className:"flex items-center gap-3 border-t px-4 py-2.5 first:border-t-0",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"truncate text-sm",children:a.name}),(0,d.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[a.total," migration",1===a.total?"":"s",a.versions.length>0&&` \xb7 ${a.versions[0]}–${a.versions.at(-1)}`]})]}),(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1.5",children:a.applied.map(b=>(0,d.jsxs)("span",{className:"flex h-6 items-center gap-1.5 rounded-lg border border-dashed px-2 text-[11px] text-muted-foreground",children:[(0,d.jsx)("span",{className:"max-w-24 truncate",children:b.connectionName}),(0,d.jsxs)("span",{className:"tabular-nums",children:[b.count,"/",a.total]})]},b.connectionId))}),(0,d.jsx)(m.$,{size:"xs",variant:"outline",disabled:b,onClick:c,children:b?"Opening…":"Open"})]})}function V({environment:a}){let{connection:b,summary:c,read:e,error:f}=a,g=e&&c.total>0&&0===c.pending&&0===c.drifted,h=e&&0===c.applied&&0===c.drifted;return(0,d.jsxs)("span",{title:f?`${b.name}: ${f}`:e?`${b.name}: ${c.applied} of ${c.total} applied`:`${b.name}: reading…`,className:(0,z.cn)("flex h-6 items-center gap-1.5 rounded-lg border px-2 text-[11px]",f&&"border-destructive/30 text-destructive",g&&"border-emerald-600/30 bg-emerald-500/10",!f&&!g&&!h&&"border-amber-600/30 bg-amber-500/10",h&&"text-muted-foreground"),children:[(0,d.jsx)(j.F,{connection:b,className:"size-1.5"}),(0,d.jsx)("span",{className:"max-w-24 truncate",children:b.name}),(0,d.jsx)("span",{className:"tabular-nums",children:f?"—":e?`${c.applied}/${c.total}`:"…"})]})}},94094:(a,b,c)=>{Promise.resolve().then(c.bind(c,81040))},99432:(a,b,c)=>{"use strict";c.d(b,{MigrationsIndex:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call MigrationsIndex() from the server but MigrationsIndex is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/theobourgeois/code/db-studio/src/components/migrations/migrations-index.tsx","MigrationsIndex")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[741,430,928,842,202,875,421,593,729,208],()=>b(b.s=27815));module.exports=c})();
1
+ (()=>{var a={};a.id=9820,a.ids=[9820],a.modules={3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},5681:(a,b,c)=>{"use strict";c.d(b,{G3:()=>A,h5:()=>E,$U:()=>H,oK:()=>D,x4:()=>G,ex:()=>F});var d=c(48249);c(67484);var e=c(90038),f=c(61903),g=c(62379),h=c(89265),i=c(52899),j=c(48607),k=c(26447),l=c(1359),m=c(30250),n=c(35116),o=c(84412),p=c(14490),q=c(25297),r=c(21654),s=c(88877);function t({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,p.cn)("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...b})}c(86871);let u=(0,r.F)("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function v({className:a,align:b="inline-start",...c}){return(0,d.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":b,className:(0,p.cn)(u({align:b}),a),onClick:a=>{a.target.closest("button")||a.currentTarget.parentElement?.querySelector("input")?.focus()},...c})}let w=(0,r.F)("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function x({className:a,type:b="button",variant:c="ghost",size:e="xs",...f}){return(0,d.jsx)(q.$,{type:b,"data-size":e,variant:c,className:(0,p.cn)(w({size:e}),a),...f})}function y({className:a,...b}){return(0,d.jsx)(s.p,{"data-slot":"input-group-control",className:(0,p.cn)("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",a),...b})}var z=c(23171);let A=e.i;function B({className:a,children:b,...c}){return(0,d.jsxs)(f.M,{"data-slot":"combobox-trigger",className:(0,p.cn)("[&_svg:not([class*='size-'])]:size-4",a),...c,children:[b,(0,d.jsx)(z.RQe,{className:"pointer-events-none size-4 text-muted-foreground"})]})}function C({className:a,...b}){return(0,d.jsx)(g.V,{"data-slot":"combobox-clear",render:(0,d.jsx)(x,{variant:"ghost",size:"icon-xs"}),className:(0,p.cn)(a),...b,children:(0,d.jsx)(z.yBK,{className:"pointer-events-none"})})}function D({className:a,children:b,disabled:c=!1,showTrigger:e=!0,showClear:f=!1,inputRef:g,...i}){return(0,d.jsxs)(t,{className:(0,p.cn)("w-auto",a),children:[(0,d.jsx)(h.o,{ref:g,render:(0,d.jsx)(y,{disabled:c}),...i}),(0,d.jsxs)(v,{align:"inline-end",children:[e&&(0,d.jsx)(x,{size:"icon-xs",variant:"ghost",render:(0,d.jsx)(B,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:c}),f&&(0,d.jsx)(C,{disabled:c})]}),b]})}function E({className:a,side:b="bottom",sideOffset:c=6,align:e="start",alignOffset:f=0,anchor:g,...h}){return(0,d.jsx)(i.K,{children:(0,d.jsx)(j.o,{side:b,sideOffset:c,align:e,alignOffset:f,anchor:g,className:"isolate z-80",children:(0,d.jsx)(k.I,{"data-slot":"combobox-content","data-chips":!!g,className:(0,p.cn)("group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[chips=true]:min-w-(--anchor-width) data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/30 *:data-[slot=input-group]:shadow-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",a),...h})})})}function F({className:a,...b}){return(0,d.jsx)(l.e,{"data-slot":"combobox-list",className:(0,p.cn)("no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto overscroll-contain p-1 data-empty:p-0",a),...b})}function G({className:a,children:b,...c}){return(0,d.jsxs)(m.x,{"data-slot":"combobox-item",className:(0,p.cn)("relative flex h-8 w-full cursor-pointer items-center gap-2 rounded-lg pr-8 pl-2 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...c,children:[b,(0,d.jsx)(n.Q,{render:(0,d.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,d.jsx)(z.wiW,{className:"pointer-events-none"})})]})}function H({className:a,...b}){return(0,d.jsx)(o.$,{"data-slot":"combobox-empty",className:(0,p.cn)("hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex",a),...b})}},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},24358:(a,b,c)=>{Promise.resolve().then(c.bind(c,99432))},28354:a=>{"use strict";a.exports=require("util")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},38522:a=>{"use strict";a.exports=require("node:zlib")},38632:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>f});var d=c(5735),e=c(99432);function f(){return(0,d.jsx)(e.MigrationsIndex,{})}},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},70456:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>s,handler:()=>u,routeModule:()=>t});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,35780))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,1777))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),q={children:["",{children:["[connectionId]",{children:["migrations",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,38632))),"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/migrations/page.tsx"]}]},{"global-error":[p,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/Users/theobourgeois/code/db-studio/src/app/[connectionId]/layout.tsx"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a),async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,59645)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},["_not-found","_global-error","api","favicon.ico","icon.svg"]]},{layout:[i,"/Users/theobourgeois/code/db-studio/src/app/layout.tsx"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a),async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,59645)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},[]]}.children,r=(0,e.H)({tree:q,page:"/[connectionId]/migrations/page",pathname:"/[connectionId]/migrations",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),s=r.__next_app__,t=r.routeModule,u=r.handler},81040:(a,b,c)=>{"use strict";c.d(b,{MigrationsIndex:()=>P});var d=c(48249),e=c(2116),f=c.n(e),g=c(19099),h=c(67484),i=c(23171),j=c(30770),k=c(44231),l=c(86229),m=c(25297),n=c(82244),o=c(61903),p=c(89265),q=c(5681),r=c(53286),s=c(1814),t=c(20886),u=c(21883),v=c(453),w=c(78931),x=c(99598),y=c(66280),z=c(14490),A=c(60101),B=c(56918),C=c(65292),D=c(29613),E=c(76829),F=c(38393),G=c(78394);let H=[{verdict:"applied",title:"Already there",hint:"Everything these create or change is in the database.",preselected:!0},{verdict:"partial",title:"Partly there",hint:"Some of what these do is in the database and some is not — often a later migration changed it again.",preselected:!1},{verdict:"unknown",title:"Leaves no trace",hint:"Data changes, seeds, and grants cannot be seen in the schema. Include them if you know they ran.",preselected:!1},{verdict:"pending",title:"Not there",hint:"Nothing these do is in the database. Marking these hides work that still needs to run.",preselected:!1}];function I(a){return`${a.setName}\0${a.version}`}function J({connection:a,ledgerSchema:b,plan:c,onDone:e,onOpenChange:f}){let[g,k]=(0,h.useState)(null),[l,n]=(0,h.useState)(null),[o,p]=(0,h.useState)(new Set),[q,r]=(0,h.useState)([]),[s,t]=(0,h.useState)(!1),[v,w]=(0,h.useState)(null),[x,y]=(0,h.useState)(null),A=(0,h.useMemo)(()=>{if(!g)return[];let a=new Map(c.entries.map(a=>[I(a),a]));return H.map(b=>({verdict:b.verdict,title:b.title,hint:b.hint,entries:g.filter(a=>a.verdict===b.verdict).flatMap(b=>{let c=a.get(I(b));return c?[{entry:c,result:b}]:[]})})).filter(a=>a.entries.length>0)},[g,c.entries]),B=c.entries.filter(a=>o.has(I(a)));async function C(c){t(!0),y(null);try{w(await u.F.adopt(a.url,{ledgerSchema:b,entries:c})),e()}catch(a){y(a instanceof Error?a.message:String(a))}finally{t(!1)}}let D=!g&&!l;return(0,d.jsx)(F.lG,{open:!0,onOpenChange:a=>!s&&f(a),children:(0,d.jsxs)(F.Cf,{className:"sm:max-w-xl",children:[(0,d.jsxs)(F.c7,{children:[(0,d.jsx)(F.L3,{children:v?`Marked ${v.recorded} as applied`:D?`Checking ${a.name}…`:`Mark as already applied on ${a.name}`}),(0,d.jsx)(F.rr,{children:(0,d.jsxs)("span",{className:"flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{children:v?"Recorded on":"Records on"}),(0,d.jsx)(j.F,{connection:a}),(0,d.jsx)("span",{className:"font-medium text-foreground",children:a.name}),(0,d.jsx)("span",{className:"font-mono text-[11px]",children:(0,G.p)(a.url)})]})})]}),v?(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:v.existing>0?`${v.existing} were already in the ledger and were left as they were.`:"Every one of them was new to the ledger."}):D?(0,d.jsxs)("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsx)(i.gnh,{className:"size-3.5 animate-spin"}),"Reading the schema to see which of the ",c.entries.length," have already run…"]}):l?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"max-h-32 overflow-auto rounded-md border border-destructive/25 bg-destructive/5 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap text-destructive",children:l}),(0,d.jsxs)("p",{className:"text-xs text-muted-foreground",children:["The check could not run. You can still mark all ",c.entries.length," as applied if you know the database already has these changes."]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"max-h-80 overflow-y-auto rounded-md border",children:A.map(a=>{let b=a.entries.filter(({entry:a})=>o.has(I(a))).length,c=q.includes(a.verdict);return(0,d.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2",children:[(0,d.jsx)("input",{type:"checkbox","aria-label":`Include ${a.title}`,className:"size-3.5 cursor-pointer accent-primary",checked:b===a.entries.length,ref:c=>{c&&(c.indeterminate=b>0&&b<a.entries.length)},onChange:b=>{var c;return c=b.target.checked,void p(b=>{let d=new Set(b);for(let{entry:b}of a.entries)c?d.add(I(b)):d.delete(I(b));return d})}}),(0,d.jsxs)("button",{type:"button","aria-expanded":c,onClick:()=>{var b;return b=a.verdict,void r(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-left",children:[(0,d.jsx)(i.nNJ,{className:(0,z.cn)("size-3.5 shrink-0 text-muted-foreground/70 transition-transform",c&&"rotate-90")}),(0,d.jsx)("span",{className:"text-sm",children:a.title}),(0,d.jsxs)("span",{className:"tabular-nums text-xs text-muted-foreground",children:[b,"/",a.entries.length]})]}),(0,d.jsx)(K,{verdict:a.verdict})]}),!c&&(0,d.jsx)("p",{className:"px-9 pb-2 text-[11px] text-muted-foreground",children:a.hint}),c&&(0,d.jsxs)("div",{className:"bg-muted/25",children:[(0,d.jsx)("p",{className:"px-9 py-1.5 text-[11px] text-muted-foreground",children:a.hint}),a.entries.map(({entry:a,result:b})=>{let c=b.evidence.filter(a=>!a.satisfied),e=b.evidence.find(a=>a.note)?.note;return(0,d.jsxs)("label",{className:"flex cursor-pointer items-start gap-2 border-t px-3 py-1.5 text-xs hover:bg-muted/40",children:[(0,d.jsx)("input",{type:"checkbox",className:"mt-0.5 size-3.5 cursor-pointer accent-primary",checked:o.has(I(a)),onChange:()=>{p(b=>{let c=new Set(b),d=I(a);return c.has(d)?c.delete(d):c.add(d),c})}}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"shrink-0 text-muted-foreground",children:a.setName}),(0,d.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground",children:a.version}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:a.name})]}),(c.length>0||e)&&(0,d.jsxs)("span",{className:"mt-0.5 block truncate text-[11px] text-muted-foreground",children:[c.length>0&&(0,d.jsxs)(d.Fragment,{children:["Missing: ",c.slice(0,2).map(a=>a.description).join(", "),c.length>2&&` and ${c.length-2} more`]}),c.length>0&&e&&" \xb7 ",e]})]})]},I(a))})]})]},a.verdict)})}),(0,d.jsxs)("p",{className:"rounded-md border border-amber-600/25 bg-amber-500/8 px-3 py-2 text-xs",children:[(0,d.jsx)("span",{className:"font-medium",children:"No SQL runs."})," Only the ledger on"," ",a.name," changes, in one transaction. Rows already there are not touched."]})]}),x&&(0,d.jsx)("p",{className:"max-h-32 overflow-auto rounded-md border border-destructive/25 bg-destructive/5 px-3 py-2 font-mono text-[11px] whitespace-pre-wrap text-destructive",children:x}),(0,d.jsx)(F.Es,{children:v?(0,d.jsx)(m.$,{onClick:()=>f(!1),children:"Close"}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(m.$,{variant:"outline",disabled:s,onClick:()=>f(!1),children:"Cancel"}),l?(0,d.jsx)(m.$,{disabled:s,onClick:()=>void C(c.entries),children:s?"Marking…":`Mark all ${c.entries.length} as applied`}):(0,d.jsx)(m.$,{disabled:s||D||0===B.length,onClick:()=>void C(B),children:s?"Marking…":`Mark as applied (${B.length})`})]})})]})})}function K({verdict:a}){return"applied"===a?(0,d.jsx)(i.wiW,{className:"size-4 shrink-0 text-emerald-600 dark:text-emerald-400"}):"partial"===a?(0,d.jsx)(i.e5t,{className:"size-3.5 shrink-0 text-amber-600 dark:text-amber-400"}):"pending"===a?(0,d.jsx)(i.e5t,{className:"size-3.5 shrink-0 text-destructive"}):(0,d.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"})}var L=c(88877),M=c(90863);function N({root:a,environmentNames:b,onOpenChange:c,onSave:e}){let[f,g]=(0,h.useState)(a??""),i=f.trim(),j=i.startsWith("/")||i.startsWith("~")||/^[A-Za-z]:[\\/]/.test(i);function k(){i&&j&&(e(i),c(!1))}return(0,d.jsx)(F.lG,{open:!0,onOpenChange:c,children:(0,d.jsxs)(F.Cf,{className:"sm:max-w-lg",children:[(0,d.jsxs)(F.c7,{children:[(0,d.jsx)(F.L3,{children:"Migrations folder"}),(0,d.jsxs)(F.rr,{children:["A folder on this computer. Each folder inside it that holds .sql files is one migration, read fresh from disk every time — whatever branch is checked out is what shows. ",b.join(", ")," will all read from it."]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)(M.J,{htmlFor:"repo-root",children:"Path"}),(0,d.jsx)(L.p,{id:"repo-root",value:f,placeholder:"~/code/app/src/lib/supabase/migrations",spellCheck:!1,autoComplete:"off",autoFocus:!0,"aria-invalid":i.length>0&&!j,onChange:a=>g(a.target.value),onKeyDown:a=>"Enter"===a.key&&k()}),i.length>0&&!j&&(0,d.jsx)("p",{className:"text-xs text-destructive",children:"An absolute path, or one starting with ~."})]}),(0,d.jsxs)(F.Es,{children:[a&&(0,d.jsx)(m.$,{variant:"ghost",className:"mr-auto",onClick:function(){e(null),c(!1)},children:"Stop reading from disk"}),(0,d.jsx)(m.$,{variant:"outline",onClick:()=>c(!1),children:"Cancel"}),(0,d.jsx)(m.$,{disabled:!i||!j,onClick:k,children:"Save"})]})]})})}var O=c(30904);function P(){let a=(0,g.useRouter)(),{connection:b}=(0,k.k)(),c=(0,y.jV)(a=>a.sets),e=(0,y.jV)(a=>a.createSet),f=(0,y.jV)(a=>a.adoptSet),j=(0,y.jV)(a=>a.addFiles),o=(0,y.jV)(a=>a.removeSet),p=(0,y.jV)(a=>a.ledgerSchema),q=(0,y.jV)(a=>a.history),s=(0,x.gz)(b.id),[F,G]=(0,h.useState)("migrations"),[H,I]=(0,h.useState)(null),[K,L]=(0,h.useState)(null),[M,P]=(0,h.useState)(!1),[Q,V]=(0,h.useState)(!1),[W,X]=(0,h.useState)(null),Y=(0,h.useMemo)(()=>[b,...s],[b,s]),Z=Y.map(a=>a.url).join("|"),{scope:$,root:_,checkout:aa}=(0,y.ox)(b.id),ab=(0,y.jV)(a=>a.setRepoRoot),ac=(0,y.jV)(a=>a.setRepoCheckout),ad=(0,y.kG)($),ae=(0,y.jV)(a=>a.setListFilter),af=(0,O.y)(_,aa),ag=(0,h.useMemo)(()=>[...af.data?.sets??[]].sort((a,b)=>b.importedAt-a.importedAt),[af.data]),ah=(0,t.Y)(`ledgers:${p}:${Z}`,async a=>Object.fromEntries(await Promise.all(Y.map(async b=>{try{return[b.id,{ledger:await u.F.ledger(b.url,p,a),error:null}]}catch(c){if(a.aborted)throw c;return[b.id,{ledger:null,error:c instanceof Error?c.message:String(c)}]}})))),ai=(0,h.useCallback)((a,b)=>[...ag,...c].find(b=>b.name===a)?.steps.find(a=>a.version===b)??null,[ag,c]),aj=(0,h.useMemo)(()=>(0,v.x)(Y.map(a=>({connection:a,ledger:ah.data?.[a.id]?.ledger??null})),q),[Y,ah.data,q]),ak=`/${encodeURIComponent(b.id)}/migrations`,al=(0,h.useCallback)(b=>{let c=e(b.name);j(c,b.files),a.push(`${ak}/${encodeURIComponent(c)}`)},[e,j,a,ak]);async function am(b){I(b),L(null);try{let c=await Promise.all(Y.map(async a=>{try{return{read:await u.F.ledger(a.url,p,void 0,!0),error:null}}catch(a){return{read:null,error:a instanceof Error?a.message:String(a)}}})),d=c.find(a=>a.error);if(d?.error)return void L(d.error);let e=c.some(a=>a.read&&void 0===a.read.withSql),g=new Map;for(let{read:a}of c)for(let c of a?.entries??[]){if(c.setName.trim()!==b)continue;let a=g.get(c.version);a?.applySql||g.set(c.version,c)}let{set:h,missing:i}=(0,B.wQ)(b,[...g.values()]);if(0===h.steps.length)return void L(e?"The YTDB running on your machine is older than this page and cannot send stored SQL. Restart it with `npx @theobourgeois/ytdb@latest`.":`${b} was applied before YTDB stored SQL, so it cannot be rebuilt. Drop its folder instead.`);f(h),i.length>0&&L(`Rebuilt ${h.steps.length} of ${h.steps.length+i.length}. No SQL was stored for ${i.join(", ")}.`),a.push(`${ak}/${encodeURIComponent(h.id)}`)}catch(a){L(a instanceof Error?a.message:String(a))}finally{I(null)}}let an=(0,h.useMemo)(()=>[...c].sort((a,b)=>b.importedAt-a.importedAt),[c]),ao=(0,h.useMemo)(()=>(0,w.lF)(Y.map(a=>({connection:a,ledger:ah.data?.[a.id]?.ledger??null})),[...ag,...c].map(a=>a.name)),[Y,ah.data,ag,c]),ap=(0,h.useMemo)(()=>{let a=ah.data?.[b.id]?.ledger??null,c=[],d=0;if(!a)return{sets:0,entries:c};for(let b of ag){let e=(0,w.gj)(b,(0,w.Gf)(a,b.name));if(0!==e.steps.length)for(let a of(d+=1,e.steps))c.push({setName:b.name,version:a.version,name:a.name,checksum:a.checksum,applySql:a.applySql,revertSql:a.revertSql})}return{sets:d,entries:c}},[ah.data,b.id,ag]),aq=ah.loading||af.loading,ar=0===ag.length&&0===c.length&&0===ao.length,as=(0,h.useCallback)(a=>Y.map(b=>({connection:b,summary:(0,w.eh)(a,ah.data?.[b.id]?.ledger??null),read:!!ah.data?.[b.id]?.ledger,error:ah.data?.[b.id]?.error??null})),[Y,ah.data]),at=(0,h.useCallback)(a=>(0,w.yy)(a,as(a).map(a=>({connectionId:a.connection.id,summary:a.summary,read:a.read})),ad),[as,ad]),au=(0,h.useMemo)(()=>ag.filter(at),[ag,at]),av=(0,h.useMemo)(()=>an.filter(at),[an,at]),aw=""!==ad.query.trim()||"all"!==ad.status,ax=ag.length+an.length-au.length-av.length;return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsxs)(l.X,{children:[(0,d.jsx)(i.olY,{className:"size-4 shrink-0 text-muted-foreground"}),(0,d.jsx)("span",{className:"font-medium",children:"Migrations"}),_&&(0,d.jsx)(S,{root:af.data?.root??_,git:af.data?.git??null,checkouts:af.data?.checkouts??[],checkout:af.data?.checkout??null,onEdit:()=>V(!0),onPick:a=>ac($,a)}),(0,d.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,d.jsx)(m.$,{size:"icon-sm",variant:"ghost",disabled:aq,"aria-label":"Refresh",title:_?"Re-read the folder and every environment's ledger":"Re-read every environment's ledger",onClick:function(){ah.reload(),af.reload()},children:(0,d.jsx)(i.oS8,{className:(0,z.cn)(aq&&"animate-spin")})}),!_&&(0,d.jsxs)(m.$,{size:"sm",variant:"ghost",onClick:()=>V(!0),children:[(0,d.jsx)(i.WzY,{"data-icon":"inline-start"}),"Read from a folder"]}),(0,d.jsxs)(m.$,{size:"sm",variant:"ghost",onClick:()=>P(!0),children:[(0,d.jsx)(i.enO,{"data-icon":"inline-start"}),"New migration"]}),(_||c.length>0)&&(0,d.jsxs)(n.rI,{children:[(0,d.jsx)(n.ty,{render:(0,d.jsx)(m.$,{size:"icon-sm",variant:"ghost","aria-label":"More migration actions"}),className:"cursor-pointer",children:(0,d.jsx)(i.YKd,{})}),(0,d.jsxs)(n.SQ,{align:"end",className:"min-w-72",children:[_&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(n._2,{disabled:aq||0===ap.entries.length,onClick:()=>X(ap),children:[(0,d.jsx)(i.nXx,{}),"Mark everything as applied on ",b.name,(0,d.jsx)("span",{className:"ml-auto pl-3 font-mono text-[11px] text-muted-foreground",children:ap.entries.length})]}),(0,d.jsx)(n.mB,{}),(0,d.jsxs)(n._2,{onClick:()=>V(!0),children:[(0,d.jsx)(i.WzY,{}),"Change folder…"]})]}),c.length>0&&(0,d.jsxs)(d.Fragment,{children:[_&&(0,d.jsx)(n.mB,{}),(0,d.jsxs)(n._2,{variant:"destructive",onClick:function(){for(let a of c)o(a.id)},children:["Forget ",c.length," imported migration",1===c.length?"":"s"]})]})]})]})]})]}),af.error&&(0,d.jsxs)("p",{className:"flex items-start gap-2 border-b bg-destructive/5 px-4 py-1.5 text-xs text-destructive",children:[(0,d.jsx)(i.e5t,{className:"mt-px size-3.5 shrink-0"}),(0,d.jsx)("span",{className:"min-w-0 flex-1",children:af.error}),(0,d.jsx)(m.$,{size:"xs",variant:"ghost",onClick:()=>V(!0),children:"Change folder"})]}),"history"===F?(0,d.jsx)(r.F,{className:"min-h-0 flex-1",children:(0,d.jsx)(A.H,{events:aj,connections:Y,loading:ah.loading,ledgerSchema:p,findStep:ai,onLedgerChange:ah.reload})}):ar&&_&&af.loading?(0,d.jsxs)("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:["Reading ",_,"…"]}):ar&&_?(0,d.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 p-6 text-center",children:[(0,d.jsxs)("p",{className:"text-sm",children:["Nothing in ",_," yet."]}),(0,d.jsx)("p",{className:"max-w-md text-xs text-muted-foreground",children:"Each folder inside it that holds .sql files becomes a migration here, the moment it exists on the branch you have checked out."})]}):ar?(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4 p-6",children:[(0,d.jsx)(C.k,{onFiles:al,className:"w-full max-w-xl"}),(0,d.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Or"," ",(0,d.jsx)("button",{type:"button",className:"cursor-pointer underline underline-offset-4 hover:text-foreground",onClick:()=>V(!0),children:"read straight from a folder on this computer"}),", so nothing has to be imported."]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(R,{filter:ad,environments:Y,hidden:ax,onChange:a=>ae($,a)}),(0,d.jsxs)(r.F,{className:"min-h-0 flex-1",children:[au.map(a=>(0,d.jsx)(T,{set:a,href:`${ak}/${encodeURIComponent(a.id)}`,environments:as(a)},a.id)),av.length>0&&_&&(0,d.jsx)("p",{className:"border-b px-4 pt-2.5 pb-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",title:"Imported into this browser rather than read from the folder.",children:"Imported"}),av.map(a=>(0,d.jsx)(T,{set:a,href:`${ak}/${encodeURIComponent(a.id)}`,environments:as(a)},a.id)),aw&&0===au.length&&0===av.length&&(0,d.jsxs)("p",{className:"px-4 py-6 text-sm text-muted-foreground",children:["Nothing matches."," ",(0,d.jsx)("button",{type:"button",className:"cursor-pointer underline underline-offset-4 hover:text-foreground",onClick:()=>ae($,{query:"",status:"all"}),children:"Clear the filter"})]}),ao.length>0&&(0,d.jsxs)("div",{className:"border-b bg-muted/20",children:[(0,d.jsx)("p",{className:"px-4 pt-2.5 pb-1 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",title:"Applied to a database from elsewhere. The SQL is kept in its ledger, so it opens without the folder.",children:"In the ledger only"}),ao.map(a=>(0,d.jsx)(U,{migration:a,busy:H===a.name,onOpen:()=>void am(a.name)},a.name)),K&&(0,d.jsx)("p",{className:"px-4 pt-1 pb-2 text-xs text-destructive",children:K})]}),!_&&(0,d.jsx)("div",{className:"p-4",children:(0,d.jsx)(C.k,{onFiles:al,compact:!0,className:"w-full"})})]})]}),(0,d.jsx)(E.l,{caption:function(a,b,c,d){if(d&&0===a)return"Reading folder…";if(0===a&&0===b&&0===c)return"No migrations yet";let e=[];return a>0&&e.push(`${a} migration${1===a?"":"s"} on disk`),b>0&&e.push(`${b} imported`),c>0&&e.push(`${c} in the ledger only`),e.join(" \xb7 ")}(ag.length,c.length,ao.length,null!==_&&af.loading),pane:F,onPaneChange:G,historyCount:aj.length}),Q&&(0,d.jsx)(N,{root:_,environmentNames:Y.map(a=>a.name),onOpenChange:V,onSave:a=>ab($,a)}),W&&(0,d.jsx)(J,{connection:b,ledgerSchema:p,plan:W,onDone:()=>ah.reload(),onOpenChange:a=>!a&&X(null)}),(0,d.jsx)(D.K,{open:M,title:"New migration",submitLabel:"Create",onOpenChange:P,onSubmit:function(b){let c=e(b);a.push(`${ak}/${encodeURIComponent(c)}`)}})]})}let Q={all:"All",pending:"Not fully applied",untouched:"Not started anywhere",complete:"Applied everywhere"};function R({filter:a,environments:b,hidden:c,onChange:e}){let f="all"!==a.status;return(0,d.jsxs)("div",{className:"flex items-center gap-1 border-b px-2 py-1",children:[(0,d.jsx)(s.L,{value:a.query,onChange:a=>e({query:a.target.value}),placeholder:"Search migrations","aria-label":"Search migrations",className:"min-w-0 flex-1",trailing:a.query?(0,d.jsx)("button",{type:"button","aria-label":"Clear search",className:"cursor-pointer rounded p-0.5 hover:text-foreground",onClick:()=>e({query:""}),children:(0,d.jsx)(i.yBK,{className:"size-3.5"})}):null}),(0,d.jsxs)(n.rI,{children:[(0,d.jsxs)(n.ty,{render:(0,d.jsx)(m.$,{size:"sm",variant:f?"outline":"ghost"}),className:"cursor-pointer",children:[function(a,b){if(a.startsWith("pending:")){let c=b.find(b=>b.id===a.slice(8));return c?`Pending on ${c.name}`:Q.pending}return Q[a]}(a.status,b),(0,d.jsx)(i.RQe,{"data-icon":"inline-end"})]}),(0,d.jsx)(n.SQ,{align:"end",className:"min-w-56",children:(0,d.jsxs)(n.Hr,{value:a.status,onValueChange:a=>e({status:a}),children:[Object.keys(Q).map(a=>(0,d.jsx)(n.Ht,{value:a,children:Q[a]},a)),b.length>1&&(0,d.jsx)(n.mB,{}),b.length>1&&b.map(a=>(0,d.jsxs)(n.Ht,{value:`pending:${a.id}`,children:[(0,d.jsx)(j.F,{connection:a,className:"size-1.5"}),"Pending on ",a.name]},a.id))]})})]}),c>0&&(0,d.jsxs)("span",{className:"shrink-0 pr-1 text-[11px] tabular-nums text-muted-foreground",children:[c," hidden"]})]})}function S({root:a,git:b,checkouts:c,checkout:e,onEdit:f,onPick:g}){var j;let k,[l,m]=(0,h.useState)(""),n=(0,h.useMemo)(()=>{let a=l.trim().toLowerCase();return a?c.filter(b=>b.branch.toLowerCase().includes(a)||b.path.toLowerCase().includes(a)):c},[c,l]),r="cursor-pointer rounded-md outline-none hover:bg-muted/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60",s=b&&(0,d.jsxs)("span",{className:"shrink-0 rounded border px-1.5 font-mono text-[10px]",children:[b.branch,b.dirty&&"*"]});return(0,d.jsxs)("div",{className:"flex min-w-0 items-center text-xs text-muted-foreground",children:[(0,d.jsxs)("button",{type:"button",title:`Reading from ${a}. Click to change.`,onClick:f,className:(0,z.cn)("flex min-w-0 items-center gap-1.5 px-1.5 py-0.5",r),children:[(0,d.jsx)(i.WzY,{className:"size-3.5 shrink-0"}),(0,d.jsx)("span",{className:"max-w-64 truncate font-mono text-[11px]",children:(k=(j=a).split(/[\/]/).filter(Boolean)).length>2?`…/${k.slice(-2).join("/")}`:j})]}),b&&c.length>1?(0,d.jsxs)(q.G3,{items:n,filter:null,value:c.find(a=>a.path===e)??null,inputValue:l,onInputValueChange:a=>m(a),onOpenChange:a=>a&&m(""),itemToStringLabel:a=>a.branch,isItemEqualToValue:(a,b)=>a.path===b.path,onValueChange:a=>a&&g(a.path),children:[(0,d.jsxs)(o.M,{title:`${b.branch} (${b.commit}${b.dirty?", uncommitted changes":""}). Read from another worktree.`,className:(0,z.cn)("flex shrink-0 items-center gap-0.5 px-1 py-0.5",r),children:[s,(0,d.jsx)(i.klM,{className:"size-3"})]}),(0,d.jsxs)(q.h5,{className:"w-max min-w-56",children:[(0,d.jsxs)("div",{className:"m-1 mb-0 flex h-8 items-center gap-1.5 rounded-lg px-2 text-muted-foreground focus-within:bg-muted/60",children:[(0,d.jsx)(i.TfF,{className:"size-3.5 shrink-0"}),(0,d.jsx)(p.o,{placeholder:"Search worktrees",spellCheck:!1,autoComplete:"off",className:"h-full min-w-0 flex-1 bg-transparent text-[0.8rem] text-foreground outline-none placeholder:text-muted-foreground"})]}),(0,d.jsx)(q.$U,{children:"No matching worktrees"}),(0,d.jsx)(q.ex,{children:a=>(0,d.jsx)(q.x4,{value:a,title:a.path,children:(0,d.jsx)("span",{className:"font-mono text-xs",children:a.branch})},a.path)})]})]}):b&&(0,d.jsx)("span",{className:"px-1",title:`${b.branch} (${b.commit}${b.dirty?", uncommitted changes":""})`,children:s})]})}function T({set:a,href:b,environments:c}){return(0,d.jsxs)(f(),{href:b,className:"flex items-center gap-3 border-b px-4 py-3 outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("p",{className:"flex min-w-0 items-center gap-1.5 text-sm font-medium",children:[(0,d.jsx)("span",{className:"truncate",children:a.name}),a.note&&(0,d.jsx)("span",{title:a.note,className:"shrink-0 text-muted-foreground",children:(0,d.jsx)(i.UA_,{className:"size-3.5"})})]}),(0,d.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[0===a.steps.length?"No files yet":`${a.steps.length} migration${1===a.steps.length?"":"s"}`,a.steps.length>0&&` \xb7 ${a.steps[0].version}–${a.steps.at(-1)?.version}`,a.skipped.length>0&&` \xb7 ${a.skipped.length} skipped`]})]}),(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1.5",children:c.map(a=>(0,d.jsx)(V,{environment:a},a.connection.id))}),(0,d.jsx)(i.nNJ,{className:"size-4 shrink-0 text-muted-foreground/60"})]})}function U({migration:a,busy:b,onOpen:c}){return(0,d.jsxs)("div",{className:"flex items-center gap-3 border-t px-4 py-2.5 first:border-t-0",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"truncate text-sm",children:a.name}),(0,d.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[a.total," migration",1===a.total?"":"s",a.versions.length>0&&` \xb7 ${a.versions[0]}–${a.versions.at(-1)}`]})]}),(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1.5",children:a.applied.map(b=>(0,d.jsxs)("span",{className:"flex h-6 items-center gap-1.5 rounded-lg border border-dashed px-2 text-[11px] text-muted-foreground",children:[(0,d.jsx)("span",{className:"max-w-24 truncate",children:b.connectionName}),(0,d.jsxs)("span",{className:"tabular-nums",children:[b.count,"/",a.total]})]},b.connectionId))}),(0,d.jsx)(m.$,{size:"xs",variant:"outline",disabled:b,onClick:c,children:b?"Opening…":"Open"})]})}function V({environment:a}){let{connection:b,summary:c,read:e,error:f}=a,g=e&&c.total>0&&0===c.pending&&0===c.drifted,h=e&&0===c.applied&&0===c.drifted;return(0,d.jsxs)("span",{title:f?`${b.name}: ${f}`:e?`${b.name}: ${c.applied} of ${c.total} applied`:`${b.name}: reading…`,className:(0,z.cn)("flex h-6 items-center gap-1.5 rounded-lg border px-2 text-[11px]",f&&"border-destructive/30 text-destructive",g&&"border-emerald-600/30 bg-emerald-500/10",!f&&!g&&!h&&"border-amber-600/30 bg-amber-500/10",h&&"text-muted-foreground"),children:[(0,d.jsx)(j.F,{connection:b,className:"size-1.5"}),(0,d.jsx)("span",{className:"max-w-24 truncate",children:b.name}),(0,d.jsx)("span",{className:"tabular-nums",children:f?"—":e?`${c.applied}/${c.total}`:"…"})]})}},94094:(a,b,c)=>{Promise.resolve().then(c.bind(c,81040))},99432:(a,b,c)=>{"use strict";c.d(b,{MigrationsIndex:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call MigrationsIndex() from the server but MigrationsIndex is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/theobourgeois/code/db-studio/src/components/migrations/migrations-index.tsx","MigrationsIndex")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,2430,7928,8842,8202,7875,1421,7593,6729,5816],()=>b(b.s=70456));module.exports=c})();