sqlbot 0.0.1 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +2 -2
  3. package/.next/standalone/.next/server/app/(chat)/ai-providers/page_client-reference-manifest.js +1 -1
  4. package/.next/standalone/.next/server/app/(chat)/chat/[threadId]/page.js +2 -2
  5. package/.next/standalone/.next/server/app/(chat)/chat/[threadId]/page.js.nft.json +1 -1
  6. package/.next/standalone/.next/server/app/(chat)/chat/[threadId]/page_client-reference-manifest.js +1 -1
  7. package/.next/standalone/.next/server/app/(chat)/connections/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/(chat)/knowledge-base/page.js +1 -1
  9. package/.next/standalone/.next/server/app/(chat)/knowledge-base/page.js.nft.json +1 -1
  10. package/.next/standalone/.next/server/app/(chat)/knowledge-base/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/(chat)/page.js +1 -1
  12. package/.next/standalone/.next/server/app/(chat)/page.js.nft.json +1 -1
  13. package/.next/standalone/.next/server/app/(chat)/page_client-reference-manifest.js +1 -1
  14. package/.next/standalone/.next/server/app/_global-error.html +2 -2
  15. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  16. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  19. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  21. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  22. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  23. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  24. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  25. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  26. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  27. package/.next/standalone/.next/server/app/ai-providers.html +1 -1
  28. package/.next/standalone/.next/server/app/ai-providers.rsc +3 -3
  29. package/.next/standalone/.next/server/app/ai-providers.segments/!KGNoYXQp/ai-providers/__PAGE__.segment.rsc +2 -2
  30. package/.next/standalone/.next/server/app/ai-providers.segments/!KGNoYXQp/ai-providers.segment.rsc +1 -1
  31. package/.next/standalone/.next/server/app/ai-providers.segments/!KGNoYXQp.segment.rsc +1 -1
  32. package/.next/standalone/.next/server/app/ai-providers.segments/_full.segment.rsc +3 -3
  33. package/.next/standalone/.next/server/app/ai-providers.segments/_index.segment.rsc +1 -1
  34. package/.next/standalone/.next/server/app/ai-providers.segments/_tree.segment.rsc +2 -2
  35. package/.next/standalone/.next/server/app/api/chat/route.js +1 -1
  36. package/.next/standalone/.next/server/app/api/chat/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/health/route.js +1 -1
  38. package/.next/standalone/.next/server/app/api/health/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/knowledge/auto-generate/route.js +1 -1
  40. package/.next/standalone/.next/server/app/api/knowledge/auto-generate/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/knowledge/generate/route.js +1 -1
  42. package/.next/standalone/.next/server/app/api/knowledge/generate/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/trpc/[trpc]/route.js +3 -3
  44. package/.next/standalone/.next/server/app/api/trpc/[trpc]/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/connections.html +1 -1
  46. package/.next/standalone/.next/server/app/connections.rsc +3 -3
  47. package/.next/standalone/.next/server/app/connections.segments/!KGNoYXQp/connections/__PAGE__.segment.rsc +2 -2
  48. package/.next/standalone/.next/server/app/connections.segments/!KGNoYXQp/connections.segment.rsc +1 -1
  49. package/.next/standalone/.next/server/app/connections.segments/!KGNoYXQp.segment.rsc +1 -1
  50. package/.next/standalone/.next/server/app/connections.segments/_full.segment.rsc +3 -3
  51. package/.next/standalone/.next/server/app/connections.segments/_index.segment.rsc +1 -1
  52. package/.next/standalone/.next/server/app/connections.segments/_tree.segment.rsc +2 -2
  53. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1f49434f._.js +3 -0
  54. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__51b79d66._.js → [root-of-the-server]__3a1fb665._.js} +6 -6
  55. package/.next/standalone/.next/server/chunks/[root-of-the-server]__73947e32._.js +3 -0
  56. package/.next/standalone/.next/server/chunks/[root-of-the-server]__747722f0._.js +85 -0
  57. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ca89cb1f._.js +85 -0
  58. package/.next/standalone/.next/server/chunks/_26ec1867._.js +13 -13
  59. package/.next/standalone/.next/server/chunks/_430c5305._.js +13 -13
  60. package/.next/standalone/.next/server/chunks/_44fa1f03._.js +1 -1
  61. package/.next/standalone/.next/server/chunks/_75b542e9._.js +1 -1
  62. package/.next/standalone/.next/server/chunks/_82e2d86b._.js +11 -11
  63. package/.next/standalone/.next/server/chunks/_c49f2a1f._.js +13 -13
  64. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__d8a3f2e3._.js → [root-of-the-server]__1ad22765._.js} +2 -2
  65. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__2534236b._.js +1 -1
  66. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__77c3448a._.js +1 -1
  67. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__85abb029._.js +3 -0
  68. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__d2e81be0._.js +3 -0
  69. package/.next/standalone/.next/server/chunks/ssr/_119ae296._.js +12 -12
  70. package/.next/standalone/.next/server/chunks/ssr/_37f7f89d._.js +1 -1
  71. package/.next/standalone/.next/server/chunks/ssr/src_components_connections_connections-page_tsx_a8fa3df0._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/ssr/src_components_knowledge-base_knowledge-base-page_tsx_10bf7f9a._.js +1 -1
  73. package/.next/standalone/.next/server/pages/404.html +1 -1
  74. package/.next/standalone/.next/server/pages/500.html +2 -2
  75. package/.next/{static/chunks/b90a78e2d36034ff.js → standalone/.next/static/chunks/00f68930e8af39f1.js} +1 -1
  76. package/.next/standalone/.next/static/chunks/3bd88f74116ecf0b.js +1 -0
  77. package/.next/standalone/.next/static/chunks/89e492a83a4b53e3.js +1 -0
  78. package/.next/standalone/.next/static/chunks/{842e82429bd01d96.js → a3a8f6ede99c1c63.js} +1 -1
  79. package/.next/standalone/README.md +1 -1
  80. package/.next/standalone/package.json +1 -1
  81. package/.next/{standalone/.next/static/chunks/b90a78e2d36034ff.js → static/chunks/00f68930e8af39f1.js} +1 -1
  82. package/.next/static/chunks/3bd88f74116ecf0b.js +1 -0
  83. package/.next/static/chunks/89e492a83a4b53e3.js +1 -0
  84. package/.next/static/chunks/{842e82429bd01d96.js → a3a8f6ede99c1c63.js} +1 -1
  85. package/README.md +1 -1
  86. package/package.json +1 -1
  87. package/.next/standalone/.next/server/chunks/[root-of-the-server]__26852352._.js +0 -85
  88. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5dc46bc4._.js +0 -3
  89. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8992d6da._.js +0 -3
  90. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e474c328._.js +0 -85
  91. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e727499._.js +0 -3
  92. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__4451526a._.js +0 -3
  93. package/.next/standalone/.next/static/chunks/000ce5d236847e14.js +0 -1
  94. package/.next/standalone/.next/static/chunks/7c8dab1a077d98e9.js +0 -1
  95. package/.next/static/chunks/000ce5d236847e14.js +0 -1
  96. package/.next/static/chunks/7c8dab1a077d98e9.js +0 -1
  97. /package/.next/standalone/.next/static/{H1e0tcZUy-dcOaNBJh3iW → MtWdFBWYBrNNpdc-evjbH}/_buildManifest.js +0 -0
  98. /package/.next/standalone/.next/static/{H1e0tcZUy-dcOaNBJh3iW → MtWdFBWYBrNNpdc-evjbH}/_clientMiddlewareManifest.json +0 -0
  99. /package/.next/standalone/.next/static/{H1e0tcZUy-dcOaNBJh3iW → MtWdFBWYBrNNpdc-evjbH}/_ssgManifest.js +0 -0
  100. /package/.next/static/{H1e0tcZUy-dcOaNBJh3iW → MtWdFBWYBrNNpdc-evjbH}/_buildManifest.js +0 -0
  101. /package/.next/static/{H1e0tcZUy-dcOaNBJh3iW → MtWdFBWYBrNNpdc-evjbH}/_clientMiddlewareManifest.json +0 -0
  102. /package/.next/static/{H1e0tcZUy-dcOaNBJh3iW → MtWdFBWYBrNNpdc-evjbH}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[738783,(a,b,c)=>{"use strict";b.exports=a.r(342602).vendored["react-ssr"].ReactServerDOMTurbopackClient},785607,a=>{"use strict";let b=(0,a.i(883706).default)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);a.s(["Plug",()=>b],785607)},591119,a=>{"use strict";var b=a.i(187924),c=a.i(368114);function d({className:a,...d}){return(0,b.jsx)("div",{"data-slot":"card",className:(0,c.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border border-border/40 py-6",a),...d})}function e({className:a,...d}){return(0,b.jsx)("div",{"data-slot":"card-header",className:(0,c.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...d})}function f({className:a,...d}){return(0,b.jsx)("div",{"data-slot":"card-title",className:(0,c.cn)("leading-none font-semibold",a),...d})}function g({className:a,...d}){return(0,b.jsx)("div",{"data-slot":"card-description",className:(0,c.cn)("text-muted-foreground text-sm",a),...d})}function h({className:a,...d}){return(0,b.jsx)("div",{"data-slot":"card-content",className:(0,c.cn)("px-6",a),...d})}a.s(["Card",()=>d,"CardContent",()=>h,"CardDescription",()=>g,"CardHeader",()=>e,"CardTitle",()=>f])},400210,a=>{"use strict";let b=(0,a.i(883706).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);a.s(["ArrowLeft",()=>b],400210)},699464,a=>{"use strict";let b=(0,a.i(883706).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);a.s(["Pencil",()=>b],699464)},870430,a=>{"use strict";var b=a.i(187924),c=a.i(572131);a.i(935112);var d=a.i(470121),e=Symbol.for("react.lazy"),f=c[" use ".trim().toString()];function g(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===e&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}var h=Symbol("radix.slottable");function i(a){return c.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===h}var j=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,e)=>{var h,j;let k,l,m,n=(j=h=`Primitive.${e}`,(k=c.forwardRef((a,b)=>{let{children:e,...h}=a;if(g(e)&&"function"==typeof f&&(e=f(e._payload)),c.isValidElement(e)){var i;let a,f,g=(i=e,(f=(a=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?i.ref:(f=(a=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?i.props.ref:i.props.ref||i.ref),j=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(h,e.props);return e.type!==c.Fragment&&(j.ref=b?(0,d.composeRefs)(b,g):g),c.cloneElement(e,j)}return c.Children.count(e)>1?c.Children.only(null):null})).displayName=`${j}.SlotClone`,l=k,(m=c.forwardRef((a,d)=>{let{children:e,...h}=a;g(e)&&"function"==typeof f&&(e=f(e._payload));let j=c.Children.toArray(e),k=j.find(i);if(k){let a=k.props.children,e=j.map(b=>b!==k?b:c.Children.count(a)>1?c.Children.only(null):c.isValidElement(a)?a.props.children:null);return(0,b.jsx)(l,{...h,ref:d,children:c.isValidElement(a)?c.cloneElement(a,void 0,e):null})}return(0,b.jsx)(l,{...h,ref:d,children:e})})).displayName=`${h}.Slot`,m),o=c.forwardRef((a,c)=>{let{asChild:d,...f}=a;return(0,b.jsx)(d?n:e,{...f,ref:c})});return o.displayName=`Primitive.${e}`,{...a,[e]:o}},{}),k=c.forwardRef((a,c)=>(0,b.jsx)(j.label,{...a,ref:c,onMouseDown:b=>{b.target.closest("button, input, select, textarea")||(a.onMouseDown?.(b),!b.defaultPrevented&&b.detail>1&&b.preventDefault())}}));k.displayName="Label";var l=a.i(368114);function m({className:a,...c}){return(0,b.jsx)(k,{"data-slot":"label",className:(0,l.cn)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",a),...c})}a.s(["Label",()=>m],870430)},601017,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(50944),e=a.i(101880),f=a.i(699570),g=a.i(866718),h=a.i(870430),i=a.i(786304),j=a.i(591119),k=a.i(814574),l=a.i(580701),m=a.i(400210),n=a.i(915618),o=a.i(781560),p=a.i(699464),q=a.i(596221),r=a.i(785607),s=a.i(883706);let t=(0,s.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),u=(0,s.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var v=a.i(220494),w=a.i(238246),x=a.i(368114),y=a.i(823292);let z={name:"",type:"google",apiKey:""};function A(){let a=(0,d.useRouter)(),[s,A]=(0,c.useState)(!1),[B,C]=(0,c.useState)(null),[D,E]=(0,c.useState)(z),[F,G]=(0,c.useState)(!1),{data:H,isLoading:I}=e.api.aiProvider.list.useQuery(),J=e.api.aiProvider.add.useMutation(),K=e.api.aiProvider.update.useMutation(),L=e.api.aiProvider.delete.useMutation(),M=e.api.useUtils(),N=H?.providers||[],O=(0,c.useCallback)(()=>{C(null),E(z),G(!1),A(!0)},[]),P=(0,c.useCallback)(async a=>{C(a),G(!1);let b=await M.aiProvider.get.fetch({id:a});if(b.provider){let a=b.provider;E({name:a.name,type:a.type,apiKey:a.apiKey})}A(!0)},[M]),Q=(0,c.useCallback)(async()=>{try{let a={name:D.name,type:D.type,apiKey:D.apiKey};B?(await K.mutateAsync({id:B,data:a}),y.toast.success("AI provider updated. Restart the app to apply the new key.")):(await J.mutateAsync(a),y.toast.success("AI provider added. Restart the app to apply the new key.")),A(!1),M.aiProvider.list.invalidate()}catch(a){y.toast.error(a.message||"Failed to save AI provider")}},[D,B,J,K,M]),R=(0,c.useCallback)(async(a,b)=>{if(confirm(`Delete AI provider "${b}"? This cannot be undone.`))try{await L.mutateAsync({id:a}),y.toast.success("AI provider deleted"),M.aiProvider.list.invalidate()}catch(a){y.toast.error(a.message||"Failed to delete AI provider")}},[L,M]),S=D.name.trim()&&D.apiKey.trim();return(0,b.jsxs)("div",{className:"min-h-screen bg-background",children:[(0,b.jsx)("header",{className:"border-b border-border/40 bg-background/80 backdrop-blur sticky top-0 z-10",children:(0,b.jsxs)("div",{className:"max-w-5xl mx-auto flex items-center gap-4 px-4 sm:px-6 py-4",children:[(0,b.jsxs)(f.Button,{variant:"ghost",size:"sm",onClick:()=>a.push("/"),className:"gap-1.5",children:[(0,b.jsx)(m.ArrowLeft,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Back to Chat"})]}),(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)("span",{className:"hidden sm:inline",children:"Clay"}),(0,b.jsx)("span",{className:"hidden sm:inline opacity-20",children:"/"}),(0,b.jsx)("span",{children:"AI Providers"}),N.length>0&&(0,b.jsx)(i.Badge,{variant:"outline",className:"h-5 min-w-5 px-1 justify-center rounded-sm bg-muted/50 border-border/50 text-[10px]",children:N.length})]})]})}),(0,b.jsxs)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-6 sm:py-8",children:[(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4 mb-8",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"AI Providers"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage your AI provider API keys. Keys are stored locally in your config."})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(f.Button,{asChild:!0,variant:"outline",className:"gap-1.5",size:"sm",children:(0,b.jsxs)(w.default,{href:"/connections",children:[(0,b.jsx)(v.Database,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Connections"})]})}),(0,b.jsxs)(f.Button,{onClick:O,className:"gap-1.5",size:"sm",children:[(0,b.jsx)(n.Plus,{className:"h-4 w-4"}),"Add Provider"]})]})]}),(0,b.jsx)("div",{className:"rounded-lg border border-border/60 bg-muted/30 p-3 sm:p-4 mb-6",children:(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:["API keys are saved locally at"," ",(0,b.jsx)("code",{className:"text-[11px] bg-muted px-1.5 py-0.5 rounded font-mono",children:"~/.config/clay/ai-providers.json"}),". After adding or updating a key, restart the app for changes to take effect."]})}),I?(0,b.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,b.jsx)(q.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):0===N.length?(0,b.jsx)(j.Card,{className:"border-dashed",children:(0,b.jsxs)(j.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,b.jsx)("div",{className:"rounded-full bg-muted p-4 mb-4",children:(0,b.jsx)(r.Plug,{className:"h-8 w-8 text-muted-foreground"})}),(0,b.jsx)("h3",{className:"text-lg font-semibold mb-1",children:"No AI providers configured"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-6 text-center max-w-sm",children:"Add your Google AI API key to power chat, SQL generation, and embeddings with Gemini models."}),(0,b.jsxs)(f.Button,{onClick:O,className:"gap-1.5",children:[(0,b.jsx)(n.Plus,{className:"h-4 w-4"}),"Add Your First Provider"]})]})}):(0,b.jsx)("div",{className:"grid gap-3 sm:gap-4 sm:grid-cols-2",children:N.map(a=>(0,b.jsxs)(j.Card,{className:"transition-all relative",children:[(0,b.jsx)(j.CardHeader,{className:"p-4 sm:p-6 pb-2 sm:pb-3",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:(0,x.cn)("rounded-lg p-2 border shrink-0",function(a){switch(a){case"google":return"text-blue-400 bg-blue-400/10 border-blue-400/20";case"groq":return"text-orange-400 bg-orange-400/10 border-orange-400/20";default:return"text-muted-foreground"}}(a.type)),children:(0,b.jsx)(r.Plug,{className:"h-4 w-4"})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)(j.CardTitle,{className:"text-sm sm:text-base truncate",children:a.name}),(0,b.jsx)(j.CardDescription,{className:"text-xs mt-0.5",children:function(a){switch(a){case"google":return"Google AI (Gemini)";case"groq":return"Groq";default:return a}}(a.type)})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,b.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>P(a.id),className:"text-xs h-8 w-8 p-0",children:(0,b.jsx)(p.Pencil,{className:"h-3 w-3"})}),(0,b.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>R(a.id,a.name),className:"text-xs h-8 w-8 p-0 text-destructive hover:text-destructive",children:(0,b.jsx)(o.Trash2,{className:"h-3 w-3"})})]})]})}),(0,b.jsx)(j.CardContent,{className:"p-4 sm:p-6 pt-0 sm:pt-0",children:(0,b.jsxs)("div",{className:"space-y-1.5 text-xs text-muted-foreground",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground/60 w-10 sm:w-14 shrink-0",children:"Key"}),(0,b.jsx)("span",{className:"font-mono truncate",children:a.apiKey})]}),(0,b.jsxs)("div",{className:"flex items-start gap-2 min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground/60 w-10 sm:w-14 shrink-0",children:"Usage"}),(0,b.jsx)("span",{className:"line-clamp-2 sm:line-clamp-1",children:function(a){switch(a){case"google":return"Powers chat, SQL generation, and embeddings via Gemini models";case"groq":return"Fast Llama and Mixtral models hosted on Groq's LPUs";default:return""}}(a.type)})]})]})})]},a.id))})]}),(0,b.jsx)(k.Dialog,{open:s,onOpenChange:A,children:(0,b.jsxs)(k.DialogContent,{className:"sm:max-w-lg max-h-[85vh] flex! flex-col! p-4 sm:p-6",children:[(0,b.jsxs)(k.DialogHeader,{className:"shrink-0",children:[(0,b.jsx)(k.DialogTitle,{children:B?"Edit AI Provider":"Add AI Provider"}),(0,b.jsx)(k.DialogDescription,{children:B?"Update your AI provider configuration.":"Configure a new AI provider with your API key."})]}),(0,b.jsxs)("div",{className:"space-y-4 py-2 overflow-y-auto flex-1 min-h-0",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{htmlFor:"prov-name",children:"Provider Name"}),(0,b.jsx)(g.Input,{id:"prov-name",placeholder:"e.g. My Google AI Key",value:D.name,onChange:a=>E(b=>({...b,name:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{children:"Provider Type"}),(0,b.jsxs)(l.Select,{value:D.type,onValueChange:a=>E(b=>({...b,type:a})),children:[(0,b.jsx)(l.SelectTrigger,{children:(0,b.jsx)(l.SelectValue,{})}),(0,b.jsxs)(l.SelectContent,{children:[(0,b.jsx)(l.SelectItem,{value:"google",children:"Google AI (Gemini)"}),(0,b.jsx)(l.SelectItem,{value:"groq",children:"Groq"})]})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{htmlFor:"prov-api-key",children:"API Key"}),(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(g.Input,{id:"prov-api-key",type:F?"text":"password",placeholder:"Enter your API key",value:D.apiKey,onChange:a=>E(b=>({...b,apiKey:a.target.value})),className:"pr-10"}),(0,b.jsx)(f.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>G(!F),className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",children:F?(0,b.jsx)(u,{className:"h-4 w-4 text-muted-foreground"}):(0,b.jsx)(t,{className:"h-4 w-4 text-muted-foreground"})})]}),(0,b.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:["google"===D.type&&(0,b.jsxs)(b.Fragment,{children:["Get your API key from"," ",(0,b.jsx)("a",{href:"https://aistudio.google.com/apikey",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Google AI Studio"})]}),"groq"===D.type&&(0,b.jsxs)(b.Fragment,{children:["Get your API key from"," ",(0,b.jsx)("a",{href:"https://console.groq.com/keys",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Groq Console"})]})]})]})]}),(0,b.jsx)(k.DialogFooter,{className:"shrink-0",children:(0,b.jsxs)(f.Button,{onClick:Q,disabled:!S||J.isPending||K.isPending,className:"gap-1.5",children:[(J.isPending||K.isPending)&&(0,b.jsx)(q.Loader2,{className:"h-4 w-4 animate-spin"}),B?"Update":"Add Provider"]})})]})})]})}a.s(["AIProvidersPage",()=>A],601017)}];
1
+ module.exports=[738783,(a,b,c)=>{"use strict";b.exports=a.r(342602).vendored["react-ssr"].ReactServerDOMTurbopackClient},785607,a=>{"use strict";let b=(0,a.i(883706).default)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);a.s(["Plug",()=>b],785607)},591119,a=>{"use strict";var b=a.i(187924),c=a.i(368114);function d({className:a,...d}){return(0,b.jsx)("div",{"data-slot":"card",className:(0,c.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border border-border/40 py-6",a),...d})}function e({className:a,...d}){return(0,b.jsx)("div",{"data-slot":"card-header",className:(0,c.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...d})}function f({className:a,...d}){return(0,b.jsx)("div",{"data-slot":"card-title",className:(0,c.cn)("leading-none font-semibold",a),...d})}function g({className:a,...d}){return(0,b.jsx)("div",{"data-slot":"card-description",className:(0,c.cn)("text-muted-foreground text-sm",a),...d})}function h({className:a,...d}){return(0,b.jsx)("div",{"data-slot":"card-content",className:(0,c.cn)("px-6",a),...d})}a.s(["Card",()=>d,"CardContent",()=>h,"CardDescription",()=>g,"CardHeader",()=>e,"CardTitle",()=>f])},400210,a=>{"use strict";let b=(0,a.i(883706).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);a.s(["ArrowLeft",()=>b],400210)},699464,a=>{"use strict";let b=(0,a.i(883706).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);a.s(["Pencil",()=>b],699464)},870430,a=>{"use strict";var b=a.i(187924),c=a.i(572131);a.i(935112);var d=a.i(470121),e=Symbol.for("react.lazy"),f=c[" use ".trim().toString()];function g(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===e&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}var h=Symbol("radix.slottable");function i(a){return c.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===h}var j=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,e)=>{var h,j;let k,l,m,n=(j=h=`Primitive.${e}`,(k=c.forwardRef((a,b)=>{let{children:e,...h}=a;if(g(e)&&"function"==typeof f&&(e=f(e._payload)),c.isValidElement(e)){var i;let a,f,g=(i=e,(f=(a=Object.getOwnPropertyDescriptor(i.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?i.ref:(f=(a=Object.getOwnPropertyDescriptor(i,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?i.props.ref:i.props.ref||i.ref),j=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(h,e.props);return e.type!==c.Fragment&&(j.ref=b?(0,d.composeRefs)(b,g):g),c.cloneElement(e,j)}return c.Children.count(e)>1?c.Children.only(null):null})).displayName=`${j}.SlotClone`,l=k,(m=c.forwardRef((a,d)=>{let{children:e,...h}=a;g(e)&&"function"==typeof f&&(e=f(e._payload));let j=c.Children.toArray(e),k=j.find(i);if(k){let a=k.props.children,e=j.map(b=>b!==k?b:c.Children.count(a)>1?c.Children.only(null):c.isValidElement(a)?a.props.children:null);return(0,b.jsx)(l,{...h,ref:d,children:c.isValidElement(a)?c.cloneElement(a,void 0,e):null})}return(0,b.jsx)(l,{...h,ref:d,children:e})})).displayName=`${h}.Slot`,m),o=c.forwardRef((a,c)=>{let{asChild:d,...f}=a;return(0,b.jsx)(d?n:e,{...f,ref:c})});return o.displayName=`Primitive.${e}`,{...a,[e]:o}},{}),k=c.forwardRef((a,c)=>(0,b.jsx)(j.label,{...a,ref:c,onMouseDown:b=>{b.target.closest("button, input, select, textarea")||(a.onMouseDown?.(b),!b.defaultPrevented&&b.detail>1&&b.preventDefault())}}));k.displayName="Label";var l=a.i(368114);function m({className:a,...c}){return(0,b.jsx)(k,{"data-slot":"label",className:(0,l.cn)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",a),...c})}a.s(["Label",()=>m],870430)},601017,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(50944),e=a.i(101880),f=a.i(699570),g=a.i(866718),h=a.i(870430),i=a.i(786304),j=a.i(591119),k=a.i(814574),l=a.i(580701),m=a.i(400210),n=a.i(915618),o=a.i(781560),p=a.i(699464),q=a.i(596221),r=a.i(785607),s=a.i(883706);let t=(0,s.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),u=(0,s.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var v=a.i(220494),w=a.i(238246),x=a.i(368114),y=a.i(823292);let z={name:"",type:"google",apiKey:""};function A(){let a=(0,d.useRouter)(),[s,A]=(0,c.useState)(!1),[B,C]=(0,c.useState)(null),[D,E]=(0,c.useState)(z),[F,G]=(0,c.useState)(!1),{data:H,isLoading:I}=e.api.aiProvider.list.useQuery(),J=e.api.aiProvider.add.useMutation(),K=e.api.aiProvider.update.useMutation(),L=e.api.aiProvider.delete.useMutation(),M=e.api.useUtils(),N=H?.providers||[],O=(0,c.useCallback)(()=>{C(null),E(z),G(!1),A(!0)},[]),P=(0,c.useCallback)(async a=>{C(a),G(!1);let b=await M.aiProvider.get.fetch({id:a});if(b.provider){let a=b.provider;E({name:a.name,type:a.type,apiKey:a.apiKey})}A(!0)},[M]),Q=(0,c.useCallback)(async()=>{try{let a={name:D.name,type:D.type,apiKey:D.apiKey};B?(await K.mutateAsync({id:B,data:a}),y.toast.success("AI provider updated. Restart the app to apply the new key.")):(await J.mutateAsync(a),y.toast.success("AI provider added. Restart the app to apply the new key.")),A(!1),M.aiProvider.list.invalidate()}catch(a){y.toast.error(a.message||"Failed to save AI provider")}},[D,B,J,K,M]),R=(0,c.useCallback)(async(a,b)=>{if(confirm(`Delete AI provider "${b}"? This cannot be undone.`))try{await L.mutateAsync({id:a}),y.toast.success("AI provider deleted"),M.aiProvider.list.invalidate()}catch(a){y.toast.error(a.message||"Failed to delete AI provider")}},[L,M]),S=D.name.trim()&&D.apiKey.trim();return(0,b.jsxs)("div",{className:"min-h-screen bg-background",children:[(0,b.jsx)("header",{className:"border-b border-border/40 bg-background/80 backdrop-blur sticky top-0 z-10",children:(0,b.jsxs)("div",{className:"max-w-5xl mx-auto flex items-center gap-4 px-4 sm:px-6 py-4",children:[(0,b.jsxs)(f.Button,{variant:"ghost",size:"sm",onClick:()=>a.push("/"),className:"gap-1.5",children:[(0,b.jsx)(m.ArrowLeft,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Back to Chat"})]}),(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)("span",{className:"hidden sm:inline",children:"SqlBot"}),(0,b.jsx)("span",{className:"hidden sm:inline opacity-20",children:"/"}),(0,b.jsx)("span",{children:"AI Providers"}),N.length>0&&(0,b.jsx)(i.Badge,{variant:"outline",className:"h-5 min-w-5 px-1 justify-center rounded-sm bg-muted/50 border-border/50 text-[10px]",children:N.length})]})]})}),(0,b.jsxs)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-6 sm:py-8",children:[(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4 mb-8",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"AI Providers"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage your AI provider API keys. Keys are stored locally in your config."})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(f.Button,{asChild:!0,variant:"outline",className:"gap-1.5",size:"sm",children:(0,b.jsxs)(w.default,{href:"/connections",children:[(0,b.jsx)(v.Database,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Connections"})]})}),(0,b.jsxs)(f.Button,{onClick:O,className:"gap-1.5",size:"sm",children:[(0,b.jsx)(n.Plus,{className:"h-4 w-4"}),"Add Provider"]})]})]}),(0,b.jsx)("div",{className:"rounded-lg border border-border/60 bg-muted/30 p-3 sm:p-4 mb-6",children:(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:["API keys are saved locally at"," ",(0,b.jsx)("code",{className:"text-[11px] bg-muted px-1.5 py-0.5 rounded font-mono",children:H?.configPath||"~/.sqlbot/ai-providers.json"}),". After adding or updating a key, restart the app for changes to take effect."]})}),I?(0,b.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,b.jsx)(q.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):0===N.length?(0,b.jsx)(j.Card,{className:"border-dashed",children:(0,b.jsxs)(j.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,b.jsx)("div",{className:"rounded-full bg-muted p-4 mb-4",children:(0,b.jsx)(r.Plug,{className:"h-8 w-8 text-muted-foreground"})}),(0,b.jsx)("h3",{className:"text-lg font-semibold mb-1",children:"No AI providers configured"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-6 text-center max-w-sm",children:"Add your Google AI API key to power chat, SQL generation, and embeddings with Gemini models."}),(0,b.jsxs)(f.Button,{onClick:O,className:"gap-1.5",children:[(0,b.jsx)(n.Plus,{className:"h-4 w-4"}),"Add Your First Provider"]})]})}):(0,b.jsx)("div",{className:"grid gap-3 sm:gap-4 sm:grid-cols-2",children:N.map(a=>(0,b.jsxs)(j.Card,{className:"transition-all relative",children:[(0,b.jsx)(j.CardHeader,{className:"p-4 sm:p-6 pb-2 sm:pb-3",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:(0,x.cn)("rounded-lg p-2 border shrink-0",function(a){switch(a){case"google":return"text-blue-400 bg-blue-400/10 border-blue-400/20";case"groq":return"text-orange-400 bg-orange-400/10 border-orange-400/20";default:return"text-muted-foreground"}}(a.type)),children:(0,b.jsx)(r.Plug,{className:"h-4 w-4"})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)(j.CardTitle,{className:"text-sm sm:text-base truncate",children:a.name}),(0,b.jsx)(j.CardDescription,{className:"text-xs mt-0.5",children:function(a){switch(a){case"google":return"Google AI (Gemini)";case"groq":return"Groq";default:return a}}(a.type)})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,b.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>P(a.id),className:"text-xs h-8 w-8 p-0",children:(0,b.jsx)(p.Pencil,{className:"h-3 w-3"})}),(0,b.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>R(a.id,a.name),className:"text-xs h-8 w-8 p-0 text-destructive hover:text-destructive",children:(0,b.jsx)(o.Trash2,{className:"h-3 w-3"})})]})]})}),(0,b.jsx)(j.CardContent,{className:"p-4 sm:p-6 pt-0 sm:pt-0",children:(0,b.jsxs)("div",{className:"space-y-1.5 text-xs text-muted-foreground",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground/60 w-10 sm:w-14 shrink-0",children:"Key"}),(0,b.jsx)("span",{className:"font-mono truncate",children:a.apiKey})]}),(0,b.jsxs)("div",{className:"flex items-start gap-2 min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground/60 w-10 sm:w-14 shrink-0",children:"Usage"}),(0,b.jsx)("span",{className:"line-clamp-2 sm:line-clamp-1",children:function(a){switch(a){case"google":return"Powers chat, SQL generation, and embeddings via Gemini models";case"groq":return"Fast Llama and Mixtral models hosted on Groq's LPUs";default:return""}}(a.type)})]})]})})]},a.id))})]}),(0,b.jsx)(k.Dialog,{open:s,onOpenChange:A,children:(0,b.jsxs)(k.DialogContent,{className:"sm:max-w-lg max-h-[85vh] flex! flex-col! p-4 sm:p-6",children:[(0,b.jsxs)(k.DialogHeader,{className:"shrink-0",children:[(0,b.jsx)(k.DialogTitle,{children:B?"Edit AI Provider":"Add AI Provider"}),(0,b.jsx)(k.DialogDescription,{children:B?"Update your AI provider configuration.":"Configure a new AI provider with your API key."})]}),(0,b.jsxs)("div",{className:"space-y-4 py-2 overflow-y-auto flex-1 min-h-0",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{htmlFor:"prov-name",children:"Provider Name"}),(0,b.jsx)(g.Input,{id:"prov-name",placeholder:"e.g. My Google AI Key",value:D.name,onChange:a=>E(b=>({...b,name:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{children:"Provider Type"}),(0,b.jsxs)(l.Select,{value:D.type,onValueChange:a=>E(b=>({...b,type:a})),children:[(0,b.jsx)(l.SelectTrigger,{children:(0,b.jsx)(l.SelectValue,{})}),(0,b.jsxs)(l.SelectContent,{children:[(0,b.jsx)(l.SelectItem,{value:"google",children:"Google AI (Gemini)"}),(0,b.jsx)(l.SelectItem,{value:"groq",children:"Groq"})]})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(h.Label,{htmlFor:"prov-api-key",children:"API Key"}),(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(g.Input,{id:"prov-api-key",type:F?"text":"password",placeholder:"Enter your API key",value:D.apiKey,onChange:a=>E(b=>({...b,apiKey:a.target.value})),className:"pr-10"}),(0,b.jsx)(f.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>G(!F),className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",children:F?(0,b.jsx)(u,{className:"h-4 w-4 text-muted-foreground"}):(0,b.jsx)(t,{className:"h-4 w-4 text-muted-foreground"})})]}),(0,b.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:["google"===D.type&&(0,b.jsxs)(b.Fragment,{children:["Get your API key from"," ",(0,b.jsx)("a",{href:"https://aistudio.google.com/apikey",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Google AI Studio"})]}),"groq"===D.type&&(0,b.jsxs)(b.Fragment,{children:["Get your API key from"," ",(0,b.jsx)("a",{href:"https://console.groq.com/keys",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Groq Console"})]})]})]})]}),(0,b.jsx)(k.DialogFooter,{className:"shrink-0",children:(0,b.jsxs)(f.Button,{onClick:Q,disabled:!S||J.isPending||K.isPending,className:"gap-1.5",children:[(J.isPending||K.isPending)&&(0,b.jsx)(q.Loader2,{className:"h-4 w-4 animate-spin"}),B?"Update":"Add Provider"]})})]})})]})}a.s(["AIProvidersPage",()=>A],601017)}];
2
2
 
3
3
  //# sourceMappingURL=_37f7f89d._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[935736,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(101880),e=a.i(823292),f=a.i(238246),g=a.i(50944),h=a.i(699570),i=a.i(400210),j=a.i(915618),k=a.i(808406),l=a.i(953722);function m({onAddConnection:a}){let c=(0,g.useRouter)();return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("header",{className:"border-b border-border/40 bg-background/80 backdrop-blur sticky top-0 z-10",children:(0,b.jsxs)("div",{className:"max-w-5xl mx-auto flex items-center gap-4 px-4 sm:px-6 py-4",children:[(0,b.jsxs)(h.Button,{variant:"ghost",size:"sm",onClick:()=>c.push("/"),className:"gap-1.5",children:[(0,b.jsx)(i.ArrowLeft,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Back to Chat"})]}),(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsx)("h1",{className:"text-sm font-semibold",children:"CLAY"})]})}),(0,b.jsx)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-5 sm:py-8",children:(0,b.jsxs)("div",{className:"space-y-3 sm:space-y-0 sm:flex sm:items-start sm:justify-between sm:gap-4 mb-6 sm:mb-8",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h2",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Connections"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-1 hidden sm:block",children:"Manage your database connections. Supports PostgreSQL, Redshift, MySQL, SQLite, and CSV imports."})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,b.jsx)(h.Button,{asChild:!0,variant:"outline",size:"sm",className:"gap-1.5 shrink-0",children:(0,b.jsxs)(f.default,{href:"/ai-providers",children:[(0,b.jsx)(k.Sparkles,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"AI Providers"})]})}),(0,b.jsx)(h.Button,{asChild:!0,variant:"outline",size:"sm",className:"gap-1.5 shrink-0",children:(0,b.jsxs)(f.default,{href:"/knowledge-base",children:[(0,b.jsx)(l.BookOpen,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Knowledge Base"})]})}),(0,b.jsxs)(h.Button,{onClick:a,size:"sm",className:"gap-1.5 shrink-0",children:[(0,b.jsx)(j.Plus,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"sm:hidden",children:"Add"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Add Connection"})]})]})]})})]})}var n=a.i(591119),o=a.i(220494),p=a.i(596221),q=a.i(786304),r=a.i(167453),s=a.i(785607),t=a.i(883706);let u=(0,t.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),v=(0,t.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),w=(0,t.default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);var x=a.i(136398),y=a.i(699464),z=a.i(781560),A=a.i(368114),B=a.i(624722),C=a.i(111805);let D={redshift:5439,postgresql:5432,mysql:3306,sqlite:0,csv:0},E={name:"",type:"postgresql",host:"",port:"5432",user:"",password:"",database:"",ssl:!0,filePath:""},F={redshift:{color:"text-orange-400 bg-orange-400/10 border-orange-400/20",label:"Amazon Redshift",icon:o.Database},postgresql:{color:"text-blue-400 bg-blue-400/10 border-blue-400/20",label:"PostgreSQL",icon:o.Database},mysql:{color:"text-cyan-400 bg-cyan-400/10 border-cyan-400/20",label:"MySQL",icon:o.Database},sqlite:{color:"text-violet-400 bg-violet-400/10 border-violet-400/20",label:"SQLite",icon:C.HardDrive},csv:{color:"text-green-400 bg-green-400/10 border-green-400/20",label:"CSV (SQLite)",icon:B.FileSpreadsheet}},G={color:"text-muted-foreground",label:"",icon:o.Database};function H({connection:a,isActive:c,isTestPending:d,onSetActive:e,onTestExisting:f,onEdit:g,onDelete:i,onImportCsv:j}){var k,l,m;let o=(k=a.type,F[k]?.icon??G.icon);return(0,b.jsxs)(n.Card,{className:(0,A.cn)("transition-all relative overflow-hidden min-w-0",c&&"ring-1 ring-primary/50 border-primary/30"),children:[(0,b.jsx)(n.CardHeader,{className:"p-4 sm:p-6 pb-2 sm:pb-3",children:(0,b.jsxs)("div",{className:"flex items-center gap-2.5 sm:gap-3",children:[(0,b.jsx)("div",{className:(0,A.cn)("rounded-lg p-1.5 sm:p-2 border shrink-0",(l=a.type,F[l]?.color??G.color)),children:(0,b.jsx)(o,{className:"h-4 w-4"})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(n.CardTitle,{className:"text-sm sm:text-base truncate",children:a.name}),c&&(0,b.jsxs)(q.Badge,{variant:"default",className:"text-[10px] gap-1 shrink-0",children:[(0,b.jsx)(r.CheckCircle2,{className:"h-3 w-3"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Active"})]})]}),(0,b.jsx)(n.CardDescription,{className:"text-xs mt-0.5",children:(m=a.type,F[m]?.label??m)})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,b.jsx)(h.Button,{variant:"ghost",size:"sm",onClick:()=>g(a.id),className:"h-7 w-7 p-0",children:(0,b.jsx)(y.Pencil,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(h.Button,{variant:"ghost",size:"sm",onClick:()=>i(a.id,a.name),className:"h-7 w-7 p-0 text-destructive hover:text-destructive",children:(0,b.jsx)(z.Trash2,{className:"h-3.5 w-3.5"})})]})]})}),(0,b.jsxs)(n.CardContent,{className:"p-4 sm:p-6 pt-0 sm:pt-0 min-w-0 overflow-hidden",children:[(0,b.jsx)(I,{connection:a}),(0,b.jsx)(M,{connection:a,isActive:c,isTestPending:d,onSetActive:e,onTestExisting:f,onImportCsv:j})]})]})}function I({connection:a}){return(0,b.jsx)("div",{className:"space-y-1 text-xs text-muted-foreground mb-3 sm:mb-4 min-w-0 overflow-hidden",children:"sqlite"===a.type?(0,b.jsx)(J,{label:"File",value:a.filePath||a.database||"—"}):"csv"===a.type?(0,b.jsx)(K,{csvFiles:a.csvFiles}):(0,b.jsx)(L,{connection:a})})}function J({label:a,value:c}){return(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground/60 w-12 sm:w-14 shrink-0",children:a}),(0,b.jsx)("span",{className:"font-mono truncate min-w-0 flex-1",children:c})]})}function K({csvFiles:a}){return a?.length?(0,b.jsx)(b.Fragment,{children:a.map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)(x.Table2,{className:"h-3 w-3 shrink-0 text-green-400/60"}),(0,b.jsx)("span",{className:"font-mono truncate min-w-0",title:a.tableName,children:a.tableName}),(0,b.jsx)("span",{className:"text-muted-foreground/40 shrink-0 text-[10px]",children:null!=a.rowCount&&`${a.rowCount} rows`})]},a.tableName))}):(0,b.jsx)("div",{className:"text-muted-foreground/50 italic",children:"No CSV files imported yet"})}function L({connection:a}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(J,{label:"Host",value:`${a.host}:${a.port}`}),(0,b.jsx)(J,{label:"DB",value:a.database}),(0,b.jsx)(J,{label:"User",value:a.user}),a.ssl&&(0,b.jsxs)("div",{className:"flex items-center gap-1 text-green-500/70 mt-1",children:[(0,b.jsx)(v,{className:"h-3 w-3"}),(0,b.jsx)("span",{children:"SSL enabled"})]})]})}function M({connection:a,isActive:c,isTestPending:d,onSetActive:e,onTestExisting:g,onImportCsv:i}){return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[!c&&(0,b.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>e(a.id),className:"text-xs gap-1 h-7 px-2",children:[(0,b.jsx)(s.Plug,{className:"h-3 w-3"}),"Active"]}),(0,b.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>g(a.id),disabled:d,className:"text-xs gap-1 h-7 px-2",children:[d?(0,b.jsx)(p.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(u,{className:"h-3 w-3"}),"Test"]}),"csv"===a.type&&(0,b.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>i(a.id),className:"text-xs gap-1 h-7 px-2 text-green-400 border-green-400/30 hover:bg-green-400/10",children:[(0,b.jsx)(w,{className:"h-3 w-3"}),"CSV"]}),(0,b.jsx)(h.Button,{asChild:!0,variant:"outline",size:"sm",className:"text-xs gap-1 h-7 px-2",children:(0,b.jsxs)(f.default,{href:`/knowledge-base?connectionId=${a.id}`,children:[(0,b.jsx)(l.BookOpen,{className:"h-3 w-3"}),"KB"]})})]})}function N({connections:a,activeConnectionId:c,isLoading:d,isTestPending:e,onAdd:f,onSetActive:g,onTestExisting:h,onEdit:i,onDelete:j,onImportCsv:k}){return d?(0,b.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,b.jsx)(p.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):0===a.length?(0,b.jsx)(O,{onAdd:f}):(0,b.jsx)("div",{className:"grid gap-3 sm:gap-4 md:grid-cols-2 min-w-0",children:a.map(a=>(0,b.jsx)(H,{connection:a,isActive:a.id===c,isTestPending:e,onSetActive:g,onTestExisting:h,onEdit:i,onDelete:j,onImportCsv:k},a.id))})}function O({onAdd:a}){return(0,b.jsx)(n.Card,{className:"border-dashed",children:(0,b.jsxs)(n.CardContent,{className:"flex flex-col items-center justify-center py-10 sm:py-16 px-4",children:[(0,b.jsx)("div",{className:"rounded-full bg-muted p-4 mb-4",children:(0,b.jsx)(o.Database,{className:"h-8 w-8 text-muted-foreground"})}),(0,b.jsx)("h3",{className:"text-base sm:text-lg font-semibold mb-1",children:"No connections yet"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-6 text-center max-w-sm",children:"Add a database connection to start querying your data with AI."}),(0,b.jsxs)(h.Button,{onClick:a,className:"gap-1.5",children:[(0,b.jsx)(j.Plus,{className:"h-4 w-4"}),"Add Your First Connection"]})]})})}var P=a.i(866718),Q=a.i(870430),R=a.i(814574),S=a.i(580701),T=a.i(862722),U=a.i(104720),V=a.i(633508);function W(a,b=6){let c=[],d=[],e="",f=!1,g=0;for(;g<a.length&&c.length<b;){let b=a[g];f?'"'===b?g+1<a.length&&'"'===a[g+1]?(e+='"',g+=2):(f=!1,g++):(e+=b,g++):'"'===b?(f=!0,g++):","===b?(d.push(e.trim()),e="",g++):"\r"===b||"\n"===b?(d.push(e.trim()),e="",d.some(a=>""!==a)&&c.push(d),d=[],"\r"===b&&g+1<a.length&&"\n"===a[g+1]?g+=2:g++):(e+=b,g++)}return(e||d.length>0)&&(d.push(e.trim()),d.some(a=>""!==a)&&c.push(d)),c}function X(a){return a>1048576?`${(a/1048576).toFixed(1)} MB`:`${(a/1024).toFixed(1)} KB`}function Y(a){return a.replace(/\.csv$/i,"").replace(/[^\w\s]/g,"").replace(/\s+/g,"_").toLowerCase().slice(0,64)||"imported_data"}function Z({formHook:a,connections:c,onOpenCsvImport:d,onRemoveCsvTable:e}){let{dialogOpen:f,setDialogOpen:g,editingId:i,form:j,setForm:k,isLocalType:l,testingConnection:m,testResult:n,pendingCsvFiles:o,pendingCsvFileRef:q,isFormValid:r,isSaving:s,handleTypeChange:t,handleTestConnection:v,handleSave:w,handlePendingCsvFileSelect:x,removePendingCsvFile:y,updatePendingTableName:z}=a;return(0,b.jsx)(R.Dialog,{open:f,onOpenChange:g,children:(0,b.jsxs)(R.DialogContent,{className:(0,A.cn)("sm:max-w-lg max-h-[85vh] flex! flex-col! p-4 sm:p-6","csv"===j.type&&"sm:max-w-xl"),children:[(0,b.jsxs)(R.DialogHeader,{className:"shrink-0",children:[(0,b.jsx)(R.DialogTitle,{children:i?"Edit Connection":"Add Connection"}),(0,b.jsx)(R.DialogDescription,{children:i?"Update your database connection details.":"Configure a new database connection."})]}),(0,b.jsxs)("div",{className:"space-y-4 py-2 overflow-y-auto flex-1 min-h-0 -mx-4 sm:-mx-6 px-4 sm:px-6",children:[(0,b.jsx)($,{form:j,setForm:k}),(0,b.jsx)(_,{form:j,editingId:i,onTypeChange:t}),"sqlite"===j.type&&(0,b.jsx)(aa,{form:j,setForm:k}),"csv"===j.type&&!i&&(0,b.jsx)(ac,{pendingCsvFiles:o,pendingCsvFileRef:q,onFileSelect:x,onRemove:y,onUpdateTableName:z}),"csv"===j.type&&i&&(0,b.jsx)(ad,{editingId:i,connections:c,onOpenCsvImport:d,onRemoveCsvTable:e,onCloseDialog:()=>g(!1)}),!l&&(0,b.jsx)(ab,{form:j,setForm:k}),n&&(0,b.jsx)(ae,{testResult:n})]}),(0,b.jsxs)(R.DialogFooter,{className:"gap-2 sm:gap-0 shrink-0",children:["csv"!==j.type&&(0,b.jsxs)(h.Button,{variant:"outline",onClick:v,disabled:!r||m,className:"gap-1.5",children:[m?(0,b.jsx)(p.Loader2,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(u,{className:"h-4 w-4"}),"Test Connection"]}),(0,b.jsxs)(h.Button,{onClick:w,disabled:!r||s,className:"gap-1.5",children:[s&&(0,b.jsx)(p.Loader2,{className:"h-4 w-4 animate-spin"}),i?"Update":"csv"===j.type&&o.length>0?`Save & Import ${o.length} File${o.length>1?"s":""}`:"Save"]})]})]})})}function $({form:a,setForm:c}){let d="csv"===a.type?"e.g. Sales Data CSVs":"sqlite"===a.type?"e.g. Local SQLite DB":"e.g. Production Redshift";return(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-name",children:"Connection Name"}),(0,b.jsx)(P.Input,{id:"conn-name",placeholder:d,value:a.name,onChange:a=>c(b=>({...b,name:a.target.value}))})]})}function _({form:a,editingId:c,onTypeChange:d}){return(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{children:"Database Type"}),(0,b.jsxs)(S.Select,{value:a.type,onValueChange:a=>d(a),disabled:!!c,children:[(0,b.jsx)(S.SelectTrigger,{children:(0,b.jsx)(S.SelectValue,{})}),(0,b.jsxs)(S.SelectContent,{children:[(0,b.jsx)(S.SelectItem,{value:"postgresql",children:"PostgreSQL"}),(0,b.jsx)(S.SelectItem,{value:"redshift",children:"Amazon Redshift"}),(0,b.jsx)(S.SelectItem,{value:"mysql",children:"MySQL"}),(0,b.jsx)(S.SelectItem,{value:"sqlite",children:"SQLite"}),(0,b.jsx)(S.SelectItem,{value:"csv",children:"CSV Import"})]})]})]})}function aa({form:a,setForm:c}){return(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-filepath",children:"Database File Path"}),(0,b.jsx)(P.Input,{id:"conn-filepath",placeholder:"/path/to/your/database.db",value:a.filePath,onChange:a=>c(b=>({...b,filePath:a.target.value}))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Full path to the SQLite database file on your local machine"})]})}function ab({form:a,setForm:c}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-host",children:"Host"}),(0,b.jsx)(P.Input,{id:"conn-host",placeholder:"localhost",value:a.host,onChange:a=>c(b=>({...b,host:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-port",children:"Port"}),(0,b.jsx)(P.Input,{id:"conn-port",placeholder:String(D[a.type]),value:a.port,onChange:a=>c(b=>({...b,port:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-database",children:"Database"}),(0,b.jsx)(P.Input,{id:"conn-database",placeholder:"my_database",value:a.database,onChange:a=>c(b=>({...b,database:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-user",children:"Username"}),(0,b.jsx)(P.Input,{id:"conn-user",placeholder:"postgres",value:a.user,onChange:a=>c(b=>({...b,user:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-password",children:"Password"}),(0,b.jsx)(P.Input,{id:"conn-password",type:"password",placeholder:"••••••••",value:a.password,onChange:a=>c(b=>({...b,password:a.target.value}))})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("input",{type:"checkbox",id:"conn-ssl",checked:a.ssl,onChange:a=>c(b=>({...b,ssl:a.target.checked})),className:"rounded border-border"}),(0,b.jsx)(Q.Label,{htmlFor:"conn-ssl",className:"text-sm font-normal cursor-pointer",children:"Use SSL"})]})]})}function ac({pendingCsvFiles:a,pendingCsvFileRef:c,onFileSelect:d,onRemove:e,onUpdateTableName:f}){return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)(Q.Label,{className:"text-xs",children:"CSV Files"}),(0,b.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),className:"text-xs gap-1 h-7 text-green-400 border-green-400/30 hover:bg-green-400/10",children:[(0,b.jsx)(j.Plus,{className:"h-3 w-3"}),"Add CSV"]}),(0,b.jsx)("input",{ref:c,type:"file",accept:".csv",onChange:d,className:"hidden"})]}),0===a.length?(0,b.jsxs)("div",{onClick:()=>c.current?.click(),className:"rounded-lg border-2 border-dashed p-6 text-center cursor-pointer transition-colors hover:border-green-400/40 hover:bg-green-400/5",children:[(0,b.jsx)(w,{className:"h-6 w-6 text-muted-foreground/40 mx-auto mb-2"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Click to add CSV files — each file becomes a queryable table"})]}):(0,b.jsx)("div",{className:"rounded-lg border divide-y",children:a.map((a,c)=>(0,b.jsxs)("div",{className:"px-3 py-2.5 space-y-1.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(U.FileText,{className:"h-4 w-4 shrink-0 text-green-400/70"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-sm font-medium truncate",children:a.fileName}),(0,b.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:[X(a.fileSize),a.previewRows.length>0&&(0,b.jsxs)(b.Fragment,{children:[" · ",a.previewRows[0]?.length||0," columns"]})]})]}),(0,b.jsx)(h.Button,{variant:"ghost",size:"sm",onClick:()=>e(c),className:"h-7 w-7 p-0 text-destructive hover:text-destructive shrink-0",children:(0,b.jsx)(V.X,{className:"h-3 w-3"})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(Q.Label,{className:"text-[11px] text-muted-foreground shrink-0 w-16",children:"Table name"}),(0,b.jsx)(P.Input,{value:a.tableName,onChange:a=>f(c,a.target.value),className:"h-7 text-xs font-mono"})]})]},c))})]})}function ad({editingId:a,connections:c,onOpenCsvImport:d,onRemoveCsvTable:e,onCloseDialog:f}){let g=c.find(b=>b.id===a),i=g?.csvFiles||[];return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)(Q.Label,{className:"text-xs",children:"Imported CSV Files"}),(0,b.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>{f(),d(a)},className:"text-xs gap-1 h-7 text-green-400 border-green-400/30 hover:bg-green-400/10",children:[(0,b.jsx)(w,{className:"h-3 w-3"}),"Import CSV"]})]}),0===i.length?(0,b.jsxs)("div",{className:"rounded-lg border border-dashed p-4 text-center",children:[(0,b.jsx)(B.FileSpreadsheet,{className:"h-6 w-6 text-muted-foreground/40 mx-auto mb-2"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"No CSV files imported yet"})]}):(0,b.jsx)("div",{className:"rounded-lg border divide-y max-h-64 overflow-y-auto",children:i.map(c=>(0,b.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[(0,b.jsx)(x.Table2,{className:"h-4 w-4 shrink-0 text-green-400/70"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,b.jsx)("p",{className:"text-xs font-medium font-mono truncate",title:c.tableName,children:c.tableName}),(0,b.jsxs)("p",{className:"text-[11px] text-muted-foreground truncate",title:c.fileName,children:[c.fileName,null!=c.rowCount&&` \xb7 ${c.rowCount} rows`]})]}),(0,b.jsx)(h.Button,{variant:"ghost",size:"sm",onClick:()=>e(a,c.tableName),className:"h-7 w-7 p-0 shrink-0 text-destructive hover:text-destructive",children:(0,b.jsx)(z.Trash2,{className:"h-3.5 w-3.5"})})]},c.tableName))})]})}function ae({testResult:a}){return(0,b.jsx)("div",{className:(0,A.cn)("rounded-lg p-3 text-sm flex items-center gap-2",a.success?"bg-green-500/10 text-green-500 border border-green-500/20":"bg-destructive/10 text-destructive border border-destructive/20"),children:a.success?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.CheckCircle2,{className:"h-4 w-4 shrink-0"}),(0,b.jsxs)("span",{children:["Connected successfully (",a.latencyMs,"ms)"]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(T.XCircle,{className:"h-4 w-4 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.error})]})})}function af({previewRows:a,totalLineCount:c}){if(a.length<=1)return null;let d=a[0],e=a.slice(1,6);return(0,b.jsxs)("div",{className:"rounded-lg border overflow-hidden",children:[(0,b.jsx)("div",{className:"overflow-auto max-h-48",children:(0,b.jsxs)("table",{className:"text-xs",children:[(0,b.jsx)("thead",{className:"sticky top-0",children:(0,b.jsx)("tr",{className:"bg-muted/80 border-b",children:d.map((a,c)=>(0,b.jsx)("th",{className:"px-2.5 py-1.5 text-left font-semibold text-foreground whitespace-nowrap text-[11px]",children:a.length>24?a.slice(0,22)+"…":a||`col_${c+1}`},c))})}),(0,b.jsx)("tbody",{children:e.map((a,c)=>(0,b.jsx)("tr",{className:"border-b last:border-0 hover:bg-muted/30",children:d.map((c,d)=>(0,b.jsx)("td",{className:"px-2.5 py-1 text-muted-foreground font-mono text-[11px] whitespace-nowrap max-w-[180px] truncate",children:(a[d]??"").length>30?(a[d]??"").slice(0,28)+"…":a[d]??""},d))},c))})]})}),c&&c>6&&(0,b.jsxs)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground/60 bg-muted/30 border-t text-center",children:["Showing first ",Math.min(a.length-1,5)," rows · full file will be imported"]})]})}function ag({csvImport:a}){let{dialogOpen:c,setDialogOpen:d,tableName:e,setTableName:f,fileName:g,fileSize:i,content:j,previewRows:k,importing:l,fileRef:m,isImportValid:n,handleFileSelect:o,handleImport:q}=a;return(0,b.jsx)(R.Dialog,{open:c,onOpenChange:d,children:(0,b.jsxs)(R.DialogContent,{className:"sm:max-w-xl max-h-[85vh] flex! flex-col! overflow-hidden p-4 sm:p-6",children:[(0,b.jsxs)(R.DialogHeader,{className:"shrink-0",children:[(0,b.jsxs)(R.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)(B.FileSpreadsheet,{className:"h-5 w-5 text-green-400"}),"Import CSV File"]}),(0,b.jsx)(R.DialogDescription,{children:"Each imported CSV becomes a queryable SQL table."})]}),(0,b.jsxs)("div",{className:"space-y-4 py-2 overflow-y-auto flex-1 min-h-0",children:[(0,b.jsx)(ah,{fileRef:m,fileName:g,fileSize:i,previewRows:k,onFileSelect:o}),g&&(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(Q.Label,{htmlFor:"csv-table",className:"text-xs",children:"Table Name"}),(0,b.jsx)(P.Input,{id:"csv-table",placeholder:"e.g. sales_data",value:e,onChange:a=>f(a.target.value),className:"h-9"}),(0,b.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:["SQL table name — you'll query it as"," ",(0,b.jsxs)("code",{className:"bg-muted px-1 rounded",children:["SELECT * FROM ",e||"table_name"]})]})]}),k.length>1&&(0,b.jsxs)("div",{className:"space-y-1.5 min-w-0",children:[(0,b.jsx)(Q.Label,{className:"text-xs",children:"Preview"}),(0,b.jsx)(af,{previewRows:k,totalLineCount:j.split("\n").length})]})]}),(0,b.jsxs)(R.DialogFooter,{className:"shrink-0",children:[(0,b.jsx)(h.Button,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),(0,b.jsxs)(h.Button,{onClick:q,disabled:!n||l,className:"gap-1.5",children:[l?(0,b.jsx)(p.Loader2,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(w,{className:"h-4 w-4"}),l?"Importing...":"Import"]})]})]})})}function ah({fileRef:a,fileName:c,fileSize:d,previewRows:e,onFileSelect:f}){return(0,b.jsxs)("div",{onClick:()=>a.current?.click(),className:(0,A.cn)("border-2 border-dashed rounded-lg px-4 py-3 cursor-pointer transition-colors","hover:border-primary/50 hover:bg-primary/5",c?"border-green-400/30 bg-green-400/5":"border-border"),children:[(0,b.jsx)("input",{ref:a,type:"file",accept:".csv",onChange:f,className:"hidden"}),c?(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(U.FileText,{className:"h-5 w-5 text-green-400 shrink-0"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-sm font-medium truncate",children:c}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[d>0&&X(d),e.length>1&&(0,b.jsxs)(b.Fragment,{children:[" · ",e[0]?.length||0," columns detected"]})]})]}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:"Change file"})]}):(0,b.jsxs)("div",{className:"flex items-center gap-3 justify-center py-2",children:[(0,b.jsx)(w,{className:"h-5 w-5 text-muted-foreground"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"Click to select a CSV file"})]})]})}function ai(){let{data:a,isLoading:f}=d.api.connection.list.useQuery(),g=d.api.connection.delete.useMutation(),h=d.api.connection.setActive.useMutation(),i=d.api.connection.testExisting.useMutation(),j=d.api.connection.removeCsvTable.useMutation(),k=d.api.useUtils(),l=a?.connections||[],n=a?.activeConnectionId,o=(0,c.useCallback)(()=>{k.connection.list.invalidate()},[k]),p=function({onSaved:a}){let[b,f]=(0,c.useState)(!1),[g,h]=(0,c.useState)(null),[i,j]=(0,c.useState)(E),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(null),[o,p]=(0,c.useState)([]),q=(0,c.useRef)(null),r=d.api.connection.add.useMutation(),s=d.api.connection.update.useMutation(),t=d.api.connection.test.useMutation(),u=d.api.connection.importCsv.useMutation(),v=d.api.useUtils(),w="sqlite"===i.type||"csv"===i.type,x=(0,c.useCallback)(()=>{h(null),j(E),n(null),p([]),f(!0)},[]),y=(0,c.useCallback)(async a=>{h(a),n(null);let b=await v.connection.get.fetch({id:a});if(b.connection){let a=b.connection;j({name:a.name,type:a.type,host:a.host||"",port:String(a.port||0),user:a.user||"",password:a.password||"",database:a.database||"",ssl:a.ssl||!1,filePath:a.filePath||""})}f(!0)},[v]),z=(0,c.useCallback)(a=>{j(b=>({...b,type:a,..."sqlite"===a||"csv"===a?{host:"",port:"0",user:"",password:"",database:"",ssl:!1}:{port:String(D[a]),filePath:""}})),"csv"!==a&&p([])},[]),A=(0,c.useCallback)(async()=>{l(!0),n(null);try{let a=await t.mutateAsync({name:i.name||"Test",type:i.type,host:i.host||"",port:parseInt(i.port)||D[i.type],user:i.user||"",password:i.password||"",database:i.database||"",ssl:i.ssl,filePath:i.filePath||void 0});n(a)}catch(a){n({success:!1,error:a.message||"Connection test failed"})}finally{l(!1)}},[i,t]),B=(0,c.useCallback)(async()=>{try{let b={name:i.name,type:i.type,host:i.host||"",port:parseInt(i.port)||D[i.type],user:i.user||"",password:i.password||"",database:i.database||"",ssl:i.ssl,filePath:i.filePath||void 0};if(g)await s.mutateAsync({id:g,data:b}),e.toast.success("Connection updated");else{let a=await r.mutateAsync(b);if("csv"===i.type&&o.length>0&&a.connection){let b=a.connection.id,c=0;for(let a of o)try{await u.mutateAsync({connectionId:b,csvContent:a.content,tableName:a.tableName,fileName:a.fileName}),c++}catch(b){e.toast.error(`Failed to import ${a.fileName}: ${b.message}`)}e.toast.success(c>0?`Connection created with ${c} CSV file(s) imported`:"Connection added")}else e.toast.success("Connection added");p([])}f(!1),a()}catch(a){e.toast.error(a.message||"Failed to save connection")}},[i,g,r,s,u,o,a]),C=(0,c.useCallback)(a=>{let b=a.target.files?.[0];if(!b)return;let c=Y(b.name),d=new FileReader;d.onload=a=>{let d=a.target?.result||"",e=W(d,4);p(a=>[...a,{fileName:b.name,tableName:c,content:d,fileSize:b.size,previewRows:e}])},d.readAsText(b),q.current&&(q.current.value="")},[]),F=(0,c.useCallback)(a=>{p(b=>b.filter((b,c)=>c!==a))},[]),G=(0,c.useCallback)((a,b)=>{p(c=>c.map((c,d)=>d===a?{...c,tableName:b}:c))},[]),H=!!i.name.trim()&&("sqlite"===i.type?!!i.filePath?.trim():"csv"===i.type?!!g||o.length>0:!!(i.host.trim()&&i.port.trim()&&i.user.trim()&&i.password.trim()&&i.database.trim()));return{dialogOpen:b,setDialogOpen:f,editingId:g,form:i,setForm:j,isLocalType:w,testingConnection:k,testResult:m,pendingCsvFiles:o,pendingCsvFileRef:q,isFormValid:H,isSaving:r.isPending||s.isPending,openAddDialog:x,openEditDialog:y,handleTypeChange:z,handleTestConnection:A,handleSave:B,handlePendingCsvFileSelect:C,removePendingCsvFile:F,updatePendingTableName:G}}({onSaved:o}),q=function({onImported:a}){let[b,f]=(0,c.useState)(!1),[g,h]=(0,c.useState)(null),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(""),[m,n]=(0,c.useState)(""),[o,p]=(0,c.useState)(0),[q,r]=(0,c.useState)([]),[s,t]=(0,c.useState)(!1),u=(0,c.useRef)(null),v=d.api.connection.importCsv.useMutation(),w=(0,c.useCallback)(a=>{h(a),j(""),l(""),n(""),p(0),r([]),f(!0),u.current&&(u.current.value="")},[]),x=(0,c.useCallback)(a=>{let b=a.target.files?.[0];if(!b)return;l(b.name),p(b.size),j(Y(b.name));let c=new FileReader;c.onload=a=>{let b=a.target?.result||"";n(b),r(W(b,6))},c.readAsText(b)},[]),y=(0,c.useCallback)(async()=>{if(g&&m&&i){t(!0);try{let b=await v.mutateAsync({connectionId:g,csvContent:m,tableName:i,fileName:k});e.toast.success(`Imported ${b.rowCount} rows into table "${b.tableName}"`),f(!1),a()}catch(a){e.toast.error(a.message||"Failed to import CSV")}finally{t(!1)}}},[g,m,i,k,v,a]),z=!!(m&&i.trim());return{dialogOpen:b,setDialogOpen:f,tableName:i,setTableName:j,fileName:k,fileSize:o,content:m,previewRows:q,importing:s,fileRef:u,isImportValid:z,openDialog:w,handleFileSelect:x,handleImport:y}}({onImported:o}),r=(0,c.useCallback)(async(a,b)=>{if(confirm(`Delete connection "${b}"? This cannot be undone.`))try{await g.mutateAsync({id:a}),e.toast.success("Connection deleted"),o()}catch(a){e.toast.error(a.message||"Failed to delete connection")}},[g,o]),s=(0,c.useCallback)(async a=>{try{await h.mutateAsync({id:a}),o(),e.toast.success("Active connection updated")}catch(a){e.toast.error(a.message||"Failed to set active connection")}},[h,o]),t=(0,c.useCallback)(async a=>{try{let b=await i.mutateAsync({id:a});b.success?e.toast.success(`Connection successful (${b.latencyMs}ms)`):e.toast.error(`Connection failed: ${b.error}`)}catch(a){e.toast.error(a.message||"Test failed")}},[i]),u=(0,c.useCallback)(async(a,b)=>{if(confirm(`Remove table "${b}"? This will delete the imported data.`))try{await j.mutateAsync({connectionId:a,tableName:b}),e.toast.success(`Table "${b}" removed`),o()}catch(a){e.toast.error(a.message||"Failed to remove table")}},[j,o]);return(0,b.jsxs)("div",{className:"min-h-screen bg-background overflow-x-hidden",children:[(0,b.jsx)(m,{onAddConnection:p.openAddDialog}),(0,b.jsx)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 -mt-4 sm:-mt-8 pb-8 sm:pb-12",children:(0,b.jsx)(N,{connections:l,activeConnectionId:n,isLoading:f,isTestPending:i.isPending,onAdd:p.openAddDialog,onSetActive:s,onTestExisting:t,onEdit:p.openEditDialog,onDelete:r,onImportCsv:q.openDialog})}),(0,b.jsx)(Z,{formHook:p,connections:l,onOpenCsvImport:q.openDialog,onRemoveCsvTable:u}),(0,b.jsx)(ag,{csvImport:q})]})}a.s(["ConnectionsPage",()=>ai],935736)}];
1
+ module.exports=[935736,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(101880),e=a.i(823292),f=a.i(238246),g=a.i(50944),h=a.i(699570),i=a.i(400210),j=a.i(915618),k=a.i(808406),l=a.i(953722);function m({onAddConnection:a}){let c=(0,g.useRouter)();return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("header",{className:"border-b border-border/40 bg-background/80 backdrop-blur sticky top-0 z-10",children:(0,b.jsxs)("div",{className:"max-w-5xl mx-auto flex items-center gap-4 px-4 sm:px-6 py-4",children:[(0,b.jsxs)(h.Button,{variant:"ghost",size:"sm",onClick:()=>c.push("/"),className:"gap-1.5",children:[(0,b.jsx)(i.ArrowLeft,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Back to Chat"})]}),(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsx)("h1",{className:"text-sm font-semibold uppercase tracking-wider",children:"SQLBOT"})]})}),(0,b.jsx)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-5 sm:py-8",children:(0,b.jsxs)("div",{className:"space-y-3 sm:space-y-0 sm:flex sm:items-start sm:justify-between sm:gap-4 mb-6 sm:mb-8",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h2",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Connections"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-1 hidden sm:block",children:"Manage your database connections. Supports PostgreSQL, Redshift, MySQL, SQLite, and CSV imports."})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,b.jsx)(h.Button,{asChild:!0,variant:"outline",size:"sm",className:"gap-1.5 shrink-0",children:(0,b.jsxs)(f.default,{href:"/ai-providers",children:[(0,b.jsx)(k.Sparkles,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"AI Providers"})]})}),(0,b.jsx)(h.Button,{asChild:!0,variant:"outline",size:"sm",className:"gap-1.5 shrink-0",children:(0,b.jsxs)(f.default,{href:"/knowledge-base",children:[(0,b.jsx)(l.BookOpen,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Knowledge Base"})]})}),(0,b.jsxs)(h.Button,{onClick:a,size:"sm",className:"gap-1.5 shrink-0",children:[(0,b.jsx)(j.Plus,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"sm:hidden",children:"Add"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Add Connection"})]})]})]})})]})}var n=a.i(591119),o=a.i(220494),p=a.i(596221),q=a.i(786304),r=a.i(167453),s=a.i(785607),t=a.i(883706);let u=(0,t.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),v=(0,t.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),w=(0,t.default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);var x=a.i(136398),y=a.i(699464),z=a.i(781560),A=a.i(368114),B=a.i(624722),C=a.i(111805);let D={redshift:5439,postgresql:5432,mysql:3306,sqlite:0,csv:0},E={name:"",type:"postgresql",host:"",port:"5432",user:"",password:"",database:"",ssl:!0,filePath:""},F={redshift:{color:"text-orange-400 bg-orange-400/10 border-orange-400/20",label:"Amazon Redshift",icon:o.Database},postgresql:{color:"text-blue-400 bg-blue-400/10 border-blue-400/20",label:"PostgreSQL",icon:o.Database},mysql:{color:"text-cyan-400 bg-cyan-400/10 border-cyan-400/20",label:"MySQL",icon:o.Database},sqlite:{color:"text-violet-400 bg-violet-400/10 border-violet-400/20",label:"SQLite",icon:C.HardDrive},csv:{color:"text-green-400 bg-green-400/10 border-green-400/20",label:"CSV (SQLite)",icon:B.FileSpreadsheet}},G={color:"text-muted-foreground",label:"",icon:o.Database};function H({connection:a,isActive:c,isTestPending:d,onSetActive:e,onTestExisting:f,onEdit:g,onDelete:i,onImportCsv:j}){var k,l,m;let o=(k=a.type,F[k]?.icon??G.icon);return(0,b.jsxs)(n.Card,{className:(0,A.cn)("transition-all relative overflow-hidden min-w-0",c&&"ring-1 ring-primary/50 border-primary/30"),children:[(0,b.jsx)(n.CardHeader,{className:"p-4 sm:p-6 pb-2 sm:pb-3",children:(0,b.jsxs)("div",{className:"flex items-center gap-2.5 sm:gap-3",children:[(0,b.jsx)("div",{className:(0,A.cn)("rounded-lg p-1.5 sm:p-2 border shrink-0",(l=a.type,F[l]?.color??G.color)),children:(0,b.jsx)(o,{className:"h-4 w-4"})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(n.CardTitle,{className:"text-sm sm:text-base truncate",children:a.name}),c&&(0,b.jsxs)(q.Badge,{variant:"default",className:"text-[10px] gap-1 shrink-0",children:[(0,b.jsx)(r.CheckCircle2,{className:"h-3 w-3"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Active"})]})]}),(0,b.jsx)(n.CardDescription,{className:"text-xs mt-0.5",children:(m=a.type,F[m]?.label??m)})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,b.jsx)(h.Button,{variant:"ghost",size:"sm",onClick:()=>g(a.id),className:"h-7 w-7 p-0",children:(0,b.jsx)(y.Pencil,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(h.Button,{variant:"ghost",size:"sm",onClick:()=>i(a.id,a.name),className:"h-7 w-7 p-0 text-destructive hover:text-destructive",children:(0,b.jsx)(z.Trash2,{className:"h-3.5 w-3.5"})})]})]})}),(0,b.jsxs)(n.CardContent,{className:"p-4 sm:p-6 pt-0 sm:pt-0 min-w-0 overflow-hidden",children:[(0,b.jsx)(I,{connection:a}),(0,b.jsx)(M,{connection:a,isActive:c,isTestPending:d,onSetActive:e,onTestExisting:f,onImportCsv:j})]})]})}function I({connection:a}){return(0,b.jsx)("div",{className:"space-y-1 text-xs text-muted-foreground mb-3 sm:mb-4 min-w-0 overflow-hidden",children:"sqlite"===a.type?(0,b.jsx)(J,{label:"File",value:a.filePath||a.database||"—"}):"csv"===a.type?(0,b.jsx)(K,{csvFiles:a.csvFiles}):(0,b.jsx)(L,{connection:a})})}function J({label:a,value:c}){return(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)("span",{className:"text-muted-foreground/60 w-12 sm:w-14 shrink-0",children:a}),(0,b.jsx)("span",{className:"font-mono truncate min-w-0 flex-1",children:c})]})}function K({csvFiles:a}){return a?.length?(0,b.jsx)(b.Fragment,{children:a.map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)(x.Table2,{className:"h-3 w-3 shrink-0 text-green-400/60"}),(0,b.jsx)("span",{className:"font-mono truncate min-w-0",title:a.tableName,children:a.tableName}),(0,b.jsx)("span",{className:"text-muted-foreground/40 shrink-0 text-[10px]",children:null!=a.rowCount&&`${a.rowCount} rows`})]},a.tableName))}):(0,b.jsx)("div",{className:"text-muted-foreground/50 italic",children:"No CSV files imported yet"})}function L({connection:a}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(J,{label:"Host",value:`${a.host}:${a.port}`}),(0,b.jsx)(J,{label:"DB",value:a.database}),(0,b.jsx)(J,{label:"User",value:a.user}),a.ssl&&(0,b.jsxs)("div",{className:"flex items-center gap-1 text-green-500/70 mt-1",children:[(0,b.jsx)(v,{className:"h-3 w-3"}),(0,b.jsx)("span",{children:"SSL enabled"})]})]})}function M({connection:a,isActive:c,isTestPending:d,onSetActive:e,onTestExisting:g,onImportCsv:i}){return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[!c&&(0,b.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>e(a.id),className:"text-xs gap-1 h-7 px-2",children:[(0,b.jsx)(s.Plug,{className:"h-3 w-3"}),"Active"]}),(0,b.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>g(a.id),disabled:d,className:"text-xs gap-1 h-7 px-2",children:[d?(0,b.jsx)(p.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(u,{className:"h-3 w-3"}),"Test"]}),"csv"===a.type&&(0,b.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>i(a.id),className:"text-xs gap-1 h-7 px-2 text-green-400 border-green-400/30 hover:bg-green-400/10",children:[(0,b.jsx)(w,{className:"h-3 w-3"}),"CSV"]}),(0,b.jsx)(h.Button,{asChild:!0,variant:"outline",size:"sm",className:"text-xs gap-1 h-7 px-2",children:(0,b.jsxs)(f.default,{href:`/knowledge-base?connectionId=${a.id}`,children:[(0,b.jsx)(l.BookOpen,{className:"h-3 w-3"}),"KB"]})})]})}function N({connections:a,activeConnectionId:c,isLoading:d,isTestPending:e,onAdd:f,onSetActive:g,onTestExisting:h,onEdit:i,onDelete:j,onImportCsv:k}){return d?(0,b.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,b.jsx)(p.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):0===a.length?(0,b.jsx)(O,{onAdd:f}):(0,b.jsx)("div",{className:"grid gap-3 sm:gap-4 md:grid-cols-2 min-w-0",children:a.map(a=>(0,b.jsx)(H,{connection:a,isActive:a.id===c,isTestPending:e,onSetActive:g,onTestExisting:h,onEdit:i,onDelete:j,onImportCsv:k},a.id))})}function O({onAdd:a}){return(0,b.jsx)(n.Card,{className:"border-dashed",children:(0,b.jsxs)(n.CardContent,{className:"flex flex-col items-center justify-center py-10 sm:py-16 px-4",children:[(0,b.jsx)("div",{className:"rounded-full bg-muted p-4 mb-4",children:(0,b.jsx)(o.Database,{className:"h-8 w-8 text-muted-foreground"})}),(0,b.jsx)("h3",{className:"text-base sm:text-lg font-semibold mb-1",children:"No connections yet"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-6 text-center max-w-sm",children:"Add a database connection to start querying your data with AI."}),(0,b.jsxs)(h.Button,{onClick:a,className:"gap-1.5",children:[(0,b.jsx)(j.Plus,{className:"h-4 w-4"}),"Add Your First Connection"]})]})})}var P=a.i(866718),Q=a.i(870430),R=a.i(814574),S=a.i(580701),T=a.i(862722),U=a.i(104720),V=a.i(633508);function W(a,b=6){let c=[],d=[],e="",f=!1,g=0;for(;g<a.length&&c.length<b;){let b=a[g];f?'"'===b?g+1<a.length&&'"'===a[g+1]?(e+='"',g+=2):(f=!1,g++):(e+=b,g++):'"'===b?(f=!0,g++):","===b?(d.push(e.trim()),e="",g++):"\r"===b||"\n"===b?(d.push(e.trim()),e="",d.some(a=>""!==a)&&c.push(d),d=[],"\r"===b&&g+1<a.length&&"\n"===a[g+1]?g+=2:g++):(e+=b,g++)}return(e||d.length>0)&&(d.push(e.trim()),d.some(a=>""!==a)&&c.push(d)),c}function X(a){return a>1048576?`${(a/1048576).toFixed(1)} MB`:`${(a/1024).toFixed(1)} KB`}function Y(a){return a.replace(/\.csv$/i,"").replace(/[^\w\s]/g,"").replace(/\s+/g,"_").toLowerCase().slice(0,64)||"imported_data"}function Z({formHook:a,connections:c,onOpenCsvImport:d,onRemoveCsvTable:e}){let{dialogOpen:f,setDialogOpen:g,editingId:i,form:j,setForm:k,isLocalType:l,testingConnection:m,testResult:n,pendingCsvFiles:o,pendingCsvFileRef:q,isFormValid:r,isSaving:s,handleTypeChange:t,handleTestConnection:v,handleSave:w,handlePendingCsvFileSelect:x,removePendingCsvFile:y,updatePendingTableName:z}=a;return(0,b.jsx)(R.Dialog,{open:f,onOpenChange:g,children:(0,b.jsxs)(R.DialogContent,{className:(0,A.cn)("sm:max-w-lg max-h-[85vh] flex! flex-col! p-4 sm:p-6","csv"===j.type&&"sm:max-w-xl"),children:[(0,b.jsxs)(R.DialogHeader,{className:"shrink-0",children:[(0,b.jsx)(R.DialogTitle,{children:i?"Edit Connection":"Add Connection"}),(0,b.jsx)(R.DialogDescription,{children:i?"Update your database connection details.":"Configure a new database connection."})]}),(0,b.jsxs)("div",{className:"space-y-4 py-2 overflow-y-auto flex-1 min-h-0 -mx-4 sm:-mx-6 px-4 sm:px-6",children:[(0,b.jsx)($,{form:j,setForm:k}),(0,b.jsx)(_,{form:j,editingId:i,onTypeChange:t}),"sqlite"===j.type&&(0,b.jsx)(aa,{form:j,setForm:k}),"csv"===j.type&&!i&&(0,b.jsx)(ac,{pendingCsvFiles:o,pendingCsvFileRef:q,onFileSelect:x,onRemove:y,onUpdateTableName:z}),"csv"===j.type&&i&&(0,b.jsx)(ad,{editingId:i,connections:c,onOpenCsvImport:d,onRemoveCsvTable:e,onCloseDialog:()=>g(!1)}),!l&&(0,b.jsx)(ab,{form:j,setForm:k}),n&&(0,b.jsx)(ae,{testResult:n})]}),(0,b.jsxs)(R.DialogFooter,{className:"gap-2 sm:gap-0 shrink-0",children:["csv"!==j.type&&(0,b.jsxs)(h.Button,{variant:"outline",onClick:v,disabled:!r||m,className:"gap-1.5",children:[m?(0,b.jsx)(p.Loader2,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(u,{className:"h-4 w-4"}),"Test Connection"]}),(0,b.jsxs)(h.Button,{onClick:w,disabled:!r||s,className:"gap-1.5",children:[s&&(0,b.jsx)(p.Loader2,{className:"h-4 w-4 animate-spin"}),i?"Update":"csv"===j.type&&o.length>0?`Save & Import ${o.length} File${o.length>1?"s":""}`:"Save"]})]})]})})}function $({form:a,setForm:c}){let d="csv"===a.type?"e.g. Sales Data CSVs":"sqlite"===a.type?"e.g. Local SQLite DB":"e.g. Production Redshift";return(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-name",children:"Connection Name"}),(0,b.jsx)(P.Input,{id:"conn-name",placeholder:d,value:a.name,onChange:a=>c(b=>({...b,name:a.target.value}))})]})}function _({form:a,editingId:c,onTypeChange:d}){return(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{children:"Database Type"}),(0,b.jsxs)(S.Select,{value:a.type,onValueChange:a=>d(a),disabled:!!c,children:[(0,b.jsx)(S.SelectTrigger,{children:(0,b.jsx)(S.SelectValue,{})}),(0,b.jsxs)(S.SelectContent,{children:[(0,b.jsx)(S.SelectItem,{value:"postgresql",children:"PostgreSQL"}),(0,b.jsx)(S.SelectItem,{value:"redshift",children:"Amazon Redshift"}),(0,b.jsx)(S.SelectItem,{value:"mysql",children:"MySQL"}),(0,b.jsx)(S.SelectItem,{value:"sqlite",children:"SQLite"}),(0,b.jsx)(S.SelectItem,{value:"csv",children:"CSV Import"})]})]})]})}function aa({form:a,setForm:c}){return(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-filepath",children:"Database File Path"}),(0,b.jsx)(P.Input,{id:"conn-filepath",placeholder:"/path/to/your/database.db",value:a.filePath,onChange:a=>c(b=>({...b,filePath:a.target.value}))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Full path to the SQLite database file on your local machine"})]})}function ab({form:a,setForm:c}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-host",children:"Host"}),(0,b.jsx)(P.Input,{id:"conn-host",placeholder:"localhost",value:a.host,onChange:a=>c(b=>({...b,host:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-port",children:"Port"}),(0,b.jsx)(P.Input,{id:"conn-port",placeholder:String(D[a.type]),value:a.port,onChange:a=>c(b=>({...b,port:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-database",children:"Database"}),(0,b.jsx)(P.Input,{id:"conn-database",placeholder:"my_database",value:a.database,onChange:a=>c(b=>({...b,database:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-user",children:"Username"}),(0,b.jsx)(P.Input,{id:"conn-user",placeholder:"postgres",value:a.user,onChange:a=>c(b=>({...b,user:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(Q.Label,{htmlFor:"conn-password",children:"Password"}),(0,b.jsx)(P.Input,{id:"conn-password",type:"password",placeholder:"••••••••",value:a.password,onChange:a=>c(b=>({...b,password:a.target.value}))})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("input",{type:"checkbox",id:"conn-ssl",checked:a.ssl,onChange:a=>c(b=>({...b,ssl:a.target.checked})),className:"rounded border-border"}),(0,b.jsx)(Q.Label,{htmlFor:"conn-ssl",className:"text-sm font-normal cursor-pointer",children:"Use SSL"})]})]})}function ac({pendingCsvFiles:a,pendingCsvFileRef:c,onFileSelect:d,onRemove:e,onUpdateTableName:f}){return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)(Q.Label,{className:"text-xs",children:"CSV Files"}),(0,b.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>c.current?.click(),className:"text-xs gap-1 h-7 text-green-400 border-green-400/30 hover:bg-green-400/10",children:[(0,b.jsx)(j.Plus,{className:"h-3 w-3"}),"Add CSV"]}),(0,b.jsx)("input",{ref:c,type:"file",accept:".csv",onChange:d,className:"hidden"})]}),0===a.length?(0,b.jsxs)("div",{onClick:()=>c.current?.click(),className:"rounded-lg border-2 border-dashed p-6 text-center cursor-pointer transition-colors hover:border-green-400/40 hover:bg-green-400/5",children:[(0,b.jsx)(w,{className:"h-6 w-6 text-muted-foreground/40 mx-auto mb-2"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Click to add CSV files — each file becomes a queryable table"})]}):(0,b.jsx)("div",{className:"rounded-lg border divide-y",children:a.map((a,c)=>(0,b.jsxs)("div",{className:"px-3 py-2.5 space-y-1.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(U.FileText,{className:"h-4 w-4 shrink-0 text-green-400/70"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-sm font-medium truncate",children:a.fileName}),(0,b.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:[X(a.fileSize),a.previewRows.length>0&&(0,b.jsxs)(b.Fragment,{children:[" · ",a.previewRows[0]?.length||0," columns"]})]})]}),(0,b.jsx)(h.Button,{variant:"ghost",size:"sm",onClick:()=>e(c),className:"h-7 w-7 p-0 text-destructive hover:text-destructive shrink-0",children:(0,b.jsx)(V.X,{className:"h-3 w-3"})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(Q.Label,{className:"text-[11px] text-muted-foreground shrink-0 w-16",children:"Table name"}),(0,b.jsx)(P.Input,{value:a.tableName,onChange:a=>f(c,a.target.value),className:"h-7 text-xs font-mono"})]})]},c))})]})}function ad({editingId:a,connections:c,onOpenCsvImport:d,onRemoveCsvTable:e,onCloseDialog:f}){let g=c.find(b=>b.id===a),i=g?.csvFiles||[];return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)(Q.Label,{className:"text-xs",children:"Imported CSV Files"}),(0,b.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:()=>{f(),d(a)},className:"text-xs gap-1 h-7 text-green-400 border-green-400/30 hover:bg-green-400/10",children:[(0,b.jsx)(w,{className:"h-3 w-3"}),"Import CSV"]})]}),0===i.length?(0,b.jsxs)("div",{className:"rounded-lg border border-dashed p-4 text-center",children:[(0,b.jsx)(B.FileSpreadsheet,{className:"h-6 w-6 text-muted-foreground/40 mx-auto mb-2"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"No CSV files imported yet"})]}):(0,b.jsx)("div",{className:"rounded-lg border divide-y max-h-64 overflow-y-auto",children:i.map(c=>(0,b.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[(0,b.jsx)(x.Table2,{className:"h-4 w-4 shrink-0 text-green-400/70"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0 overflow-hidden",children:[(0,b.jsx)("p",{className:"text-xs font-medium font-mono truncate",title:c.tableName,children:c.tableName}),(0,b.jsxs)("p",{className:"text-[11px] text-muted-foreground truncate",title:c.fileName,children:[c.fileName,null!=c.rowCount&&` \xb7 ${c.rowCount} rows`]})]}),(0,b.jsx)(h.Button,{variant:"ghost",size:"sm",onClick:()=>e(a,c.tableName),className:"h-7 w-7 p-0 shrink-0 text-destructive hover:text-destructive",children:(0,b.jsx)(z.Trash2,{className:"h-3.5 w-3.5"})})]},c.tableName))})]})}function ae({testResult:a}){return(0,b.jsx)("div",{className:(0,A.cn)("rounded-lg p-3 text-sm flex items-center gap-2",a.success?"bg-green-500/10 text-green-500 border border-green-500/20":"bg-destructive/10 text-destructive border border-destructive/20"),children:a.success?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r.CheckCircle2,{className:"h-4 w-4 shrink-0"}),(0,b.jsxs)("span",{children:["Connected successfully (",a.latencyMs,"ms)"]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(T.XCircle,{className:"h-4 w-4 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:a.error})]})})}function af({previewRows:a,totalLineCount:c}){if(a.length<=1)return null;let d=a[0],e=a.slice(1,6);return(0,b.jsxs)("div",{className:"rounded-lg border overflow-hidden",children:[(0,b.jsx)("div",{className:"overflow-auto max-h-48",children:(0,b.jsxs)("table",{className:"text-xs",children:[(0,b.jsx)("thead",{className:"sticky top-0",children:(0,b.jsx)("tr",{className:"bg-muted/80 border-b",children:d.map((a,c)=>(0,b.jsx)("th",{className:"px-2.5 py-1.5 text-left font-semibold text-foreground whitespace-nowrap text-[11px]",children:a.length>24?a.slice(0,22)+"…":a||`col_${c+1}`},c))})}),(0,b.jsx)("tbody",{children:e.map((a,c)=>(0,b.jsx)("tr",{className:"border-b last:border-0 hover:bg-muted/30",children:d.map((c,d)=>(0,b.jsx)("td",{className:"px-2.5 py-1 text-muted-foreground font-mono text-[11px] whitespace-nowrap max-w-[180px] truncate",children:(a[d]??"").length>30?(a[d]??"").slice(0,28)+"…":a[d]??""},d))},c))})]})}),c&&c>6&&(0,b.jsxs)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground/60 bg-muted/30 border-t text-center",children:["Showing first ",Math.min(a.length-1,5)," rows · full file will be imported"]})]})}function ag({csvImport:a}){let{dialogOpen:c,setDialogOpen:d,tableName:e,setTableName:f,fileName:g,fileSize:i,content:j,previewRows:k,importing:l,fileRef:m,isImportValid:n,handleFileSelect:o,handleImport:q}=a;return(0,b.jsx)(R.Dialog,{open:c,onOpenChange:d,children:(0,b.jsxs)(R.DialogContent,{className:"sm:max-w-xl max-h-[85vh] flex! flex-col! overflow-hidden p-4 sm:p-6",children:[(0,b.jsxs)(R.DialogHeader,{className:"shrink-0",children:[(0,b.jsxs)(R.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)(B.FileSpreadsheet,{className:"h-5 w-5 text-green-400"}),"Import CSV File"]}),(0,b.jsx)(R.DialogDescription,{children:"Each imported CSV becomes a queryable SQL table."})]}),(0,b.jsxs)("div",{className:"space-y-4 py-2 overflow-y-auto flex-1 min-h-0",children:[(0,b.jsx)(ah,{fileRef:m,fileName:g,fileSize:i,previewRows:k,onFileSelect:o}),g&&(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(Q.Label,{htmlFor:"csv-table",className:"text-xs",children:"Table Name"}),(0,b.jsx)(P.Input,{id:"csv-table",placeholder:"e.g. sales_data",value:e,onChange:a=>f(a.target.value),className:"h-9"}),(0,b.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:["SQL table name — you'll query it as"," ",(0,b.jsxs)("code",{className:"bg-muted px-1 rounded",children:["SELECT * FROM ",e||"table_name"]})]})]}),k.length>1&&(0,b.jsxs)("div",{className:"space-y-1.5 min-w-0",children:[(0,b.jsx)(Q.Label,{className:"text-xs",children:"Preview"}),(0,b.jsx)(af,{previewRows:k,totalLineCount:j.split("\n").length})]})]}),(0,b.jsxs)(R.DialogFooter,{className:"shrink-0",children:[(0,b.jsx)(h.Button,{variant:"outline",onClick:()=>d(!1),children:"Cancel"}),(0,b.jsxs)(h.Button,{onClick:q,disabled:!n||l,className:"gap-1.5",children:[l?(0,b.jsx)(p.Loader2,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(w,{className:"h-4 w-4"}),l?"Importing...":"Import"]})]})]})})}function ah({fileRef:a,fileName:c,fileSize:d,previewRows:e,onFileSelect:f}){return(0,b.jsxs)("div",{onClick:()=>a.current?.click(),className:(0,A.cn)("border-2 border-dashed rounded-lg px-4 py-3 cursor-pointer transition-colors","hover:border-primary/50 hover:bg-primary/5",c?"border-green-400/30 bg-green-400/5":"border-border"),children:[(0,b.jsx)("input",{ref:a,type:"file",accept:".csv",onChange:f,className:"hidden"}),c?(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(U.FileText,{className:"h-5 w-5 text-green-400 shrink-0"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-sm font-medium truncate",children:c}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[d>0&&X(d),e.length>1&&(0,b.jsxs)(b.Fragment,{children:[" · ",e[0]?.length||0," columns detected"]})]})]}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:"Change file"})]}):(0,b.jsxs)("div",{className:"flex items-center gap-3 justify-center py-2",children:[(0,b.jsx)(w,{className:"h-5 w-5 text-muted-foreground"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"Click to select a CSV file"})]})]})}function ai(){let{data:a,isLoading:f}=d.api.connection.list.useQuery(),g=d.api.connection.delete.useMutation(),h=d.api.connection.setActive.useMutation(),i=d.api.connection.testExisting.useMutation(),j=d.api.connection.removeCsvTable.useMutation(),k=d.api.useUtils(),l=a?.connections||[],n=a?.activeConnectionId,o=(0,c.useCallback)(()=>{k.connection.list.invalidate()},[k]),p=function({onSaved:a}){let[b,f]=(0,c.useState)(!1),[g,h]=(0,c.useState)(null),[i,j]=(0,c.useState)(E),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(null),[o,p]=(0,c.useState)([]),q=(0,c.useRef)(null),r=d.api.connection.add.useMutation(),s=d.api.connection.update.useMutation(),t=d.api.connection.test.useMutation(),u=d.api.connection.importCsv.useMutation(),v=d.api.useUtils(),w="sqlite"===i.type||"csv"===i.type,x=(0,c.useCallback)(()=>{h(null),j(E),n(null),p([]),f(!0)},[]),y=(0,c.useCallback)(async a=>{h(a),n(null);let b=await v.connection.get.fetch({id:a});if(b.connection){let a=b.connection;j({name:a.name,type:a.type,host:a.host||"",port:String(a.port||0),user:a.user||"",password:a.password||"",database:a.database||"",ssl:a.ssl||!1,filePath:a.filePath||""})}f(!0)},[v]),z=(0,c.useCallback)(a=>{j(b=>({...b,type:a,..."sqlite"===a||"csv"===a?{host:"",port:"0",user:"",password:"",database:"",ssl:!1}:{port:String(D[a]),filePath:""}})),"csv"!==a&&p([])},[]),A=(0,c.useCallback)(async()=>{l(!0),n(null);try{let a=await t.mutateAsync({name:i.name||"Test",type:i.type,host:i.host||"",port:parseInt(i.port)||D[i.type],user:i.user||"",password:i.password||"",database:i.database||"",ssl:i.ssl,filePath:i.filePath||void 0});n(a)}catch(a){n({success:!1,error:a.message||"Connection test failed"})}finally{l(!1)}},[i,t]),B=(0,c.useCallback)(async()=>{try{let b={name:i.name,type:i.type,host:i.host||"",port:parseInt(i.port)||D[i.type],user:i.user||"",password:i.password||"",database:i.database||"",ssl:i.ssl,filePath:i.filePath||void 0};if(g)await s.mutateAsync({id:g,data:b}),e.toast.success("Connection updated");else{let a=await r.mutateAsync(b);if("csv"===i.type&&o.length>0&&a.connection){let b=a.connection.id,c=0;for(let a of o)try{await u.mutateAsync({connectionId:b,csvContent:a.content,tableName:a.tableName,fileName:a.fileName}),c++}catch(b){e.toast.error(`Failed to import ${a.fileName}: ${b.message}`)}e.toast.success(c>0?`Connection created with ${c} CSV file(s) imported`:"Connection added")}else e.toast.success("Connection added");p([])}f(!1),a()}catch(a){e.toast.error(a.message||"Failed to save connection")}},[i,g,r,s,u,o,a]),C=(0,c.useCallback)(a=>{let b=a.target.files?.[0];if(!b)return;let c=Y(b.name),d=new FileReader;d.onload=a=>{let d=a.target?.result||"",e=W(d,4);p(a=>[...a,{fileName:b.name,tableName:c,content:d,fileSize:b.size,previewRows:e}])},d.readAsText(b),q.current&&(q.current.value="")},[]),F=(0,c.useCallback)(a=>{p(b=>b.filter((b,c)=>c!==a))},[]),G=(0,c.useCallback)((a,b)=>{p(c=>c.map((c,d)=>d===a?{...c,tableName:b}:c))},[]),H=!!i.name.trim()&&("sqlite"===i.type?!!i.filePath?.trim():"csv"===i.type?!!g||o.length>0:!!(i.host.trim()&&i.port.trim()&&i.user.trim()&&i.password.trim()&&i.database.trim()));return{dialogOpen:b,setDialogOpen:f,editingId:g,form:i,setForm:j,isLocalType:w,testingConnection:k,testResult:m,pendingCsvFiles:o,pendingCsvFileRef:q,isFormValid:H,isSaving:r.isPending||s.isPending,openAddDialog:x,openEditDialog:y,handleTypeChange:z,handleTestConnection:A,handleSave:B,handlePendingCsvFileSelect:C,removePendingCsvFile:F,updatePendingTableName:G}}({onSaved:o}),q=function({onImported:a}){let[b,f]=(0,c.useState)(!1),[g,h]=(0,c.useState)(null),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(""),[m,n]=(0,c.useState)(""),[o,p]=(0,c.useState)(0),[q,r]=(0,c.useState)([]),[s,t]=(0,c.useState)(!1),u=(0,c.useRef)(null),v=d.api.connection.importCsv.useMutation(),w=(0,c.useCallback)(a=>{h(a),j(""),l(""),n(""),p(0),r([]),f(!0),u.current&&(u.current.value="")},[]),x=(0,c.useCallback)(a=>{let b=a.target.files?.[0];if(!b)return;l(b.name),p(b.size),j(Y(b.name));let c=new FileReader;c.onload=a=>{let b=a.target?.result||"";n(b),r(W(b,6))},c.readAsText(b)},[]),y=(0,c.useCallback)(async()=>{if(g&&m&&i){t(!0);try{let b=await v.mutateAsync({connectionId:g,csvContent:m,tableName:i,fileName:k});e.toast.success(`Imported ${b.rowCount} rows into table "${b.tableName}"`),f(!1),a()}catch(a){e.toast.error(a.message||"Failed to import CSV")}finally{t(!1)}}},[g,m,i,k,v,a]),z=!!(m&&i.trim());return{dialogOpen:b,setDialogOpen:f,tableName:i,setTableName:j,fileName:k,fileSize:o,content:m,previewRows:q,importing:s,fileRef:u,isImportValid:z,openDialog:w,handleFileSelect:x,handleImport:y}}({onImported:o}),r=(0,c.useCallback)(async(a,b)=>{if(confirm(`Delete connection "${b}"? This cannot be undone.`))try{await g.mutateAsync({id:a}),e.toast.success("Connection deleted"),o()}catch(a){e.toast.error(a.message||"Failed to delete connection")}},[g,o]),s=(0,c.useCallback)(async a=>{try{await h.mutateAsync({id:a}),o(),e.toast.success("Active connection updated")}catch(a){e.toast.error(a.message||"Failed to set active connection")}},[h,o]),t=(0,c.useCallback)(async a=>{try{let b=await i.mutateAsync({id:a});b.success?e.toast.success(`Connection successful (${b.latencyMs}ms)`):e.toast.error(`Connection failed: ${b.error}`)}catch(a){e.toast.error(a.message||"Test failed")}},[i]),u=(0,c.useCallback)(async(a,b)=>{if(confirm(`Remove table "${b}"? This will delete the imported data.`))try{await j.mutateAsync({connectionId:a,tableName:b}),e.toast.success(`Table "${b}" removed`),o()}catch(a){e.toast.error(a.message||"Failed to remove table")}},[j,o]);return(0,b.jsxs)("div",{className:"min-h-screen bg-background overflow-x-hidden",children:[(0,b.jsx)(m,{onAddConnection:p.openAddDialog}),(0,b.jsx)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 -mt-4 sm:-mt-8 pb-8 sm:pb-12",children:(0,b.jsx)(N,{connections:l,activeConnectionId:n,isLoading:f,isTestPending:i.isPending,onAdd:p.openAddDialog,onSetActive:s,onTestExisting:t,onEdit:p.openEditDialog,onDelete:r,onImportCsv:q.openDialog})}),(0,b.jsx)(Z,{formHook:p,connections:l,onOpenCsvImport:q.openDialog,onRemoveCsvTable:u}),(0,b.jsx)(ag,{csvImport:q})]})}a.s(["ConnectionsPage",()=>ai],935736)}];
2
2
 
3
3
  //# sourceMappingURL=src_components_connections_connections-page_tsx_a8fa3df0._.js.map
@@ -1,4 +1,4 @@
1
- module.exports=[845158,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(50944),e=a.i(833039);a.i(397133);var f=a.i(906118);let g=new WeakMap;var h=a.i(101880),i=a.i(823292),j=a.i(699570),k=a.i(591119),l=a.i(220494),m=a.i(915618);let n=(0,f.atom)({connections:[],activeConnectionId:null});var o=a.i(238246),p=a.i(870430),q=a.i(580701),r=a.i(400210),s=a.i(953722),t=a.i(669520),u=a.i(596221),v=a.i(883706);let w=(0,v.default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]),x=(0,v.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var y=a.i(808406);let z=(0,v.default)("cable",[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]]);function A({selectedConnectionId:a,entryCount:c,isRegenerating:f,onConnectionChange:g,onAddEntry:h,onGenerateFromText:i,onAutoGenerate:k,onRegenerateEmbeddings:v}){let A=(0,d.useRouter)(),{connections:B}=(0,e.useAtomValue)(n);return(0,b.jsx)("header",{className:"border-b border-border/40 bg-background/80 backdrop-blur sticky top-0 z-10",children:(0,b.jsxs)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-4 space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)(j.Button,{variant:"ghost",size:"sm",onClick:()=>A.push("/"),className:"gap-1.5",children:[(0,b.jsx)(r.ArrowLeft,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Back to Chat"})]}),(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsx)("h1",{className:"text-sm font-semibold",children:"CLAY"})]}),(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("h2",{className:"text-xl sm:text-2xl font-bold tracking-tight flex items-center gap-2",children:[(0,b.jsx)(s.BookOpen,{className:"h-5 w-5 sm:h-6 sm:w-6"}),"Knowledge Base"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Add context about your database to help AI write better queries."})]}),B.length>0&&(0,b.jsxs)("div",{className:"flex items-center gap-2 flex-wrap shrink-0",children:[(0,b.jsx)(j.Button,{asChild:!0,variant:"outline",size:"sm",className:"gap-1.5 text-xs",children:(0,b.jsxs)(o.default,{href:"/connections",children:[(0,b.jsx)(z,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Connections"})]})}),(0,b.jsx)(j.Button,{asChild:!0,variant:"outline",size:"sm",className:"gap-1.5 text-xs",children:(0,b.jsxs)(o.default,{href:"/ai-providers",children:[(0,b.jsx)(y.Sparkles,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"AI Providers"})]})}),(0,b.jsxs)(j.Button,{variant:"outline",size:"sm",onClick:k,disabled:!a,className:"gap-1.5 text-xs",children:[(0,b.jsx)(x,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Auto"})," Generate"]}),(0,b.jsxs)(j.Button,{variant:"outline",size:"sm",onClick:i,disabled:!a,className:"gap-1.5 text-xs",children:[(0,b.jsx)(w,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"From"})," Text"]}),c>0&&(0,b.jsxs)(j.Button,{variant:"outline",size:"sm",onClick:v,disabled:!a||f,className:"gap-1.5 text-xs",title:"Regenerate vector embeddings for semantic search",children:[f?(0,b.jsx)(u.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(t.RefreshCw,{className:"h-3.5 w-3.5"}),"Rebuild"]}),(0,b.jsxs)(j.Button,{size:"sm",onClick:h,disabled:!a,className:"gap-1.5",children:[(0,b.jsx)(m.Plus,{className:"h-4 w-4"}),"Add"]})]})]}),B.length>0&&(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(p.Label,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Connection:"}),(0,b.jsxs)(q.Select,{value:a,onValueChange:g,children:[(0,b.jsx)(q.SelectTrigger,{className:"w-full sm:w-[280px]",children:(0,b.jsx)(q.SelectValue,{placeholder:"Select a connection"})}),(0,b.jsx)(q.SelectContent,{children:B.map(a=>(0,b.jsx)(q.SelectItem,{value:a.id,children:(0,b.jsxs)("span",{className:"flex items-center gap-2",children:[(0,b.jsx)(l.Database,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.name,(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",a.type,")"]})]})},a.id))})]})]})]})})}var B=a.i(866718),C=a.i(786304),D=a.i(875083),E=a.i(587532),F=a.i(546842),G=a.i(781560);function H({searchQuery:a,onSearchChange:c,activeTab:d,onTabChange:e,totalCount:f,humanCount:g,aiCount:h,onClear:i,isClearing:k}){let l="human"===d?g:"ai"===d?h:f;return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(E.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,b.jsx)(B.Input,{placeholder:"Search knowledge base...",value:a,onChange:a=>c(a.target.value),className:"pl-9"})]}),(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[(0,b.jsx)(D.Tabs,{value:d,onValueChange:e,children:(0,b.jsxs)(D.TabsList,{className:"w-full sm:w-auto",children:[(0,b.jsxs)(D.TabsTrigger,{value:"all",className:"gap-1 sm:gap-1.5 flex-1 sm:flex-initial text-xs sm:text-sm",children:["All",(0,b.jsx)(C.Badge,{variant:"secondary",className:"text-[10px] px-1.5 h-4",children:f})]}),(0,b.jsxs)(D.TabsTrigger,{value:"human",className:"gap-1 sm:gap-1.5 flex-1 sm:flex-initial text-xs sm:text-sm",children:[(0,b.jsx)(F.User,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"hidden xs:inline",children:"Human"}),(0,b.jsx)(C.Badge,{variant:"secondary",className:"text-[10px] px-1.5 h-4",children:g})]}),(0,b.jsxs)(D.TabsTrigger,{value:"ai",className:"gap-1 sm:gap-1.5 flex-1 sm:flex-initial text-xs sm:text-sm",children:[(0,b.jsx)(y.Sparkles,{className:"h-3.5 w-3.5"}),"AI",(0,b.jsx)(C.Badge,{variant:"secondary",className:"text-[10px] px-1.5 h-4",children:h})]})]})}),l>0&&(0,b.jsxs)(j.Button,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive hover:bg-destructive/10 gap-1.5 h-8 text-xs self-end sm:self-auto",onClick:i,disabled:k,children:[(0,b.jsx)(G.Trash2,{className:"h-3.5 w-3.5"}),"human"===d?"Clear Human":"ai"===d?"Clear AI":"Clear All"]})]})]})}let I=(0,v.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var J=a.i(111989),J=J,K=a.i(699464),L=a.i(368114);function M({entry:a,onEdit:c,onDelete:d}){let e="ai_generated"===a.source;return(0,b.jsxs)(k.Card,{className:"transition-all hover:border-border/80 group",children:[(0,b.jsx)(k.CardHeader,{className:"p-4 sm:p-6 pb-2 sm:pb-2",children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2 sm:gap-3",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,b.jsxs)(C.Badge,{variant:"outline",className:(0,L.cn)("text-[10px] gap-1 shrink-0","ai_generated"===a.source?"text-purple-400 bg-purple-400/10 border-purple-400/20":"text-zinc-400 bg-zinc-400/10 border-zinc-400/20"),children:[e?(0,b.jsx)(y.Sparkles,{className:"h-3 w-3"}):(0,b.jsx)(F.User,{className:"h-3 w-3"}),e?"AI":"Human"]})}),(0,b.jsx)(k.CardTitle,{className:"text-sm font-medium wrap-break-word",children:a.title})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"sm",onClick:()=>c(a),className:"h-7 w-7 p-0",children:(0,b.jsx)(K.Pencil,{className:"h-3 w-3"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"sm",onClick:()=>d(a.pubId,a.title),className:"h-7 w-7 p-0 text-destructive hover:text-destructive",children:(0,b.jsx)(G.Trash2,{className:"h-3 w-3"})})]})]})}),(0,b.jsxs)(k.CardContent,{className:"p-4 sm:p-6 pt-0 sm:pt-0",children:[(0,b.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground whitespace-pre-wrap line-clamp-3 sm:line-clamp-4",children:a.content}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground/60 mt-2",children:new Date(a.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})})]})]})}function N({entries:a,isLoading:d,searchQuery:e,onEdit:f,onDelete:g,onAddFirst:h}){let[i,l]=(0,c.useState)(1),n=Math.max(1,Math.ceil(a.length/10));(0,c.useEffect)(()=>{l(1)},[a.length,e]),(0,c.useEffect)(()=>{i>n&&l(n)},[i,n]);let o=(0,c.useMemo)(()=>{let b=(i-1)*10;return a.slice(b,b+10)},[a,i]);return d?(0,b.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,b.jsx)(u.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):0===a.length?(0,b.jsx)(k.Card,{className:"border-dashed",children:(0,b.jsxs)(k.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,b.jsx)("div",{className:"rounded-full bg-muted p-4 mb-4",children:(0,b.jsx)(s.BookOpen,{className:"h-8 w-8 text-muted-foreground"})}),(0,b.jsx)("h3",{className:"text-lg font-semibold mb-1",children:e?"No results found":"No knowledge entries yet"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-6 text-center max-w-sm",children:e?"Try a different search query.":"Add knowledge about your database to help AI understand your schema, business logic, and conventions."}),!e&&(0,b.jsxs)(j.Button,{onClick:h,className:"gap-1.5",children:[(0,b.jsx)(m.Plus,{className:"h-4 w-4"}),"Add First Entry"]})]})}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("div",{className:"space-y-3",children:o.map(a=>(0,b.jsx)(M,{entry:a,onEdit:f,onDelete:g},a.pubId))}),n>1&&(0,b.jsx)(O,{currentPage:i,totalPages:n,totalEntries:a.length,onPageChange:l})]})}function O({currentPage:a,totalPages:d,totalEntries:e,onPageChange:f}){let g=(0,c.useMemo)(()=>(function(a,b){if(b<=7)return Array.from({length:b},(a,b)=>b+1);let c=[],d=Math.max(2,a-1),e=Math.min(b-1,a+1);c.push(1),d>2&&c.push("...");for(let a=d;a<=e;a++)c.push(a);return e<b-1&&c.push("..."),c.push(b),c})(a,d),[a,d]),h=(a-1)*10+1,i=Math.min(10*a,e);return(0,b.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[h,"–",i," of ",e]}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsx)(j.Button,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",disabled:1===a,onClick:()=>f(a-1),children:(0,b.jsx)(I,{className:"h-4 w-4"})}),g.map((c,d)=>"..."===c?(0,b.jsx)("span",{className:"px-1 text-xs text-muted-foreground select-none",children:"..."},`ellipsis-${d}`):(0,b.jsx)(j.Button,{variant:c===a?"default":"outline",size:"sm",className:(0,L.cn)("h-8 w-8 p-0 text-xs",c===a&&"pointer-events-none"),onClick:()=>f(c),children:c},c)),(0,b.jsx)(j.Button,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",disabled:a===d,onClick:()=>f(a+1),children:(0,b.jsx)(J.default,{className:"h-4 w-4"})})]})]})}var P=a.i(429246),Q=a.i(814574);function R({open:a,onOpenChange:c,editingPubId:d,form:e,onFormChange:f,isFormValid:g,isSaving:h,onSave:i}){return(0,b.jsx)(Q.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(Q.DialogContent,{className:"sm:max-w-lg max-h-[85vh] flex! flex-col! p-4 sm:p-6",children:[(0,b.jsxs)(Q.DialogHeader,{className:"shrink-0",children:[(0,b.jsx)(Q.DialogTitle,{children:d?"Edit Knowledge Entry":"Add Knowledge Entry"}),(0,b.jsx)(Q.DialogDescription,{children:d?"Update this knowledge entry.":"Add context about your database to improve AI query accuracy."})]}),(0,b.jsxs)("div",{className:"space-y-4 py-2 overflow-y-auto flex-1 min-h-0",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(p.Label,{htmlFor:"kb-title",children:"Title"}),(0,b.jsx)(B.Input,{id:"kb-title",placeholder:"e.g. User status enum values, Revenue calculation logic",value:e.title,onChange:a=>f(b=>({...b,title:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(p.Label,{htmlFor:"kb-content",children:"Content"}),(0,b.jsx)(P.Textarea,{id:"kb-content",placeholder:`Describe the knowledge here. For example:
1
+ module.exports=[845158,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(50944),e=a.i(833039);a.i(397133);var f=a.i(906118);let g=new WeakMap;var h=a.i(101880),i=a.i(823292),j=a.i(699570),k=a.i(591119),l=a.i(220494),m=a.i(915618);let n=(0,f.atom)({connections:[],activeConnectionId:null});var o=a.i(238246),p=a.i(870430),q=a.i(580701),r=a.i(400210),s=a.i(953722),t=a.i(669520),u=a.i(596221),v=a.i(883706);let w=(0,v.default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]),x=(0,v.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var y=a.i(808406);let z=(0,v.default)("cable",[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]]);function A({selectedConnectionId:a,entryCount:c,isRegenerating:f,onConnectionChange:g,onAddEntry:h,onGenerateFromText:i,onAutoGenerate:k,onRegenerateEmbeddings:v}){let A=(0,d.useRouter)(),{connections:B}=(0,e.useAtomValue)(n);return(0,b.jsx)("header",{className:"border-b border-border/40 bg-background/80 backdrop-blur sticky top-0 z-10",children:(0,b.jsxs)("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 py-4 space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)(j.Button,{variant:"ghost",size:"sm",onClick:()=>A.push("/"),className:"gap-1.5",children:[(0,b.jsx)(r.ArrowLeft,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Back to Chat"})]}),(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsx)("h1",{className:"text-sm font-semibold uppercase tracking-wider",children:"SQLBOT"})]}),(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("h2",{className:"text-xl sm:text-2xl font-bold tracking-tight flex items-center gap-2",children:[(0,b.jsx)(s.BookOpen,{className:"h-5 w-5 sm:h-6 sm:w-6"}),"Knowledge Base"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Add context about your database to help AI write better queries."})]}),B.length>0&&(0,b.jsxs)("div",{className:"flex items-center gap-2 flex-wrap shrink-0",children:[(0,b.jsx)(j.Button,{asChild:!0,variant:"outline",size:"sm",className:"gap-1.5 text-xs",children:(0,b.jsxs)(o.default,{href:"/connections",children:[(0,b.jsx)(z,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Connections"})]})}),(0,b.jsx)(j.Button,{asChild:!0,variant:"outline",size:"sm",className:"gap-1.5 text-xs",children:(0,b.jsxs)(o.default,{href:"/ai-providers",children:[(0,b.jsx)(y.Sparkles,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"AI Providers"})]})}),(0,b.jsxs)(j.Button,{variant:"outline",size:"sm",onClick:k,disabled:!a,className:"gap-1.5 text-xs",children:[(0,b.jsx)(x,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"Auto"})," Generate"]}),(0,b.jsxs)(j.Button,{variant:"outline",size:"sm",onClick:i,disabled:!a,className:"gap-1.5 text-xs",children:[(0,b.jsx)(w,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:"From"})," Text"]}),c>0&&(0,b.jsxs)(j.Button,{variant:"outline",size:"sm",onClick:v,disabled:!a||f,className:"gap-1.5 text-xs",title:"Regenerate vector embeddings for semantic search",children:[f?(0,b.jsx)(u.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(t.RefreshCw,{className:"h-3.5 w-3.5"}),"Rebuild"]}),(0,b.jsxs)(j.Button,{size:"sm",onClick:h,disabled:!a,className:"gap-1.5",children:[(0,b.jsx)(m.Plus,{className:"h-4 w-4"}),"Add"]})]})]}),B.length>0&&(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(p.Label,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Connection:"}),(0,b.jsxs)(q.Select,{value:a,onValueChange:g,children:[(0,b.jsx)(q.SelectTrigger,{className:"w-full sm:w-[280px]",children:(0,b.jsx)(q.SelectValue,{placeholder:"Select a connection"})}),(0,b.jsx)(q.SelectContent,{children:B.map(a=>(0,b.jsx)(q.SelectItem,{value:a.id,children:(0,b.jsxs)("span",{className:"flex items-center gap-2",children:[(0,b.jsx)(l.Database,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.name,(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",a.type,")"]})]})},a.id))})]})]})]})})}var B=a.i(866718),C=a.i(786304),D=a.i(875083),E=a.i(587532),F=a.i(546842),G=a.i(781560);function H({searchQuery:a,onSearchChange:c,activeTab:d,onTabChange:e,totalCount:f,humanCount:g,aiCount:h,onClear:i,isClearing:k}){let l="human"===d?g:"ai"===d?h:f;return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(E.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,b.jsx)(B.Input,{placeholder:"Search knowledge base...",value:a,onChange:a=>c(a.target.value),className:"pl-9"})]}),(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[(0,b.jsx)(D.Tabs,{value:d,onValueChange:e,children:(0,b.jsxs)(D.TabsList,{className:"w-full sm:w-auto",children:[(0,b.jsxs)(D.TabsTrigger,{value:"all",className:"gap-1 sm:gap-1.5 flex-1 sm:flex-initial text-xs sm:text-sm",children:["All",(0,b.jsx)(C.Badge,{variant:"secondary",className:"text-[10px] px-1.5 h-4",children:f})]}),(0,b.jsxs)(D.TabsTrigger,{value:"human",className:"gap-1 sm:gap-1.5 flex-1 sm:flex-initial text-xs sm:text-sm",children:[(0,b.jsx)(F.User,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"hidden xs:inline",children:"Human"}),(0,b.jsx)(C.Badge,{variant:"secondary",className:"text-[10px] px-1.5 h-4",children:g})]}),(0,b.jsxs)(D.TabsTrigger,{value:"ai",className:"gap-1 sm:gap-1.5 flex-1 sm:flex-initial text-xs sm:text-sm",children:[(0,b.jsx)(y.Sparkles,{className:"h-3.5 w-3.5"}),"AI",(0,b.jsx)(C.Badge,{variant:"secondary",className:"text-[10px] px-1.5 h-4",children:h})]})]})}),l>0&&(0,b.jsxs)(j.Button,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive hover:bg-destructive/10 gap-1.5 h-8 text-xs self-end sm:self-auto",onClick:i,disabled:k,children:[(0,b.jsx)(G.Trash2,{className:"h-3.5 w-3.5"}),"human"===d?"Clear Human":"ai"===d?"Clear AI":"Clear All"]})]})]})}let I=(0,v.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var J=a.i(111989),J=J,K=a.i(699464),L=a.i(368114);function M({entry:a,onEdit:c,onDelete:d}){let e="ai_generated"===a.source;return(0,b.jsxs)(k.Card,{className:"transition-all hover:border-border/80 group",children:[(0,b.jsx)(k.CardHeader,{className:"p-4 sm:p-6 pb-2 sm:pb-2",children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2 sm:gap-3",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,b.jsxs)(C.Badge,{variant:"outline",className:(0,L.cn)("text-[10px] gap-1 shrink-0","ai_generated"===a.source?"text-purple-400 bg-purple-400/10 border-purple-400/20":"text-zinc-400 bg-zinc-400/10 border-zinc-400/20"),children:[e?(0,b.jsx)(y.Sparkles,{className:"h-3 w-3"}):(0,b.jsx)(F.User,{className:"h-3 w-3"}),e?"AI":"Human"]})}),(0,b.jsx)(k.CardTitle,{className:"text-sm font-medium wrap-break-word",children:a.title})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(j.Button,{variant:"ghost",size:"sm",onClick:()=>c(a),className:"h-7 w-7 p-0",children:(0,b.jsx)(K.Pencil,{className:"h-3 w-3"})}),(0,b.jsx)(j.Button,{variant:"ghost",size:"sm",onClick:()=>d(a.pubId,a.title),className:"h-7 w-7 p-0 text-destructive hover:text-destructive",children:(0,b.jsx)(G.Trash2,{className:"h-3 w-3"})})]})]})}),(0,b.jsxs)(k.CardContent,{className:"p-4 sm:p-6 pt-0 sm:pt-0",children:[(0,b.jsx)("p",{className:"text-xs sm:text-sm text-muted-foreground whitespace-pre-wrap line-clamp-3 sm:line-clamp-4",children:a.content}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground/60 mt-2",children:new Date(a.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})})]})]})}function N({entries:a,isLoading:d,searchQuery:e,onEdit:f,onDelete:g,onAddFirst:h}){let[i,l]=(0,c.useState)(1),n=Math.max(1,Math.ceil(a.length/10));(0,c.useEffect)(()=>{l(1)},[a.length,e]),(0,c.useEffect)(()=>{i>n&&l(n)},[i,n]);let o=(0,c.useMemo)(()=>{let b=(i-1)*10;return a.slice(b,b+10)},[a,i]);return d?(0,b.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,b.jsx)(u.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):0===a.length?(0,b.jsx)(k.Card,{className:"border-dashed",children:(0,b.jsxs)(k.CardContent,{className:"flex flex-col items-center justify-center py-16",children:[(0,b.jsx)("div",{className:"rounded-full bg-muted p-4 mb-4",children:(0,b.jsx)(s.BookOpen,{className:"h-8 w-8 text-muted-foreground"})}),(0,b.jsx)("h3",{className:"text-lg font-semibold mb-1",children:e?"No results found":"No knowledge entries yet"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-6 text-center max-w-sm",children:e?"Try a different search query.":"Add knowledge about your database to help AI understand your schema, business logic, and conventions."}),!e&&(0,b.jsxs)(j.Button,{onClick:h,className:"gap-1.5",children:[(0,b.jsx)(m.Plus,{className:"h-4 w-4"}),"Add First Entry"]})]})}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("div",{className:"space-y-3",children:o.map(a=>(0,b.jsx)(M,{entry:a,onEdit:f,onDelete:g},a.pubId))}),n>1&&(0,b.jsx)(O,{currentPage:i,totalPages:n,totalEntries:a.length,onPageChange:l})]})}function O({currentPage:a,totalPages:d,totalEntries:e,onPageChange:f}){let g=(0,c.useMemo)(()=>(function(a,b){if(b<=7)return Array.from({length:b},(a,b)=>b+1);let c=[],d=Math.max(2,a-1),e=Math.min(b-1,a+1);c.push(1),d>2&&c.push("...");for(let a=d;a<=e;a++)c.push(a);return e<b-1&&c.push("..."),c.push(b),c})(a,d),[a,d]),h=(a-1)*10+1,i=Math.min(10*a,e);return(0,b.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[h,"–",i," of ",e]}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsx)(j.Button,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",disabled:1===a,onClick:()=>f(a-1),children:(0,b.jsx)(I,{className:"h-4 w-4"})}),g.map((c,d)=>"..."===c?(0,b.jsx)("span",{className:"px-1 text-xs text-muted-foreground select-none",children:"..."},`ellipsis-${d}`):(0,b.jsx)(j.Button,{variant:c===a?"default":"outline",size:"sm",className:(0,L.cn)("h-8 w-8 p-0 text-xs",c===a&&"pointer-events-none"),onClick:()=>f(c),children:c},c)),(0,b.jsx)(j.Button,{variant:"outline",size:"sm",className:"h-8 w-8 p-0",disabled:a===d,onClick:()=>f(a+1),children:(0,b.jsx)(J.default,{className:"h-4 w-4"})})]})]})}var P=a.i(429246),Q=a.i(814574);function R({open:a,onOpenChange:c,editingPubId:d,form:e,onFormChange:f,isFormValid:g,isSaving:h,onSave:i}){return(0,b.jsx)(Q.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(Q.DialogContent,{className:"sm:max-w-lg max-h-[85vh] flex! flex-col! p-4 sm:p-6",children:[(0,b.jsxs)(Q.DialogHeader,{className:"shrink-0",children:[(0,b.jsx)(Q.DialogTitle,{children:d?"Edit Knowledge Entry":"Add Knowledge Entry"}),(0,b.jsx)(Q.DialogDescription,{children:d?"Update this knowledge entry.":"Add context about your database to improve AI query accuracy."})]}),(0,b.jsxs)("div",{className:"space-y-4 py-2 overflow-y-auto flex-1 min-h-0",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(p.Label,{htmlFor:"kb-title",children:"Title"}),(0,b.jsx)(B.Input,{id:"kb-title",placeholder:"e.g. User status enum values, Revenue calculation logic",value:e.title,onChange:a=>f(b=>({...b,title:a.target.value}))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(p.Label,{htmlFor:"kb-content",children:"Content"}),(0,b.jsx)(P.Textarea,{id:"kb-content",placeholder:`Describe the knowledge here. For example:
2
2
 
3
3
  - Column descriptions and their meanings
4
4
  - Business logic and rules
@@ -1 +1 @@
1
- <!DOCTYPE html><!--H1e0tcZUy_dcOaNBJh3iW--><html lang="en" class="dark"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/2473c16c0c2f6b5f.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/chunks/3799f4ad1dc31445.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/124bc670aadbcaaa.js"/><script src="/_next/static/chunks/e49035715a3b468c.js" async=""></script><script src="/_next/static/chunks/8b181cdae656a3a3.js" async=""></script><script src="/_next/static/chunks/ee4ef5db2df5a4d4.js" async=""></script><script src="/_next/static/chunks/3d40e553ae400c39.js" async=""></script><script src="/_next/static/chunks/turbopack-e0f8f63596dbdf82.js" async=""></script><script src="/_next/static/chunks/8d7447b91a6a2b1d.js" async=""></script><script src="/_next/static/chunks/44306e436a72cf18.js" async=""></script><script src="/_next/static/chunks/d96012bcfc98706a.js" async=""></script><script src="/_next/static/chunks/d80b3790a119a285.js" async=""></script><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><title>CLAY</title><meta name="description" content="Ask questions about your database in natural language"/><link rel="icon" href="/favicon.ico?favicon.0b3bf435.ico" sizes="256x256" type="image/x-icon"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="geist_a71539c9-module__T19VSG__variable geist_mono_8d43a2aa-module__8Li5zG__variable antialiased"><div hidden=""><!--$--><!--/$--></div><style>#nprogress{pointer-events:none}#nprogress .bar{background:var(--primary);position:fixed;z-index:1600;top: 0;left:0;width:100%;height:3px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px var(--primary),0 0 5px var(--primary);opacity:1;-webkit-transform:rotate(3deg) translate(0px,-4px);-ms-transform:rotate(3deg) translate(0px,-4px);transform:rotate(3deg) translate(0px,-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1600;top: 15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;box-sizing:border-box;border:2px solid transparent;border-top-color:var(--primary);border-left-color:var(--primary);border-radius:50%;-webkit-animation:nprogress-spinner 400ms linear infinite;animation:nprogress-spinner 400ms linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@-webkit-keyframes nprogress-spinner{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes nprogress-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}</style><noscript><div class="fixed top-0 left-0 w-full bg-orange-500 text-foreground p-4 text-center z-1000">JavaScript is disabled in your browser. Please enable JavaScript to use all features of this application.</div></noscript><!--$--><!--/$--><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><section aria-label="Notifications alt+T" tabindex="-1" aria-live="polite" aria-relevant="additions text" aria-atomic="false"></section><script src="/_next/static/chunks/124bc670aadbcaaa.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[818421,[\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"/_next/static/chunks/44306e436a72cf18.js\"],\"default\"]\n4:I[12985,[\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"/_next/static/chunks/44306e436a72cf18.js\"],\"NuqsAdapter\"]\n5:I[289062,[\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"/_next/static/chunks/44306e436a72cf18.js\"],\"JotaiProvider\"]\n6:I[874998,[\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"/_next/static/chunks/44306e436a72cf18.js\"],\"TRPCProvider\"]\n7:I[339756,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n8:I[837457,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n9:I[846696,[\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"/_next/static/chunks/44306e436a72cf18.js\"],\"Toaster\"]\na:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"OutletBoundary\"]\nb:\"$Sreact.suspense\"\nd:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"ViewportBoundary\"]\nf:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"MetadataBoundary\"]\n11:I[168027,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n:HL[\"/_next/static/chunks/2473c16c0c2f6b5f.css\",\"style\"]\n:HL[\"/_next/static/chunks/3799f4ad1dc31445.css\",\"style\"]\n3:[\"$\",\"div\",null,{\"className\":\"fixed top-0 left-0 w-full bg-orange-500 text-foreground p-4 text-center z-1000\",\"children\":\"JavaScript is disabled in your browser. Please enable JavaScript to use all features of this application.\"}]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"H1e0tcZUy-dcOaNBJh3iW\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/2473c16c0c2f6b5f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/3799f4ad1dc31445.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/44306e436a72cf18.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"className\":\"dark\",\"children\":[\"$\",\"body\",null,{\"className\":\"geist_a71539c9-module__T19VSG__variable geist_mono_8d43a2aa-module__8Li5zG__variable antialiased\",\"children\":[[\"$\",\"$L2\",null,{\"showSpinner\":false,\"color\":\"var(--primary)\"}],[\"$\",\"noscript\",null,{\"children\":\"$3\"}],[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$L5\",null,{\"children\":[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$L7\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L8\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]}]}],[\"$\",\"$L9\",null,{\"richColors\":true,\"position\":\"top-center\"}]]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L7\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L8\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:2:props:children:props:children:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:2:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:2:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:2:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$La\",null,{\"children\":[\"$\",\"$b\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@c\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$Ld\",null,{\"children\":\"$@e\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lf\",null,{\"children\":[\"$\",\"$b\",null,{\"name\":\"Next.Metadata\",\"children\":\"$@10\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$11\",\"$undefined\"],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"e:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"12:I[27201,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"IconMark\"]\n10:[[\"$\",\"title\",\"0\",{\"children\":\"CLAY\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Ask questions about your database in natural language\"}],[\"$\",\"link\",\"2\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?favicon.0b3bf435.ico\",\"sizes\":\"256x256\",\"type\":\"image/x-icon\"}],[\"$\",\"$L12\",\"3\",{}]]\nc:null\n"])</script></body></html>
1
+ <!DOCTYPE html><!--MtWdFBWYBrNNpdc_evjbH--><html lang="en" class="dark"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/2473c16c0c2f6b5f.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/chunks/3799f4ad1dc31445.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/124bc670aadbcaaa.js"/><script src="/_next/static/chunks/e49035715a3b468c.js" async=""></script><script src="/_next/static/chunks/8b181cdae656a3a3.js" async=""></script><script src="/_next/static/chunks/ee4ef5db2df5a4d4.js" async=""></script><script src="/_next/static/chunks/3d40e553ae400c39.js" async=""></script><script src="/_next/static/chunks/turbopack-e0f8f63596dbdf82.js" async=""></script><script src="/_next/static/chunks/8d7447b91a6a2b1d.js" async=""></script><script src="/_next/static/chunks/44306e436a72cf18.js" async=""></script><script src="/_next/static/chunks/d96012bcfc98706a.js" async=""></script><script src="/_next/static/chunks/d80b3790a119a285.js" async=""></script><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><title>SQLBOT</title><meta name="description" content="Ask questions about your database in natural language"/><link rel="icon" href="/favicon.ico?favicon.0b3bf435.ico" sizes="256x256" type="image/x-icon"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="geist_a71539c9-module__T19VSG__variable geist_mono_8d43a2aa-module__8Li5zG__variable antialiased"><div hidden=""><!--$--><!--/$--></div><style>#nprogress{pointer-events:none}#nprogress .bar{background:var(--primary);position:fixed;z-index:1600;top: 0;left:0;width:100%;height:3px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px var(--primary),0 0 5px var(--primary);opacity:1;-webkit-transform:rotate(3deg) translate(0px,-4px);-ms-transform:rotate(3deg) translate(0px,-4px);transform:rotate(3deg) translate(0px,-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1600;top: 15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;box-sizing:border-box;border:2px solid transparent;border-top-color:var(--primary);border-left-color:var(--primary);border-radius:50%;-webkit-animation:nprogress-spinner 400ms linear infinite;animation:nprogress-spinner 400ms linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@-webkit-keyframes nprogress-spinner{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes nprogress-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}</style><noscript><div class="fixed top-0 left-0 w-full bg-orange-500 text-foreground p-4 text-center z-1000">JavaScript is disabled in your browser. Please enable JavaScript to use all features of this application.</div></noscript><!--$--><!--/$--><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><section aria-label="Notifications alt+T" tabindex="-1" aria-live="polite" aria-relevant="additions text" aria-atomic="false"></section><script src="/_next/static/chunks/124bc670aadbcaaa.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[818421,[\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"/_next/static/chunks/44306e436a72cf18.js\"],\"default\"]\n4:I[12985,[\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"/_next/static/chunks/44306e436a72cf18.js\"],\"NuqsAdapter\"]\n5:I[289062,[\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"/_next/static/chunks/44306e436a72cf18.js\"],\"JotaiProvider\"]\n6:I[874998,[\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"/_next/static/chunks/44306e436a72cf18.js\"],\"TRPCProvider\"]\n7:I[339756,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n8:I[837457,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n9:I[846696,[\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"/_next/static/chunks/44306e436a72cf18.js\"],\"Toaster\"]\na:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"OutletBoundary\"]\nb:\"$Sreact.suspense\"\nd:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"ViewportBoundary\"]\nf:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"MetadataBoundary\"]\n11:I[168027,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n:HL[\"/_next/static/chunks/2473c16c0c2f6b5f.css\",\"style\"]\n:HL[\"/_next/static/chunks/3799f4ad1dc31445.css\",\"style\"]\n3:[\"$\",\"div\",null,{\"className\":\"fixed top-0 left-0 w-full bg-orange-500 text-foreground p-4 text-center z-1000\",\"children\":\"JavaScript is disabled in your browser. Please enable JavaScript to use all features of this application.\"}]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"MtWdFBWYBrNNpdc-evjbH\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/2473c16c0c2f6b5f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/3799f4ad1dc31445.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/8d7447b91a6a2b1d.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/44306e436a72cf18.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"className\":\"dark\",\"children\":[\"$\",\"body\",null,{\"className\":\"geist_a71539c9-module__T19VSG__variable geist_mono_8d43a2aa-module__8Li5zG__variable antialiased\",\"children\":[[\"$\",\"$L2\",null,{\"showSpinner\":false,\"color\":\"var(--primary)\"}],[\"$\",\"noscript\",null,{\"children\":\"$3\"}],[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$L5\",null,{\"children\":[\"$\",\"$L6\",null,{\"children\":[\"$\",\"$L7\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L8\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]}]}],[\"$\",\"$L9\",null,{\"richColors\":true,\"position\":\"top-center\"}]]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L7\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L8\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:2:props:children:props:children:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:2:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:2:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:2:props:children:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$La\",null,{\"children\":[\"$\",\"$b\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@c\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$Ld\",null,{\"children\":\"$@e\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lf\",null,{\"children\":[\"$\",\"$b\",null,{\"name\":\"Next.Metadata\",\"children\":\"$@10\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$11\",\"$undefined\"],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"e:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"12:I[27201,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"IconMark\"]\n10:[[\"$\",\"title\",\"0\",{\"children\":\"SQLBOT\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Ask questions about your database in natural language\"}],[\"$\",\"link\",\"2\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?favicon.0b3bf435.ico\",\"sizes\":\"256x256\",\"type\":\"image/x-icon\"}],[\"$\",\"$L12\",\"3\",{}]]\nc:null\n"])</script></body></html>
@@ -1,2 +1,2 @@
1
- <!DOCTYPE html><!--H1e0tcZUy_dcOaNBJh3iW--><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/124bc670aadbcaaa.js"/><script src="/_next/static/chunks/e49035715a3b468c.js" async=""></script><script src="/_next/static/chunks/8b181cdae656a3a3.js" async=""></script><script src="/_next/static/chunks/ee4ef5db2df5a4d4.js" async=""></script><script src="/_next/static/chunks/3d40e553ae400c39.js" async=""></script><script src="/_next/static/chunks/turbopack-e0f8f63596dbdf82.js" async=""></script><script src="/_next/static/chunks/d96012bcfc98706a.js" async=""></script><script src="/_next/static/chunks/d80b3790a119a285.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: Internal Server Error.</title><link rel="icon" href="/favicon.ico?favicon.0b3bf435.ico" sizes="256x256" type="image/x-icon"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}
2
- @media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/124bc670aadbcaaa.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[339756,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n3:I[837457,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n4:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"ViewportBoundary\"]\n9:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"MetadataBoundary\"]\nb:I[168027,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"H1e0tcZUy-dcOaNBJh3iW\",\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"title\",null,{\"children\":\"500: Internal Server Error.\"}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"lineHeight\":\"48px\"},\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}\\n@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"paddingRight\":23,\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\"},\"children\":\"500\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"28px\"},\"children\":\"Internal Server Error.\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L7\",null,{\"children\":\"$@8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$@a\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"c:I[27201,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"IconMark\"]\na:[[\"$\",\"link\",\"0\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?favicon.0b3bf435.ico\",\"sizes\":\"256x256\",\"type\":\"image/x-icon\"}],[\"$\",\"$Lc\",\"1\",{}]]\n6:null\n"])</script></body></html>
1
+ <!DOCTYPE html><!--MtWdFBWYBrNNpdc_evjbH--><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/124bc670aadbcaaa.js"/><script src="/_next/static/chunks/e49035715a3b468c.js" async=""></script><script src="/_next/static/chunks/8b181cdae656a3a3.js" async=""></script><script src="/_next/static/chunks/ee4ef5db2df5a4d4.js" async=""></script><script src="/_next/static/chunks/3d40e553ae400c39.js" async=""></script><script src="/_next/static/chunks/turbopack-e0f8f63596dbdf82.js" async=""></script><script src="/_next/static/chunks/d96012bcfc98706a.js" async=""></script><script src="/_next/static/chunks/d80b3790a119a285.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: Internal Server Error.</title><link rel="icon" href="/favicon.ico?favicon.0b3bf435.ico" sizes="256x256" type="image/x-icon"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}
2
+ @media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/124bc670aadbcaaa.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[339756,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n3:I[837457,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n4:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"ViewportBoundary\"]\n9:I[897367,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"MetadataBoundary\"]\nb:I[168027,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"MtWdFBWYBrNNpdc-evjbH\",\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"title\",null,{\"children\":\"500: Internal Server Error.\"}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"lineHeight\":\"48px\"},\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}\\n@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"paddingRight\":23,\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\"},\"children\":\"500\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"28px\"},\"children\":\"Internal Server Error.\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L7\",null,{\"children\":\"$@8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$@a\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"c:I[27201,[\"/_next/static/chunks/d96012bcfc98706a.js\",\"/_next/static/chunks/d80b3790a119a285.js\"],\"IconMark\"]\na:[[\"$\",\"link\",\"0\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?favicon.0b3bf435.ico\",\"sizes\":\"256x256\",\"type\":\"image/x-icon\"}],[\"$\",\"$Lc\",\"1\",{}]]\n6:null\n"])</script></body></html>