khoj 2.0.0b8.dev1__py3-none-any.whl → 2.0.0b9.dev7__py3-none-any.whl
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.
- khoj/database/adapters/__init__.py +3 -2
- khoj/database/models/__init__.py +28 -0
- khoj/interface/compiled/404/index.html +2 -2
- khoj/interface/compiled/_next/static/chunks/{2327-d863b0b21ecb23de.js → 2327-ea623ca2d22f78e9.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/5477-c4209b72942d3038.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{5639-0c4604668cb2d4c0.js → 5639-09e2009a2adedf8b.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/9139-ce1ae935dac9c871.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/agents/layout-4e2a134ec26aa606.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/agents/{page-5db6ad18da10d353.js → page-0006674668eb5a4d.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/automations/{page-6271e2e31c7571d1.js → page-4c465cde2d14cb52.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/layout-d6acbba22ccac0ff.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/chat/page-4408125f66c165cf.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/{page-a19a597629e87fb8.js → page-85b9b416898738f7.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/search/layout-484d34239ed0f2b1.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/search/{page-fa366ac14b228688.js → page-883b7d8d2e3abe3e.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/{page-8f9a85f96088c18b.js → page-95e994ddac31473f.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-b3f7ae1ef8871d30.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-ed7787cf4938b8e3.js → page-c062269e6906ef22.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{webpack-c6e14fd89812b96f.js → webpack-c375c47fee5a4dda.js} +1 -1
- khoj/interface/compiled/_next/static/css/1e9b757ee2a2b34b.css +1 -0
- khoj/interface/compiled/_next/static/css/ee66643a6a5bf71c.css +1 -0
- khoj/interface/compiled/agents/index.html +2 -2
- khoj/interface/compiled/agents/index.txt +2 -2
- khoj/interface/compiled/automations/index.html +2 -2
- khoj/interface/compiled/automations/index.txt +3 -3
- khoj/interface/compiled/chat/index.html +2 -2
- khoj/interface/compiled/chat/index.txt +2 -2
- khoj/interface/compiled/index.html +2 -2
- khoj/interface/compiled/index.txt +2 -2
- khoj/interface/compiled/search/index.html +2 -2
- khoj/interface/compiled/search/index.txt +2 -2
- khoj/interface/compiled/settings/index.html +2 -2
- khoj/interface/compiled/settings/index.txt +4 -4
- khoj/interface/compiled/share/chat/index.html +2 -2
- khoj/interface/compiled/share/chat/index.txt +2 -2
- khoj/main.py +11 -1
- khoj/processor/conversation/utils.py +7 -7
- khoj/processor/operator/__init__.py +16 -1
- khoj/processor/tools/run_code.py +5 -2
- khoj/routers/api_chat.py +822 -682
- khoj/routers/helpers.py +101 -2
- khoj/routers/research.py +56 -14
- khoj/utils/rawconfig.py +0 -1
- {khoj-2.0.0b8.dev1.dist-info → khoj-2.0.0b9.dev7.dist-info}/METADATA +1 -1
- {khoj-2.0.0b8.dev1.dist-info → khoj-2.0.0b9.dev7.dist-info}/RECORD +56 -56
- khoj/interface/compiled/_next/static/chunks/5477-18323501c445315e.js +0 -1
- khoj/interface/compiled/_next/static/chunks/9568-0d60ac475f4cc538.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/agents/layout-e00fb81dca656a10.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/layout-33934fc2d6ae6838.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/page-b186e95387e23ed5.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/search/layout-f5881c7ae3ba0795.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-abb6c5f4239ad7be.js +0 -1
- khoj/interface/compiled/_next/static/css/37a73b87f02df402.css +0 -1
- khoj/interface/compiled/_next/static/css/93eeacc43e261162.css +0 -1
- /khoj/interface/compiled/_next/static/chunks/{1327-1a9107b9a2a04a98.js → 1327-3b1a41af530fa8ee.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{1915-5c6508f6ebb62a30.js → 1915-fbfe167c84ad60c5.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{2117-080746c8e170c81a.js → 2117-e78b6902ad6f75ec.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{2939-4af3fd24b8ffc9ad.js → 2939-4d4084c5b888b960.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{4447-cd95608f8e93e711.js → 4447-d6cf93724d57e34b.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{8667-50b03a89e82e0ba7.js → 8667-4b7790573b08c50d.js} +0 -0
- /khoj/interface/compiled/_next/static/{ZHB1va0KhWIu8Zs8-kbgt → j6hqMrHT_uO81BNrhFQkJ}/_buildManifest.js +0 -0
- /khoj/interface/compiled/_next/static/{ZHB1va0KhWIu8Zs8-kbgt → j6hqMrHT_uO81BNrhFQkJ}/_ssgManifest.js +0 -0
- {khoj-2.0.0b8.dev1.dist-info → khoj-2.0.0b9.dev7.dist-info}/WHEEL +0 -0
- {khoj-2.0.0b8.dev1.dist-info → khoj-2.0.0b9.dev7.dist-info}/entry_points.txt +0 -0
- {khoj-2.0.0b8.dev1.dist-info → khoj-2.0.0b9.dev7.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9139],{99376:function(e,t,n){var r=n(35475);n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},2208:function(e,t,n){t.ZP=void 0;var r=n(14273);Object.defineProperty(t,"ZP",{enumerable:!0,get:function(){return r.useWebSocket}}),n(28433),n(29015),n(88720),n(83420)},68761:function(e,t,n){var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.attachListeners=void 0;var a=n(19174),o=n(87075),c=n(29015),l=n(83420),u=function(e,t,n,r){e.onmessage=function(e){var a;t.current.onMessage&&t.current.onMessage(e),"number"==typeof(null==r?void 0:r.current)&&(r.current=Date.now()),"function"==typeof t.current.filter&&!0!==t.current.filter(e)||t.current.heartbeat&&"boolean"!=typeof t.current.heartbeat&&(null===(a=t.current.heartbeat)||void 0===a?void 0:a.returnMessage)===e.data||n(e)}},s=function(e,t,n,r,a){e.onopen=function(l){if(t.current.onOpen&&t.current.onOpen(l),r.current=0,n(c.ReadyState.OPEN),t.current.heartbeat&&e instanceof WebSocket){var u="boolean"==typeof t.current.heartbeat?void 0:t.current.heartbeat;a.current=Date.now(),(0,o.heartbeat)(e,a,u)}}},i=function(e,t,n,r,a){var o;return c.isEventSourceSupported&&e instanceof EventSource?function(){}:((0,l.assertIsWebSocket)(e,t.current.skipAssert),e.onclose=function(e){var l;if(t.current.onClose&&t.current.onClose(e),n(c.ReadyState.CLOSED),t.current.shouldReconnect&&t.current.shouldReconnect(e)){var u=null!==(l=t.current.reconnectAttempts)&&void 0!==l?l:c.DEFAULT_RECONNECT_LIMIT;if(a.current<u){var s="function"==typeof t.current.reconnectInterval?t.current.reconnectInterval(a.current):t.current.reconnectInterval;o=window.setTimeout(function(){a.current++,r()},null!=s?s:c.DEFAULT_RECONNECT_INTERVAL_MS)}else t.current.onReconnectStop&&t.current.onReconnectStop(u),console.warn("Max reconnect attempts of ".concat(u," exceeded"))}},function(){return o&&window.clearTimeout(o)})},f=function(e,t,n,a,o){var l;return e.onerror=function(u){var s;if(t.current.onError&&t.current.onError(u),c.isEventSourceSupported&&e instanceof EventSource&&(t.current.onClose&&t.current.onClose(r(r({},u),{code:1006,reason:"An error occurred with the EventSource: ".concat(u),wasClean:!1})),n(c.ReadyState.CLOSED),e.close()),t.current.retryOnError){if(o.current<(null!==(s=t.current.reconnectAttempts)&&void 0!==s?s:c.DEFAULT_RECONNECT_LIMIT)){var i="function"==typeof t.current.reconnectInterval?t.current.reconnectInterval(o.current):t.current.reconnectInterval;l=window.setTimeout(function(){o.current++,a()},null!=i?i:c.DEFAULT_RECONNECT_INTERVAL_MS)}else t.current.onReconnectStop&&t.current.onReconnectStop(t.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(t.current.reconnectAttempts," exceeded"))}},function(){return l&&window.clearTimeout(l)}};t.attachListeners=function(e,t,n,r,o,l,d){var p,h,m,v=t.setLastMessage,E=t.setReadyState;return n.current.fromSocketIO&&(p=(0,a.setUpSocketIOPing)(d)),u(e,n,v,l),s(e,n,E,o,l),h=i(e,n,E,r,o),m=f(e,n,E,r,o),function(){E(c.ReadyState.CLOSING),h(),m(),e.close(),p&&clearInterval(p)}}},90657:function(e,t,n){var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.attachSharedListeners=void 0;var a=n(31677),o=n(29015),c=n(69366),l=n(19174),u=n(87075),s=function(e,t,n){e.onmessage=function(e){(0,c.getSubscribers)(t).forEach(function(t){var r;t.optionsRef.current.onMessage&&t.optionsRef.current.onMessage(e),"number"==typeof(null===(r=null==t?void 0:t.lastMessageTime)||void 0===r?void 0:r.current)&&(t.lastMessageTime.current=Date.now()),("function"!=typeof t.optionsRef.current.filter||!0===t.optionsRef.current.filter(e))&&(n&&"boolean"!=typeof n&&(null==n?void 0:n.returnMessage)===e.data||t.setLastMessage(e))})}},i=function(e,t,n){e.onopen=function(r){var a=(0,c.getSubscribers)(t);a.forEach(function(t){t.reconnectCount.current=0,t.optionsRef.current.onOpen&&t.optionsRef.current.onOpen(r),t.setReadyState(o.ReadyState.OPEN),n&&e instanceof WebSocket&&(t.lastMessageTime.current=Date.now())}),n&&e instanceof WebSocket&&(0,u.heartbeat)(e,a.map(function(e){return e.lastMessageTime}),"boolean"==typeof n?void 0:n)}},f=function(e,t){e instanceof WebSocket&&(e.onclose=function(e){(0,c.getSubscribers)(t).forEach(function(t){t.optionsRef.current.onClose&&t.optionsRef.current.onClose(e),t.setReadyState(o.ReadyState.CLOSED)}),delete a.sharedWebSockets[t],(0,c.getSubscribers)(t).forEach(function(t){var n;if(t.optionsRef.current.shouldReconnect&&t.optionsRef.current.shouldReconnect(e)){var r=null!==(n=t.optionsRef.current.reconnectAttempts)&&void 0!==n?n:o.DEFAULT_RECONNECT_LIMIT;if(t.reconnectCount.current<r){var a="function"==typeof t.optionsRef.current.reconnectInterval?t.optionsRef.current.reconnectInterval(t.reconnectCount.current):t.optionsRef.current.reconnectInterval;setTimeout(function(){t.reconnectCount.current++,t.reconnect.current()},null!=a?a:o.DEFAULT_RECONNECT_INTERVAL_MS)}else t.optionsRef.current.onReconnectStop&&t.optionsRef.current.onReconnectStop(t.optionsRef.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(r," exceeded"))}})})},d=function(e,t){e.onerror=function(n){(0,c.getSubscribers)(t).forEach(function(t){t.optionsRef.current.onError&&t.optionsRef.current.onError(n),o.isEventSourceSupported&&e instanceof EventSource&&(t.optionsRef.current.onClose&&t.optionsRef.current.onClose(r(r({},n),{code:1006,reason:"An error occurred with the EventSource: ".concat(n),wasClean:!1})),t.setReadyState(o.ReadyState.CLOSED))}),o.isEventSourceSupported&&e instanceof EventSource&&e.close()}};t.attachSharedListeners=function(e,t,n,r){var a;return n.current.fromSocketIO&&(a=(0,l.setUpSocketIOPing)(r)),s(e,t,n.current.heartbeat),f(e,t),i(e,t,n.current.heartbeat),d(e,t),function(){a&&clearInterval(a)}}},29015:function(e,t){var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.isEventSourceSupported=t.isReactNative=t.ReadyState=t.DEFAULT_HEARTBEAT=t.UNPARSABLE_JSON_OBJECT=t.DEFAULT_RECONNECT_INTERVAL_MS=t.DEFAULT_RECONNECT_LIMIT=t.SOCKET_IO_PING_CODE=t.SOCKET_IO_PATH=t.SOCKET_IO_PING_INTERVAL=t.DEFAULT_EVENT_SOURCE_OPTIONS=t.EMPTY_EVENT_HANDLERS=t.DEFAULT_OPTIONS=void 0,t.DEFAULT_OPTIONS={},t.EMPTY_EVENT_HANDLERS={},t.DEFAULT_EVENT_SOURCE_OPTIONS={withCredentials:!1,events:t.EMPTY_EVENT_HANDLERS},t.SOCKET_IO_PING_INTERVAL=25e3,t.SOCKET_IO_PATH="/socket.io/?EIO=3&transport=websocket",t.SOCKET_IO_PING_CODE="2",t.DEFAULT_RECONNECT_LIMIT=20,t.DEFAULT_RECONNECT_INTERVAL_MS=5e3,t.UNPARSABLE_JSON_OBJECT={},t.DEFAULT_HEARTBEAT={message:"ping",timeout:6e4,interval:25e3},(r=n||(t.ReadyState=n={}))[r.UNINSTANTIATED=-1]="UNINSTANTIATED",r[r.CONNECTING=0]="CONNECTING",r[r.OPEN=1]="OPEN",r[r.CLOSING=2]="CLOSING",r[r.CLOSED=3]="CLOSED",t.isReactNative="undefined"!=typeof navigator&&"ReactNative"===navigator.product,t.isEventSourceSupported=!t.isReactNative&&function(){try{return"EventSource"in globalThis}catch(e){return!1}}()},22057:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.createOrJoinSocket=void 0;var r=n(31677),a=n(29015),o=n(68761),c=n(90657),l=n(69366);t.createOrJoinSocket=function(e,t,n,u,s,i,f,d,p){if(!a.isEventSourceSupported&&u.current.eventSourceOptions){if(a.isReactNative)throw Error("EventSource is not supported in ReactNative");throw Error("EventSource is not supported")}if(u.current.share){var h,m=null;void 0===r.sharedWebSockets[t]?(r.sharedWebSockets[t]=u.current.eventSourceOptions?new EventSource(t,u.current.eventSourceOptions):new WebSocket(t,u.current.protocols),e.current=r.sharedWebSockets[t],n(a.ReadyState.CONNECTING),m=(0,c.attachSharedListeners)(r.sharedWebSockets[t],t,u,p)):(e.current=r.sharedWebSockets[t],n(r.sharedWebSockets[t].readyState));var v={setLastMessage:s,setReadyState:n,optionsRef:u,reconnectCount:f,lastMessageTime:d,reconnect:i};return(0,l.addSubscriber)(t,v),h=m,function(){if((0,l.removeSubscriber)(t,v),!(0,l.hasSubscribers)(t)){try{var e=r.sharedWebSockets[t];e instanceof WebSocket&&(e.onclose=function(e){u.current.onClose&&u.current.onClose(e),n(a.ReadyState.CLOSED)}),e.close()}catch(e){}h&&h(),delete r.sharedWebSockets[t]}}}if(e.current=u.current.eventSourceOptions?new EventSource(t,u.current.eventSourceOptions):new WebSocket(t,u.current.protocols),n(a.ReadyState.CONNECTING),!e.current)throw Error("WebSocket failed to be created");return(0,o.attachListeners)(e.current,{setLastMessage:s,setReadyState:n},u,i.current,f,d,p)}},87186:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function c(e){try{u(r.next(e))}catch(e){o(e)}}function l(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(c,l)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=l(0),c.throw=l(1),c.return=l(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function l(l){return function(u){return function(l){if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,u])}}},o=this&&this.__spreadArray||function(e,t,n){if(n||2==arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.getUrl=void 0;var c=n(19174),l=n(29015);t.getUrl=function(e,n){for(var u=[],s=2;s<arguments.length;s++)u[s-2]=arguments[s];return r(void 0,o([e,n],u,!0),void 0,function(e,n,r){var o,u,s,i,f,d,p;return void 0===r&&(r=0),a(this,function(a){switch(a.label){case 0:if("function"!=typeof e)return[3,10];a.label=1;case 1:return a.trys.push([1,3,,9]),[4,e()];case 2:return o=a.sent(),[3,9];case 3:var h;if(a.sent(),!n.current.retryOnError)return[3,7];if(u=null!==(f=n.current.reconnectAttempts)&&void 0!==f?f:l.DEFAULT_RECONNECT_LIMIT,!(r<u))return[3,5];return[4,(h=null!=(s="function"==typeof n.current.reconnectInterval?n.current.reconnectInterval(r):n.current.reconnectInterval)?s:l.DEFAULT_RECONNECT_INTERVAL_MS,new Promise(function(e){return window.setTimeout(e,h)}))];case 4:return a.sent(),[2,(0,t.getUrl)(e,n,r+1)];case 5:return null===(p=(d=n.current).onReconnectStop)||void 0===p||p.call(d,r),[2,null];case 6:return[3,8];case 7:return[2,null];case 8:return[3,9];case 9:return[3,11];case 10:o=e,a.label=11;case 11:return i=n.current.fromSocketIO?(0,c.parseSocketIOUrl)(o):o,[2,n.current.queryParams?(0,c.appendQueryParams)(i,n.current.queryParams):i]}})})}},31677:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.resetWebSockets=t.sharedWebSockets=void 0,t.sharedWebSockets={},t.resetWebSockets=function(e){if(e&&t.sharedWebSockets.hasOwnProperty(e))delete t.sharedWebSockets[e];else for(var n in t.sharedWebSockets)t.sharedWebSockets.hasOwnProperty(n)&&delete t.sharedWebSockets[n]}},87075:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.heartbeat=function(e,t,n){var a=n||{},o=a.interval,c=void 0===o?r.DEFAULT_HEARTBEAT.interval:o,l=a.timeout,u=void 0===l?r.DEFAULT_HEARTBEAT.timeout:l,s=a.message,i=void 0===s?r.DEFAULT_HEARTBEAT.message:s,f=Date.now(),d=setInterval(function(){var n=Date.now(),r=Array.isArray(t)?t.reduce(function(e,t){return e.current>t.current?e:t}).current:t.current;if(r+u<=n)console.warn("Heartbeat timed out, closing connection, last message received ".concat(n-r,"ms ago, last ping sent ").concat(n-f,"ms ago")),e.close();else if(r+c<=n&&f+c<=n)try{"function"==typeof i?e.send(i()):e.send(i),f=n}catch(t){console.error("Heartbeat failed, closing connection",t instanceof Error?t.message:t),e.close()}},Math.max(100,c/10));return e.addEventListener("close",function(){clearInterval(d)}),function(){}};var r=n(29015)},69366:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.resetSubscribers=t.removeSubscriber=t.addSubscriber=t.hasSubscribers=t.getSubscribers=void 0;var n={},r=[];t.getSubscribers=function(e){return(0,t.hasSubscribers)(e)?Array.from(n[e]):r},t.hasSubscribers=function(e){var t;return(null===(t=n[e])||void 0===t?void 0:t.size)>0},t.addSubscriber=function(e,t){n[e]=n[e]||new Set,n[e].add(t)},t.removeSubscriber=function(e,t){n[e].delete(t)},t.resetSubscribers=function(e){if(e&&n.hasOwnProperty(e))delete n[e];else for(var t in n)n.hasOwnProperty(t)&&delete n[t]}},96116:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.websocketWrapper=void 0,t.websocketWrapper=function(e,t){return new Proxy(e,{get:function(e,n){var r=e[n];return"reconnect"===n?t:"function"==typeof r?(console.error("Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket."),function(){}):r},set:function(e,t,n){return/^on/.test(t)?(console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."),!1):(e[t]=n,!0)}})},t.default=t.websocketWrapper},19174:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.setUpSocketIOPing=t.appendQueryParams=t.parseSocketIOUrl=void 0;var r=n(29015);t.parseSocketIOUrl=function(e){if(e){var t=/^https|wss/.test(e),n=e.replace(/^(https?|wss?)(:\/\/)?/,"").replace(/\/$/,""),a=t?"wss":"ws";return"".concat(a,"://").concat(n).concat(r.SOCKET_IO_PATH)}if(""===e){var t=/^https/.test(window.location.protocol),a=t?"wss":"ws",o=window.location.port?":".concat(window.location.port):"";return"".concat(a,"://").concat(window.location.hostname).concat(o).concat(r.SOCKET_IO_PATH)}return e},t.appendQueryParams=function(e,t){void 0===t&&(t={});var n=/\?([\w]+=[\w]+)/.test(e),r="".concat(Object.entries(t).reduce(function(e,t){var n=t[0],r=t[1];return e+"".concat(n,"=").concat(r,"&")},"").slice(0,-1));return"".concat(e).concat(n?"&":"?").concat(r)},t.setUpSocketIOPing=function(e,t){return void 0===t&&(t=r.SOCKET_IO_PING_INTERVAL),window.setInterval(function(){return e(r.SOCKET_IO_PING_CODE)},t)}},88720:function(e,t,n){var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},a=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)0>t.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n};Object.defineProperty(t,"__esModule",{value:!0}),t.useEventSource=void 0;var o=n(2265),c=n(14273),l=n(29015);t.useEventSource=function(e,t,n){void 0===t&&(t=l.DEFAULT_EVENT_SOURCE_OPTIONS);var u=t.withCredentials,s=t.events,i=a(t,["withCredentials","events"]);void 0===n&&(n=!0);var f=r(r({},i),{eventSourceOptions:{withCredentials:u}}),d=(0,o.useRef)(l.EMPTY_EVENT_HANDLERS);s&&(d.current=s);var p=(0,c.useWebSocket)(e,f,n),h=p.lastMessage,m=p.readyState,v=p.getWebSocket;return(0,o.useEffect)(function(){(null==h?void 0:h.type)&&Object.entries(d.current).forEach(function(e){var t=e[0],n=e[1];t===h.type&&n(h)})},[h]),{lastEvent:h,readyState:m,getEventSource:v}}},28433:function(e,t,n){var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.useSocketIO=void 0;var a=n(2265),o=n(14273),c=n(29015),l={type:"empty",payload:null},u=function(e){if(!e||!e.data)return l;var t=e.data.match(/\[.*]/);if(!t)return l;var n=JSON.parse(t);return Array.isArray(n)&&n[1]?{type:n[0],payload:n[1]}:l};t.useSocketIO=function(e,t,n){void 0===t&&(t=c.DEFAULT_OPTIONS),void 0===n&&(n=!0);var l=(0,a.useMemo)(function(){return r(r({},t),{fromSocketIO:!0})},[]),s=(0,o.useWebSocket)(e,l,n),i=s.sendMessage,f=s.sendJsonMessage,d=s.lastMessage,p=s.readyState,h=s.getWebSocket,m=(0,a.useMemo)(function(){return u(d)},[d]);return{sendMessage:i,sendJsonMessage:f,lastMessage:m,lastJsonMessage:m,readyState:p,getWebSocket:h}}},14273:function(e,t,n){var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(a,o){function c(e){try{u(r.next(e))}catch(e){o(e)}}function l(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(c,l)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=l(0),c.throw=l(1),c.return=l(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function l(l){return function(u){return function(l){if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(o=0)),o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,u])}}},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.useWebSocket=void 0;var l=n(2265),u=n(54887),s=n(29015),i=n(22057),f=n(87186),d=c(n(96116)),p=n(83420);t.useWebSocket=function(e,t,n){void 0===t&&(t=s.DEFAULT_OPTIONS),void 0===n&&(n=!0);var c=(0,l.useState)(null),h=c[0],m=c[1],v=(0,l.useState)({}),E=v[0],S=v[1],b=(0,l.useMemo)(function(){if(!t.disableJson&&h)try{return JSON.parse(h.data)}catch(e){return s.UNPARSABLE_JSON_OBJECT}return null},[h,t.disableJson]),A=(0,l.useRef)(null),y=(0,l.useRef)(null),g=(0,l.useRef)(function(){}),O=(0,l.useRef)(0),M=(0,l.useRef)(Date.now()),L=(0,l.useRef)([]),w=(0,l.useRef)(null),_=(0,l.useRef)(t);_.current=t;var Z=A.current&&void 0!==E[A.current]?E[A.current]:null!==e&&!0===n?s.ReadyState.CONNECTING:s.ReadyState.UNINSTANTIATED,T=t.queryParams?JSON.stringify(t.queryParams):null,R=(0,l.useCallback)(function(e,t){var n;if(void 0===t&&(t=!0),s.isEventSourceSupported&&y.current instanceof EventSource){console.warn("Unable to send a message from an eventSource");return}(null===(n=y.current)||void 0===n?void 0:n.readyState)===s.ReadyState.OPEN?((0,p.assertIsWebSocket)(y.current,_.current.skipAssert),y.current.send(e)):t&&L.current.push(e)},[]),C=(0,l.useCallback)(function(e,t){void 0===t&&(t=!0),R(JSON.stringify(e),t)},[R]),N=(0,l.useCallback)(function(){return!0!==_.current.share||s.isEventSourceSupported&&y.current instanceof EventSource?y.current:(null===w.current&&y.current&&((0,p.assertIsWebSocket)(y.current,_.current.skipAssert),w.current=(0,d.default)(y.current,g)),w.current)},[]);return(0,l.useEffect)(function(){if(null!==e&&!0===n){var t,c=!1,l=!0,d=function(){return a(void 0,void 0,void 0,function(){var n,a,d;return o(this,function(o){switch(o.label){case 0:return n=A,[4,(0,f.getUrl)(e,_)];case 1:if(n.current=o.sent(),null===A.current)return console.error("Failed to get a valid URL. WebSocket connection aborted."),A.current="ABORTED",(0,u.flushSync)(function(){return S(function(e){return r(r({},e),{ABORTED:s.ReadyState.CLOSED})})}),[2];return a=function(e){c||(0,u.flushSync)(function(){return m(e)})},d=function(e){c||(0,u.flushSync)(function(){return S(function(t){var n;return r(r({},t),A.current&&((n={})[A.current]=e,n))})})},l&&(t=(0,i.createOrJoinSocket)(y,A.current,d,_,a,g,O,M,R)),[2]}})})};return g.current=function(){c||(w.current&&(w.current=null),null==t||t(),d())},d(),function(){c=!0,l=!1,w.current&&(w.current=null),null==t||t(),m(null)}}(null===e||!1===n)&&(O.current=0,S(function(e){var t;return r(r({},e),A.current&&((t={})[A.current]=s.ReadyState.CLOSED,t))}))},[e,n,T,R]),(0,l.useEffect)(function(){Z===s.ReadyState.OPEN&&L.current.splice(0).forEach(function(e){R(e)})},[Z]),{sendMessage:R,sendJsonMessage:C,lastMessage:h,lastJsonMessage:b,readyState:Z,getWebSocket:N}}},83420:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.assertIsWebSocket=function(e,t){if(!t&&e instanceof WebSocket==!1)throw Error("")},t.resetGlobalState=function(e){(0,a.resetSubscribers)(e),(0,r.resetWebSockets)(e)};var r=n(31677),a=n(69366)},5223:function(e,t,n){n.d(t,{Z:function(){return l}});var r=n(2265),a=n(4992);let o=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M120.49,167.51a12,12,0,0,1,0,17l-32,32a12,12,0,0,1-17,0l-32-32a12,12,0,1,1,17-17L68,179V48a12,12,0,0,1,24,0V179l11.51-11.52A12,12,0,0,1,120.49,167.51Zm96-96-32-32a12,12,0,0,0-17,0l-32,32a12,12,0,0,0,17,17L164,77V208a12,12,0,0,0,24,0V77l11.51,11.52a12,12,0,0,0,17-17Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M176,48V208H80V48Z",opacity:"0.2"}),r.createElement("path",{d:"M117.66,170.34a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L72,188.69V48a8,8,0,0,1,16,0V188.69l18.34-18.35A8,8,0,0,1,117.66,170.34Zm96-96-32-32a8,8,0,0,0-11.32,0l-32,32a8,8,0,0,0,11.32,11.32L168,67.31V208a8,8,0,0,0,16,0V67.31l18.34,18.35a8,8,0,0,0,11.32-11.32Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M119.39,172.94a8,8,0,0,1-1.73,8.72l-32,32a8,8,0,0,1-11.32,0l-32-32A8,8,0,0,1,48,168H72V48a8,8,0,0,1,16,0V168h24A8,8,0,0,1,119.39,172.94Zm94.27-98.6-32-32a8,8,0,0,0-11.32,0l-32,32A8,8,0,0,0,144,88h24V208a8,8,0,0,0,16,0V88h24a8,8,0,0,0,5.66-13.66Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M116.24,171.76a6,6,0,0,1,0,8.48l-32,32a6,6,0,0,1-8.48,0l-32-32a6,6,0,0,1,8.48-8.48L74,193.51V48a6,6,0,0,1,12,0V193.51l21.76-21.75A6,6,0,0,1,116.24,171.76Zm96-96-32-32a6,6,0,0,0-8.48,0l-32,32a6,6,0,0,0,8.48,8.48L170,62.49V208a6,6,0,0,0,12,0V62.49l21.76,21.75a6,6,0,0,0,8.48-8.48Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M117.66,170.34a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L72,188.69V48a8,8,0,0,1,16,0V188.69l18.34-18.35A8,8,0,0,1,117.66,170.34Zm96-96-32-32a8,8,0,0,0-11.32,0l-32,32a8,8,0,0,0,11.32,11.32L168,67.31V208a8,8,0,0,0,16,0V67.31l18.34,18.35a8,8,0,0,0,11.32-11.32Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M114.83,173.17a4,4,0,0,1,0,5.66l-32,32a4,4,0,0,1-5.66,0l-32-32a4,4,0,0,1,5.66-5.66L76,198.34V48a4,4,0,0,1,8,0V198.34l25.17-25.17A4,4,0,0,1,114.83,173.17Zm96-96-32-32a4,4,0,0,0-5.66,0l-32,32a4,4,0,0,0,5.66,5.66L172,57.66V208a4,4,0,0,0,8,0V57.66l25.17,25.17a4,4,0,1,0,5.66-5.66Z"}))]]),c=r.forwardRef((e,t)=>r.createElement(a.Z,{ref:t,...e,weights:o}));c.displayName="ArrowsDownUpIcon";let l=c},32046:function(e,t,n){n.d(t,{_:function(){return l}});var r=n(2265),a=n(4992);let o=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm48.49-108.49a12,12,0,0,1,0,17l-40,40a12,12,0,0,1-17,0l-40-40a12,12,0,0,1,17-17L128,135l31.51-31.52A12,12,0,0,1,176.49,103.51Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),r.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm45.66-109.66a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L128,140.69l34.34-34.35A8,8,0,0,1,173.66,106.34Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,93.66-40,40a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L128,140.69l34.34-34.35a8,8,0,0,1,11.32,11.32Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm44.24-110.24a6,6,0,0,1,0,8.48l-40,40a6,6,0,0,1-8.48,0l-40-40a6,6,0,0,1,8.48-8.48L128,143.51l35.76-35.75A6,6,0,0,1,172.24,107.76Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm45.66-109.66a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L128,140.69l34.34-34.35A8,8,0,0,1,173.66,106.34Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm42.83-110.83a4,4,0,0,1,0,5.66l-40,40a4,4,0,0,1-5.66,0l-40-40a4,4,0,0,1,5.66-5.66L128,146.34l37.17-37.17A4,4,0,0,1,170.83,109.17Z"}))]]),c=r.forwardRef((e,t)=>r.createElement(a.Z,{ref:t,...e,weights:o}));c.displayName="CaretCircleDownIcon";let l=c},75256:function(e,t,n){n.d(t,{K:function(){return l}});var r=n(2265),a=n(4992);let o=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M184.49,167.51a12,12,0,0,1,0,17l-48,48a12,12,0,0,1-17,0l-48-48a12,12,0,0,1,17-17L128,207l39.51-39.52A12,12,0,0,1,184.49,167.51Zm-96-79L128,49l39.51,39.52a12,12,0,0,0,17-17l-48-48a12,12,0,0,0-17,0l-48,48a12,12,0,0,0,17,17Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M80,176h96l-48,48ZM128,32,80,80h96Z",opacity:"0.2"}),r.createElement("path",{d:"M176,168H80a8,8,0,0,0-5.66,13.66l48,48a8,8,0,0,0,11.32,0l48-48A8,8,0,0,0,176,168Zm-48,44.69L99.31,184h57.38ZM80,88h96a8,8,0,0,0,5.66-13.66l-48-48a8,8,0,0,0-11.32,0l-48,48A8,8,0,0,0,80,88Zm48-44.69L156.69,72H99.31Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M72.61,83.06a8,8,0,0,1,1.73-8.72l48-48a8,8,0,0,1,11.32,0l48,48A8,8,0,0,1,176,88H80A8,8,0,0,1,72.61,83.06ZM176,168H80a8,8,0,0,0-5.66,13.66l48,48a8,8,0,0,0,11.32,0l48-48A8,8,0,0,0,176,168Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M180.24,171.76a6,6,0,0,1,0,8.48l-48,48a6,6,0,0,1-8.48,0l-48-48a6,6,0,0,1,8.48-8.48L128,215.51l43.76-43.75A6,6,0,0,1,180.24,171.76Zm-96-87.52L128,40.49l43.76,43.75a6,6,0,0,0,8.48-8.48l-48-48a6,6,0,0,0-8.48,0l-48,48a6,6,0,0,0,8.48,8.48Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M181.66,170.34a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-48-48a8,8,0,0,1,11.32-11.32L128,212.69l42.34-42.35A8,8,0,0,1,181.66,170.34Zm-96-84.68L128,43.31l42.34,42.35a8,8,0,0,0,11.32-11.32l-48-48a8,8,0,0,0-11.32,0l-48,48A8,8,0,0,0,85.66,85.66Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M178.83,173.17a4,4,0,0,1,0,5.66l-48,48a4,4,0,0,1-5.66,0l-48-48a4,4,0,0,1,5.66-5.66L128,218.34l45.17-45.17A4,4,0,0,1,178.83,173.17Zm-96-90.34L128,37.66l45.17,45.17a4,4,0,1,0,5.66-5.66l-48-48a4,4,0,0,0-5.66,0l-48,48a4,4,0,0,0,5.66,5.66Z"}))]]),c=r.forwardRef((e,t)=>r.createElement(a.Z,{ref:t,...e,weights:o}));c.displayName="CaretUpDownIcon";let l=c},68772:function(e,t,n){n.d(t,{f:function(){return l}});var r=n(2265),a=n(4992);let o=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M176.49,95.51a12,12,0,0,1,0,17l-56,56a12,12,0,0,1-17,0l-24-24a12,12,0,1,1,17-17L112,143l47.51-47.52A12,12,0,0,1,176.49,95.51ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),r.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm45.66,85.66-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35a8,8,0,0,1,11.32,11.32Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M172.24,99.76a6,6,0,0,1,0,8.48l-56,56a6,6,0,0,1-8.48,0l-24-24a6,6,0,0,1,8.48-8.48L112,151.51l51.76-51.75A6,6,0,0,1,172.24,99.76ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M170.83,101.17a4,4,0,0,1,0,5.66l-56,56a4,4,0,0,1-5.66,0l-24-24a4,4,0,0,1,5.66-5.66L112,154.34l53.17-53.17A4,4,0,0,1,170.83,101.17ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]),c=r.forwardRef((e,t)=>r.createElement(a.Z,{ref:t,...e,weights:o}));c.displayName="CheckCircleIcon";let l=c},79603:function(e,t,n){n.d(t,{C:function(){return l}});var r=n(2265),a=n(4992);let o=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),r.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M232,128A104,104,0,1,1,128,24,104.13,104.13,0,0,1,232,128Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Z"}))]]),c=r.forwardRef((e,t)=>r.createElement(a.Z,{ref:t,...e,weights:o}));c.displayName="CircleIcon";let l=c},91890:function(e,t,n){n.d(t,{T:function(){return l}});var r=n(2265),a=n(4992);let o=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,144H140V98.32a44,44,0,1,0-24,0V144H48a20,20,0,0,0-20,20v44a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V164A20,20,0,0,0,208,144ZM108,56a20,20,0,1,1,20,20A20,20,0,0,1,108,56Zm96,148H52V168H204ZM172,104h32a12,12,0,0,1,0,24H172a12,12,0,0,1,0-24Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M216,160v48a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V160a8,8,0,0,1,8-8H208A8,8,0,0,1,216,160ZM128,88A32,32,0,1,0,96,56,32,32,0,0,0,128,88Z",opacity:"0.2"}),r.createElement("path",{d:"M208,144H136V95.19a40,40,0,1,0-16,0V144H48a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V160A16,16,0,0,0,208,144ZM104,56a24,24,0,1,1,24,24A24,24,0,0,1,104,56ZM208,208H48V160H208v48Zm-40-96h32a8,8,0,0,1,0,16H168a8,8,0,0,1,0-16Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M224,160v48a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V160a16,16,0,0,1,16-16h72V95.19a40,40,0,1,1,16,0V144h72A16,16,0,0,1,224,160Zm-64-40a8,8,0,0,0,8,8h32a8,8,0,0,0,0-16H168A8,8,0,0,0,160,120Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,146H134V93.52a38,38,0,1,0-12,0V146H48a14,14,0,0,0-14,14v48a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V160A14,14,0,0,0,208,146ZM102,56a26,26,0,1,1,26,26A26,26,0,0,1,102,56ZM210,208a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V160a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Zm-42-94h32a6,6,0,0,1,0,12H168a6,6,0,0,1,0-12Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,144H136V95.19a40,40,0,1,0-16,0V144H48a16,16,0,0,0-16,16v48a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V160A16,16,0,0,0,208,144ZM104,56a24,24,0,1,1,24,24A24,24,0,0,1,104,56ZM208,208H48V160H208v48Zm-40-96h32a8,8,0,0,1,0,16H168a8,8,0,0,1,0-16Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,148H132V91.77a36,36,0,1,0-8,0V148H48a12,12,0,0,0-12,12v48a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V160A12,12,0,0,0,208,148ZM100,56a28,28,0,1,1,28,28A28,28,0,0,1,100,56ZM212,208a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V160a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-48-88a4,4,0,0,1,4-4h32a4,4,0,0,1,0,8H168A4,4,0,0,1,164,120Z"}))]]),c=r.forwardRef((e,t)=>r.createElement(a.Z,{ref:t,...e,weights:o}));c.displayName="JoystickIcon";let l=c},34153:function(e,t,n){n.d(t,{R:function(){return l}});var r=n(2265),a=n(4992);let o=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,84A36,36,0,1,0,92,48,36,36,0,0,0,128,84Zm0-48a12,12,0,1,1-12,12A12,12,0,0,1,128,36Zm100,72a12,12,0,0,1-12,12H140v16.09L188.73,157A12,12,0,0,1,196,168v48a12,12,0,0,1-24,0V175.91l-41.67-17.86L56,224.92A12,12,0,0,1,40,207.08l76-68.42V120H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,108Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M152,48a24,24,0,1,1-24-24A24,24,0,0,1,152,48Z",opacity:"0.2"}),r.createElement("path",{d:"M128,80A32,32,0,1,0,96,48,32,32,0,0,0,128,80Zm0-48a16,16,0,1,1-16,16A16,16,0,0,1,128,32Zm96,72a8,8,0,0,1-8,8H136v26.72l51.15,21.93A8,8,0,0,1,192,168v48a8,8,0,0,1-16,0V173.28l-46.45-19.91L53.35,222a8,8,0,1,1-10.7-11.9L120,140.44V112H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,104Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M96,48a32,32,0,1,1,32,32A32,32,0,0,1,96,48ZM216,96H40a8,8,0,0,0,0,16h80v28.44L42.65,210.05A8,8,0,0,0,53.35,222l76.2-68.58L176,173.28V216a8,8,0,0,0,16,0V168a8,8,0,0,0-4.85-7.35L136,138.72V112h80a8,8,0,0,0,0-16Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,78A30,30,0,1,0,98,48,30,30,0,0,0,128,78Zm0-48a18,18,0,1,1-18,18A18,18,0,0,1,128,30Zm94,74a6,6,0,0,1-6,6H134v30l52.36,22.45A6,6,0,0,1,190,168v48a6,6,0,0,1-12,0V172L129.16,151,52,220.46a6,6,0,0,1-8-8.92l78-70.21V110H40a6,6,0,0,1,0-12H216A6,6,0,0,1,222,104Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,80A32,32,0,1,0,96,48,32,32,0,0,0,128,80Zm0-48a16,16,0,1,1-16,16A16,16,0,0,1,128,32Zm96,72a8,8,0,0,1-8,8H136v26.72l51.15,21.93A8,8,0,0,1,192,168v48a8,8,0,0,1-16,0V173.28l-46.45-19.91L53.35,222a8,8,0,1,1-10.7-11.9L120,140.44V112H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,104Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M128,76a28,28,0,1,0-28-28A28,28,0,0,0,128,76Zm0-48a20,20,0,1,1-20,20A20,20,0,0,1,128,28Zm92,76a4,4,0,0,1-4,4H132v33.36l53.58,23A4,4,0,0,1,188,168v48a4,4,0,0,1-8,0V170.64l-51.22-22L50.68,219A4,4,0,1,1,45.32,213L124,142.22V108H40a4,4,0,0,1,0-8H216A4,4,0,0,1,220,104Z"}))]]),c=r.forwardRef((e,t)=>r.createElement(a.Z,{ref:t,...e,weights:o}));c.displayName="PersonSimpleTaiChiIcon";let l=c},43551:function(e,t,n){n.d(t,{J:function(){return l}});var r=n(2265),a=n(4992);let o=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z",opacity:"0.2"}),r.createElement("path",{d:"M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z"}))]]),c=r.forwardRef((e,t)=>r.createElement(a.Z,{ref:t,...e,weights:o}));c.displayName="SparkleIcon";let l=c},9270:function(e,t,n){n.d(t,{fC:function(){return y},z$:function(){return O}});var r=n(2265),a=n(98575),o=n(73966),c=n(6741),l=n(80886),u=n(6718),s=n(90420),i=n(71599),f=n(66840),d=n(57437),p="Checkbox",[h,m]=(0,o.b)(p),[v,E]=h(p);function S(e){let{__scopeCheckbox:t,checked:n,children:a,defaultChecked:o,disabled:c,form:u,name:s,onCheckedChange:i,required:f,value:h="on",internal_do_not_use_render:m}=e,[E,S]=(0,l.T)({prop:n,defaultProp:null!=o&&o,onChange:i,caller:p}),[b,A]=r.useState(null),[y,g]=r.useState(null),O=r.useRef(!1),M=!b||!!u||!!b.closest("form"),L={checked:E,disabled:c,setChecked:S,control:b,setControl:A,name:s,form:u,value:h,hasConsumerStoppedPropagationRef:O,required:f,defaultChecked:!w(o)&&o,isFormControl:M,bubbleInput:y,setBubbleInput:g};return(0,d.jsx)(v,{scope:t,...L,children:"function"==typeof m?m(L):a})}var b="CheckboxTrigger",A=r.forwardRef((e,t)=>{let{__scopeCheckbox:n,onKeyDown:o,onClick:l,...u}=e,{control:s,value:i,disabled:p,checked:h,required:m,setControl:v,setChecked:S,hasConsumerStoppedPropagationRef:A,isFormControl:y,bubbleInput:g}=E(b,n),O=(0,a.e)(t,v),M=r.useRef(h);return r.useEffect(()=>{let e=null==s?void 0:s.form;if(e){let t=()=>S(M.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[s,S]),(0,d.jsx)(f.WV.button,{type:"button",role:"checkbox","aria-checked":w(h)?"mixed":h,"aria-required":m,"data-state":_(h),"data-disabled":p?"":void 0,disabled:p,value:i,...u,ref:O,onKeyDown:(0,c.M)(o,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,c.M)(l,e=>{S(e=>!!w(e)||!e),g&&y&&(A.current=e.isPropagationStopped(),A.current||e.stopPropagation())})})});A.displayName=b;var y=r.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:a,defaultChecked:o,required:c,disabled:l,value:u,onCheckedChange:s,form:i,...f}=e;return(0,d.jsx)(S,{__scopeCheckbox:n,checked:a,defaultChecked:o,disabled:l,required:c,onCheckedChange:s,name:r,form:i,value:u,internal_do_not_use_render:e=>{let{isFormControl:r}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(A,{...f,ref:t,__scopeCheckbox:n}),r&&(0,d.jsx)(L,{__scopeCheckbox:n})]})}})});y.displayName=p;var g="CheckboxIndicator",O=r.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...a}=e,o=E(g,n);return(0,d.jsx)(i.z,{present:r||w(o.checked)||!0===o.checked,children:(0,d.jsx)(f.WV.span,{"data-state":_(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});O.displayName=g;var M="CheckboxBubbleInput",L=r.forwardRef((e,t)=>{let{__scopeCheckbox:n,...o}=e,{control:c,hasConsumerStoppedPropagationRef:l,checked:i,defaultChecked:p,required:h,disabled:m,name:v,value:S,form:b,bubbleInput:A,setBubbleInput:y}=E(M,n),g=(0,a.e)(t,y),O=(0,u.D)(i),L=(0,s.t)(c);r.useEffect(()=>{if(!A)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,t=!l.current;if(O!==i&&e){let n=new Event("click",{bubbles:t});A.indeterminate=w(i),e.call(A,!w(i)&&i),A.dispatchEvent(n)}},[A,O,i,l]);let _=r.useRef(!w(i)&&i);return(0,d.jsx)(f.WV.input,{type:"checkbox","aria-hidden":!0,defaultChecked:null!=p?p:_.current,required:h,disabled:m,name:v,value:S,form:b,...o,tabIndex:-1,ref:g,style:{...o.style,...L,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function w(e){return"indeterminate"===e}function _(e){return w(e)?"indeterminate":e?"checked":"unchecked"}L.displayName=M},16605:function(e,t,n){n.d(t,{VY:function(){return C},fC:function(){return T},xz:function(){return R}});var r,a=n(2265),o=n(6741),c=n(73966),l=n(80886),u=n(98575),s=n(26008),i=(n(83832),n(71599)),f=n(66840),d=n(15278),p=n(57437),h="HoverCard",[m,v]=(0,c.b)(h,[s.D7]),E=(0,s.D7)(),[S,b]=m(h),A=e=>{let{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:c,openDelay:u=700,closeDelay:i=300}=e,f=E(t),d=a.useRef(0),m=a.useRef(0),v=a.useRef(!1),b=a.useRef(!1),[A,y]=(0,l.T)({prop:r,defaultProp:null!=o&&o,onChange:c,caller:h}),g=a.useCallback(()=>{clearTimeout(m.current),d.current=window.setTimeout(()=>y(!0),u)},[u,y]),O=a.useCallback(()=>{clearTimeout(d.current),v.current||b.current||(m.current=window.setTimeout(()=>y(!1),i))},[i,y]),M=a.useCallback(()=>y(!1),[y]);return a.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(m.current)},[]),(0,p.jsx)(S,{scope:t,open:A,onOpenChange:y,onOpen:g,onClose:O,onDismiss:M,hasSelectionRef:v,isPointerDownOnContentRef:b,children:(0,p.jsx)(s.fC,{...f,children:n})})};A.displayName=h;var y="HoverCardTrigger",g=a.forwardRef((e,t)=>{let{__scopeHoverCard:n,...r}=e,a=b(y,n),c=E(n);return(0,p.jsx)(s.ee,{asChild:!0,...c,children:(0,p.jsx)(f.WV.a,{"data-state":a.open?"open":"closed",...r,ref:t,onPointerEnter:(0,o.M)(e.onPointerEnter,Z(a.onOpen)),onPointerLeave:(0,o.M)(e.onPointerLeave,Z(a.onClose)),onFocus:(0,o.M)(e.onFocus,a.onOpen),onBlur:(0,o.M)(e.onBlur,a.onClose),onTouchStart:(0,o.M)(e.onTouchStart,e=>e.preventDefault())})})});g.displayName=y;var[O,M]=m("HoverCardPortal",{forceMount:void 0}),L="HoverCardContent",w=a.forwardRef((e,t)=>{let n=M(L,e.__scopeHoverCard),{forceMount:r=n.forceMount,...a}=e,c=b(L,e.__scopeHoverCard);return(0,p.jsx)(i.z,{present:r||c.open,children:(0,p.jsx)(_,{"data-state":c.open?"open":"closed",...a,onPointerEnter:(0,o.M)(e.onPointerEnter,Z(c.onOpen)),onPointerLeave:(0,o.M)(e.onPointerLeave,Z(c.onClose)),ref:t})})});w.displayName=L;var _=a.forwardRef((e,t)=>{let{__scopeHoverCard:n,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:i,onInteractOutside:f,...h}=e,m=b(L,n),v=E(n),S=a.useRef(null),A=(0,u.e)(t,S),[y,g]=a.useState(!1);return a.useEffect(()=>{if(y){let e=document.body;return r=e.style.userSelect||e.style.webkitUserSelect,e.style.userSelect="none",e.style.webkitUserSelect="none",()=>{e.style.userSelect=r,e.style.webkitUserSelect=r}}},[y]),a.useEffect(()=>{if(S.current){let e=()=>{g(!1),m.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var e;(null===(e=document.getSelection())||void 0===e?void 0:e.toString())!==""&&(m.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",e),()=>{document.removeEventListener("pointerup",e),m.hasSelectionRef.current=!1,m.isPointerDownOnContentRef.current=!1}}},[m.isPointerDownOnContentRef,m.hasSelectionRef]),a.useEffect(()=>{S.current&&(function(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t})(S.current).forEach(e=>e.setAttribute("tabindex","-1"))}),(0,p.jsx)(d.XB,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:l,onFocusOutside:(0,o.M)(i,e=>{e.preventDefault()}),onDismiss:m.onDismiss,children:(0,p.jsx)(s.VY,{...v,...h,onPointerDown:(0,o.M)(h.onPointerDown,e=>{e.currentTarget.contains(e.target)&&g(!0),m.hasSelectionRef.current=!1,m.isPointerDownOnContentRef.current=!0}),ref:A,style:{...h.style,userSelect:y?"text":void 0,WebkitUserSelect:y?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})});function Z(e){return t=>"touch"===t.pointerType?void 0:e()}a.forwardRef((e,t)=>{let{__scopeHoverCard:n,...r}=e,a=E(n);return(0,p.jsx)(s.Eh,{...a,...r,ref:t})}).displayName="HoverCardArrow";var T=A,R=g,C=w}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8459,3317,7138,244],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9718],{1813:function(e,a,t){Promise.resolve().then(t.bind(t,37335))},37335:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return V}});var l=t(57437),n=t(14675),r=t.n(n),o=t(17200),s=t(2265),i=t(56937),d=t(2335),c=t(19945),u=t(26110),h=t(39535),m=t(14308),p=t(65613),f=t(7436),v=t(25427),g=t(29501),x=t(13590),A=t(60729),j=t(34124),b=t(6512),_=t(37104),Z=t(49027),M=t(27648);let N=()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),y=e=>fetch(e).then(e=>e.json());function E(e){let[a,t]=(0,s.useState)(!1),[n,r]=(0,s.useState)(null),[o,i]=(0,s.useState)(!0),c=(0,g.cI)({resolver:(0,x.F)(v.bc),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]}});return(0,s.useEffect)(()=>{c.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]})},[e.selectedChatModelOption,e.data]),(0,l.jsxs)(u.Vq,{open:a,onOpenChange:t,children:[(0,l.jsx)(u.hg,{children:(0,l.jsxs)("div",{className:"flex items-center text-md gap-2",children:[(0,l.jsx)(d.v,{}),"Create Agent"]})}),(0,l.jsxs)(u.cZ,{className:"lg:max-w-screen-lg py-4 overflow-y-scroll h-full md:h-4/6 rounded-lg flex flex-col",children:[(0,l.jsx)(u.fK,{children:(0,l.jsx)(Z.$N,{children:"Create Agent"})}),!e.userProfile&&o&&(0,l.jsx)(h.Z,{onOpenChange:i,isMobileWidth:e.isMobileWidth}),(0,l.jsx)(v.ks,{form:c,onSubmit:a=>{fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(a=>{200===a.status?(c.reset(),t(!1),r(null),e.setAgentChangeTriggered(!0)):a.json().then(e=>{console.error(e),e.error&&r(e.error)})}).catch(e=>{console.error("Error:",e),r(e)})},create:!0,errors:n,filesOptions:e.filesOptions,modelOptions:e.modelOptions,inputToolOptions:e.inputToolOptions,outputModeOptions:e.outputModeOptions,isSubscribed:e.isSubscribed})]})]})}function V(){let{data:e,error:a,mutate:t}=(0,o.ZP)("agents",N,{revalidateOnFocus:!1}),{data:n,error:d,isLoading:u}=(0,i.GW)(),{data:g}=(0,i.h2)(!0),[x,Z]=(0,s.useState)(!1),V=(0,f.IC)(),[w,O]=(0,s.useState)([]),[L,C]=(0,s.useState)([]),[S,P]=(0,s.useState)(null),{data:F,error:H}=(0,o.ZP)(g?"/api/content/computer":null,y),{data:T,error:k}=(0,o.ZP)("/api/agents/options",y),[I,W]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{I&&(t(),W(!1))},[I]),(0,s.useEffect)(()=>{if(e){O(e.filter(e=>e.creator===(null==n?void 0:n.username)));let a=e.filter(e=>"private"!==e.privacy_level&&e.creator!==(null==n?void 0:n.username));C(a);{let t=new URLSearchParams(window.location.search).get("agent");if(t){P(t);let l=e.find(e=>e.slug===t);l||(l=a.find(e=>e.slug===t)),l||fetch("/api/agents/".concat(t)).then(e=>{if(404===e.status)throw Error("Agent not found");return e.json()}).then(e=>{"protected"===e.privacy_level&&C(a=>[...a,e])})}}}},[e,n]),a)return(0,l.jsxs)("main",{className:r().main,children:[(0,l.jsx)("div",{className:"".concat(r().titleBar," text-5xl"),children:"Agents"}),(0,l.jsx)("div",{className:r().agentList,children:"Error loading agents"})]});if(!e)return(0,l.jsx)("main",{className:r().main,children:(0,l.jsxs)("div",{className:r().agentList,children:[(0,l.jsx)(m.l,{})," booting up your agents"]})});let R=(null==g?void 0:g.chat_model_options)||[],B=(null==g?void 0:g.selected_chat_model_config)||0,Y=(null==g?void 0:g.is_active)||!1,z=R.find(e=>e.id===B);return(0,l.jsxs)(A.Hn,{children:[(0,l.jsx)(j.S,{conversationId:""}),(0,l.jsxs)(A.kV,{children:[(0,l.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,l.jsx)(A.vP,{className:"-ml-1"}),(0,l.jsx)(b.Z,{orientation:"vertical",className:"mr-2 h-4"}),V?(0,l.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,l.jsx)(_.VO,{className:"h-auto w-16"})}):(0,l.jsx)("h2",{className:"text-lg",children:"Agents"})]}),(0,l.jsx)("main",{className:"w-full mx-auto",children:(0,l.jsx)("div",{className:"grid w-full mx-auto",children:(0,l.jsxs)("div",{className:"".concat(r().pageLayout," w-full"),children:[(0,l.jsxs)("div",{className:"pt-6 md:pt-8 flex justify-between",children:[(0,l.jsx)("h1",{className:"text-3xl flex items-center",children:"Agents"}),(0,l.jsx)("div",{className:"ml-auto float-right border p-2 pt-3 rounded-xl font-bold hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,l.jsx)(E,{data:{slug:"",name:"",persona:"",color:"",icon:"",privacy_level:"private",managed_by_admin:!1,chat_model:"",input_tools:[],output_modes:[],is_hidden:!1},userProfile:u?null:null!=n?n:null,isMobileWidth:V,filesOptions:F||[],modelOptions:(null==g?void 0:g.chat_model_options)||[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:Y,setAgentChangeTriggered:W,inputToolOptions:(null==T?void 0:T.input_tools)||{},outputModeOptions:(null==T?void 0:T.output_modes)||{}})})]}),x&&(0,l.jsx)(h.Z,{onOpenChange:Z,isMobileWidth:V}),(0,l.jsx)(p.bZ,{className:"bg-secondary border-none my-4",children:(0,l.jsxs)(p.X,{children:[(0,l.jsx)(c.P,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,l.jsx)("span",{className:"font-bold",children:"How it works"})," Use any of these specialized personas to tune your conversation to your needs.",!Y&&(0,l.jsxs)("span",{children:[" ",(0,l.jsx)(M.default,{href:"/settings",className:"font-bold",children:"Upgrade your plan"})," to leverage custom models. You will fallback to the default model when chatting."]})]})}),(0,l.jsx)("div",{className:"pt-6 md:pt-8",children:(0,l.jsx)("div",{className:"".concat(r().agentList),children:n&&w.map(e=>(0,l.jsx)(v.EY,{data:e,userProfile:n,isMobileWidth:V,filesOptions:null!=F?F:[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:Y,setAgentChangeTriggered:W,modelOptions:(null==g?void 0:g.chat_model_options)||[],editCard:!0,agentSlug:S||"",inputToolOptions:(null==T?void 0:T.input_tools)||{},outputModeOptions:(null==T?void 0:T.output_modes)||{}},e.slug))})}),(0,l.jsxs)("div",{className:"pt-6 md:pt-8",children:[(0,l.jsx)("h2",{className:"text-2xl",children:"Explore"}),(0,l.jsx)("div",{className:"".concat(r().agentList),children:!u&&L.map(e=>(0,l.jsx)(v.EY,{data:e,userProfile:n||null,isMobileWidth:V,editCard:!1,filesOptions:null!=F?F:[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:Y,setAgentChangeTriggered:W,modelOptions:(null==g?void 0:g.chat_model_options)||[],agentSlug:S||"",inputToolOptions:(null==T?void 0:T.input_tools)||{},outputModeOptions:(null==T?void 0:T.output_modes)||{}},e.slug))})]})]})})})]})]})}},32759:function(e,a,t){"use strict";t.d(a,{E:function(){return s}});var l=t(57437),n=t(2265),r=t(60610),o=t(94508);let s=n.forwardRef((e,a)=>{let{className:t,value:n,indicatorColor:s,...i}=e;return(0,l.jsx)(r.fC,{ref:a,className:(0,o.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...i,children:(0,l.jsx)(r.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(s),style:{transform:"translateX(-".concat(100-(n||0),"%)")}})})});s.displayName=r.fC.displayName},76818:function(e,a,t){"use strict";t.d(a,{g:function(){return o}});var l=t(57437),n=t(2265),r=t(94508);let o=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,l.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...n})});o.displayName="Textarea"},14675:function(e){e.exports={titleBar:"agents_titleBar__FzYbY",agentPersonality:"agents_agentPersonality__o0Ysz",pageLayout:"agents_pageLayout__gR3S3",infoButton:"agents_infoButton__NqI7E",agentList:"agents_agentList__XVx4A"}},49807:function(e,a,t){"use strict";t.d(a,{a:function(){return s}});var l=t(2265),n=t(4992);let r=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M252,124a60.14,60.14,0,0,0-32-53.08,52,52,0,0,0-92-32.11A52,52,0,0,0,36,70.92a60,60,0,0,0,0,106.14,52,52,0,0,0,92,32.13,52,52,0,0,0,92-32.13A60.05,60.05,0,0,0,252,124ZM88,204a28,28,0,0,1-26.85-20.07c1,0,1.89.07,2.85.07h8a12,12,0,0,0,0-24H64A36,36,0,0,1,52,90.05a12,12,0,0,0,8-11.32V72a28,28,0,0,1,56,0v60.18a51.61,51.61,0,0,0-7.2-3.85,12,12,0,1,0-9.6,22A28,28,0,0,1,88,204Zm104-44h-8a12,12,0,0,0,0,24h8c1,0,1.9,0,2.85-.07a28,28,0,1,1-38-33.61,12,12,0,1,0-9.6-22,51.61,51.61,0,0,0-7.2,3.85V72a28,28,0,0,1,56,0v6.73a12,12,0,0,0,8,11.32,36,36,0,0,1-12,70Zm16-44a12,12,0,0,1-12,12,40,40,0,0,1-40-40V84a12,12,0,0,1,24,0v4a16,16,0,0,0,16,16A12,12,0,0,1,208,116ZM100,88a40,40,0,0,1-40,40,12,12,0,0,1,0-24A16,16,0,0,0,76,88V84a12,12,0,0,1,24,0Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M240,124a48,48,0,0,1-32,45.27h0V176a40,40,0,0,1-80,0,40,40,0,0,1-80,0v-6.73h0a48,48,0,0,1,0-90.54V72a40,40,0,0,1,80,0,40,40,0,0,1,80,0v6.73A48,48,0,0,1,240,124Z",opacity:"0.2"}),l.createElement("path",{d:"M248,124a56.11,56.11,0,0,0-32-50.61V72a48,48,0,0,0-88-26.49A48,48,0,0,0,40,72v1.39a56,56,0,0,0,0,101.2V176a48,48,0,0,0,88,26.49A48,48,0,0,0,216,176v-1.41A56.09,56.09,0,0,0,248,124ZM88,208a32,32,0,0,1-31.81-28.56A55.87,55.87,0,0,0,64,180h8a8,8,0,0,0,0-16H64A40,40,0,0,1,50.67,86.27,8,8,0,0,0,56,78.73V72a32,32,0,0,1,64,0v68.26A47.8,47.8,0,0,0,88,128a8,8,0,0,0,0,16,32,32,0,0,1,0,64Zm104-44h-8a8,8,0,0,0,0,16h8a55.87,55.87,0,0,0,7.81-.56A32,32,0,1,1,168,144a8,8,0,0,0,0-16,47.8,47.8,0,0,0-32,12.26V72a32,32,0,0,1,64,0v6.73a8,8,0,0,0,5.33,7.54A40,40,0,0,1,192,164Zm16-52a8,8,0,0,1-8,8h-4a36,36,0,0,1-36-36V80a8,8,0,0,1,16,0v4a20,20,0,0,0,20,20h4A8,8,0,0,1,208,112ZM60,120H56a8,8,0,0,1,0-16h4A20,20,0,0,0,80,84V80a8,8,0,0,1,16,0v4A36,36,0,0,1,60,120Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M212,76V72a44,44,0,0,0-74.86-31.31,3.93,3.93,0,0,0-1.14,2.8v88.72a4,4,0,0,0,6.2,3.33A47.67,47.67,0,0,1,167.68,128a8.18,8.18,0,0,1,8.31,7.58,8,8,0,0,1-8,8.42,32,32,0,0,0-32,32v33.88a4,4,0,0,0,1.49,3.12,47.92,47.92,0,0,0,74.21-17.16,4,4,0,0,0-4.49-5.56A68.06,68.06,0,0,1,192,192h-7.73a8.18,8.18,0,0,1-8.25-7.47,8,8,0,0,1,8-8.53h8a51.6,51.6,0,0,0,24-5.88v0A52,52,0,0,0,212,76Zm-12,36h-4a36,36,0,0,1-36-36V72a8,8,0,0,1,16,0v4a20,20,0,0,0,20,20h4a8,8,0,0,1,0,16ZM88,28A44.05,44.05,0,0,0,44,72v4a52,52,0,0,0-4,94.12h0A51.6,51.6,0,0,0,64,176h7.73A8.18,8.18,0,0,1,80,183.47,8,8,0,0,1,72,192H64a67.48,67.48,0,0,1-15.21-1.73,4,4,0,0,0-4.5,5.55A47.93,47.93,0,0,0,118.51,213a4,4,0,0,0,1.49-3.12V176a32,32,0,0,0-32-32,8,8,0,0,1-8-8.42A8.18,8.18,0,0,1,88.32,128a47.67,47.67,0,0,1,25.48,7.54,4,4,0,0,0,6.2-3.33V43.49a4,4,0,0,0-1.14-2.81A43.85,43.85,0,0,0,88,28Zm8,48a36,36,0,0,1-36,36H56a8,8,0,0,1,0-16h4A20,20,0,0,0,80,76V72a8,8,0,0,1,16,0Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M246,124a54.13,54.13,0,0,0-32-49.33V72a46,46,0,0,0-86-22.67A46,46,0,0,0,42,72v2.67a54,54,0,0,0,0,98.63V176a46,46,0,0,0,86,22.67A46,46,0,0,0,214,176v-2.7A54.07,54.07,0,0,0,246,124ZM88,210a34,34,0,0,1-34-32.94A53.67,53.67,0,0,0,64,178h8a6,6,0,0,0,0-12H64A42,42,0,0,1,50,84.39a6,6,0,0,0,4-5.66V72a34,34,0,0,1,68,0v73.05A45.89,45.89,0,0,0,88,130a6,6,0,0,0,0,12,34,34,0,0,1,0,68Zm104-44h-8a6,6,0,0,0,0,12h8a53.67,53.67,0,0,0,10-.94A34,34,0,1,1,168,142a6,6,0,0,0,0-12,45.89,45.89,0,0,0-34,15.05V72a34,34,0,0,1,68,0v6.73a6,6,0,0,0,4,5.66A42,42,0,0,1,192,166Zm14-54a6,6,0,0,1-6,6h-4a34,34,0,0,1-34-34V80a6,6,0,0,1,12,0v4a22,22,0,0,0,22,22h4A6,6,0,0,1,206,112ZM60,118H56a6,6,0,0,1,0-12h4A22,22,0,0,0,82,84V80a6,6,0,0,1,12,0v4A34,34,0,0,1,60,118Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M248,124a56.11,56.11,0,0,0-32-50.61V72a48,48,0,0,0-88-26.49A48,48,0,0,0,40,72v1.39a56,56,0,0,0,0,101.2V176a48,48,0,0,0,88,26.49A48,48,0,0,0,216,176v-1.41A56.09,56.09,0,0,0,248,124ZM88,208a32,32,0,0,1-31.81-28.56A55.87,55.87,0,0,0,64,180h8a8,8,0,0,0,0-16H64A40,40,0,0,1,50.67,86.27,8,8,0,0,0,56,78.73V72a32,32,0,0,1,64,0v68.26A47.8,47.8,0,0,0,88,128a8,8,0,0,0,0,16,32,32,0,0,1,0,64Zm104-44h-8a8,8,0,0,0,0,16h8a55.87,55.87,0,0,0,7.81-.56A32,32,0,1,1,168,144a8,8,0,0,0,0-16,47.8,47.8,0,0,0-32,12.26V72a32,32,0,0,1,64,0v6.73a8,8,0,0,0,5.33,7.54A40,40,0,0,1,192,164Zm16-52a8,8,0,0,1-8,8h-4a36,36,0,0,1-36-36V80a8,8,0,0,1,16,0v4a20,20,0,0,0,20,20h4A8,8,0,0,1,208,112ZM60,120H56a8,8,0,0,1,0-16h4A20,20,0,0,0,80,84V80a8,8,0,0,1,16,0v4A36,36,0,0,1,60,120Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M244,124a52.1,52.1,0,0,0-32-48V72a44,44,0,0,0-84-18.3A44,44,0,0,0,44,72v4a52,52,0,0,0,0,96v4a44,44,0,0,0,84,18.3A44,44,0,0,0,212,176v-4A52.07,52.07,0,0,0,244,124ZM88,212a36,36,0,0,1-36-36v-1.41A52.13,52.13,0,0,0,64,176h8a4,4,0,0,0,0-8H64A44,44,0,0,1,49.33,82.5,4,4,0,0,0,52,78.73V72a36,36,0,0,1,72,0v78.75A44,44,0,0,0,88,132a4,4,0,0,0,0,8,36,36,0,0,1,0,72Zm104-44h-8a4,4,0,0,0,0,8h8a52.13,52.13,0,0,0,12-1.41V176a36,36,0,1,1-36-36,4,4,0,0,0,0-8,44,44,0,0,0-36,18.75V72a36,36,0,0,1,72,0v6.73a4,4,0,0,0,2.67,3.77A44,44,0,0,1,192,168Zm12-56a4,4,0,0,1-4,4h-4a32,32,0,0,1-32-32V80a4,4,0,0,1,8,0v4a24,24,0,0,0,24,24h4A4,4,0,0,1,204,112ZM92,84a32,32,0,0,1-32,32H56a4,4,0,0,1,0-8h4A24,24,0,0,0,84,84V80a4,4,0,0,1,8,0Z"}))]]),o=l.forwardRef((e,a)=>l.createElement(n.Z,{ref:a,...e,weights:r}));o.displayName="BrainIcon";let s=o},19945:function(e,a,t){"use strict";t.d(a,{P:function(){return s}});var l=t(2265),n=t(4992);let r=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M219.71,117.38a12,12,0,0,0-7.25-8.52L161.28,88.39l10.59-70.61a12,12,0,0,0-20.64-10l-112,120a12,12,0,0,0,4.31,19.33l51.18,20.47L84.13,238.22a12,12,0,0,0,20.64,10l112-120A12,12,0,0,0,219.71,117.38ZM113.6,203.55l6.27-41.77a12,12,0,0,0-7.41-12.92L68.74,131.37,142.4,52.45l-6.27,41.77a12,12,0,0,0,7.41,12.92l43.72,17.49Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M96,240l16-80L48,136,160,16,144,96l64,24Z",opacity:"0.2"}),l.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M213.85,125.46l-112,120a8,8,0,0,1-13.69-7l14.66-73.33L45.19,143.49a8,8,0,0,1-3-13l112-120a8,8,0,0,1,13.69,7L153.18,90.9l57.63,21.61a8,8,0,0,1,3,12.95Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M213.84,118.63a6,6,0,0,0-3.73-4.25L150.88,92.17l15-75a6,6,0,0,0-10.27-5.27l-112,120a6,6,0,0,0,2.28,9.71l59.23,22.21-15,75a6,6,0,0,0,3.14,6.52A6.07,6.07,0,0,0,96,246a6,6,0,0,0,4.39-1.91l112-120A6,6,0,0,0,213.84,118.63ZM106,220.46l11.85-59.28a6,6,0,0,0-3.77-6.8l-55.6-20.85,91.46-98L138.12,94.82a6,6,0,0,0,3.77,6.8l55.6,20.85Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M211.89,119.09a4,4,0,0,0-2.49-2.84l-60.81-22.8,15.33-76.67a4,4,0,0,0-6.84-3.51l-112,120a4,4,0,0,0-1,3.64,4,4,0,0,0,2.49,2.84l60.81,22.8L92.08,239.22a4,4,0,0,0,6.84,3.51l112-120A4,4,0,0,0,211.89,119.09ZM102.68,227l13.24-66.2a4,4,0,0,0-2.52-4.53L55,134.36,153.32,29l-13.24,66.2a4,4,0,0,0,2.52,4.53L201,121.64Z"}))]]),o=l.forwardRef((e,a)=>l.createElement(n.Z,{ref:a,...e,weights:r}));o.displayName="LightningIcon";let s=o},60610:function(e,a,t){"use strict";t.d(a,{fC:function(){return j},z$:function(){return b}});var l=t(2265),n=t(73966),r=t(66840),o=t(57437),s="Progress",[i,d]=(0,n.b)(s),[c,u]=i(s),h=l.forwardRef((e,a)=>{var t,l,n,s;let{__scopeProgress:i,value:d=null,max:u,getValueLabel:h=f,...m}=e;(u||0===u)&&!x(u)&&console.error((t="".concat(u),l="Progress","Invalid prop `max` of value `".concat(t,"` supplied to `").concat(l,"`. Only numbers greater than 0 are valid max values. Defaulting to `").concat(100,"`.")));let p=x(u)?u:100;null===d||A(d,p)||console.error((n="".concat(d),s="Progress","Invalid prop `value` of value `".concat(n,"` supplied to `").concat(s,"`. The `value` prop must be:\n - a positive number\n - less than the value passed to `max` (or ").concat(100," if no `max` prop is set)\n - `null` or `undefined` if the progress is indeterminate.\n\nDefaulting to `null`.")));let j=A(d,p)?d:null,b=g(j)?h(j,p):void 0;return(0,o.jsx)(c,{scope:i,value:j,max:p,children:(0,o.jsx)(r.WV.div,{"aria-valuemax":p,"aria-valuemin":0,"aria-valuenow":g(j)?j:void 0,"aria-valuetext":b,role:"progressbar","data-state":v(j,p),"data-value":null!=j?j:void 0,"data-max":p,...m,ref:a})})});h.displayName=s;var m="ProgressIndicator",p=l.forwardRef((e,a)=>{var t;let{__scopeProgress:l,...n}=e,s=u(m,l);return(0,o.jsx)(r.WV.div,{"data-state":v(s.value,s.max),"data-value":null!==(t=s.value)&&void 0!==t?t:void 0,"data-max":s.max,...n,ref:a})});function f(e,a){return"".concat(Math.round(e/a*100),"%")}function v(e,a){return null==e?"indeterminate":e===a?"complete":"loading"}function g(e){return"number"==typeof e}function x(e){return g(e)&&!isNaN(e)&&e>0}function A(e,a){return g(e)&&!isNaN(e)&&e<=a&&e>=0}p.displayName=m;var j=h,b=p}},function(e){e.O(0,[4173,2939,7200,8667,1327,4447,558,3595,2327,5427,2971,2117,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9718],{1813:function(e,a,t){Promise.resolve().then(t.bind(t,37335))},37335:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return V}});var l=t(57437),n=t(14675),r=t.n(n),o=t(17200),s=t(2265),i=t(56937),d=t(2335),c=t(19945),u=t(26110),h=t(39535),m=t(14308),p=t(65613),f=t(7436),v=t(25427),g=t(29501),x=t(13590),A=t(60729),j=t(34124),b=t(6512),_=t(37104),Z=t(49027),M=t(27648);let N=()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),y=e=>fetch(e).then(e=>e.json());function E(e){let[a,t]=(0,s.useState)(!1),[n,r]=(0,s.useState)(null),[o,i]=(0,s.useState)(!0),c=(0,g.cI)({resolver:(0,x.F)(v.bc),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]}});return(0,s.useEffect)(()=>{c.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]})},[e.selectedChatModelOption,e.data]),(0,l.jsxs)(u.Vq,{open:a,onOpenChange:t,children:[(0,l.jsx)(u.hg,{children:(0,l.jsxs)("div",{className:"flex items-center text-md gap-2",children:[(0,l.jsx)(d.v,{}),"Create Agent"]})}),(0,l.jsxs)(u.cZ,{className:"lg:max-w-screen-lg py-4 overflow-y-scroll h-full md:h-4/6 rounded-lg flex flex-col",children:[(0,l.jsx)(u.fK,{children:(0,l.jsx)(Z.$N,{children:"Create Agent"})}),!e.userProfile&&o&&(0,l.jsx)(h.Z,{onOpenChange:i,isMobileWidth:e.isMobileWidth}),(0,l.jsx)(v.ks,{form:c,onSubmit:a=>{fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(a=>{200===a.status?(c.reset(),t(!1),r(null),e.setAgentChangeTriggered(!0)):a.json().then(e=>{console.error(e),e.error&&r(e.error)})}).catch(e=>{console.error("Error:",e),r(e)})},create:!0,errors:n,filesOptions:e.filesOptions,modelOptions:e.modelOptions,inputToolOptions:e.inputToolOptions,outputModeOptions:e.outputModeOptions,isSubscribed:e.isSubscribed})]})]})}function V(){let{data:e,error:a,mutate:t}=(0,o.ZP)("agents",N,{revalidateOnFocus:!1}),{data:n,error:d,isLoading:u}=(0,i.GW)(),{data:g}=(0,i.h2)(!0),[x,Z]=(0,s.useState)(!1),V=(0,f.IC)(),[w,O]=(0,s.useState)([]),[L,C]=(0,s.useState)([]),[S,P]=(0,s.useState)(null),{data:F,error:H}=(0,o.ZP)(g?"/api/content/computer":null,y),{data:T,error:k}=(0,o.ZP)("/api/agents/options",y),[I,W]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{I&&(t(),W(!1))},[I]),(0,s.useEffect)(()=>{if(e){O(e.filter(e=>e.creator===(null==n?void 0:n.username)));let a=e.filter(e=>"private"!==e.privacy_level&&e.creator!==(null==n?void 0:n.username));C(a);{let t=new URLSearchParams(window.location.search).get("agent");if(t){P(t);let l=e.find(e=>e.slug===t);l||(l=a.find(e=>e.slug===t)),l||fetch("/api/agents/".concat(t)).then(e=>{if(404===e.status)throw Error("Agent not found");return e.json()}).then(e=>{"protected"===e.privacy_level&&C(a=>[...a,e])})}}}},[e,n]),a)return(0,l.jsxs)("main",{className:r().main,children:[(0,l.jsx)("div",{className:"".concat(r().titleBar," text-5xl"),children:"Agents"}),(0,l.jsx)("div",{className:r().agentList,children:"Error loading agents"})]});if(!e)return(0,l.jsx)("main",{className:r().main,children:(0,l.jsxs)("div",{className:r().agentList,children:[(0,l.jsx)(m.l,{})," booting up your agents"]})});let R=(null==g?void 0:g.chat_model_options)||[],B=(null==g?void 0:g.selected_chat_model_config)||0,Y=(null==g?void 0:g.is_active)||!1,z=R.find(e=>e.id===B);return(0,l.jsxs)(A.Hn,{children:[(0,l.jsx)(j.S,{conversationId:""}),(0,l.jsxs)(A.kV,{children:[(0,l.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,l.jsx)(A.vP,{className:"-ml-1"}),(0,l.jsx)(b.Z,{orientation:"vertical",className:"mr-2 h-4"}),V?(0,l.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,l.jsx)(_.VO,{className:"h-auto w-16"})}):(0,l.jsx)("h2",{className:"text-lg",children:"Agents"})]}),(0,l.jsx)("main",{className:"w-full mx-auto",children:(0,l.jsx)("div",{className:"grid w-full mx-auto",children:(0,l.jsxs)("div",{className:"".concat(r().pageLayout," w-full"),children:[(0,l.jsxs)("div",{className:"pt-6 md:pt-8 flex justify-between",children:[(0,l.jsx)("h1",{className:"text-3xl flex items-center",children:"Agents"}),(0,l.jsx)("div",{className:"ml-auto float-right border p-2 pt-3 rounded-xl font-bold hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,l.jsx)(E,{data:{slug:"",name:"",persona:"",color:"",icon:"",privacy_level:"private",managed_by_admin:!1,chat_model:"",input_tools:[],output_modes:[],is_hidden:!1},userProfile:u?null:null!=n?n:null,isMobileWidth:V,filesOptions:F||[],modelOptions:(null==g?void 0:g.chat_model_options)||[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:Y,setAgentChangeTriggered:W,inputToolOptions:(null==T?void 0:T.input_tools)||{},outputModeOptions:(null==T?void 0:T.output_modes)||{}})})]}),x&&(0,l.jsx)(h.Z,{onOpenChange:Z,isMobileWidth:V}),(0,l.jsx)(p.bZ,{className:"bg-secondary border-none my-4",children:(0,l.jsxs)(p.X,{children:[(0,l.jsx)(c.P,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,l.jsx)("span",{className:"font-bold",children:"How it works"})," Use any of these specialized personas to tune your conversation to your needs.",!Y&&(0,l.jsxs)("span",{children:[" ",(0,l.jsx)(M.default,{href:"/settings",className:"font-bold",children:"Upgrade your plan"})," to leverage custom models. You will fallback to the default model when chatting."]})]})}),(0,l.jsx)("div",{className:"pt-6 md:pt-8",children:(0,l.jsx)("div",{className:"".concat(r().agentList),children:n&&w.map(e=>(0,l.jsx)(v.EY,{data:e,userProfile:n,isMobileWidth:V,filesOptions:null!=F?F:[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:Y,setAgentChangeTriggered:W,modelOptions:(null==g?void 0:g.chat_model_options)||[],editCard:!0,agentSlug:S||"",inputToolOptions:(null==T?void 0:T.input_tools)||{},outputModeOptions:(null==T?void 0:T.output_modes)||{}},e.slug))})}),(0,l.jsxs)("div",{className:"pt-6 md:pt-8",children:[(0,l.jsx)("h2",{className:"text-2xl",children:"Explore"}),(0,l.jsx)("div",{className:"".concat(r().agentList),children:!u&&L.map(e=>(0,l.jsx)(v.EY,{data:e,userProfile:n||null,isMobileWidth:V,editCard:!1,filesOptions:null!=F?F:[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:Y,setAgentChangeTriggered:W,modelOptions:(null==g?void 0:g.chat_model_options)||[],agentSlug:S||"",inputToolOptions:(null==T?void 0:T.input_tools)||{},outputModeOptions:(null==T?void 0:T.output_modes)||{}},e.slug))})]})]})})})]})]})}},32759:function(e,a,t){"use strict";t.d(a,{E:function(){return s}});var l=t(57437),n=t(2265),r=t(60610),o=t(94508);let s=n.forwardRef((e,a)=>{let{className:t,value:n,indicatorColor:s,...i}=e;return(0,l.jsx)(r.fC,{ref:a,className:(0,o.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...i,children:(0,l.jsx)(r.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(s),style:{transform:"translateX(-".concat(100-(n||0),"%)")}})})});s.displayName=r.fC.displayName},76818:function(e,a,t){"use strict";t.d(a,{g:function(){return o}});var l=t(57437),n=t(2265),r=t(94508);let o=n.forwardRef((e,a)=>{let{className:t,...n}=e;return(0,l.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...n})});o.displayName="Textarea"},14675:function(e){e.exports={titleBar:"agents_titleBar__FzYbY",agentPersonality:"agents_agentPersonality__o0Ysz",pageLayout:"agents_pageLayout__gR3S3",infoButton:"agents_infoButton__NqI7E",agentList:"agents_agentList__XVx4A"}},49807:function(e,a,t){"use strict";t.d(a,{a:function(){return s}});var l=t(2265),n=t(4992);let r=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M252,124a60.14,60.14,0,0,0-32-53.08,52,52,0,0,0-92-32.11A52,52,0,0,0,36,70.92a60,60,0,0,0,0,106.14,52,52,0,0,0,92,32.13,52,52,0,0,0,92-32.13A60.05,60.05,0,0,0,252,124ZM88,204a28,28,0,0,1-26.85-20.07c1,0,1.89.07,2.85.07h8a12,12,0,0,0,0-24H64A36,36,0,0,1,52,90.05a12,12,0,0,0,8-11.32V72a28,28,0,0,1,56,0v60.18a51.61,51.61,0,0,0-7.2-3.85,12,12,0,1,0-9.6,22A28,28,0,0,1,88,204Zm104-44h-8a12,12,0,0,0,0,24h8c1,0,1.9,0,2.85-.07a28,28,0,1,1-38-33.61,12,12,0,1,0-9.6-22,51.61,51.61,0,0,0-7.2,3.85V72a28,28,0,0,1,56,0v6.73a12,12,0,0,0,8,11.32,36,36,0,0,1-12,70Zm16-44a12,12,0,0,1-12,12,40,40,0,0,1-40-40V84a12,12,0,0,1,24,0v4a16,16,0,0,0,16,16A12,12,0,0,1,208,116ZM100,88a40,40,0,0,1-40,40,12,12,0,0,1,0-24A16,16,0,0,0,76,88V84a12,12,0,0,1,24,0Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M240,124a48,48,0,0,1-32,45.27h0V176a40,40,0,0,1-80,0,40,40,0,0,1-80,0v-6.73h0a48,48,0,0,1,0-90.54V72a40,40,0,0,1,80,0,40,40,0,0,1,80,0v6.73A48,48,0,0,1,240,124Z",opacity:"0.2"}),l.createElement("path",{d:"M248,124a56.11,56.11,0,0,0-32-50.61V72a48,48,0,0,0-88-26.49A48,48,0,0,0,40,72v1.39a56,56,0,0,0,0,101.2V176a48,48,0,0,0,88,26.49A48,48,0,0,0,216,176v-1.41A56.09,56.09,0,0,0,248,124ZM88,208a32,32,0,0,1-31.81-28.56A55.87,55.87,0,0,0,64,180h8a8,8,0,0,0,0-16H64A40,40,0,0,1,50.67,86.27,8,8,0,0,0,56,78.73V72a32,32,0,0,1,64,0v68.26A47.8,47.8,0,0,0,88,128a8,8,0,0,0,0,16,32,32,0,0,1,0,64Zm104-44h-8a8,8,0,0,0,0,16h8a55.87,55.87,0,0,0,7.81-.56A32,32,0,1,1,168,144a8,8,0,0,0,0-16,47.8,47.8,0,0,0-32,12.26V72a32,32,0,0,1,64,0v6.73a8,8,0,0,0,5.33,7.54A40,40,0,0,1,192,164Zm16-52a8,8,0,0,1-8,8h-4a36,36,0,0,1-36-36V80a8,8,0,0,1,16,0v4a20,20,0,0,0,20,20h4A8,8,0,0,1,208,112ZM60,120H56a8,8,0,0,1,0-16h4A20,20,0,0,0,80,84V80a8,8,0,0,1,16,0v4A36,36,0,0,1,60,120Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M212,76V72a44,44,0,0,0-74.86-31.31,3.93,3.93,0,0,0-1.14,2.8v88.72a4,4,0,0,0,6.2,3.33A47.67,47.67,0,0,1,167.68,128a8.18,8.18,0,0,1,8.31,7.58,8,8,0,0,1-8,8.42,32,32,0,0,0-32,32v33.88a4,4,0,0,0,1.49,3.12,47.92,47.92,0,0,0,74.21-17.16,4,4,0,0,0-4.49-5.56A68.06,68.06,0,0,1,192,192h-7.73a8.18,8.18,0,0,1-8.25-7.47,8,8,0,0,1,8-8.53h8a51.6,51.6,0,0,0,24-5.88v0A52,52,0,0,0,212,76Zm-12,36h-4a36,36,0,0,1-36-36V72a8,8,0,0,1,16,0v4a20,20,0,0,0,20,20h4a8,8,0,0,1,0,16ZM88,28A44.05,44.05,0,0,0,44,72v4a52,52,0,0,0-4,94.12h0A51.6,51.6,0,0,0,64,176h7.73A8.18,8.18,0,0,1,80,183.47,8,8,0,0,1,72,192H64a67.48,67.48,0,0,1-15.21-1.73,4,4,0,0,0-4.5,5.55A47.93,47.93,0,0,0,118.51,213a4,4,0,0,0,1.49-3.12V176a32,32,0,0,0-32-32,8,8,0,0,1-8-8.42A8.18,8.18,0,0,1,88.32,128a47.67,47.67,0,0,1,25.48,7.54,4,4,0,0,0,6.2-3.33V43.49a4,4,0,0,0-1.14-2.81A43.85,43.85,0,0,0,88,28Zm8,48a36,36,0,0,1-36,36H56a8,8,0,0,1,0-16h4A20,20,0,0,0,80,76V72a8,8,0,0,1,16,0Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M246,124a54.13,54.13,0,0,0-32-49.33V72a46,46,0,0,0-86-22.67A46,46,0,0,0,42,72v2.67a54,54,0,0,0,0,98.63V176a46,46,0,0,0,86,22.67A46,46,0,0,0,214,176v-2.7A54.07,54.07,0,0,0,246,124ZM88,210a34,34,0,0,1-34-32.94A53.67,53.67,0,0,0,64,178h8a6,6,0,0,0,0-12H64A42,42,0,0,1,50,84.39a6,6,0,0,0,4-5.66V72a34,34,0,0,1,68,0v73.05A45.89,45.89,0,0,0,88,130a6,6,0,0,0,0,12,34,34,0,0,1,0,68Zm104-44h-8a6,6,0,0,0,0,12h8a53.67,53.67,0,0,0,10-.94A34,34,0,1,1,168,142a6,6,0,0,0,0-12,45.89,45.89,0,0,0-34,15.05V72a34,34,0,0,1,68,0v6.73a6,6,0,0,0,4,5.66A42,42,0,0,1,192,166Zm14-54a6,6,0,0,1-6,6h-4a34,34,0,0,1-34-34V80a6,6,0,0,1,12,0v4a22,22,0,0,0,22,22h4A6,6,0,0,1,206,112ZM60,118H56a6,6,0,0,1,0-12h4A22,22,0,0,0,82,84V80a6,6,0,0,1,12,0v4A34,34,0,0,1,60,118Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M248,124a56.11,56.11,0,0,0-32-50.61V72a48,48,0,0,0-88-26.49A48,48,0,0,0,40,72v1.39a56,56,0,0,0,0,101.2V176a48,48,0,0,0,88,26.49A48,48,0,0,0,216,176v-1.41A56.09,56.09,0,0,0,248,124ZM88,208a32,32,0,0,1-31.81-28.56A55.87,55.87,0,0,0,64,180h8a8,8,0,0,0,0-16H64A40,40,0,0,1,50.67,86.27,8,8,0,0,0,56,78.73V72a32,32,0,0,1,64,0v68.26A47.8,47.8,0,0,0,88,128a8,8,0,0,0,0,16,32,32,0,0,1,0,64Zm104-44h-8a8,8,0,0,0,0,16h8a55.87,55.87,0,0,0,7.81-.56A32,32,0,1,1,168,144a8,8,0,0,0,0-16,47.8,47.8,0,0,0-32,12.26V72a32,32,0,0,1,64,0v6.73a8,8,0,0,0,5.33,7.54A40,40,0,0,1,192,164Zm16-52a8,8,0,0,1-8,8h-4a36,36,0,0,1-36-36V80a8,8,0,0,1,16,0v4a20,20,0,0,0,20,20h4A8,8,0,0,1,208,112ZM60,120H56a8,8,0,0,1,0-16h4A20,20,0,0,0,80,84V80a8,8,0,0,1,16,0v4A36,36,0,0,1,60,120Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M244,124a52.1,52.1,0,0,0-32-48V72a44,44,0,0,0-84-18.3A44,44,0,0,0,44,72v4a52,52,0,0,0,0,96v4a44,44,0,0,0,84,18.3A44,44,0,0,0,212,176v-4A52.07,52.07,0,0,0,244,124ZM88,212a36,36,0,0,1-36-36v-1.41A52.13,52.13,0,0,0,64,176h8a4,4,0,0,0,0-8H64A44,44,0,0,1,49.33,82.5,4,4,0,0,0,52,78.73V72a36,36,0,0,1,72,0v78.75A44,44,0,0,0,88,132a4,4,0,0,0,0,8,36,36,0,0,1,0,72Zm104-44h-8a4,4,0,0,0,0,8h8a52.13,52.13,0,0,0,12-1.41V176a36,36,0,1,1-36-36,4,4,0,0,0,0-8,44,44,0,0,0-36,18.75V72a36,36,0,0,1,72,0v6.73a4,4,0,0,0,2.67,3.77A44,44,0,0,1,192,168Zm12-56a4,4,0,0,1-4,4h-4a32,32,0,0,1-32-32V80a4,4,0,0,1,8,0v4a24,24,0,0,0,24,24h4A4,4,0,0,1,204,112ZM92,84a32,32,0,0,1-32,32H56a4,4,0,0,1,0-8h4A24,24,0,0,0,84,84V80a4,4,0,0,1,8,0Z"}))]]),o=l.forwardRef((e,a)=>l.createElement(n.Z,{ref:a,...e,weights:r}));o.displayName="BrainIcon";let s=o},19945:function(e,a,t){"use strict";t.d(a,{P:function(){return s}});var l=t(2265),n=t(4992);let r=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M219.71,117.38a12,12,0,0,0-7.25-8.52L161.28,88.39l10.59-70.61a12,12,0,0,0-20.64-10l-112,120a12,12,0,0,0,4.31,19.33l51.18,20.47L84.13,238.22a12,12,0,0,0,20.64,10l112-120A12,12,0,0,0,219.71,117.38ZM113.6,203.55l6.27-41.77a12,12,0,0,0-7.41-12.92L68.74,131.37,142.4,52.45l-6.27,41.77a12,12,0,0,0,7.41,12.92l43.72,17.49Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M96,240l16-80L48,136,160,16,144,96l64,24Z",opacity:"0.2"}),l.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M213.85,125.46l-112,120a8,8,0,0,1-13.69-7l14.66-73.33L45.19,143.49a8,8,0,0,1-3-13l112-120a8,8,0,0,1,13.69,7L153.18,90.9l57.63,21.61a8,8,0,0,1,3,12.95Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M213.84,118.63a6,6,0,0,0-3.73-4.25L150.88,92.17l15-75a6,6,0,0,0-10.27-5.27l-112,120a6,6,0,0,0,2.28,9.71l59.23,22.21-15,75a6,6,0,0,0,3.14,6.52A6.07,6.07,0,0,0,96,246a6,6,0,0,0,4.39-1.91l112-120A6,6,0,0,0,213.84,118.63ZM106,220.46l11.85-59.28a6,6,0,0,0-3.77-6.8l-55.6-20.85,91.46-98L138.12,94.82a6,6,0,0,0,3.77,6.8l55.6,20.85Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M211.89,119.09a4,4,0,0,0-2.49-2.84l-60.81-22.8,15.33-76.67a4,4,0,0,0-6.84-3.51l-112,120a4,4,0,0,0-1,3.64,4,4,0,0,0,2.49,2.84l60.81,22.8L92.08,239.22a4,4,0,0,0,6.84,3.51l112-120A4,4,0,0,0,211.89,119.09ZM102.68,227l13.24-66.2a4,4,0,0,0-2.52-4.53L55,134.36,153.32,29l-13.24,66.2a4,4,0,0,0,2.52,4.53L201,121.64Z"}))]]),o=l.forwardRef((e,a)=>l.createElement(n.Z,{ref:a,...e,weights:r}));o.displayName="LightningIcon";let s=o},60610:function(e,a,t){"use strict";t.d(a,{fC:function(){return j},z$:function(){return b}});var l=t(2265),n=t(73966),r=t(66840),o=t(57437),s="Progress",[i,d]=(0,n.b)(s),[c,u]=i(s),h=l.forwardRef((e,a)=>{var t,l,n,s;let{__scopeProgress:i,value:d=null,max:u,getValueLabel:h=f,...m}=e;(u||0===u)&&!x(u)&&console.error((t="".concat(u),l="Progress","Invalid prop `max` of value `".concat(t,"` supplied to `").concat(l,"`. Only numbers greater than 0 are valid max values. Defaulting to `").concat(100,"`.")));let p=x(u)?u:100;null===d||A(d,p)||console.error((n="".concat(d),s="Progress","Invalid prop `value` of value `".concat(n,"` supplied to `").concat(s,"`. The `value` prop must be:\n - a positive number\n - less than the value passed to `max` (or ").concat(100," if no `max` prop is set)\n - `null` or `undefined` if the progress is indeterminate.\n\nDefaulting to `null`.")));let j=A(d,p)?d:null,b=g(j)?h(j,p):void 0;return(0,o.jsx)(c,{scope:i,value:j,max:p,children:(0,o.jsx)(r.WV.div,{"aria-valuemax":p,"aria-valuemin":0,"aria-valuenow":g(j)?j:void 0,"aria-valuetext":b,role:"progressbar","data-state":v(j,p),"data-value":null!=j?j:void 0,"data-max":p,...m,ref:a})})});h.displayName=s;var m="ProgressIndicator",p=l.forwardRef((e,a)=>{var t;let{__scopeProgress:l,...n}=e,s=u(m,l);return(0,o.jsx)(r.WV.div,{"data-state":v(s.value,s.max),"data-value":null!==(t=s.value)&&void 0!==t?t:void 0,"data-max":s.max,...n,ref:a})});function f(e,a){return"".concat(Math.round(e/a*100),"%")}function v(e,a){return null==e?"indeterminate":e===a?"complete":"loading"}function g(e){return"number"==typeof e}function x(e){return g(e)&&!isNaN(e)&&e>0}function A(e,a){return g(e)&&!isNaN(e)&&e<=a&&e>=0}p.displayName=m;var j=h,b=p}},function(e){e.O(0,[1189,9853,2939,7200,8667,1327,4447,558,3595,2327,5427,2971,2117,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
|
@@ -1 +1 @@
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4371],{2743:function(e,t,a){Promise.resolve().then(a.bind(a,77837))},77837:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return eg}});var s=a(57437),n=a(17200),r=a(14308),o=a(66070),i=a(62869),l=a(53647),c=a(47107),d=a.n(c),u=a(13590),m=a(29501),h=a(91115),x=a(2265),f=a(15681),p=a(95186),g=a(26110),j=a(49027),y=a(76818),w=a(7436),v=a(30190),N=a.n(v),b=a(97673),k=a(99376),D=a(57054),S=a(86723),C=a(66142),_=a(96620),M=a(25888),I=a(45646),A=a(81627),T=a(82875),R=a(74646),z=a(64446),P=a(14353),L=a(2335),O=a(19945),W=a(56937),q=a(39535),E=a(77992),U=a(89534),V=a(65613),F=a(17814),G=a(60729),B=a(34124),Z=a(6512),J=a(37104);let Q=()=>window.fetch("/api/automation").then(e=>e.json()).catch(e=>console.log(e));function X(e){let t=e.split(" "),a=t[2],s=t[4];return"*"===a&&"*"===s?"Day":"*"!==s?"Week":"*"!==a?"Month":"Day"}function H(e){let t=e.split(" ");if("*"===t[3]&&"*"!==t[4])return Number(t[4])}function Y(e){let t=e.split(" "),a=t[1],s=t[0],n=Number(a)>=12?"PM":"AM",r=Number(a)>12?Number(a)-12:a;"00"===r&&(r="12");let o=s;return 10>Number(o)&&"00"!==o&&(o="0".concat(o)),"".concat(r,":").concat(o," ").concat(n)}function $(e){return String(e.split(" ")[2])}function K(e){return d().toString(e)}let ee=["Day","Week","Month"],et=Array.from({length:31},(e,t)=>String(t+1)),ea=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],es=[],en=["AM","PM"];for(var er=0;er<en.length;er++)for(var eo=0;eo<12;eo++)for(var ei=0;ei<60;ei+=15){let e=String(ei).padStart(2,"0"),t=0===eo?12:eo;es.push("".concat(t,":").concat(e," ").concat(en[er]))}let el=Date.now(),ec=[{subject:"Weekly Newsletter",scheduling_request:"/research Compile a message including: 1. A recap of news from last week 2. An at-home workout I can do before work 3. A quote to inspire me for the week ahead",schedule:"9AM every Monday",next:"Next run at 9AM on Monday",crontime:"0 9 * * 1",id:el,query_to_run:""},{subject:"Front Page of Hacker News",scheduling_request:"/research Summarize the top 5 posts from https://news.ycombinator.com/best and share them with me, including links",schedule:"9PM on every Wednesday",next:"Next run at 9PM on Wednesday",crontime:"0 21 * * 3",id:el+2,query_to_run:""},{subject:"Market Summary",scheduling_request:"/research Get the market summary for today and share it with me. Focus on tech stocks and the S&P 500.",schedule:"9AM on every weekday",next:"Next run at 9AM on Monday",crontime:"0 9 * * *",id:el+3,query_to_run:""},{subject:"Market Crash Notification",scheduling_request:"Notify me if the stock market fell by more than 5% today.",schedule:"5PM every evening",next:"Next run at 5PM today",crontime:"0 17 * * *",id:el+5,query_to_run:""},{subject:"Round-up of research papers about AI in healthcare",scheduling_request:"/research Summarize the top 3 research papers about AI in healthcare that were published in the last week. Include links to the full papers.",schedule:"9AM every Friday",next:"Next run at 9AM on Friday",crontime:"0 9 * * 5",id:el+4,query_to_run:""},{subject:"Daily Bedtime Story",scheduling_request:"Compose a bedtime story that a five-year-old might enjoy. It should not exceed five paragraphs. Appeal to the imagination, but weave in learnings.",schedule:"9PM every night",next:"Next run at 9PM today",crontime:"0 21 * * *",id:el+1,query_to_run:""}];function ed(e){let t=encodeURIComponent(e.subject),a=encodeURIComponent(e.scheduling_request),s=encodeURIComponent(e.crontime);return"".concat(window.location.origin,"/automations?subject=").concat(t,"&query=").concat(a,"&crontime=").concat(s)}function eu(e){let[t,a]=(0,x.useState)(!1),[n,r]=(0,x.useState)(null),[l,c]=(0,x.useState)(!1),d=e.automation,[u,m]=(0,x.useState)(""),[h,f]=(0,x.useState)("");return((0,x.useEffect)(()=>{let e=n||d;m(Y(e.crontime));let t=X(e.crontime);if("Day"===t)f("Daily");else if("Week"===t){let t=H(e.crontime);void 0===t?f("Weekly"):f("".concat(ea[t]))}else if("Month"===t){let t=$(e.crontime);f("Monthly on the ".concat(t))}},[n,d]),l)?null:(0,s.jsxs)(o.Zb,{className:"h-full shadow-md rounded-lg dark:bg-muted ".concat(N().automationCard),children:[(0,s.jsx)(o.Ol,{children:(0,s.jsxs)(o.ll,{className:"line-clamp-2 leading-normal flex justify-between",children:[(null==n?void 0:n.subject)||d.subject,(0,s.jsxs)(D.J2,{children:[(0,s.jsx)(D.xo,{asChild:!0,children:(0,s.jsx)(i.z,{className:"bg-background",variant:"ghost",children:(0,s.jsx)(S.F,{className:"h-4 w-4"})})}),(0,s.jsxs)(D.yk,{className:"w-auto grid gap-2 text-left bg-secondary",children:[!e.suggestedCard&&e.locationData&&(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Edit",createNew:!1,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:r,authenticatedData:e.authenticatedData,isCreating:t,automation:n||d,ipLocationData:e.locationData,setToastMessage:e.setToastMessage}),(0,s.jsx)(b.Z,{buttonTitle:"Share",includeIcon:!0,buttonClassName:"justify-start px-4 py-2 h-10",buttonVariant:"outline",title:"Share Automation",description:"Copy the link below and share it with your coworkers or friends.",url:ed(d),onShare:()=>{navigator.clipboard.writeText(ed(d))}}),!e.suggestedCard&&(0,s.jsxs)(i.z,{variant:"outline",className:"justify-start",onClick:()=>{!function(e,t){fetch("/api/automation/trigger?automation_id=".concat(e),{method:"POST"}).then(e=>{if(!e.ok)throw Error("Network response was not ok");return e}).then(e=>{t("Automation triggered. Check your inbox in a few minutes!")}).catch(e=>{t("Sorry, something went wrong. Try again later.")})}(d.id.toString(),e.setToastMessage)},children:[(0,s.jsx)(C.s,{className:"h-4 w-4 mr-2"}),"Run Now"]}),(0,s.jsxs)(i.z,{variant:"destructive",className:"justify-start",onClick:()=>{if(e.suggestedCard){c(!0);return}!function(e,t){fetch("/api/automation?automation_id=".concat(e),{method:"DELETE"}).then(e=>e.json()).then(e=>{t(!0)})}(d.id.toString(),c)},children:[(0,s.jsx)(_.r,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})}),(0,s.jsx)(o.aY,{className:"text-secondary-foreground break-all",children:(null==n?void 0:n.scheduling_request)||d.scheduling_request}),(0,s.jsxs)(o.eW,{className:"flex flex-col items-start md:flex-row md:justify-between md:items-center gap-2",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center rounded-lg p-1.5 border-blue-200 border dark:border-blue-500",children:[(0,s.jsx)(M.T,{className:"h-4 w-4 mr-2 text-blue-700 dark:text-blue-300"}),(0,s.jsx)("div",{className:"text-s text-blue-700 dark:text-blue-300",children:u})]}),(0,s.jsxs)("div",{className:"flex items-center rounded-lg p-1.5 border-purple-200 border dark:border-purple-500",children:[(0,s.jsx)(I.u,{className:"h-4 w-4 mr-2 text-purple-700 dark:text-purple-300"}),(0,s.jsx)("div",{className:"text-s text-purple-700 dark:text-purple-300",children:h})]})]}),e.suggestedCard&&e.setNewAutomationData&&(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Add",createNew:!0,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:t,automation:d,ipLocationData:e.locationData,setToastMessage:e.setToastMessage})]})]})}function em(e){let t=(0,k.useSearchParams)(),[a,n]=(0,x.useState)(!0),r=t.get("subject"),o=t.get("query"),i=t.get("crontime");if(!r||!o||!i)return null;let l={id:0,subject:decodeURIComponent(r),scheduling_request:decodeURIComponent(o),query_to_run:"",schedule:K(decodeURIComponent(i)),crontime:decodeURIComponent(i),next:""};return a?(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Shared",createNew:!0,setIsCreating:n,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:a,automation:l,ipLocationData:e.locationData,setToastMessage:e.setToastMessage}):null}let eh=h.z.object({subject:h.z.optional(h.z.string()),everyBlah:h.z.string({required_error:"Every is required"}),dayOfWeek:h.z.optional(h.z.number()),dayOfMonth:h.z.optional(h.z.string()),timeRecurrence:h.z.string({required_error:"Time Recurrence is required"}),schedulingRequest:h.z.string({required_error:"Query to Run is required"})});function ex(e){let t=e.automation,a=(0,m.cI)({resolver:(0,u.F)(eh),defaultValues:{subject:null==t?void 0:t.subject,everyBlah:(null==t?void 0:t.crontime)?X(t.crontime):"Day",dayOfWeek:(null==t?void 0:t.crontime)?H(t.crontime):void 0,timeRecurrence:(null==t?void 0:t.crontime)?Y(t.crontime):"12:00 PM",dayOfMonth:(null==t?void 0:t.crontime)?$(t.crontime):"1",schedulingRequest:null==t?void 0:t.scheduling_request}});return(0,s.jsx)(ef,{authenticatedData:e.authenticatedData,locationData:e.locationData||null,form:a,onSubmit:a=>{let s=function(e,t,a,s){let n="",r=t.split(":")[1].split(" ")[0],o=t.split(":")[1].split(" ")[1],i=Number(t.split(":")[0]),l="PM"===o&&i<12?String(i+12):i;switch(e){case"Day":n="".concat(r," ").concat(l," * * *");break;case"Week":n="".concat(r," ").concat(l," * * ").concat(void 0!==a?7===a?0:a:"*");break;case"Month":n="".concat(r," ").concat(l," ").concat(s," * *")}return n}(a.everyBlah,a.timeRecurrence,a.dayOfWeek,a.dayOfMonth),n="/api/automation?";n+="q=".concat(encodeURIComponent(a.schedulingRequest)),(null==t?void 0:t.id)&&!e.createNew&&(n+="&automation_id=".concat(encodeURIComponent(t.id))),a.subject&&(n+="&subject=".concat(encodeURIComponent(a.subject))),n+="&crontime=".concat(encodeURIComponent(s)),e.locationData&&e.locationData.city&&(n+="&city=".concat(encodeURIComponent(e.locationData.city))),e.locationData&&e.locationData.region&&(n+="®ion=".concat(encodeURIComponent(e.locationData.region))),e.locationData&&e.locationData.country&&(n+="&country=".concat(encodeURIComponent(e.locationData.country))),e.locationData&&e.locationData.timezone&&(n+="&timezone=".concat(encodeURIComponent(e.locationData.timezone))),fetch(n,{method:e.createNew?"POST":"PUT"}).then(e=>e.json()).then(t=>{e.setIsEditing(!1),e.setUpdatedAutomationData({id:t.id,subject:t.subject||"",query_to_run:t.query_to_run,scheduling_request:t.scheduling_request,schedule:K(t.crontime),crontime:t.crontime,next:t.next})}).catch(t=>{console.error("Error saving automation:",t),e.setIsEditing(!1),e.setToastMessage("Sorry, something went wrong. Try again or contact team@khoj.dev.")})},create:e.createNew,isLoggedIn:e.isLoggedIn,setShowLoginPrompt:e.setShowLoginPrompt})}function ef(e){var t,a;let[n,r]=(0,x.useState)(!1),{errors:o}=e.form.formState,c=["Make a picture of","Generate a summary of","Create a newsletter of","Notify me when"];return(0,s.jsx)(f.l0,{...e.form,children:(0,s.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),r(!0)}),className:"space-y-6",children:[(0,s.jsx)(f.xJ,{className:"space-y-1",children:(0,s.jsxs)(f.pf,{children:["Emails will be sent to this address. Timezone and location data will be used to schedule automations.",e.locationData&&(t=e.locationData,a=e.authenticatedData,(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[a?(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(R.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),a.email]}):null,t&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),t?"".concat(t.city,", ").concat(t.country):"Unknown"]}),t&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),t?"".concat(t.timezone):"Unknown"]})]}))]})}),!e.create&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"subject",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"space-y-1",children:[(0,s.jsx)(f.lX,{children:"Subject"}),(0,s.jsx)(f.pf,{children:"This is the subject of the email you will receive."}),(0,s.jsx)(f.NI,{children:(0,s.jsx)(p.I,{placeholder:"Digest of Healthcare AI trends",...a})}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.subject)||void 0===t?void 0:t.message})]})}}),(0,s.jsx)(f.Wi,{control:e.form.control,name:"everyBlah",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.lX,{children:"Frequency"}),(0,s.jsx)(f.pf,{children:"How often should this automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(A.W,{className:"h-4 w-4 mr-2 inline"}),"Every"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:ee.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.everyBlah)||void 0===t?void 0:t.message})]})}}),"Week"===e.form.watch("everyBlah")&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"dayOfWeek",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.pf,{children:"Every week, on which day should this automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:e=>a.onChange(Number(e)),defaultValue:String(a.value),children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(T.n,{className:"h-4 w-4 mr-2 inline"}),"On"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:ea.map((e,t)=>(0,s.jsx)(l.Ql,{value:String(t),children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.dayOfWeek)||void 0===t?void 0:t.message})]})}}),"Month"===e.form.watch("everyBlah")&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"dayOfMonth",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.pf,{children:"Every month, on which day should the automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(T.n,{className:"h-4 w-4 mr-2 inline"}),"On the"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:et.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.dayOfMonth)||void 0===t?void 0:t.message})]})}}),("Day"===e.form.watch("everyBlah")||"Week"==e.form.watch("everyBlah")||"Month"==e.form.watch("everyBlah"))&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"timeRecurrence",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.lX,{children:"Time"}),(0,s.jsx)(f.pf,{children:"On the days this automation runs, at what time should it run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(I.u,{className:"h-4 w-4 mr-2 inline"}),"At"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:es.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.timeRecurrence)||void 0===t?void 0:t.message})]})}}),(0,s.jsx)(f.Wi,{control:e.form.control,name:"schedulingRequest",render:t=>{var a;let{field:n}=t;return(0,s.jsxs)(f.xJ,{className:"space-y-1",children:[(0,s.jsx)(f.lX,{children:"Instructions"}),(0,s.jsx)(f.pf,{children:"What do you want Khoj to do?"}),e.create&&(0,s.jsx)("div",{children:c.map(e=>{var t;return t=n.onChange,(0,s.jsxs)(i.z,{className:"text-xs bg-slate-50 dark:bg-slate-950 h-auto p-1.5 m-1 rounded-full",variant:"ghost",onClick:a=>{a.preventDefault(),t({target:{value:e}},a)},children:[e,"..."]},e)})}),(0,s.jsx)(f.NI,{children:(0,s.jsx)(y.g,{placeholder:"Create a summary of the latest news about AI in healthcare.",value:n.value,onChange:n.onChange})}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(a=o.schedulingRequest)||void 0===a?void 0:a.message})]})}}),(0,s.jsx)("fieldset",{disabled:n,children:e.isLoggedIn?n?(0,s.jsx)(i.z,{type:"submit",disabled:!0,children:"Saving..."}):(0,s.jsx)(i.z,{type:"submit",children:"Save"}):(0,s.jsx)(i.z,{onClick:t=>{t.preventDefault(),e.setShowLoginPrompt(!0)},variant:"default",children:"Login to Save"})})]})})}function ep(e){return e.isMobileWidth?(0,s.jsxs)(F.dy,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,s.jsx)(F.Qz,{asChild:!0,children:(0,s.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,s.jsxs)(F.sc,{className:"p-2",children:[(0,s.jsx)(F.iI,{children:"Automation"}),(0,s.jsx)(ex,{createNew:e.createNew,automation:e.automation,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData,setToastMessage:e.setToastMessage})]})]}):(0,s.jsxs)(g.Vq,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,s.jsx)(g.hg,{asChild:!0,children:(0,s.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,s.jsxs)(g.cZ,{className:"max-h-[98vh] overflow-y-auto",children:[(0,s.jsx)(j.$N,{children:"Automation"}),(0,s.jsx)(ex,{automation:e.automation,createNew:e.createNew,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData,setToastMessage:e.setToastMessage})]})]})}function eg(){let{data:e,error:t,isLoading:a}=(0,W.GW)(),{data:o,error:l,isLoading:c}=(0,n.ZP)(e?"automations":null,Q,{revalidateOnFocus:!1}),[d,u]=(0,x.useState)(!1),[m,h]=(0,x.useState)(null),[f,p]=(0,x.useState)([]),[g,j]=(0,x.useState)([]),[y,v]=(0,x.useState)(!1),b=(0,w.IC)(),{locationData:k,locationDataError:D,locationDataLoading:S}=(0,w.k6)(),[C,_]=(0,x.useState)(""),{toast:M}=(0,E.pm)();return((0,x.useEffect)(()=>{m&&(p([...f,m]),h(null))},[m,f]),(0,x.useEffect)(()=>{let e=o?o.concat(f):f;e&&j(ec.filter(t=>void 0===e.find(e=>t.subject===e.subject)))},[o,f]),(0,x.useEffect)(()=>{C&&(M({title:"Automation",description:C,action:(0,s.jsx)(U.gD,{altText:"Dismiss",children:"Ok"}),variant:C.includes("Sorry")?"destructive":"default"}),_(""))},[C]),l)?(0,s.jsx)(r.l,{message:"Oops, something went wrong. Please refresh the page."}):(0,s.jsxs)(G.Hn,{children:[(0,s.jsx)(B.S,{conversationId:""}),(0,s.jsxs)(G.kV,{children:[(0,s.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,s.jsx)(G.vP,{className:"-ml-1"}),(0,s.jsx)(Z.Z,{orientation:"vertical",className:"mr-2 h-4"}),b?(0,s.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,s.jsx)(J.VO,{className:"h-auto w-16"})}):(0,s.jsx)("h2",{className:"text-lg",children:"Automations"})]}),(0,s.jsx)("main",{className:"w-full mx-auto",children:(0,s.jsx)("div",{className:"grid w-full mx-auto",children:(0,s.jsxs)("div",{className:"".concat(N().pageLayout," w-full"),children:[(0,s.jsxs)("div",{className:"pt-6 md:pt-8 grid gap-1 md:flex md:justify-between",children:[(0,s.jsx)("h1",{className:"text-3xl flex items-center",children:"Automations"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[e?(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(R.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),e.email]}):null,k&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),k?"".concat(k.city,", ").concat(k.country):"Unknown"]}),k&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),k?"".concat(k.timezone):"Unknown"]})]})]}),y&&(0,s.jsx)(q.Z,{onOpenChange:v,isMobileWidth:b}),(0,s.jsx)(V.bZ,{className:"bg-secondary border-none my-4",children:(0,s.jsxs)(V.X,{children:[(0,s.jsx)(O.P,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,s.jsx)("span",{className:"font-bold",children:"How it works"})," Automations help you structure your time by automating tasks you do regularly. Build your own, or try out our presets. Get results straight to your inbox."]})}),(0,s.jsx)("div",{className:"flex justify-between items-center py-4",children:e?(0,s.jsx)(ep,{isMobileWidth:b,callToAction:"Create Automation",createNew:!0,setIsCreating:u,setShowLoginPrompt:v,setNewAutomationData:h,authenticatedData:e,isCreating:d,ipLocationData:k,setToastMessage:_}):(0,s.jsxs)(i.z,{className:"shadow-sm",onClick:()=>v(!0),variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),"Create Automation"]})}),(0,s.jsx)(x.Suspense,{children:(0,s.jsx)(em,{isMobileWidth:b,authenticatedData:e||null,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setNewAutomationData:h,setToastMessage:_})}),c&&(0,s.jsx)(r.l,{message:"booting up your automations"}),(0,s.jsxs)("div",{className:"".concat(N().automationsLayout),children:[e&&o&&o.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,authenticatedData:e,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setToastMessage:_},t.id)),e&&f.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,authenticatedData:e,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setToastMessage:_},t.id))]}),(0,s.jsx)("h3",{className:"text-xl py-4",children:"Explore"}),(0,s.jsx)("div",{className:"".concat(N().automationsLayout),children:g.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,setNewAutomationData:h,authenticatedData:e||null,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,suggestedCard:!0,setToastMessage:_},t.id))})]})})})]})]})}},97673:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var s=a(57437),n=a(26110),r=a(62869),o=a(95186),i=a(26815),l=a(33321);function c(e){var t;return(0,s.jsxs)(n.Vq,{children:[(0,s.jsx)(n.hg,{asChild:!0,onClick:e.onShare,children:(0,s.jsxs)(r.z,{size:"sm",className:"".concat(e.buttonClassName||"px-3"),variant:null!==(t=e.buttonVariant)&&void 0!==t?t:"default",children:[e.includeIcon&&(0,s.jsx)(l.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,s.jsxs)(n.cZ,{children:[(0,s.jsxs)(n.fK,{children:[(0,s.jsx)(n.$N,{children:e.title}),(0,s.jsx)(n.Be,{children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,s.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,s.jsx)(o.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,s.jsx)(r.z,{type:"submit",size:"sm",className:"px-3",onClick:()=>(function(e){let t=navigator.clipboard;t&&t.writeText(e)})(e.url),children:(0,s.jsx)("span",{children:"Copy"})})]})]})]})}},65613:function(e,t,a){"use strict";a.d(t,{X:function(){return c},bZ:function(){return l}});var s=a(57437),n=a(2265),r=a(90535),o=a(94508);let i=(0,r.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),l=n.forwardRef((e,t)=>{let{className:a,variant:n,...r}=e;return(0,s.jsx)("div",{ref:t,role:"alert",className:(0,o.cn)(i({variant:n}),a),...r})});l.displayName="Alert",n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("h5",{ref:t,className:(0,o.cn)("mb-1 font-medium leading-none tracking-tight",a),...n})}).displayName="AlertTitle";let c=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,o.cn)("text-sm [&_p]:leading-relaxed",a),...n})});c.displayName="AlertDescription"},15681:function(e,t,a){"use strict";a.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return g},xJ:function(){return x},zG:function(){return j}});var s=a(57437),n=a(2265),r=a(37053),o=a(29501),i=a(94508),l=a(26815);let c=o.RV,d=n.createContext({}),u=e=>{let{...t}=e;return(0,s.jsx)(d.Provider,{value:{name:t.name},children:(0,s.jsx)(o.Qr,{...t})})},m=()=>{let e=n.useContext(d),t=n.useContext(h),{getFieldState:a,formState:s}=(0,o.Gc)(),r=a(e.name,s);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...r}},h=n.createContext({}),x=n.forwardRef((e,t)=>{let{className:a,...r}=e,o=n.useId();return(0,s.jsx)(h.Provider,{value:{id:o},children:(0,s.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",a),...r})})});x.displayName="FormItem";let f=n.forwardRef((e,t)=>{let{className:a,...n}=e,{error:r,formItemId:o}=m();return(0,s.jsx)(l._,{ref:t,className:(0,i.cn)(r&&"text-destructive",a),htmlFor:o,...n})});f.displayName="FormLabel";let p=n.forwardRef((e,t)=>{let{...a}=e,{error:n,formItemId:o,formDescriptionId:i,formMessageId:l}=m();return(0,s.jsx)(r.g7,{ref:t,id:o,"aria-describedby":n?"".concat(i," ").concat(l):"".concat(i),"aria-invalid":!!n,...a})});p.displayName="FormControl";let g=n.forwardRef((e,t)=>{let{className:a,...n}=e,{formDescriptionId:r}=m();return(0,s.jsx)("p",{ref:t,id:r,className:(0,i.cn)("text-sm text-muted-foreground",a),...n})});g.displayName="FormDescription";let j=n.forwardRef((e,t)=>{let{className:a,children:n,...r}=e,{error:o,formMessageId:l}=m(),c=o?String(null==o?void 0:o.message):n;return c?(0,s.jsx)("p",{ref:t,id:l,className:(0,i.cn)("text-sm font-medium text-destructive",a),...r,children:c}):null});j.displayName="FormMessage"},26815:function(e,t,a){"use strict";a.d(t,{_:function(){return c}});var s=a(57437),n=a(2265),r=a(6394),o=a(90535),i=a(94508);let l=(0,o.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.f,{ref:t,className:(0,i.cn)(l(),a),...n})});c.displayName=r.f.displayName},53647:function(e,t,a){"use strict";a.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var s=a(57437),n=a(2265),r=a(56873),o=a(40875),i=a(22135),l=a(30401),c=a(94508);let d=r.fC;r.ZA;let u=r.B4,m=n.forwardRef((e,t)=>{let{className:a,children:n,...i}=e;return(0,s.jsxs)(r.xz,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...i,children:[n,(0,s.jsx)(r.JO,{asChild:!0,children:(0,s.jsx)(o.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let h=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...n,children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let x=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...n,children:(0,s.jsx)(o.Z,{className:"h-4 w-4"})})});x.displayName=r.$G.displayName;let f=n.forwardRef((e,t)=>{let{className:a,children:n,position:o="popper",...i}=e;return(0,s.jsx)(r.h_,{children:(0,s.jsxs)(r.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===o&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:o,...i,children:[(0,s.jsx)(h,{}),(0,s.jsx)(r.l_,{className:(0,c.cn)("p-1","popper"===o&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),(0,s.jsx)(x,{})]})})});f.displayName=r.VY.displayName,n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...n})}).displayName=r.__.displayName;let p=n.forwardRef((e,t)=>{let{className:a,children:n,...o}=e;return(0,s.jsxs)(r.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...o,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(r.wU,{children:(0,s.jsx)(l.Z,{className:"h-4 w-4"})})}),(0,s.jsx)(r.eT,{children:n})]})});p.displayName=r.ck.displayName,n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",a),...n})}).displayName=r.Z0.displayName},76818:function(e,t,a){"use strict";a.d(t,{g:function(){return o}});var s=a(57437),n=a(2265),r=a(94508);let o=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...n})});o.displayName="Textarea"},89534:function(e,t,a){"use strict";a.d(t,{FN:function(){return m},Mi:function(){return f},VW:function(){return c},_i:function(){return d},gD:function(){return h},lj:function(){return p},sA:function(){return x}});var s=a(57437),n=a(2265),r=a(41915),o=a(90535),i=a(32489),l=a(94508);let c=r.zt,d=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.l_,{ref:t,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",a),...n})});d.displayName=r.l_.displayName;let u=(0,o.j)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),m=n.forwardRef((e,t)=>{let{className:a,variant:n,...o}=e;return(0,s.jsx)(r.fC,{ref:t,className:(0,l.cn)(u({variant:n}),a),...o})});m.displayName=r.fC.displayName;let h=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.aU,{ref:t,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",a),...n})});h.displayName=r.aU.displayName;let x=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.x8,{ref:t,className:(0,l.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",a),"toast-close":"",...n,children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=r.x8.displayName;let f=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold",a),...n})});f.displayName=r.Dx.displayName;let p=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",a),...n})});p.displayName=r.dk.displayName},77992:function(e,t,a){"use strict";a.d(t,{pm:function(){return m}});var s=a(2265);let n=0,r=new Map,o=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},i=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:a}=t;return a?o(a):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===a||void 0===a?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},l=[],c={toasts:[]};function d(e){c=i(c,e),l.forEach(e=>{e(c)})}function u(e){let{...t}=e,a=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),s=()=>d({type:"DISMISS_TOAST",toastId:a});return d({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||s()}}}),{id:a,dismiss:s,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function m(){let[e,t]=s.useState(c);return s.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},30190:function(e){e.exports={automationsLayout:"automations_automationsLayout__Atoh_",automationCard:"automations_automationCard__BKidA",pageLayout:"automations_pageLayout__OaoYA"}}},function(e){e.O(0,[4173,2939,7200,8667,1327,4447,558,1915,9537,2327,2971,2117,1744],function(){return e(e.s=2743)}),_N_E=e.O()}]);
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4371],{2743:function(e,t,a){Promise.resolve().then(a.bind(a,77837))},77837:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return eg}});var s=a(57437),n=a(17200),r=a(14308),o=a(66070),i=a(62869),l=a(53647),c=a(47107),d=a.n(c),u=a(13590),m=a(29501),h=a(91115),x=a(2265),f=a(15681),p=a(95186),g=a(26110),j=a(49027),y=a(76818),w=a(7436),v=a(30190),N=a.n(v),b=a(97673),k=a(99376),D=a(57054),S=a(86723),C=a(66142),_=a(96620),M=a(25888),I=a(45646),A=a(81627),T=a(82875),R=a(74646),z=a(64446),P=a(14353),L=a(2335),O=a(19945),W=a(56937),q=a(39535),E=a(77992),U=a(89534),V=a(65613),F=a(17814),G=a(60729),B=a(34124),Z=a(6512),J=a(37104);let Q=()=>window.fetch("/api/automation").then(e=>e.json()).catch(e=>console.log(e));function X(e){let t=e.split(" "),a=t[2],s=t[4];return"*"===a&&"*"===s?"Day":"*"!==s?"Week":"*"!==a?"Month":"Day"}function H(e){let t=e.split(" ");if("*"===t[3]&&"*"!==t[4])return Number(t[4])}function Y(e){let t=e.split(" "),a=t[1],s=t[0],n=Number(a)>=12?"PM":"AM",r=Number(a)>12?Number(a)-12:a;"00"===r&&(r="12");let o=s;return 10>Number(o)&&"00"!==o&&(o="0".concat(o)),"".concat(r,":").concat(o," ").concat(n)}function $(e){return String(e.split(" ")[2])}function K(e){return d().toString(e)}let ee=["Day","Week","Month"],et=Array.from({length:31},(e,t)=>String(t+1)),ea=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],es=[],en=["AM","PM"];for(var er=0;er<en.length;er++)for(var eo=0;eo<12;eo++)for(var ei=0;ei<60;ei+=15){let e=String(ei).padStart(2,"0"),t=0===eo?12:eo;es.push("".concat(t,":").concat(e," ").concat(en[er]))}let el=Date.now(),ec=[{subject:"Weekly Newsletter",scheduling_request:"/research Compile a message including: 1. A recap of news from last week 2. An at-home workout I can do before work 3. A quote to inspire me for the week ahead",schedule:"9AM every Monday",next:"Next run at 9AM on Monday",crontime:"0 9 * * 1",id:el,query_to_run:""},{subject:"Front Page of Hacker News",scheduling_request:"/research Summarize the top 5 posts from https://news.ycombinator.com/best and share them with me, including links",schedule:"9PM on every Wednesday",next:"Next run at 9PM on Wednesday",crontime:"0 21 * * 3",id:el+2,query_to_run:""},{subject:"Market Summary",scheduling_request:"/research Get the market summary for today and share it with me. Focus on tech stocks and the S&P 500.",schedule:"9AM on every weekday",next:"Next run at 9AM on Monday",crontime:"0 9 * * *",id:el+3,query_to_run:""},{subject:"Market Crash Notification",scheduling_request:"Notify me if the stock market fell by more than 5% today.",schedule:"5PM every evening",next:"Next run at 5PM today",crontime:"0 17 * * *",id:el+5,query_to_run:""},{subject:"Round-up of research papers about AI in healthcare",scheduling_request:"/research Summarize the top 3 research papers about AI in healthcare that were published in the last week. Include links to the full papers.",schedule:"9AM every Friday",next:"Next run at 9AM on Friday",crontime:"0 9 * * 5",id:el+4,query_to_run:""},{subject:"Daily Bedtime Story",scheduling_request:"Compose a bedtime story that a five-year-old might enjoy. It should not exceed five paragraphs. Appeal to the imagination, but weave in learnings.",schedule:"9PM every night",next:"Next run at 9PM today",crontime:"0 21 * * *",id:el+1,query_to_run:""}];function ed(e){let t=encodeURIComponent(e.subject),a=encodeURIComponent(e.scheduling_request),s=encodeURIComponent(e.crontime);return"".concat(window.location.origin,"/automations?subject=").concat(t,"&query=").concat(a,"&crontime=").concat(s)}function eu(e){let[t,a]=(0,x.useState)(!1),[n,r]=(0,x.useState)(null),[l,c]=(0,x.useState)(!1),d=e.automation,[u,m]=(0,x.useState)(""),[h,f]=(0,x.useState)("");return((0,x.useEffect)(()=>{let e=n||d;m(Y(e.crontime));let t=X(e.crontime);if("Day"===t)f("Daily");else if("Week"===t){let t=H(e.crontime);void 0===t?f("Weekly"):f("".concat(ea[t]))}else if("Month"===t){let t=$(e.crontime);f("Monthly on the ".concat(t))}},[n,d]),l)?null:(0,s.jsxs)(o.Zb,{className:"h-full shadow-md rounded-lg dark:bg-muted ".concat(N().automationCard),children:[(0,s.jsx)(o.Ol,{children:(0,s.jsxs)(o.ll,{className:"line-clamp-2 leading-normal flex justify-between",children:[(null==n?void 0:n.subject)||d.subject,(0,s.jsxs)(D.J2,{children:[(0,s.jsx)(D.xo,{asChild:!0,children:(0,s.jsx)(i.z,{className:"bg-background",variant:"ghost",children:(0,s.jsx)(S.F,{className:"h-4 w-4"})})}),(0,s.jsxs)(D.yk,{className:"w-auto grid gap-2 text-left bg-secondary",children:[!e.suggestedCard&&e.locationData&&(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Edit",createNew:!1,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:r,authenticatedData:e.authenticatedData,isCreating:t,automation:n||d,ipLocationData:e.locationData,setToastMessage:e.setToastMessage}),(0,s.jsx)(b.Z,{buttonTitle:"Share",includeIcon:!0,buttonClassName:"justify-start px-4 py-2 h-10",buttonVariant:"outline",title:"Share Automation",description:"Copy the link below and share it with your coworkers or friends.",url:ed(d),onShare:()=>{navigator.clipboard.writeText(ed(d))}}),!e.suggestedCard&&(0,s.jsxs)(i.z,{variant:"outline",className:"justify-start",onClick:()=>{!function(e,t){fetch("/api/automation/trigger?automation_id=".concat(e),{method:"POST"}).then(e=>{if(!e.ok)throw Error("Network response was not ok");return e}).then(e=>{t("Automation triggered. Check your inbox in a few minutes!")}).catch(e=>{t("Sorry, something went wrong. Try again later.")})}(d.id.toString(),e.setToastMessage)},children:[(0,s.jsx)(C.s,{className:"h-4 w-4 mr-2"}),"Run Now"]}),(0,s.jsxs)(i.z,{variant:"destructive",className:"justify-start",onClick:()=>{if(e.suggestedCard){c(!0);return}!function(e,t){fetch("/api/automation?automation_id=".concat(e),{method:"DELETE"}).then(e=>e.json()).then(e=>{t(!0)})}(d.id.toString(),c)},children:[(0,s.jsx)(_.r,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})}),(0,s.jsx)(o.aY,{className:"text-secondary-foreground break-all",children:(null==n?void 0:n.scheduling_request)||d.scheduling_request}),(0,s.jsxs)(o.eW,{className:"flex flex-col items-start md:flex-row md:justify-between md:items-center gap-2",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center rounded-lg p-1.5 border-blue-200 border dark:border-blue-500",children:[(0,s.jsx)(M.T,{className:"h-4 w-4 mr-2 text-blue-700 dark:text-blue-300"}),(0,s.jsx)("div",{className:"text-s text-blue-700 dark:text-blue-300",children:u})]}),(0,s.jsxs)("div",{className:"flex items-center rounded-lg p-1.5 border-purple-200 border dark:border-purple-500",children:[(0,s.jsx)(I.u,{className:"h-4 w-4 mr-2 text-purple-700 dark:text-purple-300"}),(0,s.jsx)("div",{className:"text-s text-purple-700 dark:text-purple-300",children:h})]})]}),e.suggestedCard&&e.setNewAutomationData&&(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Add",createNew:!0,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:t,automation:d,ipLocationData:e.locationData,setToastMessage:e.setToastMessage})]})]})}function em(e){let t=(0,k.useSearchParams)(),[a,n]=(0,x.useState)(!0),r=t.get("subject"),o=t.get("query"),i=t.get("crontime");if(!r||!o||!i)return null;let l={id:0,subject:decodeURIComponent(r),scheduling_request:decodeURIComponent(o),query_to_run:"",schedule:K(decodeURIComponent(i)),crontime:decodeURIComponent(i),next:""};return a?(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Shared",createNew:!0,setIsCreating:n,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:a,automation:l,ipLocationData:e.locationData,setToastMessage:e.setToastMessage}):null}let eh=h.z.object({subject:h.z.optional(h.z.string()),everyBlah:h.z.string({required_error:"Every is required"}),dayOfWeek:h.z.optional(h.z.number()),dayOfMonth:h.z.optional(h.z.string()),timeRecurrence:h.z.string({required_error:"Time Recurrence is required"}),schedulingRequest:h.z.string({required_error:"Query to Run is required"})});function ex(e){let t=e.automation,a=(0,m.cI)({resolver:(0,u.F)(eh),defaultValues:{subject:null==t?void 0:t.subject,everyBlah:(null==t?void 0:t.crontime)?X(t.crontime):"Day",dayOfWeek:(null==t?void 0:t.crontime)?H(t.crontime):void 0,timeRecurrence:(null==t?void 0:t.crontime)?Y(t.crontime):"12:00 PM",dayOfMonth:(null==t?void 0:t.crontime)?$(t.crontime):"1",schedulingRequest:null==t?void 0:t.scheduling_request}});return(0,s.jsx)(ef,{authenticatedData:e.authenticatedData,locationData:e.locationData||null,form:a,onSubmit:a=>{let s=function(e,t,a,s){let n="",r=t.split(":")[1].split(" ")[0],o=t.split(":")[1].split(" ")[1],i=Number(t.split(":")[0]),l="PM"===o&&i<12?String(i+12):i;switch(e){case"Day":n="".concat(r," ").concat(l," * * *");break;case"Week":n="".concat(r," ").concat(l," * * ").concat(void 0!==a?7===a?0:a:"*");break;case"Month":n="".concat(r," ").concat(l," ").concat(s," * *")}return n}(a.everyBlah,a.timeRecurrence,a.dayOfWeek,a.dayOfMonth),n="/api/automation?";n+="q=".concat(encodeURIComponent(a.schedulingRequest)),(null==t?void 0:t.id)&&!e.createNew&&(n+="&automation_id=".concat(encodeURIComponent(t.id))),a.subject&&(n+="&subject=".concat(encodeURIComponent(a.subject))),n+="&crontime=".concat(encodeURIComponent(s)),e.locationData&&e.locationData.city&&(n+="&city=".concat(encodeURIComponent(e.locationData.city))),e.locationData&&e.locationData.region&&(n+="®ion=".concat(encodeURIComponent(e.locationData.region))),e.locationData&&e.locationData.country&&(n+="&country=".concat(encodeURIComponent(e.locationData.country))),e.locationData&&e.locationData.timezone&&(n+="&timezone=".concat(encodeURIComponent(e.locationData.timezone))),fetch(n,{method:e.createNew?"POST":"PUT"}).then(e=>e.json()).then(t=>{e.setIsEditing(!1),e.setUpdatedAutomationData({id:t.id,subject:t.subject||"",query_to_run:t.query_to_run,scheduling_request:t.scheduling_request,schedule:K(t.crontime),crontime:t.crontime,next:t.next})}).catch(t=>{console.error("Error saving automation:",t),e.setIsEditing(!1),e.setToastMessage("Sorry, something went wrong. Try again or contact team@khoj.dev.")})},create:e.createNew,isLoggedIn:e.isLoggedIn,setShowLoginPrompt:e.setShowLoginPrompt})}function ef(e){var t,a;let[n,r]=(0,x.useState)(!1),{errors:o}=e.form.formState,c=["Make a picture of","Generate a summary of","Create a newsletter of","Notify me when"];return(0,s.jsx)(f.l0,{...e.form,children:(0,s.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),r(!0)}),className:"space-y-6",children:[(0,s.jsx)(f.xJ,{className:"space-y-1",children:(0,s.jsxs)(f.pf,{children:["Emails will be sent to this address. Timezone and location data will be used to schedule automations.",e.locationData&&(t=e.locationData,a=e.authenticatedData,(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[a?(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(R.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),a.email]}):null,t&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),t?"".concat(t.city,", ").concat(t.country):"Unknown"]}),t&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),t?"".concat(t.timezone):"Unknown"]})]}))]})}),!e.create&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"subject",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"space-y-1",children:[(0,s.jsx)(f.lX,{children:"Subject"}),(0,s.jsx)(f.pf,{children:"This is the subject of the email you will receive."}),(0,s.jsx)(f.NI,{children:(0,s.jsx)(p.I,{placeholder:"Digest of Healthcare AI trends",...a})}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.subject)||void 0===t?void 0:t.message})]})}}),(0,s.jsx)(f.Wi,{control:e.form.control,name:"everyBlah",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.lX,{children:"Frequency"}),(0,s.jsx)(f.pf,{children:"How often should this automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(A.W,{className:"h-4 w-4 mr-2 inline"}),"Every"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:ee.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.everyBlah)||void 0===t?void 0:t.message})]})}}),"Week"===e.form.watch("everyBlah")&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"dayOfWeek",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.pf,{children:"Every week, on which day should this automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:e=>a.onChange(Number(e)),defaultValue:String(a.value),children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(T.n,{className:"h-4 w-4 mr-2 inline"}),"On"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:ea.map((e,t)=>(0,s.jsx)(l.Ql,{value:String(t),children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.dayOfWeek)||void 0===t?void 0:t.message})]})}}),"Month"===e.form.watch("everyBlah")&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"dayOfMonth",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.pf,{children:"Every month, on which day should the automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(T.n,{className:"h-4 w-4 mr-2 inline"}),"On the"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:et.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.dayOfMonth)||void 0===t?void 0:t.message})]})}}),("Day"===e.form.watch("everyBlah")||"Week"==e.form.watch("everyBlah")||"Month"==e.form.watch("everyBlah"))&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"timeRecurrence",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.lX,{children:"Time"}),(0,s.jsx)(f.pf,{children:"On the days this automation runs, at what time should it run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(I.u,{className:"h-4 w-4 mr-2 inline"}),"At"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:es.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.timeRecurrence)||void 0===t?void 0:t.message})]})}}),(0,s.jsx)(f.Wi,{control:e.form.control,name:"schedulingRequest",render:t=>{var a;let{field:n}=t;return(0,s.jsxs)(f.xJ,{className:"space-y-1",children:[(0,s.jsx)(f.lX,{children:"Instructions"}),(0,s.jsx)(f.pf,{children:"What do you want Khoj to do?"}),e.create&&(0,s.jsx)("div",{children:c.map(e=>{var t;return t=n.onChange,(0,s.jsxs)(i.z,{className:"text-xs bg-slate-50 dark:bg-slate-950 h-auto p-1.5 m-1 rounded-full",variant:"ghost",onClick:a=>{a.preventDefault(),t({target:{value:e}},a)},children:[e,"..."]},e)})}),(0,s.jsx)(f.NI,{children:(0,s.jsx)(y.g,{placeholder:"Create a summary of the latest news about AI in healthcare.",value:n.value,onChange:n.onChange})}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(a=o.schedulingRequest)||void 0===a?void 0:a.message})]})}}),(0,s.jsx)("fieldset",{disabled:n,children:e.isLoggedIn?n?(0,s.jsx)(i.z,{type:"submit",disabled:!0,children:"Saving..."}):(0,s.jsx)(i.z,{type:"submit",children:"Save"}):(0,s.jsx)(i.z,{onClick:t=>{t.preventDefault(),e.setShowLoginPrompt(!0)},variant:"default",children:"Login to Save"})})]})})}function ep(e){return e.isMobileWidth?(0,s.jsxs)(F.dy,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,s.jsx)(F.Qz,{asChild:!0,children:(0,s.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,s.jsxs)(F.sc,{className:"p-2",children:[(0,s.jsx)(F.iI,{children:"Automation"}),(0,s.jsx)(ex,{createNew:e.createNew,automation:e.automation,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData,setToastMessage:e.setToastMessage})]})]}):(0,s.jsxs)(g.Vq,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,s.jsx)(g.hg,{asChild:!0,children:(0,s.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,s.jsxs)(g.cZ,{className:"max-h-[98vh] overflow-y-auto",children:[(0,s.jsx)(j.$N,{children:"Automation"}),(0,s.jsx)(ex,{automation:e.automation,createNew:e.createNew,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData,setToastMessage:e.setToastMessage})]})]})}function eg(){let{data:e,error:t,isLoading:a}=(0,W.GW)(),{data:o,error:l,isLoading:c}=(0,n.ZP)(e?"automations":null,Q,{revalidateOnFocus:!1}),[d,u]=(0,x.useState)(!1),[m,h]=(0,x.useState)(null),[f,p]=(0,x.useState)([]),[g,j]=(0,x.useState)([]),[y,v]=(0,x.useState)(!1),b=(0,w.IC)(),{locationData:k,locationDataError:D,locationDataLoading:S}=(0,w.k6)(),[C,_]=(0,x.useState)(""),{toast:M}=(0,E.pm)();return((0,x.useEffect)(()=>{m&&(p([...f,m]),h(null))},[m,f]),(0,x.useEffect)(()=>{let e=o?o.concat(f):f;e&&j(ec.filter(t=>void 0===e.find(e=>t.subject===e.subject)))},[o,f]),(0,x.useEffect)(()=>{C&&(M({title:"Automation",description:C,action:(0,s.jsx)(U.gD,{altText:"Dismiss",children:"Ok"}),variant:C.includes("Sorry")?"destructive":"default"}),_(""))},[C]),l)?(0,s.jsx)(r.l,{message:"Oops, something went wrong. Please refresh the page."}):(0,s.jsxs)(G.Hn,{children:[(0,s.jsx)(B.S,{conversationId:""}),(0,s.jsxs)(G.kV,{children:[(0,s.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,s.jsx)(G.vP,{className:"-ml-1"}),(0,s.jsx)(Z.Z,{orientation:"vertical",className:"mr-2 h-4"}),b?(0,s.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,s.jsx)(J.VO,{className:"h-auto w-16"})}):(0,s.jsx)("h2",{className:"text-lg",children:"Automations"})]}),(0,s.jsx)("main",{className:"w-full mx-auto",children:(0,s.jsx)("div",{className:"grid w-full mx-auto",children:(0,s.jsxs)("div",{className:"".concat(N().pageLayout," w-full"),children:[(0,s.jsxs)("div",{className:"pt-6 md:pt-8 grid gap-1 md:flex md:justify-between",children:[(0,s.jsx)("h1",{className:"text-3xl flex items-center",children:"Automations"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[e?(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(R.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),e.email]}):null,k&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),k?"".concat(k.city,", ").concat(k.country):"Unknown"]}),k&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),k?"".concat(k.timezone):"Unknown"]})]})]}),y&&(0,s.jsx)(q.Z,{onOpenChange:v,isMobileWidth:b}),(0,s.jsx)(V.bZ,{className:"bg-secondary border-none my-4",children:(0,s.jsxs)(V.X,{children:[(0,s.jsx)(O.P,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,s.jsx)("span",{className:"font-bold",children:"How it works"})," Automations help you structure your time by automating tasks you do regularly. Build your own, or try out our presets. Get results straight to your inbox."]})}),(0,s.jsx)("div",{className:"flex justify-between items-center py-4",children:e?(0,s.jsx)(ep,{isMobileWidth:b,callToAction:"Create Automation",createNew:!0,setIsCreating:u,setShowLoginPrompt:v,setNewAutomationData:h,authenticatedData:e,isCreating:d,ipLocationData:k,setToastMessage:_}):(0,s.jsxs)(i.z,{className:"shadow-sm",onClick:()=>v(!0),variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),"Create Automation"]})}),(0,s.jsx)(x.Suspense,{children:(0,s.jsx)(em,{isMobileWidth:b,authenticatedData:e||null,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setNewAutomationData:h,setToastMessage:_})}),c&&(0,s.jsx)(r.l,{message:"booting up your automations"}),(0,s.jsxs)("div",{className:"".concat(N().automationsLayout),children:[e&&o&&o.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,authenticatedData:e,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setToastMessage:_},t.id)),e&&f.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,authenticatedData:e,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setToastMessage:_},t.id))]}),(0,s.jsx)("h3",{className:"text-xl py-4",children:"Explore"}),(0,s.jsx)("div",{className:"".concat(N().automationsLayout),children:g.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,setNewAutomationData:h,authenticatedData:e||null,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,suggestedCard:!0,setToastMessage:_},t.id))})]})})})]})]})}},97673:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var s=a(57437),n=a(26110),r=a(62869),o=a(95186),i=a(26815),l=a(33321);function c(e){var t;return(0,s.jsxs)(n.Vq,{children:[(0,s.jsx)(n.hg,{asChild:!0,onClick:e.onShare,children:(0,s.jsxs)(r.z,{size:"sm",className:"".concat(e.buttonClassName||"px-3"),variant:null!==(t=e.buttonVariant)&&void 0!==t?t:"default",children:[e.includeIcon&&(0,s.jsx)(l.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,s.jsxs)(n.cZ,{children:[(0,s.jsxs)(n.fK,{children:[(0,s.jsx)(n.$N,{children:e.title}),(0,s.jsx)(n.Be,{children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,s.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,s.jsx)(o.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,s.jsx)(r.z,{type:"submit",size:"sm",className:"px-3",onClick:()=>(function(e){let t=navigator.clipboard;t&&t.writeText(e)})(e.url),children:(0,s.jsx)("span",{children:"Copy"})})]})]})]})}},65613:function(e,t,a){"use strict";a.d(t,{X:function(){return c},bZ:function(){return l}});var s=a(57437),n=a(2265),r=a(90535),o=a(94508);let i=(0,r.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),l=n.forwardRef((e,t)=>{let{className:a,variant:n,...r}=e;return(0,s.jsx)("div",{ref:t,role:"alert",className:(0,o.cn)(i({variant:n}),a),...r})});l.displayName="Alert",n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("h5",{ref:t,className:(0,o.cn)("mb-1 font-medium leading-none tracking-tight",a),...n})}).displayName="AlertTitle";let c=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,o.cn)("text-sm [&_p]:leading-relaxed",a),...n})});c.displayName="AlertDescription"},15681:function(e,t,a){"use strict";a.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return g},xJ:function(){return x},zG:function(){return j}});var s=a(57437),n=a(2265),r=a(37053),o=a(29501),i=a(94508),l=a(26815);let c=o.RV,d=n.createContext({}),u=e=>{let{...t}=e;return(0,s.jsx)(d.Provider,{value:{name:t.name},children:(0,s.jsx)(o.Qr,{...t})})},m=()=>{let e=n.useContext(d),t=n.useContext(h),{getFieldState:a,formState:s}=(0,o.Gc)(),r=a(e.name,s);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...r}},h=n.createContext({}),x=n.forwardRef((e,t)=>{let{className:a,...r}=e,o=n.useId();return(0,s.jsx)(h.Provider,{value:{id:o},children:(0,s.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",a),...r})})});x.displayName="FormItem";let f=n.forwardRef((e,t)=>{let{className:a,...n}=e,{error:r,formItemId:o}=m();return(0,s.jsx)(l._,{ref:t,className:(0,i.cn)(r&&"text-destructive",a),htmlFor:o,...n})});f.displayName="FormLabel";let p=n.forwardRef((e,t)=>{let{...a}=e,{error:n,formItemId:o,formDescriptionId:i,formMessageId:l}=m();return(0,s.jsx)(r.g7,{ref:t,id:o,"aria-describedby":n?"".concat(i," ").concat(l):"".concat(i),"aria-invalid":!!n,...a})});p.displayName="FormControl";let g=n.forwardRef((e,t)=>{let{className:a,...n}=e,{formDescriptionId:r}=m();return(0,s.jsx)("p",{ref:t,id:r,className:(0,i.cn)("text-sm text-muted-foreground",a),...n})});g.displayName="FormDescription";let j=n.forwardRef((e,t)=>{let{className:a,children:n,...r}=e,{error:o,formMessageId:l}=m(),c=o?String(null==o?void 0:o.message):n;return c?(0,s.jsx)("p",{ref:t,id:l,className:(0,i.cn)("text-sm font-medium text-destructive",a),...r,children:c}):null});j.displayName="FormMessage"},26815:function(e,t,a){"use strict";a.d(t,{_:function(){return c}});var s=a(57437),n=a(2265),r=a(6394),o=a(90535),i=a(94508);let l=(0,o.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.f,{ref:t,className:(0,i.cn)(l(),a),...n})});c.displayName=r.f.displayName},53647:function(e,t,a){"use strict";a.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var s=a(57437),n=a(2265),r=a(56873),o=a(40875),i=a(22135),l=a(30401),c=a(94508);let d=r.fC;r.ZA;let u=r.B4,m=n.forwardRef((e,t)=>{let{className:a,children:n,...i}=e;return(0,s.jsxs)(r.xz,{ref:t,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...i,children:[n,(0,s.jsx)(r.JO,{asChild:!0,children:(0,s.jsx)(o.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let h=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...n,children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let x=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...n,children:(0,s.jsx)(o.Z,{className:"h-4 w-4"})})});x.displayName=r.$G.displayName;let f=n.forwardRef((e,t)=>{let{className:a,children:n,position:o="popper",...i}=e;return(0,s.jsx)(r.h_,{children:(0,s.jsxs)(r.VY,{ref:t,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===o&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:o,...i,children:[(0,s.jsx)(h,{}),(0,s.jsx)(r.l_,{className:(0,c.cn)("p-1","popper"===o&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),(0,s.jsx)(x,{})]})})});f.displayName=r.VY.displayName,n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...n})}).displayName=r.__.displayName;let p=n.forwardRef((e,t)=>{let{className:a,children:n,...o}=e;return(0,s.jsxs)(r.ck,{ref:t,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...o,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(r.wU,{children:(0,s.jsx)(l.Z,{className:"h-4 w-4"})})}),(0,s.jsx)(r.eT,{children:n})]})});p.displayName=r.ck.displayName,n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",a),...n})}).displayName=r.Z0.displayName},76818:function(e,t,a){"use strict";a.d(t,{g:function(){return o}});var s=a(57437),n=a(2265),r=a(94508);let o=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...n})});o.displayName="Textarea"},89534:function(e,t,a){"use strict";a.d(t,{FN:function(){return m},Mi:function(){return f},VW:function(){return c},_i:function(){return d},gD:function(){return h},lj:function(){return p},sA:function(){return x}});var s=a(57437),n=a(2265),r=a(41915),o=a(90535),i=a(32489),l=a(94508);let c=r.zt,d=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.l_,{ref:t,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",a),...n})});d.displayName=r.l_.displayName;let u=(0,o.j)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),m=n.forwardRef((e,t)=>{let{className:a,variant:n,...o}=e;return(0,s.jsx)(r.fC,{ref:t,className:(0,l.cn)(u({variant:n}),a),...o})});m.displayName=r.fC.displayName;let h=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.aU,{ref:t,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",a),...n})});h.displayName=r.aU.displayName;let x=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.x8,{ref:t,className:(0,l.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",a),"toast-close":"",...n,children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=r.x8.displayName;let f=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold",a),...n})});f.displayName=r.Dx.displayName;let p=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",a),...n})});p.displayName=r.dk.displayName},77992:function(e,t,a){"use strict";a.d(t,{pm:function(){return m}});var s=a(2265);let n=0,r=new Map,o=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},i=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:a}=t;return a?o(a):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===a||void 0===a?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},l=[],c={toasts:[]};function d(e){c=i(c,e),l.forEach(e=>{e(c)})}function u(e){let{...t}=e,a=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),s=()=>d({type:"DISMISS_TOAST",toastId:a});return d({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||s()}}}),{id:a,dismiss:s,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function m(){let[e,t]=s.useState(c);return s.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},30190:function(e){e.exports={automationsLayout:"automations_automationsLayout__Atoh_",automationCard:"automations_automationCard__BKidA",pageLayout:"automations_pageLayout__OaoYA"}}},function(e){e.O(0,[9853,1189,2939,7200,8667,1327,4447,558,1915,9537,2327,2971,2117,1744],function(){return e(e.s=2743)}),_N_E=e.O()}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3317,7138,244,8459],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{39929:function(e,t,s){Promise.resolve().then(s.bind(s,42780))},42780:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return ed}});var a=s(57437),n=s(63136),l=s.n(n),i=s(2265),o=s(2208),r=s(27127),d=s(99376),c=s(14308),u=s(59199);s(2446);var h=s(7436),m=s(5477),x=s(56937),f=s(55287),p=s(60729),g=s(34124),j=s(6512),v=s(37104),N=s(62869),y=s(91890),b=s(68772),w=s(79603),_=s(23594),S=s(34153),C=s(43551),O=s(32046),k=s(5223),I=s(76818),M=s(75256),T=s(24148),E=s(94508),z=s(23518),B=s(57054),L=s(16605);let R=L.fC,F=L.xz,A=i.forwardRef((e,t)=>{let{className:s,align:n="center",sideOffset:l=4,...i}=e;return(0,a.jsx)(L.VY,{ref:t,align:n,sideOffset:l,className:(0,E.cn)("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...i})});A.displayName=L.VY.displayName;var P=s(93022);function W(e){var t,s;let{...n}=e,[l,o]=i.useState(!1),[r,d]=(0,i.useState)(void 0),[c,u]=(0,i.useState)(void 0),{data:m,error:f,isLoading:p}=(0,x.h2)(!0),[g,j]=(0,i.useState)([]),v=(0,h.IC)();return((0,i.useEffect)(()=>{if(!p&&m){if(j(m.chat_model_options),n.initialModel)u(m.chat_model_options.find(e=>e.name===n.initialModel));else{let e=m.chat_model_options.find(e=>e.id===m.selected_chat_model_config);!e&&m.chat_model_options.length>0?u(m.chat_model_options[0]):u(e)}}},[m,n.initialModel,p]),(0,i.useEffect)(()=>{c&&m&&n.onSelect(c)},[c,m,n.onSelect]),p)?(0,a.jsx)(P.O,{className:"w-full h-10"}):f?(0,a.jsx)("div",{className:"text-sm text-error",children:f.message}):(0,a.jsx)("div",{className:"grid gap-2 w-[250px]",children:(0,a.jsxs)(B.J2,{open:l,onOpenChange:o,...n,children:[(0,a.jsx)(B.xo,{asChild:!0,children:(0,a.jsxs)(N.z,{variant:"outline",role:"combobox","aria-expanded":l,"aria-label":"Select a model",className:"w-full justify-between text-left",disabled:null!==(s=n.disabled)&&void 0!==s&&s,children:[(0,a.jsx)("p",{className:"truncate",children:c?null===(t=c.name)||void 0===t?void 0:t.substring(0,20):"Select a model..."}),(0,a.jsx)(M.K,{className:"opacity-50"})]})}),(0,a.jsx)(B.yk,{align:"end",className:"w-[250px] p-0",children:v?(0,a.jsx)("div",{children:(0,a.jsx)(z.mY,{loop:!0,children:(0,a.jsxs)(z.e8,{className:"h-[var(--cmdk-list-height)]",children:[(0,a.jsx)(z.sZ,{placeholder:"Search Models..."}),(0,a.jsx)(z.rb,{children:"No Models found."}),(0,a.jsx)(z.fu,{heading:"Models",children:g&&g.length>0&&g.map(e=>(0,a.jsx)(Z,{model:e,isSelected:(null==c?void 0:c.id)===e.id,onPeek:e=>d(e),onSelect:()=>{u(e),o(!1)},isActive:n.isActive},e.id))},"models")]})})}):(0,a.jsxs)(R,{children:[(0,a.jsx)(A,{side:"left",align:"start",forceMount:!0,className:"min-h-[280px]",children:(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)("h4",{className:"font-medium leading-none",children:null==r?void 0:r.name}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:null==r?void 0:r.description}),(null==r?void 0:r.strengths)?(0,a.jsxs)("div",{className:"mt-4 grid gap-2",children:[(0,a.jsx)("h5",{className:"text-sm font-medium leading-none",children:"Strengths"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:r.strengths})]}):null]})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(F,{}),(0,a.jsx)(z.mY,{loop:!0,children:(0,a.jsxs)(z.e8,{className:"h-[var(--cmdk-list-height)]",children:[(0,a.jsx)(z.sZ,{placeholder:"Search Models..."}),(0,a.jsx)(z.rb,{children:"No Models found."}),(0,a.jsx)(z.fu,{heading:"Models",children:g&&g.length>0&&g.map(e=>(0,a.jsx)(Z,{model:e,isSelected:(null==c?void 0:c.id)===e.id,onPeek:e=>d(e),onSelect:()=>{u(e),o(!1)},isActive:n.isActive},e.id))},"models")]})})]})]})})]})})}function Z(e){let{model:t,isSelected:s,onSelect:n,onPeek:l,isActive:o}=e,r=i.useRef(null);return(0,h.Iy)(r,e=>{e.forEach(e=>{var s;"attributes"===e.type&&"aria-selected"===e.attributeName&&(null===(s=r.current)||void 0===s?void 0:s.getAttribute("aria-selected"))==="true"&&l(t)})}),(0,a.jsxs)(z.di,{onSelect:n,ref:r,className:"data-[selected=true]:bg-muted data-[selected=true]:text-secondary-foreground",disabled:!o&&"free"!==t.tier,children:[t.name," ","standard"===t.tier&&(0,a.jsx)("span",{className:"text-green-500 ml-2",children:"(Futurist)"}),(0,a.jsx)(T.J,{className:(0,E.cn)("ml-auto",s?"opacity-100":"opacity-0")})]},t.id)}var J=s(17200),D=s(2602),K=s(69304),V=s(42225),U=s(26815),H=s(9270),Q=s(30401);let G=i.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(H.fC,{ref:t,className:(0,E.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-secondary-foreground ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-gray-500 data-[state=checked]:text-primary-foreground",s),...n,children:(0,a.jsx)(H.z$,{className:(0,E.cn)("flex items-center justify-center text-current"),children:(0,a.jsx)(Q.Z,{className:"h-4 w-4"})})})});G.displayName=H.fC.displayName;var q=s(81103),Y=s(61312),$=s(26110),X=s(53647),ee=s(84671),et=s(95186),es=s(27648),ea=s(14368);let en=e=>fetch(e).then(e=>e.json());function el(e){let{...t}=e;return t.isMobileWidth?(0,a.jsx)(K.yo,{open:t.isOpen,onOpenChange:t.onOpenChange,children:(0,a.jsx)(K.ue,{className:"w-[300px] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",children:(0,a.jsx)(eo,{...t})})}):(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(eo,{...t})})}function ei(e){let t=(0,V.BI)(),s=ee.xF,[n,l]=(0,i.useState)(!1),[o,r]=(0,i.useState)(),[d,c]=(0,i.useState)(),[u,h]=(0,i.useState)(),[m,x]=(0,i.useState)(!1),[f,p]=(0,i.useState)(),[g,j]=(0,i.useState)(!1),[v,y]=(0,i.useState)();return(0,i.useEffect)(()=>{o&&d&&u?j(!0):j(!1)},[o,d,u]),(0,a.jsxs)($.Vq,{children:[(0,a.jsx)($.hg,{asChild:!0,children:(0,a.jsx)(N.z,{className:"w-full",variant:"secondary",children:"Create Agent"})}),(0,a.jsxs)($.cZ,{children:[(0,a.jsxs)($.fK,{children:[m&&f?(0,a.jsxs)($.$N,{children:["Created ",o]}):(0,a.jsx)($.$N,{children:"Create a New Agent"}),(0,a.jsx)($.GG,{}),(0,a.jsx)($.Be,{children:"If these settings have been helpful, create a dedicated agent you can re-use across conversations."})]}),(0,a.jsx)("div",{className:"py-4",children:m&&f?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 py-8",children:[(0,a.jsx)(ea.E.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:260,damping:20},children:(0,a.jsx)(b.f,{className:"w-16 h-16 text-green-500",weight:"fill"})}),(0,a.jsx)(ea.E.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2},className:"text-center text-lg font-medium text-accent-foreground",children:"Created successfully!"}),(0,a.jsx)(ea.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.4},children:(0,a.jsx)(es.default,{href:"/agents?agent=".concat(f),children:(0,a.jsx)(N.z,{variant:"secondary",className:"mt-2",children:"Manage Agent"})})})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(U._,{htmlFor:"agent_name",children:"Name"}),(0,a.jsx)(et.I,{id:"agent_name",className:"w-full p-2 border mt-4 border-slate-500 rounded-lg",disabled:n,value:o,onChange:e=>r(e.target.value)})]}),(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)(X.Ph,{onValueChange:h,defaultValue:u,children:[(0,a.jsx)(X.i4,{className:"w-full dark:bg-muted",disabled:n,children:(0,a.jsx)(X.ki,{placeholder:"Color"})}),(0,a.jsx)(X.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:s.map(e=>(0,a.jsx)(X.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(w.C,{className:"w-6 h-6 mr-2 ".concat((0,ee.oz)(e)),weight:"fill"}),e]})},e))})]})}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)(X.Ph,{onValueChange:c,defaultValue:d,children:[(0,a.jsx)(X.i4,{className:"w-full dark:bg-muted",disabled:n,children:(0,a.jsx)(X.ki,{placeholder:"Icon"})}),(0,a.jsx)(X.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:t.map(e=>(0,a.jsx)(X.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,V.TI)(e,null!=u?u:"gray","w-6","h-6"),e]})},e))})]})})]})]})}),(0,a.jsxs)($.cN,{children:[v&&(0,a.jsx)("div",{className:"text-red-500 text-sm",children:v}),!m&&(0,a.jsxs)(N.z,{type:"submit",onClick:()=>void(!n&&(l(!0),fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:o,icon:d,color:u,persona:e.customPrompt,chat_model:e.selectedModel,input_tools:e.inputTools,output_modes:e.outputModes,privacy_level:"private"})}).then(e=>e.json()).then(e=>{if(console.log("Success:",e),"detail"in e){y("Error creating agent: ".concat(e.detail)),l(!1);return}x(!0),p(e.slug),l(!1)}).catch(e=>{console.error("Error:",e),y("Error creating agent: ".concat(e)),l(!1)}))),disabled:n||!g,children:[n?(0,a.jsx)(_.U,{className:"animate-spin"}):(0,a.jsx)(S.R,{}),"Create"]}),(0,a.jsx)($.GG,{})]})]})]})}function eo(e){var t,s,n,l,o;let{...r}=e,[d,c]=(0,i.useState)(!1),{data:u,error:h}=(0,J.ZP)("/api/agents/options",en),{data:m,isLoading:g,error:j}=(0,J.ZP)("/api/agents/conversation?conversation_id=".concat(r.conversationId),en),{data:v,error:y,isLoading:b}=(0,x.GW)(),[w,S]=(0,i.useState)(),[M,T]=(0,i.useState)(),[E,z]=(0,i.useState)(),[L,R]=(0,i.useState)(),[F,A]=(0,i.useState)(!1),[P,Z]=(0,i.useState)(!m||(null==m?void 0:null===(t=m.slug)||void 0===t?void 0:t.toLowerCase())==="khoj"),[K,H]=(0,i.useState)(),[Q,$]=(0,i.useState)(),[X,ee]=(0,i.useState)(!1),et=null!==(s=null==v?void 0:v.is_active)&&void 0!==s&&s;function es(){if(m){var e,t;z(m.input_tools),H(m.input_tools),(void 0===m.input_tools||0===m.input_tools.length)&&H((null==u?void 0:u.input_tools)?Object.keys(u.input_tools):[]),R(m.output_modes),$(m.output_modes),(void 0===m.output_modes||0===m.output_modes.length)&&$((null==u?void 0:u.output_modes)?Object.keys(u.output_modes):[]),((null===(e=m.name)||void 0===e?void 0:e.toLowerCase())==="khoj"||!0===m.is_hidden)&&c(!0),(null===(t=m.slug)||void 0===t?void 0:t.toLowerCase())==="khoj"?(T(void 0),S(void 0),Z(!0)):(Z(!1),S(m.persona),T(m.chat_model))}}function ea(e,t){return t.includes(e)?t.filter(t=>t!==e):[...t,e]}return(0,i.useEffect)(()=>{es(),A(!1)},[m]),(0,i.useEffect)(()=>{var e,t;if(!m||g)return;let s=!!M&&M!==m.chat_model,a=!!w&&w!==m.persona,n=JSON.stringify((null==E?void 0:E.sort())||[])!==JSON.stringify(null===(e=m.input_tools)||void 0===e?void 0:e.sort()),l=JSON.stringify((null==L?void 0:L.sort())||[])!==JSON.stringify(null===(t=m.output_modes)||void 0===t?void 0:t.sort());A(s||a||n||l)},[M,w,E,L,m,g]),(0,a.jsxs)(p.DD,{collapsible:"none",className:"ml-auto opacity-30 rounded-lg p-2 transition-all transform duration-300 ease-in-out\n ".concat(r.isOpen?"translate-x-0 opacity-100 w-[300px] relative":"translate-x-full opacity-100 w-0 p-0 m-0","\n "),variant:"floating",children:[(0,a.jsxs)(p.TZ,{children:[(0,a.jsx)(p.$l,{children:m&&!d?(0,a.jsx)("div",{className:"flex items-center relative text-sm",children:(0,a.jsxs)("a",{className:"text-lg font-bold flex flex-row items-center",href:"/agents?agent=".concat(m.slug),children:[(0,V.TI)(m.icon,m.color),m.name]})}):(0,a.jsx)("div",{className:"flex items-center relative text-sm justify-between",children:(0,a.jsx)("p",{children:"Chat Options"})})}),(0,a.jsx)(p.Hz,{className:"border-b last:border-none",children:(0,a.jsx)(p.Ks,{className:"gap-0",children:(0,a.jsx)(p.w3,{className:"p-0 m-0",children:m&&m.has_files?(0,a.jsx)(p.LO,{className:"list-none",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 rounded-full",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:(0,a.jsx)(C.J,{})}),(0,a.jsx)("div",{className:"text-muted-foreground text-sm",children:"Using custom knowledge base"})]})},"agent_knowledge"):null})})},"knowledge"),(0,a.jsx)(p.Hz,{children:(0,a.jsxs)(p.Ks,{children:[(0,a.jsx)(p.nO,{children:"Instructions"}),(0,a.jsx)(p.w3,{className:"p-0 m-0",children:(0,a.jsx)(p.LO,{className:"list-none",children:(0,a.jsx)(I.g,{className:"w-full h-32 resize-none hover:resize-y",value:w||"",onChange:e=>{S(e.target.value)},readOnly:!d,disabled:!d})})})]})},"instructions"),!g&&m&&(0,a.jsx)(p.Hz,{children:(0,a.jsxs)(p.Ks,{children:[(0,a.jsxs)(p.nO,{children:["Model",!et&&(0,a.jsx)("a",{href:"/settings",className:"hover:font-bold text-accent-foreground m-2 bg-accent bg-opacity-10 p-1 rounded-lg",children:"Upgrade"})]}),(0,a.jsx)(p.w3,{className:"p-0 m-0",children:(0,a.jsx)(p.LO,{className:"list-none",children:(0,a.jsx)(W,{disabled:!d,onSelect:e=>{T(e.name)},initialModel:P?void 0:null==m?void 0:m.chat_model,isActive:r.isActive})},"model")})]})},"model"),(0,a.jsx)(B.J2,{defaultOpen:!1,children:(0,a.jsxs)(p.Hz,{children:[(0,a.jsx)(p.nO,{asChild:!0,children:(0,a.jsxs)(B.xo,{children:["Tools",(0,a.jsx)(O._,{className:"ml-auto transition-transform group-data-[state=open]/collapsible:rotate-180"})]})}),(0,a.jsx)(B.yk,{children:(0,a.jsx)(p.Ks,{children:(0,a.jsxs)(p.w3,{className:"p-1 m-0",children:[Object.entries(null!==(n=null==u?void 0:u.input_tools)&&void 0!==n?n:{}).map(e=>{let[t,s]=e;return(0,a.jsx)(p.LO,{className:"list-none",children:(0,a.jsxs)(q.u,{children:[(0,a.jsx)(q.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(U._,{htmlFor:t,className:"flex items-center gap-2 text-accent-foreground p-1 cursor-pointer",children:[(0,V.vH)(t),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:t})]}),(0,a.jsx)(G,{id:t,className:"".concat(d?"cursor-pointer":""),checked:(null!=K?K:[]).includes(t),onCheckedChange:()=>{let e=ea(t,null!=K?K:[]);z(e),H(e)},disabled:!d,children:t})]})},t),(0,a.jsx)(Y._v,{sideOffset:5,side:"left",align:"start",className:"text-sm bg-background text-foreground shadow-sm border border-slate-500 border-opacity-20 p-2 rounded-lg",children:s})]})},t)}),Object.entries(null!==(l=null==u?void 0:u.output_modes)&&void 0!==l?l:{}).map(e=>{let[t,s]=e;return(0,a.jsx)(p.LO,{className:"list-none",children:(0,a.jsxs)(q.u,{children:[(0,a.jsx)(q.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(U._,{htmlFor:t,className:"flex items-center gap-2 p-1 rounded-lg cursor-pointer",children:[(0,V.vH)(t),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:t})]}),(0,a.jsx)(G,{id:t,className:"".concat(d?"cursor-pointer":""),checked:(null!=Q?Q:[]).includes(t),onCheckedChange:()=>{let e=ea(t,null!=Q?Q:[]);R(e),$(e)},disabled:!d,children:t})]})},t),(0,a.jsx)(Y._v,{sideOffset:5,side:"left",align:"start",className:"text-sm bg-background text-foreground shadow-sm border border-slate-500 border-opacity-20 p-2 rounded-lg",children:s})]})},t)})]})})})]})}),(0,a.jsx)(p.Hz,{children:(0,a.jsxs)(p.Ks,{children:[(0,a.jsx)(p.nO,{children:"Files"}),(0,a.jsx)(p.w3,{className:"p-0 m-0",children:(0,a.jsx)(p.LO,{className:"list-none",children:(0,a.jsx)(f.J_,{conversationId:r.conversationId,uploadedFiles:[],isMobileWidth:null!==(o=r.isMobileWidth)&&void 0!==o&&o})},"files-conversation")})]})},"files")]}),r.isOpen&&(0,a.jsx)(p.ZW,{children:(0,a.jsx)(p.w3,{className:"p-0 m-0",children:m&&!d&&m.is_creator?(0,a.jsx)(p.LO,{children:(0,a.jsx)(p.bb,{asChild:!0,children:(0,a.jsx)(N.z,{className:"w-full",variant:"ghost",onClick:()=>window.location.href="/agents?agent=".concat(null==m?void 0:m.slug),children:"Manage"})})}):(0,a.jsxs)(a.Fragment,{children:[!F&&d&&w&&!P&&M&&(0,a.jsx)(p.LO,{children:(0,a.jsx)(p.bb,{asChild:!0,children:(0,a.jsx)(ei,{customPrompt:w,selectedModel:M,inputTools:null!=K?K:[],outputModes:null!=Q?Q:[]})})}),(0,a.jsx)(p.LO,{children:(0,a.jsx)(p.bb,{asChild:!0,children:(0,a.jsx)(N.z,{className:"w-full",onClick:()=>void(es(),A(!1)),variant:"ghost",disabled:!d||!F,children:"Reset"})})}),(0,a.jsx)(p.LO,{children:(0,a.jsx)(p.bb,{asChild:!0,children:(0,a.jsxs)(N.z,{className:"w-full ".concat(F?"bg-accent-foreground text-accent":""),variant:"secondary",onClick:()=>(function(){if(F){if(!P&&(null==m?void 0:m.is_hidden)===!1){alert("This agent is not a hidden agent. It cannot be modified from this interface.");return}let e="PATCH";P&&(e="POST");let t={persona:w,chat_model:M,input_tools:E,output_modes:L,...P?{}:{slug:null==m?void 0:m.slug}};ee(!0),fetch(P?"/api/agents/hidden?conversation_id=".concat(r.conversationId):"/api/agents/hidden",{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(e=>{ee(!1),e.json()}).then(e=>{(0,D.j)("/api/agents/conversation?conversation_id=".concat(r.conversationId)),A(!1)}).catch(e=>{console.error("Error:",e),ee(!1)})}})(),disabled:!d||!F||X,children:[X?(0,a.jsx)(_.U,{className:"animate-spin"}):(0,a.jsx)(k.Z,{}),X?"Saving":"Save"]})})})]})})},"actions")]})}function er(e){let t=(0,d.useSearchParams)().get("conversationId"),[s,n]=(0,i.useState)(""),[o,c]=(0,i.useState)([]),[u,h]=(0,i.useState)(!1),[x,f]=(0,i.useState)(null),[p,g]=(0,i.useState)(!1),j=(0,i.useRef)(null),v=e.setQueryToProcess,N=e.onConversationIdChange,y=e.isMobileWidth?"w-full":"w-4/6";if((0,i.useEffect)(()=>{if(o.length>0){let t=o.map(e=>encodeURIComponent(e));e.setImages(t)}},[o,e.setImages]),(0,i.useEffect)(()=>{let t=localStorage.getItem("images");if(t){let s=JSON.parse(t);c(s);let a=s.map(e=>encodeURIComponent(e));e.setImages(a),localStorage.removeItem("images")}let s=localStorage.getItem("message");s&&(h(!0),v(s),s.trim().startsWith("/research")&&g(!0));let a=localStorage.getItem("uploadedFiles");if(a){let t=a?JSON.parse(a):[],s=[];for(let e of t)s.push({name:e.name,file_type:e.file_type,content:e.content,size:e.size});localStorage.removeItem("uploadedFiles"),e.setUploadedFiles(s)}},[v,e.setImages,t]),(0,i.useEffect)(()=>{s&&(h(!0),v(s))},[s,v]),(0,i.useEffect)(()=>{t&&(null==N||N(t))},[t,N]),(0,i.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?(h(!1),c([]),e.setUploadedFiles(void 0)):n("")},[e.streamedMessages]),!t){window.location.href="/";return}return(0,a.jsxs)("div",{className:"flex flex-row h-full w-full",children:[(0,a.jsxs)("div",{className:"flex flex-col h-full w-full",children:[(0,a.jsx)("div",{className:l().chatBodyFull,children:(0,a.jsx)(r.Z,{conversationId:t,setTitle:e.setTitle,setAgent:f,pendingMessage:u?s:"",incomingMessages:e.streamedMessages,setIncomingMessages:e.setStreamedMessages,customClassName:y,setIsChatSideBarOpen:e.setIsChatSideBarOpen,onRetryMessage:e.onRetryMessage})}),(0,a.jsx)("div",{className:"".concat(l().inputBox," print-hidden p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-2xl md:rounded-xl h-fit ").concat(y," mr-auto ml-auto mt-auto"),children:(0,a.jsx)(m.a,{agentColor:null==x?void 0:x.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>n(e),sendImage:e=>c(t=>[...t,e]),sendDisabled:e.isParentProcessing||!1,chatOptionsData:e.chatOptionsData,conversationId:t,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:j,isResearchModeEnabled:p,setTriggeredAbort:e.setTriggeredAbort})})]}),(0,a.jsx)("div",{className:"print-hidden",children:(0,a.jsx)(el,{conversationId:t,isActive:e.isActive,isOpen:e.isChatSideBarOpen,onOpenChange:e.setIsChatSideBarOpen,isMobileWidth:e.isMobileWidth})})]})}function ed(){let e="Khoj AI - Chat",[t,s]=(0,i.useState)(null),[n,r]=(0,i.useState)(!0),[d,m]=(0,i.useState)(e),[b,w]=(0,i.useState)(null),[_,S]=(0,i.useState)([]),[C,O]=(0,i.useState)(""),[k,I]=(0,i.useState)(!1),[M,T]=(0,i.useState)(void 0),[E,z]=(0,i.useState)([]),[B,L]=(0,i.useState)(!1),[R,F]=(0,i.useState)(""),A=(0,i.useRef)(""),P=(0,i.useRef)(null),{locationData:W,locationDataError:Z,locationDataLoading:J}=(0,h.k6)()||{locationData:{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}},{data:D,error:K,isLoading:V}=(0,x.GW)(),U=(0,h.IC)(),[H,Q]=(0,i.useState)(!1),[G,q]=(0,i.useState)(null),Y=(0,i.useCallback)(()=>{P.current&&clearTimeout(P.current),q(null),console.log("WebSocket disconnected due to inactivity.")},[]),$=(0,i.useCallback)(()=>{P.current&&clearTimeout(P.current),P.current=setTimeout(Y,6e5)},[Y]),{sendMessage:X,lastMessage:ee}=(0,o.ZP)(G,{share:!0,shouldReconnect:e=>!0,reconnectAttempts:10,reconnectInterval:e=>Math.min(1e3*Math.pow(2,e)+1e3*Math.random(),2e4),onOpen:()=>{console.log("WebSocket connection established."),$()},onClose:()=>{console.log("WebSocket connection closed."),P.current&&clearTimeout(P.current)}});async function et(){if(localStorage.removeItem("message"),!C||!b){I(!1);return}if($(),!G){let e="https:"===window.location.protocol?"wss:":"ws:";q("".concat(e,"//").concat(window.location.host,"/api/chat/ws?client=web"))}X(JSON.stringify({q:C,conversation_id:b,stream:!0,...W&&{city:W.city,region:W.region,country:W.country,country_code:W.countryCode,timezone:W.timezone},...E.length>0&&{images:E},...M&&{files:M}}))}return(0,i.useEffect)(()=>{if(null!==ee){let e;$();try{let e=JSON.parse(ee.data);if("interrupt_acknowledged"===e.type){console.log("Interrupt acknowledged by server"),I(!1);return}if("interrupt_message_acknowledged"===e.type){console.log("Interrupt message acknowledged by server"),I(!1);return}if(e.error){console.error("WebSocket error:",e.error);return}}catch(e){}let t="␃\uD83D\uDD1A␗";for(A.current+=ee.data;-1!==(e=A.current.indexOf(t));){let s=A.current.slice(0,e);A.current=A.current.slice(e+t.length),s&&S(e=>{let t=[...e],a=t[t.length-1];if(!a||a.completed)return e;let{context:n,onlineContext:l,codeContext:i}=(0,u.VK)(s,a,a.context||[],a.onlineContext||{},a.codeContext||{});return a.context=n,a.onlineContext=l,a.codeContext=i,a.completed&&(O(""),I(!1),z([]),b&&(0,u.tQ)(b,m)),t})}}},[ee,S]),(0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{r(!1),e&&s(e)}).catch(e=>{console.error(e)}),(0,h.EK)()},[]),((0,i.useEffect)(()=>{B&&(X(JSON.stringify({type:"interrupt",query:R})),console.log("Sent interrupt message via WebSocket:",R),S(e=>{let t=[...e],s=t[t.length-1];return s&&(s.completed=!0),t}),O(R),L(!1),F(""))},[B,X]),(0,i.useEffect)(()=>{if(C){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},codeContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:C||"",images:E,queryFiles:M};S(t=>[...t,e]),I(!0)}},[C]),(0,i.useEffect)(()=>{k&&!J&&et()},[k,J]),(0,i.useEffect)(()=>{if(!b)return;let e="https:"===window.location.protocol?"wss:":"ws:";return q("".concat(e,"//").concat(window.location.host,"/api/chat/ws?client=web")),()=>{P.current&&clearTimeout(P.current)}},[b]),n)?(0,a.jsx)(c.Z,{}):(0,a.jsxs)(p.Hn,{children:[(0,a.jsx)("div",{className:"print-hidden",children:(0,a.jsx)(g.S,{conversationId:b||""})}),(0,a.jsxs)(p.kV,{children:[(0,a.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4 print-hidden",children:[(0,a.jsx)(p.vP,{className:"-ml-1"}),(0,a.jsx)(j.Z,{orientation:"vertical",className:"mr-2 h-4"}),b&&(0,a.jsx)("div",{className:"".concat(l().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mx-2 md:mr-8 col-auto h-fit"),children:U?(0,a.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,a.jsx)(v.VO,{className:"h-auto w-16"})}):d&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden mr-4",children:d}),(0,a.jsx)(f.En,{conversationId:b,setTitle:m,sizing:"md"})]})}),(0,a.jsx)("div",{className:"flex justify-end items-start gap-2 text-sm ml-auto",children:(0,a.jsx)(N.z,{variant:"ghost",size:"icon",className:"h-12 w-12 data-[state=open]:bg-accent print-hidden",onClick:()=>Q(!H),children:(0,a.jsx)(y.T,{className:"w-6 h-6"})})})]}),(0,a.jsxs)("div",{className:"".concat(l().main," ").concat(l().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(d&&d!==e?": ".concat(d):"")}),(0,a.jsx)("div",{className:l().chatBox,children:(0,a.jsx)("div",{className:l().chatBoxBody,children:(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(c.Z,{}),children:(0,a.jsx)(er,{isLoggedIn:!!D,streamedMessages:_,setStreamedMessages:S,chatOptionsData:t,setTitle:m,setQueryToProcess:O,setUploadedFiles:T,isMobileWidth:U,onConversationIdChange:e=>{w(e)},setImages:z,setTriggeredAbort:(e,t)=>{e&&F(t||""),L(e)},isChatSideBarOpen:H,setIsChatSideBarOpen:Q,isActive:null==D?void 0:D.is_active,isParentProcessing:k,onRetryMessage:(e,t)=>{if(!e){console.warn("No query provided for retry");return}t&&(S(e=>e.filter(e=>e.turnId!==t)),fetch("/api/chat/conversation/message",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation_id:b,turn_id:t})}).catch(e=>{console.error("Failed to delete message for retry:",e)})),O(e)}})})})})]})]})]})}},26815:function(e,t,s){"use strict";s.d(t,{_:function(){return d}});var a=s(57437),n=s(2265),l=s(6394),i=s(90535),o=s(94508);let r=(0,i.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(l.f,{ref:t,className:(0,o.cn)(r(),s),...n})});d.displayName=l.f.displayName},53647:function(e,t,s){"use strict";s.d(t,{Bw:function(){return f},Ph:function(){return c},Ql:function(){return p},i4:function(){return h},ki:function(){return u}});var a=s(57437),n=s(2265),l=s(56873),i=s(40875),o=s(22135),r=s(30401),d=s(94508);let c=l.fC;l.ZA;let u=l.B4,h=n.forwardRef((e,t)=>{let{className:s,children:n,...o}=e;return(0,a.jsxs)(l.xz,{ref:t,className:(0,d.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...o,children:[n,(0,a.jsx)(l.JO,{asChild:!0,children:(0,a.jsx)(i.Z,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=l.xz.displayName;let m=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(l.u_,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",s),...n,children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})});m.displayName=l.u_.displayName;let x=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(l.$G,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",s),...n,children:(0,a.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=l.$G.displayName;let f=n.forwardRef((e,t)=>{let{className:s,children:n,position:i="popper",...o}=e;return(0,a.jsx)(l.h_,{children:(0,a.jsxs)(l.VY,{ref:t,className:(0,d.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:i,...o,children:[(0,a.jsx)(m,{}),(0,a.jsx)(l.l_,{className:(0,d.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),(0,a.jsx)(x,{})]})})});f.displayName=l.VY.displayName,n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(l.__,{ref:t,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",s),...n})}).displayName=l.__.displayName;let p=n.forwardRef((e,t)=>{let{className:s,children:n,...i}=e;return(0,a.jsxs)(l.ck,{ref:t,className:(0,d.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...i,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(l.wU,{children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(l.eT,{children:n})]})});p.displayName=l.ck.displayName,n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,a.jsx)(l.Z0,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",s),...n})}).displayName=l.Z0.displayName},63136:function(e){e.exports={main:"chat_main__8xQu5",suggestions:"chat_suggestions__m8n2t",inputBox:"chat_inputBox__LOFws",chatBodyFull:"chat_chatBodyFull__FfKEK",chatBody:"chat_chatBody__sS1LX",chatLayout:"chat_chatLayout__pR203",chatBox:"chat_chatBox__FBct_",titleBar:"chat_titleBar__R5QlK",chatBoxBody:"chat_chatBoxBody__qT_SC",agentIndicator:"chat_agentIndicator__8V55w",chatTitleWrapper:"chat_chatTitleWrapper__6ChWq",chatHistory:"chat_chatHistory__EzBJM"}}},function(e){e.O(0,[8255,9853,1189,3954,1860,2939,7200,8667,1327,4447,3592,5639,9139,2327,5477,7127,2971,2117,1744],function(){return e(e.s=39929)}),_N_E=e.O()}]);
|