larkup 0.1.40 → 0.1.41

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 (176) 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 +8 -8
  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/0598_next_dist_esm_build_templates_app-route_0kbcuk-.js +8 -7
  68. package/.next/server/chunks/[root-of-the-server]__0j2l54r._.js +1 -1
  69. package/.next/server/chunks/packages_scraper_src_0kkcv_v._.js +1 -1
  70. package/.next/server/chunks/ssr/_169pdlf._.js +5 -5
  71. package/.next/server/chunks/ssr/_1yqlx1m._.js +1 -1
  72. package/.next/server/middleware-build-manifest.js +3 -3
  73. package/.next/server/pages/404.html +1 -1
  74. package/.next/server/pages/500.html +1 -1
  75. package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
  76. package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
  77. package/.next/standalone/apps/web/.next/required-server-files.json +1 -1
  78. package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
  79. package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
  80. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  81. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  82. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  83. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  84. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  85. package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  86. package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
  87. package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +16 -16
  88. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +16 -16
  89. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  90. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
  91. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  92. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  93. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  94. package/.next/standalone/apps/web/.next/server/app/analytics/page_client-reference-manifest.js +1 -1
  95. package/.next/standalone/apps/web/.next/server/app/analytics.html +1 -1
  96. package/.next/standalone/apps/web/.next/server/app/analytics.rsc +17 -17
  97. package/.next/standalone/apps/web/.next/server/app/analytics.segments/_full.segment.rsc +17 -17
  98. package/.next/standalone/apps/web/.next/server/app/analytics.segments/_head.segment.rsc +4 -4
  99. package/.next/standalone/apps/web/.next/server/app/analytics.segments/_index.segment.rsc +11 -11
  100. package/.next/standalone/apps/web/.next/server/app/analytics.segments/_tree.segment.rsc +1 -1
  101. package/.next/standalone/apps/web/.next/server/app/analytics.segments/analytics/__PAGE__.segment.rsc +3 -3
  102. package/.next/standalone/apps/web/.next/server/app/analytics.segments/analytics.segment.rsc +3 -3
  103. package/.next/standalone/apps/web/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  104. package/.next/standalone/apps/web/.next/server/app/chat.html +1 -1
  105. package/.next/standalone/apps/web/.next/server/app/chat.rsc +17 -17
  106. package/.next/standalone/apps/web/.next/server/app/chat.segments/_full.segment.rsc +17 -17
  107. package/.next/standalone/apps/web/.next/server/app/chat.segments/_head.segment.rsc +4 -4
  108. package/.next/standalone/apps/web/.next/server/app/chat.segments/_index.segment.rsc +11 -11
  109. package/.next/standalone/apps/web/.next/server/app/chat.segments/_tree.segment.rsc +1 -1
  110. package/.next/standalone/apps/web/.next/server/app/chat.segments/chat/__PAGE__.segment.rsc +3 -3
  111. package/.next/standalone/apps/web/.next/server/app/chat.segments/chat.segment.rsc +3 -3
  112. package/.next/standalone/apps/web/.next/server/app/data/page_client-reference-manifest.js +1 -1
  113. package/.next/standalone/apps/web/.next/server/app/data.html +1 -1
  114. package/.next/standalone/apps/web/.next/server/app/data.rsc +17 -17
  115. package/.next/standalone/apps/web/.next/server/app/data.segments/_full.segment.rsc +17 -17
  116. package/.next/standalone/apps/web/.next/server/app/data.segments/_head.segment.rsc +4 -4
  117. package/.next/standalone/apps/web/.next/server/app/data.segments/_index.segment.rsc +11 -11
  118. package/.next/standalone/apps/web/.next/server/app/data.segments/_tree.segment.rsc +1 -1
  119. package/.next/standalone/apps/web/.next/server/app/data.segments/data/__PAGE__.segment.rsc +3 -3
  120. package/.next/standalone/apps/web/.next/server/app/data.segments/data.segment.rsc +3 -3
  121. package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
  122. package/.next/standalone/apps/web/.next/server/app/index.rsc +16 -16
  123. package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  124. package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +16 -16
  125. package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +4 -4
  126. package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +11 -11
  127. package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  128. package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  129. package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  130. package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
  131. package/.next/standalone/apps/web/.next/server/app/settings.rsc +18 -18
  132. package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +18 -18
  133. package/.next/standalone/apps/web/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  134. package/.next/standalone/apps/web/.next/server/app/settings.segments/_index.segment.rsc +11 -11
  135. package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  136. package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  137. package/.next/standalone/apps/web/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  138. package/.next/standalone/apps/web/.next/server/chunks/0598_next_dist_esm_build_templates_app-route_0kbcuk-.js +8 -7
  139. package/.next/standalone/apps/web/.next/server/chunks/[root-of-the-server]__0j2l54r._.js +1 -1
  140. package/.next/standalone/apps/web/.next/server/chunks/packages_scraper_src_0kkcv_v._.js +1 -1
  141. package/.next/standalone/apps/web/.next/server/chunks/ssr/_169pdlf._.js +5 -5
  142. package/.next/standalone/apps/web/.next/server/chunks/ssr/_1yqlx1m._.js +1 -1
  143. package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
  144. package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
  145. package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
  146. package/.next/standalone/apps/web/.next/static/chunks/{2_qbhu4zxkm7j.js → 2dvtyg2k2op4x.js} +5 -5
  147. package/.next/{static/chunks/1b9srvyupwcjz.js → standalone/apps/web/.next/static/chunks/2x1t8sqst0ipu.js} +1 -1
  148. package/.next/standalone/apps/web/CHANGELOG.md +9 -0
  149. package/.next/standalone/apps/web/app/api/chat/route.ts +9 -2
  150. package/.next/standalone/apps/web/app/api/chat/tools.ts +10 -1
  151. package/.next/standalone/apps/web/components/data/firecrawl-notice.tsx +3 -3
  152. package/.next/standalone/apps/web/components/data/media-panel.tsx +3 -8
  153. package/.next/standalone/apps/web/components/data/scrape-panel.tsx +3 -11
  154. package/.next/standalone/apps/web/components/index/index-workspace.tsx +1 -1
  155. package/.next/standalone/apps/web/package.json +1 -1
  156. package/.next/standalone/apps/web/server.js +1 -1
  157. package/.next/standalone/packages/tools/video-audio/CHANGELOG.md +6 -0
  158. package/.next/standalone/packages/tools/video-audio/dist/url-importer.js +37 -5
  159. package/.next/standalone/packages/tools/video-audio/package.json +1 -1
  160. package/.next/standalone/packages/tools/video-audio/src/url-importer.ts +61 -25
  161. package/.next/static/chunks/{2_qbhu4zxkm7j.js → 2dvtyg2k2op4x.js} +5 -5
  162. package/.next/{standalone/apps/web/.next/static/chunks/1b9srvyupwcjz.js → static/chunks/2x1t8sqst0ipu.js} +1 -1
  163. package/CHANGELOG.md +9 -0
  164. package/app/api/chat/route.ts +9 -2
  165. package/app/api/chat/tools.ts +10 -1
  166. package/components/data/firecrawl-notice.tsx +3 -3
  167. package/components/data/media-panel.tsx +3 -8
  168. package/components/data/scrape-panel.tsx +3 -11
  169. package/components/index/index-workspace.tsx +1 -1
  170. package/package.json +6 -6
  171. /package/.next/standalone/apps/web/.next/static/{7yuxi3XYqMr4kxUl6T-qk → whR5PvI0kapiCtaze5Lb0}/_buildManifest.js +0 -0
  172. /package/.next/standalone/apps/web/.next/static/{7yuxi3XYqMr4kxUl6T-qk → whR5PvI0kapiCtaze5Lb0}/_clientMiddlewareManifest.js +0 -0
  173. /package/.next/standalone/apps/web/.next/static/{7yuxi3XYqMr4kxUl6T-qk → whR5PvI0kapiCtaze5Lb0}/_ssgManifest.js +0 -0
  174. /package/.next/static/{7yuxi3XYqMr4kxUl6T-qk → whR5PvI0kapiCtaze5Lb0}/_buildManifest.js +0 -0
  175. /package/.next/static/{7yuxi3XYqMr4kxUl6T-qk → whR5PvI0kapiCtaze5Lb0}/_clientMiddlewareManifest.js +0 -0
  176. /package/.next/static/{7yuxi3XYqMr4kxUl6T-qk → whR5PvI0kapiCtaze5Lb0}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,721606,e=>{"use strict";var t=e.i(199910),s=e.i(178328),a=e.i(732684);function n(){return"u">typeof window}function r(){return"production"}function i(){return"development"===((n()?window.vam:r())||"production")}function l(e){return RegExp(`/${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?=[/?#]|$)`)}function o(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:`/${e}`}function d(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},t){var s;if(!n())return;let{beforeSend:a,src:l,dataset:d}=function(e,t){var s,a;let n=e;if(t)try{n={...null==(s=JSON.parse(t))?void 0:s.analytics,...e}}catch{}!function(e="auto"){if("auto"===e){window.vam=r();return}window.vam=e}(n.mode);let l={sdkn:"@vercel/analytics"+(n.framework?`/${n.framework}`:""),sdkv:"2.0.1"};return n.disableAutoTrack&&(l.disableAutoTrack="1"),n.viewEndpoint&&(l.viewEndpoint=o(n.viewEndpoint)),n.eventEndpoint&&(l.eventEndpoint=o(n.eventEndpoint)),n.sessionEndpoint&&(l.sessionEndpoint=o(n.sessionEndpoint)),i()&&!1===n.debug&&(l.debug="false"),n.dsn&&(l.dsn=n.dsn),n.endpoint?l.endpoint=n.endpoint:n.basePath&&(l.endpoint=o(`${n.basePath}/insights`)),{beforeSend:n.beforeSend,src:(a=n).scriptSrc?o(a.scriptSrc):i()?"https://va.vercel-scripts.com/v1/script.debug.js":a.basePath?o(`${a.basePath}/insights/script.js`):"/_vercel/insights/script.js",dataset:l}}(e,t);if(window.va||(window.va=function(...e){window.vaq||(window.vaq=[]),window.vaq.push(e)}),a&&(null==(s=window.va)||s.call(window,"beforeSend",a)),document.head.querySelector(`script[src*="${l}"]`))return;let c=document.createElement("script");for(let[e,t]of(c.src=l,Object.entries(d)))c.dataset[e]=t;c.defer=!0,c.onerror=()=>{let e=i()?"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 ${l}. ${e}`)},document.head.appendChild(c)}({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},e.configString??function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}())},[]),(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 c(e){let n,r,i,{route:o,path:c}=(n=(0,a.useParams)(),r=(0,a.useSearchParams)(),i=(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=l(a);e.test(s)&&(s=s.replace(e,`/[${t}]`))}for(let[t,a]of e)if(Array.isArray(a)){let e=l(a.join("/"));e.test(s)&&(s=s.replace(e,`/[...${t}]`))}return s}catch{return e}}(i,Object.keys(n).length?n:Object.fromEntries(r.entries())),path:i}:{route:null,path:i});return s.default.createElement(d,{path:c,route:o,...e,basePath:function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH}(),configString:function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_CLIENT_CONFIG}(),framework:"next"})}e.s(["Analytics",0,function(e){return s.default.createElement(s.Suspense,{fallback:null},s.default.createElement(c,{...e}))}])},7012,e=>{"use strict";var t=e.i(523829),s=e.i(178328),a=(e,t,s,a,n,r,i,l)=>{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,l&&d.includes(s)&&(o.style.colorScheme=s)}if(a)c(a);else try{let e=localStorage.getItem(t)||s,a=i&&"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:i,defaultTheme:l,value:o,themes:d,nonce:c,scriptProps:u})=>{let m=JSON.stringify([n,t,l,e,d,o,r,i]).slice(1,-1);return s.createElement("script",{...u,suppressHydrationWarning:!0,nonce:"u"<typeof window?c:"",dangerouslySetInnerHTML:{__html:`(${a.toString()})(${m})`}})});var i=e.i(746632),l=e.i(795360),l=l,o=e.i(951482),o=o,d=e.i(195300),d=d,c=e.i(909042),c=c,u=e.i(964548),u=u;e.s(["Toaster",0,({...e})=>{var a;let{theme:m="system"}=null!=(a=s.useContext(n))?a:r;return(0,t.jsx)(i.Toaster,{closeButton:!0,theme:m,className:"toaster group z-9999999! ",icons:{success:(0,t.jsx)(l.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(523829),s=e.i(82100),a=e.i(178328),n=e.i(334347),r=e.i(732684),i=e.i(301470),l=e.i(518864),o=e.i(487779),d=e.i(874822);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(708909),m=e.i(37126),x=e.i(152236),h=e.i(839717),p=e.i(133058);let f=(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 g=e.i(980369),b=e.i(379702),j=e.i(885131),v=e.i(440087),y=e.i(624529),N=e.i(874560),w=e.i(746632),k=e.i(501706),C=e.i(466691),A=e.i(282879);function F({target:e,open:s,onOpenChange:n}){let{deleteServer:r}=(0,y.useWorkspace)(),[i,l]=(0,a.useState)(!1);async function o(){if(e){l(!0);try{await r(e.id),w.toast.success(`Deleted "${e.name}".`),n(!1)}catch{w.toast.error("Could not delete the server.")}finally{l(!1)}}}return(0,t.jsx)(A.Dialog,{open:s,onOpenChange:n,children:(0,t.jsxs)(A.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsxs)(A.DialogHeader,{children:[(0,t.jsxs)(A.DialogTitle,{children:["Delete “",e?.name,"”?"]}),(0,t.jsx)(A.DialogDescription,{children:"This permanently removes the server's documents, index, vector data, and generated files. This cannot be undone."})]}),(0,t.jsxs)(A.DialogFooter,{children:[(0,t.jsx)(C.Button,{variant:"outline",onClick:()=>n(!1),disabled:i,children:"Cancel"}),(0,t.jsxs)(C.Button,{variant:"destructive",onClick:()=>void o(),disabled:i,children:[i&&(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,i]=(0,a.useState)(!1),[l,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)(f,{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:()=>i(!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)(g.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:i}),(0,t.jsx)(N.ServerFormDialog,{mode:"rename",target:l,open:null!==l,onOpenChange:e=>!e&&o(null)}),(0,t.jsx)(F,{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 E={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},D=[{id:"chat",label:"Chat",href:"/chat",icon:i.MessageCircle},{id:"data",label:"Data",href:"/data",icon:l.Database},{id:"analytics",label:"Analytics",href:"/analytics",icon:c},{id:"settings",label:"Settings",href:"/settings",icon:o.Settings}];function T(){let e=(0,r.usePathname)(),{pageStyle:i,navBg:l}=(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))},f=l?E[l]: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",f?"":"bg-background","fused"===i?"border-r border-border":""),style:f?{backgroundColor:f}: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:D.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 I={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},M=[{id:"chat",label:"Chat",href:"/chat",icon:i.MessageCircle},{id:"data",label:"Data",href:"/data",icon:l.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:i}=(0,s.useThemeCustomizer)(),l=i?I[i]: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",l?"":"bg-[#F5F5F4]"),style:l?{backgroundColor:l}: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:M.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 _=(0,d.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var B=e.i(570764),O=e.i(18928),O=O,L=e.i(562949),R=e.i(741445),V=e.i(924911),$=e.i(300033),W=e.i(856474),K=e.i(266741);let U=["vercel_ai_gateway","openai","google","mistral","custom"];function H(){let{setUsername:e,createServer:s,refresh:n}=(0,y.useWorkspace)(),i=(0,r.useRouter)(),[l,o]=(0,a.useState)(""),[d,c]=(0,a.useState)("vercel_ai_gateway"),[u,m]=(0,a.useState)(""),[x,h]=(0,a.useState)(null),[p,f]=(0,a.useState)("vercel_ai_gateway"),[b,j]=(0,a.useState)(""),[v,N]=(0,a.useState)(null),[F,S]=(0,a.useState)(!1),[z,E]=(0,a.useState)(!1),[D,T]=(0,a.useState)(!1),[I,M]=(0,a.useState)(!1),[P,H]=(0,a.useState)(null),q="custom"===d,Y="custom"===p,J=z||q||d!==p?b:u,G=async()=>{S(!0);try{let t=await fetch("/api/config"),{config:a}=await t.json(),r={...a};q&&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?Y&&v?(r.chatProvider="custom",r.chatModelId=`custom:${v.modelName}`,r.chatApiKey=v.apiKey||void 0,r.customChatModels=[v]):(r.chatProvider=p,r.chatApiKey=J):q&&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}l.trim()&&await e(l.trim()),await s("my-larkup"),await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n(),i.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},X=async()=>{S(!0);try{l.trim()&&await e(l.trim()),await s("my-larkup"),n(),i.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},Z=(e,s)=>(0,t.jsxs)($.Select,{value:e,onValueChange:e=>{var t;"custom"===(t=e??"")?("embedding"===s?c("custom"):f("custom"),H(s)):"embedding"===s?(c(t),h(null),!z&&f(t)):(f(t),N(null))},children:[(0,t.jsx)($.SelectTrigger,{className:"w-full bg-white/90 hover:bg-white",children:(0,t.jsx)("span",{className:"flex items-center gap-2",children:W.PROVIDER_META[e]?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(W.ProviderIcon,{src:W.PROVIDER_META[e].iconSrc,alt:W.PROVIDER_META[e].label,pillBg:W.PROVIDER_META[e].pillBg,size:16}),W.PROVIDER_META[e].label]}):"Select provider"})}),(0,t.jsx)($.SelectContent,{children:U.map(e=>{let s=W.PROVIDER_META[e];return s?(0,t.jsx)($.SelectItem,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(W.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:()=>H(s),className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(g.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)(V.Input,{value:l,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"}),Z(d,"embedding"),q&&x&&Q(x,"embedding"),q&&!x&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!q&&(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.jsxs)("div",{className:"relative",children:[(0,t.jsx)(V.Input,{type:D?"text":"password",value:u,onChange:e=>m(e.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,t.jsx)("button",{type:"button","aria-label":D?"Hide API key":"Show API key",onClick:()=>T(e=>!e),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:D?(0,t.jsx)(R.EyeOff,{className:"size-4"}):(0,t.jsx)(L.Eye,{className:"size-4"})})]})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>E(!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)(O.default,{className:"size-3.5"}):(0,t.jsx)(B.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"}),Z(p,"chat"),Y&&v&&Q(v,"chat"),Y&&!v&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!Y&&(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.jsxs)("div",{className:"relative",children:[(0,t.jsx)(V.Input,{type:I?"text":"password",value:b,onChange:e=>j(e.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,t.jsx)("button",{type:"button","aria-label":I?"Hide chat API key":"Show chat API key",onClick:()=>M(e=>!e),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:I?(0,t.jsx)(R.EyeOff,{className:"size-4"}):(0,t.jsx)(L.Eye,{className:"size-4"})})]})]})]}),(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:X,disabled:F,children:"Skip for now"}),(0,t.jsx)(C.Button,{className:"flex-1",onClick:G,disabled:F||!(()=>{if(q){if(!x)return!1}else if(!u)return!1;if(z){if(Y){if(!v)return!1}else if(!J)return!1}return!0})(),children:F?(0,t.jsx)(k.Loader2,{className:"size-4 animate-spin"}):(0,t.jsxs)(t.Fragment,{children:["Continue ",(0,t.jsx)(_,{className:"ml-1.5 size-4"})]})})]})]})]})}),(0,t.jsx)(A.Dialog,{open:null!==P,onOpenChange:e=>{e||("embedding"!==P||x||c("vercel_ai_gateway"),"chat"!==P||v||f("vercel_ai_gateway"),H(null))},children:(0,t.jsxs)(A.DialogContent,{className:"max-w-xl",children:[(0,t.jsxs)(A.DialogHeader,{children:[(0,t.jsxs)(A.DialogTitle,{children:["Custom ","embedding"===P?"Embedding":"Chat"," Model"]}),(0,t.jsxs)(A.DialogDescription,{children:["Connect an OpenAI-compatible ","embedding"===P?"embedding":"chat"," ","model. Test the connection before adding."]})]}),P&&(0,t.jsx)(K.CustomModelForm,{type:P,onSave:e=>{"embedding"===P?(h(e),c("custom")):"chat"===P&&(N(e),f("custom")),H(null)},onCancel:()=>{"embedding"!==P||x||c("vercel_ai_gateway"),"chat"!==P||v||f("vercel_ai_gateway"),H(null)}})]})})]})}let q={"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:i}=(0,s.useThemeCustomizer)(),l=(0,r.usePathname)(),o=l?.includes("/chat"),{isFirstRun:d,isLoading:c}=(0,y.useWorkspace)(),u=q[n],m=u?{backgroundColor:u}:void 0;return!c&&d?(0,t.jsx)(H,{}):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"===i?(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||l?.includes("/settings")||l?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||l?.includes("/settings")||l?.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)(T,{}),(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||l?.includes("/settings")||l?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||l?.includes("/settings")||l?.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(523829),s=e.i(842646),a=e.i(501706),n=e.i(178328),r=e.i(866657),i=e.i(874822);let l=(0,i.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(871942);let d=(0,i.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(518864),u=e.i(702938);let m=(0,i.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(743118),h=e.i(714809),p=e.i(241491),f=e.i(539352);let g=(0,i.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(746632),A=e.i(878835),F=e.i(282879);let S=e=>fetch(e).then(e=>e.json()),z=["chunking","embedding","upserting"];function E({open:e,onOpenChange:i,trigger:l}){let[o,d]=(0,n.useState)(!1),[c,u]=(0,n.useState)(!1),m=void 0!==e,g=m?e:c,b=m&&i?i:u,{data:j,isLoading:y,mutate:N}=(0,s.default)("/api/index",S,{refreshInterval:e=>e?.run&&z.includes(e.run.status)?1e3:0}),T=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{let e=j?.run?.warning;e&&e!==T.current?C.toast.warning(e,{id:"rate-limit-warning",duration:7e4}):!e&&T.current&&(C.toast.dismiss("rate-limit-warning"),C.toast.success("Rate limit resolved — resuming indexing.",{duration:3e3})),T.current=e},[j?.run?.warning]);let[M,P]=(0,n.useState)(!1);async function _(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 B(){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):M&&"completed"===e&&(P(!1),b(!1),C.toast.success("Indexing completed successfully!"))},[j?.run?.status,M,b]),(0,t.jsxs)(F.Dialog,{open:g,onOpenChange:b,children:[l?(0,t.jsx)(F.DialogTrigger,{render:(0,n.isValidElement)(l)?l:(0,t.jsx)("button",{children:l})}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j?.run?.status==="completed"&&(0,t.jsxs)(A.AlertDialog,{children:[(0,t.jsx)(A.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{disabled:!j.ready||!!(j.run&&z.includes(j.run.status))||o,variant:"outline",children:[(0,t.jsx)(f.RotateCcw,{className:"size-4 mr-2"}),"Re-Index Data"]})}),(0,t.jsxs)(A.AlertDialogContent,{children:[(0,t.jsxs)(A.AlertDialogHeader,{children:[(0,t.jsx)(A.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(A.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(A.AlertDialogFooter,{children:[(0,t.jsx)(A.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(A.AlertDialogAction,{onClick:()=>{b(!0),_(!1)},children:"Continue"})]})]})]}),(0,t.jsx)(F.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)(F.DialogContent,{className:"max-w-2xl max-h-[90vh] overflow-y-auto ",children:[(0,t.jsxs)(F.DialogHeader,{children:[(0,t.jsx)(F.DialogTitle,{children:"Index Data"}),(0,t.jsx)(F.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)(D,{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)(I,{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:()=>_(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)(A.AlertDialog,{children:[(0,t.jsx)(A.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{variant:"outline",size:"lg",disabled:o,children:[(0,t.jsx)(f.RotateCcw,{className:"size-4 mr-2"}),"Re-Index All"]})}),(0,t.jsxs)(A.AlertDialogContent,{children:[(0,t.jsxs)(A.AlertDialogHeader,{children:[(0,t.jsx)(A.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(A.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(A.AlertDialogFooter,{children:[(0,t.jsx)(A.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(A.AlertDialogAction,{onClick:()=>{b(!0),_(!1)},children:"Continue"})]})]})]}),!!(j.run&&z.includes(j.run.status))&&(0,t.jsx)(v.Button,{onClick:B,disabled:o,size:"lg",variant:"destructive",children:"Cancel"})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"lg",onClick:()=>b(!1),children:"Close"})]})]})]})]})}function D({config:e,docCount:s,charCount:a}){let n=(0,b.getEmbeddingModel)(e.embeddingModelId),r=(0,j.getVectorStore)(e.vectorStore),i=[{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:l,label:"Index type",value:e.indexType.toUpperCase()},{icon:g,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:i.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 T={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 I({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=T[e.status],i=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:i,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)(M,{label:"Documents",value:e.docCount.toLocaleString()}),(0,t.jsx)(M,{label:"Chunks",value:e.totalChunks.toLocaleString()}),(0,t.jsx)(M,{label:"Dimensions",value:e.dimensions?e.dimensions.toLocaleString():"—"}),(0,t.jsx)(M,{label:"Duration",value:e.durationMs?`${(e.durationMs/1e3).toFixed(1)}s`:s?"running…":"—"})]})]})]})}function M({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 _=e=>fetch(e).then(e=>e.json()),B=["chunking","embedding","upserting"];e.s(["GlobalIndexProgress",0,function(){let{data:e}=(0,s.default)("/api/index",_,{refreshInterval:e=>e?.run&&B.includes(e.run.status)?1e3:0});if(!(e?.run&&B.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)(E,{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(199910),s=e.i(523829),a=e.i(178328),n=e.i(960198),r=e.i(133058),i=e.i(736484),l=e.i(417368),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,f]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),j="0.1.40",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){f(!0);try{let{check:t}=await e.A(963347),{relaunch:s}=await e.A(995308),a=await t();a?(await a.downloadAndInstall(),await s()):f(!1)}catch(e){console.error("Auto-update failed:",e),f(!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":g?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.Check,{"aria-hidden":"true"}),"Copied"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.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)(l.X,{"aria-hidden":"true"})})]})}):null}])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,721606,e=>{"use strict";var t=e.i(199910),s=e.i(178328),a=e.i(732684);function n(){return"u">typeof window}function r(){return"production"}function i(){return"development"===((n()?window.vam:r())||"production")}function l(e){return RegExp(`/${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?=[/?#]|$)`)}function o(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:`/${e}`}function d(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},t){var s;if(!n())return;let{beforeSend:a,src:l,dataset:d}=function(e,t){var s,a;let n=e;if(t)try{n={...null==(s=JSON.parse(t))?void 0:s.analytics,...e}}catch{}!function(e="auto"){if("auto"===e){window.vam=r();return}window.vam=e}(n.mode);let l={sdkn:"@vercel/analytics"+(n.framework?`/${n.framework}`:""),sdkv:"2.0.1"};return n.disableAutoTrack&&(l.disableAutoTrack="1"),n.viewEndpoint&&(l.viewEndpoint=o(n.viewEndpoint)),n.eventEndpoint&&(l.eventEndpoint=o(n.eventEndpoint)),n.sessionEndpoint&&(l.sessionEndpoint=o(n.sessionEndpoint)),i()&&!1===n.debug&&(l.debug="false"),n.dsn&&(l.dsn=n.dsn),n.endpoint?l.endpoint=n.endpoint:n.basePath&&(l.endpoint=o(`${n.basePath}/insights`)),{beforeSend:n.beforeSend,src:(a=n).scriptSrc?o(a.scriptSrc):i()?"https://va.vercel-scripts.com/v1/script.debug.js":a.basePath?o(`${a.basePath}/insights/script.js`):"/_vercel/insights/script.js",dataset:l}}(e,t);if(window.va||(window.va=function(...e){window.vaq||(window.vaq=[]),window.vaq.push(e)}),a&&(null==(s=window.va)||s.call(window,"beforeSend",a)),document.head.querySelector(`script[src*="${l}"]`))return;let c=document.createElement("script");for(let[e,t]of(c.src=l,Object.entries(d)))c.dataset[e]=t;c.defer=!0,c.onerror=()=>{let e=i()?"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 ${l}. ${e}`)},document.head.appendChild(c)}({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},e.configString??function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}())},[]),(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 c(e){let n,r,i,{route:o,path:c}=(n=(0,a.useParams)(),r=(0,a.useSearchParams)(),i=(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=l(a);e.test(s)&&(s=s.replace(e,`/[${t}]`))}for(let[t,a]of e)if(Array.isArray(a)){let e=l(a.join("/"));e.test(s)&&(s=s.replace(e,`/[...${t}]`))}return s}catch{return e}}(i,Object.keys(n).length?n:Object.fromEntries(r.entries())),path:i}:{route:null,path:i});return s.default.createElement(d,{path:c,route:o,...e,basePath:function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH}(),configString:function(){if(void 0!==t.default&&void 0!==t.default.env)return t.default.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_CLIENT_CONFIG}(),framework:"next"})}e.s(["Analytics",0,function(e){return s.default.createElement(s.Suspense,{fallback:null},s.default.createElement(c,{...e}))}])},7012,e=>{"use strict";var t=e.i(523829),s=e.i(178328),a=(e,t,s,a,n,r,i,l)=>{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,l&&d.includes(s)&&(o.style.colorScheme=s)}if(a)c(a);else try{let e=localStorage.getItem(t)||s,a=i&&"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:i,defaultTheme:l,value:o,themes:d,nonce:c,scriptProps:u})=>{let m=JSON.stringify([n,t,l,e,d,o,r,i]).slice(1,-1);return s.createElement("script",{...u,suppressHydrationWarning:!0,nonce:"u"<typeof window?c:"",dangerouslySetInnerHTML:{__html:`(${a.toString()})(${m})`}})});var i=e.i(746632),l=e.i(795360),l=l,o=e.i(951482),o=o,d=e.i(195300),d=d,c=e.i(909042),c=c,u=e.i(964548),u=u;e.s(["Toaster",0,({...e})=>{var a;let{theme:m="system"}=null!=(a=s.useContext(n))?a:r;return(0,t.jsx)(i.Toaster,{closeButton:!0,theme:m,className:"toaster group z-9999999! ",icons:{success:(0,t.jsx)(l.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(523829),s=e.i(82100),a=e.i(178328),n=e.i(334347),r=e.i(732684),i=e.i(301470),l=e.i(518864),o=e.i(487779),d=e.i(874822);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(708909),m=e.i(37126),x=e.i(152236),h=e.i(839717),p=e.i(133058);let f=(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 g=e.i(980369),b=e.i(379702),j=e.i(885131),v=e.i(440087),y=e.i(624529),N=e.i(874560),w=e.i(746632),k=e.i(501706),C=e.i(466691),A=e.i(282879);function F({target:e,open:s,onOpenChange:n}){let{deleteServer:r}=(0,y.useWorkspace)(),[i,l]=(0,a.useState)(!1);async function o(){if(e){l(!0);try{await r(e.id),w.toast.success(`Deleted "${e.name}".`),n(!1)}catch{w.toast.error("Could not delete the server.")}finally{l(!1)}}}return(0,t.jsx)(A.Dialog,{open:s,onOpenChange:n,children:(0,t.jsxs)(A.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsxs)(A.DialogHeader,{children:[(0,t.jsxs)(A.DialogTitle,{children:["Delete “",e?.name,"”?"]}),(0,t.jsx)(A.DialogDescription,{children:"This permanently removes the server's documents, index, vector data, and generated files. This cannot be undone."})]}),(0,t.jsxs)(A.DialogFooter,{children:[(0,t.jsx)(C.Button,{variant:"outline",onClick:()=>n(!1),disabled:i,children:"Cancel"}),(0,t.jsxs)(C.Button,{variant:"destructive",onClick:()=>void o(),disabled:i,children:[i&&(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,i]=(0,a.useState)(!1),[l,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)(f,{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:()=>i(!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)(g.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:i}),(0,t.jsx)(N.ServerFormDialog,{mode:"rename",target:l,open:null!==l,onOpenChange:e=>!e&&o(null)}),(0,t.jsx)(F,{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 E={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},D=[{id:"chat",label:"Chat",href:"/chat",icon:i.MessageCircle},{id:"data",label:"Data",href:"/data",icon:l.Database},{id:"analytics",label:"Analytics",href:"/analytics",icon:c},{id:"settings",label:"Settings",href:"/settings",icon:o.Settings}];function T(){let e=(0,r.usePathname)(),{pageStyle:i,navBg:l}=(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))},f=l?E[l]: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",f?"":"bg-background","fused"===i?"border-r border-border":""),style:f?{backgroundColor:f}: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:D.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 I={"panel-default":void 0,"panel-white":"#FFFFFF","panel-fafafa":"#FAFAFA","panel-warm":"#F7F1EA","panel-soft":"#FBFAF8","panel-silver":"#F8F8F8","panel-stone":"#F5F5F2"},M=[{id:"chat",label:"Chat",href:"/chat",icon:i.MessageCircle},{id:"data",label:"Data",href:"/data",icon:l.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:i}=(0,s.useThemeCustomizer)(),l=i?I[i]: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",l?"":"bg-[#F5F5F4]"),style:l?{backgroundColor:l}: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:M.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 _=(0,d.default)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var B=e.i(570764),O=e.i(18928),O=O,L=e.i(562949),R=e.i(741445),V=e.i(924911),$=e.i(300033),W=e.i(856474),K=e.i(266741);let U=["vercel_ai_gateway","openai","google","mistral","custom"];function H(){let{setUsername:e,createServer:s,refresh:n}=(0,y.useWorkspace)(),i=(0,r.useRouter)(),[l,o]=(0,a.useState)(""),[d,c]=(0,a.useState)("vercel_ai_gateway"),[u,m]=(0,a.useState)(""),[x,h]=(0,a.useState)(null),[p,f]=(0,a.useState)("vercel_ai_gateway"),[b,j]=(0,a.useState)(""),[v,N]=(0,a.useState)(null),[F,S]=(0,a.useState)(!1),[z,E]=(0,a.useState)(!1),[D,T]=(0,a.useState)(!1),[I,M]=(0,a.useState)(!1),[P,H]=(0,a.useState)(null),q="custom"===d,Y="custom"===p,J=z||q||d!==p?b:u,G=async()=>{S(!0);try{let t=await fetch("/api/config"),{config:a}=await t.json(),r={...a};q&&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?Y&&v?(r.chatProvider="custom",r.chatModelId=`custom:${v.modelName}`,r.chatApiKey=v.apiKey||void 0,r.customChatModels=[v]):(r.chatProvider=p,r.chatApiKey=J):q&&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}l.trim()&&await e(l.trim()),await s("my-larkup"),await fetch("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),n(),i.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},X=async()=>{S(!0);try{l.trim()&&await e(l.trim()),await s("my-larkup"),n(),i.push("/chat")}catch(e){w.toast.error("Failed to complete setup")}finally{S(!1)}},Z=(e,s)=>(0,t.jsxs)($.Select,{value:e,onValueChange:e=>{var t;"custom"===(t=e??"")?("embedding"===s?c("custom"):f("custom"),H(s)):"embedding"===s?(c(t),h(null),!z&&f(t)):(f(t),N(null))},children:[(0,t.jsx)($.SelectTrigger,{className:"w-full bg-white/90 hover:bg-white",children:(0,t.jsx)("span",{className:"flex items-center gap-2",children:W.PROVIDER_META[e]?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(W.ProviderIcon,{src:W.PROVIDER_META[e].iconSrc,alt:W.PROVIDER_META[e].label,pillBg:W.PROVIDER_META[e].pillBg,size:16}),W.PROVIDER_META[e].label]}):"Select provider"})}),(0,t.jsx)($.SelectContent,{children:U.map(e=>{let s=W.PROVIDER_META[e];return s?(0,t.jsx)($.SelectItem,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(W.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:()=>H(s),className:"text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)(g.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)(V.Input,{value:l,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"}),Z(d,"embedding"),q&&x&&Q(x,"embedding"),q&&!x&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!q&&(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.jsxs)("div",{className:"relative",children:[(0,t.jsx)(V.Input,{type:D?"text":"password",value:u,onChange:e=>m(e.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,t.jsx)("button",{type:"button","aria-label":D?"Hide API key":"Show API key",onClick:()=>T(e=>!e),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:D?(0,t.jsx)(R.EyeOff,{className:"size-4"}):(0,t.jsx)(L.Eye,{className:"size-4"})})]})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>E(!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)(O.default,{className:"size-3.5"}):(0,t.jsx)(B.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"}),Z(p,"chat"),Y&&v&&Q(v,"chat"),Y&&!v&&(0,t.jsx)("p",{className:"text-[11px] text-amber-600 mt-1",children:"Please configure and test your custom model to continue."})]}),!Y&&(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.jsxs)("div",{className:"relative",children:[(0,t.jsx)(V.Input,{type:I?"text":"password",value:b,onChange:e=>j(e.target.value),placeholder:"sk-...",className:"bg-background/50 pr-10"}),(0,t.jsx)("button",{type:"button","aria-label":I?"Hide chat API key":"Show chat API key",onClick:()=>M(e=>!e),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground",children:I?(0,t.jsx)(R.EyeOff,{className:"size-4"}):(0,t.jsx)(L.Eye,{className:"size-4"})})]})]})]}),(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:X,disabled:F,children:"Skip for now"}),(0,t.jsx)(C.Button,{className:"flex-1",onClick:G,disabled:F||!(()=>{if(q){if(!x)return!1}else if(!u)return!1;if(z){if(Y){if(!v)return!1}else if(!J)return!1}return!0})(),children:F?(0,t.jsx)(k.Loader2,{className:"size-4 animate-spin"}):(0,t.jsxs)(t.Fragment,{children:["Continue ",(0,t.jsx)(_,{className:"ml-1.5 size-4"})]})})]})]})]})}),(0,t.jsx)(A.Dialog,{open:null!==P,onOpenChange:e=>{e||("embedding"!==P||x||c("vercel_ai_gateway"),"chat"!==P||v||f("vercel_ai_gateway"),H(null))},children:(0,t.jsxs)(A.DialogContent,{className:"max-w-xl",children:[(0,t.jsxs)(A.DialogHeader,{children:[(0,t.jsxs)(A.DialogTitle,{children:["Custom ","embedding"===P?"Embedding":"Chat"," Model"]}),(0,t.jsxs)(A.DialogDescription,{children:["Connect an OpenAI-compatible ","embedding"===P?"embedding":"chat"," ","model. Test the connection before adding."]})]}),P&&(0,t.jsx)(K.CustomModelForm,{type:P,onSave:e=>{"embedding"===P?(h(e),c("custom")):"chat"===P&&(N(e),f("custom")),H(null)},onCancel:()=>{"embedding"!==P||x||c("vercel_ai_gateway"),"chat"!==P||v||f("vercel_ai_gateway"),H(null)}})]})})]})}let q={"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:i}=(0,s.useThemeCustomizer)(),l=(0,r.usePathname)(),o=l?.includes("/chat"),{isFirstRun:d,isLoading:c}=(0,y.useWorkspace)(),u=q[n],m=u?{backgroundColor:u}:void 0;return!c&&d?(0,t.jsx)(H,{}):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"===i?(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||l?.includes("/settings")||l?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||l?.includes("/settings")||l?.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)(T,{}),(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||l?.includes("/settings")||l?.includes("/analytics")?"overflow-hidden flex flex-col":"overflow-auto"),children:(0,t.jsx)("div",{className:(0,x.cn)("h-full w-full",o||l?.includes("/settings")||l?.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(523829),s=e.i(842646),a=e.i(501706),n=e.i(178328),r=e.i(866657),i=e.i(874822);let l=(0,i.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(871942);let d=(0,i.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(518864),u=e.i(702938);let m=(0,i.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(743118),h=e.i(714809),p=e.i(241491),f=e.i(539352);let g=(0,i.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(746632),A=e.i(878835),F=e.i(282879);let S=e=>fetch(e).then(e=>e.json()),z=["chunking","embedding","upserting"];function E({open:e,onOpenChange:i,trigger:l}){let[o,d]=(0,n.useState)(!1),[c,u]=(0,n.useState)(!1),m=void 0!==e,g=m?e:c,b=m&&i?i:u,{data:j,isLoading:y,mutate:N}=(0,s.default)("/api/index",S,{refreshInterval:e=>e?.run&&z.includes(e.run.status)?1e3:0}),T=(0,n.useRef)(void 0);(0,n.useEffect)(()=>{let e=j?.run?.warning;e&&e!==T.current?C.toast.warning(e,{id:"rate-limit-warning",duration:7e4}):!e&&T.current&&(C.toast.dismiss("rate-limit-warning"),C.toast.success("Rate limit resolved — resuming indexing.",{duration:3e3})),T.current=e},[j?.run?.warning]);let[M,P]=(0,n.useState)(!1);async function _(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 B(){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):M&&"completed"===e&&(P(!1),b(!1),C.toast.success("Indexing completed successfully!"))},[j?.run?.status,M,b]),(0,t.jsxs)(F.Dialog,{open:g,onOpenChange:b,children:[l?(0,t.jsx)(F.DialogTrigger,{render:(0,n.isValidElement)(l)?l:(0,t.jsx)("button",{children:l})}):(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j?.run?.status==="completed"&&(0,t.jsxs)(A.AlertDialog,{children:[(0,t.jsx)(A.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{disabled:!j.ready||!!(j.run&&z.includes(j.run.status))||o,variant:"outline",children:[(0,t.jsx)(f.RotateCcw,{className:"size-4 mr-2"}),"Re-Index Data"]})}),(0,t.jsxs)(A.AlertDialogContent,{children:[(0,t.jsxs)(A.AlertDialogHeader,{children:[(0,t.jsx)(A.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(A.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(A.AlertDialogFooter,{children:[(0,t.jsx)(A.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(A.AlertDialogAction,{onClick:()=>{b(!0),_(!1)},children:"Continue"})]})]})]}),(0,t.jsx)(F.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)(F.DialogContent,{className:"max-w-2xl max-h-[90vh] overflow-y-auto ",children:[(0,t.jsxs)(F.DialogHeader,{children:[(0,t.jsx)(F.DialogTitle,{children:"Index Data"}),(0,t.jsx)(F.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)(D,{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)(I,{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:()=>_(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)(A.AlertDialog,{children:[(0,t.jsx)(A.AlertDialogTrigger,{render:(0,t.jsxs)(v.Button,{variant:"outline",size:"lg",disabled:o,children:[(0,t.jsx)(f.RotateCcw,{className:"size-4 mr-2"}),"Re-Index All"]})}),(0,t.jsxs)(A.AlertDialogContent,{children:[(0,t.jsxs)(A.AlertDialogHeader,{children:[(0,t.jsx)(A.AlertDialogTitle,{children:"Are you sure you want to re-index data?"}),(0,t.jsx)(A.AlertDialogDescription,{children:"This will rebuild the entire index from scratch. All documents will be re-processed."})]}),(0,t.jsxs)(A.AlertDialogFooter,{children:[(0,t.jsx)(A.AlertDialogCancel,{children:"Cancel"}),(0,t.jsx)(A.AlertDialogAction,{onClick:()=>{b(!0),_(!1)},children:"Continue"})]})]})]}),!!(j.run&&z.includes(j.run.status))&&(0,t.jsx)(v.Button,{onClick:B,disabled:o,size:"lg",variant:"destructive",children:"Cancel"})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"lg",onClick:()=>b(!1),children:"Close"})]})]})]})]})}function D({config:e,docCount:s,charCount:a}){let n=(0,b.getEmbeddingModel)(e.embeddingModelId),r=(0,j.getVectorStore)(e.vectorStore),i=[{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:l,label:"Index type",value:e.indexType.toUpperCase()},{icon:g,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:i.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 T={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 I({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=T[e.status],i=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:i,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)(M,{label:"Documents",value:e.docCount.toLocaleString()}),(0,t.jsx)(M,{label:"Chunks",value:e.totalChunks.toLocaleString()}),(0,t.jsx)(M,{label:"Dimensions",value:e.dimensions?e.dimensions.toLocaleString():"—"}),(0,t.jsx)(M,{label:"Duration",value:e.durationMs?`${(e.durationMs/1e3).toFixed(1)}s`:s?"running…":"—"})]})]})]})}function M({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 _=e=>fetch(e).then(e=>e.json()),B=["chunking","embedding","upserting"];e.s(["GlobalIndexProgress",0,function(){let{data:e}=(0,s.default)("/api/index",_,{refreshInterval:e=>e?.run&&B.includes(e.run.status)?1e3:0});if(!(e?.run&&B.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)(E,{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(199910),s=e.i(523829),a=e.i(178328),n=e.i(960198),r=e.i(133058),i=e.i(736484),l=e.i(417368),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,f]=(0,a.useState)(!1),[g,b]=(0,a.useState)(!1),j="0.1.41",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){f(!0);try{let{check:t}=await e.A(963347),{relaunch:s}=await e.A(995308),a=await t();a?(await a.downloadAndInstall(),await s()):f(!1)}catch(e){console.error("Auto-update failed:",e),f(!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":g?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.Check,{"aria-hidden":"true"}),"Copied"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.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)(l.X,{"aria-hidden":"true"})})]})}):null}])}]);
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # larkup
2
2
 
3
+ ## 0.1.41
4
+
5
+ ### Patch Changes
6
+
7
+ - 0ff7dec: Stabilize native crawl state, prioritise local knowledge retrieval, and improve media-import progress and source-download recovery.
8
+ - Updated dependencies [0ff7dec]
9
+ - @larkup/scraper@0.1.29
10
+ - @larkup/tool-video-audio@0.2.4
11
+
3
12
  ## 0.1.40
4
13
 
5
14
  ### Patch Changes
@@ -74,6 +74,7 @@ TOOL RULES:
74
74
  DO:
75
75
  - Keep answers short and direct. 1–3 sentences unless the task is complex.
76
76
  - Search at most ONCE per tool per turn. Never repeat the same search.
77
+ - For questions about the user's own facts or preferences (for example, "what is my favourite fruit?"), searchKnowledgeBase is required before answering.
77
78
  - Use presentMedia to show images/videos/audio from indexed content.
78
79
  - For follow-ups like "show me that", reuse the mediaAssetId from earlier results — do not search again.
79
80
 
@@ -88,8 +89,13 @@ function latestUserText(messages: UIMessage[]): string {
88
89
  const message = [...messages].reverse().find((candidate) => candidate.role === 'user') as any;
89
90
  if (!message) return '';
90
91
  if (typeof message.content === 'string') return message.content;
91
- if (Array.isArray(message.parts)) {
92
- return message.parts
92
+ const parts = Array.isArray(message.parts)
93
+ ? message.parts
94
+ : Array.isArray(message.content)
95
+ ? message.content
96
+ : [];
97
+ if (parts.length) {
98
+ return parts
93
99
  .filter((part: any) => part.type === 'text' && typeof part.text === 'string')
94
100
  .map((part: any) => part.text)
95
101
  .join(' ');
@@ -110,6 +116,7 @@ function requiresKnowledgeBaseSearch(text: string): boolean {
110
116
  /\b(my|our)\s+(favo(?:u)?rite|preference|choice|answer|name|result|score|winner)\b/i.test(
111
117
  text,
112
118
  ) ||
119
+ /\b(?:what|which|who|where|when|how)\b[\s\S]{0,80}\b(my|our)\b/i.test(text) ||
113
120
  /\b(my|our)\s+(document|file|data|image|picture|diagram|video|audio|upload|corpus|knowledge|database|db|pdf|report|spreadsheet|presentation)/i.test(
114
121
  text,
115
122
  ) ||
@@ -1011,7 +1011,16 @@ export async function getChatTools(context: {
1011
1011
 
1012
1012
  if (
1013
1013
  isEnabled(id) ||
1014
- ['presentMedia', 'fillDocumentForm', 'editDocument', 'requestDocumentSignature'].includes(id)
1014
+ [
1015
+ // Retrieval is core chat behavior, not an optional marketplace action.
1016
+ // Keeping it available prevents an enabled web-search configuration
1017
+ // from silently removing the user's local knowledge base.
1018
+ 'searchKnowledgeBase',
1019
+ 'presentMedia',
1020
+ 'fillDocumentForm',
1021
+ 'editDocument',
1022
+ 'requestDocumentSignature',
1023
+ ].includes(id)
1015
1024
  ) {
1016
1025
  finalTools[id] = toolDef;
1017
1026
  }
@@ -66,7 +66,7 @@ export function FirecrawlNotice({
66
66
  description:
67
67
  runtimeEnv === 'docker'
68
68
  ? 'Checking if the crawler service is available on the network.'
69
- : 'Starting Larkup’s built-in crawler. ',
69
+ : 'Preparing Larkup’s built-in crawler and its local job storage.',
70
70
  },
71
71
  );
72
72
  }
@@ -82,7 +82,7 @@ export function FirecrawlNotice({
82
82
  if (action === 'start') {
83
83
  if (json.state?.running) {
84
84
  toast.success('Web crawler is running', {
85
- description: 'Web scraping is now active.',
85
+ description: 'Ready to receive scrape jobs.',
86
86
  });
87
87
  } else if (runtimeEnv === 'docker') {
88
88
  toast.error('Crawler service is not part of this container', {
@@ -91,7 +91,7 @@ export function FirecrawlNotice({
91
91
  });
92
92
  } else {
93
93
  toast.success('Web crawler is ready', {
94
- description: 'You can now scrape websites without Docker.',
94
+ description: 'Ready to receive scrape jobs without Docker.',
95
95
  });
96
96
  }
97
97
  } else {
@@ -731,13 +731,8 @@ function MediaContent({
731
731
  if (!res.ok) throw new Error(data.error ?? 'Media import failed');
732
732
  const ids = (data.assets as MediaAsset[]).map((asset) => asset.id);
733
733
  toast.success(`${mediaType === 'video' ? 'Video' : 'Audio'} import started`, {
734
- description: `Expected time: ${
735
- remoteDuration
736
- ? `about ${remoteEstimate.processingMinutes} minute${
737
- remoteEstimate.processingMinutes === 1 ? '' : 's'
738
- }`
739
- : 'a few minutes'
740
- }. You can safely leave — we will keep indexing it in the background.`,
734
+ description:
735
+ 'Queued for download and indexing. Live progress will appear once the source starts responding; you can safely leave in the meantime.',
741
736
  duration: 8_000,
742
737
  });
743
738
  await processAssets(ids);
@@ -1385,7 +1380,7 @@ function MediaContent({
1385
1380
  <AlertDialogFooter>
1386
1381
  <AlertDialogCancel>Keep file</AlertDialogCancel>
1387
1382
  <AlertDialogAction
1388
- className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
1383
+ className="bg-destructive text-white hover:bg-destructive/90"
1389
1384
  onClick={() => {
1390
1385
  if (assetToRemove) void handleDelete(assetToRemove.id);
1391
1386
  setAssetToRemove(null);
@@ -576,20 +576,12 @@ export function ScrapePanel({
576
576
  const data = await res.json();
577
577
  if (!res.ok) throw new Error(data.error ?? 'Could not start job');
578
578
 
579
- const { totalPages, estimatedSeconds } = estimateEtlDuration(
580
- selectedUrls.length,
581
- effectiveScope,
582
- specificUrls ? 1 : pageLimit,
583
- );
584
-
585
- toast.success('Scraping started, running in background', {
579
+ toast.success('Scrape queued', {
586
580
  description: specificUrls
587
- ? `Scraping ${selectedUrls.length} specific URL(s) only, no deep crawl. You can navigate away. Progress is tracked automatically.`
581
+ ? `We will connect to ${selectedUrls.length} specific URL(s) and show real page progress as each response arrives. You can navigate away.`
588
582
  : `${selectedUrls.length} ${
589
583
  effectiveScope === 'domain' ? 'domain(s)' : 'page(s)'
590
- } · ~${totalPages} pages · ETA ${formatDuration(
591
- estimatedSeconds,
592
- )}. You can navigate away. Progress is tracked automatically.`,
584
+ } selected. We will show real page progress as each response arrives; no artificial completion estimate. You can navigate away.`,
593
585
  duration: 8000,
594
586
  });
595
587
 
@@ -95,7 +95,7 @@ export function IndexWorkspace({
95
95
  setIsIndexing(true);
96
96
  } else if (isIndexing && status === 'completed') {
97
97
  setIsIndexing(false);
98
- toast.success('Indexing complete your data is ready to use.');
98
+ toast.success('Indexing complete. Your data is ready to use.');
99
99
  try {
100
100
  const context = new (window.AudioContext || (window as any).webkitAudioContext)();
101
101
  const oscillator = context.createOscillator();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "larkup",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "larkup": "./bin/larkup.js"
@@ -53,13 +53,13 @@
53
53
  "xlsx": "^0.18.5",
54
54
  "zod": "^4.4.3",
55
55
  "zustand": "^5.0.14",
56
- "@larkup/core": "0.2.5",
57
56
  "@larkup/sandbox": "0.1.2",
58
- "@larkup/tool-doc-editor": "0.2.6",
59
- "@larkup/scraper": "0.1.28",
60
- "@larkup/vector-stores": "0.1.23",
61
57
  "@larkup/marketplace": "0.1.11",
62
- "@larkup/tool-video-audio": "0.2.3"
58
+ "@larkup/core": "0.2.5",
59
+ "@larkup/scraper": "0.1.29",
60
+ "@larkup/vector-stores": "0.1.23",
61
+ "@larkup/tool-video-audio": "0.2.4",
62
+ "@larkup/tool-doc-editor": "0.2.6"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@tailwindcss/postcss": "^4.2.0",