khoj 1.35.4.dev2__py3-none-any.whl → 1.36.0__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.
Files changed (88) hide show
  1. khoj/database/adapters/__init__.py +51 -5
  2. khoj/database/migrations/0081_agent_is_hidden_chatmodel_description_and_more.py +27 -0
  3. khoj/database/migrations/0082_merge_20250121_1842.py +13 -0
  4. khoj/database/migrations/0083_alter_agent_output_modes_alter_agent_personality_and_more.py +71 -0
  5. khoj/database/migrations/0084_alter_agent_input_tools.py +33 -0
  6. khoj/database/migrations/0085_alter_agent_output_modes.py +24 -0
  7. khoj/database/models/__init__.py +8 -6
  8. khoj/interface/compiled/404/index.html +1 -1
  9. khoj/interface/compiled/_next/static/chunks/2327-780f28ea68228e9a.js +1 -0
  10. khoj/interface/compiled/_next/static/chunks/3224-34b5078830a51f42.js +1 -0
  11. khoj/interface/compiled/_next/static/chunks/4357-73c05a7c905ffc9f.js +1 -0
  12. khoj/interface/compiled/_next/static/chunks/{4610.196691887afb7fea.js → 4610.a1e7f40a759ed2aa.js} +1 -1
  13. khoj/interface/compiled/_next/static/chunks/4986-80ecd055ad138cf6.js +1 -0
  14. khoj/interface/compiled/_next/static/chunks/{5427-0a9a2669cb5cde83.js → 5427-d65c69daf03cc100.js} +1 -1
  15. khoj/interface/compiled/_next/static/chunks/{6434.e6cd986d690f2cef.js → 6434.7afea9648e238ad5.js} +1 -1
  16. khoj/interface/compiled/_next/static/chunks/{6002-7e3115f142731625.js → 8155-87b4d2ea2cf725cc.js} +9 -9
  17. khoj/interface/compiled/_next/static/chunks/849-bf52aa2736c7f253.js +20 -0
  18. khoj/interface/compiled/_next/static/chunks/8580-f95d376ed2c5a2cb.js +1 -0
  19. khoj/interface/compiled/_next/static/chunks/app/agents/page-5c32dfc2ab1d37c3.js +1 -0
  20. khoj/interface/compiled/_next/static/chunks/app/automations/{page-e1e5c04c6d1a3b82.js → page-c6dee506ac1ef75c.js} +1 -1
  21. khoj/interface/compiled/_next/static/chunks/app/chat/page-74b7f5b550cfb2b3.js +1 -0
  22. khoj/interface/compiled/_next/static/chunks/app/page-18c5514c09249e15.js +1 -0
  23. khoj/interface/compiled/_next/static/chunks/app/search/{page-3813b25193b1c9e3.js → page-dfbf62acab34d1f1.js} +1 -1
  24. khoj/interface/compiled/_next/static/chunks/app/settings/page-2a68279b34a434e3.js +1 -0
  25. khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-6d7831aace573049.js +1 -0
  26. khoj/interface/compiled/_next/static/chunks/app/share/chat/page-978928ef05d44a48.js +1 -0
  27. khoj/interface/compiled/_next/static/chunks/{webpack-2c5a3f89bde64271.js → webpack-8477c6163ef026fe.js} +1 -1
  28. khoj/interface/compiled/_next/static/css/20ac73cc3d58b75c.css +25 -0
  29. khoj/interface/compiled/_next/static/css/37a73b87f02df402.css +1 -0
  30. khoj/interface/compiled/_next/static/css/{df4b47a2d0d85eae.css → b15666ef52060cd0.css} +1 -1
  31. khoj/interface/compiled/_next/static/css/f29752d6e1be7624.css +1 -0
  32. khoj/interface/compiled/_next/static/css/f29ee25d068f459b.css +1 -0
  33. khoj/interface/compiled/agents/index.html +1 -1
  34. khoj/interface/compiled/agents/index.txt +2 -2
  35. khoj/interface/compiled/automations/index.html +1 -1
  36. khoj/interface/compiled/automations/index.txt +3 -3
  37. khoj/interface/compiled/chat/index.html +1 -1
  38. khoj/interface/compiled/chat/index.txt +2 -2
  39. khoj/interface/compiled/index.html +1 -1
  40. khoj/interface/compiled/index.txt +2 -2
  41. khoj/interface/compiled/search/index.html +1 -1
  42. khoj/interface/compiled/search/index.txt +3 -3
  43. khoj/interface/compiled/settings/index.html +1 -1
  44. khoj/interface/compiled/settings/index.txt +4 -4
  45. khoj/interface/compiled/share/chat/index.html +1 -1
  46. khoj/interface/compiled/share/chat/index.txt +2 -2
  47. khoj/routers/api_agents.py +164 -4
  48. khoj/routers/api_chat.py +22 -5
  49. khoj/routers/api_model.py +14 -7
  50. khoj/routers/helpers.py +47 -5
  51. khoj/utils/helpers.py +14 -5
  52. {khoj-1.35.4.dev2.dist-info → khoj-1.36.0.dist-info}/METADATA +1 -1
  53. {khoj-1.35.4.dev2.dist-info → khoj-1.36.0.dist-info}/RECORD +73 -67
  54. khoj/interface/compiled/_next/static/chunks/182-8cd8b17d40e6e989.js +0 -20
  55. khoj/interface/compiled/_next/static/chunks/2327-3b7d77ac1d1c86a2.js +0 -1
  56. khoj/interface/compiled/_next/static/chunks/4270-28ab75d62e71521c.js +0 -1
  57. khoj/interface/compiled/_next/static/chunks/4986-4de8a920c7fcbbc6.js +0 -1
  58. khoj/interface/compiled/_next/static/chunks/9665-1ab5c8c667b74dca.js +0 -1
  59. khoj/interface/compiled/_next/static/chunks/app/agents/page-7e18b67e737c7ddd.js +0 -1
  60. khoj/interface/compiled/_next/static/chunks/app/chat/page-6e4297193657b39b.js +0 -1
  61. khoj/interface/compiled/_next/static/chunks/app/page-71b4596245f4b71d.js +0 -1
  62. khoj/interface/compiled/_next/static/chunks/app/settings/page-9a2c880a5750f2d4.js +0 -1
  63. khoj/interface/compiled/_next/static/chunks/app/share/chat/layout-8b91b8adb4f04450.js +0 -1
  64. khoj/interface/compiled/_next/static/chunks/app/share/chat/page-0276dcbd88d8d132.js +0 -1
  65. khoj/interface/compiled/_next/static/css/bb7ea98028b368f3.css +0 -1
  66. khoj/interface/compiled/_next/static/css/d6f22b1f76448451.css +0 -1
  67. khoj/interface/compiled/_next/static/css/d7448372b4f1e3b8.css +0 -25
  68. khoj/interface/compiled/_next/static/css/eff89937927ce00a.css +0 -1
  69. /khoj/interface/compiled/_next/static/{qiv_p9caXoUfGDmSGgKvs → 3Sk3rOaHsdqnMPNiH4jA4}/_buildManifest.js +0 -0
  70. /khoj/interface/compiled/_next/static/{qiv_p9caXoUfGDmSGgKvs → 3Sk3rOaHsdqnMPNiH4jA4}/_ssgManifest.js +0 -0
  71. /khoj/interface/compiled/_next/static/chunks/{1199-3461ffb259e6d98b.js → 1199-80c79778c44ad4ec.js} +0 -0
  72. /khoj/interface/compiled/_next/static/chunks/{1915-605f698f2573cfd4.js → 1915-233ac8a122732d6b.js} +0 -0
  73. /khoj/interface/compiled/_next/static/chunks/{2117-2a54a27661a71b65.js → 2117-ce1f0a4598f5e4fe.js} +0 -0
  74. /khoj/interface/compiled/_next/static/chunks/{2509-299ad8b73ce407dd.js → 2509-79b3ce8040bc0bcf.js} +0 -0
  75. /khoj/interface/compiled/_next/static/chunks/{5473-b1cf56dedac6577a.js → 5473-02d1709b2a3f4a4b.js} +0 -0
  76. /khoj/interface/compiled/_next/static/chunks/{5477-3a4efd2e062e7102.js → 5477-c47515d2934cd866.js} +0 -0
  77. /khoj/interface/compiled/_next/static/chunks/{6244-08fb644d7709f449.js → 6244-4b970139897ef46e.js} +0 -0
  78. /khoj/interface/compiled/_next/static/chunks/{7647-5a935022fa3da0a6.js → 7647-469de84d236fc7fd.js} +0 -0
  79. /khoj/interface/compiled/_next/static/chunks/{8667-d3e5bc726e4ff4e3.js → 8667-8136f74e9a086fca.js} +0 -0
  80. /khoj/interface/compiled/_next/static/chunks/{9259-27d1ff42af9a43e0.js → 9259-fa40e7cf2ca28e04.js} +0 -0
  81. /khoj/interface/compiled/_next/static/chunks/app/_not-found/{page-a834eddae3e235df.js → page-0ec97c4970898f2d.js} +0 -0
  82. /khoj/interface/compiled/_next/static/chunks/app/automations/{layout-0adc73dba7a04c11.js → layout-02f95fa0a48743eb.js} +0 -0
  83. /khoj/interface/compiled/_next/static/chunks/app/search/{layout-acc9eb43c9962ee1.js → layout-596cdc3a5a1a8e46.js} +0 -0
  84. /khoj/interface/compiled/_next/static/chunks/app/settings/{layout-d09d6510a45cd4bd.js → layout-8a22f370d3eaeed3.js} +0 -0
  85. /khoj/interface/compiled/_next/static/chunks/{fd9d1056-f14840e2376aea5a.js → fd9d1056-7454f5bbfcf5bd5b.js} +0 -0
  86. {khoj-1.35.4.dev2.dist-info → khoj-1.36.0.dist-info}/WHEEL +0 -0
  87. {khoj-1.35.4.dev2.dist-info → khoj-1.36.0.dist-info}/entry_points.txt +0 -0
  88. {khoj-1.35.4.dev2.dist-info → khoj-1.36.0.dist-info}/licenses/LICENSE +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9665],{40875:function(e,t,r){r.d(t,{Z:function(){return a}});let a=(0,r(79205).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},13590:function(e,t,r){r.d(t,{F:function(){return d}});var a=r(29501);let i=(e,t,r)=>{if(e&&"reportValidity"in e){let i=(0,a.U2)(r,t);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},n=(e,t)=>{for(let r in t.fields){let a=t.fields[r];a&&a.ref&&"reportValidity"in a.ref?i(a.ref,r,e):a.refs&&a.refs.forEach(t=>i(t,r,e))}},s=(e,t)=>{t.shouldUseNativeValidation&&n(e,t);let r={};for(let i in e){let n=(0,a.U2)(t.fields,i),s=Object.assign(e[i]||{},{ref:n&&n.ref});if(l(t.names||Object.keys(e),i)){let e=Object.assign({},(0,a.U2)(r,i));(0,a.t8)(e,"root",s),(0,a.t8)(r,i,e)}else(0,a.t8)(r,i,s)}return r},l=(e,t)=>e.some(e=>e.startsWith(t+"."));var o=function(e,t){for(var r={};e.length;){var i=e[0],n=i.code,s=i.message,l=i.path.join(".");if(!r[l]){if("unionErrors"in i){var o=i.unionErrors[0].errors[0];r[l]={message:o.message,type:o.code}}else r[l]={message:s,type:n}}if("unionErrors"in i&&i.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var d=r[l].types,u=d&&d[i.code];r[l]=(0,a.KN)(l,t,r,n,u?[].concat(u,i.message):i.message)}e.shift()}return r},d=function(e,t,r){return void 0===r&&(r={}),function(a,i,l){try{return Promise.resolve(function(i,s){try{var o=Promise.resolve(e["sync"===r.mode?"parse":"parseAsync"](a,t)).then(function(e){return l.shouldUseNativeValidation&&n({},l),{errors:{},values:r.raw?a:e}})}catch(e){return s(e)}return o&&o.then?o.then(void 0,s):o}(0,function(e){if(Array.isArray(null==e?void 0:e.errors))return{values:{},errors:s(o(e.errors,!l.shouldUseNativeValidation&&"all"===l.criteriaMode),l)};throw e}))}catch(e){return Promise.reject(e)}}}},6394:function(e,t,r){r.d(t,{f:function(){return l}});var a=r(2265),i=r(66840),n=r(57437),s=a.forwardRef((e,t)=>(0,n.jsx)(i.WV.label,{...e,ref:t,onMouseDown:t=>{var r;t.target.closest("button, input, select, textarea")||(null===(r=e.onMouseDown)||void 0===r||r.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName="Label";var l=s},28951:function(e,t,r){r.d(t,{VY:function(){return eN},ZA:function(){return eD},JO:function(){return eO},ck:function(){return eI},wU:function(){return eM},eT:function(){return eP},__:function(){return eR},h_:function(){return eV},fC:function(){return ej},$G:function(){return e$},u_:function(){return eL},Z0:function(){return eU},xz:function(){return eZ},B4:function(){return eE},l_:function(){return eF}});var a=r(2265),i=r(54887),n=r(62484),s=r(6741),l=r(67822),o=r(98575),d=r(73966),u=r(29114),c=r(15278),f=r(86097),h=r(99103),p=r(99255),m=r(35345),v=r(83832),y=r(66840),g=r(37053),_=r(26606),b=r(80886),x=r(61188),w=r(95098),k=r(5478),S=r(99157),C=r(57437),T=[" ","Enter","ArrowUp","ArrowDown"],A=[" ","Enter"],j="Select",[Z,E,O]=(0,l.B)(j),[V,N]=(0,d.b)(j,[O,m.D7]),F=(0,m.D7)(),[D,R]=V(j),[I,P]=V(j),M=e=>{let{__scopeSelect:t,children:r,open:i,defaultOpen:n,onOpenChange:s,value:l,defaultValue:o,onValueChange:d,dir:c,name:f,autoComplete:h,disabled:v,required:y,form:g}=e,_=F(t),[x,w]=a.useState(null),[k,S]=a.useState(null),[T,A]=a.useState(!1),j=(0,u.gm)(c),[E=!1,O]=(0,b.T)({prop:i,defaultProp:n,onChange:s}),[V,N]=(0,b.T)({prop:l,defaultProp:o,onChange:d}),R=a.useRef(null),P=!x||g||!!x.closest("form"),[M,L]=a.useState(new Set),$=Array.from(M).map(e=>e.props.value).join(";");return(0,C.jsx)(m.fC,{..._,children:(0,C.jsxs)(D,{required:y,scope:t,trigger:x,onTriggerChange:w,valueNode:k,onValueNodeChange:S,valueNodeHasChildren:T,onValueNodeHasChildrenChange:A,contentId:(0,p.M)(),value:V,onValueChange:N,open:E,onOpenChange:O,dir:j,triggerPointerDownPosRef:R,disabled:v,children:[(0,C.jsx)(Z.Provider,{scope:t,children:(0,C.jsx)(I,{scope:e.__scopeSelect,onNativeOptionAdd:a.useCallback(e=>{L(t=>new Set(t).add(e))},[]),onNativeOptionRemove:a.useCallback(e=>{L(t=>{let r=new Set(t);return r.delete(e),r})},[]),children:r})}),P?(0,C.jsxs)(eC,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:h,value:V,onChange:e=>N(e.target.value),disabled:v,form:g,children:[void 0===V?(0,C.jsx)("option",{value:""}):null,Array.from(M)]},$):null]})})};M.displayName=j;var L="SelectTrigger",$=a.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:i=!1,...n}=e,l=F(r),d=R(L,r),u=d.disabled||i,c=(0,o.e)(t,d.onTriggerChange),f=E(r),h=a.useRef("touch"),[p,v,g]=eT(e=>{let t=f().filter(e=>!e.disabled),r=t.find(e=>e.value===d.value),a=eA(t,e,r);void 0!==a&&d.onValueChange(a.value)}),_=e=>{u||(d.onOpenChange(!0),g()),e&&(d.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,C.jsx)(m.ee,{asChild:!0,...l,children:(0,C.jsx)(y.WV.button,{type:"button",role:"combobox","aria-controls":d.contentId,"aria-expanded":d.open,"aria-required":d.required,"aria-autocomplete":"none",dir:d.dir,"data-state":d.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":eS(d.value)?"":void 0,...n,ref:c,onClick:(0,s.M)(n.onClick,e=>{e.currentTarget.focus(),"mouse"!==h.current&&_(e)}),onPointerDown:(0,s.M)(n.onPointerDown,e=>{h.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(_(e),e.preventDefault())}),onKeyDown:(0,s.M)(n.onKeyDown,e=>{let t=""!==p.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||v(e.key),(!t||" "!==e.key)&&T.includes(e.key)&&(_(),e.preventDefault())})})})});$.displayName=L;var U="SelectValue",B=a.forwardRef((e,t)=>{let{__scopeSelect:r,className:a,style:i,children:n,placeholder:s="",...l}=e,d=R(U,r),{onValueNodeHasChildrenChange:u}=d,c=void 0!==n,f=(0,o.e)(t,d.onValueNodeChange);return(0,x.b)(()=>{u(c)},[u,c]),(0,C.jsx)(y.WV.span,{...l,ref:f,style:{pointerEvents:"none"},children:eS(d.value)?(0,C.jsx)(C.Fragment,{children:s}):n})});B.displayName=U;var z=a.forwardRef((e,t)=>{let{__scopeSelect:r,children:a,...i}=e;return(0,C.jsx)(y.WV.span,{"aria-hidden":!0,...i,ref:t,children:a||"▼"})});z.displayName="SelectIcon";var W=e=>(0,C.jsx)(v.h,{asChild:!0,...e});W.displayName="SelectPortal";var K="SelectContent",H=a.forwardRef((e,t)=>{let r=R(K,e.__scopeSelect),[n,s]=a.useState();return((0,x.b)(()=>{s(new DocumentFragment)},[]),r.open)?(0,C.jsx)(G,{...e,ref:t}):n?i.createPortal((0,C.jsx)(q,{scope:e.__scopeSelect,children:(0,C.jsx)(Z.Slot,{scope:e.__scopeSelect,children:(0,C.jsx)("div",{children:e.children})})}),n):null});H.displayName=K;var[q,Y]=V(K),G=a.forwardRef((e,t)=>{let{__scopeSelect:r,position:i="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:l,onPointerDownOutside:d,side:u,sideOffset:p,align:m,alignOffset:v,arrowPadding:y,collisionBoundary:_,collisionPadding:b,sticky:x,hideWhenDetached:w,avoidCollisions:T,...A}=e,j=R(K,r),[Z,O]=a.useState(null),[V,N]=a.useState(null),F=(0,o.e)(t,e=>O(e)),[D,I]=a.useState(null),[P,M]=a.useState(null),L=E(r),[$,U]=a.useState(!1),B=a.useRef(!1);a.useEffect(()=>{if(Z)return(0,k.Ry)(Z)},[Z]),(0,f.EW)();let z=a.useCallback(e=>{let[t,...r]=L().map(e=>e.ref.current),[a]=r.slice(-1),i=document.activeElement;for(let r of e)if(r===i||(null==r||r.scrollIntoView({block:"nearest"}),r===t&&V&&(V.scrollTop=0),r===a&&V&&(V.scrollTop=V.scrollHeight),null==r||r.focus(),document.activeElement!==i))return},[L,V]),W=a.useCallback(()=>z([D,Z]),[z,D,Z]);a.useEffect(()=>{$&&W()},[$,W]);let{onOpenChange:H,triggerPointerDownPosRef:Y}=j;a.useEffect(()=>{if(Z){let e={x:0,y:0},t=t=>{var r,a,i,n;e={x:Math.abs(Math.round(t.pageX)-(null!==(i=null===(r=Y.current)||void 0===r?void 0:r.x)&&void 0!==i?i:0)),y:Math.abs(Math.round(t.pageY)-(null!==(n=null===(a=Y.current)||void 0===a?void 0:a.y)&&void 0!==n?n:0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():Z.contains(r.target)||H(!1),document.removeEventListener("pointermove",t),Y.current=null};return null!==Y.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[Z,H,Y]),a.useEffect(()=>{let e=()=>H(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[H]);let[G,Q]=eT(e=>{let t=L().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),a=eA(t,e,r);a&&setTimeout(()=>a.ref.current.focus())}),ee=a.useCallback((e,t,r)=>{let a=!B.current&&!r;(void 0!==j.value&&j.value===t||a)&&(I(e),a&&(B.current=!0))},[j.value]),et=a.useCallback(()=>null==Z?void 0:Z.focus(),[Z]),er=a.useCallback((e,t,r)=>{let a=!B.current&&!r;(void 0!==j.value&&j.value===t||a)&&M(e)},[j.value]),ea="popper"===i?X:J,ei=ea===X?{side:u,sideOffset:p,align:m,alignOffset:v,arrowPadding:y,collisionBoundary:_,collisionPadding:b,sticky:x,hideWhenDetached:w,avoidCollisions:T}:{};return(0,C.jsx)(q,{scope:r,content:Z,viewport:V,onViewportChange:N,itemRefCallback:ee,selectedItem:D,onItemLeave:et,itemTextRefCallback:er,focusSelectedItem:W,selectedItemText:P,position:i,isPositioned:$,searchRef:G,children:(0,C.jsx)(S.Z,{as:g.g7,allowPinchZoom:!0,children:(0,C.jsx)(h.M,{asChild:!0,trapped:j.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:(0,s.M)(n,e=>{var t;null===(t=j.trigger)||void 0===t||t.focus({preventScroll:!0}),e.preventDefault()}),children:(0,C.jsx)(c.XB,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>j.onOpenChange(!1),children:(0,C.jsx)(ea,{role:"listbox",id:j.contentId,"data-state":j.open?"open":"closed",dir:j.dir,onContextMenu:e=>e.preventDefault(),...A,...ei,onPlaced:()=>U(!0),ref:F,style:{display:"flex",flexDirection:"column",outline:"none",...A.style},onKeyDown:(0,s.M)(A.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||Q(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=L().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let r=e.target,a=t.indexOf(r);t=t.slice(a+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});G.displayName="SelectContentImpl";var J=a.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:i,...s}=e,l=R(K,r),d=Y(K,r),[u,c]=a.useState(null),[f,h]=a.useState(null),p=(0,o.e)(t,e=>h(e)),m=E(r),v=a.useRef(!1),g=a.useRef(!0),{viewport:_,selectedItem:b,selectedItemText:w,focusSelectedItem:k}=d,S=a.useCallback(()=>{if(l.trigger&&l.valueNode&&u&&f&&_&&b&&w){let e=l.trigger.getBoundingClientRect(),t=f.getBoundingClientRect(),r=l.valueNode.getBoundingClientRect(),a=w.getBoundingClientRect();if("rtl"!==l.dir){let i=a.left-t.left,s=r.left-i,l=e.left-s,o=e.width+l,d=Math.max(o,t.width),c=window.innerWidth-10,f=(0,n.u)(s,[10,Math.max(10,c-d)]);u.style.minWidth=o+"px",u.style.left=f+"px"}else{let i=t.right-a.right,s=window.innerWidth-r.right-i,l=window.innerWidth-e.right-s,o=e.width+l,d=Math.max(o,t.width),c=window.innerWidth-10,f=(0,n.u)(s,[10,Math.max(10,c-d)]);u.style.minWidth=o+"px",u.style.right=f+"px"}let s=m(),o=window.innerHeight-20,d=_.scrollHeight,c=window.getComputedStyle(f),h=parseInt(c.borderTopWidth,10),p=parseInt(c.paddingTop,10),y=parseInt(c.borderBottomWidth,10),g=h+p+d+parseInt(c.paddingBottom,10)+y,x=Math.min(5*b.offsetHeight,g),k=window.getComputedStyle(_),S=parseInt(k.paddingTop,10),C=parseInt(k.paddingBottom,10),T=e.top+e.height/2-10,A=b.offsetHeight/2,j=h+p+(b.offsetTop+A);if(j<=T){let e=s.length>0&&b===s[s.length-1].ref.current;u.style.bottom="0px";let t=f.clientHeight-_.offsetTop-_.offsetHeight;u.style.height=j+Math.max(o-T,A+(e?C:0)+t+y)+"px"}else{let e=s.length>0&&b===s[0].ref.current;u.style.top="0px";let t=Math.max(T,h+_.offsetTop+(e?S:0)+A);u.style.height=t+(g-j)+"px",_.scrollTop=j-T+_.offsetTop}u.style.margin="".concat(10,"px 0"),u.style.minHeight=x+"px",u.style.maxHeight=o+"px",null==i||i(),requestAnimationFrame(()=>v.current=!0)}},[m,l.trigger,l.valueNode,u,f,_,b,w,l.dir,i]);(0,x.b)(()=>S(),[S]);let[T,A]=a.useState();(0,x.b)(()=>{f&&A(window.getComputedStyle(f).zIndex)},[f]);let j=a.useCallback(e=>{e&&!0===g.current&&(S(),null==k||k(),g.current=!1)},[S,k]);return(0,C.jsx)(Q,{scope:r,contentWrapper:u,shouldExpandOnScrollRef:v,onScrollButtonChange:j,children:(0,C.jsx)("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:(0,C.jsx)(y.WV.div,{...s,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});J.displayName="SelectItemAlignedPosition";var X=a.forwardRef((e,t)=>{let{__scopeSelect:r,align:a="start",collisionPadding:i=10,...n}=e,s=F(r);return(0,C.jsx)(m.VY,{...s,...n,ref:t,align:a,collisionPadding:i,style:{boxSizing:"border-box",...n.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});X.displayName="SelectPopperPosition";var[Q,ee]=V(K,{}),et="SelectViewport",er=a.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:i,...n}=e,l=Y(et,r),d=ee(et,r),u=(0,o.e)(t,l.onViewportChange),c=a.useRef(0);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),(0,C.jsx)(Z.Slot,{scope:r,children:(0,C.jsx)(y.WV.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:(0,s.M)(n.onScroll,e=>{let t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:a}=d;if((null==a?void 0:a.current)&&r){let e=Math.abs(c.current-t.scrollTop);if(e>0){let a=window.innerHeight-20,i=Math.max(parseFloat(r.style.minHeight),parseFloat(r.style.height));if(i<a){let n=i+e,s=Math.min(a,n),l=n-s;r.style.height=s+"px","0px"===r.style.bottom&&(t.scrollTop=l>0?l:0,r.style.justifyContent="flex-end")}}}c.current=t.scrollTop})})})]})});er.displayName=et;var ea="SelectGroup",[ei,en]=V(ea),es=a.forwardRef((e,t)=>{let{__scopeSelect:r,...a}=e,i=(0,p.M)();return(0,C.jsx)(ei,{scope:r,id:i,children:(0,C.jsx)(y.WV.div,{role:"group","aria-labelledby":i,...a,ref:t})})});es.displayName=ea;var el="SelectLabel",eo=a.forwardRef((e,t)=>{let{__scopeSelect:r,...a}=e,i=en(el,r);return(0,C.jsx)(y.WV.div,{id:i.id,...a,ref:t})});eo.displayName=el;var ed="SelectItem",[eu,ec]=V(ed),ef=a.forwardRef((e,t)=>{let{__scopeSelect:r,value:i,disabled:n=!1,textValue:l,...d}=e,u=R(ed,r),c=Y(ed,r),f=u.value===i,[h,m]=a.useState(null!=l?l:""),[v,g]=a.useState(!1),_=(0,o.e)(t,e=>{var t;return null===(t=c.itemRefCallback)||void 0===t?void 0:t.call(c,e,i,n)}),b=(0,p.M)(),x=a.useRef("touch"),w=()=>{n||(u.onValueChange(i),u.onOpenChange(!1))};if(""===i)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,C.jsx)(eu,{scope:r,value:i,disabled:n,textId:b,isSelected:f,onItemTextChange:a.useCallback(e=>{m(t=>{var r;return t||(null!==(r=null==e?void 0:e.textContent)&&void 0!==r?r:"").trim()})},[]),children:(0,C.jsx)(Z.ItemSlot,{scope:r,value:i,disabled:n,textValue:h,children:(0,C.jsx)(y.WV.div,{role:"option","aria-labelledby":b,"data-highlighted":v?"":void 0,"aria-selected":f&&v,"data-state":f?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...d,ref:_,onFocus:(0,s.M)(d.onFocus,()=>g(!0)),onBlur:(0,s.M)(d.onBlur,()=>g(!1)),onClick:(0,s.M)(d.onClick,()=>{"mouse"!==x.current&&w()}),onPointerUp:(0,s.M)(d.onPointerUp,()=>{"mouse"===x.current&&w()}),onPointerDown:(0,s.M)(d.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:(0,s.M)(d.onPointerMove,e=>{if(x.current=e.pointerType,n){var t;null===(t=c.onItemLeave)||void 0===t||t.call(c)}else"mouse"===x.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:(0,s.M)(d.onPointerLeave,e=>{if(e.currentTarget===document.activeElement){var t;null===(t=c.onItemLeave)||void 0===t||t.call(c)}}),onKeyDown:(0,s.M)(d.onKeyDown,e=>{var t;(null===(t=c.searchRef)||void 0===t?void 0:t.current)!==""&&" "===e.key||(A.includes(e.key)&&w()," "===e.key&&e.preventDefault())})})})})});ef.displayName=ed;var eh="SelectItemText",ep=a.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:s,...l}=e,d=R(eh,r),u=Y(eh,r),c=ec(eh,r),f=P(eh,r),[h,p]=a.useState(null),m=(0,o.e)(t,e=>p(e),c.onItemTextChange,e=>{var t;return null===(t=u.itemTextRefCallback)||void 0===t?void 0:t.call(u,e,c.value,c.disabled)}),v=null==h?void 0:h.textContent,g=a.useMemo(()=>(0,C.jsx)("option",{value:c.value,disabled:c.disabled,children:v},c.value),[c.disabled,c.value,v]),{onNativeOptionAdd:_,onNativeOptionRemove:b}=f;return(0,x.b)(()=>(_(g),()=>b(g)),[_,b,g]),(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(y.WV.span,{id:c.textId,...l,ref:m}),c.isSelected&&d.valueNode&&!d.valueNodeHasChildren?i.createPortal(l.children,d.valueNode):null]})});ep.displayName=eh;var em="SelectItemIndicator",ev=a.forwardRef((e,t)=>{let{__scopeSelect:r,...a}=e;return ec(em,r).isSelected?(0,C.jsx)(y.WV.span,{"aria-hidden":!0,...a,ref:t}):null});ev.displayName=em;var ey="SelectScrollUpButton",eg=a.forwardRef((e,t)=>{let r=Y(ey,e.__scopeSelect),i=ee(ey,e.__scopeSelect),[n,s]=a.useState(!1),l=(0,o.e)(t,i.onScrollButtonChange);return(0,x.b)(()=>{if(r.viewport&&r.isPositioned){let e=function(){s(t.scrollTop>0)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),n?(0,C.jsx)(ex,{...e,ref:l,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});eg.displayName=ey;var e_="SelectScrollDownButton",eb=a.forwardRef((e,t)=>{let r=Y(e_,e.__scopeSelect),i=ee(e_,e.__scopeSelect),[n,s]=a.useState(!1),l=(0,o.e)(t,i.onScrollButtonChange);return(0,x.b)(()=>{if(r.viewport&&r.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;s(Math.ceil(t.scrollTop)<e)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),n?(0,C.jsx)(ex,{...e,ref:l,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});eb.displayName=e_;var ex=a.forwardRef((e,t)=>{let{__scopeSelect:r,onAutoScroll:i,...n}=e,l=Y("SelectScrollButton",r),o=a.useRef(null),d=E(r),u=a.useCallback(()=>{null!==o.current&&(window.clearInterval(o.current),o.current=null)},[]);return a.useEffect(()=>()=>u(),[u]),(0,x.b)(()=>{var e;let t=d().find(e=>e.ref.current===document.activeElement);null==t||null===(e=t.ref.current)||void 0===e||e.scrollIntoView({block:"nearest"})},[d]),(0,C.jsx)(y.WV.div,{"aria-hidden":!0,...n,ref:t,style:{flexShrink:0,...n.style},onPointerDown:(0,s.M)(n.onPointerDown,()=>{null===o.current&&(o.current=window.setInterval(i,50))}),onPointerMove:(0,s.M)(n.onPointerMove,()=>{var e;null===(e=l.onItemLeave)||void 0===e||e.call(l),null===o.current&&(o.current=window.setInterval(i,50))}),onPointerLeave:(0,s.M)(n.onPointerLeave,()=>{u()})})}),ew=a.forwardRef((e,t)=>{let{__scopeSelect:r,...a}=e;return(0,C.jsx)(y.WV.div,{"aria-hidden":!0,...a,ref:t})});ew.displayName="SelectSeparator";var ek="SelectArrow";function eS(e){return""===e||void 0===e}a.forwardRef((e,t)=>{let{__scopeSelect:r,...a}=e,i=F(r),n=R(ek,r),s=Y(ek,r);return n.open&&"popper"===s.position?(0,C.jsx)(m.Eh,{...i,...a,ref:t}):null}).displayName=ek;var eC=a.forwardRef((e,t)=>{let{value:r,...i}=e,n=a.useRef(null),s=(0,o.e)(t,n),l=function(e){let t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}(r);return a.useEffect(()=>{let e=n.current,t=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(l!==r&&t){let a=new Event("change",{bubbles:!0});t.call(e,r),e.dispatchEvent(a)}},[l,r]),(0,C.jsx)(w.T,{asChild:!0,children:(0,C.jsx)("select",{...i,ref:s,defaultValue:r})})});function eT(e){let t=(0,_.W)(e),r=a.useRef(""),i=a.useRef(0),n=a.useCallback(e=>{let a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(i.current),""!==t&&(i.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),s=a.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return a.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,n,s]}function eA(e,t,r){var a;let i=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,n=(a=Math.max(r?e.indexOf(r):-1,0),e.map((t,r)=>e[(a+r)%e.length]));1===i.length&&(n=n.filter(e=>e!==r));let s=n.find(e=>e.textValue.toLowerCase().startsWith(i.toLowerCase()));return s!==r?s:void 0}eC.displayName="BubbleSelect";var ej=M,eZ=$,eE=B,eO=z,eV=W,eN=H,eF=er,eD=es,eR=eo,eI=ef,eP=ep,eM=ev,eL=eg,e$=eb,eU=ew},29501:function(e,t,r){r.d(t,{Gc:function(){return T},KN:function(){return I},Qr:function(){return R},RV:function(){return A},U2:function(){return y},cI:function(){return ek},t8:function(){return x}});var a=r(2265),i=e=>"checkbox"===e.type,n=e=>e instanceof Date,s=e=>null==e;let l=e=>"object"==typeof e;var o=e=>!s(e)&&!Array.isArray(e)&&l(e)&&!n(e),d=e=>o(e)&&e.target?i(e.target)?e.target.checked:e.target.value:e,u=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,c=(e,t)=>e.has(u(t)),f=e=>{let t=e.constructor&&e.constructor.prototype;return o(t)&&t.hasOwnProperty("isPrototypeOf")},h="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function p(e){let t;let r=Array.isArray(e),a="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(!(h&&(e instanceof Blob||a))&&(r||o(e))))return e;else if(t=r?[]:{},r||f(e))for(let r in e)e.hasOwnProperty(r)&&(t[r]=p(e[r]));else t=e;return t}var m=e=>Array.isArray(e)?e.filter(Boolean):[],v=e=>void 0===e,y=(e,t,r)=>{if(!t||!o(e))return r;let a=m(t.split(/[,[\].]+?/)).reduce((e,t)=>s(e)?e:e[t],e);return v(a)||a===e?v(e[t])?r:e[t]:a},g=e=>"boolean"==typeof e,_=e=>/^\w*$/.test(e),b=e=>m(e.replace(/["|']|\]/g,"").split(/\.|\[/)),x=(e,t,r)=>{let a=-1,i=_(t)?[t]:b(t),n=i.length,s=n-1;for(;++a<n;){let t=i[a],n=r;if(a!==s){let r=e[t];n=o(r)||Array.isArray(r)?r:isNaN(+i[a+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=n,e=e[t]}return e};let w={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},k={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},S={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},C=a.createContext(null),T=()=>a.useContext(C),A=e=>{let{children:t,...r}=e;return a.createElement(C.Provider,{value:r},t)};var j=(e,t,r,a=!0)=>{let i={defaultValues:t._defaultValues};for(let n in e)Object.defineProperty(i,n,{get:()=>(t._proxyFormState[n]!==k.all&&(t._proxyFormState[n]=!a||k.all),r&&(r[n]=!0),e[n])});return i},Z=e=>o(e)&&!Object.keys(e).length,E=(e,t,r,a)=>{r(e);let{name:i,...n}=e;return Z(n)||Object.keys(n).length>=Object.keys(t).length||Object.keys(n).find(e=>t[e]===(!a||k.all))},O=e=>Array.isArray(e)?e:[e],V=(e,t,r)=>!e||!t||e===t||O(e).some(e=>e&&(r?e===t:e.startsWith(t)||t.startsWith(e)));function N(e){let t=a.useRef(e);t.current=e,a.useEffect(()=>{let r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var F=e=>"string"==typeof e,D=(e,t,r,a,i)=>F(e)?(a&&t.watch.add(e),y(r,e,i)):Array.isArray(e)?e.map(e=>(a&&t.watch.add(e),y(r,e))):(a&&(t.watchAll=!0),r);let R=e=>e.render(function(e){let t=T(),{name:r,disabled:i,control:n=t.control,shouldUnregister:s}=e,l=c(n._names.array,r),o=function(e){let t=T(),{control:r=t.control,name:i,defaultValue:n,disabled:s,exact:l}=e||{},o=a.useRef(i);o.current=i,N({disabled:s,subject:r._subjects.values,next:e=>{V(o.current,e.name,l)&&u(p(D(o.current,r._names,e.values||r._formValues,!1,n)))}});let[d,u]=a.useState(r._getWatch(i,n));return a.useEffect(()=>r._removeUnmounted()),d}({control:n,name:r,defaultValue:y(n._formValues,r,y(n._defaultValues,r,e.defaultValue)),exact:!0}),u=function(e){let t=T(),{control:r=t.control,disabled:i,name:n,exact:s}=e||{},[l,o]=a.useState(r._formState),d=a.useRef(!0),u=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),c=a.useRef(n);return c.current=n,N({disabled:i,next:e=>d.current&&V(c.current,e.name,s)&&E(e,u.current,r._updateFormState)&&o({...r._formState,...e}),subject:r._subjects.state}),a.useEffect(()=>(d.current=!0,u.current.isValid&&r._updateValid(!0),()=>{d.current=!1}),[r]),a.useMemo(()=>j(l,r,u.current,!1),[l,r])}({control:n,name:r,exact:!0}),f=a.useRef(n.register(r,{...e.rules,value:o,...g(e.disabled)?{disabled:e.disabled}:{}})),h=a.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!y(u.errors,r)},isDirty:{enumerable:!0,get:()=>!!y(u.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!y(u.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!y(u.validatingFields,r)},error:{enumerable:!0,get:()=>y(u.errors,r)}}),[u,r]),m=a.useMemo(()=>({name:r,value:o,...g(i)||u.disabled?{disabled:u.disabled||i}:{},onChange:e=>f.current.onChange({target:{value:d(e),name:r},type:w.CHANGE}),onBlur:()=>f.current.onBlur({target:{value:y(n._formValues,r),name:r},type:w.BLUR}),ref:e=>{let t=y(n._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}}),[r,n._formValues,i,u.disabled,o,n._fields]);return a.useEffect(()=>{let e=n._options.shouldUnregister||s,t=(e,t)=>{let r=y(n._fields,e);r&&r._f&&(r._f.mount=t)};if(t(r,!0),e){let e=p(y(n._options.defaultValues,r));x(n._defaultValues,r,e),v(y(n._formValues,r))&&x(n._formValues,r,e)}return()=>{(l?e&&!n._state.action:e)?n.unregister(r):t(r,!1)}},[r,n,l,s]),a.useEffect(()=>{g(i)&&y(n._fields,r)&&n._updateDisabledField({disabled:i,fields:n._fields,name:r,value:y(n._fields,r)._f.value})},[i,r,n]),a.useMemo(()=>({field:m,formState:u,fieldState:h}),[m,u,h])}(e));var I=(e,t,r,a,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[a]:i||!0}}:{},P=e=>({isOnSubmit:!e||e===k.onSubmit,isOnBlur:e===k.onBlur,isOnChange:e===k.onChange,isOnAll:e===k.all,isOnTouch:e===k.onTouched}),M=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let L=(e,t,r,a)=>{for(let i of r||Object.keys(e)){let r=y(e,i);if(r){let{_f:e,...n}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!a||e.ref&&t(e.ref,e.name)&&!a)return!0;if(L(n,t))break}else if(o(n)&&L(n,t))break}}};var $=(e,t,r)=>{let a=O(y(e,r));return x(a,"root",t[r]),x(e,r,a),e},U=e=>"file"===e.type,B=e=>"function"==typeof e,z=e=>{if(!h)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},W=e=>F(e),K=e=>"radio"===e.type,H=e=>e instanceof RegExp;let q={value:!1,isValid:!1},Y={value:!0,isValid:!0};var G=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!v(e[0].attributes.value)?v(e[0].value)||""===e[0].value?Y:{value:e[0].value,isValid:!0}:Y:q}return q};let J={isValid:!1,value:null};var X=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,J):J;function Q(e,t,r="validate"){if(W(e)||Array.isArray(e)&&e.every(W)||g(e)&&!e)return{type:r,message:W(e)?e:"",ref:t}}var ee=e=>o(e)&&!H(e)?e:{value:e,message:""},et=async(e,t,r,a,n)=>{let{ref:l,refs:d,required:u,maxLength:c,minLength:f,min:h,max:p,pattern:m,validate:_,name:b,valueAsNumber:x,mount:w,disabled:k}=e._f,C=y(t,b);if(!w||k)return{};let T=d?d[0]:l,A=e=>{a&&T.reportValidity&&(T.setCustomValidity(g(e)?"":e||""),T.reportValidity())},j={},E=K(l),O=i(l),V=(x||U(l))&&v(l.value)&&v(C)||z(l)&&""===l.value||""===C||Array.isArray(C)&&!C.length,N=I.bind(null,b,r,j),D=(e,t,r,a=S.maxLength,i=S.minLength)=>{let n=e?t:r;j[b]={type:e?a:i,message:n,ref:l,...N(e?a:i,n)}};if(n?!Array.isArray(C)||!C.length:u&&(!(E||O)&&(V||s(C))||g(C)&&!C||O&&!G(d).isValid||E&&!X(d).isValid)){let{value:e,message:t}=W(u)?{value:!!u,message:u}:ee(u);if(e&&(j[b]={type:S.required,message:t,ref:T,...N(S.required,t)},!r))return A(t),j}if(!V&&(!s(h)||!s(p))){let e,t;let a=ee(p),i=ee(h);if(s(C)||isNaN(C)){let r=l.valueAsDate||new Date(C),n=e=>new Date(new Date().toDateString()+" "+e),s="time"==l.type,o="week"==l.type;F(a.value)&&C&&(e=s?n(C)>n(a.value):o?C>a.value:r>new Date(a.value)),F(i.value)&&C&&(t=s?n(C)<n(i.value):o?C<i.value:r<new Date(i.value))}else{let r=l.valueAsNumber||(C?+C:C);s(a.value)||(e=r>a.value),s(i.value)||(t=r<i.value)}if((e||t)&&(D(!!e,a.message,i.message,S.max,S.min),!r))return A(j[b].message),j}if((c||f)&&!V&&(F(C)||n&&Array.isArray(C))){let e=ee(c),t=ee(f),a=!s(e.value)&&C.length>+e.value,i=!s(t.value)&&C.length<+t.value;if((a||i)&&(D(a,e.message,t.message),!r))return A(j[b].message),j}if(m&&!V&&F(C)){let{value:e,message:t}=ee(m);if(H(e)&&!C.match(e)&&(j[b]={type:S.pattern,message:t,ref:l,...N(S.pattern,t)},!r))return A(t),j}if(_){if(B(_)){let e=Q(await _(C,t),T);if(e&&(j[b]={...e,...N(S.validate,e.message)},!r))return A(e.message),j}else if(o(_)){let e={};for(let a in _){if(!Z(e)&&!r)break;let i=Q(await _[a](C,t),T,a);i&&(e={...i,...N(a,i.message)},A(i.message),r&&(j[b]=e))}if(!Z(e)&&(j[b]={ref:T,...e},!r))return j}}return A(!0),j};function er(e,t){let r=Array.isArray(t)?t:_(t)?[t]:b(t),a=1===r.length?e:function(e,t){let r=t.slice(0,-1).length,a=0;for(;a<r;)e=v(e)?a++:e[t[a++]];return e}(e,r),i=r.length-1,n=r[i];return a&&delete a[n],0!==i&&(o(a)&&Z(a)||Array.isArray(a)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!v(e[t]))return!1;return!0}(a))&&er(e,r.slice(0,-1)),e}var ea=()=>{let e=[];return{get observers(){return e},next:t=>{for(let r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},ei=e=>s(e)||!l(e);function en(e,t){if(ei(e)||ei(t))return e===t;if(n(e)&&n(t))return e.getTime()===t.getTime();let r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(let i of r){let r=e[i];if(!a.includes(i))return!1;if("ref"!==i){let e=t[i];if(n(r)&&n(e)||o(r)&&o(e)||Array.isArray(r)&&Array.isArray(e)?!en(r,e):r!==e)return!1}}return!0}var es=e=>"select-multiple"===e.type,el=e=>K(e)||i(e),eo=e=>z(e)&&e.isConnected,ed=e=>{for(let t in e)if(B(e[t]))return!0;return!1};function eu(e,t={}){let r=Array.isArray(e);if(o(e)||r)for(let r in e)Array.isArray(e[r])||o(e[r])&&!ed(e[r])?(t[r]=Array.isArray(e[r])?[]:{},eu(e[r],t[r])):s(e[r])||(t[r]=!0);return t}var ec=(e,t)=>(function e(t,r,a){let i=Array.isArray(t);if(o(t)||i)for(let i in t)Array.isArray(t[i])||o(t[i])&&!ed(t[i])?v(r)||ei(a[i])?a[i]=Array.isArray(t[i])?eu(t[i],[]):{...eu(t[i])}:e(t[i],s(r)?{}:r[i],a[i]):a[i]=!en(t[i],r[i]);return a})(e,t,eu(t)),ef=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:a})=>v(e)?e:t?""===e?NaN:e?+e:e:r&&F(e)?new Date(e):a?a(e):e;function eh(e){let t=e.ref;return(e.refs?e.refs.every(e=>e.disabled):t.disabled)?void 0:U(t)?t.files:K(t)?X(e.refs).value:es(t)?[...t.selectedOptions].map(({value:e})=>e):i(t)?G(e.refs).value:ef(v(t.value)?e.ref.value:t.value,e)}var ep=(e,t,r,a)=>{let i={};for(let r of e){let e=y(t,r);e&&x(i,r,e._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:a}},em=e=>v(e)?e:H(e)?e.source:o(e)?H(e.value)?e.value.source:e.value:e;let ev="AsyncFunction";var ey=e=>!!e&&!!e.validate&&!!(B(e.validate)&&e.validate.constructor.name===ev||o(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===ev)),eg=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function e_(e,t,r){let a=y(e,r);if(a||_(r))return{error:a,name:r};let i=r.split(".");for(;i.length;){let a=i.join("."),n=y(t,a),s=y(e,a);if(n&&!Array.isArray(n)&&r!==a)break;if(s&&s.type)return{name:a,error:s};i.pop()}return{name:r}}var eb=(e,t,r,a,i)=>!i.isOnAll&&(!r&&i.isOnTouch?!(t||e):(r?a.isOnBlur:i.isOnBlur)?!e:(r?!a.isOnChange:!i.isOnChange)||e),ex=(e,t)=>!m(y(e,t)).length&&er(e,t);let ew={mode:k.onSubmit,reValidateMode:k.onChange,shouldFocusError:!0};function ek(e={}){let t=a.useRef(void 0),r=a.useRef(void 0),[l,u]=a.useState({isDirty:!1,isValidating:!1,isLoading:B(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:B(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...function(e={}){let t,r={...ew,...e},a={submitCount:0,isDirty:!1,isLoading:B(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},l={},u=(o(r.defaultValues)||o(r.values))&&p(r.defaultValues||r.values)||{},f=r.shouldUnregister?{}:p(u),_={action:!1,mount:!1,watch:!1},b={mount:new Set,unMount:new Set,array:new Set,watch:new Set},S=0,C={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},T={values:ea(),array:ea(),state:ea()},A=P(r.mode),j=P(r.reValidateMode),E=r.criteriaMode===k.all,V=e=>t=>{clearTimeout(S),S=setTimeout(e,t)},N=async e=>{if(!r.disabled&&(C.isValid||e)){let e=r.resolver?Z((await q()).errors):await G(l,!0);e!==a.isValid&&T.state.next({isValid:e})}},R=(e,t)=>{!r.disabled&&(C.isValidating||C.validatingFields)&&((e||Array.from(b.mount)).forEach(e=>{e&&(t?x(a.validatingFields,e,t):er(a.validatingFields,e))}),T.state.next({validatingFields:a.validatingFields,isValidating:!Z(a.validatingFields)}))},I=(e,t)=>{x(a.errors,e,t),T.state.next({errors:a.errors})},W=(e,t,r,a)=>{let i=y(l,e);if(i){let n=y(f,e,v(r)?y(u,e):r);v(n)||a&&a.defaultChecked||t?x(f,e,t?n:eh(i._f)):Q(e,n),_.mount&&N()}},K=(e,t,i,n,s)=>{let o=!1,d=!1,c={name:e};if(!r.disabled){let r=!!(y(l,e)&&y(l,e)._f&&y(l,e)._f.disabled);if(!i||n){C.isDirty&&(d=a.isDirty,a.isDirty=c.isDirty=J(),o=d!==c.isDirty);let i=r||en(y(u,e),t);d=!!(!r&&y(a.dirtyFields,e)),i||r?er(a.dirtyFields,e):x(a.dirtyFields,e,!0),c.dirtyFields=a.dirtyFields,o=o||C.dirtyFields&&!i!==d}if(i){let t=y(a.touchedFields,e);t||(x(a.touchedFields,e,i),c.touchedFields=a.touchedFields,o=o||C.touchedFields&&t!==i)}o&&s&&T.state.next(c)}return o?c:{}},H=(e,i,n,s)=>{let l=y(a.errors,e),o=C.isValid&&g(i)&&a.isValid!==i;if(r.delayError&&n?(t=V(()=>I(e,n)))(r.delayError):(clearTimeout(S),t=null,n?x(a.errors,e,n):er(a.errors,e)),(n?!en(l,n):l)||!Z(s)||o){let t={...s,...o&&g(i)?{isValid:i}:{},errors:a.errors,name:e};a={...a,...t},T.state.next(t)}},q=async e=>{R(e,!0);let t=await r.resolver(f,r.context,ep(e||b.mount,l,r.criteriaMode,r.shouldUseNativeValidation));return R(e),t},Y=async e=>{let{errors:t}=await q(e);if(e)for(let r of e){let e=y(t,r);e?x(a.errors,r,e):er(a.errors,r)}else a.errors=t;return t},G=async(e,t,i={valid:!0})=>{for(let n in e){let s=e[n];if(s){let{_f:e,...l}=s;if(e){let l=b.array.has(e.name),o=s._f&&ey(s._f);o&&C.validatingFields&&R([n],!0);let d=await et(s,f,E,r.shouldUseNativeValidation&&!t,l);if(o&&C.validatingFields&&R([n]),d[e.name]&&(i.valid=!1,t))break;t||(y(d,e.name)?l?$(a.errors,d,e.name):x(a.errors,e.name,d[e.name]):er(a.errors,e.name))}Z(l)||await G(l,t,i)}}return i.valid},J=(e,t)=>!r.disabled&&(e&&t&&x(f,e,t),!en(ek(),u)),X=(e,t,r)=>D(e,b,{..._.mount?f:v(t)?u:F(e)?{[e]:t}:t},r,t),Q=(e,t,r={})=>{let a=y(l,e),n=t;if(a){let r=a._f;r&&(r.disabled||x(f,e,ef(t,r)),n=z(r.ref)&&s(t)?"":t,es(r.ref)?[...r.ref.options].forEach(e=>e.selected=n.includes(e.value)):r.refs?i(r.ref)?r.refs.length>1?r.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(n)?!!n.find(t=>t===e.value):n===e.value)):r.refs[0]&&(r.refs[0].checked=!!n):r.refs.forEach(e=>e.checked=e.value===n):U(r.ref)?r.ref.value="":(r.ref.value=n,r.ref.type||T.values.next({name:e,values:{...f}})))}(r.shouldDirty||r.shouldTouch)&&K(e,n,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&ev(e)},ee=(e,t,r)=>{for(let a in t){let i=t[a],s=`${e}.${a}`,d=y(l,s);(b.array.has(e)||o(i)||d&&!d._f)&&!n(i)?ee(s,i,r):Q(s,i,r)}},ei=(e,t,r={})=>{let i=y(l,e),n=b.array.has(e),o=p(t);x(f,e,o),n?(T.array.next({name:e,values:{...f}}),(C.isDirty||C.dirtyFields)&&r.shouldDirty&&T.state.next({name:e,dirtyFields:ec(u,f),isDirty:J(e,o)})):!i||i._f||s(o)?Q(e,o,r):ee(e,o,r),M(e,b)&&T.state.next({...a}),T.values.next({name:_.mount?e:void 0,values:{...f}})},ed=async e=>{_.mount=!0;let i=e.target,s=i.name,o=!0,u=y(l,s),c=e=>{o=Number.isNaN(e)||n(e)&&isNaN(e.getTime())||en(e,y(f,s,e))};if(u){let n,h;let p=i.type?eh(u._f):d(e),m=e.type===w.BLUR||e.type===w.FOCUS_OUT,v=!eg(u._f)&&!r.resolver&&!y(a.errors,s)&&!u._f.deps||eb(m,y(a.touchedFields,s),a.isSubmitted,j,A),g=M(s,b,m);x(f,s,p),m?(u._f.onBlur&&u._f.onBlur(e),t&&t(0)):u._f.onChange&&u._f.onChange(e);let _=K(s,p,m,!1),k=!Z(_)||g;if(m||T.values.next({name:s,type:e.type,values:{...f}}),v)return C.isValid&&("onBlur"===r.mode?m&&N():N()),k&&T.state.next({name:s,...g?{}:_});if(!m&&g&&T.state.next({...a}),r.resolver){let{errors:e}=await q([s]);if(c(p),o){let t=e_(a.errors,l,s),r=e_(e,l,t.name||s);n=r.error,s=r.name,h=Z(e)}}else R([s],!0),n=(await et(u,f,E,r.shouldUseNativeValidation))[s],R([s]),c(p),o&&(n?h=!1:C.isValid&&(h=await G(l,!0)));o&&(u._f.deps&&ev(u._f.deps),H(s,h,n,_))}},eu=(e,t)=>{if(y(a.errors,t)&&e.focus)return e.focus(),1},ev=async(e,t={})=>{let i,n;let s=O(e);if(r.resolver){let t=await Y(v(e)?e:s);i=Z(t),n=e?!s.some(e=>y(t,e)):i}else e?((n=(await Promise.all(s.map(async e=>{let t=y(l,e);return await G(t&&t._f?{[e]:t}:t)}))).every(Boolean))||a.isValid)&&N():n=i=await G(l);return T.state.next({...!F(e)||C.isValid&&i!==a.isValid?{}:{name:e},...r.resolver||!e?{isValid:i}:{},errors:a.errors}),t.shouldFocus&&!n&&L(l,eu,e?s:b.mount),n},ek=e=>{let t={..._.mount?f:u};return v(e)?t:F(e)?y(t,e):e.map(e=>y(t,e))},eS=(e,t)=>({invalid:!!y((t||a).errors,e),isDirty:!!y((t||a).dirtyFields,e),error:y((t||a).errors,e),isValidating:!!y(a.validatingFields,e),isTouched:!!y((t||a).touchedFields,e)}),eC=(e,t,r)=>{let i=(y(l,e,{_f:{}})._f||{}).ref,{ref:n,message:s,type:o,...d}=y(a.errors,e)||{};x(a.errors,e,{...d,...t,ref:i}),T.state.next({name:e,errors:a.errors,isValid:!1}),r&&r.shouldFocus&&i&&i.focus&&i.focus()},eT=(e,t={})=>{for(let i of e?O(e):b.mount)b.mount.delete(i),b.array.delete(i),t.keepValue||(er(l,i),er(f,i)),t.keepError||er(a.errors,i),t.keepDirty||er(a.dirtyFields,i),t.keepTouched||er(a.touchedFields,i),t.keepIsValidating||er(a.validatingFields,i),r.shouldUnregister||t.keepDefaultValue||er(u,i);T.values.next({values:{...f}}),T.state.next({...a,...t.keepDirty?{isDirty:J()}:{}}),t.keepIsValid||N()},eA=({disabled:e,name:t,field:r,fields:a,value:i})=>{if(g(e)&&_.mount||e){let n=e?void 0:v(i)?eh(r?r._f:y(a,t)._f):i;!e&&(e||v(n))||x(f,t,n),K(t,n,!1,!1,!0)}},ej=(e,t={})=>{let a=y(l,e),i=g(t.disabled)||g(r.disabled);return x(l,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...t}}),b.mount.add(e),a?eA({field:a,disabled:g(t.disabled)?t.disabled:r.disabled,name:e,value:t.value}):W(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:em(t.min),max:em(t.max),minLength:em(t.minLength),maxLength:em(t.maxLength),pattern:em(t.pattern)}:{},name:e,onChange:ed,onBlur:ed,ref:i=>{if(i){ej(e,t),a=y(l,e);let r=v(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,n=el(r),s=a._f.refs||[];(n?s.find(e=>e===r):r===a._f.ref)||(x(l,e,{_f:{...a._f,...n?{refs:[...s.filter(eo),r,...Array.isArray(y(u,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),W(e,!1,void 0,r))}else(a=y(l,e,{}))._f&&(a._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&!(c(b.array,e)&&_.action)&&b.unMount.add(e)}}},eZ=()=>r.shouldFocusError&&L(l,eu,b.mount),eE=(e,t)=>async i=>{let n;if(i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist()),r.disabled){t&&await t({...a.errors},i);return}let s=p(f);if(T.state.next({isSubmitting:!0}),r.resolver){let{errors:e,values:t}=await q();a.errors=e,s=t}else await G(l);if(er(a.errors,"root"),Z(a.errors)){T.state.next({errors:{}});try{await e(s,i)}catch(e){n=e}}else t&&await t({...a.errors},i),eZ(),setTimeout(eZ);if(T.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Z(a.errors)&&!n,submitCount:a.submitCount+1,errors:a.errors}),n)throw n},eO=(e,t={})=>{let i=e?p(e):u,n=p(i),s=Z(e),o=s?u:n;if(t.keepDefaultValues||(u=i),!t.keepValues){if(t.keepDirtyValues)for(let e of Array.from(new Set([...b.mount,...Object.keys(ec(u,f))])))y(a.dirtyFields,e)?x(o,e,y(f,e)):ei(e,y(o,e));else{if(h&&v(e))for(let e of b.mount){let t=y(l,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(z(e)){let t=e.closest("form");if(t){t.reset();break}}}}l={}}f=r.shouldUnregister?t.keepDefaultValues?p(u):{}:p(o),T.array.next({values:{...o}}),T.values.next({values:{...o}})}b={mount:t.keepDirtyValues?b.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},_.mount=!C.isValid||!!t.keepIsValid||!!t.keepDirtyValues,_.watch=!!r.shouldUnregister,T.state.next({submitCount:t.keepSubmitCount?a.submitCount:0,isDirty:!s&&(t.keepDirty?a.isDirty:!!(t.keepDefaultValues&&!en(e,u))),isSubmitted:!!t.keepIsSubmitted&&a.isSubmitted,dirtyFields:s?{}:t.keepDirtyValues?t.keepDefaultValues&&f?ec(u,f):a.dirtyFields:t.keepDefaultValues&&e?ec(u,e):t.keepDirty?a.dirtyFields:{},touchedFields:t.keepTouched?a.touchedFields:{},errors:t.keepErrors?a.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&a.isSubmitSuccessful,isSubmitting:!1})},eV=(e,t)=>eO(B(e)?e(f):e,t);return{control:{register:ej,unregister:eT,getFieldState:eS,handleSubmit:eE,setError:eC,_executeSchema:q,_getWatch:X,_getDirty:J,_updateValid:N,_removeUnmounted:()=>{for(let e of b.unMount){let t=y(l,e);t&&(t._f.refs?t._f.refs.every(e=>!eo(e)):!eo(t._f.ref))&&eT(e)}b.unMount=new Set},_updateFieldArray:(e,t=[],i,n,s=!0,o=!0)=>{if(n&&i&&!r.disabled){if(_.action=!0,o&&Array.isArray(y(l,e))){let t=i(y(l,e),n.argA,n.argB);s&&x(l,e,t)}if(o&&Array.isArray(y(a.errors,e))){let t=i(y(a.errors,e),n.argA,n.argB);s&&x(a.errors,e,t),ex(a.errors,e)}if(C.touchedFields&&o&&Array.isArray(y(a.touchedFields,e))){let t=i(y(a.touchedFields,e),n.argA,n.argB);s&&x(a.touchedFields,e,t)}C.dirtyFields&&(a.dirtyFields=ec(u,f)),T.state.next({name:e,isDirty:J(e,t),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else x(f,e,t)},_updateDisabledField:eA,_getFieldArray:e=>m(y(_.mount?f:u,e,r.shouldUnregister?y(u,e,[]):[])),_reset:eO,_resetDefaultValues:()=>B(r.defaultValues)&&r.defaultValues().then(e=>{eV(e,r.resetOptions),T.state.next({isLoading:!1})}),_updateFormState:e=>{a={...a,...e}},_disableForm:e=>{g(e)&&(T.state.next({disabled:e}),L(l,(t,r)=>{let a=y(l,r);a&&(t.disabled=a._f.disabled||e,Array.isArray(a._f.refs)&&a._f.refs.forEach(t=>{t.disabled=a._f.disabled||e}))},0,!1))},_subjects:T,_proxyFormState:C,_setErrors:e=>{a.errors=e,T.state.next({errors:a.errors,isValid:!1})},get _fields(){return l},get _formValues(){return f},get _state(){return _},set _state(value){_=value},get _defaultValues(){return u},get _names(){return b},set _names(value){b=value},get _formState(){return a},set _formState(value){a=value},get _options(){return r},set _options(value){r={...r,...value}}},trigger:ev,register:ej,handleSubmit:eE,watch:(e,t)=>B(e)?T.values.subscribe({next:r=>e(X(void 0,t),r)}):X(e,t,!0),setValue:ei,getValues:ek,reset:eV,resetField:(e,t={})=>{y(l,e)&&(v(t.defaultValue)?ei(e,p(y(u,e))):(ei(e,t.defaultValue),x(u,e,p(t.defaultValue))),t.keepTouched||er(a.touchedFields,e),t.keepDirty||(er(a.dirtyFields,e),a.isDirty=t.defaultValue?J(e,p(y(u,e))):J()),!t.keepError&&(er(a.errors,e),C.isValid&&N()),T.state.next({...a}))},clearErrors:e=>{e&&O(e).forEach(e=>er(a.errors,e)),T.state.next({errors:e?a.errors:{}})},unregister:eT,setError:eC,setFocus:(e,t={})=>{let r=y(l,e),a=r&&r._f;if(a){let e=a.refs?a.refs[0]:a.ref;e.focus&&(e.focus(),t.shouldSelect&&B(e.select)&&e.select())}},getFieldState:eS}}(e),formState:l});let f=t.current.control;return f._options=e,N({subject:f._subjects.state,next:e=>{E(e,f._proxyFormState,f._updateFormState,!0)&&u({...f._formState})}}),a.useEffect(()=>f._disableForm(e.disabled),[f,e.disabled]),a.useEffect(()=>{if(f._proxyFormState.isDirty){let e=f._getDirty();e!==l.isDirty&&f._subjects.state.next({isDirty:e})}},[f,l.isDirty]),a.useEffect(()=>{e.values&&!en(e.values,r.current)?(f._reset(e.values,f._options.resetOptions),r.current=e.values,u(e=>({...e}))):f._resetDefaultValues()},[e.values,f]),a.useEffect(()=>{e.errors&&f._setErrors(e.errors)},[e.errors,f]),a.useEffect(()=>{f._state.mount||(f._updateValid(),f._state.mount=!0),f._state.watch&&(f._state.watch=!1,f._subjects.state.next({...f._formState})),f._removeUnmounted()}),a.useEffect(()=>{e.shouldUnregister&&f._subjects.values.next({values:f._getWatch()})},[e.shouldUnregister,f]),t.current.formState=j(l,f),t.current}},31229:function(e,t,r){let a;r.d(t,{z:function(){return tc}}),(tr=tn||(tn={})).assertEqual=e=>e,tr.assertIs=function(e){},tr.assertNever=function(e){throw Error()},tr.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},tr.getValidEnumValues=e=>{let t=tr.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return tr.objectValues(r)},tr.objectValues=e=>tr.objectKeys(e).map(function(t){return e[t]}),tr.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},tr.find=(e,t)=>{for(let r of e)if(t(r))return r},tr.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,tr.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},tr.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(ts||(ts={})).mergeShapes=(e,t)=>({...e,...t});let i=tn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),n=e=>{switch(typeof e){case"undefined":return i.undefined;case"string":return i.string;case"number":return isNaN(e)?i.nan:i.number;case"boolean":return i.boolean;case"function":return i.function;case"bigint":return i.bigint;case"symbol":return i.symbol;case"object":if(Array.isArray(e))return i.array;if(null===e)return i.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return i.promise;if("undefined"!=typeof Map&&e instanceof Map)return i.map;if("undefined"!=typeof Set&&e instanceof Set)return i.set;if("undefined"!=typeof Date&&e instanceof Date)return i.date;return i.object;default:return i.unknown}},s=tn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class l extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(let i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(a);else if("invalid_return_type"===i.code)a(i.returnTypeError);else if("invalid_arguments"===i.code)a(i.argumentsError);else if(0===i.path.length)r._errors.push(t(i));else{let e=r,a=0;for(;a<i.path.length;){let r=i.path[a];a===i.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(i))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof l))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,tn.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}l.create=e=>new l(e);let o=(e,t)=>{let r;switch(e.code){case s.invalid_type:r=e.received===i.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case s.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,tn.jsonStringifyReplacer)}`;break;case s.unrecognized_keys:r=`Unrecognized key(s) in object: ${tn.joinValues(e.keys,", ")}`;break;case s.invalid_union:r="Invalid input";break;case s.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${tn.joinValues(e.options)}`;break;case s.invalid_enum_value:r=`Invalid enum value. Expected ${tn.joinValues(e.options)}, received '${e.received}'`;break;case s.invalid_arguments:r="Invalid function arguments";break;case s.invalid_return_type:r="Invalid function return type";break;case s.invalid_date:r="Invalid date";break;case s.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:tn.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case s.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case s.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case s.custom:r="Invalid input";break;case s.invalid_intersection_types:r="Intersection results could not be merged";break;case s.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case s.not_finite:r="Number must be finite";break;default:r=t.defaultError,tn.assertNever(e)}return{message:r}},d=o;function u(){return d}let c=e=>{let{data:t,path:r,errorMaps:a,issueData:i}=e,n=[...r,...i.path||[]],s={...i,path:n};if(void 0!==i.message)return{...i,path:n,message:i.message};let l="";for(let e of a.filter(e=>!!e).slice().reverse())l=e(s,{data:t,defaultError:l}).message;return{...i,path:n,message:l}};function f(e,t){let r=u(),a=c({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===o?void 0:o].filter(e=>!!e)});e.common.issues.push(a)}class h{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if("aborted"===a.status)return p;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,a=await e.value;r.push({key:t,value:a})}return h.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:t,value:i}=a;if("aborted"===t.status||"aborted"===i.status)return p;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==i.value||a.alwaysSet)&&(r[t.value]=i.value)}return{status:e.value,value:r}}}let p=Object.freeze({status:"aborted"}),m=e=>({status:"dirty",value:e}),v=e=>({status:"valid",value:e}),y=e=>"aborted"===e.status,g=e=>"dirty"===e.status,_=e=>"valid"===e.status,b=e=>"undefined"!=typeof Promise&&e instanceof Promise;function x(e,t,r,a){if("a"===r&&!a)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?a:"a"===r?a.call(e):a?a.value:t.get(e)}function w(e,t,r,a,i){if("m"===a)throw TypeError("Private method is not writable");if("a"===a&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,r):i?i.value=r:t.set(e,r),r}"function"==typeof SuppressedError&&SuppressedError,(ta=tl||(tl={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},ta.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class k{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let S=(e,t)=>{if(_(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new l(e.common.issues);return this._error=t,this._error}}};function C(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:i}=e;if(t&&(r||a))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{var n,s;let{message:l}=e;return"invalid_enum_value"===t.code?{message:null!=l?l:i.defaultError}:void 0===i.data?{message:null!==(n=null!=l?l:a)&&void 0!==n?n:i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:null!==(s=null!=l?l:r)&&void 0!==s?s:i.defaultError}},description:i}}class T{get description(){return this._def.description}_getType(e){return n(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new h,ctx:{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(b(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let a={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},i=this._parseSync({data:e,path:a.path,parent:a});return S(a,i)}"~validate"(e){var t,r;let a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)};if(!this["~standard"].async)try{let t=this._parseSync({data:e,path:[],parent:a});return _(t)?{value:t.value}:{issues:a.common.issues}}catch(e){(null===(r=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(e=>_(e)?{value:e.value}:{issues:a.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},a=this._parse({data:e,path:r.path,parent:r});return S(r,await (b(a)?a:Promise.resolve(a)))}refine(e,t){let r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,a)=>{let i=e(t),n=()=>a.addIssue({code:s.custom,...r(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(n(),!1)):!!i||(n(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new eb({schema:this,typeName:tu.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ex.create(this,this._def)}nullable(){return ew.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ea.create(this)}promise(){return e_.create(this,this._def)}or(e){return en.create([this,e],this._def)}and(e){return eo.create(this,e,this._def)}transform(e){return new eb({...C(this._def),schema:this,typeName:tu.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ek({...C(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:tu.ZodDefault})}brand(){return new eA({typeName:tu.ZodBranded,type:this,...C(this._def)})}catch(e){return new eS({...C(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:tu.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return ej.create(this,e)}readonly(){return eZ.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let A=/^c[^\s-]{8,}$/i,j=/^[0-9a-z]+$/,Z=/^[0-9A-HJKMNP-TV-Z]{26}$/i,E=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,O=/^[a-z0-9_-]{21}$/i,V=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,N=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,F=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,D=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,R=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,I=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,P=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,M=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,L=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",U=RegExp(`^${$}$`);function B(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function z(e){let t=`${$}T${B(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)}class W extends T{_parse(e){var t,r,n,l;let o;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==i.string){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.string,received:t.parsedType}),p}let d=new h;for(let i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(f(o=this._getOrReturnCtx(e,o),{code:s.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),d.dirty());else if("max"===i.kind)e.data.length>i.value&&(f(o=this._getOrReturnCtx(e,o),{code:s.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),d.dirty());else if("length"===i.kind){let t=e.data.length>i.value,r=e.data.length<i.value;(t||r)&&(o=this._getOrReturnCtx(e,o),t?f(o,{code:s.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):r&&f(o,{code:s.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),d.dirty())}else if("email"===i.kind)F.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{validation:"email",code:s.invalid_string,message:i.message}),d.dirty());else if("emoji"===i.kind)a||(a=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),a.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{validation:"emoji",code:s.invalid_string,message:i.message}),d.dirty());else if("uuid"===i.kind)E.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{validation:"uuid",code:s.invalid_string,message:i.message}),d.dirty());else if("nanoid"===i.kind)O.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{validation:"nanoid",code:s.invalid_string,message:i.message}),d.dirty());else if("cuid"===i.kind)A.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{validation:"cuid",code:s.invalid_string,message:i.message}),d.dirty());else if("cuid2"===i.kind)j.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{validation:"cuid2",code:s.invalid_string,message:i.message}),d.dirty());else if("ulid"===i.kind)Z.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{validation:"ulid",code:s.invalid_string,message:i.message}),d.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(t){f(o=this._getOrReturnCtx(e,o),{validation:"url",code:s.invalid_string,message:i.message}),d.dirty()}else"regex"===i.kind?(i.regex.lastIndex=0,i.regex.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{validation:"regex",code:s.invalid_string,message:i.message}),d.dirty())):"trim"===i.kind?e.data=e.data.trim():"includes"===i.kind?e.data.includes(i.value,i.position)||(f(o=this._getOrReturnCtx(e,o),{code:s.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),d.dirty()):"toLowerCase"===i.kind?e.data=e.data.toLowerCase():"toUpperCase"===i.kind?e.data=e.data.toUpperCase():"startsWith"===i.kind?e.data.startsWith(i.value)||(f(o=this._getOrReturnCtx(e,o),{code:s.invalid_string,validation:{startsWith:i.value},message:i.message}),d.dirty()):"endsWith"===i.kind?e.data.endsWith(i.value)||(f(o=this._getOrReturnCtx(e,o),{code:s.invalid_string,validation:{endsWith:i.value},message:i.message}),d.dirty()):"datetime"===i.kind?z(i).test(e.data)||(f(o=this._getOrReturnCtx(e,o),{code:s.invalid_string,validation:"datetime",message:i.message}),d.dirty()):"date"===i.kind?U.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{code:s.invalid_string,validation:"date",message:i.message}),d.dirty()):"time"===i.kind?RegExp(`^${B(i)}$`).test(e.data)||(f(o=this._getOrReturnCtx(e,o),{code:s.invalid_string,validation:"time",message:i.message}),d.dirty()):"duration"===i.kind?N.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{validation:"duration",code:s.invalid_string,message:i.message}),d.dirty()):"ip"===i.kind?(t=e.data,("v4"===(r=i.version)||!r)&&D.test(t)||("v6"===r||!r)&&I.test(t)||(f(o=this._getOrReturnCtx(e,o),{validation:"ip",code:s.invalid_string,message:i.message}),d.dirty())):"jwt"===i.kind?!function(e,t){if(!V.test(e))return!1;try{let[r]=e.split("."),a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(a));if("object"!=typeof i||null===i||!i.typ||!i.alg||t&&i.alg!==t)return!1;return!0}catch(e){return!1}}(e.data,i.alg)&&(f(o=this._getOrReturnCtx(e,o),{validation:"jwt",code:s.invalid_string,message:i.message}),d.dirty()):"cidr"===i.kind?(n=e.data,("v4"===(l=i.version)||!l)&&R.test(n)||("v6"===l||!l)&&P.test(n)||(f(o=this._getOrReturnCtx(e,o),{validation:"cidr",code:s.invalid_string,message:i.message}),d.dirty())):"base64"===i.kind?M.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{validation:"base64",code:s.invalid_string,message:i.message}),d.dirty()):"base64url"===i.kind?L.test(e.data)||(f(o=this._getOrReturnCtx(e,o),{validation:"base64url",code:s.invalid_string,message:i.message}),d.dirty()):tn.assertNever(i);return{status:d.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:s.invalid_string,...tl.errToObj(r)})}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...tl.errToObj(e)})}url(e){return this._addCheck({kind:"url",...tl.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...tl.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...tl.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...tl.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...tl.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...tl.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...tl.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...tl.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...tl.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...tl.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...tl.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...tl.errToObj(e)})}datetime(e){var t,r;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...tl.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...tl.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...tl.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...tl.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...tl.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...tl.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...tl.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...tl.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...tl.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...tl.errToObj(t)})}nonempty(e){return this.min(1,tl.errToObj(e))}trim(){return new W({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new W({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new W({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}W.create=e=>{var t;return new W({checks:[],typeName:tu.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...C(e)})};class K extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==i.number){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.number,received:t.parsedType}),p}let r=new h;for(let a of this._def.checks)"int"===a.kind?tn.isInteger(e.data)||(f(t=this._getOrReturnCtx(e,t),{code:s.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(f(t=this._getOrReturnCtx(e,t),{code:s.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(f(t=this._getOrReturnCtx(e,t),{code:s.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,i=r>a?r:a;return parseInt(e.toFixed(i).replace(".",""))%parseInt(t.toFixed(i).replace(".",""))/Math.pow(10,i)}(e.data,a.value)&&(f(t=this._getOrReturnCtx(e,t),{code:s.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(f(t=this._getOrReturnCtx(e,t),{code:s.not_finite,message:a.message}),r.dirty()):tn.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,tl.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tl.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tl.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tl.toString(t))}setLimit(e,t,r,a){return new K({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tl.toString(a)}]})}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:tl.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tl.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tl.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tl.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tl.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tl.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:tl.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tl.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tl.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&tn.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}K.create=e=>new K({checks:[],typeName:tu.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...C(e)});class H extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==i.bigint)return this._getInvalidInput(e);let r=new h;for(let a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(f(t=this._getOrReturnCtx(e,t),{code:s.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(f(t=this._getOrReturnCtx(e,t),{code:s.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(f(t=this._getOrReturnCtx(e,t),{code:s.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):tn.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.bigint,received:t.parsedType}),p}gte(e,t){return this.setLimit("min",e,!0,tl.toString(t))}gt(e,t){return this.setLimit("min",e,!1,tl.toString(t))}lte(e,t){return this.setLimit("max",e,!0,tl.toString(t))}lt(e,t){return this.setLimit("max",e,!1,tl.toString(t))}setLimit(e,t,r,a){return new H({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:tl.toString(a)}]})}_addCheck(e){return new H({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tl.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tl.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tl.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tl.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:tl.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}H.create=e=>{var t;return new H({checks:[],typeName:tu.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...C(e)})};class q extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==i.boolean){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.boolean,received:t.parsedType}),p}return v(e.data)}}q.create=e=>new q({typeName:tu.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...C(e)});class Y extends T{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==i.date){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.date,received:t.parsedType}),p}if(isNaN(e.data.getTime()))return f(this._getOrReturnCtx(e),{code:s.invalid_date}),p;let r=new h;for(let a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(f(t=this._getOrReturnCtx(e,t),{code:s.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(f(t=this._getOrReturnCtx(e,t),{code:s.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):tn.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:tl.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:tl.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Y.create=e=>new Y({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:tu.ZodDate,...C(e)});class G extends T{_parse(e){if(this._getType(e)!==i.symbol){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.symbol,received:t.parsedType}),p}return v(e.data)}}G.create=e=>new G({typeName:tu.ZodSymbol,...C(e)});class J extends T{_parse(e){if(this._getType(e)!==i.undefined){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.undefined,received:t.parsedType}),p}return v(e.data)}}J.create=e=>new J({typeName:tu.ZodUndefined,...C(e)});class X extends T{_parse(e){if(this._getType(e)!==i.null){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.null,received:t.parsedType}),p}return v(e.data)}}X.create=e=>new X({typeName:tu.ZodNull,...C(e)});class Q extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return v(e.data)}}Q.create=e=>new Q({typeName:tu.ZodAny,...C(e)});class ee extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return v(e.data)}}ee.create=e=>new ee({typeName:tu.ZodUnknown,...C(e)});class et extends T{_parse(e){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.never,received:t.parsedType}),p}}et.create=e=>new et({typeName:tu.ZodNever,...C(e)});class er extends T{_parse(e){if(this._getType(e)!==i.undefined){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.void,received:t.parsedType}),p}return v(e.data)}}er.create=e=>new er({typeName:tu.ZodVoid,...C(e)});class ea extends T{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==i.array)return f(t,{code:s.invalid_type,expected:i.array,received:t.parsedType}),p;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(f(t,{code:e?s.too_big:s.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(f(t,{code:s.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(f(t,{code:s.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>a.type._parseAsync(new k(t,e,t.path,r)))).then(e=>h.mergeArray(r,e));let n=[...t.data].map((e,r)=>a.type._parseSync(new k(t,e,t.path,r)));return h.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new ea({...this._def,minLength:{value:e,message:tl.toString(t)}})}max(e,t){return new ea({...this._def,maxLength:{value:e,message:tl.toString(t)}})}length(e,t){return new ea({...this._def,exactLength:{value:e,message:tl.toString(t)}})}nonempty(e){return this.min(1,e)}}ea.create=(e,t)=>new ea({type:e,minLength:null,maxLength:null,exactLength:null,typeName:tu.ZodArray,...C(t)});class ei extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=tn.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==i.object){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.object,received:t.parsedType}),p}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:n}=this._getCached(),l=[];if(!(this._def.catchall instanceof et&&"strip"===this._def.unknownKeys))for(let e in r.data)n.includes(e)||l.push(e);let o=[];for(let e of n){let t=a[e],i=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new k(r,i,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof et){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of l)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)l.length>0&&(f(r,{code:s.unrecognized_keys,keys:l}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of l){let a=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new k(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>h.mergeObjectSync(t,e)):h.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return tl.errToObj,new ei({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var a,i,n,s;let l=null!==(n=null===(i=(a=this._def).errorMap)||void 0===i?void 0:i.call(a,t,r).message)&&void 0!==n?n:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(s=tl.errToObj(e).message)&&void 0!==s?s:l}:{message:l}}}:{}})}strip(){return new ei({...this._def,unknownKeys:"strip"})}passthrough(){return new ei({...this._def,unknownKeys:"passthrough"})}extend(e){return new ei({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ei({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:tu.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ei({...this._def,catchall:e})}pick(e){let t={};return tn.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new ei({...this._def,shape:()=>t})}omit(e){let t={};return tn.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new ei({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof ei){let r={};for(let a in t.shape){let i=t.shape[a];r[a]=ex.create(e(i))}return new ei({...t._def,shape:()=>r})}return t instanceof ea?new ea({...t._def,type:e(t.element)}):t instanceof ex?ex.create(e(t.unwrap())):t instanceof ew?ew.create(e(t.unwrap())):t instanceof ed?ed.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};return tn.objectKeys(this.shape).forEach(r=>{let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}),new ei({...this._def,shape:()=>t})}required(e){let t={};return tn.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof ex;)e=e._def.innerType;t[r]=e}}),new ei({...this._def,shape:()=>t})}keyof(){return ev(tn.objectKeys(this.shape))}}ei.create=(e,t)=>new ei({shape:()=>e,unknownKeys:"strip",catchall:et.create(),typeName:tu.ZodObject,...C(t)}),ei.strictCreate=(e,t)=>new ei({shape:()=>e,unknownKeys:"strict",catchall:et.create(),typeName:tu.ZodObject,...C(t)}),ei.lazycreate=(e,t)=>new ei({shape:e,unknownKeys:"strip",catchall:et.create(),typeName:tu.ZodObject,...C(t)});class en extends T{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new l(e.ctx.common.issues));return f(t,{code:s.invalid_union,unionErrors:r}),p});{let e;let a=[];for(let i of r){let r={...t,common:{...t.common,issues:[]},parent:null},n=i._parseSync({data:t.data,path:t.path,parent:r});if("valid"===n.status)return n;"dirty"!==n.status||e||(e={result:n,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=a.map(e=>new l(e));return f(t,{code:s.invalid_union,unionErrors:i}),p}}get options(){return this._def.options}}en.create=(e,t)=>new en({options:e,typeName:tu.ZodUnion,...C(t)});let es=e=>{if(e instanceof ep)return es(e.schema);if(e instanceof eb)return es(e.innerType());if(e instanceof em)return[e.value];if(e instanceof ey)return e.options;if(e instanceof eg)return tn.objectValues(e.enum);if(e instanceof ek)return es(e._def.innerType);if(e instanceof J)return[void 0];else if(e instanceof X)return[null];else if(e instanceof ex)return[void 0,...es(e.unwrap())];else if(e instanceof ew)return[null,...es(e.unwrap())];else if(e instanceof eA)return es(e.unwrap());else if(e instanceof eZ)return es(e.unwrap());else if(e instanceof eS)return es(e._def.innerType);else return[]};class el extends T{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return f(t,{code:s.invalid_type,expected:i.object,received:t.parsedType}),p;let r=this.discriminator,a=t.data[r],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(f(t,{code:s.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),p)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let r of t){let t=es(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of t){if(a.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);a.set(i,r)}}return new el({typeName:tu.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...C(r)})}}class eo extends T{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if(y(e)||y(a))return p;let l=function e(t,r){let a=n(t),s=n(r);if(t===r)return{valid:!0,data:t};if(a===i.object&&s===i.object){let a=tn.objectKeys(r),i=tn.objectKeys(t).filter(e=>-1!==a.indexOf(e)),n={...t,...r};for(let a of i){let i=e(t[a],r[a]);if(!i.valid)return{valid:!1};n[a]=i.data}return{valid:!0,data:n}}if(a===i.array&&s===i.array){if(t.length!==r.length)return{valid:!1};let a=[];for(let i=0;i<t.length;i++){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1};a.push(n.data)}return{valid:!0,data:a}}return a===i.date&&s===i.date&&+t==+r?{valid:!0,data:t}:{valid:!1}}(e.value,a.value);return l.valid?((g(e)||g(a))&&t.dirty(),{status:t.value,value:l.data}):(f(r,{code:s.invalid_intersection_types}),p)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}eo.create=(e,t,r)=>new eo({left:e,right:t,typeName:tu.ZodIntersection,...C(r)});class ed extends T{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.array)return f(r,{code:s.invalid_type,expected:i.array,received:r.parsedType}),p;if(r.data.length<this._def.items.length)return f(r,{code:s.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;!this._def.rest&&r.data.length>this._def.items.length&&(f(r,{code:s.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((e,t)=>{let a=this._def.items[t]||this._def.rest;return a?a._parse(new k(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>h.mergeArray(t,e)):h.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ed({...this._def,rest:e})}}ed.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ed({items:e,typeName:tu.ZodTuple,rest:null,...C(t)})};class eu extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.object)return f(r,{code:s.invalid_type,expected:i.object,received:r.parsedType}),p;let a=[],n=this._def.keyType,l=this._def.valueType;for(let e in r.data)a.push({key:n._parse(new k(r,e,r.path,e)),value:l._parse(new k(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?h.mergeObjectAsync(t,a):h.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new eu(t instanceof T?{keyType:e,valueType:t,typeName:tu.ZodRecord,...C(r)}:{keyType:W.create(),valueType:e,typeName:tu.ZodRecord,...C(t)})}}class ec extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.map)return f(r,{code:s.invalid_type,expected:i.map,received:r.parsedType}),p;let a=this._def.keyType,n=this._def.valueType,l=[...r.data.entries()].map(([e,t],i)=>({key:a._parse(new k(r,e,r.path,[i,"key"])),value:n._parse(new k(r,t,r.path,[i,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of l){let a=await r.key,i=await r.value;if("aborted"===a.status||"aborted"===i.status)return p;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of l){let a=r.key,i=r.value;if("aborted"===a.status||"aborted"===i.status)return p;("dirty"===a.status||"dirty"===i.status)&&t.dirty(),e.set(a.value,i.value)}return{status:t.value,value:e}}}}ec.create=(e,t,r)=>new ec({valueType:t,keyType:e,typeName:tu.ZodMap,...C(r)});class ef extends T{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==i.set)return f(r,{code:s.invalid_type,expected:i.set,received:r.parsedType}),p;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(f(r,{code:s.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(f(r,{code:s.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let n=this._def.valueType;function l(e){let r=new Set;for(let a of e){if("aborted"===a.status)return p;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let o=[...r.data.values()].map((e,t)=>n._parse(new k(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>l(e)):l(o)}min(e,t){return new ef({...this._def,minSize:{value:e,message:tl.toString(t)}})}max(e,t){return new ef({...this._def,maxSize:{value:e,message:tl.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ef.create=(e,t)=>new ef({valueType:e,minSize:null,maxSize:null,typeName:tu.ZodSet,...C(t)});class eh extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return f(t,{code:s.invalid_type,expected:i.function,received:t.parsedType}),p;function r(e,r){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,u(),o].filter(e=>!!e),issueData:{code:s.invalid_arguments,argumentsError:r}})}function a(e,r){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,u(),o].filter(e=>!!e),issueData:{code:s.invalid_return_type,returnTypeError:r}})}let n={errorMap:t.common.contextualErrorMap},d=t.data;if(this._def.returns instanceof e_){let e=this;return v(async function(...t){let i=new l([]),s=await e._def.args.parseAsync(t,n).catch(e=>{throw i.addIssue(r(t,e)),i}),o=await Reflect.apply(d,this,s);return await e._def.returns._def.type.parseAsync(o,n).catch(e=>{throw i.addIssue(a(o,e)),i})})}{let e=this;return v(function(...t){let i=e._def.args.safeParse(t,n);if(!i.success)throw new l([r(t,i.error)]);let s=Reflect.apply(d,this,i.data),o=e._def.returns.safeParse(s,n);if(!o.success)throw new l([a(s,o.error)]);return o.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new eh({...this._def,args:ed.create(e).rest(ee.create())})}returns(e){return new eh({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new eh({args:e||ed.create([]).rest(ee.create()),returns:t||ee.create(),typeName:tu.ZodFunction,...C(r)})}}class ep extends T{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ep.create=(e,t)=>new ep({getter:e,typeName:tu.ZodLazy,...C(t)});class em extends T{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:s.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ev(e,t){return new ey({values:e,typeName:tu.ZodEnum,...C(t)})}em.create=(e,t)=>new em({value:e,typeName:tu.ZodLiteral,...C(t)});class ey extends T{constructor(){super(...arguments),to.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return f(t,{expected:tn.joinValues(r),received:t.parsedType,code:s.invalid_type}),p}if(x(this,to,"f")||w(this,to,new Set(this._def.values),"f"),!x(this,to,"f").has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return f(t,{received:t.data,code:s.invalid_enum_value,options:r}),p}return v(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ey.create(e,{...this._def,...t})}exclude(e,t=this._def){return ey.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}to=new WeakMap,ey.create=ev;class eg extends T{constructor(){super(...arguments),td.set(this,void 0)}_parse(e){let t=tn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==i.string&&r.parsedType!==i.number){let e=tn.objectValues(t);return f(r,{expected:tn.joinValues(e),received:r.parsedType,code:s.invalid_type}),p}if(x(this,td,"f")||w(this,td,new Set(tn.getValidEnumValues(this._def.values)),"f"),!x(this,td,"f").has(e.data)){let e=tn.objectValues(t);return f(r,{received:r.data,code:s.invalid_enum_value,options:e}),p}return v(e.data)}get enum(){return this._def.values}}td=new WeakMap,eg.create=(e,t)=>new eg({values:e,typeName:tu.ZodNativeEnum,...C(t)});class e_ extends T{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==i.promise&&!1===t.common.async?(f(t,{code:s.invalid_type,expected:i.promise,received:t.parsedType}),p):v((t.parsedType===i.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}e_.create=(e,t)=>new e_({type:e,typeName:tu.ZodPromise,...C(t)});class eb extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===tu.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:e=>{f(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===a.type){let e=a.transform(r.data,i);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return p;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?p:"dirty"===a.status||"dirty"===t.value?m(a.value):a});{if("aborted"===t.value)return p;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?p:"dirty"===a.status||"dirty"===t.value?m(a.value):a}}if("refinement"===a.type){let e=e=>{let t=a.refinement(e,i);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?p:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?p:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}}if("transform"===a.type){if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>_(e)?Promise.resolve(a.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!_(e))return e;let n=a.transform(e.value,i);if(n instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}}tn.assertNever(a)}}eb.create=(e,t,r)=>new eb({schema:e,typeName:tu.ZodEffects,effect:t,...C(r)}),eb.createWithPreprocess=(e,t,r)=>new eb({schema:t,effect:{type:"preprocess",transform:e},typeName:tu.ZodEffects,...C(r)});class ex extends T{_parse(e){return this._getType(e)===i.undefined?v(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ex.create=(e,t)=>new ex({innerType:e,typeName:tu.ZodOptional,...C(t)});class ew extends T{_parse(e){return this._getType(e)===i.null?v(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ew.create=(e,t)=>new ew({innerType:e,typeName:tu.ZodNullable,...C(t)});class ek extends T{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===i.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ek.create=(e,t)=>new ek({innerType:e,typeName:tu.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...C(t)});class eS extends T{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return b(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new l(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new l(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eS.create=(e,t)=>new eS({innerType:e,typeName:tu.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...C(t)});class eC extends T{_parse(e){if(this._getType(e)!==i.nan){let t=this._getOrReturnCtx(e);return f(t,{code:s.invalid_type,expected:i.nan,received:t.parsedType}),p}return{status:"valid",value:e.data}}}eC.create=e=>new eC({typeName:tu.ZodNaN,...C(e)});let eT=Symbol("zod_brand");class eA extends T{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class ej extends T{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),m(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?p:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ej({in:e,out:t,typeName:tu.ZodPipeline})}}class eZ extends T{_parse(e){let t=this._def.innerType._parse(e),r=e=>(_(e)&&(e.value=Object.freeze(e.value)),e);return b(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}function eE(e,t={},r){return e?Q.create().superRefine((a,i)=>{var n,s;if(!e(a)){let e="function"==typeof t?t(a):"string"==typeof t?{message:t}:t,l=null===(s=null!==(n=e.fatal)&&void 0!==n?n:r)||void 0===s||s;i.addIssue({code:"custom",..."string"==typeof e?{message:e}:e,fatal:l})}}):Q.create()}eZ.create=(e,t)=>new eZ({innerType:e,typeName:tu.ZodReadonly,...C(t)});let eO={object:ei.lazycreate};(ti=tu||(tu={})).ZodString="ZodString",ti.ZodNumber="ZodNumber",ti.ZodNaN="ZodNaN",ti.ZodBigInt="ZodBigInt",ti.ZodBoolean="ZodBoolean",ti.ZodDate="ZodDate",ti.ZodSymbol="ZodSymbol",ti.ZodUndefined="ZodUndefined",ti.ZodNull="ZodNull",ti.ZodAny="ZodAny",ti.ZodUnknown="ZodUnknown",ti.ZodNever="ZodNever",ti.ZodVoid="ZodVoid",ti.ZodArray="ZodArray",ti.ZodObject="ZodObject",ti.ZodUnion="ZodUnion",ti.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ti.ZodIntersection="ZodIntersection",ti.ZodTuple="ZodTuple",ti.ZodRecord="ZodRecord",ti.ZodMap="ZodMap",ti.ZodSet="ZodSet",ti.ZodFunction="ZodFunction",ti.ZodLazy="ZodLazy",ti.ZodLiteral="ZodLiteral",ti.ZodEnum="ZodEnum",ti.ZodEffects="ZodEffects",ti.ZodNativeEnum="ZodNativeEnum",ti.ZodOptional="ZodOptional",ti.ZodNullable="ZodNullable",ti.ZodDefault="ZodDefault",ti.ZodCatch="ZodCatch",ti.ZodPromise="ZodPromise",ti.ZodBranded="ZodBranded",ti.ZodPipeline="ZodPipeline",ti.ZodReadonly="ZodReadonly";let eV=W.create,eN=K.create,eF=eC.create,eD=H.create,eR=q.create,eI=Y.create,eP=G.create,eM=J.create,eL=X.create,e$=Q.create,eU=ee.create,eB=et.create,ez=er.create,eW=ea.create,eK=ei.create,eH=ei.strictCreate,eq=en.create,eY=el.create,eG=eo.create,eJ=ed.create,eX=eu.create,eQ=ec.create,e0=ef.create,e1=eh.create,e9=ep.create,e4=em.create,e2=ey.create,e5=eg.create,e6=e_.create,e3=eb.create,e8=ex.create,e7=ew.create,te=eb.createWithPreprocess,tt=ej.create;var tr,ta,ti,tn,ts,tl,to,td,tu,tc=Object.freeze({__proto__:null,defaultErrorMap:o,setErrorMap:function(e){d=e},getErrorMap:u,makeIssue:c,EMPTY_PATH:[],addIssueToContext:f,ParseStatus:h,INVALID:p,DIRTY:m,OK:v,isAborted:y,isDirty:g,isValid:_,isAsync:b,get util(){return tn},get objectUtil(){return ts},ZodParsedType:i,getParsedType:n,ZodType:T,datetimeRegex:z,ZodString:W,ZodNumber:K,ZodBigInt:H,ZodBoolean:q,ZodDate:Y,ZodSymbol:G,ZodUndefined:J,ZodNull:X,ZodAny:Q,ZodUnknown:ee,ZodNever:et,ZodVoid:er,ZodArray:ea,ZodObject:ei,ZodUnion:en,ZodDiscriminatedUnion:el,ZodIntersection:eo,ZodTuple:ed,ZodRecord:eu,ZodMap:ec,ZodSet:ef,ZodFunction:eh,ZodLazy:ep,ZodLiteral:em,ZodEnum:ey,ZodNativeEnum:eg,ZodPromise:e_,ZodEffects:eb,ZodTransformer:eb,ZodOptional:ex,ZodNullable:ew,ZodDefault:ek,ZodCatch:eS,ZodNaN:eC,BRAND:eT,ZodBranded:eA,ZodPipeline:ej,ZodReadonly:eZ,custom:eE,Schema:T,ZodSchema:T,late:eO,get ZodFirstPartyTypeKind(){return tu},coerce:{string:e=>W.create({...e,coerce:!0}),number:e=>K.create({...e,coerce:!0}),boolean:e=>q.create({...e,coerce:!0}),bigint:e=>H.create({...e,coerce:!0}),date:e=>Y.create({...e,coerce:!0})},any:e$,array:eW,bigint:eD,boolean:eR,date:eI,discriminatedUnion:eY,effect:e3,enum:e2,function:e1,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>eE(t=>t instanceof e,t),intersection:eG,lazy:e9,literal:e4,map:eQ,nan:eF,nativeEnum:e5,never:eB,null:eL,nullable:e7,number:eN,object:eK,oboolean:()=>eR().optional(),onumber:()=>eN().optional(),optional:e8,ostring:()=>eV().optional(),pipeline:tt,preprocess:te,promise:e6,record:eX,set:e0,strictObject:eH,string:eV,symbol:eP,transformer:e3,tuple:eJ,undefined:eM,union:eq,unknown:eU,void:ez,NEVER:p,ZodIssueCode:s,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:l})}}]);
@@ -1 +0,0 @@
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 _}});var n=t(57437),l=t(14675),r=t.n(l),o=t(63861),s=t(2265),i=t(56937),c=t(89203),d=t(78527),u=t(26110),m=t(33494),p=t(14308),h=t(65613),f=t(7436),v=t(25427),g=t(29501),A=t(13590),x=t(85872),b=t(34124),Z=t(6512),j=t(37104),y=t(49027);let O=()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),M=e=>fetch(e).then(e=>e.json());function E(e){let[a,t]=(0,s.useState)(!1),[l,r]=(0,s.useState)(null),[o,i]=(0,s.useState)(!0),d=(0,g.cI)({resolver:(0,A.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)(()=>{d.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,n.jsxs)(u.Vq,{open:a,onOpenChange:t,children:[(0,n.jsx)(u.hg,{children:(0,n.jsxs)("div",{className:"flex items-center text-md gap-2",children:[(0,n.jsx)(c.v,{}),"Create Agent"]})}),(0,n.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,n.jsx)(u.fK,{children:(0,n.jsx)(y.$N,{children:"Create Agent"})}),!e.userProfile&&o&&(0,n.jsx)(m.Z,{onOpenChange:i,isMobileWidth:e.isMobileWidth}),(0,n.jsx)(v.ks,{form:d,onSubmit:a=>{fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(a=>{200===a.status?(d.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:l,filesOptions:e.filesOptions,modelOptions:e.modelOptions,inputToolOptions:e.inputToolOptions,outputModeOptions:e.outputModeOptions,isSubscribed:e.isSubscribed})]})]})}function _(){let{data:e,error:a,mutate:t}=(0,o.ZP)("agents",O,{revalidateOnFocus:!1}),{data:l,error:c,isLoading:u}=(0,i.GW)(),{userConfig:g}=(0,i.h2)(!0),[A,y]=(0,s.useState)(!1),_=(0,f.IC)(),[w,V]=(0,s.useState)([]),[N,P]=(0,s.useState)([]),[L,C]=(0,s.useState)(null),{data:S,error:F}=(0,o.ZP)(g?"/api/content/computer":null,M),{data:H,error:T}=(0,o.ZP)("/api/agents/options",M),[k,I]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{k&&(t(),I(!1))},[k]),(0,s.useEffect)(()=>{if(e){V(e.filter(e=>e.creator===(null==l?void 0:l.username)));let a=e.filter(e=>"private"!==e.privacy_level&&e.creator!==(null==l?void 0:l.username));P(a);{let t=new URLSearchParams(window.location.search).get("agent");if(t){C(t);let n=e.find(e=>e.slug===t);n||(n=a.find(e=>e.slug===t)),n||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&&P(a=>[...a,e])})}}}},[e,l]),a)return(0,n.jsxs)("main",{className:r().main,children:[(0,n.jsx)("div",{className:"".concat(r().titleBar," text-5xl"),children:"Agents"}),(0,n.jsx)("div",{className:r().agentList,children:"Error loading agents"})]});if(!e)return(0,n.jsx)("main",{className:r().main,children:(0,n.jsxs)("div",{className:r().agentList,children:[(0,n.jsx)(p.l,{})," booting up your agents"]})});let R=(null==g?void 0:g.chat_model_options)||[],W=(null==g?void 0:g.selected_chat_model_config)||0,B=(null==g?void 0:g.is_active)||!1,z=R.find(e=>e.id===W);return(0,n.jsxs)(x.Hn,{children:[(0,n.jsx)(b.S,{conversationId:""}),(0,n.jsxs)(x.kV,{children:[(0,n.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,n.jsx)(x.vP,{className:"-ml-1"}),(0,n.jsx)(Z.Z,{orientation:"vertical",className:"mr-2 h-4"}),_?(0,n.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,n.jsx)(j.VO,{className:"h-auto w-16"})}):(0,n.jsx)("h2",{className:"text-lg",children:"Agents"})]}),(0,n.jsx)("main",{className:"w-full mx-auto",children:(0,n.jsx)("div",{className:"grid w-full mx-auto",children:(0,n.jsxs)("div",{className:"".concat(r().pageLayout," w-full"),children:[(0,n.jsxs)("div",{className:"pt-6 md:pt-8 flex justify-between",children:[(0,n.jsx)("h1",{className:"text-3xl flex items-center",children:"Agents"}),(0,n.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,n.jsx)(E,{data:{slug:"",name:"",persona:"",color:"",icon:"",privacy_level:"private",managed_by_admin:!1,chat_model:"",input_tools:[],output_modes:[]},userProfile:u?null:null!=l?l:null,isMobileWidth:_,filesOptions:S||[],modelOptions:(null==g?void 0:g.chat_model_options)||[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:B,setAgentChangeTriggered:I,inputToolOptions:(null==H?void 0:H.input_tools)||{},outputModeOptions:(null==H?void 0:H.output_modes)||{}})})]}),A&&(0,n.jsx)(m.Z,{onOpenChange:y,isMobileWidth:_}),(0,n.jsx)(h.bZ,{className:"bg-secondary border-none my-4",children:(0,n.jsxs)(h.X,{children:[(0,n.jsx)(d.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,n.jsx)("span",{className:"font-bold",children:"How it works"})," Use any of these specialized personas to tune your conversation to your needs."]})}),(0,n.jsx)("div",{className:"pt-6 md:pt-8",children:(0,n.jsx)("div",{className:"".concat(r().agentList),children:l&&w.map(e=>(0,n.jsx)(v.EY,{data:e,userProfile:l,isMobileWidth:_,filesOptions:null!=S?S:[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:B,setAgentChangeTriggered:I,modelOptions:(null==g?void 0:g.chat_model_options)||[],editCard:!0,agentSlug:L||"",inputToolOptions:(null==H?void 0:H.input_tools)||{},outputModeOptions:(null==H?void 0:H.output_modes)||{}},e.slug))})}),(0,n.jsxs)("div",{className:"pt-6 md:pt-8",children:[(0,n.jsx)("h2",{className:"text-2xl",children:"Explore"}),(0,n.jsx)("div",{className:"".concat(r().agentList),children:!u&&N.map(e=>(0,n.jsx)(v.EY,{data:e,userProfile:l||null,isMobileWidth:_,editCard:!1,filesOptions:null!=S?S:[],selectedChatModelOption:(null==z?void 0:z.name)||"",isSubscribed:B,setAgentChangeTriggered:I,modelOptions:(null==g?void 0:g.chat_model_options)||[],agentSlug:L||"",inputToolOptions:(null==H?void 0:H.input_tools)||{},outputModeOptions:(null==H?void 0:H.output_modes)||{}},e.slug))})]})]})})})]})]})}},32759:function(e,a,t){"use strict";t.d(a,{E:function(){return s}});var n=t(57437),l=t(2265),r=t(60610),o=t(94508);let s=l.forwardRef((e,a)=>{let{className:t,value:l,indicatorColor:s,...i}=e;return(0,n.jsx)(r.fC,{ref:a,className:(0,o.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...i,children:(0,n.jsx)(r.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(s),style:{transform:"translateX(-".concat(100-(l||0),"%)")}})})});s.displayName=r.fC.displayName},76818:function(e,a,t){"use strict";t.d(a,{g:function(){return o}});var n=t(57437),l=t(2265),r=t(94508);let o=l.forwardRef((e,a)=>{let{className:t,...l}=e;return(0,n.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,...l})});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"}},2452:function(e,a,t){"use strict";t.d(a,{a:function(){return f}});var n=t(2265),l=t(49656);let r=new Map([["bold",n.createElement(n.Fragment,null,n.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",n.createElement(n.Fragment,null,n.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"}),n.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",n.createElement(n.Fragment,null,n.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",n.createElement(n.Fragment,null,n.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",n.createElement(n.Fragment,null,n.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",n.createElement(n.Fragment,null,n.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"}))]]);var o=Object.defineProperty,s=Object.defineProperties,i=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,m=(e,a,t)=>a in e?o(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,p=(e,a)=>{for(var t in a||(a={}))d.call(a,t)&&m(e,t,a[t]);if(c)for(var t of c(a))u.call(a,t)&&m(e,t,a[t]);return e},h=(e,a)=>s(e,i(a));let f=(0,n.forwardRef)((e,a)=>n.createElement(l.Z,h(p({ref:a},e),{weights:r})));f.displayName="Brain"},75419:function(e,a,t){"use strict";t.d(a,{k:function(){return f}});var n=t(2265),l=t(49656);let r=new Map([["bold",n.createElement(n.Fragment,null,n.createElement("path",{d:"M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,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,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z"}))],["duotone",n.createElement(n.Fragment,null,n.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),n.createElement("path",{d:"M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,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,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z"}))],["fill",n.createElement(n.Fragment,null,n.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z"}))],["light",n.createElement(n.Fragment,null,n.createElement("path",{d:"M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,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",n.createElement(n.Fragment,null,n.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,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"}))],["thin",n.createElement(n.Fragment,null,n.createElement("path",{d:"M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,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"}))]]);var o=Object.defineProperty,s=Object.defineProperties,i=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,m=(e,a,t)=>a in e?o(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,p=(e,a)=>{for(var t in a||(a={}))d.call(a,t)&&m(e,t,a[t]);if(c)for(var t of c(a))u.call(a,t)&&m(e,t,a[t]);return e},h=(e,a)=>s(e,i(a));let f=(0,n.forwardRef)((e,a)=>n.createElement(l.Z,h(p({ref:a},e),{weights:r})));f.displayName="Info"},78527:function(e,a,t){"use strict";t.d(a,{B:function(){return f}});var n=t(2265),l=t(49656);let r=new Map([["bold",n.createElement(n.Fragment,null,n.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",n.createElement(n.Fragment,null,n.createElement("path",{d:"M96,240l16-80L48,136,160,16,144,96l64,24Z",opacity:"0.2"}),n.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",n.createElement(n.Fragment,null,n.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",n.createElement(n.Fragment,null,n.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",n.createElement(n.Fragment,null,n.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",n.createElement(n.Fragment,null,n.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"}))]]);var o=Object.defineProperty,s=Object.defineProperties,i=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,m=(e,a,t)=>a in e?o(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,p=(e,a)=>{for(var t in a||(a={}))d.call(a,t)&&m(e,t,a[t]);if(c)for(var t of c(a))u.call(a,t)&&m(e,t,a[t]);return e},h=(e,a)=>s(e,i(a));let f=(0,n.forwardRef)((e,a)=>n.createElement(l.Z,h(p({ref:a},e),{weights:r})));f.displayName="Lightning"},60610:function(e,a,t){"use strict";t.d(a,{fC:function(){return b},z$:function(){return Z}});var n=t(2265),l=t(73966),r=t(66840),o=t(57437),s="Progress",[i,c]=(0,l.b)(s),[d,u]=i(s),m=n.forwardRef((e,a)=>{var t,n,l,s;let{__scopeProgress:i,value:c=null,max:u,getValueLabel:m=f,...p}=e;(u||0===u)&&!A(u)&&console.error((t="".concat(u),n="Progress","Invalid prop `max` of value `".concat(t,"` supplied to `").concat(n,"`. Only numbers greater than 0 are valid max values. Defaulting to `").concat(100,"`.")));let h=A(u)?u:100;null===c||x(c,h)||console.error((l="".concat(c),s="Progress","Invalid prop `value` of value `".concat(l,"` 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 b=x(c,h)?c:null,Z=g(b)?m(b,h):void 0;return(0,o.jsx)(d,{scope:i,value:b,max:h,children:(0,o.jsx)(r.WV.div,{"aria-valuemax":h,"aria-valuemin":0,"aria-valuenow":g(b)?b:void 0,"aria-valuetext":Z,role:"progressbar","data-state":v(b,h),"data-value":null!=b?b:void 0,"data-max":h,...p,ref:a})})});m.displayName=s;var p="ProgressIndicator",h=n.forwardRef((e,a)=>{var t;let{__scopeProgress:n,...l}=e,s=u(p,n);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,...l,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 A(e){return g(e)&&!isNaN(e)&&e>0}function x(e,a){return g(e)&&!isNaN(e)&&e<=a&&e>=0}h.displayName=p;var b=m,Z=h}},function(e){e.O(0,[8221,9853,9259,8667,182,9665,7647,2327,5427,2971,2117,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{39929:function(e,t,s){Promise.resolve().then(s.bind(s,74723))},74723:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return w}});var a=s(57437),o=s(63136),n=s.n(o),r=s(2265),i=s(74986),c=s(99376),l=s(14308),d=s(59199);s(2446);var u=s(7436),h=s(5477),m=s(56937),g=s(55287),p=s(85872),f=s(34124),x=s(6512),y=s(37104);function _(e){let t=(0,c.useSearchParams)().get("conversationId"),[s,o]=(0,r.useState)(""),[l,d]=(0,r.useState)([]),[u,m]=(0,r.useState)(!1),[g,p]=(0,r.useState)(null),[f,x]=(0,r.useState)(!1),y=(0,r.useRef)(null),_=e.setQueryToProcess,w=e.onConversationIdChange,S=e.isMobileWidth?"w-full":"w-4/6";if((0,r.useEffect)(()=>{if(l.length>0){let t=l.map(e=>encodeURIComponent(e));e.setImages(t)}},[l,e.setImages]),(0,r.useEffect)(()=>{let t=localStorage.getItem("images");if(t){let s=JSON.parse(t);d(s);let a=s.map(e=>encodeURIComponent(e));e.setImages(a),localStorage.removeItem("images")}let s=localStorage.getItem("message");s&&(m(!0),_(s),s.trim().startsWith("/research")&&x(!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)}},[_,e.setImages,t]),(0,r.useEffect)(()=>{s&&(m(!0),_(s))},[s,_]),(0,r.useEffect)(()=>{t&&(null==w||w(t))},[t,w]),(0,r.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?(m(!1),d([]),e.setUploadedFiles(void 0)):o("")},[e.streamedMessages]),!t){window.location.href="/";return}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:n().chatBodyFull,children:(0,a.jsx)(i.Z,{conversationId:t,setTitle:e.setTitle,setAgent:p,pendingMessage:u?s:"",incomingMessages:e.streamedMessages,setIncomingMessages:e.setStreamedMessages,customClassName:S})}),(0,a.jsx)("div",{className:"".concat(n().inputBox," 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(S," mr-auto ml-auto"),children:(0,a.jsx)(h.a,{agentColor:null==g?void 0:g.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(t=>[...t,e]),sendDisabled:u,chatOptionsData:e.chatOptionsData,conversationId:t,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:y,isResearchModeEnabled:f,setTriggeredAbort:e.setTriggeredAbort})})]})}function w(){let e="Khoj AI - Chat",[t,s]=(0,r.useState)(null),[o,i]=(0,r.useState)(!0),[c,h]=(0,r.useState)(e),[w,S]=(0,r.useState)(null),[I,b]=(0,r.useState)([]),[j,v]=(0,r.useState)(""),[E,k]=(0,r.useState)(!1),[C,N]=(0,r.useState)(void 0),[T,B]=(0,r.useState)([]),[M,R]=(0,r.useState)(null),[F,O]=(0,r.useState)(!1),{locationData:D,locationDataError:W,locationDataLoading:P}=(0,u.k6)()||{locationData:{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}},{data:A,error:L,isLoading:U}=(0,m.GW)(),K=(0,u.IC)();async function z(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let t=e.body.getReader(),s=new TextDecoder,a="␃\uD83D\uDD1A␗",o="",n=[],r={},i={};for(;;){let e;let{done:c,value:l}=await t.read();if(c){v(""),k(!1),B([]),w&&(0,d.tQ)(w,h);break}for(o+=s.decode(l,{stream:!0});-1!==(e=o.indexOf(a));){let t=o.slice(0,e);if(o=o.slice(e+a.length),t){let e=I.find(e=>!e.completed);if(!e){console.error("No current message found");return}({context:n,onlineContext:r,codeContext:i}=(0,d.VK)(t,e,n,r,i)),b([...I])}}}}async function Q(){if(localStorage.removeItem("message"),!j||!w)return;let e={q:j,conversation_id:w,stream:!0,...D&&{city:D.city,region:D.region,country:D.country,country_code:D.countryCode,timezone:D.timezone},...T.length>0&&{images:T},...C&&{files:C}},t=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:null==M?void 0:M.signal});try{await z(t)}catch(n){let e;try{e=await t.json()}catch(t){e={streamError:"Error reading API error response stream. Expected JSON response."}}console.error(e);let s=I.find(e=>!e.completed);if(!s)return;let a=n.message,o=n.name;a.includes("Error in input stream")?s.rawResponse="Woops! The connection broke while I was writing my thoughts down. Maybe try again in a bit or dislike this message if the issue persists?":e.streamError?s.rawResponse="Umm, not sure what just happened but I lost my train of thought. Could you try again or ask my developers to look into this if the issue persists? They can be contacted at the Khoj Github, Discord or team@khoj.dev.":429===t.status?"detail"in e?s.rawResponse="".concat(e.detail):s.rawResponse="I'm a bit overwhelmed at the moment. Could you try again in a bit or dislike this message if the issue persists?":"AbortError"===o?s.rawResponse="I've stopped processing this message. If you'd like to continue, please send the message again.":s.rawResponse="Umm, not sure what just happened. I see this error message: ".concat(a,". Could you try again or dislike this message if the issue persists?"),s.completed=!0,b([...I]),v(""),k(!1)}}return(0,r.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{i(!1),e&&s(e)}).catch(e=>{console.error(e)}),(0,u.EK)()},[]),(0,r.useEffect)(()=>{F&&(null==M||M.abort(),function(){let e=I.find(e=>!e.completed);e&&(e.completed=!0,b([...I]),v(""),k(!1))}(),O(!1))}),(0,r.useEffect)(()=>{if(j){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},codeContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:j||"",images:T,queryFiles:C};b(t=>[...t,e]),k(!0),R(new AbortController)}},[j]),(0,r.useEffect)(()=>{E&&!P&&Q()},[E,P]),o?(0,a.jsx)(l.Z,{}):(0,a.jsxs)(p.Hn,{children:[(0,a.jsx)(f.S,{conversationId:w||""}),(0,a.jsxs)(p.kV,{children:[(0,a.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,a.jsx)(p.vP,{className:"-ml-1"}),(0,a.jsx)(x.Z,{orientation:"vertical",className:"mr-2 h-4"}),w&&(0,a.jsx)("div",{className:"".concat(n().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:K?(0,a.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,a.jsx)(y.VO,{className:"h-auto w-16"})}):c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden mr-4",children:c}),(0,a.jsx)(g.En,{conversationId:w,setTitle:h,sizing:"md"})]})})]}),(0,a.jsxs)("div",{className:"".concat(n().main," ").concat(n().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(c&&c!==e?": ".concat(c):"")}),(0,a.jsx)("div",{className:n().chatBox,children:(0,a.jsx)("div",{className:n().chatBoxBody,children:(0,a.jsx)(r.Suspense,{fallback:(0,a.jsx)(l.Z,{}),children:(0,a.jsx)(_,{isLoggedIn:!!A,streamedMessages:I,setStreamedMessages:b,chatOptionsData:t,setTitle:h,setQueryToProcess:v,setUploadedFiles:N,isMobileWidth:K,onConversationIdChange:e=>{S(e)},setImages:B,setTriggeredAbort:O})})})})]})]})]})}},99376:function(e,t,s){"use strict";var a=s(35475);s.o(a,"useRouter")&&s.d(t,{useRouter:function(){return a.useRouter}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})},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"}}},function(e){e.O(0,[8255,9853,8221,3954,1919,9259,8667,182,4270,6002,2327,5477,4986,2971,2117,1744],function(){return e(e.s=39929)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{1507:function(e,t,a){Promise.resolve().then(a.bind(a,84523))},84523:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return eh}});var n,o,i=a(57437);a(47960);var r=a(76777),l=a.n(r);a(2446);var s=a(2265),c=a(63861),p=a(49656);let d=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M168.49,191.51a12,12,0,0,1,0,17l-32,32a12,12,0,0,1-17,0l-32-32a12,12,0,0,1,17-17L116,203V53L104.49,64.49a12,12,0,1,1-17-17l32-32a12,12,0,0,1,17,0l32,32a12,12,0,0,1-17,17L140,53V203l11.51-11.52A12,12,0,0,1,168.49,191.51Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M160,56V200l-32,32L96,200V56l32-32Z",opacity:"0.2"}),s.createElement("path",{d:"M165.66,194.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.32L120,212.69V43.31L101.66,61.66A8,8,0,0,1,90.34,50.34l32-32a8,8,0,0,1,11.32,0l32,32a8,8,0,0,1-11.32,11.32L136,43.31V212.69l18.34-18.35A8,8,0,0,1,165.66,194.34Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M167.39,196.94a8,8,0,0,1-1.73,8.72l-32,32a8,8,0,0,1-11.32,0l-32-32A8,8,0,0,1,96,192h24V64H96a8,8,0,0,1-5.66-13.66l32-32a8,8,0,0,1,11.32,0l32,32A8,8,0,0,1,160,64H136V192h24A8,8,0,0,1,167.39,196.94Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M164.24,195.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.48L122,217.51v-179L100.24,60.24a6,6,0,0,1-8.48-8.48l32-32a6,6,0,0,1,8.48,0l32,32a6,6,0,1,1-8.48,8.48L134,38.49v179l21.76-21.75A6,6,0,0,1,164.24,195.76Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M165.66,194.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.32L120,212.69V43.31L101.66,61.66A8,8,0,0,1,90.34,50.34l32-32a8,8,0,0,1,11.32,0l32,32a8,8,0,0,1-11.32,11.32L136,43.31V212.69l18.34-18.35A8,8,0,0,1,165.66,194.34Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M162.83,197.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.66L124,222.34V33.66L98.83,58.83a4,4,0,0,1-5.66-5.66l32-32a4,4,0,0,1,5.66,0l32,32a4,4,0,0,1-5.66,5.66L132,33.66V222.34l25.17-25.17A4,4,0,0,1,162.83,197.17Z"}))]]);var m=Object.defineProperty,h=Object.defineProperties,u=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,w=(e,t,a)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,v=(e,t)=>{for(var a in t||(t={}))f.call(t,a)&&w(e,a,t[a]);if(g)for(var a of g(t))x.call(t,a)&&w(e,a,t[a]);return e},b=(e,t)=>h(e,u(t));let y=(0,s.forwardRef)((e,t)=>s.createElement(p.Z,b(v({ref:t},e),{weights:d})));y.displayName="ArrowsVertical";var j=a(66070),L=a(64670),M=a.n(L),E=a(42225),S=a(5477);(n=o||(o={})).Paint="Paint",n.Travel="Travel",n.Health="Health",n.Learning="Learning",n.Math="Mathematics",n.Language="Language",n.PopCulture="Pop Culture",n.Food="Food",n.Interviewing="Interviewing",n.Home="Home",n.Fun="Fun",n.Code="Code",n.Finance="Finance",n.Document="Document",n.Image="Image";let I={};I.Paint="indigo",I.Travel="yellow",I.Health="teal",I.Learning="purple",I.Language="blue",I["Pop Culture"]="red",I.Food="yellow",I.Interviewing="orange",I.Home="green",I.Fun="fuchsia",I.Code="teal",I.Finance="green",I.Mathematics="blue",I.Image="red",I.Document="orange";let C="orange";function k(e,t){return"Paint"===e?(0,E.TI)("Palette",t,"w-6","h-6"):"Pop Culture"===e?(0,E.TI)("Confetti",t,"w-6","h-6"):"Travel"===e?(0,E.TI)("Jeep",t,"w-6","h-6"):"Learning"===e?(0,E.TI)("Book",t,"w-6","h-6"):"Health"===e?(0,E.TI)("Asclepius",t,"w-6","h-6"):"Fun"===e?(0,E.TI)("Island",t,"w-6","h-6"):"Home"===e?(0,E.TI)("House",t,"w-6","h-6"):"Language"===e?(0,E.TI)("Translate",t,"w-6","h-6"):"Code"===e?(0,E.TI)("Code",t,"w-6","h-6"):"Food"===e?(0,E.TI)("BowlFood",t,"w-6","h-6"):"Interviewing"===e?(0,E.TI)("Lectern",t,"w-6","h-6"):"Finance"===e?(0,E.TI)("Wallet",t,"w-6","h-6"):"Mathematics"===e?(0,E.TI)("MathOperations",t,"w-6","h-6"):"Image"===e?(0,E.TI)("Image",t,"w-6","h-6"):"Document"===e?(0,E.TI)("File",t,"w-6","h-6"):(0,E.TI)("Lightbulb",t,"w-6","h-6")}let H=[{type:"Document",actionTagline:"Analyze document",color:I.Document||C,focus:S.$.FILE,intent:"Read this document and explain"},{type:"Code",actionTagline:"Write code",color:I.Code||C,focus:S.$.MESSAGE,intent:"Write a program that"},{type:"Learning",actionTagline:"Explain concept",color:I.Learning||C,focus:S.$.MESSAGE,intent:"I want to understand a concept"},{type:"Paint",actionTagline:"Create image",color:I.Paint||C,focus:S.$.MESSAGE,intent:"Paint a picture of"},{type:"Language",actionTagline:"Translate text",color:I.Language||C,focus:S.$.MESSAGE,intent:"Translate this text"},{type:"Finance",actionTagline:"Explain finance",color:I.Finance||C,focus:S.$.MESSAGE,intent:"Help me build mental models for finance"},{type:"Mathematics",actionTagline:"Explain math",color:I.Mathematics||C,focus:S.$.MESSAGE,intent:"Help me understand the math behind"},{type:"Image",actionTagline:"Analyze image",color:I.Image||C,focus:S.$.FILE,intent:"Explain the significance of this image"},{type:"Health",actionTagline:"Improve health",color:I.Health||C,focus:S.$.MESSAGE,intent:"Help me improve my health"}],Z={Paint:[{prompt:"Paint a picture of a sunset but it's made of stained glass tiles."},{prompt:"Paint a futuristic cityscape with flying cars."},{prompt:"Paint a neon-lit street scene with reflections in the rain."},{prompt:"Paint a portrait of a person with a unique hairstyle."},{prompt:"Paint a landscape of a forest with a hidden waterfall."}],Travel:[{prompt:"Search for the best attractions in Austria Hungary."},{prompt:"Find the top-rated coffee shops in Seattle."},{prompt:"Research the best hiking trails in the Swiss Alps."},{prompt:"What is the best time of year to visit Bali?"},{prompt:"Find the best hidden gems in Nairobi."}],Health:[{prompt:"Explain to me how to improve my posture."},{prompt:"Tell me how what I eat affects my insulin levels."},{prompt:"Suggest healthy meal prep ideas for a busy work week."},{prompt:"Recommend good exercises to improve my flexibility."},{prompt:"Explain the benefits of a plant-based diet"}],Learning:[{prompt:"/research look up how Alpha Fold works and explain it to me."},{prompt:"Explain the key equations of general relativity."},{prompt:"Explain the concept of 'machine learning' in simple terms."},{prompt:"What are the key principles of Stoicism?"},{prompt:"/research what are the causes behind the breakthroughs in AI in the last 5 years."}],Language:[{prompt:"Translate the following text into Spanish: 'Hello, how are you?'"},{prompt:"Tell me how to greet someone in Arabic."},{prompt:"Explain the difference between the words 'ser' and 'estar' in Spanish."},{prompt:"Translate the following text into French: 'Where is the nearest metro station?'"},{prompt:"Translate the following text into Japanese: 'I am learning Japanese.'"}],"Pop Culture":[{prompt:"Find the best-rated science fiction books of the last decade."},{prompt:"Research the latest trends in K-pop and its global influence."},{prompt:"Explain the plot of the movie 'Doctor Zhivago' in detail."},{prompt:"What fashion is trending in jackets this season?"},{prompt:"Find the best indie movies of the last year"}],Food:[{prompt:"Find the best empanada recipe from Colombia."},{prompt:"Suggest a healthy alternative to a popular fast food dish."},{prompt:"Find the best recipe for a vegan chocolate cake."},{prompt:"Suggest a recipe for a quick and easy weeknight dinner."},{prompt:"Create a diagram that explains how to make a traditional Italian lasagna."}],Interviewing:[{prompt:"Create interview prep questions for a consulting job."},{prompt:"What information should I include in a CV for a PhD application?"},{prompt:"Suggest questions to ask during a job interview."},{prompt:"What are the best ways to prepare for a technical interview?"},{prompt:"How can I improve my public speaking skills for an interview?"}],Home:[{prompt:"Recommend plants that can grow well indoors."},{prompt:"Suggest ways to reduce plastic waste in daily life."},{prompt:"Create a list of eco-friendly home cleaning products."},{prompt:"Suggest ways to make a small apartment feel more spacious."},{prompt:"Recommend ways to reduce energy consumption in a home."}],Fun:[{prompt:"List creative date ideas for couples on a budget."},{prompt:"Create a list of fun activities for a family game night."},{prompt:"Give me three questions that can help me get to know someone better."},{prompt:"Suggest fun activities for a group of friends on a rainy day."},{prompt:"How can I improve my drawing skills?"}],Code:[{prompt:"Teach me how to write a simple 'Hello World' program in Python."},{prompt:"Write a single page application using vanilla HTML, CSS, and JavaScript that displays a list of items."},{prompt:"Explain the concept of recursion with a simple coding example."},{prompt:"Create a simple calculator app using React."},{prompt:"Write a function that takes an array of numbers and returns the sum of all the numbers."}],Finance:[{prompt:"Create a chart to explain the concept of compound interest and its importance in long-term savings."},{prompt:"Provide an overview of different types of retirement accounts (e.g., 401(k), IRA, Roth IRA)."},{prompt:"Explain the concept of diversification and its importance in investing."},{prompt:"Create a budgeting plan for someone who wants to save money for a vacation."},{prompt:"Explain the difference between a stock and a bond."}],Mathematics:[{prompt:"Create a series of questions to help a student discover the principles of basic economics."},{prompt:"Develop a hands-on experiment to demonstrate the concept of density to middle schoolers."},{prompt:"Explain the concept of a derivative and its applications in real life."},{prompt:"Create a lesson plan to teach students about the Pythagorean theorem."},{prompt:"Explain the concept of a limit in calculus and its importance in mathematics."}],Image:[{prompt:"Explain what is happening in this photograph"},{prompt:"Show me how I can improve this UI design"},{prompt:"Explain the significance of this historical painting"},{prompt:"Can you explain this physics diagram to me?"},{prompt:"Explain this meme to me"}],Document:[{prompt:"Summarize the key concepts in this document."},{prompt:"Provide a detailed explanation about the topic of this document."},{prompt:"Create a visual representation of the information in this document."},{prompt:"Find the main arguments in this document."},{prompt:"Explain the relevance of this document to various other disciplines."}]},N=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M252,152a12,12,0,0,1-12,12H228v12a12,12,0,0,1-24,0V164H192a12,12,0,0,1,0-24h12V128a12,12,0,0,1,24,0v12h12A12,12,0,0,1,252,152ZM56,76H68V88a12,12,0,0,0,24,0V76h12a12,12,0,1,0,0-24H92V40a12,12,0,0,0-24,0V52H56a12,12,0,0,0,0,24ZM184,188h-4v-4a12,12,0,0,0-24,0v4h-4a12,12,0,0,0,0,24h4v4a12,12,0,0,0,24,0v-4h4a12,12,0,0,0,0-24ZM222.14,82.83,82.82,222.14a20,20,0,0,1-28.28,0L33.85,201.46a20,20,0,0,1,0-28.29L173.17,33.86a20,20,0,0,1,28.28,0l20.69,20.68A20,20,0,0,1,222.14,82.83ZM159,112,144,97,53.65,187.31l15,15Zm43.31-43.31-15-15L161,80l15,15Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,112,74.34,213.66a8,8,0,0,1-11.31,0L42.34,193a8,8,0,0,1,0-11.31L144,80Z",opacity:"0.2"}),s.createElement("path",{d:"M248,152a8,8,0,0,1-8,8H224v16a8,8,0,0,1-16,0V160H192a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,248,152ZM56,72H72V88a8,8,0,0,0,16,0V72h16a8,8,0,0,0,0-16H88V40a8,8,0,0,0-16,0V56H56a8,8,0,0,0,0,16ZM184,192h-8v-8a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0v-8h8a8,8,0,0,0,0-16ZM219.31,80,80,219.31a16,16,0,0,1-22.62,0L36.68,198.63a16,16,0,0,1,0-22.63L176,36.69a16,16,0,0,1,22.63,0l20.68,20.68A16,16,0,0,1,219.31,80Zm-54.63,32L144,91.31l-96,96L68.68,208ZM208,68.69,187.31,48l-32,32L176,100.69Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M248,152a8,8,0,0,1-8,8H224v16a8,8,0,0,1-16,0V160H192a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,248,152ZM56,72H72V88a8,8,0,0,0,16,0V72h16a8,8,0,0,0,0-16H88V40a8,8,0,0,0-16,0V56H56a8,8,0,0,0,0,16ZM184,192h-8v-8a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0v-8h8a8,8,0,0,0,0-16ZM219.31,80,80,219.31a16,16,0,0,1-22.62,0L36.68,198.63a16,16,0,0,1,0-22.63L176,36.69a16,16,0,0,1,22.63,0l20.68,20.68A16,16,0,0,1,219.31,80ZM208,68.69,187.31,48l-32,32L176,100.69Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M246,152a6,6,0,0,1-6,6H222v18a6,6,0,0,1-12,0V158H192a6,6,0,0,1,0-12h18V128a6,6,0,0,1,12,0v18h18A6,6,0,0,1,246,152ZM56,70H74V88a6,6,0,0,0,12,0V70h18a6,6,0,0,0,0-12H86V40a6,6,0,0,0-12,0V58H56a6,6,0,0,0,0,12ZM184,194H174V184a6,6,0,0,0-12,0v10H152a6,6,0,0,0,0,12h10v10a6,6,0,0,0,12,0V206h10a6,6,0,0,0,0-12ZM217.9,78.59,78.58,217.9a14,14,0,0,1-19.8,0L38.09,197.21a14,14,0,0,1,0-19.8L177.41,38.1a14,14,0,0,1,19.8,0L217.9,58.79A14,14,0,0,1,217.9,78.59ZM167.51,112,144,88.49,46.58,185.9a2,2,0,0,0,0,2.83l20.69,20.68a2,2,0,0,0,2.82,0h0Zm41.9-44.73L188.73,46.59a2,2,0,0,0-2.83,0L152.48,80,176,103.52,209.41,70.1A2,2,0,0,0,209.41,67.27Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M48,64a8,8,0,0,1,8-8H72V40a8,8,0,0,1,16,0V56h16a8,8,0,0,1,0,16H88V88a8,8,0,0,1-16,0V72H56A8,8,0,0,1,48,64ZM184,192h-8v-8a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0v-8h8a8,8,0,0,0,0-16Zm56-48H224V128a8,8,0,0,0-16,0v16H192a8,8,0,0,0,0,16h16v16a8,8,0,0,0,16,0V160h16a8,8,0,0,0,0-16ZM219.31,80,80,219.31a16,16,0,0,1-22.62,0L36.68,198.63a16,16,0,0,1,0-22.63L176,36.69a16,16,0,0,1,22.63,0l20.68,20.68A16,16,0,0,1,219.31,80Zm-54.63,32L144,91.31l-96,96L68.68,208ZM208,68.69,187.31,48l-32,32L176,100.69Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M244,152a4,4,0,0,1-4,4H220v20a4,4,0,0,1-8,0V156H192a4,4,0,0,1,0-8h20V128a4,4,0,0,1,8,0v20h20A4,4,0,0,1,244,152ZM56,68H76V88a4,4,0,0,0,8,0V68h20a4,4,0,0,0,0-8H84V40a4,4,0,0,0-8,0V60H56a4,4,0,0,0,0,8ZM184,196H172V184a4,4,0,0,0-8,0v12H152a4,4,0,0,0,0,8h12v12a4,4,0,0,0,8,0V204h12a4,4,0,0,0,0-8ZM216.48,77.17,77.17,216.49a12,12,0,0,1-17,0L39.51,195.8a12,12,0,0,1,0-17L178.83,39.51a12,12,0,0,1,17,0L216.48,60.2A12,12,0,0,1,216.48,77.17ZM170.34,112,144,85.66,45.17,184.49a4,4,0,0,0,0,5.65l20.68,20.69a4,4,0,0,0,5.66,0Zm40.49-46.14L190.14,45.17a4,4,0,0,0-5.66,0L149.65,80,176,106.34l34.83-34.83A4,4,0,0,0,210.83,65.86Z"}))]]);var A=Object.defineProperty,V=Object.defineProperties,F=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,O=(e,t,a)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,W=(e,t)=>{for(var a in t||(t={}))_.call(t,a)&&O(e,a,t[a]);if(T)for(var a of T(t))P.call(t,a)&&O(e,a,t[a]);return e},B=(e,t)=>V(e,F(t));let D=(0,s.forwardRef)((e,t)=>s.createElement(p.Z,B(W({ref:t},e),{weights:N})));D.displayName="MagicWand";var R=a(4243);function G(e){let t="".concat(M().card," md:w-full md:h-fit sm:w-full h-fit md:w-[200px] cursor-pointer md:p-2"),a="".concat(M().text," dark:text-white");return(0,i.jsx)(j.Zb,{className:t,children:(0,i.jsx)("div",{className:"flex w-full",children:(0,i.jsxs)(j.aY,{className:"m-0 p-2 w-full flex flex-row",children:[k(e.title,e.color.toLowerCase()),(0,i.jsx)(j.SZ,{className:"".concat(a," sm:line-clamp-2 md:line-clamp-4 pt-1 break-words whitespace-pre-wrap max-w-full"),children:e.body})]})})})}function U(e){let t="".concat(M().card," md:h-fit sm:w-full h-fit cursor-pointer md:p-2");return(0,i.jsx)(j.Zb,{className:t,children:(0,i.jsx)("div",{className:"flex w-full items-center",children:(0,i.jsxs)(j.aY,{className:"m-0 p-1 w-full flex flex-row items-center",children:[(0,i.jsx)(D,{weight:"thin",className:"w-4 h-4 text-muted-foreground inline-flex mr-1 text-opacity-40"}),(0,i.jsx)(j.SZ,{className:"sm:line-clamp-2 md:line-clamp-4 break-words whitespace-pre-wrap max-w-full text-sm text-wrap text-black dark:text-white",children:e.prompt})]})})})}function $(e){let t="".concat(M().card," md:w-full md:h-fit sm:w-full h-fit md:w-fit cursor-pointer m-2 md:p-1 animate-fade-in-up border-opacity-50 shadow-none"),a="".concat(M().text," dark:text-white");return(0,i.jsx)(j.Zb,{className:t,onClick:e.onClick,children:(0,i.jsx)("div",{className:"flex w-full h-full items-center justify-center",children:(0,i.jsxs)(j.aY,{className:"m-0 p-2 w-full flex flex-row items-center justify-center",children:[k(e.title,e.color.toLowerCase()),(0,i.jsx)(j.SZ,{className:"".concat(a," sm:line-clamp-2 md:line-clamp-4 pt-1 break-words whitespace-pre-wrap max-w-full text-center"),children:e.body}),(0,i.jsx)(R.a,{className:"w-6 h-6 text-muted-foreground inline-flex ml-1"})]})})})}var q=a(14308),z=a(33494),J=a(56937),Y=a(84671),K=a(59199),Q=a(7436),X=a(99376),ee=a(19378),et=a(25427),ea=a(57054),en=a(62869),eo=a(37104),ei=a(17814);function er(e){return e.isMobileWidth?(0,i.jsx)(ei.dy,{open:!0,onClose:()=>e.setShowLoginPrompt(!1),children:(0,i.jsx)(ei.sc,{children:(0,i.jsx)(el,{...e})})}):(0,i.jsx)("div",{className:"fixed inset-x-0 bottom-8 z-30 flex items-center justify-center",children:(0,i.jsx)(el,{...e})})}function el(e){return(0,i.jsxs)(j.Zb,{className:"rounded-lg p-6 flex flex-col items-center justify-between gap-8 md:w-fit border-none md:flex-row md:z-30 md:shadow-lg",children:[!e.isMobileWidth&&(0,i.jsx)(eo.S6,{className:"w-12 h-auto"}),(0,i.jsxs)("div",{className:"flex flex-col items-start justify-center gap-8 md:gap-2",children:[(0,i.jsx)(j.Ol,{className:"p-0 text-xl font-bold",children:"Welcome to Khoj!"}),(0,i.jsx)(j.SZ,{children:"Sign in to get started with Khoj, your AI research assistant."})]}),(0,i.jsx)(en.z,{variant:"default",className:"p-6 text-lg",onClick:()=>e.setShowLoginPrompt(!0),children:"Get started for free"})]})}var es=a(85872),ec=a(34124),ep=a(6512);function ed(e){let{agents:t,agentIcons:a,selectedAgent:n,isPopoverOpen:o,debouncedHoveredAgent:r,setHoveredAgent:l,setIsPopoverOpen:s,setSelectedAgent:c,chatInputRef:p,openAgentEditCard:d,userConfig:m,isMobileWidth:h}=e;return(0,i.jsxs)(ee.x,{className:"w-full max-w-[600px] mx-auto",children:[(0,i.jsx)("div",{className:"flex pb-2 gap-2 items-center justify-center",children:t.map((e,t)=>(0,i.jsxs)(ea.J2,{open:o&&r===e.slug,onOpenChange:e=>{e||(l(null),s(!1))},children:[(0,i.jsx)(ea.xo,{asChild:!0,children:(0,i.jsx)(j.Zb,{className:"".concat(n===e.slug?(0,Y.Iu)(e.color):"border-stone-100 dark:border-neutral-700 text-muted-foreground","\n hover:cursor-pointer rounded-lg px-2 py-2"),onDoubleClick:()=>d(e.slug),onClick:()=>{var t;c(e.slug),null===(t=p.current)||void 0===t||t.focus(),l(null),s(!1)},onMouseEnter:()=>l(e.slug),onMouseLeave:()=>{l(null),s(!1)},children:(0,i.jsxs)(j.ll,{className:"text-center text-md font-medium flex justify-center items-center whitespace-nowrap",children:[a[t]," ",e.name]})})}),(0,i.jsx)(ea.yk,{className:"w-80 p-0 border-none bg-transparent shadow-none",onMouseLeave:()=>{l(null),s(!1)},children:(0,i.jsx)(et.EY,{data:e,userProfile:null,isMobileWidth:h||!1,showChatButton:!1,editCard:!1,filesOptions:[],selectedChatModelOption:"",agentSlug:"",isSubscribed:(0,J.T8)(m),setAgentChangeTriggered:()=>{},modelOptions:[],inputToolOptions:{},outputModeOptions:{}})})]},"".concat(t,"-").concat(e.slug)))}),(0,i.jsx)(ee.B,{orientation:"horizontal"})]})}function em(e){var t,a;let[n,o]=(0,s.useState)(""),[r,p]=(0,s.useState)(""),[d,m]=(0,s.useState)(S.$.MESSAGE),[h,u]=(0,s.useState)([]),[g,f]=(0,s.useState)(!1),[x,w]=(0,s.useState)(""),[v,b]=(0,s.useState)(H.slice(0,3)),[L,M]=(0,s.useState)([]),[I,C]=(0,s.useState)(null),[k,N]=(0,s.useState)(null),A=(0,Q.Nr)(k,500),[V,F]=(0,s.useState)(!1),[T,_]=(0,s.useState)("khoj"),[P,O]=(0,s.useState)([]),[W,B]=(0,s.useState)([]),D=(0,s.useRef)(null),[R,q]=(0,s.useState)(!1),J=(0,X.useRouter)(),et=(0,X.useSearchParams)().get("q");(0,s.useEffect)(()=>{et&&o(decodeURIComponent(et))},[et]),(0,s.useEffect)(()=>{A&&F(!0)},[A]);let ea=e.onConversationIdChange,{data:en,error:eo}=(0,c.ZP)("agents",()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),{revalidateOnFocus:!1}),ei=e=>{J.push("/agents?agent=".concat(e))};return(0,s.useEffect)(()=>{var t,a;if(e.isLoadingUserConfig)return;let n=new Date,o=n.getDay(),i=n.getHours()>=17||4>n.getHours()?"evening":n.getHours()>=12?"afternoon":"morning",r=(null===(t=e.userConfig)||void 0===t?void 0:t.given_name)?", ".concat(null===(a=e.userConfig)||void 0===a?void 0:a.given_name):"",l=["What would you like to get done".concat(r,"?"),"Hey".concat(r,"! How can I help?"),"Good ".concat(i).concat(r,"! What's on your mind?"),"Ready to breeze through ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o],"?"),"Let's navigate your ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o]," workload")];w(l[Math.floor(Math.random()*l.length)])},[e.isLoadingUserConfig,e.userConfig]),(0,s.useEffect)(()=>{let e=(en||[]).filter(e=>null!=e);B(e),_(e.length>1?e[0].slug:"khoj"),O(e.map(e=>(0,E.TI)(e.icon,e.color)))},[en]),(0,s.useEffect)(()=>{(async()=>{if(n&&!g){f(!0);try{let e=await (0,K.A0)(T||"khoj");null==ea||ea(e),localStorage.setItem("message",n),h.length>0&&localStorage.setItem("images",JSON.stringify(h)),window.location.href="/chat?conversationId=".concat(e)}catch(e){console.error("Error creating new conversation:",e),f(!1)}o(""),u([])}})(),(n||h.length>0)&&f(!0)},[T,n,g,ea]),(0,s.useEffect)(()=>{let e=document.querySelector("[data-radix-scroll-area-viewport]"),t=()=>{N(null),F(!1)};return null==e||e.addEventListener("scroll",t),()=>null==e?void 0:e.removeEventListener("scroll",t)},[]),(0,i.jsxs)("div",{className:"".concat(l().homeGreetings," w-full md:w-auto"),children:[R&&(0,i.jsx)(z.Z,{onOpenChange:q,isMobileWidth:e.isMobileWidth}),!e.isLoggedIn&&(0,i.jsx)(er,{isMobileWidth:e.isMobileWidth,setShowLoginPrompt:q}),(0,i.jsxs)("div",{className:"w-full text-center justify-end content-end",children:[(0,i.jsx)("div",{className:"items-center",children:(0,i.jsx)("h1",{className:"text-2xl md:text-3xl text-center w-fit pb-6 px-4 mx-auto",children:x})}),!e.isMobileWidth&&(0,i.jsx)(ed,{agents:W,agentIcons:P,selectedAgent:T,isPopoverOpen:V,debouncedHoveredAgent:A,setHoveredAgent:N,setIsPopoverOpen:F,setSelectedAgent:_,chatInputRef:D,openAgentEditCard:ei,userConfig:e.userConfig})]}),(0,i.jsxs)("div",{className:"mx-auto ".concat(e.isMobileWidth?"w-full":"w-full max-w-screen-md"),children:[!e.isMobileWidth&&(0,i.jsx)("div",{className:"w-full ".concat(l().inputBox," shadow-lg bg-background align-middle items-center justify-center px-3 py-1 dark:bg-neutral-700 border-stone-100 dark:border-none dark:shadow-none rounded-2xl"),children:(0,i.jsx)(S.a,{isLoggedIn:e.isLoggedIn,prefillMessage:r,focus:d,sendMessage:e=>o(e),sendImage:e=>u(t=>[...t,e]),sendDisabled:g,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(t=W.find(e=>e.slug===T))||void 0===t?void 0:t.color,ref:D,setTriggeredAbort:()=>{}})}),0==L.length&&(0,i.jsx)("div",{className:"".concat(l().suggestions," w-full ").concat(e.isMobileWidth&&H.length>3?"grid grid-cols-2":"grid grid-cols-3",' "justify-center items-center"'),children:v.map((t,a)=>(0,i.jsx)("div",{onClick:a=>{e.isLoggedIn?function(e){p(e.intent);let t=Z[e.type]||[];C(e),M(t),m(e.focus)}(t):(a.preventDefault(),a.stopPropagation(),q(!0))},children:(0,i.jsx)(G,{title:t.type,body:t.actionTagline,color:t.color},t.type+Math.random())},"".concat(t.type," ").concat(t.actionTagline)))}),0==L.length&&v.length<H.length&&(0,i.jsx)("div",{className:"flex items-center justify-center margin-auto",children:(0,i.jsxs)("button",{onClick:function(){b(H)},className:"m-2 p-1.5 rounded-lg dark:hover:bg-[var(--background-color)] hover:bg-stone-100 border border-stone-100 text-sm text-stone-500 dark:text-stone-300 dark:border-neutral-700",children:["Show All ",(0,i.jsx)(y,{className:"h-4 w-4 inline"})]})}),I&&(0,i.jsx)($,{title:I.type,body:I.actionTagline,color:I.color,onClick:()=>{p(""),C(null),M([]),m(S.$.MESSAGE)}}),L.length>0&&(0,i.jsx)("div",{className:"w-full ".concat(e.isMobileWidth?"grid":"grid grid-cols-1"," justify-center items-center gap-2 p-2"),children:L.map((e,t)=>(0,i.jsx)("div",{className:"w-full cursor-pointer animate-fade-in-up",onClick:t=>{o(e.prompt)},children:(0,i.jsx)(U,{prompt:e.prompt},e.prompt)},"".concat(e.prompt," ").concat(t)))})]}),e.isMobileWidth&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"".concat(l().inputBox," pt-1 shadow-[0_-20px_25px_-5px_rgba(0,0,0,0.1)] dark:bg-neutral-700 bg-background align-middle items-center justify-center pb-3 mx-1 rounded-2xl mb-2"),children:[(0,i.jsxs)(ee.x,{className:"w-full max-w-[85vw]",children:[(0,i.jsx)("div",{className:"flex gap-2 items-center justify-left pt-1 pb-2 px-12",children:P.map((e,t)=>(0,i.jsx)(j.Zb,{className:"".concat(T===W[t].slug?(0,Y.Iu)(W[t].color):"border-muted text-muted-foreground"," hover:cursor-pointer"),children:(0,i.jsxs)(j.ll,{className:"text-center text-xs font-medium flex justify-center items-center whitespace-nowrap px-1.5 py-1",onDoubleClick:()=>ei(W[t].slug),onClick:()=>{var e;_(W[t].slug),null===(e=D.current)||void 0===e||e.focus()},children:[e," ",W[t].name]})},"".concat(t,"-").concat(W[t].slug)))}),(0,i.jsx)(ee.B,{orientation:"horizontal"})]}),(0,i.jsx)(S.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>u(t=>[...t,e]),sendDisabled:g,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(a=W.find(e=>e.slug===T))||void 0===a?void 0:a.color,ref:D,setTriggeredAbort:()=>{}})]})})]})}function eh(){let[e,t]=(0,s.useState)(null),[a,n]=(0,s.useState)(!0),[o,r]=(0,s.useState)(null),[c,p]=(0,s.useState)(null),d=(0,Q.IC)(),{userConfig:m,isLoadingUserConfig:h}=(0,J.h2)(!0),[u,g]=(0,s.useState)(null),{data:f,error:x,isLoading:w}=(0,J.GW)();return((0,s.useEffect)(()=>{g(m)},[m]),(0,s.useEffect)(()=>{c&&localStorage.setItem("uploadedFiles",JSON.stringify(c))},[c]),(0,s.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{n(!1),e&&t(e)}).catch(e=>{console.error(e)})},[]),a)?(0,i.jsx)(q.Z,{}):(0,i.jsxs)(es.Hn,{children:[(0,i.jsx)(ec.S,{conversationId:o}),(0,i.jsxs)(es.kV,{children:[(0,i.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,i.jsx)(es.vP,{className:"-ml-1"}),(0,i.jsx)(ep.Z,{orientation:"vertical",className:"mr-2 h-4"}),d?(0,i.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,i.jsx)(eo.VO,{className:"h-auto w-16"})}):(0,i.jsx)("h2",{className:"text-lg",children:"Ask Anything"})]}),(0,i.jsxs)("div",{className:"".concat(l().main," ").concat(l().chatLayout),children:[(0,i.jsx)("title",{children:"Khoj AI - Your Second Brain"}),(0,i.jsx)("div",{className:"".concat(l().chatBox),children:(0,i.jsx)("div",{className:"".concat(l().chatBoxBody),children:!w&&(0,i.jsx)(em,{isLoggedIn:!!f,chatOptionsData:e,setUploadedFiles:p,isMobileWidth:d,onConversationIdChange:e=>{r(e)},userConfig:u,isLoadingUserConfig:h})})})]})]})]})}},99376:function(e,t,a){"use strict";var n=a(35475);a.o(n,"useRouter")&&a.d(t,{useRouter:function(){return n.useRouter}}),a.o(n,"useSearchParams")&&a.d(t,{useSearchParams:function(){return n.useSearchParams}})},47960:function(){},64670:function(e){e.exports={card:"suggestions_card__fbiZo",title:"suggestions_title__vNozc",text:"suggestions_text__J_IfY"}},76777:function(e){e.exports={main:"page_main__nw1Wk",suggestions:"page_suggestions__Y8EqU",inputBox:"page_inputBox__LrcZ4",chatBodyFull:"page_chatBodyFull__Qu2T2",chatBody:"page_chatBody__IirQQ",chatLayout:"page_chatLayout__bJUjP",chatBox:"page_chatBox__gsR6V",titleBar:"page_titleBar__3btUI",chatBoxBody:"page_chatBoxBody__xORKr",homeGreetings:"page_homeGreetings__VjQhh"}}},function(e){e.O(0,[3587,6250,8255,8221,9853,9259,8667,182,9665,4270,7647,2327,5477,5427,2971,2117,1744],function(){return e(e.s=1507)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6938],{62960:function(e,t,s){Promise.resolve().then(s.bind(s,31537))},31537:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return ei}});var a,n,r=s(57437),i=s(917),o=s.n(i);s(97510);var l=s(2265),c=s(77992),d=s(56937),h=s(7436),m=s(67341),x=s(62869),u=s(26371),p=s(95186),j=s(66070),f=s(84190),g=s(94508);let b=l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:t,className:(0,g.cn)("w-full caption-bottom text-sm",s),...a})})});b.displayName="Table",l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("thead",{ref:t,className:(0,g.cn)("[&_tr]:border-b",s),...a})}).displayName="TableHeader";let w=l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tbody",{ref:t,className:(0,g.cn)("[&_tr:last-child]:border-0",s),...a})});w.displayName="TableBody",l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tfoot",{ref:t,className:(0,g.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a})}).displayName="TableFooter";let N=l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tr",{ref:t,className:(0,g.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...a})});N.displayName="TableRow",l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("th",{ref:t,className:(0,g.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...a})}).displayName="TableHead";let y=l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("td",{ref:t,className:(0,g.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...a})});y.displayName="TableCell",l.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("caption",{ref:t,className:(0,g.cn)("mt-4 text-sm text-muted-foreground",s),...a})}).displayName="TableCaption";var v=s(3894),_=s(81228),k=s(89203),S=s(94018),T=s(13272),C=s(88435),D=s(19841),F=s(37295),E=s(2049),P=s(50525),O=s(5147),A=s(80438),I=s(2452),Y=s(47615),z=s(35099),K=s(22345),R=s(75216),W=s(47020),Z=s(90483),B=s(73925),M=s(54271),U=s(95656),V=s(58717),H=s(87296),L=s(56777),G=s(57466),q=s(97525),J=s(45178),X=s(14308),$=s(34688),Q=s(85872),ee=s(34124),et=s(6512),es=s(37104);let ea=e=>{var t,s;let{items:a,selected:n,callbackFunc:i}=e,[o,c]=(0,l.useState)(null!==(s=null==n?void 0:n.toString())&&void 0!==s?s:"0");return!!n&&(0,r.jsx)("div",{className:"overflow-hidden shadow-md rounded-lg",children:(0,r.jsxs)(f.h_,{children:[(0,r.jsx)(f.$F,{asChild:!0,className:"w-full rounded-lg",children:(0,r.jsxs)(x.z,{variant:"outline",className:"justify-start py-6 rounded-lg",children:[null===(t=a.find(e=>e.id.toString()===o))||void 0===t?void 0:t.name," ",(0,r.jsx)(v.p,{className:"h-4 w-4 ml-auto text-muted-foreground"})]})}),(0,r.jsx)(f.AW,{style:{maxHeight:"200px",overflowY:"auto",minWidth:"var(--radix-dropdown-menu-trigger-width)"},children:(0,r.jsx)(f._x,{value:o,onValueChange:async e=>{c(e),await i(e)},children:a.map(e=>(0,r.jsx)(f.qB,{value:e.id.toString(),children:e.name},e.id.toString()))})})]})})},en=()=>{let[e,t]=(0,l.useState)([]),{toast:s}=(0,c.pm)(),a=async()=>{try{let e=await fetch("/auth/token",{method:"POST",headers:{"Content-Type":"application/json"}}),s=await e.json();t(e=>[...e,s])}catch(e){console.error("Error generating API key:",e)}},n=async e=>{try{await navigator.clipboard.writeText(e),s({title:"\uD83D\uDD11 API Key",description:"Copied to clipboard"})}catch(e){console.error("Error copying API key:",e)}},r=async e=>{try{(await fetch("/auth/token?token=".concat(e),{method:"DELETE"})).ok&&t(t=>t.filter(t=>t.token!==e))}catch(e){console.error("Error deleting API key:",e)}},i=async()=>{try{let e=await fetch("/auth/token"),s=await e.json();(null==s?void 0:s.length)>0&&t(s)}catch(e){console.error("Error listing API keys:",e)}};return(0,l.useEffect)(()=>{i()},[]),{apiKeys:e,generateAPIKey:a,copyAPIKey:n,deleteAPIKey:r}};function er(){let{apiKeys:e,generateAPIKey:t,copyAPIKey:s,deleteAPIKey:a}=en(),[n,i]=(0,l.useState)(new Set),{toast:o}=(0,c.pm)();return(0,r.jsxs)(j.Zb,{className:"grid grid-flow-column border border-gray-300 shadow-md rounded-lg dark:bg-muted dark:border-none border-opacity-50 lg:w-2/3",children:[(0,r.jsxs)(j.Ol,{className:"text-xl grid grid-flow-col grid-cols-[1fr_auto] pb-0",children:[(0,r.jsxs)("span",{className:"flex flex-wrap",children:[(0,r.jsx)(_.s,{className:"h-7 w-7 mr-2"}),"API Keys"]}),(0,r.jsxs)(x.z,{variant:"secondary",className:"!mt-0",onClick:t,children:[(0,r.jsx)(k.v,{weight:"bold",className:"h-5 w-5 mr-2"}),"Generate Key"]})]}),(0,r.jsxs)(j.aY,{className:"overflow-hidden grid gap-6",children:[(0,r.jsxs)("p",{className:"text-md text-gray-400",children:["Access Khoj from the"," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/desktop",target:"_blank",children:"Desktop"}),", ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/obsidian",children:"Obsidian"}),","," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/emacs",children:"Emacs"})," apps and more."]}),(0,r.jsx)(b,{children:(0,r.jsx)(w,{children:e.map(e=>(0,r.jsxs)(N,{children:[(0,r.jsx)(y,{className:"pl-0 py-3",children:e.name}),(0,r.jsxs)(y,{className:"grid grid-flow-col grid-cols-[1fr_auto] bg-secondary dark:bg-background rounded-xl p-3 m-1",children:[(0,r.jsx)("span",{className:"font-mono text-left w-[50px] md:w-[400px]",children:n.has(e.token)?e.token:"".concat(e.token.slice(0,6),"...").concat(e.token.slice(-4))}),(0,r.jsxs)("div",{className:"grid grid-flow-col",children:[n.has(e.token)?(0,r.jsx)(S.N,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>i(t=>{let s=new Set(t);return s.delete(e.token),s})}):(0,r.jsx)(T.b,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>i(new Set([...n,e.token]))}),(0,r.jsx)(C.C,{weight:"bold",className:"h-4 w-4 mr-2 hover:bg-primary/40",onClick:()=>{o({title:"\uD83D\uDD11 Copied API Key: ".concat(e.name),description:"Set this API key in the Khoj apps you want to connect to this Khoj account"}),s(e.token)}}),(0,r.jsx)(D.r,{weight:"bold",className:"h-4 w-4 mr-2 md:ml-4 text-red-400 hover:bg-primary/40",onClick:()=>{o({title:"\uD83D\uDD11 Deleted API Key: ".concat(e.name),description:"Apps using this API key will no longer connect to this Khoj account"}),a(e.token)}})]})]})]},e.token))})})]}),(0,r.jsx)(j.eW,{className:"flex flex-wrap gap-4"})]})}function ei(){let{userConfig:e}=(0,d.h2)(!0),[t,s]=(0,l.useState)(null),[a,n]=(0,l.useState)(void 0),[i,f]=(0,l.useState)(null),[g,b]=(0,l.useState)(void 0),[w,N]=(0,l.useState)(""),[y,v]=(0,l.useState)("verified"),{toast:_}=(0,c.pm)(),k=(0,h.IC)(),S="w-full lg:w-5/12 grid grid-flow-column border border-gray-300 shadow-md rounded-lg border dark:border-none border-opacity-50 dark:bg-muted";(0,l.useEffect)(()=>{var t;s(e),b(null==e?void 0:e.phone_number),v((null==e?void 0:e.is_phone_number_verified)?"verified":(null==e?void 0:e.phone_number)?"otp":"setup"),n(null==e?void 0:e.given_name),f(null!==(t=null==e?void 0:e.notion_token)&&void 0!==t?t:null)},[e]);let T=async()=>{try{if(!(await fetch("/api/phone?phone_number=".concat(g),{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to send OTP");v("verify")}catch(e){console.error("Error sending OTP:",e),_({title:"\uD83D\uDCF1 Phone",description:"Failed to send OTP. Try again or contact us at team@khoj.dev"})}},C=async()=>{try{if(!(await fetch("/api/phone/verify?code=".concat(w),{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to verify OTP");v("verified"),_({title:"\uD83D\uDCF1 Phone",description:"Phone number verified"})}catch(e){console.error("Error verifying OTP:",e),_({title:"\uD83D\uDCF1 Phone",description:"Failed to verify OTP. Try again or contact us at team@khoj.dev"})}},D=async()=>{try{if(!(await fetch("/api/phone",{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to disconnect phone number");b(void 0),v("setup"),_({title:"\uD83D\uDCF1 Phone",description:"Phone number disconnected"})}catch(e){console.error("Error disconnecting phone number:",e),_({title:"\uD83D\uDCF1 Phone",description:"Failed to disconnect phone number. Try again or contact us at team@khoj.dev"})}},en=async e=>{try{if(!(await fetch("/api/subscription?operation=".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to change subscription");t&&(t.subscription_state="cancel"===e?d.o9.UNSUBSCRIBED:d.o9.SUBSCRIBED,s(t)),_({title:"\uD83D\uDCB3 Subscription",description:(null==t?void 0:t.subscription_state)==="unsubscribed"?"Your subscription was cancelled":"Your Futurist subscription has been renewed"})}catch(t){console.error("Error changing subscription:",t),_({title:"\uD83D\uDCB3 Subscription",description:"cancel"===e?"Failed to cancel subscription. Try again or contact us at team@khoj.dev":"Failed to renew subscription. Try again or contact us at team@khoj.dev"})}},ei=async()=>{try{let e=await fetch("/api/subscription/trial",{method:"POST"});if(!e.ok)throw Error("Failed to enable free trial");if((await e.json()).trial_enabled&&t){t.subscription_state=d.o9.TRIAL;let e=new Date(Date.now()+864e5*t.length_of_free_trial);t.subscription_renewal_date=(e=>{let t=new Date(e);return new Intl.DateTimeFormat("en-US",{day:"2-digit",month:"short",year:"numeric"}).format(t)})(e),t.subscription_enabled_trial_at=new Date().toISOString(),s(t),_({title:"\uD83C\uDF89 Trial Enabled",description:"Your free trial will end on ".concat(t.subscription_renewal_date)})}}catch(e){console.error("Error enabling free trial:",e),_({title:"⚠️ Failed to Enable Free Trial",description:"Failed to enable free trial. Try again or contact us at team@khoj.dev"})}},eo=async()=>{if(a)try{if(!(await fetch("/api/user/name?name=".concat(a),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to update name");t&&(t.given_name=a,s(t)),_({title:"✅ Updated Profile",description:"You name has been updated to ".concat(a)})}catch(e){console.error("Error updating name:",e),_({title:"⚠️ Failed to Update Profile",description:"Failed to update name. Try again or contact team@khoj.dev"})}},el=e=>async s=>{if(!(null==t?void 0:t.is_active)){_({title:"Model Update",description:"You need to be subscribed to update ".concat(e," models"),variant:"destructive"});return}try{if(!(await fetch("/api/model/".concat(e,"?id=")+s,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to update model");_({title:"✅ Updated ".concat((0,h.LF)(e)," Model")})}catch(t){console.error("Failed to update ".concat(e," model:"),t),_({description:"❌ Failed to update ".concat((0,h.LF)(e)," model. Try again."),variant:"destructive"})}},ec=async()=>{if(i)try{if(!(await fetch("/api/content/notion",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:i})})).ok)throw Error("Failed to save Notion API key");t&&(t.notion_token=i,s(t)),_({title:"✅ Saved Notion Settings",description:"You Notion API key has been saved."})}catch(e){console.error("Error updating name:",e),_({title:"⚠️ Failed to Save Notion Settings",description:"Failed to save Notion API key. Try again or contact team@khoj.dev"})}},ed=async e=>{try{if(!(await fetch("/api/content?t=".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to sync content from ".concat(e));_({title:"\uD83D\uDD04 Syncing ".concat(e),description:"Your ".concat(e," content is being synced.")})}catch(t){console.error("Error syncing content:",t),_({title:"⚠️ Failed to Sync ".concat(e),description:"Failed to sync ".concat(e," content. Try again or contact team@khoj.dev")})}},eh=async e=>{try{if(!(await fetch("/api/content/".concat(e),{method:"DELETE",headers:{"Content-Type":"application/json"}})).ok)throw Error("Failed to disconnect ".concat(e));t&&("computer"===e?t.enabled_content_source.computer=!1:"notion"===e?(t.enabled_content_source.notion=!1,t.notion_token=null,f(t.notion_token)):"github"===e&&(t.enabled_content_source.github=!1),s(t)),"computer"===e?_({title:"✅ Deleted Synced Files",description:"Your synced documents have been deleted."}):_({title:"✅ Disconnected ".concat(e),description:"Your ".concat(e," integration to Khoj has been disconnected.")})}catch(t){console.error("Error disconnecting ".concat(e,":"),t),_({title:"⚠️ Failed to Disconnect ".concat(e),description:"Failed to disconnect from ".concat(e,". Try again or contact team@khoj.dev")})}};return t?(0,r.jsxs)(Q.Hn,{children:[(0,r.jsx)(ee.S,{conversationId:""}),(0,r.jsxs)(Q.kV,{children:[(0,r.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,r.jsx)(Q.vP,{className:"-ml-1"}),(0,r.jsx)(et.Z,{orientation:"vertical",className:"mr-2 h-4"}),k?(0,r.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,r.jsx)(es.VO,{className:"h-auto w-16"})}):(0,r.jsx)("h2",{className:"text-lg",children:"Settings"})]}),(0,r.jsxs)("div",{className:o().page,children:[(0,r.jsx)("title",{children:"Settings"}),(0,r.jsx)("div",{className:o().content,children:(0,r.jsx)("div",{className:"".concat(o().contentBody," mx-10 my-2"),children:(0,r.jsx)(l.Suspense,{fallback:(0,r.jsx)(X.Z,{}),children:(0,r.jsxs)("div",{id:"content",className:"grid grid-flow-column sm:grid-flow-row gap-16 m-8",children:[(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Profile"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[(0,r.jsxs)(j.Zb,{className:S,children:[(0,r.jsxs)(j.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(F.Y,{className:"h-7 w-7 mr-2"}),"Name"]}),(0,r.jsxs)(j.aY,{className:"overflow-hidden",children:[(0,r.jsx)("p",{className:"pb-4 text-gray-400",children:"What should Khoj refer to you as?"}),(0,r.jsx)(p.I,{type:"text",onChange:e=>n(e.target.value),value:a,className:"w-full border border-gray-300 rounded-lg p-4 py-6"})]}),(0,r.jsx)(j.eW,{className:"flex flex-wrap gap-4",children:(0,r.jsxs)(x.z,{variant:"outline",size:"sm",onClick:eo,disabled:a===t.given_name,children:[(0,r.jsx)(E.B,{className:"h-5 w-5 inline mr-2"}),"Save"]})})]}),(0,r.jsxs)(j.Zb,{id:"subscription",className:S,children:[(0,r.jsxs)(j.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(P.a,{className:"h-7 w-7 mr-2"}),"Subscription"]}),(0,r.jsxs)(j.aY,{className:"grid gap-2 overflow-hidden",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Current Plan"}),"trial"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl text-primary/80",children:"Futurist (Trial)"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["You are on a"," ",t.length_of_free_trial," ","day trial of the Khoj Futurist plan. Your trial ends on"," ",t.subscription_renewal_date,". Check"," ",(0,r.jsx)("a",{href:"https://khoj.dev/#pricing",target:"_blank",children:"pricing page"})," ","to compare plans."]})]})||"subscribed"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl text-primary/80",children:"Futurist"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"renews"})," on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})]})||"unsubscribed"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl",children:"Futurist"}),(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"ends"})," on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})]})||"expired"===t.subscription_state&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xl",children:"Humanist"}),t.subscription_renewal_date&&(0,r.jsxs)("p",{className:"text-gray-400",children:["Subscription ",(0,r.jsx)("b",{children:"expired"})," ","on"," ",(0,r.jsx)("b",{children:t.subscription_renewal_date})]})||(0,r.jsxs)("p",{className:"text-gray-400",children:["Check"," ",(0,r.jsx)("a",{href:"https://khoj.dev/#pricing",target:"_blank",children:"pricing page"})," ","to compare plans."]})]})]}),(0,r.jsx)(j.eW,{className:"flex flex-wrap gap-4",children:"subscribed"==t.subscription_state&&(0,r.jsxs)(x.z,{variant:"outline",className:"hover:text-red-400",onClick:()=>en("cancel"),children:[(0,r.jsx)(O.b,{className:"h-5 w-5 mr-2"}),"Unsubscribe"]})||"unsubscribed"==t.subscription_state&&(0,r.jsxs)(x.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:()=>en("resubscribe"),children:[(0,r.jsx)(A.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Resubscribe"]})||t.subscription_enabled_trial_at&&(0,r.jsxs)(x.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:()=>window.open("".concat(t.khoj_cloud_subscription_url,"?prefilled_email=").concat(t.username),"_blank","noopener,noreferrer"),children:[(0,r.jsx)(A.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Subscribe"]})||(0,r.jsxs)(x.z,{variant:"outline",className:"text-primary/80 hover:text-primary",onClick:ei,children:[(0,r.jsx)(A.e,{weight:"bold",className:"h-5 w-5 mr-2"}),"Enable Trial"]})})]})]})]}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Content"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[(0,r.jsxs)(j.Zb,{id:"computer",className:S,children:[(0,r.jsxs)(j.Ol,{className:"flex flex-row text-xl",children:[(0,r.jsx)(I.a,{className:"h-8 w-8 mr-2"}),"Knowledge Base",t.enabled_content_source.computer&&(0,r.jsx)(Y.f,{className:"h-6 w-6 ml-auto text-green-500",weight:"fill"})]}),(0,r.jsx)(j.aY,{className:"overflow-hidden pb-12 text-gray-400",children:"Manage and search through your digital brain."}),(0,r.jsxs)(j.eW,{className:"flex flex-wrap gap-4",children:[(0,r.jsxs)(x.z,{variant:"outline",size:"sm",title:"Search thorugh files",onClick:()=>window.location.href="/search",children:[(0,r.jsx)(z.Y,{className:"h-5 w-5 inline mr-1"}),"Search"]}),(0,r.jsxs)(x.z,{variant:"outline",size:"sm",className:"".concat(t.enabled_content_source.computer||"hidden"),onClick:()=>eh("computer"),children:[(0,r.jsx)(K.u,{className:"h-5 w-5 inline mr-1"}),"Clear All"]})]})]}),(0,r.jsxs)(j.Zb,{id:"github",className:"".concat(S," hidden"),children:[(0,r.jsxs)(j.Ol,{className:"flex flex-row text-2xl",children:[(0,r.jsx)(R.b,{className:"h-8 w-8 mr-2"}),"Github"]}),(0,r.jsx)(j.aY,{className:"overflow-hidden pb-12 text-gray-400",children:"Set Github repositories to index"}),(0,r.jsxs)(j.eW,{className:"flex flex-wrap gap-4",children:[(0,r.jsx)(x.z,{variant:"outline",size:"sm",children:t.enabled_content_source.github&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(W.h,{className:"h-5 w-5 inline mr-1"}),"Manage"]})||(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Z.F,{className:"h-5 w-5 inline mr-1"}),"Connect"]})}),(0,r.jsxs)(x.z,{variant:"outline",size:"sm",className:"".concat(t.enabled_content_source.github||"hidden"),children:[(0,r.jsx)(K.u,{className:"h-5 w-5 inline mr-1"}),"Disable"]})]})]}),(0,r.jsxs)(j.Zb,{id:"notion",className:S,children:[(0,r.jsxs)(j.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(B.F,{className:"h-7 w-7 mr-2"}),"Notion",t.enabled_content_source.notion&&(0,r.jsx)(Y.f,{className:"h-6 w-6 ml-auto text-green-500",weight:"fill"})]}),(0,r.jsxs)(j.aY,{className:"grid gap-4",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Sync your Notion workspace."}),!t.notion_oauth_url&&(0,r.jsx)(p.I,{onChange:e=>f(e.target.value),value:i||"",placeholder:"Enter API Key of your Khoj integration on Notion",className:"w-full border border-gray-300 rounded-lg px-4 py-6"})]}),(0,r.jsxs)(j.eW,{className:"flex flex-wrap gap-4",children:[t.notion_oauth_url&&!t.enabled_content_source.notion?(0,r.jsxs)(x.z,{variant:"outline",size:"sm",onClick:()=>{window.open(t.notion_oauth_url)},children:[(0,r.jsx)(Z.F,{className:"h-5 w-5 inline mr-1"}),"Connect"]}):t.enabled_content_source.notion&&i===t.notion_token?(0,r.jsxs)(x.z,{variant:"outline",size:"sm",onClick:()=>ed("notion"),children:[(0,r.jsx)(M.t,{className:"h-5 w-5 inline mr-1"}),"Sync"]}):t.notion_oauth_url?(0,r.jsx)(r.Fragment,{}):(0,r.jsxs)(x.z,{variant:"outline",size:"sm",onClick:ec,disabled:i===t.notion_token,children:[(0,r.jsx)(E.B,{className:"h-5 w-5 inline mr-1"}),t.enabled_content_source.notion&&"Update API Key"||"Set API Key"]}),(0,r.jsxs)(x.z,{variant:"outline",size:"sm",className:"".concat(t.notion_token||"hidden"),onClick:()=>eh("notion"),children:[(0,r.jsx)(K.u,{className:"h-5 w-5 inline mr-1"}),"Disconnect"]})]})]})]})]}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{className:"text-2xl",children:"Models"}),(0,r.jsxs)("div",{className:"cards flex flex-wrap gap-16",children:[t.chat_model_options.length>0&&(0,r.jsxs)(j.Zb,{className:S,children:[(0,r.jsxs)(j.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(U.G,{className:"h-7 w-7 mr-2"}),"Chat"]}),(0,r.jsxs)(j.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the chat model to generate text responses"}),(0,r.jsx)(ea,{items:t.chat_model_options,selected:t.selected_chat_model_config,callbackFunc:el("chat")})]}),(0,r.jsx)(j.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]}),t.paint_model_options.length>0&&(0,r.jsxs)(j.Zb,{className:S,children:[(0,r.jsxs)(j.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(V.Y,{className:"h-7 w-7 mr-2"}),"Paint"]}),(0,r.jsxs)(j.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the paint model to generate image responses"}),(0,r.jsx)(ea,{items:t.paint_model_options,selected:t.selected_paint_model_config,callbackFunc:el("paint")})]}),(0,r.jsx)(j.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]}),t.voice_model_options.length>0&&(0,r.jsxs)(j.Zb,{className:S,children:[(0,r.jsxs)(j.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(H.u,{className:"h-7 w-7 mr-2"}),"Voice"]}),(0,r.jsxs)(j.aY,{className:"overflow-hidden pb-12 grid gap-8 h-fit",children:[(0,r.jsx)("p",{className:"text-gray-400",children:"Pick the voice model to generate speech responses"}),(0,r.jsx)(ea,{items:t.voice_model_options,selected:t.selected_voice_model_config,callbackFunc:el("voice")})]}),(0,r.jsx)(j.eW,{className:"flex flex-wrap gap-4",children:!t.is_active&&(0,r.jsx)("p",{className:"text-gray-400",children:"Subscribe to switch model"})})]})]})]}),(0,r.jsxs)("div",{className:"section grid gap-8",children:[(0,r.jsx)("div",{id:"clients",className:"text-2xl",children:"Clients"}),(0,r.jsxs)("div",{className:"cards flex flex-col flex-wrap gap-8",children:[!t.anonymous_mode&&(0,r.jsx)(er,{}),(0,r.jsxs)(j.Zb,{className:"".concat(S," lg:w-2/3"),children:[(0,r.jsxs)(j.Ol,{className:"text-xl flex flex-row",children:[(0,r.jsx)(L.V,{className:"h-7 w-7 mr-2"}),"Chat on Whatsapp","verified"===y&&(0,r.jsx)(Y.f,{weight:"bold",className:"h-4 w-4 ml-1 text-green-400"})||"setup"!==y&&(0,r.jsx)(G.C,{weight:"bold",className:"h-4 w-4 ml-1 text-yellow-400"})]}),(0,r.jsxs)(j.aY,{className:"grid gap-4",children:[(0,r.jsxs)("p",{className:"text-gray-400",children:["Connect your number to chat with Khoj on WhatsApp. Learn more about the integration"," ",(0,r.jsx)("a",{href:"https://docs.khoj.dev/clients/whatsapp",children:"here"}),"."]}),(0,r.jsxs)("div",{children:[(0,r.jsx)($.Z,{initialValue:g||"",onChangeNumber:b,disabled:"verify"===y,initOptions:{separateDialCode:!0,initialCountry:"af",utilsScript:"https://assets.khoj.dev/intl-tel-input%4023.8.0_build_js_utils.js",containerClass:"".concat(o().phoneInput)}}),"verify"===y&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{children:"Enter the OTP sent to your number: ".concat(g)}),(0,r.jsx)(u.Zn,{autoFocus:!0,maxLength:6,value:w||"",onChange:N,onComplete:()=>v("verify"),children:(0,r.jsxs)(u.hf,{children:[(0,r.jsx)(u.cY,{index:0}),(0,r.jsx)(u.cY,{index:1}),(0,r.jsx)(u.cY,{index:2}),(0,r.jsx)(u.cY,{index:3}),(0,r.jsx)(u.cY,{index:4}),(0,r.jsx)(u.cY,{index:5})]})})]})]})]}),(0,r.jsxs)(j.eW,{className:"flex flex-wrap gap-4",children:["verify"===y&&(0,r.jsx)(x.z,{variant:"outline",onClick:C,children:"Verify"})||(0,r.jsx)(x.z,{variant:"outline",disabled:!g||g===t.phone_number&&"verified"===y||!(0,m.y)(g),onClick:T,children:t.phone_number?g&&(g!==t.phone_number||"verified"!==y)&&(0,m.y)(g)?(0,r.jsxs)(r.Fragment,{children:["Send OTP"," ",(0,r.jsx)(J.o,{className:"inline ml-2",weight:"bold"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(q.F,{className:"inline mr-2 text-green-400"}),"Switch Number"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Z.F,{className:"inline mr-2"}),"Setup Whatsapp"]})}),"verified"===y&&(0,r.jsxs)(x.z,{variant:"outline",onClick:()=>D(),children:[(0,r.jsx)(K.u,{className:"h-5 w-5 mr-2"}),"Disconnect"]})]})]})]})]})]})})})})]})]})]}):(0,r.jsx)(X.Z,{})}(a=n||(n={})).Setup="setup",a.SendOTP="otp",a.VerifyOTP="verify",a.Verified="verified"},77992:function(e,t,s){"use strict";s.d(t,{pm:function(){return m}});var a=s(2265);let n=0,r=new Map,i=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},o=(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:s}=t;return s?i(s):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===s||void 0===s?{...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=o(c,e),l.forEach(e=>{e(c)})}function h(e){let{...t}=e,s=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),a=()=>d({type:"DISMISS_TOAST",toastId:s});return d({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:e=>{e||a()}}}),{id:s,dismiss:a,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:s}})}}function m(){let[e,t]=a.useState(c);return a.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:h,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},917:function(e){e.exports={page:"settings_page__mP7qk",contentBody:"settings_contentBody__uZjue",phoneInput:"settings_phoneInput__j6xJN"}}},function(e){e.O(0,[6008,9853,8221,9259,8667,182,6244,1199,2327,2971,2117,1744],function(){return e(e.s=62960)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7138,3317,8459],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3111],{91955:function(e,t,s){Promise.resolve().then(s.bind(s,41694))},41694:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return f}});var a=s(57437),n=s(22515),o=s.n(n),i=s(2265),c=s(74986),r=s(14308);s(2446);var l=s(7436),d=s(56937),h=s(5477),u=s(85872),g=s(34124),m=s(6512),p=s(37104);function x(e){let[t,s]=(0,i.useState)(""),[n,r]=(0,i.useState)([]),[l,d]=(0,i.useState)(!1),[u,g]=(0,i.useState)(null),m=(0,i.useRef)(null),p=e.setQueryToProcess,x=e.streamedMessages,f=e.isMobileWidth?"w-full":"w-4/6";return((0,i.useEffect)(()=>{if(n.length>0){let t=n.map(e=>encodeURIComponent(e));e.setImages(t)}},[n,e.setImages]),(0,i.useEffect)(()=>{t&&(d(!0),p(t))},[t,p]),(0,i.useEffect)(()=>{x&&x.length>0&&x[x.length-1].completed?d(!1):s("")},[x]),e.publicConversationSlug||e.conversationId)?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:o().chatBodyFull,children:(0,a.jsx)(c.Z,{publicConversationSlug:e.publicConversationSlug,conversationId:e.conversationId||"",setAgent:g,setTitle:e.setTitle,pendingMessage:l?t:"",incomingMessages:e.streamedMessages,customClassName:f})}),(0,a.jsx)("div",{className:"".concat(o().inputBox," 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(f," mr-auto ml-auto"),children:(0,a.jsx)(h.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>s(e),sendImage:e=>r(t=>[...t,e]),sendDisabled:l,chatOptionsData:e.chatOptionsData,conversationId:e.conversationId,agentColor:null==u?void 0:u.color,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,setTriggeredAbort:()=>{},ref:m})})]}):(0,a.jsx)("div",{className:o().suggestions,children:"Whoops, nothing to see here!"})}function f(){let[e,t]=(0,i.useState)(null),[s,n]=(0,i.useState)(!0),[c,h]=(0,i.useState)("Khoj AI - Chat"),[f,_]=(0,i.useState)(void 0),[v,j]=(0,i.useState)([]),[S,C]=(0,i.useState)(""),[I,b]=(0,i.useState)(null),[N,y]=(0,i.useState)(void 0),[B,w]=(0,i.useState)([]),{data:O,error:k,isLoading:M}=(0,d.GW)(),E=(0,l.IC)();return((0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{n(!1),e&&t(e)}).catch(e=>{console.error(e)}),(0,l.EK)(),y(window.location.pathname.split("/").pop()||"")},[]),(0,i.useEffect)(()=>{I&&localStorage.setItem("uploadedFiles",JSON.stringify(I))},[I]),(0,i.useEffect)(()=>{if(S&&!f){fetch("/api/chat/share/fork?public_conversation_slug=".concat(N),{method:"POST",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{_(e.conversation_id),localStorage.setItem("message",S),B.length>0&&localStorage.setItem("images",JSON.stringify(B)),window.location.href="/chat?conversationId=".concat(e.conversation_id)}).catch(e=>{console.error(e)});return}},[S,f,N]),s)?(0,a.jsx)(r.Z,{}):N?(0,a.jsxs)(u.Hn,{children:[(0,a.jsx)(g.S,{conversationId:f||""}),(0,a.jsxs)(u.kV,{children:[(0,a.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,a.jsx)(u.vP,{className:"-ml-1"}),(0,a.jsx)(m.Z,{orientation:"vertical",className:"mr-2 h-4"}),N&&(0,a.jsx)("div",{className:"".concat(o().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:E?(0,a.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,a.jsx)(p.VO,{className:"h-auto w-16"})}):c&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden mr-4",children:c})})})]}),(0,a.jsxs)("div",{className:"".concat(o().main," ").concat(o().chatLayout),children:[(0,a.jsx)("title",{children:c}),(0,a.jsx)("div",{className:o().chatBox,children:(0,a.jsx)("div",{className:o().chatBoxBody,children:(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(r.Z,{}),children:(0,a.jsx)(x,{conversationId:f,streamedMessages:v,setQueryToProcess:C,isLoggedIn:!!O,publicConversationSlug:N,chatOptionsData:e,setTitle:h,setUploadedFiles:b,isMobileWidth:E,setImages:w})})})})]})]})]}):(0,a.jsx)("div",{className:o().suggestions,children:"Whoops, nothing to see here!"})}},22515:function(e){e.exports={main:"sharedChat_main__7Nayy",suggestions:"sharedChat_suggestions__V8kr_",inputBox:"sharedChat_inputBox__wRW5A",chatBodyFull:"sharedChat_chatBodyFull__O1MOv",chatBody:"sharedChat_chatBody__OnHDL",chatLayout:"sharedChat_chatLayout__gutlc",chatBox:"sharedChat_chatBox__PmAPg",titleBar:"sharedChat_titleBar__vOHp_",chatBoxBody:"sharedChat_chatBoxBody__ef2Nl",agentIndicator:"sharedChat_agentIndicator__ORCl4"}}},function(e){e.O(0,[9346,8255,9853,8221,3954,1919,9259,8667,182,4270,6002,2327,5477,4986,2971,2117,1744],function(){return e(e.s=91955)}),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- div.agents_titleBar__FzYbY{padding:16px 0;text-align:left}.agents_agentPersonality__o0Ysz p{white-space:inherit;overflow:hidden;height:77px;line-height:1.5}div.agents_agentPersonality__o0Ysz{text-align:left;grid-column:span 3;overflow:hidden}div.agents_pageLayout__gR3S3{max-width:60vw;margin:auto auto 2rem}button.agents_infoButton__NqI7E{border:none;background-color:transparent!important;text-align:left;font-family:inherit;font-size:medium}div.agents_agentList__XVx4A{display:grid;gap:20px;padding-top:30px;margin-right:auto;grid-auto-flow:row;grid-template-columns:1fr 1fr;margin-left:auto}@media only screen and (max-width:768px){div.agents_agentList__XVx4A{width:100%;padding:0;margin-right:auto;margin-left:auto;grid-template-columns:1fr}div.agents_pageLayout__gR3S3{max-width:90vw}}.loginPrompt_gsiMaterialButton__8QVFH{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-webkit-appearance:none;background-image:none;border-radius:20px;box-sizing:border-box;color:#1f1f1f;cursor:pointer;font-family:Roboto,arial,sans-serif;font-size:14px;height:40px;letter-spacing:.25px;outline:none;overflow:hidden;padding:0;position:relative;text-align:center;transition:background-color .218s,border-color .218s,box-shadow .218s;vertical-align:middle;white-space:nowrap;width:40px;max-width:400px;min-width:-moz-min-content;min-width:min-content}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonIcon__6TSC5{height:100%;min-width:20px;width:100%;margin:0;padding:9px}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonContentWrapper__9tahB{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;height:100%;justify-content:space-between;position:relative;width:100%}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonContents__3_YcB{flex-grow:1;font-family:Roboto,arial,sans-serif;font-weight:500;overflow:hidden;text-overflow:ellipsis;vertical-align:top}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonState__CDGQm{transition:opacity .218s;bottom:0;left:0;opacity:0;position:absolute;right:0;top:0}.loginPrompt_gsiMaterialButton__8QVFH:disabled{cursor:default;background-color:#ffffff61;border-color:#1f1f1f1f}.loginPrompt_gsiMaterialButton__8QVFH:disabled .loginPrompt_gsiMaterialButtonContents__3_YcB,.loginPrompt_gsiMaterialButton__8QVFH:disabled .loginPrompt_gsiMaterialButtonIcon__6TSC5{opacity:38%}.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):active .loginPrompt_gsiMaterialButton-State__mAfCZ,.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):focus .loginPrompt_gsiMaterialButtonState__CDGQm{background-color:#303030;opacity:12%}.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):hover{box-shadow:0 1px 2px 0 rgba(60,64,67,.3),0 1px 3px 1px rgba(60,64,67,.15)}.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):hover .loginPrompt_gsiMaterialButtonState__CDGQm{background-color:#303030;opacity:8%}div.automations_automationsLayout__Atoh_{display:grid;grid-template-columns:1fr 1fr;gap:1rem}div.automations_automationCard__BKidA{display:grid;grid-template-rows:auto 1fr auto}div.automations_pageLayout__OaoYA{max-width:60vw;margin:auto auto 2rem}@media screen and (max-width:768px){div.automations_automationsLayout__Atoh_{grid-template-columns:1fr}div.automations_pageLayout__OaoYA{max-width:90vw}}
@@ -1 +0,0 @@
1
- div.search_searchLayout__fP3m0{display:grid;grid-template-columns:1fr;gap:1rem;height:100%}@media screen and (max-width:768px){div.search_searchLayout__fP3m0{gap:0}}div.sidePanel_session__EeNjH{padding:.5rem;margin-bottom:.25rem;border-radius:.5rem;cursor:pointer;max-width:14rem;font-size:medium;display:grid;grid-template-columns:minmax(auto,400px) 1fr;gap:0}div.sidePanel_compressed__CUgIn{grid-template-columns:minmax(12rem,100%) 1fr 1fr}div.sidePanel_sessionHover__cf_VO,div.sidePanel_session__EeNjH:hover{background-color:hsla(var(--popover))}div.sidePanel_session__EeNjH:hover{color:hsla(var(--popover-foreground))}div.sidePanel_session__EeNjH a{text-decoration:none}button.sidePanel_button__NzdN_{border:none;outline:none;background-color:transparent;cursor:pointer;color:var(--main-text-color);width:24px}button.sidePanel_showMoreButton__nDt4Z{border-radius:.5rem;padding:8px}div.sidePanel_panel__9offQ{display:flex;flex-direction:column;padding:1rem;overflow-y:auto;max-width:auto;transition:background-color .5s}div.sidePanel_expanded__aHnYV{gap:1rem;background-color:hsla(var(--muted));height:100%}div.sidePanel_collapsed__ewO3e{display:grid;grid-template-columns:1fr;height:-moz-fit-content;height:fit-content;padding:1rem 0 0 1rem}p.sidePanel_session__EeNjH{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;text-align:left;font-size:small}p.sidePanel_compressed__CUgIn{width:12rem}p.sidePanel_expanded__aHnYV{max-width:20rem}div.sidePanel_header__NCT_v{display:grid;grid-template-columns:1fr auto}div.sidePanel_profile__pfAJU{display:grid;grid-template-columns:auto 1fr;gap:1rem;align-items:center;margin-top:auto}div.sidePanel_panelWrapper__cDMvb{display:grid;grid-template-rows:1fr auto auto;height:100%}div.sidePanel_modalSessionsList___u3aa{position:fixed;top:0;left:0;width:100%;height:100%;background-color:hsla(var(--frosted-background-color));z-index:1;display:flex;justify-content:center;align-items:center;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}div.sidePanel_modalSessionsList___u3aa div.sidePanel_content__z60YO{max-width:80%;max-height:80%;background-color:hsla(var(--frosted-background-color));overflow:auto;padding:20px;border-radius:10px}div.sidePanel_modalSessionsList___u3aa div.sidePanel_session__EeNjH{max-width:100%;text-overflow:ellipsis}@media screen and (max-width:768px){div.sidePanel_panel__9offQ{padding:.25rem;width:100%}div.sidePanel_expanded__aHnYV{z-index:1}div.sidePanel_singleReference__vmXZr{padding:4px}div.sidePanel_panelWrapper__cDMvb{width:100%;padding:0 1rem}div.sidePanel_session__EeNjH.sidePanel_compressed__CUgIn{max-width:100%;display:grid;grid-template-columns:70vw auto;justify-content:space-between}div.sidePanel_session__EeNjH{max-width:100%;grid-template-columns:minmax(auto,70vw) 1fr}}.agentCard_agentPersonality__MmRlN p{white-space:inherit;overflow:hidden;height:77px;line-height:1.5}div.agentCard_agentPersonality__MmRlN{text-align:left;grid-column:span 3;overflow:hidden}button.agentCard_infoButton__heh_w{border:none;background-color:transparent!important;text-align:left;font-family:inherit;font-size:medium}