larkup 0.1.21 → 0.1.23

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 (119) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/diagnostics/route-bundle-stats.json +12 -12
  4. package/.next/fallback-build-manifest.json +3 -3
  5. package/.next/required-server-files.js +1 -1
  6. package/.next/required-server-files.json +1 -1
  7. package/.next/server/app/_global-error.html +1 -1
  8. package/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +16 -16
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +16 -16
  18. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  19. package/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  21. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/server/app/analytics/page_client-reference-manifest.js +1 -1
  24. package/.next/server/app/analytics.html +1 -1
  25. package/.next/server/app/analytics.rsc +17 -17
  26. package/.next/server/app/analytics.segments/_full.segment.rsc +17 -17
  27. package/.next/server/app/analytics.segments/_head.segment.rsc +4 -4
  28. package/.next/server/app/analytics.segments/_index.segment.rsc +11 -11
  29. package/.next/server/app/analytics.segments/_tree.segment.rsc +1 -1
  30. package/.next/server/app/analytics.segments/analytics/__PAGE__.segment.rsc +3 -3
  31. package/.next/server/app/analytics.segments/analytics.segment.rsc +3 -3
  32. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  33. package/.next/server/app/chat.html +1 -1
  34. package/.next/server/app/chat.rsc +17 -17
  35. package/.next/server/app/chat.segments/_full.segment.rsc +17 -17
  36. package/.next/server/app/chat.segments/_head.segment.rsc +4 -4
  37. package/.next/server/app/chat.segments/_index.segment.rsc +11 -11
  38. package/.next/server/app/chat.segments/_tree.segment.rsc +1 -1
  39. package/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +3 -3
  40. package/.next/server/app/chat.segments/chat.segment.rsc +3 -3
  41. package/.next/server/app/data/page_client-reference-manifest.js +1 -1
  42. package/.next/server/app/data.html +1 -1
  43. package/.next/server/app/data.rsc +17 -17
  44. package/.next/server/app/data.segments/_full.segment.rsc +17 -17
  45. package/.next/server/app/data.segments/_head.segment.rsc +4 -4
  46. package/.next/server/app/data.segments/_index.segment.rsc +11 -11
  47. package/.next/server/app/data.segments/_tree.segment.rsc +1 -1
  48. package/.next/server/app/data.segments/data/__PAGE__.segment.rsc +3 -3
  49. package/.next/server/app/data.segments/data.segment.rsc +3 -3
  50. package/.next/server/app/index.html +1 -1
  51. package/.next/server/app/index.rsc +16 -16
  52. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  53. package/.next/server/app/index.segments/_full.segment.rsc +16 -16
  54. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  55. package/.next/server/app/index.segments/_index.segment.rsc +11 -11
  56. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  57. package/.next/server/app/page_client-reference-manifest.js +1 -1
  58. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  59. package/.next/server/app/settings.html +1 -1
  60. package/.next/server/app/settings.rsc +18 -18
  61. package/.next/server/app/settings.segments/_full.segment.rsc +18 -18
  62. package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  63. package/.next/server/app/settings.segments/_index.segment.rsc +11 -11
  64. package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  65. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  66. package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  67. package/.next/server/chunks/[root-of-the-server]__0036943._.js +2 -2
  68. package/.next/server/chunks/[root-of-the-server]__00nqa2u._.js +2 -2
  69. package/.next/server/chunks/[root-of-the-server]__02cpmox._.js +3 -3
  70. package/.next/server/chunks/[root-of-the-server]__02p-tv7._.js +3 -3
  71. package/.next/server/chunks/[root-of-the-server]__02t_0g7._.js +2 -2
  72. package/.next/server/chunks/[root-of-the-server]__04kopvt._.js +3 -3
  73. package/.next/server/chunks/[root-of-the-server]__04l~ip-._.js +2 -2
  74. package/.next/server/chunks/[root-of-the-server]__04visk8._.js +2 -2
  75. package/.next/server/chunks/[root-of-the-server]__05x8tmf._.js +2 -2
  76. package/.next/server/chunks/[root-of-the-server]__06l96vc._.js +2 -2
  77. package/.next/server/chunks/[root-of-the-server]__06ohoeu._.js +2 -2
  78. package/.next/server/chunks/[root-of-the-server]__07_1411._.js +2 -2
  79. package/.next/server/chunks/[root-of-the-server]__0acpo9m._.js +2 -2
  80. package/.next/server/chunks/[root-of-the-server]__0exyn0q._.js +2 -2
  81. package/.next/server/chunks/[root-of-the-server]__0fcf_rl._.js +2 -2
  82. package/.next/server/chunks/[root-of-the-server]__0f~eq1-._.js +2 -2
  83. package/.next/server/chunks/[root-of-the-server]__0ljy49-._.js +2 -2
  84. package/.next/server/chunks/[root-of-the-server]__0n0nerw._.js +2 -2
  85. package/.next/server/chunks/[root-of-the-server]__0oh5wgp._.js +2 -2
  86. package/.next/server/chunks/[root-of-the-server]__0oyc7s4._.js +3 -3
  87. package/.next/server/chunks/[root-of-the-server]__0pg~eys._.js +2 -2
  88. package/.next/server/chunks/[root-of-the-server]__0qtx78g._.js +2 -2
  89. package/.next/server/chunks/[root-of-the-server]__0r03jcl._.js +2 -2
  90. package/.next/server/chunks/[root-of-the-server]__0sb7d93._.js +2 -2
  91. package/.next/server/chunks/[root-of-the-server]__0t36t5o._.js +3 -3
  92. package/.next/server/chunks/[root-of-the-server]__0t_hp52._.js +2 -2
  93. package/.next/server/chunks/[root-of-the-server]__0v03x56._.js +2 -2
  94. package/.next/server/chunks/[root-of-the-server]__0v4bbce._.js +2 -2
  95. package/.next/server/chunks/[root-of-the-server]__0vcdpoc._.js +2 -2
  96. package/.next/server/chunks/[root-of-the-server]__0wvxpqf._.js +2 -2
  97. package/.next/server/chunks/[root-of-the-server]__0wyl7x5._.js +2 -2
  98. package/.next/server/chunks/[root-of-the-server]__0yx8vxp._.js +2 -2
  99. package/.next/server/chunks/[root-of-the-server]__0zh8t6z._.js +2 -2
  100. package/.next/server/chunks/[root-of-the-server]__0~q2fro._.js +2 -2
  101. package/.next/server/chunks/[root-of-the-server]__10d58x4._.js +2 -2
  102. package/.next/server/chunks/[root-of-the-server]__12kvuvp._.js +2 -2
  103. package/.next/server/chunks/packages_core_src_generator_generate-server_ts_0mt.je3._.js +3 -5
  104. package/.next/server/chunks/ssr/_0s5_0n1._.js +1 -1
  105. package/.next/server/chunks/ssr/packages_core_src_generator_generate-server_ts_0o.y7vi._.js +3 -5
  106. package/.next/server/middleware-build-manifest.js +3 -3
  107. package/.next/server/pages/404.html +1 -1
  108. package/.next/server/pages/500.html +1 -1
  109. package/.next/static/chunks/0u4n0ggeto75y.js +1 -0
  110. package/CHANGELOG.md +12 -0
  111. package/bin/larkup.js +43 -15
  112. package/components/onboarding/simple-setup.tsx +2 -2
  113. package/components/onboarding/welcome-screen.tsx +2 -2
  114. package/next-env.d.ts +1 -1
  115. package/package.json +17 -17
  116. package/.next/static/chunks/0ho7lc.x2uknx.js +0 -1
  117. /package/.next/static/{KqIuNxkoeAlhCusoxtMrS → Fb01QU1MyWBHc7U1LHf5y}/_buildManifest.js +0 -0
  118. /package/.next/static/{KqIuNxkoeAlhCusoxtMrS → Fb01QU1MyWBHc7U1LHf5y}/_clientMiddlewareManifest.js +0 -0
  119. /package/.next/static/{KqIuNxkoeAlhCusoxtMrS → Fb01QU1MyWBHc7U1LHf5y}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,675973,e=>{"use strict";var t=e.i(799718),s=e.i(539104),a=e.i(567821);function n(){return"u">typeof window}function r(){return"production"}function l(){return"development"===((n()?window.vam:r())||"production")}function i(e){return RegExp(`/${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?=[/?#]|$)`)}function o(e){return(0,s.useEffect)(()=>{var t;e.beforeSend&&(null==(t=window.va)||t.call(window,"beforeSend",e.beforeSend))},[e.beforeSend]),(0,s.useEffect)(()=>{!function(e={debug:!0}){var t;if(!n())return;!function(e="auto"){if("auto"===e){window.vam=r();return}window.vam=e}(e.mode),window.va||(window.va=function(...e){(window.vaq=window.vaq||[]).push(e)}),e.beforeSend&&(null==(t=window.va)||t.call(window,"beforeSend",e.beforeSend));let s=e.scriptSrc?e.scriptSrc:l()?"https://va.vercel-scripts.com/v1/script.debug.js":e.basePath?`${e.basePath}/insights/script.js`:"/_vercel/insights/script.js";if(document.head.querySelector(`script[src*="${s}"]`))return;let a=document.createElement("script");a.src=s,a.defer=!0,a.dataset.sdkn="@vercel/analytics"+(e.framework?`/${e.framework}`:""),a.dataset.sdkv="1.6.1",e.disableAutoTrack&&(a.dataset.disableAutoTrack="1"),e.endpoint?a.dataset.endpoint=e.endpoint:e.basePath&&(a.dataset.endpoint=`${e.basePath}/insights`),e.dsn&&(a.dataset.dsn=e.dsn),a.onerror=()=>{let e=l()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${s}. ${e}`)},l()&&!1===e.debug&&(a.dataset.debug="false"),document.head.appendChild(a)}({framework:e.framework||"react",basePath:e.basePath??function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}(),...void 0!==e.route&&{disableAutoTrack:!0},...e})},[]),(0,s.useEffect)(()=>{e.route&&e.path&&function({route:e,path:t}){var s;null==(s=window.va)||s.call(window,"pageview",{route:e,path:t})}({route:e.route,path:e.path})},[e.route,e.path]),null}function d(e){let n,r,l,{route:d,path:c}=(n=(0,a.useParams)(),r=(0,a.useSearchParams)(),l=(0,a.usePathname)(),n?{route:function(e,t){if(!e||!t)return e;let s=e;try{let e=Object.entries(t);for(let[t,a]of e)if(!Array.isArray(a)){let e=i(a);e.test(s)&&(s=s.replace(e,`/[${t}]`))}for(let[t,a]of e)if(Array.isArray(a)){let e=i(a.join("/"));e.test(s)&&(s=s.replace(e,`/[...${t}]`))}return s}catch(t){return e}}(l,Object.keys(n).length?n:Object.fromEntries(r.entries())),path:l}:{route:null,path:l});return s.default.createElement(o,{path:c,route:d,...e,basePath:function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH}(),framework:"next"})}e.s(["Analytics",0,function(e){return s.default.createElement(s.Suspense,{fallback:null},s.default.createElement(d,{...e}))}])},7012,e=>{"use strict";var t=e.i(538863),s=e.i(539104),a=(e,t,s,a,n,r,l,i)=>{let o=document.documentElement,d=["light","dark"];function c(t){var s;(Array.isArray(e)?e:[e]).forEach(e=>{let s="class"===e,a=s&&r?n.map(e=>r[e]||e):n;s?(o.classList.remove(...a),o.classList.add(r&&r[t]?r[t]:t)):o.setAttribute(e,t)}),s=t,i&&d.includes(s)&&(o.style.colorScheme=s)}if(a)c(a);else try{let e=localStorage.getItem(t)||s,a=l&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;c(a)}catch(e){}},n=s.createContext(void 0),r={setTheme:e=>{},themes:[]};s.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:l,defaultTheme:i,value:o,themes:d,nonce:c,scriptProps:u})=>{let m=JSON.stringify([n,t,i,e,d,o,r,l]).slice(1,-1);return s.createElement("script",{...u,suppressHydrationWarning:!0,nonce:"u"<typeof window?c:"",dangerouslySetInnerHTML:{__html:`(${a.toString()})(${m})`}})});var l=e.i(360112),i=e.i(546545),i=i,o=e.i(184861),o=o,d=e.i(670033),d=d,c=e.i(529945),c=c,u=e.i(623582),u=u;e.s(["Toaster",0,({...e})=>{var a;let{theme:m="system"}=null!=(a=s.useContext(n))?a:r;return(0,t.jsx)(l.Toaster,{closeButton:!0,theme:m,className:"toaster group z-9999999! ",icons:{success:(0,t.jsx)(i.default,{className:"size-5 text-white",fill:"#10b981"}),info:(0,t.jsx)(o.default,{className:"size-5 text-white",fill:"#3b82f6"}),warning:(0,t.jsx)(d.default,{className:"size-5 text-white",fill:"#f59e0b"}),error:(0,t.jsx)(c.default,{className:"size-5 text-white",fill:"#ef4444"}),loading:(0,t.jsx)(u.default,{className:"size-5 animate-spin text-muted-foreground"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)",zIndex:999999},toastOptions:{classNames:{toast:"group toast items-start group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900 group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:",icon:"mt-0.5",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",success:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",error:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",warning:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",info:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900"}},...e})}],7012)},266186,e=>{"use strict";var t=e.i(538863),s=e.i(82100),a=e.i(539104),n=e.i(364086),r=e.i(567821),l=e.i(697934),i=e.i(2e3),o=e.i(24830),d=e.i(643689);let c=(0,d.default)("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);var u=e.i(542677),m=e.i(54134),x=e.i(152236),h=e.i(839717),p=e.i(623012);let g=(0,d.default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);var f=e.i(519528),b=e.i(458266),j=e.i(146141),v=e.i(440087),y=e.i(624529),N=e.i(874560),w=e.i(360112),k=e.i(850628),C=e.i(466691),F=e.i(282879);function A({target:e,open:s,onOpenChange:n}){let{deleteServer:r}=(0,y.useWorkspace)(),[l,i]=(0,a.useState)(!1);async function o(){if(e){i(!0);try{await r(e.id),w.toast.success(`Deleted "${e.name}".`),n(!1)}catch{w.toast.error("Could not delete the server.")}finally{i(!1)}}}return(0,t.jsx)(F.Dialog,{open:s,onOpenChange:n,children:(0,t.jsxs)(F.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsxs)(F.DialogHeader,{children:[(0,t.jsxs)(F.DialogTitle,{children:["Delete “",e?.name,"”?"]}),(0,t.jsx)(F.DialogDescription,{children:"This permanently removes the server's documents, index, vector data, and generated files. This cannot be undone."})]}),(0,t.jsxs)(F.DialogFooter,{children:[(0,t.jsx)(C.Button,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"Cancel"}),(0,t.jsxs)(C.Button,{variant:"destructive",onClick:()=>void o(),disabled:l,children:[l&&(0,t.jsx)(k.Loader2,{className:"size-4 animate-spin"}),"Delete server"]})]})]})})}function S(){let{servers:e,activeServer:s,activateServer:n}=(0,y.useWorkspace)(),[r,l]=(0,a.useState)(!1),[i,o]=(0,a.useState)(null),[d,c]=(0,a.useState)(null);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(v.DropdownMenu,{children:[(0,t.jsxs)(v.DropdownMenuTrigger,{render:(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-lg border border-border bg-card px-2 py-1.5 text-left transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),children:[(0,t.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md bg-primary/12 text-primary",children:(0,t.jsx)(m.Server,{className:"size-3.5"})}),(0,t.jsx)("span",{className:"flex min-w-0 flex-1 flex-col",children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:s?.name??"No server"}),s?.running&&(0,t.jsx)(z,{})]})}),(0,t.jsx)(g,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,t.jsxs)(v.DropdownMenuContent,{align:"start",sideOffset:6,className:"w-(--anchor-width) min-w-[260px]",children:[(0,t.jsxs)(v.DropdownMenuGroup,{children:[(0,t.jsx)(v.DropdownMenuLabel,{children:"Your servers"}),e.map(e=>{let a=e.id===s?.id;return(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>{a||n(e.id)},className:"gap-2",children:[(0,t.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:(0,t.jsx)(m.Server,{className:"size-3.5"})}),(0,t.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"truncate font-medium",children:e.name}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-[11px] text-muted-foreground tabular-nums",children:[(0,t.jsxs)("span",{children:[e.docCount," docs"]}),e.indexed&&(0,t.jsx)("span",{children:"· indexed"}),e.running&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-500",children:[(0,t.jsx)(z,{}),"live"]})]})]}),a&&(0,t.jsx)(p.Check,{className:"size-4 shrink-0 text-primary"})]},e.id)})]}),(0,t.jsx)(v.DropdownMenuSeparator,{}),(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>l(!0),className:"gap-2 h-9",children:[(0,t.jsx)(b.Plus,{className:"size-4"}),"New server"]}),s&&(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>o(s),className:"gap-2 h-9",children:[(0,t.jsx)(f.Pencil,{className:"size-4"}),"Rename current"]}),s&&e.length>1&&(0,t.jsxs)(v.DropdownMenuItem,{variant:"destructive",onClick:()=>c(s),className:"gap-2",children:[(0,t.jsx)(j.Trash2,{className:"size-4"}),"Delete current"]})]})]}),(0,t.jsx)(N.ServerFormDialog,{mode:"create",open:r,onOpenChange:l}),(0,t.jsx)(N.ServerFormDialog,{mode:"rename",target:i,open:null!==i,onOpenChange:e=>!e&&o(null)}),(0,t.jsx)(A,{target:d,open:null!==d,onOpenChange:e=>!e&&c(null)})]})}function z(){return(0,t.jsxs)("span",{className:"relative flex size-2",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-500"})]})}let D={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},T=[{id:"chat",label:"Chat",href:"/chat",icon:l.MessageCircle},{id:"data",label:"Data",href:"/data",icon:i.Database},{id:"analytics",label:"Analytics",href:"/analytics",icon:c},{id:"settings",label:"Settings",href:"/settings",icon:o.Settings}];function E(){let e=(0,r.usePathname)(),{pageStyle:l,navBg:i}=(0,s.useThemeCustomizer)(),{activeServer:o}=(0,y.useWorkspace)(),[d,c]=(0,a.useState)(!0);(0,a.useEffect)(()=>{"false"===localStorage.getItem("sidebar-collapsed")&&c(!1)},[]);let p=()=>{let e=!d;c(e),localStorage.setItem("sidebar-collapsed",String(e))},g=i?D[i]:void 0;return(0,t.jsx)(h.TooltipProvider,{delay:150,children:(0,t.jsxs)("aside",{className:(0,x.cn)("sticky top-0 hidden h-screen shrink-0 flex-col self-start py-4 md:flex transition-all duration-300 ease-in-out",d?"w-18":"w-60",g?"":"bg-background","fused"===l?"border-r border-border":""),style:g?{backgroundColor:g}:void 0,children:[(0,t.jsx)("div",{className:(0,x.cn)("flex w-full items-center mb-6",d?"justify-center px-3":"justify-between px-4"),children:d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:p,"aria-label":"Expand sidebar",className:"flex size-10 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105"}),children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)(h.TooltipContent,{side:"right",sideOffset:10,children:"Expand sidebar"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.default,{href:"/chat",className:"flex items-center gap-2.5",children:[(0,t.jsx)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Larkup"})]}),(0,t.jsx)("button",{onClick:p,className:"flex size-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors","aria-label":"Collapse sidebar",children:(0,t.jsx)(u.ChevronLeft,{className:"size-3.5"})})]})}),(0,t.jsx)("nav",{className:(0,x.cn)("flex flex-1 flex-col w-full",d?"items-center px-3 gap-3":"px-3 gap-1.5"),children:T.map(s=>{let a=s.icon,r=e===s.href||"/"!==s.href&&e?.startsWith(s.href);return d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)(n.default,{href:s.href,"aria-current":r?"page":void 0,onClick:t=>{"chat"===s.id&&"/chat"===e&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,x.cn)("group relative flex size-10 items-center justify-center rounded-xl transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"bg-[#F0F0F0] text-foreground":"text-muted-foreground hover:bg-[#EBEBEB] hover:text-foreground")}),children:(0,t.jsx)(a,{className:"size-4.5",strokeWidth:r?2.25:1.75})}),(0,t.jsx)(h.TooltipContent,{side:"right",sideOffset:10,children:s.label})]},s.id):(0,t.jsxs)(n.default,{href:s.href,"aria-current":r?"page":void 0,onClick:t=>{"chat"===s.id&&"/chat"===e&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,x.cn)("group relative flex items-center gap-3 rounded-xl px-3 py-2.5 text-[13px] font-medium transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"bg-[#F0F0F0] text-foreground":"text-muted-foreground hover:bg-[#EBEBEB] hover:text-foreground"),children:[(0,t.jsx)(a,{className:"size-4.5 shrink-0",strokeWidth:r?2.25:1.75}),(0,t.jsx)("span",{className:"truncate",children:s.label})]},s.id)})}),(0,t.jsx)("div",{className:(0,x.cn)("w-full pt-3",d?"px-2":"px-3"),children:d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:p,className:"flex w-full items-center justify-center py-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors"}),children:(0,t.jsxs)("div",{className:"relative size-8 rounded-lg border border-border bg-card flex items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:[(0,t.jsx)(m.Server,{className:"size-4"}),(0,t.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 flex size-2.5",children:o?.running?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-green-500 border border-card"})]}):(0,t.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-gray-500 border border-card"})})]})}),(0,t.jsxs)(h.TooltipContent,{side:"right",sideOffset:10,children:[o?.name??"No server"," (",o?.running?"Live":"Offline",")"]})]}):(0,t.jsx)(S,{})})]})})}let M={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},I=[{id:"chat",label:"Chat",href:"/chat",icon:l.MessageCircle},{id:"data",label:"Data",href:"/data",icon:i.Database},{id:"analytics",label:"Analytics",href:"/analytics",icon:c},{id:"settings",label:"Settings",href:"/settings",icon:o.Settings}];function P(){let e=(0,r.usePathname)(),{username:a}=(0,y.useWorkspace)(),{navBg:l}=(0,s.useThemeCustomizer)(),i=l?M[l]:void 0;return(0,t.jsx)(h.TooltipProvider,{delay:150,children:(0,t.jsxs)("header",{className:(0,x.cn)("sticky top-0 z-50 flex h-14 shrink-0 items-center gap-6 border-b border-border px-4 md:px-6",i?"":"bg-[#F5F5F4]"),style:i?{backgroundColor:i}:void 0,children:[(0,t.jsxs)(n.default,{href:"/chat","aria-label":"larkup home",className:"flex items-center gap-2.5 shrink-0",children:[(0,t.jsx)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)("span",{className:"font-semibold tracking-tight text-foreground hidden sm:inline-block",children:"Larkup"})]}),(0,t.jsx)("nav",{className:"flex h-full items-center gap-1",children:I.map(s=>{let a=s.icon,r=e===s.href||"/"!==s.href&&e?.startsWith(s.href);return(0,t.jsxs)(n.default,{href:s.href,"aria-current":r?"page":void 0,className:(0,x.cn)("group relative flex items-center gap-2 h-full px-3 text-[13px] font-medium transition-colors outline-none",r?"text-primary":"text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(a,{className:"size-[16px]",strokeWidth:r?2.25:1.75}),(0,t.jsx)("span",{className:"hidden md:inline",children:s.label}),(0,t.jsx)("span",{className:(0,x.cn)("absolute bottom-0 left-2 right-2 h-[2px] rounded-full bg-primary transition-opacity",r?"opacity-100":"opacity-0")})]},s.id)})}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(S,{}),a&&(0,t.jsxs)("span",{className:"hidden text-sm text-muted-foreground md:block",children:["Hi, ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:a})]})]})]})})}let B=(0,d.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var _=e.i(266411),L=e.i(755382),L=L,O=e.i(924911),R=e.i(300033),$=e.i(856474),V=e.i(266741);let K=["vercel_ai_gateway","openai","google","mistral","custom"];function W(){let{setUsername:e,createServer:s,refresh:n}=(0,y.useWorkspace)(),l=(0,r.useRouter)(),[i,o]=(0,a.useState)(""),[d,c]=(0,a.useState)("vercel_ai_gateway"),[u,m]=(0,a.useState)(""),[x,h]=(0,a.useState)(null),[p,g]=(0,a.useState)("vercel_ai_gateway"),[b,j]=(0,a.useState)(""),[v,N]=(0,a.useState)(null),[A,S]=(0,a.useState)(!1),[z,D]=(0,a.useState)(!1),[T,E]=(0,a.useState)(null),M="custom"===d,I="custom"===p,P=z||M||d!==p?b:u,W=async()=>{S(!0);try{let t=await fetch("/api/config"),{config:a}=await t.json(),r={...a};M&&x?(r.embeddingProvider="custom",r.embeddingModelId=`custom:${x.modelName}`,r.embeddingApiKey=x.apiKey||void 0,r.customEmbeddings=[x]):(r.embeddingProvider=d,r.embeddingApiKey=u),z?I&&v?(r.chatProvider="custom",r.chatModelId=`custom:${v.modelName}`,r.chatApiKey=v.apiKey||void 0,r.customChatModels=[v]):(r.chatProvider=p,r.chatApiKey=P):M&&x||(r.chatProvider=d,r.chatApiKey=u);let o=await fetch("/api/config/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embeddingProvider:r.embeddingProvider,embeddingApiKey:r.embeddingApiKey,embeddingModelId:r.embeddingModelId,customEmbeddings:r.customEmbeddings,chatProvider:r.chatProvider,chatApiKey:r.chatApiKey,chatModelId:r.chatModelId,customChatModels:r.customChatModels})});if(!o.ok){let e=await o.json();w.toast.error(e.error||"Verification failed — please check your API key.",{duration:8e3}),S(!1);return}i.trim()&&await e(i.trim()),await s("my-larkup"),await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n(),l.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},U=async()=>{S(!0);try{i.trim()&&await e(i.trim()),await s("my-larkup"),n(),l.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},H=(e,s)=>(0,t.jsxs)(R.Select,{value:e,onValueChange:e=>{var t;"custom"===(t=e??"")?("embedding"===s?c("custom"):g("custom"),E(s)):"embedding"===s?(c(t),h(null),!z&&g(t)):(g(t),N(null))},children:[(0,t.jsx)(R.SelectTrigger,{className:"w-full bg-white/90 hover:bg-white",children:(0,t.jsx)("span",{className:"flex items-center gap-2",children:$.PROVIDER_META[e]?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)($.ProviderIcon,{src:$.PROVIDER_META[e].iconSrc,alt:$.PROVIDER_META[e].label,pillBg:$.PROVIDER_META[e].pillBg,size:16}),$.PROVIDER_META[e].label]}):"Select provider"})}),(0,t.jsx)(R.SelectContent,{children:K.map(e=>{let s=$.PROVIDER_META[e];return s?(0,t.jsx)(R.SelectItem,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)($.ProviderIcon,{src:s.iconSrc,alt:s.label,pillBg:s.pillBg,size:16}),(0,t.jsxs)("span",{children:[s.label,"vercel_ai_gateway"===e&&" (Recommended)","custom"===e&&" (OpenAI-compatible)"]})]})},e):null})})]}),q=(e,s)=>(0,t.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 rounded-lg border border-green-200 bg-green-50/50 px-3 py-2",children:[(0,t.jsx)("span",{className:"text-green-600 text-xs",children:"✓"}),(0,t.jsx)("span",{className:"flex-1 truncate text-xs font-medium text-foreground",children:e.modelName}),(0,t.jsx)("button",{type:"button",onClick:()=>E(s),className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(f.Pencil,{className:"size-3"})})]});return(0,t.jsxs)("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-background",children:[(0,t.jsxs)("div",{className:"pointer-events-none fixed inset-0 overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute -left-20 -top-20 h-125 w-125 rounded-full bg-stone-200/40 blur-3xl animate-pulse"}),(0,t.jsx)("div",{className:"absolute -bottom-32 -right-32 h-150 w-150 rounded-full bg-amber-100/30 blur-3xl animate-pulse [animation-delay:1s]"})]}),(0,t.jsx)("div",{className:"relative z-10 flex min-h-full w-full flex-col items-center justify-center px-6 py-12",children:(0,t.jsxs)("div",{className:"flex w-full max-w-lg flex-col items-center gap-8 animate-fade-up",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center",children:[(0,t.jsx)("div",{className:"flex size-14 items-center justify-center rounded-xl bg-primary text-primary-foreground ",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-8",alt:"Larkup"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Welcome to Larkup"}),(0,t.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Let's set up your AI models. You can change these later in Settings."})]})]}),(0,t.jsxs)("div",{className:"w-full space-y-5 rounded-2xl p-6 backdrop-blur-xl",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Your Name (Optional)"}),(0,t.jsx)(O.Input,{value:i,onChange:e=>o(e.target.value),placeholder:"How should we call you?",className:"bg-background/50"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Embedding Provider"}),H(d,"embedding"),M&&x&&q(x,"embedding"),M&&!x&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!M&&(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("label",{className:"text-xs font-medium text-foreground",children:["API Key",!z&&(0,t.jsxs)("span",{className:"text-muted-foreground font-normal",children:[" ","(used for both embedding & chat)"]})]}),(0,t.jsx)(O.Input,{type:"password",value:u,onChange:e=>m(e.target.value),placeholder:"sk-...",className:"bg-background/50"})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>D(!z),className:"flex w-full items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[z?(0,t.jsx)(L.default,{className:"size-3.5"}):(0,t.jsx)(_.ChevronDown,{className:"size-3.5"}),"Use a different chat model"]}),z&&(0,t.jsxs)("div",{className:"space-y-3 rounded-xl border border-border/40 bg-muted/20 p-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat Provider"}),H(p,"chat"),I&&v&&q(v,"chat"),I&&!v&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!I&&(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat API Key"}),(0,t.jsx)(O.Input,{type:"password",value:b,onChange:e=>j(e.target.value),placeholder:"sk-...",className:"bg-background/50"})]})]}),(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"More providers and fine-grained model selection available in Settings → AI Models."}),(0,t.jsxs)("div",{className:"pt-2 flex gap-3",children:[(0,t.jsx)(C.Button,{variant:"outline",className:"flex-1",onClick:U,disabled:A,children:"Skip for now"}),(0,t.jsx)(C.Button,{className:"flex-1",onClick:W,disabled:A||!(()=>{if(M){if(!x)return!1}else if(!u)return!1;if(z){if(I){if(!v)return!1}else if(!P)return!1}return!0})(),children:A?(0,t.jsx)(k.Loader2,{className:"size-4 animate-spin"}):(0,t.jsxs)(t.Fragment,{children:["Continue ",(0,t.jsx)(B,{className:"ml-1.5 size-4"})]})})]})]})]})}),(0,t.jsx)(F.Dialog,{open:null!==T,onOpenChange:e=>{e||("embedding"!==T||x||c("vercel_ai_gateway"),"chat"!==T||v||g("vercel_ai_gateway"),E(null))},children:(0,t.jsxs)(F.DialogContent,{className:"max-w-xl",children:[(0,t.jsxs)(F.DialogHeader,{children:[(0,t.jsxs)(F.DialogTitle,{children:["Custom ","embedding"===T?"Embedding":"Chat"," Model"]}),(0,t.jsxs)(F.DialogDescription,{children:["Connect an OpenAI-compatible ","embedding"===T?"embedding":"chat"," ","model. Test the connection before adding."]})]}),T&&(0,t.jsx)(V.CustomModelForm,{type:T,onSave:e=>{"embedding"===T?(h(e),c("custom")):"chat"===T&&(N(e),g("custom")),E(null)},onCancel:()=>{"embedding"!==T||x||c("vercel_ai_gateway"),"chat"!==T||v||g("vercel_ai_gateway"),E(null)}})]})})]})}let U={"panel-default":"#FAFAFA","panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"};e.s(["ClientLayoutWrapper",0,function({children:e}){let{pageStyle:a,panelBg:n,layout:l}=(0,s.useThemeCustomizer)(),i=(0,r.usePathname)(),o=i?.includes("/chat"),{isFirstRun:d,isLoading:c}=(0,y.useWorkspace)(),u=U[n],m=u?{backgroundColor:u}:void 0;return!c&&d?(0,t.jsx)(W,{}):c?(0,t.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,t.jsx)("div",{className:"size-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):"topnav"===l?(0,t.jsxs)("div",{className:"flex flex-col h-screen overflow-hidden",children:[(0,t.jsx)(P,{}),(0,t.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,t.jsx)("div",{className:"h-full flex flex-col bg-background text-foreground",style:m,children:(0,t.jsx)("div",{className:(0,x.cn)("flex-1 min-h-0",o||i?.includes("/settings")||i?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||i?.includes("/settings")||i?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:e})})})})]}):(0,t.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,t.jsx)(E,{}),(0,t.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,t.jsx)("div",{className:"fused"===a?"h-screen flex flex-col bg-background text-foreground overflow-hidden":"h-screen flex flex-col md:rounded-l-2xl border-l border-border bg-panel text-panel-foreground overflow-hidden",style:m,children:(0,t.jsx)("div",{className:(0,x.cn)("flex-1 min-h-0",o||i?.includes("/settings")||i?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||i?.includes("/settings")||i?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:e})})})})]})}],266186)},953159,e=>{"use strict";var t=e.i(538863),s=e.i(423484),a=e.i(850628),n=e.i(539104),r=e.i(447932),l=e.i(643689);let i=(0,l.default)("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);var o=e.i(248384);let d=(0,l.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);var c=e.i(2e3),u=e.i(182832);let m=(0,l.default)("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);var x=e.i(439399),h=e.i(470175),p=e.i(704101),g=e.i(55339);let f=(0,l.default)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);var b=e.i(682458),j=e.i(161351),v=e.i(466691),y=e.i(861947),N=e.i(323621),w=e.i(524365),k=e.i(534792),C=e.i(360112),F=e.i(878835),A=e.i(282879);let S=e=>fetch(e).then(e=>e.json()),z=["chunking","embedding","upserting"];function D({open:e,onOpenChange:l,trigger:i}){let[o,d]=(0,n.useState)(!1),[c,u]=(0,n.useState)(!1),m=void 0!==e,f=m?e:c,b=m&&l?l:u,{data:j,isLoading:y,mutate:N}=(0,s.default)("/api/index",S,{refreshInterval:e=>e?.run&&z.includes(e.run.status)?1e3:0}),E=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{let e=j?.run?.warning;e&&e!==E.current?C.toast.warning(e,{id:"rate-limit-warning",duration:7e4}):!e&&E.current&&(C.toast.dismiss("rate-limit-warning"),C.toast.success("Rate limit resolved — resuming indexing.",{duration:3e3})),E.current=e},[j?.run?.warning]);let[I,P]=(0,n.useState)(!1);async function B(e=!1){d(!0);try{let t=await fetch("/api/index",{method:"POST",body:JSON.stringify({incremental:e}),headers:{"Content-Type":"application/json"}}),s=await t.json();if(!t.ok)return void C.toast.error(s.error??"Could not start indexing.");C.toast.success("Indexing started."),N()}catch{C.toast.error("Could not start indexing.")}finally{d(!1)}}async function _(){d(!0);try{if(!(await fetch("/api/index",{method:"DELETE"})).ok)return void C.toast.error("Could not cancel indexing.");C.toast.success("Indexing cancelled."),N()}catch{C.toast.error("Could not cancel indexing.")}finally{d(!1)}}return(0,n.useEffect)(()=>{let e=j?.run?.status;e&&z.includes(e)?P(!0):I&&"completed"===e&&(P(!1),b(!1),C.toast.success("Indexing completed successfully!"))},[j?.run?.status,I,b]),(0,t.jsxs)(A.Dialog,{open:f,onOpenChange:b,children:[i?(0,t.jsx)(A.DialogTrigger,{render:(0,n.isValidElement)(i)?i:(0,t.jsx)("button",{children:i})}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j?.run?.status==="completed"&&(0,t.jsxs)(F.AlertDialog,{children:[(0,t.jsx)(F.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{disabled:!j.ready||!!(j.run&&z.includes(j.run.status))||o,variant:"outline",children:[(0,t.jsx)(g.RotateCcw,{className:"size-4 mr-2"}),"Re-Index Data"]})}),(0,t.jsxs)(F.AlertDialogContent,{children:[(0,t.jsxs)(F.AlertDialogHeader,{children:[(0,t.jsx)(F.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(F.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(F.AlertDialogFooter,{children:[(0,t.jsx)(F.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(F.AlertDialogAction,{onClick:()=>{b(!0),B(!1)},children:"Continue"})]})]})]}),(0,t.jsx)(A.DialogTrigger,{render:(0,t.jsxs)(v.Button,{disabled:!j?.ready||j?.unindexedCount===0,children:[(0,t.jsx)(h.Layers,{className:"size-4 mr-2"}),"Index Data"]})})]}),(0,t.jsxs)(A.DialogContent,{className:"max-w-2xl max-h-[90vh] overflow-y-auto ",children:[(0,t.jsxs)(A.DialogHeader,{children:[(0,t.jsx)(A.DialogTitle,{children:"Index Data"}),(0,t.jsx)(A.DialogDescription,{children:"Chunk, embed, and index into your selected vector database."})]}),y||!j?(0,t.jsx)("div",{className:"py-6",children:(0,t.jsx)(k.Skeleton,{className:"h-40 w-full"})}):(0,t.jsxs)("div",{className:"space-y-6 py-4",children:[(0,t.jsx)(T,{config:j.config,docCount:j.docCount,charCount:j.charCount}),!j.ready&&(0,t.jsxs)(w.Alert,{variant:"default",children:[(0,t.jsx)(r.AlertTriangle,{className:"size-4 text-orange-500!"}),(0,t.jsx)(w.AlertTitle,{className:"text-orange-500!",children:"Not ready to index"}),(0,t.jsx)(w.AlertDescription,{children:(0,t.jsx)("ul",{className:"list-disc pl-4",children:j.blockers.map(e=>(0,t.jsx)("li",{children:e},e))})})]}),(0,t.jsx)(M,{run:j.run,running:!!(j.run&&z.includes(j.run.status))}),j.ready&&!j.run&&(0,t.jsxs)(w.Alert,{children:[(0,t.jsx)(x.Info,{className:"size-4 text-blue-500!"}),(0,t.jsx)(w.AlertTitle,{className:"text-blue-600 dark:text-blue-400",children:"Before you start indexing"}),(0,t.jsxs)(w.AlertDescription,{className:"text-muted-foreground space-y-1",children:[(0,t.jsxs)("p",{children:["Once indexing begins, two settings become"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:"locked"})," to the existing index:"]}),(0,t.jsxs)("ul",{className:"list-disc pl-4 space-y-0.5",children:[(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"Embedding model"})," — you can swap to any model with the"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:"same vector dimensions"}),", but switching to a model with different dimensions will require a full re-index."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"Vector store"})," — changing the store after indexing requires starting fresh."]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)(v.Button,{onClick:()=>B(j.run?.status==="completed"),disabled:!j.ready||!!(j.run&&z.includes(j.run.status))||o||j.run?.status==="completed"&&0===j.unindexedCount,size:"lg",children:[j.run&&z.includes(j.run.status)||o?(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin mr-2"}):(0,t.jsx)(p.Play,{className:"size-4 mr-2"}),j.run&&z.includes(j.run.status)?"Indexing…":o?"Starting…":j.run?.status==="completed"?`Index new documents (${j.unindexedCount})`:`Start indexing (${j.unindexedCount})`]}),j.run?.status==="completed"&&!(j.run&&z.includes(j.run.status))&&(0,t.jsxs)(F.AlertDialog,{children:[(0,t.jsx)(F.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{variant:"outline",size:"lg",disabled:o,children:[(0,t.jsx)(g.RotateCcw,{className:"size-4 mr-2"}),"Re-Index All"]})}),(0,t.jsxs)(F.AlertDialogContent,{children:[(0,t.jsxs)(F.AlertDialogHeader,{children:[(0,t.jsx)(F.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(F.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(F.AlertDialogFooter,{children:[(0,t.jsx)(F.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(F.AlertDialogAction,{onClick:()=>{b(!0),B(!1)},children:"Continue"})]})]})]}),!!(j.run&&z.includes(j.run.status))&&(0,t.jsx)(v.Button,{onClick:_,disabled:o,size:"lg",variant:"destructive",children:"Cancel"})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"lg",onClick:()=>b(!1),children:"Close"})]})]})]})]})}function T({config:e,docCount:s,charCount:a}){let n=(0,b.getEmbeddingModel)(e.embeddingModelId),r=(0,j.getVectorStore)(e.vectorStore),l=[{icon:d,label:"Embedding model",value:n?.label??e.embeddingModelId,hint:n?`${n.dimensions} dims`:void 0},{icon:c.Database,label:"Vector store",value:r?.label??e.vectorStore},{icon:i,label:"Index type",value:e.indexType.toUpperCase()},{icon:f,label:"Chunking",value:`${e.chunking.chunkSize} / ${e.chunking.chunkOverlap}`,hint:"size / overlap"},{icon:u.FileText,label:"Corpus",value:`${s.toLocaleString()} docs`,hint:`${a.toLocaleString()} chars`}];return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-base font-semibold mb-4",children:[(0,t.jsx)(h.Layers,{className:"size-4 text-primary"}),"Index configuration"]}),(0,t.jsx)("dl",{className:"grid grid-cols-2 gap-x-6 gap-y-5 sm:grid-cols-3",children:l.map(e=>(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsxs)("dt",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(e.icon,{className:"size-3.5"}),e.label]}),(0,t.jsxs)("dd",{className:"text-sm font-medium leading-tight",children:[e.value,e.hint&&(0,t.jsx)("span",{className:"ml-1.5 font-mono text-[11px] font-normal text-muted-foreground",children:e.hint})]})]},e.label))})]})}let E={idle:{label:"Idle"},chunking:{label:"Chunking",phase:"Splitting documents into chunks"},embedding:{label:"Embedding",phase:"Generating vector embeddings"},upserting:{label:"Storing",phase:"Writing vectors to the store"},completed:{label:"Completed"},failed:{label:"Failed"}};function M({run:e,running:s}){if(!e)return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground flex flex-col items-center justify-center gap-1 py-8 text-center",children:[(0,t.jsx)(m,{className:"mb-1 size-6 text-muted-foreground/60"}),(0,t.jsx)("p",{className:"text-sm font-medium",children:"No index built yet"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Build a Larkup index to embed your corpus and make it searchable."})]});let n=E[e.status],l=e.totalChunks>0?Math.round(e.processedChunks/e.totalChunks*100):5*!!s;return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground p-4 space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-base font-semibold",children:["completed"===e.status?(0,t.jsx)(o.CheckCircle2,{className:"size-4 text-primary"}):"failed"===e.status?(0,t.jsx)(r.AlertTriangle,{className:"size-4 text-destructive"}):(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin text-primary"}),n.label]}),(0,t.jsx)(P,{status:e.status})]}),"failed"===e.status?(0,t.jsx)(t.Fragment,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:n.phase??"Done"}),(0,t.jsxs)("span",{className:"font-mono tabular-nums",children:[e.processedChunks.toLocaleString(),e.totalChunks>0&&` / ${e.totalChunks.toLocaleString()}`," chunks"]})]}),(0,t.jsx)(y.Progress,{value:l,className:"**:data-[slot=progress-indicator]:bg-green-600"})]}),(0,t.jsxs)("dl",{className:"grid grid-cols-2 gap-4 pt-1 sm:grid-cols-4",children:[(0,t.jsx)(I,{label:"Documents",value:e.docCount.toLocaleString()}),(0,t.jsx)(I,{label:"Chunks",value:e.totalChunks.toLocaleString()}),(0,t.jsx)(I,{label:"Dimensions",value:e.dimensions?e.dimensions.toLocaleString():"—"}),(0,t.jsx)(I,{label:"Duration",value:e.durationMs?`${(e.durationMs/1e3).toFixed(1)}s`:s?"running…":"—"})]})]})]})}function I({label:e,value:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("dt",{className:"text-xs text-muted-foreground",children:e}),(0,t.jsx)("dd",{className:"font-mono text-sm tabular-nums",children:s})]})}function P({status:e}){return"completed"===e?(0,t.jsx)(N.Badge,{className:"bg-primary/12 text-primary hover:bg-primary/12",children:"Ready"}):"failed"===e?(0,t.jsx)(N.Badge,{variant:"destructive",children:"Failed"}):z.includes(e)?(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-green-600",children:[(0,t.jsxs)("span",{className:"relative flex size-2",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-600 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-600"})]}),"Live"]}):null}let B=e=>fetch(e).then(e=>e.json()),_=["chunking","embedding","upserting"];e.s(["GlobalIndexProgress",0,function(){let{data:e}=(0,s.default)("/api/index",B,{refreshInterval:e=>e?.run&&_.includes(e.run.status)?1e3:0});if(!(e?.run&&_.includes(e.run.status))||!e?.run)return null;let{run:n}=e,r=n.totalChunks>0?Math.round(n.processedChunks/n.totalChunks*100):5;return(0,t.jsx)("div",{className:"fixed bottom-6 right-6 z-50",children:(0,t.jsx)(D,{trigger:(0,t.jsxs)("button",{className:"flex items-center gap-3 rounded-full border bg-background px-4 py-2 text-sm font-medium transition-all hover:bg-muted/50 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin text-primary"}),(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs leading-none text-muted-foreground",children:"Storing..."}),(0,t.jsxs)("span",{className:"leading-none",children:[r,"%"]})]})]})})})}],953159)},232295,e=>{"use strict";var t=e.i(799718),s=e.i(538863),a=e.i(539104),n=e.i(926125),r=e.i(623012),l=e.i(789085),i=e.i(432501),o=e.i(466691);let d="larkup-update-dismissed",c={docker:"docker compose pull && docker compose up -d",npm:"larkup update"};e.s(["UpdateBanner",0,function(){let[u,m]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[p,g]=(0,a.useState)(!1),[f,b]=(0,a.useState)(!1),j="0.1.22",v="__TAURI__"in window?"desktop":"true"===t.default.env.NEXT_PUBLIC_DOCKER_ENV||"true"===t.default.env.NEXT_PUBLIC_RUNNING_IN_DOCKER?"docker":"npm";(0,a.useEffect)(()=>{if(function(){try{let e=localStorage.getItem(d);if(!e)return!1;let{timestamp:t}=JSON.parse(e);return Date.now()-t<864e5}catch{return!1}}())return;let e=new AbortController;return fetch("https://larkup.de/api/version",{signal:e.signal,cache:"no-store"}).then(e=>e.json()).then(e=>{e.version&&function(e,t){let s=e.replace(/^v/,"").split(".").map(Number),a=t.replace(/^v/,"").split(".").map(Number);for(let e=0;e<3;e++){let t=s[e]||0,n=a[e]||0;if(t>n)return 1;if(t<n)return -1}return 0}(e.version,j)>0&&(m(e.version),h(!0))}).catch(()=>{}),()=>e.abort()},[j]);let y=async()=>{if("desktop"===v){g(!0);try{let{check:t}=await e.A(963347),{relaunch:s}=await e.A(995308),a=await t();a?(await a.downloadAndInstall(),await s()):g(!1)}catch(e){console.error("Auto-update failed:",e),g(!1),window.open("https://larkup.de/download","_blank")}}else try{await navigator.clipboard.writeText(c[v]),b(!0),window.setTimeout(()=>b(!1),2e3)}catch(e){console.error("Could not copy update command:",e)}};return x&&u?(0,s.jsx)("div",{role:"status","aria-live":"polite",className:"relative z-50 border-b border-border bg-background px-3 py-2 text-foreground sm:px-4",children:(0,s.jsxs)("div",{className:"mx-auto flex min-h-7 max-w-screen-2xl items-center gap-2.5",children:[(0,s.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background",children:(0,s.jsx)(n.ArrowUp,{className:"size-3.5","aria-hidden":"true"})}),(0,s.jsxs)("p",{className:"min-w-0 text-xs sm:text-sm",children:[(0,s.jsxs)("span",{className:"font-medium",children:["Larkup v",u," is available."]})," ",(0,s.jsxs)("span",{className:"hidden text-muted-foreground sm:inline",children:["You're using v",j,"."]})]}),"desktop"!==v&&(0,s.jsx)("code",{className:"ml-auto hidden max-w-[38rem] truncate rounded-[5px] border border-border bg-muted/40 px-2 py-1 font-mono text-[11px] text-muted-foreground lg:block",children:c[v]}),(0,s.jsx)(o.Button,{type:"button",variant:"desktop"===v?"default":"outline",size:"xs",onClick:y,disabled:p,"aria-label":"desktop"===v?"Update Larkup now":"Copy update command",className:"desktop"===v?"ml-auto":"ml-auto lg:ml-0",children:"desktop"===v?p?"Updating...":"Update now":f?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.Check,{"aria-hidden":"true"}),"Copied"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.Copy,{"aria-hidden":"true"}),"Copy command"]})}),(0,s.jsx)(o.Button,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>{try{localStorage.setItem(d,JSON.stringify({timestamp:Date.now()}))}catch{}h(!1)},"aria-label":"Dismiss update notification",title:"Remind me tomorrow",children:(0,s.jsx)(i.X,{"aria-hidden":"true"})})]})}):null}])}]);
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # larkup
2
2
 
3
+ ## 0.1.23
4
+
5
+ ### Patch Changes
6
+
7
+ - Use `my-larkup` as the initial project name in the web onboarding flow.
8
+
9
+ ## 0.1.22
10
+
11
+ ### Patch Changes
12
+
13
+ - Make `larkup dev` start and open the main Larkup web application on port 4567.
14
+
3
15
  ## 0.1.21
4
16
 
5
17
  ### Patch Changes
package/bin/larkup.js CHANGED
@@ -1,28 +1,56 @@
1
1
  #!/usr/bin/env node
2
- import { spawnSync } from "node:child_process";
3
- import { fileURLToPath } from "node:url";
4
- import path from "node:path";
2
+ import { spawn } from 'node:child_process';
3
+ import { fileURLToPath } from 'node:url';
4
+ import path from 'node:path';
5
+ import { readFileSync } from 'node:fs';
5
6
 
6
7
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
- const packageDir = path.resolve(__dirname, "..");
8
- const nextBin = path.join(packageDir, "node_modules", ".bin", "next");
8
+ const packageDir = path.resolve(__dirname, '..');
9
+ const nextBin = path.join(packageDir, 'node_modules', '.bin', 'next');
10
+ const pkg = JSON.parse(readFileSync(path.join(packageDir, 'package.json'), 'utf8'));
9
11
 
10
12
  const args = process.argv.slice(2);
11
13
  const command = args[0];
12
14
 
13
- if (command === "start") {
14
- const port = process.env.PORT || "4567";
15
- console.log(`Starting Larkup Studio on port ${port}...`);
16
- const result = spawnSync(nextBin, ["start", "-p", port], {
15
+ if (command === '--version' || command === '-v') {
16
+ console.log(pkg.version);
17
+ } else if (command === 'dev' || command === 'start') {
18
+ const port = process.env.PORT || '4567';
19
+ const url = `http://localhost:${port}`;
20
+ console.log(`\x1b[38;2;223;156;32mStarting Larkup…\x1b[0m`);
21
+ const child = spawn(nextBin, ['start', '-p', port], {
17
22
  cwd: packageDir,
18
- stdio: "inherit",
23
+ stdio: 'inherit',
19
24
  });
20
- if (result.error) {
21
- console.error("Failed to start server:", result.error.message);
25
+
26
+ child.once('error', (error) => {
27
+ console.error('Failed to start Larkup:', error.message);
22
28
  process.exit(1);
23
- }
24
- process.exit(result.status ?? 0);
29
+ });
30
+ child.once('exit', (code) => process.exit(code ?? 0));
31
+
32
+ void openWhenReady(url);
25
33
  } else {
26
- console.error("Usage: larkup start");
34
+ console.error('Usage: larkup dev');
27
35
  process.exit(1);
28
36
  }
37
+
38
+ async function openWhenReady(url) {
39
+ for (let attempt = 0; attempt < 80; attempt += 1) {
40
+ try {
41
+ await fetch(url);
42
+ const [command, args] = openCommandForPlatform(url);
43
+ const browser = spawn(command, args, { detached: true, stdio: 'ignore' });
44
+ browser.unref();
45
+ return;
46
+ } catch {
47
+ await new Promise((resolve) => setTimeout(resolve, 250));
48
+ }
49
+ }
50
+ }
51
+
52
+ function openCommandForPlatform(url) {
53
+ if (process.platform === 'darwin') return ['open', [url]];
54
+ if (process.platform === 'win32') return ['cmd', ['/c', 'start', '', url]];
55
+ return ['xdg-open', [url]];
56
+ }
@@ -211,7 +211,7 @@ export function SimpleSetup({ onBack }: SimpleSetupProps) {
211
211
  setBusy(true);
212
212
  try {
213
213
  // Create a default server
214
- const server = await createServer('my-rag');
214
+ const server = await createServer('my-larkup');
215
215
 
216
216
  // Build config
217
217
  const isCloud = connectionMode === 'cloud';
@@ -220,7 +220,7 @@ export function SimpleSetup({ onBack }: SimpleSetupProps) {
220
220
  : `custom:${embeddingModelName}`;
221
221
 
222
222
  const configBody: Record<string, unknown> = {
223
- projectName: 'my-rag',
223
+ projectName: 'my-larkup',
224
224
  embeddingProvider: isCloud ? provider : 'custom',
225
225
  embeddingApiKey: isCloud ? apiKey : '',
226
226
  embeddingModelId,
@@ -137,7 +137,7 @@ export function WelcomeScreen() {
137
137
  await setUsername(name.trim());
138
138
  }
139
139
 
140
- await createServer('My Project');
140
+ await createServer('my-larkup');
141
141
 
142
142
  await fetch('/api/config', {
143
143
  method: 'PUT',
@@ -162,7 +162,7 @@ export function WelcomeScreen() {
162
162
  }
163
163
 
164
164
  // Create a default server so isFirstRun becomes false
165
- await createServer('My Project');
165
+ await createServer('my-larkup');
166
166
 
167
167
  refresh();
168
168
  router.push('/chat');
package/next-env.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="next" />
2
2
  /// <reference types="next/image-types/global" />
3
- import "./.next/types/routes.d.ts";
3
+ import './.next/types/routes.d.ts';
4
4
 
5
5
  // NOTE: This file should not be edited
6
6
  // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
package/package.json CHANGED
@@ -1,42 +1,42 @@
1
1
  {
2
2
  "name": "larkup",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "larkup": "./bin/larkup.js"
7
7
  },
8
8
  "dependencies": {
9
9
  "@ai-sdk/anthropic": "^4.0.15",
10
- "@ai-sdk/cohere": "3.0.39",
11
- "@ai-sdk/deepseek": "2.0.39",
12
- "@ai-sdk/gateway": "3.0.133",
13
- "@ai-sdk/google": "3.0.83",
14
- "@ai-sdk/mistral": "3.0.40",
15
- "@ai-sdk/openai": "3.0.68",
16
- "@ai-sdk/openai-compatible": "2.0.51",
17
- "@ai-sdk/react": "4.0.5",
10
+ "@ai-sdk/cohere": "4.0.12",
11
+ "@ai-sdk/deepseek": "3.0.13",
12
+ "@ai-sdk/gateway": "4.0.28",
13
+ "@ai-sdk/google": "4.0.24",
14
+ "@ai-sdk/mistral": "4.0.14",
15
+ "@ai-sdk/openai": "4.0.20",
16
+ "@ai-sdk/openai-compatible": "3.0.14",
17
+ "@ai-sdk/react": "4.0.40",
18
18
  "@base-ui/react": "^1.5.0",
19
19
  "@codemirror/lang-javascript": "^6.2.5",
20
20
  "@codemirror/lang-json": "^6.0.2",
21
21
  "@codemirror/lang-markdown": "^6.5.0",
22
22
  "@codemirror/lang-python": "^6.2.1",
23
23
  "@codemirror/lang-yaml": "^6.1.3",
24
- "@lancedb/lancedb": "^0.30.0",
24
+ "@lancedb/lancedb": "^0.31.0",
25
25
  "@tauri-apps/plugin-process": "^2.3.1",
26
26
  "@tauri-apps/plugin-updater": "^2.10.1",
27
27
  "@uiw/codemirror-theme-github": "^4.25.10",
28
28
  "@uiw/react-codemirror": "^4.25.10",
29
- "@vercel/analytics": "1.6.1",
30
- "ai": "6.0.197",
29
+ "@vercel/analytics": "2.0.1",
30
+ "ai": "7.0.37",
31
31
  "class-variance-authority": "^0.7.1",
32
32
  "clsx": "^2.1.1",
33
- "dockerode": "^4.0.7",
33
+ "dockerode": "^5.0.1",
34
34
  "framer-motion": "^12.40.0",
35
35
  "idb-keyval": "^6.3.0",
36
36
  "jszip": "^3.10.1",
37
37
  "lucide-react": "^1.16.0",
38
38
  "mammoth": "^1.12.0",
39
- "next": "16.2.6",
39
+ "next": "16.2.12",
40
40
  "next-themes": "^0.4.6",
41
41
  "node-ssh": "^13.2.1",
42
42
  "papaparse": "^5.5.3",
@@ -54,12 +54,12 @@
54
54
  "zod": "^4.4.3",
55
55
  "zustand": "^5.0.14",
56
56
  "@larkup/core": "0.2.0",
57
- "@larkup/marketplace": "0.1.1",
58
57
  "@larkup/sandbox": "0.1.1",
59
58
  "@larkup/scraper": "0.1.21",
59
+ "@larkup/marketplace": "0.1.1",
60
+ "@larkup/tool-video-audio": "0.2.0",
60
61
  "@larkup/tool-doc-editor": "0.2.0",
61
- "@larkup/vector-stores": "0.1.21",
62
- "@larkup/tool-video-audio": "0.2.0"
62
+ "@larkup/vector-stores": "0.1.21"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@tailwindcss/postcss": "^4.2.0",
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,675973,e=>{"use strict";var t=e.i(799718),s=e.i(539104),a=e.i(567821);function n(){return"u">typeof window}function r(){return"production"}function l(){return"development"===((n()?window.vam:r())||"production")}function i(e){return RegExp(`/${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?=[/?#]|$)`)}function o(e){return(0,s.useEffect)(()=>{var t;e.beforeSend&&(null==(t=window.va)||t.call(window,"beforeSend",e.beforeSend))},[e.beforeSend]),(0,s.useEffect)(()=>{!function(e={debug:!0}){var t;if(!n())return;!function(e="auto"){if("auto"===e){window.vam=r();return}window.vam=e}(e.mode),window.va||(window.va=function(...e){(window.vaq=window.vaq||[]).push(e)}),e.beforeSend&&(null==(t=window.va)||t.call(window,"beforeSend",e.beforeSend));let s=e.scriptSrc?e.scriptSrc:l()?"https://va.vercel-scripts.com/v1/script.debug.js":e.basePath?`${e.basePath}/insights/script.js`:"/_vercel/insights/script.js";if(document.head.querySelector(`script[src*="${s}"]`))return;let a=document.createElement("script");a.src=s,a.defer=!0,a.dataset.sdkn="@vercel/analytics"+(e.framework?`/${e.framework}`:""),a.dataset.sdkv="1.6.1",e.disableAutoTrack&&(a.dataset.disableAutoTrack="1"),e.endpoint?a.dataset.endpoint=e.endpoint:e.basePath&&(a.dataset.endpoint=`${e.basePath}/insights`),e.dsn&&(a.dataset.dsn=e.dsn),a.onerror=()=>{let e=l()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${s}. ${e}`)},l()&&!1===e.debug&&(a.dataset.debug="false"),document.head.appendChild(a)}({framework:e.framework||"react",basePath:e.basePath??function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}(),...void 0!==e.route&&{disableAutoTrack:!0},...e})},[]),(0,s.useEffect)(()=>{e.route&&e.path&&function({route:e,path:t}){var s;null==(s=window.va)||s.call(window,"pageview",{route:e,path:t})}({route:e.route,path:e.path})},[e.route,e.path]),null}function d(e){let n,r,l,{route:d,path:c}=(n=(0,a.useParams)(),r=(0,a.useSearchParams)(),l=(0,a.usePathname)(),n?{route:function(e,t){if(!e||!t)return e;let s=e;try{let e=Object.entries(t);for(let[t,a]of e)if(!Array.isArray(a)){let e=i(a);e.test(s)&&(s=s.replace(e,`/[${t}]`))}for(let[t,a]of e)if(Array.isArray(a)){let e=i(a.join("/"));e.test(s)&&(s=s.replace(e,`/[...${t}]`))}return s}catch(t){return e}}(l,Object.keys(n).length?n:Object.fromEntries(r.entries())),path:l}:{route:null,path:l});return s.default.createElement(o,{path:c,route:d,...e,basePath:function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH}(),framework:"next"})}e.s(["Analytics",0,function(e){return s.default.createElement(s.Suspense,{fallback:null},s.default.createElement(d,{...e}))}])},7012,e=>{"use strict";var t=e.i(538863),s=e.i(539104),a=(e,t,s,a,n,r,l,i)=>{let o=document.documentElement,d=["light","dark"];function c(t){var s;(Array.isArray(e)?e:[e]).forEach(e=>{let s="class"===e,a=s&&r?n.map(e=>r[e]||e):n;s?(o.classList.remove(...a),o.classList.add(r&&r[t]?r[t]:t)):o.setAttribute(e,t)}),s=t,i&&d.includes(s)&&(o.style.colorScheme=s)}if(a)c(a);else try{let e=localStorage.getItem(t)||s,a=l&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;c(a)}catch(e){}},n=s.createContext(void 0),r={setTheme:e=>{},themes:[]};s.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:l,defaultTheme:i,value:o,themes:d,nonce:c,scriptProps:u})=>{let m=JSON.stringify([n,t,i,e,d,o,r,l]).slice(1,-1);return s.createElement("script",{...u,suppressHydrationWarning:!0,nonce:"u"<typeof window?c:"",dangerouslySetInnerHTML:{__html:`(${a.toString()})(${m})`}})});var l=e.i(360112),i=e.i(546545),i=i,o=e.i(184861),o=o,d=e.i(670033),d=d,c=e.i(529945),c=c,u=e.i(623582),u=u;e.s(["Toaster",0,({...e})=>{var a;let{theme:m="system"}=null!=(a=s.useContext(n))?a:r;return(0,t.jsx)(l.Toaster,{closeButton:!0,theme:m,className:"toaster group z-9999999! ",icons:{success:(0,t.jsx)(i.default,{className:"size-5 text-white",fill:"#10b981"}),info:(0,t.jsx)(o.default,{className:"size-5 text-white",fill:"#3b82f6"}),warning:(0,t.jsx)(d.default,{className:"size-5 text-white",fill:"#f59e0b"}),error:(0,t.jsx)(c.default,{className:"size-5 text-white",fill:"#ef4444"}),loading:(0,t.jsx)(u.default,{className:"size-5 animate-spin text-muted-foreground"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)",zIndex:999999},toastOptions:{classNames:{toast:"group toast items-start group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900 group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:",icon:"mt-0.5",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",success:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",error:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",warning:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900",info:"group-[.toaster]:!bg-[#F9F9F7] dark:group-[.toaster]:!bg-zinc-900"}},...e})}],7012)},266186,e=>{"use strict";var t=e.i(538863),s=e.i(82100),a=e.i(539104),n=e.i(364086),r=e.i(567821),l=e.i(697934),i=e.i(2e3),o=e.i(24830),d=e.i(643689);let c=(0,d.default)("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);var u=e.i(542677),m=e.i(54134),x=e.i(152236),h=e.i(839717),p=e.i(623012);let g=(0,d.default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);var f=e.i(519528),b=e.i(458266),j=e.i(146141),v=e.i(440087),y=e.i(624529),N=e.i(874560),w=e.i(360112),k=e.i(850628),C=e.i(466691),F=e.i(282879);function A({target:e,open:s,onOpenChange:n}){let{deleteServer:r}=(0,y.useWorkspace)(),[l,i]=(0,a.useState)(!1);async function o(){if(e){i(!0);try{await r(e.id),w.toast.success(`Deleted "${e.name}".`),n(!1)}catch{w.toast.error("Could not delete the server.")}finally{i(!1)}}}return(0,t.jsx)(F.Dialog,{open:s,onOpenChange:n,children:(0,t.jsxs)(F.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsxs)(F.DialogHeader,{children:[(0,t.jsxs)(F.DialogTitle,{children:["Delete “",e?.name,"”?"]}),(0,t.jsx)(F.DialogDescription,{children:"This permanently removes the server's documents, index, vector data, and generated files. This cannot be undone."})]}),(0,t.jsxs)(F.DialogFooter,{children:[(0,t.jsx)(C.Button,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"Cancel"}),(0,t.jsxs)(C.Button,{variant:"destructive",onClick:()=>void o(),disabled:l,children:[l&&(0,t.jsx)(k.Loader2,{className:"size-4 animate-spin"}),"Delete server"]})]})]})})}function S(){let{servers:e,activeServer:s,activateServer:n}=(0,y.useWorkspace)(),[r,l]=(0,a.useState)(!1),[i,o]=(0,a.useState)(null),[d,c]=(0,a.useState)(null);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(v.DropdownMenu,{children:[(0,t.jsxs)(v.DropdownMenuTrigger,{render:(0,t.jsx)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-lg border border-border bg-card px-2 py-1.5 text-left transition-colors hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),children:[(0,t.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-md bg-primary/12 text-primary",children:(0,t.jsx)(m.Server,{className:"size-3.5"})}),(0,t.jsx)("span",{className:"flex min-w-0 flex-1 flex-col",children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:s?.name??"No server"}),s?.running&&(0,t.jsx)(z,{})]})}),(0,t.jsx)(g,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,t.jsxs)(v.DropdownMenuContent,{align:"start",sideOffset:6,className:"w-(--anchor-width) min-w-[260px]",children:[(0,t.jsxs)(v.DropdownMenuGroup,{children:[(0,t.jsx)(v.DropdownMenuLabel,{children:"Your servers"}),e.map(e=>{let a=e.id===s?.id;return(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>{a||n(e.id)},className:"gap-2",children:[(0,t.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:(0,t.jsx)(m.Server,{className:"size-3.5"})}),(0,t.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,t.jsx)("span",{className:"truncate font-medium",children:e.name}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-[11px] text-muted-foreground tabular-nums",children:[(0,t.jsxs)("span",{children:[e.docCount," docs"]}),e.indexed&&(0,t.jsx)("span",{children:"· indexed"}),e.running&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-500",children:[(0,t.jsx)(z,{}),"live"]})]})]}),a&&(0,t.jsx)(p.Check,{className:"size-4 shrink-0 text-primary"})]},e.id)})]}),(0,t.jsx)(v.DropdownMenuSeparator,{}),(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>l(!0),className:"gap-2 h-9",children:[(0,t.jsx)(b.Plus,{className:"size-4"}),"New server"]}),s&&(0,t.jsxs)(v.DropdownMenuItem,{onClick:()=>o(s),className:"gap-2 h-9",children:[(0,t.jsx)(f.Pencil,{className:"size-4"}),"Rename current"]}),s&&e.length>1&&(0,t.jsxs)(v.DropdownMenuItem,{variant:"destructive",onClick:()=>c(s),className:"gap-2",children:[(0,t.jsx)(j.Trash2,{className:"size-4"}),"Delete current"]})]})]}),(0,t.jsx)(N.ServerFormDialog,{mode:"create",open:r,onOpenChange:l}),(0,t.jsx)(N.ServerFormDialog,{mode:"rename",target:i,open:null!==i,onOpenChange:e=>!e&&o(null)}),(0,t.jsx)(A,{target:d,open:null!==d,onOpenChange:e=>!e&&c(null)})]})}function z(){return(0,t.jsxs)("span",{className:"relative flex size-2",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-500"})]})}let D={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},T=[{id:"chat",label:"Chat",href:"/chat",icon:l.MessageCircle},{id:"data",label:"Data",href:"/data",icon:i.Database},{id:"analytics",label:"Analytics",href:"/analytics",icon:c},{id:"settings",label:"Settings",href:"/settings",icon:o.Settings}];function E(){let e=(0,r.usePathname)(),{pageStyle:l,navBg:i}=(0,s.useThemeCustomizer)(),{activeServer:o}=(0,y.useWorkspace)(),[d,c]=(0,a.useState)(!0);(0,a.useEffect)(()=>{"false"===localStorage.getItem("sidebar-collapsed")&&c(!1)},[]);let p=()=>{let e=!d;c(e),localStorage.setItem("sidebar-collapsed",String(e))},g=i?D[i]:void 0;return(0,t.jsx)(h.TooltipProvider,{delay:150,children:(0,t.jsxs)("aside",{className:(0,x.cn)("sticky top-0 hidden h-screen shrink-0 flex-col self-start py-4 md:flex transition-all duration-300 ease-in-out",d?"w-18":"w-60",g?"":"bg-background","fused"===l?"border-r border-border":""),style:g?{backgroundColor:g}:void 0,children:[(0,t.jsx)("div",{className:(0,x.cn)("flex w-full items-center mb-6",d?"justify-center px-3":"justify-between px-4"),children:d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:p,"aria-label":"Expand sidebar",className:"flex size-10 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105"}),children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)(h.TooltipContent,{side:"right",sideOffset:10,children:"Expand sidebar"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(n.default,{href:"/chat",className:"flex items-center gap-2.5",children:[(0,t.jsx)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Larkup"})]}),(0,t.jsx)("button",{onClick:p,className:"flex size-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors","aria-label":"Collapse sidebar",children:(0,t.jsx)(u.ChevronLeft,{className:"size-3.5"})})]})}),(0,t.jsx)("nav",{className:(0,x.cn)("flex flex-1 flex-col w-full",d?"items-center px-3 gap-3":"px-3 gap-1.5"),children:T.map(s=>{let a=s.icon,r=e===s.href||"/"!==s.href&&e?.startsWith(s.href);return d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)(n.default,{href:s.href,"aria-current":r?"page":void 0,onClick:t=>{"chat"===s.id&&"/chat"===e&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,x.cn)("group relative flex size-10 items-center justify-center rounded-xl transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"bg-[#F0F0F0] text-foreground":"text-muted-foreground hover:bg-[#EBEBEB] hover:text-foreground")}),children:(0,t.jsx)(a,{className:"size-4.5",strokeWidth:r?2.25:1.75})}),(0,t.jsx)(h.TooltipContent,{side:"right",sideOffset:10,children:s.label})]},s.id):(0,t.jsxs)(n.default,{href:s.href,"aria-current":r?"page":void 0,onClick:t=>{"chat"===s.id&&"/chat"===e&&(t.preventDefault(),window.dispatchEvent(new CustomEvent("new-chat")))},className:(0,x.cn)("group relative flex items-center gap-3 rounded-xl px-3 py-2.5 text-[13px] font-medium transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring",r?"bg-[#F0F0F0] text-foreground":"text-muted-foreground hover:bg-[#EBEBEB] hover:text-foreground"),children:[(0,t.jsx)(a,{className:"size-4.5 shrink-0",strokeWidth:r?2.25:1.75}),(0,t.jsx)("span",{className:"truncate",children:s.label})]},s.id)})}),(0,t.jsx)("div",{className:(0,x.cn)("w-full pt-3",d?"px-2":"px-3"),children:d?(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:p,className:"flex w-full items-center justify-center py-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors"}),children:(0,t.jsxs)("div",{className:"relative size-8 rounded-lg border border-border bg-card flex items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:[(0,t.jsx)(m.Server,{className:"size-4"}),(0,t.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 flex size-2.5",children:o?.running?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-500 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-green-500 border border-card"})]}):(0,t.jsx)("span",{className:"relative inline-flex size-full rounded-full bg-gray-500 border border-card"})})]})}),(0,t.jsxs)(h.TooltipContent,{side:"right",sideOffset:10,children:[o?.name??"No server"," (",o?.running?"Live":"Offline",")"]})]}):(0,t.jsx)(S,{})})]})})}let M={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},I=[{id:"chat",label:"Chat",href:"/chat",icon:l.MessageCircle},{id:"data",label:"Data",href:"/data",icon:i.Database},{id:"analytics",label:"Analytics",href:"/analytics",icon:c},{id:"settings",label:"Settings",href:"/settings",icon:o.Settings}];function P(){let e=(0,r.usePathname)(),{username:a}=(0,y.useWorkspace)(),{navBg:l}=(0,s.useThemeCustomizer)(),i=l?M[l]:void 0;return(0,t.jsx)(h.TooltipProvider,{delay:150,children:(0,t.jsxs)("header",{className:(0,x.cn)("sticky top-0 z-50 flex h-14 shrink-0 items-center gap-6 border-b border-border px-4 md:px-6",i?"":"bg-[#F5F5F4]"),style:i?{backgroundColor:i}:void 0,children:[(0,t.jsxs)(n.default,{href:"/chat","aria-label":"larkup home",className:"flex items-center gap-2.5 shrink-0",children:[(0,t.jsx)("span",{className:"flex size-9 items-center justify-center rounded-xl bg-primary text-primary-foreground transition-transform hover:scale-105",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-5",alt:"logo"})}),(0,t.jsx)("span",{className:"font-semibold tracking-tight text-foreground hidden sm:inline-block",children:"Larkup"})]}),(0,t.jsx)("nav",{className:"flex h-full items-center gap-1",children:I.map(s=>{let a=s.icon,r=e===s.href||"/"!==s.href&&e?.startsWith(s.href);return(0,t.jsxs)(n.default,{href:s.href,"aria-current":r?"page":void 0,className:(0,x.cn)("group relative flex items-center gap-2 h-full px-3 text-[13px] font-medium transition-colors outline-none",r?"text-primary":"text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(a,{className:"size-[16px]",strokeWidth:r?2.25:1.75}),(0,t.jsx)("span",{className:"hidden md:inline",children:s.label}),(0,t.jsx)("span",{className:(0,x.cn)("absolute bottom-0 left-2 right-2 h-[2px] rounded-full bg-primary transition-opacity",r?"opacity-100":"opacity-0")})]},s.id)})}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(S,{}),a&&(0,t.jsxs)("span",{className:"hidden text-sm text-muted-foreground md:block",children:["Hi, ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:a})]})]})]})})}let B=(0,d.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var _=e.i(266411),L=e.i(755382),L=L,O=e.i(924911),R=e.i(300033),$=e.i(856474),V=e.i(266741);let K=["vercel_ai_gateway","openai","google","mistral","custom"];function W(){let{setUsername:e,createServer:s,refresh:n}=(0,y.useWorkspace)(),l=(0,r.useRouter)(),[i,o]=(0,a.useState)(""),[d,c]=(0,a.useState)("vercel_ai_gateway"),[u,m]=(0,a.useState)(""),[x,h]=(0,a.useState)(null),[p,g]=(0,a.useState)("vercel_ai_gateway"),[b,j]=(0,a.useState)(""),[v,N]=(0,a.useState)(null),[A,S]=(0,a.useState)(!1),[z,D]=(0,a.useState)(!1),[T,E]=(0,a.useState)(null),M="custom"===d,I="custom"===p,P=z||M||d!==p?b:u,W=async()=>{S(!0);try{let t=await fetch("/api/config"),{config:a}=await t.json(),r={...a};M&&x?(r.embeddingProvider="custom",r.embeddingModelId=`custom:${x.modelName}`,r.embeddingApiKey=x.apiKey||void 0,r.customEmbeddings=[x]):(r.embeddingProvider=d,r.embeddingApiKey=u),z?I&&v?(r.chatProvider="custom",r.chatModelId=`custom:${v.modelName}`,r.chatApiKey=v.apiKey||void 0,r.customChatModels=[v]):(r.chatProvider=p,r.chatApiKey=P):M&&x||(r.chatProvider=d,r.chatApiKey=u);let o=await fetch("/api/config/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({embeddingProvider:r.embeddingProvider,embeddingApiKey:r.embeddingApiKey,embeddingModelId:r.embeddingModelId,customEmbeddings:r.customEmbeddings,chatProvider:r.chatProvider,chatApiKey:r.chatApiKey,chatModelId:r.chatModelId,customChatModels:r.customChatModels})});if(!o.ok){let e=await o.json();w.toast.error(e.error||"Verification failed — please check your API key.",{duration:8e3}),S(!1);return}i.trim()&&await e(i.trim()),await s("My Project"),await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n(),l.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},U=async()=>{S(!0);try{i.trim()&&await e(i.trim()),await s("My Project"),n(),l.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},H=(e,s)=>(0,t.jsxs)(R.Select,{value:e,onValueChange:e=>{var t;"custom"===(t=e??"")?("embedding"===s?c("custom"):g("custom"),E(s)):"embedding"===s?(c(t),h(null),!z&&g(t)):(g(t),N(null))},children:[(0,t.jsx)(R.SelectTrigger,{className:"w-full bg-white/90 hover:bg-white",children:(0,t.jsx)("span",{className:"flex items-center gap-2",children:$.PROVIDER_META[e]?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)($.ProviderIcon,{src:$.PROVIDER_META[e].iconSrc,alt:$.PROVIDER_META[e].label,pillBg:$.PROVIDER_META[e].pillBg,size:16}),$.PROVIDER_META[e].label]}):"Select provider"})}),(0,t.jsx)(R.SelectContent,{children:K.map(e=>{let s=$.PROVIDER_META[e];return s?(0,t.jsx)(R.SelectItem,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)($.ProviderIcon,{src:s.iconSrc,alt:s.label,pillBg:s.pillBg,size:16}),(0,t.jsxs)("span",{children:[s.label,"vercel_ai_gateway"===e&&" (Recommended)","custom"===e&&" (OpenAI-compatible)"]})]})},e):null})})]}),q=(e,s)=>(0,t.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 rounded-lg border border-green-200 bg-green-50/50 px-3 py-2",children:[(0,t.jsx)("span",{className:"text-green-600 text-xs",children:"✓"}),(0,t.jsx)("span",{className:"flex-1 truncate text-xs font-medium text-foreground",children:e.modelName}),(0,t.jsx)("button",{type:"button",onClick:()=>E(s),className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(f.Pencil,{className:"size-3"})})]});return(0,t.jsxs)("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-background",children:[(0,t.jsxs)("div",{className:"pointer-events-none fixed inset-0 overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute -left-20 -top-20 h-125 w-125 rounded-full bg-stone-200/40 blur-3xl animate-pulse"}),(0,t.jsx)("div",{className:"absolute -bottom-32 -right-32 h-150 w-150 rounded-full bg-amber-100/30 blur-3xl animate-pulse [animation-delay:1s]"})]}),(0,t.jsx)("div",{className:"relative z-10 flex min-h-full w-full flex-col items-center justify-center px-6 py-12",children:(0,t.jsxs)("div",{className:"flex w-full max-w-lg flex-col items-center gap-8 animate-fade-up",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center",children:[(0,t.jsx)("div",{className:"flex size-14 items-center justify-center rounded-xl bg-primary text-primary-foreground ",children:(0,t.jsx)("img",{src:"/logo9.png",className:"size-8",alt:"Larkup"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Welcome to Larkup"}),(0,t.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Let's set up your AI models. You can change these later in Settings."})]})]}),(0,t.jsxs)("div",{className:"w-full space-y-5 rounded-2xl p-6 backdrop-blur-xl",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Your Name (Optional)"}),(0,t.jsx)(O.Input,{value:i,onChange:e=>o(e.target.value),placeholder:"How should we call you?",className:"bg-background/50"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Embedding Provider"}),H(d,"embedding"),M&&x&&q(x,"embedding"),M&&!x&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!M&&(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("label",{className:"text-xs font-medium text-foreground",children:["API Key",!z&&(0,t.jsxs)("span",{className:"text-muted-foreground font-normal",children:[" ","(used for both embedding & chat)"]})]}),(0,t.jsx)(O.Input,{type:"password",value:u,onChange:e=>m(e.target.value),placeholder:"sk-...",className:"bg-background/50"})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>D(!z),className:"flex w-full items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[z?(0,t.jsx)(L.default,{className:"size-3.5"}):(0,t.jsx)(_.ChevronDown,{className:"size-3.5"}),"Use a different chat model"]}),z&&(0,t.jsxs)("div",{className:"space-y-3 rounded-xl border border-border/40 bg-muted/20 p-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat Provider"}),H(p,"chat"),I&&v&&q(v,"chat"),I&&!v&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!I&&(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-foreground",children:"Chat API Key"}),(0,t.jsx)(O.Input,{type:"password",value:b,onChange:e=>j(e.target.value),placeholder:"sk-...",className:"bg-background/50"})]})]}),(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"More providers and fine-grained model selection available in Settings → AI Models."}),(0,t.jsxs)("div",{className:"pt-2 flex gap-3",children:[(0,t.jsx)(C.Button,{variant:"outline",className:"flex-1",onClick:U,disabled:A,children:"Skip for now"}),(0,t.jsx)(C.Button,{className:"flex-1",onClick:W,disabled:A||!(()=>{if(M){if(!x)return!1}else if(!u)return!1;if(z){if(I){if(!v)return!1}else if(!P)return!1}return!0})(),children:A?(0,t.jsx)(k.Loader2,{className:"size-4 animate-spin"}):(0,t.jsxs)(t.Fragment,{children:["Continue ",(0,t.jsx)(B,{className:"ml-1.5 size-4"})]})})]})]})]})}),(0,t.jsx)(F.Dialog,{open:null!==T,onOpenChange:e=>{e||("embedding"!==T||x||c("vercel_ai_gateway"),"chat"!==T||v||g("vercel_ai_gateway"),E(null))},children:(0,t.jsxs)(F.DialogContent,{className:"max-w-xl",children:[(0,t.jsxs)(F.DialogHeader,{children:[(0,t.jsxs)(F.DialogTitle,{children:["Custom ","embedding"===T?"Embedding":"Chat"," Model"]}),(0,t.jsxs)(F.DialogDescription,{children:["Connect an OpenAI-compatible ","embedding"===T?"embedding":"chat"," ","model. Test the connection before adding."]})]}),T&&(0,t.jsx)(V.CustomModelForm,{type:T,onSave:e=>{"embedding"===T?(h(e),c("custom")):"chat"===T&&(N(e),g("custom")),E(null)},onCancel:()=>{"embedding"!==T||x||c("vercel_ai_gateway"),"chat"!==T||v||g("vercel_ai_gateway"),E(null)}})]})})]})}let U={"panel-default":"#FAFAFA","panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"};e.s(["ClientLayoutWrapper",0,function({children:e}){let{pageStyle:a,panelBg:n,layout:l}=(0,s.useThemeCustomizer)(),i=(0,r.usePathname)(),o=i?.includes("/chat"),{isFirstRun:d,isLoading:c}=(0,y.useWorkspace)(),u=U[n],m=u?{backgroundColor:u}:void 0;return!c&&d?(0,t.jsx)(W,{}):c?(0,t.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,t.jsx)("div",{className:"size-6 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):"topnav"===l?(0,t.jsxs)("div",{className:"flex flex-col h-screen overflow-hidden",children:[(0,t.jsx)(P,{}),(0,t.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,t.jsx)("div",{className:"h-full flex flex-col bg-background text-foreground",style:m,children:(0,t.jsx)("div",{className:(0,x.cn)("flex-1 min-h-0",o||i?.includes("/settings")||i?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||i?.includes("/settings")||i?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:e})})})})]}):(0,t.jsxs)("div",{className:"flex h-screen overflow-hidden",children:[(0,t.jsx)(E,{}),(0,t.jsx)("main",{className:"min-w-0 flex-1 overflow-hidden",children:(0,t.jsx)("div",{className:"fused"===a?"h-screen flex flex-col bg-background text-foreground overflow-hidden":"h-screen flex flex-col md:rounded-l-2xl border-l border-border bg-panel text-panel-foreground overflow-hidden",style:m,children:(0,t.jsx)("div",{className:(0,x.cn)("flex-1 min-h-0",o||i?.includes("/settings")||i?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||i?.includes("/settings")||i?.includes("/analytics")?"flex-1 min-h-0 flex flex-col":"container mx-auto pb-8"),children:e})})})})]})}],266186)},953159,e=>{"use strict";var t=e.i(538863),s=e.i(423484),a=e.i(850628),n=e.i(539104),r=e.i(447932),l=e.i(643689);let i=(0,l.default)("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);var o=e.i(248384);let d=(0,l.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);var c=e.i(2e3),u=e.i(182832);let m=(0,l.default)("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);var x=e.i(439399),h=e.i(470175),p=e.i(704101),g=e.i(55339);let f=(0,l.default)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);var b=e.i(682458),j=e.i(161351),v=e.i(466691),y=e.i(861947),N=e.i(323621),w=e.i(524365),k=e.i(534792),C=e.i(360112),F=e.i(878835),A=e.i(282879);let S=e=>fetch(e).then(e=>e.json()),z=["chunking","embedding","upserting"];function D({open:e,onOpenChange:l,trigger:i}){let[o,d]=(0,n.useState)(!1),[c,u]=(0,n.useState)(!1),m=void 0!==e,f=m?e:c,b=m&&l?l:u,{data:j,isLoading:y,mutate:N}=(0,s.default)("/api/index",S,{refreshInterval:e=>e?.run&&z.includes(e.run.status)?1e3:0}),E=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{let e=j?.run?.warning;e&&e!==E.current?C.toast.warning(e,{id:"rate-limit-warning",duration:7e4}):!e&&E.current&&(C.toast.dismiss("rate-limit-warning"),C.toast.success("Rate limit resolved — resuming indexing.",{duration:3e3})),E.current=e},[j?.run?.warning]);let[I,P]=(0,n.useState)(!1);async function B(e=!1){d(!0);try{let t=await fetch("/api/index",{method:"POST",body:JSON.stringify({incremental:e}),headers:{"Content-Type":"application/json"}}),s=await t.json();if(!t.ok)return void C.toast.error(s.error??"Could not start indexing.");C.toast.success("Indexing started."),N()}catch{C.toast.error("Could not start indexing.")}finally{d(!1)}}async function _(){d(!0);try{if(!(await fetch("/api/index",{method:"DELETE"})).ok)return void C.toast.error("Could not cancel indexing.");C.toast.success("Indexing cancelled."),N()}catch{C.toast.error("Could not cancel indexing.")}finally{d(!1)}}return(0,n.useEffect)(()=>{let e=j?.run?.status;e&&z.includes(e)?P(!0):I&&"completed"===e&&(P(!1),b(!1),C.toast.success("Indexing completed successfully!"))},[j?.run?.status,I,b]),(0,t.jsxs)(A.Dialog,{open:f,onOpenChange:b,children:[i?(0,t.jsx)(A.DialogTrigger,{render:(0,n.isValidElement)(i)?i:(0,t.jsx)("button",{children:i})}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j?.run?.status==="completed"&&(0,t.jsxs)(F.AlertDialog,{children:[(0,t.jsx)(F.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{disabled:!j.ready||!!(j.run&&z.includes(j.run.status))||o,variant:"outline",children:[(0,t.jsx)(g.RotateCcw,{className:"size-4 mr-2"}),"Re-Index Data"]})}),(0,t.jsxs)(F.AlertDialogContent,{children:[(0,t.jsxs)(F.AlertDialogHeader,{children:[(0,t.jsx)(F.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(F.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(F.AlertDialogFooter,{children:[(0,t.jsx)(F.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(F.AlertDialogAction,{onClick:()=>{b(!0),B(!1)},children:"Continue"})]})]})]}),(0,t.jsx)(A.DialogTrigger,{render:(0,t.jsxs)(v.Button,{disabled:!j?.ready||j?.unindexedCount===0,children:[(0,t.jsx)(h.Layers,{className:"size-4 mr-2"}),"Index Data"]})})]}),(0,t.jsxs)(A.DialogContent,{className:"max-w-2xl max-h-[90vh] overflow-y-auto ",children:[(0,t.jsxs)(A.DialogHeader,{children:[(0,t.jsx)(A.DialogTitle,{children:"Index Data"}),(0,t.jsx)(A.DialogDescription,{children:"Chunk, embed, and index into your selected vector database."})]}),y||!j?(0,t.jsx)("div",{className:"py-6",children:(0,t.jsx)(k.Skeleton,{className:"h-40 w-full"})}):(0,t.jsxs)("div",{className:"space-y-6 py-4",children:[(0,t.jsx)(T,{config:j.config,docCount:j.docCount,charCount:j.charCount}),!j.ready&&(0,t.jsxs)(w.Alert,{variant:"default",children:[(0,t.jsx)(r.AlertTriangle,{className:"size-4 text-orange-500!"}),(0,t.jsx)(w.AlertTitle,{className:"text-orange-500!",children:"Not ready to index"}),(0,t.jsx)(w.AlertDescription,{children:(0,t.jsx)("ul",{className:"list-disc pl-4",children:j.blockers.map(e=>(0,t.jsx)("li",{children:e},e))})})]}),(0,t.jsx)(M,{run:j.run,running:!!(j.run&&z.includes(j.run.status))}),j.ready&&!j.run&&(0,t.jsxs)(w.Alert,{children:[(0,t.jsx)(x.Info,{className:"size-4 text-blue-500!"}),(0,t.jsx)(w.AlertTitle,{className:"text-blue-600 dark:text-blue-400",children:"Before you start indexing"}),(0,t.jsxs)(w.AlertDescription,{className:"text-muted-foreground space-y-1",children:[(0,t.jsxs)("p",{children:["Once indexing begins, two settings become"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:"locked"})," to the existing index:"]}),(0,t.jsxs)("ul",{className:"list-disc pl-4 space-y-0.5",children:[(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"Embedding model"})," — you can swap to any model with the"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:"same vector dimensions"}),", but switching to a model with different dimensions will require a full re-index."]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"Vector store"})," — changing the store after indexing requires starting fresh."]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)(v.Button,{onClick:()=>B(j.run?.status==="completed"),disabled:!j.ready||!!(j.run&&z.includes(j.run.status))||o||j.run?.status==="completed"&&0===j.unindexedCount,size:"lg",children:[j.run&&z.includes(j.run.status)||o?(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin mr-2"}):(0,t.jsx)(p.Play,{className:"size-4 mr-2"}),j.run&&z.includes(j.run.status)?"Indexing…":o?"Starting…":j.run?.status==="completed"?`Index new documents (${j.unindexedCount})`:`Start indexing (${j.unindexedCount})`]}),j.run?.status==="completed"&&!(j.run&&z.includes(j.run.status))&&(0,t.jsxs)(F.AlertDialog,{children:[(0,t.jsx)(F.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{variant:"outline",size:"lg",disabled:o,children:[(0,t.jsx)(g.RotateCcw,{className:"size-4 mr-2"}),"Re-Index All"]})}),(0,t.jsxs)(F.AlertDialogContent,{children:[(0,t.jsxs)(F.AlertDialogHeader,{children:[(0,t.jsx)(F.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(F.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(F.AlertDialogFooter,{children:[(0,t.jsx)(F.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(F.AlertDialogAction,{onClick:()=>{b(!0),B(!1)},children:"Continue"})]})]})]}),!!(j.run&&z.includes(j.run.status))&&(0,t.jsx)(v.Button,{onClick:_,disabled:o,size:"lg",variant:"destructive",children:"Cancel"})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"lg",onClick:()=>b(!1),children:"Close"})]})]})]})]})}function T({config:e,docCount:s,charCount:a}){let n=(0,b.getEmbeddingModel)(e.embeddingModelId),r=(0,j.getVectorStore)(e.vectorStore),l=[{icon:d,label:"Embedding model",value:n?.label??e.embeddingModelId,hint:n?`${n.dimensions} dims`:void 0},{icon:c.Database,label:"Vector store",value:r?.label??e.vectorStore},{icon:i,label:"Index type",value:e.indexType.toUpperCase()},{icon:f,label:"Chunking",value:`${e.chunking.chunkSize} / ${e.chunking.chunkOverlap}`,hint:"size / overlap"},{icon:u.FileText,label:"Corpus",value:`${s.toLocaleString()} docs`,hint:`${a.toLocaleString()} chars`}];return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-base font-semibold mb-4",children:[(0,t.jsx)(h.Layers,{className:"size-4 text-primary"}),"Index configuration"]}),(0,t.jsx)("dl",{className:"grid grid-cols-2 gap-x-6 gap-y-5 sm:grid-cols-3",children:l.map(e=>(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsxs)("dt",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(e.icon,{className:"size-3.5"}),e.label]}),(0,t.jsxs)("dd",{className:"text-sm font-medium leading-tight",children:[e.value,e.hint&&(0,t.jsx)("span",{className:"ml-1.5 font-mono text-[11px] font-normal text-muted-foreground",children:e.hint})]})]},e.label))})]})}let E={idle:{label:"Idle"},chunking:{label:"Chunking",phase:"Splitting documents into chunks"},embedding:{label:"Embedding",phase:"Generating vector embeddings"},upserting:{label:"Storing",phase:"Writing vectors to the store"},completed:{label:"Completed"},failed:{label:"Failed"}};function M({run:e,running:s}){if(!e)return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground flex flex-col items-center justify-center gap-1 py-8 text-center",children:[(0,t.jsx)(m,{className:"mb-1 size-6 text-muted-foreground/60"}),(0,t.jsx)("p",{className:"text-sm font-medium",children:"No index built yet"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Build a Larkup index to embed your corpus and make it searchable."})]});let n=E[e.status],l=e.totalChunks>0?Math.round(e.processedChunks/e.totalChunks*100):5*!!s;return(0,t.jsxs)("div",{className:"rounded-xl border bg-card text-card-foreground p-4 space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-row items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-base font-semibold",children:["completed"===e.status?(0,t.jsx)(o.CheckCircle2,{className:"size-4 text-primary"}):"failed"===e.status?(0,t.jsx)(r.AlertTriangle,{className:"size-4 text-destructive"}):(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin text-primary"}),n.label]}),(0,t.jsx)(P,{status:e.status})]}),"failed"===e.status?(0,t.jsx)(t.Fragment,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:n.phase??"Done"}),(0,t.jsxs)("span",{className:"font-mono tabular-nums",children:[e.processedChunks.toLocaleString(),e.totalChunks>0&&` / ${e.totalChunks.toLocaleString()}`," chunks"]})]}),(0,t.jsx)(y.Progress,{value:l,className:"**:data-[slot=progress-indicator]:bg-green-600"})]}),(0,t.jsxs)("dl",{className:"grid grid-cols-2 gap-4 pt-1 sm:grid-cols-4",children:[(0,t.jsx)(I,{label:"Documents",value:e.docCount.toLocaleString()}),(0,t.jsx)(I,{label:"Chunks",value:e.totalChunks.toLocaleString()}),(0,t.jsx)(I,{label:"Dimensions",value:e.dimensions?e.dimensions.toLocaleString():"—"}),(0,t.jsx)(I,{label:"Duration",value:e.durationMs?`${(e.durationMs/1e3).toFixed(1)}s`:s?"running…":"—"})]})]})]})}function I({label:e,value:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("dt",{className:"text-xs text-muted-foreground",children:e}),(0,t.jsx)("dd",{className:"font-mono text-sm tabular-nums",children:s})]})}function P({status:e}){return"completed"===e?(0,t.jsx)(N.Badge,{className:"bg-primary/12 text-primary hover:bg-primary/12",children:"Ready"}):"failed"===e?(0,t.jsx)(N.Badge,{variant:"destructive",children:"Failed"}):z.includes(e)?(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-green-600",children:[(0,t.jsxs)("span",{className:"relative flex size-2",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-600 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex size-2 rounded-full bg-green-600"})]}),"Live"]}):null}let B=e=>fetch(e).then(e=>e.json()),_=["chunking","embedding","upserting"];e.s(["GlobalIndexProgress",0,function(){let{data:e}=(0,s.default)("/api/index",B,{refreshInterval:e=>e?.run&&_.includes(e.run.status)?1e3:0});if(!(e?.run&&_.includes(e.run.status))||!e?.run)return null;let{run:n}=e,r=n.totalChunks>0?Math.round(n.processedChunks/n.totalChunks*100):5;return(0,t.jsx)("div",{className:"fixed bottom-6 right-6 z-50",children:(0,t.jsx)(D,{trigger:(0,t.jsxs)("button",{className:"flex items-center gap-3 rounded-full border bg-background px-4 py-2 text-sm font-medium transition-all hover:bg-muted/50 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[(0,t.jsx)(a.Loader2,{className:"size-4 animate-spin text-primary"}),(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,t.jsx)("span",{className:"text-xs leading-none text-muted-foreground",children:"Storing..."}),(0,t.jsxs)("span",{className:"leading-none",children:[r,"%"]})]})]})})})}],953159)},232295,e=>{"use strict";var t=e.i(799718),s=e.i(538863),a=e.i(539104),n=e.i(926125),r=e.i(623012),l=e.i(789085),i=e.i(432501),o=e.i(466691);let d="larkup-update-dismissed",c={docker:"docker compose pull && docker compose up -d",npm:"larkup update"};e.s(["UpdateBanner",0,function(){let[u,m]=(0,a.useState)(null),[x,h]=(0,a.useState)(!1),[p,g]=(0,a.useState)(!1),[f,b]=(0,a.useState)(!1),j="0.1.21",v="__TAURI__"in window?"desktop":"true"===t.default.env.NEXT_PUBLIC_DOCKER_ENV||"true"===t.default.env.NEXT_PUBLIC_RUNNING_IN_DOCKER?"docker":"npm";(0,a.useEffect)(()=>{if(function(){try{let e=localStorage.getItem(d);if(!e)return!1;let{timestamp:t}=JSON.parse(e);return Date.now()-t<864e5}catch{return!1}}())return;let e=new AbortController;return fetch("https://larkup.de/api/version",{signal:e.signal,cache:"no-store"}).then(e=>e.json()).then(e=>{e.version&&function(e,t){let s=e.replace(/^v/,"").split(".").map(Number),a=t.replace(/^v/,"").split(".").map(Number);for(let e=0;e<3;e++){let t=s[e]||0,n=a[e]||0;if(t>n)return 1;if(t<n)return -1}return 0}(e.version,j)>0&&(m(e.version),h(!0))}).catch(()=>{}),()=>e.abort()},[j]);let y=async()=>{if("desktop"===v){g(!0);try{let{check:t}=await e.A(963347),{relaunch:s}=await e.A(995308),a=await t();a?(await a.downloadAndInstall(),await s()):g(!1)}catch(e){console.error("Auto-update failed:",e),g(!1),window.open("https://larkup.de/download","_blank")}}else try{await navigator.clipboard.writeText(c[v]),b(!0),window.setTimeout(()=>b(!1),2e3)}catch(e){console.error("Could not copy update command:",e)}};return x&&u?(0,s.jsx)("div",{role:"status","aria-live":"polite",className:"relative z-50 border-b border-border bg-background px-3 py-2 text-foreground sm:px-4",children:(0,s.jsxs)("div",{className:"mx-auto flex min-h-7 max-w-screen-2xl items-center gap-2.5",children:[(0,s.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background",children:(0,s.jsx)(n.ArrowUp,{className:"size-3.5","aria-hidden":"true"})}),(0,s.jsxs)("p",{className:"min-w-0 text-xs sm:text-sm",children:[(0,s.jsxs)("span",{className:"font-medium",children:["Larkup v",u," is available."]})," ",(0,s.jsxs)("span",{className:"hidden text-muted-foreground sm:inline",children:["You're using v",j,"."]})]}),"desktop"!==v&&(0,s.jsx)("code",{className:"ml-auto hidden max-w-[38rem] truncate rounded-[5px] border border-border bg-muted/40 px-2 py-1 font-mono text-[11px] text-muted-foreground lg:block",children:c[v]}),(0,s.jsx)(o.Button,{type:"button",variant:"desktop"===v?"default":"outline",size:"xs",onClick:y,disabled:p,"aria-label":"desktop"===v?"Update Larkup now":"Copy update command",className:"desktop"===v?"ml-auto":"ml-auto lg:ml-0",children:"desktop"===v?p?"Updating...":"Update now":f?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.Check,{"aria-hidden":"true"}),"Copied"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.Copy,{"aria-hidden":"true"}),"Copy command"]})}),(0,s.jsx)(o.Button,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>{try{localStorage.setItem(d,JSON.stringify({timestamp:Date.now()}))}catch{}h(!1)},"aria-label":"Dismiss update notification",title:"Remind me tomorrow",children:(0,s.jsx)(i.X,{"aria-hidden":"true"})})]})}):null}])}]);