nao-core 0.0.18__py3-none-any.whl → 0.0.22__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.
- nao_core/__init__.py +1 -1
- nao_core/bin/fastapi/main.py +4 -6
- nao_core/bin/nao-chat-server +0 -0
- nao_core/bin/public/assets/{_chat-layout-Do0mWziW.js → _chat-layout-BSDXwLlM.js} +1 -1
- nao_core/bin/public/assets/{_chat-layout.index-mxrV7qZY.js → _chat-layout.index-CWlZ1WSD.js} +1 -1
- nao_core/bin/public/assets/{agentProvider-cEZoyU1e.js → agentProvider-BkGOwLc-.js} +1 -1
- nao_core/bin/public/assets/{code-block-F6WJLWQG-oIWcWPcR.js → code-block-F6WJLWQG-BdtbfwZl.js} +1 -1
- nao_core/bin/public/assets/{createLucideIcon-BGNfPWE_.js → createLucideIcon-CAzRYUZ0.js} +1 -1
- nao_core/bin/public/assets/index-DD1IB790.css +1 -0
- nao_core/bin/public/assets/{index-B-_pu_22.js → index-gWi3S-SV.js} +2 -2
- nao_core/bin/public/assets/{login-CF4uOXFH.js → login-BEFjZaUF.js} +1 -1
- nao_core/bin/public/assets/{mermaid-FSSLJTFX-BzFakw7W.js → mermaid-FSSLJTFX-_2mzlJwk.js} +77 -75
- nao_core/bin/public/assets/{signinForm-D98dwmLQ.js → signinForm-D97br205.js} +1 -1
- nao_core/bin/public/assets/{signup-CQSmDpcH.js → signup-CU4v0Hqr.js} +1 -1
- nao_core/bin/public/index.html +2 -2
- nao_core/bin/rg +0 -0
- nao_core/commands/sync/databases.py +3 -3
- {nao_core-0.0.18.dist-info → nao_core-0.0.22.dist-info}/METADATA +1 -1
- {nao_core-0.0.18.dist-info → nao_core-0.0.22.dist-info}/RECORD +22 -23
- nao_core/bin/chats/588bbb8a-dcbc-42dc-b0d8-b6b9ed13e2fb.json +0 -45
- nao_core/bin/db.sqlite +0 -0
- nao_core/bin/public/assets/index-CWAm1NQa.css +0 -1
- {nao_core-0.0.18.dist-info → nao_core-0.0.22.dist-info}/WHEEL +0 -0
- {nao_core-0.0.18.dist-info → nao_core-0.0.22.dist-info}/entry_points.txt +0 -0
- {nao_core-0.0.18.dist-info → nao_core-0.0.22.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/signup-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/signup-CU4v0Hqr.js","assets/signinForm-D97br205.js","assets/createLucideIcon-CAzRYUZ0.js","assets/utils-DzJYey0s.js","assets/login-BEFjZaUF.js","assets/_chat-layout-BSDXwLlM.js","assets/agentProvider-BkGOwLc-.js","assets/_chat-layout.index-CWlZ1WSD.js","assets/mermaid-FSSLJTFX-_2mzlJwk.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function xO(e,t){for(var a=0;a<t.length;a++){const i=t[a];if(typeof i!="string"&&!Array.isArray(i)){for(const o in i)if(o!=="default"&&!(o in e)){const u=Object.getOwnPropertyDescriptor(i,o);u&&Object.defineProperty(e,o,u.get?u:{enumerable:!0,get:()=>i[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function a(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(o){if(o.ep)return;o.ep=!0;const u=a(o);fetch(o.href,u)}})();function wh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pd={exports:{}},Gs={};var Jv;function MO(){if(Jv)return Gs;Jv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(i,o,u){var c=null;if(u!==void 0&&(c=""+u),o.key!==void 0&&(c=""+o.key),"key"in o){u={};for(var f in o)f!=="key"&&(u[f]=o[f])}else u=o;return o=u.ref,{$$typeof:e,type:i,key:c,ref:o!==void 0?o:null,props:u}}return Gs.Fragment=t,Gs.jsx=a,Gs.jsxs=a,Gs}var Kv;function CO(){return Kv||(Kv=1,pd.exports=MO()),pd.exports}var ae=CO(),md={exports:{}},pe={};var Xv;function zO(){if(Xv)return pe;Xv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function S(A){return A===null||typeof A!="object"?null:(A=b&&A[b]||A["@@iterator"],typeof A=="function"?A:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,x={};function z(A,V,X){this.props=A,this.context=V,this.refs=x,this.updater=X||T}z.prototype.isReactComponent={},z.prototype.setState=function(A,V){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,V,"setState")},z.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function U(){}U.prototype=z.prototype;function w(A,V,X){this.props=A,this.context=V,this.refs=x,this.updater=X||T}var C=w.prototype=new U;C.constructor=w,E(C,z.prototype),C.isPureReactComponent=!0;var F=Array.isArray;function L(){}var I={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function W(A,V,X){var ee=X.ref;return{$$typeof:e,type:A,key:V,ref:ee!==void 0?ee:null,props:X}}function fe(A,V){return W(A.type,V,A.props)}function le(A){return typeof A=="object"&&A!==null&&A.$$typeof===e}function je(A){var V={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(X){return V[X]})}var we=/\/+/g;function ve(A,V){return typeof A=="object"&&A!==null&&A.key!=null?je(""+A.key):V.toString(36)}function Ae(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(L,L):(A.status="pending",A.then(function(V){A.status==="pending"&&(A.status="fulfilled",A.value=V)},function(V){A.status==="pending"&&(A.status="rejected",A.reason=V)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function $(A,V,X,ee,de){var he=typeof A;(he==="undefined"||he==="boolean")&&(A=null);var Ee=!1;if(A===null)Ee=!0;else switch(he){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(A.$$typeof){case e:case t:Ee=!0;break;case y:return Ee=A._init,$(Ee(A._payload),V,X,ee,de)}}if(Ee)return de=de(A),Ee=ee===""?"."+ve(A,0):ee,F(de)?(X="",Ee!=null&&(X=Ee.replace(we,"$&/")+"/"),$(de,V,X,"",function(qn){return qn})):de!=null&&(le(de)&&(de=fe(de,X+(de.key==null||A&&A.key===de.key?"":(""+de.key).replace(we,"$&/")+"/")+Ee)),V.push(de)),1;Ee=0;var lt=ee===""?".":ee+":";if(F(A))for(var Be=0;Be<A.length;Be++)ee=A[Be],he=lt+ve(ee,Be),Ee+=$(ee,V,X,he,de);else if(Be=S(A),typeof Be=="function")for(A=Be.call(A),Be=0;!(ee=A.next()).done;)ee=ee.value,he=lt+ve(ee,Be++),Ee+=$(ee,V,X,he,de);else if(he==="object"){if(typeof A.then=="function")return $(Ae(A),V,X,ee,de);throw V=String(A),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return Ee}function J(A,V,X){if(A==null)return A;var ee=[],de=0;return $(A,ee,"","",function(he){return V.call(X,he,de++)}),ee}function ce(A){if(A._status===-1){var V=A._result;V=V(),V.then(function(X){(A._status===0||A._status===-1)&&(A._status=1,A._result=X)},function(X){(A._status===0||A._status===-1)&&(A._status=2,A._result=X)}),A._status===-1&&(A._status=0,A._result=V)}if(A._status===1)return A._result.default;throw A._result}var Pe=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},Ze={map:J,forEach:function(A,V,X){J(A,function(){V.apply(this,arguments)},X)},count:function(A){var V=0;return J(A,function(){V++}),V},toArray:function(A){return J(A,function(V){return V})||[]},only:function(A){if(!le(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return pe.Activity=v,pe.Children=Ze,pe.Component=z,pe.Fragment=a,pe.Profiler=o,pe.PureComponent=w,pe.StrictMode=i,pe.Suspense=h,pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,pe.__COMPILER_RUNTIME={__proto__:null,c:function(A){return I.H.useMemoCache(A)}},pe.cache=function(A){return function(){return A.apply(null,arguments)}},pe.cacheSignal=function(){return null},pe.cloneElement=function(A,V,X){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var ee=E({},A.props),de=A.key;if(V!=null)for(he in V.key!==void 0&&(de=""+V.key),V)!G.call(V,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&V.ref===void 0||(ee[he]=V[he]);var he=arguments.length-2;if(he===1)ee.children=X;else if(1<he){for(var Ee=Array(he),lt=0;lt<he;lt++)Ee[lt]=arguments[lt+2];ee.children=Ee}return W(A.type,de,ee)},pe.createContext=function(A){return A={$$typeof:c,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:u,_context:A},A},pe.createElement=function(A,V,X){var ee,de={},he=null;if(V!=null)for(ee in V.key!==void 0&&(he=""+V.key),V)G.call(V,ee)&&ee!=="key"&&ee!=="__self"&&ee!=="__source"&&(de[ee]=V[ee]);var Ee=arguments.length-2;if(Ee===1)de.children=X;else if(1<Ee){for(var lt=Array(Ee),Be=0;Be<Ee;Be++)lt[Be]=arguments[Be+2];de.children=lt}if(A&&A.defaultProps)for(ee in Ee=A.defaultProps,Ee)de[ee]===void 0&&(de[ee]=Ee[ee]);return W(A,he,de)},pe.createRef=function(){return{current:null}},pe.forwardRef=function(A){return{$$typeof:f,render:A}},pe.isValidElement=le,pe.lazy=function(A){return{$$typeof:y,_payload:{_status:-1,_result:A},_init:ce}},pe.memo=function(A,V){return{$$typeof:m,type:A,compare:V===void 0?null:V}},pe.startTransition=function(A){var V=I.T,X={};I.T=X;try{var ee=A(),de=I.S;de!==null&&de(X,ee),typeof ee=="object"&&ee!==null&&typeof ee.then=="function"&&ee.then(L,Pe)}catch(he){Pe(he)}finally{V!==null&&X.types!==null&&(V.types=X.types),I.T=V}},pe.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},pe.use=function(A){return I.H.use(A)},pe.useActionState=function(A,V,X){return I.H.useActionState(A,V,X)},pe.useCallback=function(A,V){return I.H.useCallback(A,V)},pe.useContext=function(A){return I.H.useContext(A)},pe.useDebugValue=function(){},pe.useDeferredValue=function(A,V){return I.H.useDeferredValue(A,V)},pe.useEffect=function(A,V){return I.H.useEffect(A,V)},pe.useEffectEvent=function(A){return I.H.useEffectEvent(A)},pe.useId=function(){return I.H.useId()},pe.useImperativeHandle=function(A,V,X){return I.H.useImperativeHandle(A,V,X)},pe.useInsertionEffect=function(A,V){return I.H.useInsertionEffect(A,V)},pe.useLayoutEffect=function(A,V){return I.H.useLayoutEffect(A,V)},pe.useMemo=function(A,V){return I.H.useMemo(A,V)},pe.useOptimistic=function(A,V){return I.H.useOptimistic(A,V)},pe.useReducer=function(A,V,X){return I.H.useReducer(A,V,X)},pe.useRef=function(A){return I.H.useRef(A)},pe.useState=function(A){return I.H.useState(A)},pe.useSyncExternalStore=function(A,V,X){return I.H.useSyncExternalStore(A,V,X)},pe.useTransition=function(){return I.H.useTransition()},pe.version="19.2.3",pe}var Wv;function _o(){return Wv||(Wv=1,md.exports=zO()),md.exports}var K=_o();const qi=wh(K),bP=xO({__proto__:null,default:qi},[K]);var NO=Object.create,sb=Object.defineProperty,jO=Object.getOwnPropertyDescriptor,ob=Object.getOwnPropertyNames,DO=Object.getPrototypeOf,PO=Object.prototype.hasOwnProperty,Bn=(e,t)=>function(){return t||(0,e[ob(e)[0]])((t={exports:{}}).exports,t),t.exports},LO=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=ob(t),u=0,c=o.length,f;u<c;u++)f=o[u],!PO.call(e,f)&&f!==a&&sb(e,f,{get:(h=>t[h]).bind(null,f),enumerable:!(i=jO(t,f))||i.enumerable});return e},ot=(e,t,a)=>(a=e!=null?NO(DO(e)):{},LO(sb(a,"default",{value:e,enumerable:!0}),e)),lb=Bn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function a(i){"@babel/helpers - typeof";return t.exports=a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},t.exports.__esModule=!0,t.exports.default=t.exports,a(i)}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}}),UO=Bn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var a=lb().default;function i(o,u){if(a(o)!="object"||!o)return o;var c=o[Symbol.toPrimitive];if(c!==void 0){var f=c.call(o,u||"default");if(a(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(o)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),IO=Bn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var a=lb().default,i=UO();function o(u){var c=i(u,"string");return a(c)=="symbol"?c:c+""}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}}),ka=Bn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var a=IO();function i(o,u,c){return(u=a(u))in o?Object.defineProperty(o,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[u]=c,o}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),Cn=Bn({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var a=ka();function i(u,c){var f=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),f.push.apply(f,h)}return f}function o(u){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?i(Object(f),!0).forEach(function(h){a(u,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(f)):i(Object(f)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(f,h))})}return u}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}});function Qi(e){const t={subscribe(a){let i=null,o=!1,u=!1,c=!1;function f(){if(i===null){c=!0;return}u||(u=!0,typeof i=="function"?i():i&&i.unsubscribe())}return i=e({next(h){var m;o||(m=a.next)===null||m===void 0||m.call(a,h)},error(h){var m;o||(o=!0,(m=a.error)===null||m===void 0||m.call(a,h),f())},complete(){var h;o||(o=!0,(h=a.complete)===null||h===void 0||h.call(a),f())}}),c&&f(),{unsubscribe:f}},pipe(...a){return a.reduce(kO,t)}};return t}function kO(e,t){return t(e)}function $O(e){const t=new AbortController;return new Promise((i,o)=>{let u=!1;function c(){u||(u=!0,f.unsubscribe())}t.signal.addEventListener("abort",()=>{o(t.signal.reason)});const f=e.subscribe({next(h){u=!0,i(h),c()},error(h){o(h)},complete(){t.abort(),c()}})})}function ZO(e){return t=>{let a=0,i=null;const o=[];function u(){i||(i=t.subscribe({next(f){for(const m of o){var h;(h=m.next)===null||h===void 0||h.call(m,f)}},error(f){for(const m of o){var h;(h=m.error)===null||h===void 0||h.call(m,f)}},complete(){for(const h of o){var f;(f=h.complete)===null||f===void 0||f.call(h)}}}))}function c(){if(a===0&&i){const f=i;i=null,f.unsubscribe()}}return Qi(f=>(a++,o.push(f),u(),{unsubscribe(){a--,c();const h=o.findIndex(m=>m===f);h>-1&&o.splice(h,1)}}))}}function BO(e){return t=>Qi(a=>t.subscribe({next(i){var o;(o=e.next)===null||o===void 0||o.call(e,i),a.next(i)},error(i){var o;(o=e.error)===null||o===void 0||o.call(e,i),a.error(i)},complete(){var i;(i=e.complete)===null||i===void 0||i.call(e),a.complete()}}))}function qO(e){let t=e;const a=[],i=c=>{t!==void 0&&c.next(t),a.push(c)},o=c=>{a.splice(a.indexOf(c),1)},u=Qi(c=>(i(c),()=>{o(c)}));return u.next=c=>{if(t!==c){t=c;for(const f of a)f.next(c)}},u.get=()=>t,u}function HO(e){return Qi(t=>{function a(o=0,u=e.op){const c=e.links[o];if(!c)throw new Error("No more links to execute - did you forget to add an ending link?");return c({op:u,next(h){return a(o+1,h)}})}return a().subscribe(t)})}function Kr(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function VO(e){return typeof e=="function"}function GO(){return Object.create(null)}const YO=typeof Symbol=="function"&&!!Symbol.asyncIterator;function FO(e){return YO&&Kr(e)&&Symbol.asyncIterator in e}const QO=e=>e();var JO=Object.create,ub=Object.defineProperty,KO=Object.getOwnPropertyDescriptor,cb=Object.getOwnPropertyNames,XO=Object.getPrototypeOf,WO=Object.prototype.hasOwnProperty,So=(e,t)=>function(){return t||(0,e[cb(e)[0]])((t={exports:{}}).exports,t),t.exports},ew=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=cb(t),u=0,c=o.length,f;u<c;u++)f=o[u],!WO.call(e,f)&&f!==a&&ub(e,f,{get:(h=>t[h]).bind(null,f),enumerable:!(i=KO(t,f))||i.enumerable});return e},ku=(e,t,a)=>(a=e!=null?JO(XO(e)):{},ew(ub(a,"default",{value:e,enumerable:!0}),e));const fb=()=>{},eg=e=>{Object.freeze&&Object.freeze(e)};function db(e,t,a){var i;const o=t.join(".");return(i=a[o])!==null&&i!==void 0||(a[o]=new Proxy(fb,{get(u,c){if(!(typeof c!="string"||c==="then"))return db(e,[...t,c],a)},apply(u,c,f){const h=t[t.length-1];let m={args:f,path:t};return h==="call"?m={args:f.length>=2?[f[1]]:[],path:t.slice(0,-1)}:h==="apply"&&(m={args:f.length>=2?f[1]:[],path:t.slice(0,-1)}),eg(m.args),eg(m.path),e(m)}})),a[o]}const hb=e=>db(e,[],GO()),tw=e=>new Proxy(fb,{get(t,a){if(a!=="then")return e(a)}});var pb=So({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function a(i){"@babel/helpers - typeof";return t.exports=a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},t.exports.__esModule=!0,t.exports.default=t.exports,a(i)}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}}),nw=So({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var a=pb().default;function i(o,u){if(a(o)!="object"||!o)return o;var c=o[Symbol.toPrimitive];if(c!==void 0){var f=c.call(o,u||"default");if(a(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(o)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),rw=So({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var a=pb().default,i=nw();function o(u){var c=i(u,"string");return a(c)=="symbol"?c:c+""}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}}),mb=So({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var a=rw();function i(o,u,c){return(u=a(u))in o?Object.defineProperty(o,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):o[u]=c,o}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),Th=So({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var a=mb();function i(u,c){var f=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),f.push.apply(f,h)}return f}function o(u){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?i(Object(f),!0).forEach(function(h){a(u,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(f)):i(Object(f)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(f,h))})}return u}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}});ku(Th());var tg=ku(mb()),aw=class extends Error{};function iw(e){if(e instanceof Error)return e;const t=typeof e;if(!(t==="undefined"||t==="function"||e===null)){if(t!=="object")return new Error(String(e));if(Kr(e))return Object.assign(new aw,e)}}var ng=class extends Error{constructor(e){var t,a,i;const o=iw(e.cause),u=(t=(a=e.message)!==null&&a!==void 0?a:o?.message)!==null&&t!==void 0?t:e.code;super(u,{cause:o}),(0,tg.default)(this,"cause",void 0),(0,tg.default)(this,"code",void 0),this.code=e.code,this.name="TRPCError",(i=this.cause)!==null&&i!==void 0||(this.cause=o)}},Jl=ku(Th());function sw(e,t){if("error"in e){const i=t.deserialize(e.error);return{ok:!1,error:(0,Jl.default)((0,Jl.default)({},e),{},{error:i})}}return{ok:!0,result:(0,Jl.default)((0,Jl.default)({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var yd=class extends Error{constructor(){super("Unable to transform response from server")}};function ow(e,t){let a;try{a=sw(e,t)}catch{throw new yd}if(!a.ok&&(!Kr(a.error.error)||typeof a.error.error.code!="number"))throw new yd;if(a.ok&&!Kr(a.result))throw new yd;return a}ku(Th());function lw(e){return typeof e=="function"}async function uw(e,t){const{_def:a}=e;let i=a.procedures[t];for(;!i;){const o=Object.keys(a.lazy).find(c=>t.startsWith(c));if(!o)return null;await a.lazy[o].load(),i=a.procedures[t]}return i}async function cw(e){const{type:t,path:a}=e,i=await uw(e.router,a);if(!i||!lw(i)||i._def.type!==t&&!e.allowMethodOverride)throw new ng({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${a}"`});if(i._def.type!==t&&e.allowMethodOverride&&i._def.type==="subscription")throw new ng({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return i(e)}var Kl=ot(ka()),xi=ot(Cn());function fw(e){return e instanceof _u}function dw(e){return Kr(e)&&Kr(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function hw(e,t){return typeof e=="string"?e:Kr(e)&&typeof e.message=="string"?e.message:t}var _u=class cu extends Error{constructor(t,a){var i,o;const u=a?.cause;super(t,{cause:u}),(0,Kl.default)(this,"cause",void 0),(0,Kl.default)(this,"shape",void 0),(0,Kl.default)(this,"data",void 0),(0,Kl.default)(this,"meta",void 0),this.meta=a?.meta,this.cause=u,this.shape=a==null||(i=a.result)===null||i===void 0?void 0:i.error,this.data=a==null||(o=a.result)===null||o===void 0?void 0:o.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,cu.prototype)}static from(t,a={}){const i=t;return fw(i)?(a.meta&&(i.meta=(0,xi.default)((0,xi.default)({},i.meta),a.meta)),i):dw(i)?new cu(i.error.message,(0,xi.default)((0,xi.default)({},a),{},{result:i})):new cu(hw(i,"Unknown error"),(0,xi.default)((0,xi.default)({},a),{},{cause:i}))}};function pw(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:a=>a,deserialize:a=>a},output:{serialize:a=>a,deserialize:a=>a}}}const rg=e=>typeof e=="function";function mw(e){if(e)return e;if(typeof window<"u"&&rg(window.fetch))return window.fetch;if(typeof globalThis<"u"&&rg(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var io=ot(Cn());function yw(e){return{url:e.url.toString(),fetch:e.fetch,transformer:pw(e.transformer),methodOverride:e.methodOverride}}function vw(e){const t={};for(let a=0;a<e.length;a++){const i=e[a];t[a]=i}return t}const gw={query:"GET",mutation:"POST",subscription:"PATCH"};function yb(e){return"input"in e?e.transformer.input.serialize(e.input):vw(e.inputs.map(t=>e.transformer.input.serialize(t)))}const vb=e=>{const t=e.url.split("?");let i=t[0].replace(/\/$/,"")+"/"+e.path;const o=[];if(t[1]&&o.push(t[1]),"inputs"in e&&o.push("batch=1"),e.type==="query"||e.type==="subscription"){const u=yb(e);u!==void 0&&e.methodOverride!=="POST"&&o.push(`input=${encodeURIComponent(JSON.stringify(u))}`)}return o.length&&(i+="?"+o.join("&")),i},bw=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=yb(e);return t!==void 0?JSON.stringify(t):void 0},_w=e=>ww((0,io.default)((0,io.default)({},e),{},{contentTypeHeader:"application/json",getUrl:vb,getBody:bw}));var Sw=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const Ew=e=>{var t;if(e?.aborted)throw(t=e.throwIfAborted)===null||t===void 0||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new Sw};async function Ow(e){var t;Ew(e.signal);const a=e.getUrl(e),i=e.getBody(e),o=(t=e.methodOverride)!==null&&t!==void 0?t:gw[e.type],u=await(async()=>{const f=await e.headers();return Symbol.iterator in f?Object.fromEntries(f):f})(),c=(0,io.default)((0,io.default)((0,io.default)({},e.contentTypeHeader&&o!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0),u);return mw(e.fetch)(a,{method:o,signal:e.signal,body:i,headers:c})}async function ww(e){const t={},a=await Ow(e);t.response=a;const i=await a.json();return t.responseJSON=i,{json:i,meta:t}}ot(Cn());const ag=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function ig(e){let t=null,a=null;const i=()=>{clearTimeout(a),a=null,t=null};function o(f){const h=[[]];let m=0;for(;;){const b=f[m];if(!b)break;const S=h[h.length-1];if(b.aborted){var y;(y=b.reject)===null||y===void 0||y.call(b,new Error("Aborted")),m++;continue}if(e.validate(S.concat(b).map(E=>E.key))){S.push(b),m++;continue}if(S.length===0){var v;(v=b.reject)===null||v===void 0||v.call(b,new Error("Input is too big for a single dispatch")),m++;continue}h.push([])}return h}function u(){const f=o(t);i();for(const h of f){if(!h.length)continue;const m={items:h};for(const v of h)v.batch=m;e.fetch(m.items.map(v=>v.key)).then(async v=>{await Promise.all(v.map(async(S,T)=>{const E=m.items[T];try{var x;const U=await Promise.resolve(S);(x=E.resolve)===null||x===void 0||x.call(E,U)}catch(U){var z;(z=E.reject)===null||z===void 0||z.call(E,U)}E.batch=null,E.reject=null,E.resolve=null}));for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,new Error("Missing result")),S.batch=null}}).catch(v=>{for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,v),S.batch=null}})}}function c(f){var h;const m={aborted:!1,key:f,batch:null,resolve:ag,reject:ag},y=new Promise((v,b)=>{var S;m.reject=b,m.resolve=v,(S=t)!==null&&S!==void 0||(t=[]),t.push(m)});return(h=a)!==null&&h!==void 0||(a=setTimeout(u)),y}return{load:c}}function Tw(...e){const t=new AbortController,a=e.length;let i=0;const o=()=>{++i===a&&t.abort()};for(const u of e)u?.aborted?o():u?.addEventListener("abort",o,{once:!0});return t.signal}var Xl=ot(Cn());function Rw(e){var t,a;const i=yw(e),o=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,u=(a=e.maxItems)!==null&&a!==void 0?a:1/0;return()=>{const c=y=>({validate(v){if(o===1/0&&u===1/0)return!0;if(v.length>u)return!1;const b=v.map(E=>E.path).join(","),S=v.map(E=>E.input);return vb((0,Xl.default)((0,Xl.default)({},i),{},{type:y,path:b,inputs:S,signal:null})).length<=o},async fetch(v){const b=v.map(U=>U.path).join(","),S=v.map(U=>U.input),T=Tw(...v.map(U=>U.signal)),E=await _w((0,Xl.default)((0,Xl.default)({},i),{},{path:b,inputs:S,type:y,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:v}):e.headers:{}},signal:T}));return(Array.isArray(E.json)?E.json:v.map(()=>E.json)).map(U=>({meta:E.meta,json:U}))}}),f=ig(c("query")),h=ig(c("mutation")),m={query:f,mutation:h};return({op:y})=>Qi(v=>{if(y.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const S=m[y.type].load(y);let T;return S.then(E=>{T=E;const x=ow(E.json,i.transformer.output);if(!x.ok){v.error(_u.from(x.error,{meta:E.meta}));return}v.next({context:E.meta,result:x.result}),v.complete()}).catch(E=>{v.error(_u.from(E,{meta:T?.meta}))}),()=>{}})}}var xn=ot(Cn());function Aw(e){return typeof FormData>"u"?!1:e instanceof FormData}const vd={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1B[30;46m","\x1B[97;46m"],mutation:["\x1B[30;45m","\x1B[97;45m"],subscription:["\x1B[30;42m","\x1B[97;42m"]},bold:{query:["\x1B[1;30;46m","\x1B[1;97;46m"],mutation:["\x1B[1;30;45m","\x1B[1;97;45m"],subscription:["\x1B[1;30;42m","\x1B[1;97;42m"]}}};function xw(e){const{direction:t,type:a,withContext:i,path:o,id:u,input:c}=e,f=[],h=[];if(e.colorMode==="none")f.push(t==="up"?">>":"<<",a,`#${u}`,o);else if(e.colorMode==="ansi"){const[m,y]=vd.ansi.regular[a],[v,b]=vd.ansi.bold[a];f.push(t==="up"?m:y,t==="up"?">>":"<<",a,t==="up"?v:b,`#${u}`,o,"\x1B[0m")}else{const[m,y]=vd.css[a],v=`
|
|
3
3
|
background-color: #${t==="up"?m:y};
|
|
4
4
|
color: ${t==="up"?"black":"white"};
|
|
@@ -56,4 +56,4 @@ Error message: ${DS(a)}`,cause:a}),this[Z0]=!0,this.value=t}static isInstance(t)
|
|
|
56
56
|
|
|
57
57
|
`)},flush(e){e.enqueue(`data: [DONE]
|
|
58
58
|
|
|
59
|
-
`)}})}});var MD=nD(()=>GS($e([ue({type:Y("text-start"),id:D(),providerMetadata:Re.optional()}),ue({type:Y("text-delta"),id:D(),delta:D(),providerMetadata:Re.optional()}),ue({type:Y("text-end"),id:D(),providerMetadata:Re.optional()}),ue({type:Y("error"),errorText:D()}),ue({type:Y("tool-input-start"),toolCallId:D(),toolName:D(),providerExecuted:De().optional(),dynamic:De().optional(),title:D().optional()}),ue({type:Y("tool-input-delta"),toolCallId:D(),inputTextDelta:D()}),ue({type:Y("tool-input-available"),toolCallId:D(),toolName:D(),input:gt(),providerExecuted:De().optional(),providerMetadata:Re.optional(),dynamic:De().optional(),title:D().optional()}),ue({type:Y("tool-input-error"),toolCallId:D(),toolName:D(),input:gt(),providerExecuted:De().optional(),providerMetadata:Re.optional(),dynamic:De().optional(),errorText:D(),title:D().optional()}),ue({type:Y("tool-approval-request"),approvalId:D(),toolCallId:D()}),ue({type:Y("tool-output-available"),toolCallId:D(),output:gt(),providerExecuted:De().optional(),dynamic:De().optional(),preliminary:De().optional()}),ue({type:Y("tool-output-error"),toolCallId:D(),errorText:D(),providerExecuted:De().optional(),dynamic:De().optional()}),ue({type:Y("tool-output-denied"),toolCallId:D()}),ue({type:Y("reasoning-start"),id:D(),providerMetadata:Re.optional()}),ue({type:Y("reasoning-delta"),id:D(),delta:D(),providerMetadata:Re.optional()}),ue({type:Y("reasoning-end"),id:D(),providerMetadata:Re.optional()}),ue({type:Y("source-url"),sourceId:D(),url:D(),title:D().optional(),providerMetadata:Re.optional()}),ue({type:Y("source-document"),sourceId:D(),mediaType:D(),title:D(),filename:D().optional(),providerMetadata:Re.optional()}),ue({type:Y("file"),url:D(),mediaType:D(),providerMetadata:Re.optional()}),ue({type:Qu(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:D().optional(),data:gt(),transient:De().optional()}),ue({type:Y("start-step")}),ue({type:Y("finish-step")}),ue({type:Y("start"),messageId:D().optional(),messageMetadata:gt().optional()}),ue({type:Y("finish"),finishReason:Yh(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:gt().optional()}),ue({type:Y("abort"),reason:D().optional()}),ue({type:Y("message-metadata"),messageMetadata:gt()})])));function CD(e){return e.type.startsWith("tool-")}function e1(e){return e.type==="dynamic-tool"}function t1(e){return CD(e)||e1(e)}function zD(e){return e.type.split("-").slice(1).join("-")}function ND(e){return e1(e)?e.toolName:zD(e)}xo({prefix:"aitxt",size:24});xo({prefix:"aiobj",size:24});xo({prefix:"aiobj",size:24});var jD=class{constructor({api:e="/api/chat",credentials:t,headers:a,body:i,fetch:o,prepareSendMessagesRequest:u,prepareReconnectToStreamRequest:c}){this.api=e,this.credentials=t,this.headers=a,this.body=i,this.fetch=o,this.prepareSendMessagesRequest=u,this.prepareReconnectToStreamRequest=c}async sendMessages({abortSignal:e,...t}){var a,i,o,u,c;const f=await qr(this.body),h=await qr(this.headers),m=await qr(this.credentials),y={...Aa(h),...Aa(t.headers)},v=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...f,...t.body},headers:y,credentials:m,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),b=(i=v?.api)!=null?i:this.api,S=v?.headers!==void 0?Aa(v.headers):y,T=v?.body!==void 0?v.body:{...f,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},E=(o=v?.credentials)!=null?o:m,z=await((u=this.fetch)!=null?u:globalThis.fetch)(b,{method:"POST",headers:H0({"Content-Type":"application/json",...S},`ai-sdk/${F0}`,q0()),body:JSON.stringify(T),credentials:E,signal:e});if(!z.ok)throw new Error((c=await z.text())!=null?c:"Failed to fetch the chat response.");if(!z.body)throw new Error("The response body is empty.");return this.processResponseStream(z.body)}async reconnectToStream(e){var t,a,i,o,u;const c=await qr(this.body),f=await qr(this.headers),h=await qr(this.credentials),m={...Aa(f),...Aa(e.headers)},y=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...c,...e.body},headers:m,credentials:h,requestMetadata:e.metadata})),v=(a=y?.api)!=null?a:`${this.api}/${e.chatId}/stream`,b=y?.headers!==void 0?Aa(y.headers):m,S=(i=y?.credentials)!=null?i:h,E=await((o=this.fetch)!=null?o:globalThis.fetch)(v,{method:"GET",headers:H0(b,`ai-sdk/${F0}`,q0()),credentials:S});if(E.status===204)return null;if(!E.ok)throw new Error((u=await E.text())!=null?u:"Failed to fetch the chat response.");if(!E.body)throw new Error("The response body is empty.");return this.processResponseStream(E.body)}},DD=class extends jD{constructor(e={}){super(e)}processResponseStream(e){return lD({stream:e,schema:MD}).pipeThrough(new TransformStream({async transform(t,a){if(!t.success)throw t.error;a.enqueue(t.value)}}))}};function PD({messages:e}){const t=e[e.length-1];if(!t||t.role!=="assistant")return!1;const a=t.parts.reduce((o,u,c)=>u.type==="step-start"?c:o,-1),i=t.parts.slice(a+1).filter(t1).filter(o=>!o.providerExecuted);return i.length>0&&i.every(o=>o.state==="output-available"||o.state==="output-error")}const LD=e=>{const t=K.useRef(e);return t.current=e,t},UD=({chatId:e})=>xT(bu.chat.get.queryOptions({chatId:e??""},{enabled:!!e})),Ni=new Map,$i={getAgent(e){return Ni.get(e)},registerAgent(e,t){return Ni.set(e,t),t},disposeAgent(e){Ni.delete(e)},moveAgent(e,t){const a=Ni.get(e);if(!a)throw new Error(`Agent ${e} not found.`);Ni.delete(e),Ni.set(t,a)}},RP=({state:e})=>e==="output-available"||e==="output-denied"||e==="output-error",AP=t1,xP=ND,MP=(e,t)=>{if(!n1(e))return!1;const i=t.at(-1);return i?i.parts.some(o=>o.type==="step-start"):!1},n1=e=>e==="streaming"||e==="submitted",CP=()=>{const e=wo(),{chatId:t}=Oo({strict:!1}),a=UD({chatId:t}),i=zb(),o=LD(t),u=K.useMemo(()=>{const v=t??"new-chat",b=$i.getAgent(v);if(b)return b;const S=new vh({id:v,transport:new DD({api:"/api/chat/agent",prepareSendMessagesRequest:T=>({body:{chatId:o.current,message:T.messages.at(-1)}})}),onData:T=>{const E=T.data;$i.moveAgent(v,E.id),i.setQueryData(bu.chat.get.queryKey({chatId:E.id}),{...T.data,messages:u.messages}),i.setQueryData(bu.chat.list.queryKey(),x=>({chats:[E,...x?.chats||[]]})),e({to:"/$chatId",params:{chatId:E.id}})},sendAutomaticallyWhen:PD,onFinish:()=>{o.current!==u.id&&$i.disposeAgent(u.id)}});return $i.registerAgent(v,S)},[t,e,i,o]),c=sj({chat:u}),{setMessages:f,messages:h,status:m}=c,y=m==="streaming"||m==="submitted";return K.useEffect(()=>{a.data?.messages&&!y&&f(a.data.messages)},[a.data?.messages,y,f]),K.useEffect(()=>{y&&i.setQueryData(bu.chat.get.queryKey({chatId:t}),v=>v&&{...v,messages:h})},[i,h,t,y]),{...c,isRunning:y,isReadyForNewMessages:t?!!a.data&&!y:!0}},ID=()=>{const e=Oo({strict:!1}).chatId,t=K.useRef(e);K.useEffect(()=>{try{if(!e||!t.current||e===t.current)return;const a=t.current,i=$i.getAgent(a);if(!i)return;n1(i.status)||$i.disposeAgent(a)}finally{t.current=e}},[e])};var kD={},Q0={};const yu=Object.create(null),Xs=e=>kD||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?yu:globalThis),yn=new Proxy(yu,{get(e,t){return Xs()[t]??yu[t]},has(e,t){return t in Xs()||t in yu},set(e,t,a){const i=Xs(!0);return i[t]=a,!0},deleteProperty(e,t){if(!t)return!1;const a=Xs(!0);return delete a[t],!0},ownKeys(){const e=Xs(!0);return Object.keys(e)}});function ht(e,t){return typeof process<"u"&&Q0?Q0[e]??t:typeof Deno<"u"?Deno.env.get(e)??t:typeof Bun<"u"?Bun.env[e]??t:t}const Ws=1,vt=4,In=8,Kt=24,J0={eterm:vt,cons25:vt,console:vt,cygwin:vt,dtterm:vt,gnome:vt,hurd:vt,jfbterm:vt,konsole:vt,kterm:vt,mlterm:vt,mosh:Kt,putty:vt,st:vt,"rxvt-unicode-24bit":Kt,terminator:Kt,"xterm-kitty":Kt},$D=new Map(Object.entries({APPVEYOR:In,BUILDKITE:In,CIRCLECI:Kt,DRONE:In,GITEA_ACTIONS:Kt,GITHUB_ACTIONS:Kt,GITLAB_CI:In,TRAVIS:In})),ZD=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function BD(){if(ht("FORCE_COLOR")!==void 0)switch(ht("FORCE_COLOR")){case"":case"1":case"true":return vt;case"2":return In;case"3":return Kt;default:return Ws}if(ht("NODE_DISABLE_COLORS")!==void 0&&ht("NODE_DISABLE_COLORS")!==""||ht("NO_COLOR")!==void 0&&ht("NO_COLOR")!==""||ht("TERM")==="dumb")return Ws;if(ht("TMUX"))return Kt;if("TF_BUILD"in yn&&"AGENT_NAME"in yn)return vt;if("CI"in yn){for(const{0:e,1:t}of $D)if(e in yn)return t;return ht("CI_NAME")==="codeship"?In:Ws}if("TEAMCITY_VERSION"in yn)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(ht("TEAMCITY_VERSION"))!==null?vt:Ws;switch(ht("TERM_PROGRAM")){case"iTerm.app":return!ht("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(ht("TERM_PROGRAM_VERSION"))!==null?In:Kt;case"HyperTerm":case"MacTerm":return Kt;case"Apple_Terminal":return In}if(ht("COLORTERM")==="truecolor"||ht("COLORTERM")==="24bit")return Kt;if(ht("TERM")){if(/truecolor/.exec(ht("TERM"))!==null)return Kt;if(/^xterm-256/.exec(ht("TERM"))!==null)return In;const e=ht("TERM").toLowerCase();if(J0[e])return J0[e];if(ZD.some(t=>t.exec(e)!==null))return vt}return ht("COLORTERM")?vt:Ws}const kn={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",fg:{red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m"}},Sh=["debug","info","success","warn","error"];function qD(e,t){return Sh.indexOf(t)>=Sh.indexOf(e)}const HD={info:kn.fg.blue,success:kn.fg.green,warn:kn.fg.yellow,error:kn.fg.red,debug:kn.fg.magenta},VD=(e,t,a)=>{const i=new Date().toISOString();return a?`${kn.dim}${i}${kn.reset} ${HD[e]}${e.toUpperCase()}${kn.reset} ${kn.bright}[Better Auth]:${kn.reset} ${t}`:`${i} ${e.toUpperCase()} [Better Auth]: ${t}`},GD=e=>{const t="error",a=BD()!==1,i=(o,u,c=[])=>{if(!qD(t,o))return;const f=VD(o,u,a);{o==="error"?console.error(f,...c):o==="warn"?console.warn(f,...c):console.log(f,...c);return}};return{...Object.fromEntries(Sh.map(o=>[o,(...[u,...c])=>i(o,u,c)])),get level(){return t}}};GD();function YD(e){return e.charAt(0).toUpperCase()+e.slice(1)}var vu=class extends Error{constructor(e,t){super(e),this.name="BetterAuthError",this.message=e,this.cause=t,this.stack=""}};function FD(e){try{return(new URL(e).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new vu(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function QD(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new vu(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof vu?t:new vu(`Invalid base URL: ${e}. Please provide a valid base URL.`,String(t))}}function Hd(e,t="/api/auth"){if(QD(e),FD(e))return e;const a=e.replace(/\/+$/,"");return!t||t==="/"?a:(t=t.startsWith("/")?t:`/${t}`,`${a}${t}`)}function JD(e,t,a,i,o){if(e)return Hd(e,t);{const u=yn.BETTER_AUTH_URL||yn.NEXT_PUBLIC_BETTER_AUTH_URL||yn.PUBLIC_BETTER_AUTH_URL||yn.NUXT_PUBLIC_BETTER_AUTH_URL||yn.NUXT_PUBLIC_AUTH_URL||(yn.BASE_URL!=="/"?yn.BASE_URL:void 0);if(u)return Hd(u,t)}if(typeof window<"u"&&window.location)return Hd(window.location.origin,t)}const KD={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},XD={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},WD=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,K0={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},e4=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function t4(e){return e instanceof Date&&!isNaN(e.getTime())}function n4(e){const t=e4.exec(e);if(!t)return null;const[,a,i,o,u,c,f,h,m,y,v]=t;let b=new Date(Date.UTC(parseInt(a,10),parseInt(i,10)-1,parseInt(o,10),parseInt(u,10),parseInt(c,10),parseInt(f,10),h?parseInt(h.padEnd(3,"0"),10):0));if(m){const S=(parseInt(y,10)*60+parseInt(v,10))*(m==="+"?-1:1);b.setUTCMinutes(b.getUTCMinutes()+S)}return t4(b)?b:null}function r4(e,t={}){const{strict:a=!1,warnings:i=!1,reviver:o,parseDates:u=!0}=t;if(typeof e!="string")return e;const c=e.trim();if(c.length>0&&c[0]==='"'&&c.endsWith('"')&&!c.slice(1,-1).includes('"'))return c.slice(1,-1);const f=c.toLowerCase();if(f.length<=9&&f in K0)return K0[f];if(!WD.test(c)){if(a)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(XD).some(([h,m])=>{const y=m.test(c);return y&&i&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${h} pattern`),y})&&a)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(c,(m,y)=>{if(m==="__proto__"||m==="constructor"&&y&&typeof y=="object"&&"prototype"in y){i&&console.warn(`[better-json] Dropping "${m}" key to prevent prototype pollution`);return}if(u&&typeof y=="string"){const v=n4(y);if(v)return v}return o?o(m,y):y})}catch(h){if(a)throw h;return e}}function a4(e,t={strict:!0}){return r4(e,t)}let An=[],$r=0;const ou=4,r1=e=>{let t=[],a={get(){return a.lc||a.listen(()=>{})(),a.value},lc:0,listen(i){return a.lc=t.push(i),()=>{for(let u=$r+ou;u<An.length;)An[u]===i?An.splice(u,ou):u+=ou;let o=t.indexOf(i);~o&&(t.splice(o,1),--a.lc||a.off())}},notify(i,o){let u=!An.length;for(let c of t)An.push(c,a.value,i,o);if(u){for($r=0;$r<An.length;$r+=ou)An[$r](An[$r+1],An[$r+2],An[$r+3]);An.length=0}},off(){},set(i){let o=a.value;o!==i&&(a.value=i,a.notify(o))},subscribe(i){let o=a.listen(i);return i(a.value),o},value:e};return a},i4=5,lu=6,uu=10;let s4=(e,t,a,i)=>(e.events=e.events||{},e.events[a+uu]||(e.events[a+uu]=i(o=>{e.events[a].reduceRight((u,c)=>(c(u),u),{shared:{},...o})})),e.events[a]=e.events[a]||[],e.events[a].push(t),()=>{let o=e.events[a],u=o.indexOf(t);o.splice(u,1),o.length||(delete e.events[a],e.events[a+uu](),delete e.events[a+uu])}),o4=1e3,a1=(e,t)=>s4(e,i=>{let o=t(i);o&&e.events[lu].push(o)},i4,i=>{let o=e.listen;e.listen=(...c)=>(!e.lc&&!e.active&&(e.active=!0,i()),o(...c));let u=e.off;return e.events[lu]=[],e.off=()=>{u(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let c of e.events[lu])c();e.events[lu]=[]}},o4)},()=>{e.listen=o,e.off=u}});function l4(e,t,a){let i=new Set(t).add(void 0);return e.listen((o,u,c)=>{i.has(c)&&a(o,u,c)})}const u4=()=>typeof window>"u",c4=(e,t,a,i)=>{const o=r1({data:null,error:null,isPending:!0,isRefetching:!1,refetch:f=>u(f)}),u=async f=>new Promise(h=>{const m=typeof i=="function"?i({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):i;a(t,{...m,query:{...m?.query,...f?.query},async onSuccess(y){o.set({data:y.data,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await m?.onSuccess?.(y)},async onError(y){const{request:v}=y,b=typeof v.retry=="number"?v.retry:v.retry?.attempts,S=v.retryAttempt||0;b&&S<b||(o.set({error:y.error,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await m?.onError?.(y))},async onRequest(y){const v=o.get();o.set({isPending:v.data===null,data:v.data,error:null,isRefetching:!0,refetch:o.value.refetch}),await m?.onRequest?.(y)}}).catch(y=>{o.set({error:y,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}).finally(()=>{h(void 0)})});e=Array.isArray(e)?e:[e];let c=!1;for(const f of e)f.subscribe(async()=>{u4()||(c?await u():a1(o,()=>{const h=setTimeout(async()=>{c||(await u(),c=!0)},0);return()=>{o.off(),f.off(),clearTimeout(h)}}))});return o},Vd=Symbol.for("better-auth:broadcast-channel"),f4=()=>Math.floor(Date.now()/1e3);var d4=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>"u"))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:f4()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=t=>{if(t.key!==this.name)return;const a=JSON.parse(t.newValue??"{}");a?.event!=="session"||!a?.data||this.listeners.forEach(i=>i(a))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function Gd(e="better-auth.message"){return globalThis[Vd]||(globalThis[Vd]=new d4(e)),globalThis[Vd]}const Yd=Symbol.for("better-auth:focus-manager");var h4=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>{document.visibilityState==="visible"&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function X0(){return globalThis[Yd]||(globalThis[Yd]=new h4),globalThis[Yd]}const Fd=Symbol.for("better-auth:online-manager");var p4=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e,!1),window.removeEventListener("offline",t,!1)}}};function Qd(){return globalThis[Fd]||(globalThis[Fd]=new p4),globalThis[Fd]}const ji=()=>Math.floor(Date.now()/1e3),m4=5;function y4(e){const{sessionAtom:t,sessionSignal:a,$fetch:i,options:o={}}=e,u=o.sessionOptions?.refetchInterval??0,c=o.sessionOptions?.refetchOnWindowFocus??!0,f=o.sessionOptions?.refetchWhenOffline??!1,h={lastSync:0,lastSessionRequest:0,cachedSession:void 0},m=()=>f||Qd().isOnline,y=U=>{if(!m())return;if(U?.event==="storage"){h.lastSync=ji(),a.set(!a.get());return}const w=t.get();if(U?.event==="poll"){h.lastSessionRequest=ji(),i("/get-session").then(C=>{C.error?t.set({...w,data:null,error:C.error}):t.set({...w,data:C.data,error:null}),h.lastSync=ji(),a.set(!a.get())}).catch(()=>{});return}if(U?.event==="visibilitychange"){if(ji()-h.lastSessionRequest<m4)return;h.lastSessionRequest=ji()}(w?.data===null||w?.data===void 0||U?.event==="visibilitychange")&&(h.lastSync=ji(),a.set(!a.get()))},v=U=>{Gd().post({event:"session",data:{trigger:U},clientId:Math.random().toString(36).substring(7)})},b=()=>{u&&u>0&&(h.pollInterval=setInterval(()=>{t.get()?.data&&y({event:"poll"})},u*1e3))},S=()=>{h.unsubscribeBroadcast=Gd().subscribe(()=>{y({event:"storage"})})},T=()=>{c&&(h.unsubscribeFocus=X0().subscribe(()=>{y({event:"visibilitychange"})}))},E=()=>{h.unsubscribeOnline=Qd().subscribe(U=>{U&&y({event:"visibilitychange"})})};return{init:()=>{b(),S(),T(),E(),Gd().setup(),X0().setup(),Qd().setup()},cleanup:()=>{h.pollInterval&&(clearInterval(h.pollInterval),h.pollInterval=void 0),h.unsubscribeBroadcast&&(h.unsubscribeBroadcast(),h.unsubscribeBroadcast=void 0),h.unsubscribeFocus&&(h.unsubscribeFocus(),h.unsubscribeFocus=void 0),h.unsubscribeOnline&&(h.unsubscribeOnline(),h.unsubscribeOnline=void 0),h.lastSync=0,h.lastSessionRequest=0,h.cachedSession=void 0},triggerRefetch:y,broadcastSessionUpdate:v}}function v4(e,t){const a=r1(!1),i=c4(a,"/get-session",e,{method:"GET"});return a1(i,()=>{const o=y4({sessionAtom:i,sessionSignal:a,$fetch:e,options:t});return o.init(),()=>{o.cleanup()}}),{session:i,$sessionSignal:a}}var g4=Object.defineProperty,b4=Object.defineProperties,_4=Object.getOwnPropertyDescriptors,W0=Object.getOwnPropertySymbols,S4=Object.prototype.hasOwnProperty,E4=Object.prototype.propertyIsEnumerable,eb=(e,t,a)=>t in e?g4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Mn=(e,t)=>{for(var a in t||(t={}))S4.call(t,a)&&eb(e,a,t[a]);if(W0)for(var a of W0(t))E4.call(t,a)&&eb(e,a,t[a]);return e},Un=(e,t)=>b4(e,_4(t)),O4=class extends Error{constructor(e,t,a){super(t||e.toString(),{cause:a}),this.status=e,this.statusText=t,this.error=a,Error.captureStackTrace(this,this.constructor)}},w4=async(e,t)=>{var a,i,o,u,c,f;let h=t||{};const m={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:h,hooks:m};for(const y of t?.plugins||[]){if(y.init){const v=await((a=y.init)==null?void 0:a.call(y,e.toString(),t));h=v.options||h,e=v.url}m.onRequest.push((i=y.hooks)==null?void 0:i.onRequest),m.onResponse.push((o=y.hooks)==null?void 0:o.onResponse),m.onSuccess.push((u=y.hooks)==null?void 0:u.onSuccess),m.onError.push((c=y.hooks)==null?void 0:c.onError),m.onRetry.push((f=y.hooks)==null?void 0:f.onRetry)}return{url:e,options:h,hooks:m}},tb=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},T4=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function R4(e){if(typeof e=="number")return new tb({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new tb(e);case"exponential":return new T4(e);default:throw new Error("Invalid retry strategy")}}var A4=async e=>{const t={},a=async i=>typeof i=="function"?await i():i;if(e?.auth){if(e.auth.type==="Bearer"){const i=await a(e.auth.token);if(!i)return t;t.authorization=`Bearer ${i}`}else if(e.auth.type==="Basic"){const[i,o]=await Promise.all([a(e.auth.username),a(e.auth.password)]);if(!i||!o)return t;t.authorization=`Basic ${btoa(`${i}:${o}`)}`}else if(e.auth.type==="Custom"){const[i,o]=await Promise.all([a(e.auth.prefix),a(e.auth.value)]);if(!o)return t;t.authorization=`${i??""} ${o}`}}return t},x4=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function M4(e){const t=e.headers.get("content-type"),a=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";const i=t.split(";").shift()||"";return x4.test(i)?"json":a.has(i)||i.startsWith("text/")?"text":"blob"}function C4(e){try{return JSON.parse(e),!0}catch{return!1}}function Eh(e){if(e===void 0)return!1;const t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function nb(e){try{return JSON.parse(e)}catch{return e}}function rb(e){return typeof e=="function"}function z4(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&rb(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&rb(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function N4(e){const t=new Headers(e?.headers),a=await A4(e);for(const[i,o]of Object.entries(a||{}))t.set(i,o);if(!t.has("content-type")){const i=j4(e?.body);i&&t.set("content-type",i)}return t}function j4(e){return Eh(e)?"application/json":null}function D4(e){if(!e?.body)return null;const t=new Headers(e?.headers);if(Eh(e.body)&&!t.has("content-type")){for(const[a,i]of Object.entries(e?.body))i instanceof Date&&(e.body[a]=i.toISOString());return JSON.stringify(e.body)}return t.has("content-type")&&t.get("content-type")==="application/x-www-form-urlencoded"&&Eh(e.body)?new URLSearchParams(e.body).toString():e.body}function P4(e,t){var a;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){const i=(a=e.split("@")[1])==null?void 0:a.split("/")[0];return s1.includes(i)?i.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function L4(e,t){let a;return!e?.signal&&e?.timeout&&(a=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:a,clearTimeout:()=>{a&&clearTimeout(a)}}}var U4=class i1 extends Error{constructor(t,a){super(a||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,i1.prototype)}};async function gu(e,t){const a=await e["~standard"].validate(t);if(a.issues)throw new U4(a.issues);return a.value}var s1=["get","post","put","patch","delete"],I4=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,a){var i,o,u,c;const f=((o=(i=e.plugins)==null?void 0:i.find(h=>{var m;return(m=h.schema)!=null&&m.config?t.startsWith(h.schema.config.baseURL||"")||t.startsWith(h.schema.config.prefix||""):!1}))==null?void 0:o.schema)||e.schema;if(f){let h=t;(u=f.config)!=null&&u.prefix&&h.startsWith(f.config.prefix)&&(h=h.replace(f.config.prefix,""),f.config.baseURL&&(t=t.replace(f.config.prefix,f.config.baseURL))),(c=f.config)!=null&&c.baseURL&&h.startsWith(f.config.baseURL)&&(h=h.replace(f.config.baseURL,""));const m=f.schema[h];if(m){let y=Un(Mn({},a),{method:m.method,output:m.output});return a?.disableValidation||(y=Un(Mn({},y),{body:m.input?await gu(m.input,a?.body):a?.body,params:m.params?await gu(m.params,a?.params):a?.params,query:m.query?await gu(m.query,a?.query):a?.query})),{url:t,options:y}}}return{url:t,options:a}}}),k4=e=>{async function t(a,i){const o=Un(Mn(Mn({},e),i),{plugins:[...e?.plugins||[],I4(e||{}),...i?.plugins||[]]});if(e?.catchAllError)try{return await Oh(a,o)}catch(u){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:u}}}return await Oh(a,o)}return t};function $4(e,t){const{baseURL:a,params:i,query:o}=t||{query:{},params:{},baseURL:""};let u=e.startsWith("http")?e.split("/").slice(0,3).join("/"):a||"";if(e.startsWith("@")){const v=e.toString().split("@")[1].split("/")[0];s1.includes(v)&&(e=e.replace(`@${v}/`,"/"))}u.endsWith("/")||(u+="/");let[c,f]=e.replace(u,"").split("?");const h=new URLSearchParams(f);for(const[v,b]of Object.entries(o||{})){if(b==null)continue;let S;if(typeof b=="string")S=b;else if(Array.isArray(b)){for(const T of b)h.append(v,T);continue}else S=JSON.stringify(b);h.set(v,S)}if(i)if(Array.isArray(i)){const v=c.split("/").filter(b=>b.startsWith(":"));for(const[b,S]of v.entries()){const T=i[b];c=c.replace(S,T)}}else for(const[v,b]of Object.entries(i))c=c.replace(`:${v}`,String(b));c=c.split("/").map(encodeURIComponent).join("/"),c.startsWith("/")&&(c=c.slice(1));let m=h.toString();return m=m.length>0?`?${m}`.replace(/\+/g,"%20"):"",u.startsWith("http")?new URL(`${c}${m}`,u):`${u}${c}${m}`}var Oh=async(e,t)=>{var a,i,o,u,c,f,h,m;const{hooks:y,url:v,options:b}=await w4(e,t),S=z4(b),T=new AbortController,E=(a=b.signal)!=null?a:T.signal,x=$4(v,b),z=D4(b),U=await N4(b),w=P4(v,b);let C=Un(Mn({},b),{url:x,headers:U,body:z,method:w,signal:E});for(const we of y.onRequest)if(we){const ve=await we(C);typeof ve=="object"&&ve!==null&&(C=ve)}("pipeTo"in C&&typeof C.pipeTo=="function"||typeof((i=t?.body)==null?void 0:i.pipe)=="function")&&("duplex"in C||(C.duplex="half"));const{clearTimeout:F}=L4(b,T);let L=await S(C.url,C);F();const I={response:L,request:C};for(const we of y.onResponse)if(we){const ve=await we(Un(Mn({},I),{response:(o=t?.hookOptions)!=null&&o.cloneResponse?L.clone():L}));ve instanceof Response?L=ve:typeof ve=="object"&&ve!==null&&(L=ve.response)}if(L.ok){if(!(C.method!=="HEAD"))return{data:"",error:null};const ve=M4(L),Ae={data:null,response:L,request:C};if(ve==="json"||ve==="text"){const $=await L.text(),J=(u=C.jsonParser)!=null?u:nb;Ae.data=await J($)}else Ae.data=await L[ve]();C?.output&&C.output&&!C.disableValidation&&(Ae.data=await gu(C.output,Ae.data));for(const $ of y.onSuccess)$&&await $(Un(Mn({},Ae),{response:(c=t?.hookOptions)!=null&&c.cloneResponse?L.clone():L}));return t?.throw?Ae.data:{data:Ae.data,error:null}}const G=(f=t?.jsonParser)!=null?f:nb,W=await L.text(),fe=C4(W),le=fe?await G(W):null,je={response:L,responseText:W,request:C,error:Un(Mn({},le),{status:L.status,statusText:L.statusText})};for(const we of y.onError)we&&await we(Un(Mn({},je),{response:(h=t?.hookOptions)!=null&&h.cloneResponse?L.clone():L}));if(t?.retry){const we=R4(t.retry),ve=(m=t.retryAttempt)!=null?m:0;if(await we.shouldAttemptRetry(ve,L)){for(const $ of y.onRetry)$&&await $(I);const Ae=we.getDelay(ve);return await new Promise($=>setTimeout($,Ae)),await Oh(e,Un(Mn({},t),{retryAttempt:ve+1}))}}if(t?.throw)throw new O4(L.status,L.statusText,fe?le:W);return{data:null,error:Un(Mn({},le),{status:L.status,statusText:L.statusText})}};const Z4=(e,t)=>{const a="credentials"in Request.prototype,i=JD(e?.baseURL,e?.basePath)??"/api/auth",o=e?.plugins?.flatMap(C=>C.fetchPlugins).filter(C=>C!==void 0)||[],u={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:c,onError:f,onRequest:h,onResponse:m,...y}=e?.fetchOptions||{},v=k4({baseURL:i,...a?{credentials:"include"}:{},method:"GET",jsonParser(C){return C?a4(C,{strict:!1}):null},customFetchImpl:fetch,...y,plugins:[u,...y.plugins||[],...e?.disableDefaultFetchPlugins?[]:[KD],...o]}),{$sessionSignal:b,session:S}=v4(v,e),T=e?.plugins||[];let E={},x={$sessionSignal:b,session:S},z={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"};const U=[{signal:"$sessionSignal",matcher(C){return C==="/sign-out"||C==="/update-user"||C==="/sign-up/email"||C==="/sign-in/email"||C==="/delete-user"||C==="/verify-email"||C==="/revoke-sessions"||C==="/revoke-session"||C==="/change-email"}}];for(const C of T)C.getAtoms&&Object.assign(x,C.getAtoms?.(v)),C.pathMethods&&Object.assign(z,C.pathMethods),C.atomListeners&&U.push(...C.atomListeners);const w={notify:C=>{x[C].set(!x[C].get())},listen:(C,F)=>{x[C].subscribe(F)},atoms:x};for(const C of T)C.getActions&&Object.assign(E,C.getActions?.(v,w,e));return{get baseURL(){return i},pluginsActions:E,pluginsAtoms:x,pluginPathMethods:z,atomListeners:U,$fetch:v,$store:w}};function B4(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function q4(e,t,a){const i=t[e],{fetchOptions:o,query:u,...c}=a||{};return i||(o?.method?o.method:c&&Object.keys(c).length>0?"POST":"GET")}function H4(e,t,a,i,o){function u(c=[]){return new Proxy(function(){},{get(f,h){if(typeof h!="string"||h==="then"||h==="catch"||h==="finally")return;const m=[...c,h];let y=e;for(const v of m)if(y&&typeof y=="object"&&v in y)y=y[v];else{y=void 0;break}return typeof y=="function"||B4(y)?y:u(m)},apply:async(f,h,m)=>{const y="/"+c.map(U=>U.replace(/[A-Z]/g,w=>`-${w.toLowerCase()}`)).join("/"),v=m[0]||{},b=m[1]||{},{query:S,fetchOptions:T,...E}=v,x={...b,...T},z=q4(y,a,v);return await t(y,{...x,body:z==="GET"?void 0:{...E,...x?.body||{}},query:S||x?.query,method:z,async onSuccess(U){if(await x?.onSuccess?.(U),!o||x.disableSignal)return;const w=o.filter(F=>F.matcher(y));if(!w.length)return;const C=new Set;for(const F of w){const L=i[F.signal];if(!L)return;if(C.has(F.signal))continue;C.add(F.signal);const I=L.get();setTimeout(()=>{L.set(!I)},10)}}})}})}return u()}function V4(e,t={}){let a=K.useRef(e.get());const{keys:i,deps:o=[e,i]}=t;let u=K.useCallback(f=>{const h=m=>{a.current!==m&&(a.current=m,f())};return h(e.value),i?.length?l4(e,i,h):e.listen(h)},o),c=()=>a.current;return K.useSyncExternalStore(u,c,c)}function G4(e){return`use${YD(e)}`}function Y4(e){const{pluginPathMethods:t,pluginsActions:a,pluginsAtoms:i,$fetch:o,$store:u,atomListeners:c}=Z4(e);let f={};for(const[h,m]of Object.entries(i))f[G4(h)]=()=>V4(m);return H4({...a,...f,$fetch:o,$store:u},o,t,i,c)}const o1=Y4({}),{useSession:F4,signIn:zP,signUp:NP,signOut:jP}=o1,DP=async()=>{await o1.signIn.social({provider:"google"})},Q4=()=>{const e=wo(),t=F4();return K.useEffect(()=>{!t.isPending&&!t.data&&e({to:"/login"})},[t.isPending,t.data,e]),t},Wu=OA({component:J4});function J4(){const e=Q4();return ID(),e.isPending?null:ae.jsx("div",{className:"flex h-screen",children:ae.jsx(a_,{})})}const K4="modulepreload",X4=function(e){return"/"+e},ab={},Mo=function(t,a,i){let o=Promise.resolve();if(a&&a.length>0){let h=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");o=h(a.map(m=>{if(m=X4(m),m in ab)return;ab[m]=!0;const y=m.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":K4,y||(b.as="script"),b.crossOrigin="",b.href=m,f&&b.setAttribute("nonce",f),document.head.appendChild(b),y)return new Promise((S,T)=>{b.addEventListener("load",S),b.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return o.then(c=>{for(const f of c||[])f.status==="rejected"&&u(f.reason);return t().catch(u)})},W4=()=>Mo(()=>import("./signup-CQSmDpcH.js"),__vite__mapDeps([0,1,2,3])),eP=La("/signup")({component:To(W4,"component")}),tP=()=>Mo(()=>import("./login-CF4uOXFH.js"),__vite__mapDeps([4,1,2,3])),nP=La("/login")({component:To(tP,"component")}),rP=()=>Mo(()=>import("./_chat-layout-Do0mWziW.js"),__vite__mapDeps([5,2,3,6])),aP=La("/_chat-layout")({component:To(rP,"component")}),iP=()=>Mo(()=>import("./_chat-layout.index-mxrV7qZY.js"),__vite__mapDeps([7,3])),sP=La("/_chat-layout/")({component:To(iP,"component")}),oP=()=>Mo(()=>import("./mermaid-FSSLJTFX-BzFakw7W.js").then(e=>e._),__vite__mapDeps([8,3,6,2])),lP=La("/_chat-layout/$chatId")({component:To(oP,"component")}),uP=eP.update({id:"/signup",path:"/signup",getParentRoute:()=>Wu}),cP=nP.update({id:"/login",path:"/login",getParentRoute:()=>Wu}),Kh=aP.update({id:"/_chat-layout",getParentRoute:()=>Wu}),fP=sP.update({id:"/",path:"/",getParentRoute:()=>Kh}),dP=lP.update({id:"/$chatId",path:"/$chatId",getParentRoute:()=>Kh}),hP={ChatLayoutChatIdRoute:dP,ChatLayoutIndexRoute:fP},pP=Kh._addFileChildren(hP),mP={ChatLayoutRoute:pP,LoginRoute:cP,SignupRoute:uP},yP=Wu._addFileChildren(mP)._addFileTypes(),vP=NA({routeTree:yP,context:{},defaultPreload:"intent",scrollRestoration:!0,defaultStructuralSharing:!0,defaultPreloadStaleTime:0}),l1=new mT({defaultOptions:{queries:{retry:!1,staleTime:300*1e3}}}),gP=$w({links:[Cw(),Rw({url:"/api/trpc"})]}),bu=QT({client:gP,queryClient:l1}),ib=document.getElementById("app");ib.innerHTML||ZA.createRoot(ib).render(ae.jsx(K.StrictMode,{children:ae.jsx(yT,{client:l1,children:ae.jsx(PA,{router:vP})})}));export{t_ as L,a_ as O,bP as R,Eo as S,Mo as _,zP as a,F4 as b,xT as c,Xd as d,uo as e,zb as f,dT as g,DP as h,Ut as i,ae as j,Tb as k,Oo as l,CP as m,wt as n,wh as o,qi as p,RP as q,K as r,NP as s,bu as t,wo as u,xP as v,MP as w,AP as x,UD as y};
|
|
59
|
+
`)}})}});var MD=nD(()=>GS($e([ue({type:Y("text-start"),id:D(),providerMetadata:Re.optional()}),ue({type:Y("text-delta"),id:D(),delta:D(),providerMetadata:Re.optional()}),ue({type:Y("text-end"),id:D(),providerMetadata:Re.optional()}),ue({type:Y("error"),errorText:D()}),ue({type:Y("tool-input-start"),toolCallId:D(),toolName:D(),providerExecuted:De().optional(),dynamic:De().optional(),title:D().optional()}),ue({type:Y("tool-input-delta"),toolCallId:D(),inputTextDelta:D()}),ue({type:Y("tool-input-available"),toolCallId:D(),toolName:D(),input:gt(),providerExecuted:De().optional(),providerMetadata:Re.optional(),dynamic:De().optional(),title:D().optional()}),ue({type:Y("tool-input-error"),toolCallId:D(),toolName:D(),input:gt(),providerExecuted:De().optional(),providerMetadata:Re.optional(),dynamic:De().optional(),errorText:D(),title:D().optional()}),ue({type:Y("tool-approval-request"),approvalId:D(),toolCallId:D()}),ue({type:Y("tool-output-available"),toolCallId:D(),output:gt(),providerExecuted:De().optional(),dynamic:De().optional(),preliminary:De().optional()}),ue({type:Y("tool-output-error"),toolCallId:D(),errorText:D(),providerExecuted:De().optional(),dynamic:De().optional()}),ue({type:Y("tool-output-denied"),toolCallId:D()}),ue({type:Y("reasoning-start"),id:D(),providerMetadata:Re.optional()}),ue({type:Y("reasoning-delta"),id:D(),delta:D(),providerMetadata:Re.optional()}),ue({type:Y("reasoning-end"),id:D(),providerMetadata:Re.optional()}),ue({type:Y("source-url"),sourceId:D(),url:D(),title:D().optional(),providerMetadata:Re.optional()}),ue({type:Y("source-document"),sourceId:D(),mediaType:D(),title:D(),filename:D().optional(),providerMetadata:Re.optional()}),ue({type:Y("file"),url:D(),mediaType:D(),providerMetadata:Re.optional()}),ue({type:Qu(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:D().optional(),data:gt(),transient:De().optional()}),ue({type:Y("start-step")}),ue({type:Y("finish-step")}),ue({type:Y("start"),messageId:D().optional(),messageMetadata:gt().optional()}),ue({type:Y("finish"),finishReason:Yh(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:gt().optional()}),ue({type:Y("abort"),reason:D().optional()}),ue({type:Y("message-metadata"),messageMetadata:gt()})])));function CD(e){return e.type.startsWith("tool-")}function e1(e){return e.type==="dynamic-tool"}function t1(e){return CD(e)||e1(e)}function zD(e){return e.type.split("-").slice(1).join("-")}function ND(e){return e1(e)?e.toolName:zD(e)}xo({prefix:"aitxt",size:24});xo({prefix:"aiobj",size:24});xo({prefix:"aiobj",size:24});var jD=class{constructor({api:e="/api/chat",credentials:t,headers:a,body:i,fetch:o,prepareSendMessagesRequest:u,prepareReconnectToStreamRequest:c}){this.api=e,this.credentials=t,this.headers=a,this.body=i,this.fetch=o,this.prepareSendMessagesRequest=u,this.prepareReconnectToStreamRequest=c}async sendMessages({abortSignal:e,...t}){var a,i,o,u,c;const f=await qr(this.body),h=await qr(this.headers),m=await qr(this.credentials),y={...Aa(h),...Aa(t.headers)},v=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...f,...t.body},headers:y,credentials:m,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),b=(i=v?.api)!=null?i:this.api,S=v?.headers!==void 0?Aa(v.headers):y,T=v?.body!==void 0?v.body:{...f,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},E=(o=v?.credentials)!=null?o:m,z=await((u=this.fetch)!=null?u:globalThis.fetch)(b,{method:"POST",headers:H0({"Content-Type":"application/json",...S},`ai-sdk/${F0}`,q0()),body:JSON.stringify(T),credentials:E,signal:e});if(!z.ok)throw new Error((c=await z.text())!=null?c:"Failed to fetch the chat response.");if(!z.body)throw new Error("The response body is empty.");return this.processResponseStream(z.body)}async reconnectToStream(e){var t,a,i,o,u;const c=await qr(this.body),f=await qr(this.headers),h=await qr(this.credentials),m={...Aa(f),...Aa(e.headers)},y=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...c,...e.body},headers:m,credentials:h,requestMetadata:e.metadata})),v=(a=y?.api)!=null?a:`${this.api}/${e.chatId}/stream`,b=y?.headers!==void 0?Aa(y.headers):m,S=(i=y?.credentials)!=null?i:h,E=await((o=this.fetch)!=null?o:globalThis.fetch)(v,{method:"GET",headers:H0(b,`ai-sdk/${F0}`,q0()),credentials:S});if(E.status===204)return null;if(!E.ok)throw new Error((u=await E.text())!=null?u:"Failed to fetch the chat response.");if(!E.body)throw new Error("The response body is empty.");return this.processResponseStream(E.body)}},DD=class extends jD{constructor(e={}){super(e)}processResponseStream(e){return lD({stream:e,schema:MD}).pipeThrough(new TransformStream({async transform(t,a){if(!t.success)throw t.error;a.enqueue(t.value)}}))}};function PD({messages:e}){const t=e[e.length-1];if(!t||t.role!=="assistant")return!1;const a=t.parts.reduce((o,u,c)=>u.type==="step-start"?c:o,-1),i=t.parts.slice(a+1).filter(t1).filter(o=>!o.providerExecuted);return i.length>0&&i.every(o=>o.state==="output-available"||o.state==="output-error")}const LD=e=>{const t=K.useRef(e);return t.current=e,t},UD=({chatId:e})=>xT(bu.chat.get.queryOptions({chatId:e??""},{enabled:!!e})),Ni=new Map,$i={getAgent(e){return Ni.get(e)},registerAgent(e,t){return Ni.set(e,t),t},disposeAgent(e){Ni.delete(e)},moveAgent(e,t){const a=Ni.get(e);if(!a)throw new Error(`Agent ${e} not found.`);Ni.delete(e),Ni.set(t,a)}},RP=({state:e})=>e==="output-available"||e==="output-denied"||e==="output-error",AP=t1,xP=ND,MP=(e,t)=>{if(!n1(e))return!1;const i=t.at(-1);return i?i.parts.some(o=>o.type==="step-start"):!1},n1=e=>e==="streaming"||e==="submitted",CP=()=>{const e=wo(),{chatId:t}=Oo({strict:!1}),a=UD({chatId:t}),i=zb(),o=LD(t),u=K.useMemo(()=>{const v=t??"new-chat",b=$i.getAgent(v);if(b)return b;const S=new vh({id:v,transport:new DD({api:"/api/chat/agent",prepareSendMessagesRequest:T=>({body:{chatId:o.current,message:T.messages.at(-1)}})}),onData:T=>{const E=T.data;$i.moveAgent(v,E.id),i.setQueryData(bu.chat.get.queryKey({chatId:E.id}),{...T.data,messages:u.messages}),i.setQueryData(bu.chat.list.queryKey(),x=>({chats:[E,...x?.chats||[]]})),e({to:"/$chatId",params:{chatId:E.id}})},sendAutomaticallyWhen:PD,onFinish:()=>{o.current!==u.id&&$i.disposeAgent(u.id)}});return $i.registerAgent(v,S)},[t,e,i,o]),c=sj({chat:u}),{setMessages:f,messages:h,status:m}=c,y=m==="streaming"||m==="submitted";return K.useEffect(()=>{a.data?.messages&&!y&&f(a.data.messages)},[a.data?.messages,y,f]),K.useEffect(()=>{y&&i.setQueryData(bu.chat.get.queryKey({chatId:t}),v=>v&&{...v,messages:h})},[i,h,t,y]),{...c,isRunning:y,isReadyForNewMessages:t?!!a.data&&!y:!0}},ID=()=>{const e=Oo({strict:!1}).chatId,t=K.useRef(e);K.useEffect(()=>{try{if(!e||!t.current||e===t.current)return;const a=t.current,i=$i.getAgent(a);if(!i)return;n1(i.status)||$i.disposeAgent(a)}finally{t.current=e}},[e])};var kD={},Q0={};const yu=Object.create(null),Xs=e=>kD||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?yu:globalThis),yn=new Proxy(yu,{get(e,t){return Xs()[t]??yu[t]},has(e,t){return t in Xs()||t in yu},set(e,t,a){const i=Xs(!0);return i[t]=a,!0},deleteProperty(e,t){if(!t)return!1;const a=Xs(!0);return delete a[t],!0},ownKeys(){const e=Xs(!0);return Object.keys(e)}});function ht(e,t){return typeof process<"u"&&Q0?Q0[e]??t:typeof Deno<"u"?Deno.env.get(e)??t:typeof Bun<"u"?Bun.env[e]??t:t}const Ws=1,vt=4,In=8,Kt=24,J0={eterm:vt,cons25:vt,console:vt,cygwin:vt,dtterm:vt,gnome:vt,hurd:vt,jfbterm:vt,konsole:vt,kterm:vt,mlterm:vt,mosh:Kt,putty:vt,st:vt,"rxvt-unicode-24bit":Kt,terminator:Kt,"xterm-kitty":Kt},$D=new Map(Object.entries({APPVEYOR:In,BUILDKITE:In,CIRCLECI:Kt,DRONE:In,GITEA_ACTIONS:Kt,GITHUB_ACTIONS:Kt,GITLAB_CI:In,TRAVIS:In})),ZD=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function BD(){if(ht("FORCE_COLOR")!==void 0)switch(ht("FORCE_COLOR")){case"":case"1":case"true":return vt;case"2":return In;case"3":return Kt;default:return Ws}if(ht("NODE_DISABLE_COLORS")!==void 0&&ht("NODE_DISABLE_COLORS")!==""||ht("NO_COLOR")!==void 0&&ht("NO_COLOR")!==""||ht("TERM")==="dumb")return Ws;if(ht("TMUX"))return Kt;if("TF_BUILD"in yn&&"AGENT_NAME"in yn)return vt;if("CI"in yn){for(const{0:e,1:t}of $D)if(e in yn)return t;return ht("CI_NAME")==="codeship"?In:Ws}if("TEAMCITY_VERSION"in yn)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(ht("TEAMCITY_VERSION"))!==null?vt:Ws;switch(ht("TERM_PROGRAM")){case"iTerm.app":return!ht("TERM_PROGRAM_VERSION")||/^[0-2]\./.exec(ht("TERM_PROGRAM_VERSION"))!==null?In:Kt;case"HyperTerm":case"MacTerm":return Kt;case"Apple_Terminal":return In}if(ht("COLORTERM")==="truecolor"||ht("COLORTERM")==="24bit")return Kt;if(ht("TERM")){if(/truecolor/.exec(ht("TERM"))!==null)return Kt;if(/^xterm-256/.exec(ht("TERM"))!==null)return In;const e=ht("TERM").toLowerCase();if(J0[e])return J0[e];if(ZD.some(t=>t.exec(e)!==null))return vt}return ht("COLORTERM")?vt:Ws}const kn={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",fg:{red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m"}},Sh=["debug","info","success","warn","error"];function qD(e,t){return Sh.indexOf(t)>=Sh.indexOf(e)}const HD={info:kn.fg.blue,success:kn.fg.green,warn:kn.fg.yellow,error:kn.fg.red,debug:kn.fg.magenta},VD=(e,t,a)=>{const i=new Date().toISOString();return a?`${kn.dim}${i}${kn.reset} ${HD[e]}${e.toUpperCase()}${kn.reset} ${kn.bright}[Better Auth]:${kn.reset} ${t}`:`${i} ${e.toUpperCase()} [Better Auth]: ${t}`},GD=e=>{const t="error",a=BD()!==1,i=(o,u,c=[])=>{if(!qD(t,o))return;const f=VD(o,u,a);{o==="error"?console.error(f,...c):o==="warn"?console.warn(f,...c):console.log(f,...c);return}};return{...Object.fromEntries(Sh.map(o=>[o,(...[u,...c])=>i(o,u,c)])),get level(){return t}}};GD();function YD(e){return e.charAt(0).toUpperCase()+e.slice(1)}var vu=class extends Error{constructor(e,t){super(e),this.name="BetterAuthError",this.message=e,this.cause=t,this.stack=""}};function FD(e){try{return(new URL(e).pathname.replace(/\/+$/,"")||"/")!=="/"}catch{throw new vu(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function QD(e){try{const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new vu(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof vu?t:new vu(`Invalid base URL: ${e}. Please provide a valid base URL.`,String(t))}}function Hd(e,t="/api/auth"){if(QD(e),FD(e))return e;const a=e.replace(/\/+$/,"");return!t||t==="/"?a:(t=t.startsWith("/")?t:`/${t}`,`${a}${t}`)}function JD(e,t,a,i,o){if(e)return Hd(e,t);{const u=yn.BETTER_AUTH_URL||yn.NEXT_PUBLIC_BETTER_AUTH_URL||yn.PUBLIC_BETTER_AUTH_URL||yn.NUXT_PUBLIC_BETTER_AUTH_URL||yn.NUXT_PUBLIC_AUTH_URL||(yn.BASE_URL!=="/"?yn.BASE_URL:void 0);if(u)return Hd(u,t)}if(typeof window<"u"&&window.location)return Hd(window.location.origin,t)}const KD={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}},XD={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},WD=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,K0={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},e4=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function t4(e){return e instanceof Date&&!isNaN(e.getTime())}function n4(e){const t=e4.exec(e);if(!t)return null;const[,a,i,o,u,c,f,h,m,y,v]=t;let b=new Date(Date.UTC(parseInt(a,10),parseInt(i,10)-1,parseInt(o,10),parseInt(u,10),parseInt(c,10),parseInt(f,10),h?parseInt(h.padEnd(3,"0"),10):0));if(m){const S=(parseInt(y,10)*60+parseInt(v,10))*(m==="+"?-1:1);b.setUTCMinutes(b.getUTCMinutes()+S)}return t4(b)?b:null}function r4(e,t={}){const{strict:a=!1,warnings:i=!1,reviver:o,parseDates:u=!0}=t;if(typeof e!="string")return e;const c=e.trim();if(c.length>0&&c[0]==='"'&&c.endsWith('"')&&!c.slice(1,-1).includes('"'))return c.slice(1,-1);const f=c.toLowerCase();if(f.length<=9&&f in K0)return K0[f];if(!WD.test(c)){if(a)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(XD).some(([h,m])=>{const y=m.test(c);return y&&i&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${h} pattern`),y})&&a)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(c,(m,y)=>{if(m==="__proto__"||m==="constructor"&&y&&typeof y=="object"&&"prototype"in y){i&&console.warn(`[better-json] Dropping "${m}" key to prevent prototype pollution`);return}if(u&&typeof y=="string"){const v=n4(y);if(v)return v}return o?o(m,y):y})}catch(h){if(a)throw h;return e}}function a4(e,t={strict:!0}){return r4(e,t)}let An=[],$r=0;const ou=4,r1=e=>{let t=[],a={get(){return a.lc||a.listen(()=>{})(),a.value},lc:0,listen(i){return a.lc=t.push(i),()=>{for(let u=$r+ou;u<An.length;)An[u]===i?An.splice(u,ou):u+=ou;let o=t.indexOf(i);~o&&(t.splice(o,1),--a.lc||a.off())}},notify(i,o){let u=!An.length;for(let c of t)An.push(c,a.value,i,o);if(u){for($r=0;$r<An.length;$r+=ou)An[$r](An[$r+1],An[$r+2],An[$r+3]);An.length=0}},off(){},set(i){let o=a.value;o!==i&&(a.value=i,a.notify(o))},subscribe(i){let o=a.listen(i);return i(a.value),o},value:e};return a},i4=5,lu=6,uu=10;let s4=(e,t,a,i)=>(e.events=e.events||{},e.events[a+uu]||(e.events[a+uu]=i(o=>{e.events[a].reduceRight((u,c)=>(c(u),u),{shared:{},...o})})),e.events[a]=e.events[a]||[],e.events[a].push(t),()=>{let o=e.events[a],u=o.indexOf(t);o.splice(u,1),o.length||(delete e.events[a],e.events[a+uu](),delete e.events[a+uu])}),o4=1e3,a1=(e,t)=>s4(e,i=>{let o=t(i);o&&e.events[lu].push(o)},i4,i=>{let o=e.listen;e.listen=(...c)=>(!e.lc&&!e.active&&(e.active=!0,i()),o(...c));let u=e.off;return e.events[lu]=[],e.off=()=>{u(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let c of e.events[lu])c();e.events[lu]=[]}},o4)},()=>{e.listen=o,e.off=u}});function l4(e,t,a){let i=new Set(t).add(void 0);return e.listen((o,u,c)=>{i.has(c)&&a(o,u,c)})}const u4=()=>typeof window>"u",c4=(e,t,a,i)=>{const o=r1({data:null,error:null,isPending:!0,isRefetching:!1,refetch:f=>u(f)}),u=async f=>new Promise(h=>{const m=typeof i=="function"?i({data:o.get().data,error:o.get().error,isPending:o.get().isPending}):i;a(t,{...m,query:{...m?.query,...f?.query},async onSuccess(y){o.set({data:y.data,error:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await m?.onSuccess?.(y)},async onError(y){const{request:v}=y,b=typeof v.retry=="number"?v.retry:v.retry?.attempts,S=v.retryAttempt||0;b&&S<b||(o.set({error:y.error,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch}),await m?.onError?.(y))},async onRequest(y){const v=o.get();o.set({isPending:v.data===null,data:v.data,error:null,isRefetching:!0,refetch:o.value.refetch}),await m?.onRequest?.(y)}}).catch(y=>{o.set({error:y,data:null,isPending:!1,isRefetching:!1,refetch:o.value.refetch})}).finally(()=>{h(void 0)})});e=Array.isArray(e)?e:[e];let c=!1;for(const f of e)f.subscribe(async()=>{u4()||(c?await u():a1(o,()=>{const h=setTimeout(async()=>{c||(await u(),c=!0)},0);return()=>{o.off(),f.off(),clearTimeout(h)}}))});return o},Vd=Symbol.for("better-auth:broadcast-channel"),f4=()=>Math.floor(Date.now()/1e3);var d4=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>"u"))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:f4()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=t=>{if(t.key!==this.name)return;const a=JSON.parse(t.newValue??"{}");a?.event!=="session"||!a?.data||this.listeners.forEach(i=>i(a))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function Gd(e="better-auth.message"){return globalThis[Vd]||(globalThis[Vd]=new d4(e)),globalThis[Vd]}const Yd=Symbol.for("better-auth:focus-manager");var h4=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>{document.visibilityState==="visible"&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function X0(){return globalThis[Yd]||(globalThis[Yd]=new h4),globalThis[Yd]}const Fd=Symbol.for("better-auth:online-manager");var p4=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};const e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e,!1),window.removeEventListener("offline",t,!1)}}};function Qd(){return globalThis[Fd]||(globalThis[Fd]=new p4),globalThis[Fd]}const ji=()=>Math.floor(Date.now()/1e3),m4=5;function y4(e){const{sessionAtom:t,sessionSignal:a,$fetch:i,options:o={}}=e,u=o.sessionOptions?.refetchInterval??0,c=o.sessionOptions?.refetchOnWindowFocus??!0,f=o.sessionOptions?.refetchWhenOffline??!1,h={lastSync:0,lastSessionRequest:0,cachedSession:void 0},m=()=>f||Qd().isOnline,y=U=>{if(!m())return;if(U?.event==="storage"){h.lastSync=ji(),a.set(!a.get());return}const w=t.get();if(U?.event==="poll"){h.lastSessionRequest=ji(),i("/get-session").then(C=>{C.error?t.set({...w,data:null,error:C.error}):t.set({...w,data:C.data,error:null}),h.lastSync=ji(),a.set(!a.get())}).catch(()=>{});return}if(U?.event==="visibilitychange"){if(ji()-h.lastSessionRequest<m4)return;h.lastSessionRequest=ji()}(w?.data===null||w?.data===void 0||U?.event==="visibilitychange")&&(h.lastSync=ji(),a.set(!a.get()))},v=U=>{Gd().post({event:"session",data:{trigger:U},clientId:Math.random().toString(36).substring(7)})},b=()=>{u&&u>0&&(h.pollInterval=setInterval(()=>{t.get()?.data&&y({event:"poll"})},u*1e3))},S=()=>{h.unsubscribeBroadcast=Gd().subscribe(()=>{y({event:"storage"})})},T=()=>{c&&(h.unsubscribeFocus=X0().subscribe(()=>{y({event:"visibilitychange"})}))},E=()=>{h.unsubscribeOnline=Qd().subscribe(U=>{U&&y({event:"visibilitychange"})})};return{init:()=>{b(),S(),T(),E(),Gd().setup(),X0().setup(),Qd().setup()},cleanup:()=>{h.pollInterval&&(clearInterval(h.pollInterval),h.pollInterval=void 0),h.unsubscribeBroadcast&&(h.unsubscribeBroadcast(),h.unsubscribeBroadcast=void 0),h.unsubscribeFocus&&(h.unsubscribeFocus(),h.unsubscribeFocus=void 0),h.unsubscribeOnline&&(h.unsubscribeOnline(),h.unsubscribeOnline=void 0),h.lastSync=0,h.lastSessionRequest=0,h.cachedSession=void 0},triggerRefetch:y,broadcastSessionUpdate:v}}function v4(e,t){const a=r1(!1),i=c4(a,"/get-session",e,{method:"GET"});return a1(i,()=>{const o=y4({sessionAtom:i,sessionSignal:a,$fetch:e,options:t});return o.init(),()=>{o.cleanup()}}),{session:i,$sessionSignal:a}}var g4=Object.defineProperty,b4=Object.defineProperties,_4=Object.getOwnPropertyDescriptors,W0=Object.getOwnPropertySymbols,S4=Object.prototype.hasOwnProperty,E4=Object.prototype.propertyIsEnumerable,eb=(e,t,a)=>t in e?g4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Mn=(e,t)=>{for(var a in t||(t={}))S4.call(t,a)&&eb(e,a,t[a]);if(W0)for(var a of W0(t))E4.call(t,a)&&eb(e,a,t[a]);return e},Un=(e,t)=>b4(e,_4(t)),O4=class extends Error{constructor(e,t,a){super(t||e.toString(),{cause:a}),this.status=e,this.statusText=t,this.error=a,Error.captureStackTrace(this,this.constructor)}},w4=async(e,t)=>{var a,i,o,u,c,f;let h=t||{};const m={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:h,hooks:m};for(const y of t?.plugins||[]){if(y.init){const v=await((a=y.init)==null?void 0:a.call(y,e.toString(),t));h=v.options||h,e=v.url}m.onRequest.push((i=y.hooks)==null?void 0:i.onRequest),m.onResponse.push((o=y.hooks)==null?void 0:o.onResponse),m.onSuccess.push((u=y.hooks)==null?void 0:u.onSuccess),m.onError.push((c=y.hooks)==null?void 0:c.onError),m.onRetry.push((f=y.hooks)==null?void 0:f.onRetry)}return{url:e,options:h,hooks:m}},tb=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},T4=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function R4(e){if(typeof e=="number")return new tb({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new tb(e);case"exponential":return new T4(e);default:throw new Error("Invalid retry strategy")}}var A4=async e=>{const t={},a=async i=>typeof i=="function"?await i():i;if(e?.auth){if(e.auth.type==="Bearer"){const i=await a(e.auth.token);if(!i)return t;t.authorization=`Bearer ${i}`}else if(e.auth.type==="Basic"){const[i,o]=await Promise.all([a(e.auth.username),a(e.auth.password)]);if(!i||!o)return t;t.authorization=`Basic ${btoa(`${i}:${o}`)}`}else if(e.auth.type==="Custom"){const[i,o]=await Promise.all([a(e.auth.prefix),a(e.auth.value)]);if(!o)return t;t.authorization=`${i??""} ${o}`}}return t},x4=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function M4(e){const t=e.headers.get("content-type"),a=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";const i=t.split(";").shift()||"";return x4.test(i)?"json":a.has(i)||i.startsWith("text/")?"text":"blob"}function C4(e){try{return JSON.parse(e),!0}catch{return!1}}function Eh(e){if(e===void 0)return!1;const t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function nb(e){try{return JSON.parse(e)}catch{return e}}function rb(e){return typeof e=="function"}function z4(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&rb(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&rb(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function N4(e){const t=new Headers(e?.headers),a=await A4(e);for(const[i,o]of Object.entries(a||{}))t.set(i,o);if(!t.has("content-type")){const i=j4(e?.body);i&&t.set("content-type",i)}return t}function j4(e){return Eh(e)?"application/json":null}function D4(e){if(!e?.body)return null;const t=new Headers(e?.headers);if(Eh(e.body)&&!t.has("content-type")){for(const[a,i]of Object.entries(e?.body))i instanceof Date&&(e.body[a]=i.toISOString());return JSON.stringify(e.body)}return t.has("content-type")&&t.get("content-type")==="application/x-www-form-urlencoded"&&Eh(e.body)?new URLSearchParams(e.body).toString():e.body}function P4(e,t){var a;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){const i=(a=e.split("@")[1])==null?void 0:a.split("/")[0];return s1.includes(i)?i.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function L4(e,t){let a;return!e?.signal&&e?.timeout&&(a=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:a,clearTimeout:()=>{a&&clearTimeout(a)}}}var U4=class i1 extends Error{constructor(t,a){super(a||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,i1.prototype)}};async function gu(e,t){const a=await e["~standard"].validate(t);if(a.issues)throw new U4(a.issues);return a.value}var s1=["get","post","put","patch","delete"],I4=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,a){var i,o,u,c;const f=((o=(i=e.plugins)==null?void 0:i.find(h=>{var m;return(m=h.schema)!=null&&m.config?t.startsWith(h.schema.config.baseURL||"")||t.startsWith(h.schema.config.prefix||""):!1}))==null?void 0:o.schema)||e.schema;if(f){let h=t;(u=f.config)!=null&&u.prefix&&h.startsWith(f.config.prefix)&&(h=h.replace(f.config.prefix,""),f.config.baseURL&&(t=t.replace(f.config.prefix,f.config.baseURL))),(c=f.config)!=null&&c.baseURL&&h.startsWith(f.config.baseURL)&&(h=h.replace(f.config.baseURL,""));const m=f.schema[h];if(m){let y=Un(Mn({},a),{method:m.method,output:m.output});return a?.disableValidation||(y=Un(Mn({},y),{body:m.input?await gu(m.input,a?.body):a?.body,params:m.params?await gu(m.params,a?.params):a?.params,query:m.query?await gu(m.query,a?.query):a?.query})),{url:t,options:y}}}return{url:t,options:a}}}),k4=e=>{async function t(a,i){const o=Un(Mn(Mn({},e),i),{plugins:[...e?.plugins||[],I4(e||{}),...i?.plugins||[]]});if(e?.catchAllError)try{return await Oh(a,o)}catch(u){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:u}}}return await Oh(a,o)}return t};function $4(e,t){const{baseURL:a,params:i,query:o}=t||{query:{},params:{},baseURL:""};let u=e.startsWith("http")?e.split("/").slice(0,3).join("/"):a||"";if(e.startsWith("@")){const v=e.toString().split("@")[1].split("/")[0];s1.includes(v)&&(e=e.replace(`@${v}/`,"/"))}u.endsWith("/")||(u+="/");let[c,f]=e.replace(u,"").split("?");const h=new URLSearchParams(f);for(const[v,b]of Object.entries(o||{})){if(b==null)continue;let S;if(typeof b=="string")S=b;else if(Array.isArray(b)){for(const T of b)h.append(v,T);continue}else S=JSON.stringify(b);h.set(v,S)}if(i)if(Array.isArray(i)){const v=c.split("/").filter(b=>b.startsWith(":"));for(const[b,S]of v.entries()){const T=i[b];c=c.replace(S,T)}}else for(const[v,b]of Object.entries(i))c=c.replace(`:${v}`,String(b));c=c.split("/").map(encodeURIComponent).join("/"),c.startsWith("/")&&(c=c.slice(1));let m=h.toString();return m=m.length>0?`?${m}`.replace(/\+/g,"%20"):"",u.startsWith("http")?new URL(`${c}${m}`,u):`${u}${c}${m}`}var Oh=async(e,t)=>{var a,i,o,u,c,f,h,m;const{hooks:y,url:v,options:b}=await w4(e,t),S=z4(b),T=new AbortController,E=(a=b.signal)!=null?a:T.signal,x=$4(v,b),z=D4(b),U=await N4(b),w=P4(v,b);let C=Un(Mn({},b),{url:x,headers:U,body:z,method:w,signal:E});for(const we of y.onRequest)if(we){const ve=await we(C);typeof ve=="object"&&ve!==null&&(C=ve)}("pipeTo"in C&&typeof C.pipeTo=="function"||typeof((i=t?.body)==null?void 0:i.pipe)=="function")&&("duplex"in C||(C.duplex="half"));const{clearTimeout:F}=L4(b,T);let L=await S(C.url,C);F();const I={response:L,request:C};for(const we of y.onResponse)if(we){const ve=await we(Un(Mn({},I),{response:(o=t?.hookOptions)!=null&&o.cloneResponse?L.clone():L}));ve instanceof Response?L=ve:typeof ve=="object"&&ve!==null&&(L=ve.response)}if(L.ok){if(!(C.method!=="HEAD"))return{data:"",error:null};const ve=M4(L),Ae={data:null,response:L,request:C};if(ve==="json"||ve==="text"){const $=await L.text(),J=(u=C.jsonParser)!=null?u:nb;Ae.data=await J($)}else Ae.data=await L[ve]();C?.output&&C.output&&!C.disableValidation&&(Ae.data=await gu(C.output,Ae.data));for(const $ of y.onSuccess)$&&await $(Un(Mn({},Ae),{response:(c=t?.hookOptions)!=null&&c.cloneResponse?L.clone():L}));return t?.throw?Ae.data:{data:Ae.data,error:null}}const G=(f=t?.jsonParser)!=null?f:nb,W=await L.text(),fe=C4(W),le=fe?await G(W):null,je={response:L,responseText:W,request:C,error:Un(Mn({},le),{status:L.status,statusText:L.statusText})};for(const we of y.onError)we&&await we(Un(Mn({},je),{response:(h=t?.hookOptions)!=null&&h.cloneResponse?L.clone():L}));if(t?.retry){const we=R4(t.retry),ve=(m=t.retryAttempt)!=null?m:0;if(await we.shouldAttemptRetry(ve,L)){for(const $ of y.onRetry)$&&await $(I);const Ae=we.getDelay(ve);return await new Promise($=>setTimeout($,Ae)),await Oh(e,Un(Mn({},t),{retryAttempt:ve+1}))}}if(t?.throw)throw new O4(L.status,L.statusText,fe?le:W);return{data:null,error:Un(Mn({},le),{status:L.status,statusText:L.statusText})}};const Z4=(e,t)=>{const a="credentials"in Request.prototype,i=JD(e?.baseURL,e?.basePath)??"/api/auth",o=e?.plugins?.flatMap(C=>C.fetchPlugins).filter(C=>C!==void 0)||[],u={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:c,onError:f,onRequest:h,onResponse:m,...y}=e?.fetchOptions||{},v=k4({baseURL:i,...a?{credentials:"include"}:{},method:"GET",jsonParser(C){return C?a4(C,{strict:!1}):null},customFetchImpl:fetch,...y,plugins:[u,...y.plugins||[],...e?.disableDefaultFetchPlugins?[]:[KD],...o]}),{$sessionSignal:b,session:S}=v4(v,e),T=e?.plugins||[];let E={},x={$sessionSignal:b,session:S},z={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"};const U=[{signal:"$sessionSignal",matcher(C){return C==="/sign-out"||C==="/update-user"||C==="/sign-up/email"||C==="/sign-in/email"||C==="/delete-user"||C==="/verify-email"||C==="/revoke-sessions"||C==="/revoke-session"||C==="/change-email"}}];for(const C of T)C.getAtoms&&Object.assign(x,C.getAtoms?.(v)),C.pathMethods&&Object.assign(z,C.pathMethods),C.atomListeners&&U.push(...C.atomListeners);const w={notify:C=>{x[C].set(!x[C].get())},listen:(C,F)=>{x[C].subscribe(F)},atoms:x};for(const C of T)C.getActions&&Object.assign(E,C.getActions?.(v,w,e));return{get baseURL(){return i},pluginsActions:E,pluginsAtoms:x,pluginPathMethods:z,atomListeners:U,$fetch:v,$store:w}};function B4(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function q4(e,t,a){const i=t[e],{fetchOptions:o,query:u,...c}=a||{};return i||(o?.method?o.method:c&&Object.keys(c).length>0?"POST":"GET")}function H4(e,t,a,i,o){function u(c=[]){return new Proxy(function(){},{get(f,h){if(typeof h!="string"||h==="then"||h==="catch"||h==="finally")return;const m=[...c,h];let y=e;for(const v of m)if(y&&typeof y=="object"&&v in y)y=y[v];else{y=void 0;break}return typeof y=="function"||B4(y)?y:u(m)},apply:async(f,h,m)=>{const y="/"+c.map(U=>U.replace(/[A-Z]/g,w=>`-${w.toLowerCase()}`)).join("/"),v=m[0]||{},b=m[1]||{},{query:S,fetchOptions:T,...E}=v,x={...b,...T},z=q4(y,a,v);return await t(y,{...x,body:z==="GET"?void 0:{...E,...x?.body||{}},query:S||x?.query,method:z,async onSuccess(U){if(await x?.onSuccess?.(U),!o||x.disableSignal)return;const w=o.filter(F=>F.matcher(y));if(!w.length)return;const C=new Set;for(const F of w){const L=i[F.signal];if(!L)return;if(C.has(F.signal))continue;C.add(F.signal);const I=L.get();setTimeout(()=>{L.set(!I)},10)}}})}})}return u()}function V4(e,t={}){let a=K.useRef(e.get());const{keys:i,deps:o=[e,i]}=t;let u=K.useCallback(f=>{const h=m=>{a.current!==m&&(a.current=m,f())};return h(e.value),i?.length?l4(e,i,h):e.listen(h)},o),c=()=>a.current;return K.useSyncExternalStore(u,c,c)}function G4(e){return`use${YD(e)}`}function Y4(e){const{pluginPathMethods:t,pluginsActions:a,pluginsAtoms:i,$fetch:o,$store:u,atomListeners:c}=Z4(e);let f={};for(const[h,m]of Object.entries(i))f[G4(h)]=()=>V4(m);return H4({...a,...f,$fetch:o,$store:u},o,t,i,c)}const o1=Y4({}),{useSession:F4,signIn:zP,signUp:NP,signOut:jP}=o1,DP=async()=>{await o1.signIn.social({provider:"google"})},Q4=()=>{const e=wo(),t=F4();return K.useEffect(()=>{!t.isPending&&!t.data&&e({to:"/login"})},[t.isPending,t.data,e]),t},Wu=OA({component:J4});function J4(){const e=Q4();return ID(),e.isPending?null:ae.jsx("div",{className:"flex h-screen",children:ae.jsx(a_,{})})}const K4="modulepreload",X4=function(e){return"/"+e},ab={},Mo=function(t,a,i){let o=Promise.resolve();if(a&&a.length>0){let h=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),f=c?.nonce||c?.getAttribute("nonce");o=h(a.map(m=>{if(m=X4(m),m in ab)return;ab[m]=!0;const y=m.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":K4,y||(b.as="script"),b.crossOrigin="",b.href=m,f&&b.setAttribute("nonce",f),document.head.appendChild(b),y)return new Promise((S,T)=>{b.addEventListener("load",S),b.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return o.then(c=>{for(const f of c||[])f.status==="rejected"&&u(f.reason);return t().catch(u)})},W4=()=>Mo(()=>import("./signup-CU4v0Hqr.js"),__vite__mapDeps([0,1,2,3])),eP=La("/signup")({component:To(W4,"component")}),tP=()=>Mo(()=>import("./login-BEFjZaUF.js"),__vite__mapDeps([4,1,2,3])),nP=La("/login")({component:To(tP,"component")}),rP=()=>Mo(()=>import("./_chat-layout-BSDXwLlM.js"),__vite__mapDeps([5,2,3,6])),aP=La("/_chat-layout")({component:To(rP,"component")}),iP=()=>Mo(()=>import("./_chat-layout.index-CWlZ1WSD.js"),__vite__mapDeps([7,3])),sP=La("/_chat-layout/")({component:To(iP,"component")}),oP=()=>Mo(()=>import("./mermaid-FSSLJTFX-_2mzlJwk.js").then(e=>e._),__vite__mapDeps([8,3,6,2])),lP=La("/_chat-layout/$chatId")({component:To(oP,"component")}),uP=eP.update({id:"/signup",path:"/signup",getParentRoute:()=>Wu}),cP=nP.update({id:"/login",path:"/login",getParentRoute:()=>Wu}),Kh=aP.update({id:"/_chat-layout",getParentRoute:()=>Wu}),fP=sP.update({id:"/",path:"/",getParentRoute:()=>Kh}),dP=lP.update({id:"/$chatId",path:"/$chatId",getParentRoute:()=>Kh}),hP={ChatLayoutChatIdRoute:dP,ChatLayoutIndexRoute:fP},pP=Kh._addFileChildren(hP),mP={ChatLayoutRoute:pP,LoginRoute:cP,SignupRoute:uP},yP=Wu._addFileChildren(mP)._addFileTypes(),vP=NA({routeTree:yP,context:{},defaultPreload:"intent",scrollRestoration:!0,defaultStructuralSharing:!0,defaultPreloadStaleTime:0}),l1=new mT({defaultOptions:{queries:{retry:!1,staleTime:300*1e3}}}),gP=$w({links:[Cw(),Rw({url:"/api/trpc"})]}),bu=QT({client:gP,queryClient:l1}),ib=document.getElementById("app");ib.innerHTML||ZA.createRoot(ib).render(ae.jsx(K.StrictMode,{children:ae.jsx(yT,{client:l1,children:ae.jsx(PA,{router:vP})})}));export{t_ as L,a_ as O,bP as R,Eo as S,Mo as _,zP as a,F4 as b,xT as c,Xd as d,uo as e,zb as f,dT as g,DP as h,Ut as i,ae as j,Tb as k,Oo as l,CP as m,wt as n,wh as o,qi as p,RP as q,K as r,NP as s,bu as t,wo as u,xP as v,MP as w,AP as x,UD as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as l,r as o,j as u,a as c}from"./index-
|
|
1
|
+
import{u as l,r as o,j as u,a as c}from"./index-gWi3S-SV.js";import{S as g}from"./signinForm-D97br205.js";import"./createLucideIcon-CAzRYUZ0.js";import"./utils-DzJYey0s.js";function h(){const n=l(),[e,r]=o.useState({email:"",password:""}),[s,a]=o.useState(""),i=async t=>{t.preventDefault(),a(""),await c.email({email:e.email,password:e.password},{onSuccess:()=>{n({to:"/"})},onError:p=>{a(p.error.message)}})},m=t=>{r({...e,[t.target.name]:t.target.value})};return u.jsx(g,{title:"Sign In",fields:[{name:"email",type:"email",placeholder:"Email"},{name:"password",type:"password",placeholder:"Password"}],formData:e,onSubmit:i,onChange:m,submitButtonText:"Sign In",footerText:"Don't have an account?",footerLinkText:"Sign up",footerLinkTo:"/signup",error:s})}export{h as component};
|