@waniwani/sdk 0.22.0-beta.7 → 0.22.1

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.
@@ -1,12 +1,12 @@
1
- "use strict";var WaniWaniChatEmbed=(()=>{var y3=Object.create;var sf=Object.defineProperty;var w3=Object.getOwnPropertyDescriptor;var v3=Object.getOwnPropertyNames;var x3=Object.getPrototypeOf,b3=Object.prototype.hasOwnProperty;var v0=e=>{throw TypeError(e)};var S3=(e,t,a)=>t in e?sf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var L=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ca=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),lf=(e,t)=>{for(var a in t)sf(e,a,{get:t[a],enumerable:!0})},I3=(e,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of v3(t))!b3.call(e,r)&&r!==a&&sf(e,r,{get:()=>t[r],enumerable:!(n=w3(t,r))||n.enumerable});return e};var j=(e,t,a)=>(a=e!=null?y3(x3(e)):{},I3(t||!e||!e.__esModule?sf(a,"default",{value:e,enumerable:!0}):a,e));var K=(e,t,a)=>S3(e,typeof t!="symbol"?t+"":t,a),eg=(e,t,a)=>t.has(e)||v0("Cannot "+a);var b=(e,t,a)=>(eg(e,t,"read from private field"),a?a.call(e):t.get(e)),ue=(e,t,a)=>t.has(e)?v0("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,a),q=(e,t,a,n)=>(eg(e,t,"write to private field"),n?n.call(e,a):t.set(e,a),a),Y=(e,t,a)=>(eg(e,t,"access private method"),a);var D0=Ca(Re=>{"use strict";var ng=Symbol.for("react.transitional.element"),C3=Symbol.for("react.portal"),k3=Symbol.for("react.fragment"),T3=Symbol.for("react.strict_mode"),L3=Symbol.for("react.profiler"),E3=Symbol.for("react.consumer"),A3=Symbol.for("react.context"),M3=Symbol.for("react.forward_ref"),R3=Symbol.for("react.suspense"),D3=Symbol.for("react.memo"),T0=Symbol.for("react.lazy"),_3=Symbol.for("react.activity"),S0=Symbol.iterator;function P3(e){return e===null||typeof e!="object"?null:(e=S0&&e[S0]||e["@@iterator"],typeof e=="function"?e:null)}var L0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E0=Object.assign,A0={};function Ts(e,t,a){this.props=e,this.context=t,this.refs=A0,this.updater=a||L0}Ts.prototype.isReactComponent={};Ts.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Ts.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function M0(){}M0.prototype=Ts.prototype;function rg(e,t,a){this.props=e,this.context=t,this.refs=A0,this.updater=a||L0}var og=rg.prototype=new M0;og.constructor=rg;E0(og,Ts.prototype);og.isPureReactComponent=!0;var I0=Array.isArray;function ag(){}var Ct={H:null,A:null,T:null,S:null},R0=Object.prototype.hasOwnProperty;function ig(e,t,a){var n=a.ref;return{$$typeof:ng,type:e,key:t,ref:n!==void 0?n:null,props:a}}function O3(e,t){return ig(e.type,t,e.props)}function sg(e){return typeof e=="object"&&e!==null&&e.$$typeof===ng}function N3(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(a){return t[a]})}var C0=/\/+/g;function tg(e,t){return typeof e=="object"&&e!==null&&e.key!=null?N3(""+e.key):t.toString(36)}function U3(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(ag,ag):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function ks(e,t,a,n,r){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case ng:case C3:i=!0;break;case T0:return i=e._init,ks(i(e._payload),t,a,n,r)}}if(i)return r=r(e),i=n===""?"."+tg(e,0):n,I0(r)?(a="",i!=null&&(a=i.replace(C0,"$&/")+"/"),ks(r,t,a,"",function(u){return u})):r!=null&&(sg(r)&&(r=O3(r,a+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(C0,"$&/")+"/")+i)),t.push(r)),1;i=0;var s=n===""?".":n+":";if(I0(e))for(var l=0;l<e.length;l++)n=e[l],o=s+tg(n,l),i+=ks(n,t,a,o,r);else if(l=P3(e),typeof l=="function")for(e=l.call(e),l=0;!(n=e.next()).done;)n=n.value,o=s+tg(n,l++),i+=ks(n,t,a,o,r);else if(o==="object"){if(typeof e.then=="function")return ks(U3(e),t,a,n,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return i}function uf(e,t,a){if(e==null)return e;var n=[],r=0;return ks(e,n,"","",function(o){return t.call(a,o,r++)}),n}function B3(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(a){(e._status===0||e._status===-1)&&(e._status=1,e._result=a)},function(a){(e._status===0||e._status===-1)&&(e._status=2,e._result=a)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var k0=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},z3={map:uf,forEach:function(e,t,a){uf(e,function(){t.apply(this,arguments)},a)},count:function(e){var t=0;return uf(e,function(){t++}),t},toArray:function(e){return uf(e,function(t){return t})||[]},only:function(e){if(!sg(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Re.Activity=_3;Re.Children=z3;Re.Component=Ts;Re.Fragment=k3;Re.Profiler=L3;Re.PureComponent=rg;Re.StrictMode=T3;Re.Suspense=R3;Re.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ct;Re.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Ct.H.useMemoCache(e)}};Re.cache=function(e){return function(){return e.apply(null,arguments)}};Re.cacheSignal=function(){return null};Re.cloneElement=function(e,t,a){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var n=E0({},e.props),r=e.key;if(t!=null)for(o in t.key!==void 0&&(r=""+t.key),t)!R0.call(t,o)||o==="key"||o==="__self"||o==="__source"||o==="ref"&&t.ref===void 0||(n[o]=t[o]);var o=arguments.length-2;if(o===1)n.children=a;else if(1<o){for(var i=Array(o),s=0;s<o;s++)i[s]=arguments[s+2];n.children=i}return ig(e.type,r,n)};Re.createContext=function(e){return e={$$typeof:A3,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:E3,_context:e},e};Re.createElement=function(e,t,a){var n,r={},o=null;if(t!=null)for(n in t.key!==void 0&&(o=""+t.key),t)R0.call(t,n)&&n!=="key"&&n!=="__self"&&n!=="__source"&&(r[n]=t[n]);var i=arguments.length-2;if(i===1)r.children=a;else if(1<i){for(var s=Array(i),l=0;l<i;l++)s[l]=arguments[l+2];r.children=s}if(e&&e.defaultProps)for(n in i=e.defaultProps,i)r[n]===void 0&&(r[n]=i[n]);return ig(e,o,r)};Re.createRef=function(){return{current:null}};Re.forwardRef=function(e){return{$$typeof:M3,render:e}};Re.isValidElement=sg;Re.lazy=function(e){return{$$typeof:T0,_payload:{_status:-1,_result:e},_init:B3}};Re.memo=function(e,t){return{$$typeof:D3,type:e,compare:t===void 0?null:t}};Re.startTransition=function(e){var t=Ct.T,a={};Ct.T=a;try{var n=e(),r=Ct.S;r!==null&&r(a,n),typeof n=="object"&&n!==null&&typeof n.then=="function"&&n.then(ag,k0)}catch(o){k0(o)}finally{t!==null&&a.types!==null&&(t.types=a.types),Ct.T=t}};Re.unstable_useCacheRefresh=function(){return Ct.H.useCacheRefresh()};Re.use=function(e){return Ct.H.use(e)};Re.useActionState=function(e,t,a){return Ct.H.useActionState(e,t,a)};Re.useCallback=function(e,t){return Ct.H.useCallback(e,t)};Re.useContext=function(e){return Ct.H.useContext(e)};Re.useDebugValue=function(){};Re.useDeferredValue=function(e,t){return Ct.H.useDeferredValue(e,t)};Re.useEffect=function(e,t){return Ct.H.useEffect(e,t)};Re.useEffectEvent=function(e){return Ct.H.useEffectEvent(e)};Re.useId=function(){return Ct.H.useId()};Re.useImperativeHandle=function(e,t,a){return Ct.H.useImperativeHandle(e,t,a)};Re.useInsertionEffect=function(e,t){return Ct.H.useInsertionEffect(e,t)};Re.useLayoutEffect=function(e,t){return Ct.H.useLayoutEffect(e,t)};Re.useMemo=function(e,t){return Ct.H.useMemo(e,t)};Re.useOptimistic=function(e,t){return Ct.H.useOptimistic(e,t)};Re.useReducer=function(e,t,a){return Ct.H.useReducer(e,t,a)};Re.useRef=function(e){return Ct.H.useRef(e)};Re.useState=function(e){return Ct.H.useState(e)};Re.useSyncExternalStore=function(e,t,a){return Ct.H.useSyncExternalStore(e,t,a)};Re.useTransition=function(){return Ct.H.useTransition()};Re.version="19.2.4"});var Ee=Ca((DZ,_0)=>{"use strict";_0.exports=D0()});var j0=Ca(Rt=>{"use strict";function dg(e,t){var a=e.length;e.push(t);e:for(;0<a;){var n=a-1>>>1,r=e[n];if(0<cf(r,t))e[n]=t,e[a]=r,a=n;else break e}}function ir(e){return e.length===0?null:e[0]}function ff(e){if(e.length===0)return null;var t=e[0],a=e.pop();if(a!==t){e[0]=a;e:for(var n=0,r=e.length,o=r>>>1;n<o;){var i=2*(n+1)-1,s=e[i],l=i+1,u=e[l];if(0>cf(s,a))l<r&&0>cf(u,s)?(e[n]=u,e[l]=a,n=l):(e[n]=s,e[i]=a,n=i);else if(l<r&&0>cf(u,a))e[n]=u,e[l]=a,n=l;else break e}}return t}function cf(e,t){var a=e.sortIndex-t.sortIndex;return a!==0?a:e.id-t.id}Rt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(P0=performance,Rt.unstable_now=function(){return P0.now()}):(lg=Date,O0=lg.now(),Rt.unstable_now=function(){return lg.now()-O0});var P0,lg,O0,Tr=[],co=[],F3=1,Cn=null,ka=3,fg=!1,bu=!1,Su=!1,pg=!1,B0=typeof setTimeout=="function"?setTimeout:null,z0=typeof clearTimeout=="function"?clearTimeout:null,N0=typeof setImmediate<"u"?setImmediate:null;function df(e){for(var t=ir(co);t!==null;){if(t.callback===null)ff(co);else if(t.startTime<=e)ff(co),t.sortIndex=t.expirationTime,dg(Tr,t);else break;t=ir(co)}}function mg(e){if(Su=!1,df(e),!bu)if(ir(Tr)!==null)bu=!0,Es||(Es=!0,Ls());else{var t=ir(co);t!==null&&hg(mg,t.startTime-e)}}var Es=!1,Iu=-1,F0=5,q0=-1;function H0(){return pg?!0:!(Rt.unstable_now()-q0<F0)}function ug(){if(pg=!1,Es){var e=Rt.unstable_now();q0=e;var t=!0;try{e:{bu=!1,Su&&(Su=!1,z0(Iu),Iu=-1),fg=!0;var a=ka;try{t:{for(df(e),Cn=ir(Tr);Cn!==null&&!(Cn.expirationTime>e&&H0());){var n=Cn.callback;if(typeof n=="function"){Cn.callback=null,ka=Cn.priorityLevel;var r=n(Cn.expirationTime<=e);if(e=Rt.unstable_now(),typeof r=="function"){Cn.callback=r,df(e),t=!0;break t}Cn===ir(Tr)&&ff(Tr),df(e)}else ff(Tr);Cn=ir(Tr)}if(Cn!==null)t=!0;else{var o=ir(co);o!==null&&hg(mg,o.startTime-e),t=!1}}break e}finally{Cn=null,ka=a,fg=!1}t=void 0}}finally{t?Ls():Es=!1}}}var Ls;typeof N0=="function"?Ls=function(){N0(ug)}:typeof MessageChannel<"u"?(cg=new MessageChannel,U0=cg.port2,cg.port1.onmessage=ug,Ls=function(){U0.postMessage(null)}):Ls=function(){B0(ug,0)};var cg,U0;function hg(e,t){Iu=B0(function(){e(Rt.unstable_now())},t)}Rt.unstable_IdlePriority=5;Rt.unstable_ImmediatePriority=1;Rt.unstable_LowPriority=4;Rt.unstable_NormalPriority=3;Rt.unstable_Profiling=null;Rt.unstable_UserBlockingPriority=2;Rt.unstable_cancelCallback=function(e){e.callback=null};Rt.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F0=0<e?Math.floor(1e3/e):5};Rt.unstable_getCurrentPriorityLevel=function(){return ka};Rt.unstable_next=function(e){switch(ka){case 1:case 2:case 3:var t=3;break;default:t=ka}var a=ka;ka=t;try{return e()}finally{ka=a}};Rt.unstable_requestPaint=function(){pg=!0};Rt.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var a=ka;ka=e;try{return t()}finally{ka=a}};Rt.unstable_scheduleCallback=function(e,t,a){var n=Rt.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?n+a:n):a=n,e){case 1:var r=-1;break;case 2:r=250;break;case 5:r=1073741823;break;case 4:r=1e4;break;default:r=5e3}return r=a+r,e={id:F3++,callback:t,priorityLevel:e,startTime:a,expirationTime:r,sortIndex:-1},a>n?(e.sortIndex=a,dg(co,e),ir(Tr)===null&&e===ir(co)&&(Su?(z0(Iu),Iu=-1):Su=!0,hg(mg,a-n))):(e.sortIndex=r,dg(Tr,e),bu||fg||(bu=!0,Es||(Es=!0,Ls()))),e};Rt.unstable_shouldYield=H0;Rt.unstable_wrapCallback=function(e){var t=ka;return function(){var a=ka;ka=t;try{return e.apply(this,arguments)}finally{ka=a}}}});var $0=Ca((PZ,V0)=>{"use strict";V0.exports=j0()});var G0=Ca(Pa=>{"use strict";var q3=Ee();function W0(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function fo(){}var _a={d:{f:fo,r:function(){throw Error(W0(522))},D:fo,C:fo,L:fo,m:fo,X:fo,S:fo,M:fo},p:0,findDOMNode:null},H3=Symbol.for("react.portal");function j3(e,t,a){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:H3,key:n==null?null:""+n,children:e,containerInfo:t,implementation:a}}var Cu=q3.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function pf(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Pa.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=_a;Pa.createPortal=function(e,t){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(W0(299));return j3(e,t,null,a)};Pa.flushSync=function(e){var t=Cu.T,a=_a.p;try{if(Cu.T=null,_a.p=2,e)return e()}finally{Cu.T=t,_a.p=a,_a.d.f()}};Pa.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,_a.d.C(e,t))};Pa.prefetchDNS=function(e){typeof e=="string"&&_a.d.D(e)};Pa.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var a=t.as,n=pf(a,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,o=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;a==="style"?_a.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:n,integrity:r,fetchPriority:o}):a==="script"&&_a.d.X(e,{crossOrigin:n,integrity:r,fetchPriority:o,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Pa.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var a=pf(t.as,t.crossOrigin);_a.d.M(e,{crossOrigin:a,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&_a.d.M(e)};Pa.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var a=t.as,n=pf(a,t.crossOrigin);_a.d.L(e,a,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Pa.preloadModule=function(e,t){if(typeof e=="string")if(t){var a=pf(t.as,t.crossOrigin);_a.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:a,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else _a.d.m(e)};Pa.requestFormReset=function(e){_a.d.r(e)};Pa.unstable_batchedUpdates=function(e,t){return e(t)};Pa.useFormState=function(e,t,a){return Cu.H.useFormState(e,t,a)};Pa.useFormStatus=function(){return Cu.H.useHostTransitionStatus()};Pa.version="19.2.4"});var gg=Ca((NZ,K0)=>{"use strict";function X0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(X0)}catch(e){console.error(e)}}X0(),K0.exports=G0()});var s1=Ca(Bp=>{"use strict";var sa=$0(),bC=Ee(),V3=gg();function z(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function SC(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function cc(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function IC(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function CC(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Y0(e){if(cc(e)!==e)throw Error(z(188))}function $3(e){var t=e.alternate;if(!t){if(t=cc(e),t===null)throw Error(z(188));return t!==e?null:e}for(var a=e,n=t;;){var r=a.return;if(r===null)break;var o=r.alternate;if(o===null){if(n=r.return,n!==null){a=n;continue}break}if(r.child===o.child){for(o=r.child;o;){if(o===a)return Y0(r),e;if(o===n)return Y0(r),t;o=o.sibling}throw Error(z(188))}if(a.return!==n.return)a=r,n=o;else{for(var i=!1,s=r.child;s;){if(s===a){i=!0,a=r,n=o;break}if(s===n){i=!0,n=r,a=o;break}s=s.sibling}if(!i){for(s=o.child;s;){if(s===a){i=!0,a=o,n=r;break}if(s===n){i=!0,n=o,a=r;break}s=s.sibling}if(!i)throw Error(z(189))}}if(a.alternate!==n)throw Error(z(190))}if(a.tag!==3)throw Error(z(188));return a.stateNode.current===a?e:t}function kC(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=kC(e),t!==null)return t;e=e.sibling}return null}var Lt=Object.assign,W3=Symbol.for("react.element"),mf=Symbol.for("react.transitional.element"),Du=Symbol.for("react.portal"),Ps=Symbol.for("react.fragment"),TC=Symbol.for("react.strict_mode"),Yg=Symbol.for("react.profiler"),LC=Symbol.for("react.consumer"),Pr=Symbol.for("react.context"),$y=Symbol.for("react.forward_ref"),Zg=Symbol.for("react.suspense"),Jg=Symbol.for("react.suspense_list"),Wy=Symbol.for("react.memo"),po=Symbol.for("react.lazy"),Qg=Symbol.for("react.activity"),G3=Symbol.for("react.memo_cache_sentinel"),Z0=Symbol.iterator;function ku(e){return e===null||typeof e!="object"?null:(e=Z0&&e[Z0]||e["@@iterator"],typeof e=="function"?e:null)}var X3=Symbol.for("react.client.reference");function ey(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===X3?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ps:return"Fragment";case Yg:return"Profiler";case TC:return"StrictMode";case Zg:return"Suspense";case Jg:return"SuspenseList";case Qg:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Du:return"Portal";case Pr:return e.displayName||"Context";case LC:return(e._context.displayName||"Context")+".Consumer";case $y:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Wy:return t=e.displayName||null,t!==null?t:ey(e.type)||"Memo";case po:t=e._payload,e=e._init;try{return ey(e(t))}catch{}}return null}var _u=Array.isArray,Te=bC.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,lt=V3.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,yi={pending:!1,data:null,method:null,action:null},ty=[],Os=-1;function dr(e){return{current:e}}function pa(e){0>Os||(e.current=ty[Os],ty[Os]=null,Os--)}function St(e,t){Os++,ty[Os]=e.current,e.current=t}var cr=dr(null),Yu=dr(null),Co=dr(null),Gf=dr(null);function Xf(e,t){switch(St(Co,t),St(Yu,e),St(cr,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?rC(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=rC(t),e=GT(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}pa(cr),St(cr,e)}function Qs(){pa(cr),pa(Yu),pa(Co)}function ay(e){e.memoizedState!==null&&St(Gf,e);var t=cr.current,a=GT(t,e.type);t!==a&&(St(Yu,e),St(cr,a))}function Kf(e){Yu.current===e&&(pa(cr),pa(Yu)),Gf.current===e&&(pa(Gf),sc._currentValue=yi)}var yg,J0;function pi(e){if(yg===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);yg=t&&t[1]||"",J0=-1<a.stack.indexOf(`
1
+ "use strict";var WaniWaniChatEmbed=(()=>{var y3=Object.create;var sf=Object.defineProperty;var w3=Object.getOwnPropertyDescriptor;var v3=Object.getOwnPropertyNames;var x3=Object.getPrototypeOf,b3=Object.prototype.hasOwnProperty;var vI=e=>{throw TypeError(e)};var S3=(e,t,a)=>t in e?sf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var L=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ca=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),lf=(e,t)=>{for(var a in t)sf(e,a,{get:t[a],enumerable:!0})},I3=(e,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of v3(t))!b3.call(e,r)&&r!==a&&sf(e,r,{get:()=>t[r],enumerable:!(n=w3(t,r))||n.enumerable});return e};var j=(e,t,a)=>(a=e!=null?y3(x3(e)):{},I3(t||!e||!e.__esModule?sf(a,"default",{value:e,enumerable:!0}):a,e));var K=(e,t,a)=>S3(e,typeof t!="symbol"?t+"":t,a),eg=(e,t,a)=>t.has(e)||vI("Cannot "+a);var b=(e,t,a)=>(eg(e,t,"read from private field"),a?a.call(e):t.get(e)),ue=(e,t,a)=>t.has(e)?vI("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,a),q=(e,t,a,n)=>(eg(e,t,"write to private field"),n?n.call(e,a):t.set(e,a),a),Y=(e,t,a)=>(eg(e,t,"access private method"),a);var DI=Ca(Re=>{"use strict";var ng=Symbol.for("react.transitional.element"),C3=Symbol.for("react.portal"),k3=Symbol.for("react.fragment"),T3=Symbol.for("react.strict_mode"),L3=Symbol.for("react.profiler"),E3=Symbol.for("react.consumer"),A3=Symbol.for("react.context"),M3=Symbol.for("react.forward_ref"),R3=Symbol.for("react.suspense"),D3=Symbol.for("react.memo"),TI=Symbol.for("react.lazy"),_3=Symbol.for("react.activity"),SI=Symbol.iterator;function P3(e){return e===null||typeof e!="object"?null:(e=SI&&e[SI]||e["@@iterator"],typeof e=="function"?e:null)}var LI={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},EI=Object.assign,AI={};function Ts(e,t,a){this.props=e,this.context=t,this.refs=AI,this.updater=a||LI}Ts.prototype.isReactComponent={};Ts.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Ts.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function MI(){}MI.prototype=Ts.prototype;function rg(e,t,a){this.props=e,this.context=t,this.refs=AI,this.updater=a||LI}var og=rg.prototype=new MI;og.constructor=rg;EI(og,Ts.prototype);og.isPureReactComponent=!0;var II=Array.isArray;function ag(){}var Ct={H:null,A:null,T:null,S:null},RI=Object.prototype.hasOwnProperty;function ig(e,t,a){var n=a.ref;return{$$typeof:ng,type:e,key:t,ref:n!==void 0?n:null,props:a}}function O3(e,t){return ig(e.type,t,e.props)}function sg(e){return typeof e=="object"&&e!==null&&e.$$typeof===ng}function N3(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(a){return t[a]})}var CI=/\/+/g;function tg(e,t){return typeof e=="object"&&e!==null&&e.key!=null?N3(""+e.key):t.toString(36)}function U3(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(ag,ag):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function ks(e,t,a,n,r){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case ng:case C3:i=!0;break;case TI:return i=e._init,ks(i(e._payload),t,a,n,r)}}if(i)return r=r(e),i=n===""?"."+tg(e,0):n,II(r)?(a="",i!=null&&(a=i.replace(CI,"$&/")+"/"),ks(r,t,a,"",function(u){return u})):r!=null&&(sg(r)&&(r=O3(r,a+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(CI,"$&/")+"/")+i)),t.push(r)),1;i=0;var s=n===""?".":n+":";if(II(e))for(var l=0;l<e.length;l++)n=e[l],o=s+tg(n,l),i+=ks(n,t,a,o,r);else if(l=P3(e),typeof l=="function")for(e=l.call(e),l=0;!(n=e.next()).done;)n=n.value,o=s+tg(n,l++),i+=ks(n,t,a,o,r);else if(o==="object"){if(typeof e.then=="function")return ks(U3(e),t,a,n,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return i}function uf(e,t,a){if(e==null)return e;var n=[],r=0;return ks(e,n,"","",function(o){return t.call(a,o,r++)}),n}function B3(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(a){(e._status===0||e._status===-1)&&(e._status=1,e._result=a)},function(a){(e._status===0||e._status===-1)&&(e._status=2,e._result=a)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var kI=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},z3={map:uf,forEach:function(e,t,a){uf(e,function(){t.apply(this,arguments)},a)},count:function(e){var t=0;return uf(e,function(){t++}),t},toArray:function(e){return uf(e,function(t){return t})||[]},only:function(e){if(!sg(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Re.Activity=_3;Re.Children=z3;Re.Component=Ts;Re.Fragment=k3;Re.Profiler=L3;Re.PureComponent=rg;Re.StrictMode=T3;Re.Suspense=R3;Re.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ct;Re.__COMPILER_RUNTIME={__proto__:null,c:function(e){return Ct.H.useMemoCache(e)}};Re.cache=function(e){return function(){return e.apply(null,arguments)}};Re.cacheSignal=function(){return null};Re.cloneElement=function(e,t,a){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var n=EI({},e.props),r=e.key;if(t!=null)for(o in t.key!==void 0&&(r=""+t.key),t)!RI.call(t,o)||o==="key"||o==="__self"||o==="__source"||o==="ref"&&t.ref===void 0||(n[o]=t[o]);var o=arguments.length-2;if(o===1)n.children=a;else if(1<o){for(var i=Array(o),s=0;s<o;s++)i[s]=arguments[s+2];n.children=i}return ig(e.type,r,n)};Re.createContext=function(e){return e={$$typeof:A3,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:E3,_context:e},e};Re.createElement=function(e,t,a){var n,r={},o=null;if(t!=null)for(n in t.key!==void 0&&(o=""+t.key),t)RI.call(t,n)&&n!=="key"&&n!=="__self"&&n!=="__source"&&(r[n]=t[n]);var i=arguments.length-2;if(i===1)r.children=a;else if(1<i){for(var s=Array(i),l=0;l<i;l++)s[l]=arguments[l+2];r.children=s}if(e&&e.defaultProps)for(n in i=e.defaultProps,i)r[n]===void 0&&(r[n]=i[n]);return ig(e,o,r)};Re.createRef=function(){return{current:null}};Re.forwardRef=function(e){return{$$typeof:M3,render:e}};Re.isValidElement=sg;Re.lazy=function(e){return{$$typeof:TI,_payload:{_status:-1,_result:e},_init:B3}};Re.memo=function(e,t){return{$$typeof:D3,type:e,compare:t===void 0?null:t}};Re.startTransition=function(e){var t=Ct.T,a={};Ct.T=a;try{var n=e(),r=Ct.S;r!==null&&r(a,n),typeof n=="object"&&n!==null&&typeof n.then=="function"&&n.then(ag,kI)}catch(o){kI(o)}finally{t!==null&&a.types!==null&&(t.types=a.types),Ct.T=t}};Re.unstable_useCacheRefresh=function(){return Ct.H.useCacheRefresh()};Re.use=function(e){return Ct.H.use(e)};Re.useActionState=function(e,t,a){return Ct.H.useActionState(e,t,a)};Re.useCallback=function(e,t){return Ct.H.useCallback(e,t)};Re.useContext=function(e){return Ct.H.useContext(e)};Re.useDebugValue=function(){};Re.useDeferredValue=function(e,t){return Ct.H.useDeferredValue(e,t)};Re.useEffect=function(e,t){return Ct.H.useEffect(e,t)};Re.useEffectEvent=function(e){return Ct.H.useEffectEvent(e)};Re.useId=function(){return Ct.H.useId()};Re.useImperativeHandle=function(e,t,a){return Ct.H.useImperativeHandle(e,t,a)};Re.useInsertionEffect=function(e,t){return Ct.H.useInsertionEffect(e,t)};Re.useLayoutEffect=function(e,t){return Ct.H.useLayoutEffect(e,t)};Re.useMemo=function(e,t){return Ct.H.useMemo(e,t)};Re.useOptimistic=function(e,t){return Ct.H.useOptimistic(e,t)};Re.useReducer=function(e,t,a){return Ct.H.useReducer(e,t,a)};Re.useRef=function(e){return Ct.H.useRef(e)};Re.useState=function(e){return Ct.H.useState(e)};Re.useSyncExternalStore=function(e,t,a){return Ct.H.useSyncExternalStore(e,t,a)};Re.useTransition=function(){return Ct.H.useTransition()};Re.version="19.2.4"});var Ee=Ca((_Z,_I)=>{"use strict";_I.exports=DI()});var jI=Ca(Rt=>{"use strict";function dg(e,t){var a=e.length;e.push(t);e:for(;0<a;){var n=a-1>>>1,r=e[n];if(0<cf(r,t))e[n]=t,e[a]=r,a=n;else break e}}function ir(e){return e.length===0?null:e[0]}function ff(e){if(e.length===0)return null;var t=e[0],a=e.pop();if(a!==t){e[0]=a;e:for(var n=0,r=e.length,o=r>>>1;n<o;){var i=2*(n+1)-1,s=e[i],l=i+1,u=e[l];if(0>cf(s,a))l<r&&0>cf(u,s)?(e[n]=u,e[l]=a,n=l):(e[n]=s,e[i]=a,n=i);else if(l<r&&0>cf(u,a))e[n]=u,e[l]=a,n=l;else break e}}return t}function cf(e,t){var a=e.sortIndex-t.sortIndex;return a!==0?a:e.id-t.id}Rt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(PI=performance,Rt.unstable_now=function(){return PI.now()}):(lg=Date,OI=lg.now(),Rt.unstable_now=function(){return lg.now()-OI});var PI,lg,OI,Tr=[],co=[],F3=1,Cn=null,ka=3,fg=!1,bu=!1,Su=!1,pg=!1,BI=typeof setTimeout=="function"?setTimeout:null,zI=typeof clearTimeout=="function"?clearTimeout:null,NI=typeof setImmediate<"u"?setImmediate:null;function df(e){for(var t=ir(co);t!==null;){if(t.callback===null)ff(co);else if(t.startTime<=e)ff(co),t.sortIndex=t.expirationTime,dg(Tr,t);else break;t=ir(co)}}function mg(e){if(Su=!1,df(e),!bu)if(ir(Tr)!==null)bu=!0,Es||(Es=!0,Ls());else{var t=ir(co);t!==null&&hg(mg,t.startTime-e)}}var Es=!1,Iu=-1,FI=5,qI=-1;function HI(){return pg?!0:!(Rt.unstable_now()-qI<FI)}function ug(){if(pg=!1,Es){var e=Rt.unstable_now();qI=e;var t=!0;try{e:{bu=!1,Su&&(Su=!1,zI(Iu),Iu=-1),fg=!0;var a=ka;try{t:{for(df(e),Cn=ir(Tr);Cn!==null&&!(Cn.expirationTime>e&&HI());){var n=Cn.callback;if(typeof n=="function"){Cn.callback=null,ka=Cn.priorityLevel;var r=n(Cn.expirationTime<=e);if(e=Rt.unstable_now(),typeof r=="function"){Cn.callback=r,df(e),t=!0;break t}Cn===ir(Tr)&&ff(Tr),df(e)}else ff(Tr);Cn=ir(Tr)}if(Cn!==null)t=!0;else{var o=ir(co);o!==null&&hg(mg,o.startTime-e),t=!1}}break e}finally{Cn=null,ka=a,fg=!1}t=void 0}}finally{t?Ls():Es=!1}}}var Ls;typeof NI=="function"?Ls=function(){NI(ug)}:typeof MessageChannel<"u"?(cg=new MessageChannel,UI=cg.port2,cg.port1.onmessage=ug,Ls=function(){UI.postMessage(null)}):Ls=function(){BI(ug,0)};var cg,UI;function hg(e,t){Iu=BI(function(){e(Rt.unstable_now())},t)}Rt.unstable_IdlePriority=5;Rt.unstable_ImmediatePriority=1;Rt.unstable_LowPriority=4;Rt.unstable_NormalPriority=3;Rt.unstable_Profiling=null;Rt.unstable_UserBlockingPriority=2;Rt.unstable_cancelCallback=function(e){e.callback=null};Rt.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):FI=0<e?Math.floor(1e3/e):5};Rt.unstable_getCurrentPriorityLevel=function(){return ka};Rt.unstable_next=function(e){switch(ka){case 1:case 2:case 3:var t=3;break;default:t=ka}var a=ka;ka=t;try{return e()}finally{ka=a}};Rt.unstable_requestPaint=function(){pg=!0};Rt.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var a=ka;ka=e;try{return t()}finally{ka=a}};Rt.unstable_scheduleCallback=function(e,t,a){var n=Rt.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?n+a:n):a=n,e){case 1:var r=-1;break;case 2:r=250;break;case 5:r=1073741823;break;case 4:r=1e4;break;default:r=5e3}return r=a+r,e={id:F3++,callback:t,priorityLevel:e,startTime:a,expirationTime:r,sortIndex:-1},a>n?(e.sortIndex=a,dg(co,e),ir(Tr)===null&&e===ir(co)&&(Su?(zI(Iu),Iu=-1):Su=!0,hg(mg,a-n))):(e.sortIndex=r,dg(Tr,e),bu||fg||(bu=!0,Es||(Es=!0,Ls()))),e};Rt.unstable_shouldYield=HI;Rt.unstable_wrapCallback=function(e){var t=ka;return function(){var a=ka;ka=t;try{return e.apply(this,arguments)}finally{ka=a}}}});var $I=Ca((OZ,VI)=>{"use strict";VI.exports=jI()});var GI=Ca(Pa=>{"use strict";var q3=Ee();function WI(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function fo(){}var _a={d:{f:fo,r:function(){throw Error(WI(522))},D:fo,C:fo,L:fo,m:fo,X:fo,S:fo,M:fo},p:0,findDOMNode:null},H3=Symbol.for("react.portal");function j3(e,t,a){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:H3,key:n==null?null:""+n,children:e,containerInfo:t,implementation:a}}var Cu=q3.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function pf(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Pa.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=_a;Pa.createPortal=function(e,t){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(WI(299));return j3(e,t,null,a)};Pa.flushSync=function(e){var t=Cu.T,a=_a.p;try{if(Cu.T=null,_a.p=2,e)return e()}finally{Cu.T=t,_a.p=a,_a.d.f()}};Pa.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,_a.d.C(e,t))};Pa.prefetchDNS=function(e){typeof e=="string"&&_a.d.D(e)};Pa.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var a=t.as,n=pf(a,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,o=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;a==="style"?_a.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:n,integrity:r,fetchPriority:o}):a==="script"&&_a.d.X(e,{crossOrigin:n,integrity:r,fetchPriority:o,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Pa.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var a=pf(t.as,t.crossOrigin);_a.d.M(e,{crossOrigin:a,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&_a.d.M(e)};Pa.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var a=t.as,n=pf(a,t.crossOrigin);_a.d.L(e,a,{crossOrigin:n,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};Pa.preloadModule=function(e,t){if(typeof e=="string")if(t){var a=pf(t.as,t.crossOrigin);_a.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:a,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else _a.d.m(e)};Pa.requestFormReset=function(e){_a.d.r(e)};Pa.unstable_batchedUpdates=function(e,t){return e(t)};Pa.useFormState=function(e,t,a){return Cu.H.useFormState(e,t,a)};Pa.useFormStatus=function(){return Cu.H.useHostTransitionStatus()};Pa.version="19.2.4"});var gg=Ca((UZ,KI)=>{"use strict";function XI(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(XI)}catch(e){console.error(e)}}XI(),KI.exports=GI()});var s1=Ca(Bp=>{"use strict";var sa=$I(),bC=Ee(),V3=gg();function z(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function SC(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function cc(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function IC(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function CC(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function YI(e){if(cc(e)!==e)throw Error(z(188))}function $3(e){var t=e.alternate;if(!t){if(t=cc(e),t===null)throw Error(z(188));return t!==e?null:e}for(var a=e,n=t;;){var r=a.return;if(r===null)break;var o=r.alternate;if(o===null){if(n=r.return,n!==null){a=n;continue}break}if(r.child===o.child){for(o=r.child;o;){if(o===a)return YI(r),e;if(o===n)return YI(r),t;o=o.sibling}throw Error(z(188))}if(a.return!==n.return)a=r,n=o;else{for(var i=!1,s=r.child;s;){if(s===a){i=!0,a=r,n=o;break}if(s===n){i=!0,n=r,a=o;break}s=s.sibling}if(!i){for(s=o.child;s;){if(s===a){i=!0,a=o,n=r;break}if(s===n){i=!0,n=o,a=r;break}s=s.sibling}if(!i)throw Error(z(189))}}if(a.alternate!==n)throw Error(z(190))}if(a.tag!==3)throw Error(z(188));return a.stateNode.current===a?e:t}function kC(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=kC(e),t!==null)return t;e=e.sibling}return null}var Lt=Object.assign,W3=Symbol.for("react.element"),mf=Symbol.for("react.transitional.element"),Du=Symbol.for("react.portal"),Ps=Symbol.for("react.fragment"),TC=Symbol.for("react.strict_mode"),Yg=Symbol.for("react.profiler"),LC=Symbol.for("react.consumer"),Pr=Symbol.for("react.context"),$y=Symbol.for("react.forward_ref"),Zg=Symbol.for("react.suspense"),Jg=Symbol.for("react.suspense_list"),Wy=Symbol.for("react.memo"),po=Symbol.for("react.lazy"),Qg=Symbol.for("react.activity"),G3=Symbol.for("react.memo_cache_sentinel"),ZI=Symbol.iterator;function ku(e){return e===null||typeof e!="object"?null:(e=ZI&&e[ZI]||e["@@iterator"],typeof e=="function"?e:null)}var X3=Symbol.for("react.client.reference");function ey(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===X3?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ps:return"Fragment";case Yg:return"Profiler";case TC:return"StrictMode";case Zg:return"Suspense";case Jg:return"SuspenseList";case Qg:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Du:return"Portal";case Pr:return e.displayName||"Context";case LC:return(e._context.displayName||"Context")+".Consumer";case $y:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Wy:return t=e.displayName||null,t!==null?t:ey(e.type)||"Memo";case po:t=e._payload,e=e._init;try{return ey(e(t))}catch{}}return null}var _u=Array.isArray,Te=bC.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,lt=V3.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,yi={pending:!1,data:null,method:null,action:null},ty=[],Os=-1;function dr(e){return{current:e}}function pa(e){0>Os||(e.current=ty[Os],ty[Os]=null,Os--)}function St(e,t){Os++,ty[Os]=e.current,e.current=t}var cr=dr(null),Yu=dr(null),Co=dr(null),Gf=dr(null);function Xf(e,t){switch(St(Co,t),St(Yu,e),St(cr,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?rC(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=rC(t),e=GT(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}pa(cr),St(cr,e)}function Qs(){pa(cr),pa(Yu),pa(Co)}function ay(e){e.memoizedState!==null&&St(Gf,e);var t=cr.current,a=GT(t,e.type);t!==a&&(St(Yu,e),St(cr,a))}function Kf(e){Yu.current===e&&(pa(cr),pa(Yu)),Gf.current===e&&(pa(Gf),sc._currentValue=yi)}var yg,JI;function pi(e){if(yg===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);yg=t&&t[1]||"",JI=-1<a.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+yg+e+J0}var wg=!1;function vg(e,t){if(!e||wg)return"";wg=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(m){var p=m}Reflect.construct(e,[],d)}else{try{d.call()}catch(m){p=m}e.call(d.prototype)}}else{try{throw Error()}catch(m){p=m}(d=e())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(m){if(m&&p&&typeof m.stack=="string")return[m.stack,p.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=n.DetermineComponentFrameRoot(),i=o[0],s=o[1];if(i&&s){var l=i.split(`
3
+ `+yg+e+JI}var wg=!1;function vg(e,t){if(!e||wg)return"";wg=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var n={DetermineComponentFrameRoot:function(){try{if(t){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(m){var p=m}Reflect.construct(e,[],d)}else{try{d.call()}catch(m){p=m}e.call(d.prototype)}}else{try{throw Error()}catch(m){p=m}(d=e())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(m){if(m&&p&&typeof m.stack=="string")return[m.stack,p.stack]}return[null,null]}};n.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(n.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(n.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var o=n.DetermineComponentFrameRoot(),i=o[0],s=o[1];if(i&&s){var l=i.split(`
4
4
  `),u=s.split(`
5
5
  `);for(r=n=0;n<l.length&&!l[n].includes("DetermineComponentFrameRoot");)n++;for(;r<u.length&&!u[r].includes("DetermineComponentFrameRoot");)r++;if(n===l.length||r===u.length)for(n=l.length-1,r=u.length-1;1<=n&&0<=r&&l[n]!==u[r];)r--;for(;1<=n&&0<=r;n--,r--)if(l[n]!==u[r]){if(n!==1||r!==1)do if(n--,r--,0>r||l[n]!==u[r]){var c=`
6
- `+l[n].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=n&&0<=r);break}}}finally{wg=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?pi(a):""}function K3(e,t){switch(e.tag){case 26:case 27:case 5:return pi(e.type);case 16:return pi("Lazy");case 13:return e.child!==t&&t!==null?pi("Suspense Fallback"):pi("Suspense");case 19:return pi("SuspenseList");case 0:case 15:return vg(e.type,!1);case 11:return vg(e.type.render,!1);case 1:return vg(e.type,!0);case 31:return pi("Activity");default:return""}}function Q0(e){try{var t="",a=null;do t+=K3(e,a),a=e,e=e.return;while(e);return t}catch(n){return`
6
+ `+l[n].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=n&&0<=r);break}}}finally{wg=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?pi(a):""}function K3(e,t){switch(e.tag){case 26:case 27:case 5:return pi(e.type);case 16:return pi("Lazy");case 13:return e.child!==t&&t!==null?pi("Suspense Fallback"):pi("Suspense");case 19:return pi("SuspenseList");case 0:case 15:return vg(e.type,!1);case 11:return vg(e.type.render,!1);case 1:return vg(e.type,!0);case 31:return pi("Activity");default:return""}}function QI(e){try{var t="",a=null;do t+=K3(e,a),a=e,e=e.return;while(e);return t}catch(n){return`
7
7
  Error generating stack: `+n.message+`
8
- `+n.stack}}var ny=Object.prototype.hasOwnProperty,Gy=sa.unstable_scheduleCallback,xg=sa.unstable_cancelCallback,Y3=sa.unstable_shouldYield,Z3=sa.unstable_requestPaint,dn=sa.unstable_now,J3=sa.unstable_getCurrentPriorityLevel,EC=sa.unstable_ImmediatePriority,AC=sa.unstable_UserBlockingPriority,Yf=sa.unstable_NormalPriority,Q3=sa.unstable_LowPriority,MC=sa.unstable_IdlePriority,ez=sa.log,tz=sa.unstable_setDisableYieldValue,dc=null,fn=null;function vo(e){if(typeof ez=="function"&&tz(e),fn&&typeof fn.setStrictMode=="function")try{fn.setStrictMode(dc,e)}catch{}}var pn=Math.clz32?Math.clz32:rz,az=Math.log,nz=Math.LN2;function rz(e){return e>>>=0,e===0?32:31-(az(e)/nz|0)|0}var hf=256,gf=262144,yf=4194304;function mi(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Sp(e,t,a){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var s=n&134217727;return s!==0?(n=s&~o,n!==0?r=mi(n):(i&=s,i!==0?r=mi(i):a||(a=s&~e,a!==0&&(r=mi(a))))):(s=n&~o,s!==0?r=mi(s):i!==0?r=mi(i):a||(a=n&~e,a!==0&&(r=mi(a)))),r===0?0:t!==0&&t!==r&&(t&o)===0&&(o=r&-r,a=t&-t,o>=a||o===32&&(a&4194048)!==0)?t:r}function fc(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function oz(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function RC(){var e=yf;return yf<<=1,(yf&62914560)===0&&(yf=4194304),e}function bg(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function pc(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function iz(e,t,a,n,r,o){var i=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var s=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(a=i&~a;0<a;){var c=31-pn(a),d=1<<c;s[c]=0,l[c]=-1;var p=u[c];if(p!==null)for(u[c]=null,c=0;c<p.length;c++){var m=p[c];m!==null&&(m.lane&=-536870913)}a&=~d}n!==0&&DC(e,n,0),o!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=o&~(i&~t))}function DC(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-pn(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|a&261930}function _C(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var n=31-pn(a),r=1<<n;r&t|e[n]&t&&(e[n]|=t),a&=~r}}function PC(e,t){var a=t&-t;return a=(a&42)!==0?1:Xy(a),(a&(e.suspendedLanes|t))!==0?0:a}function Xy(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ky(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function OC(){var e=lt.p;return e!==0?e:(e=window.event,e===void 0?32:r1(e.type))}function eI(e,t){var a=lt.p;try{return lt.p=e,t()}finally{lt.p=a}}var Uo=Math.random().toString(36).slice(2),wa="__reactFiber$"+Uo,Xa="__reactProps$"+Uo,cl="__reactContainer$"+Uo,ry="__reactEvents$"+Uo,sz="__reactListeners$"+Uo,lz="__reactHandles$"+Uo,tI="__reactResources$"+Uo,mc="__reactMarker$"+Uo;function Yy(e){delete e[wa],delete e[Xa],delete e[ry],delete e[sz],delete e[lz]}function Ns(e){var t=e[wa];if(t)return t;for(var a=e.parentNode;a;){if(t=a[cl]||a[wa]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=uC(e);e!==null;){if(a=e[wa])return a;e=uC(e)}return t}e=a,a=e.parentNode}return null}function dl(e){if(e=e[wa]||e[cl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Pu(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(z(33))}function Ws(e){var t=e[tI];return t||(t=e[tI]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function fa(e){e[mc]=!0}var NC=new Set,UC={};function Li(e,t){el(e,t),el(e+"Capture",t)}function el(e,t){for(UC[e]=t,e=0;e<t.length;e++)NC.add(t[e])}var uz=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),aI={},nI={};function cz(e){return ny.call(nI,e)?!0:ny.call(aI,e)?!1:uz.test(e)?nI[e]=!0:(aI[e]=!0,!1)}function Df(e,t,a){if(cz(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function wf(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Lr(e,t,a,n){if(n===null)e.removeAttribute(a);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+n)}}function Tn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function BC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function dz(e,t,a){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(i){a=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(i){a=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function oy(e){if(!e._valueTracker){var t=BC(e)?"checked":"value";e._valueTracker=dz(e,t,""+e[t])}}function zC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),n="";return e&&(n=BC(e)?e.checked?"true":"false":e.value),e=n,e!==a?(t.setValue(e),!0):!1}function Zf(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var fz=/[\n"\\]/g;function An(e){return e.replace(fz,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function iy(e,t,a,n,r,o,i,s){e.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?e.type=i:e.removeAttribute("type"),t!=null?i==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Tn(t)):e.value!==""+Tn(t)&&(e.value=""+Tn(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?sy(e,i,Tn(t)):a!=null?sy(e,i,Tn(a)):n!=null&&e.removeAttribute("value"),r==null&&o!=null&&(e.defaultChecked=!!o),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?e.name=""+Tn(s):e.removeAttribute("name")}function FC(e,t,a,n,r,o,i,s){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.type=o),t!=null||a!=null){if(!(o!=="submit"&&o!=="reset"||t!=null)){oy(e);return}a=a!=null?""+Tn(a):"",t=t!=null?""+Tn(t):a,s||t===e.value||(e.value=t),e.defaultValue=t}n=n??r,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=s?e.checked:!!n,e.defaultChecked=!!n,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.name=i),oy(e)}function sy(e,t,a){t==="number"&&Zf(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Gs(e,t,a,n){if(e=e.options,t){t={};for(var r=0;r<a.length;r++)t["$"+a[r]]=!0;for(a=0;a<e.length;a++)r=t.hasOwnProperty("$"+e[a].value),e[a].selected!==r&&(e[a].selected=r),r&&n&&(e[a].defaultSelected=!0)}else{for(a=""+Tn(a),t=null,r=0;r<e.length;r++){if(e[r].value===a){e[r].selected=!0,n&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function qC(e,t,a){if(t!=null&&(t=""+Tn(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Tn(a):""}function HC(e,t,a,n){if(t==null){if(n!=null){if(a!=null)throw Error(z(92));if(_u(n)){if(1<n.length)throw Error(z(93));n=n[0]}a=n}a==null&&(a=""),t=a}a=Tn(t),e.defaultValue=a,n=e.textContent,n===a&&n!==""&&n!==null&&(e.value=n),oy(e)}function tl(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var pz=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function rI(e,t,a){var n=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,a):typeof a!="number"||a===0||pz.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function jC(e,t,a){if(t!=null&&typeof t!="object")throw Error(z(62));if(e=e.style,a!=null){for(var n in a)!a.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var r in t)n=t[r],t.hasOwnProperty(r)&&a[r]!==n&&rI(e,r,n)}else for(var o in t)t.hasOwnProperty(o)&&rI(e,o,t[o])}function Zy(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mz=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),hz=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function _f(e){return hz.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Or(){}var ly=null;function Jy(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Us=null,Xs=null;function oI(e){var t=dl(e);if(t&&(e=t.stateNode)){var a=e[Xa]||null;e:switch(e=t.stateNode,t.type){case"input":if(iy(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+An(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var n=a[t];if(n!==e&&n.form===e.form){var r=n[Xa]||null;if(!r)throw Error(z(90));iy(n,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<a.length;t++)n=a[t],n.form===e.form&&zC(n)}break e;case"textarea":qC(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Gs(e,!!a.multiple,t,!1)}}}var Sg=!1;function VC(e,t,a){if(Sg)return e(t,a);Sg=!0;try{var n=e(t);return n}finally{if(Sg=!1,(Us!==null||Xs!==null)&&(Pp(),Us&&(t=Us,e=Xs,Xs=Us=null,oI(t),e)))for(t=0;t<e.length;t++)oI(e[t])}}function Zu(e,t){var a=e.stateNode;if(a===null)return null;var n=a[Xa]||null;if(n===null)return null;a=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(z(231,t,typeof a));return a}var Fr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uy=!1;if(Fr)try{As={},Object.defineProperty(As,"passive",{get:function(){uy=!0}}),window.addEventListener("test",As,As),window.removeEventListener("test",As,As)}catch{uy=!1}var As,xo=null,Qy=null,Pf=null;function $C(){if(Pf)return Pf;var e,t=Qy,a=t.length,n,r="value"in xo?xo.value:xo.textContent,o=r.length;for(e=0;e<a&&t[e]===r[e];e++);var i=a-e;for(n=1;n<=i&&t[a-n]===r[o-n];n++);return Pf=r.slice(e,1<n?1-n:void 0)}function Of(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function vf(){return!0}function iI(){return!1}function Ka(e){function t(a,n,r,o,i){this._reactName=a,this._targetInst=r,this.type=n,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(a=e[s],this[s]=a?a(o):o[s]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?vf:iI,this.isPropagationStopped=iI,this}return Lt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=vf)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=vf)},persist:function(){},isPersistent:vf}),t}var Ei={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ip=Ka(Ei),hc=Lt({},Ei,{view:0,detail:0}),gz=Ka(hc),Ig,Cg,Tu,Cp=Lt({},hc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ew,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Tu&&(Tu&&e.type==="mousemove"?(Ig=e.screenX-Tu.screenX,Cg=e.screenY-Tu.screenY):Cg=Ig=0,Tu=e),Ig)},movementY:function(e){return"movementY"in e?e.movementY:Cg}}),sI=Ka(Cp),yz=Lt({},Cp,{dataTransfer:0}),wz=Ka(yz),vz=Lt({},hc,{relatedTarget:0}),kg=Ka(vz),xz=Lt({},Ei,{animationName:0,elapsedTime:0,pseudoElement:0}),bz=Ka(xz),Sz=Lt({},Ei,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Iz=Ka(Sz),Cz=Lt({},Ei,{data:0}),lI=Ka(Cz),kz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Tz={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Lz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ez(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Lz[e])?!!t[e]:!1}function ew(){return Ez}var Az=Lt({},hc,{key:function(e){if(e.key){var t=kz[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Of(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Tz[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ew,charCode:function(e){return e.type==="keypress"?Of(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Of(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Mz=Ka(Az),Rz=Lt({},Cp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),uI=Ka(Rz),Dz=Lt({},hc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ew}),_z=Ka(Dz),Pz=Lt({},Ei,{propertyName:0,elapsedTime:0,pseudoElement:0}),Oz=Ka(Pz),Nz=Lt({},Cp,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Uz=Ka(Nz),Bz=Lt({},Ei,{newState:0,oldState:0}),zz=Ka(Bz),Fz=[9,13,27,32],tw=Fr&&"CompositionEvent"in window,Uu=null;Fr&&"documentMode"in document&&(Uu=document.documentMode);var qz=Fr&&"TextEvent"in window&&!Uu,WC=Fr&&(!tw||Uu&&8<Uu&&11>=Uu),cI=" ",dI=!1;function GC(e,t){switch(e){case"keyup":return Fz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function XC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bs=!1;function Hz(e,t){switch(e){case"compositionend":return XC(t);case"keypress":return t.which!==32?null:(dI=!0,cI);case"textInput":return e=t.data,e===cI&&dI?null:e;default:return null}}function jz(e,t){if(Bs)return e==="compositionend"||!tw&&GC(e,t)?(e=$C(),Pf=Qy=xo=null,Bs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return WC&&t.locale!=="ko"?null:t.data;default:return null}}var Vz={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function fI(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Vz[e.type]:t==="textarea"}function KC(e,t,a,n){Us?Xs?Xs.push(n):Xs=[n]:Us=n,t=hp(t,"onChange"),0<t.length&&(a=new Ip("onChange","change",null,a,n),e.push({event:a,listeners:t}))}var Bu=null,Ju=null;function $z(e){VT(e,0)}function kp(e){var t=Pu(e);if(zC(t))return e}function pI(e,t){if(e==="change")return t}var YC=!1;Fr&&(Fr?(bf="oninput"in document,bf||(Tg=document.createElement("div"),Tg.setAttribute("oninput","return;"),bf=typeof Tg.oninput=="function"),xf=bf):xf=!1,YC=xf&&(!document.documentMode||9<document.documentMode));var xf,bf,Tg;function mI(){Bu&&(Bu.detachEvent("onpropertychange",ZC),Ju=Bu=null)}function ZC(e){if(e.propertyName==="value"&&kp(Ju)){var t=[];KC(t,Ju,e,Jy(e)),VC($z,t)}}function Wz(e,t,a){e==="focusin"?(mI(),Bu=t,Ju=a,Bu.attachEvent("onpropertychange",ZC)):e==="focusout"&&mI()}function Gz(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return kp(Ju)}function Xz(e,t){if(e==="click")return kp(t)}function Kz(e,t){if(e==="input"||e==="change")return kp(t)}function Yz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var hn=typeof Object.is=="function"?Object.is:Yz;function Qu(e,t){if(hn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(n=0;n<a.length;n++){var r=a[n];if(!ny.call(t,r)||!hn(e[r],t[r]))return!1}return!0}function hI(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function gI(e,t){var a=hI(e);e=0;for(var n;a;){if(a.nodeType===3){if(n=e+a.textContent.length,e<=t&&n>=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=hI(a)}}function JC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?JC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function QC(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Zf(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Zf(e.document)}return t}function aw(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Zz=Fr&&"documentMode"in document&&11>=document.documentMode,zs=null,cy=null,zu=null,dy=!1;function yI(e,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;dy||zs==null||zs!==Zf(n)||(n=zs,"selectionStart"in n&&aw(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),zu&&Qu(zu,n)||(zu=n,n=hp(cy,"onSelect"),0<n.length&&(t=new Ip("onSelect","select",null,t,a),e.push({event:t,listeners:n}),t.target=zs)))}function fi(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Fs={animationend:fi("Animation","AnimationEnd"),animationiteration:fi("Animation","AnimationIteration"),animationstart:fi("Animation","AnimationStart"),transitionrun:fi("Transition","TransitionRun"),transitionstart:fi("Transition","TransitionStart"),transitioncancel:fi("Transition","TransitionCancel"),transitionend:fi("Transition","TransitionEnd")},Lg={},ek={};Fr&&(ek=document.createElement("div").style,"AnimationEvent"in window||(delete Fs.animationend.animation,delete Fs.animationiteration.animation,delete Fs.animationstart.animation),"TransitionEvent"in window||delete Fs.transitionend.transition);function Ai(e){if(Lg[e])return Lg[e];if(!Fs[e])return e;var t=Fs[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in ek)return Lg[e]=t[a];return e}var tk=Ai("animationend"),ak=Ai("animationiteration"),nk=Ai("animationstart"),Jz=Ai("transitionrun"),Qz=Ai("transitionstart"),eF=Ai("transitioncancel"),rk=Ai("transitionend"),ok=new Map,fy="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");fy.push("scrollEnd");function Gn(e,t){ok.set(e,t),Li(t,[e])}var Jf=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},kn=[],qs=0,nw=0;function Tp(){for(var e=qs,t=nw=qs=0;t<e;){var a=kn[t];kn[t++]=null;var n=kn[t];kn[t++]=null;var r=kn[t];kn[t++]=null;var o=kn[t];if(kn[t++]=null,n!==null&&r!==null){var i=n.pending;i===null?r.next=r:(r.next=i.next,i.next=r),n.pending=r}o!==0&&ik(a,r,o)}}function Lp(e,t,a,n){kn[qs++]=e,kn[qs++]=t,kn[qs++]=a,kn[qs++]=n,nw|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function rw(e,t,a,n){return Lp(e,t,a,n),Qf(e)}function Mi(e,t){return Lp(e,null,null,t),Qf(e)}function ik(e,t,a){e.lanes|=a;var n=e.alternate;n!==null&&(n.lanes|=a);for(var r=!1,o=e.return;o!==null;)o.childLanes|=a,n=o.alternate,n!==null&&(n.childLanes|=a),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(r=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,r&&t!==null&&(r=31-pn(a),e=o.hiddenUpdates,n=e[r],n===null?e[r]=[t]:n.push(t),t.lane=a|536870912),o):null}function Qf(e){if(50<Xu)throw Xu=0,_y=null,Error(z(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Hs={};function tF(e,t,a,n){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function un(e,t,a,n){return new tF(e,t,a,n)}function ow(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ur(e,t){var a=e.alternate;return a===null?(a=un(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function sk(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Nf(e,t,a,n,r,o){var i=0;if(n=e,typeof e=="function")ow(e)&&(i=1);else if(typeof e=="string")i=rq(e,a,cr.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Qg:return e=un(31,a,t,r),e.elementType=Qg,e.lanes=o,e;case Ps:return wi(a.children,r,o,t);case TC:i=8,r|=24;break;case Yg:return e=un(12,a,t,r|2),e.elementType=Yg,e.lanes=o,e;case Zg:return e=un(13,a,t,r),e.elementType=Zg,e.lanes=o,e;case Jg:return e=un(19,a,t,r),e.elementType=Jg,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Pr:i=10;break e;case LC:i=9;break e;case $y:i=11;break e;case Wy:i=14;break e;case po:i=16,n=null;break e}i=29,a=Error(z(130,e===null?"null":typeof e,"")),n=null}return t=un(i,a,t,r),t.elementType=e,t.type=n,t.lanes=o,t}function wi(e,t,a,n){return e=un(7,e,n,t),e.lanes=a,e}function Eg(e,t,a){return e=un(6,e,null,t),e.lanes=a,e}function lk(e){var t=un(18,null,null,0);return t.stateNode=e,t}function Ag(e,t,a){return t=un(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var wI=new WeakMap;function Mn(e,t){if(typeof e=="object"&&e!==null){var a=wI.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Q0(t)},wI.set(e,t),t)}return{value:e,source:t,stack:Q0(t)}}var js=[],Vs=0,ep=null,ec=0,Ln=[],En=0,_o=null,sr=1,lr="";function Dr(e,t){js[Vs++]=ec,js[Vs++]=ep,ep=e,ec=t}function uk(e,t,a){Ln[En++]=sr,Ln[En++]=lr,Ln[En++]=_o,_o=e;var n=sr;e=lr;var r=32-pn(n)-1;n&=~(1<<r),a+=1;var o=32-pn(t)+r;if(30<o){var i=r-r%5;o=(n&(1<<i)-1).toString(32),n>>=i,r-=i,sr=1<<32-pn(t)+r|a<<r|n,lr=o+e}else sr=1<<o|a<<r|n,lr=e}function iw(e){e.return!==null&&(Dr(e,1),uk(e,1,0))}function sw(e){for(;e===ep;)ep=js[--Vs],js[Vs]=null,ec=js[--Vs],js[Vs]=null;for(;e===_o;)_o=Ln[--En],Ln[En]=null,lr=Ln[--En],Ln[En]=null,sr=Ln[--En],Ln[En]=null}function ck(e,t){Ln[En++]=sr,Ln[En++]=lr,Ln[En++]=_o,sr=t.id,lr=t.overflow,_o=e}var va=null,Tt=null,Ze=!1,ko=null,Rn=!1,py=Error(z(519));function Po(e){var t=Error(z(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw tc(Mn(t,e)),py}function vI(e){var t=e.stateNode,a=e.type,n=e.memoizedProps;switch(t[wa]=e,t[Xa]=n,a){case"dialog":Ge("cancel",t),Ge("close",t);break;case"iframe":case"object":case"embed":Ge("load",t);break;case"video":case"audio":for(a=0;a<oc.length;a++)Ge(oc[a],t);break;case"source":Ge("error",t);break;case"img":case"image":case"link":Ge("error",t),Ge("load",t);break;case"details":Ge("toggle",t);break;case"input":Ge("invalid",t),FC(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":Ge("invalid",t);break;case"textarea":Ge("invalid",t),HC(t,n.value,n.defaultValue,n.children)}a=n.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||n.suppressHydrationWarning===!0||WT(t.textContent,a)?(n.popover!=null&&(Ge("beforetoggle",t),Ge("toggle",t)),n.onScroll!=null&&Ge("scroll",t),n.onScrollEnd!=null&&Ge("scrollend",t),n.onClick!=null&&(t.onclick=Or),t=!0):t=!1,t||Po(e,!0)}function xI(e){for(va=e.return;va;)switch(va.tag){case 5:case 31:case 13:Rn=!1;return;case 27:case 3:Rn=!0;return;default:va=va.return}}function Ms(e){if(e!==va)return!1;if(!Ze)return xI(e),Ze=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||By(e.type,e.memoizedProps)),a=!a),a&&Tt&&Po(e),xI(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(z(317));Tt=lC(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(z(317));Tt=lC(e)}else t===27?(t=Tt,Bo(e.type)?(e=Hy,Hy=null,Tt=e):Tt=t):Tt=va?_n(e.stateNode.nextSibling):null;return!0}function Si(){Tt=va=null,Ze=!1}function Mg(){var e=ko;return e!==null&&(Wa===null?Wa=e:Wa.push.apply(Wa,e),ko=null),e}function tc(e){ko===null?ko=[e]:ko.push(e)}var my=dr(null),Ri=null,Nr=null;function ho(e,t,a){St(my,t._currentValue),t._currentValue=a}function Br(e){e._currentValue=my.current,pa(my)}function hy(e,t,a){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===a)break;e=e.return}}function gy(e,t,a,n){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var o=r.dependencies;if(o!==null){var i=r.child;o=o.firstContext;e:for(;o!==null;){var s=o;o=r;for(var l=0;l<t.length;l++)if(s.context===t[l]){o.lanes|=a,s=o.alternate,s!==null&&(s.lanes|=a),hy(o.return,a,e),n||(i=null);break e}o=s.next}}else if(r.tag===18){if(i=r.return,i===null)throw Error(z(341));i.lanes|=a,o=i.alternate,o!==null&&(o.lanes|=a),hy(i,a,e),i=null}else i=r.child;if(i!==null)i.return=r;else for(i=r;i!==null;){if(i===e){i=null;break}if(r=i.sibling,r!==null){r.return=i.return,i=r;break}i=i.return}r=i}}function fl(e,t,a,n){e=null;for(var r=t,o=!1;r!==null;){if(!o){if((r.flags&524288)!==0)o=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var i=r.alternate;if(i===null)throw Error(z(387));if(i=i.memoizedProps,i!==null){var s=r.type;hn(r.pendingProps.value,i.value)||(e!==null?e.push(s):e=[s])}}else if(r===Gf.current){if(i=r.alternate,i===null)throw Error(z(387));i.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(sc):e=[sc])}r=r.return}e!==null&&gy(t,e,a,n),t.flags|=262144}function tp(e){for(e=e.firstContext;e!==null;){if(!hn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ii(e){Ri=e,Nr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function xa(e){return dk(Ri,e)}function Sf(e,t){return Ri===null&&Ii(e),dk(e,t)}function dk(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Nr===null){if(e===null)throw Error(z(308));Nr=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Nr=Nr.next=t;return a}var aF=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},nF=sa.unstable_scheduleCallback,rF=sa.unstable_NormalPriority,na={$$typeof:Pr,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lw(){return{controller:new aF,data:new Map,refCount:0}}function gc(e){e.refCount--,e.refCount===0&&nF(rF,function(){e.controller.abort()})}var Fu=null,yy=0,al=0,Ks=null;function oF(e,t){if(Fu===null){var a=Fu=[];yy=0,al=_w(),Ks={status:"pending",value:void 0,then:function(n){a.push(n)}}}return yy++,t.then(bI,bI),t}function bI(){if(--yy===0&&Fu!==null){Ks!==null&&(Ks.status="fulfilled");var e=Fu;Fu=null,al=0,Ks=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function iF(e,t){var a=[],n={status:"pending",value:null,reason:null,then:function(r){a.push(r)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var r=0;r<a.length;r++)(0,a[r])(t)},function(r){for(n.status="rejected",n.reason=r,r=0;r<a.length;r++)(0,a[r])(void 0)}),n}var SI=Te.S;Te.S=function(e,t){kT=dn(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&oF(e,t),SI!==null&&SI(e,t)};var vi=dr(null);function uw(){var e=vi.current;return e!==null?e:vt.pooledCache}function Uf(e,t){t===null?St(vi,vi.current):St(vi,t.pool)}function fk(){var e=uw();return e===null?null:{parent:na._currentValue,pool:e}}var pl=Error(z(460)),cw=Error(z(474)),Ep=Error(z(542)),ap={then:function(){}};function II(e){return e=e.status,e==="fulfilled"||e==="rejected"}function pk(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(Or,Or),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,kI(e),e;default:if(typeof t.status=="string")t.then(Or,Or);else{if(e=vt,e!==null&&100<e.shellSuspendCounter)throw Error(z(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=n}},function(n){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,kI(e),e}throw xi=t,pl}}function hi(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(xi=a,pl):a}}var xi=null;function CI(){if(xi===null)throw Error(z(459));var e=xi;return xi=null,e}function kI(e){if(e===pl||e===Ep)throw Error(z(483))}var Ys=null,ac=0;function If(e){var t=ac;return ac+=1,Ys===null&&(Ys=[]),pk(Ys,e,t)}function Lu(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Cf(e,t){throw t.$$typeof===W3?Error(z(525)):(e=Object.prototype.toString.call(t),Error(z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function mk(e){function t(y,w){if(e){var g=y.deletions;g===null?(y.deletions=[w],y.flags|=16):g.push(w)}}function a(y,w){if(!e)return null;for(;w!==null;)t(y,w),w=w.sibling;return null}function n(y){for(var w=new Map;y!==null;)y.key!==null?w.set(y.key,y):w.set(y.index,y),y=y.sibling;return w}function r(y,w){return y=Ur(y,w),y.index=0,y.sibling=null,y}function o(y,w,g){return y.index=g,e?(g=y.alternate,g!==null?(g=g.index,g<w?(y.flags|=67108866,w):g):(y.flags|=67108866,w)):(y.flags|=1048576,w)}function i(y){return e&&y.alternate===null&&(y.flags|=67108866),y}function s(y,w,g,S){return w===null||w.tag!==6?(w=Eg(g,y.mode,S),w.return=y,w):(w=r(w,g),w.return=y,w)}function l(y,w,g,S){var E=g.type;return E===Ps?c(y,w,g.props.children,S,g.key):w!==null&&(w.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===po&&hi(E)===w.type)?(w=r(w,g.props),Lu(w,g),w.return=y,w):(w=Nf(g.type,g.key,g.props,null,y.mode,S),Lu(w,g),w.return=y,w)}function u(y,w,g,S){return w===null||w.tag!==4||w.stateNode.containerInfo!==g.containerInfo||w.stateNode.implementation!==g.implementation?(w=Ag(g,y.mode,S),w.return=y,w):(w=r(w,g.children||[]),w.return=y,w)}function c(y,w,g,S,E){return w===null||w.tag!==7?(w=wi(g,y.mode,S,E),w.return=y,w):(w=r(w,g),w.return=y,w)}function d(y,w,g){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=Eg(""+w,y.mode,g),w.return=y,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case mf:return g=Nf(w.type,w.key,w.props,null,y.mode,g),Lu(g,w),g.return=y,g;case Du:return w=Ag(w,y.mode,g),w.return=y,w;case po:return w=hi(w),d(y,w,g)}if(_u(w)||ku(w))return w=wi(w,y.mode,g,null),w.return=y,w;if(typeof w.then=="function")return d(y,If(w),g);if(w.$$typeof===Pr)return d(y,Sf(y,w),g);Cf(y,w)}return null}function p(y,w,g,S){var E=w!==null?w.key:null;if(typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint")return E!==null?null:s(y,w,""+g,S);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case mf:return g.key===E?l(y,w,g,S):null;case Du:return g.key===E?u(y,w,g,S):null;case po:return g=hi(g),p(y,w,g,S)}if(_u(g)||ku(g))return E!==null?null:c(y,w,g,S,null);if(typeof g.then=="function")return p(y,w,If(g),S);if(g.$$typeof===Pr)return p(y,w,Sf(y,g),S);Cf(y,g)}return null}function m(y,w,g,S,E){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return y=y.get(g)||null,s(w,y,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case mf:return y=y.get(S.key===null?g:S.key)||null,l(w,y,S,E);case Du:return y=y.get(S.key===null?g:S.key)||null,u(w,y,S,E);case po:return S=hi(S),m(y,w,g,S,E)}if(_u(S)||ku(S))return y=y.get(g)||null,c(w,y,S,E,null);if(typeof S.then=="function")return m(y,w,g,If(S),E);if(S.$$typeof===Pr)return m(y,w,g,Sf(w,S),E);Cf(w,S)}return null}function h(y,w,g,S){for(var E=null,T=null,R=w,O=w=0,U=null;R!==null&&O<g.length;O++){R.index>O?(U=R,R=null):U=R.sibling;var A=p(y,R,g[O],S);if(A===null){R===null&&(R=U);break}e&&R&&A.alternate===null&&t(y,R),w=o(A,w,O),T===null?E=A:T.sibling=A,T=A,R=U}if(O===g.length)return a(y,R),Ze&&Dr(y,O),E;if(R===null){for(;O<g.length;O++)R=d(y,g[O],S),R!==null&&(w=o(R,w,O),T===null?E=R:T.sibling=R,T=R);return Ze&&Dr(y,O),E}for(R=n(R);O<g.length;O++)U=m(R,y,O,g[O],S),U!==null&&(e&&U.alternate!==null&&R.delete(U.key===null?O:U.key),w=o(U,w,O),T===null?E=U:T.sibling=U,T=U);return e&&R.forEach(function(Q){return t(y,Q)}),Ze&&Dr(y,O),E}function v(y,w,g,S){if(g==null)throw Error(z(151));for(var E=null,T=null,R=w,O=w=0,U=null,A=g.next();R!==null&&!A.done;O++,A=g.next()){R.index>O?(U=R,R=null):U=R.sibling;var Q=p(y,R,A.value,S);if(Q===null){R===null&&(R=U);break}e&&R&&Q.alternate===null&&t(y,R),w=o(Q,w,O),T===null?E=Q:T.sibling=Q,T=Q,R=U}if(A.done)return a(y,R),Ze&&Dr(y,O),E;if(R===null){for(;!A.done;O++,A=g.next())A=d(y,A.value,S),A!==null&&(w=o(A,w,O),T===null?E=A:T.sibling=A,T=A);return Ze&&Dr(y,O),E}for(R=n(R);!A.done;O++,A=g.next())A=m(R,y,O,A.value,S),A!==null&&(e&&A.alternate!==null&&R.delete(A.key===null?O:A.key),w=o(A,w,O),T===null?E=A:T.sibling=A,T=A);return e&&R.forEach(function($){return t(y,$)}),Ze&&Dr(y,O),E}function I(y,w,g,S){if(typeof g=="object"&&g!==null&&g.type===Ps&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case mf:e:{for(var E=g.key;w!==null;){if(w.key===E){if(E=g.type,E===Ps){if(w.tag===7){a(y,w.sibling),S=r(w,g.props.children),S.return=y,y=S;break e}}else if(w.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===po&&hi(E)===w.type){a(y,w.sibling),S=r(w,g.props),Lu(S,g),S.return=y,y=S;break e}a(y,w);break}else t(y,w);w=w.sibling}g.type===Ps?(S=wi(g.props.children,y.mode,S,g.key),S.return=y,y=S):(S=Nf(g.type,g.key,g.props,null,y.mode,S),Lu(S,g),S.return=y,y=S)}return i(y);case Du:e:{for(E=g.key;w!==null;){if(w.key===E)if(w.tag===4&&w.stateNode.containerInfo===g.containerInfo&&w.stateNode.implementation===g.implementation){a(y,w.sibling),S=r(w,g.children||[]),S.return=y,y=S;break e}else{a(y,w);break}else t(y,w);w=w.sibling}S=Ag(g,y.mode,S),S.return=y,y=S}return i(y);case po:return g=hi(g),I(y,w,g,S)}if(_u(g))return h(y,w,g,S);if(ku(g)){if(E=ku(g),typeof E!="function")throw Error(z(150));return g=E.call(g),v(y,w,g,S)}if(typeof g.then=="function")return I(y,w,If(g),S);if(g.$$typeof===Pr)return I(y,w,Sf(y,g),S);Cf(y,g)}return typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint"?(g=""+g,w!==null&&w.tag===6?(a(y,w.sibling),S=r(w,g),S.return=y,y=S):(a(y,w),S=Eg(g,y.mode,S),S.return=y,y=S),i(y)):a(y,w)}return function(y,w,g,S){try{ac=0;var E=I(y,w,g,S);return Ys=null,E}catch(R){if(R===pl||R===Ep)throw R;var T=un(29,R,null,y.mode);return T.lanes=S,T.return=y,T}}}var Ci=mk(!0),hk=mk(!1),mo=!1;function dw(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wy(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function To(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Lo(e,t,a){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(st&2)!==0){var r=n.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Qf(e),ik(e,null,a),t}return Lp(e,n,t,a),Qf(e)}function qu(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,_C(e,a)}}function Rg(e,t){var a=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var r=null,o=null;if(a=a.firstBaseUpdate,a!==null){do{var i={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};o===null?r=o=i:o=o.next=i,a=a.next}while(a!==null);o===null?r=o=t:o=o.next=t}else r=o=t;a={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:n.shared,callbacks:n.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var vy=!1;function Hu(){if(vy){var e=Ks;if(e!==null)throw e}}function ju(e,t,a,n){vy=!1;var r=e.updateQueue;mo=!1;var o=r.firstBaseUpdate,i=r.lastBaseUpdate,s=r.shared.pending;if(s!==null){r.shared.pending=null;var l=s,u=l.next;l.next=null,i===null?o=u:i.next=u,i=l;var c=e.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==i&&(s===null?c.firstBaseUpdate=u:s.next=u,c.lastBaseUpdate=l))}if(o!==null){var d=r.baseState;i=0,c=u=l=null,s=o;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Ke&p)===p:(n&p)===p){p!==0&&p===al&&(vy=!0),c!==null&&(c=c.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var h=e,v=s;p=t;var I=a;switch(v.tag){case 1:if(h=v.payload,typeof h=="function"){d=h.call(I,d,p);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=v.payload,p=typeof h=="function"?h.call(I,d,p):h,p==null)break e;d=Lt({},d,p);break e;case 2:mo=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=r.callbacks,m===null?r.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(u=c=m,l=d):c=c.next=m,i|=p;if(s=s.next,s===null){if(s=r.shared.pending,s===null)break;m=s,s=m.next,m.next=null,r.lastBaseUpdate=m,r.shared.pending=null}}while(!0);c===null&&(l=d),r.baseState=l,r.firstBaseUpdate=u,r.lastBaseUpdate=c,o===null&&(r.shared.lanes=0),No|=i,e.lanes=i,e.memoizedState=d}}function gk(e,t){if(typeof e!="function")throw Error(z(191,e));e.call(t)}function yk(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)gk(a[e],t)}var nl=dr(null),np=dr(0);function TI(e,t){e=Vr,St(np,e),St(nl,t),Vr=e|t.baseLanes}function xy(){St(np,Vr),St(nl,nl.current)}function fw(){Vr=np.current,pa(nl),pa(np)}var gn=dr(null),Dn=null;function go(e){var t=e.alternate;St(Yt,Yt.current&1),St(gn,e),Dn===null&&(t===null||nl.current!==null||t.memoizedState!==null)&&(Dn=e)}function by(e){St(Yt,Yt.current),St(gn,e),Dn===null&&(Dn=e)}function wk(e){e.tag===22?(St(Yt,Yt.current),St(gn,e),Dn===null&&(Dn=e)):yo(e)}function yo(){St(Yt,Yt.current),St(gn,gn.current)}function ln(e){pa(gn),Dn===e&&(Dn=null),pa(Yt)}var Yt=dr(0);function rp(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Fy(a)||qy(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var qr=0,Pe=null,yt=null,ta=null,op=!1,Zs=!1,ki=!1,ip=0,nc=0,Js=null,sF=0;function Ht(){throw Error(z(321))}function pw(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!hn(e[a],t[a]))return!1;return!0}function mw(e,t,a,n,r,o){return qr=o,Pe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Te.H=e===null||e.memoizedState===null?Kk:kw,ki=!1,o=a(n,r),ki=!1,Zs&&(o=xk(t,a,n,r)),vk(e),o}function vk(e){Te.H=rc;var t=yt!==null&&yt.next!==null;if(qr=0,ta=yt=Pe=null,op=!1,nc=0,Js=null,t)throw Error(z(300));e===null||ra||(e=e.dependencies,e!==null&&tp(e)&&(ra=!0))}function xk(e,t,a,n){Pe=e;var r=0;do{if(Zs&&(Js=null),nc=0,Zs=!1,25<=r)throw Error(z(301));if(r+=1,ta=yt=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}Te.H=Yk,o=t(a,n)}while(Zs);return o}function lF(){var e=Te.H,t=e.useState()[0];return t=typeof t.then=="function"?yc(t):t,e=e.useState()[0],(yt!==null?yt.memoizedState:null)!==e&&(Pe.flags|=1024),t}function hw(){var e=ip!==0;return ip=0,e}function gw(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function yw(e){if(op){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}op=!1}qr=0,ta=yt=Pe=null,Zs=!1,nc=ip=0,Js=null}function Oa(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ta===null?Pe.memoizedState=ta=e:ta=ta.next=e,ta}function Zt(){if(yt===null){var e=Pe.alternate;e=e!==null?e.memoizedState:null}else e=yt.next;var t=ta===null?Pe.memoizedState:ta.next;if(t!==null)ta=t,yt=e;else{if(e===null)throw Pe.alternate===null?Error(z(467)):Error(z(310));yt=e,e={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},ta===null?Pe.memoizedState=ta=e:ta=ta.next=e}return ta}function Ap(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function yc(e){var t=nc;return nc+=1,Js===null&&(Js=[]),e=pk(Js,e,t),t=Pe,(ta===null?t.memoizedState:ta.next)===null&&(t=t.alternate,Te.H=t===null||t.memoizedState===null?Kk:kw),e}function Mp(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return yc(e);if(e.$$typeof===Pr)return xa(e)}throw Error(z(438,String(e)))}function ww(e){var t=null,a=Pe.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var n=Pe.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Ap(),Pe.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),n=0;n<e;n++)a[n]=G3;return t.index++,a}function Hr(e,t){return typeof t=="function"?t(e):t}function Bf(e){var t=Zt();return vw(t,yt,e)}function vw(e,t,a){var n=e.queue;if(n===null)throw Error(z(311));n.lastRenderedReducer=a;var r=e.baseQueue,o=n.pending;if(o!==null){if(r!==null){var i=r.next;r.next=o.next,o.next=i}t.baseQueue=r=o,n.pending=null}if(o=e.baseState,r===null)e.memoizedState=o;else{t=r.next;var s=i=null,l=null,u=t,c=!1;do{var d=u.lane&-536870913;if(d!==u.lane?(Ke&d)===d:(qr&d)===d){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),d===al&&(c=!0);else if((qr&p)===p){u=u.next,p===al&&(c=!0);continue}else d={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(s=l=d,i=o):l=l.next=d,Pe.lanes|=p,No|=p;d=u.action,ki&&a(o,d),o=u.hasEagerState?u.eagerState:a(o,d)}else p={lane:d,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(s=l=p,i=o):l=l.next=p,Pe.lanes|=d,No|=d;u=u.next}while(u!==null&&u!==t);if(l===null?i=o:l.next=s,!hn(o,e.memoizedState)&&(ra=!0,c&&(a=Ks,a!==null)))throw a;e.memoizedState=o,e.baseState=i,e.baseQueue=l,n.lastRenderedState=o}return r===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function Dg(e){var t=Zt(),a=t.queue;if(a===null)throw Error(z(311));a.lastRenderedReducer=e;var n=a.dispatch,r=a.pending,o=t.memoizedState;if(r!==null){a.pending=null;var i=r=r.next;do o=e(o,i.action),i=i.next;while(i!==r);hn(o,t.memoizedState)||(ra=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),a.lastRenderedState=o}return[o,n]}function bk(e,t,a){var n=Pe,r=Zt(),o=Ze;if(o){if(a===void 0)throw Error(z(407));a=a()}else a=t();var i=!hn((yt||r).memoizedState,a);if(i&&(r.memoizedState=a,ra=!0),r=r.queue,xw(Ck.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||ta!==null&&ta.memoizedState.tag&1){if(n.flags|=2048,rl(9,{destroy:void 0},Ik.bind(null,n,r,a,t),null),vt===null)throw Error(z(349));o||(qr&127)!==0||Sk(n,t,a)}return a}function Sk(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Pe.updateQueue,t===null?(t=Ap(),Pe.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Ik(e,t,a,n){t.value=a,t.getSnapshot=n,kk(t)&&Tk(e)}function Ck(e,t,a){return a(function(){kk(t)&&Tk(e)})}function kk(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!hn(e,a)}catch{return!0}}function Tk(e){var t=Mi(e,2);t!==null&&Ga(t,e,2)}function Sy(e){var t=Oa();if(typeof e=="function"){var a=e;if(e=a(),ki){vo(!0);try{a()}finally{vo(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:e},t}function Lk(e,t,a,n){return e.baseState=a,vw(e,yt,typeof n=="function"?n:Hr)}function uF(e,t,a,n,r){if(Dp(e))throw Error(z(485));if(e=t.action,e!==null){var o={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){o.listeners.push(i)}};Te.T!==null?a(!0):o.isTransition=!1,n(o),a=t.pending,a===null?(o.next=t.pending=o,Ek(t,o)):(o.next=a.next,t.pending=a.next=o)}}function Ek(e,t){var a=t.action,n=t.payload,r=e.state;if(t.isTransition){var o=Te.T,i={};Te.T=i;try{var s=a(r,n),l=Te.S;l!==null&&l(i,s),LI(e,t,s)}catch(u){Iy(e,t,u)}finally{o!==null&&i.types!==null&&(o.types=i.types),Te.T=o}}else try{o=a(r,n),LI(e,t,o)}catch(u){Iy(e,t,u)}}function LI(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(n){EI(e,t,n)},function(n){return Iy(e,t,n)}):EI(e,t,a)}function EI(e,t,a){t.status="fulfilled",t.value=a,Ak(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Ek(e,a)))}function Iy(e,t,a){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=a,Ak(t),t=t.next;while(t!==n)}e.action=null}function Ak(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Mk(e,t){return t}function AI(e,t){if(Ze){var a=vt.formState;if(a!==null){e:{var n=Pe;if(Ze){if(Tt){t:{for(var r=Tt,o=Rn;r.nodeType!==8;){if(!o){r=null;break t}if(r=_n(r.nextSibling),r===null){r=null;break t}}o=r.data,r=o==="F!"||o==="F"?r:null}if(r){Tt=_n(r.nextSibling),n=r.data==="F!";break e}}Po(n)}n=!1}n&&(t=a[0])}}return a=Oa(),a.memoizedState=a.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mk,lastRenderedState:t},a.queue=n,a=Wk.bind(null,Pe,n),n.dispatch=a,n=Sy(!1),o=Cw.bind(null,Pe,!1,n.queue),n=Oa(),r={state:t,dispatch:null,action:e,pending:null},n.queue=r,a=uF.bind(null,Pe,r,o,a),r.dispatch=a,n.memoizedState=e,[t,a,!1]}function MI(e){var t=Zt();return Rk(t,yt,e)}function Rk(e,t,a){if(t=vw(e,t,Mk)[0],e=Bf(Hr)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=yc(t)}catch(i){throw i===pl?Ep:i}else n=t;t=Zt();var r=t.queue,o=r.dispatch;return a!==t.memoizedState&&(Pe.flags|=2048,rl(9,{destroy:void 0},cF.bind(null,r,a),null)),[n,o,e]}function cF(e,t){e.action=t}function RI(e){var t=Zt(),a=yt;if(a!==null)return Rk(t,a,e);Zt(),t=t.memoizedState,a=Zt();var n=a.queue.dispatch;return a.memoizedState=e,[t,n,!1]}function rl(e,t,a,n){return e={tag:e,create:a,deps:n,inst:t,next:null},t=Pe.updateQueue,t===null&&(t=Ap(),Pe.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(n=a.next,a.next=e,e.next=n,t.lastEffect=e),e}function Dk(){return Zt().memoizedState}function zf(e,t,a,n){var r=Oa();Pe.flags|=e,r.memoizedState=rl(1|t,{destroy:void 0},a,n===void 0?null:n)}function Rp(e,t,a,n){var r=Zt();n=n===void 0?null:n;var o=r.memoizedState.inst;yt!==null&&n!==null&&pw(n,yt.memoizedState.deps)?r.memoizedState=rl(t,o,a,n):(Pe.flags|=e,r.memoizedState=rl(1|t,o,a,n))}function DI(e,t){zf(8390656,8,e,t)}function xw(e,t){Rp(2048,8,e,t)}function dF(e){Pe.flags|=4;var t=Pe.updateQueue;if(t===null)t=Ap(),Pe.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function _k(e){var t=Zt().memoizedState;return dF({ref:t,nextImpl:e}),function(){if((st&2)!==0)throw Error(z(440));return t.impl.apply(void 0,arguments)}}function Pk(e,t){return Rp(4,2,e,t)}function Ok(e,t){return Rp(4,4,e,t)}function Nk(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Uk(e,t,a){a=a!=null?a.concat([e]):null,Rp(4,4,Nk.bind(null,t,e),a)}function bw(){}function Bk(e,t){var a=Zt();t=t===void 0?null:t;var n=a.memoizedState;return t!==null&&pw(t,n[1])?n[0]:(a.memoizedState=[e,t],e)}function zk(e,t){var a=Zt();t=t===void 0?null:t;var n=a.memoizedState;if(t!==null&&pw(t,n[1]))return n[0];if(n=e(),ki){vo(!0);try{e()}finally{vo(!1)}}return a.memoizedState=[n,t],n}function Sw(e,t,a){return a===void 0||(qr&1073741824)!==0&&(Ke&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=LT(),Pe.lanes|=e,No|=e,a)}function Fk(e,t,a,n){return hn(a,t)?a:nl.current!==null?(e=Sw(e,a,n),hn(e,t)||(ra=!0),e):(qr&42)===0||(qr&1073741824)!==0&&(Ke&261930)===0?(ra=!0,e.memoizedState=a):(e=LT(),Pe.lanes|=e,No|=e,t)}function qk(e,t,a,n,r){var o=lt.p;lt.p=o!==0&&8>o?o:8;var i=Te.T,s={};Te.T=s,Cw(e,!1,t,a);try{var l=r(),u=Te.S;if(u!==null&&u(s,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=iF(l,n);Vu(e,t,c,mn(e))}else Vu(e,t,n,mn(e))}catch(d){Vu(e,t,{then:function(){},status:"rejected",reason:d},mn())}finally{lt.p=o,i!==null&&s.types!==null&&(i.types=s.types),Te.T=i}}function fF(){}function Cy(e,t,a,n){if(e.tag!==5)throw Error(z(476));var r=Hk(e).queue;qk(e,r,t,yi,a===null?fF:function(){return jk(e),a(n)})}function Hk(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:yi,baseState:yi,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:yi},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function jk(e){var t=Hk(e);t.next===null&&(t=e.alternate.memoizedState),Vu(e,t.next.queue,{},mn())}function Iw(){return xa(sc)}function Vk(){return Zt().memoizedState}function $k(){return Zt().memoizedState}function pF(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=mn();e=To(a);var n=Lo(t,e,a);n!==null&&(Ga(n,t,a),qu(n,t,a)),t={cache:lw()},e.payload=t;return}t=t.return}}function mF(e,t,a){var n=mn();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Dp(e)?Gk(t,a):(a=rw(e,t,a,n),a!==null&&(Ga(a,e,n),Xk(a,t,n)))}function Wk(e,t,a){var n=mn();Vu(e,t,a,n)}function Vu(e,t,a,n){var r={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Dp(e))Gk(t,r);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,s=o(i,a);if(r.hasEagerState=!0,r.eagerState=s,hn(s,i))return Lp(e,t,r,0),vt===null&&Tp(),!1}catch{}if(a=rw(e,t,r,n),a!==null)return Ga(a,e,n),Xk(a,t,n),!0}return!1}function Cw(e,t,a,n){if(n={lane:2,revertLane:_w(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Dp(e)){if(t)throw Error(z(479))}else t=rw(e,a,n,2),t!==null&&Ga(t,e,2)}function Dp(e){var t=e.alternate;return e===Pe||t!==null&&t===Pe}function Gk(e,t){Zs=op=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Xk(e,t,a){if((a&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,_C(e,a)}}var rc={readContext:xa,use:Mp,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};rc.useEffectEvent=Ht;var Kk={readContext:xa,use:Mp,useCallback:function(e,t){return Oa().memoizedState=[e,t===void 0?null:t],e},useContext:xa,useEffect:DI,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,zf(4194308,4,Nk.bind(null,t,e),a)},useLayoutEffect:function(e,t){return zf(4194308,4,e,t)},useInsertionEffect:function(e,t){zf(4,2,e,t)},useMemo:function(e,t){var a=Oa();t=t===void 0?null:t;var n=e();if(ki){vo(!0);try{e()}finally{vo(!1)}}return a.memoizedState=[n,t],n},useReducer:function(e,t,a){var n=Oa();if(a!==void 0){var r=a(t);if(ki){vo(!0);try{a(t)}finally{vo(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=mF.bind(null,Pe,e),[n.memoizedState,e]},useRef:function(e){var t=Oa();return e={current:e},t.memoizedState=e},useState:function(e){e=Sy(e);var t=e.queue,a=Wk.bind(null,Pe,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:bw,useDeferredValue:function(e,t){var a=Oa();return Sw(a,e,t)},useTransition:function(){var e=Sy(!1);return e=qk.bind(null,Pe,e.queue,!0,!1),Oa().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var n=Pe,r=Oa();if(Ze){if(a===void 0)throw Error(z(407));a=a()}else{if(a=t(),vt===null)throw Error(z(349));(Ke&127)!==0||Sk(n,t,a)}r.memoizedState=a;var o={value:a,getSnapshot:t};return r.queue=o,DI(Ck.bind(null,n,o,e),[e]),n.flags|=2048,rl(9,{destroy:void 0},Ik.bind(null,n,o,a,t),null),a},useId:function(){var e=Oa(),t=vt.identifierPrefix;if(Ze){var a=lr,n=sr;a=(n&~(1<<32-pn(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=ip++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=sF++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Iw,useFormState:AI,useActionState:AI,useOptimistic:function(e){var t=Oa();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Cw.bind(null,Pe,!0,a),a.dispatch=t,[e,t]},useMemoCache:ww,useCacheRefresh:function(){return Oa().memoizedState=pF.bind(null,Pe)},useEffectEvent:function(e){var t=Oa(),a={impl:e};return t.memoizedState=a,function(){if((st&2)!==0)throw Error(z(440));return a.impl.apply(void 0,arguments)}}},kw={readContext:xa,use:Mp,useCallback:Bk,useContext:xa,useEffect:xw,useImperativeHandle:Uk,useInsertionEffect:Pk,useLayoutEffect:Ok,useMemo:zk,useReducer:Bf,useRef:Dk,useState:function(){return Bf(Hr)},useDebugValue:bw,useDeferredValue:function(e,t){var a=Zt();return Fk(a,yt.memoizedState,e,t)},useTransition:function(){var e=Bf(Hr)[0],t=Zt().memoizedState;return[typeof e=="boolean"?e:yc(e),t]},useSyncExternalStore:bk,useId:Vk,useHostTransitionStatus:Iw,useFormState:MI,useActionState:MI,useOptimistic:function(e,t){var a=Zt();return Lk(a,yt,e,t)},useMemoCache:ww,useCacheRefresh:$k};kw.useEffectEvent=_k;var Yk={readContext:xa,use:Mp,useCallback:Bk,useContext:xa,useEffect:xw,useImperativeHandle:Uk,useInsertionEffect:Pk,useLayoutEffect:Ok,useMemo:zk,useReducer:Dg,useRef:Dk,useState:function(){return Dg(Hr)},useDebugValue:bw,useDeferredValue:function(e,t){var a=Zt();return yt===null?Sw(a,e,t):Fk(a,yt.memoizedState,e,t)},useTransition:function(){var e=Dg(Hr)[0],t=Zt().memoizedState;return[typeof e=="boolean"?e:yc(e),t]},useSyncExternalStore:bk,useId:Vk,useHostTransitionStatus:Iw,useFormState:RI,useActionState:RI,useOptimistic:function(e,t){var a=Zt();return yt!==null?Lk(a,yt,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:ww,useCacheRefresh:$k};Yk.useEffectEvent=_k;function _g(e,t,a,n){t=e.memoizedState,a=a(n,t),a=a==null?t:Lt({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var ky={enqueueSetState:function(e,t,a){e=e._reactInternals;var n=mn(),r=To(n);r.payload=t,a!=null&&(r.callback=a),t=Lo(e,r,n),t!==null&&(Ga(t,e,n),qu(t,e,n))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var n=mn(),r=To(n);r.tag=1,r.payload=t,a!=null&&(r.callback=a),t=Lo(e,r,n),t!==null&&(Ga(t,e,n),qu(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=mn(),n=To(a);n.tag=2,t!=null&&(n.callback=t),t=Lo(e,n,a),t!==null&&(Ga(t,e,a),qu(t,e,a))}};function _I(e,t,a,n,r,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,o,i):t.prototype&&t.prototype.isPureReactComponent?!Qu(a,n)||!Qu(r,o):!0}function PI(e,t,a,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,n),t.state!==e&&ky.enqueueReplaceState(t,t.state,null)}function Ti(e,t){var a=t;if("ref"in t){a={};for(var n in t)n!=="ref"&&(a[n]=t[n])}if(e=e.defaultProps){a===t&&(a=Lt({},a));for(var r in e)a[r]===void 0&&(a[r]=e[r])}return a}function Zk(e){Jf(e)}function Jk(e){console.error(e)}function Qk(e){Jf(e)}function sp(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function OI(e,t,a){try{var n=e.onCaughtError;n(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Ty(e,t,a){return a=To(a),a.tag=3,a.payload={element:null},a.callback=function(){sp(e,t)},a}function eT(e){return e=To(e),e.tag=3,e}function tT(e,t,a,n){var r=a.type.getDerivedStateFromError;if(typeof r=="function"){var o=n.value;e.payload=function(){return r(o)},e.callback=function(){OI(t,a,n)}}var i=a.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){OI(t,a,n),typeof r!="function"&&(Eo===null?Eo=new Set([this]):Eo.add(this));var s=n.stack;this.componentDidCatch(n.value,{componentStack:s!==null?s:""})})}function hF(e,t,a,n,r){if(a.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=a.alternate,t!==null&&fl(t,a,r,!0),a=gn.current,a!==null){switch(a.tag){case 31:case 13:return Dn===null?fp():a.alternate===null&&jt===0&&(jt=3),a.flags&=-257,a.flags|=65536,a.lanes=r,n===ap?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([n]):t.add(n),Vg(e,n,r)),!1;case 22:return a.flags|=65536,n===ap?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([n]):a.add(n)),Vg(e,n,r)),!1}throw Error(z(435,a.tag))}return Vg(e,n,r),fp(),!1}if(Ze)return t=gn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,n!==py&&(e=Error(z(422),{cause:n}),tc(Mn(e,a)))):(n!==py&&(t=Error(z(423),{cause:n}),tc(Mn(t,a))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,n=Mn(n,a),r=Ty(e.stateNode,n,r),Rg(e,r),jt!==4&&(jt=2)),!1;var o=Error(z(520),{cause:n});if(o=Mn(o,a),Gu===null?Gu=[o]:Gu.push(o),jt!==4&&(jt=2),t===null)return!0;n=Mn(n,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=r&-r,a.lanes|=e,e=Ty(a.stateNode,n,e),Rg(a,e),!1;case 1:if(t=a.type,o=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(Eo===null||!Eo.has(o))))return a.flags|=65536,r&=-r,a.lanes|=r,r=eT(r),tT(r,e,a,n),Rg(a,r),!1}a=a.return}while(a!==null);return!1}var Tw=Error(z(461)),ra=!1;function ya(e,t,a,n){t.child=e===null?hk(t,null,a,n):Ci(t,e.child,a,n)}function NI(e,t,a,n,r){a=a.render;var o=t.ref;if("ref"in n){var i={};for(var s in n)s!=="ref"&&(i[s]=n[s])}else i=n;return Ii(t),n=mw(e,t,a,i,o,r),s=hw(),e!==null&&!ra?(gw(e,t,r),jr(e,t,r)):(Ze&&s&&iw(t),t.flags|=1,ya(e,t,n,r),t.child)}function UI(e,t,a,n,r){if(e===null){var o=a.type;return typeof o=="function"&&!ow(o)&&o.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=o,aT(e,t,o,n,r)):(e=Nf(a.type,null,n,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!Lw(e,r)){var i=o.memoizedProps;if(a=a.compare,a=a!==null?a:Qu,a(i,n)&&e.ref===t.ref)return jr(e,t,r)}return t.flags|=1,e=Ur(o,n),e.ref=t.ref,e.return=t,t.child=e}function aT(e,t,a,n,r){if(e!==null){var o=e.memoizedProps;if(Qu(o,n)&&e.ref===t.ref)if(ra=!1,t.pendingProps=n=o,Lw(e,r))(e.flags&131072)!==0&&(ra=!0);else return t.lanes=e.lanes,jr(e,t,r)}return Ly(e,t,a,n,r)}function nT(e,t,a,n){var r=n.children,o=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((t.flags&128)!==0){if(o=o!==null?o.baseLanes|a:a,e!==null){for(n=t.child=e.child,r=0;n!==null;)r=r|n.lanes|n.childLanes,n=n.sibling;n=r&~o}else n=0,t.child=null;return BI(e,t,o,a,n)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Uf(t,o!==null?o.cachePool:null),o!==null?TI(t,o):xy(),wk(t);else return n=t.lanes=536870912,BI(e,t,o!==null?o.baseLanes|a:a,a,n)}else o!==null?(Uf(t,o.cachePool),TI(t,o),yo(t),t.memoizedState=null):(e!==null&&Uf(t,null),xy(),yo(t));return ya(e,t,r,a),t.child}function Ou(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function BI(e,t,a,n,r){var o=uw();return o=o===null?null:{parent:na._currentValue,pool:o},t.memoizedState={baseLanes:a,cachePool:o},e!==null&&Uf(t,null),xy(),wk(t),e!==null&&fl(e,t,n,!0),t.childLanes=r,null}function Ff(e,t){return t=lp({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function zI(e,t,a){return Ci(t,e.child,null,a),e=Ff(t,t.pendingProps),e.flags|=2,ln(t),t.memoizedState=null,e}function gF(e,t,a){var n=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ze){if(n.mode==="hidden")return e=Ff(t,n),t.lanes=536870912,Ou(null,e);if(by(t),(e=Tt)?(e=KT(e,Rn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_o!==null?{id:sr,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},a=lk(e),a.return=t,t.child=a,va=t,Tt=null)):e=null,e===null)throw Po(t);return t.lanes=536870912,null}return Ff(t,n)}var o=e.memoizedState;if(o!==null){var i=o.dehydrated;if(by(t),r)if(t.flags&256)t.flags&=-257,t=zI(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(z(558));else if(ra||fl(e,t,a,!1),r=(a&e.childLanes)!==0,ra||r){if(n=vt,n!==null&&(i=PC(n,a),i!==0&&i!==o.retryLane))throw o.retryLane=i,Mi(e,i),Ga(n,e,i),Tw;fp(),t=zI(e,t,a)}else e=o.treeContext,Tt=_n(i.nextSibling),va=t,Ze=!0,ko=null,Rn=!1,e!==null&&ck(t,e),t=Ff(t,n),t.flags|=4096;return t}return e=Ur(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function qf(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(z(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Ly(e,t,a,n,r){return Ii(t),a=mw(e,t,a,n,void 0,r),n=hw(),e!==null&&!ra?(gw(e,t,r),jr(e,t,r)):(Ze&&n&&iw(t),t.flags|=1,ya(e,t,a,r),t.child)}function FI(e,t,a,n,r,o){return Ii(t),t.updateQueue=null,a=xk(t,n,a,r),vk(e),n=hw(),e!==null&&!ra?(gw(e,t,o),jr(e,t,o)):(Ze&&n&&iw(t),t.flags|=1,ya(e,t,a,o),t.child)}function qI(e,t,a,n,r){if(Ii(t),t.stateNode===null){var o=Hs,i=a.contextType;typeof i=="object"&&i!==null&&(o=xa(i)),o=new a(n,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=ky,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=n,o.state=t.memoizedState,o.refs={},dw(t),i=a.contextType,o.context=typeof i=="object"&&i!==null?xa(i):Hs,o.state=t.memoizedState,i=a.getDerivedStateFromProps,typeof i=="function"&&(_g(t,a,i,n),o.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(i=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),i!==o.state&&ky.enqueueReplaceState(o,o.state,null),ju(t,n,o,r),Hu(),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){o=t.stateNode;var s=t.memoizedProps,l=Ti(a,s);o.props=l;var u=o.context,c=a.contextType;i=Hs,typeof c=="object"&&c!==null&&(i=xa(c));var d=a.getDerivedStateFromProps;c=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function",s=t.pendingProps!==s,c||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s||u!==i)&&PI(t,o,n,i),mo=!1;var p=t.memoizedState;o.state=p,ju(t,n,o,r),Hu(),u=t.memoizedState,s||p!==u||mo?(typeof d=="function"&&(_g(t,a,d,n),u=t.memoizedState),(l=mo||_I(t,a,l,n,p,u,i))?(c||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=u),o.props=n,o.state=u,o.context=i,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,wy(e,t),i=t.memoizedProps,c=Ti(a,i),o.props=c,d=t.pendingProps,p=o.context,u=a.contextType,l=Hs,typeof u=="object"&&u!==null&&(l=xa(u)),s=a.getDerivedStateFromProps,(u=typeof s=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(i!==d||p!==l)&&PI(t,o,n,l),mo=!1,p=t.memoizedState,o.state=p,ju(t,n,o,r),Hu();var m=t.memoizedState;i!==d||p!==m||mo||e!==null&&e.dependencies!==null&&tp(e.dependencies)?(typeof s=="function"&&(_g(t,a,s,n),m=t.memoizedState),(c=mo||_I(t,a,c,n,p,m,l)||e!==null&&e.dependencies!==null&&tp(e.dependencies))?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,m,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,m,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=m),o.props=n,o.state=m,o.context=l,n=c):(typeof o.componentDidUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),n=!1)}return o=n,qf(e,t),n=(t.flags&128)!==0,o||n?(o=t.stateNode,a=n&&typeof a.getDerivedStateFromError!="function"?null:o.render(),t.flags|=1,e!==null&&n?(t.child=Ci(t,e.child,null,r),t.child=Ci(t,null,a,r)):ya(e,t,a,r),t.memoizedState=o.state,e=t.child):e=jr(e,t,r),e}function HI(e,t,a,n){return Si(),t.flags|=256,ya(e,t,a,n),t.child}var Pg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Og(e){return{baseLanes:e,cachePool:fk()}}function Ng(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=cn),e}function rT(e,t,a){var n=t.pendingProps,r=!1,o=(t.flags&128)!==0,i;if((i=o)||(i=e!==null&&e.memoizedState===null?!1:(Yt.current&2)!==0),i&&(r=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ze){if(r?go(t):yo(t),(e=Tt)?(e=KT(e,Rn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_o!==null?{id:sr,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},a=lk(e),a.return=t,t.child=a,va=t,Tt=null)):e=null,e===null)throw Po(t);return qy(e)?t.lanes=32:t.lanes=536870912,null}var s=n.children;return n=n.fallback,r?(yo(t),r=t.mode,s=lp({mode:"hidden",children:s},r),n=wi(n,r,a,null),s.return=t,n.return=t,s.sibling=n,t.child=s,n=t.child,n.memoizedState=Og(a),n.childLanes=Ng(e,i,a),t.memoizedState=Pg,Ou(null,n)):(go(t),Ey(t,s))}var l=e.memoizedState;if(l!==null&&(s=l.dehydrated,s!==null)){if(o)t.flags&256?(go(t),t.flags&=-257,t=Ug(e,t,a)):t.memoizedState!==null?(yo(t),t.child=e.child,t.flags|=128,t=null):(yo(t),s=n.fallback,r=t.mode,n=lp({mode:"visible",children:n.children},r),s=wi(s,r,a,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,Ci(t,e.child,null,a),n=t.child,n.memoizedState=Og(a),n.childLanes=Ng(e,i,a),t.memoizedState=Pg,t=Ou(null,n));else if(go(t),qy(s)){if(i=s.nextSibling&&s.nextSibling.dataset,i)var u=i.dgst;i=u,n=Error(z(419)),n.stack="",n.digest=i,tc({value:n,source:null,stack:null}),t=Ug(e,t,a)}else if(ra||fl(e,t,a,!1),i=(a&e.childLanes)!==0,ra||i){if(i=vt,i!==null&&(n=PC(i,a),n!==0&&n!==l.retryLane))throw l.retryLane=n,Mi(e,n),Ga(i,e,n),Tw;Fy(s)||fp(),t=Ug(e,t,a)}else Fy(s)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Tt=_n(s.nextSibling),va=t,Ze=!0,ko=null,Rn=!1,e!==null&&ck(t,e),t=Ey(t,n.children),t.flags|=4096);return t}return r?(yo(t),s=n.fallback,r=t.mode,l=e.child,u=l.sibling,n=Ur(l,{mode:"hidden",children:n.children}),n.subtreeFlags=l.subtreeFlags&65011712,u!==null?s=Ur(u,s):(s=wi(s,r,a,null),s.flags|=2),s.return=t,n.return=t,n.sibling=s,t.child=n,Ou(null,n),n=t.child,s=e.child.memoizedState,s===null?s=Og(a):(r=s.cachePool,r!==null?(l=na._currentValue,r=r.parent!==l?{parent:l,pool:l}:r):r=fk(),s={baseLanes:s.baseLanes|a,cachePool:r}),n.memoizedState=s,n.childLanes=Ng(e,i,a),t.memoizedState=Pg,Ou(e.child,n)):(go(t),a=e.child,e=a.sibling,a=Ur(a,{mode:"visible",children:n.children}),a.return=t,a.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=a,t.memoizedState=null,a)}function Ey(e,t){return t=lp({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function lp(e,t){return e=un(22,e,null,t),e.lanes=0,e}function Ug(e,t,a){return Ci(t,e.child,null,a),e=Ey(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jI(e,t,a){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),hy(e.return,t,a)}function Bg(e,t,a,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:a,tailMode:r,treeForkCount:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=a,i.tailMode=r,i.treeForkCount=o)}function oT(e,t,a){var n=t.pendingProps,r=n.revealOrder,o=n.tail;n=n.children;var i=Yt.current,s=(i&2)!==0;if(s?(i=i&1|2,t.flags|=128):i&=1,St(Yt,i),ya(e,t,n,a),n=Ze?ec:0,!s&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&jI(e,a,t);else if(e.tag===19)jI(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(a=t.child,r=null;a!==null;)e=a.alternate,e!==null&&rp(e)===null&&(r=a),a=a.sibling;a=r,a===null?(r=t.child,t.child=null):(r=a.sibling,a.sibling=null),Bg(t,!1,r,a,o,n);break;case"backwards":case"unstable_legacy-backwards":for(a=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&rp(e)===null){t.child=r;break}e=r.sibling,r.sibling=a,a=r,r=e}Bg(t,!0,a,null,o,n);break;case"together":Bg(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function jr(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),No|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(fl(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(z(153));if(t.child!==null){for(e=t.child,a=Ur(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Ur(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function Lw(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&tp(e)))}function yF(e,t,a){switch(t.tag){case 3:Xf(t,t.stateNode.containerInfo),ho(t,na,e.memoizedState.cache),Si();break;case 27:case 5:ay(t);break;case 4:Xf(t,t.stateNode.containerInfo);break;case 10:ho(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,by(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(go(t),t.flags|=128,null):(a&t.child.childLanes)!==0?rT(e,t,a):(go(t),e=jr(e,t,a),e!==null?e.sibling:null);go(t);break;case 19:var r=(e.flags&128)!==0;if(n=(a&t.childLanes)!==0,n||(fl(e,t,a,!1),n=(a&t.childLanes)!==0),r){if(n)return oT(e,t,a);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),St(Yt,Yt.current),n)break;return null;case 22:return t.lanes=0,nT(e,t,a,t.pendingProps);case 24:ho(t,na,e.memoizedState.cache)}return jr(e,t,a)}function iT(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)ra=!0;else{if(!Lw(e,a)&&(t.flags&128)===0)return ra=!1,yF(e,t,a);ra=(e.flags&131072)!==0}else ra=!1,Ze&&(t.flags&1048576)!==0&&uk(t,ec,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=hi(t.elementType),t.type=e,typeof e=="function")ow(e)?(n=Ti(e,n),t.tag=1,t=qI(null,t,e,n,a)):(t.tag=0,t=Ly(null,t,e,n,a));else{if(e!=null){var r=e.$$typeof;if(r===$y){t.tag=11,t=NI(null,t,e,n,a);break e}else if(r===Wy){t.tag=14,t=UI(null,t,e,n,a);break e}}throw t=ey(e)||e,Error(z(306,t,""))}}return t;case 0:return Ly(e,t,t.type,t.pendingProps,a);case 1:return n=t.type,r=Ti(n,t.pendingProps),qI(e,t,n,r,a);case 3:e:{if(Xf(t,t.stateNode.containerInfo),e===null)throw Error(z(387));n=t.pendingProps;var o=t.memoizedState;r=o.element,wy(e,t),ju(t,n,null,a);var i=t.memoizedState;if(n=i.cache,ho(t,na,n),n!==o.cache&&gy(t,[na],a,!0),Hu(),n=i.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=HI(e,t,n,a);break e}else if(n!==r){r=Mn(Error(z(424)),t),tc(r),t=HI(e,t,n,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Tt=_n(e.firstChild),va=t,Ze=!0,ko=null,Rn=!0,a=hk(t,null,n,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Si(),n===r){t=jr(e,t,a);break e}ya(e,t,n,a)}t=t.child}return t;case 26:return qf(e,t),e===null?(a=dC(t.type,null,t.pendingProps,null))?t.memoizedState=a:Ze||(a=t.type,e=t.pendingProps,n=gp(Co.current).createElement(a),n[wa]=t,n[Xa]=e,ba(n,a,e),fa(n),t.stateNode=n):t.memoizedState=dC(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ay(t),e===null&&Ze&&(n=t.stateNode=YT(t.type,t.pendingProps,Co.current),va=t,Rn=!0,r=Tt,Bo(t.type)?(Hy=r,Tt=_n(n.firstChild)):Tt=r),ya(e,t,t.pendingProps.children,a),qf(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ze&&((r=n=Tt)&&(n=$F(n,t.type,t.pendingProps,Rn),n!==null?(t.stateNode=n,va=t,Tt=_n(n.firstChild),Rn=!1,r=!0):r=!1),r||Po(t)),ay(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,n=o.children,By(r,o)?n=null:i!==null&&By(r,i)&&(t.flags|=32),t.memoizedState!==null&&(r=mw(e,t,lF,null,null,a),sc._currentValue=r),qf(e,t),ya(e,t,n,a),t.child;case 6:return e===null&&Ze&&((e=a=Tt)&&(a=WF(a,t.pendingProps,Rn),a!==null?(t.stateNode=a,va=t,Tt=null,e=!0):e=!1),e||Po(t)),null;case 13:return rT(e,t,a);case 4:return Xf(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ci(t,null,n,a):ya(e,t,n,a),t.child;case 11:return NI(e,t,t.type,t.pendingProps,a);case 7:return ya(e,t,t.pendingProps,a),t.child;case 8:return ya(e,t,t.pendingProps.children,a),t.child;case 12:return ya(e,t,t.pendingProps.children,a),t.child;case 10:return n=t.pendingProps,ho(t,t.type,n.value),ya(e,t,n.children,a),t.child;case 9:return r=t.type._context,n=t.pendingProps.children,Ii(t),r=xa(r),n=n(r),t.flags|=1,ya(e,t,n,a),t.child;case 14:return UI(e,t,t.type,t.pendingProps,a);case 15:return aT(e,t,t.type,t.pendingProps,a);case 19:return oT(e,t,a);case 31:return gF(e,t,a);case 22:return nT(e,t,a,t.pendingProps);case 24:return Ii(t),n=xa(na),e===null?(r=uw(),r===null&&(r=vt,o=lw(),r.pooledCache=o,o.refCount++,o!==null&&(r.pooledCacheLanes|=a),r=o),t.memoizedState={parent:n,cache:r},dw(t),ho(t,na,r)):((e.lanes&a)!==0&&(wy(e,t),ju(t,null,null,a),Hu()),r=e.memoizedState,o=t.memoizedState,r.parent!==n?(r={parent:n,cache:n},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),ho(t,na,n)):(n=o.cache,ho(t,na,n),n!==r.cache&&gy(t,[na],a,!0))),ya(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(z(156,t.tag))}function Er(e){e.flags|=4}function zg(e,t,a,n,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(MT())e.flags|=8192;else throw xi=ap,cw}else e.flags&=-16777217}function VI(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!QT(t))if(MT())e.flags|=8192;else throw xi=ap,cw}function kf(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?RC():536870912,e.lanes|=t,ol|=t)}function Eu(e,t){if(!Ze)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var n=null;a!==null;)a.alternate!==null&&(n=a),a=a.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function kt(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,n=0;if(t)for(var r=e.child;r!==null;)a|=r.lanes|r.childLanes,n|=r.subtreeFlags&65011712,n|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)a|=r.lanes|r.childLanes,n|=r.subtreeFlags,n|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=n,e.childLanes=a,t}function wF(e,t,a){var n=t.pendingProps;switch(sw(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(t),null;case 1:return kt(t),null;case 3:return a=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Br(na),Qs(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ms(t)?Er(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Mg())),kt(t),null;case 26:var r=t.type,o=t.memoizedState;return e===null?(Er(t),o!==null?(kt(t),VI(t,o)):(kt(t),zg(t,r,null,n,a))):o?o!==e.memoizedState?(Er(t),kt(t),VI(t,o)):(kt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&&Er(t),kt(t),zg(t,r,e,n,a)),null;case 27:if(Kf(t),a=Co.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Er(t);else{if(!n){if(t.stateNode===null)throw Error(z(166));return kt(t),null}e=cr.current,Ms(t)?vI(t,e):(e=YT(r,n,a),t.stateNode=e,Er(t))}return kt(t),null;case 5:if(Kf(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Er(t);else{if(!n){if(t.stateNode===null)throw Error(z(166));return kt(t),null}if(o=cr.current,Ms(t))vI(t,o);else{var i=gp(Co.current);switch(o){case 1:o=i.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:o=i.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":o=i.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":o=i.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":o=i.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof n.is=="string"?i.createElement("select",{is:n.is}):i.createElement("select"),n.multiple?o.multiple=!0:n.size&&(o.size=n.size);break;default:o=typeof n.is=="string"?i.createElement(r,{is:n.is}):i.createElement(r)}}o[wa]=t,o[Xa]=n;e:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)o.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=o;e:switch(ba(o,r,n),r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Er(t)}}return kt(t),zg(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&Er(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(z(166));if(e=Co.current,Ms(t)){if(e=t.stateNode,a=t.memoizedProps,n=null,r=va,r!==null)switch(r.tag){case 27:case 5:n=r.memoizedProps}e[wa]=t,e=!!(e.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||WT(e.nodeValue,a)),e||Po(t,!0)}else e=gp(e).createTextNode(n),e[wa]=t,t.stateNode=e}return kt(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(n=Ms(t),a!==null){if(e===null){if(!n)throw Error(z(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(z(557));e[wa]=t}else Si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;kt(t),e=!1}else a=Mg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(ln(t),t):(ln(t),null);if((t.flags&128)!==0)throw Error(z(558))}return kt(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Ms(t),n!==null&&n.dehydrated!==null){if(e===null){if(!r)throw Error(z(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(z(317));r[wa]=t}else Si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;kt(t),r=!1}else r=Mg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(ln(t),t):(ln(t),null)}return ln(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,e=e!==null&&e.memoizedState!==null,a&&(n=t.child,r=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(r=n.alternate.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==r&&(n.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),kf(t,t.updateQueue),kt(t),null);case 4:return Qs(),e===null&&Pw(t.stateNode.containerInfo),kt(t),null;case 10:return Br(t.type),kt(t),null;case 19:if(pa(Yt),n=t.memoizedState,n===null)return kt(t),null;if(r=(t.flags&128)!==0,o=n.rendering,o===null)if(r)Eu(n,!1);else{if(jt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=rp(e),o!==null){for(t.flags|=128,Eu(n,!1),e=o.updateQueue,t.updateQueue=e,kf(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)sk(a,e),a=a.sibling;return St(Yt,Yt.current&1|2),Ze&&Dr(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&dn()>cp&&(t.flags|=128,r=!0,Eu(n,!1),t.lanes=4194304)}else{if(!r)if(e=rp(o),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,kf(t,e),Eu(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate&&!Ze)return kt(t),null}else 2*dn()-n.renderingStartTime>cp&&a!==536870912&&(t.flags|=128,r=!0,Eu(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(e=n.last,e!==null?e.sibling=o:t.child=o,n.last=o)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=dn(),e.sibling=null,a=Yt.current,St(Yt,r?a&1|2:a&1),Ze&&Dr(t,n.treeForkCount),e):(kt(t),null);case 22:case 23:return ln(t),fw(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(kt(t),t.subtreeFlags&6&&(t.flags|=8192)):kt(t),a=t.updateQueue,a!==null&&kf(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),e!==null&&pa(vi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Br(na),kt(t),null;case 25:return null;case 30:return null}throw Error(z(156,t.tag))}function vF(e,t){switch(sw(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Br(na),Qs(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Kf(t),null;case 31:if(t.memoizedState!==null){if(ln(t),t.alternate===null)throw Error(z(340));Si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ln(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(z(340));Si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return pa(Yt),null;case 4:return Qs(),null;case 10:return Br(t.type),null;case 22:case 23:return ln(t),fw(),e!==null&&pa(vi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Br(na),null;case 25:return null;default:return null}}function sT(e,t){switch(sw(t),t.tag){case 3:Br(na),Qs();break;case 26:case 27:case 5:Kf(t);break;case 4:Qs();break;case 31:t.memoizedState!==null&&ln(t);break;case 13:ln(t);break;case 19:pa(Yt);break;case 10:Br(t.type);break;case 22:case 23:ln(t),fw(),e!==null&&pa(vi);break;case 24:Br(na)}}function wc(e,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var r=n.next;a=r;do{if((a.tag&e)===e){n=void 0;var o=a.create,i=a.inst;n=o(),i.destroy=n}a=a.next}while(a!==r)}}catch(s){ft(t,t.return,s)}}function Oo(e,t,a){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var o=r.next;n=o;do{if((n.tag&e)===e){var i=n.inst,s=i.destroy;if(s!==void 0){i.destroy=void 0,r=t;var l=a,u=s;try{u()}catch(c){ft(r,l,c)}}}n=n.next}while(n!==o)}}catch(c){ft(t,t.return,c)}}function lT(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{yk(t,a)}catch(n){ft(e,e.return,n)}}}function uT(e,t,a){a.props=Ti(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(n){ft(e,t,n)}}function $u(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof a=="function"?e.refCleanup=a(n):a.current=n}}catch(r){ft(e,t,r)}}function ur(e,t){var a=e.ref,n=e.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(r){ft(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(r){ft(e,t,r)}else a.current=null}function cT(e){var t=e.type,a=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(r){ft(e,e.return,r)}}function Fg(e,t,a){try{var n=e.stateNode;zF(n,e.type,a,t),n[Xa]=t}catch(r){ft(e,e.return,r)}}function dT(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Bo(e.type)||e.tag===4}function qg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||dT(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Bo(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ay(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Or));else if(n!==4&&(n===27&&Bo(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Ay(e,t,a),e=e.sibling;e!==null;)Ay(e,t,a),e=e.sibling}function up(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(n!==4&&(n===27&&Bo(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(up(e,t,a),e=e.sibling;e!==null;)up(e,t,a),e=e.sibling}function fT(e){var t=e.stateNode,a=e.memoizedProps;try{for(var n=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);ba(t,n,a),t[wa]=e,t[Xa]=a}catch(o){ft(e,e.return,o)}}var _r=!1,aa=!1,Hg=!1,$I=typeof WeakSet=="function"?WeakSet:Set,da=null;function xF(e,t){if(e=e.containerInfo,Ny=xp,e=QC(e),aw(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var r=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{a.nodeType,o.nodeType}catch{a=null;break e}var i=0,s=-1,l=-1,u=0,c=0,d=e,p=null;t:for(;;){for(var m;d!==a||r!==0&&d.nodeType!==3||(s=i+r),d!==o||n!==0&&d.nodeType!==3||(l=i+n),d.nodeType===3&&(i+=d.nodeValue.length),(m=d.firstChild)!==null;)p=d,d=m;for(;;){if(d===e)break t;if(p===a&&++u===r&&(s=i),p===o&&++c===n&&(l=i),(m=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=m}a=s===-1||l===-1?null:{start:s,end:l}}else a=null}a=a||{start:0,end:0}}else a=null;for(Uy={focusedElem:e,selectionRange:a},xp=!1,da=t;da!==null;)if(t=da,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,da=e;else for(;da!==null;){switch(t=da,o=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)r=e[a],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&o!==null){e=void 0,a=t,r=o.memoizedProps,o=o.memoizedState,n=a.stateNode;try{var h=Ti(a.type,r);e=n.getSnapshotBeforeUpdate(h,o),n.__reactInternalSnapshotBeforeUpdate=e}catch(v){ft(a,a.return,v)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)zy(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":zy(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(z(163))}if(e=t.sibling,e!==null){e.return=t.return,da=e;break}da=t.return}}function pT(e,t,a){var n=a.flags;switch(a.tag){case 0:case 11:case 15:Mr(e,a),n&4&&wc(5,a);break;case 1:if(Mr(e,a),n&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(i){ft(a,a.return,i)}else{var r=Ti(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){ft(a,a.return,i)}}n&64&&lT(a),n&512&&$u(a,a.return);break;case 3:if(Mr(e,a),n&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{yk(e,t)}catch(i){ft(a,a.return,i)}}break;case 27:t===null&&n&4&&fT(a);case 26:case 5:Mr(e,a),t===null&&n&4&&cT(a),n&512&&$u(a,a.return);break;case 12:Mr(e,a);break;case 31:Mr(e,a),n&4&&gT(e,a);break;case 13:Mr(e,a),n&4&&yT(e,a),n&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=AF.bind(null,a),GF(e,a))));break;case 22:if(n=a.memoizedState!==null||_r,!n){t=t!==null&&t.memoizedState!==null||aa,r=_r;var o=aa;_r=n,(aa=t)&&!o?Rr(e,a,(a.subtreeFlags&8772)!==0):Mr(e,a),_r=r,aa=o}break;case 30:break;default:Mr(e,a)}}function mT(e){var t=e.alternate;t!==null&&(e.alternate=null,mT(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Yy(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Dt=null,$a=!1;function Ar(e,t,a){for(a=a.child;a!==null;)hT(e,t,a),a=a.sibling}function hT(e,t,a){if(fn&&typeof fn.onCommitFiberUnmount=="function")try{fn.onCommitFiberUnmount(dc,a)}catch{}switch(a.tag){case 26:aa||ur(a,t),Ar(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:aa||ur(a,t);var n=Dt,r=$a;Bo(a.type)&&(Dt=a.stateNode,$a=!1),Ar(e,t,a),Ku(a.stateNode),Dt=n,$a=r;break;case 5:aa||ur(a,t);case 6:if(n=Dt,r=$a,Dt=null,Ar(e,t,a),Dt=n,$a=r,Dt!==null)if($a)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(a.stateNode)}catch(o){ft(a,t,o)}else try{Dt.removeChild(a.stateNode)}catch(o){ft(a,t,o)}break;case 18:Dt!==null&&($a?(e=Dt,iC(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ul(e)):iC(Dt,a.stateNode));break;case 4:n=Dt,r=$a,Dt=a.stateNode.containerInfo,$a=!0,Ar(e,t,a),Dt=n,$a=r;break;case 0:case 11:case 14:case 15:Oo(2,a,t),aa||Oo(4,a,t),Ar(e,t,a);break;case 1:aa||(ur(a,t),n=a.stateNode,typeof n.componentWillUnmount=="function"&&uT(a,t,n)),Ar(e,t,a);break;case 21:Ar(e,t,a);break;case 22:aa=(n=aa)||a.memoizedState!==null,Ar(e,t,a),aa=n;break;default:Ar(e,t,a)}}function gT(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ul(e)}catch(a){ft(t,t.return,a)}}}function yT(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ul(e)}catch(a){ft(t,t.return,a)}}function bF(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $I),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $I),t;default:throw Error(z(435,e.tag))}}function Tf(e,t){var a=bF(e);t.forEach(function(n){if(!a.has(n)){a.add(n);var r=MF.bind(null,e,n);n.then(r,r)}})}function ja(e,t){var a=t.deletions;if(a!==null)for(var n=0;n<a.length;n++){var r=a[n],o=e,i=t,s=i;e:for(;s!==null;){switch(s.tag){case 27:if(Bo(s.type)){Dt=s.stateNode,$a=!1;break e}break;case 5:Dt=s.stateNode,$a=!1;break e;case 3:case 4:Dt=s.stateNode.containerInfo,$a=!0;break e}s=s.return}if(Dt===null)throw Error(z(160));hT(o,i,r),Dt=null,$a=!1,o=r.alternate,o!==null&&(o.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)wT(t,e),t=t.sibling}var Wn=null;function wT(e,t){var a=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ja(t,e),Va(e),n&4&&(Oo(3,e,e.return),wc(3,e),Oo(5,e,e.return));break;case 1:ja(t,e),Va(e),n&512&&(aa||a===null||ur(a,a.return)),n&64&&_r&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?n:a.concat(n))));break;case 26:var r=Wn;if(ja(t,e),Va(e),n&512&&(aa||a===null||ur(a,a.return)),n&4){var o=a!==null?a.memoizedState:null;if(n=e.memoizedState,a===null)if(n===null)if(e.stateNode===null){e:{n=e.type,a=e.memoizedProps,r=r.ownerDocument||r;t:switch(n){case"title":o=r.getElementsByTagName("title")[0],(!o||o[mc]||o[wa]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=r.createElement(n),r.head.insertBefore(o,r.querySelector("head > title"))),ba(o,n,a),o[wa]=e,fa(o),n=o;break e;case"link":var i=pC("link","href",r).get(n+(a.href||""));if(i){for(var s=0;s<i.length;s++)if(o=i[s],o.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&o.getAttribute("rel")===(a.rel==null?null:a.rel)&&o.getAttribute("title")===(a.title==null?null:a.title)&&o.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){i.splice(s,1);break t}}o=r.createElement(n),ba(o,n,a),r.head.appendChild(o);break;case"meta":if(i=pC("meta","content",r).get(n+(a.content||""))){for(s=0;s<i.length;s++)if(o=i[s],o.getAttribute("content")===(a.content==null?null:""+a.content)&&o.getAttribute("name")===(a.name==null?null:a.name)&&o.getAttribute("property")===(a.property==null?null:a.property)&&o.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&o.getAttribute("charset")===(a.charSet==null?null:a.charSet)){i.splice(s,1);break t}}o=r.createElement(n),ba(o,n,a),r.head.appendChild(o);break;default:throw Error(z(468,n))}o[wa]=e,fa(o),n=o}e.stateNode=n}else mC(r,e.type,e.stateNode);else e.stateNode=fC(r,n,e.memoizedProps);else o!==n?(o===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):o.count--,n===null?mC(r,e.type,e.stateNode):fC(r,n,e.memoizedProps)):n===null&&e.stateNode!==null&&Fg(e,e.memoizedProps,a.memoizedProps)}break;case 27:ja(t,e),Va(e),n&512&&(aa||a===null||ur(a,a.return)),a!==null&&n&4&&Fg(e,e.memoizedProps,a.memoizedProps);break;case 5:if(ja(t,e),Va(e),n&512&&(aa||a===null||ur(a,a.return)),e.flags&32){r=e.stateNode;try{tl(r,"")}catch(h){ft(e,e.return,h)}}n&4&&e.stateNode!=null&&(r=e.memoizedProps,Fg(e,r,a!==null?a.memoizedProps:r)),n&1024&&(Hg=!0);break;case 6:if(ja(t,e),Va(e),n&4){if(e.stateNode===null)throw Error(z(162));n=e.memoizedProps,a=e.stateNode;try{a.nodeValue=n}catch(h){ft(e,e.return,h)}}break;case 3:if(Vf=null,r=Wn,Wn=yp(t.containerInfo),ja(t,e),Wn=r,Va(e),n&4&&a!==null&&a.memoizedState.isDehydrated)try{ul(t.containerInfo)}catch(h){ft(e,e.return,h)}Hg&&(Hg=!1,vT(e));break;case 4:n=Wn,Wn=yp(e.stateNode.containerInfo),ja(t,e),Va(e),Wn=n;break;case 12:ja(t,e),Va(e);break;case 31:ja(t,e),Va(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Tf(e,n)));break;case 13:ja(t,e),Va(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(_p=dn()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Tf(e,n)));break;case 22:r=e.memoizedState!==null;var l=a!==null&&a.memoizedState!==null,u=_r,c=aa;if(_r=u||r,aa=c||l,ja(t,e),aa=c,_r=u,Va(e),n&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(a===null||l||_r||aa||gi(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){l=a=t;try{if(o=l.stateNode,r)i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none";else{s=l.stateNode;var d=l.memoizedProps.style,p=d!=null&&d.hasOwnProperty("display")?d.display:null;s.style.display=p==null||typeof p=="boolean"?"":(""+p).trim()}}catch(h){ft(l,l.return,h)}}}else if(t.tag===6){if(a===null){l=t;try{l.stateNode.nodeValue=r?"":l.memoizedProps}catch(h){ft(l,l.return,h)}}}else if(t.tag===18){if(a===null){l=t;try{var m=l.stateNode;r?sC(m,!0):sC(l.stateNode,!1)}catch(h){ft(l,l.return,h)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=e.updateQueue,n!==null&&(a=n.retryQueue,a!==null&&(n.retryQueue=null,Tf(e,a))));break;case 19:ja(t,e),Va(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Tf(e,n)));break;case 30:break;case 21:break;default:ja(t,e),Va(e)}}function Va(e){var t=e.flags;if(t&2){try{for(var a,n=e.return;n!==null;){if(dT(n)){a=n;break}n=n.return}if(a==null)throw Error(z(160));switch(a.tag){case 27:var r=a.stateNode,o=qg(e);up(e,o,r);break;case 5:var i=a.stateNode;a.flags&32&&(tl(i,""),a.flags&=-33);var s=qg(e);up(e,s,i);break;case 3:case 4:var l=a.stateNode.containerInfo,u=qg(e);Ay(e,u,l);break;default:throw Error(z(161))}}catch(c){ft(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function vT(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;vT(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Mr(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)pT(e,t.alternate,t),t=t.sibling}function gi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Oo(4,t,t.return),gi(t);break;case 1:ur(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&uT(t,t.return,a),gi(t);break;case 27:Ku(t.stateNode);case 26:case 5:ur(t,t.return),gi(t);break;case 22:t.memoizedState===null&&gi(t);break;case 30:gi(t);break;default:gi(t)}e=e.sibling}}function Rr(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,r=e,o=t,i=o.flags;switch(o.tag){case 0:case 11:case 15:Rr(r,o,a),wc(4,o);break;case 1:if(Rr(r,o,a),n=o,r=n.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(u){ft(n,n.return,u)}if(n=o,r=n.updateQueue,r!==null){var s=n.stateNode;try{var l=r.shared.hiddenCallbacks;if(l!==null)for(r.shared.hiddenCallbacks=null,r=0;r<l.length;r++)gk(l[r],s)}catch(u){ft(n,n.return,u)}}a&&i&64&&lT(o),$u(o,o.return);break;case 27:fT(o);case 26:case 5:Rr(r,o,a),a&&n===null&&i&4&&cT(o),$u(o,o.return);break;case 12:Rr(r,o,a);break;case 31:Rr(r,o,a),a&&i&4&&gT(r,o);break;case 13:Rr(r,o,a),a&&i&4&&yT(r,o);break;case 22:o.memoizedState===null&&Rr(r,o,a),$u(o,o.return);break;case 30:break;default:Rr(r,o,a)}t=t.sibling}}function Ew(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&gc(a))}function Aw(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&gc(e))}function $n(e,t,a,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xT(e,t,a,n),t=t.sibling}function xT(e,t,a,n){var r=t.flags;switch(t.tag){case 0:case 11:case 15:$n(e,t,a,n),r&2048&&wc(9,t);break;case 1:$n(e,t,a,n);break;case 3:$n(e,t,a,n),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&gc(e)));break;case 12:if(r&2048){$n(e,t,a,n),e=t.stateNode;try{var o=t.memoizedProps,i=o.id,s=o.onPostCommit;typeof s=="function"&&s(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(l){ft(t,t.return,l)}}else $n(e,t,a,n);break;case 31:$n(e,t,a,n);break;case 13:$n(e,t,a,n);break;case 23:break;case 22:o=t.stateNode,i=t.alternate,t.memoizedState!==null?o._visibility&2?$n(e,t,a,n):Wu(e,t):o._visibility&2?$n(e,t,a,n):(o._visibility|=2,Ds(e,t,a,n,(t.subtreeFlags&10256)!==0||!1)),r&2048&&Ew(i,t);break;case 24:$n(e,t,a,n),r&2048&&Aw(t.alternate,t);break;default:$n(e,t,a,n)}}function Ds(e,t,a,n,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var o=e,i=t,s=a,l=n,u=i.flags;switch(i.tag){case 0:case 11:case 15:Ds(o,i,s,l,r),wc(8,i);break;case 23:break;case 22:var c=i.stateNode;i.memoizedState!==null?c._visibility&2?Ds(o,i,s,l,r):Wu(o,i):(c._visibility|=2,Ds(o,i,s,l,r)),r&&u&2048&&Ew(i.alternate,i);break;case 24:Ds(o,i,s,l,r),r&&u&2048&&Aw(i.alternate,i);break;default:Ds(o,i,s,l,r)}t=t.sibling}}function Wu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,n=t,r=n.flags;switch(n.tag){case 22:Wu(a,n),r&2048&&Ew(n.alternate,n);break;case 24:Wu(a,n),r&2048&&Aw(n.alternate,n);break;default:Wu(a,n)}t=t.sibling}}var Nu=8192;function Rs(e,t,a){if(e.subtreeFlags&Nu)for(e=e.child;e!==null;)bT(e,t,a),e=e.sibling}function bT(e,t,a){switch(e.tag){case 26:Rs(e,t,a),e.flags&Nu&&e.memoizedState!==null&&oq(a,Wn,e.memoizedState,e.memoizedProps);break;case 5:Rs(e,t,a);break;case 3:case 4:var n=Wn;Wn=yp(e.stateNode.containerInfo),Rs(e,t,a),Wn=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=Nu,Nu=16777216,Rs(e,t,a),Nu=n):Rs(e,t,a));break;default:Rs(e,t,a)}}function ST(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Au(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];da=n,CT(n,e)}ST(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)IT(e),e=e.sibling}function IT(e){switch(e.tag){case 0:case 11:case 15:Au(e),e.flags&2048&&Oo(9,e,e.return);break;case 3:Au(e);break;case 12:Au(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hf(e)):Au(e);break;default:Au(e)}}function Hf(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];da=n,CT(n,e)}ST(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Oo(8,t,t.return),Hf(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Hf(t));break;default:Hf(t)}e=e.sibling}}function CT(e,t){for(;da!==null;){var a=da;switch(a.tag){case 0:case 11:case 15:Oo(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var n=a.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:gc(a.memoizedState.cache)}if(n=a.child,n!==null)n.return=a,da=n;else e:for(a=e;da!==null;){n=da;var r=n.sibling,o=n.return;if(mT(n),n===a){da=null;break e}if(r!==null){r.return=o,da=r;break e}da=o}}}var SF={getCacheForType:function(e){var t=xa(na),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return xa(na).controller.signal}},IF=typeof WeakMap=="function"?WeakMap:Map,st=0,vt=null,Xe=null,Ke=0,dt=0,sn=null,bo=!1,ml=!1,Mw=!1,Vr=0,jt=0,No=0,bi=0,Rw=0,cn=0,ol=0,Gu=null,Wa=null,My=!1,_p=0,kT=0,cp=1/0,dp=null,Eo=null,ia=0,Ao=null,il=null,zr=0,Ry=0,Dy=null,TT=null,Xu=0,_y=null;function mn(){return(st&2)!==0&&Ke!==0?Ke&-Ke:Te.T!==null?_w():OC()}function LT(){if(cn===0)if((Ke&536870912)===0||Ze){var e=gf;gf<<=1,(gf&3932160)===0&&(gf=262144),cn=e}else cn=536870912;return e=gn.current,e!==null&&(e.flags|=32),cn}function Ga(e,t,a){(e===vt&&(dt===2||dt===9)||e.cancelPendingCommit!==null)&&(sl(e,0),So(e,Ke,cn,!1)),pc(e,a),((st&2)===0||e!==vt)&&(e===vt&&((st&2)===0&&(bi|=a),jt===4&&So(e,Ke,cn,!1)),fr(e))}function ET(e,t,a){if((st&6)!==0)throw Error(z(327));var n=!a&&(t&127)===0&&(t&e.expiredLanes)===0||fc(e,t),r=n?TF(e,t):jg(e,t,!0),o=n;do{if(r===0){ml&&!n&&So(e,t,0,!1);break}else{if(a=e.current.alternate,o&&!CF(a)){r=jg(e,t,!1),o=!1;continue}if(r===2){if(o=t,e.errorRecoveryDisabledLanes&o)var i=0;else i=e.pendingLanes&-536870913,i=i!==0?i:i&536870912?536870912:0;if(i!==0){t=i;e:{var s=e;r=Gu;var l=s.current.memoizedState.isDehydrated;if(l&&(sl(s,i).flags|=256),i=jg(s,i,!1),i!==2){if(Mw&&!l){s.errorRecoveryDisabledLanes|=o,bi|=o,r=4;break e}o=Wa,Wa=r,o!==null&&(Wa===null?Wa=o:Wa.push.apply(Wa,o))}r=i}if(o=!1,r!==2)continue}}if(r===1){sl(e,0),So(e,t,0,!0);break}e:{switch(n=e,o=r,o){case 0:case 1:throw Error(z(345));case 4:if((t&4194048)!==t)break;case 6:So(n,t,cn,!bo);break e;case 2:Wa=null;break;case 3:case 5:break;default:throw Error(z(329))}if((t&62914560)===t&&(r=_p+300-dn(),10<r)){if(So(n,t,cn,!bo),Sp(n,0,!0)!==0)break e;zr=t,n.timeoutHandle=XT(WI.bind(null,n,a,Wa,dp,My,t,cn,bi,ol,bo,o,"Throttled",-0,0),r);break e}WI(n,a,Wa,dp,My,t,cn,bi,ol,bo,o,null,-0,0)}}break}while(!0);fr(e)}function WI(e,t,a,n,r,o,i,s,l,u,c,d,p,m){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)===16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Or},bT(t,o,d);var h=(o&62914560)===o?_p-dn():(o&4194048)===o?kT-dn():0;if(h=iq(d,h),h!==null){zr=o,e.cancelPendingCommit=h(XI.bind(null,e,t,o,a,n,r,i,s,l,c,d,null,p,m)),So(e,o,i,!u);return}}XI(e,t,o,a,n,r,i,s,l)}function CF(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var n=0;n<a.length;n++){var r=a[n],o=r.getSnapshot;r=r.value;try{if(!hn(o(),r))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function So(e,t,a,n){t&=~Rw,t&=~bi,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var r=t;0<r;){var o=31-pn(r),i=1<<o;n[o]=-1,r&=~i}a!==0&&DC(e,a,t)}function Pp(){return(st&6)===0?(vc(0,!1),!1):!0}function Dw(){if(Xe!==null){if(dt===0)var e=Xe.return;else e=Xe,Nr=Ri=null,yw(e),Ys=null,ac=0,e=Xe;for(;e!==null;)sT(e.alternate,e),e=e.return;Xe=null}}function sl(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,HF(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),zr=0,Dw(),vt=e,Xe=a=Ur(e.current,null),Ke=t,dt=0,sn=null,bo=!1,ml=fc(e,t),Mw=!1,ol=cn=Rw=bi=No=jt=0,Wa=Gu=null,My=!1,(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-pn(n),o=1<<r;t|=e[r],n&=~o}return Vr=t,Tp(),a}function AT(e,t){Pe=null,Te.H=rc,t===pl||t===Ep?(t=CI(),dt=3):t===cw?(t=CI(),dt=4):dt=t===Tw?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,sn=t,Xe===null&&(jt=1,sp(e,Mn(t,e.current)))}function MT(){var e=gn.current;return e===null?!0:(Ke&4194048)===Ke?Dn===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?e===Dn:!1}function RT(){var e=Te.H;return Te.H=rc,e===null?rc:e}function DT(){var e=Te.A;return Te.A=SF,e}function fp(){jt=4,bo||(Ke&4194048)!==Ke&&gn.current!==null||(ml=!0),(No&134217727)===0&&(bi&134217727)===0||vt===null||So(vt,Ke,cn,!1)}function jg(e,t,a){var n=st;st|=2;var r=RT(),o=DT();(vt!==e||Ke!==t)&&(dp=null,sl(e,t)),t=!1;var i=jt;e:do try{if(dt!==0&&Xe!==null){var s=Xe,l=sn;switch(dt){case 8:Dw(),i=6;break e;case 3:case 2:case 9:case 6:gn.current===null&&(t=!0);var u=dt;if(dt=0,sn=null,$s(e,s,l,u),a&&ml){i=0;break e}break;default:u=dt,dt=0,sn=null,$s(e,s,l,u)}}kF(),i=jt;break}catch(c){AT(e,c)}while(!0);return t&&e.shellSuspendCounter++,Nr=Ri=null,st=n,Te.H=r,Te.A=o,Xe===null&&(vt=null,Ke=0,Tp()),i}function kF(){for(;Xe!==null;)_T(Xe)}function TF(e,t){var a=st;st|=2;var n=RT(),r=DT();vt!==e||Ke!==t?(dp=null,cp=dn()+500,sl(e,t)):ml=fc(e,t);e:do try{if(dt!==0&&Xe!==null){t=Xe;var o=sn;t:switch(dt){case 1:dt=0,sn=null,$s(e,t,o,1);break;case 2:case 9:if(II(o)){dt=0,sn=null,GI(t);break}t=function(){dt!==2&&dt!==9||vt!==e||(dt=7),fr(e)},o.then(t,t);break e;case 3:dt=7;break e;case 4:dt=5;break e;case 7:II(o)?(dt=0,sn=null,GI(t)):(dt=0,sn=null,$s(e,t,o,7));break;case 5:var i=null;switch(Xe.tag){case 26:i=Xe.memoizedState;case 5:case 27:var s=Xe;if(i?QT(i):s.stateNode.complete){dt=0,sn=null;var l=s.sibling;if(l!==null)Xe=l;else{var u=s.return;u!==null?(Xe=u,Op(u)):Xe=null}break t}}dt=0,sn=null,$s(e,t,o,5);break;case 6:dt=0,sn=null,$s(e,t,o,6);break;case 8:Dw(),jt=6;break e;default:throw Error(z(462))}}LF();break}catch(c){AT(e,c)}while(!0);return Nr=Ri=null,Te.H=n,Te.A=r,st=a,Xe!==null?0:(vt=null,Ke=0,Tp(),jt)}function LF(){for(;Xe!==null&&!Y3();)_T(Xe)}function _T(e){var t=iT(e.alternate,e,Vr);e.memoizedProps=e.pendingProps,t===null?Op(e):Xe=t}function GI(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=FI(a,t,t.pendingProps,t.type,void 0,Ke);break;case 11:t=FI(a,t,t.pendingProps,t.type.render,t.ref,Ke);break;case 5:yw(t);default:sT(a,t),t=Xe=sk(t,Vr),t=iT(a,t,Vr)}e.memoizedProps=e.pendingProps,t===null?Op(e):Xe=t}function $s(e,t,a,n){Nr=Ri=null,yw(t),Ys=null,ac=0;var r=t.return;try{if(hF(e,r,t,a,Ke)){jt=1,sp(e,Mn(a,e.current)),Xe=null;return}}catch(o){if(r!==null)throw Xe=r,o;jt=1,sp(e,Mn(a,e.current)),Xe=null;return}t.flags&32768?(Ze||n===1?e=!0:ml||(Ke&536870912)!==0?e=!1:(bo=e=!0,(n===2||n===9||n===3||n===6)&&(n=gn.current,n!==null&&n.tag===13&&(n.flags|=16384))),PT(t,e)):Op(t)}function Op(e){var t=e;do{if((t.flags&32768)!==0){PT(t,bo);return}e=t.return;var a=wF(t.alternate,t,Vr);if(a!==null){Xe=a;return}if(t=t.sibling,t!==null){Xe=t;return}Xe=t=e}while(t!==null);jt===0&&(jt=5)}function PT(e,t){do{var a=vF(e.alternate,e);if(a!==null){a.flags&=32767,Xe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Xe=e;return}Xe=e=a}while(e!==null);jt=6,Xe=null}function XI(e,t,a,n,r,o,i,s,l){e.cancelPendingCommit=null;do Np();while(ia!==0);if((st&6)!==0)throw Error(z(327));if(t!==null){if(t===e.current)throw Error(z(177));if(o=t.lanes|t.childLanes,o|=nw,iz(e,a,o,i,s,l),e===vt&&(Xe=vt=null,Ke=0),il=t,Ao=e,zr=a,Ry=o,Dy=r,TT=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,RF(Yf,function(){return zT(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=Te.T,Te.T=null,r=lt.p,lt.p=2,i=st,st|=4;try{xF(e,t,a)}finally{st=i,lt.p=r,Te.T=n}}ia=1,OT(),NT(),UT()}}function OT(){if(ia===1){ia=0;var e=Ao,t=il,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=Te.T,Te.T=null;var n=lt.p;lt.p=2;var r=st;st|=4;try{wT(t,e);var o=Uy,i=QC(e.containerInfo),s=o.focusedElem,l=o.selectionRange;if(i!==s&&s&&s.ownerDocument&&JC(s.ownerDocument.documentElement,s)){if(l!==null&&aw(s)){var u=l.start,c=l.end;if(c===void 0&&(c=u),"selectionStart"in s)s.selectionStart=u,s.selectionEnd=Math.min(c,s.value.length);else{var d=s.ownerDocument||document,p=d&&d.defaultView||window;if(p.getSelection){var m=p.getSelection(),h=s.textContent.length,v=Math.min(l.start,h),I=l.end===void 0?v:Math.min(l.end,h);!m.extend&&v>I&&(i=I,I=v,v=i);var y=gI(s,v),w=gI(s,I);if(y&&w&&(m.rangeCount!==1||m.anchorNode!==y.node||m.anchorOffset!==y.offset||m.focusNode!==w.node||m.focusOffset!==w.offset)){var g=d.createRange();g.setStart(y.node,y.offset),m.removeAllRanges(),v>I?(m.addRange(g),m.extend(w.node,w.offset)):(g.setEnd(w.node,w.offset),m.addRange(g))}}}}for(d=[],m=s;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<d.length;s++){var S=d[s];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}xp=!!Ny,Uy=Ny=null}finally{st=r,lt.p=n,Te.T=a}}e.current=t,ia=2}}function NT(){if(ia===2){ia=0;var e=Ao,t=il,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=Te.T,Te.T=null;var n=lt.p;lt.p=2;var r=st;st|=4;try{pT(e,t.alternate,t)}finally{st=r,lt.p=n,Te.T=a}}ia=3}}function UT(){if(ia===4||ia===3){ia=0,Z3();var e=Ao,t=il,a=zr,n=TT;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ia=5:(ia=0,il=Ao=null,BT(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Eo=null),Ky(a),t=t.stateNode,fn&&typeof fn.onCommitFiberRoot=="function")try{fn.onCommitFiberRoot(dc,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=Te.T,r=lt.p,lt.p=2,Te.T=null;try{for(var o=e.onRecoverableError,i=0;i<n.length;i++){var s=n[i];o(s.value,{componentStack:s.stack})}}finally{Te.T=t,lt.p=r}}(zr&3)!==0&&Np(),fr(e),r=e.pendingLanes,(a&261930)!==0&&(r&42)!==0?e===_y?Xu++:(Xu=0,_y=e):Xu=0,vc(0,!1)}}function BT(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,gc(t)))}function Np(){return OT(),NT(),UT(),zT()}function zT(){if(ia!==5)return!1;var e=Ao,t=Ry;Ry=0;var a=Ky(zr),n=Te.T,r=lt.p;try{lt.p=32>a?32:a,Te.T=null,a=Dy,Dy=null;var o=Ao,i=zr;if(ia=0,il=Ao=null,zr=0,(st&6)!==0)throw Error(z(331));var s=st;if(st|=4,IT(o.current),xT(o,o.current,i,a),st=s,vc(0,!1),fn&&typeof fn.onPostCommitFiberRoot=="function")try{fn.onPostCommitFiberRoot(dc,o)}catch{}return!0}finally{lt.p=r,Te.T=n,BT(e,t)}}function KI(e,t,a){t=Mn(a,t),t=Ty(e.stateNode,t,2),e=Lo(e,t,2),e!==null&&(pc(e,2),fr(e))}function ft(e,t,a){if(e.tag===3)KI(e,e,a);else for(;t!==null;){if(t.tag===3){KI(t,e,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Eo===null||!Eo.has(n))){e=Mn(a,e),a=eT(2),n=Lo(t,a,2),n!==null&&(tT(a,n,t,e),pc(n,2),fr(n));break}}t=t.return}}function Vg(e,t,a){var n=e.pingCache;if(n===null){n=e.pingCache=new IF;var r=new Set;n.set(t,r)}else r=n.get(t),r===void 0&&(r=new Set,n.set(t,r));r.has(a)||(Mw=!0,r.add(a),e=EF.bind(null,e,t,a),t.then(e,e))}function EF(e,t,a){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,vt===e&&(Ke&a)===a&&(jt===4||jt===3&&(Ke&62914560)===Ke&&300>dn()-_p?(st&2)===0&&sl(e,0):Rw|=a,ol===Ke&&(ol=0)),fr(e)}function FT(e,t){t===0&&(t=RC()),e=Mi(e,t),e!==null&&(pc(e,t),fr(e))}function AF(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),FT(e,a)}function MF(e,t){var a=0;switch(e.tag){case 31:case 13:var n=e.stateNode,r=e.memoizedState;r!==null&&(a=r.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(z(314))}n!==null&&n.delete(t),FT(e,a)}function RF(e,t){return Gy(e,t)}var pp=null,_s=null,Py=!1,mp=!1,$g=!1,Io=0;function fr(e){e!==_s&&e.next===null&&(_s===null?pp=_s=e:_s=_s.next=e),mp=!0,Py||(Py=!0,_F())}function vc(e,t){if(!$g&&mp){$g=!0;do for(var a=!1,n=pp;n!==null;){if(!t)if(e!==0){var r=n.pendingLanes;if(r===0)var o=0;else{var i=n.suspendedLanes,s=n.pingedLanes;o=(1<<31-pn(42|e)+1)-1,o&=r&~(i&~s),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(a=!0,YI(n,o))}else o=Ke,o=Sp(n,n===vt?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(o&3)===0||fc(n,o)||(a=!0,YI(n,o));n=n.next}while(a);$g=!1}}function DF(){qT()}function qT(){mp=Py=!1;var e=0;Io!==0&&qF()&&(e=Io);for(var t=dn(),a=null,n=pp;n!==null;){var r=n.next,o=HT(n,t);o===0?(n.next=null,a===null?pp=r:a.next=r,r===null&&(_s=a)):(a=n,(e!==0||(o&3)!==0)&&(mp=!0)),n=r}ia!==0&&ia!==5||vc(e,!1),Io!==0&&(Io=0)}function HT(e,t){for(var a=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var i=31-pn(o),s=1<<i,l=r[i];l===-1?((s&a)===0||(s&n)!==0)&&(r[i]=oz(s,t)):l<=t&&(e.expiredLanes|=s),o&=~s}if(t=vt,a=Ke,a=Sp(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,a===0||e===t&&(dt===2||dt===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&xg(n),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||fc(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(n!==null&&xg(n),Ky(a)){case 2:case 8:a=AC;break;case 32:a=Yf;break;case 268435456:a=MC;break;default:a=Yf}return n=jT.bind(null,e),a=Gy(a,n),e.callbackPriority=t,e.callbackNode=a,t}return n!==null&&n!==null&&xg(n),e.callbackPriority=2,e.callbackNode=null,2}function jT(e,t){if(ia!==0&&ia!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Np()&&e.callbackNode!==a)return null;var n=Ke;return n=Sp(e,e===vt?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(ET(e,n,t),HT(e,dn()),e.callbackNode!=null&&e.callbackNode===a?jT.bind(null,e):null)}function YI(e,t){if(Np())return null;ET(e,t,!0)}function _F(){jF(function(){(st&6)!==0?Gy(EC,DF):qT()})}function _w(){if(Io===0){var e=al;e===0&&(e=hf,hf<<=1,(hf&261888)===0&&(hf=256)),Io=e}return Io}function ZI(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:_f(""+e)}function JI(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function PF(e,t,a,n,r){if(t==="submit"&&a&&a.stateNode===r){var o=ZI((r[Xa]||null).action),i=n.submitter;i&&(t=(t=i[Xa]||null)?ZI(t.formAction):i.getAttribute("formAction"),t!==null&&(o=t,i=null));var s=new Ip("action","action",null,n,r);e.push({event:s,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Io!==0){var l=i?JI(r,i):new FormData(r);Cy(a,{pending:!0,data:l,method:r.method,action:o},null,l)}}else typeof o=="function"&&(s.preventDefault(),l=i?JI(r,i):new FormData(r),Cy(a,{pending:!0,data:l,method:r.method,action:o},o,l))},currentTarget:r}]})}}for(Lf=0;Lf<fy.length;Lf++)Ef=fy[Lf],QI=Ef.toLowerCase(),eC=Ef[0].toUpperCase()+Ef.slice(1),Gn(QI,"on"+eC);var Ef,QI,eC,Lf;Gn(tk,"onAnimationEnd");Gn(ak,"onAnimationIteration");Gn(nk,"onAnimationStart");Gn("dblclick","onDoubleClick");Gn("focusin","onFocus");Gn("focusout","onBlur");Gn(Jz,"onTransitionRun");Gn(Qz,"onTransitionStart");Gn(eF,"onTransitionCancel");Gn(rk,"onTransitionEnd");el("onMouseEnter",["mouseout","mouseover"]);el("onMouseLeave",["mouseout","mouseover"]);el("onPointerEnter",["pointerout","pointerover"]);el("onPointerLeave",["pointerout","pointerover"]);Li("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Li("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Li("onBeforeInput",["compositionend","keypress","textInput","paste"]);Li("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Li("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Li("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var oc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),OF=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(oc));function VT(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var n=e[a],r=n.event;n=n.listeners;e:{var o=void 0;if(t)for(var i=n.length-1;0<=i;i--){var s=n[i],l=s.instance,u=s.currentTarget;if(s=s.listener,l!==o&&r.isPropagationStopped())break e;o=s,r.currentTarget=u;try{o(r)}catch(c){Jf(c)}r.currentTarget=null,o=l}else for(i=0;i<n.length;i++){if(s=n[i],l=s.instance,u=s.currentTarget,s=s.listener,l!==o&&r.isPropagationStopped())break e;o=s,r.currentTarget=u;try{o(r)}catch(c){Jf(c)}r.currentTarget=null,o=l}}}}function Ge(e,t){var a=t[ry];a===void 0&&(a=t[ry]=new Set);var n=e+"__bubble";a.has(n)||($T(t,e,2,!1),a.add(n))}function Wg(e,t,a){var n=0;t&&(n|=4),$T(a,e,n,t)}var Af="_reactListening"+Math.random().toString(36).slice(2);function Pw(e){if(!e[Af]){e[Af]=!0,NC.forEach(function(a){a!=="selectionchange"&&(OF.has(a)||Wg(a,!1,e),Wg(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Af]||(t[Af]=!0,Wg("selectionchange",!1,t))}}function $T(e,t,a,n){switch(r1(t)){case 2:var r=uq;break;case 8:r=cq;break;default:r=Bw}a=r.bind(null,t,a,e),r=void 0,!uy||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),n?r!==void 0?e.addEventListener(t,a,{capture:!0,passive:r}):e.addEventListener(t,a,!0):r!==void 0?e.addEventListener(t,a,{passive:r}):e.addEventListener(t,a,!1)}function Gg(e,t,a,n,r){var o=n;if((t&1)===0&&(t&2)===0&&n!==null)e:for(;;){if(n===null)return;var i=n.tag;if(i===3||i===4){var s=n.stateNode.containerInfo;if(s===r)break;if(i===4)for(i=n.return;i!==null;){var l=i.tag;if((l===3||l===4)&&i.stateNode.containerInfo===r)return;i=i.return}for(;s!==null;){if(i=Ns(s),i===null)return;if(l=i.tag,l===5||l===6||l===26||l===27){n=o=i;continue e}s=s.parentNode}}n=n.return}VC(function(){var u=o,c=Jy(a),d=[];e:{var p=ok.get(e);if(p!==void 0){var m=Ip,h=e;switch(e){case"keypress":if(Of(a)===0)break e;case"keydown":case"keyup":m=Mz;break;case"focusin":h="focus",m=kg;break;case"focusout":h="blur",m=kg;break;case"beforeblur":case"afterblur":m=kg;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=sI;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=wz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=_z;break;case tk:case ak:case nk:m=bz;break;case rk:m=Oz;break;case"scroll":case"scrollend":m=gz;break;case"wheel":m=Uz;break;case"copy":case"cut":case"paste":m=Iz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=uI;break;case"toggle":case"beforetoggle":m=zz}var v=(t&4)!==0,I=!v&&(e==="scroll"||e==="scrollend"),y=v?p!==null?p+"Capture":null:p;v=[];for(var w=u,g;w!==null;){var S=w;if(g=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||g===null||y===null||(S=Zu(w,y),S!=null&&v.push(ic(w,S,g))),I)break;w=w.return}0<v.length&&(p=new m(p,h,null,a,c),d.push({event:p,listeners:v}))}}if((t&7)===0){e:{if(p=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",p&&a!==ly&&(h=a.relatedTarget||a.fromElement)&&(Ns(h)||h[cl]))break e;if((m||p)&&(p=c.window===c?c:(p=c.ownerDocument)?p.defaultView||p.parentWindow:window,m?(h=a.relatedTarget||a.toElement,m=u,h=h?Ns(h):null,h!==null&&(I=cc(h),v=h.tag,h!==I||v!==5&&v!==27&&v!==6)&&(h=null)):(m=null,h=u),m!==h)){if(v=sI,S="onMouseLeave",y="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(v=uI,S="onPointerLeave",y="onPointerEnter",w="pointer"),I=m==null?p:Pu(m),g=h==null?p:Pu(h),p=new v(S,w+"leave",m,a,c),p.target=I,p.relatedTarget=g,S=null,Ns(c)===u&&(v=new v(y,w+"enter",h,a,c),v.target=g,v.relatedTarget=I,S=v),I=S,m&&h)t:{for(v=NF,y=m,w=h,g=0,S=y;S;S=v(S))g++;S=0;for(var E=w;E;E=v(E))S++;for(;0<g-S;)y=v(y),g--;for(;0<S-g;)w=v(w),S--;for(;g--;){if(y===w||w!==null&&y===w.alternate){v=y;break t}y=v(y),w=v(w)}v=null}else v=null;m!==null&&tC(d,p,m,v,!1),h!==null&&I!==null&&tC(d,I,h,v,!0)}}e:{if(p=u?Pu(u):window,m=p.nodeName&&p.nodeName.toLowerCase(),m==="select"||m==="input"&&p.type==="file")var T=pI;else if(fI(p))if(YC)T=Kz;else{T=Gz;var R=Wz}else m=p.nodeName,!m||m.toLowerCase()!=="input"||p.type!=="checkbox"&&p.type!=="radio"?u&&Zy(u.elementType)&&(T=pI):T=Xz;if(T&&(T=T(e,u))){KC(d,T,a,c);break e}R&&R(e,p,u),e==="focusout"&&u&&p.type==="number"&&u.memoizedProps.value!=null&&sy(p,"number",p.value)}switch(R=u?Pu(u):window,e){case"focusin":(fI(R)||R.contentEditable==="true")&&(zs=R,cy=u,zu=null);break;case"focusout":zu=cy=zs=null;break;case"mousedown":dy=!0;break;case"contextmenu":case"mouseup":case"dragend":dy=!1,yI(d,a,c);break;case"selectionchange":if(Zz)break;case"keydown":case"keyup":yI(d,a,c)}var O;if(tw)e:{switch(e){case"compositionstart":var U="onCompositionStart";break e;case"compositionend":U="onCompositionEnd";break e;case"compositionupdate":U="onCompositionUpdate";break e}U=void 0}else Bs?GC(e,a)&&(U="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(U="onCompositionStart");U&&(WC&&a.locale!=="ko"&&(Bs||U!=="onCompositionStart"?U==="onCompositionEnd"&&Bs&&(O=$C()):(xo=c,Qy="value"in xo?xo.value:xo.textContent,Bs=!0)),R=hp(u,U),0<R.length&&(U=new lI(U,e,null,a,c),d.push({event:U,listeners:R}),O?U.data=O:(O=XC(a),O!==null&&(U.data=O)))),(O=qz?Hz(e,a):jz(e,a))&&(U=hp(u,"onBeforeInput"),0<U.length&&(R=new lI("onBeforeInput","beforeinput",null,a,c),d.push({event:R,listeners:U}),R.data=O)),PF(d,e,u,a,c)}VT(d,t)})}function ic(e,t,a){return{instance:e,listener:t,currentTarget:a}}function hp(e,t){for(var a=t+"Capture",n=[];e!==null;){var r=e,o=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||o===null||(r=Zu(e,a),r!=null&&n.unshift(ic(e,r,o)),r=Zu(e,t),r!=null&&n.push(ic(e,r,o))),e.tag===3)return n;e=e.return}return[]}function NF(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function tC(e,t,a,n,r){for(var o=t._reactName,i=[];a!==null&&a!==n;){var s=a,l=s.alternate,u=s.stateNode;if(s=s.tag,l!==null&&l===n)break;s!==5&&s!==26&&s!==27||u===null||(l=u,r?(u=Zu(a,o),u!=null&&i.unshift(ic(a,u,l))):r||(u=Zu(a,o),u!=null&&i.push(ic(a,u,l)))),a=a.return}i.length!==0&&e.push({event:t,listeners:i})}var UF=/\r\n?/g,BF=/\u0000|\uFFFD/g;function aC(e){return(typeof e=="string"?e:""+e).replace(UF,`
9
- `).replace(BF,"")}function WT(e,t){return t=aC(t),aC(e)===t}function gt(e,t,a,n,r,o){switch(a){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||tl(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&tl(e,""+n);break;case"className":wf(e,"class",n);break;case"tabIndex":wf(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":wf(e,a,n);break;case"style":jC(e,n,o);break;case"data":if(t!=="object"){wf(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=_f(""+n),e.setAttribute(a,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof o=="function"&&(a==="formAction"?(t!=="input"&&gt(e,t,"name",r.name,r,null),gt(e,t,"formEncType",r.formEncType,r,null),gt(e,t,"formMethod",r.formMethod,r,null),gt(e,t,"formTarget",r.formTarget,r,null)):(gt(e,t,"encType",r.encType,r,null),gt(e,t,"method",r.method,r,null),gt(e,t,"target",r.target,r,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=_f(""+n),e.setAttribute(a,n);break;case"onClick":n!=null&&(e.onclick=Or);break;case"onScroll":n!=null&&Ge("scroll",e);break;case"onScrollEnd":n!=null&&Ge("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(z(61));if(a=n.__html,a!=null){if(r.children!=null)throw Error(z(60));e.innerHTML=a}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}a=_f(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""+n):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":n===!0?e.setAttribute(a,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,n):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(a,n):e.removeAttribute(a);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(a):e.setAttribute(a,n);break;case"popover":Ge("beforetoggle",e),Ge("toggle",e),Df(e,"popover",n);break;case"xlinkActuate":Lr(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":Lr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":Lr(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":Lr(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":Lr(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":Lr(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":Lr(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":Lr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":Lr(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Df(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=mz.get(a)||a,Df(e,a,n))}}function Oy(e,t,a,n,r,o){switch(a){case"style":jC(e,n,o);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(z(61));if(a=n.__html,a!=null){if(r.children!=null)throw Error(z(60));e.innerHTML=a}}break;case"children":typeof n=="string"?tl(e,n):(typeof n=="number"||typeof n=="bigint")&&tl(e,""+n);break;case"onScroll":n!=null&&Ge("scroll",e);break;case"onScrollEnd":n!=null&&Ge("scrollend",e);break;case"onClick":n!=null&&(e.onclick=Or);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!UC.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(r=a.endsWith("Capture"),t=a.slice(2,r?a.length-7:void 0),o=e[Xa]||null,o=o!=null?o[a]:null,typeof o=="function"&&e.removeEventListener(t,o,r),typeof n=="function")){typeof o!="function"&&o!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,n,r);break e}a in e?e[a]=n:n===!0?e.setAttribute(a,""):Df(e,a,n)}}}function ba(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ge("error",e),Ge("load",e);var n=!1,r=!1,o;for(o in a)if(a.hasOwnProperty(o)){var i=a[o];if(i!=null)switch(o){case"src":n=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(z(137,t));default:gt(e,t,o,i,a,null)}}r&&gt(e,t,"srcSet",a.srcSet,a,null),n&&gt(e,t,"src",a.src,a,null);return;case"input":Ge("invalid",e);var s=o=i=r=null,l=null,u=null;for(n in a)if(a.hasOwnProperty(n)){var c=a[n];if(c!=null)switch(n){case"name":r=c;break;case"type":i=c;break;case"checked":l=c;break;case"defaultChecked":u=c;break;case"value":o=c;break;case"defaultValue":s=c;break;case"children":case"dangerouslySetInnerHTML":if(c!=null)throw Error(z(137,t));break;default:gt(e,t,n,c,a,null)}}FC(e,o,s,l,u,i,r,!1);return;case"select":Ge("invalid",e),n=i=o=null;for(r in a)if(a.hasOwnProperty(r)&&(s=a[r],s!=null))switch(r){case"value":o=s;break;case"defaultValue":i=s;break;case"multiple":n=s;default:gt(e,t,r,s,a,null)}t=o,a=i,e.multiple=!!n,t!=null?Gs(e,!!n,t,!1):a!=null&&Gs(e,!!n,a,!0);return;case"textarea":Ge("invalid",e),o=r=n=null;for(i in a)if(a.hasOwnProperty(i)&&(s=a[i],s!=null))switch(i){case"value":n=s;break;case"defaultValue":r=s;break;case"children":o=s;break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(z(91));break;default:gt(e,t,i,s,a,null)}HC(e,n,r,o);return;case"option":for(l in a)a.hasOwnProperty(l)&&(n=a[l],n!=null)&&(l==="selected"?e.selected=n&&typeof n!="function"&&typeof n!="symbol":gt(e,t,l,n,a,null));return;case"dialog":Ge("beforetoggle",e),Ge("toggle",e),Ge("cancel",e),Ge("close",e);break;case"iframe":case"object":Ge("load",e);break;case"video":case"audio":for(n=0;n<oc.length;n++)Ge(oc[n],e);break;case"image":Ge("error",e),Ge("load",e);break;case"details":Ge("toggle",e);break;case"embed":case"source":case"link":Ge("error",e),Ge("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(u in a)if(a.hasOwnProperty(u)&&(n=a[u],n!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(z(137,t));default:gt(e,t,u,n,a,null)}return;default:if(Zy(t)){for(c in a)a.hasOwnProperty(c)&&(n=a[c],n!==void 0&&Oy(e,t,c,n,a,void 0));return}}for(s in a)a.hasOwnProperty(s)&&(n=a[s],n!=null&&gt(e,t,s,n,a,null))}function zF(e,t,a,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,o=null,i=null,s=null,l=null,u=null,c=null;for(m in a){var d=a[m];if(a.hasOwnProperty(m)&&d!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":l=d;default:n.hasOwnProperty(m)||gt(e,t,m,null,n,d)}}for(var p in n){var m=n[p];if(d=a[p],n.hasOwnProperty(p)&&(m!=null||d!=null))switch(p){case"type":o=m;break;case"name":r=m;break;case"checked":u=m;break;case"defaultChecked":c=m;break;case"value":i=m;break;case"defaultValue":s=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(z(137,t));break;default:m!==d&&gt(e,t,p,m,n,d)}}iy(e,i,s,l,u,c,o,r);return;case"select":m=i=s=p=null;for(o in a)if(l=a[o],a.hasOwnProperty(o)&&l!=null)switch(o){case"value":break;case"multiple":m=l;default:n.hasOwnProperty(o)||gt(e,t,o,null,n,l)}for(r in n)if(o=n[r],l=a[r],n.hasOwnProperty(r)&&(o!=null||l!=null))switch(r){case"value":p=o;break;case"defaultValue":s=o;break;case"multiple":i=o;default:o!==l&&gt(e,t,r,o,n,l)}t=s,a=i,n=m,p!=null?Gs(e,!!a,p,!1):!!n!=!!a&&(t!=null?Gs(e,!!a,t,!0):Gs(e,!!a,a?[]:"",!1));return;case"textarea":m=p=null;for(s in a)if(r=a[s],a.hasOwnProperty(s)&&r!=null&&!n.hasOwnProperty(s))switch(s){case"value":break;case"children":break;default:gt(e,t,s,null,n,r)}for(i in n)if(r=n[i],o=a[i],n.hasOwnProperty(i)&&(r!=null||o!=null))switch(i){case"value":p=r;break;case"defaultValue":m=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(z(91));break;default:r!==o&&gt(e,t,i,r,n,o)}qC(e,p,m);return;case"option":for(var h in a)p=a[h],a.hasOwnProperty(h)&&p!=null&&!n.hasOwnProperty(h)&&(h==="selected"?e.selected=!1:gt(e,t,h,null,n,p));for(l in n)p=n[l],m=a[l],n.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null)&&(l==="selected"?e.selected=p&&typeof p!="function"&&typeof p!="symbol":gt(e,t,l,p,n,m));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var v in a)p=a[v],a.hasOwnProperty(v)&&p!=null&&!n.hasOwnProperty(v)&&gt(e,t,v,null,n,p);for(u in n)if(p=n[u],m=a[u],n.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(z(137,t));break;default:gt(e,t,u,p,n,m)}return;default:if(Zy(t)){for(var I in a)p=a[I],a.hasOwnProperty(I)&&p!==void 0&&!n.hasOwnProperty(I)&&Oy(e,t,I,void 0,n,p);for(c in n)p=n[c],m=a[c],!n.hasOwnProperty(c)||p===m||p===void 0&&m===void 0||Oy(e,t,c,p,n,m);return}}for(var y in a)p=a[y],a.hasOwnProperty(y)&&p!=null&&!n.hasOwnProperty(y)&&gt(e,t,y,null,n,p);for(d in n)p=n[d],m=a[d],!n.hasOwnProperty(d)||p===m||p==null&&m==null||gt(e,t,d,p,n,m)}function nC(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function FF(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),n=0;n<a.length;n++){var r=a[n],o=r.transferSize,i=r.initiatorType,s=r.duration;if(o&&s&&nC(i)){for(i=0,s=r.responseEnd,n+=1;n<a.length;n++){var l=a[n],u=l.startTime;if(u>s)break;var c=l.transferSize,d=l.initiatorType;c&&nC(d)&&(l=l.responseEnd,i+=c*(l<s?1:(s-u)/(l-u)))}if(--n,t+=8*(o+i)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Ny=null,Uy=null;function gp(e){return e.nodeType===9?e:e.ownerDocument}function rC(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function GT(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function By(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xg=null;function qF(){var e=window.event;return e&&e.type==="popstate"?e===Xg?!1:(Xg=e,!0):(Xg=null,!1)}var XT=typeof setTimeout=="function"?setTimeout:void 0,HF=typeof clearTimeout=="function"?clearTimeout:void 0,oC=typeof Promise=="function"?Promise:void 0,jF=typeof queueMicrotask=="function"?queueMicrotask:typeof oC<"u"?function(e){return oC.resolve(null).then(e).catch(VF)}:XT;function VF(e){setTimeout(function(){throw e})}function Bo(e){return e==="head"}function iC(e,t){var a=t,n=0;do{var r=a.nextSibling;if(e.removeChild(a),r&&r.nodeType===8)if(a=r.data,a==="/$"||a==="/&"){if(n===0){e.removeChild(r),ul(t);return}n--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")n++;else if(a==="html")Ku(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ku(a);for(var o=a.firstChild;o;){var i=o.nextSibling,s=o.nodeName;o[mc]||s==="SCRIPT"||s==="STYLE"||s==="LINK"&&o.rel.toLowerCase()==="stylesheet"||a.removeChild(o),o=i}}else a==="body"&&Ku(e.ownerDocument.body);a=r}while(a);ul(t)}function sC(e,t){var a=e;e=0;do{var n=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),n&&n.nodeType===8)if(a=n.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=n}while(a)}function zy(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":zy(a),Yy(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function $F(e,t,a,n){for(;e.nodeType===1;){var r=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[mc])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(o!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var o=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;if(e=_n(e.nextSibling),e===null)break}return null}function WF(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=_n(e.nextSibling),e===null))return null;return e}function KT(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=_n(e.nextSibling),e===null))return null;return e}function Fy(e){return e.data==="$?"||e.data==="$~"}function qy(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function GF(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var n=function(){t(),a.removeEventListener("DOMContentLoaded",n)};a.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function _n(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Hy=null;function lC(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return _n(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function uC(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function YT(e,t,a){switch(t=gp(a),e){case"html":if(e=t.documentElement,!e)throw Error(z(452));return e;case"head":if(e=t.head,!e)throw Error(z(453));return e;case"body":if(e=t.body,!e)throw Error(z(454));return e;default:throw Error(z(451))}}function Ku(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Yy(e)}var Pn=new Map,cC=new Set;function yp(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var $r=lt.d;lt.d={f:XF,r:KF,D:YF,C:ZF,L:JF,m:QF,X:tq,S:eq,M:aq};function XF(){var e=$r.f(),t=Pp();return e||t}function KF(e){var t=dl(e);t!==null&&t.tag===5&&t.type==="form"?jk(t):$r.r(e)}var hl=typeof document>"u"?null:document;function ZT(e,t,a){var n=hl;if(n&&typeof t=="string"&&t){var r=An(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof a=="string"&&(r+='[crossorigin="'+a+'"]'),cC.has(r)||(cC.add(r),e={rel:e,crossOrigin:a,href:t},n.querySelector(r)===null&&(t=n.createElement("link"),ba(t,"link",e),fa(t),n.head.appendChild(t)))}}function YF(e){$r.D(e),ZT("dns-prefetch",e,null)}function ZF(e,t){$r.C(e,t),ZT("preconnect",e,t)}function JF(e,t,a){$r.L(e,t,a);var n=hl;if(n&&e&&t){var r='link[rel="preload"][as="'+An(t)+'"]';t==="image"&&a&&a.imageSrcSet?(r+='[imagesrcset="'+An(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(r+='[imagesizes="'+An(a.imageSizes)+'"]')):r+='[href="'+An(e)+'"]';var o=r;switch(t){case"style":o=ll(e);break;case"script":o=gl(e)}Pn.has(o)||(e=Lt({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Pn.set(o,e),n.querySelector(r)!==null||t==="style"&&n.querySelector(xc(o))||t==="script"&&n.querySelector(bc(o))||(t=n.createElement("link"),ba(t,"link",e),fa(t),n.head.appendChild(t)))}}function QF(e,t){$r.m(e,t);var a=hl;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+An(n)+'"][href="'+An(e)+'"]',o=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=gl(e)}if(!Pn.has(o)&&(e=Lt({rel:"modulepreload",href:e},t),Pn.set(o,e),a.querySelector(r)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(bc(o)))return}n=a.createElement("link"),ba(n,"link",e),fa(n),a.head.appendChild(n)}}}function eq(e,t,a){$r.S(e,t,a);var n=hl;if(n&&e){var r=Ws(n).hoistableStyles,o=ll(e);t=t||"default";var i=r.get(o);if(!i){var s={loading:0,preload:null};if(i=n.querySelector(xc(o)))s.loading=5;else{e=Lt({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Pn.get(o))&&Ow(e,a);var l=i=n.createElement("link");fa(l),ba(l,"link",e),l._p=new Promise(function(u,c){l.onload=u,l.onerror=c}),l.addEventListener("load",function(){s.loading|=1}),l.addEventListener("error",function(){s.loading|=2}),s.loading|=4,jf(i,t,n)}i={type:"stylesheet",instance:i,count:1,state:s},r.set(o,i)}}}function tq(e,t){$r.X(e,t);var a=hl;if(a&&e){var n=Ws(a).hoistableScripts,r=gl(e),o=n.get(r);o||(o=a.querySelector(bc(r)),o||(e=Lt({src:e,async:!0},t),(t=Pn.get(r))&&Nw(e,t),o=a.createElement("script"),fa(o),ba(o,"link",e),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},n.set(r,o))}}function aq(e,t){$r.M(e,t);var a=hl;if(a&&e){var n=Ws(a).hoistableScripts,r=gl(e),o=n.get(r);o||(o=a.querySelector(bc(r)),o||(e=Lt({src:e,async:!0,type:"module"},t),(t=Pn.get(r))&&Nw(e,t),o=a.createElement("script"),fa(o),ba(o,"link",e),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},n.set(r,o))}}function dC(e,t,a,n){var r=(r=Co.current)?yp(r):null;if(!r)throw Error(z(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=ll(a.href),a=Ws(r).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ll(a.href);var o=Ws(r).hoistableStyles,i=o.get(e);if(i||(r=r.ownerDocument||r,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,i),(o=r.querySelector(xc(e)))&&!o._p&&(i.instance=o,i.state.loading=5),Pn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Pn.set(e,a),o||nq(r,e,a,i.state))),t&&n===null)throw Error(z(528,""));return i}if(t&&n!==null)throw Error(z(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=gl(a),a=Ws(r).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(z(444,e))}}function ll(e){return'href="'+An(e)+'"'}function xc(e){return'link[rel="stylesheet"]['+e+"]"}function JT(e){return Lt({},e,{"data-precedence":e.precedence,precedence:null})}function nq(e,t,a,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),ba(t,"link",a),fa(t),e.head.appendChild(t))}function gl(e){return'[src="'+An(e)+'"]'}function bc(e){return"script[async]"+e}function fC(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+An(a.href)+'"]');if(n)return t.instance=n,fa(n),n;var r=Lt({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),fa(n),ba(n,"style",r),jf(n,a.precedence,e),t.instance=n;case"stylesheet":r=ll(a.href);var o=e.querySelector(xc(r));if(o)return t.state.loading|=4,t.instance=o,fa(o),o;n=JT(a),(r=Pn.get(r))&&Ow(n,r),o=(e.ownerDocument||e).createElement("link"),fa(o);var i=o;return i._p=new Promise(function(s,l){i.onload=s,i.onerror=l}),ba(o,"link",n),t.state.loading|=4,jf(o,a.precedence,e),t.instance=o;case"script":return o=gl(a.src),(r=e.querySelector(bc(o)))?(t.instance=r,fa(r),r):(n=a,(r=Pn.get(o))&&(n=Lt({},a),Nw(n,r)),e=e.ownerDocument||e,r=e.createElement("script"),fa(r),ba(r,"link",n),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(z(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,jf(n,a.precedence,e));return t.instance}function jf(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,o=r,i=0;i<n.length;i++){var s=n[i];if(s.dataset.precedence===t)o=s;else if(o!==r)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Ow(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Nw(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Vf=null;function pC(e,t,a){if(Vf===null){var n=new Map,r=Vf=new Map;r.set(a,n)}else r=Vf,n=r.get(a),n||(n=new Map,r.set(a,n));if(n.has(e))return n;for(n.set(e,null),a=a.getElementsByTagName(e),r=0;r<a.length;r++){var o=a[r];if(!(o[mc]||o[wa]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var i=o.getAttribute(t)||"";i=e+i;var s=n.get(i);s?s.push(o):n.set(i,[o])}}return n}function mC(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function rq(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function QT(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function oq(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var r=ll(n.href),o=t.querySelector(xc(r));if(o){t=o._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=wp.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=o,fa(o);return}o=t.ownerDocument||t,n=JT(n),(r=Pn.get(r))&&Ow(n,r),o=o.createElement("link"),fa(o);var i=o;i._p=new Promise(function(s,l){i.onload=s,i.onerror=l}),ba(o,"link",n),a.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=wp.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Kg=0;function iq(e,t){return e.stylesheets&&e.count===0&&$f(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var n=setTimeout(function(){if(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+t);0<e.imgBytes&&Kg===0&&(Kg=62500*FF());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>Kg?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}function wp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$f(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var vp=null;function $f(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,vp=new Map,t.forEach(sq,e),vp=null,wp.call(e))}function sq(e,t){if(!(t.state.loading&4)){var a=vp.get(e);if(a)var n=a.get(null);else{a=new Map,vp.set(e,a);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<r.length;o++){var i=r[o];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(a.set(i.dataset.precedence,i),n=i)}n&&a.set(null,n)}r=t.instance,i=r.getAttribute("data-precedence"),o=a.get(i)||n,o===n&&a.set(null,r),a.set(i,r),this.count++,n=wp.bind(this),r.addEventListener("load",n),r.addEventListener("error",n),o?o.parentNode.insertBefore(r,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var sc={$$typeof:Pr,Provider:null,Consumer:null,_currentValue:yi,_currentValue2:yi,_threadCount:0};function lq(e,t,a,n,r,o,i,s,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=bg(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bg(0),this.hiddenUpdates=bg(null),this.identifierPrefix=n,this.onUncaughtError=r,this.onCaughtError=o,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function e1(e,t,a,n,r,o,i,s,l,u,c,d){return e=new lq(e,t,a,i,l,u,c,d,s),t=1,o===!0&&(t|=24),o=un(3,null,null,t),e.current=o,o.stateNode=e,t=lw(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:n,isDehydrated:a,cache:t},dw(o),e}function t1(e){return e?(e=Hs,e):Hs}function a1(e,t,a,n,r,o){r=t1(r),n.context===null?n.context=r:n.pendingContext=r,n=To(t),n.payload={element:a},o=o===void 0?null:o,o!==null&&(n.callback=o),a=Lo(e,n,t),a!==null&&(Ga(a,e,t),qu(a,e,t))}function hC(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Uw(e,t){hC(e,t),(e=e.alternate)&&hC(e,t)}function n1(e){if(e.tag===13||e.tag===31){var t=Mi(e,67108864);t!==null&&Ga(t,e,67108864),Uw(e,67108864)}}function gC(e){if(e.tag===13||e.tag===31){var t=mn();t=Xy(t);var a=Mi(e,t);a!==null&&Ga(a,e,t),Uw(e,t)}}var xp=!0;function uq(e,t,a,n){var r=Te.T;Te.T=null;var o=lt.p;try{lt.p=2,Bw(e,t,a,n)}finally{lt.p=o,Te.T=r}}function cq(e,t,a,n){var r=Te.T;Te.T=null;var o=lt.p;try{lt.p=8,Bw(e,t,a,n)}finally{lt.p=o,Te.T=r}}function Bw(e,t,a,n){if(xp){var r=jy(n);if(r===null)Gg(e,t,n,bp,a),yC(e,n);else if(fq(r,e,t,a,n))n.stopPropagation();else if(yC(e,n),t&4&&-1<dq.indexOf(e)){for(;r!==null;){var o=dl(r);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var i=mi(o.pendingLanes);if(i!==0){var s=o;for(s.pendingLanes|=2,s.entangledLanes|=2;i;){var l=1<<31-pn(i);s.entanglements[1]|=l,i&=~l}fr(o),(st&6)===0&&(cp=dn()+500,vc(0,!1))}}break;case 31:case 13:s=Mi(o,2),s!==null&&Ga(s,o,2),Pp(),Uw(o,2)}if(o=jy(n),o===null&&Gg(e,t,n,bp,a),o===r)break;r=o}r!==null&&n.stopPropagation()}else Gg(e,t,n,null,a)}}function jy(e){return e=Jy(e),zw(e)}var bp=null;function zw(e){if(bp=null,e=Ns(e),e!==null){var t=cc(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=IC(t),e!==null)return e;e=null}else if(a===31){if(e=CC(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return bp=e,null}function r1(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(J3()){case EC:return 2;case AC:return 8;case Yf:case Q3:return 32;case MC:return 268435456;default:return 32}default:return 32}}var Vy=!1,Mo=null,Ro=null,Do=null,lc=new Map,uc=new Map,wo=[],dq="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function yC(e,t){switch(e){case"focusin":case"focusout":Mo=null;break;case"dragenter":case"dragleave":Ro=null;break;case"mouseover":case"mouseout":Do=null;break;case"pointerover":case"pointerout":lc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":uc.delete(t.pointerId)}}function Mu(e,t,a,n,r,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:a,eventSystemFlags:n,nativeEvent:o,targetContainers:[r]},t!==null&&(t=dl(t),t!==null&&n1(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function fq(e,t,a,n,r){switch(t){case"focusin":return Mo=Mu(Mo,e,t,a,n,r),!0;case"dragenter":return Ro=Mu(Ro,e,t,a,n,r),!0;case"mouseover":return Do=Mu(Do,e,t,a,n,r),!0;case"pointerover":var o=r.pointerId;return lc.set(o,Mu(lc.get(o)||null,e,t,a,n,r)),!0;case"gotpointercapture":return o=r.pointerId,uc.set(o,Mu(uc.get(o)||null,e,t,a,n,r)),!0}return!1}function o1(e){var t=Ns(e.target);if(t!==null){var a=cc(t);if(a!==null){if(t=a.tag,t===13){if(t=IC(a),t!==null){e.blockedOn=t,eI(e.priority,function(){gC(a)});return}}else if(t===31){if(t=CC(a),t!==null){e.blockedOn=t,eI(e.priority,function(){gC(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Wf(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=jy(e.nativeEvent);if(a===null){a=e.nativeEvent;var n=new a.constructor(a.type,a);ly=n,a.target.dispatchEvent(n),ly=null}else return t=dl(a),t!==null&&n1(t),e.blockedOn=a,!1;t.shift()}return!0}function wC(e,t,a){Wf(e)&&a.delete(t)}function pq(){Vy=!1,Mo!==null&&Wf(Mo)&&(Mo=null),Ro!==null&&Wf(Ro)&&(Ro=null),Do!==null&&Wf(Do)&&(Do=null),lc.forEach(wC),uc.forEach(wC)}function Mf(e,t){e.blockedOn===t&&(e.blockedOn=null,Vy||(Vy=!0,sa.unstable_scheduleCallback(sa.unstable_NormalPriority,pq)))}var Rf=null;function vC(e){Rf!==e&&(Rf=e,sa.unstable_scheduleCallback(sa.unstable_NormalPriority,function(){Rf===e&&(Rf=null);for(var t=0;t<e.length;t+=3){var a=e[t],n=e[t+1],r=e[t+2];if(typeof n!="function"){if(zw(n||a)===null)continue;break}var o=dl(a);o!==null&&(e.splice(t,3),t-=3,Cy(o,{pending:!0,data:r,method:a.method,action:n},n,r))}}))}function ul(e){function t(l){return Mf(l,e)}Mo!==null&&Mf(Mo,e),Ro!==null&&Mf(Ro,e),Do!==null&&Mf(Do,e),lc.forEach(t),uc.forEach(t);for(var a=0;a<wo.length;a++){var n=wo[a];n.blockedOn===e&&(n.blockedOn=null)}for(;0<wo.length&&(a=wo[0],a.blockedOn===null);)o1(a),a.blockedOn===null&&wo.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(n=0;n<a.length;n+=3){var r=a[n],o=a[n+1],i=r[Xa]||null;if(typeof o=="function")i||vC(a);else if(i){var s=null;if(o&&o.hasAttribute("formAction")){if(r=o,i=o[Xa]||null)s=i.formAction;else if(zw(r)!==null)continue}else s=i.action;typeof s=="function"?a[n+1]=s:(a.splice(n,3),n-=3),vC(a)}}}function i1(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(i){return r=i})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),n||setTimeout(a,20)}function a(){if(!n&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function Fw(e){this._internalRoot=e}Up.prototype.render=Fw.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(z(409));var a=t.current,n=mn();a1(a,n,e,t,null,null)};Up.prototype.unmount=Fw.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;a1(e.current,2,null,e,null,null),Pp(),t[cl]=null}};function Up(e){this._internalRoot=e}Up.prototype.unstable_scheduleHydration=function(e){if(e){var t=OC();e={blockedOn:null,target:e,priority:t};for(var a=0;a<wo.length&&t!==0&&t<wo[a].priority;a++);wo.splice(a,0,e),a===0&&o1(e)}};var xC=bC.version;if(xC!=="19.2.4")throw Error(z(527,xC,"19.2.4"));lt.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(z(188)):(e=Object.keys(e).join(","),Error(z(268,e)));return e=$3(t),e=e!==null?kC(e):null,e=e===null?null:e.stateNode,e};var mq={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Te,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Ru=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Ru.isDisabled&&Ru.supportsFiber))try{dc=Ru.inject(mq),fn=Ru}catch{}var Ru;Bp.createRoot=function(e,t){if(!SC(e))throw Error(z(299));var a=!1,n="",r=Zk,o=Jk,i=Qk;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=e1(e,1,!1,null,null,a,n,null,r,o,i,i1),e[cl]=t.current,Pw(e),new Fw(t)};Bp.hydrateRoot=function(e,t,a){if(!SC(e))throw Error(z(299));var n=!1,r="",o=Zk,i=Jk,s=Qk,l=null;return a!=null&&(a.unstable_strictMode===!0&&(n=!0),a.identifierPrefix!==void 0&&(r=a.identifierPrefix),a.onUncaughtError!==void 0&&(o=a.onUncaughtError),a.onCaughtError!==void 0&&(i=a.onCaughtError),a.onRecoverableError!==void 0&&(s=a.onRecoverableError),a.formState!==void 0&&(l=a.formState)),t=e1(e,1,!0,t,a??null,n,r,l,o,i,s,i1),t.context=t1(null),a=t.current,n=mn(),n=Xy(n),r=To(n),r.callback=null,Lo(a,r,n),a=n,t.current.lanes=a,pc(t,a),fr(t),e[cl]=t.current,Pw(e),new Up(t)};Bp.version="19.2.4"});var qw=Ca((BZ,u1)=>{"use strict";function l1(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l1)}catch(e){console.error(e)}}l1(),u1.exports=s1()});var B1=Ca(Kp=>{"use strict";var _4=Symbol.for("react.transitional.element"),P4=Symbol.for("react.fragment");function U1(e,t,a){var n=null;if(a!==void 0&&(n=""+a),t.key!==void 0&&(n=""+t.key),"key"in t){a={};for(var r in t)r!=="key"&&(a[r]=t[r])}else a=t;return t=a.ref,{$$typeof:_4,type:e,key:n,ref:t!==void 0?t:null,props:a}}Kp.Fragment=P4;Kp.jsx=U1;Kp.jsxs=U1});var me=Ca((UQ,z1)=>{"use strict";z1.exports=B1()});function F1(e){var t,a,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(a=F1(e[t]))&&(n&&(n+=" "),n+=a)}else for(a in e)e[a]&&(n&&(n+=" "),n+=a);return n}function Zp(){for(var e,t,a=0,n="",r=arguments.length;a<r;a++)(e=arguments[a])&&(t=F1(e))&&(n&&(n+=" "),n+=t);return n}var tv=L(()=>{"use strict"});function av(...e){return e.filter(Boolean).join(" ")}function q1(){return av}var nv=L(()=>{"use strict"});function hV(e){let t=[],a=-1;for(;++a<e.length;)t[a]=Zo(e[a]);return bm(n);function n(...r){let o=-1;for(;++o<t.length;)if(t[o].apply(this,r))return!0;return!1}}function gV(e){let t=e;return bm(a);function a(n){let r=n,o;for(o in e)if(r[o]!==t[o])return!1;return!0}}function yV(e){return bm(t);function t(a){return a&&a.type===e}}function bm(e){return t;function t(a,n,r){return!!(vV(a)&&e.call(this,a,typeof n=="number"?n:void 0,r||void 0))}}function wV(){return!0}function vV(e){return e!==null&&typeof e=="object"&&"type"in e}var Zo,jM=L(()=>{"use strict";Zo=(function(e){if(e==null)return wV;if(typeof e=="function")return bm(e);if(typeof e=="object")return Array.isArray(e)?hV(e):gV(e);if(typeof e=="string")return yV(e);throw new Error("Expected function, string, or object as test")})});var Sm=L(()=>{"use strict";jM()});function cd(e,t,a,n){let r;typeof t=="function"&&typeof a!="function"?(n=a,a=t):r=t;let o=Zo(r),i=n?-1:1;s(e,void 0,[])();function s(l,u,c){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return p;function p(){let m=VM,h,v,I;if((!t||o(l,u,c[c.length-1]||void 0))&&(m=xV(a(l,c)),m[0]===ns))return m;if("children"in l&&l.children){let y=l;if(y.children&&m[0]!==rs)for(v=(n?y.children.length:-1)+i,I=c.concat(y);v>-1&&v<y.children.length;){let w=y.children[v];if(h=s(w,v,I)(),h[0]===ns)return h;v=typeof h[1]=="number"?h[1]:v+i}}return m}}}function xV(e){return Array.isArray(e)?e:typeof e=="number"?[Jr,e]:e==null?VM:[e]}var VM,Jr,ns,rs,$M=L(()=>{"use strict";Sm();VM=[],Jr=!0,ns=!1,rs="skip"});var Im=L(()=>{"use strict";$M()});function Qr(e,t,a,n){let r,o,i;typeof t=="function"&&typeof a!="function"?(o=void 0,i=t,r=a):(o=t,i=a,r=n),cd(e,o,s,r);function s(l,u){let c=u[u.length-1],d=c?c.children.indexOf(l):void 0;return i(l,d,c)}}var WM=L(()=>{"use strict";Im();Im()});var Cm=L(()=>{"use strict";WM()});function KM({defaultOrigin:e="",allowedLinkPrefixes:t=[],allowedImagePrefixes:a=[],allowDataImages:n=!1,allowedProtocols:r=[],blockedImageClass:o="inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm",blockedLinkClass:i="text-gray-500"}){let s=t.length&&!t.every(u=>u==="*"),l=a.length&&!a.every(u=>u==="*");if(!e&&(s||l))throw new Error("defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided");return u=>{let c=CV(e,t,a,n,r,o,i);Qr(u,c)}}function GM(e,t){if(typeof e!="string")return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))try{return new URL(e,"http://example.com")}catch{return null}return null}}function bV(e){return typeof e!="string"?!1:e.startsWith("/")||e.startsWith("./")||e.startsWith("../")}function XM(e,t,a,n=!1,r=!1,o=[]){if(!e)return null;if(typeof e=="string"&&e.startsWith("#")&&!r)try{if(new URL(e,"http://example.com").hash===e)return e}catch{}if(typeof e=="string"&&e.startsWith("data:"))return r&&n&&e.startsWith("data:image/")?e:null;if(typeof e=="string"&&e.startsWith("blob:")){try{if(new URL(e).protocol==="blob:"&&e.length>5){let c=e.substring(5);if(c&&c.length>0&&c!=="invalid")return e}}catch{return null}return null}let i=GM(e,a);if(!i||IV.has(i.protocol)||!(SV.has(i.protocol)||o.includes(i.protocol)||o.includes("*")))return null;if(i.protocol==="mailto:"||!i.protocol.match(/^https?:$/))return i.href;let l=bV(e);return i&&t.some(u=>{let c=GM(u,a);return!c||c.origin!==i.origin?!1:i.href.startsWith(c.href)})?l?i.pathname+i.search+i.hash:i.href:t.includes("*")?i.protocol!=="https:"&&i.protocol!=="http:"?null:l?i.pathname+i.search+i.hash:i.href:null}var SV,IV,yx,CV,YM=L(()=>{"use strict";Cm();SV=new Set(["https:","http:","irc:","ircs:","mailto:","xmpp:","blob:"]),IV=new Set(["javascript:","data:","file:","vbscript:"]);yx=Symbol("node-seen"),CV=(e,t,a,n,r,o,i)=>{let s=(l,u,c)=>{if(l.type!=="element"||l[yx])return Jr;if(l.tagName==="a"){let d=XM(l.properties.href,t,e,!1,!1,r);return d===null?(l[yx]=!0,Qr(l,s),c&&typeof u=="number"&&(c.children[u]={type:"element",tagName:"span",properties:{title:"Blocked URL: "+String(l.properties.href),class:i},children:[...l.children,{type:"text",value:" [blocked]"}]}),rs):(l.properties.href=d,l.properties.target="_blank",l.properties.rel="noopener noreferrer",Jr)}if(l.tagName==="img"){let d=XM(l.properties.src,a,e,n,!0,r);return d===null?(l[yx]=!0,Qr(l,s),c&&typeof u=="number"&&(c.children[u]={type:"element",tagName:"span",properties:{class:o},children:[{type:"text",value:"[Image blocked: "+String(l.properties.alt||"No description")+"]"}]}),rs):(l.properties.src=d,Jr)}return Jr};return s}});function kV(){return e=>e}var ZM,JM=L(()=>{"use strict";ZM=kV});var QM,AV,xx,rR=L(()=>{"use strict";QM=typeof self=="object"?self:globalThis,AV=(e,t)=>{let a=(r,o)=>(e.set(o,r),r),n=r=>{if(e.has(r))return e.get(r);let[o,i]=t[r];switch(o){case 0:case-1:return a(i,r);case 1:{let s=a([],r);for(let l of i)s.push(n(l));return s}case 2:{let s=a({},r);for(let[l,u]of i)s[n(l)]=n(u);return s}case 3:return a(new Date(i),r);case 4:{let{source:s,flags:l}=i;return a(new RegExp(s,l),r)}case 5:{let s=a(new Map,r);for(let[l,u]of i)s.set(n(l),n(u));return s}case 6:{let s=a(new Set,r);for(let l of i)s.add(n(l));return s}case 7:{let{name:s,message:l}=i;return a(new QM[s](l),r)}case 8:return a(BigInt(i),r);case"BigInt":return a(Object(BigInt(i)),r);case"ArrayBuffer":return a(new Uint8Array(i).buffer,i);case"DataView":{let{buffer:s}=new Uint8Array(i);return a(new DataView(s),i)}}return a(new QM[o](i),r)};return n},xx=e=>AV(new Map,e)(0)});var $l,MV,RV,dd,Tm,DV,bx,oR=L(()=>{"use strict";$l="",{toString:MV}={},{keys:RV}=Object,dd=e=>{let t=typeof e;if(t!=="object"||!e)return[0,t];let a=MV.call(e).slice(8,-1);switch(a){case"Array":return[1,$l];case"Object":return[2,$l];case"Date":return[3,$l];case"RegExp":return[4,$l];case"Map":return[5,$l];case"Set":return[6,$l];case"DataView":return[1,a]}return a.includes("Array")?[1,a]:a.includes("Error")?[7,a]:[2,a]},Tm=([e,t])=>e===0&&(t==="function"||t==="symbol"),DV=(e,t,a,n)=>{let r=(i,s)=>{let l=n.push(i)-1;return a.set(s,l),l},o=i=>{if(a.has(i))return a.get(i);let[s,l]=dd(i);switch(s){case 0:{let c=i;switch(l){case"bigint":s=8,c=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return r([-1],i)}return r([s,c],i)}case 1:{if(l){let p=i;return l==="DataView"?p=new Uint8Array(i.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(i)),r([l,[...p]],i)}let c=[],d=r([s,c],i);for(let p of i)c.push(o(p));return d}case 2:{if(l)switch(l){case"BigInt":return r([l,i.toString()],i);case"Boolean":case"Number":case"String":return r([l,i.valueOf()],i)}if(t&&"toJSON"in i)return o(i.toJSON());let c=[],d=r([s,c],i);for(let p of RV(i))(e||!Tm(dd(i[p])))&&c.push([o(p),o(i[p])]);return d}case 3:return r([s,i.toISOString()],i);case 4:{let{source:c,flags:d}=i;return r([s,{source:c,flags:d}],i)}case 5:{let c=[],d=r([s,c],i);for(let[p,m]of i)(e||!(Tm(dd(p))||Tm(dd(m))))&&c.push([o(p),o(m)]);return d}case 6:{let c=[],d=r([s,c],i);for(let p of i)(e||!Tm(dd(p)))&&c.push(o(p));return d}}let{message:u}=i;return r([s,{name:l,message:u}],i)};return o},bx=(e,{json:t,lossy:a}={})=>{let n=[];return DV(!(t||a),!!t,new Map,n)(e),n}});var Jo,Lm=L(()=>{"use strict";rR();oR();Jo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?xx(bx(e,t)):structuredClone(e):(e,t)=>xx(bx(e,t))});function iR(e){return t;function t(a){let n=a&&a.position&&a.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function fd(e){let t=Wl(e),a=Em(e);if(t&&a)return{start:t,end:a}}var Em,Wl,sR=L(()=>{"use strict";Em=iR("end"),Wl=iR("start")});var pd=L(()=>{"use strict";sR()});var os,Sx,lR=L(()=>{"use strict";os=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],Sx={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...os,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...os],h2:[["className","sr-only"]],img:[...os,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...os,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...os],table:[...os],ul:[...os,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]}});function Ix(e,t){let a={type:"root",children:[]},n={schema:t?{...Sx,...t}:Sx,stack:[]},r=dR(n,e);return r&&(Array.isArray(r)?r.length===1?a=r[0]:a.children=r:a=r),a}function dR(e,t){if(t&&typeof t=="object"){let a=t;switch(typeof a.type=="string"?a.type:""){case"comment":return _V(e,a);case"doctype":return PV(e,a);case"element":return OV(e,a);case"root":return NV(e,a);case"text":return UV(e,a);default:}}}function _V(e,t){if(e.schema.allowComments){let a=typeof t.value=="string"?t.value:"",n=a.indexOf("-->"),o={type:"comment",value:n<0?a:a.slice(0,n)};return md(o,t),o}}function PV(e,t){if(e.schema.allowDoctypes){let a={type:"doctype"};return md(a,t),a}}function OV(e,t){let a=typeof t.tagName=="string"?t.tagName:"";e.stack.push(a);let n=fR(e,t.children),r=BV(e,t.properties);e.stack.pop();let o=!1;if(a&&a!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(a))&&(o=!0,e.schema.ancestors&&Qo.call(e.schema.ancestors,a))){let s=e.schema.ancestors[a],l=-1;for(o=!1;++l<s.length;)e.stack.includes(s[l])&&(o=!0)}if(!o)return e.schema.strip&&!e.schema.strip.includes(a)?n:void 0;let i={type:"element",tagName:a,properties:r,children:n};return md(i,t),i}function NV(e,t){let n={type:"root",children:fR(e,t.children)};return md(n,t),n}function UV(e,t){let n={type:"text",value:typeof t.value=="string"?t.value:""};return md(n,t),n}function fR(e,t){let a=[];if(Array.isArray(t)){let n=t,r=-1;for(;++r<n.length;){let o=dR(e,n[r]);o&&(Array.isArray(o)?a.push(...o):a.push(o))}}return a}function BV(e,t){let a=e.stack[e.stack.length-1],n=e.schema.attributes,r=e.schema.required,o=n&&Qo.call(n,a)?n[a]:void 0,i=n&&Qo.call(n,"*")?n["*"]:void 0,s=t&&typeof t=="object"?t:{},l={},u;for(u in s)if(Qo.call(s,u)){let c=s[u],d=uR(e,cR(o,u),u,c);d==null&&(d=uR(e,cR(i,u),u,c)),d!=null&&(l[u]=d)}if(r&&Qo.call(r,a)){let c=r[a];for(u in c)Qo.call(c,u)&&!Qo.call(l,u)&&(l[u]=c[u])}return l}function uR(e,t,a,n){return t?Array.isArray(n)?zV(e,t,a,n):pR(e,t,a,n):void 0}function zV(e,t,a,n){let r=-1,o=[];for(;++r<n.length;){let i=pR(e,t,a,n[r]);(typeof i=="number"||typeof i=="string")&&o.push(i)}return o}function pR(e,t,a,n){if(!(typeof n!="boolean"&&typeof n!="number"&&typeof n!="string")&&FV(e,a,n)){if(typeof t=="object"&&t.length>1){let r=!1,o=0;for(;++o<t.length;){let i=t[o];if(i&&typeof i=="object"&&"flags"in i){if(i.test(String(n))){r=!0;break}}else if(i===n){r=!0;break}}if(!r)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(a)?e.schema.clobberPrefix+n:n}}function FV(e,t,a){let n=e.schema.protocols&&Qo.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!n||n.length===0)return!0;let r=String(a),o=r.indexOf(":"),i=r.indexOf("?"),s=r.indexOf("#"),l=r.indexOf("/");if(o<0||l>-1&&o>l||i>-1&&o>i||s>-1&&o>s)return!0;let u=-1;for(;++u<n.length;){let c=n[u];if(o===c.length&&r.slice(0,c.length)===c)return!0}return!1}function md(e,t){let a=fd(t);t.data&&(e.data=Jo(t.data)),a&&(e.position=a)}function cR(e,t){let a,n=-1;if(e)for(;++n<e.length;){let r=e[n],o=typeof r=="string"?r:r[0];if(o===t)return r;o==="data*"&&(a=r)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return a}var Qo,mR=L(()=>{"use strict";Lm();pd();lR();Qo={}.hasOwnProperty});var hR=L(()=>{"use strict";mR()});function Am(e){return function(t){return Ix(t,e)}}var gR=L(()=>{"use strict";hR()});var yR=L(()=>{"use strict";gR()});function Cx(e,t){let a=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,r=a.indexOf(t);for(;r!==-1;)n++,r=a.indexOf(t,r+t.length);return n}var wR=L(()=>{"use strict"});function is(e){return e!==null&&(e<32||e===127)}function ne(e){return e!==null&&e<-2}function $e(e){return e!==null&&(e<0||e===32)}function ve(e){return e===-2||e===-1||e===32}function ei(e){return t;function t(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}var la,Vt,vR,hd,xR,bR,ss,Sr,at=L(()=>{"use strict";la=ei(/[A-Za-z]/),Vt=ei(/[\dA-Za-z]/),vR=ei(/[#-'*+\--9=?A-Z^-~]/);hd=ei(/\d/),xR=ei(/[\dA-Fa-f]/),bR=ei(/[!-/:-@[-`{-~]/);ss=ei(/\p{P}|\p{S}/u),Sr=ei(/\s/)});function kx(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var SR=L(()=>{"use strict"});function Tx(e,t,a){let r=Zo((a||{}).ignore||[]),o=qV(t),i=-1;for(;++i<o.length;)cd(e,"text",s);function s(u,c){let d=-1,p;for(;++d<c.length;){let m=c[d],h=p?p.children:void 0;if(r(m,h?h.indexOf(m):void 0,p))return;p=m}if(p)return l(u,c)}function l(u,c){let d=c[c.length-1],p=o[i][0],m=o[i][1],h=0,I=d.children.indexOf(u),y=!1,w=[];p.lastIndex=0;let g=p.exec(u.value);for(;g;){let S=g.index,E={index:g.index,input:g.input,stack:[...c,u]},T=m(...g,E);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?p.lastIndex=S+1:(h!==S&&w.push({type:"text",value:u.value.slice(h,S)}),Array.isArray(T)?w.push(...T):T&&w.push(T),h=S+g[0].length,y=!0),!p.global)break;g=p.exec(u.value)}return y?(h<u.value.length&&w.push({type:"text",value:u.value.slice(h)}),d.children.splice(I,1,...w)):w=[u],I+w.length}}function qV(e){let t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");let a=!e[0]||Array.isArray(e[0])?e:[e],n=-1;for(;++n<a.length;){let r=a[n];t.push([HV(r[0]),jV(r[1])])}return t}function HV(e){return typeof e=="string"?new RegExp(kx(e),"g"):e}function jV(e){return typeof e=="function"?e:function(){return e}}var IR=L(()=>{"use strict";SR();Im();Sm()});var CR=L(()=>{"use strict";IR()});function Mx(){return{transforms:[KV],enter:{literalAutolink:VV,literalAutolinkEmail:Ax,literalAutolinkHttp:Ax,literalAutolinkWww:Ax},exit:{literalAutolink:XV,literalAutolinkEmail:GV,literalAutolinkHttp:$V,literalAutolinkWww:WV}}}function Rx(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Lx,notInConstruct:Ex},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Lx,notInConstruct:Ex},{character:":",before:"[ps]",after:"\\/",inConstruct:Lx,notInConstruct:Ex}]}}function VV(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ax(e){this.config.enter.autolinkProtocol.call(this,e)}function $V(e){this.config.exit.autolinkProtocol.call(this,e)}function WV(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function GV(e){this.config.exit.autolinkEmail.call(this,e)}function XV(e){this.exit(e)}function KV(e){Tx(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,YV],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,ZV]],{ignore:["link","linkReference"]})}function YV(e,t,a,n,r){let o="";if(!kR(r)||(/^w/i.test(t)&&(a=t+a,t="",o="http://"),!JV(a)))return!1;let i=QV(a+n);if(!i[0])return!1;let s={type:"link",title:null,url:o+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[s,{type:"text",value:i[1]}]:s}function ZV(e,t,a,n){return!kR(n,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+a,children:[{type:"text",value:t+"@"+a}]}}function JV(e){let t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function QV(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let a=t[0],n=a.indexOf(")"),r=Cx(e,"("),o=Cx(e,")");for(;n!==-1&&r>o;)e+=a.slice(0,n+1),a=a.slice(n+1),n=a.indexOf(")"),o++;return[e,a]}function kR(e,t){let a=e.input.charCodeAt(e.index-1);return(e.index===0||Sr(a)||ss(a))&&(!t||a!==47)}var Lx,Ex,TR=L(()=>{"use strict";wR();at();CR();Lx="phrasing",Ex=["autolink","link","image","label"]});var LR=L(()=>{"use strict";TR()});function Ma(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var Gl=L(()=>{"use strict"});function e$(){this.buffer()}function t$(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function a$(){this.buffer()}function n$(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function r$(e){let t=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Ma(this.sliceSerialize(e)).toLowerCase(),a.label=t}function o$(e){this.exit(e)}function i$(e){let t=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Ma(this.sliceSerialize(e)).toLowerCase(),a.label=t}function s$(e){this.exit(e)}function l$(){return"["}function ER(e,t,a,n){let r=a.createTracker(n),o=r.move("[^"),i=a.enter("footnoteReference"),s=a.enter("reference");return o+=r.move(a.safe(a.associationId(e),{after:"]",before:o})),s(),i(),o+=r.move("]"),o}function Dx(){return{enter:{gfmFootnoteCallString:e$,gfmFootnoteCall:t$,gfmFootnoteDefinitionLabelString:a$,gfmFootnoteDefinition:n$},exit:{gfmFootnoteCallString:r$,gfmFootnoteCall:o$,gfmFootnoteDefinitionLabelString:i$,gfmFootnoteDefinition:s$}}}function _x(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:a,footnoteReference:ER},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(n,r,o,i){let s=o.createTracker(i),l=s.move("[^"),u=o.enter("footnoteDefinition"),c=o.enter("label");return l+=s.move(o.safe(o.associationId(n),{before:l,after:"]"})),c(),l+=s.move("]:"),n.children&&n.children.length>0&&(s.shift(4),l+=s.move((t?`
8
+ `+n.stack}}var ny=Object.prototype.hasOwnProperty,Gy=sa.unstable_scheduleCallback,xg=sa.unstable_cancelCallback,Y3=sa.unstable_shouldYield,Z3=sa.unstable_requestPaint,dn=sa.unstable_now,J3=sa.unstable_getCurrentPriorityLevel,EC=sa.unstable_ImmediatePriority,AC=sa.unstable_UserBlockingPriority,Yf=sa.unstable_NormalPriority,Q3=sa.unstable_LowPriority,MC=sa.unstable_IdlePriority,ez=sa.log,tz=sa.unstable_setDisableYieldValue,dc=null,fn=null;function vo(e){if(typeof ez=="function"&&tz(e),fn&&typeof fn.setStrictMode=="function")try{fn.setStrictMode(dc,e)}catch{}}var pn=Math.clz32?Math.clz32:rz,az=Math.log,nz=Math.LN2;function rz(e){return e>>>=0,e===0?32:31-(az(e)/nz|0)|0}var hf=256,gf=262144,yf=4194304;function mi(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Sp(e,t,a){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var s=n&134217727;return s!==0?(n=s&~o,n!==0?r=mi(n):(i&=s,i!==0?r=mi(i):a||(a=s&~e,a!==0&&(r=mi(a))))):(s=n&~o,s!==0?r=mi(s):i!==0?r=mi(i):a||(a=n&~e,a!==0&&(r=mi(a)))),r===0?0:t!==0&&t!==r&&(t&o)===0&&(o=r&-r,a=t&-t,o>=a||o===32&&(a&4194048)!==0)?t:r}function fc(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function oz(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function RC(){var e=yf;return yf<<=1,(yf&62914560)===0&&(yf=4194304),e}function bg(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function pc(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function iz(e,t,a,n,r,o){var i=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var s=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(a=i&~a;0<a;){var c=31-pn(a),d=1<<c;s[c]=0,l[c]=-1;var p=u[c];if(p!==null)for(u[c]=null,c=0;c<p.length;c++){var m=p[c];m!==null&&(m.lane&=-536870913)}a&=~d}n!==0&&DC(e,n,0),o!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=o&~(i&~t))}function DC(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var n=31-pn(t);e.entangledLanes|=t,e.entanglements[n]=e.entanglements[n]|1073741824|a&261930}function _C(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var n=31-pn(a),r=1<<n;r&t|e[n]&t&&(e[n]|=t),a&=~r}}function PC(e,t){var a=t&-t;return a=(a&42)!==0?1:Xy(a),(a&(e.suspendedLanes|t))!==0?0:a}function Xy(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ky(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function OC(){var e=lt.p;return e!==0?e:(e=window.event,e===void 0?32:r1(e.type))}function e0(e,t){var a=lt.p;try{return lt.p=e,t()}finally{lt.p=a}}var Uo=Math.random().toString(36).slice(2),wa="__reactFiber$"+Uo,Xa="__reactProps$"+Uo,cl="__reactContainer$"+Uo,ry="__reactEvents$"+Uo,sz="__reactListeners$"+Uo,lz="__reactHandles$"+Uo,t0="__reactResources$"+Uo,mc="__reactMarker$"+Uo;function Yy(e){delete e[wa],delete e[Xa],delete e[ry],delete e[sz],delete e[lz]}function Ns(e){var t=e[wa];if(t)return t;for(var a=e.parentNode;a;){if(t=a[cl]||a[wa]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=uC(e);e!==null;){if(a=e[wa])return a;e=uC(e)}return t}e=a,a=e.parentNode}return null}function dl(e){if(e=e[wa]||e[cl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Pu(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(z(33))}function Ws(e){var t=e[t0];return t||(t=e[t0]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function fa(e){e[mc]=!0}var NC=new Set,UC={};function Li(e,t){el(e,t),el(e+"Capture",t)}function el(e,t){for(UC[e]=t,e=0;e<t.length;e++)NC.add(t[e])}var uz=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),a0={},n0={};function cz(e){return ny.call(n0,e)?!0:ny.call(a0,e)?!1:uz.test(e)?n0[e]=!0:(a0[e]=!0,!1)}function Df(e,t,a){if(cz(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var n=t.toLowerCase().slice(0,5);if(n!=="data-"&&n!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function wf(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Lr(e,t,a,n){if(n===null)e.removeAttribute(a);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+n)}}function Tn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function BC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function dz(e,t,a){var n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(i){a=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return a},setValue:function(i){a=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function oy(e){if(!e._valueTracker){var t=BC(e)?"checked":"value";e._valueTracker=dz(e,t,""+e[t])}}function zC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),n="";return e&&(n=BC(e)?e.checked?"true":"false":e.value),e=n,e!==a?(t.setValue(e),!0):!1}function Zf(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var fz=/[\n"\\]/g;function An(e){return e.replace(fz,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function iy(e,t,a,n,r,o,i,s){e.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?e.type=i:e.removeAttribute("type"),t!=null?i==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Tn(t)):e.value!==""+Tn(t)&&(e.value=""+Tn(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?sy(e,i,Tn(t)):a!=null?sy(e,i,Tn(a)):n!=null&&e.removeAttribute("value"),r==null&&o!=null&&(e.defaultChecked=!!o),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?e.name=""+Tn(s):e.removeAttribute("name")}function FC(e,t,a,n,r,o,i,s){if(o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.type=o),t!=null||a!=null){if(!(o!=="submit"&&o!=="reset"||t!=null)){oy(e);return}a=a!=null?""+Tn(a):"",t=t!=null?""+Tn(t):a,s||t===e.value||(e.value=t),e.defaultValue=t}n=n??r,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=s?e.checked:!!n,e.defaultChecked=!!n,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.name=i),oy(e)}function sy(e,t,a){t==="number"&&Zf(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Gs(e,t,a,n){if(e=e.options,t){t={};for(var r=0;r<a.length;r++)t["$"+a[r]]=!0;for(a=0;a<e.length;a++)r=t.hasOwnProperty("$"+e[a].value),e[a].selected!==r&&(e[a].selected=r),r&&n&&(e[a].defaultSelected=!0)}else{for(a=""+Tn(a),t=null,r=0;r<e.length;r++){if(e[r].value===a){e[r].selected=!0,n&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function qC(e,t,a){if(t!=null&&(t=""+Tn(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Tn(a):""}function HC(e,t,a,n){if(t==null){if(n!=null){if(a!=null)throw Error(z(92));if(_u(n)){if(1<n.length)throw Error(z(93));n=n[0]}a=n}a==null&&(a=""),t=a}a=Tn(t),e.defaultValue=a,n=e.textContent,n===a&&n!==""&&n!==null&&(e.value=n),oy(e)}function tl(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var pz=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function r0(e,t,a){var n=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?n?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":n?e.setProperty(t,a):typeof a!="number"||a===0||pz.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function jC(e,t,a){if(t!=null&&typeof t!="object")throw Error(z(62));if(e=e.style,a!=null){for(var n in a)!a.hasOwnProperty(n)||t!=null&&t.hasOwnProperty(n)||(n.indexOf("--")===0?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="");for(var r in t)n=t[r],t.hasOwnProperty(r)&&a[r]!==n&&r0(e,r,n)}else for(var o in t)t.hasOwnProperty(o)&&r0(e,o,t[o])}function Zy(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mz=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),hz=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function _f(e){return hz.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Or(){}var ly=null;function Jy(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Us=null,Xs=null;function o0(e){var t=dl(e);if(t&&(e=t.stateNode)){var a=e[Xa]||null;e:switch(e=t.stateNode,t.type){case"input":if(iy(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+An(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var n=a[t];if(n!==e&&n.form===e.form){var r=n[Xa]||null;if(!r)throw Error(z(90));iy(n,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<a.length;t++)n=a[t],n.form===e.form&&zC(n)}break e;case"textarea":qC(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Gs(e,!!a.multiple,t,!1)}}}var Sg=!1;function VC(e,t,a){if(Sg)return e(t,a);Sg=!0;try{var n=e(t);return n}finally{if(Sg=!1,(Us!==null||Xs!==null)&&(Pp(),Us&&(t=Us,e=Xs,Xs=Us=null,o0(t),e)))for(t=0;t<e.length;t++)o0(e[t])}}function Zu(e,t){var a=e.stateNode;if(a===null)return null;var n=a[Xa]||null;if(n===null)return null;a=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(z(231,t,typeof a));return a}var Fr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),uy=!1;if(Fr)try{As={},Object.defineProperty(As,"passive",{get:function(){uy=!0}}),window.addEventListener("test",As,As),window.removeEventListener("test",As,As)}catch{uy=!1}var As,xo=null,Qy=null,Pf=null;function $C(){if(Pf)return Pf;var e,t=Qy,a=t.length,n,r="value"in xo?xo.value:xo.textContent,o=r.length;for(e=0;e<a&&t[e]===r[e];e++);var i=a-e;for(n=1;n<=i&&t[a-n]===r[o-n];n++);return Pf=r.slice(e,1<n?1-n:void 0)}function Of(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function vf(){return!0}function i0(){return!1}function Ka(e){function t(a,n,r,o,i){this._reactName=a,this._targetInst=r,this.type=n,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var s in e)e.hasOwnProperty(s)&&(a=e[s],this[s]=a?a(o):o[s]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?vf:i0,this.isPropagationStopped=i0,this}return Lt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=vf)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=vf)},persist:function(){},isPersistent:vf}),t}var Ei={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ip=Ka(Ei),hc=Lt({},Ei,{view:0,detail:0}),gz=Ka(hc),Ig,Cg,Tu,Cp=Lt({},hc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ew,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Tu&&(Tu&&e.type==="mousemove"?(Ig=e.screenX-Tu.screenX,Cg=e.screenY-Tu.screenY):Cg=Ig=0,Tu=e),Ig)},movementY:function(e){return"movementY"in e?e.movementY:Cg}}),s0=Ka(Cp),yz=Lt({},Cp,{dataTransfer:0}),wz=Ka(yz),vz=Lt({},hc,{relatedTarget:0}),kg=Ka(vz),xz=Lt({},Ei,{animationName:0,elapsedTime:0,pseudoElement:0}),bz=Ka(xz),Sz=Lt({},Ei,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Iz=Ka(Sz),Cz=Lt({},Ei,{data:0}),l0=Ka(Cz),kz={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Tz={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Lz={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ez(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Lz[e])?!!t[e]:!1}function ew(){return Ez}var Az=Lt({},hc,{key:function(e){if(e.key){var t=kz[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Of(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Tz[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ew,charCode:function(e){return e.type==="keypress"?Of(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Of(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Mz=Ka(Az),Rz=Lt({},Cp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),u0=Ka(Rz),Dz=Lt({},hc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ew}),_z=Ka(Dz),Pz=Lt({},Ei,{propertyName:0,elapsedTime:0,pseudoElement:0}),Oz=Ka(Pz),Nz=Lt({},Cp,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Uz=Ka(Nz),Bz=Lt({},Ei,{newState:0,oldState:0}),zz=Ka(Bz),Fz=[9,13,27,32],tw=Fr&&"CompositionEvent"in window,Uu=null;Fr&&"documentMode"in document&&(Uu=document.documentMode);var qz=Fr&&"TextEvent"in window&&!Uu,WC=Fr&&(!tw||Uu&&8<Uu&&11>=Uu),c0=" ",d0=!1;function GC(e,t){switch(e){case"keyup":return Fz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function XC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bs=!1;function Hz(e,t){switch(e){case"compositionend":return XC(t);case"keypress":return t.which!==32?null:(d0=!0,c0);case"textInput":return e=t.data,e===c0&&d0?null:e;default:return null}}function jz(e,t){if(Bs)return e==="compositionend"||!tw&&GC(e,t)?(e=$C(),Pf=Qy=xo=null,Bs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return WC&&t.locale!=="ko"?null:t.data;default:return null}}var Vz={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function f0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Vz[e.type]:t==="textarea"}function KC(e,t,a,n){Us?Xs?Xs.push(n):Xs=[n]:Us=n,t=hp(t,"onChange"),0<t.length&&(a=new Ip("onChange","change",null,a,n),e.push({event:a,listeners:t}))}var Bu=null,Ju=null;function $z(e){VT(e,0)}function kp(e){var t=Pu(e);if(zC(t))return e}function p0(e,t){if(e==="change")return t}var YC=!1;Fr&&(Fr?(bf="oninput"in document,bf||(Tg=document.createElement("div"),Tg.setAttribute("oninput","return;"),bf=typeof Tg.oninput=="function"),xf=bf):xf=!1,YC=xf&&(!document.documentMode||9<document.documentMode));var xf,bf,Tg;function m0(){Bu&&(Bu.detachEvent("onpropertychange",ZC),Ju=Bu=null)}function ZC(e){if(e.propertyName==="value"&&kp(Ju)){var t=[];KC(t,Ju,e,Jy(e)),VC($z,t)}}function Wz(e,t,a){e==="focusin"?(m0(),Bu=t,Ju=a,Bu.attachEvent("onpropertychange",ZC)):e==="focusout"&&m0()}function Gz(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return kp(Ju)}function Xz(e,t){if(e==="click")return kp(t)}function Kz(e,t){if(e==="input"||e==="change")return kp(t)}function Yz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var hn=typeof Object.is=="function"?Object.is:Yz;function Qu(e,t){if(hn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(n=0;n<a.length;n++){var r=a[n];if(!ny.call(t,r)||!hn(e[r],t[r]))return!1}return!0}function h0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function g0(e,t){var a=h0(e);e=0;for(var n;a;){if(a.nodeType===3){if(n=e+a.textContent.length,e<=t&&n>=t)return{node:a,offset:t-e};e=n}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=h0(a)}}function JC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?JC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function QC(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Zf(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=Zf(e.document)}return t}function aw(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Zz=Fr&&"documentMode"in document&&11>=document.documentMode,zs=null,cy=null,zu=null,dy=!1;function y0(e,t,a){var n=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;dy||zs==null||zs!==Zf(n)||(n=zs,"selectionStart"in n&&aw(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),zu&&Qu(zu,n)||(zu=n,n=hp(cy,"onSelect"),0<n.length&&(t=new Ip("onSelect","select",null,t,a),e.push({event:t,listeners:n}),t.target=zs)))}function fi(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Fs={animationend:fi("Animation","AnimationEnd"),animationiteration:fi("Animation","AnimationIteration"),animationstart:fi("Animation","AnimationStart"),transitionrun:fi("Transition","TransitionRun"),transitionstart:fi("Transition","TransitionStart"),transitioncancel:fi("Transition","TransitionCancel"),transitionend:fi("Transition","TransitionEnd")},Lg={},ek={};Fr&&(ek=document.createElement("div").style,"AnimationEvent"in window||(delete Fs.animationend.animation,delete Fs.animationiteration.animation,delete Fs.animationstart.animation),"TransitionEvent"in window||delete Fs.transitionend.transition);function Ai(e){if(Lg[e])return Lg[e];if(!Fs[e])return e;var t=Fs[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in ek)return Lg[e]=t[a];return e}var tk=Ai("animationend"),ak=Ai("animationiteration"),nk=Ai("animationstart"),Jz=Ai("transitionrun"),Qz=Ai("transitionstart"),eF=Ai("transitioncancel"),rk=Ai("transitionend"),ok=new Map,fy="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");fy.push("scrollEnd");function Gn(e,t){ok.set(e,t),Li(t,[e])}var Jf=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},kn=[],qs=0,nw=0;function Tp(){for(var e=qs,t=nw=qs=0;t<e;){var a=kn[t];kn[t++]=null;var n=kn[t];kn[t++]=null;var r=kn[t];kn[t++]=null;var o=kn[t];if(kn[t++]=null,n!==null&&r!==null){var i=n.pending;i===null?r.next=r:(r.next=i.next,i.next=r),n.pending=r}o!==0&&ik(a,r,o)}}function Lp(e,t,a,n){kn[qs++]=e,kn[qs++]=t,kn[qs++]=a,kn[qs++]=n,nw|=n,e.lanes|=n,e=e.alternate,e!==null&&(e.lanes|=n)}function rw(e,t,a,n){return Lp(e,t,a,n),Qf(e)}function Mi(e,t){return Lp(e,null,null,t),Qf(e)}function ik(e,t,a){e.lanes|=a;var n=e.alternate;n!==null&&(n.lanes|=a);for(var r=!1,o=e.return;o!==null;)o.childLanes|=a,n=o.alternate,n!==null&&(n.childLanes|=a),o.tag===22&&(e=o.stateNode,e===null||e._visibility&1||(r=!0)),e=o,o=o.return;return e.tag===3?(o=e.stateNode,r&&t!==null&&(r=31-pn(a),e=o.hiddenUpdates,n=e[r],n===null?e[r]=[t]:n.push(t),t.lane=a|536870912),o):null}function Qf(e){if(50<Xu)throw Xu=0,_y=null,Error(z(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Hs={};function tF(e,t,a,n){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function un(e,t,a,n){return new tF(e,t,a,n)}function ow(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ur(e,t){var a=e.alternate;return a===null?(a=un(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function sk(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Nf(e,t,a,n,r,o){var i=0;if(n=e,typeof e=="function")ow(e)&&(i=1);else if(typeof e=="string")i=rq(e,a,cr.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Qg:return e=un(31,a,t,r),e.elementType=Qg,e.lanes=o,e;case Ps:return wi(a.children,r,o,t);case TC:i=8,r|=24;break;case Yg:return e=un(12,a,t,r|2),e.elementType=Yg,e.lanes=o,e;case Zg:return e=un(13,a,t,r),e.elementType=Zg,e.lanes=o,e;case Jg:return e=un(19,a,t,r),e.elementType=Jg,e.lanes=o,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Pr:i=10;break e;case LC:i=9;break e;case $y:i=11;break e;case Wy:i=14;break e;case po:i=16,n=null;break e}i=29,a=Error(z(130,e===null?"null":typeof e,"")),n=null}return t=un(i,a,t,r),t.elementType=e,t.type=n,t.lanes=o,t}function wi(e,t,a,n){return e=un(7,e,n,t),e.lanes=a,e}function Eg(e,t,a){return e=un(6,e,null,t),e.lanes=a,e}function lk(e){var t=un(18,null,null,0);return t.stateNode=e,t}function Ag(e,t,a){return t=un(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var w0=new WeakMap;function Mn(e,t){if(typeof e=="object"&&e!==null){var a=w0.get(e);return a!==void 0?a:(t={value:e,source:t,stack:QI(t)},w0.set(e,t),t)}return{value:e,source:t,stack:QI(t)}}var js=[],Vs=0,ep=null,ec=0,Ln=[],En=0,_o=null,sr=1,lr="";function Dr(e,t){js[Vs++]=ec,js[Vs++]=ep,ep=e,ec=t}function uk(e,t,a){Ln[En++]=sr,Ln[En++]=lr,Ln[En++]=_o,_o=e;var n=sr;e=lr;var r=32-pn(n)-1;n&=~(1<<r),a+=1;var o=32-pn(t)+r;if(30<o){var i=r-r%5;o=(n&(1<<i)-1).toString(32),n>>=i,r-=i,sr=1<<32-pn(t)+r|a<<r|n,lr=o+e}else sr=1<<o|a<<r|n,lr=e}function iw(e){e.return!==null&&(Dr(e,1),uk(e,1,0))}function sw(e){for(;e===ep;)ep=js[--Vs],js[Vs]=null,ec=js[--Vs],js[Vs]=null;for(;e===_o;)_o=Ln[--En],Ln[En]=null,lr=Ln[--En],Ln[En]=null,sr=Ln[--En],Ln[En]=null}function ck(e,t){Ln[En++]=sr,Ln[En++]=lr,Ln[En++]=_o,sr=t.id,lr=t.overflow,_o=e}var va=null,Tt=null,Ze=!1,ko=null,Rn=!1,py=Error(z(519));function Po(e){var t=Error(z(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw tc(Mn(t,e)),py}function v0(e){var t=e.stateNode,a=e.type,n=e.memoizedProps;switch(t[wa]=e,t[Xa]=n,a){case"dialog":Ge("cancel",t),Ge("close",t);break;case"iframe":case"object":case"embed":Ge("load",t);break;case"video":case"audio":for(a=0;a<oc.length;a++)Ge(oc[a],t);break;case"source":Ge("error",t);break;case"img":case"image":case"link":Ge("error",t),Ge("load",t);break;case"details":Ge("toggle",t);break;case"input":Ge("invalid",t),FC(t,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0);break;case"select":Ge("invalid",t);break;case"textarea":Ge("invalid",t),HC(t,n.value,n.defaultValue,n.children)}a=n.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||n.suppressHydrationWarning===!0||WT(t.textContent,a)?(n.popover!=null&&(Ge("beforetoggle",t),Ge("toggle",t)),n.onScroll!=null&&Ge("scroll",t),n.onScrollEnd!=null&&Ge("scrollend",t),n.onClick!=null&&(t.onclick=Or),t=!0):t=!1,t||Po(e,!0)}function x0(e){for(va=e.return;va;)switch(va.tag){case 5:case 31:case 13:Rn=!1;return;case 27:case 3:Rn=!0;return;default:va=va.return}}function Ms(e){if(e!==va)return!1;if(!Ze)return x0(e),Ze=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||By(e.type,e.memoizedProps)),a=!a),a&&Tt&&Po(e),x0(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(z(317));Tt=lC(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(z(317));Tt=lC(e)}else t===27?(t=Tt,Bo(e.type)?(e=Hy,Hy=null,Tt=e):Tt=t):Tt=va?_n(e.stateNode.nextSibling):null;return!0}function Si(){Tt=va=null,Ze=!1}function Mg(){var e=ko;return e!==null&&(Wa===null?Wa=e:Wa.push.apply(Wa,e),ko=null),e}function tc(e){ko===null?ko=[e]:ko.push(e)}var my=dr(null),Ri=null,Nr=null;function ho(e,t,a){St(my,t._currentValue),t._currentValue=a}function Br(e){e._currentValue=my.current,pa(my)}function hy(e,t,a){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===a)break;e=e.return}}function gy(e,t,a,n){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var o=r.dependencies;if(o!==null){var i=r.child;o=o.firstContext;e:for(;o!==null;){var s=o;o=r;for(var l=0;l<t.length;l++)if(s.context===t[l]){o.lanes|=a,s=o.alternate,s!==null&&(s.lanes|=a),hy(o.return,a,e),n||(i=null);break e}o=s.next}}else if(r.tag===18){if(i=r.return,i===null)throw Error(z(341));i.lanes|=a,o=i.alternate,o!==null&&(o.lanes|=a),hy(i,a,e),i=null}else i=r.child;if(i!==null)i.return=r;else for(i=r;i!==null;){if(i===e){i=null;break}if(r=i.sibling,r!==null){r.return=i.return,i=r;break}i=i.return}r=i}}function fl(e,t,a,n){e=null;for(var r=t,o=!1;r!==null;){if(!o){if((r.flags&524288)!==0)o=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var i=r.alternate;if(i===null)throw Error(z(387));if(i=i.memoizedProps,i!==null){var s=r.type;hn(r.pendingProps.value,i.value)||(e!==null?e.push(s):e=[s])}}else if(r===Gf.current){if(i=r.alternate,i===null)throw Error(z(387));i.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(sc):e=[sc])}r=r.return}e!==null&&gy(t,e,a,n),t.flags|=262144}function tp(e){for(e=e.firstContext;e!==null;){if(!hn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ii(e){Ri=e,Nr=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function xa(e){return dk(Ri,e)}function Sf(e,t){return Ri===null&&Ii(e),dk(e,t)}function dk(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Nr===null){if(e===null)throw Error(z(308));Nr=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Nr=Nr.next=t;return a}var aF=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},nF=sa.unstable_scheduleCallback,rF=sa.unstable_NormalPriority,na={$$typeof:Pr,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lw(){return{controller:new aF,data:new Map,refCount:0}}function gc(e){e.refCount--,e.refCount===0&&nF(rF,function(){e.controller.abort()})}var Fu=null,yy=0,al=0,Ks=null;function oF(e,t){if(Fu===null){var a=Fu=[];yy=0,al=_w(),Ks={status:"pending",value:void 0,then:function(n){a.push(n)}}}return yy++,t.then(b0,b0),t}function b0(){if(--yy===0&&Fu!==null){Ks!==null&&(Ks.status="fulfilled");var e=Fu;Fu=null,al=0,Ks=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function iF(e,t){var a=[],n={status:"pending",value:null,reason:null,then:function(r){a.push(r)}};return e.then(function(){n.status="fulfilled",n.value=t;for(var r=0;r<a.length;r++)(0,a[r])(t)},function(r){for(n.status="rejected",n.reason=r,r=0;r<a.length;r++)(0,a[r])(void 0)}),n}var S0=Te.S;Te.S=function(e,t){kT=dn(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&oF(e,t),S0!==null&&S0(e,t)};var vi=dr(null);function uw(){var e=vi.current;return e!==null?e:vt.pooledCache}function Uf(e,t){t===null?St(vi,vi.current):St(vi,t.pool)}function fk(){var e=uw();return e===null?null:{parent:na._currentValue,pool:e}}var pl=Error(z(460)),cw=Error(z(474)),Ep=Error(z(542)),ap={then:function(){}};function I0(e){return e=e.status,e==="fulfilled"||e==="rejected"}function pk(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(Or,Or),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,k0(e),e;default:if(typeof t.status=="string")t.then(Or,Or);else{if(e=vt,e!==null&&100<e.shellSuspendCounter)throw Error(z(482));e=t,e.status="pending",e.then(function(n){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=n}},function(n){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=n}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,k0(e),e}throw xi=t,pl}}function hi(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(xi=a,pl):a}}var xi=null;function C0(){if(xi===null)throw Error(z(459));var e=xi;return xi=null,e}function k0(e){if(e===pl||e===Ep)throw Error(z(483))}var Ys=null,ac=0;function If(e){var t=ac;return ac+=1,Ys===null&&(Ys=[]),pk(Ys,e,t)}function Lu(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Cf(e,t){throw t.$$typeof===W3?Error(z(525)):(e=Object.prototype.toString.call(t),Error(z(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function mk(e){function t(y,w){if(e){var g=y.deletions;g===null?(y.deletions=[w],y.flags|=16):g.push(w)}}function a(y,w){if(!e)return null;for(;w!==null;)t(y,w),w=w.sibling;return null}function n(y){for(var w=new Map;y!==null;)y.key!==null?w.set(y.key,y):w.set(y.index,y),y=y.sibling;return w}function r(y,w){return y=Ur(y,w),y.index=0,y.sibling=null,y}function o(y,w,g){return y.index=g,e?(g=y.alternate,g!==null?(g=g.index,g<w?(y.flags|=67108866,w):g):(y.flags|=67108866,w)):(y.flags|=1048576,w)}function i(y){return e&&y.alternate===null&&(y.flags|=67108866),y}function s(y,w,g,S){return w===null||w.tag!==6?(w=Eg(g,y.mode,S),w.return=y,w):(w=r(w,g),w.return=y,w)}function l(y,w,g,S){var E=g.type;return E===Ps?c(y,w,g.props.children,S,g.key):w!==null&&(w.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===po&&hi(E)===w.type)?(w=r(w,g.props),Lu(w,g),w.return=y,w):(w=Nf(g.type,g.key,g.props,null,y.mode,S),Lu(w,g),w.return=y,w)}function u(y,w,g,S){return w===null||w.tag!==4||w.stateNode.containerInfo!==g.containerInfo||w.stateNode.implementation!==g.implementation?(w=Ag(g,y.mode,S),w.return=y,w):(w=r(w,g.children||[]),w.return=y,w)}function c(y,w,g,S,E){return w===null||w.tag!==7?(w=wi(g,y.mode,S,E),w.return=y,w):(w=r(w,g),w.return=y,w)}function d(y,w,g){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return w=Eg(""+w,y.mode,g),w.return=y,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case mf:return g=Nf(w.type,w.key,w.props,null,y.mode,g),Lu(g,w),g.return=y,g;case Du:return w=Ag(w,y.mode,g),w.return=y,w;case po:return w=hi(w),d(y,w,g)}if(_u(w)||ku(w))return w=wi(w,y.mode,g,null),w.return=y,w;if(typeof w.then=="function")return d(y,If(w),g);if(w.$$typeof===Pr)return d(y,Sf(y,w),g);Cf(y,w)}return null}function p(y,w,g,S){var E=w!==null?w.key:null;if(typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint")return E!==null?null:s(y,w,""+g,S);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case mf:return g.key===E?l(y,w,g,S):null;case Du:return g.key===E?u(y,w,g,S):null;case po:return g=hi(g),p(y,w,g,S)}if(_u(g)||ku(g))return E!==null?null:c(y,w,g,S,null);if(typeof g.then=="function")return p(y,w,If(g),S);if(g.$$typeof===Pr)return p(y,w,Sf(y,g),S);Cf(y,g)}return null}function m(y,w,g,S,E){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return y=y.get(g)||null,s(w,y,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case mf:return y=y.get(S.key===null?g:S.key)||null,l(w,y,S,E);case Du:return y=y.get(S.key===null?g:S.key)||null,u(w,y,S,E);case po:return S=hi(S),m(y,w,g,S,E)}if(_u(S)||ku(S))return y=y.get(g)||null,c(w,y,S,E,null);if(typeof S.then=="function")return m(y,w,g,If(S),E);if(S.$$typeof===Pr)return m(y,w,g,Sf(w,S),E);Cf(w,S)}return null}function h(y,w,g,S){for(var E=null,T=null,R=w,O=w=0,U=null;R!==null&&O<g.length;O++){R.index>O?(U=R,R=null):U=R.sibling;var A=p(y,R,g[O],S);if(A===null){R===null&&(R=U);break}e&&R&&A.alternate===null&&t(y,R),w=o(A,w,O),T===null?E=A:T.sibling=A,T=A,R=U}if(O===g.length)return a(y,R),Ze&&Dr(y,O),E;if(R===null){for(;O<g.length;O++)R=d(y,g[O],S),R!==null&&(w=o(R,w,O),T===null?E=R:T.sibling=R,T=R);return Ze&&Dr(y,O),E}for(R=n(R);O<g.length;O++)U=m(R,y,O,g[O],S),U!==null&&(e&&U.alternate!==null&&R.delete(U.key===null?O:U.key),w=o(U,w,O),T===null?E=U:T.sibling=U,T=U);return e&&R.forEach(function(Q){return t(y,Q)}),Ze&&Dr(y,O),E}function v(y,w,g,S){if(g==null)throw Error(z(151));for(var E=null,T=null,R=w,O=w=0,U=null,A=g.next();R!==null&&!A.done;O++,A=g.next()){R.index>O?(U=R,R=null):U=R.sibling;var Q=p(y,R,A.value,S);if(Q===null){R===null&&(R=U);break}e&&R&&Q.alternate===null&&t(y,R),w=o(Q,w,O),T===null?E=Q:T.sibling=Q,T=Q,R=U}if(A.done)return a(y,R),Ze&&Dr(y,O),E;if(R===null){for(;!A.done;O++,A=g.next())A=d(y,A.value,S),A!==null&&(w=o(A,w,O),T===null?E=A:T.sibling=A,T=A);return Ze&&Dr(y,O),E}for(R=n(R);!A.done;O++,A=g.next())A=m(R,y,O,A.value,S),A!==null&&(e&&A.alternate!==null&&R.delete(A.key===null?O:A.key),w=o(A,w,O),T===null?E=A:T.sibling=A,T=A);return e&&R.forEach(function($){return t(y,$)}),Ze&&Dr(y,O),E}function I(y,w,g,S){if(typeof g=="object"&&g!==null&&g.type===Ps&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case mf:e:{for(var E=g.key;w!==null;){if(w.key===E){if(E=g.type,E===Ps){if(w.tag===7){a(y,w.sibling),S=r(w,g.props.children),S.return=y,y=S;break e}}else if(w.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===po&&hi(E)===w.type){a(y,w.sibling),S=r(w,g.props),Lu(S,g),S.return=y,y=S;break e}a(y,w);break}else t(y,w);w=w.sibling}g.type===Ps?(S=wi(g.props.children,y.mode,S,g.key),S.return=y,y=S):(S=Nf(g.type,g.key,g.props,null,y.mode,S),Lu(S,g),S.return=y,y=S)}return i(y);case Du:e:{for(E=g.key;w!==null;){if(w.key===E)if(w.tag===4&&w.stateNode.containerInfo===g.containerInfo&&w.stateNode.implementation===g.implementation){a(y,w.sibling),S=r(w,g.children||[]),S.return=y,y=S;break e}else{a(y,w);break}else t(y,w);w=w.sibling}S=Ag(g,y.mode,S),S.return=y,y=S}return i(y);case po:return g=hi(g),I(y,w,g,S)}if(_u(g))return h(y,w,g,S);if(ku(g)){if(E=ku(g),typeof E!="function")throw Error(z(150));return g=E.call(g),v(y,w,g,S)}if(typeof g.then=="function")return I(y,w,If(g),S);if(g.$$typeof===Pr)return I(y,w,Sf(y,g),S);Cf(y,g)}return typeof g=="string"&&g!==""||typeof g=="number"||typeof g=="bigint"?(g=""+g,w!==null&&w.tag===6?(a(y,w.sibling),S=r(w,g),S.return=y,y=S):(a(y,w),S=Eg(g,y.mode,S),S.return=y,y=S),i(y)):a(y,w)}return function(y,w,g,S){try{ac=0;var E=I(y,w,g,S);return Ys=null,E}catch(R){if(R===pl||R===Ep)throw R;var T=un(29,R,null,y.mode);return T.lanes=S,T.return=y,T}}}var Ci=mk(!0),hk=mk(!1),mo=!1;function dw(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wy(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function To(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Lo(e,t,a){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(st&2)!==0){var r=n.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),n.pending=t,t=Qf(e),ik(e,null,a),t}return Lp(e,n,t,a),Qf(e)}function qu(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,_C(e,a)}}function Rg(e,t){var a=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,a===n)){var r=null,o=null;if(a=a.firstBaseUpdate,a!==null){do{var i={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};o===null?r=o=i:o=o.next=i,a=a.next}while(a!==null);o===null?r=o=t:o=o.next=t}else r=o=t;a={baseState:n.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:n.shared,callbacks:n.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var vy=!1;function Hu(){if(vy){var e=Ks;if(e!==null)throw e}}function ju(e,t,a,n){vy=!1;var r=e.updateQueue;mo=!1;var o=r.firstBaseUpdate,i=r.lastBaseUpdate,s=r.shared.pending;if(s!==null){r.shared.pending=null;var l=s,u=l.next;l.next=null,i===null?o=u:i.next=u,i=l;var c=e.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==i&&(s===null?c.firstBaseUpdate=u:s.next=u,c.lastBaseUpdate=l))}if(o!==null){var d=r.baseState;i=0,c=u=l=null,s=o;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Ke&p)===p:(n&p)===p){p!==0&&p===al&&(vy=!0),c!==null&&(c=c.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var h=e,v=s;p=t;var I=a;switch(v.tag){case 1:if(h=v.payload,typeof h=="function"){d=h.call(I,d,p);break e}d=h;break e;case 3:h.flags=h.flags&-65537|128;case 0:if(h=v.payload,p=typeof h=="function"?h.call(I,d,p):h,p==null)break e;d=Lt({},d,p);break e;case 2:mo=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=r.callbacks,m===null?r.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(u=c=m,l=d):c=c.next=m,i|=p;if(s=s.next,s===null){if(s=r.shared.pending,s===null)break;m=s,s=m.next,m.next=null,r.lastBaseUpdate=m,r.shared.pending=null}}while(!0);c===null&&(l=d),r.baseState=l,r.firstBaseUpdate=u,r.lastBaseUpdate=c,o===null&&(r.shared.lanes=0),No|=i,e.lanes=i,e.memoizedState=d}}function gk(e,t){if(typeof e!="function")throw Error(z(191,e));e.call(t)}function yk(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)gk(a[e],t)}var nl=dr(null),np=dr(0);function T0(e,t){e=Vr,St(np,e),St(nl,t),Vr=e|t.baseLanes}function xy(){St(np,Vr),St(nl,nl.current)}function fw(){Vr=np.current,pa(nl),pa(np)}var gn=dr(null),Dn=null;function go(e){var t=e.alternate;St(Yt,Yt.current&1),St(gn,e),Dn===null&&(t===null||nl.current!==null||t.memoizedState!==null)&&(Dn=e)}function by(e){St(Yt,Yt.current),St(gn,e),Dn===null&&(Dn=e)}function wk(e){e.tag===22?(St(Yt,Yt.current),St(gn,e),Dn===null&&(Dn=e)):yo(e)}function yo(){St(Yt,Yt.current),St(gn,gn.current)}function ln(e){pa(gn),Dn===e&&(Dn=null),pa(Yt)}var Yt=dr(0);function rp(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Fy(a)||qy(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var qr=0,Pe=null,yt=null,ta=null,op=!1,Zs=!1,ki=!1,ip=0,nc=0,Js=null,sF=0;function Ht(){throw Error(z(321))}function pw(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!hn(e[a],t[a]))return!1;return!0}function mw(e,t,a,n,r,o){return qr=o,Pe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Te.H=e===null||e.memoizedState===null?Kk:kw,ki=!1,o=a(n,r),ki=!1,Zs&&(o=xk(t,a,n,r)),vk(e),o}function vk(e){Te.H=rc;var t=yt!==null&&yt.next!==null;if(qr=0,ta=yt=Pe=null,op=!1,nc=0,Js=null,t)throw Error(z(300));e===null||ra||(e=e.dependencies,e!==null&&tp(e)&&(ra=!0))}function xk(e,t,a,n){Pe=e;var r=0;do{if(Zs&&(Js=null),nc=0,Zs=!1,25<=r)throw Error(z(301));if(r+=1,ta=yt=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}Te.H=Yk,o=t(a,n)}while(Zs);return o}function lF(){var e=Te.H,t=e.useState()[0];return t=typeof t.then=="function"?yc(t):t,e=e.useState()[0],(yt!==null?yt.memoizedState:null)!==e&&(Pe.flags|=1024),t}function hw(){var e=ip!==0;return ip=0,e}function gw(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function yw(e){if(op){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}op=!1}qr=0,ta=yt=Pe=null,Zs=!1,nc=ip=0,Js=null}function Oa(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ta===null?Pe.memoizedState=ta=e:ta=ta.next=e,ta}function Zt(){if(yt===null){var e=Pe.alternate;e=e!==null?e.memoizedState:null}else e=yt.next;var t=ta===null?Pe.memoizedState:ta.next;if(t!==null)ta=t,yt=e;else{if(e===null)throw Pe.alternate===null?Error(z(467)):Error(z(310));yt=e,e={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},ta===null?Pe.memoizedState=ta=e:ta=ta.next=e}return ta}function Ap(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function yc(e){var t=nc;return nc+=1,Js===null&&(Js=[]),e=pk(Js,e,t),t=Pe,(ta===null?t.memoizedState:ta.next)===null&&(t=t.alternate,Te.H=t===null||t.memoizedState===null?Kk:kw),e}function Mp(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return yc(e);if(e.$$typeof===Pr)return xa(e)}throw Error(z(438,String(e)))}function ww(e){var t=null,a=Pe.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var n=Pe.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(t={data:n.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Ap(),Pe.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),n=0;n<e;n++)a[n]=G3;return t.index++,a}function Hr(e,t){return typeof t=="function"?t(e):t}function Bf(e){var t=Zt();return vw(t,yt,e)}function vw(e,t,a){var n=e.queue;if(n===null)throw Error(z(311));n.lastRenderedReducer=a;var r=e.baseQueue,o=n.pending;if(o!==null){if(r!==null){var i=r.next;r.next=o.next,o.next=i}t.baseQueue=r=o,n.pending=null}if(o=e.baseState,r===null)e.memoizedState=o;else{t=r.next;var s=i=null,l=null,u=t,c=!1;do{var d=u.lane&-536870913;if(d!==u.lane?(Ke&d)===d:(qr&d)===d){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),d===al&&(c=!0);else if((qr&p)===p){u=u.next,p===al&&(c=!0);continue}else d={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(s=l=d,i=o):l=l.next=d,Pe.lanes|=p,No|=p;d=u.action,ki&&a(o,d),o=u.hasEagerState?u.eagerState:a(o,d)}else p={lane:d,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(s=l=p,i=o):l=l.next=p,Pe.lanes|=d,No|=d;u=u.next}while(u!==null&&u!==t);if(l===null?i=o:l.next=s,!hn(o,e.memoizedState)&&(ra=!0,c&&(a=Ks,a!==null)))throw a;e.memoizedState=o,e.baseState=i,e.baseQueue=l,n.lastRenderedState=o}return r===null&&(n.lanes=0),[e.memoizedState,n.dispatch]}function Dg(e){var t=Zt(),a=t.queue;if(a===null)throw Error(z(311));a.lastRenderedReducer=e;var n=a.dispatch,r=a.pending,o=t.memoizedState;if(r!==null){a.pending=null;var i=r=r.next;do o=e(o,i.action),i=i.next;while(i!==r);hn(o,t.memoizedState)||(ra=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),a.lastRenderedState=o}return[o,n]}function bk(e,t,a){var n=Pe,r=Zt(),o=Ze;if(o){if(a===void 0)throw Error(z(407));a=a()}else a=t();var i=!hn((yt||r).memoizedState,a);if(i&&(r.memoizedState=a,ra=!0),r=r.queue,xw(Ck.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||ta!==null&&ta.memoizedState.tag&1){if(n.flags|=2048,rl(9,{destroy:void 0},Ik.bind(null,n,r,a,t),null),vt===null)throw Error(z(349));o||(qr&127)!==0||Sk(n,t,a)}return a}function Sk(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=Pe.updateQueue,t===null?(t=Ap(),Pe.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Ik(e,t,a,n){t.value=a,t.getSnapshot=n,kk(t)&&Tk(e)}function Ck(e,t,a){return a(function(){kk(t)&&Tk(e)})}function kk(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!hn(e,a)}catch{return!0}}function Tk(e){var t=Mi(e,2);t!==null&&Ga(t,e,2)}function Sy(e){var t=Oa();if(typeof e=="function"){var a=e;if(e=a(),ki){vo(!0);try{a()}finally{vo(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:e},t}function Lk(e,t,a,n){return e.baseState=a,vw(e,yt,typeof n=="function"?n:Hr)}function uF(e,t,a,n,r){if(Dp(e))throw Error(z(485));if(e=t.action,e!==null){var o={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){o.listeners.push(i)}};Te.T!==null?a(!0):o.isTransition=!1,n(o),a=t.pending,a===null?(o.next=t.pending=o,Ek(t,o)):(o.next=a.next,t.pending=a.next=o)}}function Ek(e,t){var a=t.action,n=t.payload,r=e.state;if(t.isTransition){var o=Te.T,i={};Te.T=i;try{var s=a(r,n),l=Te.S;l!==null&&l(i,s),L0(e,t,s)}catch(u){Iy(e,t,u)}finally{o!==null&&i.types!==null&&(o.types=i.types),Te.T=o}}else try{o=a(r,n),L0(e,t,o)}catch(u){Iy(e,t,u)}}function L0(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(n){E0(e,t,n)},function(n){return Iy(e,t,n)}):E0(e,t,a)}function E0(e,t,a){t.status="fulfilled",t.value=a,Ak(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Ek(e,a)))}function Iy(e,t,a){var n=e.pending;if(e.pending=null,n!==null){n=n.next;do t.status="rejected",t.reason=a,Ak(t),t=t.next;while(t!==n)}e.action=null}function Ak(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Mk(e,t){return t}function A0(e,t){if(Ze){var a=vt.formState;if(a!==null){e:{var n=Pe;if(Ze){if(Tt){t:{for(var r=Tt,o=Rn;r.nodeType!==8;){if(!o){r=null;break t}if(r=_n(r.nextSibling),r===null){r=null;break t}}o=r.data,r=o==="F!"||o==="F"?r:null}if(r){Tt=_n(r.nextSibling),n=r.data==="F!";break e}}Po(n)}n=!1}n&&(t=a[0])}}return a=Oa(),a.memoizedState=a.baseState=t,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mk,lastRenderedState:t},a.queue=n,a=Wk.bind(null,Pe,n),n.dispatch=a,n=Sy(!1),o=Cw.bind(null,Pe,!1,n.queue),n=Oa(),r={state:t,dispatch:null,action:e,pending:null},n.queue=r,a=uF.bind(null,Pe,r,o,a),r.dispatch=a,n.memoizedState=e,[t,a,!1]}function M0(e){var t=Zt();return Rk(t,yt,e)}function Rk(e,t,a){if(t=vw(e,t,Mk)[0],e=Bf(Hr)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var n=yc(t)}catch(i){throw i===pl?Ep:i}else n=t;t=Zt();var r=t.queue,o=r.dispatch;return a!==t.memoizedState&&(Pe.flags|=2048,rl(9,{destroy:void 0},cF.bind(null,r,a),null)),[n,o,e]}function cF(e,t){e.action=t}function R0(e){var t=Zt(),a=yt;if(a!==null)return Rk(t,a,e);Zt(),t=t.memoizedState,a=Zt();var n=a.queue.dispatch;return a.memoizedState=e,[t,n,!1]}function rl(e,t,a,n){return e={tag:e,create:a,deps:n,inst:t,next:null},t=Pe.updateQueue,t===null&&(t=Ap(),Pe.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(n=a.next,a.next=e,e.next=n,t.lastEffect=e),e}function Dk(){return Zt().memoizedState}function zf(e,t,a,n){var r=Oa();Pe.flags|=e,r.memoizedState=rl(1|t,{destroy:void 0},a,n===void 0?null:n)}function Rp(e,t,a,n){var r=Zt();n=n===void 0?null:n;var o=r.memoizedState.inst;yt!==null&&n!==null&&pw(n,yt.memoizedState.deps)?r.memoizedState=rl(t,o,a,n):(Pe.flags|=e,r.memoizedState=rl(1|t,o,a,n))}function D0(e,t){zf(8390656,8,e,t)}function xw(e,t){Rp(2048,8,e,t)}function dF(e){Pe.flags|=4;var t=Pe.updateQueue;if(t===null)t=Ap(),Pe.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function _k(e){var t=Zt().memoizedState;return dF({ref:t,nextImpl:e}),function(){if((st&2)!==0)throw Error(z(440));return t.impl.apply(void 0,arguments)}}function Pk(e,t){return Rp(4,2,e,t)}function Ok(e,t){return Rp(4,4,e,t)}function Nk(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Uk(e,t,a){a=a!=null?a.concat([e]):null,Rp(4,4,Nk.bind(null,t,e),a)}function bw(){}function Bk(e,t){var a=Zt();t=t===void 0?null:t;var n=a.memoizedState;return t!==null&&pw(t,n[1])?n[0]:(a.memoizedState=[e,t],e)}function zk(e,t){var a=Zt();t=t===void 0?null:t;var n=a.memoizedState;if(t!==null&&pw(t,n[1]))return n[0];if(n=e(),ki){vo(!0);try{e()}finally{vo(!1)}}return a.memoizedState=[n,t],n}function Sw(e,t,a){return a===void 0||(qr&1073741824)!==0&&(Ke&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=LT(),Pe.lanes|=e,No|=e,a)}function Fk(e,t,a,n){return hn(a,t)?a:nl.current!==null?(e=Sw(e,a,n),hn(e,t)||(ra=!0),e):(qr&42)===0||(qr&1073741824)!==0&&(Ke&261930)===0?(ra=!0,e.memoizedState=a):(e=LT(),Pe.lanes|=e,No|=e,t)}function qk(e,t,a,n,r){var o=lt.p;lt.p=o!==0&&8>o?o:8;var i=Te.T,s={};Te.T=s,Cw(e,!1,t,a);try{var l=r(),u=Te.S;if(u!==null&&u(s,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=iF(l,n);Vu(e,t,c,mn(e))}else Vu(e,t,n,mn(e))}catch(d){Vu(e,t,{then:function(){},status:"rejected",reason:d},mn())}finally{lt.p=o,i!==null&&s.types!==null&&(i.types=s.types),Te.T=i}}function fF(){}function Cy(e,t,a,n){if(e.tag!==5)throw Error(z(476));var r=Hk(e).queue;qk(e,r,t,yi,a===null?fF:function(){return jk(e),a(n)})}function Hk(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:yi,baseState:yi,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:yi},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function jk(e){var t=Hk(e);t.next===null&&(t=e.alternate.memoizedState),Vu(e,t.next.queue,{},mn())}function Iw(){return xa(sc)}function Vk(){return Zt().memoizedState}function $k(){return Zt().memoizedState}function pF(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=mn();e=To(a);var n=Lo(t,e,a);n!==null&&(Ga(n,t,a),qu(n,t,a)),t={cache:lw()},e.payload=t;return}t=t.return}}function mF(e,t,a){var n=mn();a={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Dp(e)?Gk(t,a):(a=rw(e,t,a,n),a!==null&&(Ga(a,e,n),Xk(a,t,n)))}function Wk(e,t,a){var n=mn();Vu(e,t,a,n)}function Vu(e,t,a,n){var r={lane:n,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Dp(e))Gk(t,r);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,s=o(i,a);if(r.hasEagerState=!0,r.eagerState=s,hn(s,i))return Lp(e,t,r,0),vt===null&&Tp(),!1}catch{}if(a=rw(e,t,r,n),a!==null)return Ga(a,e,n),Xk(a,t,n),!0}return!1}function Cw(e,t,a,n){if(n={lane:2,revertLane:_w(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Dp(e)){if(t)throw Error(z(479))}else t=rw(e,a,n,2),t!==null&&Ga(t,e,2)}function Dp(e){var t=e.alternate;return e===Pe||t!==null&&t===Pe}function Gk(e,t){Zs=op=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Xk(e,t,a){if((a&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,a|=n,t.lanes=a,_C(e,a)}}var rc={readContext:xa,use:Mp,useCallback:Ht,useContext:Ht,useEffect:Ht,useImperativeHandle:Ht,useLayoutEffect:Ht,useInsertionEffect:Ht,useMemo:Ht,useReducer:Ht,useRef:Ht,useState:Ht,useDebugValue:Ht,useDeferredValue:Ht,useTransition:Ht,useSyncExternalStore:Ht,useId:Ht,useHostTransitionStatus:Ht,useFormState:Ht,useActionState:Ht,useOptimistic:Ht,useMemoCache:Ht,useCacheRefresh:Ht};rc.useEffectEvent=Ht;var Kk={readContext:xa,use:Mp,useCallback:function(e,t){return Oa().memoizedState=[e,t===void 0?null:t],e},useContext:xa,useEffect:D0,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,zf(4194308,4,Nk.bind(null,t,e),a)},useLayoutEffect:function(e,t){return zf(4194308,4,e,t)},useInsertionEffect:function(e,t){zf(4,2,e,t)},useMemo:function(e,t){var a=Oa();t=t===void 0?null:t;var n=e();if(ki){vo(!0);try{e()}finally{vo(!1)}}return a.memoizedState=[n,t],n},useReducer:function(e,t,a){var n=Oa();if(a!==void 0){var r=a(t);if(ki){vo(!0);try{a(t)}finally{vo(!1)}}}else r=t;return n.memoizedState=n.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},n.queue=e,e=e.dispatch=mF.bind(null,Pe,e),[n.memoizedState,e]},useRef:function(e){var t=Oa();return e={current:e},t.memoizedState=e},useState:function(e){e=Sy(e);var t=e.queue,a=Wk.bind(null,Pe,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:bw,useDeferredValue:function(e,t){var a=Oa();return Sw(a,e,t)},useTransition:function(){var e=Sy(!1);return e=qk.bind(null,Pe,e.queue,!0,!1),Oa().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var n=Pe,r=Oa();if(Ze){if(a===void 0)throw Error(z(407));a=a()}else{if(a=t(),vt===null)throw Error(z(349));(Ke&127)!==0||Sk(n,t,a)}r.memoizedState=a;var o={value:a,getSnapshot:t};return r.queue=o,D0(Ck.bind(null,n,o,e),[e]),n.flags|=2048,rl(9,{destroy:void 0},Ik.bind(null,n,o,a,t),null),a},useId:function(){var e=Oa(),t=vt.identifierPrefix;if(Ze){var a=lr,n=sr;a=(n&~(1<<32-pn(n)-1)).toString(32)+a,t="_"+t+"R_"+a,a=ip++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=sF++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Iw,useFormState:A0,useActionState:A0,useOptimistic:function(e){var t=Oa();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Cw.bind(null,Pe,!0,a),a.dispatch=t,[e,t]},useMemoCache:ww,useCacheRefresh:function(){return Oa().memoizedState=pF.bind(null,Pe)},useEffectEvent:function(e){var t=Oa(),a={impl:e};return t.memoizedState=a,function(){if((st&2)!==0)throw Error(z(440));return a.impl.apply(void 0,arguments)}}},kw={readContext:xa,use:Mp,useCallback:Bk,useContext:xa,useEffect:xw,useImperativeHandle:Uk,useInsertionEffect:Pk,useLayoutEffect:Ok,useMemo:zk,useReducer:Bf,useRef:Dk,useState:function(){return Bf(Hr)},useDebugValue:bw,useDeferredValue:function(e,t){var a=Zt();return Fk(a,yt.memoizedState,e,t)},useTransition:function(){var e=Bf(Hr)[0],t=Zt().memoizedState;return[typeof e=="boolean"?e:yc(e),t]},useSyncExternalStore:bk,useId:Vk,useHostTransitionStatus:Iw,useFormState:M0,useActionState:M0,useOptimistic:function(e,t){var a=Zt();return Lk(a,yt,e,t)},useMemoCache:ww,useCacheRefresh:$k};kw.useEffectEvent=_k;var Yk={readContext:xa,use:Mp,useCallback:Bk,useContext:xa,useEffect:xw,useImperativeHandle:Uk,useInsertionEffect:Pk,useLayoutEffect:Ok,useMemo:zk,useReducer:Dg,useRef:Dk,useState:function(){return Dg(Hr)},useDebugValue:bw,useDeferredValue:function(e,t){var a=Zt();return yt===null?Sw(a,e,t):Fk(a,yt.memoizedState,e,t)},useTransition:function(){var e=Dg(Hr)[0],t=Zt().memoizedState;return[typeof e=="boolean"?e:yc(e),t]},useSyncExternalStore:bk,useId:Vk,useHostTransitionStatus:Iw,useFormState:R0,useActionState:R0,useOptimistic:function(e,t){var a=Zt();return yt!==null?Lk(a,yt,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:ww,useCacheRefresh:$k};Yk.useEffectEvent=_k;function _g(e,t,a,n){t=e.memoizedState,a=a(n,t),a=a==null?t:Lt({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var ky={enqueueSetState:function(e,t,a){e=e._reactInternals;var n=mn(),r=To(n);r.payload=t,a!=null&&(r.callback=a),t=Lo(e,r,n),t!==null&&(Ga(t,e,n),qu(t,e,n))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var n=mn(),r=To(n);r.tag=1,r.payload=t,a!=null&&(r.callback=a),t=Lo(e,r,n),t!==null&&(Ga(t,e,n),qu(t,e,n))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=mn(),n=To(a);n.tag=2,t!=null&&(n.callback=t),t=Lo(e,n,a),t!==null&&(Ga(t,e,a),qu(t,e,a))}};function _0(e,t,a,n,r,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,o,i):t.prototype&&t.prototype.isPureReactComponent?!Qu(a,n)||!Qu(r,o):!0}function P0(e,t,a,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,n),t.state!==e&&ky.enqueueReplaceState(t,t.state,null)}function Ti(e,t){var a=t;if("ref"in t){a={};for(var n in t)n!=="ref"&&(a[n]=t[n])}if(e=e.defaultProps){a===t&&(a=Lt({},a));for(var r in e)a[r]===void 0&&(a[r]=e[r])}return a}function Zk(e){Jf(e)}function Jk(e){console.error(e)}function Qk(e){Jf(e)}function sp(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(n){setTimeout(function(){throw n})}}function O0(e,t,a){try{var n=e.onCaughtError;n(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Ty(e,t,a){return a=To(a),a.tag=3,a.payload={element:null},a.callback=function(){sp(e,t)},a}function eT(e){return e=To(e),e.tag=3,e}function tT(e,t,a,n){var r=a.type.getDerivedStateFromError;if(typeof r=="function"){var o=n.value;e.payload=function(){return r(o)},e.callback=function(){O0(t,a,n)}}var i=a.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){O0(t,a,n),typeof r!="function"&&(Eo===null?Eo=new Set([this]):Eo.add(this));var s=n.stack;this.componentDidCatch(n.value,{componentStack:s!==null?s:""})})}function hF(e,t,a,n,r){if(a.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(t=a.alternate,t!==null&&fl(t,a,r,!0),a=gn.current,a!==null){switch(a.tag){case 31:case 13:return Dn===null?fp():a.alternate===null&&jt===0&&(jt=3),a.flags&=-257,a.flags|=65536,a.lanes=r,n===ap?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([n]):t.add(n),Vg(e,n,r)),!1;case 22:return a.flags|=65536,n===ap?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([n]):a.add(n)),Vg(e,n,r)),!1}throw Error(z(435,a.tag))}return Vg(e,n,r),fp(),!1}if(Ze)return t=gn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,n!==py&&(e=Error(z(422),{cause:n}),tc(Mn(e,a)))):(n!==py&&(t=Error(z(423),{cause:n}),tc(Mn(t,a))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,n=Mn(n,a),r=Ty(e.stateNode,n,r),Rg(e,r),jt!==4&&(jt=2)),!1;var o=Error(z(520),{cause:n});if(o=Mn(o,a),Gu===null?Gu=[o]:Gu.push(o),jt!==4&&(jt=2),t===null)return!0;n=Mn(n,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=r&-r,a.lanes|=e,e=Ty(a.stateNode,n,e),Rg(a,e),!1;case 1:if(t=a.type,o=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||o!==null&&typeof o.componentDidCatch=="function"&&(Eo===null||!Eo.has(o))))return a.flags|=65536,r&=-r,a.lanes|=r,r=eT(r),tT(r,e,a,n),Rg(a,r),!1}a=a.return}while(a!==null);return!1}var Tw=Error(z(461)),ra=!1;function ya(e,t,a,n){t.child=e===null?hk(t,null,a,n):Ci(t,e.child,a,n)}function N0(e,t,a,n,r){a=a.render;var o=t.ref;if("ref"in n){var i={};for(var s in n)s!=="ref"&&(i[s]=n[s])}else i=n;return Ii(t),n=mw(e,t,a,i,o,r),s=hw(),e!==null&&!ra?(gw(e,t,r),jr(e,t,r)):(Ze&&s&&iw(t),t.flags|=1,ya(e,t,n,r),t.child)}function U0(e,t,a,n,r){if(e===null){var o=a.type;return typeof o=="function"&&!ow(o)&&o.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=o,aT(e,t,o,n,r)):(e=Nf(a.type,null,n,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!Lw(e,r)){var i=o.memoizedProps;if(a=a.compare,a=a!==null?a:Qu,a(i,n)&&e.ref===t.ref)return jr(e,t,r)}return t.flags|=1,e=Ur(o,n),e.ref=t.ref,e.return=t,t.child=e}function aT(e,t,a,n,r){if(e!==null){var o=e.memoizedProps;if(Qu(o,n)&&e.ref===t.ref)if(ra=!1,t.pendingProps=n=o,Lw(e,r))(e.flags&131072)!==0&&(ra=!0);else return t.lanes=e.lanes,jr(e,t,r)}return Ly(e,t,a,n,r)}function nT(e,t,a,n){var r=n.children,o=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.mode==="hidden"){if((t.flags&128)!==0){if(o=o!==null?o.baseLanes|a:a,e!==null){for(n=t.child=e.child,r=0;n!==null;)r=r|n.lanes|n.childLanes,n=n.sibling;n=r&~o}else n=0,t.child=null;return B0(e,t,o,a,n)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Uf(t,o!==null?o.cachePool:null),o!==null?T0(t,o):xy(),wk(t);else return n=t.lanes=536870912,B0(e,t,o!==null?o.baseLanes|a:a,a,n)}else o!==null?(Uf(t,o.cachePool),T0(t,o),yo(t),t.memoizedState=null):(e!==null&&Uf(t,null),xy(),yo(t));return ya(e,t,r,a),t.child}function Ou(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function B0(e,t,a,n,r){var o=uw();return o=o===null?null:{parent:na._currentValue,pool:o},t.memoizedState={baseLanes:a,cachePool:o},e!==null&&Uf(t,null),xy(),wk(t),e!==null&&fl(e,t,n,!0),t.childLanes=r,null}function Ff(e,t){return t=lp({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function z0(e,t,a){return Ci(t,e.child,null,a),e=Ff(t,t.pendingProps),e.flags|=2,ln(t),t.memoizedState=null,e}function gF(e,t,a){var n=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ze){if(n.mode==="hidden")return e=Ff(t,n),t.lanes=536870912,Ou(null,e);if(by(t),(e=Tt)?(e=KT(e,Rn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_o!==null?{id:sr,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},a=lk(e),a.return=t,t.child=a,va=t,Tt=null)):e=null,e===null)throw Po(t);return t.lanes=536870912,null}return Ff(t,n)}var o=e.memoizedState;if(o!==null){var i=o.dehydrated;if(by(t),r)if(t.flags&256)t.flags&=-257,t=z0(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(z(558));else if(ra||fl(e,t,a,!1),r=(a&e.childLanes)!==0,ra||r){if(n=vt,n!==null&&(i=PC(n,a),i!==0&&i!==o.retryLane))throw o.retryLane=i,Mi(e,i),Ga(n,e,i),Tw;fp(),t=z0(e,t,a)}else e=o.treeContext,Tt=_n(i.nextSibling),va=t,Ze=!0,ko=null,Rn=!1,e!==null&&ck(t,e),t=Ff(t,n),t.flags|=4096;return t}return e=Ur(e.child,{mode:n.mode,children:n.children}),e.ref=t.ref,t.child=e,e.return=t,e}function qf(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(z(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Ly(e,t,a,n,r){return Ii(t),a=mw(e,t,a,n,void 0,r),n=hw(),e!==null&&!ra?(gw(e,t,r),jr(e,t,r)):(Ze&&n&&iw(t),t.flags|=1,ya(e,t,a,r),t.child)}function F0(e,t,a,n,r,o){return Ii(t),t.updateQueue=null,a=xk(t,n,a,r),vk(e),n=hw(),e!==null&&!ra?(gw(e,t,o),jr(e,t,o)):(Ze&&n&&iw(t),t.flags|=1,ya(e,t,a,o),t.child)}function q0(e,t,a,n,r){if(Ii(t),t.stateNode===null){var o=Hs,i=a.contextType;typeof i=="object"&&i!==null&&(o=xa(i)),o=new a(n,o),t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=ky,t.stateNode=o,o._reactInternals=t,o=t.stateNode,o.props=n,o.state=t.memoizedState,o.refs={},dw(t),i=a.contextType,o.context=typeof i=="object"&&i!==null?xa(i):Hs,o.state=t.memoizedState,i=a.getDerivedStateFromProps,typeof i=="function"&&(_g(t,a,i,n),o.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(i=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),i!==o.state&&ky.enqueueReplaceState(o,o.state,null),ju(t,n,o,r),Hu(),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!0}else if(e===null){o=t.stateNode;var s=t.memoizedProps,l=Ti(a,s);o.props=l;var u=o.context,c=a.contextType;i=Hs,typeof c=="object"&&c!==null&&(i=xa(c));var d=a.getDerivedStateFromProps;c=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function",s=t.pendingProps!==s,c||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s||u!==i)&&P0(t,o,n,i),mo=!1;var p=t.memoizedState;o.state=p,ju(t,n,o,r),Hu(),u=t.memoizedState,s||p!==u||mo?(typeof d=="function"&&(_g(t,a,d,n),u=t.memoizedState),(l=mo||_0(t,a,l,n,p,u,i))?(c||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=u),o.props=n,o.state=u,o.context=i,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,wy(e,t),i=t.memoizedProps,c=Ti(a,i),o.props=c,d=t.pendingProps,p=o.context,u=a.contextType,l=Hs,typeof u=="object"&&u!==null&&(l=xa(u)),s=a.getDerivedStateFromProps,(u=typeof s=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(i!==d||p!==l)&&P0(t,o,n,l),mo=!1,p=t.memoizedState,o.state=p,ju(t,n,o,r),Hu();var m=t.memoizedState;i!==d||p!==m||mo||e!==null&&e.dependencies!==null&&tp(e.dependencies)?(typeof s=="function"&&(_g(t,a,s,n),m=t.memoizedState),(c=mo||_0(t,a,c,n,p,m,l)||e!==null&&e.dependencies!==null&&tp(e.dependencies))?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,m,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,m,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=m),o.props=n,o.state=m,o.context=l,n=c):(typeof o.componentDidUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),n=!1)}return o=n,qf(e,t),n=(t.flags&128)!==0,o||n?(o=t.stateNode,a=n&&typeof a.getDerivedStateFromError!="function"?null:o.render(),t.flags|=1,e!==null&&n?(t.child=Ci(t,e.child,null,r),t.child=Ci(t,null,a,r)):ya(e,t,a,r),t.memoizedState=o.state,e=t.child):e=jr(e,t,r),e}function H0(e,t,a,n){return Si(),t.flags|=256,ya(e,t,a,n),t.child}var Pg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Og(e){return{baseLanes:e,cachePool:fk()}}function Ng(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=cn),e}function rT(e,t,a){var n=t.pendingProps,r=!1,o=(t.flags&128)!==0,i;if((i=o)||(i=e!==null&&e.memoizedState===null?!1:(Yt.current&2)!==0),i&&(r=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ze){if(r?go(t):yo(t),(e=Tt)?(e=KT(e,Rn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_o!==null?{id:sr,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},a=lk(e),a.return=t,t.child=a,va=t,Tt=null)):e=null,e===null)throw Po(t);return qy(e)?t.lanes=32:t.lanes=536870912,null}var s=n.children;return n=n.fallback,r?(yo(t),r=t.mode,s=lp({mode:"hidden",children:s},r),n=wi(n,r,a,null),s.return=t,n.return=t,s.sibling=n,t.child=s,n=t.child,n.memoizedState=Og(a),n.childLanes=Ng(e,i,a),t.memoizedState=Pg,Ou(null,n)):(go(t),Ey(t,s))}var l=e.memoizedState;if(l!==null&&(s=l.dehydrated,s!==null)){if(o)t.flags&256?(go(t),t.flags&=-257,t=Ug(e,t,a)):t.memoizedState!==null?(yo(t),t.child=e.child,t.flags|=128,t=null):(yo(t),s=n.fallback,r=t.mode,n=lp({mode:"visible",children:n.children},r),s=wi(s,r,a,null),s.flags|=2,n.return=t,s.return=t,n.sibling=s,t.child=n,Ci(t,e.child,null,a),n=t.child,n.memoizedState=Og(a),n.childLanes=Ng(e,i,a),t.memoizedState=Pg,t=Ou(null,n));else if(go(t),qy(s)){if(i=s.nextSibling&&s.nextSibling.dataset,i)var u=i.dgst;i=u,n=Error(z(419)),n.stack="",n.digest=i,tc({value:n,source:null,stack:null}),t=Ug(e,t,a)}else if(ra||fl(e,t,a,!1),i=(a&e.childLanes)!==0,ra||i){if(i=vt,i!==null&&(n=PC(i,a),n!==0&&n!==l.retryLane))throw l.retryLane=n,Mi(e,n),Ga(i,e,n),Tw;Fy(s)||fp(),t=Ug(e,t,a)}else Fy(s)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Tt=_n(s.nextSibling),va=t,Ze=!0,ko=null,Rn=!1,e!==null&&ck(t,e),t=Ey(t,n.children),t.flags|=4096);return t}return r?(yo(t),s=n.fallback,r=t.mode,l=e.child,u=l.sibling,n=Ur(l,{mode:"hidden",children:n.children}),n.subtreeFlags=l.subtreeFlags&65011712,u!==null?s=Ur(u,s):(s=wi(s,r,a,null),s.flags|=2),s.return=t,n.return=t,n.sibling=s,t.child=n,Ou(null,n),n=t.child,s=e.child.memoizedState,s===null?s=Og(a):(r=s.cachePool,r!==null?(l=na._currentValue,r=r.parent!==l?{parent:l,pool:l}:r):r=fk(),s={baseLanes:s.baseLanes|a,cachePool:r}),n.memoizedState=s,n.childLanes=Ng(e,i,a),t.memoizedState=Pg,Ou(e.child,n)):(go(t),a=e.child,e=a.sibling,a=Ur(a,{mode:"visible",children:n.children}),a.return=t,a.sibling=null,e!==null&&(i=t.deletions,i===null?(t.deletions=[e],t.flags|=16):i.push(e)),t.child=a,t.memoizedState=null,a)}function Ey(e,t){return t=lp({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function lp(e,t){return e=un(22,e,null,t),e.lanes=0,e}function Ug(e,t,a){return Ci(t,e.child,null,a),e=Ey(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function j0(e,t,a){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),hy(e.return,t,a)}function Bg(e,t,a,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:a,tailMode:r,treeForkCount:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=a,i.tailMode=r,i.treeForkCount=o)}function oT(e,t,a){var n=t.pendingProps,r=n.revealOrder,o=n.tail;n=n.children;var i=Yt.current,s=(i&2)!==0;if(s?(i=i&1|2,t.flags|=128):i&=1,St(Yt,i),ya(e,t,n,a),n=Ze?ec:0,!s&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&j0(e,a,t);else if(e.tag===19)j0(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(a=t.child,r=null;a!==null;)e=a.alternate,e!==null&&rp(e)===null&&(r=a),a=a.sibling;a=r,a===null?(r=t.child,t.child=null):(r=a.sibling,a.sibling=null),Bg(t,!1,r,a,o,n);break;case"backwards":case"unstable_legacy-backwards":for(a=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&rp(e)===null){t.child=r;break}e=r.sibling,r.sibling=a,a=r,r=e}Bg(t,!0,a,null,o,n);break;case"together":Bg(t,!1,null,null,void 0,n);break;default:t.memoizedState=null}return t.child}function jr(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),No|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(fl(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(z(153));if(t.child!==null){for(e=t.child,a=Ur(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Ur(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function Lw(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&tp(e)))}function yF(e,t,a){switch(t.tag){case 3:Xf(t,t.stateNode.containerInfo),ho(t,na,e.memoizedState.cache),Si();break;case 27:case 5:ay(t);break;case 4:Xf(t,t.stateNode.containerInfo);break;case 10:ho(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,by(t),null;break;case 13:var n=t.memoizedState;if(n!==null)return n.dehydrated!==null?(go(t),t.flags|=128,null):(a&t.child.childLanes)!==0?rT(e,t,a):(go(t),e=jr(e,t,a),e!==null?e.sibling:null);go(t);break;case 19:var r=(e.flags&128)!==0;if(n=(a&t.childLanes)!==0,n||(fl(e,t,a,!1),n=(a&t.childLanes)!==0),r){if(n)return oT(e,t,a);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),St(Yt,Yt.current),n)break;return null;case 22:return t.lanes=0,nT(e,t,a,t.pendingProps);case 24:ho(t,na,e.memoizedState.cache)}return jr(e,t,a)}function iT(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)ra=!0;else{if(!Lw(e,a)&&(t.flags&128)===0)return ra=!1,yF(e,t,a);ra=(e.flags&131072)!==0}else ra=!1,Ze&&(t.flags&1048576)!==0&&uk(t,ec,t.index);switch(t.lanes=0,t.tag){case 16:e:{var n=t.pendingProps;if(e=hi(t.elementType),t.type=e,typeof e=="function")ow(e)?(n=Ti(e,n),t.tag=1,t=q0(null,t,e,n,a)):(t.tag=0,t=Ly(null,t,e,n,a));else{if(e!=null){var r=e.$$typeof;if(r===$y){t.tag=11,t=N0(null,t,e,n,a);break e}else if(r===Wy){t.tag=14,t=U0(null,t,e,n,a);break e}}throw t=ey(e)||e,Error(z(306,t,""))}}return t;case 0:return Ly(e,t,t.type,t.pendingProps,a);case 1:return n=t.type,r=Ti(n,t.pendingProps),q0(e,t,n,r,a);case 3:e:{if(Xf(t,t.stateNode.containerInfo),e===null)throw Error(z(387));n=t.pendingProps;var o=t.memoizedState;r=o.element,wy(e,t),ju(t,n,null,a);var i=t.memoizedState;if(n=i.cache,ho(t,na,n),n!==o.cache&&gy(t,[na],a,!0),Hu(),n=i.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=H0(e,t,n,a);break e}else if(n!==r){r=Mn(Error(z(424)),t),tc(r),t=H0(e,t,n,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Tt=_n(e.firstChild),va=t,Ze=!0,ko=null,Rn=!0,a=hk(t,null,n,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Si(),n===r){t=jr(e,t,a);break e}ya(e,t,n,a)}t=t.child}return t;case 26:return qf(e,t),e===null?(a=dC(t.type,null,t.pendingProps,null))?t.memoizedState=a:Ze||(a=t.type,e=t.pendingProps,n=gp(Co.current).createElement(a),n[wa]=t,n[Xa]=e,ba(n,a,e),fa(n),t.stateNode=n):t.memoizedState=dC(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ay(t),e===null&&Ze&&(n=t.stateNode=YT(t.type,t.pendingProps,Co.current),va=t,Rn=!0,r=Tt,Bo(t.type)?(Hy=r,Tt=_n(n.firstChild)):Tt=r),ya(e,t,t.pendingProps.children,a),qf(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ze&&((r=n=Tt)&&(n=$F(n,t.type,t.pendingProps,Rn),n!==null?(t.stateNode=n,va=t,Tt=_n(n.firstChild),Rn=!1,r=!0):r=!1),r||Po(t)),ay(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,n=o.children,By(r,o)?n=null:i!==null&&By(r,i)&&(t.flags|=32),t.memoizedState!==null&&(r=mw(e,t,lF,null,null,a),sc._currentValue=r),qf(e,t),ya(e,t,n,a),t.child;case 6:return e===null&&Ze&&((e=a=Tt)&&(a=WF(a,t.pendingProps,Rn),a!==null?(t.stateNode=a,va=t,Tt=null,e=!0):e=!1),e||Po(t)),null;case 13:return rT(e,t,a);case 4:return Xf(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Ci(t,null,n,a):ya(e,t,n,a),t.child;case 11:return N0(e,t,t.type,t.pendingProps,a);case 7:return ya(e,t,t.pendingProps,a),t.child;case 8:return ya(e,t,t.pendingProps.children,a),t.child;case 12:return ya(e,t,t.pendingProps.children,a),t.child;case 10:return n=t.pendingProps,ho(t,t.type,n.value),ya(e,t,n.children,a),t.child;case 9:return r=t.type._context,n=t.pendingProps.children,Ii(t),r=xa(r),n=n(r),t.flags|=1,ya(e,t,n,a),t.child;case 14:return U0(e,t,t.type,t.pendingProps,a);case 15:return aT(e,t,t.type,t.pendingProps,a);case 19:return oT(e,t,a);case 31:return gF(e,t,a);case 22:return nT(e,t,a,t.pendingProps);case 24:return Ii(t),n=xa(na),e===null?(r=uw(),r===null&&(r=vt,o=lw(),r.pooledCache=o,o.refCount++,o!==null&&(r.pooledCacheLanes|=a),r=o),t.memoizedState={parent:n,cache:r},dw(t),ho(t,na,r)):((e.lanes&a)!==0&&(wy(e,t),ju(t,null,null,a),Hu()),r=e.memoizedState,o=t.memoizedState,r.parent!==n?(r={parent:n,cache:n},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),ho(t,na,n)):(n=o.cache,ho(t,na,n),n!==r.cache&&gy(t,[na],a,!0))),ya(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(z(156,t.tag))}function Er(e){e.flags|=4}function zg(e,t,a,n,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(MT())e.flags|=8192;else throw xi=ap,cw}else e.flags&=-16777217}function V0(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!QT(t))if(MT())e.flags|=8192;else throw xi=ap,cw}function kf(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?RC():536870912,e.lanes|=t,ol|=t)}function Eu(e,t){if(!Ze)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var n=null;a!==null;)a.alternate!==null&&(n=a),a=a.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function kt(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,n=0;if(t)for(var r=e.child;r!==null;)a|=r.lanes|r.childLanes,n|=r.subtreeFlags&65011712,n|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)a|=r.lanes|r.childLanes,n|=r.subtreeFlags,n|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=n,e.childLanes=a,t}function wF(e,t,a){var n=t.pendingProps;switch(sw(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(t),null;case 1:return kt(t),null;case 3:return a=t.stateNode,n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Br(na),Qs(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ms(t)?Er(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Mg())),kt(t),null;case 26:var r=t.type,o=t.memoizedState;return e===null?(Er(t),o!==null?(kt(t),V0(t,o)):(kt(t),zg(t,r,null,n,a))):o?o!==e.memoizedState?(Er(t),kt(t),V0(t,o)):(kt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==n&&Er(t),kt(t),zg(t,r,e,n,a)),null;case 27:if(Kf(t),a=Co.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Er(t);else{if(!n){if(t.stateNode===null)throw Error(z(166));return kt(t),null}e=cr.current,Ms(t)?v0(t,e):(e=YT(r,n,a),t.stateNode=e,Er(t))}return kt(t),null;case 5:if(Kf(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==n&&Er(t);else{if(!n){if(t.stateNode===null)throw Error(z(166));return kt(t),null}if(o=cr.current,Ms(t))v0(t,o);else{var i=gp(Co.current);switch(o){case 1:o=i.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:o=i.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":o=i.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":o=i.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":o=i.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild);break;case"select":o=typeof n.is=="string"?i.createElement("select",{is:n.is}):i.createElement("select"),n.multiple?o.multiple=!0:n.size&&(o.size=n.size);break;default:o=typeof n.is=="string"?i.createElement(r,{is:n.is}):i.createElement(r)}}o[wa]=t,o[Xa]=n;e:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)o.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=o;e:switch(ba(o,r,n),r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Er(t)}}return kt(t),zg(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&Er(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(z(166));if(e=Co.current,Ms(t)){if(e=t.stateNode,a=t.memoizedProps,n=null,r=va,r!==null)switch(r.tag){case 27:case 5:n=r.memoizedProps}e[wa]=t,e=!!(e.nodeValue===a||n!==null&&n.suppressHydrationWarning===!0||WT(e.nodeValue,a)),e||Po(t,!0)}else e=gp(e).createTextNode(n),e[wa]=t,t.stateNode=e}return kt(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(n=Ms(t),a!==null){if(e===null){if(!n)throw Error(z(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(z(557));e[wa]=t}else Si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;kt(t),e=!1}else a=Mg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(ln(t),t):(ln(t),null);if((t.flags&128)!==0)throw Error(z(558))}return kt(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Ms(t),n!==null&&n.dehydrated!==null){if(e===null){if(!r)throw Error(z(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(z(317));r[wa]=t}else Si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;kt(t),r=!1}else r=Mg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(ln(t),t):(ln(t),null)}return ln(t),(t.flags&128)!==0?(t.lanes=a,t):(a=n!==null,e=e!==null&&e.memoizedState!==null,a&&(n=t.child,r=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(r=n.alternate.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==r&&(n.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),kf(t,t.updateQueue),kt(t),null);case 4:return Qs(),e===null&&Pw(t.stateNode.containerInfo),kt(t),null;case 10:return Br(t.type),kt(t),null;case 19:if(pa(Yt),n=t.memoizedState,n===null)return kt(t),null;if(r=(t.flags&128)!==0,o=n.rendering,o===null)if(r)Eu(n,!1);else{if(jt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(o=rp(e),o!==null){for(t.flags|=128,Eu(n,!1),e=o.updateQueue,t.updateQueue=e,kf(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)sk(a,e),a=a.sibling;return St(Yt,Yt.current&1|2),Ze&&Dr(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&dn()>cp&&(t.flags|=128,r=!0,Eu(n,!1),t.lanes=4194304)}else{if(!r)if(e=rp(o),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,kf(t,e),Eu(n,!0),n.tail===null&&n.tailMode==="hidden"&&!o.alternate&&!Ze)return kt(t),null}else 2*dn()-n.renderingStartTime>cp&&a!==536870912&&(t.flags|=128,r=!0,Eu(n,!1),t.lanes=4194304);n.isBackwards?(o.sibling=t.child,t.child=o):(e=n.last,e!==null?e.sibling=o:t.child=o,n.last=o)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=dn(),e.sibling=null,a=Yt.current,St(Yt,r?a&1|2:a&1),Ze&&Dr(t,n.treeForkCount),e):(kt(t),null);case 22:case 23:return ln(t),fw(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(a&536870912)!==0&&(t.flags&128)===0&&(kt(t),t.subtreeFlags&6&&(t.flags|=8192)):kt(t),a=t.updateQueue,a!==null&&kf(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==a&&(t.flags|=2048),e!==null&&pa(vi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Br(na),kt(t),null;case 25:return null;case 30:return null}throw Error(z(156,t.tag))}function vF(e,t){switch(sw(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Br(na),Qs(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Kf(t),null;case 31:if(t.memoizedState!==null){if(ln(t),t.alternate===null)throw Error(z(340));Si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ln(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(z(340));Si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return pa(Yt),null;case 4:return Qs(),null;case 10:return Br(t.type),null;case 22:case 23:return ln(t),fw(),e!==null&&pa(vi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Br(na),null;case 25:return null;default:return null}}function sT(e,t){switch(sw(t),t.tag){case 3:Br(na),Qs();break;case 26:case 27:case 5:Kf(t);break;case 4:Qs();break;case 31:t.memoizedState!==null&&ln(t);break;case 13:ln(t);break;case 19:pa(Yt);break;case 10:Br(t.type);break;case 22:case 23:ln(t),fw(),e!==null&&pa(vi);break;case 24:Br(na)}}function wc(e,t){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var r=n.next;a=r;do{if((a.tag&e)===e){n=void 0;var o=a.create,i=a.inst;n=o(),i.destroy=n}a=a.next}while(a!==r)}}catch(s){ft(t,t.return,s)}}function Oo(e,t,a){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var o=r.next;n=o;do{if((n.tag&e)===e){var i=n.inst,s=i.destroy;if(s!==void 0){i.destroy=void 0,r=t;var l=a,u=s;try{u()}catch(c){ft(r,l,c)}}}n=n.next}while(n!==o)}}catch(c){ft(t,t.return,c)}}function lT(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{yk(t,a)}catch(n){ft(e,e.return,n)}}}function uT(e,t,a){a.props=Ti(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(n){ft(e,t,n)}}function $u(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof a=="function"?e.refCleanup=a(n):a.current=n}}catch(r){ft(e,t,r)}}function ur(e,t){var a=e.ref,n=e.refCleanup;if(a!==null)if(typeof n=="function")try{n()}catch(r){ft(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(r){ft(e,t,r)}else a.current=null}function cT(e){var t=e.type,a=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break e;case"img":a.src?n.src=a.src:a.srcSet&&(n.srcset=a.srcSet)}}catch(r){ft(e,e.return,r)}}function Fg(e,t,a){try{var n=e.stateNode;zF(n,e.type,a,t),n[Xa]=t}catch(r){ft(e,e.return,r)}}function dT(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Bo(e.type)||e.tag===4}function qg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||dT(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Bo(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ay(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Or));else if(n!==4&&(n===27&&Bo(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Ay(e,t,a),e=e.sibling;e!==null;)Ay(e,t,a),e=e.sibling}function up(e,t,a){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(n!==4&&(n===27&&Bo(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(up(e,t,a),e=e.sibling;e!==null;)up(e,t,a),e=e.sibling}function fT(e){var t=e.stateNode,a=e.memoizedProps;try{for(var n=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);ba(t,n,a),t[wa]=e,t[Xa]=a}catch(o){ft(e,e.return,o)}}var _r=!1,aa=!1,Hg=!1,$0=typeof WeakSet=="function"?WeakSet:Set,da=null;function xF(e,t){if(e=e.containerInfo,Ny=xp,e=QC(e),aw(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var n=a.getSelection&&a.getSelection();if(n&&n.rangeCount!==0){a=n.anchorNode;var r=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{a.nodeType,o.nodeType}catch{a=null;break e}var i=0,s=-1,l=-1,u=0,c=0,d=e,p=null;t:for(;;){for(var m;d!==a||r!==0&&d.nodeType!==3||(s=i+r),d!==o||n!==0&&d.nodeType!==3||(l=i+n),d.nodeType===3&&(i+=d.nodeValue.length),(m=d.firstChild)!==null;)p=d,d=m;for(;;){if(d===e)break t;if(p===a&&++u===r&&(s=i),p===o&&++c===n&&(l=i),(m=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=m}a=s===-1||l===-1?null:{start:s,end:l}}else a=null}a=a||{start:0,end:0}}else a=null;for(Uy={focusedElem:e,selectionRange:a},xp=!1,da=t;da!==null;)if(t=da,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,da=e;else for(;da!==null;){switch(t=da,o=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)r=e[a],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&o!==null){e=void 0,a=t,r=o.memoizedProps,o=o.memoizedState,n=a.stateNode;try{var h=Ti(a.type,r);e=n.getSnapshotBeforeUpdate(h,o),n.__reactInternalSnapshotBeforeUpdate=e}catch(v){ft(a,a.return,v)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)zy(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":zy(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(z(163))}if(e=t.sibling,e!==null){e.return=t.return,da=e;break}da=t.return}}function pT(e,t,a){var n=a.flags;switch(a.tag){case 0:case 11:case 15:Mr(e,a),n&4&&wc(5,a);break;case 1:if(Mr(e,a),n&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(i){ft(a,a.return,i)}else{var r=Ti(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){ft(a,a.return,i)}}n&64&&lT(a),n&512&&$u(a,a.return);break;case 3:if(Mr(e,a),n&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{yk(e,t)}catch(i){ft(a,a.return,i)}}break;case 27:t===null&&n&4&&fT(a);case 26:case 5:Mr(e,a),t===null&&n&4&&cT(a),n&512&&$u(a,a.return);break;case 12:Mr(e,a);break;case 31:Mr(e,a),n&4&&gT(e,a);break;case 13:Mr(e,a),n&4&&yT(e,a),n&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=AF.bind(null,a),GF(e,a))));break;case 22:if(n=a.memoizedState!==null||_r,!n){t=t!==null&&t.memoizedState!==null||aa,r=_r;var o=aa;_r=n,(aa=t)&&!o?Rr(e,a,(a.subtreeFlags&8772)!==0):Mr(e,a),_r=r,aa=o}break;case 30:break;default:Mr(e,a)}}function mT(e){var t=e.alternate;t!==null&&(e.alternate=null,mT(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Yy(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Dt=null,$a=!1;function Ar(e,t,a){for(a=a.child;a!==null;)hT(e,t,a),a=a.sibling}function hT(e,t,a){if(fn&&typeof fn.onCommitFiberUnmount=="function")try{fn.onCommitFiberUnmount(dc,a)}catch{}switch(a.tag){case 26:aa||ur(a,t),Ar(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:aa||ur(a,t);var n=Dt,r=$a;Bo(a.type)&&(Dt=a.stateNode,$a=!1),Ar(e,t,a),Ku(a.stateNode),Dt=n,$a=r;break;case 5:aa||ur(a,t);case 6:if(n=Dt,r=$a,Dt=null,Ar(e,t,a),Dt=n,$a=r,Dt!==null)if($a)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(a.stateNode)}catch(o){ft(a,t,o)}else try{Dt.removeChild(a.stateNode)}catch(o){ft(a,t,o)}break;case 18:Dt!==null&&($a?(e=Dt,iC(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),ul(e)):iC(Dt,a.stateNode));break;case 4:n=Dt,r=$a,Dt=a.stateNode.containerInfo,$a=!0,Ar(e,t,a),Dt=n,$a=r;break;case 0:case 11:case 14:case 15:Oo(2,a,t),aa||Oo(4,a,t),Ar(e,t,a);break;case 1:aa||(ur(a,t),n=a.stateNode,typeof n.componentWillUnmount=="function"&&uT(a,t,n)),Ar(e,t,a);break;case 21:Ar(e,t,a);break;case 22:aa=(n=aa)||a.memoizedState!==null,Ar(e,t,a),aa=n;break;default:Ar(e,t,a)}}function gT(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ul(e)}catch(a){ft(t,t.return,a)}}}function yT(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ul(e)}catch(a){ft(t,t.return,a)}}function bF(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $0),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $0),t;default:throw Error(z(435,e.tag))}}function Tf(e,t){var a=bF(e);t.forEach(function(n){if(!a.has(n)){a.add(n);var r=MF.bind(null,e,n);n.then(r,r)}})}function ja(e,t){var a=t.deletions;if(a!==null)for(var n=0;n<a.length;n++){var r=a[n],o=e,i=t,s=i;e:for(;s!==null;){switch(s.tag){case 27:if(Bo(s.type)){Dt=s.stateNode,$a=!1;break e}break;case 5:Dt=s.stateNode,$a=!1;break e;case 3:case 4:Dt=s.stateNode.containerInfo,$a=!0;break e}s=s.return}if(Dt===null)throw Error(z(160));hT(o,i,r),Dt=null,$a=!1,o=r.alternate,o!==null&&(o.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)wT(t,e),t=t.sibling}var Wn=null;function wT(e,t){var a=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ja(t,e),Va(e),n&4&&(Oo(3,e,e.return),wc(3,e),Oo(5,e,e.return));break;case 1:ja(t,e),Va(e),n&512&&(aa||a===null||ur(a,a.return)),n&64&&_r&&(e=e.updateQueue,e!==null&&(n=e.callbacks,n!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?n:a.concat(n))));break;case 26:var r=Wn;if(ja(t,e),Va(e),n&512&&(aa||a===null||ur(a,a.return)),n&4){var o=a!==null?a.memoizedState:null;if(n=e.memoizedState,a===null)if(n===null)if(e.stateNode===null){e:{n=e.type,a=e.memoizedProps,r=r.ownerDocument||r;t:switch(n){case"title":o=r.getElementsByTagName("title")[0],(!o||o[mc]||o[wa]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=r.createElement(n),r.head.insertBefore(o,r.querySelector("head > title"))),ba(o,n,a),o[wa]=e,fa(o),n=o;break e;case"link":var i=pC("link","href",r).get(n+(a.href||""));if(i){for(var s=0;s<i.length;s++)if(o=i[s],o.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&o.getAttribute("rel")===(a.rel==null?null:a.rel)&&o.getAttribute("title")===(a.title==null?null:a.title)&&o.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){i.splice(s,1);break t}}o=r.createElement(n),ba(o,n,a),r.head.appendChild(o);break;case"meta":if(i=pC("meta","content",r).get(n+(a.content||""))){for(s=0;s<i.length;s++)if(o=i[s],o.getAttribute("content")===(a.content==null?null:""+a.content)&&o.getAttribute("name")===(a.name==null?null:a.name)&&o.getAttribute("property")===(a.property==null?null:a.property)&&o.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&o.getAttribute("charset")===(a.charSet==null?null:a.charSet)){i.splice(s,1);break t}}o=r.createElement(n),ba(o,n,a),r.head.appendChild(o);break;default:throw Error(z(468,n))}o[wa]=e,fa(o),n=o}e.stateNode=n}else mC(r,e.type,e.stateNode);else e.stateNode=fC(r,n,e.memoizedProps);else o!==n?(o===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):o.count--,n===null?mC(r,e.type,e.stateNode):fC(r,n,e.memoizedProps)):n===null&&e.stateNode!==null&&Fg(e,e.memoizedProps,a.memoizedProps)}break;case 27:ja(t,e),Va(e),n&512&&(aa||a===null||ur(a,a.return)),a!==null&&n&4&&Fg(e,e.memoizedProps,a.memoizedProps);break;case 5:if(ja(t,e),Va(e),n&512&&(aa||a===null||ur(a,a.return)),e.flags&32){r=e.stateNode;try{tl(r,"")}catch(h){ft(e,e.return,h)}}n&4&&e.stateNode!=null&&(r=e.memoizedProps,Fg(e,r,a!==null?a.memoizedProps:r)),n&1024&&(Hg=!0);break;case 6:if(ja(t,e),Va(e),n&4){if(e.stateNode===null)throw Error(z(162));n=e.memoizedProps,a=e.stateNode;try{a.nodeValue=n}catch(h){ft(e,e.return,h)}}break;case 3:if(Vf=null,r=Wn,Wn=yp(t.containerInfo),ja(t,e),Wn=r,Va(e),n&4&&a!==null&&a.memoizedState.isDehydrated)try{ul(t.containerInfo)}catch(h){ft(e,e.return,h)}Hg&&(Hg=!1,vT(e));break;case 4:n=Wn,Wn=yp(e.stateNode.containerInfo),ja(t,e),Va(e),Wn=n;break;case 12:ja(t,e),Va(e);break;case 31:ja(t,e),Va(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Tf(e,n)));break;case 13:ja(t,e),Va(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(_p=dn()),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Tf(e,n)));break;case 22:r=e.memoizedState!==null;var l=a!==null&&a.memoizedState!==null,u=_r,c=aa;if(_r=u||r,aa=c||l,ja(t,e),aa=c,_r=u,Va(e),n&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(a===null||l||_r||aa||gi(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){l=a=t;try{if(o=l.stateNode,r)i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none";else{s=l.stateNode;var d=l.memoizedProps.style,p=d!=null&&d.hasOwnProperty("display")?d.display:null;s.style.display=p==null||typeof p=="boolean"?"":(""+p).trim()}}catch(h){ft(l,l.return,h)}}}else if(t.tag===6){if(a===null){l=t;try{l.stateNode.nodeValue=r?"":l.memoizedProps}catch(h){ft(l,l.return,h)}}}else if(t.tag===18){if(a===null){l=t;try{var m=l.stateNode;r?sC(m,!0):sC(l.stateNode,!1)}catch(h){ft(l,l.return,h)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}n&4&&(n=e.updateQueue,n!==null&&(a=n.retryQueue,a!==null&&(n.retryQueue=null,Tf(e,a))));break;case 19:ja(t,e),Va(e),n&4&&(n=e.updateQueue,n!==null&&(e.updateQueue=null,Tf(e,n)));break;case 30:break;case 21:break;default:ja(t,e),Va(e)}}function Va(e){var t=e.flags;if(t&2){try{for(var a,n=e.return;n!==null;){if(dT(n)){a=n;break}n=n.return}if(a==null)throw Error(z(160));switch(a.tag){case 27:var r=a.stateNode,o=qg(e);up(e,o,r);break;case 5:var i=a.stateNode;a.flags&32&&(tl(i,""),a.flags&=-33);var s=qg(e);up(e,s,i);break;case 3:case 4:var l=a.stateNode.containerInfo,u=qg(e);Ay(e,u,l);break;default:throw Error(z(161))}}catch(c){ft(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function vT(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;vT(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Mr(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)pT(e,t.alternate,t),t=t.sibling}function gi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Oo(4,t,t.return),gi(t);break;case 1:ur(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&uT(t,t.return,a),gi(t);break;case 27:Ku(t.stateNode);case 26:case 5:ur(t,t.return),gi(t);break;case 22:t.memoizedState===null&&gi(t);break;case 30:gi(t);break;default:gi(t)}e=e.sibling}}function Rr(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var n=t.alternate,r=e,o=t,i=o.flags;switch(o.tag){case 0:case 11:case 15:Rr(r,o,a),wc(4,o);break;case 1:if(Rr(r,o,a),n=o,r=n.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(u){ft(n,n.return,u)}if(n=o,r=n.updateQueue,r!==null){var s=n.stateNode;try{var l=r.shared.hiddenCallbacks;if(l!==null)for(r.shared.hiddenCallbacks=null,r=0;r<l.length;r++)gk(l[r],s)}catch(u){ft(n,n.return,u)}}a&&i&64&&lT(o),$u(o,o.return);break;case 27:fT(o);case 26:case 5:Rr(r,o,a),a&&n===null&&i&4&&cT(o),$u(o,o.return);break;case 12:Rr(r,o,a);break;case 31:Rr(r,o,a),a&&i&4&&gT(r,o);break;case 13:Rr(r,o,a),a&&i&4&&yT(r,o);break;case 22:o.memoizedState===null&&Rr(r,o,a),$u(o,o.return);break;case 30:break;default:Rr(r,o,a)}t=t.sibling}}function Ew(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&gc(a))}function Aw(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&gc(e))}function $n(e,t,a,n){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xT(e,t,a,n),t=t.sibling}function xT(e,t,a,n){var r=t.flags;switch(t.tag){case 0:case 11:case 15:$n(e,t,a,n),r&2048&&wc(9,t);break;case 1:$n(e,t,a,n);break;case 3:$n(e,t,a,n),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&gc(e)));break;case 12:if(r&2048){$n(e,t,a,n),e=t.stateNode;try{var o=t.memoizedProps,i=o.id,s=o.onPostCommit;typeof s=="function"&&s(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(l){ft(t,t.return,l)}}else $n(e,t,a,n);break;case 31:$n(e,t,a,n);break;case 13:$n(e,t,a,n);break;case 23:break;case 22:o=t.stateNode,i=t.alternate,t.memoizedState!==null?o._visibility&2?$n(e,t,a,n):Wu(e,t):o._visibility&2?$n(e,t,a,n):(o._visibility|=2,Ds(e,t,a,n,(t.subtreeFlags&10256)!==0||!1)),r&2048&&Ew(i,t);break;case 24:$n(e,t,a,n),r&2048&&Aw(t.alternate,t);break;default:$n(e,t,a,n)}}function Ds(e,t,a,n,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var o=e,i=t,s=a,l=n,u=i.flags;switch(i.tag){case 0:case 11:case 15:Ds(o,i,s,l,r),wc(8,i);break;case 23:break;case 22:var c=i.stateNode;i.memoizedState!==null?c._visibility&2?Ds(o,i,s,l,r):Wu(o,i):(c._visibility|=2,Ds(o,i,s,l,r)),r&&u&2048&&Ew(i.alternate,i);break;case 24:Ds(o,i,s,l,r),r&&u&2048&&Aw(i.alternate,i);break;default:Ds(o,i,s,l,r)}t=t.sibling}}function Wu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,n=t,r=n.flags;switch(n.tag){case 22:Wu(a,n),r&2048&&Ew(n.alternate,n);break;case 24:Wu(a,n),r&2048&&Aw(n.alternate,n);break;default:Wu(a,n)}t=t.sibling}}var Nu=8192;function Rs(e,t,a){if(e.subtreeFlags&Nu)for(e=e.child;e!==null;)bT(e,t,a),e=e.sibling}function bT(e,t,a){switch(e.tag){case 26:Rs(e,t,a),e.flags&Nu&&e.memoizedState!==null&&oq(a,Wn,e.memoizedState,e.memoizedProps);break;case 5:Rs(e,t,a);break;case 3:case 4:var n=Wn;Wn=yp(e.stateNode.containerInfo),Rs(e,t,a),Wn=n;break;case 22:e.memoizedState===null&&(n=e.alternate,n!==null&&n.memoizedState!==null?(n=Nu,Nu=16777216,Rs(e,t,a),Nu=n):Rs(e,t,a));break;default:Rs(e,t,a)}}function ST(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Au(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];da=n,CT(n,e)}ST(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)IT(e),e=e.sibling}function IT(e){switch(e.tag){case 0:case 11:case 15:Au(e),e.flags&2048&&Oo(9,e,e.return);break;case 3:Au(e);break;case 12:Au(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hf(e)):Au(e);break;default:Au(e)}}function Hf(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var n=t[a];da=n,CT(n,e)}ST(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Oo(8,t,t.return),Hf(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Hf(t));break;default:Hf(t)}e=e.sibling}}function CT(e,t){for(;da!==null;){var a=da;switch(a.tag){case 0:case 11:case 15:Oo(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var n=a.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:gc(a.memoizedState.cache)}if(n=a.child,n!==null)n.return=a,da=n;else e:for(a=e;da!==null;){n=da;var r=n.sibling,o=n.return;if(mT(n),n===a){da=null;break e}if(r!==null){r.return=o,da=r;break e}da=o}}}var SF={getCacheForType:function(e){var t=xa(na),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return xa(na).controller.signal}},IF=typeof WeakMap=="function"?WeakMap:Map,st=0,vt=null,Xe=null,Ke=0,dt=0,sn=null,bo=!1,ml=!1,Mw=!1,Vr=0,jt=0,No=0,bi=0,Rw=0,cn=0,ol=0,Gu=null,Wa=null,My=!1,_p=0,kT=0,cp=1/0,dp=null,Eo=null,ia=0,Ao=null,il=null,zr=0,Ry=0,Dy=null,TT=null,Xu=0,_y=null;function mn(){return(st&2)!==0&&Ke!==0?Ke&-Ke:Te.T!==null?_w():OC()}function LT(){if(cn===0)if((Ke&536870912)===0||Ze){var e=gf;gf<<=1,(gf&3932160)===0&&(gf=262144),cn=e}else cn=536870912;return e=gn.current,e!==null&&(e.flags|=32),cn}function Ga(e,t,a){(e===vt&&(dt===2||dt===9)||e.cancelPendingCommit!==null)&&(sl(e,0),So(e,Ke,cn,!1)),pc(e,a),((st&2)===0||e!==vt)&&(e===vt&&((st&2)===0&&(bi|=a),jt===4&&So(e,Ke,cn,!1)),fr(e))}function ET(e,t,a){if((st&6)!==0)throw Error(z(327));var n=!a&&(t&127)===0&&(t&e.expiredLanes)===0||fc(e,t),r=n?TF(e,t):jg(e,t,!0),o=n;do{if(r===0){ml&&!n&&So(e,t,0,!1);break}else{if(a=e.current.alternate,o&&!CF(a)){r=jg(e,t,!1),o=!1;continue}if(r===2){if(o=t,e.errorRecoveryDisabledLanes&o)var i=0;else i=e.pendingLanes&-536870913,i=i!==0?i:i&536870912?536870912:0;if(i!==0){t=i;e:{var s=e;r=Gu;var l=s.current.memoizedState.isDehydrated;if(l&&(sl(s,i).flags|=256),i=jg(s,i,!1),i!==2){if(Mw&&!l){s.errorRecoveryDisabledLanes|=o,bi|=o,r=4;break e}o=Wa,Wa=r,o!==null&&(Wa===null?Wa=o:Wa.push.apply(Wa,o))}r=i}if(o=!1,r!==2)continue}}if(r===1){sl(e,0),So(e,t,0,!0);break}e:{switch(n=e,o=r,o){case 0:case 1:throw Error(z(345));case 4:if((t&4194048)!==t)break;case 6:So(n,t,cn,!bo);break e;case 2:Wa=null;break;case 3:case 5:break;default:throw Error(z(329))}if((t&62914560)===t&&(r=_p+300-dn(),10<r)){if(So(n,t,cn,!bo),Sp(n,0,!0)!==0)break e;zr=t,n.timeoutHandle=XT(W0.bind(null,n,a,Wa,dp,My,t,cn,bi,ol,bo,o,"Throttled",-0,0),r);break e}W0(n,a,Wa,dp,My,t,cn,bi,ol,bo,o,null,-0,0)}}break}while(!0);fr(e)}function W0(e,t,a,n,r,o,i,s,l,u,c,d,p,m){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)===16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Or},bT(t,o,d);var h=(o&62914560)===o?_p-dn():(o&4194048)===o?kT-dn():0;if(h=iq(d,h),h!==null){zr=o,e.cancelPendingCommit=h(X0.bind(null,e,t,o,a,n,r,i,s,l,c,d,null,p,m)),So(e,o,i,!u);return}}X0(e,t,o,a,n,r,i,s,l)}function CF(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var n=0;n<a.length;n++){var r=a[n],o=r.getSnapshot;r=r.value;try{if(!hn(o(),r))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function So(e,t,a,n){t&=~Rw,t&=~bi,e.suspendedLanes|=t,e.pingedLanes&=~t,n&&(e.warmLanes|=t),n=e.expirationTimes;for(var r=t;0<r;){var o=31-pn(r),i=1<<o;n[o]=-1,r&=~i}a!==0&&DC(e,a,t)}function Pp(){return(st&6)===0?(vc(0,!1),!1):!0}function Dw(){if(Xe!==null){if(dt===0)var e=Xe.return;else e=Xe,Nr=Ri=null,yw(e),Ys=null,ac=0,e=Xe;for(;e!==null;)sT(e.alternate,e),e=e.return;Xe=null}}function sl(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,HF(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),zr=0,Dw(),vt=e,Xe=a=Ur(e.current,null),Ke=t,dt=0,sn=null,bo=!1,ml=fc(e,t),Mw=!1,ol=cn=Rw=bi=No=jt=0,Wa=Gu=null,My=!1,(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-pn(n),o=1<<r;t|=e[r],n&=~o}return Vr=t,Tp(),a}function AT(e,t){Pe=null,Te.H=rc,t===pl||t===Ep?(t=C0(),dt=3):t===cw?(t=C0(),dt=4):dt=t===Tw?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,sn=t,Xe===null&&(jt=1,sp(e,Mn(t,e.current)))}function MT(){var e=gn.current;return e===null?!0:(Ke&4194048)===Ke?Dn===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?e===Dn:!1}function RT(){var e=Te.H;return Te.H=rc,e===null?rc:e}function DT(){var e=Te.A;return Te.A=SF,e}function fp(){jt=4,bo||(Ke&4194048)!==Ke&&gn.current!==null||(ml=!0),(No&134217727)===0&&(bi&134217727)===0||vt===null||So(vt,Ke,cn,!1)}function jg(e,t,a){var n=st;st|=2;var r=RT(),o=DT();(vt!==e||Ke!==t)&&(dp=null,sl(e,t)),t=!1;var i=jt;e:do try{if(dt!==0&&Xe!==null){var s=Xe,l=sn;switch(dt){case 8:Dw(),i=6;break e;case 3:case 2:case 9:case 6:gn.current===null&&(t=!0);var u=dt;if(dt=0,sn=null,$s(e,s,l,u),a&&ml){i=0;break e}break;default:u=dt,dt=0,sn=null,$s(e,s,l,u)}}kF(),i=jt;break}catch(c){AT(e,c)}while(!0);return t&&e.shellSuspendCounter++,Nr=Ri=null,st=n,Te.H=r,Te.A=o,Xe===null&&(vt=null,Ke=0,Tp()),i}function kF(){for(;Xe!==null;)_T(Xe)}function TF(e,t){var a=st;st|=2;var n=RT(),r=DT();vt!==e||Ke!==t?(dp=null,cp=dn()+500,sl(e,t)):ml=fc(e,t);e:do try{if(dt!==0&&Xe!==null){t=Xe;var o=sn;t:switch(dt){case 1:dt=0,sn=null,$s(e,t,o,1);break;case 2:case 9:if(I0(o)){dt=0,sn=null,G0(t);break}t=function(){dt!==2&&dt!==9||vt!==e||(dt=7),fr(e)},o.then(t,t);break e;case 3:dt=7;break e;case 4:dt=5;break e;case 7:I0(o)?(dt=0,sn=null,G0(t)):(dt=0,sn=null,$s(e,t,o,7));break;case 5:var i=null;switch(Xe.tag){case 26:i=Xe.memoizedState;case 5:case 27:var s=Xe;if(i?QT(i):s.stateNode.complete){dt=0,sn=null;var l=s.sibling;if(l!==null)Xe=l;else{var u=s.return;u!==null?(Xe=u,Op(u)):Xe=null}break t}}dt=0,sn=null,$s(e,t,o,5);break;case 6:dt=0,sn=null,$s(e,t,o,6);break;case 8:Dw(),jt=6;break e;default:throw Error(z(462))}}LF();break}catch(c){AT(e,c)}while(!0);return Nr=Ri=null,Te.H=n,Te.A=r,st=a,Xe!==null?0:(vt=null,Ke=0,Tp(),jt)}function LF(){for(;Xe!==null&&!Y3();)_T(Xe)}function _T(e){var t=iT(e.alternate,e,Vr);e.memoizedProps=e.pendingProps,t===null?Op(e):Xe=t}function G0(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=F0(a,t,t.pendingProps,t.type,void 0,Ke);break;case 11:t=F0(a,t,t.pendingProps,t.type.render,t.ref,Ke);break;case 5:yw(t);default:sT(a,t),t=Xe=sk(t,Vr),t=iT(a,t,Vr)}e.memoizedProps=e.pendingProps,t===null?Op(e):Xe=t}function $s(e,t,a,n){Nr=Ri=null,yw(t),Ys=null,ac=0;var r=t.return;try{if(hF(e,r,t,a,Ke)){jt=1,sp(e,Mn(a,e.current)),Xe=null;return}}catch(o){if(r!==null)throw Xe=r,o;jt=1,sp(e,Mn(a,e.current)),Xe=null;return}t.flags&32768?(Ze||n===1?e=!0:ml||(Ke&536870912)!==0?e=!1:(bo=e=!0,(n===2||n===9||n===3||n===6)&&(n=gn.current,n!==null&&n.tag===13&&(n.flags|=16384))),PT(t,e)):Op(t)}function Op(e){var t=e;do{if((t.flags&32768)!==0){PT(t,bo);return}e=t.return;var a=wF(t.alternate,t,Vr);if(a!==null){Xe=a;return}if(t=t.sibling,t!==null){Xe=t;return}Xe=t=e}while(t!==null);jt===0&&(jt=5)}function PT(e,t){do{var a=vF(e.alternate,e);if(a!==null){a.flags&=32767,Xe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Xe=e;return}Xe=e=a}while(e!==null);jt=6,Xe=null}function X0(e,t,a,n,r,o,i,s,l){e.cancelPendingCommit=null;do Np();while(ia!==0);if((st&6)!==0)throw Error(z(327));if(t!==null){if(t===e.current)throw Error(z(177));if(o=t.lanes|t.childLanes,o|=nw,iz(e,a,o,i,s,l),e===vt&&(Xe=vt=null,Ke=0),il=t,Ao=e,zr=a,Ry=o,Dy=r,TT=n,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,RF(Yf,function(){return zT(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||n){n=Te.T,Te.T=null,r=lt.p,lt.p=2,i=st,st|=4;try{xF(e,t,a)}finally{st=i,lt.p=r,Te.T=n}}ia=1,OT(),NT(),UT()}}function OT(){if(ia===1){ia=0;var e=Ao,t=il,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=Te.T,Te.T=null;var n=lt.p;lt.p=2;var r=st;st|=4;try{wT(t,e);var o=Uy,i=QC(e.containerInfo),s=o.focusedElem,l=o.selectionRange;if(i!==s&&s&&s.ownerDocument&&JC(s.ownerDocument.documentElement,s)){if(l!==null&&aw(s)){var u=l.start,c=l.end;if(c===void 0&&(c=u),"selectionStart"in s)s.selectionStart=u,s.selectionEnd=Math.min(c,s.value.length);else{var d=s.ownerDocument||document,p=d&&d.defaultView||window;if(p.getSelection){var m=p.getSelection(),h=s.textContent.length,v=Math.min(l.start,h),I=l.end===void 0?v:Math.min(l.end,h);!m.extend&&v>I&&(i=I,I=v,v=i);var y=g0(s,v),w=g0(s,I);if(y&&w&&(m.rangeCount!==1||m.anchorNode!==y.node||m.anchorOffset!==y.offset||m.focusNode!==w.node||m.focusOffset!==w.offset)){var g=d.createRange();g.setStart(y.node,y.offset),m.removeAllRanges(),v>I?(m.addRange(g),m.extend(w.node,w.offset)):(g.setEnd(w.node,w.offset),m.addRange(g))}}}}for(d=[],m=s;m=m.parentNode;)m.nodeType===1&&d.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<d.length;s++){var S=d[s];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}xp=!!Ny,Uy=Ny=null}finally{st=r,lt.p=n,Te.T=a}}e.current=t,ia=2}}function NT(){if(ia===2){ia=0;var e=Ao,t=il,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=Te.T,Te.T=null;var n=lt.p;lt.p=2;var r=st;st|=4;try{pT(e,t.alternate,t)}finally{st=r,lt.p=n,Te.T=a}}ia=3}}function UT(){if(ia===4||ia===3){ia=0,Z3();var e=Ao,t=il,a=zr,n=TT;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ia=5:(ia=0,il=Ao=null,BT(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Eo=null),Ky(a),t=t.stateNode,fn&&typeof fn.onCommitFiberRoot=="function")try{fn.onCommitFiberRoot(dc,t,void 0,(t.current.flags&128)===128)}catch{}if(n!==null){t=Te.T,r=lt.p,lt.p=2,Te.T=null;try{for(var o=e.onRecoverableError,i=0;i<n.length;i++){var s=n[i];o(s.value,{componentStack:s.stack})}}finally{Te.T=t,lt.p=r}}(zr&3)!==0&&Np(),fr(e),r=e.pendingLanes,(a&261930)!==0&&(r&42)!==0?e===_y?Xu++:(Xu=0,_y=e):Xu=0,vc(0,!1)}}function BT(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,gc(t)))}function Np(){return OT(),NT(),UT(),zT()}function zT(){if(ia!==5)return!1;var e=Ao,t=Ry;Ry=0;var a=Ky(zr),n=Te.T,r=lt.p;try{lt.p=32>a?32:a,Te.T=null,a=Dy,Dy=null;var o=Ao,i=zr;if(ia=0,il=Ao=null,zr=0,(st&6)!==0)throw Error(z(331));var s=st;if(st|=4,IT(o.current),xT(o,o.current,i,a),st=s,vc(0,!1),fn&&typeof fn.onPostCommitFiberRoot=="function")try{fn.onPostCommitFiberRoot(dc,o)}catch{}return!0}finally{lt.p=r,Te.T=n,BT(e,t)}}function K0(e,t,a){t=Mn(a,t),t=Ty(e.stateNode,t,2),e=Lo(e,t,2),e!==null&&(pc(e,2),fr(e))}function ft(e,t,a){if(e.tag===3)K0(e,e,a);else for(;t!==null;){if(t.tag===3){K0(t,e,a);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Eo===null||!Eo.has(n))){e=Mn(a,e),a=eT(2),n=Lo(t,a,2),n!==null&&(tT(a,n,t,e),pc(n,2),fr(n));break}}t=t.return}}function Vg(e,t,a){var n=e.pingCache;if(n===null){n=e.pingCache=new IF;var r=new Set;n.set(t,r)}else r=n.get(t),r===void 0&&(r=new Set,n.set(t,r));r.has(a)||(Mw=!0,r.add(a),e=EF.bind(null,e,t,a),t.then(e,e))}function EF(e,t,a){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,vt===e&&(Ke&a)===a&&(jt===4||jt===3&&(Ke&62914560)===Ke&&300>dn()-_p?(st&2)===0&&sl(e,0):Rw|=a,ol===Ke&&(ol=0)),fr(e)}function FT(e,t){t===0&&(t=RC()),e=Mi(e,t),e!==null&&(pc(e,t),fr(e))}function AF(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),FT(e,a)}function MF(e,t){var a=0;switch(e.tag){case 31:case 13:var n=e.stateNode,r=e.memoizedState;r!==null&&(a=r.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(z(314))}n!==null&&n.delete(t),FT(e,a)}function RF(e,t){return Gy(e,t)}var pp=null,_s=null,Py=!1,mp=!1,$g=!1,Io=0;function fr(e){e!==_s&&e.next===null&&(_s===null?pp=_s=e:_s=_s.next=e),mp=!0,Py||(Py=!0,_F())}function vc(e,t){if(!$g&&mp){$g=!0;do for(var a=!1,n=pp;n!==null;){if(!t)if(e!==0){var r=n.pendingLanes;if(r===0)var o=0;else{var i=n.suspendedLanes,s=n.pingedLanes;o=(1<<31-pn(42|e)+1)-1,o&=r&~(i&~s),o=o&201326741?o&201326741|1:o?o|2:0}o!==0&&(a=!0,Y0(n,o))}else o=Ke,o=Sp(n,n===vt?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(o&3)===0||fc(n,o)||(a=!0,Y0(n,o));n=n.next}while(a);$g=!1}}function DF(){qT()}function qT(){mp=Py=!1;var e=0;Io!==0&&qF()&&(e=Io);for(var t=dn(),a=null,n=pp;n!==null;){var r=n.next,o=HT(n,t);o===0?(n.next=null,a===null?pp=r:a.next=r,r===null&&(_s=a)):(a=n,(e!==0||(o&3)!==0)&&(mp=!0)),n=r}ia!==0&&ia!==5||vc(e,!1),Io!==0&&(Io=0)}function HT(e,t){for(var a=e.suspendedLanes,n=e.pingedLanes,r=e.expirationTimes,o=e.pendingLanes&-62914561;0<o;){var i=31-pn(o),s=1<<i,l=r[i];l===-1?((s&a)===0||(s&n)!==0)&&(r[i]=oz(s,t)):l<=t&&(e.expiredLanes|=s),o&=~s}if(t=vt,a=Ke,a=Sp(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n=e.callbackNode,a===0||e===t&&(dt===2||dt===9)||e.cancelPendingCommit!==null)return n!==null&&n!==null&&xg(n),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||fc(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(n!==null&&xg(n),Ky(a)){case 2:case 8:a=AC;break;case 32:a=Yf;break;case 268435456:a=MC;break;default:a=Yf}return n=jT.bind(null,e),a=Gy(a,n),e.callbackPriority=t,e.callbackNode=a,t}return n!==null&&n!==null&&xg(n),e.callbackPriority=2,e.callbackNode=null,2}function jT(e,t){if(ia!==0&&ia!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Np()&&e.callbackNode!==a)return null;var n=Ke;return n=Sp(e,e===vt?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),n===0?null:(ET(e,n,t),HT(e,dn()),e.callbackNode!=null&&e.callbackNode===a?jT.bind(null,e):null)}function Y0(e,t){if(Np())return null;ET(e,t,!0)}function _F(){jF(function(){(st&6)!==0?Gy(EC,DF):qT()})}function _w(){if(Io===0){var e=al;e===0&&(e=hf,hf<<=1,(hf&261888)===0&&(hf=256)),Io=e}return Io}function Z0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:_f(""+e)}function J0(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function PF(e,t,a,n,r){if(t==="submit"&&a&&a.stateNode===r){var o=Z0((r[Xa]||null).action),i=n.submitter;i&&(t=(t=i[Xa]||null)?Z0(t.formAction):i.getAttribute("formAction"),t!==null&&(o=t,i=null));var s=new Ip("action","action",null,n,r);e.push({event:s,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(Io!==0){var l=i?J0(r,i):new FormData(r);Cy(a,{pending:!0,data:l,method:r.method,action:o},null,l)}}else typeof o=="function"&&(s.preventDefault(),l=i?J0(r,i):new FormData(r),Cy(a,{pending:!0,data:l,method:r.method,action:o},o,l))},currentTarget:r}]})}}for(Lf=0;Lf<fy.length;Lf++)Ef=fy[Lf],Q0=Ef.toLowerCase(),eC=Ef[0].toUpperCase()+Ef.slice(1),Gn(Q0,"on"+eC);var Ef,Q0,eC,Lf;Gn(tk,"onAnimationEnd");Gn(ak,"onAnimationIteration");Gn(nk,"onAnimationStart");Gn("dblclick","onDoubleClick");Gn("focusin","onFocus");Gn("focusout","onBlur");Gn(Jz,"onTransitionRun");Gn(Qz,"onTransitionStart");Gn(eF,"onTransitionCancel");Gn(rk,"onTransitionEnd");el("onMouseEnter",["mouseout","mouseover"]);el("onMouseLeave",["mouseout","mouseover"]);el("onPointerEnter",["pointerout","pointerover"]);el("onPointerLeave",["pointerout","pointerover"]);Li("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Li("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Li("onBeforeInput",["compositionend","keypress","textInput","paste"]);Li("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Li("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Li("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var oc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),OF=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(oc));function VT(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var n=e[a],r=n.event;n=n.listeners;e:{var o=void 0;if(t)for(var i=n.length-1;0<=i;i--){var s=n[i],l=s.instance,u=s.currentTarget;if(s=s.listener,l!==o&&r.isPropagationStopped())break e;o=s,r.currentTarget=u;try{o(r)}catch(c){Jf(c)}r.currentTarget=null,o=l}else for(i=0;i<n.length;i++){if(s=n[i],l=s.instance,u=s.currentTarget,s=s.listener,l!==o&&r.isPropagationStopped())break e;o=s,r.currentTarget=u;try{o(r)}catch(c){Jf(c)}r.currentTarget=null,o=l}}}}function Ge(e,t){var a=t[ry];a===void 0&&(a=t[ry]=new Set);var n=e+"__bubble";a.has(n)||($T(t,e,2,!1),a.add(n))}function Wg(e,t,a){var n=0;t&&(n|=4),$T(a,e,n,t)}var Af="_reactListening"+Math.random().toString(36).slice(2);function Pw(e){if(!e[Af]){e[Af]=!0,NC.forEach(function(a){a!=="selectionchange"&&(OF.has(a)||Wg(a,!1,e),Wg(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Af]||(t[Af]=!0,Wg("selectionchange",!1,t))}}function $T(e,t,a,n){switch(r1(t)){case 2:var r=uq;break;case 8:r=cq;break;default:r=Bw}a=r.bind(null,t,a,e),r=void 0,!uy||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),n?r!==void 0?e.addEventListener(t,a,{capture:!0,passive:r}):e.addEventListener(t,a,!0):r!==void 0?e.addEventListener(t,a,{passive:r}):e.addEventListener(t,a,!1)}function Gg(e,t,a,n,r){var o=n;if((t&1)===0&&(t&2)===0&&n!==null)e:for(;;){if(n===null)return;var i=n.tag;if(i===3||i===4){var s=n.stateNode.containerInfo;if(s===r)break;if(i===4)for(i=n.return;i!==null;){var l=i.tag;if((l===3||l===4)&&i.stateNode.containerInfo===r)return;i=i.return}for(;s!==null;){if(i=Ns(s),i===null)return;if(l=i.tag,l===5||l===6||l===26||l===27){n=o=i;continue e}s=s.parentNode}}n=n.return}VC(function(){var u=o,c=Jy(a),d=[];e:{var p=ok.get(e);if(p!==void 0){var m=Ip,h=e;switch(e){case"keypress":if(Of(a)===0)break e;case"keydown":case"keyup":m=Mz;break;case"focusin":h="focus",m=kg;break;case"focusout":h="blur",m=kg;break;case"beforeblur":case"afterblur":m=kg;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=s0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=wz;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=_z;break;case tk:case ak:case nk:m=bz;break;case rk:m=Oz;break;case"scroll":case"scrollend":m=gz;break;case"wheel":m=Uz;break;case"copy":case"cut":case"paste":m=Iz;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=u0;break;case"toggle":case"beforetoggle":m=zz}var v=(t&4)!==0,I=!v&&(e==="scroll"||e==="scrollend"),y=v?p!==null?p+"Capture":null:p;v=[];for(var w=u,g;w!==null;){var S=w;if(g=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||g===null||y===null||(S=Zu(w,y),S!=null&&v.push(ic(w,S,g))),I)break;w=w.return}0<v.length&&(p=new m(p,h,null,a,c),d.push({event:p,listeners:v}))}}if((t&7)===0){e:{if(p=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",p&&a!==ly&&(h=a.relatedTarget||a.fromElement)&&(Ns(h)||h[cl]))break e;if((m||p)&&(p=c.window===c?c:(p=c.ownerDocument)?p.defaultView||p.parentWindow:window,m?(h=a.relatedTarget||a.toElement,m=u,h=h?Ns(h):null,h!==null&&(I=cc(h),v=h.tag,h!==I||v!==5&&v!==27&&v!==6)&&(h=null)):(m=null,h=u),m!==h)){if(v=s0,S="onMouseLeave",y="onMouseEnter",w="mouse",(e==="pointerout"||e==="pointerover")&&(v=u0,S="onPointerLeave",y="onPointerEnter",w="pointer"),I=m==null?p:Pu(m),g=h==null?p:Pu(h),p=new v(S,w+"leave",m,a,c),p.target=I,p.relatedTarget=g,S=null,Ns(c)===u&&(v=new v(y,w+"enter",h,a,c),v.target=g,v.relatedTarget=I,S=v),I=S,m&&h)t:{for(v=NF,y=m,w=h,g=0,S=y;S;S=v(S))g++;S=0;for(var E=w;E;E=v(E))S++;for(;0<g-S;)y=v(y),g--;for(;0<S-g;)w=v(w),S--;for(;g--;){if(y===w||w!==null&&y===w.alternate){v=y;break t}y=v(y),w=v(w)}v=null}else v=null;m!==null&&tC(d,p,m,v,!1),h!==null&&I!==null&&tC(d,I,h,v,!0)}}e:{if(p=u?Pu(u):window,m=p.nodeName&&p.nodeName.toLowerCase(),m==="select"||m==="input"&&p.type==="file")var T=p0;else if(f0(p))if(YC)T=Kz;else{T=Gz;var R=Wz}else m=p.nodeName,!m||m.toLowerCase()!=="input"||p.type!=="checkbox"&&p.type!=="radio"?u&&Zy(u.elementType)&&(T=p0):T=Xz;if(T&&(T=T(e,u))){KC(d,T,a,c);break e}R&&R(e,p,u),e==="focusout"&&u&&p.type==="number"&&u.memoizedProps.value!=null&&sy(p,"number",p.value)}switch(R=u?Pu(u):window,e){case"focusin":(f0(R)||R.contentEditable==="true")&&(zs=R,cy=u,zu=null);break;case"focusout":zu=cy=zs=null;break;case"mousedown":dy=!0;break;case"contextmenu":case"mouseup":case"dragend":dy=!1,y0(d,a,c);break;case"selectionchange":if(Zz)break;case"keydown":case"keyup":y0(d,a,c)}var O;if(tw)e:{switch(e){case"compositionstart":var U="onCompositionStart";break e;case"compositionend":U="onCompositionEnd";break e;case"compositionupdate":U="onCompositionUpdate";break e}U=void 0}else Bs?GC(e,a)&&(U="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(U="onCompositionStart");U&&(WC&&a.locale!=="ko"&&(Bs||U!=="onCompositionStart"?U==="onCompositionEnd"&&Bs&&(O=$C()):(xo=c,Qy="value"in xo?xo.value:xo.textContent,Bs=!0)),R=hp(u,U),0<R.length&&(U=new l0(U,e,null,a,c),d.push({event:U,listeners:R}),O?U.data=O:(O=XC(a),O!==null&&(U.data=O)))),(O=qz?Hz(e,a):jz(e,a))&&(U=hp(u,"onBeforeInput"),0<U.length&&(R=new l0("onBeforeInput","beforeinput",null,a,c),d.push({event:R,listeners:U}),R.data=O)),PF(d,e,u,a,c)}VT(d,t)})}function ic(e,t,a){return{instance:e,listener:t,currentTarget:a}}function hp(e,t){for(var a=t+"Capture",n=[];e!==null;){var r=e,o=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||o===null||(r=Zu(e,a),r!=null&&n.unshift(ic(e,r,o)),r=Zu(e,t),r!=null&&n.push(ic(e,r,o))),e.tag===3)return n;e=e.return}return[]}function NF(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function tC(e,t,a,n,r){for(var o=t._reactName,i=[];a!==null&&a!==n;){var s=a,l=s.alternate,u=s.stateNode;if(s=s.tag,l!==null&&l===n)break;s!==5&&s!==26&&s!==27||u===null||(l=u,r?(u=Zu(a,o),u!=null&&i.unshift(ic(a,u,l))):r||(u=Zu(a,o),u!=null&&i.push(ic(a,u,l)))),a=a.return}i.length!==0&&e.push({event:t,listeners:i})}var UF=/\r\n?/g,BF=/\u0000|\uFFFD/g;function aC(e){return(typeof e=="string"?e:""+e).replace(UF,`
9
+ `).replace(BF,"")}function WT(e,t){return t=aC(t),aC(e)===t}function gt(e,t,a,n,r,o){switch(a){case"children":typeof n=="string"?t==="body"||t==="textarea"&&n===""||tl(e,n):(typeof n=="number"||typeof n=="bigint")&&t!=="body"&&tl(e,""+n);break;case"className":wf(e,"class",n);break;case"tabIndex":wf(e,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":wf(e,a,n);break;case"style":jC(e,n,o);break;case"data":if(t!=="object"){wf(e,"data",n);break}case"src":case"href":if(n===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=_f(""+n),e.setAttribute(a,n);break;case"action":case"formAction":if(typeof n=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof o=="function"&&(a==="formAction"?(t!=="input"&&gt(e,t,"name",r.name,r,null),gt(e,t,"formEncType",r.formEncType,r,null),gt(e,t,"formMethod",r.formMethod,r,null),gt(e,t,"formTarget",r.formTarget,r,null)):(gt(e,t,"encType",r.encType,r,null),gt(e,t,"method",r.method,r,null),gt(e,t,"target",r.target,r,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){e.removeAttribute(a);break}n=_f(""+n),e.setAttribute(a,n);break;case"onClick":n!=null&&(e.onclick=Or);break;case"onScroll":n!=null&&Ge("scroll",e);break;case"onScrollEnd":n!=null&&Ge("scrollend",e);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(z(61));if(a=n.__html,a!=null){if(r.children!=null)throw Error(z(60));e.innerHTML=a}}break;case"multiple":e.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":e.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){e.removeAttribute("xlink:href");break}a=_f(""+n),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""+n):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":n&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":n===!0?e.setAttribute(a,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?e.setAttribute(a,n):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?e.setAttribute(a,n):e.removeAttribute(a);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?e.removeAttribute(a):e.setAttribute(a,n);break;case"popover":Ge("beforetoggle",e),Ge("toggle",e),Df(e,"popover",n);break;case"xlinkActuate":Lr(e,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":Lr(e,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":Lr(e,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":Lr(e,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":Lr(e,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":Lr(e,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":Lr(e,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":Lr(e,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":Lr(e,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":Df(e,"is",n);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=mz.get(a)||a,Df(e,a,n))}}function Oy(e,t,a,n,r,o){switch(a){case"style":jC(e,n,o);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(z(61));if(a=n.__html,a!=null){if(r.children!=null)throw Error(z(60));e.innerHTML=a}}break;case"children":typeof n=="string"?tl(e,n):(typeof n=="number"||typeof n=="bigint")&&tl(e,""+n);break;case"onScroll":n!=null&&Ge("scroll",e);break;case"onScrollEnd":n!=null&&Ge("scrollend",e);break;case"onClick":n!=null&&(e.onclick=Or);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!UC.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(r=a.endsWith("Capture"),t=a.slice(2,r?a.length-7:void 0),o=e[Xa]||null,o=o!=null?o[a]:null,typeof o=="function"&&e.removeEventListener(t,o,r),typeof n=="function")){typeof o!="function"&&o!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,n,r);break e}a in e?e[a]=n:n===!0?e.setAttribute(a,""):Df(e,a,n)}}}function ba(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ge("error",e),Ge("load",e);var n=!1,r=!1,o;for(o in a)if(a.hasOwnProperty(o)){var i=a[o];if(i!=null)switch(o){case"src":n=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(z(137,t));default:gt(e,t,o,i,a,null)}}r&&gt(e,t,"srcSet",a.srcSet,a,null),n&&gt(e,t,"src",a.src,a,null);return;case"input":Ge("invalid",e);var s=o=i=r=null,l=null,u=null;for(n in a)if(a.hasOwnProperty(n)){var c=a[n];if(c!=null)switch(n){case"name":r=c;break;case"type":i=c;break;case"checked":l=c;break;case"defaultChecked":u=c;break;case"value":o=c;break;case"defaultValue":s=c;break;case"children":case"dangerouslySetInnerHTML":if(c!=null)throw Error(z(137,t));break;default:gt(e,t,n,c,a,null)}}FC(e,o,s,l,u,i,r,!1);return;case"select":Ge("invalid",e),n=i=o=null;for(r in a)if(a.hasOwnProperty(r)&&(s=a[r],s!=null))switch(r){case"value":o=s;break;case"defaultValue":i=s;break;case"multiple":n=s;default:gt(e,t,r,s,a,null)}t=o,a=i,e.multiple=!!n,t!=null?Gs(e,!!n,t,!1):a!=null&&Gs(e,!!n,a,!0);return;case"textarea":Ge("invalid",e),o=r=n=null;for(i in a)if(a.hasOwnProperty(i)&&(s=a[i],s!=null))switch(i){case"value":n=s;break;case"defaultValue":r=s;break;case"children":o=s;break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(z(91));break;default:gt(e,t,i,s,a,null)}HC(e,n,r,o);return;case"option":for(l in a)a.hasOwnProperty(l)&&(n=a[l],n!=null)&&(l==="selected"?e.selected=n&&typeof n!="function"&&typeof n!="symbol":gt(e,t,l,n,a,null));return;case"dialog":Ge("beforetoggle",e),Ge("toggle",e),Ge("cancel",e),Ge("close",e);break;case"iframe":case"object":Ge("load",e);break;case"video":case"audio":for(n=0;n<oc.length;n++)Ge(oc[n],e);break;case"image":Ge("error",e),Ge("load",e);break;case"details":Ge("toggle",e);break;case"embed":case"source":case"link":Ge("error",e),Ge("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(u in a)if(a.hasOwnProperty(u)&&(n=a[u],n!=null))switch(u){case"children":case"dangerouslySetInnerHTML":throw Error(z(137,t));default:gt(e,t,u,n,a,null)}return;default:if(Zy(t)){for(c in a)a.hasOwnProperty(c)&&(n=a[c],n!==void 0&&Oy(e,t,c,n,a,void 0));return}}for(s in a)a.hasOwnProperty(s)&&(n=a[s],n!=null&&gt(e,t,s,n,a,null))}function zF(e,t,a,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,o=null,i=null,s=null,l=null,u=null,c=null;for(m in a){var d=a[m];if(a.hasOwnProperty(m)&&d!=null)switch(m){case"checked":break;case"value":break;case"defaultValue":l=d;default:n.hasOwnProperty(m)||gt(e,t,m,null,n,d)}}for(var p in n){var m=n[p];if(d=a[p],n.hasOwnProperty(p)&&(m!=null||d!=null))switch(p){case"type":o=m;break;case"name":r=m;break;case"checked":u=m;break;case"defaultChecked":c=m;break;case"value":i=m;break;case"defaultValue":s=m;break;case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(z(137,t));break;default:m!==d&&gt(e,t,p,m,n,d)}}iy(e,i,s,l,u,c,o,r);return;case"select":m=i=s=p=null;for(o in a)if(l=a[o],a.hasOwnProperty(o)&&l!=null)switch(o){case"value":break;case"multiple":m=l;default:n.hasOwnProperty(o)||gt(e,t,o,null,n,l)}for(r in n)if(o=n[r],l=a[r],n.hasOwnProperty(r)&&(o!=null||l!=null))switch(r){case"value":p=o;break;case"defaultValue":s=o;break;case"multiple":i=o;default:o!==l&&gt(e,t,r,o,n,l)}t=s,a=i,n=m,p!=null?Gs(e,!!a,p,!1):!!n!=!!a&&(t!=null?Gs(e,!!a,t,!0):Gs(e,!!a,a?[]:"",!1));return;case"textarea":m=p=null;for(s in a)if(r=a[s],a.hasOwnProperty(s)&&r!=null&&!n.hasOwnProperty(s))switch(s){case"value":break;case"children":break;default:gt(e,t,s,null,n,r)}for(i in n)if(r=n[i],o=a[i],n.hasOwnProperty(i)&&(r!=null||o!=null))switch(i){case"value":p=r;break;case"defaultValue":m=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(z(91));break;default:r!==o&&gt(e,t,i,r,n,o)}qC(e,p,m);return;case"option":for(var h in a)p=a[h],a.hasOwnProperty(h)&&p!=null&&!n.hasOwnProperty(h)&&(h==="selected"?e.selected=!1:gt(e,t,h,null,n,p));for(l in n)p=n[l],m=a[l],n.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null)&&(l==="selected"?e.selected=p&&typeof p!="function"&&typeof p!="symbol":gt(e,t,l,p,n,m));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var v in a)p=a[v],a.hasOwnProperty(v)&&p!=null&&!n.hasOwnProperty(v)&&gt(e,t,v,null,n,p);for(u in n)if(p=n[u],m=a[u],n.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(z(137,t));break;default:gt(e,t,u,p,n,m)}return;default:if(Zy(t)){for(var I in a)p=a[I],a.hasOwnProperty(I)&&p!==void 0&&!n.hasOwnProperty(I)&&Oy(e,t,I,void 0,n,p);for(c in n)p=n[c],m=a[c],!n.hasOwnProperty(c)||p===m||p===void 0&&m===void 0||Oy(e,t,c,p,n,m);return}}for(var y in a)p=a[y],a.hasOwnProperty(y)&&p!=null&&!n.hasOwnProperty(y)&&gt(e,t,y,null,n,p);for(d in n)p=n[d],m=a[d],!n.hasOwnProperty(d)||p===m||p==null&&m==null||gt(e,t,d,p,n,m)}function nC(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function FF(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),n=0;n<a.length;n++){var r=a[n],o=r.transferSize,i=r.initiatorType,s=r.duration;if(o&&s&&nC(i)){for(i=0,s=r.responseEnd,n+=1;n<a.length;n++){var l=a[n],u=l.startTime;if(u>s)break;var c=l.transferSize,d=l.initiatorType;c&&nC(d)&&(l=l.responseEnd,i+=c*(l<s?1:(s-u)/(l-u)))}if(--n,t+=8*(o+i)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Ny=null,Uy=null;function gp(e){return e.nodeType===9?e:e.ownerDocument}function rC(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function GT(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function By(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xg=null;function qF(){var e=window.event;return e&&e.type==="popstate"?e===Xg?!1:(Xg=e,!0):(Xg=null,!1)}var XT=typeof setTimeout=="function"?setTimeout:void 0,HF=typeof clearTimeout=="function"?clearTimeout:void 0,oC=typeof Promise=="function"?Promise:void 0,jF=typeof queueMicrotask=="function"?queueMicrotask:typeof oC<"u"?function(e){return oC.resolve(null).then(e).catch(VF)}:XT;function VF(e){setTimeout(function(){throw e})}function Bo(e){return e==="head"}function iC(e,t){var a=t,n=0;do{var r=a.nextSibling;if(e.removeChild(a),r&&r.nodeType===8)if(a=r.data,a==="/$"||a==="/&"){if(n===0){e.removeChild(r),ul(t);return}n--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")n++;else if(a==="html")Ku(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ku(a);for(var o=a.firstChild;o;){var i=o.nextSibling,s=o.nodeName;o[mc]||s==="SCRIPT"||s==="STYLE"||s==="LINK"&&o.rel.toLowerCase()==="stylesheet"||a.removeChild(o),o=i}}else a==="body"&&Ku(e.ownerDocument.body);a=r}while(a);ul(t)}function sC(e,t){var a=e;e=0;do{var n=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),n&&n.nodeType===8)if(a=n.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=n}while(a)}function zy(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":zy(a),Yy(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function $F(e,t,a,n){for(;e.nodeType===1;){var r=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!n&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(n){if(!e[mc])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(o=e.getAttribute("rel"),o==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(o!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(o=e.getAttribute("src"),(o!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&o&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var o=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===o)return e}else return e;if(e=_n(e.nextSibling),e===null)break}return null}function WF(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=_n(e.nextSibling),e===null))return null;return e}function KT(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=_n(e.nextSibling),e===null))return null;return e}function Fy(e){return e.data==="$?"||e.data==="$~"}function qy(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function GF(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var n=function(){t(),a.removeEventListener("DOMContentLoaded",n)};a.addEventListener("DOMContentLoaded",n),e._reactRetry=n}}function _n(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Hy=null;function lC(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return _n(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function uC(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function YT(e,t,a){switch(t=gp(a),e){case"html":if(e=t.documentElement,!e)throw Error(z(452));return e;case"head":if(e=t.head,!e)throw Error(z(453));return e;case"body":if(e=t.body,!e)throw Error(z(454));return e;default:throw Error(z(451))}}function Ku(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Yy(e)}var Pn=new Map,cC=new Set;function yp(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var $r=lt.d;lt.d={f:XF,r:KF,D:YF,C:ZF,L:JF,m:QF,X:tq,S:eq,M:aq};function XF(){var e=$r.f(),t=Pp();return e||t}function KF(e){var t=dl(e);t!==null&&t.tag===5&&t.type==="form"?jk(t):$r.r(e)}var hl=typeof document>"u"?null:document;function ZT(e,t,a){var n=hl;if(n&&typeof t=="string"&&t){var r=An(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof a=="string"&&(r+='[crossorigin="'+a+'"]'),cC.has(r)||(cC.add(r),e={rel:e,crossOrigin:a,href:t},n.querySelector(r)===null&&(t=n.createElement("link"),ba(t,"link",e),fa(t),n.head.appendChild(t)))}}function YF(e){$r.D(e),ZT("dns-prefetch",e,null)}function ZF(e,t){$r.C(e,t),ZT("preconnect",e,t)}function JF(e,t,a){$r.L(e,t,a);var n=hl;if(n&&e&&t){var r='link[rel="preload"][as="'+An(t)+'"]';t==="image"&&a&&a.imageSrcSet?(r+='[imagesrcset="'+An(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(r+='[imagesizes="'+An(a.imageSizes)+'"]')):r+='[href="'+An(e)+'"]';var o=r;switch(t){case"style":o=ll(e);break;case"script":o=gl(e)}Pn.has(o)||(e=Lt({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),Pn.set(o,e),n.querySelector(r)!==null||t==="style"&&n.querySelector(xc(o))||t==="script"&&n.querySelector(bc(o))||(t=n.createElement("link"),ba(t,"link",e),fa(t),n.head.appendChild(t)))}}function QF(e,t){$r.m(e,t);var a=hl;if(a&&e){var n=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+An(n)+'"][href="'+An(e)+'"]',o=r;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":o=gl(e)}if(!Pn.has(o)&&(e=Lt({rel:"modulepreload",href:e},t),Pn.set(o,e),a.querySelector(r)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(bc(o)))return}n=a.createElement("link"),ba(n,"link",e),fa(n),a.head.appendChild(n)}}}function eq(e,t,a){$r.S(e,t,a);var n=hl;if(n&&e){var r=Ws(n).hoistableStyles,o=ll(e);t=t||"default";var i=r.get(o);if(!i){var s={loading:0,preload:null};if(i=n.querySelector(xc(o)))s.loading=5;else{e=Lt({rel:"stylesheet",href:e,"data-precedence":t},a),(a=Pn.get(o))&&Ow(e,a);var l=i=n.createElement("link");fa(l),ba(l,"link",e),l._p=new Promise(function(u,c){l.onload=u,l.onerror=c}),l.addEventListener("load",function(){s.loading|=1}),l.addEventListener("error",function(){s.loading|=2}),s.loading|=4,jf(i,t,n)}i={type:"stylesheet",instance:i,count:1,state:s},r.set(o,i)}}}function tq(e,t){$r.X(e,t);var a=hl;if(a&&e){var n=Ws(a).hoistableScripts,r=gl(e),o=n.get(r);o||(o=a.querySelector(bc(r)),o||(e=Lt({src:e,async:!0},t),(t=Pn.get(r))&&Nw(e,t),o=a.createElement("script"),fa(o),ba(o,"link",e),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},n.set(r,o))}}function aq(e,t){$r.M(e,t);var a=hl;if(a&&e){var n=Ws(a).hoistableScripts,r=gl(e),o=n.get(r);o||(o=a.querySelector(bc(r)),o||(e=Lt({src:e,async:!0,type:"module"},t),(t=Pn.get(r))&&Nw(e,t),o=a.createElement("script"),fa(o),ba(o,"link",e),a.head.appendChild(o)),o={type:"script",instance:o,count:1,state:null},n.set(r,o))}}function dC(e,t,a,n){var r=(r=Co.current)?yp(r):null;if(!r)throw Error(z(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=ll(a.href),a=Ws(r).hoistableStyles,n=a.get(t),n||(n={type:"style",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=ll(a.href);var o=Ws(r).hoistableStyles,i=o.get(e);if(i||(r=r.ownerDocument||r,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},o.set(e,i),(o=r.querySelector(xc(e)))&&!o._p&&(i.instance=o,i.state.loading=5),Pn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Pn.set(e,a),o||nq(r,e,a,i.state))),t&&n===null)throw Error(z(528,""));return i}if(t&&n!==null)throw Error(z(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=gl(a),a=Ws(r).hoistableScripts,n=a.get(t),n||(n={type:"script",instance:null,count:0,state:null},a.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(z(444,e))}}function ll(e){return'href="'+An(e)+'"'}function xc(e){return'link[rel="stylesheet"]['+e+"]"}function JT(e){return Lt({},e,{"data-precedence":e.precedence,precedence:null})}function nq(e,t,a,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),ba(t,"link",a),fa(t),e.head.appendChild(t))}function gl(e){return'[src="'+An(e)+'"]'}function bc(e){return"script[async]"+e}function fC(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+An(a.href)+'"]');if(n)return t.instance=n,fa(n),n;var r=Lt({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),fa(n),ba(n,"style",r),jf(n,a.precedence,e),t.instance=n;case"stylesheet":r=ll(a.href);var o=e.querySelector(xc(r));if(o)return t.state.loading|=4,t.instance=o,fa(o),o;n=JT(a),(r=Pn.get(r))&&Ow(n,r),o=(e.ownerDocument||e).createElement("link"),fa(o);var i=o;return i._p=new Promise(function(s,l){i.onload=s,i.onerror=l}),ba(o,"link",n),t.state.loading|=4,jf(o,a.precedence,e),t.instance=o;case"script":return o=gl(a.src),(r=e.querySelector(bc(o)))?(t.instance=r,fa(r),r):(n=a,(r=Pn.get(o))&&(n=Lt({},a),Nw(n,r)),e=e.ownerDocument||e,r=e.createElement("script"),fa(r),ba(r,"link",n),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(z(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,jf(n,a.precedence,e));return t.instance}function jf(e,t,a){for(var n=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=n.length?n[n.length-1]:null,o=r,i=0;i<n.length;i++){var s=n[i];if(s.dataset.precedence===t)o=s;else if(o!==r)break}o?o.parentNode.insertBefore(e,o.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Ow(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Nw(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Vf=null;function pC(e,t,a){if(Vf===null){var n=new Map,r=Vf=new Map;r.set(a,n)}else r=Vf,n=r.get(a),n||(n=new Map,r.set(a,n));if(n.has(e))return n;for(n.set(e,null),a=a.getElementsByTagName(e),r=0;r<a.length;r++){var o=a[r];if(!(o[mc]||o[wa]||e==="link"&&o.getAttribute("rel")==="stylesheet")&&o.namespaceURI!=="http://www.w3.org/2000/svg"){var i=o.getAttribute(t)||"";i=e+i;var s=n.get(i);s?s.push(o):n.set(i,[o])}}return n}function mC(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function rq(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function QT(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function oq(e,t,a,n){if(a.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var r=ll(n.href),o=t.querySelector(xc(r));if(o){t=o._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=wp.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=o,fa(o);return}o=t.ownerDocument||t,n=JT(n),(r=Pn.get(r))&&Ow(n,r),o=o.createElement("link"),fa(o);var i=o;i._p=new Promise(function(s,l){i.onload=s,i.onerror=l}),ba(o,"link",n),a.instance=o}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=wp.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Kg=0;function iq(e,t){return e.stylesheets&&e.count===0&&$f(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var n=setTimeout(function(){if(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend){var o=e.unsuspend;e.unsuspend=null,o()}},6e4+t);0<e.imgBytes&&Kg===0&&(Kg=62500*FF());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&$f(e,e.stylesheets),e.unsuspend)){var o=e.unsuspend;e.unsuspend=null,o()}},(e.imgBytes>Kg?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(r)}}:null}function wp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)$f(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var vp=null;function $f(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,vp=new Map,t.forEach(sq,e),vp=null,wp.call(e))}function sq(e,t){if(!(t.state.loading&4)){var a=vp.get(e);if(a)var n=a.get(null);else{a=new Map,vp.set(e,a);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),o=0;o<r.length;o++){var i=r[o];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(a.set(i.dataset.precedence,i),n=i)}n&&a.set(null,n)}r=t.instance,i=r.getAttribute("data-precedence"),o=a.get(i)||n,o===n&&a.set(null,r),a.set(i,r),this.count++,n=wp.bind(this),r.addEventListener("load",n),r.addEventListener("error",n),o?o.parentNode.insertBefore(r,o.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var sc={$$typeof:Pr,Provider:null,Consumer:null,_currentValue:yi,_currentValue2:yi,_threadCount:0};function lq(e,t,a,n,r,o,i,s,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=bg(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=bg(0),this.hiddenUpdates=bg(null),this.identifierPrefix=n,this.onUncaughtError=r,this.onCaughtError=o,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function e1(e,t,a,n,r,o,i,s,l,u,c,d){return e=new lq(e,t,a,i,l,u,c,d,s),t=1,o===!0&&(t|=24),o=un(3,null,null,t),e.current=o,o.stateNode=e,t=lw(),t.refCount++,e.pooledCache=t,t.refCount++,o.memoizedState={element:n,isDehydrated:a,cache:t},dw(o),e}function t1(e){return e?(e=Hs,e):Hs}function a1(e,t,a,n,r,o){r=t1(r),n.context===null?n.context=r:n.pendingContext=r,n=To(t),n.payload={element:a},o=o===void 0?null:o,o!==null&&(n.callback=o),a=Lo(e,n,t),a!==null&&(Ga(a,e,t),qu(a,e,t))}function hC(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Uw(e,t){hC(e,t),(e=e.alternate)&&hC(e,t)}function n1(e){if(e.tag===13||e.tag===31){var t=Mi(e,67108864);t!==null&&Ga(t,e,67108864),Uw(e,67108864)}}function gC(e){if(e.tag===13||e.tag===31){var t=mn();t=Xy(t);var a=Mi(e,t);a!==null&&Ga(a,e,t),Uw(e,t)}}var xp=!0;function uq(e,t,a,n){var r=Te.T;Te.T=null;var o=lt.p;try{lt.p=2,Bw(e,t,a,n)}finally{lt.p=o,Te.T=r}}function cq(e,t,a,n){var r=Te.T;Te.T=null;var o=lt.p;try{lt.p=8,Bw(e,t,a,n)}finally{lt.p=o,Te.T=r}}function Bw(e,t,a,n){if(xp){var r=jy(n);if(r===null)Gg(e,t,n,bp,a),yC(e,n);else if(fq(r,e,t,a,n))n.stopPropagation();else if(yC(e,n),t&4&&-1<dq.indexOf(e)){for(;r!==null;){var o=dl(r);if(o!==null)switch(o.tag){case 3:if(o=o.stateNode,o.current.memoizedState.isDehydrated){var i=mi(o.pendingLanes);if(i!==0){var s=o;for(s.pendingLanes|=2,s.entangledLanes|=2;i;){var l=1<<31-pn(i);s.entanglements[1]|=l,i&=~l}fr(o),(st&6)===0&&(cp=dn()+500,vc(0,!1))}}break;case 31:case 13:s=Mi(o,2),s!==null&&Ga(s,o,2),Pp(),Uw(o,2)}if(o=jy(n),o===null&&Gg(e,t,n,bp,a),o===r)break;r=o}r!==null&&n.stopPropagation()}else Gg(e,t,n,null,a)}}function jy(e){return e=Jy(e),zw(e)}var bp=null;function zw(e){if(bp=null,e=Ns(e),e!==null){var t=cc(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=IC(t),e!==null)return e;e=null}else if(a===31){if(e=CC(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return bp=e,null}function r1(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(J3()){case EC:return 2;case AC:return 8;case Yf:case Q3:return 32;case MC:return 268435456;default:return 32}default:return 32}}var Vy=!1,Mo=null,Ro=null,Do=null,lc=new Map,uc=new Map,wo=[],dq="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function yC(e,t){switch(e){case"focusin":case"focusout":Mo=null;break;case"dragenter":case"dragleave":Ro=null;break;case"mouseover":case"mouseout":Do=null;break;case"pointerover":case"pointerout":lc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":uc.delete(t.pointerId)}}function Mu(e,t,a,n,r,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:a,eventSystemFlags:n,nativeEvent:o,targetContainers:[r]},t!==null&&(t=dl(t),t!==null&&n1(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function fq(e,t,a,n,r){switch(t){case"focusin":return Mo=Mu(Mo,e,t,a,n,r),!0;case"dragenter":return Ro=Mu(Ro,e,t,a,n,r),!0;case"mouseover":return Do=Mu(Do,e,t,a,n,r),!0;case"pointerover":var o=r.pointerId;return lc.set(o,Mu(lc.get(o)||null,e,t,a,n,r)),!0;case"gotpointercapture":return o=r.pointerId,uc.set(o,Mu(uc.get(o)||null,e,t,a,n,r)),!0}return!1}function o1(e){var t=Ns(e.target);if(t!==null){var a=cc(t);if(a!==null){if(t=a.tag,t===13){if(t=IC(a),t!==null){e.blockedOn=t,e0(e.priority,function(){gC(a)});return}}else if(t===31){if(t=CC(a),t!==null){e.blockedOn=t,e0(e.priority,function(){gC(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Wf(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=jy(e.nativeEvent);if(a===null){a=e.nativeEvent;var n=new a.constructor(a.type,a);ly=n,a.target.dispatchEvent(n),ly=null}else return t=dl(a),t!==null&&n1(t),e.blockedOn=a,!1;t.shift()}return!0}function wC(e,t,a){Wf(e)&&a.delete(t)}function pq(){Vy=!1,Mo!==null&&Wf(Mo)&&(Mo=null),Ro!==null&&Wf(Ro)&&(Ro=null),Do!==null&&Wf(Do)&&(Do=null),lc.forEach(wC),uc.forEach(wC)}function Mf(e,t){e.blockedOn===t&&(e.blockedOn=null,Vy||(Vy=!0,sa.unstable_scheduleCallback(sa.unstable_NormalPriority,pq)))}var Rf=null;function vC(e){Rf!==e&&(Rf=e,sa.unstable_scheduleCallback(sa.unstable_NormalPriority,function(){Rf===e&&(Rf=null);for(var t=0;t<e.length;t+=3){var a=e[t],n=e[t+1],r=e[t+2];if(typeof n!="function"){if(zw(n||a)===null)continue;break}var o=dl(a);o!==null&&(e.splice(t,3),t-=3,Cy(o,{pending:!0,data:r,method:a.method,action:n},n,r))}}))}function ul(e){function t(l){return Mf(l,e)}Mo!==null&&Mf(Mo,e),Ro!==null&&Mf(Ro,e),Do!==null&&Mf(Do,e),lc.forEach(t),uc.forEach(t);for(var a=0;a<wo.length;a++){var n=wo[a];n.blockedOn===e&&(n.blockedOn=null)}for(;0<wo.length&&(a=wo[0],a.blockedOn===null);)o1(a),a.blockedOn===null&&wo.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(n=0;n<a.length;n+=3){var r=a[n],o=a[n+1],i=r[Xa]||null;if(typeof o=="function")i||vC(a);else if(i){var s=null;if(o&&o.hasAttribute("formAction")){if(r=o,i=o[Xa]||null)s=i.formAction;else if(zw(r)!==null)continue}else s=i.action;typeof s=="function"?a[n+1]=s:(a.splice(n,3),n-=3),vC(a)}}}function i1(){function e(o){o.canIntercept&&o.info==="react-transition"&&o.intercept({handler:function(){return new Promise(function(i){return r=i})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),n||setTimeout(a,20)}function a(){if(!n&&!navigation.transition){var o=navigation.currentEntry;o&&o.url!=null&&navigation.navigate(o.url,{state:o.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var n=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){n=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function Fw(e){this._internalRoot=e}Up.prototype.render=Fw.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(z(409));var a=t.current,n=mn();a1(a,n,e,t,null,null)};Up.prototype.unmount=Fw.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;a1(e.current,2,null,e,null,null),Pp(),t[cl]=null}};function Up(e){this._internalRoot=e}Up.prototype.unstable_scheduleHydration=function(e){if(e){var t=OC();e={blockedOn:null,target:e,priority:t};for(var a=0;a<wo.length&&t!==0&&t<wo[a].priority;a++);wo.splice(a,0,e),a===0&&o1(e)}};var xC=bC.version;if(xC!=="19.2.4")throw Error(z(527,xC,"19.2.4"));lt.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(z(188)):(e=Object.keys(e).join(","),Error(z(268,e)));return e=$3(t),e=e!==null?kC(e):null,e=e===null?null:e.stateNode,e};var mq={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Te,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Ru=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Ru.isDisabled&&Ru.supportsFiber))try{dc=Ru.inject(mq),fn=Ru}catch{}var Ru;Bp.createRoot=function(e,t){if(!SC(e))throw Error(z(299));var a=!1,n="",r=Zk,o=Jk,i=Qk;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(o=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=e1(e,1,!1,null,null,a,n,null,r,o,i,i1),e[cl]=t.current,Pw(e),new Fw(t)};Bp.hydrateRoot=function(e,t,a){if(!SC(e))throw Error(z(299));var n=!1,r="",o=Zk,i=Jk,s=Qk,l=null;return a!=null&&(a.unstable_strictMode===!0&&(n=!0),a.identifierPrefix!==void 0&&(r=a.identifierPrefix),a.onUncaughtError!==void 0&&(o=a.onUncaughtError),a.onCaughtError!==void 0&&(i=a.onCaughtError),a.onRecoverableError!==void 0&&(s=a.onRecoverableError),a.formState!==void 0&&(l=a.formState)),t=e1(e,1,!0,t,a??null,n,r,l,o,i,s,i1),t.context=t1(null),a=t.current,n=mn(),n=Xy(n),r=To(n),r.callback=null,Lo(a,r,n),a=n,t.current.lanes=a,pc(t,a),fr(t),e[cl]=t.current,Pw(e),new Up(t)};Bp.version="19.2.4"});var qw=Ca((zZ,u1)=>{"use strict";function l1(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l1)}catch(e){console.error(e)}}l1(),u1.exports=s1()});var B1=Ca(Kp=>{"use strict";var _4=Symbol.for("react.transitional.element"),P4=Symbol.for("react.fragment");function U1(e,t,a){var n=null;if(a!==void 0&&(n=""+a),t.key!==void 0&&(n=""+t.key),"key"in t){a={};for(var r in t)r!=="key"&&(a[r]=t[r])}else a=t;return t=a.ref,{$$typeof:_4,type:e,key:n,ref:t!==void 0?t:null,props:a}}Kp.Fragment=P4;Kp.jsx=U1;Kp.jsxs=U1});var me=Ca((BQ,z1)=>{"use strict";z1.exports=B1()});function F1(e){var t,a,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(a=F1(e[t]))&&(n&&(n+=" "),n+=a)}else for(a in e)e[a]&&(n&&(n+=" "),n+=a);return n}function Zp(){for(var e,t,a=0,n="",r=arguments.length;a<r;a++)(e=arguments[a])&&(t=F1(e))&&(n&&(n+=" "),n+=t);return n}var tv=L(()=>{"use strict"});function av(...e){return e.filter(Boolean).join(" ")}function q1(){return av}var nv=L(()=>{"use strict"});function hV(e){let t=[],a=-1;for(;++a<e.length;)t[a]=Zo(e[a]);return bm(n);function n(...r){let o=-1;for(;++o<t.length;)if(t[o].apply(this,r))return!0;return!1}}function gV(e){let t=e;return bm(a);function a(n){let r=n,o;for(o in e)if(r[o]!==t[o])return!1;return!0}}function yV(e){return bm(t);function t(a){return a&&a.type===e}}function bm(e){return t;function t(a,n,r){return!!(vV(a)&&e.call(this,a,typeof n=="number"?n:void 0,r||void 0))}}function wV(){return!0}function vV(e){return e!==null&&typeof e=="object"&&"type"in e}var Zo,jM=L(()=>{"use strict";Zo=(function(e){if(e==null)return wV;if(typeof e=="function")return bm(e);if(typeof e=="object")return Array.isArray(e)?hV(e):gV(e);if(typeof e=="string")return yV(e);throw new Error("Expected function, string, or object as test")})});var Sm=L(()=>{"use strict";jM()});function cd(e,t,a,n){let r;typeof t=="function"&&typeof a!="function"?(n=a,a=t):r=t;let o=Zo(r),i=n?-1:1;s(e,void 0,[])();function s(l,u,c){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let m=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(m?"<"+m+">":""))+")"})}return p;function p(){let m=VM,h,v,I;if((!t||o(l,u,c[c.length-1]||void 0))&&(m=xV(a(l,c)),m[0]===ns))return m;if("children"in l&&l.children){let y=l;if(y.children&&m[0]!==rs)for(v=(n?y.children.length:-1)+i,I=c.concat(y);v>-1&&v<y.children.length;){let w=y.children[v];if(h=s(w,v,I)(),h[0]===ns)return h;v=typeof h[1]=="number"?h[1]:v+i}}return m}}}function xV(e){return Array.isArray(e)?e:typeof e=="number"?[Jr,e]:e==null?VM:[e]}var VM,Jr,ns,rs,$M=L(()=>{"use strict";Sm();VM=[],Jr=!0,ns=!1,rs="skip"});var Im=L(()=>{"use strict";$M()});function Qr(e,t,a,n){let r,o,i;typeof t=="function"&&typeof a!="function"?(o=void 0,i=t,r=a):(o=t,i=a,r=n),cd(e,o,s,r);function s(l,u){let c=u[u.length-1],d=c?c.children.indexOf(l):void 0;return i(l,d,c)}}var WM=L(()=>{"use strict";Im();Im()});var Cm=L(()=>{"use strict";WM()});function KM({defaultOrigin:e="",allowedLinkPrefixes:t=[],allowedImagePrefixes:a=[],allowDataImages:n=!1,allowedProtocols:r=[],blockedImageClass:o="inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm",blockedLinkClass:i="text-gray-500"}){let s=t.length&&!t.every(u=>u==="*"),l=a.length&&!a.every(u=>u==="*");if(!e&&(s||l))throw new Error("defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided");return u=>{let c=CV(e,t,a,n,r,o,i);Qr(u,c)}}function GM(e,t){if(typeof e!="string")return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))try{return new URL(e,"http://example.com")}catch{return null}return null}}function bV(e){return typeof e!="string"?!1:e.startsWith("/")||e.startsWith("./")||e.startsWith("../")}function XM(e,t,a,n=!1,r=!1,o=[]){if(!e)return null;if(typeof e=="string"&&e.startsWith("#")&&!r)try{if(new URL(e,"http://example.com").hash===e)return e}catch{}if(typeof e=="string"&&e.startsWith("data:"))return r&&n&&e.startsWith("data:image/")?e:null;if(typeof e=="string"&&e.startsWith("blob:")){try{if(new URL(e).protocol==="blob:"&&e.length>5){let c=e.substring(5);if(c&&c.length>0&&c!=="invalid")return e}}catch{return null}return null}let i=GM(e,a);if(!i||IV.has(i.protocol)||!(SV.has(i.protocol)||o.includes(i.protocol)||o.includes("*")))return null;if(i.protocol==="mailto:"||!i.protocol.match(/^https?:$/))return i.href;let l=bV(e);return i&&t.some(u=>{let c=GM(u,a);return!c||c.origin!==i.origin?!1:i.href.startsWith(c.href)})?l?i.pathname+i.search+i.hash:i.href:t.includes("*")?i.protocol!=="https:"&&i.protocol!=="http:"?null:l?i.pathname+i.search+i.hash:i.href:null}var SV,IV,yx,CV,YM=L(()=>{"use strict";Cm();SV=new Set(["https:","http:","irc:","ircs:","mailto:","xmpp:","blob:"]),IV=new Set(["javascript:","data:","file:","vbscript:"]);yx=Symbol("node-seen"),CV=(e,t,a,n,r,o,i)=>{let s=(l,u,c)=>{if(l.type!=="element"||l[yx])return Jr;if(l.tagName==="a"){let d=XM(l.properties.href,t,e,!1,!1,r);return d===null?(l[yx]=!0,Qr(l,s),c&&typeof u=="number"&&(c.children[u]={type:"element",tagName:"span",properties:{title:"Blocked URL: "+String(l.properties.href),class:i},children:[...l.children,{type:"text",value:" [blocked]"}]}),rs):(l.properties.href=d,l.properties.target="_blank",l.properties.rel="noopener noreferrer",Jr)}if(l.tagName==="img"){let d=XM(l.properties.src,a,e,n,!0,r);return d===null?(l[yx]=!0,Qr(l,s),c&&typeof u=="number"&&(c.children[u]={type:"element",tagName:"span",properties:{class:o},children:[{type:"text",value:"[Image blocked: "+String(l.properties.alt||"No description")+"]"}]}),rs):(l.properties.src=d,Jr)}return Jr};return s}});function kV(){return e=>e}var ZM,JM=L(()=>{"use strict";ZM=kV});var QM,AV,xx,rR=L(()=>{"use strict";QM=typeof self=="object"?self:globalThis,AV=(e,t)=>{let a=(r,o)=>(e.set(o,r),r),n=r=>{if(e.has(r))return e.get(r);let[o,i]=t[r];switch(o){case 0:case-1:return a(i,r);case 1:{let s=a([],r);for(let l of i)s.push(n(l));return s}case 2:{let s=a({},r);for(let[l,u]of i)s[n(l)]=n(u);return s}case 3:return a(new Date(i),r);case 4:{let{source:s,flags:l}=i;return a(new RegExp(s,l),r)}case 5:{let s=a(new Map,r);for(let[l,u]of i)s.set(n(l),n(u));return s}case 6:{let s=a(new Set,r);for(let l of i)s.add(n(l));return s}case 7:{let{name:s,message:l}=i;return a(new QM[s](l),r)}case 8:return a(BigInt(i),r);case"BigInt":return a(Object(BigInt(i)),r);case"ArrayBuffer":return a(new Uint8Array(i).buffer,i);case"DataView":{let{buffer:s}=new Uint8Array(i);return a(new DataView(s),i)}}return a(new QM[o](i),r)};return n},xx=e=>AV(new Map,e)(0)});var $l,MV,RV,dd,Tm,DV,bx,oR=L(()=>{"use strict";$l="",{toString:MV}={},{keys:RV}=Object,dd=e=>{let t=typeof e;if(t!=="object"||!e)return[0,t];let a=MV.call(e).slice(8,-1);switch(a){case"Array":return[1,$l];case"Object":return[2,$l];case"Date":return[3,$l];case"RegExp":return[4,$l];case"Map":return[5,$l];case"Set":return[6,$l];case"DataView":return[1,a]}return a.includes("Array")?[1,a]:a.includes("Error")?[7,a]:[2,a]},Tm=([e,t])=>e===0&&(t==="function"||t==="symbol"),DV=(e,t,a,n)=>{let r=(i,s)=>{let l=n.push(i)-1;return a.set(s,l),l},o=i=>{if(a.has(i))return a.get(i);let[s,l]=dd(i);switch(s){case 0:{let c=i;switch(l){case"bigint":s=8,c=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return r([-1],i)}return r([s,c],i)}case 1:{if(l){let p=i;return l==="DataView"?p=new Uint8Array(i.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(i)),r([l,[...p]],i)}let c=[],d=r([s,c],i);for(let p of i)c.push(o(p));return d}case 2:{if(l)switch(l){case"BigInt":return r([l,i.toString()],i);case"Boolean":case"Number":case"String":return r([l,i.valueOf()],i)}if(t&&"toJSON"in i)return o(i.toJSON());let c=[],d=r([s,c],i);for(let p of RV(i))(e||!Tm(dd(i[p])))&&c.push([o(p),o(i[p])]);return d}case 3:return r([s,i.toISOString()],i);case 4:{let{source:c,flags:d}=i;return r([s,{source:c,flags:d}],i)}case 5:{let c=[],d=r([s,c],i);for(let[p,m]of i)(e||!(Tm(dd(p))||Tm(dd(m))))&&c.push([o(p),o(m)]);return d}case 6:{let c=[],d=r([s,c],i);for(let p of i)(e||!Tm(dd(p)))&&c.push(o(p));return d}}let{message:u}=i;return r([s,{name:l,message:u}],i)};return o},bx=(e,{json:t,lossy:a}={})=>{let n=[];return DV(!(t||a),!!t,new Map,n)(e),n}});var Jo,Lm=L(()=>{"use strict";rR();oR();Jo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?xx(bx(e,t)):structuredClone(e):(e,t)=>xx(bx(e,t))});function iR(e){return t;function t(a){let n=a&&a.position&&a.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function fd(e){let t=Wl(e),a=Em(e);if(t&&a)return{start:t,end:a}}var Em,Wl,sR=L(()=>{"use strict";Em=iR("end"),Wl=iR("start")});var pd=L(()=>{"use strict";sR()});var os,Sx,lR=L(()=>{"use strict";os=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],Sx={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...os,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...os],h2:[["className","sr-only"]],img:[...os,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...os,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...os],table:[...os],ul:[...os,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]}});function Ix(e,t){let a={type:"root",children:[]},n={schema:t?{...Sx,...t}:Sx,stack:[]},r=dR(n,e);return r&&(Array.isArray(r)?r.length===1?a=r[0]:a.children=r:a=r),a}function dR(e,t){if(t&&typeof t=="object"){let a=t;switch(typeof a.type=="string"?a.type:""){case"comment":return _V(e,a);case"doctype":return PV(e,a);case"element":return OV(e,a);case"root":return NV(e,a);case"text":return UV(e,a);default:}}}function _V(e,t){if(e.schema.allowComments){let a=typeof t.value=="string"?t.value:"",n=a.indexOf("-->"),o={type:"comment",value:n<0?a:a.slice(0,n)};return md(o,t),o}}function PV(e,t){if(e.schema.allowDoctypes){let a={type:"doctype"};return md(a,t),a}}function OV(e,t){let a=typeof t.tagName=="string"?t.tagName:"";e.stack.push(a);let n=fR(e,t.children),r=BV(e,t.properties);e.stack.pop();let o=!1;if(a&&a!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(a))&&(o=!0,e.schema.ancestors&&Qo.call(e.schema.ancestors,a))){let s=e.schema.ancestors[a],l=-1;for(o=!1;++l<s.length;)e.stack.includes(s[l])&&(o=!0)}if(!o)return e.schema.strip&&!e.schema.strip.includes(a)?n:void 0;let i={type:"element",tagName:a,properties:r,children:n};return md(i,t),i}function NV(e,t){let n={type:"root",children:fR(e,t.children)};return md(n,t),n}function UV(e,t){let n={type:"text",value:typeof t.value=="string"?t.value:""};return md(n,t),n}function fR(e,t){let a=[];if(Array.isArray(t)){let n=t,r=-1;for(;++r<n.length;){let o=dR(e,n[r]);o&&(Array.isArray(o)?a.push(...o):a.push(o))}}return a}function BV(e,t){let a=e.stack[e.stack.length-1],n=e.schema.attributes,r=e.schema.required,o=n&&Qo.call(n,a)?n[a]:void 0,i=n&&Qo.call(n,"*")?n["*"]:void 0,s=t&&typeof t=="object"?t:{},l={},u;for(u in s)if(Qo.call(s,u)){let c=s[u],d=uR(e,cR(o,u),u,c);d==null&&(d=uR(e,cR(i,u),u,c)),d!=null&&(l[u]=d)}if(r&&Qo.call(r,a)){let c=r[a];for(u in c)Qo.call(c,u)&&!Qo.call(l,u)&&(l[u]=c[u])}return l}function uR(e,t,a,n){return t?Array.isArray(n)?zV(e,t,a,n):pR(e,t,a,n):void 0}function zV(e,t,a,n){let r=-1,o=[];for(;++r<n.length;){let i=pR(e,t,a,n[r]);(typeof i=="number"||typeof i=="string")&&o.push(i)}return o}function pR(e,t,a,n){if(!(typeof n!="boolean"&&typeof n!="number"&&typeof n!="string")&&FV(e,a,n)){if(typeof t=="object"&&t.length>1){let r=!1,o=0;for(;++o<t.length;){let i=t[o];if(i&&typeof i=="object"&&"flags"in i){if(i.test(String(n))){r=!0;break}}else if(i===n){r=!0;break}}if(!r)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(a)?e.schema.clobberPrefix+n:n}}function FV(e,t,a){let n=e.schema.protocols&&Qo.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!n||n.length===0)return!0;let r=String(a),o=r.indexOf(":"),i=r.indexOf("?"),s=r.indexOf("#"),l=r.indexOf("/");if(o<0||l>-1&&o>l||i>-1&&o>i||s>-1&&o>s)return!0;let u=-1;for(;++u<n.length;){let c=n[u];if(o===c.length&&r.slice(0,c.length)===c)return!0}return!1}function md(e,t){let a=fd(t);t.data&&(e.data=Jo(t.data)),a&&(e.position=a)}function cR(e,t){let a,n=-1;if(e)for(;++n<e.length;){let r=e[n],o=typeof r=="string"?r:r[0];if(o===t)return r;o==="data*"&&(a=r)}if(t.length>4&&t.slice(0,4).toLowerCase()==="data")return a}var Qo,mR=L(()=>{"use strict";Lm();pd();lR();Qo={}.hasOwnProperty});var hR=L(()=>{"use strict";mR()});function Am(e){return function(t){return Ix(t,e)}}var gR=L(()=>{"use strict";hR()});var yR=L(()=>{"use strict";gR()});function Cx(e,t){let a=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,r=a.indexOf(t);for(;r!==-1;)n++,r=a.indexOf(t,r+t.length);return n}var wR=L(()=>{"use strict"});function is(e){return e!==null&&(e<32||e===127)}function ne(e){return e!==null&&e<-2}function $e(e){return e!==null&&(e<0||e===32)}function ve(e){return e===-2||e===-1||e===32}function ei(e){return t;function t(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}var la,Vt,vR,hd,xR,bR,ss,Sr,at=L(()=>{"use strict";la=ei(/[A-Za-z]/),Vt=ei(/[\dA-Za-z]/),vR=ei(/[#-'*+\--9=?A-Z^-~]/);hd=ei(/\d/),xR=ei(/[\dA-Fa-f]/),bR=ei(/[!-/:-@[-`{-~]/);ss=ei(/\p{P}|\p{S}/u),Sr=ei(/\s/)});function kx(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var SR=L(()=>{"use strict"});function Tx(e,t,a){let r=Zo((a||{}).ignore||[]),o=qV(t),i=-1;for(;++i<o.length;)cd(e,"text",s);function s(u,c){let d=-1,p;for(;++d<c.length;){let m=c[d],h=p?p.children:void 0;if(r(m,h?h.indexOf(m):void 0,p))return;p=m}if(p)return l(u,c)}function l(u,c){let d=c[c.length-1],p=o[i][0],m=o[i][1],h=0,I=d.children.indexOf(u),y=!1,w=[];p.lastIndex=0;let g=p.exec(u.value);for(;g;){let S=g.index,E={index:g.index,input:g.input,stack:[...c,u]},T=m(...g,E);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?p.lastIndex=S+1:(h!==S&&w.push({type:"text",value:u.value.slice(h,S)}),Array.isArray(T)?w.push(...T):T&&w.push(T),h=S+g[0].length,y=!0),!p.global)break;g=p.exec(u.value)}return y?(h<u.value.length&&w.push({type:"text",value:u.value.slice(h)}),d.children.splice(I,1,...w)):w=[u],I+w.length}}function qV(e){let t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");let a=!e[0]||Array.isArray(e[0])?e:[e],n=-1;for(;++n<a.length;){let r=a[n];t.push([HV(r[0]),jV(r[1])])}return t}function HV(e){return typeof e=="string"?new RegExp(kx(e),"g"):e}function jV(e){return typeof e=="function"?e:function(){return e}}var IR=L(()=>{"use strict";SR();Im();Sm()});var CR=L(()=>{"use strict";IR()});function Mx(){return{transforms:[KV],enter:{literalAutolink:VV,literalAutolinkEmail:Ax,literalAutolinkHttp:Ax,literalAutolinkWww:Ax},exit:{literalAutolink:XV,literalAutolinkEmail:GV,literalAutolinkHttp:$V,literalAutolinkWww:WV}}}function Rx(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Lx,notInConstruct:Ex},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Lx,notInConstruct:Ex},{character:":",before:"[ps]",after:"\\/",inConstruct:Lx,notInConstruct:Ex}]}}function VV(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ax(e){this.config.enter.autolinkProtocol.call(this,e)}function $V(e){this.config.exit.autolinkProtocol.call(this,e)}function WV(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function GV(e){this.config.exit.autolinkEmail.call(this,e)}function XV(e){this.exit(e)}function KV(e){Tx(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,YV],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,ZV]],{ignore:["link","linkReference"]})}function YV(e,t,a,n,r){let o="";if(!kR(r)||(/^w/i.test(t)&&(a=t+a,t="",o="http://"),!JV(a)))return!1;let i=QV(a+n);if(!i[0])return!1;let s={type:"link",title:null,url:o+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[s,{type:"text",value:i[1]}]:s}function ZV(e,t,a,n){return!kR(n,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+a,children:[{type:"text",value:t+"@"+a}]}}function JV(e){let t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function QV(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let a=t[0],n=a.indexOf(")"),r=Cx(e,"("),o=Cx(e,")");for(;n!==-1&&r>o;)e+=a.slice(0,n+1),a=a.slice(n+1),n=a.indexOf(")"),o++;return[e,a]}function kR(e,t){let a=e.input.charCodeAt(e.index-1);return(e.index===0||Sr(a)||ss(a))&&(!t||a!==47)}var Lx,Ex,TR=L(()=>{"use strict";wR();at();CR();Lx="phrasing",Ex=["autolink","link","image","label"]});var LR=L(()=>{"use strict";TR()});function Ma(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var Gl=L(()=>{"use strict"});function e$(){this.buffer()}function t$(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function a$(){this.buffer()}function n$(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function r$(e){let t=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Ma(this.sliceSerialize(e)).toLowerCase(),a.label=t}function o$(e){this.exit(e)}function i$(e){let t=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Ma(this.sliceSerialize(e)).toLowerCase(),a.label=t}function s$(e){this.exit(e)}function l$(){return"["}function ER(e,t,a,n){let r=a.createTracker(n),o=r.move("[^"),i=a.enter("footnoteReference"),s=a.enter("reference");return o+=r.move(a.safe(a.associationId(e),{after:"]",before:o})),s(),i(),o+=r.move("]"),o}function Dx(){return{enter:{gfmFootnoteCallString:e$,gfmFootnoteCall:t$,gfmFootnoteDefinitionLabelString:a$,gfmFootnoteDefinition:n$},exit:{gfmFootnoteCallString:r$,gfmFootnoteCall:o$,gfmFootnoteDefinitionLabelString:i$,gfmFootnoteDefinition:s$}}}function _x(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:a,footnoteReference:ER},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(n,r,o,i){let s=o.createTracker(i),l=s.move("[^"),u=o.enter("footnoteDefinition"),c=o.enter("label");return l+=s.move(o.safe(o.associationId(n),{before:l,after:"]"})),c(),l+=s.move("]:"),n.children&&n.children.length>0&&(s.shift(4),l+=s.move((t?`
10
10
  `:" ")+o.indentLines(o.containerFlow(n,s.current()),t?AR:u$))),u(),l}}function u$(e,t,a){return t===0?e:AR(e,t,a)}function AR(e,t,a){return(a?"":" ")+e}var MR=L(()=>{"use strict";Gl();ER.peek=l$});var RR=L(()=>{"use strict";MR()});function Px(){return{canContainEols:["delete"],enter:{strikethrough:d$},exit:{strikethrough:f$}}}function Ox(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:c$}],handlers:{delete:DR}}}function d$(e){this.enter({type:"delete",children:[]},e)}function f$(e){this.exit(e)}function DR(e,t,a,n){let r=a.createTracker(n),o=a.enter("strikethrough"),i=r.move("~~");return i+=a.containerPhrasing(e,{...r.current(),before:i,after:"~"}),i+=r.move("~~"),o(),i}function p$(){return"~"}var c$,_R=L(()=>{"use strict";c$=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];DR.peek=p$});var PR=L(()=>{"use strict";_R()});function m$(e){return e.length}function NR(e,t){let a=t||{},n=(a.align||[]).concat(),r=a.stringLength||m$,o=[],i=[],s=[],l=[],u=0,c=-1;for(;++c<e.length;){let v=[],I=[],y=-1;for(e[c].length>u&&(u=e[c].length);++y<e[c].length;){let w=h$(e[c][y]);if(a.alignDelimiters!==!1){let g=r(w);I[y]=g,(l[y]===void 0||g>l[y])&&(l[y]=g)}v.push(w)}i[c]=v,s[c]=I}let d=-1;if(typeof n=="object"&&"length"in n)for(;++d<u;)o[d]=OR(n[d]);else{let v=OR(n);for(;++d<u;)o[d]=v}d=-1;let p=[],m=[];for(;++d<u;){let v=o[d],I="",y="";v===99?(I=":",y=":"):v===108?I=":":v===114&&(y=":");let w=a.alignDelimiters===!1?1:Math.max(1,l[d]-I.length-y.length),g=I+"-".repeat(w)+y;a.alignDelimiters!==!1&&(w=I.length+w+y.length,w>l[d]&&(l[d]=w),m[d]=w),p[d]=g}i.splice(1,0,p),s.splice(1,0,m),c=-1;let h=[];for(;++c<i.length;){let v=i[c],I=s[c];d=-1;let y=[];for(;++d<u;){let w=v[d]||"",g="",S="";if(a.alignDelimiters!==!1){let E=l[d]-(I[d]||0),T=o[d];T===114?g=" ".repeat(E):T===99?E%2?(g=" ".repeat(E/2+.5),S=" ".repeat(E/2-.5)):(g=" ".repeat(E/2),S=g):S=" ".repeat(E)}a.delimiterStart!==!1&&!d&&y.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&w==="")&&(a.delimiterStart!==!1||d)&&y.push(" "),a.alignDelimiters!==!1&&y.push(g),y.push(w),a.alignDelimiters!==!1&&y.push(S),a.padding!==!1&&y.push(" "),(a.delimiterEnd!==!1||d!==u-1)&&y.push("|")}h.push(a.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return h.join(`
11
11
  `)}function h$(e){return e==null?"":String(e)}function OR(e){let t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}var UR=L(()=>{"use strict"});function BR(e,t,a,n){let r=a.enter("blockquote"),o=a.createTracker(n);o.move("> "),o.shift(2);let i=a.indentLines(a.containerFlow(e,o.current()),g$);return r(),i}function g$(e,t,a){return">"+(a?"":" ")+e}var zR=L(()=>{"use strict"});function qR(e,t){return FR(e,t.inConstruct,!0)&&!FR(e,t.notInConstruct,!1)}function FR(e,t,a){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return a;let n=-1;for(;++n<t.length;)if(e.includes(t[n]))return!0;return!1}var HR=L(()=>{"use strict"});function Nx(e,t,a,n){let r=-1;for(;++r<a.unsafe.length;)if(a.unsafe[r].character===`
12
12
  `&&qR(a.stack,a.unsafe[r]))return/[ \t]/.test(n.before)?"":" ";return`\\
@@ -38,7 +38,7 @@ Error generating stack: `+n.message+`
38
38
  $$`:`${e}$$`},rW=e=>aW(e)%2===0?e:nW(e),oW=(e,t,a)=>{if(e.substring(t+2).includes(")"))return null;let n=R7(e,t);if(n===-1||th(e,n))return null;let r=n>0&&e[n-1]==="!",o=r?n-1:n,i=e.substring(0,o);if(r)return i;let s=e.substring(n+1,t);return a==="text-only"?`${i}${s}`:`${i}[${s}](streamdown:incomplete-link)`},e_=(e,t)=>{for(let a=0;a<=t;a++)if(e[a]==="["&&!th(e,a)){if(a>0&&e[a-1]==="!")continue;let n=r_(e,a);if(n===-1)return a;if(n+1<e.length&&e[n+1]==="("){let r=e.indexOf(")",n+2);r!==-1&&(a=r)}}return-1},iW=(e,t,a)=>{let n=t>0&&e[t-1]==="!",r=n?t-1:t,o=e.substring(t+1);if(!o.includes("]")){let i=e.substring(0,r);if(n)return i;if(a==="text-only"){let s=e_(e,t);return s!==-1?e.substring(0,s)+e.substring(s+1):`${i}${o}`}return`${e}](streamdown:incomplete-link)`}if(r_(e,t)===-1){let i=e.substring(0,r);if(n)return i;if(a==="text-only"){let s=e_(e,t);if(s!==-1)return e.substring(0,s)+e.substring(s+1);let l=e.substring(t+1);return`${i}${l}`}return`${e}](streamdown:incomplete-link)`}return null},l_=(e,t="protocol")=>{let a=e.lastIndexOf("](");if(a!==-1&&!th(e,a)){let n=oW(e,a,t);if(n!==null)return n}for(let n=e.length-1;n>=0;n-=1)if(e[n]==="["&&!th(e,n)){let r=iW(e,n,t);if(r!==null)return r}return e},sW=/^-{1,2}$/,lW=/^[\s]*-{1,2}[\s]+$/,uW=/^={1,2}$/,cW=/^[\s]*={1,2}[\s]+$/,dW=e=>{if(!e||typeof e!="string")return e;let t=e.lastIndexOf(`
39
39
  `);if(t===-1)return e;let a=e.substring(t+1),n=e.substring(0,t),r=a.trim();if(sW.test(r)&&!a.match(lW)){let o=n.split(`
40
40
  `).at(-1);if(o&&o.trim().length>0)return`${e}\u200B`}if(uW.test(r)&&!a.match(cW)){let o=n.split(`
41
- `).at(-1);if(o&&o.trim().length>0)return`${e}\u200B`}return e},fW=e=>{let t=e.match(C7);if(t){let a=t[2];if(!a||ms.test(a))return e;if((e.match(QD)||[]).length%2===1)return`${e}~~`}else if(e.match(A7)&&(e.match(QD)||[]).length%2===1)return`${e}~`;return e},Ab=e=>e!==!1,bn={SETEXT_HEADINGS:0,LINKS:10,BOLD_ITALIC:20,BOLD:30,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,DEFAULT:100},pW=[{handler:{name:"setextHeadings",handle:dW,priority:bn.SETEXT_HEADINGS},optionKey:"setextHeadings"},{handler:{name:"links",handle:l_,priority:bn.LINKS},optionKey:"links",earlyReturn:e=>e.endsWith("](streamdown:incomplete-link)")},{handler:{name:"boldItalic",handle:K7,priority:bn.BOLD_ITALIC},optionKey:"boldItalic"},{handler:{name:"bold",handle:z7,priority:bn.BOLD},optionKey:"bold"},{handler:{name:"italicDoubleUnderscore",handle:q7,priority:bn.ITALIC_DOUBLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"italicSingleAsterisk",handle:j7,priority:bn.ITALIC_SINGLE_ASTERISK},optionKey:"italic"},{handler:{name:"italicSingleUnderscore",handle:W7,priority:bn.ITALIC_SINGLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"inlineCode",handle:eW,priority:bn.INLINE_CODE},optionKey:"inlineCode"},{handler:{name:"strikethrough",handle:fW,priority:bn.STRIKETHROUGH},optionKey:"strikethrough"},{handler:{name:"katex",handle:rW,priority:bn.KATEX},optionKey:"katex"}],mW=e=>{var t;let a=(t=e?.linkMode)!=null?t:"protocol";return pW.filter(({handler:n,optionKey:r})=>n.name==="links"?Ab(e?.links)||Ab(e?.images):Ab(e?.[r])).map(({handler:n,earlyReturn:r})=>n.name==="links"?{handler:a_(t_({},n),{handle:o=>l_(o,a)}),earlyReturn:a==="protocol"?r:void 0}:{handler:n,earlyReturn:r})},hW=(e,t)=>{var a;if(!e||typeof e!="string")return e;let n=e.endsWith(" ")&&!e.endsWith(" ")?e.slice(0,-1):e,r=mW(t),o=((a=t?.handlers)!=null?a:[]).map(s=>{var l;return{handler:a_(t_({},s),{priority:(l=s.priority)!=null?l:bn.DEFAULT}),earlyReturn:void 0}}),i=[...r,...o].sort((s,l)=>{var u,c;return((u=s.handler.priority)!=null?u:bn.DEFAULT)-((c=l.handler.priority)!=null?c:bn.DEFAULT)});for(let{handler:s,earlyReturn:l}of i)if(n=s.handle(n),l!=null&&l(n))return n;return n},u_=hW});function d_(e,t){let a=t||{};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}var f_=L(()=>{"use strict"});function nh(e,t){return((t||wW).jsx?yW:gW).test(e)}var gW,yW,wW,p_=L(()=>{"use strict";gW=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yW=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wW={}});var m_=L(()=>{"use strict";p_()});function Rb(e){return typeof e=="object"?e.type==="text"?h_(e.value):!1:h_(e)}function h_(e){return e.replace(vW,"")===""}var vW,g_=L(()=>{"use strict";vW=/[ \t\n\f\r]/g});var y_=L(()=>{"use strict";g_()});var no,Db=L(()=>{"use strict";no=class{constructor(t,a,n){this.normal=a,this.property=t,n&&(this.space=n)}};no.prototype.normal={};no.prototype.property={};no.prototype.space=void 0});function _b(e,t){let a={},n={};for(let r of e)Object.assign(a,r.property),Object.assign(n,r.normal);return new no(a,n,t)}var w_=L(()=>{"use strict";Db()});function Sd(e){return e.toLowerCase()}var Pb=L(()=>{"use strict"});var ga,Ob=L(()=>{"use strict";ga=class{constructor(t,a){this.attribute=a,this.property=t}};ga.prototype.attribute="";ga.prototype.booleanish=!1;ga.prototype.boolean=!1;ga.prototype.commaOrSpaceSeparated=!1;ga.prototype.commaSeparated=!1;ga.prototype.defined=!1;ga.prototype.mustUseProperty=!1;ga.prototype.number=!1;ga.prototype.overloadedBoolean=!1;ga.prototype.property="";ga.prototype.spaceSeparated=!1;ga.prototype.space=void 0});var Id={};lf(Id,{boolean:()=>De,booleanish:()=>$t,commaOrSpaceSeparated:()=>tn,commaSeparated:()=>ri,number:()=>G,overloadedBoolean:()=>rh,spaceSeparated:()=>ht});function hs(){return 2**++xW}var xW,De,$t,rh,G,ht,ri,tn,Cd=L(()=>{"use strict";xW=0,De=hs(),$t=hs(),rh=hs(),G=hs(),ht=hs(),ri=hs(),tn=hs()});function v_(e,t,a){a&&(e[t]=a)}var Nb,gs,Ub=L(()=>{"use strict";Ob();Cd();Nb=Object.keys(Id),gs=class extends ga{constructor(t,a,n,r){let o=-1;if(super(t,a),v_(this,"space",r),typeof n=="number")for(;++o<Nb.length;){let i=Nb[o];v_(this,Nb[o],(n&Id[i])===Id[i])}}};gs.prototype.defined=!0});function zn(e){let t={},a={};for(let[n,r]of Object.entries(e.properties)){let o=new gs(n,e.transform(e.attributes||{},n),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(o.mustUseProperty=!0),t[n]=o,a[Sd(n)]=n,a[Sd(o.attribute)]=n}return new no(t,a,e.space)}var ys=L(()=>{"use strict";Pb();Ub();Db()});var Bb,x_=L(()=>{"use strict";ys();Cd();Bb=zn({properties:{ariaActiveDescendant:null,ariaAtomic:$t,ariaAutoComplete:null,ariaBusy:$t,ariaChecked:$t,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:ht,ariaCurrent:null,ariaDescribedBy:ht,ariaDetails:null,ariaDisabled:$t,ariaDropEffect:ht,ariaErrorMessage:null,ariaExpanded:$t,ariaFlowTo:ht,ariaGrabbed:$t,ariaHasPopup:null,ariaHidden:$t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ht,ariaLevel:G,ariaLive:null,ariaModal:$t,ariaMultiLine:$t,ariaMultiSelectable:$t,ariaOrientation:null,ariaOwns:ht,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:$t,ariaReadOnly:$t,ariaRelevant:null,ariaRequired:$t,ariaRoleDescription:ht,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:$t,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}})});function oh(e,t){return t in e?e[t]:t}var zb=L(()=>{"use strict"});function ih(e,t){return oh(e,t.toLowerCase())}var Fb=L(()=>{"use strict";zb()});var b_,S_=L(()=>{"use strict";Fb();ys();Cd();b_=zn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ri,acceptCharset:ht,accessKey:ht,action:null,allow:null,allowFullScreen:De,allowPaymentRequest:De,allowUserMedia:De,alt:null,as:null,async:De,autoCapitalize:null,autoComplete:ht,autoFocus:De,autoPlay:De,blocking:ht,capture:null,charSet:null,checked:De,cite:null,className:ht,cols:G,colSpan:null,content:null,contentEditable:$t,controls:De,controlsList:ht,coords:G|ri,crossOrigin:null,data:null,dateTime:null,decoding:null,default:De,defer:De,dir:null,dirName:null,disabled:De,download:rh,draggable:$t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:De,formTarget:null,headers:ht,height:G,hidden:rh,high:G,href:null,hrefLang:null,htmlFor:ht,httpEquiv:ht,id:null,imageSizes:null,imageSrcSet:null,inert:De,inputMode:null,integrity:null,is:null,isMap:De,itemId:null,itemProp:ht,itemRef:ht,itemScope:De,itemType:ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:De,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:De,muted:De,name:null,nonce:null,noModule:De,noValidate:De,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:De,optimum:G,pattern:null,ping:ht,placeholder:null,playsInline:De,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:De,referrerPolicy:null,rel:ht,required:De,reversed:De,rows:G,rowSpan:G,sandbox:ht,scope:null,scoped:De,seamless:De,selected:De,shadowRootClonable:De,shadowRootDelegatesFocus:De,shadowRootMode:null,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:$t,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:De,useMap:null,value:$t,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ht,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:De,declare:De,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:De,noHref:De,noShade:De,noWrap:De,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:$t,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:De,disableRemotePlayback:De,prefix:null,property:null,results:G,security:null,unselectable:null},space:"html",transform:ih})});var I_,C_=L(()=>{"use strict";zb();ys();Cd();I_=zn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:tn,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:ht,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:De,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ri,g2:ri,glyphName:ri,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:tn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:G,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:tn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:tn,rev:tn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:tn,requiredFeatures:tn,requiredFonts:tn,requiredFormats:tn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:tn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:tn,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:tn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:oh})});var qb,k_=L(()=>{"use strict";ys();qb=zn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}})});var Hb,T_=L(()=>{"use strict";ys();Fb();Hb=zn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ih})});var jb,L_=L(()=>{"use strict";ys();jb=zn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}})});var Vb,E_=L(()=>{"use strict";Vb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"}});function $b(e,t){let a=Sd(t),n=t,r=ga;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&SW.test(t)){if(t.charAt(4)==="-"){let o=t.slice(5).replace(A_,CW);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{let o=t.slice(4);if(!A_.test(o)){let i=o.replace(bW,IW);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}r=gs}return new r(n,t)}function IW(e){return"-"+e.toLowerCase()}function CW(e){return e.charAt(1).toUpperCase()}var bW,A_,SW,M_=L(()=>{"use strict";Ub();Ob();Pb();bW=/[A-Z]/g,A_=/-[a-z]/g,SW=/^data[-\w.:]+$/i});var R_,sh,D_=L(()=>{"use strict";w_();x_();S_();C_();k_();T_();L_();E_();M_();R_=_b([Bb,b_,qb,Hb,jb],"html"),sh=_b([Bb,I_,qb,Hb,jb],"svg")});function __(e){return e.join(" ").trim()}var P_=L(()=>{"use strict"});var F_=Ca((Hme,z_)=>{"use strict";var O_=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,kW=/\n/g,TW=/^\s*/,LW=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,EW=/^:\s*/,AW=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,MW=/^[;\s]*/,RW=/^\s+|\s+$/g,DW=`
41
+ `).at(-1);if(o&&o.trim().length>0)return`${e}\u200B`}return e},fW=e=>{let t=e.match(C7);if(t){let a=t[2];if(!a||ms.test(a))return e;if((e.match(QD)||[]).length%2===1)return`${e}~~`}else if(e.match(A7)&&(e.match(QD)||[]).length%2===1)return`${e}~`;return e},Ab=e=>e!==!1,bn={SETEXT_HEADINGS:0,LINKS:10,BOLD_ITALIC:20,BOLD:30,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,DEFAULT:100},pW=[{handler:{name:"setextHeadings",handle:dW,priority:bn.SETEXT_HEADINGS},optionKey:"setextHeadings"},{handler:{name:"links",handle:l_,priority:bn.LINKS},optionKey:"links",earlyReturn:e=>e.endsWith("](streamdown:incomplete-link)")},{handler:{name:"boldItalic",handle:K7,priority:bn.BOLD_ITALIC},optionKey:"boldItalic"},{handler:{name:"bold",handle:z7,priority:bn.BOLD},optionKey:"bold"},{handler:{name:"italicDoubleUnderscore",handle:q7,priority:bn.ITALIC_DOUBLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"italicSingleAsterisk",handle:j7,priority:bn.ITALIC_SINGLE_ASTERISK},optionKey:"italic"},{handler:{name:"italicSingleUnderscore",handle:W7,priority:bn.ITALIC_SINGLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"inlineCode",handle:eW,priority:bn.INLINE_CODE},optionKey:"inlineCode"},{handler:{name:"strikethrough",handle:fW,priority:bn.STRIKETHROUGH},optionKey:"strikethrough"},{handler:{name:"katex",handle:rW,priority:bn.KATEX},optionKey:"katex"}],mW=e=>{var t;let a=(t=e?.linkMode)!=null?t:"protocol";return pW.filter(({handler:n,optionKey:r})=>n.name==="links"?Ab(e?.links)||Ab(e?.images):Ab(e?.[r])).map(({handler:n,earlyReturn:r})=>n.name==="links"?{handler:a_(t_({},n),{handle:o=>l_(o,a)}),earlyReturn:a==="protocol"?r:void 0}:{handler:n,earlyReturn:r})},hW=(e,t)=>{var a;if(!e||typeof e!="string")return e;let n=e.endsWith(" ")&&!e.endsWith(" ")?e.slice(0,-1):e,r=mW(t),o=((a=t?.handlers)!=null?a:[]).map(s=>{var l;return{handler:a_(t_({},s),{priority:(l=s.priority)!=null?l:bn.DEFAULT}),earlyReturn:void 0}}),i=[...r,...o].sort((s,l)=>{var u,c;return((u=s.handler.priority)!=null?u:bn.DEFAULT)-((c=l.handler.priority)!=null?c:bn.DEFAULT)});for(let{handler:s,earlyReturn:l}of i)if(n=s.handle(n),l!=null&&l(n))return n;return n},u_=hW});function d_(e,t){let a=t||{};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}var f_=L(()=>{"use strict"});function nh(e,t){return((t||wW).jsx?yW:gW).test(e)}var gW,yW,wW,p_=L(()=>{"use strict";gW=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yW=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wW={}});var m_=L(()=>{"use strict";p_()});function Rb(e){return typeof e=="object"?e.type==="text"?h_(e.value):!1:h_(e)}function h_(e){return e.replace(vW,"")===""}var vW,g_=L(()=>{"use strict";vW=/[ \t\n\f\r]/g});var y_=L(()=>{"use strict";g_()});var no,Db=L(()=>{"use strict";no=class{constructor(t,a,n){this.normal=a,this.property=t,n&&(this.space=n)}};no.prototype.normal={};no.prototype.property={};no.prototype.space=void 0});function _b(e,t){let a={},n={};for(let r of e)Object.assign(a,r.property),Object.assign(n,r.normal);return new no(a,n,t)}var w_=L(()=>{"use strict";Db()});function Sd(e){return e.toLowerCase()}var Pb=L(()=>{"use strict"});var ga,Ob=L(()=>{"use strict";ga=class{constructor(t,a){this.attribute=a,this.property=t}};ga.prototype.attribute="";ga.prototype.booleanish=!1;ga.prototype.boolean=!1;ga.prototype.commaOrSpaceSeparated=!1;ga.prototype.commaSeparated=!1;ga.prototype.defined=!1;ga.prototype.mustUseProperty=!1;ga.prototype.number=!1;ga.prototype.overloadedBoolean=!1;ga.prototype.property="";ga.prototype.spaceSeparated=!1;ga.prototype.space=void 0});var Id={};lf(Id,{boolean:()=>De,booleanish:()=>$t,commaOrSpaceSeparated:()=>tn,commaSeparated:()=>ri,number:()=>G,overloadedBoolean:()=>rh,spaceSeparated:()=>ht});function hs(){return 2**++xW}var xW,De,$t,rh,G,ht,ri,tn,Cd=L(()=>{"use strict";xW=0,De=hs(),$t=hs(),rh=hs(),G=hs(),ht=hs(),ri=hs(),tn=hs()});function v_(e,t,a){a&&(e[t]=a)}var Nb,gs,Ub=L(()=>{"use strict";Ob();Cd();Nb=Object.keys(Id),gs=class extends ga{constructor(t,a,n,r){let o=-1;if(super(t,a),v_(this,"space",r),typeof n=="number")for(;++o<Nb.length;){let i=Nb[o];v_(this,Nb[o],(n&Id[i])===Id[i])}}};gs.prototype.defined=!0});function zn(e){let t={},a={};for(let[n,r]of Object.entries(e.properties)){let o=new gs(n,e.transform(e.attributes||{},n),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(o.mustUseProperty=!0),t[n]=o,a[Sd(n)]=n,a[Sd(o.attribute)]=n}return new no(t,a,e.space)}var ys=L(()=>{"use strict";Pb();Ub();Db()});var Bb,x_=L(()=>{"use strict";ys();Cd();Bb=zn({properties:{ariaActiveDescendant:null,ariaAtomic:$t,ariaAutoComplete:null,ariaBusy:$t,ariaChecked:$t,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:ht,ariaCurrent:null,ariaDescribedBy:ht,ariaDetails:null,ariaDisabled:$t,ariaDropEffect:ht,ariaErrorMessage:null,ariaExpanded:$t,ariaFlowTo:ht,ariaGrabbed:$t,ariaHasPopup:null,ariaHidden:$t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ht,ariaLevel:G,ariaLive:null,ariaModal:$t,ariaMultiLine:$t,ariaMultiSelectable:$t,ariaOrientation:null,ariaOwns:ht,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:$t,ariaReadOnly:$t,ariaRelevant:null,ariaRequired:$t,ariaRoleDescription:ht,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:$t,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}})});function oh(e,t){return t in e?e[t]:t}var zb=L(()=>{"use strict"});function ih(e,t){return oh(e,t.toLowerCase())}var Fb=L(()=>{"use strict";zb()});var b_,S_=L(()=>{"use strict";Fb();ys();Cd();b_=zn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ri,acceptCharset:ht,accessKey:ht,action:null,allow:null,allowFullScreen:De,allowPaymentRequest:De,allowUserMedia:De,alt:null,as:null,async:De,autoCapitalize:null,autoComplete:ht,autoFocus:De,autoPlay:De,blocking:ht,capture:null,charSet:null,checked:De,cite:null,className:ht,cols:G,colSpan:null,content:null,contentEditable:$t,controls:De,controlsList:ht,coords:G|ri,crossOrigin:null,data:null,dateTime:null,decoding:null,default:De,defer:De,dir:null,dirName:null,disabled:De,download:rh,draggable:$t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:De,formTarget:null,headers:ht,height:G,hidden:rh,high:G,href:null,hrefLang:null,htmlFor:ht,httpEquiv:ht,id:null,imageSizes:null,imageSrcSet:null,inert:De,inputMode:null,integrity:null,is:null,isMap:De,itemId:null,itemProp:ht,itemRef:ht,itemScope:De,itemType:ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:De,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:De,muted:De,name:null,nonce:null,noModule:De,noValidate:De,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:De,optimum:G,pattern:null,ping:ht,placeholder:null,playsInline:De,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:De,referrerPolicy:null,rel:ht,required:De,reversed:De,rows:G,rowSpan:G,sandbox:ht,scope:null,scoped:De,seamless:De,selected:De,shadowRootClonable:De,shadowRootDelegatesFocus:De,shadowRootMode:null,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:$t,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:De,useMap:null,value:$t,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ht,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:De,declare:De,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:De,noHref:De,noShade:De,noWrap:De,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:$t,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:De,disableRemotePlayback:De,prefix:null,property:null,results:G,security:null,unselectable:null},space:"html",transform:ih})});var I_,C_=L(()=>{"use strict";zb();ys();Cd();I_=zn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:tn,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:ht,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:De,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ri,g2:ri,glyphName:ri,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:tn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:G,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:tn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:tn,rev:tn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:tn,requiredFeatures:tn,requiredFonts:tn,requiredFormats:tn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:tn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:tn,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:tn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:oh})});var qb,k_=L(()=>{"use strict";ys();qb=zn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}})});var Hb,T_=L(()=>{"use strict";ys();Fb();Hb=zn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ih})});var jb,L_=L(()=>{"use strict";ys();jb=zn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}})});var Vb,E_=L(()=>{"use strict";Vb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"}});function $b(e,t){let a=Sd(t),n=t,r=ga;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&SW.test(t)){if(t.charAt(4)==="-"){let o=t.slice(5).replace(A_,CW);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{let o=t.slice(4);if(!A_.test(o)){let i=o.replace(bW,IW);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}r=gs}return new r(n,t)}function IW(e){return"-"+e.toLowerCase()}function CW(e){return e.charAt(1).toUpperCase()}var bW,A_,SW,M_=L(()=>{"use strict";Ub();Ob();Pb();bW=/[A-Z]/g,A_=/-[a-z]/g,SW=/^data[-\w.:]+$/i});var R_,sh,D_=L(()=>{"use strict";w_();x_();S_();C_();k_();T_();L_();E_();M_();R_=_b([Bb,b_,qb,Hb,jb],"html"),sh=_b([Bb,I_,qb,Hb,jb],"svg")});function __(e){return e.join(" ").trim()}var P_=L(()=>{"use strict"});var F_=Ca((jme,z_)=>{"use strict";var O_=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,kW=/\n/g,TW=/^\s*/,LW=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,EW=/^:\s*/,AW=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,MW=/^[;\s]*/,RW=/^\s+|\s+$/g,DW=`
42
42
  `,N_="/",U_="*",ws="",_W="comment",PW="declaration";function OW(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var a=1,n=1;function r(h){var v=h.match(kW);v&&(a+=v.length);var I=h.lastIndexOf(DW);n=~I?h.length-I:n+h.length}function o(){var h={line:a,column:n};return function(v){return v.position=new i(h),u(),v}}function i(h){this.start=h,this.end={line:a,column:n},this.source=t.source}i.prototype.content=e;function s(h){var v=new Error(t.source+":"+a+":"+n+": "+h);if(v.reason=h,v.filename=t.source,v.line=a,v.column=n,v.source=e,!t.silent)throw v}function l(h){var v=h.exec(e);if(v){var I=v[0];return r(I),e=e.slice(I.length),v}}function u(){l(TW)}function c(h){var v;for(h=h||[];v=d();)v!==!1&&h.push(v);return h}function d(){var h=o();if(!(N_!=e.charAt(0)||U_!=e.charAt(1))){for(var v=2;ws!=e.charAt(v)&&(U_!=e.charAt(v)||N_!=e.charAt(v+1));)++v;if(v+=2,ws===e.charAt(v-1))return s("End of comment missing");var I=e.slice(2,v-2);return n+=2,r(I),e=e.slice(v),n+=2,h({type:_W,comment:I})}}function p(){var h=o(),v=l(LW);if(v){if(d(),!l(EW))return s("property missing ':'");var I=l(AW),y=h({type:PW,property:B_(v[0].replace(O_,ws)),value:I?B_(I[0].replace(O_,ws)):ws});return l(MW),y}}function m(){var h=[];c(h);for(var v;v=p();)v!==!1&&(h.push(v),c(h));return h}return u(),m()}function B_(e){return e?e.replace(RW,ws):ws}z_.exports=OW});var q_=Ca(kd=>{"use strict";var NW=kd&&kd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kd,"__esModule",{value:!0});kd.default=BW;var UW=NW(F_());function BW(e,t){let a=null;if(!e||typeof e!="string")return a;let n=(0,UW.default)(e),r=typeof t=="function";return n.forEach(o=>{if(o.type!=="declaration")return;let{property:i,value:s}=o;r?t(i,s,o):s&&(a=a||{},a[i]=s)}),a}});var j_=Ca(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.camelCase=void 0;var zW=/^--[a-zA-Z0-9_-]+$/,FW=/-([a-z])/g,qW=/^[^-]+$/,HW=/^-(webkit|moz|ms|o|khtml)-/,jW=/^-(ms)-/,VW=function(e){return!e||qW.test(e)||zW.test(e)},$W=function(e,t){return t.toUpperCase()},H_=function(e,t){return"".concat(t,"-")},WW=function(e,t){return t===void 0&&(t={}),VW(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(jW,H_):e=e.replace(HW,H_),e.replace(FW,$W))};lh.camelCase=WW});var $_=Ca((Gb,V_)=>{"use strict";var GW=Gb&&Gb.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},XW=GW(q_()),KW=j_();function Wb(e,t){var a={};return!e||typeof e!="string"||(0,XW.default)(e,function(n,r){n&&r&&(a[(0,KW.camelCase)(n,t)]=r)}),a}Wb.default=Wb;V_.exports=Wb});function oi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?W_(e.position):"start"in e||"end"in e?W_(e):"line"in e||"column"in e?Xb(e):""}function Xb(e){return G_(e&&e.line)+":"+G_(e&&e.column)}function W_(e){return Xb(e&&e.start)+"-"+Xb(e&&e.end)}function G_(e){return e&&typeof e=="number"?e:1}var X_=L(()=>{"use strict"});var Kb=L(()=>{"use strict";X_()});var ea,K_=L(()=>{"use strict";Kb();ea=class extends Error{constructor(t,a,n){super(),typeof a=="string"&&(n=a,a=void 0);let r="",o={},i=!1;if(a&&("line"in a&&"column"in a?o={place:a}:"start"in a&&"end"in a?o={place:a}:"type"in a?o={ancestors:[a],place:a.position}:o={...a}),typeof t=="string"?r=t:!o.cause&&t&&(i=!0,r=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof n=="string"){let l=n.indexOf(":");l===-1?o.ruleId=n:(o.source=n.slice(0,l),o.ruleId=n.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){let l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}let s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=s?s.line:void 0,this.name=oi(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=i&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};ea.prototype.file="";ea.prototype.name="";ea.prototype.reason="";ea.prototype.message="";ea.prototype.stack="";ea.prototype.column=void 0;ea.prototype.line=void 0;ea.prototype.ancestors=void 0;ea.prototype.cause=void 0;ea.prototype.fatal=void 0;ea.prototype.place=void 0;ea.prototype.ruleId=void 0;ea.prototype.source=void 0});var Yb=L(()=>{"use strict";K_()});function Jb(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");let a=t.filePath||void 0,n;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");n=sG(a,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");n=iG(a,t.jsx,t.jsxs)}let r={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:n,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?sh:R_,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=J_(r,e,void 0);return o&&typeof o!="string"?o:r.create(e,r.Fragment,{children:o||void 0},void 0)}function J_(e,t,a){if(t.type==="element")return eG(e,t,a);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return tG(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return nG(e,t,a);if(t.type==="mdxjsEsm")return aG(e,t);if(t.type==="root")return rG(e,t,a);if(t.type==="text")return oG(e,t)}function eG(e,t,a){let n=e.schema,r=n;t.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=sh,e.schema=r),e.ancestors.push(t);let o=eP(e,t.tagName,!1),i=lG(e,t),s=eS(e,t);return JW.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!Rb(l):!0})),Q_(e,i,o,t),Qb(i,s),e.ancestors.pop(),e.schema=n,e.create(t,o,i,a)}function tG(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Td(e,t.position)}function aG(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Td(e,t.position)}function nG(e,t,a){let n=e.schema,r=n;t.name==="svg"&&n.space==="html"&&(r=sh,e.schema=r),e.ancestors.push(t);let o=t.name===null?e.Fragment:eP(e,t.name,!0),i=uG(e,t),s=eS(e,t);return Q_(e,i,o,t),Qb(i,s),e.ancestors.pop(),e.schema=n,e.create(t,o,i,a)}function rG(e,t,a){let n={};return Qb(n,eS(e,t)),e.create(t,e.Fragment,n,a)}function oG(e,t){return t.value}function Q_(e,t,a,n){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(t.node=n)}function Qb(e,t){if(t.length>0){let a=t.length>1?t:t[0];a&&(e.children=a)}}function iG(e,t,a){return n;function n(r,o,i,s){let u=Array.isArray(i.children)?a:t;return s?u(o,i,s):u(o,i)}}function sG(e,t){return a;function a(n,r,o,i){let s=Array.isArray(o.children),l=Wl(n);return t(r,o,i,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function lG(e,t){let a={},n,r;for(r in t.properties)if(r!=="children"&&Zb.call(t.properties,r)){let o=cG(e,r,t.properties[r]);if(o){let[i,s]=o;e.tableCellAlignToStyle&&i==="align"&&typeof s=="string"&&QW.has(t.tagName)?n=s:a[i]=s}}if(n){let o=a.style||(a.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=n}return a}function uG(e,t){let a={};for(let n of t.attributes)if(n.type==="mdxJsxExpressionAttribute")if(n.data&&n.data.estree&&e.evaluater){let o=n.data.estree.body[0];o.type;let i=o.expression;i.type;let s=i.properties[0];s.type,Object.assign(a,e.evaluater.evaluateExpression(s.argument))}else Td(e,t.position);else{let r=n.name,o;if(n.value&&typeof n.value=="object")if(n.value.data&&n.value.data.estree&&e.evaluater){let s=n.value.data.estree.body[0];s.type,o=e.evaluater.evaluateExpression(s.expression)}else Td(e,t.position);else o=n.value===null?!0:n.value;a[r]=o}return a}function eS(e,t){let a=[],n=-1,r=e.passKeys?new Map:YW;for(;++n<t.children.length;){let o=t.children[n],i;if(e.passKeys){let l=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(l){let u=r.get(l)||0;i=l+"-"+u,r.set(l,u+1)}}let s=J_(e,o,i);s!==void 0&&a.push(s)}return a}function cG(e,t,a){let n=$b(e.schema,t);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=n.commaSeparated?d_(a):__(a)),n.property==="style"){let r=typeof a=="object"?a:dG(e,String(a));return e.stylePropertyNameCase==="css"&&(r=fG(r)),["style",r]}return[e.elementAttributeNameCase==="react"&&n.space?Vb[n.property]||n.property:n.attribute,a]}}function dG(e,t){try{return(0,Y_.default)(t,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};let n=a,r=new ea("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Z_+"#cannot-parse-style-attribute",r}}function eP(e,t,a){let n;if(!a)n={type:"Literal",value:t};else if(t.includes(".")){let r=t.split("."),o=-1,i;for(;++o<r.length;){let s=nh(r[o])?{type:"Identifier",name:r[o]}:{type:"Literal",value:r[o]};i=i?{type:"MemberExpression",object:i,property:s,computed:!!(o&&s.type==="Literal"),optional:!1}:s}n=i}else n=nh(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(n.type==="Literal"){let r=n.value;return Zb.call(e.components,r)?e.components[r]:r}if(e.evaluater)return e.evaluater.evaluateExpression(n);Td(e)}function Td(e,t){let a=new ea("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=Z_+"#cannot-handle-mdx-estrees-without-createevaluater",a}function fG(e){let t={},a;for(a in e)Zb.call(e,a)&&(t[pG(a)]=e[a]);return t}function pG(e){let t=e.replace(ZW,mG);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function mG(e){return"-"+e.toLowerCase()}var Y_,Zb,YW,ZW,JW,QW,Z_,tP=L(()=>{"use strict";f_();m_();y_();D_();P_();Y_=j($_(),1);pd();Yb();Zb={}.hasOwnProperty,YW=new Map,ZW=/[A-Z]/g,JW=new Set(["table","tbody","thead","tfoot","tr"]),QW=new Set(["td","th"]),Z_="https://github.com/syntax-tree/hast-util-to-jsx-runtime"});var aP=L(()=>{"use strict";tP()});function hG(e){let t=e.attempt(this.parser.constructs.contentInitial,n,r),a;return t;function n(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ye(e,t,"linePrefix")}function r(s){return e.enter("paragraph"),o(s)}function o(s){let l=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=l),a=l,i(s)}function i(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return ne(s)?(e.consume(s),e.exit("chunkText"),o):(e.consume(s),i)}}var nP,rP=L(()=>{"use strict";Qt();at();nP={tokenize:hG}});function gG(e){let t=this,a=[],n=0,r,o,i;return s;function s(g){if(n<a.length){let S=a[n];return t.containerState=S[1],e.attempt(S[0].continuation,l,u)(g)}return u(g)}function l(g){if(n++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&w();let S=t.events.length,E=S,T;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){T=t.events[E][1].end;break}y(n);let R=S;for(;R<t.events.length;)t.events[R][1].end={...T},R++;return Jt(t.events,E+1,0,t.events.slice(S)),t.events.length=R,u(g)}return s(g)}function u(g){if(n===a.length){if(!r)return p(g);if(r.currentConstruct&&r.currentConstruct.concrete)return h(g);t.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(oP,c,d)(g)}function c(g){return r&&w(),y(n),p(g)}function d(g){return t.parser.lazy[t.now().line]=n!==a.length,i=t.now().offset,h(g)}function p(g){return t.containerState={},e.attempt(oP,m,h)(g)}function m(g){return n++,a.push([t.currentConstruct,t.containerState]),p(g)}function h(g){if(g===null){r&&w(),y(0),e.consume(g);return}return r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:o}),v(g)}function v(g){if(g===null){I(e.exit("chunkFlow"),!0),y(0),e.consume(g);return}return ne(g)?(e.consume(g),I(e.exit("chunkFlow")),n=0,t.interrupt=void 0,s):(e.consume(g),v)}function I(g,S){let E=t.sliceStream(g);if(S&&E.push(null),g.previous=o,o&&(o.next=g),o=g,r.defineSkip(g.start),r.write(E),t.parser.lazy[g.start.line]){let T=r.events.length;for(;T--;)if(r.events[T][1].start.offset<i&&(!r.events[T][1].end||r.events[T][1].end.offset>i))return;let R=t.events.length,O=R,U,A;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(U){A=t.events[O][1].end;break}U=!0}for(y(n),T=R;T<t.events.length;)t.events[T][1].end={...A},T++;Jt(t.events,O+1,0,t.events.slice(R)),t.events.length=T}}function y(g){let S=a.length;for(;S-- >g;){let E=a[S];t.containerState=E[1],E[0].exit.call(t,e)}a.length=g}function w(){r.write([null]),o=void 0,r=void 0,t.containerState._closeFlow=void 0}}function yG(e,t,a){return ye(e,e.attempt(this.parser.constructs.document,t,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}var iP,oP,sP=L(()=>{"use strict";Qt();at();to();iP={tokenize:gG},oP={tokenize:yG}});function wG(e){let t=this,a=e.attempt(Cr,n,e.attempt(this.parser.constructs.flowInitial,r,ye(e,e.attempt(this.parser.constructs.flow,r,e.attempt(db,r)),"linePrefix")));return a;function n(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,a}function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,a}}var lP,uP=L(()=>{"use strict";Zm();Qt();lP={tokenize:wG}});function pP(e){return{resolveAll:mP(e==="text"?vG:void 0),tokenize:t};function t(a){let n=this,r=this.parser.constructs[e],o=a.attempt(r,i,s);return i;function i(c){return u(c)?o(c):s(c)}function s(c){if(c===null){a.consume(c);return}return a.enter("data"),a.consume(c),l}function l(c){return u(c)?(a.exit("data"),o(c)):(a.consume(c),l)}function u(c){if(c===null)return!0;let d=r[c],p=-1;if(d)for(;++p<d.length;){let m=d[p];if(!m.previous||m.previous.call(n,n.previous))return!0}return!1}}}function mP(e){return t;function t(a,n){let r=-1,o;for(;++r<=a.length;)o===void 0?a[r]&&a[r][1].type==="data"&&(o=r,r++):(!a[r]||a[r][1].type!=="data")&&(r!==o+2&&(a[o][1].end=a[r-1][1].end,a.splice(o+2,r-o-2),r=o+2),o=void 0);return e?e(a,n):a}}function vG(e,t){let a=0;for(;++a<=e.length;)if((a===e.length||e[a][1].type==="lineEnding")&&e[a-1][1].type==="data"){let n=e[a-1][1],r=t.sliceStream(n),o=r.length,i=-1,s=0,l;for(;o--;){let u=r[o];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)s++,i--;if(i)break;i=-1}else if(u===-2)l=!0,s++;else if(u!==-1){o++;break}}if(t._contentTypeTextTrailing&&a===e.length&&(s=0),s){let u={type:a===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?i:n.start._bufferIndex+i,_index:n.start._index+o,line:n.end.line,column:n.end.column-s,offset:n.end.offset-s},end:{...n.end}};n.end={...u.start},n.start.offset===n.end.offset?Object.assign(n,u):(e.splice(a,0,["enter",u,t],["exit",u,t]),a+=2)}a++}return e}var cP,dP,fP,tS=L(()=>{"use strict";cP={resolveAll:mP()},dP=pP("string"),fP=pP("text")});var aS={};lf(aS,{attentionMarkers:()=>LG,contentInitial:()=>bG,disable:()=>EG,document:()=>xG,flow:()=>IG,flowInitial:()=>SG,insideSpan:()=>TG,string:()=>CG,text:()=>kG});var xG,bG,SG,IG,CG,kG,TG,LG,EG,hP=L(()=>{"use strict";Zm();tS();xG={42:Ra,43:Ra,45:Ra,48:Ra,49:Ra,50:Ra,51:Ra,52:Ra,53:Ra,54:Ra,55:Ra,56:Ra,57:Ra,62:Fm},bG={91:gb},SG={[-2]:vd,[-1]:vd,32:vd},IG={35:wb,42:ps,45:[Ym,ps],60:xb,61:Ym,95:ps,96:jm,126:jm},CG={38:Hm,92:qm},kG={[-5]:bd,[-4]:bd,[-3]:bd,33:Sb,38:Hm,42:wd,60:[lb,bb],91:Ib,92:[yb,qm],93:fs,95:wd,96:ub},TG={null:[wd,cP]},LG={null:[42,95]},EG={null:[]}});function gP(e,t,a){let n={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0},r={},o=[],i=[],s=[],l=!0,u={attempt:U(R),check:U(O),consume:S,enter:E,exit:T,interrupt:U(O,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:I,parser:e,previous:null,sliceSerialize:h,sliceStream:v,write:m},d=t.tokenize.call(c,u),p;return t.resolveAll&&o.push(t),c;function m(H){return i=za(i,H),w(),i[i.length-1]!==null?[]:(A(t,0),c.events=ai(o,c.events,c),c.events)}function h(H,Z){return MG(v(H),Z)}function v(H){return AG(i,H)}function I(){let{_bufferIndex:H,_index:Z,line:X,column:B,offset:P}=n;return{_bufferIndex:H,_index:Z,line:X,column:B,offset:P}}function y(H){r[H.line]=H.column,$()}function w(){let H;for(;n._index<i.length;){let Z=i[n._index];if(typeof Z=="string")for(H=n._index,n._bufferIndex<0&&(n._bufferIndex=0);n._index===H&&n._bufferIndex<Z.length;)g(Z.charCodeAt(n._bufferIndex));else g(Z)}}function g(H){l=void 0,p=H,d=d(H)}function S(H){ne(H)?(n.line++,n.column=1,n.offset+=H===-3?2:1,$()):H!==-1&&(n.column++,n.offset++),n._bufferIndex<0?n._index++:(n._bufferIndex++,n._bufferIndex===i[n._index].length&&(n._bufferIndex=-1,n._index++)),c.previous=H,l=!0}function E(H,Z){let X=Z||{};return X.type=H,X.start=I(),c.events.push(["enter",X,c]),s.push(X),X}function T(H){let Z=s.pop();return Z.end=I(),c.events.push(["exit",Z,c]),Z}function R(H,Z){A(H,Z.from)}function O(H,Z){Z.restore()}function U(H,Z){return X;function X(B,P,J){let ge,C,ze,ot;return Array.isArray(B)?te(B):"tokenize"in B?te([B]):x(B);function x(be){return Oe;function Oe(we){let ce=we!==null&&be[we],Le=we!==null&&be.null,ie=[...Array.isArray(ce)?ce:ce?[ce]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return te(ie)(we)}}function te(be){return ge=be,C=0,be.length===0?J:re(be[C])}function re(be){return Oe;function Oe(we){return ot=Q(),ze=be,be.partial||(c.currentConstruct=be),be.name&&c.parser.constructs.disable.null.includes(be.name)?We(we):be.tokenize.call(Z?Object.assign(Object.create(c),Z):c,u,ke,We)(we)}}function ke(be){return l=!0,H(ze,ot),P}function We(be){return l=!0,ot.restore(),++C<ge.length?re(ge[C]):J}}}function A(H,Z){H.resolveAll&&!o.includes(H)&&o.push(H),H.resolve&&Jt(c.events,Z,c.events.length-Z,H.resolve(c.events.slice(Z),c)),H.resolveTo&&(c.events=H.resolveTo(c.events,c))}function Q(){let H=I(),Z=c.previous,X=c.currentConstruct,B=c.events.length,P=Array.from(s);return{from:B,restore:J};function J(){n=H,c.previous=Z,c.currentConstruct=X,c.events.length=B,s=P,$()}}function $(){n.line in r&&n.column<2&&(n.column=r[n.line],n.offset+=r[n.line]-1)}}function AG(e,t){let a=t.start._index,n=t.start._bufferIndex,r=t.end._index,o=t.end._bufferIndex,i;if(a===r)i=[e[a].slice(n,o)];else{if(i=e.slice(a,r),n>-1){let s=i[0];typeof s=="string"?i[0]=s.slice(n):i.shift()}o>0&&i.push(e[r].slice(0,o))}return i}function MG(e,t){let a=-1,n=[],r;for(;++a<e.length;){let o=e[a],i;if(typeof o=="string")i=o;else switch(o){case-5:{i="\r";break}case-4:{i=`
43
43
  `;break}case-3:{i=`\r
44
44
  `;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&r)continue;i=" ";break}default:i=String.fromCharCode(o)}r=o===-2,n.push(i)}return n.join("")}var yP=L(()=>{"use strict";at();to();yd()});function nS(e){let n={constructs:Bm([aS,...(e||{}).extensions||[]]),content:r(nP),defined:[],document:r(iP),flow:r(lP),lazy:{},string:r(dP),text:r(fP)};return n;function r(o){return i;function i(s){return gP(n,o,s)}}}var wP=L(()=>{"use strict";rb();rP();sP();uP();tS();hP();yP()});function rS(e){for(;!$m(e););return e}var vP=L(()=>{"use strict";cb()});function oS(){let e=1,t="",a=!0,n;return r;function r(o,i,s){let l=[],u,c,d,p,m;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(i||void 0).decode(o)),d=0,t="",a&&(o.charCodeAt(0)===65279&&d++,a=void 0);d<o.length;){if(xP.lastIndex=d,u=xP.exec(o),p=u&&u.index!==void 0?u.index:o.length,m=o.charCodeAt(p),!u){t=o.slice(d);break}if(m===10&&d===p&&n)l.push(-3),n=void 0;else switch(n&&(l.push(-5),n=void 0),d<p&&(l.push(o.slice(d,p)),e+=p-d),m){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:n=!0,e=1}d=p+1}return s&&(n&&l.push(-5),t&&l.push(t),l.push(null)),l}}var xP,bP=L(()=>{"use strict";xP=/[\0\t\n\r]/g});var SP=L(()=>{"use strict";wP();vP();bP()});function iS(e,t,a){return typeof t!="string"&&(a=t,t=void 0),RG(a)(rS(nS(a).document().write(oS()(e,t,!0))))}function RG(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(de),autolinkProtocol:U,autolinkEmail:U,atxHeading:o(Ne),blockQuote:o(we),characterEscape:U,characterReference:U,codeFenced:o(ce),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:o(ce,i),codeText:o(Le,i),codeTextData:U,data:U,codeFlowValue:U,definition:o(ie),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:o(xe),hardBreakEscape:o(_e),hardBreakTrailing:o(_e),htmlFlow:o(Fe,i),htmlFlowData:U,htmlText:o(Fe,i),htmlTextData:U,image:o(Ae),label:i,link:o(de),listItem:o(ct),listItemValue:p,listOrdered:o(W,d),listUnordered:o(W),paragraph:o(le),reference:x,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:o(Ne),strong:o(oe),thematicBreak:o(ae)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:Oe,autolinkProtocol:be,blockQuote:l(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:ke,characterReference:We,codeFenced:l(I),codeFencedFence:v,codeFencedFenceInfo:m,codeFencedFenceMeta:h,codeFlowValue:A,codeIndented:l(y),codeText:l(X),codeTextData:A,data:A,definition:l(),definitionDestinationString:S,definitionLabelString:w,definitionTitleString:g,emphasis:l(),hardBreakEscape:l($),hardBreakTrailing:l($),htmlFlow:l(H),htmlFlowData:A,htmlText:l(Z),htmlTextData:A,image:l(P),label:ge,labelText:J,lineEnding:Q,link:l(B),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:te,resourceDestinationString:C,resourceTitleString:ze,resource:ot,setextHeading:l(O),setextHeadingLineSequence:R,setextHeadingText:T,strong:l(),thematicBreak:l()}};kP(t,(e||{}).mdastExtensions||[]);let a={};return n;function n(k){let D={type:"root",children:[]},F={stack:[D],tokenStack:[],config:t,enter:s,exit:u,buffer:i,resume:c,data:a},fe=[],Ve=-1;for(;++Ve<k.length;)if(k[Ve][1].type==="listOrdered"||k[Ve][1].type==="listUnordered")if(k[Ve][0]==="enter")fe.push(Ve);else{let Ft=fe.pop();Ve=r(k,Ft,Ve)}for(Ve=-1;++Ve<k.length;){let Ft=t[k[Ve][0]];CP.call(Ft,k[Ve][1].type)&&Ft[k[Ve][1].type].call(Object.assign({sliceSerialize:k[Ve][2].sliceSerialize},F),k[Ve][1])}if(F.tokenStack.length>0){let Ft=F.tokenStack[F.tokenStack.length-1];(Ft[1]||IP).call(F,void 0,Ft[0])}for(D.position={start:ii(k.length>0?k[0][1].start:{line:1,column:1,offset:0}),end:ii(k.length>0?k[k.length-2][1].end:{line:1,column:1,offset:0})},Ve=-1;++Ve<t.transforms.length;)D=t.transforms[Ve](D)||D;return D}function r(k,D,F){let fe=D-1,Ve=-1,Ft=!1,In,ca,so,lo;for(;++fe<=F;){let qt=k[fe];switch(qt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{qt[0]==="enter"?Ve++:Ve--,lo=void 0;break}case"lineEndingBlank":{qt[0]==="enter"&&(In&&!lo&&!Ve&&!so&&(so=fe),lo=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:lo=void 0}if(!Ve&&qt[0]==="enter"&&qt[1].type==="listItemPrefix"||Ve===-1&&qt[0]==="exit"&&(qt[1].type==="listUnordered"||qt[1].type==="listOrdered")){if(In){let Vn=fe;for(ca=void 0;Vn--;){let on=k[Vn];if(on[1].type==="lineEnding"||on[1].type==="lineEndingBlank"){if(on[0]==="exit")continue;ca&&(k[ca][1].type="lineEndingBlank",Ft=!0),on[1].type="lineEnding",ca=Vn}else if(!(on[1].type==="linePrefix"||on[1].type==="blockQuotePrefix"||on[1].type==="blockQuotePrefixWhitespace"||on[1].type==="blockQuoteMarker"||on[1].type==="listItemIndent"))break}so&&(!ca||so<ca)&&(In._spread=!0),In.end=Object.assign({},ca?k[ca][1].start:qt[1].end),k.splice(ca||fe,0,["exit",In,qt[2]]),fe++,F++}if(qt[1].type==="listItemPrefix"){let Vn={type:"listItem",_spread:!1,start:Object.assign({},qt[1].start),end:void 0};In=Vn,k.splice(fe,0,["enter",Vn,qt[2]]),fe++,F++,so=void 0,lo=!0}}}return k[D][1]._spread=Ft,F}function o(k,D){return F;function F(fe){s.call(this,k(fe),fe),D&&D.call(this,fe)}}function i(){this.stack.push({type:"fragment",children:[]})}function s(k,D,F){this.stack[this.stack.length-1].children.push(k),this.stack.push(k),this.tokenStack.push([D,F||void 0]),k.position={start:ii(D.start),end:void 0}}function l(k){return D;function D(F){k&&k.call(this,F),u.call(this,F)}}function u(k,D){let F=this.stack.pop(),fe=this.tokenStack.pop();if(fe)fe[0].type!==k.type&&(D?D.call(this,k,fe[0]):(fe[1]||IP).call(this,k,fe[0]));else throw new Error("Cannot close `"+k.type+"` ("+oi({start:k.start,end:k.end})+"): it\u2019s not open");F.position.end=ii(k.end)}function c(){return ls(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(k){if(this.data.expectingFirstListItemValue){let D=this.stack[this.stack.length-2];D.start=Number.parseInt(this.sliceSerialize(k),10),this.data.expectingFirstListItemValue=void 0}}function m(){let k=this.resume(),D=this.stack[this.stack.length-1];D.lang=k}function h(){let k=this.resume(),D=this.stack[this.stack.length-1];D.meta=k}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function I(){let k=this.resume(),D=this.stack[this.stack.length-1];D.value=k.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){let k=this.resume(),D=this.stack[this.stack.length-1];D.value=k.replace(/(\r?\n|\r)$/g,"")}function w(k){let D=this.resume(),F=this.stack[this.stack.length-1];F.label=D,F.identifier=Ma(this.sliceSerialize(k)).toLowerCase()}function g(){let k=this.resume(),D=this.stack[this.stack.length-1];D.title=k}function S(){let k=this.resume(),D=this.stack[this.stack.length-1];D.url=k}function E(k){let D=this.stack[this.stack.length-1];if(!D.depth){let F=this.sliceSerialize(k).length;D.depth=F}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function R(k){let D=this.stack[this.stack.length-1];D.depth=this.sliceSerialize(k).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function U(k){let F=this.stack[this.stack.length-1].children,fe=F[F.length-1];(!fe||fe.type!=="text")&&(fe=Ie(),fe.position={start:ii(k.start),end:void 0},F.push(fe)),this.stack.push(fe)}function A(k){let D=this.stack.pop();D.value+=this.sliceSerialize(k),D.position.end=ii(k.end)}function Q(k){let D=this.stack[this.stack.length-1];if(this.data.atHardBreak){let F=D.children[D.children.length-1];F.position.end=ii(k.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(D.type)&&(U.call(this,k),A.call(this,k))}function $(){this.data.atHardBreak=!0}function H(){let k=this.resume(),D=this.stack[this.stack.length-1];D.value=k}function Z(){let k=this.resume(),D=this.stack[this.stack.length-1];D.value=k}function X(){let k=this.resume(),D=this.stack[this.stack.length-1];D.value=k}function B(){let k=this.stack[this.stack.length-1];if(this.data.inReference){let D=this.data.referenceType||"shortcut";k.type+="Reference",k.referenceType=D,delete k.url,delete k.title}else delete k.identifier,delete k.label;this.data.referenceType=void 0}function P(){let k=this.stack[this.stack.length-1];if(this.data.inReference){let D=this.data.referenceType||"shortcut";k.type+="Reference",k.referenceType=D,delete k.url,delete k.title}else delete k.identifier,delete k.label;this.data.referenceType=void 0}function J(k){let D=this.sliceSerialize(k),F=this.stack[this.stack.length-2];F.label=V2(D),F.identifier=Ma(D).toLowerCase()}function ge(){let k=this.stack[this.stack.length-1],D=this.resume(),F=this.stack[this.stack.length-1];if(this.data.inReference=!0,F.type==="link"){let fe=k.children;F.children=fe}else F.alt=D}function C(){let k=this.resume(),D=this.stack[this.stack.length-1];D.url=k}function ze(){let k=this.resume(),D=this.stack[this.stack.length-1];D.title=k}function ot(){this.data.inReference=void 0}function x(){this.data.referenceType="collapsed"}function te(k){let D=this.resume(),F=this.stack[this.stack.length-1];F.label=D,F.identifier=Ma(this.sliceSerialize(k)).toLowerCase(),this.data.referenceType="full"}function re(k){this.data.characterReferenceType=k.type}function ke(k){let D=this.sliceSerialize(k),F=this.data.characterReferenceType,fe;F?(fe=Um(D,F==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):fe=Zl(D);let Ve=this.stack[this.stack.length-1];Ve.value+=fe}function We(k){let D=this.stack.pop();D.position.end=ii(k.end)}function be(k){A.call(this,k);let D=this.stack[this.stack.length-1];D.url=this.sliceSerialize(k)}function Oe(k){A.call(this,k);let D=this.stack[this.stack.length-1];D.url="mailto:"+this.sliceSerialize(k)}function we(){return{type:"blockquote",children:[]}}function ce(){return{type:"code",lang:null,meta:null,value:""}}function Le(){return{type:"inlineCode",value:""}}function ie(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function xe(){return{type:"emphasis",children:[]}}function Ne(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function Ae(){return{type:"image",title:null,url:"",alt:null}}function de(){return{type:"link",title:null,url:"",children:[]}}function W(k){return{type:"list",ordered:k.type==="listOrdered",start:null,spread:k._spread,children:[]}}function ct(k){return{type:"listItem",spread:k._spread,checked:null,children:[]}}function le(){return{type:"paragraph",children:[]}}function oe(){return{type:"strong",children:[]}}function Ie(){return{type:"text",value:""}}function ae(){return{type:"thematicBreak"}}}function ii(e){return{line:e.line,column:e.column,offset:e.offset}}function kP(e,t){let a=-1;for(;++a<t.length;){let n=t[a];Array.isArray(n)?kP(e,n):DG(e,n)}}function DG(e,t){let a;for(a in t)if(CP.call(t,a))switch(a){case"canContainEols":{let n=t[a];n&&e[a].push(...n);break}case"transforms":{let n=t[a];n&&e[a].push(...n);break}case"enter":case"exit":{let n=t[a];n&&Object.assign(e[a],n);break}}}function IP(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+oi({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+oi({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+oi({start:t.start,end:t.end})+") is still open")}var CP,TP=L(()=>{"use strict";_m();SP();Kx();$2();Gl();Nm();Kb();CP={}.hasOwnProperty});var LP=L(()=>{"use strict";TP()});function uh(e){let t=this;t.parser=a;function a(n){return iS(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}var EP=L(()=>{"use strict";LP()});var AP=L(()=>{"use strict";EP()});function MP(e,t){let a={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,a),e.applyData(t,a)}var RP=L(()=>{"use strict"});function DP(e,t){let a={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,a),[e.applyData(t,a),{type:"text",value:`
@@ -51,9 +51,9 @@ $$`:`${e}$$`},rW=e=>aW(e)%2===0?e:nW(e),oW=(e,t,a)=>{if(e.substring(t+2).include
51
51
  `});++n<e.length;)n&&a.push({type:"text",value:`
52
52
  `}),a.push(e[n]);return t&&e.length>0&&a.push({type:"text",value:`
53
53
  `}),a}function MO(e){let t=0,a=e.charCodeAt(t);for(;a===9||a===32;)t++,a=e.charCodeAt(t);return e.slice(t)}var lS,NG,DO=L(()=>{"use strict";Lm();Cm();pd();LO();lS={}.hasOwnProperty,NG={}});function fh(e,t){let a=RO(e,t),n=a.one(e,void 0),r=EO(a),o=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return r&&("children"in o,o.children.push({type:"text",value:`
54
- `},r)),o}var _O=L(()=>{"use strict";AO();DO()});var PO=L(()=>{"use strict";_O()});function ph(e,t){return e&&"run"in e?async function(a,n){let r=fh(a,{file:n,...t});await e.run(r,n)}:function(a,n){return fh(a,{file:n,...e||t})}}var OO=L(()=>{"use strict";PO()});var NO=L(()=>{"use strict";OO()});function uS(e){if(e)throw e}var UO=L(()=>{"use strict"});var WO=Ca((bye,$O)=>{"use strict";var mh=Object.prototype.hasOwnProperty,VO=Object.prototype.toString,BO=Object.defineProperty,zO=Object.getOwnPropertyDescriptor,FO=function(t){return typeof Array.isArray=="function"?Array.isArray(t):VO.call(t)==="[object Array]"},qO=function(t){if(!t||VO.call(t)!=="[object Object]")return!1;var a=mh.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&mh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!a&&!n)return!1;var r;for(r in t);return typeof r>"u"||mh.call(t,r)},HO=function(t,a){BO&&a.name==="__proto__"?BO(t,a.name,{enumerable:!0,configurable:!0,value:a.newValue,writable:!0}):t[a.name]=a.newValue},jO=function(t,a){if(a==="__proto__")if(mh.call(t,a)){if(zO)return zO(t,a).value}else return;return t[a]};$O.exports=function e(){var t,a,n,r,o,i,s=arguments[0],l=1,u=arguments.length,c=!1;for(typeof s=="boolean"&&(c=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<u;++l)if(t=arguments[l],t!=null)for(a in t)n=jO(s,a),r=jO(t,a),s!==r&&(c&&r&&(qO(r)||(o=FO(r)))?(o?(o=!1,i=n&&FO(n)?n:[]):i=n&&qO(n)?n:{},HO(s,{name:a,newValue:e(c,i,r)})):typeof r<"u"&&HO(s,{name:a,newValue:r}));return s}});function Ld(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var GO=L(()=>{"use strict"});function cS(){let e=[],t={run:a,use:n};return t;function a(...r){let o=-1,i=r.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);s(null,...r);function s(l,...u){let c=e[++o],d=-1;if(l){i(l);return}for(;++d<r.length;)(u[d]===null||u[d]===void 0)&&(u[d]=r[d]);r=u,c?XO(c,s)(...u):i(null,...u)}}function n(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function XO(e,t){let a;return n;function n(...i){let s=e.length>i.length,l;s&&i.push(r);try{l=e.apply(this,i)}catch(u){let c=u;if(s&&a)throw c;return r(c)}s||(l&&l.then&&typeof l.then=="function"?l.then(o,r):l instanceof Error?r(l):o(l))}function r(i,...s){a||(a=!0,t(i,...s))}function o(i){r(null,i)}}var KO=L(()=>{"use strict"});var YO=L(()=>{"use strict";KO()});function qG(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ed(e);let a=0,n=-1,r=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(o){a=r+1;break}}else n<0&&(o=!0,n=r+1);return n<0?"":e.slice(a,n)}if(t===e)return"";let i=-1,s=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(o){a=r+1;break}}else i<0&&(o=!0,i=r+1),s>-1&&(e.codePointAt(r)===t.codePointAt(s--)?s<0&&(n=r):(s=-1,n=i));return a===n?n=i:n<0&&(n=e.length),e.slice(a,n)}function HG(e){if(Ed(e),e.length===0)return".";let t=-1,a=e.length,n;for(;--a;)if(e.codePointAt(a)===47){if(n){t=a;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function jG(e){Ed(e);let t=e.length,a=-1,n=0,r=-1,o=0,i;for(;t--;){let s=e.codePointAt(t);if(s===47){if(i){n=t+1;break}continue}a<0&&(i=!0,a=t+1),s===46?r<0?r=t:o!==1&&(o=1):r>-1&&(o=-1)}return r<0||a<0||o===0||o===1&&r===a-1&&r===n+1?"":e.slice(r,a)}function VG(...e){let t=-1,a;for(;++t<e.length;)Ed(e[t]),e[t]&&(a=a===void 0?e[t]:a+"/"+e[t]);return a===void 0?".":$G(a)}function $G(e){Ed(e);let t=e.codePointAt(0)===47,a=WG(e,!t);return a.length===0&&!t&&(a="."),a.length>0&&e.codePointAt(e.length-1)===47&&(a+="/"),t?"/"+a:a}function WG(e,t){let a="",n=0,r=-1,o=0,i=-1,s,l;for(;++i<=e.length;){if(i<e.length)s=e.codePointAt(i);else{if(s===47)break;s=47}if(s===47){if(!(r===i-1||o===1))if(r!==i-1&&o===2){if(a.length<2||n!==2||a.codePointAt(a.length-1)!==46||a.codePointAt(a.length-2)!==46){if(a.length>2){if(l=a.lastIndexOf("/"),l!==a.length-1){l<0?(a="",n=0):(a=a.slice(0,l),n=a.length-1-a.lastIndexOf("/")),r=i,o=0;continue}}else if(a.length>0){a="",n=0,r=i,o=0;continue}}t&&(a=a.length>0?a+"/..":"..",n=2)}else a.length>0?a+="/"+e.slice(r+1,i):a=e.slice(r+1,i),n=i-r-1;r=i,o=0}else s===46&&o>-1?o++:o=-1}return a}function Ed(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var ar,ZO=L(()=>{"use strict";ar={basename:qG,dirname:HG,extname:jG,join:VG,sep:"/"}});function GG(){return"/"}var JO,QO=L(()=>{"use strict";JO={cwd:GG}});function eu(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}var dS=L(()=>{"use strict"});function eN(e){if(typeof e=="string")e=new URL(e);else if(!eu(e)){let t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){let t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return XG(e)}function XG(e){if(e.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let t=e.pathname,a=-1;for(;++a<t.length;)if(t.codePointAt(a)===37&&t.codePointAt(a+1)===50){let n=t.codePointAt(a+2);if(n===70||n===102){let r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(t)}var tN=L(()=>{"use strict";dS();dS()});function pS(e,t){if(e&&e.includes(ar.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ar.sep+"`")}function mS(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function aN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function KG(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var fS,Ad,nN=L(()=>{"use strict";Yb();ZO();QO();tN();fS=["history","path","basename","stem","extname","dirname"],Ad=class{constructor(t){let a;t?eu(t)?a={path:t}:typeof t=="string"||KG(t)?a={value:t}:a=t:a={},this.cwd="cwd"in a?"":JO.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<fS.length;){let o=fS[n];o in a&&a[o]!==void 0&&a[o]!==null&&(this[o]=o==="history"?[...a[o]]:a[o])}let r;for(r in a)fS.includes(r)||(this[r]=a[r])}get basename(){return typeof this.path=="string"?ar.basename(this.path):void 0}set basename(t){mS(t,"basename"),pS(t,"basename"),this.path=ar.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ar.dirname(this.path):void 0}set dirname(t){aN(this.basename,"dirname"),this.path=ar.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ar.extname(this.path):void 0}set extname(t){if(pS(t,"extname"),aN(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ar.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){eu(t)&&(t=eN(t)),mS(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ar.basename(this.path,this.extname):void 0}set stem(t){mS(t,"stem"),pS(t,"stem"),this.path=ar.join(this.dirname||"",t+(this.extname||""))}fail(t,a,n){let r=this.message(t,a,n);throw r.fatal=!0,r}info(t,a,n){let r=this.message(t,a,n);return r.fatal=void 0,r}message(t,a,n){let r=new ea(t,a,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}});var rN=L(()=>{"use strict";nN()});var oN,iN=L(()=>{"use strict";oN=(function(e){let n=this.constructor.prototype,r=n[e],o=function(){return r.apply(o,arguments)};return Object.setPrototypeOf(o,n),o})});function hS(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function gS(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function yS(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function sN(e){if(!Ld(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function lN(e,t,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function hh(e){return ZG(e)?e:new Ad(e)}function ZG(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function JG(e){return typeof e=="string"||QG(e)}function QG(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var gh,YG,wS,vS,uN=L(()=>{"use strict";UO();gh=j(WO(),1);GO();YO();rN();iN();YG={}.hasOwnProperty,wS=class e extends oN{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=cS()}copy(){let t=new e,a=-1;for(;++a<this.attachers.length;){let n=this.attachers[a];t.use(...n)}return t.data((0,gh.default)(!0,{},this.namespace)),t}data(t,a){return typeof t=="string"?arguments.length===2?(yS("data",this.frozen),this.namespace[t]=a,this):YG.call(this.namespace,t)&&this.namespace[t]||void 0:t?(yS("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;let t=this;for(;++this.freezeIndex<this.attachers.length;){let[a,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=a.call(t,...n);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();let a=hh(t),n=this.parser||this.Parser;return hS("parse",n),n(String(a),a)}process(t,a){let n=this;return this.freeze(),hS("process",this.parser||this.Parser),gS("process",this.compiler||this.Compiler),a?r(void 0,a):new Promise(r);function r(o,i){let s=hh(t),l=n.parse(s);n.run(l,s,function(c,d,p){if(c||!d||!p)return u(c);let m=d,h=n.stringify(m,p);JG(h)?p.value=h:p.result=h,u(c,p)});function u(c,d){c||!d?i(c):o?o(d):a(void 0,d)}}}processSync(t){let a=!1,n;return this.freeze(),hS("processSync",this.parser||this.Parser),gS("processSync",this.compiler||this.Compiler),this.process(t,r),lN("processSync","process",a),n;function r(o,i){a=!0,uS(o),n=i}}run(t,a,n){sN(t),this.freeze();let r=this.transformers;return!n&&typeof a=="function"&&(n=a,a=void 0),n?o(void 0,n):new Promise(o);function o(i,s){let l=hh(a);r.run(t,l,u);function u(c,d,p){let m=d||t;c?s(c):i?i(m):n(void 0,m,p)}}}runSync(t,a){let n=!1,r;return this.run(t,a,o),lN("runSync","run",n),r;function o(i,s){uS(i),r=s,n=!0}}stringify(t,a){this.freeze();let n=hh(a),r=this.compiler||this.Compiler;return gS("stringify",r),sN(t),r(t,n)}use(t,...a){let n=this.attachers,r=this.namespace;if(yS("use",this.frozen),t!=null)if(typeof t=="function")l(t,a);else if(typeof t=="object")Array.isArray(t)?s(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){let[c,...d]=u;l(c,d)}else i(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function i(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(u.plugins),u.settings&&(r.settings=(0,gh.default)(!0,r.settings,u.settings))}function s(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){let d=u[c];o(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let d=-1,p=-1;for(;++d<n.length;)if(n[d][0]===u){p=d;break}if(p===-1)n.push([u,...c]);else if(c.length>0){let[m,...h]=c,v=n[p][1];Ld(v)&&Ld(m)&&(m=(0,gh.default)(!0,v,m)),n[p]=[u,m,...h]}}}},vS=new wS().freeze()});var cN=L(()=>{"use strict";uN()});function IS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function yN(e){xs=e}function it(e,t=""){let a=typeof e=="string"?e:e.source,n={replace:(r,o)=>{let i=typeof o=="string"?o:o.source;return i=i.replace(Fa.caret,"$1"),a=a.replace(r,i),n},getRegex:()=>new RegExp(a,t)};return n}function ro(e,t){if(t){if(Fa.escapeTest.test(e))return e.replace(Fa.escapeReplace,pN)}else if(Fa.escapeTestNoEncode.test(e))return e.replace(Fa.escapeReplaceNoEncode,pN);return e}function mN(e){try{e=encodeURI(e).replace(Fa.percentDecode,"%")}catch{return null}return e}function hN(e,t){let a=e.replace(Fa.findPipe,(o,i,s)=>{let l=!1,u=i;for(;--u>=0&&s[u]==="\\";)l=!l;return l?"|":" |"}),n=a.split(Fa.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(Fa.slashPipe,"|");return n}function Rd(e,t,a){let n=e.length;if(n===0)return"";let r=0;for(;r<n;){let o=e.charAt(n-r-1);if(o===t&&!a)r++;else if(o!==t&&a)r++;else break}return e.slice(0,n-r)}function PX(e,t){if(e.indexOf(t[1])===-1)return-1;let a=0;for(let n=0;n<e.length;n++)if(e[n]==="\\")n++;else if(e[n]===t[0])a++;else if(e[n]===t[1]&&(a--,a<0))return n;return a>0?-2:-1}function gN(e,t,a,n,r){let o=t.href,i=t.title||null,s=e[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:a,href:o,title:i,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,l}function OX(e,t,a){let n=e.match(a.other.indentCodeCompensation);if(n===null)return t;let r=n[1];return t.split(`
54
+ `},r)),o}var _O=L(()=>{"use strict";AO();DO()});var PO=L(()=>{"use strict";_O()});function ph(e,t){return e&&"run"in e?async function(a,n){let r=fh(a,{file:n,...t});await e.run(r,n)}:function(a,n){return fh(a,{file:n,...e||t})}}var OO=L(()=>{"use strict";PO()});var NO=L(()=>{"use strict";OO()});function uS(e){if(e)throw e}var UO=L(()=>{"use strict"});var WO=Ca((Sye,$O)=>{"use strict";var mh=Object.prototype.hasOwnProperty,VO=Object.prototype.toString,BO=Object.defineProperty,zO=Object.getOwnPropertyDescriptor,FO=function(t){return typeof Array.isArray=="function"?Array.isArray(t):VO.call(t)==="[object Array]"},qO=function(t){if(!t||VO.call(t)!=="[object Object]")return!1;var a=mh.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&mh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!a&&!n)return!1;var r;for(r in t);return typeof r>"u"||mh.call(t,r)},HO=function(t,a){BO&&a.name==="__proto__"?BO(t,a.name,{enumerable:!0,configurable:!0,value:a.newValue,writable:!0}):t[a.name]=a.newValue},jO=function(t,a){if(a==="__proto__")if(mh.call(t,a)){if(zO)return zO(t,a).value}else return;return t[a]};$O.exports=function e(){var t,a,n,r,o,i,s=arguments[0],l=1,u=arguments.length,c=!1;for(typeof s=="boolean"&&(c=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<u;++l)if(t=arguments[l],t!=null)for(a in t)n=jO(s,a),r=jO(t,a),s!==r&&(c&&r&&(qO(r)||(o=FO(r)))?(o?(o=!1,i=n&&FO(n)?n:[]):i=n&&qO(n)?n:{},HO(s,{name:a,newValue:e(c,i,r)})):typeof r<"u"&&HO(s,{name:a,newValue:r}));return s}});function Ld(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var GO=L(()=>{"use strict"});function cS(){let e=[],t={run:a,use:n};return t;function a(...r){let o=-1,i=r.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);s(null,...r);function s(l,...u){let c=e[++o],d=-1;if(l){i(l);return}for(;++d<r.length;)(u[d]===null||u[d]===void 0)&&(u[d]=r[d]);r=u,c?XO(c,s)(...u):i(null,...u)}}function n(r){if(typeof r!="function")throw new TypeError("Expected `middelware` to be a function, not "+r);return e.push(r),t}}function XO(e,t){let a;return n;function n(...i){let s=e.length>i.length,l;s&&i.push(r);try{l=e.apply(this,i)}catch(u){let c=u;if(s&&a)throw c;return r(c)}s||(l&&l.then&&typeof l.then=="function"?l.then(o,r):l instanceof Error?r(l):o(l))}function r(i,...s){a||(a=!0,t(i,...s))}function o(i){r(null,i)}}var KO=L(()=>{"use strict"});var YO=L(()=>{"use strict";KO()});function qG(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ed(e);let a=0,n=-1,r=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;r--;)if(e.codePointAt(r)===47){if(o){a=r+1;break}}else n<0&&(o=!0,n=r+1);return n<0?"":e.slice(a,n)}if(t===e)return"";let i=-1,s=t.length-1;for(;r--;)if(e.codePointAt(r)===47){if(o){a=r+1;break}}else i<0&&(o=!0,i=r+1),s>-1&&(e.codePointAt(r)===t.codePointAt(s--)?s<0&&(n=r):(s=-1,n=i));return a===n?n=i:n<0&&(n=e.length),e.slice(a,n)}function HG(e){if(Ed(e),e.length===0)return".";let t=-1,a=e.length,n;for(;--a;)if(e.codePointAt(a)===47){if(n){t=a;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function jG(e){Ed(e);let t=e.length,a=-1,n=0,r=-1,o=0,i;for(;t--;){let s=e.codePointAt(t);if(s===47){if(i){n=t+1;break}continue}a<0&&(i=!0,a=t+1),s===46?r<0?r=t:o!==1&&(o=1):r>-1&&(o=-1)}return r<0||a<0||o===0||o===1&&r===a-1&&r===n+1?"":e.slice(r,a)}function VG(...e){let t=-1,a;for(;++t<e.length;)Ed(e[t]),e[t]&&(a=a===void 0?e[t]:a+"/"+e[t]);return a===void 0?".":$G(a)}function $G(e){Ed(e);let t=e.codePointAt(0)===47,a=WG(e,!t);return a.length===0&&!t&&(a="."),a.length>0&&e.codePointAt(e.length-1)===47&&(a+="/"),t?"/"+a:a}function WG(e,t){let a="",n=0,r=-1,o=0,i=-1,s,l;for(;++i<=e.length;){if(i<e.length)s=e.codePointAt(i);else{if(s===47)break;s=47}if(s===47){if(!(r===i-1||o===1))if(r!==i-1&&o===2){if(a.length<2||n!==2||a.codePointAt(a.length-1)!==46||a.codePointAt(a.length-2)!==46){if(a.length>2){if(l=a.lastIndexOf("/"),l!==a.length-1){l<0?(a="",n=0):(a=a.slice(0,l),n=a.length-1-a.lastIndexOf("/")),r=i,o=0;continue}}else if(a.length>0){a="",n=0,r=i,o=0;continue}}t&&(a=a.length>0?a+"/..":"..",n=2)}else a.length>0?a+="/"+e.slice(r+1,i):a=e.slice(r+1,i),n=i-r-1;r=i,o=0}else s===46&&o>-1?o++:o=-1}return a}function Ed(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var ar,ZO=L(()=>{"use strict";ar={basename:qG,dirname:HG,extname:jG,join:VG,sep:"/"}});function GG(){return"/"}var JO,QO=L(()=>{"use strict";JO={cwd:GG}});function eu(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}var dS=L(()=>{"use strict"});function eN(e){if(typeof e=="string")e=new URL(e);else if(!eu(e)){let t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){let t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return XG(e)}function XG(e){if(e.hostname!==""){let n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}let t=e.pathname,a=-1;for(;++a<t.length;)if(t.codePointAt(a)===37&&t.codePointAt(a+1)===50){let n=t.codePointAt(a+2);if(n===70||n===102){let r=new TypeError("File URL path must not include encoded / characters");throw r.code="ERR_INVALID_FILE_URL_PATH",r}}return decodeURIComponent(t)}var tN=L(()=>{"use strict";dS();dS()});function pS(e,t){if(e&&e.includes(ar.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ar.sep+"`")}function mS(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function aN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function KG(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var fS,Ad,nN=L(()=>{"use strict";Yb();ZO();QO();tN();fS=["history","path","basename","stem","extname","dirname"],Ad=class{constructor(t){let a;t?eu(t)?a={path:t}:typeof t=="string"||KG(t)?a={value:t}:a=t:a={},this.cwd="cwd"in a?"":JO.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<fS.length;){let o=fS[n];o in a&&a[o]!==void 0&&a[o]!==null&&(this[o]=o==="history"?[...a[o]]:a[o])}let r;for(r in a)fS.includes(r)||(this[r]=a[r])}get basename(){return typeof this.path=="string"?ar.basename(this.path):void 0}set basename(t){mS(t,"basename"),pS(t,"basename"),this.path=ar.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ar.dirname(this.path):void 0}set dirname(t){aN(this.basename,"dirname"),this.path=ar.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ar.extname(this.path):void 0}set extname(t){if(pS(t,"extname"),aN(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ar.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){eu(t)&&(t=eN(t)),mS(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ar.basename(this.path,this.extname):void 0}set stem(t){mS(t,"stem"),pS(t,"stem"),this.path=ar.join(this.dirname||"",t+(this.extname||""))}fail(t,a,n){let r=this.message(t,a,n);throw r.fatal=!0,r}info(t,a,n){let r=this.message(t,a,n);return r.fatal=void 0,r}message(t,a,n){let r=new ea(t,a,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}});var rN=L(()=>{"use strict";nN()});var oN,iN=L(()=>{"use strict";oN=(function(e){let n=this.constructor.prototype,r=n[e],o=function(){return r.apply(o,arguments)};return Object.setPrototypeOf(o,n),o})});function hS(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function gS(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function yS(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function sN(e){if(!Ld(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function lN(e,t,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function hh(e){return ZG(e)?e:new Ad(e)}function ZG(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function JG(e){return typeof e=="string"||QG(e)}function QG(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var gh,YG,wS,vS,uN=L(()=>{"use strict";UO();gh=j(WO(),1);GO();YO();rN();iN();YG={}.hasOwnProperty,wS=class e extends oN{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=cS()}copy(){let t=new e,a=-1;for(;++a<this.attachers.length;){let n=this.attachers[a];t.use(...n)}return t.data((0,gh.default)(!0,{},this.namespace)),t}data(t,a){return typeof t=="string"?arguments.length===2?(yS("data",this.frozen),this.namespace[t]=a,this):YG.call(this.namespace,t)&&this.namespace[t]||void 0:t?(yS("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;let t=this;for(;++this.freezeIndex<this.attachers.length;){let[a,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=a.call(t,...n);typeof r=="function"&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();let a=hh(t),n=this.parser||this.Parser;return hS("parse",n),n(String(a),a)}process(t,a){let n=this;return this.freeze(),hS("process",this.parser||this.Parser),gS("process",this.compiler||this.Compiler),a?r(void 0,a):new Promise(r);function r(o,i){let s=hh(t),l=n.parse(s);n.run(l,s,function(c,d,p){if(c||!d||!p)return u(c);let m=d,h=n.stringify(m,p);JG(h)?p.value=h:p.result=h,u(c,p)});function u(c,d){c||!d?i(c):o?o(d):a(void 0,d)}}}processSync(t){let a=!1,n;return this.freeze(),hS("processSync",this.parser||this.Parser),gS("processSync",this.compiler||this.Compiler),this.process(t,r),lN("processSync","process",a),n;function r(o,i){a=!0,uS(o),n=i}}run(t,a,n){sN(t),this.freeze();let r=this.transformers;return!n&&typeof a=="function"&&(n=a,a=void 0),n?o(void 0,n):new Promise(o);function o(i,s){let l=hh(a);r.run(t,l,u);function u(c,d,p){let m=d||t;c?s(c):i?i(m):n(void 0,m,p)}}}runSync(t,a){let n=!1,r;return this.run(t,a,o),lN("runSync","run",n),r;function o(i,s){uS(i),r=s,n=!0}}stringify(t,a){this.freeze();let n=hh(a),r=this.compiler||this.Compiler;return gS("stringify",r),sN(t),r(t,n)}use(t,...a){let n=this.attachers,r=this.namespace;if(yS("use",this.frozen),t!=null)if(typeof t=="function")l(t,a);else if(typeof t=="object")Array.isArray(t)?s(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){let[c,...d]=u;l(c,d)}else i(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function i(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(u.plugins),u.settings&&(r.settings=(0,gh.default)(!0,r.settings,u.settings))}function s(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){let d=u[c];o(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let d=-1,p=-1;for(;++d<n.length;)if(n[d][0]===u){p=d;break}if(p===-1)n.push([u,...c]);else if(c.length>0){let[m,...h]=c,v=n[p][1];Ld(v)&&Ld(m)&&(m=(0,gh.default)(!0,v,m)),n[p]=[u,m,...h]}}}},vS=new wS().freeze()});var cN=L(()=>{"use strict";uN()});function IS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function yN(e){xs=e}function it(e,t=""){let a=typeof e=="string"?e:e.source,n={replace:(r,o)=>{let i=typeof o=="string"?o:o.source;return i=i.replace(Fa.caret,"$1"),a=a.replace(r,i),n},getRegex:()=>new RegExp(a,t)};return n}function ro(e,t){if(t){if(Fa.escapeTest.test(e))return e.replace(Fa.escapeReplace,pN)}else if(Fa.escapeTestNoEncode.test(e))return e.replace(Fa.escapeReplaceNoEncode,pN);return e}function mN(e){try{e=encodeURI(e).replace(Fa.percentDecode,"%")}catch{return null}return e}function hN(e,t){let a=e.replace(Fa.findPipe,(o,i,s)=>{let l=!1,u=i;for(;--u>=0&&s[u]==="\\";)l=!l;return l?"|":" |"}),n=a.split(Fa.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(Fa.slashPipe,"|");return n}function Rd(e,t,a){let n=e.length;if(n===0)return"";let r=0;for(;r<n;){let o=e.charAt(n-r-1);if(o===t&&!a)r++;else if(o!==t&&a)r++;else break}return e.slice(0,n-r)}function PX(e,t){if(e.indexOf(t[1])===-1)return-1;let a=0;for(let n=0;n<e.length;n++)if(e[n]==="\\")n++;else if(e[n]===t[0])a++;else if(e[n]===t[1]&&(a--,a<0))return n;return a>0?-2:-1}function gN(e,t,a,n,r){let o=t.href,i=t.title||null,s=e[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:a,href:o,title:i,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,l}function OX(e,t,a){let n=e.match(a.other.indentCodeCompensation);if(n===null)return t;let r=n[1];return t.split(`
55
55
  `).map(o=>{let i=o.match(a.other.beginningSpace);if(i===null)return o;let[s]=i;return s.length>=r.length?o.slice(r.length):o}).join(`
56
- `)}function wt(e,t){return vs.parse(e,t)}var xs,_d,eX,Fa,tX,aX,nX,Pd,rX,CS,wN,vN,oX,kS,iX,TS,sX,lX,Sh,LS,uX,xN,cX,ES,dN,dX,fX,pX,mX,bN,hX,Ih,AS,SN,gX,IN,yX,wX,vX,CN,xX,bX,kN,SX,IX,CX,kX,TX,LX,EX,vh,AX,TN,LN,MX,fN,MS,RX,xS,DX,yh,Md,_X,pN,xh,Sn,bh,RS,nr,wh,Dd,NX,vs,Xye,Kye,Yye,Zye,Jye,Qye,ewe,EN=L(()=>{"use strict";xs=IS();_d={exec:()=>null};eX=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Fa={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},tX=/^(?:[ \t]*(?:\n|$))+/,aX=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,nX=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Pd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,rX=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,CS=/(?:[*+-]|\d{1,9}[.)])/,wN=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,vN=it(wN).replace(/bull/g,CS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),oX=it(wN).replace(/bull/g,CS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),kS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,iX=/^[^\n]+/,TS=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,sX=it(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",TS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lX=it(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,CS).getRegex(),Sh="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",LS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,uX=it("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",LS).replace("tag",Sh).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xN=it(kS).replace("hr",Pd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Sh).getRegex(),cX=it(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",xN).getRegex(),ES={blockquote:cX,code:aX,def:sX,fences:nX,heading:rX,hr:Pd,html:uX,lheading:vN,list:lX,newline:tX,paragraph:xN,table:_d,text:iX},dN=it("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Pd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Sh).getRegex(),dX={...ES,lheading:oX,table:dN,paragraph:it(kS).replace("hr",Pd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",dN).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Sh).getRegex()},fX={...ES,html:it(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",LS).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_d,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:it(kS).replace("hr",Pd).replace("heading",` *#{1,6} *[^
56
+ `)}function wt(e,t){return vs.parse(e,t)}var xs,_d,eX,Fa,tX,aX,nX,Pd,rX,CS,wN,vN,oX,kS,iX,TS,sX,lX,Sh,LS,uX,xN,cX,ES,dN,dX,fX,pX,mX,bN,hX,Ih,AS,SN,gX,IN,yX,wX,vX,CN,xX,bX,kN,SX,IX,CX,kX,TX,LX,EX,vh,AX,TN,LN,MX,fN,MS,RX,xS,DX,yh,Md,_X,pN,xh,Sn,bh,RS,nr,wh,Dd,NX,vs,Kye,Yye,Zye,Jye,Qye,ewe,twe,EN=L(()=>{"use strict";xs=IS();_d={exec:()=>null};eX=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Fa={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},tX=/^(?:[ \t]*(?:\n|$))+/,aX=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,nX=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Pd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,rX=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,CS=/(?:[*+-]|\d{1,9}[.)])/,wN=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,vN=it(wN).replace(/bull/g,CS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),oX=it(wN).replace(/bull/g,CS).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),kS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,iX=/^[^\n]+/,TS=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,sX=it(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",TS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lX=it(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,CS).getRegex(),Sh="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",LS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,uX=it("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",LS).replace("tag",Sh).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xN=it(kS).replace("hr",Pd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Sh).getRegex(),cX=it(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",xN).getRegex(),ES={blockquote:cX,code:aX,def:sX,fences:nX,heading:rX,hr:Pd,html:uX,lheading:vN,list:lX,newline:tX,paragraph:xN,table:_d,text:iX},dN=it("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Pd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Sh).getRegex(),dX={...ES,lheading:oX,table:dN,paragraph:it(kS).replace("hr",Pd).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",dN).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Sh).getRegex()},fX={...ES,html:it(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",LS).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_d,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:it(kS).replace("hr",Pd).replace("heading",` *#{1,6} *[^
57
57
  ]`).replace("lheading",vN).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},pX=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,mX=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,bN=/^( {2,}|\\)\n(?!\s*$)/,hX=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ih=/[\p{P}\p{S}]/u,AS=/[\s\p{P}\p{S}]/u,SN=/[^\s\p{P}\p{S}]/u,gX=it(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,AS).getRegex(),IN=/(?!~)[\p{P}\p{S}]/u,yX=/(?!~)[\s\p{P}\p{S}]/u,wX=/(?:[^\s\p{P}\p{S}]|~)/u,vX=it(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",eX?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),CN=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,xX=it(CN,"u").replace(/punct/g,Ih).getRegex(),bX=it(CN,"u").replace(/punct/g,IN).getRegex(),kN="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",SX=it(kN,"gu").replace(/notPunctSpace/g,SN).replace(/punctSpace/g,AS).replace(/punct/g,Ih).getRegex(),IX=it(kN,"gu").replace(/notPunctSpace/g,wX).replace(/punctSpace/g,yX).replace(/punct/g,IN).getRegex(),CX=it("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,SN).replace(/punctSpace/g,AS).replace(/punct/g,Ih).getRegex(),kX=it(/\\(punct)/,"gu").replace(/punct/g,Ih).getRegex(),TX=it(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),LX=it(LS).replace("(?:-->|$)","-->").getRegex(),EX=it("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",LX).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),vh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,AX=it(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",vh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),TN=it(/^!?\[(label)\]\[(ref)\]/).replace("label",vh).replace("ref",TS).getRegex(),LN=it(/^!?\[(ref)\](?:\[\])?/).replace("ref",TS).getRegex(),MX=it("reflink|nolink(?!\\()","g").replace("reflink",TN).replace("nolink",LN).getRegex(),fN=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,MS={_backpedal:_d,anyPunctuation:kX,autolink:TX,blockSkip:vX,br:bN,code:mX,del:_d,emStrongLDelim:xX,emStrongRDelimAst:SX,emStrongRDelimUnd:CX,escape:pX,link:AX,nolink:LN,punctuation:gX,reflink:TN,reflinkSearch:MX,tag:EX,text:hX,url:_d},RX={...MS,link:it(/^!?\[(label)\]\((.*?)\)/).replace("label",vh).getRegex(),reflink:it(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",vh).getRegex()},xS={...MS,emStrongRDelimAst:IX,emStrongLDelim:bX,url:it(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",fN).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:it(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",fN).getRegex()},DX={...xS,br:it(bN).replace("{2,}","*").getRegex(),text:it(xS.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},yh={normal:ES,gfm:dX,pedantic:fX},Md={normal:MS,gfm:xS,breaks:DX,pedantic:RX},_X={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pN=e=>_X[e];xh=class{constructor(e){K(this,"options");K(this,"rules");K(this,"lexer");this.options=e||xs}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let a=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?a:Rd(a,`
58
58
  `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let a=t[0],n=OX(a,t[3]||"",this.rules);return{type:"code",raw:a,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let a=t[2].trim();if(this.rules.other.endingHash.test(a)){let n=Rd(a,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(a=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:a,tokens:this.lexer.inline(a)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Rd(t[0],`
59
59
  `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let a=Rd(t[0],`
@@ -109,7 +109,7 @@ ${this.parser.parse(e)}</blockquote>
109
109
  ${e}</tr>
110
110
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),a=e.header?"th":"td";return(e.align?`<${a} align="${e.align}">`:`<${a}>`)+t+`</${a}>
111
111
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ro(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:a}){let n=this.parser.parseInline(a),r=mN(e);if(r===null)return n;e=r;let o='<a href="'+e+'"';return t&&(o+=' title="'+ro(t)+'"'),o+=">"+n+"</a>",o}image({href:e,title:t,text:a,tokens:n}){n&&(a=this.parser.parseInline(n,this.parser.textRenderer));let r=mN(e);if(r===null)return ro(a);e=r;let o=`<img src="${e}" alt="${a}"`;return t&&(o+=` title="${ro(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ro(e.text)}},RS=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},nr=class SS{constructor(t){K(this,"options");K(this,"renderer");K(this,"textRenderer");this.options=t||xs,this.options.renderer=this.options.renderer||new bh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new RS}static parse(t,a){return new SS(a).parse(t)}static parseInline(t,a){return new SS(a).parseInline(t)}parse(t){let a="";for(let n=0;n<t.length;n++){let r=t[n];if(this.options.extensions?.renderers?.[r.type]){let i=r,s=this.options.extensions.renderers[i.type].call({parser:this},i);if(s!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){a+=s||"";continue}}let o=r;switch(o.type){case"space":{a+=this.renderer.space(o);break}case"hr":{a+=this.renderer.hr(o);break}case"heading":{a+=this.renderer.heading(o);break}case"code":{a+=this.renderer.code(o);break}case"table":{a+=this.renderer.table(o);break}case"blockquote":{a+=this.renderer.blockquote(o);break}case"list":{a+=this.renderer.list(o);break}case"checkbox":{a+=this.renderer.checkbox(o);break}case"html":{a+=this.renderer.html(o);break}case"def":{a+=this.renderer.def(o);break}case"paragraph":{a+=this.renderer.paragraph(o);break}case"text":{a+=this.renderer.text(o);break}default:{let i='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return a}parseInline(t,a=this.renderer){let n="";for(let r=0;r<t.length;r++){let o=t[r];if(this.options.extensions?.renderers?.[o.type]){let s=this.options.extensions.renderers[o.type].call({parser:this},o);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=s||"";continue}}let i=o;switch(i.type){case"escape":{n+=a.text(i);break}case"html":{n+=a.html(i);break}case"link":{n+=a.link(i);break}case"image":{n+=a.image(i);break}case"checkbox":{n+=a.checkbox(i);break}case"strong":{n+=a.strong(i);break}case"em":{n+=a.em(i);break}case"codespan":{n+=a.codespan(i);break}case"br":{n+=a.br(i);break}case"del":{n+=a.del(i);break}case"text":{n+=a.text(i);break}default:{let s='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}},Dd=(wh=class{constructor(e){K(this,"options");K(this,"block");this.options=e||xs}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Sn.lex:Sn.lexInline}provideParser(){return this.block?nr.parse:nr.parseInline}},K(wh,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),K(wh,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),wh),NX=class{constructor(...e){K(this,"defaults",IS());K(this,"options",this.setOptions);K(this,"parse",this.parseMarkdown(!0));K(this,"parseInline",this.parseMarkdown(!1));K(this,"Parser",nr);K(this,"Renderer",bh);K(this,"TextRenderer",RS);K(this,"Lexer",Sn);K(this,"Tokenizer",xh);K(this,"Hooks",Dd);this.use(...e)}walkTokens(e,t){let a=[];for(let n of e)switch(a=a.concat(t.call(this,n)),n.type){case"table":{let r=n;for(let o of r.header)a=a.concat(this.walkTokens(o.tokens,t));for(let o of r.rows)for(let i of o)a=a.concat(this.walkTokens(i.tokens,t));break}case"list":{let r=n;a=a.concat(this.walkTokens(r.items,t));break}default:{let r=n;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let i=r[o].flat(1/0);a=a.concat(this.walkTokens(i,t))}):r.tokens&&(a=a.concat(this.walkTokens(r.tokens,t)))}}return a}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(a=>{let n={...a};if(n.async=this.defaults.async||n.async||!1,a.extensions&&(a.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let o=t.renderers[r.name];o?t.renderers[r.name]=function(...i){let s=r.renderer.apply(this,i);return s===!1&&(s=o.apply(this,i)),s}:t.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[r.level];o?o.unshift(r.tokenizer):t[r.level]=[r.tokenizer],r.start&&(r.level==="block"?t.startBlock?t.startBlock.push(r.start):t.startBlock=[r.start]:r.level==="inline"&&(t.startInline?t.startInline.push(r.start):t.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(t.childTokens[r.name]=r.childTokens)}),n.extensions=t),a.renderer){let r=this.defaults.renderer||new bh(this.defaults);for(let o in a.renderer){if(!(o in r))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let i=o,s=a.renderer[i],l=r[i];r[i]=(...u)=>{let c=s.apply(r,u);return c===!1&&(c=l.apply(r,u)),c||""}}n.renderer=r}if(a.tokenizer){let r=this.defaults.tokenizer||new xh(this.defaults);for(let o in a.tokenizer){if(!(o in r))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let i=o,s=a.tokenizer[i],l=r[i];r[i]=(...u)=>{let c=s.apply(r,u);return c===!1&&(c=l.apply(r,u)),c}}n.tokenizer=r}if(a.hooks){let r=this.defaults.hooks||new Dd;for(let o in a.hooks){if(!(o in r))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let i=o,s=a.hooks[i],l=r[i];Dd.passThroughHooks.has(o)?r[i]=u=>{if(this.defaults.async&&Dd.passThroughHooksRespectAsync.has(o))return(async()=>{let d=await s.call(r,u);return l.call(r,d)})();let c=s.call(r,u);return l.call(r,c)}:r[i]=(...u)=>{if(this.defaults.async)return(async()=>{let d=await s.apply(r,u);return d===!1&&(d=await l.apply(r,u)),d})();let c=s.apply(r,u);return c===!1&&(c=l.apply(r,u)),c}}n.hooks=r}if(a.walkTokens){let r=this.defaults.walkTokens,o=a.walkTokens;n.walkTokens=function(i){let s=[];return s.push(o.call(this,i)),r&&(s=s.concat(r.call(this,i))),s}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Sn.lex(e,t??this.defaults)}parser(e,t){return nr.parse(e,t??this.defaults)}parseMarkdown(e){return(t,a)=>{let n={...a},r={...this.defaults,...n},o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=e),r.async)return(async()=>{let i=r.hooks?await r.hooks.preprocess(t):t,s=await(r.hooks?await r.hooks.provideLexer():e?Sn.lex:Sn.lexInline)(i,r),l=r.hooks?await r.hooks.processAllTokens(s):s;r.walkTokens&&await Promise.all(this.walkTokens(l,r.walkTokens));let u=await(r.hooks?await r.hooks.provideParser():e?nr.parse:nr.parseInline)(l,r);return r.hooks?await r.hooks.postprocess(u):u})().catch(o);try{r.hooks&&(t=r.hooks.preprocess(t));let i=(r.hooks?r.hooks.provideLexer():e?Sn.lex:Sn.lexInline)(t,r);r.hooks&&(i=r.hooks.processAllTokens(i)),r.walkTokens&&this.walkTokens(i,r.walkTokens);let s=(r.hooks?r.hooks.provideParser():e?nr.parse:nr.parseInline)(i,r);return r.hooks&&(s=r.hooks.postprocess(s)),s}catch(i){return o(i)}}}onError(e,t){return a=>{if(a.message+=`
112
- Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+ro(a.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(a);throw a}}},vs=new NX;wt.options=wt.setOptions=function(e){return vs.setOptions(e),wt.defaults=vs.defaults,yN(wt.defaults),wt};wt.getDefaults=IS;wt.defaults=xs;wt.use=function(...e){return vs.use(...e),wt.defaults=vs.defaults,yN(wt.defaults),wt};wt.walkTokens=function(e,t){return vs.walkTokens(e,t)};wt.parseInline=vs.parseInline;wt.Parser=nr;wt.parser=nr.parse;wt.Renderer=bh;wt.TextRenderer=RS;wt.Lexer=Sn;wt.lexer=Sn.lex;wt.Tokenizer=xh;wt.Hooks=Dd;wt.parse=wt;Xye=wt.options,Kye=wt.setOptions,Yye=wt.use,Zye=wt.walkTokens,Jye=wt.parseInline,Qye=nr.parse,ewe=Sn.lex});var AN={};lf(AN,{CodeBlock:()=>qX});var rr,an,UX,BX,zX,FX,qX,MN=L(()=>{"use strict";"use client";Ch();rr=j(Ee(),1),an=j(me(),1),UX=Ce("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),BX=(0,rr.memo)(({children:e,result:t,language:a,className:n,...r})=>{let o=(0,rr.useMemo)(()=>({backgroundColor:t.bg,color:t.fg}),[t.bg,t.fg]);return(0,an.jsx)("pre",{className:Ce(n,"p-4 text-sm dark:bg-(--shiki-dark-bg)!"),"data-language":a,"data-streamdown":"code-block-body",style:o,...r,children:(0,an.jsx)("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:t.tokens.map((i,s)=>(0,an.jsx)("span",{className:UX,children:i.map((l,u)=>(0,an.jsx)("span",{className:"dark:bg-(--shiki-dark-bg)! dark:text-(--shiki-dark)!",style:{color:l.color,backgroundColor:l.bgColor,...l.htmlStyle},...l.htmlAttrs,children:l.content},u))},s))})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className),zX=({className:e,language:t,style:a,...n})=>(0,an.jsx)("div",{className:Ce("my-4 w-full overflow-hidden rounded-xl border border-border",e),"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...a},...n}),FX=({language:e,children:t})=>(0,an.jsxs)("div",{className:"flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs","data-language":e,"data-streamdown":"code-block-header",children:[(0,an.jsx)("span",{className:"ml-1 font-mono lowercase",children:e}),(0,an.jsx)("div",{className:"flex items-center gap-2",children:t})]}),qX=({code:e,language:t,className:a,children:n,...r})=>{let{shikiTheme:o}=(0,rr.useContext)(qa),i=RN(),s=(0,rr.useMemo)(()=>({bg:"transparent",fg:"inherit",tokens:e.split(`
112
+ Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+ro(a.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(a);throw a}}},vs=new NX;wt.options=wt.setOptions=function(e){return vs.setOptions(e),wt.defaults=vs.defaults,yN(wt.defaults),wt};wt.getDefaults=IS;wt.defaults=xs;wt.use=function(...e){return vs.use(...e),wt.defaults=vs.defaults,yN(wt.defaults),wt};wt.walkTokens=function(e,t){return vs.walkTokens(e,t)};wt.parseInline=vs.parseInline;wt.Parser=nr;wt.parser=nr.parse;wt.Renderer=bh;wt.TextRenderer=RS;wt.Lexer=Sn;wt.lexer=Sn.lex;wt.Tokenizer=xh;wt.Hooks=Dd;wt.parse=wt;Kye=wt.options,Yye=wt.setOptions,Zye=wt.use,Jye=wt.walkTokens,Qye=wt.parseInline,ewe=nr.parse,twe=Sn.lex});var AN={};lf(AN,{CodeBlock:()=>qX});var rr,an,UX,BX,zX,FX,qX,MN=L(()=>{"use strict";"use client";Ch();rr=j(Ee(),1),an=j(me(),1),UX=Ce("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),BX=(0,rr.memo)(({children:e,result:t,language:a,className:n,...r})=>{let o=(0,rr.useMemo)(()=>({backgroundColor:t.bg,color:t.fg}),[t.bg,t.fg]);return(0,an.jsx)("pre",{className:Ce(n,"p-4 text-sm dark:bg-(--shiki-dark-bg)!"),"data-language":a,"data-streamdown":"code-block-body",style:o,...r,children:(0,an.jsx)("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:t.tokens.map((i,s)=>(0,an.jsx)("span",{className:UX,children:i.map((l,u)=>(0,an.jsx)("span",{className:"dark:bg-(--shiki-dark-bg)! dark:text-(--shiki-dark)!",style:{color:l.color,backgroundColor:l.bgColor,...l.htmlStyle},...l.htmlAttrs,children:l.content},u))},s))})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className),zX=({className:e,language:t,style:a,...n})=>(0,an.jsx)("div",{className:Ce("my-4 w-full overflow-hidden rounded-xl border border-border",e),"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...a},...n}),FX=({language:e,children:t})=>(0,an.jsxs)("div",{className:"flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs","data-language":e,"data-streamdown":"code-block-header",children:[(0,an.jsx)("span",{className:"ml-1 font-mono lowercase",children:e}),(0,an.jsx)("div",{className:"flex items-center gap-2",children:t})]}),qX=({code:e,language:t,className:a,children:n,...r})=>{let{shikiTheme:o}=(0,rr.useContext)(qa),i=RN(),s=(0,rr.useMemo)(()=>({bg:"transparent",fg:"inherit",tokens:e.split(`
113
113
  `).map(c=>[{content:c,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[e]),[l,u]=(0,rr.useState)(s);return(0,rr.useEffect)(()=>{if(!i){u(s);return}let c=i.highlight({code:e,language:t,themes:o},d=>{u(d)});if(c){u(c);return}u(s)},[e,t,o,i,s]),(0,an.jsx)(DS.Provider,{value:{code:e},children:(0,an.jsxs)(zX,{language:t,children:[(0,an.jsx)(FX,{language:t,children:n}),(0,an.jsx)(BX,{className:a,language:t,result:l,...r})]})})}});var DN={};lf(DN,{Mermaid:()=>_S});var _N=L(()=>{"use strict";"use client";Ch()});function $X(e={}){let{immediate:t=!1,debounceDelay:a=HX,rootMargin:n=jX,idleTimeout:r=VX}=e,[o,i]=(0,N.useState)(!1),s=(0,N.useRef)(null),l=(0,N.useRef)(null),u=(0,N.useRef)(null),c=(0,N.useMemo)(()=>m=>{let h=Date.now();return window.setTimeout(()=>{m({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-h))})},1)},[]),d=(0,N.useMemo)(()=>typeof window<"u"&&window.requestIdleCallback?(m,h)=>window.requestIdleCallback(m,h):c,[c]),p=(0,N.useMemo)(()=>typeof window<"u"&&window.cancelIdleCallback?m=>window.cancelIdleCallback(m):m=>{clearTimeout(m)},[]);return(0,N.useEffect)(()=>{if(t){i(!0);return}let m=s.current;if(!m)return;l.current&&(clearTimeout(l.current),l.current=null),u.current&&(p(u.current),u.current=null);let h=()=>{l.current&&(clearTimeout(l.current),l.current=null),u.current&&(p(u.current),u.current=null)},v=g=>{u.current=d(S=>{S.timeRemaining()>0||S.didTimeout?(i(!0),g.disconnect()):u.current=d(()=>{i(!0),g.disconnect()},{timeout:r/2})},{timeout:r})},I=g=>{h(),l.current=window.setTimeout(()=>{var S,E;let T=g.takeRecords();(T.length===0||(E=(S=T.at(-1))==null?void 0:S.isIntersecting)!=null&&E)&&v(g)},a)},y=(g,S)=>{g.isIntersecting?I(S):h()},w=new IntersectionObserver(g=>{for(let S of g)y(S,w)},{rootMargin:n,threshold:0});return w.observe(m),()=>{l.current&&clearTimeout(l.current),u.current&&p(u.current),w.disconnect()}},[t,a,n,r,p,d]),{shouldRender:o,containerRef:s}}function Eh(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let a=e.position.start,n=t.position.start,r=e.position.end,o=t.position.end;return a?.line===n?.line&&a?.column===n?.column&&r?.line===o?.line&&r?.column===o?.column}function Wt(e,t){return e.className===t.className&&Eh(e.node,t.node)}var N,M,HX,jX,VX,zS,FS,Lh,WX,GX,XX,qN,PN,KX,YX,Ce,tu,DS,HN,ON,NN,ZX,UN,JX,QX,Od,eK,tK,aK,US,jN,RN,qS,nK,rK,Nd,oK,iK,sK,VN,$N,lK,PS,uK,cK,dK,fK,pK,mK,hK,BS,kh,HS,WN,GN,XN,KN,gK,YN,ZN,JN,QN,eU,tU,aU,nU,rU,oU,iU,sU,lU,uU,cU,dU,fU,yK,pU,mU,hU,wK,BN,zN,Th,vK,FN,gU,xK,bK,SK,IK,CK,kK,TK,OS,LK,NS,yU,wU,vU,EK,AK,MK,RK,qa,jS,DK,au,_K,_S,Ch=L(()=>{"use strict";"use client";N=j(Ee(),1);YM();JM();yR();YD();c_();M=j(me(),1);tv();nv();aP();AP();NO();cN();EN();HX=300,jX="300px",VX=500;zS=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),FS=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z",fill:"currentColor",fillRule:"evenodd"})}),Lh=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z",fill:"currentColor",fillRule:"evenodd"})}),WX=e=>(0,M.jsxs)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[(0,M.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,M.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),GX=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z",fill:"currentColor",fillRule:"evenodd"})}),XX=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z",fill:"currentColor",fillRule:"evenodd"})}),qN=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z",fill:"currentColor",fillRule:"evenodd"})}),PN=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z",fill:"currentColor",fillRule:"evenodd"})}),KX=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),YX=e=>(0,M.jsx)("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:(0,M.jsx)("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),Ce=(...e)=>av(Zp(e)),tu=(e,t,a)=>{let n=typeof t=="string"?new Blob([t],{type:a}):t,r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)},DS=(0,N.createContext)({code:""}),HN=()=>(0,N.useContext)(DS),ON=({onCopy:e,onError:t,timeout:a=2e3,children:n,className:r,code:o,...i})=>{let[s,l]=(0,N.useState)(!1),u=(0,N.useRef)(0),{code:c}=HN(),{isAnimating:d}=(0,N.useContext)(qa),p=o??c,m=async()=>{var v;if(typeof window>"u"||!((v=navigator?.clipboard)!=null&&v.writeText)){t?.(new Error("Clipboard API not available"));return}try{s||(await navigator.clipboard.writeText(p),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),a))}catch(I){t?.(I)}};(0,N.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let h=s?zS:FS;return(0,M.jsx)("button",{className:Ce("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-copy-button",disabled:d,onClick:m,title:"Copy Code",type:"button",...i,children:n??(0,M.jsx)(h,{size:14})})},NN={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",\u6587\u8A00:"wy"},ZX=({onDownload:e,onError:t,language:a,children:n,className:r,code:o,...i})=>{let{code:s}=HN(),{isAnimating:l}=(0,N.useContext)(qa),u=o??s,c=`file.${a&&a in NN?NN[a]:"txt"}`,d="text/plain",p=()=>{try{tu(c,u,d),e?.()}catch(m){t?.(m)}};return(0,M.jsx)("button",{className:Ce("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-download-button",disabled:l,onClick:p,title:"Download file",type:"button",...i,children:n??(0,M.jsx)(Lh,{size:14})})},UN=()=>(0,M.jsxs)("div",{className:"w-full divide-y divide-border overflow-hidden rounded-xl border border-border",children:[(0,M.jsx)("div",{className:"h-[46px] w-full bg-muted/80"}),(0,M.jsx)("div",{className:"flex w-full items-center justify-center p-4",children:(0,M.jsx)(WX,{className:"size-4 animate-spin"})})]}),JX=/\.[^/.]+$/,QX=({node:e,className:t,src:a,alt:n,...r})=>{let o=async()=>{if(a)try{let i=await(await fetch(a)).blob(),s=new URL(a,window.location.origin).pathname.split("/").pop()||"",l=s.split(".").pop(),u=s.includes(".")&&l!==void 0&&l.length<=4,c="";if(u)c=s;else{let d=i.type,p="png";d.includes("jpeg")||d.includes("jpg")?p="jpg":d.includes("png")?p="png":d.includes("svg")?p="svg":d.includes("gif")?p="gif":d.includes("webp")&&(p="webp"),c=`${(n||s||"image").replace(JX,"")}.${p}`}tu(c,i,i.type)}catch{window.open(a,"_blank")}};return a?(0,M.jsxs)("div",{className:"group relative my-4 inline-block","data-streamdown":"image-wrapper",children:[(0,M.jsx)("img",{alt:n,className:Ce("max-w-full rounded-lg",t),"data-streamdown":"image",src:a,...r}),(0,M.jsx)("div",{className:"pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block"}),(0,M.jsx)("button",{className:Ce("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:o,title:"Download image",type:"button",children:(0,M.jsx)(Lh,{size:14})})]}):null},Od=0,eK=()=>{Od+=1,Od===1&&(document.body.style.overflow="hidden")},tK=()=>{Od=Math.max(0,Od-1),Od===0&&(document.body.style.overflow="")},aK=({url:e,isOpen:t,onClose:a,onConfirm:n})=>{let[r,o]=(0,N.useState)(!1),i=(0,N.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},[e]),s=(0,N.useCallback)(()=>{n(),a()},[n,a]);return(0,N.useEffect)(()=>{if(t){eK();let l=u=>{u.key==="Escape"&&a()};return document.addEventListener("keydown",l),()=>{document.removeEventListener("keydown",l),tK()}}},[t,a]),t?(0,M.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm","data-streamdown":"link-safety-modal",onClick:a,onKeyDown:l=>{l.key==="Escape"&&a()},role:"button",tabIndex:0,children:(0,M.jsxs)("div",{className:"relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg",onClick:l=>l.stopPropagation(),onKeyDown:l=>l.stopPropagation(),role:"presentation",children:[(0,M.jsx)("button",{className:"absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:a,title:"Close",type:"button",children:(0,M.jsx)(qN,{size:16})}),(0,M.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,M.jsxs)("div",{className:"flex items-center gap-2 font-semibold text-lg",children:[(0,M.jsx)(PN,{size:20}),(0,M.jsx)("span",{children:"Open external link?"})]}),(0,M.jsx)("p",{className:"text-muted-foreground text-sm",children:"You're about to visit an external website."})]}),(0,M.jsx)("div",{className:Ce("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),(0,M.jsxs)("div",{className:"flex gap-2",children:[(0,M.jsx)("button",{className:"flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted",onClick:i,type:"button",children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(zS,{size:14}),(0,M.jsx)("span",{children:"Copied"})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(FS,{size:14}),(0,M.jsx)("span",{children:"Copy link"})]})}),(0,M.jsxs)("button",{className:"flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90",onClick:s,type:"button",children:[(0,M.jsx)(PN,{size:14}),(0,M.jsx)("span",{children:"Open link"})]})]})]})}):null},US=(0,N.createContext)(null),jN=()=>(0,N.useContext)(US),RN=()=>{var e;let t=jN();return(e=t?.code)!=null?e:null},qS=()=>{var e;let t=jN();return(e=t?.mermaid)!=null?e:null},nK=(e,t)=>{var a;let n=(a=void 0)!=null?a:5;return new Promise((r,o)=>{let i="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),s=new Image;s.crossOrigin="anonymous",s.onload=()=>{let l=document.createElement("canvas"),u=s.width*n,c=s.height*n;l.width=u,l.height=c;let d=l.getContext("2d");if(!d){o(new Error("Failed to create 2D canvas context for PNG export"));return}d.drawImage(s,0,0,u,c),l.toBlob(p=>{if(!p){o(new Error("Failed to create PNG blob"));return}r(p)},"image/png")},s.onerror=()=>o(new Error("Failed to load SVG image")),s.src=i})},rK=({chart:e,children:t,className:a,onDownload:n,config:r,onError:o})=>{let[i,s]=(0,N.useState)(!1),l=(0,N.useRef)(null),{isAnimating:u}=(0,N.useContext)(qa),c=qS(),d=async p=>{try{if(p==="mmd"){tu("diagram.mmd",e,"text/plain"),s(!1),n?.(p);return}if(!c){o?.(new Error("Mermaid plugin not available"));return}let m=c.getMermaid(r),h=e.split("").reduce((y,w)=>(y<<5)-y+w.charCodeAt(0)|0,0),v=`mermaid-${Math.abs(h)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:I}=await m.render(v,e);if(!I){o?.(new Error("SVG not found. Please wait for the diagram to render."));return}if(p==="svg"){tu("diagram.svg",I,"image/svg+xml"),s(!1),n?.(p);return}if(p==="png"){let y=await nK(I);tu("diagram.png",y,"image/png"),n?.(p),s(!1);return}}catch(m){o?.(m)}};return(0,N.useEffect)(()=>{let p=m=>{let h=m.composedPath();l.current&&!h.includes(l.current)&&s(!1)};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p)}},[]),(0,M.jsxs)("div",{className:"relative",ref:l,children:[(0,M.jsx)("button",{className:Ce("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",a),disabled:u,onClick:()=>s(!i),title:"Download diagram",type:"button",children:t??(0,M.jsx)(Lh,{size:14})}),i?(0,M.jsxs)("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("svg"),title:"Download diagram as SVG",type:"button",children:"SVG"}),(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("png"),title:"Download diagram as PNG",type:"button",children:"PNG"}),(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("mmd"),title:"Download diagram as MMD",type:"button",children:"MMD"})]}):null]})},Nd=0,oK=()=>{Nd+=1,Nd===1&&(document.body.style.overflow="hidden")},iK=()=>{Nd=Math.max(0,Nd-1),Nd===0&&(document.body.style.overflow="")},sK=({chart:e,config:t,onFullscreen:a,onExit:n,className:r,...o})=>{let[i,s]=(0,N.useState)(!1),{isAnimating:l,controls:u}=(0,N.useContext)(qa),c=(()=>{if(typeof u=="boolean")return u;let p=u.mermaid;return p===!1?!1:p===!0||p===void 0?!0:p.panZoom!==!1})(),d=()=>{s(!i)};return(0,N.useEffect)(()=>{if(i){oK();let p=m=>{m.key==="Escape"&&s(!1)};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p),iK()}}},[i]),(0,N.useEffect)(()=>{i?a?.():n&&n()},[i,a,n]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("button",{className:Ce("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),disabled:l,onClick:d,title:"View fullscreen",type:"button",...o,children:(0,M.jsx)(GX,{size:14})}),i?(0,M.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:d,onKeyDown:p=>{p.key==="Escape"&&d()},role:"button",tabIndex:0,children:[(0,M.jsx)("button",{className:"absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:d,title:"Exit fullscreen",type:"button",children:(0,M.jsx)(qN,{size:20})}),(0,M.jsx)("div",{className:"flex size-full items-center justify-center p-4",onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),role:"presentation",children:(0,M.jsx)(_S,{chart:e,className:"size-full [&_svg]:h-auto [&_svg]:w-auto",config:t,fullscreen:!0,showControls:c})})]}):null]})},VN=e=>{var t,a;let n=[],r=[],o=e.querySelectorAll("thead th");for(let s of o)n.push(((t=s.textContent)==null?void 0:t.trim())||"");let i=e.querySelectorAll("tbody tr");for(let s of i){let l=[],u=s.querySelectorAll("td");for(let c of u)l.push(((a=c.textContent)==null?void 0:a.trim())||"");r.push(l)}return{headers:n,rows:r}},$N=e=>{let{headers:t,rows:a}=e,n=s=>{let l=!1,u=!1;for(let c of s){if(c==='"'){l=!0,u=!0;break}(c===","||c===`
114
114
  `)&&(l=!0)}return l?u?`"${s.replace(/"/g,'""')}"`:`"${s}"`:s},r=t.length>0?a.length+1:a.length,o=new Array(r),i=0;t.length>0&&(o[i]=t.map(n).join(","),i+=1);for(let s of a)o[i]=s.map(n).join(","),i+=1;return o.join(`
115
115
  `)},lK=e=>{let{headers:t,rows:a}=e,n=s=>{let l=!1;for(let c of s)if(c===" "||c===`
@@ -118,31 +118,31 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error
118
118
  `)},PS=e=>{let t=!1;for(let n of e)if(n==="\\"||n==="|"){t=!0;break}if(!t)return e;let a=[];for(let n of e)n==="\\"?a.push("\\\\"):n==="|"?a.push("\\|"):a.push(n);return a.join("")},uK=e=>{let{headers:t,rows:a}=e;if(t.length===0)return"";let n=new Array(a.length+2),r=0,o=t.map(s=>PS(s));n[r]=`| ${o.join(" | ")} |`,r+=1;let i=new Array(t.length);for(let s=0;s<t.length;s+=1)i[s]="---";n[r]=`| ${i.join(" | ")} |`,r+=1;for(let s of a)if(s.length<t.length){let l=new Array(t.length);for(let u=0;u<t.length;u+=1)l[u]=u<s.length?PS(s[u]):"";n[r]=`| ${l.join(" | ")} |`,r+=1}else{let l=s.map(u=>PS(u));n[r]=`| ${l.join(" | ")} |`,r+=1}return n.join(`
119
119
  `)},cK=({children:e,className:t,onCopy:a,onError:n,timeout:r=2e3})=>{let[o,i]=(0,N.useState)(!1),[s,l]=(0,N.useState)(!1),u=(0,N.useRef)(null),c=(0,N.useRef)(0),{isAnimating:d}=(0,N.useContext)(qa),p=async h=>{var v,I;if(typeof window>"u"||!((v=navigator?.clipboard)!=null&&v.write)){n?.(new Error("Clipboard API not available"));return}try{let y=(I=u.current)==null?void 0:I.closest('[data-streamdown="table-wrapper"]'),w=y?.querySelector("table");if(!w){n?.(new Error("Table not found"));return}let g=VN(w),S=h==="csv"?$N(g):lK(g),E=new ClipboardItem({"text/plain":new Blob([S],{type:"text/plain"}),"text/html":new Blob([w.outerHTML],{type:"text/html"})});await navigator.clipboard.write([E]),l(!0),i(!1),a?.(h),c.current=window.setTimeout(()=>l(!1),r)}catch(y){n?.(y)}};(0,N.useEffect)(()=>{let h=v=>{let I=v.composedPath();u.current&&!I.includes(u.current)&&i(!1)};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h),window.clearTimeout(c.current)}},[]);let m=s?zS:FS;return(0,M.jsxs)("div",{className:"relative",ref:u,children:[(0,M.jsx)("button",{className:Ce("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:d,onClick:()=>i(!o),title:"Copy table",type:"button",children:e??(0,M.jsx)(m,{size:14})}),o?(0,M.jsxs)("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>p("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>p("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]}):null]})},dK=({children:e,className:t,onDownload:a,onError:n})=>{let[r,o]=(0,N.useState)(!1),i=(0,N.useRef)(null),{isAnimating:s}=(0,N.useContext)(qa),l=u=>{var c;try{let d=(c=i.current)==null?void 0:c.closest('[data-streamdown="table-wrapper"]'),p=d?.querySelector("table");if(!p){n?.(new Error("Table not found"));return}let m=VN(p),h=u==="csv"?$N(m):uK(m);tu(`table.${u==="csv"?"csv":"md"}`,h,u==="csv"?"text/csv":"text/markdown"),o(!1),a?.(u)}catch(d){n?.(d)}};return(0,N.useEffect)(()=>{let u=c=>{let d=c.composedPath();i.current&&!d.includes(i.current)&&o(!1)};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[]),(0,M.jsxs)("div",{className:"relative",ref:i,children:[(0,M.jsx)("button",{className:Ce("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:s,onClick:()=>o(!r),title:"Download table",type:"button",children:e??(0,M.jsx)(Lh,{size:14})}),r?(0,M.jsxs)("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>l("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),(0,M.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>l("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]}):null]})},fK=({children:e,className:t,showControls:a,...n})=>(0,M.jsxs)("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[a?(0,M.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,M.jsx)(cK,{}),(0,M.jsx)(dK,{})]}):null,(0,M.jsx)("div",{className:"overflow-x-auto",children:(0,M.jsx)("table",{className:Ce("w-full border-collapse border border-border",t),"data-streamdown":"table",...n,children:e})})]}),pK=(0,N.lazy)(()=>Promise.resolve().then(()=>(MN(),AN)).then(e=>({default:e.CodeBlock}))),mK=(0,N.lazy)(()=>Promise.resolve().then(()=>(_N(),DN)).then(e=>({default:e.Mermaid}))),hK=/language-([^\s]+)/;BS=(e,t)=>typeof e=="boolean"?e:e[t]!==!1,kh=(e,t)=>{if(typeof e=="boolean")return e;let a=e.mermaid;return a===!1?!1:a===!0||a===void 0?!0:a[t]!==!1},HS=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("ol",{className:Ce("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...n,children:e}),(e,t)=>Wt(e,t));HS.displayName="MarkdownOl";WN=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("li",{className:Ce("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...n,children:e}),(e,t)=>e.className===t.className&&Eh(e.node,t.node));WN.displayName="MarkdownLi";GN=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("ul",{className:Ce("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...n,children:e}),(e,t)=>Wt(e,t));GN.displayName="MarkdownUl";XN=(0,N.memo)(({className:e,node:t,...a})=>(0,M.jsx)("hr",{className:Ce("my-6 border-border",e),"data-streamdown":"horizontal-rule",...a}),(e,t)=>Wt(e,t));XN.displayName="MarkdownHr";KN=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("span",{className:Ce("font-semibold",t),"data-streamdown":"strong",...n,children:e}),(e,t)=>Wt(e,t));KN.displayName="MarkdownStrong";gK=({children:e,className:t,href:a,node:n,...r})=>{let{linkSafety:o}=(0,N.useContext)(qa),[i,s]=(0,N.useState)(!1),l=a==="streamdown:incomplete-link",u=(0,N.useCallback)(async m=>{if(!(!(o!=null&&o.enabled&&a)||l)){if(m.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(a)){window.open(a,"_blank","noreferrer");return}s(!0)}},[o,a,l]),c=(0,N.useCallback)(()=>{a&&window.open(a,"_blank","noreferrer")},[a]),d=(0,N.useCallback)(()=>{s(!1)},[]),p={url:a??"",isOpen:i,onClose:d,onConfirm:c};return o!=null&&o.enabled&&a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("button",{className:Ce("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":l,"data-streamdown":"link",onClick:u,type:"button",children:e}),o.renderModal?o.renderModal(p):(0,M.jsx)(aK,{...p})]}):(0,M.jsx)("a",{className:Ce("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":l,"data-streamdown":"link",href:a,rel:"noreferrer",target:"_blank",...r,children:e})},YN=(0,N.memo)(gK,(e,t)=>Wt(e,t)&&e.href===t.href);YN.displayName="MarkdownA";ZN=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h1",{className:Ce("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e}),(e,t)=>Wt(e,t));ZN.displayName="MarkdownH1";JN=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h2",{className:Ce("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e}),(e,t)=>Wt(e,t));JN.displayName="MarkdownH2";QN=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h3",{className:Ce("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e}),(e,t)=>Wt(e,t));QN.displayName="MarkdownH3";eU=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h4",{className:Ce("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e}),(e,t)=>Wt(e,t));eU.displayName="MarkdownH4";tU=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h5",{className:Ce("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e}),(e,t)=>Wt(e,t));tU.displayName="MarkdownH5";aU=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("h6",{className:Ce("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e}),(e,t)=>Wt(e,t));aU.displayName="MarkdownH6";nU=(0,N.memo)(({children:e,className:t,node:a,...n})=>{let{controls:r}=(0,N.useContext)(qa),o=BS(r,"table");return(0,M.jsx)(fK,{className:t,showControls:o,...n,children:e})},(e,t)=>Wt(e,t));nU.displayName="MarkdownTable";rU=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("thead",{className:Ce("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e}),(e,t)=>Wt(e,t));rU.displayName="MarkdownThead";oU=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("tbody",{className:Ce("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...n,children:e}),(e,t)=>Wt(e,t));oU.displayName="MarkdownTbody";iU=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("tr",{className:Ce("border-border border-b",t),"data-streamdown":"table-row",...n,children:e}),(e,t)=>Wt(e,t));iU.displayName="MarkdownTr";sU=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("th",{className:Ce("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e}),(e,t)=>Wt(e,t));sU.displayName="MarkdownTh";lU=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("td",{className:Ce("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e}),(e,t)=>Wt(e,t));lU.displayName="MarkdownTd";uU=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("blockquote",{className:Ce("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e}),(e,t)=>Wt(e,t));uU.displayName="MarkdownBlockquote";cU=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("sup",{className:Ce("text-sm",t),"data-streamdown":"superscript",...n,children:e}),(e,t)=>Wt(e,t));cU.displayName="MarkdownSup";dU=(0,N.memo)(({children:e,className:t,node:a,...n})=>(0,M.jsx)("sub",{className:Ce("text-sm",t),"data-streamdown":"subscript",...n,children:e}),(e,t)=>Wt(e,t));dU.displayName="MarkdownSub";fU=(0,N.memo)(({children:e,className:t,node:a,...n})=>{if("data-footnotes"in n){let r=i=>{var s,l;if(!(0,N.isValidElement)(i))return!1;let u=Array.isArray(i.props.children)?i.props.children:[i.props.children],c=!1,d=!1;for(let p of u)if(p){if(typeof p=="string")p.trim()!==""&&(c=!0);else if((0,N.isValidElement)(p))if(((s=p.props)==null?void 0:s["data-footnote-backref"])!==void 0)d=!0;else{let m=Array.isArray(p.props.children)?p.props.children:[p.props.children];for(let h of m){if(typeof h=="string"&&h.trim()!==""){c=!0;break}if((0,N.isValidElement)(h)&&((l=h.props)==null?void 0:l["data-footnote-backref"])===void 0){c=!0;break}}}}return d&&!c},o=Array.isArray(e)?e.map(i=>{if(!(0,N.isValidElement)(i))return i;if(i.type===HS){let s=(Array.isArray(i.props.children)?i.props.children:[i.props.children]).filter(l=>!r(l));return s.length===0?null:{...i,props:{...i.props,children:s}}}return i}):e;return(Array.isArray(o)?o.some(i=>i!==null):o!==null)?(0,M.jsx)("section",{className:t,...n,children:o}):null}return(0,M.jsx)("section",{className:t,...n,children:e})},(e,t)=>Wt(e,t));fU.displayName="MarkdownSection";yK=({node:e,className:t,children:a,...n})=>{var r,o,i;let s=((r=e?.position)==null?void 0:r.start.line)===((o=e?.position)==null?void 0:o.end.line),{mermaid:l,controls:u}=(0,N.useContext)(qa),c=qS();if(s)return(0,M.jsx)("code",{className:Ce("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:a});let d=t?.match(hK),p=(i=d?.at(1))!=null?i:"",m="";if((0,N.isValidElement)(a)&&a.props&&typeof a.props=="object"&&"children"in a.props&&typeof a.props.children=="string"?m=a.props.children:typeof a=="string"&&(m=a),p==="mermaid"&&c){let v=BS(u,"mermaid"),I=kh(u,"download"),y=kh(u,"copy"),w=kh(u,"fullscreen"),g=kh(u,"panZoom"),S=v&&(I||y||w);return(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(UN,{}),children:(0,M.jsxs)("div",{className:Ce("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[S?(0,M.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[I?(0,M.jsx)(rK,{chart:m,config:l?.config}):null,y?(0,M.jsx)(ON,{code:m}):null,w?(0,M.jsx)(sK,{chart:m,config:l?.config}):null]}):null,(0,M.jsx)(mK,{chart:m,config:l?.config,showControls:g})]})})}let h=BS(u,"code");return(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(UN,{}),children:(0,M.jsx)(pK,{className:Ce("overflow-x-auto border-border border-t",t),code:m,language:p,children:h?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(ZX,{code:m,language:p}),(0,M.jsx)(ON,{})]}):null})})},pU=(0,N.memo)(yK,(e,t)=>e.className===t.className&&Eh(e.node,t.node));pU.displayName="MarkdownCode";mU=(0,N.memo)(QX,(e,t)=>e.className===t.className&&Eh(e.node,t.node));mU.displayName="MarkdownImg";hU=(0,N.memo)(({children:e,className:t,node:a,...n})=>{var r,o;let i=(Array.isArray(e)?e:[e]).filter(s=>s!=null&&s!=="");if(i.length===1&&(0,N.isValidElement)(i[0])){let s=i[0].props.node,l=s?.tagName;if(l==="img")return(0,M.jsx)(M.Fragment,{children:e});if(l==="code"&&((r=s?.position)==null?void 0:r.start.line)!==((o=s?.position)==null?void 0:o.end.line))return(0,M.jsx)(M.Fragment,{children:e})}return(0,M.jsx)("p",{className:t,...n,children:e})},(e,t)=>Wt(e,t));hU.displayName="MarkdownParagraph";wK={ol:HS,li:WN,ul:GN,hr:XN,strong:KN,a:YN,h1:ZN,h2:JN,h3:QN,h4:eU,h5:tU,h6:aU,table:nU,thead:rU,tbody:oU,tr:iU,th:sU,td:lU,blockquote:uU,code:pU,img:mU,pre:({children:e})=>e,sup:cU,sub:dU,p:hU,section:fU},BN=[],zN={allowDangerousHtml:!0},Th=new WeakMap,vK=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let a=e.rehypePlugins,n=e.remarkPlugins,r=e.remarkRehypeOptions;if(!(a||n||r)){let c="default";return this.keyCache.set(e,c),c}let o=c=>{if(!c||c.length===0)return"";let d="";for(let p=0;p<c.length;p+=1){let m=c[p];if(p>0&&(d+=","),Array.isArray(m)){let[h,v]=m;if(typeof h=="function"){let I=Th.get(h);I||(I=h.name,Th.set(h,I)),d+=I}else d+=String(h);d+=":",d+=JSON.stringify(v)}else if(typeof m=="function"){let h=Th.get(m);h||(h=m.name,Th.set(m,h)),d+=h}else d+=String(m)}return d},i=o(a),s=o(n),l=r?JSON.stringify(r):"",u=`${s}::${i}::${l}`;return this.keyCache.set(e,u),u}get(e){let t=this.generateCacheKey(e),a=this.cache.get(t);return a&&(this.cache.delete(t),this.cache.set(t,a)),a}set(e,t){let a=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let n=this.cache.keys().next().value;n&&this.cache.delete(n)}this.cache.set(a,t)}clear(){this.cache.clear()}},FN=new vK,gU=e=>{let t=xK(e),a=e.children||"";return SK(t.runSync(t.parse(a),a),e)},xK=e=>{let t=FN.get(e);if(t)return t;let a=bK(e);return FN.set(e,a),a},bK=e=>{let t=e.rehypePlugins||BN,a=e.remarkPlugins||BN,n=e.remarkRehypeOptions?{...zN,...e.remarkRehypeOptions}:zN;return vS().use(uh).use(a).use(ph,n).use(t)},SK=(e,t)=>Jb(e,{Fragment:M.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:M.jsx,jsxs:M.jsxs,passKeys:!0,passNode:!0}),IK=/\[\^[^\]\s]{1,200}\](?!:)/,CK=/\[\^[^\]\s]{1,200}\]:/,kK=/<\/(\w+)>/,TK=/<(\w+)[\s>]/,OS=e=>{let t=0;for(;t<e.length&&(e[t]===" "||e[t]===" "||e[t]===`
120
120
  `||e[t]==="\r");)t+=1;return t+1<e.length&&e[t]==="$"&&e[t+1]==="$"},LK=e=>{let t=e.length-1;for(;t>=0&&(e[t]===" "||e[t]===" "||e[t]===`
121
- `||e[t]==="\r");)t-=1;return t>=1&&e[t]==="$"&&e[t-1]==="$"},NS=e=>{let t=0;for(let a=0;a<e.length-1;a+=1)e[a]==="$"&&e[a+1]==="$"&&(t+=1,a+=1);return t},yU=e=>{let t=IK.test(e),a=CK.test(e);if(t||a)return[e];let n=Sn.lex(e,{gfm:!0}),r=[],o=[];for(let i of n){let s=i.raw,l=r.length;if(o.length>0){if(r[l-1]+=s,i.type==="html"){let u=s.match(kK);if(u){let c=u[1];o.at(-1)===c&&o.pop()}}continue}if(i.type==="html"&&i.block){let u=s.match(TK);if(u){let c=u[1];s.includes(`</${c}>`)||o.push(c)}}if(s.trim()==="$$"&&l>0){let u=r[l-1],c=OS(u),d=NS(u);if(c&&d%2===1){r[l-1]=u+s;continue}}if(l>0&&LK(s)){let u=r[l-1],c=OS(u),d=NS(u),p=NS(s);if(c&&d%2===1&&!OS(s)&&p===1){r[l-1]=u+s;continue}}r.push(s)}return r},wU={raw:ZM,sanitize:[Am,{}],harden:[KM,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},vU={gfm:[eh,{}]},EK=Object.values(wU),AK=Object.values(vU),MK={block:" \u258B",circle:" \u25CF"},RK={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0,linkSafety:{enabled:!0}},qa=(0,N.createContext)(RK),jS=(0,N.memo)(({content:e,shouldParseIncompleteMarkdown:t,index:a,...n})=>(0,M.jsx)(gU,{...n,children:e}),(e,t)=>{if(e.content!==t.content||e.index!==t.index)return!1;if(e.components!==t.components){let a=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(a.length!==n.length||a.some(r=>{var o,i;return((o=e.components)==null?void 0:o[r])!==((i=t.components)==null?void 0:i[r])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});jS.displayName="Block";DK=["github-light","github-dark"],au=(0,N.memo)(({children:e,mode:t="streaming",parseIncompleteMarkdown:a=!0,components:n,rehypePlugins:r=EK,remarkPlugins:o=AK,className:i,shikiTheme:s=DK,mermaid:l,controls:u=!0,isAnimating:c=!1,BlockComponent:d=jS,parseMarkdownIntoBlocksFn:p=yU,caret:m,plugins:h,remend:v,linkSafety:I={enabled:!0},...y})=>{let w=(0,N.useId)(),[g,S]=(0,N.useTransition)(),E=(0,N.useMemo)(()=>typeof e!="string"?"":t==="streaming"&&a?u_(e,v):e,[e,t,a,v]),T=(0,N.useMemo)(()=>p(E),[E,p]),[R,O]=(0,N.useState)(T);(0,N.useEffect)(()=>{t==="streaming"?S(()=>{O(T)}):O(T)},[T,t]);let U=t==="streaming"?R:T,A=(0,N.useMemo)(()=>U.map((B,P)=>`${w}-${P}`),[U.length,w]),Q=(0,N.useMemo)(()=>{var B,P;return{shikiTheme:(P=(B=h?.code)==null?void 0:B.getThemes())!=null?P:s,controls:u,isAnimating:c,mode:t,mermaid:l,linkSafety:I}},[s,u,c,t,l,I,h?.code]),$=(0,N.useMemo)(()=>({...wK,...n}),[n]),H=(0,N.useMemo)(()=>{let B=[];return h!=null&&h.cjk&&(B=[...B,...h.cjk.remarkPluginsBefore]),B=[...B,...o],h!=null&&h.cjk&&(B=[...B,...h.cjk.remarkPluginsAfter]),h!=null&&h.math&&(B=[...B,h.math.remarkPlugin]),B},[o,h?.math,h?.cjk]),Z=(0,N.useMemo)(()=>h!=null&&h.math?[...r,h.math.rehypePlugin]:r,[r,h?.math]),X=(0,N.useMemo)(()=>m&&c?{"--streamdown-caret":`"${MK[m]}"`}:void 0,[m,c]);return t==="static"?(0,M.jsx)(US.Provider,{value:h??null,children:(0,M.jsx)(qa.Provider,{value:Q,children:(0,M.jsx)("div",{className:Ce("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",i),children:(0,M.jsx)(gU,{components:$,rehypePlugins:Z,remarkPlugins:H,...y,children:e})})})}):(0,M.jsx)(US.Provider,{value:h??null,children:(0,M.jsx)(qa.Provider,{value:Q,children:(0,M.jsxs)("div",{className:Ce("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",m?"*:last:after:inline *:last:after:align-baseline *:last:after:content-(--streamdown-caret)":null,i),style:X,children:[U.length===0&&m&&c&&(0,M.jsx)("span",{}),U.map((B,P)=>(0,M.jsx)(d,{components:$,content:B,index:P,rehypePlugins:Z,remarkPlugins:H,shouldParseIncompleteMarkdown:a,...y},A[P]))]})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety);au.displayName="Streamdown";_K=({children:e,className:t,minZoom:a=.5,maxZoom:n=3,zoomStep:r=.1,showControls:o=!0,initialZoom:i=1,fullscreen:s=!1})=>{let l=(0,N.useRef)(null),u=(0,N.useRef)(null),[c,d]=(0,N.useState)(i),[p,m]=(0,N.useState)({x:0,y:0}),[h,v]=(0,N.useState)(!1),[I,y]=(0,N.useState)({x:0,y:0}),[w,g]=(0,N.useState)({x:0,y:0}),S=(0,N.useCallback)($=>{d(H=>Math.max(a,Math.min(n,H+$)))},[a,n]),E=(0,N.useCallback)(()=>{S(r)},[S,r]),T=(0,N.useCallback)(()=>{S(-r)},[S,r]),R=(0,N.useCallback)(()=>{d(i),m({x:0,y:0})},[i]),O=(0,N.useCallback)($=>{$.preventDefault();let H=$.deltaY>0?-r:r;S(H)},[S,r]),U=(0,N.useCallback)($=>{if($.button!==0||$.isPrimary===!1)return;v(!0),y({x:$.clientX,y:$.clientY}),g(p);let H=$.currentTarget;H instanceof HTMLElement&&H.setPointerCapture($.pointerId)},[p]),A=(0,N.useCallback)($=>{if(!h)return;$.preventDefault();let H=$.clientX-I.x,Z=$.clientY-I.y;m({x:w.x+H,y:w.y+Z})},[h,I,w]),Q=(0,N.useCallback)($=>{v(!1);let H=$.currentTarget;H instanceof HTMLElement&&H.releasePointerCapture($.pointerId)},[]);return(0,N.useEffect)(()=>{let $=l.current;if($)return $.addEventListener("wheel",O,{passive:!1}),()=>{$.removeEventListener("wheel",O)}},[O]),(0,N.useEffect)(()=>{let $=u.current;if($&&h)return document.body.style.userSelect="none",$.addEventListener("pointermove",A,{passive:!1}),$.addEventListener("pointerup",Q),$.addEventListener("pointercancel",Q),()=>{document.body.style.userSelect="",$.removeEventListener("pointermove",A),$.removeEventListener("pointerup",Q),$.removeEventListener("pointercancel",Q)}},[h,A,Q]),(0,M.jsxs)("div",{className:Ce("relative flex flex-col",s?"h-full w-full":"min-h-28 w-full",t),ref:l,style:{cursor:h?"grabbing":"grab"},children:[o?(0,M.jsxs)("div",{className:Ce("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",s?"bottom-4 left-4":"bottom-2 left-2"),children:[(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:c>=n,onClick:E,title:"Zoom in",type:"button",children:(0,M.jsx)(KX,{size:16})}),(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:c<=a,onClick:T,title:"Zoom out",type:"button",children:(0,M.jsx)(YX,{size:16})}),(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:R,title:"Reset zoom and pan",type:"button",children:(0,M.jsx)(XX,{size:16})})]}):null,(0,M.jsx)("div",{className:Ce("flex-1 origin-center transition-transform duration-150 ease-out",s?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:U,ref:u,role:"application",style:{transform:`translate(${p.x}px, ${p.y}px) scale(${c})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},_S=({chart:e,className:t,config:a,fullscreen:n=!1,showControls:r=!0})=>{let[o,i]=(0,N.useState)(null),[s,l]=(0,N.useState)(!1),[u,c]=(0,N.useState)(""),[d,p]=(0,N.useState)(""),[m,h]=(0,N.useState)(0),{mermaid:v}=(0,N.useContext)(qa),I=qS(),y=v?.errorComponent,{shouldRender:w,containerRef:g}=$X({immediate:n});if((0,N.useEffect)(()=>{if(w){if(!I){i("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{i(null),l(!0);let E=I.getMermaid(a),T=e.split("").reduce((U,A)=>(U<<5)-U+A.charCodeAt(0)|0,0),R=`mermaid-${Math.abs(T)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:O}=await E.render(R,e);c(O),p(O)}catch(E){if(!(d||u)){let T=E instanceof Error?E.message:"Failed to render Mermaid chart";i(T)}}finally{l(!1)}})()}},[e,a,m,w,I]),!(w||u||d))return(0,M.jsx)("div",{className:Ce("my-4 min-h-[200px]",t),ref:g});if(s&&!u&&!d)return(0,M.jsx)("div",{className:Ce("my-4 flex justify-center p-4",t),ref:g,children:(0,M.jsxs)("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[(0,M.jsx)("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),(0,M.jsx)("span",{className:"text-sm",children:"Loading diagram..."})]})});if(o&&!u&&!d)return y?(0,M.jsx)("div",{ref:g,children:(0,M.jsx)(y,{chart:e,error:o,retry:()=>h(T=>T+1)})}):(0,M.jsxs)("div",{className:Ce("rounded-lg border border-red-200 bg-red-50 p-4",t),ref:g,children:[(0,M.jsxs)("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",o]}),(0,M.jsxs)("details",{className:"mt-2",children:[(0,M.jsx)("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),(0,M.jsx)("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]});let S=u||d;return(0,M.jsx)("div",{className:Ce("size-full",t),"data-streamdown":"mermaid",ref:g,children:(0,M.jsx)(_K,{className:Ce(n?"size-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:n,maxZoom:3,minZoom:.5,showControls:r,zoomStep:.1,children:(0,M.jsx)("div",{"aria-label":"Mermaid chart",className:Ce("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:S},role:"img"})})})}});var lB=Ca((Gve,sB)=>{"use strict";function uY(e,t){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let a,n=0;return function(...o){clearTimeout(a);let i=Date.now(),s=i-n,l=t-s;l<=0?(n=i,e.apply(this,o)):a=setTimeout(()=>{n=Date.now(),e.apply(this,o)},l)}}sB.exports=uY});var x0=typeof performance>"u"?0:performance.now(),b0=typeof window<"u"&&!!window.WaniWani?.chat;var Cs=j(Ee(),1),Zh=j(qw(),1);var Hw="waniwani/suggestions";function yl(e,t){for(let a of t){let n=e[a];if(typeof n=="string"&&n.length>0)return n}}var hq=["waniwani/sessionId","openai/sessionId","openai/session","sessionId","conversationId","mcp-session-id"],gq=["waniwani/requestId","openai/requestId","requestId","mcp/requestId"],yq=["waniwani/traceId","openai/traceId","traceId","mcp/traceId","openai/requestId","requestId"],wq=["waniwani/userId","openai/userId","externalUserId","userId","actorId"],vq=["waniwani/visitorId","visitorId"],xq=["correlationId","openai/requestId"];function c1(e){return e?yl(e,hq):void 0}function d1(e){return e?yl(e,gq):void 0}function f1(e){return e?yl(e,yq):void 0}function p1(e){return e?yl(e,wq):void 0}function m1(e){return e?yl(e,vq):void 0}function h1(e){return e?yl(e,xq):void 0}var bq=[{key:"openai/sessionId",source:"chatgpt"},{key:"openai/session",source:"chatgpt"}],Sq=[{needle:"claude",source:"claude"},{needle:"chatgpt",source:"chatgpt"},{needle:"openai",source:"chatgpt"},{needle:"gemini",source:"gemini"}];function g1(e,t){if(e){let n=e["waniwani/source"];if(typeof n=="string"&&n.length>0)return n;for(let{key:r,source:o}of bq){let i=e[r];if(typeof i=="string"&&i.length>0)return o}}let a=t?.name;if(typeof a=="string"&&a.length>0){let n=a.toLowerCase();for(let{needle:r,source:o}of Sq)if(n.includes(r))return o}}var Iq="@waniwani/sdk";function y1(e,t={}){let a=t.now??(()=>new Date),n=t.generateId??Cq,r=Lq(e),o=zp(e.meta),i=zp(e.metadata),s=Eq(e,o),l=Xn(e.eventId)??n(),u=Aq(e.timestamp,a),c=Xn(e.source)??g1(o)??t.source??Iq,d=jw(e)?{...e}:void 0,p={...i};return Object.keys(o).length>0&&(p.meta=o),d&&(p.rawLegacy=d),{id:l,type:"mcp.event",name:r,source:c,timestamp:u,correlation:s,properties:kq(e,r),metadata:p,rawLegacy:d}}function Cq(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`evt_${crypto.randomUUID()}`:`evt_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function kq(e,t){if(!jw(e))return zp(e.properties);let a=Tq(e,t),n=zp(e.properties);return{...a,...n}}function Tq(e,t){switch(t){case"tool.called":{let a={};return Xn(e.toolName)&&(a.name=e.toolName),Xn(e.toolType)&&(a.type=e.toolType),a}case"link.clicked":{let a={};return Xn(e.linkUrl)&&(a.url=e.linkUrl),a}default:return{}}}function Lq(e){return jw(e)?e.eventType:e.event}function Eq(e,t){let a=Xn(e.requestId)??d1(t),n=Xn(e.sessionId)??c1(t),r=Xn(e.traceId)??f1(t),o=Xn(e.externalUserId)??p1(t),i=Xn(e.visitorId)??m1(t),s=Xn(e.correlationId)??h1(t)??a,l={};return n&&(l.sessionId=n),r&&(l.traceId=r),a&&(l.requestId=a),s&&(l.correlationId=s),o&&(l.externalUserId=o),i&&(l.visitorId=i),l}function Aq(e,t){if(e instanceof Date)return e.toISOString();if(typeof e=="string"){let a=new Date(e);if(!Number.isNaN(a.getTime()))return a.toISOString()}return t().toISOString()}function zp(e){return!e||typeof e!="object"||Array.isArray(e)?{}:e}function Xn(e){if(typeof e=="string"&&e.trim().length!==0)return e}function jw(e){return"eventType"in e}function w1(e){return{priceShown:({amount:t,currency:a,itemId:n,label:r,...o})=>e({event:"price_shown",properties:{amount:t,currency:a,itemId:n,label:r},...o}),pricesCompared:({options:t,...a})=>e({event:"prices_compared",properties:{options:t},...a}),optionSelected:({id:t,amount:a,currency:n,...r})=>e({event:"option_selected",properties:{id:t,amount:a,currency:n},...r}),leadQualified:t=>{let{externalId:a,email:n,name:r,...o}=t??{};return e({event:"lead_qualified",properties:{externalId:a,email:n,name:r},...o})},converted:({amount:t,currency:a,occurredAt:n,...r})=>e({event:"converted",properties:{amount:t,currency:a,occurredAt:n},...r})}}var Mq="/api/mcp/events/v2/batch";var v1="@waniwani/sdk";var Rq=new Set([401,403]),Dq=new Set([408,425,429,500,502,503,504]),_q=(e,t)=>globalThis.fetch(e,t);function x1(e){return new Vw(e)}var Vw=class{constructor(t){K(this,"endpointUrl");K(this,"flushIntervalMs");K(this,"maxBatchSize");K(this,"maxBufferSize");K(this,"maxRetries");K(this,"retryBaseDelayMs");K(this,"retryMaxDelayMs");K(this,"shutdownTimeoutMs");K(this,"sdkVersion");K(this,"fetchFn");K(this,"logger");K(this,"now");K(this,"sleep");K(this,"apiKey");K(this,"buffer",[]);K(this,"flushTimer");K(this,"flushScheduled",!1);K(this,"flushScheduledTimer");K(this,"flushInFlight");K(this,"inFlightCount",0);K(this,"isStopped",!1);K(this,"isShuttingDown",!1);this.endpointUrl=Nq(t.apiUrl,t.endpointPath??Mq),this.flushIntervalMs=t.flushIntervalMs??1e3,this.maxBatchSize=t.maxBatchSize??20,this.maxBufferSize=t.maxBufferSize??1e3,this.maxRetries=t.maxRetries??3,this.retryBaseDelayMs=t.retryBaseDelayMs??200,this.retryMaxDelayMs=t.retryMaxDelayMs??2e3,this.shutdownTimeoutMs=t.shutdownTimeoutMs??2e3,this.fetchFn=t.fetchFn??_q,this.logger=t.logger??console,this.now=t.now??(()=>new Date),this.sleep=t.sleep??(a=>new Promise(n=>setTimeout(n,a))),this.apiKey=t.apiKey,this.sdkVersion=t.sdkVersion,this.flushIntervalMs>0&&(this.flushTimer=setInterval(()=>{this.flush()},this.flushIntervalMs)),this.registerBrowserTeardown()}enqueue(t){if(this.isStopped||this.isShuttingDown){this.logger.warn("[Waniwani] Tracking transport is stopped, dropping event %s",t.id);return}if(this.buffer.length>=this.maxBufferSize){let a=this.buffer.length-this.maxBufferSize+1;this.buffer.splice(0,a),this.logger.warn("[Waniwani] Tracking buffer overflow, dropped %d oldest event(s)",a)}if(this.buffer.push(t),this.buffer.length>=this.maxBatchSize){this.flush();return}this.scheduleMicroFlush()}pendingEvents(){return this.buffer.length+this.inFlightCount}async flush(){return this.flushInFlight?this.flushInFlight:(this.flushInFlight=this.flushLoop().finally(()=>{this.flushInFlight=void 0}),this.flushInFlight)}async shutdown(t){this.isShuttingDown=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.flushScheduledTimer&&(clearTimeout(this.flushScheduledTimer),this.flushScheduledTimer=void 0,this.flushScheduled=!1);let a=t?.timeoutMs??this.shutdownTimeoutMs,n=this.flush();if(!Number.isFinite(a)||a<=0)return await n,this.isStopped=!0,{timedOut:!1,pendingEvents:this.pendingEvents()};let r=Symbol("shutdown-timeout");return await Promise.race([n.then(()=>"flushed"),this.sleep(a).then(()=>r)])===r?(this.isStopped=!0,{timedOut:!0,pendingEvents:this.pendingEvents()}):(this.isStopped=!0,{timedOut:!1,pendingEvents:this.pendingEvents()})}registerBrowserTeardown(){if(typeof document>"u"||typeof window>"u")return;let t=()=>{document.visibilityState==="hidden"&&this.keepaliveFlush()};document.addEventListener("visibilitychange",t),window.addEventListener("pagehide",()=>this.keepaliveFlush())}keepaliveFlush(){if(this.isStopped||this.buffer.length===0)return;let t=this.buffer.splice(0,this.buffer.length);this.sendKeepaliveChunk(t)}sendKeepaliveChunk(t){let a=JSON.stringify(this.makeBatchRequest(t));if(a.length>6e4&&t.length>1){let n=Math.ceil(t.length/2);this.sendKeepaliveChunk(t.slice(0,n)),this.sendKeepaliveChunk(t.slice(n));return}try{this.fetchFn(this.endpointUrl,{method:"POST",headers:this.requestHeaders(),body:a,keepalive:!0}).catch(()=>{})}catch{}}requestHeaders(){let t={"Content-Type":"application/json","X-WaniWani-SDK":v1};return this.apiKey&&(t.Authorization=`Bearer ${this.apiKey}`),t}scheduleMicroFlush(){this.flushScheduled||(this.flushScheduled=!0,this.flushScheduledTimer=setTimeout(()=>{this.flushScheduledTimer=void 0,this.flushScheduled=!1,this.flush()},0))}async flushLoop(){for(;this.buffer.length>0&&!this.isStopped;){let t=this.buffer.splice(0,this.maxBatchSize);await this.sendBatchWithRetry(t)}}async sendBatchWithRetry(t){let a=0,n=t;for(;n.length>0&&!this.isStopped;){this.inFlightCount=n.length;let r=await this.sendBatchOnce(n);switch(this.inFlightCount=0,r.kind){case"success":return;case"auth":this.stopTransportForAuthFailure(r.status,n.length);return;case"permanent":this.logger.error("[Waniwani] Dropping %d event(s) after permanent failure: %s",n.length,r.reason);return;case"retryable":if(a>=this.maxRetries){this.logger.error("[Waniwani] Dropping %d event(s) after retry exhaustion: %s",n.length,r.reason);return}await this.sleep(this.backoffDelayMs(a)),a+=1;continue;case"partial":if(r.permanent.length>0&&this.logger.error("[Waniwani] Dropping %d event(s) rejected as permanent",r.permanent.length),r.retryable.length===0)return;if(a>=this.maxRetries){this.logger.error("[Waniwani] Dropping %d retryable event(s) after retry exhaustion",r.retryable.length);return}n=r.retryable,await this.sleep(this.backoffDelayMs(a)),a+=1;continue}}}async sendBatchOnce(t){let a;try{a=await this.fetchFn(this.endpointUrl,{method:"POST",headers:this.requestHeaders(),body:JSON.stringify(this.makeBatchRequest(t))})}catch(o){return{kind:"retryable",reason:Uq(o)}}if(Rq.has(a.status))return{kind:"auth",status:a.status};if(Dq.has(a.status))return{kind:"retryable",reason:`HTTP ${a.status}`};if(!a.ok)return{kind:"permanent",reason:`HTTP ${a.status}`};let n=await Oq(a);if(!n?.rejected||n.rejected.length===0)return{kind:"success"};let r=this.classifyRejectedEvents(t,n.rejected);return r.retryable.length===0&&r.permanent.length===0?{kind:"success"}:{kind:"partial",retryable:r.retryable,permanent:r.permanent}}makeBatchRequest(t){return{sentAt:this.now().toISOString(),source:{sdk:v1,version:this.sdkVersion??"0.0.0"},events:t}}classifyRejectedEvents(t,a){let n=new Map(t.map(i=>[i.id,i])),r=[],o=[];for(let i of a){let s=n.get(i.eventId);if(s){if(Pq(i)){r.push(s);continue}o.push(s)}}return{retryable:r,permanent:o}}backoffDelayMs(t){let a=this.retryBaseDelayMs*2**t;return Math.min(a,this.retryMaxDelayMs)}stopTransportForAuthFailure(t,a){this.isStopped=!0;let n=this.buffer.length;this.buffer.splice(0,n),this.logger.error("[Waniwani] Auth failure (HTTP %d). Stopping tracking transport and dropping %d queued event(s)",t,a+n)}};function Pq(e){if(e.retryable===!0)return!0;let t=e.code.toLowerCase();return t.includes("timeout")||t.includes("temporary")||t.includes("unavailable")||t.includes("rate_limit")||t.includes("transient")||t.includes("server")}async function Oq(e){let t=await e.text();if(t)try{return JSON.parse(t)}catch{return}}function Nq(e,t){let a=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${a}${n}`}function Uq(e){return e instanceof Error?e.message:String(e)}function b1(e){let{apiUrl:t,endpointPath:a}=Bq(e.endpoint),n=x1({apiUrl:t,apiKey:e.token,endpointPath:a,flushIntervalMs:e.flushIntervalMs}),r,o=s=>typeof s=="function"?s():s,i=async s=>{let l=e.identity?.()??{},u=o(e.channelId),c=u===void 0?s.properties:{channelId:u,...s.properties},d=y1({sessionId:l.sessionId,visitorId:l.visitorId,externalUserId:l.externalUserId??r,traceId:l.traceId,...s,properties:c,metadata:{...e.metadata,...s.metadata}},{source:o(e.source)});return n.enqueue(d),{eventId:d.id}};return{track:Object.assign(i,w1(i)),identify(s,l){return r=s,i({event:"user.identified",externalUserId:s,properties:l})},flush:()=>n.flush(),shutdown:s=>n.shutdown(s)}}function Bq(e){let t=new URL(e);return{apiUrl:t.origin,endpointPath:`${t.pathname}${t.search}`}}function Na(e,t,a){let[n,r=""]=e.split("?"),o=n.replace(/\/$/,""),i=new URLSearchParams(r);if(a)for(let[l,u]of Object.entries(a))i.set(l,u);let s=i.toString();return`${o}${t}${s?`?${s}`:""}`}var zq="/api/mcp/";function Fp(e,t){let[a=""]=e.split("?"),n="",r=a;try{let o=new URL(a);n=o.origin,r=o.pathname}catch{if(!a.startsWith("/"))return null}return r.startsWith(zq)?`${n}${t}`:null}function Fq(){if(typeof window>"u")return!1;try{return window.WANIWANI_DEBUG?!0:!!window.localStorage?.getItem("WANIWANI_DEBUG")}catch{return!1}}function Ua(...e){Fq()&&console.log("[Waniwani]",...e)}var $w="waniwani-visitor-id";function qq(){try{if(typeof crypto<"u"){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto.getRandomValues=="function"){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,a=>a.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}}}catch{}return`v-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function ma(){try{let t=localStorage.getItem($w);if(t)return t}catch{}let e=qq();try{localStorage.setItem($w,e)}catch{}return e}function wl(e){let t=typeof e=="string"?e.trim():"";if(!t)return ma();try{localStorage.setItem($w,t)}catch{}return t}function Hq(e){return e!=null&&typeof e.then=="function"}function Sc(e){let t=!1,a=()=>{t=!0};if(e==null)return a;let n;try{n=typeof e=="function"?e():e}catch{return a}return Hq(n)?n.then(r=>{t||wl(r??"")},()=>{}):wl(n??""),a}var jq="waniwani-memory";var yn="threads",qp="by_memoryUserId",Vq="by_updatedAt";var I1="memoryUserId",S1="waniwani-memory-user-id",Ww=null;function Gw(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function $q(e,t){if(t<1&&(e.objectStoreNames.contains("ids")||e.createObjectStore("ids")),t<2&&!e.objectStoreNames.contains(yn)){let a=e.createObjectStore(yn,{keyPath:"threadId"});a.createIndex(qp,"memoryUserId",{unique:!1}),a.createIndex(Vq,"updatedAt",{unique:!1})}}async function Xw(){return new Promise((e,t)=>{let a=indexedDB.open(jq,2);a.onupgradeneeded=n=>{$q(a.result,n.oldVersion)},a.onsuccess=()=>e(a.result),a.onerror=()=>t(a.error)})}async function Wq(){return Xw()}async function Gq(e){return new Promise((t,a)=>{let o=e.transaction("ids","readonly").objectStore("ids").get(I1);o.onsuccess=()=>t(typeof o.result=="string"?o.result:null),o.onerror=()=>a(o.error)})}async function Xq(e,t){return new Promise((a,n)=>{let i=e.transaction("ids","readwrite").objectStore("ids").put(t,I1);i.onsuccess=()=>a(),i.onerror=()=>n(i.error)})}async function Kq(){if(typeof indexedDB>"u")return null;try{let e=await Wq();try{let t=await Gq(e);if(t)return t;let a=Gw();return await Xq(e,a),a}finally{e.close()}}catch{return null}}function Yq(){try{let e=localStorage.getItem(S1);if(e)return e;let t=Gw();return localStorage.setItem(S1,t),t}catch{return null}}async function C1(){let e=await Kq();if(e)return e;let t=Yq();return t||(Ww||(Ww=Gw()),Ww)}function k1(e,t){return e.match(t)?.[1]??null}function Zq(e){let t=[["Edge",/Edg(?:e|A|iOS)?\/(\S+)/],["Opera",/(?:OPR|Opera)\/(\S+)/],["Samsung Internet",/SamsungBrowser\/(\S+)/],["Firefox",/Firefox\/(\S+)/],["Chrome",/Chrome\/(\S+)/],["Safari",/Version\/(\S+).*Safari/]];for(let[a,n]of t){let r=k1(e,n);if(r)return{name:a,version:r}}return null}function Jq(e){let t=[["iOS",/(?:iPhone|iPad|iPod).+?OS (\d+[_.\d]*)/],["Android",/Android (\d+[.\d]*)/],["macOS",/Mac OS X (\d+[_.\d]*)/],["Windows",/Windows NT (\d+[.\d]*)/],["ChromeOS",/CrOS \S+ (\d+[.\d]*)/],["Linux",/Linux/]];for(let[a,n]of t){let r=k1(e,n);if(r)return{name:a,version:r.replace(/_/g,".")};if(a==="Linux"&&n.test(e))return{name:a,version:""}}return null}function Qq(e){return typeof navigator<"u"&&"userAgentData"in navigator&&navigator.userAgentData?.mobile?"mobile":/iPad|tablet|PlayBook/i.test(e)?"tablet":/Mobi|Android.*Mobile|iPhone|iPod/i.test(e)?"mobile":"desktop"}async function Ic(){let e=navigator.userAgent,t=ma(),a=await C1();return{userAgent:e,browser:Zq(e),os:Jq(e),deviceType:Qq(e),language:navigator.language,languages:[...navigator.languages],timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenWidth:screen.width,screenHeight:screen.height,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,colorDepth:screen.colorDepth,devicePixelRatio:window.devicePixelRatio??1,touchSupport:"ontouchstart"in window||navigator.maxTouchPoints>0,connectionType:navigator.connection?.effectiveType??"unknown",referrer:document.referrer,visitorId:t,memoryUserId:a}}var e4="0.22.0-beta.7",t4=40,a4=10,n4=6e5;function Yw(){return typeof performance>"u"?0:performance.now()}function Zw(e,t){let a={};return{metrics:a,has:n=>n in a,set(n,r){a[n]=r},mark(n,r=Yw()){if(!(n in a)){a[n]=r-t;try{performance.mark(`waniwani:${e}:${n}`,{startTime:r})}catch{}}}}}function r4(e){let t={};for(let[a,n]of Object.entries(e)){if(Object.keys(t).length>=t4)break;if(!Number.isFinite(n))continue;let r=Math.round(n);r<0||r>n4||(t[a]=r)}return t}function o4(e){let t={};for(let[a,n]of Object.entries(e)){if(Object.keys(t).length>=a4)break;(typeof n=="string"||typeof n=="boolean")&&(t[a]=n)}return t}function i4(){let e=navigator.connection;if(e)return{effectiveType:e.effectiveType,rtt:e.rtt,downlink:e.downlink,saveData:e.saveData}}function jp(e){let t=e?.Authorization;return typeof t=="string"&&t.startsWith("Bearer ")?t.slice(7):void 0}function s4(e,t,a,n){return{kind:e,sdkVersion:e4,channelId:t.channelId||void 0,sessionId:e==="boot"?void 0:t.sessionId||void 0,visitorId:ma(),pageHost:window.location.hostname,connection:i4(),tags:o4(a),metrics:r4(n)}}var Kw,Hp=[];function Jw(e){let t=String(e?.chatTimingLogs).trim().toLowerCase()==="true";Kw=t;let a=Hp;if(Hp=[],t)for(let n of a)n()}function Vp(e,t,a,n){let{api:r,token:o}=t;if(!(typeof window>"u"||!r||!o||Kw===!1))try{let i=s4(e,t,a,n),s=()=>{Ua("timing",i),fetch(Na(r,"/timing"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify(i),keepalive:!0}).catch(()=>{})};Kw?s():Hp.length<20&&Hp.push(s)}catch{}}var Wr=Zw("boot",0),T1;function Di(e,t){Wr.mark(e,t)}function $p(e){T1??(T1=e)}var l4=/cdn\.jsdelivr\.net\/npm\/@waniwani\/sdk@[^/]+\/dist\/chat\/embed\.js/,u4=/\/embed\.js(\?|$)/;function c4(){if(typeof performance>"u")return;let e=performance.getEntriesByType("navigation")[0];e?.responseStart&&Wr.mark("navTtfb",e.responseStart),e?.domContentLoadedEventEnd&&Wr.mark("navDomContentLoaded",e.domContentLoadedEventEnd);let t=performance.getEntriesByType("resource");for(let a of t)l4.test(a.name)?(Wr.mark("bundleStart",a.startTime),Wr.mark("bundleEnd",a.responseEnd)):u4.test(a.name)&&(Wr.mark("loaderStart",a.startTime),Wr.mark("loaderEnd",a.responseEnd))}function d4(){if(b0)return!0;try{return document.querySelectorAll('script[src*="@waniwani/sdk"]').length>1}catch{return!1}}function L1(e){c4(),Wr.mark("bundleExecuted",x0),Vp("boot",e,{configSource:T1,mode:e.mode,secondSdk:d4()},Wr.metrics)}var f4=[["text-delta","firstText"],["tool-input-start","firstToolInput"],["tool-output-available","firstToolOutput"]];function E1(e){let t=Zw("turn",Yw());t.set("turnIndex",e);let a=!1;return{mark:n=>t.mark(n),instrument(n){if(!n.ok||!n.body||typeof TransformStream>"u")return n;try{let r=new TextDecoder,o=n.body.pipeThrough(new TransformStream({transform(i,s){t.mark("firstChunk");let l=r.decode(i,{stream:!0});for(let[u,c]of f4)!t.has(c)&&l.includes(u)&&t.mark(c);s.enqueue(i)}}));return new Response(o,{status:n.status,statusText:n.statusText,headers:n.headers})}catch{return n}},report(n,r){a||(a=!0,Vp("turn",n,r,t.metrics))}}}function p4(e){let t=e.indexOf("?");return t===-1?e:e.slice(0,t)}function A1(e,t){let a=Zw("widget",Yw()),n=!1;return{mark:r=>a.mark(r),has:r=>a.has(r),report(r,o){n||(n=!0,a.set("retries",o),t({widget:p4(e),outcome:r,metrics:a.metrics}))}}}var m4="/api/mcp/events/v2/batch",Qw=new Set;function h4(e,t,a){return`${e}|${t}|${a??""}`}function Cc(e){return Fp(e,m4)}async function M1(e){let{api:t,token:a,channelId:n,mode:r,source:o}=e;if(typeof window>"u"||!t||!a)return;let i=Cc(t);if(!i){Ua("page.viewed skipped: the chat api is not a Waniwani endpoint");return}if(!n&&!o){Ua("page.viewed skipped: no channelId or source to attribute it");return}let s=h4(t,a,n);if(!Qw.has(s)){Qw.add(s);try{let l=await Ic(),u=new Date().toISOString(),c=JSON.stringify({sentAt:u,source:{sdk:"@waniwani/sdk",version:"0.1.0"},events:[{id:crypto.randomUUID(),type:"mcp.event",name:"page.viewed",source:o,timestamp:u,correlation:{visitorId:l.visitorId},properties:{channelId:n,mode:r,url:window.location.href,referrer:l.referrer,deviceType:l.deviceType,language:l.language,timezone:l.timezone},metadata:{}}]}),d=fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:c,keepalive:!0});Di("pageViewSent"),await d}catch{Qw.delete(s)}}}function R1(e){let t=Cc(e.api);return t?b1({endpoint:t,token:e.token,channelId:e.channelId,source:e.getSource,identity:()=>({sessionId:e.getSessionId(),visitorId:ma()})}):Wp("the chat api does not point at a Waniwani event ingest")}function Wp(e){let t=!1,a=async()=>(t||(t=!0,console.warn(`[Waniwani] track() is disabled: ${e}`)),{eventId:""});return{track:Object.assign(a,{priceShown:a,pricesCompared:a,optionSelected:a,leadQualified:a,converted:a}),identify:a,flush:async()=>{},shutdown:async()=>({timedOut:!1,pendingEvents:0})}}var Xp=j(Ee());var Gp=(...e)=>e.filter((t,a,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===a).join(" ").trim();var D1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var _1=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,n)=>n?n.toUpperCase():a.toLowerCase());var ev=e=>{let t=_1(e);return t.charAt(0).toUpperCase()+t.slice(1)};var kc=j(Ee());var P1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var O1=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var N1=(0,kc.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:n,className:r="",children:o,iconNode:i,...s},l)=>(0,kc.createElement)("svg",{ref:l,...P1,width:t,height:t,stroke:e,strokeWidth:n?Number(a)*24/Number(t):a,className:Gp("lucide",r),...!o&&!O1(s)&&{"aria-hidden":"true"},...s},[...i.map(([u,c])=>(0,kc.createElement)(u,c)),...Array.isArray(o)?o:[o]]));var tt=(e,t)=>{let a=(0,Xp.forwardRef)(({className:n,...r},o)=>(0,Xp.createElement)(N1,{ref:o,iconNode:t,className:Gp(`lucide-${D1(ev(e))}`,`lucide-${e}`,n),...r}));return a.displayName=ev(e),a};var g4=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Tc=tt("arrow-down",g4);var y4=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],pr=tt("arrow-up",y4);var w4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Lc=tt("check",w4);var v4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],zo=tt("chevron-down",v4);var x4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ec=tt("chevron-right",x4);var b4=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]],Ac=tt("clipboard-copy",b4);var S4=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Gr=tt("clock",S4);var I4=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Mc=tt("file-text",I4);var C4=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],vl=tt("file",C4);var k4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Rc=tt("globe",k4);var T4=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Dc=tt("image",T4);var L4=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],_c=tt("loader",L4);var E4=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],xl=tt("paperclip",E4);var A4=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Pc=tt("square",A4);var M4=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],_i=tt("wrench",M4);var R4=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],wn=tt("x",R4);var D4=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Oc=tt("zap",D4);var rt=j(Ee(),1),qB=j(gg(),1);var bl=j(Ee(),1),Nc=j(me(),1);function O4(e){return 1-(1-e)**3}function N4({start:e=0,end:t=100,duration:a=1e3,delay:n=0,ease:r=O4,onUpdate:o,onEnd:i}){let s=performance.now()+n;function l(){let u=performance.now()-s,c=Math.min(u/a,1);o(e+(t-e)*r(c)),c<1?requestAnimationFrame(l):i&&i()}setTimeout(()=>requestAnimationFrame(l),n)}var U4=["80% 55%","69% 34%","8% 6%","41% 38%","86% 85%","82% 18%","51% 4%"],B4=[0,1,2,0,1,2,1];function z4(e){let t=[];for(let a=0;a<7;a++){let n=e[Math.min(B4[a],e.length-1)];t.push(`radial-gradient(at ${U4[a]}, ${n} 0px, transparent 50%)`)}return t.push(`linear-gradient(${e[0]} 0 100%)`),t}var F4=({children:e,className:t="",style:a,edgeSensitivity:n=30,backgroundColor:r="#120F17",borderRadius:o=28,coneSpread:i=25,animated:s=!1,colors:l=["#c084fc","#f472b6","#38bdf8"]})=>{let[u,c]=(0,bl.useState)(110),[d,p]=(0,bl.useState)(0),[m,h]=(0,bl.useState)(!1);(0,bl.useEffect)(()=>{if(!s)return;let E=110;h(!0),c(E),N4({ease:T=>T,duration:2e3,onUpdate:T=>{let R=T/100;c(E+360*R);let O=Math.min(R/.1,1),U=R>.85?(1-R)/.15:1;p(Math.min(O,U))},onEnd:()=>h(!1)})},[s]);let v=n+20,I=m?Math.max(0,(d*100-v)/(100-v)):0,w=z4(l).map(E=>`${E} border-box`),S=`conic-gradient(from ${`${u.toFixed(3)}deg`} at center, black ${i}%, transparent ${i+15}%, transparent ${100-i-15}%, black ${100-i}%)`;return(0,Nc.jsxs)("div",{className:`ww:relative ww:grid ww:isolate ww:border ${t}`,style:{background:r,borderRadius:typeof o=="number"?`${o}px`:o,transform:"translate3d(0, 0, 0.01px)",...a},children:[(0,Nc.jsx)("div",{className:"ww:absolute ww:inset-0 ww:rounded-[inherit] ww:-z-[1]",style:{border:"1px solid transparent",background:[`linear-gradient(${r} 0 100%) padding-box`,"linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box",...w].join(", "),opacity:I,maskImage:S,WebkitMaskImage:S,transition:m?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"}}),(0,Nc.jsx)("div",{className:"ww:flex ww:flex-col ww:relative ww:overflow-auto ww:z-[1]",children:e})]})},Yp=F4;tv();nv();var q4=q1({prefix:"ww"});function V(...e){return q4(Zp(e))}var Uc=j(me(),1);function Sl({suggestions:e,isLoading:t,onSelect:a,align:n="start",className:r,...o}){return e.length===0&&!t?null:(0,Uc.jsx)("div",{className:V("ww:px-4 ww:py-2",r),...o,children:(0,Uc.jsx)("div",{className:V("ww:mx-auto ww:w-full ww:max-w-3xl ww:flex ww:flex-wrap ww:gap-2",n==="center"&&"ww:justify-center"),children:t?[0,1,2].map(i=>(0,Uc.jsx)("div",{className:"ww:h-8 ww:rounded-full ww:bg-accent ww:animate-pulse",style:{width:`${60+i*20}px`}},i)):e.map((i,s)=>(0,Uc.jsx)("button",{type:"button",onClick:()=>a(i),className:V("ww:rounded-full ww:border ww:border-border ww:bg-accent ww:px-3.5 ww:py-1.5 ww:text-sm","ww:text-foreground ww:hover:bg-border ww:hover:border-primary/30","ww:transition-all ww:duration-200 ww:ease-out ww:cursor-pointer","ww:animate-[ww-fade-in_0.2s_ease-out_both]"),style:{animationDelay:`${s*50}ms`},children:i},i))})})}var gm=j(Ee(),1);var gL="vercel.ai.error",H4=Symbol.for(gL),H1,j1,Je=class yL extends(j1=Error,H1=H4,j1){constructor({name:t,message:a,cause:n}){super(a),this[H1]=!0,this.name=t,this.cause=n}static isInstance(t){return yL.hasMarker(t,gL)}static hasMarker(t,a){let n=Symbol.for(a);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}},wL="AI_APICallError",vL=`vercel.ai.error.${wL}`,j4=Symbol.for(vL),V1,$1,WQ=class extends($1=Je,V1=j4,$1){constructor({message:e,url:t,requestBodyValues:a,statusCode:n,responseHeaders:r,responseBody:o,cause:i,isRetryable:s=n!=null&&(n===408||n===409||n===429||n>=500),data:l}){super({name:wL,message:e,cause:i}),this[V1]=!0,this.url=t,this.requestBodyValues=a,this.statusCode=n,this.responseHeaders=r,this.responseBody=o,this.isRetryable=s,this.data=l}static isInstance(e){return Je.hasMarker(e,vL)}},xL="AI_EmptyResponseBodyError",bL=`vercel.ai.error.${xL}`,V4=Symbol.for(bL),W1,G1,GQ=class extends(G1=Je,W1=V4,G1){constructor({message:e="Empty response body"}={}){super({name:xL,message:e}),this[W1]=!0}static isInstance(e){return Je.hasMarker(e,bL)}};function SL(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var IL="AI_InvalidArgumentError",CL=`vercel.ai.error.${IL}`,$4=Symbol.for(CL),X1,K1,kL=class extends(K1=Je,X1=$4,K1){constructor({message:e,cause:t,argument:a}){super({name:IL,message:e,cause:t}),this[X1]=!0,this.argument=a}static isInstance(e){return Je.hasMarker(e,CL)}},TL="AI_InvalidPromptError",LL=`vercel.ai.error.${TL}`,W4=Symbol.for(LL),Y1,Z1,XQ=class extends(Z1=Je,Y1=W4,Z1){constructor({prompt:e,message:t,cause:a}){super({name:TL,message:`Invalid prompt: ${t}`,cause:a}),this[Y1]=!0,this.prompt=e}static isInstance(e){return Je.hasMarker(e,LL)}},EL="AI_InvalidResponseDataError",AL=`vercel.ai.error.${EL}`,G4=Symbol.for(AL),J1,Q1,KQ=class extends(Q1=Je,J1=G4,Q1){constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:EL,message:t}),this[J1]=!0,this.data=e}static isInstance(e){return Je.hasMarker(e,AL)}},ML="AI_JSONParseError",RL=`vercel.ai.error.${ML}`,X4=Symbol.for(RL),eL,tL,ov=class extends(tL=Je,eL=X4,tL){constructor({text:e,cause:t}){super({name:ML,message:`JSON parsing failed: Text: ${e}.
122
- Error message: ${SL(t)}`,cause:t}),this[eL]=!0,this.text=e}static isInstance(e){return Je.hasMarker(e,RL)}},DL="AI_LoadAPIKeyError",_L=`vercel.ai.error.${DL}`,K4=Symbol.for(_L),aL,nL,YQ=class extends(nL=Je,aL=K4,nL){constructor({message:e}){super({name:DL,message:e}),this[aL]=!0}static isInstance(e){return Je.hasMarker(e,_L)}},PL="AI_LoadSettingError",OL=`vercel.ai.error.${PL}`,Y4=Symbol.for(OL),rL,oL,ZQ=class extends(oL=Je,rL=Y4,oL){constructor({message:e}){super({name:PL,message:e}),this[rL]=!0}static isInstance(e){return Je.hasMarker(e,OL)}},NL="AI_NoContentGeneratedError",UL=`vercel.ai.error.${NL}`,Z4=Symbol.for(UL),iL,sL,JQ=class extends(sL=Je,iL=Z4,sL){constructor({message:e="No content generated."}={}){super({name:NL,message:e}),this[iL]=!0}static isInstance(e){return Je.hasMarker(e,UL)}},BL="AI_NoSuchModelError",zL=`vercel.ai.error.${BL}`,J4=Symbol.for(zL),lL,uL,QQ=class extends(uL=Je,lL=J4,uL){constructor({errorName:e=BL,modelId:t,modelType:a,message:n=`No such ${a}: ${t}`}){super({name:e,message:n}),this[lL]=!0,this.modelId=t,this.modelType=a}static isInstance(e){return Je.hasMarker(e,zL)}},FL="AI_TooManyEmbeddingValuesForCallError",qL=`vercel.ai.error.${FL}`,Q4=Symbol.for(qL),cL,dL,eee=class extends(dL=Je,cL=Q4,dL){constructor(e){super({name:FL,message:`Too many values for a single embedding call. The ${e.provider} model "${e.modelId}" can only embed up to ${e.maxEmbeddingsPerCall} values per call, but ${e.values.length} values were provided.`}),this[cL]=!0,this.provider=e.provider,this.modelId=e.modelId,this.maxEmbeddingsPerCall=e.maxEmbeddingsPerCall,this.values=e.values}static isInstance(e){return Je.hasMarker(e,qL)}},HL="AI_TypeValidationError",jL=`vercel.ai.error.${HL}`,e5=Symbol.for(jL),fL,pL,Kn=class rv extends(pL=Je,fL=e5,pL){constructor({value:t,cause:a,context:n}){let r="Type validation failed";if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=" (";let o=[];n.entityName&&o.push(n.entityName),n.entityId&&o.push(`id: "${n.entityId}"`),r+=o.join(", "),r+=")"}super({name:HL,message:`${r}: Value: ${JSON.stringify(t)}.
123
- Error message: ${SL(a)}`,cause:a}),this[fL]=!0,this.value=t,this.context=n}static isInstance(t){return Je.hasMarker(t,jL)}static wrap({value:t,cause:a,context:n}){var r,o,i;return rv.isInstance(a)&&a.value===t&&((r=a.context)==null?void 0:r.field)===n?.field&&((o=a.context)==null?void 0:o.entityName)===n?.entityName&&((i=a.context)==null?void 0:i.entityId)===n?.entityId?a:new rv({value:t,cause:a,context:n})}},VL="AI_UnsupportedFunctionalityError",$L=`vercel.ai.error.${VL}`,t5=Symbol.for($L),mL,hL,tee=class extends(hL=Je,mL=t5,hL){constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:VL,message:t}),this[mL]=!0,this.functionality=e}static isInstance(e){return Je.hasMarker(e,$L)}};var Jp=()=>sv,sv=new Proxy(Jp,{get(e,t){return t==="parse"||t==="parseAsync"?a=>a:t==="safeParse"||t==="safeParseAsync"?a=>({success:!0,data:a}):t==="_def"?{}:t==="jsonSchema"?{}:Jp},apply(){return sv}}),iv=class extends Error{constructor(){super(...arguments);K(this,"issues",[])}},f=new Proxy(Jp,{get(e,t){return t==="ZodError"?iv:t==="NEVER"?Symbol("NEVER"):Jp},apply(){return sv}});var Me={};var Qp=class extends Error{constructor(t,a){super(t),this.name="ParseError",this.type=a.type,this.field=a.field,this.value=a.value,this.line=a.line}};function lv(e){}function WL(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=lv,onError:a=lv,onRetry:n=lv,onComment:r}=e,o="",i=!0,s,l="",u="";function c(v){let I=i?v.replace(/^\xEF\xBB\xBF/,""):v,[y,w]=a5(`${o}${I}`);for(let g of y)d(g);o=w,i=!1}function d(v){if(v===""){m();return}if(v.startsWith(":")){r&&r(v.slice(v.startsWith(": ")?2:1));return}let I=v.indexOf(":");if(I!==-1){let y=v.slice(0,I),w=v[I+1]===" "?2:1,g=v.slice(I+w);p(y,g,v);return}p(v,"",v)}function p(v,I,y){switch(v){case"event":u=I;break;case"data":l=`${l}${I}
121
+ `||e[t]==="\r");)t-=1;return t>=1&&e[t]==="$"&&e[t-1]==="$"},NS=e=>{let t=0;for(let a=0;a<e.length-1;a+=1)e[a]==="$"&&e[a+1]==="$"&&(t+=1,a+=1);return t},yU=e=>{let t=IK.test(e),a=CK.test(e);if(t||a)return[e];let n=Sn.lex(e,{gfm:!0}),r=[],o=[];for(let i of n){let s=i.raw,l=r.length;if(o.length>0){if(r[l-1]+=s,i.type==="html"){let u=s.match(kK);if(u){let c=u[1];o.at(-1)===c&&o.pop()}}continue}if(i.type==="html"&&i.block){let u=s.match(TK);if(u){let c=u[1];s.includes(`</${c}>`)||o.push(c)}}if(s.trim()==="$$"&&l>0){let u=r[l-1],c=OS(u),d=NS(u);if(c&&d%2===1){r[l-1]=u+s;continue}}if(l>0&&LK(s)){let u=r[l-1],c=OS(u),d=NS(u),p=NS(s);if(c&&d%2===1&&!OS(s)&&p===1){r[l-1]=u+s;continue}}r.push(s)}return r},wU={raw:ZM,sanitize:[Am,{}],harden:[KM,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},vU={gfm:[eh,{}]},EK=Object.values(wU),AK=Object.values(vU),MK={block:" \u258B",circle:" \u25CF"},RK={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0,linkSafety:{enabled:!0}},qa=(0,N.createContext)(RK),jS=(0,N.memo)(({content:e,shouldParseIncompleteMarkdown:t,index:a,...n})=>(0,M.jsx)(gU,{...n,children:e}),(e,t)=>{if(e.content!==t.content||e.index!==t.index)return!1;if(e.components!==t.components){let a=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(a.length!==n.length||a.some(r=>{var o,i;return((o=e.components)==null?void 0:o[r])!==((i=t.components)==null?void 0:i[r])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});jS.displayName="Block";DK=["github-light","github-dark"],au=(0,N.memo)(({children:e,mode:t="streaming",parseIncompleteMarkdown:a=!0,components:n,rehypePlugins:r=EK,remarkPlugins:o=AK,className:i,shikiTheme:s=DK,mermaid:l,controls:u=!0,isAnimating:c=!1,BlockComponent:d=jS,parseMarkdownIntoBlocksFn:p=yU,caret:m,plugins:h,remend:v,linkSafety:I={enabled:!0},...y})=>{let w=(0,N.useId)(),[g,S]=(0,N.useTransition)(),E=(0,N.useMemo)(()=>typeof e!="string"?"":t==="streaming"&&a?u_(e,v):e,[e,t,a,v]),T=(0,N.useMemo)(()=>p(E),[E,p]),[R,O]=(0,N.useState)(T);(0,N.useEffect)(()=>{t==="streaming"?S(()=>{O(T)}):O(T)},[T,t]);let U=t==="streaming"?R:T,A=(0,N.useMemo)(()=>U.map((B,P)=>`${w}-${P}`),[U.length,w]),Q=(0,N.useMemo)(()=>{var B,P;return{shikiTheme:(P=(B=h?.code)==null?void 0:B.getThemes())!=null?P:s,controls:u,isAnimating:c,mode:t,mermaid:l,linkSafety:I}},[s,u,c,t,l,I,h?.code]),$=(0,N.useMemo)(()=>({...wK,...n}),[n]),H=(0,N.useMemo)(()=>{let B=[];return h!=null&&h.cjk&&(B=[...B,...h.cjk.remarkPluginsBefore]),B=[...B,...o],h!=null&&h.cjk&&(B=[...B,...h.cjk.remarkPluginsAfter]),h!=null&&h.math&&(B=[...B,h.math.remarkPlugin]),B},[o,h?.math,h?.cjk]),Z=(0,N.useMemo)(()=>h!=null&&h.math?[...r,h.math.rehypePlugin]:r,[r,h?.math]),X=(0,N.useMemo)(()=>m&&c?{"--streamdown-caret":`"${MK[m]}"`}:void 0,[m,c]);return t==="static"?(0,M.jsx)(US.Provider,{value:h??null,children:(0,M.jsx)(qa.Provider,{value:Q,children:(0,M.jsx)("div",{className:Ce("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",i),children:(0,M.jsx)(gU,{components:$,rehypePlugins:Z,remarkPlugins:H,...y,children:e})})})}):(0,M.jsx)(US.Provider,{value:h??null,children:(0,M.jsx)(qa.Provider,{value:Q,children:(0,M.jsxs)("div",{className:Ce("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",m?"*:last:after:inline *:last:after:align-baseline *:last:after:content-(--streamdown-caret)":null,i),style:X,children:[U.length===0&&m&&c&&(0,M.jsx)("span",{}),U.map((B,P)=>(0,M.jsx)(d,{components:$,content:B,index:P,rehypePlugins:Z,remarkPlugins:H,shouldParseIncompleteMarkdown:a,...y},A[P]))]})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety);au.displayName="Streamdown";_K=({children:e,className:t,minZoom:a=.5,maxZoom:n=3,zoomStep:r=.1,showControls:o=!0,initialZoom:i=1,fullscreen:s=!1})=>{let l=(0,N.useRef)(null),u=(0,N.useRef)(null),[c,d]=(0,N.useState)(i),[p,m]=(0,N.useState)({x:0,y:0}),[h,v]=(0,N.useState)(!1),[I,y]=(0,N.useState)({x:0,y:0}),[w,g]=(0,N.useState)({x:0,y:0}),S=(0,N.useCallback)($=>{d(H=>Math.max(a,Math.min(n,H+$)))},[a,n]),E=(0,N.useCallback)(()=>{S(r)},[S,r]),T=(0,N.useCallback)(()=>{S(-r)},[S,r]),R=(0,N.useCallback)(()=>{d(i),m({x:0,y:0})},[i]),O=(0,N.useCallback)($=>{$.preventDefault();let H=$.deltaY>0?-r:r;S(H)},[S,r]),U=(0,N.useCallback)($=>{if($.button!==0||$.isPrimary===!1)return;v(!0),y({x:$.clientX,y:$.clientY}),g(p);let H=$.currentTarget;H instanceof HTMLElement&&H.setPointerCapture($.pointerId)},[p]),A=(0,N.useCallback)($=>{if(!h)return;$.preventDefault();let H=$.clientX-I.x,Z=$.clientY-I.y;m({x:w.x+H,y:w.y+Z})},[h,I,w]),Q=(0,N.useCallback)($=>{v(!1);let H=$.currentTarget;H instanceof HTMLElement&&H.releasePointerCapture($.pointerId)},[]);return(0,N.useEffect)(()=>{let $=l.current;if($)return $.addEventListener("wheel",O,{passive:!1}),()=>{$.removeEventListener("wheel",O)}},[O]),(0,N.useEffect)(()=>{let $=u.current;if($&&h)return document.body.style.userSelect="none",$.addEventListener("pointermove",A,{passive:!1}),$.addEventListener("pointerup",Q),$.addEventListener("pointercancel",Q),()=>{document.body.style.userSelect="",$.removeEventListener("pointermove",A),$.removeEventListener("pointerup",Q),$.removeEventListener("pointercancel",Q)}},[h,A,Q]),(0,M.jsxs)("div",{className:Ce("relative flex flex-col",s?"h-full w-full":"min-h-28 w-full",t),ref:l,style:{cursor:h?"grabbing":"grab"},children:[o?(0,M.jsxs)("div",{className:Ce("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",s?"bottom-4 left-4":"bottom-2 left-2"),children:[(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:c>=n,onClick:E,title:"Zoom in",type:"button",children:(0,M.jsx)(KX,{size:16})}),(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:c<=a,onClick:T,title:"Zoom out",type:"button",children:(0,M.jsx)(YX,{size:16})}),(0,M.jsx)("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:R,title:"Reset zoom and pan",type:"button",children:(0,M.jsx)(XX,{size:16})})]}):null,(0,M.jsx)("div",{className:Ce("flex-1 origin-center transition-transform duration-150 ease-out",s?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:U,ref:u,role:"application",style:{transform:`translate(${p.x}px, ${p.y}px) scale(${c})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},_S=({chart:e,className:t,config:a,fullscreen:n=!1,showControls:r=!0})=>{let[o,i]=(0,N.useState)(null),[s,l]=(0,N.useState)(!1),[u,c]=(0,N.useState)(""),[d,p]=(0,N.useState)(""),[m,h]=(0,N.useState)(0),{mermaid:v}=(0,N.useContext)(qa),I=qS(),y=v?.errorComponent,{shouldRender:w,containerRef:g}=$X({immediate:n});if((0,N.useEffect)(()=>{if(w){if(!I){i("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{i(null),l(!0);let E=I.getMermaid(a),T=e.split("").reduce((U,A)=>(U<<5)-U+A.charCodeAt(0)|0,0),R=`mermaid-${Math.abs(T)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:O}=await E.render(R,e);c(O),p(O)}catch(E){if(!(d||u)){let T=E instanceof Error?E.message:"Failed to render Mermaid chart";i(T)}}finally{l(!1)}})()}},[e,a,m,w,I]),!(w||u||d))return(0,M.jsx)("div",{className:Ce("my-4 min-h-[200px]",t),ref:g});if(s&&!u&&!d)return(0,M.jsx)("div",{className:Ce("my-4 flex justify-center p-4",t),ref:g,children:(0,M.jsxs)("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[(0,M.jsx)("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),(0,M.jsx)("span",{className:"text-sm",children:"Loading diagram..."})]})});if(o&&!u&&!d)return y?(0,M.jsx)("div",{ref:g,children:(0,M.jsx)(y,{chart:e,error:o,retry:()=>h(T=>T+1)})}):(0,M.jsxs)("div",{className:Ce("rounded-lg border border-red-200 bg-red-50 p-4",t),ref:g,children:[(0,M.jsxs)("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",o]}),(0,M.jsxs)("details",{className:"mt-2",children:[(0,M.jsx)("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),(0,M.jsx)("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]});let S=u||d;return(0,M.jsx)("div",{className:Ce("size-full",t),"data-streamdown":"mermaid",ref:g,children:(0,M.jsx)(_K,{className:Ce(n?"size-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:n,maxZoom:3,minZoom:.5,showControls:r,zoomStep:.1,children:(0,M.jsx)("div",{"aria-label":"Mermaid chart",className:Ce("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:S},role:"img"})})})}});var lB=Ca((Xve,sB)=>{"use strict";function cY(e,t){if(typeof e!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let a,n=0;return function(...o){clearTimeout(a);let i=Date.now(),s=i-n,l=t-s;l<=0?(n=i,e.apply(this,o)):a=setTimeout(()=>{n=Date.now(),e.apply(this,o)},l)}}sB.exports=cY});var xI=typeof performance>"u"?0:performance.now(),bI=typeof window<"u"&&!!window.WaniWani?.chat;var Cs=j(Ee(),1),Zh=j(qw(),1);var Hw="waniwani/suggestions";function yl(e,t){for(let a of t){let n=e[a];if(typeof n=="string"&&n.length>0)return n}}var hq=["waniwani/sessionId","openai/sessionId","openai/session","sessionId","conversationId","mcp-session-id"],gq=["waniwani/requestId","openai/requestId","requestId","mcp/requestId"],yq=["waniwani/traceId","openai/traceId","traceId","mcp/traceId","openai/requestId","requestId"],wq=["waniwani/userId","openai/userId","externalUserId","userId","actorId"],vq=["waniwani/visitorId","visitorId"],xq=["correlationId","openai/requestId"];function c1(e){return e?yl(e,hq):void 0}function d1(e){return e?yl(e,gq):void 0}function f1(e){return e?yl(e,yq):void 0}function p1(e){return e?yl(e,wq):void 0}function m1(e){return e?yl(e,vq):void 0}function h1(e){return e?yl(e,xq):void 0}var bq=[{key:"openai/sessionId",source:"chatgpt"},{key:"openai/session",source:"chatgpt"}],Sq=[{needle:"claude",source:"claude"},{needle:"chatgpt",source:"chatgpt"},{needle:"openai",source:"chatgpt"},{needle:"gemini",source:"gemini"}];function g1(e,t){if(e){let n=e["waniwani/source"];if(typeof n=="string"&&n.length>0)return n;for(let{key:r,source:o}of bq){let i=e[r];if(typeof i=="string"&&i.length>0)return o}}let a=t?.name;if(typeof a=="string"&&a.length>0){let n=a.toLowerCase();for(let{needle:r,source:o}of Sq)if(n.includes(r))return o}}var Iq="@waniwani/sdk";function y1(e,t={}){let a=t.now??(()=>new Date),n=t.generateId??Cq,r=Lq(e),o=zp(e.meta),i=zp(e.metadata),s=Eq(e,o),l=Xn(e.eventId)??n(),u=Aq(e.timestamp,a),c=Xn(e.source)??g1(o)??t.source??Iq,d=jw(e)?{...e}:void 0,p={...i};return Object.keys(o).length>0&&(p.meta=o),d&&(p.rawLegacy=d),{id:l,type:"mcp.event",name:r,source:c,timestamp:u,correlation:s,properties:kq(e,r),metadata:p,rawLegacy:d}}function Cq(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`evt_${crypto.randomUUID()}`:`evt_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function kq(e,t){if(!jw(e))return zp(e.properties);let a=Tq(e,t),n=zp(e.properties);return{...a,...n}}function Tq(e,t){switch(t){case"tool.called":{let a={};return Xn(e.toolName)&&(a.name=e.toolName),Xn(e.toolType)&&(a.type=e.toolType),a}case"link.clicked":{let a={};return Xn(e.linkUrl)&&(a.url=e.linkUrl),a}default:return{}}}function Lq(e){return jw(e)?e.eventType:e.event}function Eq(e,t){let a=Xn(e.requestId)??d1(t),n=Xn(e.sessionId)??c1(t),r=Xn(e.traceId)??f1(t),o=Xn(e.externalUserId)??p1(t),i=Xn(e.visitorId)??m1(t),s=Xn(e.correlationId)??h1(t)??a,l={};return n&&(l.sessionId=n),r&&(l.traceId=r),a&&(l.requestId=a),s&&(l.correlationId=s),o&&(l.externalUserId=o),i&&(l.visitorId=i),l}function Aq(e,t){if(e instanceof Date)return e.toISOString();if(typeof e=="string"){let a=new Date(e);if(!Number.isNaN(a.getTime()))return a.toISOString()}return t().toISOString()}function zp(e){return!e||typeof e!="object"||Array.isArray(e)?{}:e}function Xn(e){if(typeof e=="string"&&e.trim().length!==0)return e}function jw(e){return"eventType"in e}function w1(e){return{priceShown:({amount:t,currency:a,itemId:n,label:r,...o})=>e({event:"price_shown",properties:{amount:t,currency:a,itemId:n,label:r},...o}),pricesCompared:({options:t,...a})=>e({event:"prices_compared",properties:{options:t},...a}),optionSelected:({id:t,amount:a,currency:n,...r})=>e({event:"option_selected",properties:{id:t,amount:a,currency:n},...r}),leadQualified:t=>{let{externalId:a,email:n,name:r,...o}=t??{};return e({event:"lead_qualified",properties:{externalId:a,email:n,name:r},...o})},converted:({amount:t,currency:a,occurredAt:n,...r})=>e({event:"converted",properties:{amount:t,currency:a,occurredAt:n},...r})}}var Mq="/api/mcp/events/v2/batch";var v1="@waniwani/sdk";var Rq=new Set([401,403]),Dq=new Set([408,425,429,500,502,503,504]),_q=(e,t)=>globalThis.fetch(e,t);function x1(e){return new Vw(e)}var Vw=class{constructor(t){K(this,"endpointUrl");K(this,"flushIntervalMs");K(this,"maxBatchSize");K(this,"maxBufferSize");K(this,"maxRetries");K(this,"retryBaseDelayMs");K(this,"retryMaxDelayMs");K(this,"shutdownTimeoutMs");K(this,"sdkVersion");K(this,"fetchFn");K(this,"logger");K(this,"now");K(this,"sleep");K(this,"apiKey");K(this,"buffer",[]);K(this,"flushTimer");K(this,"flushScheduled",!1);K(this,"flushScheduledTimer");K(this,"flushInFlight");K(this,"inFlightCount",0);K(this,"isStopped",!1);K(this,"isShuttingDown",!1);this.endpointUrl=Nq(t.apiUrl,t.endpointPath??Mq),this.flushIntervalMs=t.flushIntervalMs??1e3,this.maxBatchSize=t.maxBatchSize??20,this.maxBufferSize=t.maxBufferSize??1e3,this.maxRetries=t.maxRetries??3,this.retryBaseDelayMs=t.retryBaseDelayMs??200,this.retryMaxDelayMs=t.retryMaxDelayMs??2e3,this.shutdownTimeoutMs=t.shutdownTimeoutMs??2e3,this.fetchFn=t.fetchFn??_q,this.logger=t.logger??console,this.now=t.now??(()=>new Date),this.sleep=t.sleep??(a=>new Promise(n=>setTimeout(n,a))),this.apiKey=t.apiKey,this.sdkVersion=t.sdkVersion,this.flushIntervalMs>0&&(this.flushTimer=setInterval(()=>{this.flush()},this.flushIntervalMs)),this.registerBrowserTeardown()}enqueue(t){if(this.isStopped||this.isShuttingDown){this.logger.warn("[Waniwani] Tracking transport is stopped, dropping event %s",t.id);return}if(this.buffer.length>=this.maxBufferSize){let a=this.buffer.length-this.maxBufferSize+1;this.buffer.splice(0,a),this.logger.warn("[Waniwani] Tracking buffer overflow, dropped %d oldest event(s)",a)}if(this.buffer.push(t),this.buffer.length>=this.maxBatchSize){this.flush();return}this.scheduleMicroFlush()}pendingEvents(){return this.buffer.length+this.inFlightCount}async flush(){return this.flushInFlight?this.flushInFlight:(this.flushInFlight=this.flushLoop().finally(()=>{this.flushInFlight=void 0}),this.flushInFlight)}async shutdown(t){this.isShuttingDown=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.flushScheduledTimer&&(clearTimeout(this.flushScheduledTimer),this.flushScheduledTimer=void 0,this.flushScheduled=!1);let a=t?.timeoutMs??this.shutdownTimeoutMs,n=this.flush();if(!Number.isFinite(a)||a<=0)return await n,this.isStopped=!0,{timedOut:!1,pendingEvents:this.pendingEvents()};let r=Symbol("shutdown-timeout");return await Promise.race([n.then(()=>"flushed"),this.sleep(a).then(()=>r)])===r?(this.isStopped=!0,{timedOut:!0,pendingEvents:this.pendingEvents()}):(this.isStopped=!0,{timedOut:!1,pendingEvents:this.pendingEvents()})}registerBrowserTeardown(){if(typeof document>"u"||typeof window>"u")return;let t=()=>{document.visibilityState==="hidden"&&this.keepaliveFlush()};document.addEventListener("visibilitychange",t),window.addEventListener("pagehide",()=>this.keepaliveFlush())}keepaliveFlush(){if(this.isStopped||this.buffer.length===0)return;let t=this.buffer.splice(0,this.buffer.length);this.sendKeepaliveChunk(t)}sendKeepaliveChunk(t){let a=JSON.stringify(this.makeBatchRequest(t));if(a.length>6e4&&t.length>1){let n=Math.ceil(t.length/2);this.sendKeepaliveChunk(t.slice(0,n)),this.sendKeepaliveChunk(t.slice(n));return}try{this.fetchFn(this.endpointUrl,{method:"POST",headers:this.requestHeaders(),body:a,keepalive:!0}).catch(()=>{})}catch{}}requestHeaders(){let t={"Content-Type":"application/json","X-WaniWani-SDK":v1};return this.apiKey&&(t.Authorization=`Bearer ${this.apiKey}`),t}scheduleMicroFlush(){this.flushScheduled||(this.flushScheduled=!0,this.flushScheduledTimer=setTimeout(()=>{this.flushScheduledTimer=void 0,this.flushScheduled=!1,this.flush()},0))}async flushLoop(){for(;this.buffer.length>0&&!this.isStopped;){let t=this.buffer.splice(0,this.maxBatchSize);await this.sendBatchWithRetry(t)}}async sendBatchWithRetry(t){let a=0,n=t;for(;n.length>0&&!this.isStopped;){this.inFlightCount=n.length;let r=await this.sendBatchOnce(n);switch(this.inFlightCount=0,r.kind){case"success":return;case"auth":this.stopTransportForAuthFailure(r.status,n.length);return;case"permanent":this.logger.error("[Waniwani] Dropping %d event(s) after permanent failure: %s",n.length,r.reason);return;case"retryable":if(a>=this.maxRetries){this.logger.error("[Waniwani] Dropping %d event(s) after retry exhaustion: %s",n.length,r.reason);return}await this.sleep(this.backoffDelayMs(a)),a+=1;continue;case"partial":if(r.permanent.length>0&&this.logger.error("[Waniwani] Dropping %d event(s) rejected as permanent",r.permanent.length),r.retryable.length===0)return;if(a>=this.maxRetries){this.logger.error("[Waniwani] Dropping %d retryable event(s) after retry exhaustion",r.retryable.length);return}n=r.retryable,await this.sleep(this.backoffDelayMs(a)),a+=1;continue}}}async sendBatchOnce(t){let a;try{a=await this.fetchFn(this.endpointUrl,{method:"POST",headers:this.requestHeaders(),body:JSON.stringify(this.makeBatchRequest(t))})}catch(o){return{kind:"retryable",reason:Uq(o)}}if(Rq.has(a.status))return{kind:"auth",status:a.status};if(Dq.has(a.status))return{kind:"retryable",reason:`HTTP ${a.status}`};if(!a.ok)return{kind:"permanent",reason:`HTTP ${a.status}`};let n=await Oq(a);if(!n?.rejected||n.rejected.length===0)return{kind:"success"};let r=this.classifyRejectedEvents(t,n.rejected);return r.retryable.length===0&&r.permanent.length===0?{kind:"success"}:{kind:"partial",retryable:r.retryable,permanent:r.permanent}}makeBatchRequest(t){return{sentAt:this.now().toISOString(),source:{sdk:v1,version:this.sdkVersion??"0.0.0"},events:t}}classifyRejectedEvents(t,a){let n=new Map(t.map(i=>[i.id,i])),r=[],o=[];for(let i of a){let s=n.get(i.eventId);if(s){if(Pq(i)){r.push(s);continue}o.push(s)}}return{retryable:r,permanent:o}}backoffDelayMs(t){let a=this.retryBaseDelayMs*2**t;return Math.min(a,this.retryMaxDelayMs)}stopTransportForAuthFailure(t,a){this.isStopped=!0;let n=this.buffer.length;this.buffer.splice(0,n),this.logger.error("[Waniwani] Auth failure (HTTP %d). Stopping tracking transport and dropping %d queued event(s)",t,a+n)}};function Pq(e){if(e.retryable===!0)return!0;let t=e.code.toLowerCase();return t.includes("timeout")||t.includes("temporary")||t.includes("unavailable")||t.includes("rate_limit")||t.includes("transient")||t.includes("server")}async function Oq(e){let t=await e.text();if(t)try{return JSON.parse(t)}catch{return}}function Nq(e,t){let a=e.endsWith("/")?e:`${e}/`,n=t.startsWith("/")?t.slice(1):t;return`${a}${n}`}function Uq(e){return e instanceof Error?e.message:String(e)}function b1(e){let{apiUrl:t,endpointPath:a}=Bq(e.endpoint),n=x1({apiUrl:t,apiKey:e.token,endpointPath:a,flushIntervalMs:e.flushIntervalMs}),r,o=s=>typeof s=="function"?s():s,i=async s=>{let l=e.identity?.()??{},u=o(e.channelId),c=u===void 0?s.properties:{channelId:u,...s.properties},d=y1({sessionId:l.sessionId,visitorId:l.visitorId,externalUserId:l.externalUserId??r,traceId:l.traceId,...s,properties:c,metadata:{...e.metadata,...s.metadata}},{source:o(e.source)});return n.enqueue(d),{eventId:d.id}};return{track:Object.assign(i,w1(i)),identify(s,l){return r=s,i({event:"user.identified",externalUserId:s,properties:l})},flush:()=>n.flush(),shutdown:s=>n.shutdown(s)}}function Bq(e){let t=new URL(e);return{apiUrl:t.origin,endpointPath:`${t.pathname}${t.search}`}}function Na(e,t,a){let[n,r=""]=e.split("?"),o=n.replace(/\/$/,""),i=new URLSearchParams(r);if(a)for(let[l,u]of Object.entries(a))i.set(l,u);let s=i.toString();return`${o}${t}${s?`?${s}`:""}`}var zq="/api/mcp/";function Fp(e,t){let[a=""]=e.split("?"),n="",r=a;try{let o=new URL(a);n=o.origin,r=o.pathname}catch{if(!a.startsWith("/"))return null}return r.startsWith(zq)?`${n}${t}`:null}function Fq(){if(typeof window>"u")return!1;try{return window.WANIWANI_DEBUG?!0:!!window.localStorage?.getItem("WANIWANI_DEBUG")}catch{return!1}}function Ua(...e){Fq()&&console.log("[Waniwani]",...e)}var $w="waniwani-visitor-id";function qq(){try{if(typeof crypto<"u"){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto.getRandomValues=="function"){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,a=>a.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}}}catch{}return`v-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function ma(){try{let t=localStorage.getItem($w);if(t)return t}catch{}let e=qq();try{localStorage.setItem($w,e)}catch{}return e}function wl(e){let t=typeof e=="string"?e.trim():"";if(!t)return ma();try{localStorage.setItem($w,t)}catch{}return t}function Hq(e){return e!=null&&typeof e.then=="function"}function Sc(e){let t=!1,a=()=>{t=!0};if(e==null)return a;let n;try{n=typeof e=="function"?e():e}catch{return a}return Hq(n)?n.then(r=>{t||wl(r??"")},()=>{}):wl(n??""),a}var jq="waniwani-memory";var yn="threads",qp="by_memoryUserId",Vq="by_updatedAt";var I1="memoryUserId",S1="waniwani-memory-user-id",Ww=null;function Gw(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function $q(e,t){if(t<1&&(e.objectStoreNames.contains("ids")||e.createObjectStore("ids")),t<2&&!e.objectStoreNames.contains(yn)){let a=e.createObjectStore(yn,{keyPath:"threadId"});a.createIndex(qp,"memoryUserId",{unique:!1}),a.createIndex(Vq,"updatedAt",{unique:!1})}}async function Xw(){return new Promise((e,t)=>{let a=indexedDB.open(jq,2);a.onupgradeneeded=n=>{$q(a.result,n.oldVersion)},a.onsuccess=()=>e(a.result),a.onerror=()=>t(a.error)})}async function Wq(){return Xw()}async function Gq(e){return new Promise((t,a)=>{let o=e.transaction("ids","readonly").objectStore("ids").get(I1);o.onsuccess=()=>t(typeof o.result=="string"?o.result:null),o.onerror=()=>a(o.error)})}async function Xq(e,t){return new Promise((a,n)=>{let i=e.transaction("ids","readwrite").objectStore("ids").put(t,I1);i.onsuccess=()=>a(),i.onerror=()=>n(i.error)})}async function Kq(){if(typeof indexedDB>"u")return null;try{let e=await Wq();try{let t=await Gq(e);if(t)return t;let a=Gw();return await Xq(e,a),a}finally{e.close()}}catch{return null}}function Yq(){try{let e=localStorage.getItem(S1);if(e)return e;let t=Gw();return localStorage.setItem(S1,t),t}catch{return null}}async function C1(){let e=await Kq();if(e)return e;let t=Yq();return t||(Ww||(Ww=Gw()),Ww)}function k1(e,t){return e.match(t)?.[1]??null}function Zq(e){let t=[["Edge",/Edg(?:e|A|iOS)?\/(\S+)/],["Opera",/(?:OPR|Opera)\/(\S+)/],["Samsung Internet",/SamsungBrowser\/(\S+)/],["Firefox",/Firefox\/(\S+)/],["Chrome",/Chrome\/(\S+)/],["Safari",/Version\/(\S+).*Safari/]];for(let[a,n]of t){let r=k1(e,n);if(r)return{name:a,version:r}}return null}function Jq(e){let t=[["iOS",/(?:iPhone|iPad|iPod).+?OS (\d+[_.\d]*)/],["Android",/Android (\d+[.\d]*)/],["macOS",/Mac OS X (\d+[_.\d]*)/],["Windows",/Windows NT (\d+[.\d]*)/],["ChromeOS",/CrOS \S+ (\d+[.\d]*)/],["Linux",/Linux/]];for(let[a,n]of t){let r=k1(e,n);if(r)return{name:a,version:r.replace(/_/g,".")};if(a==="Linux"&&n.test(e))return{name:a,version:""}}return null}function Qq(e){return typeof navigator<"u"&&"userAgentData"in navigator&&navigator.userAgentData?.mobile?"mobile":/iPad|tablet|PlayBook/i.test(e)?"tablet":/Mobi|Android.*Mobile|iPhone|iPod/i.test(e)?"mobile":"desktop"}async function Ic(){let e=navigator.userAgent,t=ma(),a=await C1();return{userAgent:e,browser:Zq(e),os:Jq(e),deviceType:Qq(e),language:navigator.language,languages:[...navigator.languages],timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenWidth:screen.width,screenHeight:screen.height,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,colorDepth:screen.colorDepth,devicePixelRatio:window.devicePixelRatio??1,touchSupport:"ontouchstart"in window||navigator.maxTouchPoints>0,connectionType:navigator.connection?.effectiveType??"unknown",referrer:document.referrer,visitorId:t,memoryUserId:a}}var e4="0.22.1",t4=40,a4=10,n4=6e5;function Yw(){return typeof performance>"u"?0:performance.now()}function Zw(e,t){let a={};return{metrics:a,has:n=>n in a,set(n,r){a[n]=r},mark(n,r=Yw()){if(!(n in a)){a[n]=r-t;try{performance.mark(`waniwani:${e}:${n}`,{startTime:r})}catch{}}}}}function r4(e){let t={};for(let[a,n]of Object.entries(e)){if(Object.keys(t).length>=t4)break;if(!Number.isFinite(n))continue;let r=Math.round(n);r<0||r>n4||(t[a]=r)}return t}function o4(e){let t={};for(let[a,n]of Object.entries(e)){if(Object.keys(t).length>=a4)break;(typeof n=="string"||typeof n=="boolean")&&(t[a]=n)}return t}function i4(){let e=navigator.connection;if(e)return{effectiveType:e.effectiveType,rtt:e.rtt,downlink:e.downlink,saveData:e.saveData}}function jp(e){let t=e?.Authorization;return typeof t=="string"&&t.startsWith("Bearer ")?t.slice(7):void 0}function s4(e,t,a,n){return{kind:e,sdkVersion:e4,channelId:t.channelId||void 0,sessionId:e==="boot"?void 0:t.sessionId||void 0,visitorId:ma(),pageHost:window.location.hostname,connection:i4(),tags:o4(a),metrics:r4(n)}}var Kw,Hp=[];function Jw(e){let t=String(e?.chatTimingLogs).trim().toLowerCase()==="true";Kw=t;let a=Hp;if(Hp=[],t)for(let n of a)n()}function Vp(e,t,a,n){let{api:r,token:o}=t;if(!(typeof window>"u"||!r||!o||Kw===!1))try{let i=s4(e,t,a,n),s=()=>{Ua("timing",i),fetch(Na(r,"/timing"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify(i),keepalive:!0}).catch(()=>{})};Kw?s():Hp.length<20&&Hp.push(s)}catch{}}var Wr=Zw("boot",0),T1;function Di(e,t){Wr.mark(e,t)}function $p(e){T1??(T1=e)}var l4=/cdn\.jsdelivr\.net\/npm\/@waniwani\/sdk@[^/]+\/dist\/chat\/embed\.js/,u4=/\/embed\.js(\?|$)/;function c4(){if(typeof performance>"u")return;let e=performance.getEntriesByType("navigation")[0];e?.responseStart&&Wr.mark("navTtfb",e.responseStart),e?.domContentLoadedEventEnd&&Wr.mark("navDomContentLoaded",e.domContentLoadedEventEnd);let t=performance.getEntriesByType("resource");for(let a of t)l4.test(a.name)?(Wr.mark("bundleStart",a.startTime),Wr.mark("bundleEnd",a.responseEnd)):u4.test(a.name)&&(Wr.mark("loaderStart",a.startTime),Wr.mark("loaderEnd",a.responseEnd))}function d4(){if(bI)return!0;try{return document.querySelectorAll('script[src*="@waniwani/sdk"]').length>1}catch{return!1}}function L1(e){c4(),Wr.mark("bundleExecuted",xI),Vp("boot",e,{configSource:T1,mode:e.mode,secondSdk:d4()},Wr.metrics)}var f4=[["text-delta","firstText"],["tool-input-start","firstToolInput"],["tool-output-available","firstToolOutput"]];function E1(e){let t=Zw("turn",Yw());t.set("turnIndex",e);let a=!1;return{mark:n=>t.mark(n),instrument(n){if(!n.ok||!n.body||typeof TransformStream>"u")return n;try{let r=new TextDecoder,o=n.body.pipeThrough(new TransformStream({transform(i,s){t.mark("firstChunk");let l=r.decode(i,{stream:!0});for(let[u,c]of f4)!t.has(c)&&l.includes(u)&&t.mark(c);s.enqueue(i)}}));return new Response(o,{status:n.status,statusText:n.statusText,headers:n.headers})}catch{return n}},report(n,r){a||(a=!0,Vp("turn",n,r,t.metrics))}}}function p4(e){let t=e.indexOf("?");return t===-1?e:e.slice(0,t)}function A1(e,t){let a=Zw("widget",Yw()),n=!1;return{mark:r=>a.mark(r),has:r=>a.has(r),report(r,o){n||(n=!0,a.set("retries",o),t({widget:p4(e),outcome:r,metrics:a.metrics}))}}}var m4="/api/mcp/events/v2/batch",Qw=new Set;function h4(e,t,a){return`${e}|${t}|${a??""}`}function Cc(e){return Fp(e,m4)}async function M1(e){let{api:t,token:a,channelId:n,mode:r,source:o}=e;if(typeof window>"u"||!t||!a)return;let i=Cc(t);if(!i){Ua("page.viewed skipped: the chat api is not a Waniwani endpoint");return}if(!n&&!o){Ua("page.viewed skipped: no channelId or source to attribute it");return}let s=h4(t,a,n);if(!Qw.has(s)){Qw.add(s);try{let l=await Ic(),u=new Date().toISOString(),c=JSON.stringify({sentAt:u,source:{sdk:"@waniwani/sdk",version:"0.1.0"},events:[{id:crypto.randomUUID(),type:"mcp.event",name:"page.viewed",source:o,timestamp:u,correlation:{visitorId:l.visitorId},properties:{channelId:n,mode:r,url:window.location.href,referrer:l.referrer,deviceType:l.deviceType,language:l.language,timezone:l.timezone},metadata:{}}]}),d=fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:c,keepalive:!0});Di("pageViewSent"),await d}catch{Qw.delete(s)}}}function R1(e){let t=Cc(e.api);return t?b1({endpoint:t,token:e.token,channelId:e.channelId,source:e.getSource,identity:()=>({sessionId:e.getSessionId(),visitorId:ma()})}):Wp("the chat api does not point at a Waniwani event ingest")}function Wp(e){let t=!1,a=async()=>(t||(t=!0,console.warn(`[Waniwani] track() is disabled: ${e}`)),{eventId:""});return{track:Object.assign(a,{priceShown:a,pricesCompared:a,optionSelected:a,leadQualified:a,converted:a}),identify:a,flush:async()=>{},shutdown:async()=>({timedOut:!1,pendingEvents:0})}}var Xp=j(Ee());var Gp=(...e)=>e.filter((t,a,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===a).join(" ").trim();var D1=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var _1=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,a,n)=>n?n.toUpperCase():a.toLowerCase());var ev=e=>{let t=_1(e);return t.charAt(0).toUpperCase()+t.slice(1)};var kc=j(Ee());var P1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var O1=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var N1=(0,kc.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:n,className:r="",children:o,iconNode:i,...s},l)=>(0,kc.createElement)("svg",{ref:l,...P1,width:t,height:t,stroke:e,strokeWidth:n?Number(a)*24/Number(t):a,className:Gp("lucide",r),...!o&&!O1(s)&&{"aria-hidden":"true"},...s},[...i.map(([u,c])=>(0,kc.createElement)(u,c)),...Array.isArray(o)?o:[o]]));var tt=(e,t)=>{let a=(0,Xp.forwardRef)(({className:n,...r},o)=>(0,Xp.createElement)(N1,{ref:o,iconNode:t,className:Gp(`lucide-${D1(ev(e))}`,`lucide-${e}`,n),...r}));return a.displayName=ev(e),a};var g4=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Tc=tt("arrow-down",g4);var y4=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],pr=tt("arrow-up",y4);var w4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Lc=tt("check",w4);var v4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],zo=tt("chevron-down",v4);var x4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ec=tt("chevron-right",x4);var b4=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]],Ac=tt("clipboard-copy",b4);var S4=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Gr=tt("clock",S4);var I4=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Mc=tt("file-text",I4);var C4=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],vl=tt("file",C4);var k4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Rc=tt("globe",k4);var T4=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Dc=tt("image",T4);var L4=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],_c=tt("loader",L4);var E4=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],xl=tt("paperclip",E4);var A4=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Pc=tt("square",A4);var M4=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],_i=tt("wrench",M4);var R4=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],wn=tt("x",R4);var D4=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Oc=tt("zap",D4);var rt=j(Ee(),1),qB=j(gg(),1);var bl=j(Ee(),1),Nc=j(me(),1);function O4(e){return 1-(1-e)**3}function N4({start:e=0,end:t=100,duration:a=1e3,delay:n=0,ease:r=O4,onUpdate:o,onEnd:i}){let s=performance.now()+n;function l(){let u=performance.now()-s,c=Math.min(u/a,1);o(e+(t-e)*r(c)),c<1?requestAnimationFrame(l):i&&i()}setTimeout(()=>requestAnimationFrame(l),n)}var U4=["80% 55%","69% 34%","8% 6%","41% 38%","86% 85%","82% 18%","51% 4%"],B4=[0,1,2,0,1,2,1];function z4(e){let t=[];for(let a=0;a<7;a++){let n=e[Math.min(B4[a],e.length-1)];t.push(`radial-gradient(at ${U4[a]}, ${n} 0px, transparent 50%)`)}return t.push(`linear-gradient(${e[0]} 0 100%)`),t}var F4=({children:e,className:t="",style:a,edgeSensitivity:n=30,backgroundColor:r="#120F17",borderRadius:o=28,coneSpread:i=25,animated:s=!1,colors:l=["#c084fc","#f472b6","#38bdf8"]})=>{let[u,c]=(0,bl.useState)(110),[d,p]=(0,bl.useState)(0),[m,h]=(0,bl.useState)(!1);(0,bl.useEffect)(()=>{if(!s)return;let E=110;h(!0),c(E),N4({ease:T=>T,duration:2e3,onUpdate:T=>{let R=T/100;c(E+360*R);let O=Math.min(R/.1,1),U=R>.85?(1-R)/.15:1;p(Math.min(O,U))},onEnd:()=>h(!1)})},[s]);let v=n+20,I=m?Math.max(0,(d*100-v)/(100-v)):0,w=z4(l).map(E=>`${E} border-box`),S=`conic-gradient(from ${`${u.toFixed(3)}deg`} at center, black ${i}%, transparent ${i+15}%, transparent ${100-i-15}%, black ${100-i}%)`;return(0,Nc.jsxs)("div",{className:`ww:relative ww:grid ww:isolate ww:border ${t}`,style:{background:r,borderRadius:typeof o=="number"?`${o}px`:o,transform:"translate3d(0, 0, 0.01px)",...a},children:[(0,Nc.jsx)("div",{className:"ww:absolute ww:inset-0 ww:rounded-[inherit] ww:-z-[1]",style:{border:"1px solid transparent",background:[`linear-gradient(${r} 0 100%) padding-box`,"linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box",...w].join(", "),opacity:I,maskImage:S,WebkitMaskImage:S,transition:m?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"}}),(0,Nc.jsx)("div",{className:"ww:flex ww:flex-col ww:relative ww:overflow-auto ww:z-[1]",children:e})]})},Yp=F4;tv();nv();var q4=q1({prefix:"ww"});function V(...e){return q4(Zp(e))}var Uc=j(me(),1);function Sl({suggestions:e,isLoading:t,onSelect:a,align:n="start",className:r,...o}){return e.length===0&&!t?null:(0,Uc.jsx)("div",{className:V("ww:px-4 ww:py-2",r),...o,children:(0,Uc.jsx)("div",{className:V("ww:mx-auto ww:w-full ww:max-w-3xl ww:flex ww:flex-wrap ww:gap-2",n==="center"&&"ww:justify-center"),children:t?[0,1,2].map(i=>(0,Uc.jsx)("div",{className:"ww:h-8 ww:rounded-full ww:bg-accent ww:animate-pulse",style:{width:`${60+i*20}px`}},i)):e.map((i,s)=>(0,Uc.jsx)("button",{type:"button",onClick:()=>a(i),className:V("ww:rounded-full ww:border ww:border-border ww:bg-accent ww:px-3.5 ww:py-1.5 ww:text-sm","ww:text-foreground ww:hover:bg-border ww:hover:border-primary/30","ww:transition-all ww:duration-200 ww:ease-out ww:cursor-pointer","ww:animate-[ww-fade-in_0.2s_ease-out_both]"),style:{animationDelay:`${s*50}ms`},children:i},i))})})}var gm=j(Ee(),1);var gL="vercel.ai.error",H4=Symbol.for(gL),H1,j1,Je=class yL extends(j1=Error,H1=H4,j1){constructor({name:t,message:a,cause:n}){super(a),this[H1]=!0,this.name=t,this.cause=n}static isInstance(t){return yL.hasMarker(t,gL)}static hasMarker(t,a){let n=Symbol.for(a);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}},wL="AI_APICallError",vL=`vercel.ai.error.${wL}`,j4=Symbol.for(vL),V1,$1,GQ=class extends($1=Je,V1=j4,$1){constructor({message:e,url:t,requestBodyValues:a,statusCode:n,responseHeaders:r,responseBody:o,cause:i,isRetryable:s=n!=null&&(n===408||n===409||n===429||n>=500),data:l}){super({name:wL,message:e,cause:i}),this[V1]=!0,this.url=t,this.requestBodyValues=a,this.statusCode=n,this.responseHeaders=r,this.responseBody=o,this.isRetryable=s,this.data=l}static isInstance(e){return Je.hasMarker(e,vL)}},xL="AI_EmptyResponseBodyError",bL=`vercel.ai.error.${xL}`,V4=Symbol.for(bL),W1,G1,XQ=class extends(G1=Je,W1=V4,G1){constructor({message:e="Empty response body"}={}){super({name:xL,message:e}),this[W1]=!0}static isInstance(e){return Je.hasMarker(e,bL)}};function SL(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var IL="AI_InvalidArgumentError",CL=`vercel.ai.error.${IL}`,$4=Symbol.for(CL),X1,K1,kL=class extends(K1=Je,X1=$4,K1){constructor({message:e,cause:t,argument:a}){super({name:IL,message:e,cause:t}),this[X1]=!0,this.argument=a}static isInstance(e){return Je.hasMarker(e,CL)}},TL="AI_InvalidPromptError",LL=`vercel.ai.error.${TL}`,W4=Symbol.for(LL),Y1,Z1,KQ=class extends(Z1=Je,Y1=W4,Z1){constructor({prompt:e,message:t,cause:a}){super({name:TL,message:`Invalid prompt: ${t}`,cause:a}),this[Y1]=!0,this.prompt=e}static isInstance(e){return Je.hasMarker(e,LL)}},EL="AI_InvalidResponseDataError",AL=`vercel.ai.error.${EL}`,G4=Symbol.for(AL),J1,Q1,YQ=class extends(Q1=Je,J1=G4,Q1){constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:EL,message:t}),this[J1]=!0,this.data=e}static isInstance(e){return Je.hasMarker(e,AL)}},ML="AI_JSONParseError",RL=`vercel.ai.error.${ML}`,X4=Symbol.for(RL),eL,tL,ov=class extends(tL=Je,eL=X4,tL){constructor({text:e,cause:t}){super({name:ML,message:`JSON parsing failed: Text: ${e}.
122
+ Error message: ${SL(t)}`,cause:t}),this[eL]=!0,this.text=e}static isInstance(e){return Je.hasMarker(e,RL)}},DL="AI_LoadAPIKeyError",_L=`vercel.ai.error.${DL}`,K4=Symbol.for(_L),aL,nL,ZQ=class extends(nL=Je,aL=K4,nL){constructor({message:e}){super({name:DL,message:e}),this[aL]=!0}static isInstance(e){return Je.hasMarker(e,_L)}},PL="AI_LoadSettingError",OL=`vercel.ai.error.${PL}`,Y4=Symbol.for(OL),rL,oL,JQ=class extends(oL=Je,rL=Y4,oL){constructor({message:e}){super({name:PL,message:e}),this[rL]=!0}static isInstance(e){return Je.hasMarker(e,OL)}},NL="AI_NoContentGeneratedError",UL=`vercel.ai.error.${NL}`,Z4=Symbol.for(UL),iL,sL,QQ=class extends(sL=Je,iL=Z4,sL){constructor({message:e="No content generated."}={}){super({name:NL,message:e}),this[iL]=!0}static isInstance(e){return Je.hasMarker(e,UL)}},BL="AI_NoSuchModelError",zL=`vercel.ai.error.${BL}`,J4=Symbol.for(zL),lL,uL,eee=class extends(uL=Je,lL=J4,uL){constructor({errorName:e=BL,modelId:t,modelType:a,message:n=`No such ${a}: ${t}`}){super({name:e,message:n}),this[lL]=!0,this.modelId=t,this.modelType=a}static isInstance(e){return Je.hasMarker(e,zL)}},FL="AI_TooManyEmbeddingValuesForCallError",qL=`vercel.ai.error.${FL}`,Q4=Symbol.for(qL),cL,dL,tee=class extends(dL=Je,cL=Q4,dL){constructor(e){super({name:FL,message:`Too many values for a single embedding call. The ${e.provider} model "${e.modelId}" can only embed up to ${e.maxEmbeddingsPerCall} values per call, but ${e.values.length} values were provided.`}),this[cL]=!0,this.provider=e.provider,this.modelId=e.modelId,this.maxEmbeddingsPerCall=e.maxEmbeddingsPerCall,this.values=e.values}static isInstance(e){return Je.hasMarker(e,qL)}},HL="AI_TypeValidationError",jL=`vercel.ai.error.${HL}`,e5=Symbol.for(jL),fL,pL,Kn=class rv extends(pL=Je,fL=e5,pL){constructor({value:t,cause:a,context:n}){let r="Type validation failed";if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=" (";let o=[];n.entityName&&o.push(n.entityName),n.entityId&&o.push(`id: "${n.entityId}"`),r+=o.join(", "),r+=")"}super({name:HL,message:`${r}: Value: ${JSON.stringify(t)}.
123
+ Error message: ${SL(a)}`,cause:a}),this[fL]=!0,this.value=t,this.context=n}static isInstance(t){return Je.hasMarker(t,jL)}static wrap({value:t,cause:a,context:n}){var r,o,i;return rv.isInstance(a)&&a.value===t&&((r=a.context)==null?void 0:r.field)===n?.field&&((o=a.context)==null?void 0:o.entityName)===n?.entityName&&((i=a.context)==null?void 0:i.entityId)===n?.entityId?a:new rv({value:t,cause:a,context:n})}},VL="AI_UnsupportedFunctionalityError",$L=`vercel.ai.error.${VL}`,t5=Symbol.for($L),mL,hL,aee=class extends(hL=Je,mL=t5,hL){constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:VL,message:t}),this[mL]=!0,this.functionality=e}static isInstance(e){return Je.hasMarker(e,$L)}};var Jp=()=>sv,sv=new Proxy(Jp,{get(e,t){return t==="parse"||t==="parseAsync"?a=>a:t==="safeParse"||t==="safeParseAsync"?a=>({success:!0,data:a}):t==="_def"?{}:t==="jsonSchema"?{}:Jp},apply(){return sv}}),iv=class extends Error{constructor(){super(...arguments);K(this,"issues",[])}},f=new Proxy(Jp,{get(e,t){return t==="ZodError"?iv:t==="NEVER"?Symbol("NEVER"):Jp},apply(){return sv}});var Me={};var Qp=class extends Error{constructor(t,a){super(t),this.name="ParseError",this.type=a.type,this.field=a.field,this.value=a.value,this.line=a.line}};function lv(e){}function WL(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=lv,onError:a=lv,onRetry:n=lv,onComment:r}=e,o="",i=!0,s,l="",u="";function c(v){let I=i?v.replace(/^\xEF\xBB\xBF/,""):v,[y,w]=a5(`${o}${I}`);for(let g of y)d(g);o=w,i=!1}function d(v){if(v===""){m();return}if(v.startsWith(":")){r&&r(v.slice(v.startsWith(": ")?2:1));return}let I=v.indexOf(":");if(I!==-1){let y=v.slice(0,I),w=v[I+1]===" "?2:1,g=v.slice(I+w);p(y,g,v);return}p(v,"",v)}function p(v,I,y){switch(v){case"event":u=I;break;case"data":l=`${l}${I}
124
124
  `;break;case"id":s=I.includes("\0")?void 0:I;break;case"retry":/^\d+$/.test(I)?n(parseInt(I,10)):a(new Qp(`Invalid \`retry\` value: "${I}"`,{type:"invalid-retry",value:I,line:y}));break;default:a(new Qp(`Unknown field "${v.length>20?`${v.slice(0,20)}\u2026`:v}"`,{type:"unknown-field",field:v,value:I,line:y}));break}}function m(){l.length>0&&t({id:s,event:u||void 0,data:l.endsWith(`
125
125
  `)?l.slice(0,-1):l}),s=void 0,l="",u=""}function h(v={}){o&&v.consume&&d(o),i=!0,s=void 0,l="",u="",o=""}return{feed:c,reset:h}}function a5(e){let t=[],a="",n=0;for(;n<e.length;){let r=e.indexOf("\r",n),o=e.indexOf(`
126
126
  `,n),i=-1;if(r!==-1&&o!==-1?i=Math.min(r,o):r!==-1?r===e.length-1?i=-1:i=r:o!==-1&&(i=o),i===-1){a=e.slice(n);break}else{let s=e.slice(n,i);t.push(s),n=i+1,e[n-1]==="\r"&&e[n]===`
127
- `&&n++}}return[t,a]}var em=class extends TransformStream{constructor({onError:t,onRetry:a,onComment:n}={}){let r;super({start(o){r=WL({onEvent:i=>{o.enqueue(i)},onError(i){t==="terminate"?o.error(i):typeof t=="function"&&t(i)},onRetry:a,onComment:n})},transform(o){r.feed(o)}})}};var{btoa:vee,atob:xee}=globalThis;var JL="AI_DownloadError",QL=`vercel.ai.error.${JL}`,n5=Symbol.for(QL),GL,XL,On=class extends(XL=Je,GL=n5,XL){constructor({url:e,statusCode:t,statusText:a,cause:n,message:r=n==null?`Failed to download ${e}: ${t} ${a}`:`Failed to download ${e}: ${n}`}){super({name:JL,message:r,cause:n}),this[GL]=!0,this.url=e,this.statusCode=t,this.statusText=a}static isInstance(e){return Je.hasMarker(e,QL)}},mv=2*1024*1024*1024;async function eE({response:e,url:t,maxBytes:a=mv}){let n=e.headers.get("content-length");if(n!=null){let c=parseInt(n,10);if(!isNaN(c)&&c>a)throw new On({url:t,message:`Download of ${t} exceeded maximum size of ${a} bytes (Content-Length: ${c}).`})}let r=e.body;if(r==null)return new Uint8Array(0);let o=r.getReader(),i=[],s=0;try{for(;;){let{done:c,value:d}=await o.read();if(c)break;if(s+=d.length,s>a)throw new On({url:t,message:`Download of ${t} exceeded maximum size of ${a} bytes.`});i.push(d)}}finally{try{await o.cancel()}finally{o.releaseLock()}}let l=new Uint8Array(s),u=0;for(let c of i)l.set(c,u),u+=c.length;return l}function hv(e){let t;try{t=new URL(e)}catch{throw new On({url:e,message:`Invalid URL: ${e}`})}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new On({url:e,message:`URL scheme must be http or https, got ${t.protocol}`});let a=t.hostname;if(!a)throw new On({url:e,message:"URL must have a hostname"});if(a==="localhost"||a.endsWith(".local")||a.endsWith(".localhost"))throw new On({url:e,message:`URL with hostname ${a} is not allowed`});if(a.startsWith("[")&&a.endsWith("]")){let n=a.slice(1,-1);if(r5(n))throw new On({url:e,message:`URL with IPv6 address ${a} is not allowed`});return}if(tE(a)){if(dv(a))throw new On({url:e,message:`URL with IP address ${a} is not allowed`});return}}function tE(e){let t=e.split(".");return t.length!==4?!1:t.every(a=>{let n=Number(a);return Number.isInteger(n)&&n>=0&&n<=255&&String(n)===a})}function dv(e){let t=e.split(".").map(Number),[a,n]=t;return a===0||a===10||a===127||a===169&&n===254||a===172&&n>=16&&n<=31||a===192&&n===168}function r5(e){let t=e.toLowerCase();if(t==="::1"||t==="::")return!0;if(t.startsWith("::ffff:")){let a=t.slice(7);if(tE(a))return dv(a);let n=a.split(":");if(n.length===2){let r=parseInt(n[0],16),o=parseInt(n[1],16);if(!isNaN(r)&&!isNaN(o)){let i=r>>8&255,s=r&255,l=o>>8&255,u=o&255;return dv(`${i}.${s}.${l}.${u}`)}}}return!!(t.startsWith("fc")||t.startsWith("fd")||t.startsWith("fe80"))}var mr=({prefix:e,size:t=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{let r=()=>{let o=a.length,i=new Array(t);for(let s=0;s<t;s++)i[s]=a[Math.random()*o|0];return i.join("")};if(e==null)return r;if(a.includes(n))throw new kL({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${a}".`});return()=>`${e}${n}${r()}`},gv=mr();function aE(e=globalThis){var t,a,n;return e.window?"runtime/browser":(t=e.navigator)!=null&&t.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:(n=(a=e.process)==null?void 0:a.versions)!=null&&n.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function Fo(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((a,n)=>{t[n.toLowerCase()]=a});else{Array.isArray(e)||(e=Object.entries(e));for(let[a,n]of e)n!=null&&(t[a.toLowerCase()]=n)}return t}function tm(e,...t){let a=new Headers(Fo(e)),n=a.get("user-agent")||"";return a.set("user-agent",[n,...t].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var o5=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i5=/"(?: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*:/;function KL(e){let t=JSON.parse(e);return t===null||typeof t!="object"||o5.test(e)===!1&&i5.test(e)===!1?t:s5(t)}function s5(e){let t=[e];for(;t.length;){let a=t;t=[];for(let n of a){if(Object.prototype.hasOwnProperty.call(n,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(n,"constructor")&&n.constructor!==null&&typeof n.constructor=="object"&&Object.prototype.hasOwnProperty.call(n.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(let r in n){let o=n[r];o&&typeof o=="object"&&t.push(o)}}}return e}function l5(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return KL(e)}try{return KL(e)}finally{Error.stackTraceLimit=t}}function yv(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;let{properties:a}=e;if(a!=null)for(let n of Object.keys(a))a[n]=Pi(a[n])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(Pi):Pi(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(Pi)),e.allOf!=null&&(e.allOf=e.allOf.map(Pi)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(Pi));let{definitions:t}=e;if(t!=null)for(let a of Object.keys(t))t[a]=Pi(t[a]);return e}function Pi(e){return typeof e=="boolean"?e:yv(e)}var u5=Symbol("Let zodToJsonSchema decide on which parser to use"),YL={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},c5=e=>typeof e=="string"?{...YL,name:e}:{...YL,...e};function vn(){return{}}function d5(e,t){var a,n,r;let o={type:"array"};return(a=e.type)!=null&&a._def&&((r=(n=e.type)==null?void 0:n._def)==null?void 0:r.typeName)!==Me.ZodAny&&(o.items=pt(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(o.minItems=e.minLength.value),e.maxLength&&(o.maxItems=e.maxLength.value),e.exactLength&&(o.minItems=e.exactLength.value,o.maxItems=e.exactLength.value),o}function f5(e){let t={type:"integer",format:"int64"};if(!e.checks)return t;for(let a of e.checks)switch(a.kind){case"min":a.inclusive?t.minimum=a.value:t.exclusiveMinimum=a.value;break;case"max":a.inclusive?t.maximum=a.value:t.exclusiveMaximum=a.value;break;case"multipleOf":t.multipleOf=a.value;break}return t}function p5(){return{type:"boolean"}}function nE(e,t){return pt(e.type._def,t)}var m5=(e,t)=>pt(e.innerType._def,t);function rE(e,t,a){let n=a??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((r,o)=>rE(e,t,r))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return h5(e)}}var h5=e=>{let t={type:"integer",format:"unix-time"};for(let a of e.checks)switch(a.kind){case"min":t.minimum=a.value;break;case"max":t.maximum=a.value;break}return t};function g5(e,t){return{...pt(e.innerType._def,t),default:e.defaultValue()}}function y5(e,t){return t.effectStrategy==="input"?pt(e.schema._def,t):vn()}function w5(e){return{type:"string",enum:Array.from(e.values)}}var v5=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function x5(e,t){let a=[pt(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),pt(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(r=>!!r),n=[];return a.forEach(r=>{if(v5(r))n.push(...r.allOf);else{let o=r;if("additionalProperties"in r&&r.additionalProperties===!1){let{additionalProperties:i,...s}=r;o=s}n.push(o)}}),n.length?{allOf:n}:void 0}function b5(e){let t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}var uv=void 0,Yn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(uv===void 0&&(uv=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),uv),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function oE(e,t){let a={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,n.value):n.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":Zn(a,"email",n.message,t);break;case"format:idn-email":Zn(a,"idn-email",n.message,t);break;case"pattern:zod":Ba(a,Yn.email,n.message,t);break}break;case"url":Zn(a,"uri",n.message,t);break;case"uuid":Zn(a,"uuid",n.message,t);break;case"regex":Ba(a,n.regex,n.message,t);break;case"cuid":Ba(a,Yn.cuid,n.message,t);break;case"cuid2":Ba(a,Yn.cuid2,n.message,t);break;case"startsWith":Ba(a,RegExp(`^${cv(n.value,t)}`),n.message,t);break;case"endsWith":Ba(a,RegExp(`${cv(n.value,t)}$`),n.message,t);break;case"datetime":Zn(a,"date-time",n.message,t);break;case"date":Zn(a,"date",n.message,t);break;case"time":Zn(a,"time",n.message,t);break;case"duration":Zn(a,"duration",n.message,t);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,n.value):n.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,n.value):n.value;break;case"includes":{Ba(a,RegExp(cv(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Zn(a,"ipv4",n.message,t),n.version!=="v4"&&Zn(a,"ipv6",n.message,t);break}case"base64url":Ba(a,Yn.base64url,n.message,t);break;case"jwt":Ba(a,Yn.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&Ba(a,Yn.ipv4Cidr,n.message,t),n.version!=="v4"&&Ba(a,Yn.ipv6Cidr,n.message,t);break}case"emoji":Ba(a,Yn.emoji(),n.message,t);break;case"ulid":{Ba(a,Yn.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Zn(a,"binary",n.message,t);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{Ba(a,Yn.base64,n.message,t);break}}break}case"nanoid":Ba(a,Yn.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return a}function cv(e,t){return t.patternStrategy==="escape"?I5(e):e}var S5=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function I5(e){let t="";for(let a=0;a<e.length;a++)S5.has(e[a])||(t+="\\"),t+=e[a];return t}function Zn(e,t,a,n){var r;e.format||(r=e.anyOf)!=null&&r.some(o=>o.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...a&&n.errorMessages&&{errorMessage:{format:a}}})):e.format=t}function Ba(e,t,a,n){var r;e.pattern||(r=e.allOf)!=null&&r.some(o=>o.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:ZL(t,n),...a&&n.errorMessages&&{errorMessage:{pattern:a}}})):e.pattern=ZL(t,n)}function ZL(e,t){var a;if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},r=n.i?e.source.toLowerCase():e.source,o="",i=!1,s=!1,l=!1;for(let u=0;u<r.length;u++){if(i){o+=r[u],i=!1;continue}if(n.i){if(s){if(r[u].match(/[a-z]/)){l?(o+=r[u],o+=`${r[u-2]}-${r[u]}`.toUpperCase(),l=!1):r[u+1]==="-"&&((a=r[u+2])!=null&&a.match(/[a-z]/))?(o+=r[u],l=!0):o+=`${r[u]}${r[u].toUpperCase()}`;continue}}else if(r[u].match(/[a-z]/)){o+=`[${r[u]}${r[u].toUpperCase()}]`;continue}}if(n.m){if(r[u]==="^"){o+=`(^|(?<=[\r
127
+ `&&n++}}return[t,a]}var em=class extends TransformStream{constructor({onError:t,onRetry:a,onComment:n}={}){let r;super({start(o){r=WL({onEvent:i=>{o.enqueue(i)},onError(i){t==="terminate"?o.error(i):typeof t=="function"&&t(i)},onRetry:a,onComment:n})},transform(o){r.feed(o)}})}};var{btoa:xee,atob:bee}=globalThis;var JL="AI_DownloadError",QL=`vercel.ai.error.${JL}`,n5=Symbol.for(QL),GL,XL,On=class extends(XL=Je,GL=n5,XL){constructor({url:e,statusCode:t,statusText:a,cause:n,message:r=n==null?`Failed to download ${e}: ${t} ${a}`:`Failed to download ${e}: ${n}`}){super({name:JL,message:r,cause:n}),this[GL]=!0,this.url=e,this.statusCode=t,this.statusText=a}static isInstance(e){return Je.hasMarker(e,QL)}},mv=2*1024*1024*1024;async function eE({response:e,url:t,maxBytes:a=mv}){let n=e.headers.get("content-length");if(n!=null){let c=parseInt(n,10);if(!isNaN(c)&&c>a)throw new On({url:t,message:`Download of ${t} exceeded maximum size of ${a} bytes (Content-Length: ${c}).`})}let r=e.body;if(r==null)return new Uint8Array(0);let o=r.getReader(),i=[],s=0;try{for(;;){let{done:c,value:d}=await o.read();if(c)break;if(s+=d.length,s>a)throw new On({url:t,message:`Download of ${t} exceeded maximum size of ${a} bytes.`});i.push(d)}}finally{try{await o.cancel()}finally{o.releaseLock()}}let l=new Uint8Array(s),u=0;for(let c of i)l.set(c,u),u+=c.length;return l}function hv(e){let t;try{t=new URL(e)}catch{throw new On({url:e,message:`Invalid URL: ${e}`})}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new On({url:e,message:`URL scheme must be http or https, got ${t.protocol}`});let a=t.hostname;if(!a)throw new On({url:e,message:"URL must have a hostname"});if(a==="localhost"||a.endsWith(".local")||a.endsWith(".localhost"))throw new On({url:e,message:`URL with hostname ${a} is not allowed`});if(a.startsWith("[")&&a.endsWith("]")){let n=a.slice(1,-1);if(r5(n))throw new On({url:e,message:`URL with IPv6 address ${a} is not allowed`});return}if(tE(a)){if(dv(a))throw new On({url:e,message:`URL with IP address ${a} is not allowed`});return}}function tE(e){let t=e.split(".");return t.length!==4?!1:t.every(a=>{let n=Number(a);return Number.isInteger(n)&&n>=0&&n<=255&&String(n)===a})}function dv(e){let t=e.split(".").map(Number),[a,n]=t;return a===0||a===10||a===127||a===169&&n===254||a===172&&n>=16&&n<=31||a===192&&n===168}function r5(e){let t=e.toLowerCase();if(t==="::1"||t==="::")return!0;if(t.startsWith("::ffff:")){let a=t.slice(7);if(tE(a))return dv(a);let n=a.split(":");if(n.length===2){let r=parseInt(n[0],16),o=parseInt(n[1],16);if(!isNaN(r)&&!isNaN(o)){let i=r>>8&255,s=r&255,l=o>>8&255,u=o&255;return dv(`${i}.${s}.${l}.${u}`)}}}return!!(t.startsWith("fc")||t.startsWith("fd")||t.startsWith("fe80"))}var mr=({prefix:e,size:t=16,alphabet:a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{let r=()=>{let o=a.length,i=new Array(t);for(let s=0;s<t;s++)i[s]=a[Math.random()*o|0];return i.join("")};if(e==null)return r;if(a.includes(n))throw new kL({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${a}".`});return()=>`${e}${n}${r()}`},gv=mr();function aE(e=globalThis){var t,a,n;return e.window?"runtime/browser":(t=e.navigator)!=null&&t.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:(n=(a=e.process)==null?void 0:a.versions)!=null&&n.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function Fo(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((a,n)=>{t[n.toLowerCase()]=a});else{Array.isArray(e)||(e=Object.entries(e));for(let[a,n]of e)n!=null&&(t[a.toLowerCase()]=n)}return t}function tm(e,...t){let a=new Headers(Fo(e)),n=a.get("user-agent")||"";return a.set("user-agent",[n,...t].filter(Boolean).join(" ")),Object.fromEntries(a.entries())}var o5=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i5=/"(?: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*:/;function KL(e){let t=JSON.parse(e);return t===null||typeof t!="object"||o5.test(e)===!1&&i5.test(e)===!1?t:s5(t)}function s5(e){let t=[e];for(;t.length;){let a=t;t=[];for(let n of a){if(Object.prototype.hasOwnProperty.call(n,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(n,"constructor")&&n.constructor!==null&&typeof n.constructor=="object"&&Object.prototype.hasOwnProperty.call(n.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(let r in n){let o=n[r];o&&typeof o=="object"&&t.push(o)}}}return e}function l5(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return KL(e)}try{return KL(e)}finally{Error.stackTraceLimit=t}}function yv(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;let{properties:a}=e;if(a!=null)for(let n of Object.keys(a))a[n]=Pi(a[n])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(Pi):Pi(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(Pi)),e.allOf!=null&&(e.allOf=e.allOf.map(Pi)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(Pi));let{definitions:t}=e;if(t!=null)for(let a of Object.keys(t))t[a]=Pi(t[a]);return e}function Pi(e){return typeof e=="boolean"?e:yv(e)}var u5=Symbol("Let zodToJsonSchema decide on which parser to use"),YL={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},c5=e=>typeof e=="string"?{...YL,name:e}:{...YL,...e};function vn(){return{}}function d5(e,t){var a,n,r;let o={type:"array"};return(a=e.type)!=null&&a._def&&((r=(n=e.type)==null?void 0:n._def)==null?void 0:r.typeName)!==Me.ZodAny&&(o.items=pt(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(o.minItems=e.minLength.value),e.maxLength&&(o.maxItems=e.maxLength.value),e.exactLength&&(o.minItems=e.exactLength.value,o.maxItems=e.exactLength.value),o}function f5(e){let t={type:"integer",format:"int64"};if(!e.checks)return t;for(let a of e.checks)switch(a.kind){case"min":a.inclusive?t.minimum=a.value:t.exclusiveMinimum=a.value;break;case"max":a.inclusive?t.maximum=a.value:t.exclusiveMaximum=a.value;break;case"multipleOf":t.multipleOf=a.value;break}return t}function p5(){return{type:"boolean"}}function nE(e,t){return pt(e.type._def,t)}var m5=(e,t)=>pt(e.innerType._def,t);function rE(e,t,a){let n=a??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((r,o)=>rE(e,t,r))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return h5(e)}}var h5=e=>{let t={type:"integer",format:"unix-time"};for(let a of e.checks)switch(a.kind){case"min":t.minimum=a.value;break;case"max":t.maximum=a.value;break}return t};function g5(e,t){return{...pt(e.innerType._def,t),default:e.defaultValue()}}function y5(e,t){return t.effectStrategy==="input"?pt(e.schema._def,t):vn()}function w5(e){return{type:"string",enum:Array.from(e.values)}}var v5=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function x5(e,t){let a=[pt(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),pt(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(r=>!!r),n=[];return a.forEach(r=>{if(v5(r))n.push(...r.allOf);else{let o=r;if("additionalProperties"in r&&r.additionalProperties===!1){let{additionalProperties:i,...s}=r;o=s}n.push(o)}}),n.length?{allOf:n}:void 0}function b5(e){let t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}var uv=void 0,Yn={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(uv===void 0&&(uv=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),uv),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function oE(e,t){let a={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,n.value):n.value;break;case"max":a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":Zn(a,"email",n.message,t);break;case"format:idn-email":Zn(a,"idn-email",n.message,t);break;case"pattern:zod":Ba(a,Yn.email,n.message,t);break}break;case"url":Zn(a,"uri",n.message,t);break;case"uuid":Zn(a,"uuid",n.message,t);break;case"regex":Ba(a,n.regex,n.message,t);break;case"cuid":Ba(a,Yn.cuid,n.message,t);break;case"cuid2":Ba(a,Yn.cuid2,n.message,t);break;case"startsWith":Ba(a,RegExp(`^${cv(n.value,t)}`),n.message,t);break;case"endsWith":Ba(a,RegExp(`${cv(n.value,t)}$`),n.message,t);break;case"datetime":Zn(a,"date-time",n.message,t);break;case"date":Zn(a,"date",n.message,t);break;case"time":Zn(a,"time",n.message,t);break;case"duration":Zn(a,"duration",n.message,t);break;case"length":a.minLength=typeof a.minLength=="number"?Math.max(a.minLength,n.value):n.value,a.maxLength=typeof a.maxLength=="number"?Math.min(a.maxLength,n.value):n.value;break;case"includes":{Ba(a,RegExp(cv(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Zn(a,"ipv4",n.message,t),n.version!=="v4"&&Zn(a,"ipv6",n.message,t);break}case"base64url":Ba(a,Yn.base64url,n.message,t);break;case"jwt":Ba(a,Yn.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&Ba(a,Yn.ipv4Cidr,n.message,t),n.version!=="v4"&&Ba(a,Yn.ipv6Cidr,n.message,t);break}case"emoji":Ba(a,Yn.emoji(),n.message,t);break;case"ulid":{Ba(a,Yn.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Zn(a,"binary",n.message,t);break}case"contentEncoding:base64":{a.contentEncoding="base64";break}case"pattern:zod":{Ba(a,Yn.base64,n.message,t);break}}break}case"nanoid":Ba(a,Yn.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return a}function cv(e,t){return t.patternStrategy==="escape"?I5(e):e}var S5=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function I5(e){let t="";for(let a=0;a<e.length;a++)S5.has(e[a])||(t+="\\"),t+=e[a];return t}function Zn(e,t,a,n){var r;e.format||(r=e.anyOf)!=null&&r.some(o=>o.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...a&&n.errorMessages&&{errorMessage:{format:a}}})):e.format=t}function Ba(e,t,a,n){var r;e.pattern||(r=e.allOf)!=null&&r.some(o=>o.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:ZL(t,n),...a&&n.errorMessages&&{errorMessage:{pattern:a}}})):e.pattern=ZL(t,n)}function ZL(e,t){var a;if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},r=n.i?e.source.toLowerCase():e.source,o="",i=!1,s=!1,l=!1;for(let u=0;u<r.length;u++){if(i){o+=r[u],i=!1;continue}if(n.i){if(s){if(r[u].match(/[a-z]/)){l?(o+=r[u],o+=`${r[u-2]}-${r[u]}`.toUpperCase(),l=!1):r[u+1]==="-"&&((a=r[u+2])!=null&&a.match(/[a-z]/))?(o+=r[u],l=!0):o+=`${r[u]}${r[u].toUpperCase()}`;continue}}else if(r[u].match(/[a-z]/)){o+=`[${r[u]}${r[u].toUpperCase()}]`;continue}}if(n.m){if(r[u]==="^"){o+=`(^|(?<=[\r
128
128
  ]))`;continue}else if(r[u]==="$"){o+=`($|(?=[\r
129
129
  ]))`;continue}}if(n.s&&r[u]==="."){o+=s?`${r[u]}\r
130
130
  `:`[${r[u]}\r
131
- ]`;continue}o+=r[u],r[u]==="\\"?i=!0:s&&r[u]==="]"?s=!1:!s&&r[u]==="["&&(s=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function iE(e,t){var a,n,r,o,i,s;let l={type:"object",additionalProperties:(a=pt(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?a:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===Me.ZodString&&((r=e.keyType._def.checks)!=null&&r.length)){let{type:u,...c}=oE(e.keyType._def,t);return{...l,propertyNames:c}}else{if(((o=e.keyType)==null?void 0:o._def.typeName)===Me.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===Me.ZodBranded&&e.keyType._def.type._def.typeName===Me.ZodString&&((s=e.keyType._def.type._def.checks)!=null&&s.length)){let{type:u,...c}=nE(e.keyType._def,t);return{...l,propertyNames:c}}}return l}function C5(e,t){if(t.mapStrategy==="record")return iE(e,t);let a=pt(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||vn(),n=pt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||vn();return{type:"array",maxItems:125,items:{type:"array",items:[a,n],minItems:2,maxItems:2}}}function k5(e){let t=e.values,n=Object.keys(e.values).filter(o=>typeof t[t[o]]!="number").map(o=>t[o]),r=Array.from(new Set(n.map(o=>typeof o)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:n}}function T5(){return{not:vn()}}function L5(){return{type:"null"}}var fv={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function E5(e,t){let a=e.options instanceof Map?Array.from(e.options.values()):e.options;if(a.every(n=>n._def.typeName in fv&&(!n._def.checks||!n._def.checks.length))){let n=a.reduce((r,o)=>{let i=fv[o._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:n.length>1?n:n[0]}}else if(a.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=a.reduce((r,o)=>{let i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(o._def.value===null)return[...r,"null"];default:return r}},[]);if(n.length===a.length){let r=n.filter((o,i,s)=>s.indexOf(o)===i);return{type:r.length>1?r:r[0],enum:a.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(a.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:a.reduce((n,r)=>[...n,...r._def.values.filter(o=>!n.includes(o))],[])};return A5(e,t)}var A5=(e,t)=>{let a=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,r)=>pt(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return a.length?{anyOf:a}:void 0};function M5(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[fv[e.innerType._def.typeName],"null"]};let a=pt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function R5(e){let t={type:"number"};if(!e.checks)return t;for(let a of e.checks)switch(a.kind){case"int":t.type="integer";break;case"min":a.inclusive?t.minimum=a.value:t.exclusiveMinimum=a.value;break;case"max":a.inclusive?t.maximum=a.value:t.exclusiveMaximum=a.value;break;case"multipleOf":t.multipleOf=a.value;break}return t}function D5(e,t){let a={type:"object",properties:{}},n=[],r=e.shape();for(let i in r){let s=r[i];if(s===void 0||s._def===void 0)continue;let l=P5(s),u=pt(s._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});u!==void 0&&(a.properties[i]=u,l||n.push(i))}n.length&&(a.required=n);let o=_5(e,t);return o!==void 0&&(a.additionalProperties=o),a}function _5(e,t){if(e.catchall._def.typeName!=="ZodNever")return pt(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function P5(e){try{return e.isOptional()}catch{return!0}}var O5=(e,t)=>{var a;if(t.currentPath.toString()===((a=t.propertyPath)==null?void 0:a.toString()))return pt(e.innerType._def,t);let n=pt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:vn()},n]}:vn()},N5=(e,t)=>{if(t.pipeStrategy==="input")return pt(e.in._def,t);if(t.pipeStrategy==="output")return pt(e.out._def,t);let a=pt(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=pt(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,n].filter(r=>r!==void 0)}};function U5(e,t){return pt(e.type._def,t)}function B5(e,t){let n={type:"array",uniqueItems:!0,items:pt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function z5(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((a,n)=>pt(a._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((a,n)=>n===void 0?a:[...a,n],[]),additionalItems:pt(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((a,n)=>pt(a._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((a,n)=>n===void 0?a:[...a,n],[])}}function F5(){return{not:vn()}}function q5(){return vn()}var H5=(e,t)=>pt(e.innerType._def,t),j5=(e,t,a)=>{switch(t){case Me.ZodString:return oE(e,a);case Me.ZodNumber:return R5(e);case Me.ZodObject:return D5(e,a);case Me.ZodBigInt:return f5(e);case Me.ZodBoolean:return p5();case Me.ZodDate:return rE(e,a);case Me.ZodUndefined:return F5();case Me.ZodNull:return L5();case Me.ZodArray:return d5(e,a);case Me.ZodUnion:case Me.ZodDiscriminatedUnion:return E5(e,a);case Me.ZodIntersection:return x5(e,a);case Me.ZodTuple:return z5(e,a);case Me.ZodRecord:return iE(e,a);case Me.ZodLiteral:return b5(e);case Me.ZodEnum:return w5(e);case Me.ZodNativeEnum:return k5(e);case Me.ZodNullable:return M5(e,a);case Me.ZodOptional:return O5(e,a);case Me.ZodMap:return C5(e,a);case Me.ZodSet:return B5(e,a);case Me.ZodLazy:return()=>e.getter()._def;case Me.ZodPromise:return U5(e,a);case Me.ZodNaN:case Me.ZodNever:return T5();case Me.ZodEffects:return y5(e,a);case Me.ZodAny:return vn();case Me.ZodUnknown:return q5();case Me.ZodDefault:return g5(e,a);case Me.ZodBranded:return nE(e,a);case Me.ZodReadonly:return H5(e,a);case Me.ZodCatch:return m5(e,a);case Me.ZodPipeline:return N5(e,a);case Me.ZodFunction:case Me.ZodVoid:case Me.ZodSymbol:return;default:return(n=>{})(t)}},V5=(e,t)=>{let a=0;for(;a<e.length&&a<t.length&&e[a]===t[a];a++);return[(e.length-a).toString(),...t.slice(a)].join("/")};function pt(e,t,a=!1){var n;let r=t.seen.get(e);if(t.override){let l=(n=t.override)==null?void 0:n.call(t,e,t,r,a);if(l!==u5)return l}if(r&&!a){let l=$5(r,t);if(l!==void 0)return l}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let i=j5(e,e.typeName,t),s=typeof i=="function"?pt(i(),t):i;if(s&&W5(e,t,s),t.postProcess){let l=t.postProcess(s,e,t);return o.jsonSchema=s,l}return o.jsonSchema=s,s}var $5=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:V5(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((a,n)=>t.currentPath[n]===a)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),vn()):t.$refStrategy==="seen"?vn():void 0}},W5=(e,t,a)=>(e.description&&(a.description=e.description),a),G5=e=>{let t=c5(e),a=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},X5=(e,t)=>{var a;let n=G5(t),r=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[c,d])=>{var p;return{...u,[c]:(p=pt(d._def,{...n,currentPath:[...n.basePath,n.definitionPath,c]},!0))!=null?p:vn()}},{}):void 0,o=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(a=pt(e._def,o===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,o]},!1))!=null?a:vn(),s=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;s!==void 0&&(i.title=s);let l=o===void 0?r?{...i,[n.definitionPath]:r}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,o].join("/"),[n.definitionPath]:{...r,[o]:i}};return l.$schema="http://json-schema.org/draft-07/schema#",l},pv=Symbol.for("vercel.ai.schema");function am(e){let t;return()=>(t==null&&(t=e()),t)}function Il(e,{validate:t}={}){return{[pv]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function K5(e){return typeof e=="object"&&e!==null&&pv in e&&e[pv]===!0&&"jsonSchema"in e&&"validate"in e}function Oi(e){return e==null?Il({properties:{},additionalProperties:!1}):K5(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?Cl(e):Y5(e):e()}function Y5(e){return Il(()=>yv(e["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async t=>{let a=await e["~standard"].validate(t);return"value"in a?{success:!0,value:a.value}:{success:!1,error:new Kn({value:t,cause:a.issues})}}})}function Z5(e,t){var a;let n=(a=t?.useReferences)!=null?a:!1;return Il(()=>X5(e,{$refStrategy:n?"root":"none"}),{validate:async r=>{let o=await e.safeParseAsync(r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function J5(e,t){var a;let n=(a=t?.useReferences)!=null?a:!1;return Il(()=>yv((void 0)(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async r=>{let o=await(void 0)(e,r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function Q5(e){return"_zod"in e}function Cl(e,t){return Q5(e)?J5(e,t):Z5(e,t)}async function nm({value:e,schema:t,context:a}){let n=await kl({value:e,schema:t,context:a});if(!n.success)throw Kn.wrap({value:e,cause:n.error,context:a});return n.value}async function kl({value:e,schema:t,context:a}){let n=Oi(t);try{if(n.validate==null)return{success:!0,value:e,rawValue:e};let r=await n.validate(e);return r.success?{success:!0,value:r.value,rawValue:e}:{success:!1,error:Kn.wrap({value:e,cause:r.error,context:a}),rawValue:e}}catch(r){return{success:!1,error:Kn.wrap({value:e,cause:r,context:a}),rawValue:e}}}async function Xr({text:e,schema:t}){try{let a=l5(e);return t==null?{success:!0,value:a,rawValue:a}:await kl({value:a,schema:t})}catch(a){return{success:!1,error:ov.isInstance(a)?a:new ov({text:e,cause:a}),rawValue:void 0}}}function wv({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new em).pipeThrough(new TransformStream({async transform({data:a},n){a!=="[DONE]"&&n.enqueue(await Xr({text:a,schema:t}))}}))}async function hr(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var tH=Object.defineProperty,aH=(e,t)=>{for(var a in t)tH(e,a,{get:t[a],enumerable:!0})},nH="AI_InvalidArgumentError",rH=`vercel.ai.error.${nH}`,oH=Symbol.for(rH),iH;iH=oH;var sH="AI_InvalidStreamPartError",lH=`vercel.ai.error.${sH}`,uH=Symbol.for(lH),cH;cH=uH;var dH="AI_InvalidToolApprovalError",fH=`vercel.ai.error.${dH}`,pH=Symbol.for(fH),mH;mH=pH;var hH="AI_InvalidToolInputError",gH=`vercel.ai.error.${hH}`,yH=Symbol.for(gH),wH;wH=yH;var vH="AI_ToolCallNotFoundForApprovalError",xH=`vercel.ai.error.${vH}`,bH=Symbol.for(xH),SH;SH=bH;var IH="AI_MissingToolResultsError",CH=`vercel.ai.error.${IH}`,kH=Symbol.for(CH),TH;TH=kH;var LH="AI_NoImageGeneratedError",EH=`vercel.ai.error.${LH}`,AH=Symbol.for(EH),MH;MH=AH;var lE="AI_NoObjectGeneratedError",uE=`vercel.ai.error.${lE}`,RH=Symbol.for(uE),cE,qo=class extends Je{constructor({message:e="No object generated.",cause:t,text:a,response:n,usage:r,finishReason:o}){super({name:lE,message:e,cause:t}),this[cE]=!0,this.text=a,this.response=n,this.usage=r,this.finishReason=o}static isInstance(e){return Je.hasMarker(e,uE)}};cE=RH;var DH="AI_NoOutputGeneratedError",_H=`vercel.ai.error.${DH}`,PH=Symbol.for(_H),OH;OH=PH;var NH="AI_NoSpeechGeneratedError",UH=`vercel.ai.error.${NH}`,BH=Symbol.for(UH),zH;zH=BH;var FH="AI_NoTranscriptGeneratedError",qH=`vercel.ai.error.${FH}`,HH=Symbol.for(qH),jH;jH=HH;var VH="AI_NoVideoGeneratedError",$H=`vercel.ai.error.${VH}`,WH=Symbol.for($H),GH;GH=WH;var XH="AI_NoSuchToolError",KH=`vercel.ai.error.${XH}`,YH=Symbol.for(KH),ZH;ZH=YH;var JH="AI_ToolCallRepairError",QH=`vercel.ai.error.${JH}`,e6=Symbol.for(QH),t6;t6=e6;var dE="AI_UIMessageStreamError",fE=`vercel.ai.error.${dE}`,a6=Symbol.for(fE),pE,Tl=class extends Je{constructor({chunkType:e,chunkId:t,message:a}){super({name:dE,message:a}),this[pE]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return Je.hasMarker(e,fE)}};pE=a6;var n6="AI_InvalidDataContentError",r6=`vercel.ai.error.${n6}`,o6=Symbol.for(r6),i6;i6=o6;var s6="AI_InvalidMessageRoleError",l6=`vercel.ai.error.${s6}`,u6=Symbol.for(l6),c6;c6=u6;var d6="AI_MessageConversionError",f6=`vercel.ai.error.${d6}`,p6=Symbol.for(f6),m6;m6=p6;var h6="AI_RetryError",g6=`vercel.ai.error.${h6}`,y6=Symbol.for(g6),w6;w6=y6;var v6="6.0.141",x6=async({url:e,maxBytes:t,abortSignal:a})=>{var n;let r=e.toString();hv(r);try{let o=await fetch(r,{headers:tm({},`ai-sdk/${v6}`,aE()),signal:a});if(o.redirected&&hv(o.url),!o.ok)throw new On({url:r,statusCode:o.status,statusText:o.statusText});return{data:await eE({response:o,url:r,maxBytes:t??mv}),mediaType:(n=o.headers.get("content-type"))!=null?n:void 0}}catch(o){throw On.isInstance(o)?o:new On({url:r,cause:o})}};var mE=f.union([f.string(),f.instanceof(Uint8Array),f.instanceof(ArrayBuffer),f.custom(e=>{var t,a;return(a=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?a:!1},{message:"Must be a Buffer"})]);var zc=f.lazy(()=>f.union([f.null(),f.string(),f.number(),f.boolean(),f.record(f.string(),zc.optional()),f.array(zc)])),pe=f.record(f.string(),f.record(f.string(),zc.optional())),hE=f.object({type:f.literal("text"),text:f.string(),providerOptions:pe.optional()}),b6=f.object({type:f.literal("image"),image:f.union([mE,f.instanceof(URL)]),mediaType:f.string().optional(),providerOptions:pe.optional()}),gE=f.object({type:f.literal("file"),data:f.union([mE,f.instanceof(URL)]),filename:f.string().optional(),mediaType:f.string(),providerOptions:pe.optional()}),S6=f.object({type:f.literal("reasoning"),text:f.string(),providerOptions:pe.optional()}),I6=f.object({type:f.literal("tool-call"),toolCallId:f.string(),toolName:f.string(),input:f.unknown(),providerOptions:pe.optional(),providerExecuted:f.boolean().optional()}),C6=f.discriminatedUnion("type",[f.object({type:f.literal("text"),value:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("json"),value:zc,providerOptions:pe.optional()}),f.object({type:f.literal("execution-denied"),reason:f.string().optional(),providerOptions:pe.optional()}),f.object({type:f.literal("error-text"),value:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("error-json"),value:zc,providerOptions:pe.optional()}),f.object({type:f.literal("content"),value:f.array(f.union([f.object({type:f.literal("text"),text:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("media"),data:f.string(),mediaType:f.string()}),f.object({type:f.literal("file-data"),data:f.string(),mediaType:f.string(),filename:f.string().optional(),providerOptions:pe.optional()}),f.object({type:f.literal("file-url"),url:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("file-id"),fileId:f.union([f.string(),f.record(f.string(),f.string())]),providerOptions:pe.optional()}),f.object({type:f.literal("image-data"),data:f.string(),mediaType:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("image-url"),url:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("image-file-id"),fileId:f.union([f.string(),f.record(f.string(),f.string())]),providerOptions:pe.optional()}),f.object({type:f.literal("custom"),providerOptions:pe.optional()})]))})]),yE=f.object({type:f.literal("tool-result"),toolCallId:f.string(),toolName:f.string(),output:C6,providerOptions:pe.optional()}),k6=f.object({type:f.literal("tool-approval-request"),approvalId:f.string(),toolCallId:f.string()}),T6=f.object({type:f.literal("tool-approval-response"),approvalId:f.string(),approved:f.boolean(),reason:f.string().optional()}),L6=f.object({role:f.literal("system"),content:f.string(),providerOptions:pe.optional()}),E6=f.object({role:f.literal("user"),content:f.union([f.string(),f.array(f.union([hE,b6,gE]))]),providerOptions:pe.optional()}),A6=f.object({role:f.literal("assistant"),content:f.union([f.string(),f.array(f.union([hE,gE,S6,I6,yE,k6]))]),providerOptions:pe.optional()}),M6=f.object({role:f.literal("tool"),content:f.array(f.union([yE,T6])),providerOptions:pe.optional()}),Xee=f.union([L6,E6,A6,M6]);function wE(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let a={...e};for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let r=t[n];if(r===void 0)continue;let o=n in e?e[n]:void 0,i=r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp),s=o!=null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp);i&&s?a[n]=wE(o,r):a[n]=r}return a}var R6={};aH(R6,{array:()=>O6,choice:()=>N6,json:()=>U6,object:()=>P6,text:()=>_6});function D6(e){let t=["ROOT"],a=-1,n=null;function r(l,u,c){switch(l){case'"':{a=u,t.pop(),t.push(c),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{a=u,n=u,t.pop(),t.push(c),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(c),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=u,t.pop(),t.push(c),t.push("INSIDE_NUMBER");break}case"{":{a=u,t.pop(),t.push(c),t.push("INSIDE_OBJECT_START");break}case"[":{a=u,t.pop(),t.push(c),t.push("INSIDE_ARRAY_START");break}}}function o(l,u){switch(l){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{a=u,t.pop();break}}}function i(l,u){switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=u,t.pop();break}}}for(let l=0;l<e.length;l++){let u=e[l];switch(t[t.length-1]){case"ROOT":r(u,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(u){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{a=l,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{u==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{u==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{u===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{r(u,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{o(u,l);break}case"INSIDE_STRING":{switch(u){case'"':{t.pop(),a=l;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:a=l}break}case"INSIDE_ARRAY_START":{u==="]"?(a=l,t.pop()):(a=l,r(u,l,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(u){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=l,t.pop();break}default:{a=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{r(u,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),a=l;break}case"INSIDE_NUMBER":{switch(u){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=l;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(u,l),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&o(u,l);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&o(u,l);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(u,l);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{let d=e.substring(n,l+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?o(u,l):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(u,l)):a=l;break}}}let s=e.slice(0,a+1);for(let l=t.length-1;l>=0;l--)switch(t[l]){case"INSIDE_STRING":{s+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{s+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{s+="]";break}case"INSIDE_LITERAL":{let c=e.substring(n,e.length);"true".startsWith(c)?s+="true".slice(c.length):"false".startsWith(c)?s+="false".slice(c.length):"null".startsWith(c)&&(s+="null".slice(c.length))}}return s}async function Fc(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await Xr({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await Xr({text:D6(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var _6=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),P6=({schema:e,name:t,description:a})=>{let n=Oi(e);return{name:"object",responseFormat:hr(n.jsonSchema).then(r=>({type:"json",schema:r,...t!=null&&{name:t},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},o){let i=await Xr({text:r});if(!i.success)throw new qo({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});let s=await kl({value:i.value,schema:n});if(!s.success)throw new qo({message:"No object generated: response did not match schema.",cause:s.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});return s.value},async parsePartialOutput({text:r}){let o=await Fc(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:o.value}}},createElementStreamTransform(){}}},O6=({element:e,name:t,description:a})=>{let n=Oi(e);return{name:"array",responseFormat:hr(n.jsonSchema).then(r=>{let{$schema:o,...i}=r;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...a!=null&&{description:a}}}),async parseCompleteOutput({text:r},o){let i=await Xr({text:r});if(!i.success)throw new qo({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});let s=i.value;if(s==null||typeof s!="object"||!("elements"in s)||!Array.isArray(s.elements))throw new qo({message:"No object generated: response did not match schema.",cause:new Kn({value:s,cause:"response must be an object with an elements array"}),text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});for(let l of s.elements){let u=await kl({value:l,schema:n});if(!u.success)throw new qo({message:"No object generated: response did not match schema.",cause:u.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason})}return s.elements},async parsePartialOutput({text:r}){let o=await Fc(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let i=o.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;let s=o.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,l=[];for(let u of s){let c=await kl({value:u,schema:n});c.success&&l.push(c.value)}return{partial:l}}}},createElementStreamTransform(){let r=0;return new TransformStream({transform({partialOutput:o},i){if(o!=null)for(;r<o.length;r++)i.enqueue(o[r])}})}}},N6=({options:e,name:t,description:a})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...a!=null&&{description:a}}),async parseCompleteOutput({text:n},r){let o=await Xr({text:n});if(!o.success)throw new qo({message:"No object generated: could not parse the response.",cause:o.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});let i=o.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!e.includes(i.result))throw new qo({message:"No object generated: response did not match schema.",cause:new Kn({value:i,cause:"response must be an object that contains a choice value."}),text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},async parsePartialOutput({text:n}){let r=await Fc(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let o=r.value;if(o==null||typeof o!="object"||!("result"in o)||typeof o.result!="string")return;let i=e.filter(s=>s.startsWith(o.result));return r.state==="successful-parse"?i.includes(o.result)?{partial:o.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),U6=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:a},n){let r=await Xr({text:a});if(!r.success)throw new qo({message:"No object generated: could not parse the response.",cause:r.error,text:a,response:n.response,usage:n.usage,finishReason:n.finishReason});return r.value},async parsePartialOutput({text:a}){let n=await Fc(a);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return n.value===void 0?void 0:{partial:n.value}}},createElementStreamTransform(){}});var Jee=mr({prefix:"aitxt",size:24});var ete=class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
131
+ ]`;continue}o+=r[u],r[u]==="\\"?i=!0:s&&r[u]==="]"?s=!1:!s&&r[u]==="["&&(s=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function iE(e,t){var a,n,r,o,i,s;let l={type:"object",additionalProperties:(a=pt(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?a:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===Me.ZodString&&((r=e.keyType._def.checks)!=null&&r.length)){let{type:u,...c}=oE(e.keyType._def,t);return{...l,propertyNames:c}}else{if(((o=e.keyType)==null?void 0:o._def.typeName)===Me.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===Me.ZodBranded&&e.keyType._def.type._def.typeName===Me.ZodString&&((s=e.keyType._def.type._def.checks)!=null&&s.length)){let{type:u,...c}=nE(e.keyType._def,t);return{...l,propertyNames:c}}}return l}function C5(e,t){if(t.mapStrategy==="record")return iE(e,t);let a=pt(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||vn(),n=pt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||vn();return{type:"array",maxItems:125,items:{type:"array",items:[a,n],minItems:2,maxItems:2}}}function k5(e){let t=e.values,n=Object.keys(e.values).filter(o=>typeof t[t[o]]!="number").map(o=>t[o]),r=Array.from(new Set(n.map(o=>typeof o)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:n}}function T5(){return{not:vn()}}function L5(){return{type:"null"}}var fv={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function E5(e,t){let a=e.options instanceof Map?Array.from(e.options.values()):e.options;if(a.every(n=>n._def.typeName in fv&&(!n._def.checks||!n._def.checks.length))){let n=a.reduce((r,o)=>{let i=fv[o._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:n.length>1?n:n[0]}}else if(a.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=a.reduce((r,o)=>{let i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(o._def.value===null)return[...r,"null"];default:return r}},[]);if(n.length===a.length){let r=n.filter((o,i,s)=>s.indexOf(o)===i);return{type:r.length>1?r:r[0],enum:a.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(a.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:a.reduce((n,r)=>[...n,...r._def.values.filter(o=>!n.includes(o))],[])};return A5(e,t)}var A5=(e,t)=>{let a=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,r)=>pt(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return a.length?{anyOf:a}:void 0};function M5(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[fv[e.innerType._def.typeName],"null"]};let a=pt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}function R5(e){let t={type:"number"};if(!e.checks)return t;for(let a of e.checks)switch(a.kind){case"int":t.type="integer";break;case"min":a.inclusive?t.minimum=a.value:t.exclusiveMinimum=a.value;break;case"max":a.inclusive?t.maximum=a.value:t.exclusiveMaximum=a.value;break;case"multipleOf":t.multipleOf=a.value;break}return t}function D5(e,t){let a={type:"object",properties:{}},n=[],r=e.shape();for(let i in r){let s=r[i];if(s===void 0||s._def===void 0)continue;let l=P5(s),u=pt(s._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});u!==void 0&&(a.properties[i]=u,l||n.push(i))}n.length&&(a.required=n);let o=_5(e,t);return o!==void 0&&(a.additionalProperties=o),a}function _5(e,t){if(e.catchall._def.typeName!=="ZodNever")return pt(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function P5(e){try{return e.isOptional()}catch{return!0}}var O5=(e,t)=>{var a;if(t.currentPath.toString()===((a=t.propertyPath)==null?void 0:a.toString()))return pt(e.innerType._def,t);let n=pt(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:vn()},n]}:vn()},N5=(e,t)=>{if(t.pipeStrategy==="input")return pt(e.in._def,t);if(t.pipeStrategy==="output")return pt(e.out._def,t);let a=pt(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=pt(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",a?"1":"0"]});return{allOf:[a,n].filter(r=>r!==void 0)}};function U5(e,t){return pt(e.type._def,t)}function B5(e,t){let n={type:"array",uniqueItems:!0,items:pt(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function z5(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((a,n)=>pt(a._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((a,n)=>n===void 0?a:[...a,n],[]),additionalItems:pt(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((a,n)=>pt(a._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((a,n)=>n===void 0?a:[...a,n],[])}}function F5(){return{not:vn()}}function q5(){return vn()}var H5=(e,t)=>pt(e.innerType._def,t),j5=(e,t,a)=>{switch(t){case Me.ZodString:return oE(e,a);case Me.ZodNumber:return R5(e);case Me.ZodObject:return D5(e,a);case Me.ZodBigInt:return f5(e);case Me.ZodBoolean:return p5();case Me.ZodDate:return rE(e,a);case Me.ZodUndefined:return F5();case Me.ZodNull:return L5();case Me.ZodArray:return d5(e,a);case Me.ZodUnion:case Me.ZodDiscriminatedUnion:return E5(e,a);case Me.ZodIntersection:return x5(e,a);case Me.ZodTuple:return z5(e,a);case Me.ZodRecord:return iE(e,a);case Me.ZodLiteral:return b5(e);case Me.ZodEnum:return w5(e);case Me.ZodNativeEnum:return k5(e);case Me.ZodNullable:return M5(e,a);case Me.ZodOptional:return O5(e,a);case Me.ZodMap:return C5(e,a);case Me.ZodSet:return B5(e,a);case Me.ZodLazy:return()=>e.getter()._def;case Me.ZodPromise:return U5(e,a);case Me.ZodNaN:case Me.ZodNever:return T5();case Me.ZodEffects:return y5(e,a);case Me.ZodAny:return vn();case Me.ZodUnknown:return q5();case Me.ZodDefault:return g5(e,a);case Me.ZodBranded:return nE(e,a);case Me.ZodReadonly:return H5(e,a);case Me.ZodCatch:return m5(e,a);case Me.ZodPipeline:return N5(e,a);case Me.ZodFunction:case Me.ZodVoid:case Me.ZodSymbol:return;default:return(n=>{})(t)}},V5=(e,t)=>{let a=0;for(;a<e.length&&a<t.length&&e[a]===t[a];a++);return[(e.length-a).toString(),...t.slice(a)].join("/")};function pt(e,t,a=!1){var n;let r=t.seen.get(e);if(t.override){let l=(n=t.override)==null?void 0:n.call(t,e,t,r,a);if(l!==u5)return l}if(r&&!a){let l=$5(r,t);if(l!==void 0)return l}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let i=j5(e,e.typeName,t),s=typeof i=="function"?pt(i(),t):i;if(s&&W5(e,t,s),t.postProcess){let l=t.postProcess(s,e,t);return o.jsonSchema=s,l}return o.jsonSchema=s,s}var $5=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:V5(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((a,n)=>t.currentPath[n]===a)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),vn()):t.$refStrategy==="seen"?vn():void 0}},W5=(e,t,a)=>(e.description&&(a.description=e.description),a),G5=e=>{let t=c5(e),a=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},X5=(e,t)=>{var a;let n=G5(t),r=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[c,d])=>{var p;return{...u,[c]:(p=pt(d._def,{...n,currentPath:[...n.basePath,n.definitionPath,c]},!0))!=null?p:vn()}},{}):void 0,o=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(a=pt(e._def,o===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,o]},!1))!=null?a:vn(),s=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;s!==void 0&&(i.title=s);let l=o===void 0?r?{...i,[n.definitionPath]:r}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,o].join("/"),[n.definitionPath]:{...r,[o]:i}};return l.$schema="http://json-schema.org/draft-07/schema#",l},pv=Symbol.for("vercel.ai.schema");function am(e){let t;return()=>(t==null&&(t=e()),t)}function Il(e,{validate:t}={}){return{[pv]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function K5(e){return typeof e=="object"&&e!==null&&pv in e&&e[pv]===!0&&"jsonSchema"in e&&"validate"in e}function Oi(e){return e==null?Il({properties:{},additionalProperties:!1}):K5(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?Cl(e):Y5(e):e()}function Y5(e){return Il(()=>yv(e["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async t=>{let a=await e["~standard"].validate(t);return"value"in a?{success:!0,value:a.value}:{success:!1,error:new Kn({value:t,cause:a.issues})}}})}function Z5(e,t){var a;let n=(a=t?.useReferences)!=null?a:!1;return Il(()=>X5(e,{$refStrategy:n?"root":"none"}),{validate:async r=>{let o=await e.safeParseAsync(r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function J5(e,t){var a;let n=(a=t?.useReferences)!=null?a:!1;return Il(()=>yv((void 0)(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async r=>{let o=await(void 0)(e,r);return o.success?{success:!0,value:o.data}:{success:!1,error:o.error}}})}function Q5(e){return"_zod"in e}function Cl(e,t){return Q5(e)?J5(e,t):Z5(e,t)}async function nm({value:e,schema:t,context:a}){let n=await kl({value:e,schema:t,context:a});if(!n.success)throw Kn.wrap({value:e,cause:n.error,context:a});return n.value}async function kl({value:e,schema:t,context:a}){let n=Oi(t);try{if(n.validate==null)return{success:!0,value:e,rawValue:e};let r=await n.validate(e);return r.success?{success:!0,value:r.value,rawValue:e}:{success:!1,error:Kn.wrap({value:e,cause:r.error,context:a}),rawValue:e}}catch(r){return{success:!1,error:Kn.wrap({value:e,cause:r,context:a}),rawValue:e}}}async function Xr({text:e,schema:t}){try{let a=l5(e);return t==null?{success:!0,value:a,rawValue:a}:await kl({value:a,schema:t})}catch(a){return{success:!1,error:ov.isInstance(a)?a:new ov({text:e,cause:a}),rawValue:void 0}}}function wv({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new em).pipeThrough(new TransformStream({async transform({data:a},n){a!=="[DONE]"&&n.enqueue(await Xr({text:a,schema:t}))}}))}async function hr(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var tH=Object.defineProperty,aH=(e,t)=>{for(var a in t)tH(e,a,{get:t[a],enumerable:!0})},nH="AI_InvalidArgumentError",rH=`vercel.ai.error.${nH}`,oH=Symbol.for(rH),iH;iH=oH;var sH="AI_InvalidStreamPartError",lH=`vercel.ai.error.${sH}`,uH=Symbol.for(lH),cH;cH=uH;var dH="AI_InvalidToolApprovalError",fH=`vercel.ai.error.${dH}`,pH=Symbol.for(fH),mH;mH=pH;var hH="AI_InvalidToolInputError",gH=`vercel.ai.error.${hH}`,yH=Symbol.for(gH),wH;wH=yH;var vH="AI_ToolCallNotFoundForApprovalError",xH=`vercel.ai.error.${vH}`,bH=Symbol.for(xH),SH;SH=bH;var IH="AI_MissingToolResultsError",CH=`vercel.ai.error.${IH}`,kH=Symbol.for(CH),TH;TH=kH;var LH="AI_NoImageGeneratedError",EH=`vercel.ai.error.${LH}`,AH=Symbol.for(EH),MH;MH=AH;var lE="AI_NoObjectGeneratedError",uE=`vercel.ai.error.${lE}`,RH=Symbol.for(uE),cE,qo=class extends Je{constructor({message:e="No object generated.",cause:t,text:a,response:n,usage:r,finishReason:o}){super({name:lE,message:e,cause:t}),this[cE]=!0,this.text=a,this.response=n,this.usage=r,this.finishReason=o}static isInstance(e){return Je.hasMarker(e,uE)}};cE=RH;var DH="AI_NoOutputGeneratedError",_H=`vercel.ai.error.${DH}`,PH=Symbol.for(_H),OH;OH=PH;var NH="AI_NoSpeechGeneratedError",UH=`vercel.ai.error.${NH}`,BH=Symbol.for(UH),zH;zH=BH;var FH="AI_NoTranscriptGeneratedError",qH=`vercel.ai.error.${FH}`,HH=Symbol.for(qH),jH;jH=HH;var VH="AI_NoVideoGeneratedError",$H=`vercel.ai.error.${VH}`,WH=Symbol.for($H),GH;GH=WH;var XH="AI_NoSuchToolError",KH=`vercel.ai.error.${XH}`,YH=Symbol.for(KH),ZH;ZH=YH;var JH="AI_ToolCallRepairError",QH=`vercel.ai.error.${JH}`,e6=Symbol.for(QH),t6;t6=e6;var dE="AI_UIMessageStreamError",fE=`vercel.ai.error.${dE}`,a6=Symbol.for(fE),pE,Tl=class extends Je{constructor({chunkType:e,chunkId:t,message:a}){super({name:dE,message:a}),this[pE]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return Je.hasMarker(e,fE)}};pE=a6;var n6="AI_InvalidDataContentError",r6=`vercel.ai.error.${n6}`,o6=Symbol.for(r6),i6;i6=o6;var s6="AI_InvalidMessageRoleError",l6=`vercel.ai.error.${s6}`,u6=Symbol.for(l6),c6;c6=u6;var d6="AI_MessageConversionError",f6=`vercel.ai.error.${d6}`,p6=Symbol.for(f6),m6;m6=p6;var h6="AI_RetryError",g6=`vercel.ai.error.${h6}`,y6=Symbol.for(g6),w6;w6=y6;var v6="6.0.141",x6=async({url:e,maxBytes:t,abortSignal:a})=>{var n;let r=e.toString();hv(r);try{let o=await fetch(r,{headers:tm({},`ai-sdk/${v6}`,aE()),signal:a});if(o.redirected&&hv(o.url),!o.ok)throw new On({url:r,statusCode:o.status,statusText:o.statusText});return{data:await eE({response:o,url:r,maxBytes:t??mv}),mediaType:(n=o.headers.get("content-type"))!=null?n:void 0}}catch(o){throw On.isInstance(o)?o:new On({url:r,cause:o})}};var mE=f.union([f.string(),f.instanceof(Uint8Array),f.instanceof(ArrayBuffer),f.custom(e=>{var t,a;return(a=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?a:!1},{message:"Must be a Buffer"})]);var zc=f.lazy(()=>f.union([f.null(),f.string(),f.number(),f.boolean(),f.record(f.string(),zc.optional()),f.array(zc)])),pe=f.record(f.string(),f.record(f.string(),zc.optional())),hE=f.object({type:f.literal("text"),text:f.string(),providerOptions:pe.optional()}),b6=f.object({type:f.literal("image"),image:f.union([mE,f.instanceof(URL)]),mediaType:f.string().optional(),providerOptions:pe.optional()}),gE=f.object({type:f.literal("file"),data:f.union([mE,f.instanceof(URL)]),filename:f.string().optional(),mediaType:f.string(),providerOptions:pe.optional()}),S6=f.object({type:f.literal("reasoning"),text:f.string(),providerOptions:pe.optional()}),I6=f.object({type:f.literal("tool-call"),toolCallId:f.string(),toolName:f.string(),input:f.unknown(),providerOptions:pe.optional(),providerExecuted:f.boolean().optional()}),C6=f.discriminatedUnion("type",[f.object({type:f.literal("text"),value:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("json"),value:zc,providerOptions:pe.optional()}),f.object({type:f.literal("execution-denied"),reason:f.string().optional(),providerOptions:pe.optional()}),f.object({type:f.literal("error-text"),value:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("error-json"),value:zc,providerOptions:pe.optional()}),f.object({type:f.literal("content"),value:f.array(f.union([f.object({type:f.literal("text"),text:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("media"),data:f.string(),mediaType:f.string()}),f.object({type:f.literal("file-data"),data:f.string(),mediaType:f.string(),filename:f.string().optional(),providerOptions:pe.optional()}),f.object({type:f.literal("file-url"),url:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("file-id"),fileId:f.union([f.string(),f.record(f.string(),f.string())]),providerOptions:pe.optional()}),f.object({type:f.literal("image-data"),data:f.string(),mediaType:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("image-url"),url:f.string(),providerOptions:pe.optional()}),f.object({type:f.literal("image-file-id"),fileId:f.union([f.string(),f.record(f.string(),f.string())]),providerOptions:pe.optional()}),f.object({type:f.literal("custom"),providerOptions:pe.optional()})]))})]),yE=f.object({type:f.literal("tool-result"),toolCallId:f.string(),toolName:f.string(),output:C6,providerOptions:pe.optional()}),k6=f.object({type:f.literal("tool-approval-request"),approvalId:f.string(),toolCallId:f.string()}),T6=f.object({type:f.literal("tool-approval-response"),approvalId:f.string(),approved:f.boolean(),reason:f.string().optional()}),L6=f.object({role:f.literal("system"),content:f.string(),providerOptions:pe.optional()}),E6=f.object({role:f.literal("user"),content:f.union([f.string(),f.array(f.union([hE,b6,gE]))]),providerOptions:pe.optional()}),A6=f.object({role:f.literal("assistant"),content:f.union([f.string(),f.array(f.union([hE,gE,S6,I6,yE,k6]))]),providerOptions:pe.optional()}),M6=f.object({role:f.literal("tool"),content:f.array(f.union([yE,T6])),providerOptions:pe.optional()}),Kee=f.union([L6,E6,A6,M6]);function wE(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let a={...e};for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let r=t[n];if(r===void 0)continue;let o=n in e?e[n]:void 0,i=r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp),s=o!=null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp);i&&s?a[n]=wE(o,r):a[n]=r}return a}var R6={};aH(R6,{array:()=>O6,choice:()=>N6,json:()=>U6,object:()=>P6,text:()=>_6});function D6(e){let t=["ROOT"],a=-1,n=null;function r(l,u,c){switch(l){case'"':{a=u,t.pop(),t.push(c),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{a=u,n=u,t.pop(),t.push(c),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(c),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=u,t.pop(),t.push(c),t.push("INSIDE_NUMBER");break}case"{":{a=u,t.pop(),t.push(c),t.push("INSIDE_OBJECT_START");break}case"[":{a=u,t.pop(),t.push(c),t.push("INSIDE_ARRAY_START");break}}}function o(l,u){switch(l){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{a=u,t.pop();break}}}function i(l,u){switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=u,t.pop();break}}}for(let l=0;l<e.length;l++){let u=e[l];switch(t[t.length-1]){case"ROOT":r(u,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(u){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{a=l,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{u==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{u==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{u===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{r(u,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{o(u,l);break}case"INSIDE_STRING":{switch(u){case'"':{t.pop(),a=l;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:a=l}break}case"INSIDE_ARRAY_START":{u==="]"?(a=l,t.pop()):(a=l,r(u,l,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(u){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{a=l,t.pop();break}default:{a=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{r(u,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),a=l;break}case"INSIDE_NUMBER":{switch(u){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{a=l;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(u,l),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&o(u,l);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&o(u,l);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(u,l);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{let d=e.substring(n,l+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?o(u,l):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(u,l)):a=l;break}}}let s=e.slice(0,a+1);for(let l=t.length-1;l>=0;l--)switch(t[l]){case"INSIDE_STRING":{s+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{s+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{s+="]";break}case"INSIDE_LITERAL":{let c=e.substring(n,e.length);"true".startsWith(c)?s+="true".slice(c.length):"false".startsWith(c)?s+="false".slice(c.length):"null".startsWith(c)&&(s+="null".slice(c.length))}}return s}async function Fc(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await Xr({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await Xr({text:D6(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var _6=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),P6=({schema:e,name:t,description:a})=>{let n=Oi(e);return{name:"object",responseFormat:hr(n.jsonSchema).then(r=>({type:"json",schema:r,...t!=null&&{name:t},...a!=null&&{description:a}})),async parseCompleteOutput({text:r},o){let i=await Xr({text:r});if(!i.success)throw new qo({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});let s=await kl({value:i.value,schema:n});if(!s.success)throw new qo({message:"No object generated: response did not match schema.",cause:s.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});return s.value},async parsePartialOutput({text:r}){let o=await Fc(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:o.value}}},createElementStreamTransform(){}}},O6=({element:e,name:t,description:a})=>{let n=Oi(e);return{name:"array",responseFormat:hr(n.jsonSchema).then(r=>{let{$schema:o,...i}=r;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...a!=null&&{description:a}}}),async parseCompleteOutput({text:r},o){let i=await Xr({text:r});if(!i.success)throw new qo({message:"No object generated: could not parse the response.",cause:i.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});let s=i.value;if(s==null||typeof s!="object"||!("elements"in s)||!Array.isArray(s.elements))throw new qo({message:"No object generated: response did not match schema.",cause:new Kn({value:s,cause:"response must be an object with an elements array"}),text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});for(let l of s.elements){let u=await kl({value:l,schema:n});if(!u.success)throw new qo({message:"No object generated: response did not match schema.",cause:u.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason})}return s.elements},async parsePartialOutput({text:r}){let o=await Fc(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let i=o.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;let s=o.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,l=[];for(let u of s){let c=await kl({value:u,schema:n});c.success&&l.push(c.value)}return{partial:l}}}},createElementStreamTransform(){let r=0;return new TransformStream({transform({partialOutput:o},i){if(o!=null)for(;r<o.length;r++)i.enqueue(o[r])}})}}},N6=({options:e,name:t,description:a})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...a!=null&&{description:a}}),async parseCompleteOutput({text:n},r){let o=await Xr({text:n});if(!o.success)throw new qo({message:"No object generated: could not parse the response.",cause:o.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});let i=o.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!e.includes(i.result))throw new qo({message:"No object generated: response did not match schema.",cause:new Kn({value:i,cause:"response must be an object that contains a choice value."}),text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.result},async parsePartialOutput({text:n}){let r=await Fc(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{let o=r.value;if(o==null||typeof o!="object"||!("result"in o)||typeof o.result!="string")return;let i=e.filter(s=>s.startsWith(o.result));return r.state==="successful-parse"?i.includes(o.result)?{partial:o.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),U6=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:a},n){let r=await Xr({text:a});if(!r.success)throw new qo({message:"No object generated: could not parse the response.",cause:r.error,text:a,response:n.response,usage:n.usage,finishReason:n.finishReason});return r.value},async parsePartialOutput({text:a}){let n=await Fc(a);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return n.value===void 0?void 0:{partial:n.value}}},createElementStreamTransform(){}});var Qee=mr({prefix:"aitxt",size:24});var tte=class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
132
132
 
133
133
  `)},flush(e){e.enqueue(`data: [DONE]
134
134
 
135
- `)}})}};var xv=am(()=>Cl(f.union([f.strictObject({type:f.literal("text-start"),id:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("text-delta"),id:f.string(),delta:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("text-end"),id:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("error"),errorText:f.string()}),f.strictObject({type:f.literal("tool-input-start"),toolCallId:f.string(),toolName:f.string(),providerExecuted:f.boolean().optional(),providerMetadata:pe.optional(),dynamic:f.boolean().optional(),title:f.string().optional()}),f.strictObject({type:f.literal("tool-input-delta"),toolCallId:f.string(),inputTextDelta:f.string()}),f.strictObject({type:f.literal("tool-input-available"),toolCallId:f.string(),toolName:f.string(),input:f.unknown(),providerExecuted:f.boolean().optional(),providerMetadata:pe.optional(),dynamic:f.boolean().optional(),title:f.string().optional()}),f.strictObject({type:f.literal("tool-input-error"),toolCallId:f.string(),toolName:f.string(),input:f.unknown(),providerExecuted:f.boolean().optional(),providerMetadata:pe.optional(),dynamic:f.boolean().optional(),errorText:f.string(),title:f.string().optional()}),f.strictObject({type:f.literal("tool-approval-request"),approvalId:f.string(),toolCallId:f.string()}),f.strictObject({type:f.literal("tool-output-available"),toolCallId:f.string(),output:f.unknown(),providerExecuted:f.boolean().optional(),providerMetadata:pe.optional(),dynamic:f.boolean().optional(),preliminary:f.boolean().optional()}),f.strictObject({type:f.literal("tool-output-error"),toolCallId:f.string(),errorText:f.string(),providerExecuted:f.boolean().optional(),providerMetadata:pe.optional(),dynamic:f.boolean().optional()}),f.strictObject({type:f.literal("tool-output-denied"),toolCallId:f.string()}),f.strictObject({type:f.literal("reasoning-start"),id:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("reasoning-delta"),id:f.string(),delta:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("reasoning-end"),id:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("source-url"),sourceId:f.string(),url:f.string(),title:f.string().optional(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("source-document"),sourceId:f.string(),mediaType:f.string(),title:f.string(),filename:f.string().optional(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("file"),url:f.string(),mediaType:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.custom(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:f.string().optional(),data:f.unknown(),transient:f.boolean().optional()}),f.strictObject({type:f.literal("start-step")}),f.strictObject({type:f.literal("finish-step")}),f.strictObject({type:f.literal("start"),messageId:f.string().optional(),messageMetadata:f.unknown().optional()}),f.strictObject({type:f.literal("finish"),finishReason:f.enum(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:f.unknown().optional()}),f.strictObject({type:f.literal("abort"),reason:f.string().optional()}),f.strictObject({type:f.literal("message-metadata"),messageMetadata:f.unknown()})])));function B6(e){return e.type.startsWith("data-")}function vv(e){return e.type.startsWith("tool-")}function z6(e){return e.type==="dynamic-tool"}function rm(e){return vv(e)||z6(e)}function sE(e){return e.type.split("-").slice(1).join("-")}function vE({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function xE({stream:e,messageMetadataSchema:t,dataPartSchemas:a,runUpdateMessageJob:n,onError:r,onToolCall:o,onData:i}){return e.pipeThrough(new TransformStream({async transform(s,l){await n(async({state:u,write:c})=>{var d,p,m,h;function v(g){let E=u.message.parts.filter(rm).find(T=>T.toolCallId===g);if(E==null)throw new Tl({chunkType:"tool-invocation",chunkId:g,message:`No tool invocation found for tool call ID "${g}".`});return E}function I(g){var S;let E=u.message.parts.find(O=>vv(O)&&O.toolCallId===g.toolCallId),T=g,R=E;if(E!=null){E.state=g.state,R.input=T.input,R.output=T.output,R.errorText=T.errorText,R.rawInput=T.rawInput,R.preliminary=T.preliminary,g.title!==void 0&&(R.title=g.title),R.providerExecuted=(S=T.providerExecuted)!=null?S:E.providerExecuted;let O=T.providerMetadata;if(O!=null)if(g.state==="output-available"||g.state==="output-error"){let U=E;U.resultProviderMetadata=O}else E.callProviderMetadata=O}else u.message.parts.push({type:`tool-${g.toolName}`,toolCallId:g.toolCallId,state:g.state,title:g.title,input:T.input,output:T.output,rawInput:T.rawInput,errorText:T.errorText,providerExecuted:T.providerExecuted,preliminary:T.preliminary,...T.providerMetadata!=null&&(g.state==="output-available"||g.state==="output-error")?{resultProviderMetadata:T.providerMetadata}:{},...T.providerMetadata!=null&&!(g.state==="output-available"||g.state==="output-error")?{callProviderMetadata:T.providerMetadata}:{}})}function y(g){var S,E;let T=u.message.parts.find(U=>U.type==="dynamic-tool"&&U.toolCallId===g.toolCallId),R=g,O=T;if(T!=null){T.state=g.state,O.toolName=g.toolName,O.input=R.input,O.output=R.output,O.errorText=R.errorText,O.rawInput=(S=R.rawInput)!=null?S:O.rawInput,O.preliminary=R.preliminary,g.title!==void 0&&(O.title=g.title),O.providerExecuted=(E=R.providerExecuted)!=null?E:T.providerExecuted;let U=R.providerMetadata;if(U!=null)if(g.state==="output-available"||g.state==="output-error"){let A=T;A.resultProviderMetadata=U}else T.callProviderMetadata=U}else u.message.parts.push({type:"dynamic-tool",toolName:g.toolName,toolCallId:g.toolCallId,state:g.state,input:R.input,output:R.output,errorText:R.errorText,preliminary:R.preliminary,providerExecuted:R.providerExecuted,title:g.title,...R.providerMetadata!=null&&(g.state==="output-available"||g.state==="output-error")?{resultProviderMetadata:R.providerMetadata}:{},...R.providerMetadata!=null&&!(g.state==="output-available"||g.state==="output-error")?{callProviderMetadata:R.providerMetadata}:{}})}async function w(g){if(g!=null){let S=u.message.metadata!=null?wE(u.message.metadata,g):g;t!=null&&await nm({value:S,schema:t,context:{field:"message.metadata",entityId:u.message.id}}),u.message.metadata=S}}switch(s.type){case"text-start":{let g={type:"text",text:"",providerMetadata:s.providerMetadata,state:"streaming"};u.activeTextParts[s.id]=g,u.message.parts.push(g),c();break}case"text-delta":{let g=u.activeTextParts[s.id];if(g==null)throw new Tl({chunkType:"text-delta",chunkId:s.id,message:`Received text-delta for missing text part with ID "${s.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});g.text+=s.delta,g.providerMetadata=(d=s.providerMetadata)!=null?d:g.providerMetadata,c();break}case"text-end":{let g=u.activeTextParts[s.id];if(g==null)throw new Tl({chunkType:"text-end",chunkId:s.id,message:`Received text-end for missing text part with ID "${s.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});g.state="done",g.providerMetadata=(p=s.providerMetadata)!=null?p:g.providerMetadata,delete u.activeTextParts[s.id],c();break}case"reasoning-start":{let g={type:"reasoning",text:"",providerMetadata:s.providerMetadata,state:"streaming"};u.activeReasoningParts[s.id]=g,u.message.parts.push(g),c();break}case"reasoning-delta":{let g=u.activeReasoningParts[s.id];if(g==null)throw new Tl({chunkType:"reasoning-delta",chunkId:s.id,message:`Received reasoning-delta for missing reasoning part with ID "${s.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});g.text+=s.delta,g.providerMetadata=(m=s.providerMetadata)!=null?m:g.providerMetadata,c();break}case"reasoning-end":{let g=u.activeReasoningParts[s.id];if(g==null)throw new Tl({chunkType:"reasoning-end",chunkId:s.id,message:`Received reasoning-end for missing reasoning part with ID "${s.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});g.providerMetadata=(h=s.providerMetadata)!=null?h:g.providerMetadata,g.state="done",delete u.activeReasoningParts[s.id],c();break}case"file":{u.message.parts.push({type:"file",mediaType:s.mediaType,url:s.url,...s.providerMetadata!=null?{providerMetadata:s.providerMetadata}:{}}),c();break}case"source-url":{u.message.parts.push({type:"source-url",sourceId:s.sourceId,url:s.url,title:s.title,providerMetadata:s.providerMetadata}),c();break}case"source-document":{u.message.parts.push({type:"source-document",sourceId:s.sourceId,mediaType:s.mediaType,title:s.title,filename:s.filename,providerMetadata:s.providerMetadata}),c();break}case"tool-input-start":{let g=u.message.parts.filter(vv);u.partialToolCalls[s.toolCallId]={text:"",toolName:s.toolName,index:g.length,dynamic:s.dynamic,title:s.title},s.dynamic?y({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted,title:s.title,providerMetadata:s.providerMetadata}):I({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted,title:s.title,providerMetadata:s.providerMetadata}),c();break}case"tool-input-delta":{let g=u.partialToolCalls[s.toolCallId];if(g==null)throw new Tl({chunkType:"tool-input-delta",chunkId:s.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${s.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});g.text+=s.inputTextDelta;let{value:S}=await Fc(g.text);g.dynamic?y({toolCallId:s.toolCallId,toolName:g.toolName,state:"input-streaming",input:S,title:g.title}):I({toolCallId:s.toolCallId,toolName:g.toolName,state:"input-streaming",input:S,title:g.title}),c();break}case"tool-input-available":{s.dynamic?y({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-available",input:s.input,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata,title:s.title}):I({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-available",input:s.input,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata,title:s.title}),c(),o&&!s.providerExecuted&&await o({toolCall:s});break}case"tool-input-error":{let g=u.message.parts.filter(rm).find(E=>E.toolCallId===s.toolCallId);(g!=null?g.type==="dynamic-tool":!!s.dynamic)?y({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}):I({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:void 0,rawInput:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}),c();break}case"tool-approval-request":{let g=v(s.toolCallId);g.state="approval-requested",g.approval={id:s.approvalId},c();break}case"tool-output-denied":{let g=v(s.toolCallId);g.state="output-denied",c();break}case"tool-output-available":{let g=v(s.toolCallId);g.type==="dynamic-tool"?y({toolCallId:s.toolCallId,toolName:g.toolName,state:"output-available",input:g.input,output:s.output,preliminary:s.preliminary,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata,title:g.title}):I({toolCallId:s.toolCallId,toolName:sE(g),state:"output-available",input:g.input,output:s.output,providerExecuted:s.providerExecuted,preliminary:s.preliminary,providerMetadata:s.providerMetadata,title:g.title}),c();break}case"tool-output-error":{let g=v(s.toolCallId);g.type==="dynamic-tool"?y({toolCallId:s.toolCallId,toolName:g.toolName,state:"output-error",input:g.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata,title:g.title}):I({toolCallId:s.toolCallId,toolName:sE(g),state:"output-error",input:g.input,rawInput:g.rawInput,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata,title:g.title}),c();break}case"start-step":{u.message.parts.push({type:"step-start"});break}case"finish-step":{u.activeTextParts={},u.activeReasoningParts={};break}case"start":{s.messageId!=null&&(u.message.id=s.messageId),await w(s.messageMetadata),(s.messageId!=null||s.messageMetadata!=null)&&c();break}case"finish":{s.finishReason!=null&&(u.finishReason=s.finishReason),await w(s.messageMetadata),s.messageMetadata!=null&&c();break}case"message-metadata":{await w(s.messageMetadata),s.messageMetadata!=null&&c();break}case"error":{r?.(new Error(s.errorText));break}default:if(B6(s)){if(a?.[s.type]!=null){let E=u.message.parts.findIndex(R=>"id"in R&&"data"in R&&R.id===s.id&&R.type===s.type),T=E>=0?E:u.message.parts.length;await nm({value:s.data,schema:a[s.type],context:{field:`message.parts[${T}].data`,entityName:s.type,entityId:s.id}})}let g=s;if(g.transient){i?.(g);break}let S=g.id!=null?u.message.parts.find(E=>g.type===E.type&&g.id===E.id):void 0;S!=null?S.data=g.data:u.message.parts.push(g),i?.(g),c()}}l.enqueue(s)})}}))}function F6(e){let t=e.pipeThrough(new TransformStream);return t[Symbol.asyncIterator]=function(){let a=this.getReader(),n=!1;async function r(o){var i;if(!n){n=!0;try{o&&await((i=a.cancel)==null?void 0:i.call(a))}finally{try{a.releaseLock()}catch{}}}}return{async next(){if(n)return{done:!0,value:void 0};let{done:o,value:i}=await a.read();return o?(await r(!0),{done:!0,value:void 0}):{done:!1,value:i}},async return(){return await r(!0),{done:!0,value:void 0}},async throw(o){throw await r(!0),o}}},t}async function bE({stream:e,onError:t}){let a=e.getReader();try{for(;;){let{done:n}=await a.read();if(n)break}}catch(n){t?.(n)}finally{a.releaseLock()}}var rte=mr({prefix:"aitxt",size:24});function SE({message:e,stream:t,onError:a,terminateOnError:n=!1}){var r;let o,i=!1,s=new ReadableStream({start(c){o=c}}),l=vE({messageId:(r=e?.id)!=null?r:"",lastMessage:e}),u=c=>{a?.(c),!i&&n&&(i=!0,o?.error(c))};return bE({stream:xE({stream:t,runUpdateMessageJob(c){return c({state:l,write:()=>{o?.enqueue(structuredClone(l.message))}})},onError:u}),onError:u}).finally(()=>{i||o?.close()}),F6(s)}var ste=am(()=>Cl(f.array(f.object({id:f.string(),role:f.enum(["system","user","assistant"]),metadata:f.unknown().optional(),parts:f.array(f.union([f.object({type:f.literal("text"),text:f.string(),state:f.enum(["streaming","done"]).optional(),providerMetadata:pe.optional()}),f.object({type:f.literal("reasoning"),text:f.string(),state:f.enum(["streaming","done"]).optional(),providerMetadata:pe.optional()}),f.object({type:f.literal("source-url"),sourceId:f.string(),url:f.string(),title:f.string().optional(),providerMetadata:pe.optional()}),f.object({type:f.literal("source-document"),sourceId:f.string(),mediaType:f.string(),title:f.string(),filename:f.string().optional(),providerMetadata:pe.optional()}),f.object({type:f.literal("file"),mediaType:f.string(),filename:f.string().optional(),url:f.string(),providerMetadata:pe.optional()}),f.object({type:f.literal("step-start")}),f.object({type:f.string().startsWith("data-"),id:f.string().optional(),data:f.unknown()}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("input-streaming"),input:f.unknown().optional(),providerExecuted:f.boolean().optional(),callProviderMetadata:pe.optional(),output:f.never().optional(),errorText:f.never().optional(),approval:f.never().optional()}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("input-available"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.never().optional()}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("approval-requested"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.never().optional(),reason:f.never().optional()})}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("approval-responded"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.boolean(),reason:f.string().optional()})}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("output-available"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.unknown(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),resultProviderMetadata:pe.optional(),preliminary:f.boolean().optional(),approval:f.object({id:f.string(),approved:f.literal(!0),reason:f.string().optional()}).optional()}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("output-error"),input:f.unknown(),rawInput:f.unknown().optional(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.string(),callProviderMetadata:pe.optional(),resultProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.literal(!0),reason:f.string().optional()}).optional()}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("output-denied"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.literal(!1),reason:f.string().optional()})}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("input-streaming"),providerExecuted:f.boolean().optional(),callProviderMetadata:pe.optional(),input:f.unknown().optional(),output:f.never().optional(),errorText:f.never().optional(),approval:f.never().optional()}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("input-available"),providerExecuted:f.boolean().optional(),input:f.unknown(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.never().optional()}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("approval-requested"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.never().optional(),reason:f.never().optional()})}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("approval-responded"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.boolean(),reason:f.string().optional()})}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("output-available"),providerExecuted:f.boolean().optional(),input:f.unknown(),output:f.unknown(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),resultProviderMetadata:pe.optional(),preliminary:f.boolean().optional(),approval:f.object({id:f.string(),approved:f.literal(!0),reason:f.string().optional()}).optional()}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("output-error"),providerExecuted:f.boolean().optional(),input:f.unknown(),rawInput:f.unknown().optional(),output:f.never().optional(),errorText:f.string(),callProviderMetadata:pe.optional(),resultProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.literal(!0),reason:f.string().optional()}).optional()}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("output-denied"),providerExecuted:f.boolean().optional(),input:f.unknown(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.literal(!1),reason:f.string().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty")));var ute=mr({prefix:"aiobj",size:24});function IE(e){return({url:t,abortSignal:a})=>x6({url:t,maxBytes:e?.maxBytes,abortSignal:a})}var q6=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,a)=>{this.queue.push(async()=>{try{await e(),t()}catch(n){a(n)}}),this.processQueue()})}};var dte=mr({prefix:"aiobj",size:24});var fte=IE();var H6="AI_NoSuchProviderError",j6=`vercel.ai.error.${H6}`,V6=Symbol.for(j6),$6;$6=V6;var pte=IE();async function W6(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{let{name:a,type:n}=t,r=await new Promise((o,i)=>{let s=new FileReader;s.onload=l=>{var u;o((u=l.target)==null?void 0:u.result)},s.onerror=l=>i(l),s.readAsDataURL(t)});return{type:"file",mediaType:n,filename:a,url:r}}))}var G6=class{constructor({api:e="/api/chat",credentials:t,headers:a,body:n,fetch:r,prepareSendMessagesRequest:o,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=a,this.body=n,this.fetch=r,this.prepareSendMessagesRequest=o,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){var a,n,r,o,i;let s=await hr(this.body),l=await hr(this.headers),u=await hr(this.credentials),c={...Fo(l),...Fo(t.headers)},d=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...s,...t.body},headers:c,credentials:u,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),p=(n=d?.api)!=null?n:this.api,m=d?.headers!==void 0?Fo(d.headers):c,h=d?.body!==void 0?d.body:{...s,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},v=(r=d?.credentials)!=null?r:u,y=await((o=this.fetch)!=null?o:globalThis.fetch)(p,{method:"POST",headers:{"Content-Type":"application/json",...m},body:JSON.stringify(h),credentials:v,signal:e});if(!y.ok)throw new Error((i=await y.text())!=null?i:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(e){var t,a,n,r,o;let i=await hr(this.body),s=await hr(this.headers),l=await hr(this.credentials),u={...Fo(s),...Fo(e.headers)},c=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...i,...e.body},headers:u,credentials:l,requestMetadata:e.metadata})),d=(a=c?.api)!=null?a:`${this.api}/${e.chatId}/stream`,p=c?.headers!==void 0?Fo(c.headers):u,m=(n=c?.credentials)!=null?n:l,v=await((r=this.fetch)!=null?r:globalThis.fetch)(d,{method:"GET",headers:p,credentials:m});if(v.status===204)return null;if(!v.ok)throw new Error((o=await v.text())!=null?o:"Failed to fetch the chat response.");if(!v.body)throw new Error("The response body is empty.");return this.processResponseStream(v.body)}},bv=class extends G6{constructor(e={}){super(e)}processResponseStream(e){return wv({stream:e,schema:xv}).pipeThrough(new TransformStream({async transform(t,a){if(!t.success)throw t.error;a.enqueue(t.value)}}))}},CE=class{constructor({generateId:e=gv,id:t=e(),transport:a=new bv,messageMetadataSchema:n,dataPartSchemas:r,state:o,onError:i,onToolCall:s,onFinish:l,onData:u,sendAutomaticallyWhen:c}){this.activeResponse=void 0,this.jobExecutor=new q6,this.sendMessage=async(d,p)=>{var m,h,v,I;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(m=this.lastMessage)==null?void 0:m.id,...p});return}let y;if("text"in d||"files"in d?y={parts:[...Array.isArray(d.files)?d.files:await W6(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:y=d,d.messageId!=null){let w=this.state.messages.findIndex(g=>g.id===d.messageId);if(w===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[w].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,w+1),this.state.replaceMessage(w,{...y,id:d.messageId,role:(h=y.role)!=null?h:"user",metadata:d.metadata})}else this.state.pushMessage({...y,id:(v=y.id)!=null?v:this.generateId(),role:(I=y.role)!=null?I:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...p})},this.regenerate=async({messageId:d,...p}={})=>{let m=d==null?this.state.messages.length-1:this.state.messages.findIndex(h=>h.id===d);if(m===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[m].role==="assistant"?m:m+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...p})},this.resumeStream=async(d={})=>{await this.makeRequest({trigger:"resume-stream",...d})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:d,approved:p,reason:m,options:h})=>this.jobExecutor.run(async()=>{let v=this.state.messages,I=v[v.length-1],y=w=>rm(w)&&w.state==="approval-requested"&&w.approval.id===d?{...w,state:"approval-responded",approval:{id:d,approved:p,reason:m}}:w;this.state.replaceMessage(v.length-1,{...I,parts:I.parts.map(y)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(y)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(w=>{var g;w&&this.makeRequest({trigger:"submit-message",messageId:(g=this.lastMessage)==null?void 0:g.id,...h})})}),this.addToolOutput=async({state:d="output-available",toolCallId:p,output:m,errorText:h,options:v})=>this.jobExecutor.run(async()=>{let I=this.state.messages,y=I[I.length-1],w=g=>rm(g)&&g.toolCallId===p?{...g,state:d,output:m,errorText:h}:g;this.state.replaceMessage(I.length-1,{...y,parts:y.parts.map(w)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(w)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(g=>{var S;g&&this.makeRequest({trigger:"submit-message",messageId:(S=this.lastMessage)==null?void 0:S.id,...v})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var d;this.status!=="streaming"&&this.status!=="submitted"||(d=this.activeResponse)!=null&&d.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=a,this.generateId=e,this.messageMetadataSchema=n,this.dataPartSchemas=r,this.state=o,this.onError=i,this.onToolCall=s,this.onFinish=l,this.onData=u,this.sendAutomaticallyWhen=c}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:a,body:n,messageId:r}){var o,i,s;let l;if(e==="resume-stream")try{let m=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:a,body:n});if(m==null)return;l=m}catch(m){this.onError&&m instanceof Error&&this.onError(m),this.setStatus({status:"error",error:m});return}this.setStatus({status:"submitted",error:void 0});let u=this.lastMessage,c=!1,d=!1,p=!1;try{let m={state:vE({lastMessage:this.state.snapshot(u),messageId:this.generateId()}),abortController:new AbortController};m.abortController.signal.addEventListener("abort",()=>{c=!0}),this.activeResponse=m;let h;e==="resume-stream"?h=l:h=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:m.abortController.signal,metadata:t,headers:a,body:n,trigger:e,messageId:r});let v=I=>this.jobExecutor.run(()=>I({state:m.state,write:()=>{var y;this.setStatus({status:"streaming"}),m.state.message.id===((y=this.lastMessage)==null?void 0:y.id)?this.state.replaceMessage(this.state.messages.length-1,m.state.message):this.state.pushMessage(m.state.message)}}));await bE({stream:xE({stream:h,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:v,onError:I=>{throw I}}),onError:I=>{throw I}}),this.setStatus({status:"ready"})}catch(m){if(c||m.name==="AbortError")return c=!0,this.setStatus({status:"ready"}),null;p=!0,m instanceof TypeError&&(m.message.toLowerCase().includes("fetch")||m.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&m instanceof Error&&this.onError(m),this.setStatus({status:"error",error:m})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:d,isError:p,finishReason:(o=this.activeResponse)==null?void 0:o.state.finishReason})}catch(m){console.error(m)}this.activeResponse=void 0}!p&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(s=this.lastMessage)==null?void 0:s.id,metadata:t,headers:a,body:n})}};function om(){let e=new Set,t=new Map,a,n=0,r=!1,o=!1,i=c=>(a||(a=`text-${++n}`,c.enqueue({type:"text-start",id:a})),a),s=c=>{a&&(c.enqueue({type:"text-end",id:a}),a=void 0)},l=(c,d)=>{c.enqueue({type:"text-delta",id:i(c),delta:d})},u=(c,d,p)=>{e.has(d.callId)||(e.add(d.callId),c.enqueue({type:"tool-input-available",toolCallId:d.callId,toolName:d.toolName??d.kind,input:p,dynamic:!0}))};return new TransformStream({start(c){c.enqueue({type:"start",messageId:crypto.randomUUID()})},transform(c,d){switch(c.type){case"step.started":{t.set(c.data.stepIndex,c.data.modelId),d.enqueue({type:"start-step"}),r=!0;break}case"message.appended":{c.data.messageDelta&&l(d,c.data.messageDelta);break}case"message.completed":{!a&&c.data.message&&l(d,c.data.message),s(d);break}case"actions.requested":{s(d);for(let p of c.data.actions)u(d,p,p.input);break}case"action.result":{let{result:p,status:m,error:h}=c.data;if(p.kind!=="tool-result")break;if(u(d,p,{}),p.isError===!0||m!=="completed"){d.enqueue({type:"tool-output-error",toolCallId:p.callId,errorText:h?.message??"The tool call failed.",dynamic:!0});break}d.enqueue({type:"tool-output-available",toolCallId:p.callId,output:p.output,dynamic:!0});break}case"step.completed":{let{stepIndex:p,usage:m}=c.data;s(d),r&&(d.enqueue({type:"finish-step"}),r=!1),d.enqueue({type:"message-metadata",messageMetadata:{"waniwani/step":{stepIndex:p,modelId:t.get(p),usage:m}}});break}case"turn.failed":case"session.failed":{o=!0,d.enqueue({type:"error",errorText:c.data.message||"The agent could not answer."});break}}},flush(c){s(c),r&&c.enqueue({type:"finish-step"}),c.enqueue({type:"finish",finishReason:o?"error":"stop"})}})}async function X6(e){let t=new ReadableStream({start(n){for(let r of e)n.enqueue(r);n.close()}}).pipeThrough(om()),a;for await(let n of SE({stream:t}))a=n;return a?.parts.length?a:void 0}async function kE(e){let t=[];for(let n of e){let r=n.type==="message.received"&&!n.data.kind?n.data.message:void 0;r!==void 0?t.push({visitor:{id:n.meta?.id??crypto.randomUUID(),role:"user",parts:[{type:"text",text:r}]},events:[]}):t.at(-1)?.events.push(n)}let a=[];for(let n of t){a.push(n.visitor);let r=await X6(n.events);r&&a.push(r)}return a}var Ni=Symbol("invalid-json-value-candidate");function Iv(e){let t=Sv(e);if(t===Ni)throw TypeError("Expected a JSON-serializable value.");return t}function qc(e){let t=Iv(e);if(!K6(t))throw TypeError("Expected a JSON-serializable object.");return t}function Sv(e,t=new WeakSet){if(e===null||typeof e=="boolean"||typeof e=="string")return e;if(typeof e=="number")return Number.isFinite(e)?e:Ni;if(Array.isArray(e)){let n=[];for(let r of e){let o=Sv(r,t);if(o===Ni)return Ni;n.push(o)}return n}if(typeof e!="object"||e===void 0||!Y6(e)||t.has(e))return Ni;t.add(e);let a={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let o=Sv(r,t);if(o===Ni)return Ni;a[n]=o}return t.delete(e),a}function K6(e){return e!==null&&!Array.isArray(e)&&typeof e=="object"}function Y6(e){let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}var Hc=f.unknown().transform((e,t)=>{try{return Iv(e)}catch(a){return t.addIssue({code:"custom",message:TE(a,"Expected a JSON-serializable value.")}),f.NEVER}}),Kr=f.unknown().transform((e,t)=>{try{return qc(e)}catch(a){return t.addIssue({code:"custom",message:TE(a,"Expected a JSON-serializable object.")}),f.NEVER}});function TE(e,t){return e instanceof Error?e.message:t}var LE=f.object({callId:f.string(),input:Kr,kind:f.literal("tool-call"),toolName:f.string()}).strict();f.object({callId:f.string(),description:f.string(),input:Kr,kind:f.literal("subagent-call"),name:f.string(),nodeId:f.string(),subagentName:f.string()}).strict(),f.object({callId:f.string(),description:f.string(),input:Kr,kind:f.literal("remote-agent-call"),name:f.string(),nodeId:f.string(),remoteAgentName:f.string()}).strict(),f.object({callId:f.string(),input:Kr,kind:f.literal("workflow-tool-call"),toolName:f.string(),workflowId:f.string()}).strict(),f.object({callId:f.string(),description:f.string(),input:Kr,kind:f.literal("subagent-call"),name:f.string(),nodeId:f.string(),subagentName:f.string()}).strict();var Ote=f.object({callId:f.string(),description:f.string(),input:Kr,kind:f.literal("remote-agent-call"),name:f.string(),nodeId:f.string(),remoteAgentName:f.string()}).strict(),Nte=f.object({callId:f.string(),executeInput:Hc.optional(),input:Kr,kind:f.literal("workflow-task"),nodeId:f.string().optional(),toolName:f.string(),workflowId:f.string()}).strict();f.object({callId:f.string(),input:Kr,kind:f.literal("load-skill")}).strict();f.object({callId:f.string(),isError:f.boolean().optional(),kind:f.literal("tool-result"),output:Hc,toolName:f.string()}).strict(),f.object({callId:f.string(),isError:f.literal(!0),kind:f.literal("subagent-result"),origin:f.literal("dispatch"),output:Hc,subagentName:f.string()}).strict(),f.object({callId:f.string(),isError:f.boolean().optional(),kind:f.literal("load-skill-result"),output:Hc,name:f.string().optional()}).strict();var Z6=f.object({description:f.string().describe("Optional additional context for this option.").optional(),id:f.string().describe("Stable identifier for the option."),label:f.string().describe("User-facing label for the option."),style:f.enum(["primary","danger","default"]).describe("Visual treatment hint for the option.").optional()}).strict(),J6=f.enum(["question","session-limit","tool-approval"]),Fte=f.object({action:LE,allowFreeform:f.boolean().describe("Whether the user may answer with freeform text instead of selecting one of the provided options.").optional(),display:f.enum(["confirmation","select","text"]).describe("Rendering hint: the channel uses this to pick a UX treatment.").optional(),kind:J6.describe("Framework-owned request source used to resolve, route, and render the response."),options:f.array(Z6).describe("Selectable answer options to present to the user.").optional(),prompt:f.string().describe("The prompt to present to the user."),requestId:f.string().describe("Stable identifier for this request.")}).strict(),qte=f.object({optionId:f.string().optional(),requestId:f.string(),text:f.string().optional()}).strict();var Ya="/eve/v1",jte=`${Ya}/cron/:token`,EE=`${Ya}/health`,AE=`${Ya}/info`,Ta=`${Ya}/session`,Vte=`${Ta}/:sessionId`,$te=`${Ta}/:sessionId/cancel`,Wte=`${Ta}/:sessionId/compact`,Gte=`${Ta}/:sessionId/clear`,Xte=`${Ta}/:sessionId/reset`,Kte=`${Ta}/:sessionId/stream`,Yte=`${Ta}/:parentSessionId/subagents/:callId/:childSessionId/stream`,Zte=`${Ya}/dev/schedules/:scheduleId`,Cv=`${Ya}/dev/runtime-artifacts`,Jte=`${Cv}/rebuild`,Qte=`${Cv}/suspend`,eae=`${Cv}/resume`;var tae=`${Ya}/connections/:name/callback/:attemptId/:token`,aae=`${Ya}/callback/:token`,nae=`${Ya}/task-input/:token`,rae=`${Ya}/activity/:token`;function ME(e){return`${Ta}/${encodeURIComponent(e)}`}function RE(e){return`${Ta}/${encodeURIComponent(e)}/cancel`}function DE(e){return`${Ta}/${encodeURIComponent(e)}/compact`}function _E(e){return`${Ta}/${encodeURIComponent(e)}/clear`}function PE(e){return`${Ta}/${encodeURIComponent(e)}/reset`}function kv(e){return`${Ta}/${encodeURIComponent(e)}/stream`}function gr(e){return typeof e=="object"&&!!e&&!Array.isArray(e)}function jc(e){return e instanceof Error?e.message:typeof e=="string"?e:e==null?String(e):gr(e)?typeof e.message=="string"&&e.message.length>0?e.message:Q6(e):String(e)}function Ui(e){if(e instanceof Error)return e;let t=Error(jc(e));return gr(e)&&(typeof e.name=="string"&&e.name.length>0&&(t.name=e.name),typeof e.stack=="string"&&e.stack.length>0&&(t.stack=e.stack),"cause"in e&&e.cause!==void 0&&e.cause!==e&&(t.cause=e.cause)),t}function Q6(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}var NE="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function e9(){let e=-1,t=new Uint8Array(10);return function(){let a=Date.now();if(!Number.isInteger(a)||a<0||a>0xffffffffffff)throw Error(`Cannot mint a ULID: timestamp must be an integer from 0 to ${0xffffffffffff}.`);if(a>e)e=a,OE(t);else if(!r9(t)){if(e===0xffffffffffff)throw Error("Cannot mint a ULID: random component overflowed at the maximum timestamp.");e+=1,OE(t)}return`${a9(e)}${n9(t)}`}}var t9=e9();function OE(e){let t=globalThis.crypto;if(typeof t?.getRandomValues!="function")throw Error("Cannot mint a ULID: globalThis.crypto.getRandomValues is unavailable.");t.getRandomValues(e)}function a9(e){let t=e,a="";for(let n=0;n<10;n+=1)a=NE[t%32]+a,t=Math.floor(t/32);return a}function n9(e){let t=0,a=0,n="";for(let r of e){for(t=t<<8|r,a+=8;a>=5;)a-=5,n+=NE[t>>>a&31];t&=(1<<a)-1}return n}function r9(e){for(let t=e.length-1;t>=0;--t){let a=e[t]??0;if(a<255)return e[t]=a+1,e.fill(0,t+1),!0}return!1}var UE="x-eve-session-id";var Tv="x-eve-stream-tail-index",Lv="x-eve-stream-version";var BE="1",zE="streamControlVersion",Ev={$eve:"stream.lease-ended",version:1},Pae=new TextEncoder;function xn(e){return e.type==="session.completed"||e.type==="session.failed"||e.type==="session.waiting"}function Av(e){return e.type==="session.failed"||e.type==="step.failed"||e.type==="turn.failed"}var im=class extends Error{constructor(t=[]){let a=t.length===0?"":` (${t.join("; ")})`;super(`The server returned an unrecognized response from the eve agent info route.${a}`);K(this,"issues");this.name="AgentInfoResponseError",this.issues=t}};var sm=class extends Error{constructor(t=[]){let a=t.length===0?"":` (${t.join("; ")})`;super(`The server returned an unrecognized eve health response.${a}`);K(this,"issues");this.name="HealthResponseError",this.issues=t}};var Za=class extends Error{constructor(t,a,n){let r=Object.freeze(Object.fromEntries(new Headers(n).entries())),o=r["content-type"]?.toLowerCase(),i=a||`Server returned ${t}.`,s;try{let l=JSON.parse(a);gr(l)&&(typeof l.error=="string"&&(i=l.error),typeof l.code=="string"&&(s=l.code))}catch{o?.includes("text/html")&&(i=`Server returned ${t} with an HTML response. Check the eve route and development server configuration.`)}super(i);K(this,"code");K(this,"status");K(this,"body");K(this,"headers");this.name="ClientError",this.code=s,this.status=t,this.body=a,this.headers=r}};function FE(e){let t,a,n,r=[],o=new Map;for(let i of e)xn(i)&&(t=i),Av(i)&&(a=i),o9(i)&&(n=i.data.message??void 0),i.type==="input.requested"&&r.push(...i.data.requests),i.type==="authorization.required"&&o.set(i.data.name,i.data),i.type==="authorization.completed"&&o.delete(i.data.name);return{boundary:t,failure:a,inputRequests:r,message:n,pendingAuthorizations:[...o.values()],status:t?.type==="session.waiting"?"waiting":t?.type==="session.failed"?"failed":"completed"}}function o9(e){return e.type==="message.completed"&&e.data.finishReason!=="tool-calls"}function Bi(e,t){t.type==="authorization.required"&&t.data.webhookUrl!==void 0?e.add(t.data.name):t.type==="authorization.completed"&&e.delete(t.data.name)}var i9=/^\/eve\/[a-z0-9][a-z0-9_-]*$/,s9=/^\/eve\/[a-z0-9][a-z0-9_-]*\/v1$/;function Mv(e,t){let a=l9(e),n=t.startsWith("/")?t:`/${t}`;if(n===Ya||n.startsWith(`${Ya}/`)){if(i9.test(a))return`${a}${n.slice(4)}`;if(s9.test(a))return`${a}${n.slice(Ya.length)}`}return`${a}${n}`}function l9(e){return e==="/"?"":e.endsWith("/")?e.slice(0,-1):e}function yr(e,t,a){let n=t.indexOf("?"),r=n===-1?t:t.slice(0,n),o=n===-1?"":t.slice(n+1),i=r.startsWith("/")?r:`/${r}`;if(u9(e)){let u=new URL(e),c=HE(u.pathname);return u.pathname=Mv(c,i),qE(u.searchParams,o),jE(u.searchParams,a),u.hash="",u.toString()}let s=new URL(e,"http://eve.local"),l=HE(s.pathname);return qE(s.searchParams,o),jE(s.searchParams,a),`${Mv(l,i)}${c9(s.searchParams)}`}function qE(e,t){if(t.length!==0)for(let[a,n]of new URLSearchParams(t))e.append(a,n)}function u9(e){return/^[a-z][a-z\d+\-.]*:/i.test(e)}function HE(e){return e==="/"?"":e.endsWith("/")?e.slice(0,-1):e}function jE(e,t){if(t!==void 0)for(let[a,n]of Object.entries(t))e.set(a,n)}function c9(e){let t=e.toString();return t.length===0?"":`?${t}`}function VE(e){let t;for(let a of e)d9(a)&&(t=a.data.result);return t}function d9(e){return e.type==="result.completed"}var Rv=Symbol("consumeMessageResponse"),Dv=Symbol("acceptedDeliveryId"),$E,Vc,Ho,$c,Wc,Ll,zi,lm,GE,WE,_v=(WE=class{constructor(e){ue(this,lm);K(this,"sessionId");K(this,$E);ue(this,Vc);ue(this,Ho);ue(this,$c,!1);ue(this,Wc);ue(this,Ll,!1);ue(this,zi,Promise.withResolvers());q(this,Vc,e.cancelTurn),this.sessionId=e.sessionId,this[Dv]=e.deliveryId,q(this,Wc,e.createStream)}cancel(){if(b(this,Ll))return Promise.resolve({status:"no_active_turn"});if(b(this,Ho)!==void 0)return b(this,Ho);let e=b(this,zi).promise.then(t=>t===void 0?{status:"no_active_turn"}:b(this,Vc).call(this,t));return q(this,Ho,e),e.catch(()=>{!b(this,Ll)&&b(this,Ho)===e&&q(this,Ho,void 0)}),e}async result(){let e=[];for await(let a of this)e.push(a);let t=FE(e);return{data:VE(e),events:e,inputRequests:t.inputRequests,message:t.message,sessionId:this.sessionId,status:t.status}}[($E=Dv,Symbol.asyncIterator)](){return this[Rv]()}[Rv](e){if(b(this,$c))throw Error("MessageResponse has already been consumed.");return q(this,$c,!0),Y(this,lm,GE).call(this,e)}},Vc=new WeakMap,Ho=new WeakMap,$c=new WeakMap,Wc=new WeakMap,Ll=new WeakMap,zi=new WeakMap,lm=new WeakSet,GE=async function*(e){try{for await(let t of b(this,Wc).call(this,e))t.type==="turn.started"?b(this,zi).resolve(t.data.turnId):xn(t)&&(q(this,Ll,!0),b(this,zi).resolve(void 0)),yield t}finally{b(this,zi).resolve(void 0)}},WE);function Pv(e){return e[Dv]}function XE(e,t){return e[Rv](t)}function YE(e,t){switch(e){case"21":case"22":case"23":case"24":return f9(e,t);case"25":return p9(t);default:return m9(e)}}function f9(e,t){if(t.type==="message.appended")return KE(t.data.messageSoFar,t.data.messageDelta,"message",e),{data:{messageDelta:t.data.messageDelta,sequence:t.data.sequence,stepIndex:t.data.stepIndex,turnId:t.data.turnId},meta:t.meta,type:"message.appended"};if(t.type==="reasoning.appended")return KE(t.data.reasoningSoFar,t.data.reasoningDelta,"reasoning",e),{data:{reasoningDelta:t.data.reasoningDelta,sequence:t.data.sequence,stepIndex:t.data.stepIndex,turnId:t.data.turnId},meta:t.meta,type:"reasoning.appended"};if(t.type==="action.input.appended"){if(e!==void 0&&e!=="24")throw TypeError(`Invalid action input append for stream version ${e}.`);return h9(t.data.inputTextOffset,e),{data:{callId:t.data.callId,inputTextDelta:t.data.inputTextDelta,sequence:t.data.sequence,stepIndex:t.data.stepIndex,toolName:t.data.toolName,turnId:t.data.turnId},meta:t.meta,type:"action.input.appended"}}return t}function p9(e){return e.type==="message.appended"?(Ov(e.data.messageDelta,"message"),Gc(e.data,"messageOffset","message"),Gc(e.data,"messageSoFar","message")):e.type==="reasoning.appended"?(Ov(e.data.reasoningDelta,"reasoning"),Gc(e.data,"reasoningOffset","reasoning"),Gc(e.data,"reasoningSoFar","reasoning")):e.type==="action.input.appended"&&(Ov(e.data.inputTextDelta,"action input"),Gc(e.data,"inputTextOffset","action input")),e}function Ov(e,t){if(typeof e!="string")throw TypeError(`Invalid ${t} append delta for stream version 25.`)}function Gc(e,t,a){if(t in e)throw TypeError(`Invalid ${a} append shape for stream version 25.`)}function m9(e){throw TypeError(`Unsupported message stream version: ${String(e)}.`)}function h9(e,t){if(!Number.isSafeInteger(e)||e<0){let a=t===void 0?"persisted stream":`stream version ${t}`;throw TypeError(`Invalid action input append offset for ${a}.`)}}function KE(e,t,a,n){let r=e.length-t.length;if(r<0||e.slice(r)!==t){let o=n===void 0?"persisted stream":`stream version ${n}`;throw TypeError(`Invalid cumulative ${a} append for ${o}.`)}}function Nv(e){if(e instanceof DOMException)return e.name==="AbortError";if(!(e instanceof Error))return!1;let t="code"in e&&typeof e.code=="string"?e.code:void 0;return e.name==="AbortError"||e.message==="terminated"||t==="UND_ERR_SOCKET"||e instanceof TypeError&&/^(?:failed to fetch|fetch failed)$/i.test(e.message)||/abort|cancel|disconnect|premature close|socket|terminated/i.test(e.message)}async function*QE(e,t){let a=e.getReader(),n=new TextDecoder,r="",o=!1,i=()=>{a.cancel().catch(()=>{})};t.signal?.addEventListener("abort",i,{once:!0});try{for(;;){t.signal?.throwIfAborted();let l=await g9(a,t?.idleTimeoutMs);if(t.signal?.throwIfAborted(),l.done){o=!0,r+=n.decode();break}l.value&&(r+=n.decode(l.value,{stream:!0}));let u=r.indexOf(`
135
+ `)}})}};var xv=am(()=>Cl(f.union([f.strictObject({type:f.literal("text-start"),id:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("text-delta"),id:f.string(),delta:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("text-end"),id:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("error"),errorText:f.string()}),f.strictObject({type:f.literal("tool-input-start"),toolCallId:f.string(),toolName:f.string(),providerExecuted:f.boolean().optional(),providerMetadata:pe.optional(),dynamic:f.boolean().optional(),title:f.string().optional()}),f.strictObject({type:f.literal("tool-input-delta"),toolCallId:f.string(),inputTextDelta:f.string()}),f.strictObject({type:f.literal("tool-input-available"),toolCallId:f.string(),toolName:f.string(),input:f.unknown(),providerExecuted:f.boolean().optional(),providerMetadata:pe.optional(),dynamic:f.boolean().optional(),title:f.string().optional()}),f.strictObject({type:f.literal("tool-input-error"),toolCallId:f.string(),toolName:f.string(),input:f.unknown(),providerExecuted:f.boolean().optional(),providerMetadata:pe.optional(),dynamic:f.boolean().optional(),errorText:f.string(),title:f.string().optional()}),f.strictObject({type:f.literal("tool-approval-request"),approvalId:f.string(),toolCallId:f.string()}),f.strictObject({type:f.literal("tool-output-available"),toolCallId:f.string(),output:f.unknown(),providerExecuted:f.boolean().optional(),providerMetadata:pe.optional(),dynamic:f.boolean().optional(),preliminary:f.boolean().optional()}),f.strictObject({type:f.literal("tool-output-error"),toolCallId:f.string(),errorText:f.string(),providerExecuted:f.boolean().optional(),providerMetadata:pe.optional(),dynamic:f.boolean().optional()}),f.strictObject({type:f.literal("tool-output-denied"),toolCallId:f.string()}),f.strictObject({type:f.literal("reasoning-start"),id:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("reasoning-delta"),id:f.string(),delta:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("reasoning-end"),id:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("source-url"),sourceId:f.string(),url:f.string(),title:f.string().optional(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("source-document"),sourceId:f.string(),mediaType:f.string(),title:f.string(),filename:f.string().optional(),providerMetadata:pe.optional()}),f.strictObject({type:f.literal("file"),url:f.string(),mediaType:f.string(),providerMetadata:pe.optional()}),f.strictObject({type:f.custom(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:f.string().optional(),data:f.unknown(),transient:f.boolean().optional()}),f.strictObject({type:f.literal("start-step")}),f.strictObject({type:f.literal("finish-step")}),f.strictObject({type:f.literal("start"),messageId:f.string().optional(),messageMetadata:f.unknown().optional()}),f.strictObject({type:f.literal("finish"),finishReason:f.enum(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:f.unknown().optional()}),f.strictObject({type:f.literal("abort"),reason:f.string().optional()}),f.strictObject({type:f.literal("message-metadata"),messageMetadata:f.unknown()})])));function B6(e){return e.type.startsWith("data-")}function vv(e){return e.type.startsWith("tool-")}function z6(e){return e.type==="dynamic-tool"}function rm(e){return vv(e)||z6(e)}function sE(e){return e.type.split("-").slice(1).join("-")}function vE({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function xE({stream:e,messageMetadataSchema:t,dataPartSchemas:a,runUpdateMessageJob:n,onError:r,onToolCall:o,onData:i}){return e.pipeThrough(new TransformStream({async transform(s,l){await n(async({state:u,write:c})=>{var d,p,m,h;function v(g){let E=u.message.parts.filter(rm).find(T=>T.toolCallId===g);if(E==null)throw new Tl({chunkType:"tool-invocation",chunkId:g,message:`No tool invocation found for tool call ID "${g}".`});return E}function I(g){var S;let E=u.message.parts.find(O=>vv(O)&&O.toolCallId===g.toolCallId),T=g,R=E;if(E!=null){E.state=g.state,R.input=T.input,R.output=T.output,R.errorText=T.errorText,R.rawInput=T.rawInput,R.preliminary=T.preliminary,g.title!==void 0&&(R.title=g.title),R.providerExecuted=(S=T.providerExecuted)!=null?S:E.providerExecuted;let O=T.providerMetadata;if(O!=null)if(g.state==="output-available"||g.state==="output-error"){let U=E;U.resultProviderMetadata=O}else E.callProviderMetadata=O}else u.message.parts.push({type:`tool-${g.toolName}`,toolCallId:g.toolCallId,state:g.state,title:g.title,input:T.input,output:T.output,rawInput:T.rawInput,errorText:T.errorText,providerExecuted:T.providerExecuted,preliminary:T.preliminary,...T.providerMetadata!=null&&(g.state==="output-available"||g.state==="output-error")?{resultProviderMetadata:T.providerMetadata}:{},...T.providerMetadata!=null&&!(g.state==="output-available"||g.state==="output-error")?{callProviderMetadata:T.providerMetadata}:{}})}function y(g){var S,E;let T=u.message.parts.find(U=>U.type==="dynamic-tool"&&U.toolCallId===g.toolCallId),R=g,O=T;if(T!=null){T.state=g.state,O.toolName=g.toolName,O.input=R.input,O.output=R.output,O.errorText=R.errorText,O.rawInput=(S=R.rawInput)!=null?S:O.rawInput,O.preliminary=R.preliminary,g.title!==void 0&&(O.title=g.title),O.providerExecuted=(E=R.providerExecuted)!=null?E:T.providerExecuted;let U=R.providerMetadata;if(U!=null)if(g.state==="output-available"||g.state==="output-error"){let A=T;A.resultProviderMetadata=U}else T.callProviderMetadata=U}else u.message.parts.push({type:"dynamic-tool",toolName:g.toolName,toolCallId:g.toolCallId,state:g.state,input:R.input,output:R.output,errorText:R.errorText,preliminary:R.preliminary,providerExecuted:R.providerExecuted,title:g.title,...R.providerMetadata!=null&&(g.state==="output-available"||g.state==="output-error")?{resultProviderMetadata:R.providerMetadata}:{},...R.providerMetadata!=null&&!(g.state==="output-available"||g.state==="output-error")?{callProviderMetadata:R.providerMetadata}:{}})}async function w(g){if(g!=null){let S=u.message.metadata!=null?wE(u.message.metadata,g):g;t!=null&&await nm({value:S,schema:t,context:{field:"message.metadata",entityId:u.message.id}}),u.message.metadata=S}}switch(s.type){case"text-start":{let g={type:"text",text:"",providerMetadata:s.providerMetadata,state:"streaming"};u.activeTextParts[s.id]=g,u.message.parts.push(g),c();break}case"text-delta":{let g=u.activeTextParts[s.id];if(g==null)throw new Tl({chunkType:"text-delta",chunkId:s.id,message:`Received text-delta for missing text part with ID "${s.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});g.text+=s.delta,g.providerMetadata=(d=s.providerMetadata)!=null?d:g.providerMetadata,c();break}case"text-end":{let g=u.activeTextParts[s.id];if(g==null)throw new Tl({chunkType:"text-end",chunkId:s.id,message:`Received text-end for missing text part with ID "${s.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});g.state="done",g.providerMetadata=(p=s.providerMetadata)!=null?p:g.providerMetadata,delete u.activeTextParts[s.id],c();break}case"reasoning-start":{let g={type:"reasoning",text:"",providerMetadata:s.providerMetadata,state:"streaming"};u.activeReasoningParts[s.id]=g,u.message.parts.push(g),c();break}case"reasoning-delta":{let g=u.activeReasoningParts[s.id];if(g==null)throw new Tl({chunkType:"reasoning-delta",chunkId:s.id,message:`Received reasoning-delta for missing reasoning part with ID "${s.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});g.text+=s.delta,g.providerMetadata=(m=s.providerMetadata)!=null?m:g.providerMetadata,c();break}case"reasoning-end":{let g=u.activeReasoningParts[s.id];if(g==null)throw new Tl({chunkType:"reasoning-end",chunkId:s.id,message:`Received reasoning-end for missing reasoning part with ID "${s.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});g.providerMetadata=(h=s.providerMetadata)!=null?h:g.providerMetadata,g.state="done",delete u.activeReasoningParts[s.id],c();break}case"file":{u.message.parts.push({type:"file",mediaType:s.mediaType,url:s.url,...s.providerMetadata!=null?{providerMetadata:s.providerMetadata}:{}}),c();break}case"source-url":{u.message.parts.push({type:"source-url",sourceId:s.sourceId,url:s.url,title:s.title,providerMetadata:s.providerMetadata}),c();break}case"source-document":{u.message.parts.push({type:"source-document",sourceId:s.sourceId,mediaType:s.mediaType,title:s.title,filename:s.filename,providerMetadata:s.providerMetadata}),c();break}case"tool-input-start":{let g=u.message.parts.filter(vv);u.partialToolCalls[s.toolCallId]={text:"",toolName:s.toolName,index:g.length,dynamic:s.dynamic,title:s.title},s.dynamic?y({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted,title:s.title,providerMetadata:s.providerMetadata}):I({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted,title:s.title,providerMetadata:s.providerMetadata}),c();break}case"tool-input-delta":{let g=u.partialToolCalls[s.toolCallId];if(g==null)throw new Tl({chunkType:"tool-input-delta",chunkId:s.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${s.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});g.text+=s.inputTextDelta;let{value:S}=await Fc(g.text);g.dynamic?y({toolCallId:s.toolCallId,toolName:g.toolName,state:"input-streaming",input:S,title:g.title}):I({toolCallId:s.toolCallId,toolName:g.toolName,state:"input-streaming",input:S,title:g.title}),c();break}case"tool-input-available":{s.dynamic?y({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-available",input:s.input,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata,title:s.title}):I({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-available",input:s.input,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata,title:s.title}),c(),o&&!s.providerExecuted&&await o({toolCall:s});break}case"tool-input-error":{let g=u.message.parts.filter(rm).find(E=>E.toolCallId===s.toolCallId);(g!=null?g.type==="dynamic-tool":!!s.dynamic)?y({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}):I({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:void 0,rawInput:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}),c();break}case"tool-approval-request":{let g=v(s.toolCallId);g.state="approval-requested",g.approval={id:s.approvalId},c();break}case"tool-output-denied":{let g=v(s.toolCallId);g.state="output-denied",c();break}case"tool-output-available":{let g=v(s.toolCallId);g.type==="dynamic-tool"?y({toolCallId:s.toolCallId,toolName:g.toolName,state:"output-available",input:g.input,output:s.output,preliminary:s.preliminary,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata,title:g.title}):I({toolCallId:s.toolCallId,toolName:sE(g),state:"output-available",input:g.input,output:s.output,providerExecuted:s.providerExecuted,preliminary:s.preliminary,providerMetadata:s.providerMetadata,title:g.title}),c();break}case"tool-output-error":{let g=v(s.toolCallId);g.type==="dynamic-tool"?y({toolCallId:s.toolCallId,toolName:g.toolName,state:"output-error",input:g.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata,title:g.title}):I({toolCallId:s.toolCallId,toolName:sE(g),state:"output-error",input:g.input,rawInput:g.rawInput,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata,title:g.title}),c();break}case"start-step":{u.message.parts.push({type:"step-start"});break}case"finish-step":{u.activeTextParts={},u.activeReasoningParts={};break}case"start":{s.messageId!=null&&(u.message.id=s.messageId),await w(s.messageMetadata),(s.messageId!=null||s.messageMetadata!=null)&&c();break}case"finish":{s.finishReason!=null&&(u.finishReason=s.finishReason),await w(s.messageMetadata),s.messageMetadata!=null&&c();break}case"message-metadata":{await w(s.messageMetadata),s.messageMetadata!=null&&c();break}case"error":{r?.(new Error(s.errorText));break}default:if(B6(s)){if(a?.[s.type]!=null){let E=u.message.parts.findIndex(R=>"id"in R&&"data"in R&&R.id===s.id&&R.type===s.type),T=E>=0?E:u.message.parts.length;await nm({value:s.data,schema:a[s.type],context:{field:`message.parts[${T}].data`,entityName:s.type,entityId:s.id}})}let g=s;if(g.transient){i?.(g);break}let S=g.id!=null?u.message.parts.find(E=>g.type===E.type&&g.id===E.id):void 0;S!=null?S.data=g.data:u.message.parts.push(g),i?.(g),c()}}l.enqueue(s)})}}))}function F6(e){let t=e.pipeThrough(new TransformStream);return t[Symbol.asyncIterator]=function(){let a=this.getReader(),n=!1;async function r(o){var i;if(!n){n=!0;try{o&&await((i=a.cancel)==null?void 0:i.call(a))}finally{try{a.releaseLock()}catch{}}}}return{async next(){if(n)return{done:!0,value:void 0};let{done:o,value:i}=await a.read();return o?(await r(!0),{done:!0,value:void 0}):{done:!1,value:i}},async return(){return await r(!0),{done:!0,value:void 0}},async throw(o){throw await r(!0),o}}},t}async function bE({stream:e,onError:t}){let a=e.getReader();try{for(;;){let{done:n}=await a.read();if(n)break}}catch(n){t?.(n)}finally{a.releaseLock()}}var ote=mr({prefix:"aitxt",size:24});function SE({message:e,stream:t,onError:a,terminateOnError:n=!1}){var r;let o,i=!1,s=new ReadableStream({start(c){o=c}}),l=vE({messageId:(r=e?.id)!=null?r:"",lastMessage:e}),u=c=>{a?.(c),!i&&n&&(i=!0,o?.error(c))};return bE({stream:xE({stream:t,runUpdateMessageJob(c){return c({state:l,write:()=>{o?.enqueue(structuredClone(l.message))}})},onError:u}),onError:u}).finally(()=>{i||o?.close()}),F6(s)}var lte=am(()=>Cl(f.array(f.object({id:f.string(),role:f.enum(["system","user","assistant"]),metadata:f.unknown().optional(),parts:f.array(f.union([f.object({type:f.literal("text"),text:f.string(),state:f.enum(["streaming","done"]).optional(),providerMetadata:pe.optional()}),f.object({type:f.literal("reasoning"),text:f.string(),state:f.enum(["streaming","done"]).optional(),providerMetadata:pe.optional()}),f.object({type:f.literal("source-url"),sourceId:f.string(),url:f.string(),title:f.string().optional(),providerMetadata:pe.optional()}),f.object({type:f.literal("source-document"),sourceId:f.string(),mediaType:f.string(),title:f.string(),filename:f.string().optional(),providerMetadata:pe.optional()}),f.object({type:f.literal("file"),mediaType:f.string(),filename:f.string().optional(),url:f.string(),providerMetadata:pe.optional()}),f.object({type:f.literal("step-start")}),f.object({type:f.string().startsWith("data-"),id:f.string().optional(),data:f.unknown()}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("input-streaming"),input:f.unknown().optional(),providerExecuted:f.boolean().optional(),callProviderMetadata:pe.optional(),output:f.never().optional(),errorText:f.never().optional(),approval:f.never().optional()}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("input-available"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.never().optional()}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("approval-requested"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.never().optional(),reason:f.never().optional()})}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("approval-responded"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.boolean(),reason:f.string().optional()})}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("output-available"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.unknown(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),resultProviderMetadata:pe.optional(),preliminary:f.boolean().optional(),approval:f.object({id:f.string(),approved:f.literal(!0),reason:f.string().optional()}).optional()}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("output-error"),input:f.unknown(),rawInput:f.unknown().optional(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.string(),callProviderMetadata:pe.optional(),resultProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.literal(!0),reason:f.string().optional()}).optional()}),f.object({type:f.literal("dynamic-tool"),toolName:f.string(),toolCallId:f.string(),state:f.literal("output-denied"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.literal(!1),reason:f.string().optional()})}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("input-streaming"),providerExecuted:f.boolean().optional(),callProviderMetadata:pe.optional(),input:f.unknown().optional(),output:f.never().optional(),errorText:f.never().optional(),approval:f.never().optional()}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("input-available"),providerExecuted:f.boolean().optional(),input:f.unknown(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.never().optional()}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("approval-requested"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.never().optional(),reason:f.never().optional()})}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("approval-responded"),input:f.unknown(),providerExecuted:f.boolean().optional(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.boolean(),reason:f.string().optional()})}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("output-available"),providerExecuted:f.boolean().optional(),input:f.unknown(),output:f.unknown(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),resultProviderMetadata:pe.optional(),preliminary:f.boolean().optional(),approval:f.object({id:f.string(),approved:f.literal(!0),reason:f.string().optional()}).optional()}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("output-error"),providerExecuted:f.boolean().optional(),input:f.unknown(),rawInput:f.unknown().optional(),output:f.never().optional(),errorText:f.string(),callProviderMetadata:pe.optional(),resultProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.literal(!0),reason:f.string().optional()}).optional()}),f.object({type:f.string().startsWith("tool-"),toolCallId:f.string(),state:f.literal("output-denied"),providerExecuted:f.boolean().optional(),input:f.unknown(),output:f.never().optional(),errorText:f.never().optional(),callProviderMetadata:pe.optional(),approval:f.object({id:f.string(),approved:f.literal(!1),reason:f.string().optional()})})])).nonempty("Message must contain at least one part")})).nonempty("Messages array must not be empty")));var cte=mr({prefix:"aiobj",size:24});function IE(e){return({url:t,abortSignal:a})=>x6({url:t,maxBytes:e?.maxBytes,abortSignal:a})}var q6=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,a)=>{this.queue.push(async()=>{try{await e(),t()}catch(n){a(n)}}),this.processQueue()})}};var fte=mr({prefix:"aiobj",size:24});var pte=IE();var H6="AI_NoSuchProviderError",j6=`vercel.ai.error.${H6}`,V6=Symbol.for(j6),$6;$6=V6;var mte=IE();async function W6(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{let{name:a,type:n}=t,r=await new Promise((o,i)=>{let s=new FileReader;s.onload=l=>{var u;o((u=l.target)==null?void 0:u.result)},s.onerror=l=>i(l),s.readAsDataURL(t)});return{type:"file",mediaType:n,filename:a,url:r}}))}var G6=class{constructor({api:e="/api/chat",credentials:t,headers:a,body:n,fetch:r,prepareSendMessagesRequest:o,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=a,this.body=n,this.fetch=r,this.prepareSendMessagesRequest=o,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){var a,n,r,o,i;let s=await hr(this.body),l=await hr(this.headers),u=await hr(this.credentials),c={...Fo(l),...Fo(t.headers)},d=await((a=this.prepareSendMessagesRequest)==null?void 0:a.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...s,...t.body},headers:c,credentials:u,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),p=(n=d?.api)!=null?n:this.api,m=d?.headers!==void 0?Fo(d.headers):c,h=d?.body!==void 0?d.body:{...s,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},v=(r=d?.credentials)!=null?r:u,y=await((o=this.fetch)!=null?o:globalThis.fetch)(p,{method:"POST",headers:{"Content-Type":"application/json",...m},body:JSON.stringify(h),credentials:v,signal:e});if(!y.ok)throw new Error((i=await y.text())!=null?i:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(e){var t,a,n,r,o;let i=await hr(this.body),s=await hr(this.headers),l=await hr(this.credentials),u={...Fo(s),...Fo(e.headers)},c=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...i,...e.body},headers:u,credentials:l,requestMetadata:e.metadata})),d=(a=c?.api)!=null?a:`${this.api}/${e.chatId}/stream`,p=c?.headers!==void 0?Fo(c.headers):u,m=(n=c?.credentials)!=null?n:l,v=await((r=this.fetch)!=null?r:globalThis.fetch)(d,{method:"GET",headers:p,credentials:m});if(v.status===204)return null;if(!v.ok)throw new Error((o=await v.text())!=null?o:"Failed to fetch the chat response.");if(!v.body)throw new Error("The response body is empty.");return this.processResponseStream(v.body)}},bv=class extends G6{constructor(e={}){super(e)}processResponseStream(e){return wv({stream:e,schema:xv}).pipeThrough(new TransformStream({async transform(t,a){if(!t.success)throw t.error;a.enqueue(t.value)}}))}},CE=class{constructor({generateId:e=gv,id:t=e(),transport:a=new bv,messageMetadataSchema:n,dataPartSchemas:r,state:o,onError:i,onToolCall:s,onFinish:l,onData:u,sendAutomaticallyWhen:c}){this.activeResponse=void 0,this.jobExecutor=new q6,this.sendMessage=async(d,p)=>{var m,h,v,I;if(d==null){await this.makeRequest({trigger:"submit-message",messageId:(m=this.lastMessage)==null?void 0:m.id,...p});return}let y;if("text"in d||"files"in d?y={parts:[...Array.isArray(d.files)?d.files:await W6(d.files),..."text"in d&&d.text!=null?[{type:"text",text:d.text}]:[]]}:y=d,d.messageId!=null){let w=this.state.messages.findIndex(g=>g.id===d.messageId);if(w===-1)throw new Error(`message with id ${d.messageId} not found`);if(this.state.messages[w].role!=="user")throw new Error(`message with id ${d.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,w+1),this.state.replaceMessage(w,{...y,id:d.messageId,role:(h=y.role)!=null?h:"user",metadata:d.metadata})}else this.state.pushMessage({...y,id:(v=y.id)!=null?v:this.generateId(),role:(I=y.role)!=null?I:"user",metadata:d.metadata});await this.makeRequest({trigger:"submit-message",messageId:d.messageId,...p})},this.regenerate=async({messageId:d,...p}={})=>{let m=d==null?this.state.messages.length-1:this.state.messages.findIndex(h=>h.id===d);if(m===-1)throw new Error(`message ${d} not found`);this.state.messages=this.state.messages.slice(0,this.messages[m].role==="assistant"?m:m+1),await this.makeRequest({trigger:"regenerate-message",messageId:d,...p})},this.resumeStream=async(d={})=>{await this.makeRequest({trigger:"resume-stream",...d})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:d,approved:p,reason:m,options:h})=>this.jobExecutor.run(async()=>{let v=this.state.messages,I=v[v.length-1],y=w=>rm(w)&&w.state==="approval-requested"&&w.approval.id===d?{...w,state:"approval-responded",approval:{id:d,approved:p,reason:m}}:w;this.state.replaceMessage(v.length-1,{...I,parts:I.parts.map(y)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(y)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(w=>{var g;w&&this.makeRequest({trigger:"submit-message",messageId:(g=this.lastMessage)==null?void 0:g.id,...h})})}),this.addToolOutput=async({state:d="output-available",toolCallId:p,output:m,errorText:h,options:v})=>this.jobExecutor.run(async()=>{let I=this.state.messages,y=I[I.length-1],w=g=>rm(g)&&g.toolCallId===p?{...g,state:d,output:m,errorText:h}:g;this.state.replaceMessage(I.length-1,{...y,parts:y.parts.map(w)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(w)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(g=>{var S;g&&this.makeRequest({trigger:"submit-message",messageId:(S=this.lastMessage)==null?void 0:S.id,...v})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var d;this.status!=="streaming"&&this.status!=="submitted"||(d=this.activeResponse)!=null&&d.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=a,this.generateId=e,this.messageMetadataSchema=n,this.dataPartSchemas=r,this.state=o,this.onError=i,this.onToolCall=s,this.onFinish=l,this.onData=u,this.sendAutomaticallyWhen=c}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:a,body:n,messageId:r}){var o,i,s;let l;if(e==="resume-stream")try{let m=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:a,body:n});if(m==null)return;l=m}catch(m){this.onError&&m instanceof Error&&this.onError(m),this.setStatus({status:"error",error:m});return}this.setStatus({status:"submitted",error:void 0});let u=this.lastMessage,c=!1,d=!1,p=!1;try{let m={state:vE({lastMessage:this.state.snapshot(u),messageId:this.generateId()}),abortController:new AbortController};m.abortController.signal.addEventListener("abort",()=>{c=!0}),this.activeResponse=m;let h;e==="resume-stream"?h=l:h=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:m.abortController.signal,metadata:t,headers:a,body:n,trigger:e,messageId:r});let v=I=>this.jobExecutor.run(()=>I({state:m.state,write:()=>{var y;this.setStatus({status:"streaming"}),m.state.message.id===((y=this.lastMessage)==null?void 0:y.id)?this.state.replaceMessage(this.state.messages.length-1,m.state.message):this.state.pushMessage(m.state.message)}}));await bE({stream:xE({stream:h,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:v,onError:I=>{throw I}}),onError:I=>{throw I}}),this.setStatus({status:"ready"})}catch(m){if(c||m.name==="AbortError")return c=!0,this.setStatus({status:"ready"}),null;p=!0,m instanceof TypeError&&(m.message.toLowerCase().includes("fetch")||m.message.toLowerCase().includes("network"))&&(d=!0),this.onError&&m instanceof Error&&this.onError(m),this.setStatus({status:"error",error:m})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:c,isDisconnect:d,isError:p,finishReason:(o=this.activeResponse)==null?void 0:o.state.finishReason})}catch(m){console.error(m)}this.activeResponse=void 0}!p&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(s=this.lastMessage)==null?void 0:s.id,metadata:t,headers:a,body:n})}};function om(){let e=new Set,t=new Map,a,n=0,r=!1,o=!1,i=c=>(a||(a=`text-${++n}`,c.enqueue({type:"text-start",id:a})),a),s=c=>{a&&(c.enqueue({type:"text-end",id:a}),a=void 0)},l=(c,d)=>{c.enqueue({type:"text-delta",id:i(c),delta:d})},u=(c,d,p)=>{e.has(d.callId)||(e.add(d.callId),c.enqueue({type:"tool-input-available",toolCallId:d.callId,toolName:d.toolName??d.kind,input:p,dynamic:!0}))};return new TransformStream({start(c){c.enqueue({type:"start",messageId:crypto.randomUUID()})},transform(c,d){switch(c.type){case"step.started":{t.set(c.data.stepIndex,c.data.modelId),d.enqueue({type:"start-step"}),r=!0;break}case"message.appended":{c.data.messageDelta&&l(d,c.data.messageDelta);break}case"message.completed":{!a&&c.data.message&&l(d,c.data.message),s(d);break}case"actions.requested":{s(d);for(let p of c.data.actions)u(d,p,p.input);break}case"action.result":{let{result:p,status:m,error:h}=c.data;if(p.kind!=="tool-result")break;if(u(d,p,{}),p.isError===!0||m!=="completed"){d.enqueue({type:"tool-output-error",toolCallId:p.callId,errorText:h?.message??"The tool call failed.",dynamic:!0});break}d.enqueue({type:"tool-output-available",toolCallId:p.callId,output:p.output,dynamic:!0});break}case"step.completed":{let{stepIndex:p,usage:m}=c.data;s(d),r&&(d.enqueue({type:"finish-step"}),r=!1),d.enqueue({type:"message-metadata",messageMetadata:{"waniwani/step":{stepIndex:p,modelId:t.get(p),usage:m}}});break}case"turn.failed":case"session.failed":{o=!0,d.enqueue({type:"error",errorText:c.data.message||"The agent could not answer."});break}}},flush(c){s(c),r&&c.enqueue({type:"finish-step"}),c.enqueue({type:"finish",finishReason:o?"error":"stop"})}})}async function X6(e){let t=new ReadableStream({start(n){for(let r of e)n.enqueue(r);n.close()}}).pipeThrough(om()),a;for await(let n of SE({stream:t}))a=n;return a?.parts.length?a:void 0}async function kE(e){let t=[];for(let n of e){let r=n.type==="message.received"&&!n.data.kind?n.data.message:void 0;r!==void 0?t.push({visitor:{id:n.meta?.id??crypto.randomUUID(),role:"user",parts:[{type:"text",text:r}]},events:[]}):t.at(-1)?.events.push(n)}let a=[];for(let n of t){a.push(n.visitor);let r=await X6(n.events);r&&a.push(r)}return a}var Ni=Symbol("invalid-json-value-candidate");function Iv(e){let t=Sv(e);if(t===Ni)throw TypeError("Expected a JSON-serializable value.");return t}function qc(e){let t=Iv(e);if(!K6(t))throw TypeError("Expected a JSON-serializable object.");return t}function Sv(e,t=new WeakSet){if(e===null||typeof e=="boolean"||typeof e=="string")return e;if(typeof e=="number")return Number.isFinite(e)?e:Ni;if(Array.isArray(e)){let n=[];for(let r of e){let o=Sv(r,t);if(o===Ni)return Ni;n.push(o)}return n}if(typeof e!="object"||e===void 0||!Y6(e)||t.has(e))return Ni;t.add(e);let a={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let o=Sv(r,t);if(o===Ni)return Ni;a[n]=o}return t.delete(e),a}function K6(e){return e!==null&&!Array.isArray(e)&&typeof e=="object"}function Y6(e){let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}var Hc=f.unknown().transform((e,t)=>{try{return Iv(e)}catch(a){return t.addIssue({code:"custom",message:TE(a,"Expected a JSON-serializable value.")}),f.NEVER}}),Kr=f.unknown().transform((e,t)=>{try{return qc(e)}catch(a){return t.addIssue({code:"custom",message:TE(a,"Expected a JSON-serializable object.")}),f.NEVER}});function TE(e,t){return e instanceof Error?e.message:t}var LE=f.object({callId:f.string(),input:Kr,kind:f.literal("tool-call"),toolName:f.string()}).strict();f.object({callId:f.string(),description:f.string(),input:Kr,kind:f.literal("subagent-call"),name:f.string(),nodeId:f.string(),subagentName:f.string()}).strict(),f.object({callId:f.string(),description:f.string(),input:Kr,kind:f.literal("remote-agent-call"),name:f.string(),nodeId:f.string(),remoteAgentName:f.string()}).strict(),f.object({callId:f.string(),input:Kr,kind:f.literal("workflow-tool-call"),toolName:f.string(),workflowId:f.string()}).strict(),f.object({callId:f.string(),description:f.string(),input:Kr,kind:f.literal("subagent-call"),name:f.string(),nodeId:f.string(),subagentName:f.string()}).strict();var Nte=f.object({callId:f.string(),description:f.string(),input:Kr,kind:f.literal("remote-agent-call"),name:f.string(),nodeId:f.string(),remoteAgentName:f.string()}).strict(),Ute=f.object({callId:f.string(),executeInput:Hc.optional(),input:Kr,kind:f.literal("workflow-task"),nodeId:f.string().optional(),toolName:f.string(),workflowId:f.string()}).strict();f.object({callId:f.string(),input:Kr,kind:f.literal("load-skill")}).strict();f.object({callId:f.string(),isError:f.boolean().optional(),kind:f.literal("tool-result"),output:Hc,toolName:f.string()}).strict(),f.object({callId:f.string(),isError:f.literal(!0),kind:f.literal("subagent-result"),origin:f.literal("dispatch"),output:Hc,subagentName:f.string()}).strict(),f.object({callId:f.string(),isError:f.boolean().optional(),kind:f.literal("load-skill-result"),output:Hc,name:f.string().optional()}).strict();var Z6=f.object({description:f.string().describe("Optional additional context for this option.").optional(),id:f.string().describe("Stable identifier for the option."),label:f.string().describe("User-facing label for the option."),style:f.enum(["primary","danger","default"]).describe("Visual treatment hint for the option.").optional()}).strict(),J6=f.enum(["question","session-limit","tool-approval"]),qte=f.object({action:LE,allowFreeform:f.boolean().describe("Whether the user may answer with freeform text instead of selecting one of the provided options.").optional(),display:f.enum(["confirmation","select","text"]).describe("Rendering hint: the channel uses this to pick a UX treatment.").optional(),kind:J6.describe("Framework-owned request source used to resolve, route, and render the response."),options:f.array(Z6).describe("Selectable answer options to present to the user.").optional(),prompt:f.string().describe("The prompt to present to the user."),requestId:f.string().describe("Stable identifier for this request.")}).strict(),Hte=f.object({optionId:f.string().optional(),requestId:f.string(),text:f.string().optional()}).strict();var Ya="/eve/v1",Vte=`${Ya}/cron/:token`,EE=`${Ya}/health`,AE=`${Ya}/info`,Ta=`${Ya}/session`,$te=`${Ta}/:sessionId`,Wte=`${Ta}/:sessionId/cancel`,Gte=`${Ta}/:sessionId/compact`,Xte=`${Ta}/:sessionId/clear`,Kte=`${Ta}/:sessionId/reset`,Yte=`${Ta}/:sessionId/stream`,Zte=`${Ta}/:parentSessionId/subagents/:callId/:childSessionId/stream`,Jte=`${Ya}/dev/schedules/:scheduleId`,Cv=`${Ya}/dev/runtime-artifacts`,Qte=`${Cv}/rebuild`,eae=`${Cv}/suspend`,tae=`${Cv}/resume`;var aae=`${Ya}/connections/:name/callback/:attemptId/:token`,nae=`${Ya}/callback/:token`,rae=`${Ya}/task-input/:token`,oae=`${Ya}/activity/:token`;function ME(e){return`${Ta}/${encodeURIComponent(e)}`}function RE(e){return`${Ta}/${encodeURIComponent(e)}/cancel`}function DE(e){return`${Ta}/${encodeURIComponent(e)}/compact`}function _E(e){return`${Ta}/${encodeURIComponent(e)}/clear`}function PE(e){return`${Ta}/${encodeURIComponent(e)}/reset`}function kv(e){return`${Ta}/${encodeURIComponent(e)}/stream`}function gr(e){return typeof e=="object"&&!!e&&!Array.isArray(e)}function jc(e){return e instanceof Error?e.message:typeof e=="string"?e:e==null?String(e):gr(e)?typeof e.message=="string"&&e.message.length>0?e.message:Q6(e):String(e)}function Ui(e){if(e instanceof Error)return e;let t=Error(jc(e));return gr(e)&&(typeof e.name=="string"&&e.name.length>0&&(t.name=e.name),typeof e.stack=="string"&&e.stack.length>0&&(t.stack=e.stack),"cause"in e&&e.cause!==void 0&&e.cause!==e&&(t.cause=e.cause)),t}function Q6(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}var NE="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function e9(){let e=-1,t=new Uint8Array(10);return function(){let a=Date.now();if(!Number.isInteger(a)||a<0||a>0xffffffffffff)throw Error(`Cannot mint a ULID: timestamp must be an integer from 0 to ${0xffffffffffff}.`);if(a>e)e=a,OE(t);else if(!r9(t)){if(e===0xffffffffffff)throw Error("Cannot mint a ULID: random component overflowed at the maximum timestamp.");e+=1,OE(t)}return`${a9(e)}${n9(t)}`}}var t9=e9();function OE(e){let t=globalThis.crypto;if(typeof t?.getRandomValues!="function")throw Error("Cannot mint a ULID: globalThis.crypto.getRandomValues is unavailable.");t.getRandomValues(e)}function a9(e){let t=e,a="";for(let n=0;n<10;n+=1)a=NE[t%32]+a,t=Math.floor(t/32);return a}function n9(e){let t=0,a=0,n="";for(let r of e){for(t=t<<8|r,a+=8;a>=5;)a-=5,n+=NE[t>>>a&31];t&=(1<<a)-1}return n}function r9(e){for(let t=e.length-1;t>=0;--t){let a=e[t]??0;if(a<255)return e[t]=a+1,e.fill(0,t+1),!0}return!1}var UE="x-eve-session-id";var Tv="x-eve-stream-tail-index",Lv="x-eve-stream-version";var BE="1",zE="streamControlVersion",Ev={$eve:"stream.lease-ended",version:1},Oae=new TextEncoder;function xn(e){return e.type==="session.completed"||e.type==="session.failed"||e.type==="session.waiting"}function Av(e){return e.type==="session.failed"||e.type==="step.failed"||e.type==="turn.failed"}var im=class extends Error{constructor(t=[]){let a=t.length===0?"":` (${t.join("; ")})`;super(`The server returned an unrecognized response from the eve agent info route.${a}`);K(this,"issues");this.name="AgentInfoResponseError",this.issues=t}};var sm=class extends Error{constructor(t=[]){let a=t.length===0?"":` (${t.join("; ")})`;super(`The server returned an unrecognized eve health response.${a}`);K(this,"issues");this.name="HealthResponseError",this.issues=t}};var Za=class extends Error{constructor(t,a,n){let r=Object.freeze(Object.fromEntries(new Headers(n).entries())),o=r["content-type"]?.toLowerCase(),i=a||`Server returned ${t}.`,s;try{let l=JSON.parse(a);gr(l)&&(typeof l.error=="string"&&(i=l.error),typeof l.code=="string"&&(s=l.code))}catch{o?.includes("text/html")&&(i=`Server returned ${t} with an HTML response. Check the eve route and development server configuration.`)}super(i);K(this,"code");K(this,"status");K(this,"body");K(this,"headers");this.name="ClientError",this.code=s,this.status=t,this.body=a,this.headers=r}};function FE(e){let t,a,n,r=[],o=new Map;for(let i of e)xn(i)&&(t=i),Av(i)&&(a=i),o9(i)&&(n=i.data.message??void 0),i.type==="input.requested"&&r.push(...i.data.requests),i.type==="authorization.required"&&o.set(i.data.name,i.data),i.type==="authorization.completed"&&o.delete(i.data.name);return{boundary:t,failure:a,inputRequests:r,message:n,pendingAuthorizations:[...o.values()],status:t?.type==="session.waiting"?"waiting":t?.type==="session.failed"?"failed":"completed"}}function o9(e){return e.type==="message.completed"&&e.data.finishReason!=="tool-calls"}function Bi(e,t){t.type==="authorization.required"&&t.data.webhookUrl!==void 0?e.add(t.data.name):t.type==="authorization.completed"&&e.delete(t.data.name)}var i9=/^\/eve\/[a-z0-9][a-z0-9_-]*$/,s9=/^\/eve\/[a-z0-9][a-z0-9_-]*\/v1$/;function Mv(e,t){let a=l9(e),n=t.startsWith("/")?t:`/${t}`;if(n===Ya||n.startsWith(`${Ya}/`)){if(i9.test(a))return`${a}${n.slice(4)}`;if(s9.test(a))return`${a}${n.slice(Ya.length)}`}return`${a}${n}`}function l9(e){return e==="/"?"":e.endsWith("/")?e.slice(0,-1):e}function yr(e,t,a){let n=t.indexOf("?"),r=n===-1?t:t.slice(0,n),o=n===-1?"":t.slice(n+1),i=r.startsWith("/")?r:`/${r}`;if(u9(e)){let u=new URL(e),c=HE(u.pathname);return u.pathname=Mv(c,i),qE(u.searchParams,o),jE(u.searchParams,a),u.hash="",u.toString()}let s=new URL(e,"http://eve.local"),l=HE(s.pathname);return qE(s.searchParams,o),jE(s.searchParams,a),`${Mv(l,i)}${c9(s.searchParams)}`}function qE(e,t){if(t.length!==0)for(let[a,n]of new URLSearchParams(t))e.append(a,n)}function u9(e){return/^[a-z][a-z\d+\-.]*:/i.test(e)}function HE(e){return e==="/"?"":e.endsWith("/")?e.slice(0,-1):e}function jE(e,t){if(t!==void 0)for(let[a,n]of Object.entries(t))e.set(a,n)}function c9(e){let t=e.toString();return t.length===0?"":`?${t}`}function VE(e){let t;for(let a of e)d9(a)&&(t=a.data.result);return t}function d9(e){return e.type==="result.completed"}var Rv=Symbol("consumeMessageResponse"),Dv=Symbol("acceptedDeliveryId"),$E,Vc,Ho,$c,Wc,Ll,zi,lm,GE,WE,_v=(WE=class{constructor(e){ue(this,lm);K(this,"sessionId");K(this,$E);ue(this,Vc);ue(this,Ho);ue(this,$c,!1);ue(this,Wc);ue(this,Ll,!1);ue(this,zi,Promise.withResolvers());q(this,Vc,e.cancelTurn),this.sessionId=e.sessionId,this[Dv]=e.deliveryId,q(this,Wc,e.createStream)}cancel(){if(b(this,Ll))return Promise.resolve({status:"no_active_turn"});if(b(this,Ho)!==void 0)return b(this,Ho);let e=b(this,zi).promise.then(t=>t===void 0?{status:"no_active_turn"}:b(this,Vc).call(this,t));return q(this,Ho,e),e.catch(()=>{!b(this,Ll)&&b(this,Ho)===e&&q(this,Ho,void 0)}),e}async result(){let e=[];for await(let a of this)e.push(a);let t=FE(e);return{data:VE(e),events:e,inputRequests:t.inputRequests,message:t.message,sessionId:this.sessionId,status:t.status}}[($E=Dv,Symbol.asyncIterator)](){return this[Rv]()}[Rv](e){if(b(this,$c))throw Error("MessageResponse has already been consumed.");return q(this,$c,!0),Y(this,lm,GE).call(this,e)}},Vc=new WeakMap,Ho=new WeakMap,$c=new WeakMap,Wc=new WeakMap,Ll=new WeakMap,zi=new WeakMap,lm=new WeakSet,GE=async function*(e){try{for await(let t of b(this,Wc).call(this,e))t.type==="turn.started"?b(this,zi).resolve(t.data.turnId):xn(t)&&(q(this,Ll,!0),b(this,zi).resolve(void 0)),yield t}finally{b(this,zi).resolve(void 0)}},WE);function Pv(e){return e[Dv]}function XE(e,t){return e[Rv](t)}function YE(e,t){switch(e){case"21":case"22":case"23":case"24":return f9(e,t);case"25":return p9(t);default:return m9(e)}}function f9(e,t){if(t.type==="message.appended")return KE(t.data.messageSoFar,t.data.messageDelta,"message",e),{data:{messageDelta:t.data.messageDelta,sequence:t.data.sequence,stepIndex:t.data.stepIndex,turnId:t.data.turnId},meta:t.meta,type:"message.appended"};if(t.type==="reasoning.appended")return KE(t.data.reasoningSoFar,t.data.reasoningDelta,"reasoning",e),{data:{reasoningDelta:t.data.reasoningDelta,sequence:t.data.sequence,stepIndex:t.data.stepIndex,turnId:t.data.turnId},meta:t.meta,type:"reasoning.appended"};if(t.type==="action.input.appended"){if(e!==void 0&&e!=="24")throw TypeError(`Invalid action input append for stream version ${e}.`);return h9(t.data.inputTextOffset,e),{data:{callId:t.data.callId,inputTextDelta:t.data.inputTextDelta,sequence:t.data.sequence,stepIndex:t.data.stepIndex,toolName:t.data.toolName,turnId:t.data.turnId},meta:t.meta,type:"action.input.appended"}}return t}function p9(e){return e.type==="message.appended"?(Ov(e.data.messageDelta,"message"),Gc(e.data,"messageOffset","message"),Gc(e.data,"messageSoFar","message")):e.type==="reasoning.appended"?(Ov(e.data.reasoningDelta,"reasoning"),Gc(e.data,"reasoningOffset","reasoning"),Gc(e.data,"reasoningSoFar","reasoning")):e.type==="action.input.appended"&&(Ov(e.data.inputTextDelta,"action input"),Gc(e.data,"inputTextOffset","action input")),e}function Ov(e,t){if(typeof e!="string")throw TypeError(`Invalid ${t} append delta for stream version 25.`)}function Gc(e,t,a){if(t in e)throw TypeError(`Invalid ${a} append shape for stream version 25.`)}function m9(e){throw TypeError(`Unsupported message stream version: ${String(e)}.`)}function h9(e,t){if(!Number.isSafeInteger(e)||e<0){let a=t===void 0?"persisted stream":`stream version ${t}`;throw TypeError(`Invalid action input append offset for ${a}.`)}}function KE(e,t,a,n){let r=e.length-t.length;if(r<0||e.slice(r)!==t){let o=n===void 0?"persisted stream":`stream version ${n}`;throw TypeError(`Invalid cumulative ${a} append for ${o}.`)}}function Nv(e){if(e instanceof DOMException)return e.name==="AbortError";if(!(e instanceof Error))return!1;let t="code"in e&&typeof e.code=="string"?e.code:void 0;return e.name==="AbortError"||e.message==="terminated"||t==="UND_ERR_SOCKET"||e instanceof TypeError&&/^(?:failed to fetch|fetch failed)$/i.test(e.message)||/abort|cancel|disconnect|premature close|socket|terminated/i.test(e.message)}async function*QE(e,t){let a=e.getReader(),n=new TextDecoder,r="",o=!1,i=()=>{a.cancel().catch(()=>{})};t.signal?.addEventListener("abort",i,{once:!0});try{for(;;){t.signal?.throwIfAborted();let l=await g9(a,t?.idleTimeoutMs);if(t.signal?.throwIfAborted(),l.done){o=!0,r+=n.decode();break}l.value&&(r+=n.decode(l.value,{stream:!0}));let u=r.indexOf(`
136
136
  `);for(;u!==-1;){let c=r.slice(0,u).trim();if(r=r.slice(u+1),c.length>0){let d=JSON.parse(c);t.controlVersion==="1"&&ZE(d)?t.onLeaseEnded?.():yield JE(d,t.streamVersion)}u=r.indexOf(`
137
137
  `)}}let s=r.trim();if(s.length>0){let l=JSON.parse(s);t.controlVersion==="1"&&ZE(l)?t.onLeaseEnded?.():yield JE(l,t.streamVersion)}}finally{t.signal?.removeEventListener("abort",i),o||a.cancel().catch(()=>{}),a.releaseLock()}}function ZE(e){if(typeof e!="object"||!e)return!1;let t=e;return t.$eve===Ev.$eve&&t.version===Ev.version}function JE(e,t){return YE(t,e)}async function g9(e,t){let a;try{return t===void 0?await e.read():await Promise.race([e.read(),new Promise((n,r)=>{a=setTimeout(()=>r(new DOMException("Session stream was idle.","AbortError")),t)})])}catch(n){throw n instanceof TypeError?Error("Session stream disconnected.",{cause:n}):n}finally{a!==void 0&&clearTimeout(a)}}var y9={21:!0,22:!0,23:!0,24:!0,25:!0};function eA(e){let t=e.get(Lv);if(t!==null&&Object.hasOwn(y9,t))return t;throw TypeError(t===null?`Missing ${Lv} response header.`:`Unsupported message stream version: ${t}.`)}var Fi={retryableErrorStatuses:new Set([404,409,425,500,502,503,504]),streamIdleReconnectPolicy:{baseDelayMs:250,maxAttempts:5,maxDelayMs:4e3},streamOpenReconnectPolicy:{baseDelayMs:250,maxAttempts:12,maxDelayMs:5e3}},w9={...Fi,streamIdleReconnectPolicy:{...Fi.streamIdleReconnectPolicy,maxAttempts:0},streamOpenReconnectPolicy:{...Fi.streamOpenReconnectPolicy,maxAttempts:1}};function tA(e,t){return{...t,...e}}function aA(e,t=!1){if(e&&"reconnect"in e&&e.reconnect===!1)return w9;let a=e;return{retryableErrorStatuses:a?.retryableErrorStatuses?new Set(a.retryableErrorStatuses):Fi.retryableErrorStatuses,streamIdleReconnectPolicy:tA(a?.streamIdleReconnectPolicy,{...Fi.streamIdleReconnectPolicy,maxAttempts:t?1/0:Fi.streamIdleReconnectPolicy.maxAttempts}),streamOpenReconnectPolicy:tA(a?.streamOpenReconnectPolicy,Fi.streamOpenReconnectPolicy)}}async function*Uv(e){if(e.follow===!1&&e.startIndex<0)throw Error("stream({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.");let t=()=>aA(e.resolveReconnectPolicy===void 0?e.streamReconnectPolicy:e.resolveReconnectPolicy(),e.keepAlive),a=t(),n=a.streamIdleReconnectPolicy,r=e.startIndex,o=n.baseDelayMs,i=0,s=!0,l,u=!1;for(;;){a=t(),n=a.streamIdleReconnectPolicy;let c;try{c=await v9({...e,retryPolicy:a,startIndex:r,requestTailIndex:(e.follow===!1||e.onCaughtUp!==void 0)&&l===void 0})}catch(m){if(e.signal?.aborted)return;throw m}if((e.follow===!1||e.onCaughtUp!==void 0)&&l===void 0&&(l=c.tailIndex,l===void 0))throw c.close(),Error(`stream({ follow: false }) requires the server to report the ${Tv} header. The agent may be running an older eve version.`);if(!u&&l!==void 0&&r>l&&(u=!0,e.onCaughtUp?.()),e.follow===!1&&l!==void 0&&r>l){c.close();return}let d=!1,p=!1;try{for await(let m of QE(c.body,{signal:e.signal,controlVersion:c.controlVersion,idleTimeoutMs:e.streamReadIdleTimeoutMs??15e3,onLeaseEnded:()=>{p=!0},streamVersion:c.streamVersion}))if(r+=1,d=!0,o=n.baseDelayMs,i=0,yield m,!u&&l!==void 0&&r>l&&(u=!0,e.onCaughtUp?.()),e.follow===!1&&l!==void 0&&r>l)return}catch(m){if(!Nv(m))throw m}finally{c.close()}if(n=t().streamIdleReconnectPolicy,e.signal?.aborted||e.startIndex<0||n.maxAttempts===0)return;if(!p){if(!d&&!s&&(i+=1)>=n.maxAttempts||(s=!1,await Xc(o,e.signal),e.signal?.aborted))return;o=Math.min(o*2,n.maxDelayMs)}}}async function v9(e){let t=e.retryPolicy??aA(e.streamReconnectPolicy,e.keepAlive),a=t.streamOpenReconnectPolicy,n,r,o,i=a.baseDelayMs,s=e.startIndex>=0&&t.streamIdleReconnectPolicy.maxAttempts>0?BE:void 0,l={};s!==void 0&&(l[zE]=s),e.startIndex!==0&&(l.startIndex=String(e.startIndex)),e.requestTailIndex===!0&&(l.includeTailIndex="1");for(let u=0;u<a.maxAttempts;u+=1){e.signal?.throwIfAborted();let c=yr(e.host,e.path,Object.keys(l).length>0?l:void 0),d=await e.resolveHeaders();e.signal?.throwIfAborted();let p=new AbortController,m=e.signal?AbortSignal.any([e.signal,p.signal]):p.signal,h;try{h=await fetch(c,{cache:"no-store",headers:d,redirect:e.redirect,signal:m})}catch(v){if(e.signal?.aborted||!Nv(v)||u===a.maxAttempts-1)throw v;await Xc(i,e.signal),i=Math.min(i*2,a.maxDelayMs);continue}if(h.ok){if(!h.body)throw new Za(h.status,"Response body is null.",h.headers);let v=!1;return{body:h.body,close:()=>{v||(v=!0,h.body?.cancel().catch(()=>{}),p.abort())},controlVersion:s,streamVersion:eA(h.headers),tailIndex:x9(h.headers)}}if(n=h.status,r=await h.text(),o=h.headers,!t.retryableErrorStatuses.has(h.status))throw new Za(h.status,r,h.headers);u<a.maxAttempts-1&&(await Xc(i,e.signal),i=Math.min(i*2,a.maxDelayMs))}throw new Za(n??0,r??"Failed to open message stream.",o)}function x9(e){let t=e.get(Tv);if(t===null||!/^-?\d+$/.test(t))return;let a=Number(t);return Number.isSafeInteger(a)?a:void 0}async function Xc(e,t){t?.aborted||await new Promise(a=>{let n=()=>{clearTimeout(r),a()},r=setTimeout(()=>{t?.removeEventListener("abort",n),a()},e);t?.addEventListener("abort",n,{once:!0})})}var nA=f.discriminatedUnion("status",[f.strictObject({ok:f.literal(!0),sessionId:f.string().min(1),status:f.literal("accepted")}),f.strictObject({ok:f.literal(!0),status:f.literal("no_active_turn")})]);var rA=f.discriminatedUnion("status",[f.object({ok:f.literal(!0),sessionId:f.string().min(1),status:f.literal("accepted")}),f.object({ok:f.literal(!0),status:f.literal("no_active_session")})]);var oA=f.discriminatedUnion("status",[f.object({ok:f.literal(!0),sessionId:f.string().min(1),status:f.literal("accepted")}),f.object({ok:f.literal(!0),status:f.literal("no_active_session")})]);var iA=f.discriminatedUnion("status",[f.object({ok:f.literal(!0),previousSessionId:f.string().min(1),status:f.literal("reset")}),f.object({ok:f.literal(!0),status:f.literal("no_active_session")})]);async function sA(e){let{signal:t,...a}=e.options??{},{payload:n,response:r}=await um({body:a,context:e.context,operation:"Cancel",path:RE(e.sessionId),signal:t}),o=nA.safeParse(n);if(!o.success||o.data.status==="accepted"&&o.data.sessionId!==e.sessionId)throw Error(`Cancel route returned an invalid response (${r.status}).`);return o.data.status==="accepted"?{sessionId:o.data.sessionId,status:"accepted"}:{status:"no_active_turn"}}async function lA(e){let{payload:t}=await um({context:e.context,operation:"Clear",path:_E(e.sessionId)}),a=rA.safeParse(t);if(!a.success||a.data.status==="accepted"&&a.data.sessionId!==e.sessionId)throw Error("Clear route returned an invalid response.");return a.data.status==="accepted"?{sessionId:a.data.sessionId,status:"accepted"}:{status:"no_active_session"}}async function uA(e){let{payload:t}=await um({context:e.context,operation:"Compact",path:DE(e.sessionId)}),a=oA.safeParse(t);if(!a.success||a.data.status==="accepted"&&a.data.sessionId!==e.sessionId)throw Error("Compact route returned an invalid response.");return a.data.status==="accepted"?{sessionId:a.data.sessionId,status:"accepted"}:{status:"no_active_session"}}async function cA(e){let{signal:t,...a}=e.options??{},{payload:n}=await um({body:a,context:e.context,operation:"Reset",path:PE(e.sessionId),signal:t}),r=iA.safeParse(n);if(!r.success||r.data.status==="reset"&&r.data.previousSessionId!==e.sessionId)throw Error("Reset route returned an invalid response.");return r.data.status==="reset"?{previousSessionId:r.data.previousSessionId,status:"reset"}:{status:"no_active_session"}}async function um(e){let t=await e.context.resolveHeaders();t.set("content-type","application/json");let a=await fetch(yr(e.context.host,e.path),b9({body:e.body===void 0?void 0:JSON.stringify(e.body),headers:t,method:"POST",signal:e.signal},e.context.redirect)),n=await a.text();if(!a.ok)throw new Za(a.status,n,a.headers);try{return{payload:JSON.parse(n),response:a}}catch{throw Error(`${e.operation} route returned invalid JSON (${a.status}).`)}}function b9(e,t){return t===void 0?e:{...e,redirect:t}}function Kc(e,t){let a=typeof e;if(a!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(!Kc(e[r],t[r]))return!1;return!0}if(a==="object"){if(!e||!t)return e===t;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let o of n)if(!Kc(e[o],t[o]))return!1;return!0}return e===t}function Jn(e){return encodeURI(S9(e))}function S9(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var I9={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},C9={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},k9={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},T9=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function qi(e,t=Object.create(null),a=T9,n=""){if(e&&typeof e=="object"&&!Array.isArray(e)){let o=e.$id||e.id;if(o){let i=new URL(o,a.href);i.hash.length>1?t[i.href]=e:(i.hash="",n===""?a=i:qi(e,t,a))}}else if(e!==!0&&e!==!1)return t;let r=a.href+(n?"#"+n:"");if(t[r]!==void 0)throw Error(`Duplicate schema URI "${r}".`);if(t[r]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:r}),e.$ref&&e.__absolute_ref__===void 0){let o=new URL(e.$ref,a.href);o.hash=o.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:o.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let o=new URL(e.$recursiveRef,a.href);o.hash=o.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:o.href})}if(e.$anchor){let o=new URL("#"+e.$anchor,a.href);t[o.href]=e}for(let o in e){if(k9[o])continue;let i=`${n}/${Jn(o)}`,s=e[o];if(Array.isArray(s)){if(I9[o]){let l=s.length;for(let u=0;u<l;u++)qi(s[u],t,a,`${i}/${u}`)}}else if(C9[o])for(let l in s)qi(s[l],t,a,`${i}/${Jn(l)}`);else qi(s,t,a,i)}return t}var L9=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,E9=[0,31,28,31,30,31,30,31,31,30,31,30,31],A9=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,M9=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,R9=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,D9=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,_9=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,P9=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,O9=/^(?:\/(?:[^~/]|~0|~1)*)*$/,N9=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,U9=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,B9=e=>{if(e[0]==='"')return!1;let[t,a,...n]=e.split("@");return!t||!a||n.length!==0||t.length>64||a.length>253||t[0]==="."||t.endsWith(".")||t.includes("..")||!/^[a-z0-9.-]+$/i.test(a)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:a.split(".").every(r=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(r))},z9=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,F9=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,q9=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function wr(e){return e.test.bind(e)}var dA={date:fA,time:pA.bind(void 0,!1),"date-time":V9,duration:q9,uri:G9,"uri-reference":wr(R9),"uri-template":wr(D9),url:wr(_9),email:B9,hostname:wr(M9),ipv4:wr(z9),ipv6:wr(F9),regex:K9,uuid:wr(P9),"json-pointer":wr(O9),"json-pointer-uri-fragment":wr(N9),"relative-json-pointer":wr(U9)};function H9(e){return e%4==0&&(e%100!=0||e%400==0)}function fA(e){let t=e.match(L9);if(!t)return!1;let a=+t[1],n=+t[2],r=+t[3];return n>=1&&n<=12&&r>=1&&r<=(n==2&&H9(a)?29:E9[n])}function pA(e,t){let a=t.match(A9);if(!a)return!1;let n=+a[1],r=+a[2],o=+a[3],i=!!a[5];return(n<=23&&r<=59&&o<=59||n==23&&r==59&&o==60)&&(!e||i)}var j9=/t|\s/i;function V9(e){let t=e.split(j9);return t.length==2&&fA(t[0])&&pA(!0,t[1])}var $9=/\/|:/,W9=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function G9(e){return $9.test(e)&&W9.test(e)}var X9=/[^\\]\\Z/;function K9(e){if(X9.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}var Y9;(function(e){e[e.Flag=1]="Flag",e[e.Basic=2]="Basic",e[e.Detailed=4]="Detailed"})(Y9||(Y9={}));function Z9(e){let t=0,a=e.length,n=0,r;for(;n<a;)t++,r=e.charCodeAt(n++),r>=55296&&r<=56319&&n<a&&(r=e.charCodeAt(n),(r&64512)==56320&&n++);return t}function Nt(e,t,a="2019-09",n=qi(t),r=!0,o=null,i="#",s="#",l=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:i,keyword:"false",keywordLocation:i,error:"False boolean schema."}]};let u=typeof e,c;switch(u){case"boolean":case"number":case"string":c=u;break;case"object":c=e===null?"null":Array.isArray(e)?"array":"object";break;default:throw Error(`Instances of "${u}" type are not supported.`)}let{$ref:d,$recursiveRef:p,$recursiveAnchor:m,type:h,const:v,enum:I,required:y,not:w,anyOf:g,allOf:S,oneOf:E,if:T,then:R,else:O,format:U,properties:A,patternProperties:Q,additionalProperties:$,unevaluatedProperties:H,minProperties:Z,maxProperties:X,propertyNames:B,dependentRequired:P,dependentSchemas:J,dependencies:ge,prefixItems:C,items:ze,additionalItems:ot,unevaluatedItems:x,contains:te,minContains:re,maxContains:ke,minItems:We,maxItems:be,uniqueItems:Oe,minimum:we,maximum:ce,exclusiveMinimum:Le,exclusiveMaximum:ie,multipleOf:xe,minLength:Ne,maxLength:_e,pattern:Fe,__absolute_ref__:Ae,__absolute_recursive_ref__:de}=t,W=[];if(m===!0&&o===null&&(o=t),p==="#"){let le=o===null?n[de]:o,oe=`${s}/$recursiveRef`,Ie=Nt(e,o===null?t:o,a,n,r,le,i,oe,l);Ie.valid||W.push({instanceLocation:i,keyword:"$recursiveRef",keywordLocation:oe,error:"A subschema had errors."},...Ie.errors)}if(d!==void 0){let le=n[Ae||d];if(le===void 0){let ae=`Unresolved $ref "${d}".`;throw Ae&&Ae!==d&&(ae+=` Absolute URI "${Ae}".`),ae+=`
138
138
  Known schemas:
139
139
  - ${Object.keys(n).join(`
140
- - `)}`,Error(ae)}let oe=`${s}/$ref`,Ie=Nt(e,le,a,n,r,o,i,oe,l);if(Ie.valid||W.push({instanceLocation:i,keyword:"$ref",keywordLocation:oe,error:"A subschema had errors."},...Ie.errors),a==="4"||a==="7")return{valid:W.length===0,errors:W}}if(Array.isArray(h)){let le=h.length,oe=!1;for(let Ie=0;Ie<le;Ie++)if(c===h[Ie]||h[Ie]==="integer"&&c==="number"&&e%1==0&&e===e){oe=!0;break}oe||W.push({instanceLocation:i,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h.join('", "')}".`})}else h==="integer"?(c!=="number"||e%1||e!==e)&&W.push({instanceLocation:i,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h}".`}):h!==void 0&&c!==h&&W.push({instanceLocation:i,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h}".`});if(v!==void 0&&(c==="object"||c==="array"?Kc(e,v)||W.push({instanceLocation:i,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(v)}.`}):e!==v&&W.push({instanceLocation:i,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(v)}.`})),I!==void 0&&(c==="object"||c==="array"?I.some(le=>Kc(e,le))||W.push({instanceLocation:i,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(I)}.`}):I.some(le=>e===le)||W.push({instanceLocation:i,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(I)}.`})),w!==void 0){let le=`${s}/not`;Nt(e,w,a,n,r,o,i,le).valid&&W.push({instanceLocation:i,keyword:"not",keywordLocation:le,error:'Instance matched "not" schema.'})}let ct=[];if(g!==void 0){let le=`${s}/anyOf`,oe=W.length,Ie=!1;for(let ae=0;ae<g.length;ae++){let k=g[ae],D=Object.create(l),F=Nt(e,k,a,n,r,m===!0?o:null,i,`${le}/${ae}`,D);W.push(...F.errors),Ie||(Ie=F.valid),F.valid&&ct.push(D)}Ie?W.length=oe:W.splice(oe,0,{instanceLocation:i,keyword:"anyOf",keywordLocation:le,error:"Instance does not match any subschemas."})}if(S!==void 0){let le=`${s}/allOf`,oe=W.length,Ie=!0;for(let ae=0;ae<S.length;ae++){let k=S[ae],D=Object.create(l),F=Nt(e,k,a,n,r,m===!0?o:null,i,`${le}/${ae}`,D);W.push(...F.errors),Ie&&(Ie=F.valid),F.valid&&ct.push(D)}Ie?W.length=oe:W.splice(oe,0,{instanceLocation:i,keyword:"allOf",keywordLocation:le,error:"Instance does not match every subschema."})}if(E!==void 0){let le=`${s}/oneOf`,oe=W.length,Ie=E.filter((ae,k)=>{let D=Object.create(l),F=Nt(e,ae,a,n,r,m===!0?o:null,i,`${le}/${k}`,D);return W.push(...F.errors),F.valid&&ct.push(D),F.valid}).length;Ie===1?W.length=oe:W.splice(oe,0,{instanceLocation:i,keyword:"oneOf",keywordLocation:le,error:`Instance does not match exactly one subschema (${Ie} matches).`})}if((c==="object"||c==="array")&&Object.assign(l,...ct),T!==void 0){let le=`${s}/if`;if(Nt(e,T,a,n,r,o,i,le,l).valid){if(R!==void 0){let oe=Nt(e,R,a,n,r,o,i,`${s}/then`,l);oe.valid||W.push({instanceLocation:i,keyword:"if",keywordLocation:le,error:'Instance does not match "then" schema.'},...oe.errors)}}else if(O!==void 0){let oe=Nt(e,O,a,n,r,o,i,`${s}/else`,l);oe.valid||W.push({instanceLocation:i,keyword:"if",keywordLocation:le,error:'Instance does not match "else" schema.'},...oe.errors)}}if(c==="object"){if(y!==void 0)for(let ae of y)ae in e||W.push({instanceLocation:i,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${ae}".`});let le=Object.keys(e);if(Z!==void 0&&le.length<Z&&W.push({instanceLocation:i,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${Z} properties.`}),X!==void 0&&le.length>X&&W.push({instanceLocation:i,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${X} properties.`}),B!==void 0){let ae=`${s}/propertyNames`;for(let k in e){let D=`${i}/${Jn(k)}`,F=Nt(k,B,a,n,r,o,D,ae);F.valid||W.push({instanceLocation:i,keyword:"propertyNames",keywordLocation:ae,error:`Property name "${k}" does not match schema.`},...F.errors)}}if(P!==void 0){let ae=`${s}/dependantRequired`;for(let k in P)if(k in e){let D=P[k];for(let F of D)F in e||W.push({instanceLocation:i,keyword:"dependentRequired",keywordLocation:ae,error:`Instance has "${k}" but does not have "${F}".`})}}if(J!==void 0)for(let ae in J){let k=`${s}/dependentSchemas`;if(ae in e){let D=Nt(e,J[ae],a,n,r,o,i,`${k}/${Jn(ae)}`,l);D.valid||W.push({instanceLocation:i,keyword:"dependentSchemas",keywordLocation:k,error:`Instance has "${ae}" but does not match dependant schema.`},...D.errors)}}if(ge!==void 0){let ae=`${s}/dependencies`;for(let k in ge)if(k in e){let D=ge[k];if(Array.isArray(D))for(let F of D)F in e||W.push({instanceLocation:i,keyword:"dependencies",keywordLocation:ae,error:`Instance has "${k}" but does not have "${F}".`});else{let F=Nt(e,D,a,n,r,o,i,`${ae}/${Jn(k)}`);F.valid||W.push({instanceLocation:i,keyword:"dependencies",keywordLocation:ae,error:`Instance has "${k}" but does not match dependant schema.`},...F.errors)}}}let oe=Object.create(null),Ie=!1;if(A!==void 0){let ae=`${s}/properties`;for(let k in A){if(!(k in e))continue;let D=`${i}/${Jn(k)}`,F=Nt(e[k],A[k],a,n,r,o,D,`${ae}/${Jn(k)}`);if(F.valid)l[k]=oe[k]=!0;else if(Ie=r,W.push({instanceLocation:i,keyword:"properties",keywordLocation:ae,error:`Property "${k}" does not match schema.`},...F.errors),Ie)break}}if(!Ie&&Q!==void 0){let ae=`${s}/patternProperties`;for(let k in Q){let D=new RegExp(k,"u"),F=Q[k];for(let fe in e){if(!D.test(fe))continue;let Ve=`${i}/${Jn(fe)}`,Ft=Nt(e[fe],F,a,n,r,o,Ve,`${ae}/${Jn(k)}`);Ft.valid?l[fe]=oe[fe]=!0:(Ie=r,W.push({instanceLocation:i,keyword:"patternProperties",keywordLocation:ae,error:`Property "${fe}" matches pattern "${k}" but does not match associated schema.`},...Ft.errors))}}}if(!Ie&&$!==void 0){let ae=`${s}/additionalProperties`;for(let k in e){if(oe[k])continue;let D=`${i}/${Jn(k)}`,F=Nt(e[k],$,a,n,r,o,D,ae);F.valid?l[k]=!0:(Ie=r,W.push({instanceLocation:i,keyword:"additionalProperties",keywordLocation:ae,error:`Property "${k}" does not match additional properties schema.`},...F.errors))}}else if(!Ie&&H!==void 0){let ae=`${s}/unevaluatedProperties`;for(let k in e)if(!l[k]){let D=`${i}/${Jn(k)}`,F=Nt(e[k],H,a,n,r,o,D,ae);F.valid?l[k]=!0:W.push({instanceLocation:i,keyword:"unevaluatedProperties",keywordLocation:ae,error:`Property "${k}" does not match unevaluated properties schema.`},...F.errors)}}}else if(c==="array"){be!==void 0&&e.length>be&&W.push({instanceLocation:i,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${e.length} > ${be}).`}),We!==void 0&&e.length<We&&W.push({instanceLocation:i,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${e.length} < ${We}).`});let le=e.length,oe=0,Ie=!1;if(C!==void 0){let ae=`${s}/prefixItems`,k=Math.min(C.length,le);for(;oe<k;oe++){let D=Nt(e[oe],C[oe],a,n,r,o,`${i}/${oe}`,`${ae}/${oe}`);if(l[oe]=!0,!D.valid&&(Ie=r,W.push({instanceLocation:i,keyword:"prefixItems",keywordLocation:ae,error:"Items did not match schema."},...D.errors),Ie))break}}if(ze!==void 0){let ae=`${s}/items`;if(Array.isArray(ze)){let k=Math.min(ze.length,le);for(;oe<k;oe++){let D=Nt(e[oe],ze[oe],a,n,r,o,`${i}/${oe}`,`${ae}/${oe}`);if(l[oe]=!0,!D.valid&&(Ie=r,W.push({instanceLocation:i,keyword:"items",keywordLocation:ae,error:"Items did not match schema."},...D.errors),Ie))break}}else for(;oe<le;oe++){let k=Nt(e[oe],ze,a,n,r,o,`${i}/${oe}`,ae);if(l[oe]=!0,!k.valid&&(Ie=r,W.push({instanceLocation:i,keyword:"items",keywordLocation:ae,error:"Items did not match schema."},...k.errors),Ie))break}if(!Ie&&ot!==void 0){let k=`${s}/additionalItems`;for(;oe<le;oe++){let D=Nt(e[oe],ot,a,n,r,o,`${i}/${oe}`,k);l[oe]=!0,D.valid||(Ie=r,W.push({instanceLocation:i,keyword:"additionalItems",keywordLocation:k,error:"Items did not match additional items schema."},...D.errors))}}}if(te!==void 0)if(le===0&&re===void 0)W.push({instanceLocation:i,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(re!==void 0&&le<re)W.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${le}) than minContains (${re}).`});else{let ae=`${s}/contains`,k=W.length,D=0;for(let F=0;F<le;F++){let fe=Nt(e[F],te,a,n,r,o,`${i}/${F}`,ae);fe.valid?(l[F]=!0,D++):W.push(...fe.errors)}D>=(re||0)&&(W.length=k),re===void 0&&ke===void 0&&D===0?W.splice(k,0,{instanceLocation:i,keyword:"contains",keywordLocation:ae,error:"Array does not contain item matching schema."}):re!==void 0&&D<re?W.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${re} items matching schema. Only ${D} items were found.`}):ke!==void 0&&D>ke&&W.push({instanceLocation:i,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${ke} items matching schema. ${D} items were found.`})}if(!Ie&&x!==void 0){let ae=`${s}/unevaluatedItems`;for(;oe<le;oe++){if(l[oe])continue;let k=Nt(e[oe],x,a,n,r,o,`${i}/${oe}`,ae);l[oe]=!0,k.valid||W.push({instanceLocation:i,keyword:"unevaluatedItems",keywordLocation:ae,error:"Items did not match unevaluated items schema."},...k.errors)}}if(Oe)for(let ae=0;ae<le;ae++){let k=e[ae],D=typeof k=="object"&&!!k;for(let F=0;F<le;F++){if(ae===F)continue;let fe=e[F];(k===fe||D&&typeof fe=="object"&&fe&&Kc(k,fe))&&(W.push({instanceLocation:i,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${ae} and ${F}.`}),ae=2**53-1,F=2**53-1)}}}else if(c==="number"){if(a==="4"?(we!==void 0&&(Le===!0&&e<=we||e<we)&&W.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${e} is less than ${Le?"or equal to ":""} ${we}.`}),ce!==void 0&&(ie===!0&&e>=ce||e>ce)&&W.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${e} is greater than ${ie?"or equal to ":""} ${ce}.`})):(we!==void 0&&e<we&&W.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${e} is less than ${we}.`}),ce!==void 0&&e>ce&&W.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${e} is greater than ${ce}.`}),Le!==void 0&&e<=Le&&W.push({instanceLocation:i,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${e} is less than ${Le}.`}),ie!==void 0&&e>=ie&&W.push({instanceLocation:i,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${e} is greater than or equal to ${ie}.`})),xe!==void 0){let le=e%xe;Math.abs(0-le)>=11920929e-14&&Math.abs(xe-le)>=11920929e-14&&W.push({instanceLocation:i,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${e} is not a multiple of ${xe}.`})}}else if(c==="string"){let le=Ne===void 0&&_e===void 0?0:Z9(e);Ne!==void 0&&le<Ne&&W.push({instanceLocation:i,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${le} < ${Ne}).`}),_e!==void 0&&le>_e&&W.push({instanceLocation:i,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${le} > ${_e}).`}),Fe!==void 0&&!new RegExp(Fe,"u").test(e)&&W.push({instanceLocation:i,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),U!==void 0&&dA[U]&&!dA[U](e)&&W.push({instanceLocation:i,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${U}".`})}return{valid:W.length===0,errors:W}}var mA=class{constructor(e,t="2019-09",a=!0){K(this,"schema");K(this,"draft");K(this,"shortCircuit");K(this,"lookup");this.schema=e,this.draft=t,this.shortCircuit=a,this.lookup=qi(e)}validate(e){return Nt(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){t&&(e={...e,$id:t}),qi(e,this.lookup)}};function yA(e){return ej(e,"output")}function J9(e,t){let a=()=>structuredClone(e),n={"~standard":{version:1,vendor:"eve",validate:nj(e,t),jsonSchema:{input:a,output:a}}};return Q9.add(n),n}var Q9=new WeakSet,jne=J9({});function ej(e,t){return e==null?e:tj(e,t)}function tj(e,t){let a=aj(e),n=a?.jsonSchema,r=typeof n=="object"&&n?n[t]:void 0,o=typeof a?.vendor=="string"?a.vendor:"unknown";if(a!==void 0&&typeof r!="function"&&o==="zod"){if(t==="input"){let l=Oi(e),{$schema:u,...c}=qc(l.jsonSchema);return c}throw Error("Zod 3 cannot emit an output JSON Schema. Upgrade to Zod 4 or provide a plain JSON Schema object.")}if(a!==void 0&&typeof r!="function")throw Error(`Standard Schema vendor "${o}" does not support JSON Schema conversion. Provide a Standard Schema implementation with JSON Schema conversion or a plain JSON Schema object.`);let{$schema:i,...s}=qc(a===void 0?e:r({target:"draft-07"}));return s}function aj(e){if(typeof e!="object"||!e||!("~standard"in e))return;let t=e["~standard"];return typeof t=="object"&&t?t:void 0}function nj(e,t){let a,n=!1,r=(o,i)=>(n||(n=!0,console.warn(`[eve] Tool schema cannot validate values locally; passing them through unvalidated: ${i}`)),{value:o});return o=>{if(a===void 0){let u=sj(e);if(typeof u=="string")return a=null,r(o,u);a=u}if(a===null)return{value:o};let i;try{i=a.validate(o)}catch(u){return o===void 0?{issues:[{message:"Expected a JSON value."}]}:r(o,jc(u))}if(!i.valid)return{issues:mj(i.errors)};let s=zv(e,e,o),l=t?.(s);return l===void 0?{value:s}:{issues:[{message:l}]}}}function zv(e,t,a){let n=a;for(let r of wA(e,t)){let{items:o,properties:i}=r;if(gr(n)&&gr(i))n=rj(e,i,n);else if(Array.isArray(n)&&gr(o)){let s=n,l=s.map(u=>zv(e,o,u));l.some((u,c)=>u!==s[c])&&(n=l)}}return n}function rj(e,t,a){let n=a;for(let[r,o]of Object.entries(t)){let i=Object.hasOwn(a,r)?a[r]:void 0,s=i===void 0?oj(e,o):zv(e,o,i);s!==i&&(n===a&&(n={...a}),n[r]=s)}return n}function oj(e,t){for(let a of wA(e,t))if("default"in a)return structuredClone(a.default)}function*wA(e,t){let a=new Set,n=t;for(;gr(n)&&!a.has(n);)a.add(n),yield n,n=ij(e,n.$ref)}function ij(e,t){if(typeof t!="string"||t!=="#"&&!t.startsWith("#/"))return;let a=e;for(let n of Bv(t)){if(typeof a!="object"||!a||!Object.hasOwn(a,n))return;a=a[n]}return a}function sj(e){try{let t=structuredClone(e);return Yc(t)??new mA(t,"2020-12",!1)}catch(t){return jc(t)}}var lj=new Set(["array","boolean","integer","null","number","object","string"]),uj=[["exclusiveMinimum","minimum"],["exclusiveMaximum","maximum"]],cj=["additionalItems","additionalProperties","contains","else","if","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],dj=["allOf","anyOf","oneOf","prefixItems"],fj=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"];function Yc(e){if(typeof e=="boolean")return;if(typeof e!="object"||!e||Array.isArray(e))return"a subschema is neither an object nor a boolean";let t=e;delete t.format;for(let[s,l]of uj)typeof t[s]=="boolean"&&(t[s]&&typeof t[l]=="number"?(t[s]=t[l],delete t[l]):delete t[s]);let{enum:a,pattern:n,required:r,type:o}=t;if(o!==void 0&&!(Array.isArray(o)?o.every(hA):hA(o)))return`unsupported type ${JSON.stringify(o)}`;if(a!==void 0&&!Array.isArray(a))return"`enum` is not an array";if(r!==void 0&&!(Array.isArray(r)&&r.every(s=>typeof s=="string")))return"`required` is not an array of strings";if(n!==void 0&&!gA(n))return`invalid pattern ${JSON.stringify(n)}`;for(let s of cj)if(s in t){let l=Yc(t[s]);if(l!==void 0)return l}let i=t.items;for(let s of Array.isArray(i)?i:i===void 0?[]:[i]){let l=Yc(s);if(l!==void 0)return l}for(let s of dj){let l=t[s];if(l!==void 0){if(!Array.isArray(l))return`\`${s}\` is not an array`;for(let u of l){let c=Yc(u);if(c!==void 0)return c}}}for(let s of fj){let l=t[s];if(l!==void 0){if(typeof l!="object"||!l||Array.isArray(l))return`\`${s}\` is not an object`;for(let[u,c]of Object.entries(l)){if(s==="patternProperties"&&!gA(u))return`invalid pattern ${JSON.stringify(u)}`;if(s==="dependencies"&&Array.isArray(c))continue;let d=Yc(c);if(d!==void 0)return d}}}}function hA(e){return typeof e=="string"&&lj.has(e)}function gA(e){if(typeof e!="string")return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}var pj=/\/(?:additional|unevaluated)Properties$/;function mj(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],o=e[n+1];if(pj.test(r.keywordLocation)&&o?.keyword==="false"){let i=Bv(o.instanceLocation).at(-1);t.push({keyword:"false",location:o.instanceLocation,message:`Unrecognized key: ${JSON.stringify(i)}`,object:r.instanceLocation}),n++}else t.push({keyword:r.keyword,location:r.instanceLocation,message:r.error})}let a=t.filter(n=>n.object===void 0||!t.some(r=>r.object===void 0&&(r.location===n.location||r.location.startsWith(`${n.location}/`))));return a.filter((n,r)=>{let o=a[r+1];return o===void 0?!0:o.location.startsWith(`${n.location}/`)?!1:n.keyword!=="$ref"||o.location!==n.location}).map(({location:n,message:r,object:o})=>{let i=Bv(o??n);return i.length===0?{message:r}:{message:r,path:i}})}function Bv(e){return e.split("/").slice(1).map(t=>{let a=t;try{a=decodeURIComponent(t)}catch{}return a.replaceAll("~1","/").replaceAll("~0","~")})}var vA=Symbol("followClientSession"),La,Ut,oa,qv,Hv,xA,jv,Vv,cm,Hi,Zc=(Hi=class{constructor(t,a){ue(this,oa);ue(this,La);ue(this,Ut);q(this,La,t),q(this,Ut,a)}static async create(t,a){var i;let n=await $v(t,Ta,a,!0),{sessionId:r}=await Fv(n),o=new Hi(t,{sessionId:r,streamIndex:0});return{response:Y(i=o,oa,Hv).call(i,n,a,0),session:o}}static async prewarm(t,a={}){let{sessionId:n}=await Fv(await gj(t,a));return new Hi(t,{sessionId:n,streamIndex:0})}get state(){return b(this,Ut)}async snapshot(t){t?.signal?.throwIfAborted();let a=[];for await(let n of Y(this,oa,cm).call(this,{follow:!1,signal:t?.signal,startIndex:0}))a.push(n);return t?.signal?.throwIfAborted(),{events:a,session:{sessionId:b(this,Ut).sessionId,streamIndex:a.length}}}async send(t,a={}){return await Y(this,oa,qv).call(this,{...a,message:t},!0)}async respond(t,a={}){if(t.length===0)throw Error("ClientSession.respond() requires at least one input response.");return await Y(this,oa,qv).call(this,{...a,inputResponses:t},!1)}async cancel(t){return await sA({context:b(this,La),options:t,sessionId:b(this,Ut).sessionId})}async clear(){return await lA({context:b(this,La),sessionId:b(this,Ut).sessionId})}async compact(){return await uA({context:b(this,La),sessionId:b(this,Ut).sessionId})}async reset(t){return await cA({context:b(this,La),options:t,sessionId:b(this,Ut).sessionId})}stream(t){if(t?.follow===!1&&(t.startIndex??b(this,Ut).streamIndex)<0)throw Error("stream({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.");return Y(this,oa,jv).call(this,t)}streamSubagent(t,a){if(t.data.sessionId!==b(this,Ut).sessionId)throw Error(`streamSubagent() requires a subagent.called event from session ${b(this,Ut).sessionId}, but it came from session ${t.data.sessionId}.`);if(typeof t.data.childStreamPath!="string")throw Error(`streamSubagent() requires a subagent.called event with childStreamPath, but call ${t.data.callId} has none. The event was recorded by an older eve version.`);let n=a?.startIndex??0;if(a?.follow===!1&&n<0)throw Error("streamSubagent({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.");return Uv({follow:a?.follow,host:b(this,La).host,path:t.data.childStreamPath,redirect:b(this,La).redirect,resolveHeaders:()=>b(this,La).resolveHeaders(),signal:a?.signal,startIndex:n,streamReconnectPolicy:a?.streamReconnectPolicy})}[vA](t){return Y(this,oa,jv).call(this,{...t,keepAlive:!0})}},La=new WeakMap,Ut=new WeakMap,oa=new WeakSet,qv=async function(t,a){let n=b(this,Ut).streamIndex,r=ME(b(this,Ut).sessionId),o=a?await hj(b(this,La),r,t):await $v(b(this,La),r,t,!1),{sessionId:i,deliveryId:s}=await Fv(o,b(this,Ut).sessionId);if(i!==b(this,Ut).sessionId)throw Error("Message route returned a different session id.");if(t.message!==void 0&&s===void 0)throw Error("Message route did not return a delivery id. Update the server before sending with this client.");return Y(this,oa,Hv).call(this,o,t,n,t.message===void 0?void 0:s)},Hv=function(t,a,n,r){return t.body?.cancel().catch(()=>{}),new _v({cancelTurn:async o=>await this.cancel({turnId:o}),createStream:o=>Y(this,oa,xA).call(this,n,a,r,o),deliveryId:r,sessionId:b(this,Ut).sessionId})},xA=async function*(t,a,n,r){let o=0,i=n===void 0,s=!1,l=new Set;try{for await(let u of r??Y(this,oa,cm).call(this,{headers:a.headers,keepAlive:!0,signal:a.signal,startIndex:t,streamReconnectPolicy:a.streamReconnectPolicy})){if(o+=1,n!==void 0){let c=u.meta?.deliveryIds?.includes(n)===!0,d=u.type==="session.failed"||u.type==="session.completed";if(!c&&d&&(!i||u.type==="session.completed"))throw Error("The session ended before the accepted message reached its turn boundary.");if(!i&&!c||!d&&u.meta?.deliveryIds!==void 0&&!c)continue;i=!0}if(Bi(l,u),s=xn(u)&&(u.type!=="session.waiting"||l.size===0),yield u,s)break}if(n!==void 0&&!s&&!a.signal?.aborted)throw Error("The response stream ended before the accepted message reached its turn boundary.")}finally{Y(this,oa,Vv).call(this,t+o)}},jv=async function*(t){let a=t?.startIndex??b(this,Ut).streamIndex,n=0;for await(let r of Y(this,oa,cm).call(this,{follow:t?.follow,headers:t?.headers,keepAlive:t?.keepAlive,onCaughtUp:t?.onCaughtUp,resolveHeaders:t?.resolveHeaders,resolveReconnectPolicy:t?.resolveReconnectPolicy,signal:t?.signal,startIndex:a,streamReconnectPolicy:t?.streamReconnectPolicy}))n+=1,a>=0&&Y(this,oa,Vv).call(this,a+n),yield r},Vv=function(t){q(this,Ut,{sessionId:b(this,Ut).sessionId,streamIndex:Math.max(b(this,Ut).streamIndex,t)})},cm=function(t){return Uv({onCaughtUp:t.onCaughtUp,follow:t.follow,host:b(this,La).host,keepAlive:t.keepAlive,resolveHeaders:()=>b(this,La).resolveHeaders(t.resolveHeaders?.()??t.headers),path:kv(b(this,Ut).sessionId),redirect:b(this,La).redirect,signal:t.signal,startIndex:t.startIndex,streamReconnectPolicy:t.streamReconnectPolicy,resolveReconnectPolicy:t.resolveReconnectPolicy})},Hi);function bA(e,t){return e[vA](t)}async function hj(e,t,a){let n=Date.now()+2e4,r=250;for(;;){try{return await $v(e,t,a,!1)}catch(o){if(!yj(o))throw o;let i=n-Date.now();if(i<=0)throw o;await Xc(Math.min(r,i),a.signal)}a.signal?.throwIfAborted(),r=Math.min(r*2,2e3)}}async function gj(e,t){let a=await e.resolveHeaders(t.headers),n=await fetch(yr(e.host,Ta),{headers:a,method:"POST",redirect:e.redirect,signal:t.signal??null});if(!n.ok){let r=await n.text();throw new Za(n.status,r,n.headers)}return n}function yj(e){return e instanceof Za&&e.status===409&&e.code==="session_not_ready"}async function $v(e,t,a,n){let r=wj(a,n);if(r===null)throw Error(n?"Creating a session requires a non-empty message.":"A session turn requires a non-empty message or inputResponses.");let o=await e.resolveHeaders(a.headers);o.set("content-type","application/json");let i=await fetch(yr(e.host,t),{body:JSON.stringify(r),headers:o,method:"POST",redirect:e.redirect,signal:a.signal??null});if(!i.ok){let s=await i.text();throw new Za(i.status,s,i.headers)}return i}async function Fv(e,t){let a=await e.json(),n=(typeof a.sessionId=="string"?a.sessionId:void 0)??e.headers.get(UE)?.trim()??t;if(!n)throw Error("Message route did not return a session id.");return{sessionId:n,deliveryId:typeof a.deliveryId=="string"&&a.deliveryId.length>0?a.deliveryId:void 0}}function wj(e,t){let a={};e.message!==void 0&&(a.message=e.message),e.inputResponses!==void 0&&e.inputResponses.length>0&&(a.inputResponses=e.inputResponses),!t&&e.message!==void 0&&e.turnPolicy!==void 0&&(a.turnPolicy=e.turnPolicy),e.message!==void 0&&e.taskDeliveryPolicy!==void 0&&(a.taskDeliveryPolicy=e.taskDeliveryPolicy),e.clientContext!==void 0&&(a.clientContext=e.clientContext);let n=yA(e.outputSchema);return n!==void 0&&(a.outputSchema=n),t&&a.message===void 0||a.message===void 0&&a.inputResponses===void 0?null:a}var ji,SA,Wv=(SA=class{constructor(e){ue(this,ji);q(this,ji,e)}async create(e={}){return"message"in e?await Zc.create(b(this,ji),e):{session:await Zc.prewarm(b(this,ji),e)}}attach(e,t){if(e.length===0)throw Error("sessionId must be a non-empty string.");return new Zc(b(this,ji),{sessionId:e,streamIndex:t?.streamIndex??0})}},ji=new WeakMap,SA);function IA(e,t){let a=new TextEncoder().encode(`${e}:${t}`),n=Array.from(a,r=>String.fromCodePoint(r)).join("");return btoa(n)}var CA=f.object({ok:f.literal(!0),status:f.literal("ready"),workflowId:f.string().min(1)}).strict();var dm=f.discriminatedUnion("kind",[f.object({kind:f.literal("application")}).strict(),f.object({feature:f.string(),kind:f.literal("framework")}).strict(),f.object({kind:f.literal("extension"),namespace:f.string(),packageName:f.string()}).strict()]),LA=f.discriminatedUnion("kind",[f.object({externalDependencies:f.array(f.string()),extensionScope:f.object({namespace:f.string(),sourceRoot:f.string()}).strict().optional(),kind:f.literal("filesystem"),sourcePath:f.string()}).strict(),f.object({dependencies:f.record(f.string(),f.string()).optional(),kind:f.literal("programmatic"),moduleId:f.string(),parameters:f.record(f.string(),f.unknown()).optional(),registryId:f.string(),revision:f.string(),semanticRevision:f.string().optional()}).strict()]),EA=f.object({backing:LA,logicalPath:f.string(),owner:dm}).strict(),Yr=f.object({binding:EA.optional(),exportName:f.string().optional(),logicalPath:f.string(),owner:dm,sourceId:f.string(),sourceKind:f.enum(["markdown","module","skill-package"])}).strict(),Vi=Yr.extend({name:f.string()}).strict(),Jc=Yr.extend({eventNames:f.array(f.string()),slug:f.string()}).strict(),vj=f.discriminatedUnion("kind",[f.object({kind:f.literal("gateway"),target:f.string(),byok:f.string().optional()}).strict(),f.object({kind:f.literal("external"),provider:f.string()}).strict()]),xj=f.union([f.object({kind:f.literal("external"),provider:f.string()}).strict(),f.object({kind:f.literal("chatgpt"),state:f.enum(["checking","ready","signed-out","reauth-required","unavailable"]),accountLabel:f.string().optional()}).strict(),f.object({kind:f.literal("gateway"),connected:f.literal(!0),credential:f.enum(["api-key","oidc","oauth"]),team:f.optional(f.string())}).strict(),f.object({kind:f.literal("gateway"),connected:f.literal(!1)}).strict()]),kA={contextWindowTokens:f.number().optional(),providerOptions:f.unknown().optional(),reasoning:f.enum(["provider-default","none","minimal","low","medium","high","xhigh"]).optional().catch(void 0),source:Yr.optional()},bj=f.union([f.object({...kA,endpoint:xj.optional(),id:f.string(),routing:vj}).strict(),f.object({...kA,endpoint:f.never().optional(),id:f.never().optional(),routing:f.object({kind:f.literal("dynamic"),resolver:Jc}).strict()}).strict()]),Sj=Vi.extend({description:f.string(),hasAuth:f.boolean(),hasExecute:f.boolean(),hasModelOutputProjection:f.boolean(),hasOutputSchema:f.boolean(),inputSchema:f.unknown(),outputSchema:f.unknown().optional(),requiresApproval:f.boolean()}).strict(),Ij=Vi.extend({description:f.string(),license:f.string().optional(),markdown:f.string(),metadata:f.record(f.string(),f.string()).optional()}).strict(),Cj=Vi.extend({content:f.string(),role:f.enum(["system","user"])}).strict(),kj=Vi.extend({cron:f.string(),hasRun:f.boolean(),markdown:f.string().optional()}).strict(),AA=f.enum(["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS","WEBSOCKET"]),Tj=Vi.extend({adapterKind:f.string().optional(),method:AA,urlPath:f.string()}).strict(),Lj=f.object({backing:f.union([LA,f.object({kind:f.literal("resource"),sourcePath:f.string()}).strict()]),form:f.enum(["derived","direct"]),layer:f.enum(["framework-default","extension-package","extension-override","application"]),logicalPath:f.string(),owner:dm,sourceId:f.string()}).strict(),Ej=f.object({method:AA,source:Lj,urlPath:f.string(),winnerSourceId:f.string()}).strict(),Aj=Yr.extend({connectionName:f.string(),description:f.string(),hasApproval:f.boolean(),hasAuthorization:f.boolean(),hasHeaders:f.boolean(),protocol:f.string(),toolFilter:f.unknown().optional(),url:f.string()}).strict(),Mj=Yr.extend({eventNames:f.array(f.string()),slug:f.string()}).strict(),Rj=Yr.extend({description:f.string().optional(),slot:f.string(),visibility:f.enum(["scope","session"])}).strict(),Dj=Yr.extend({provider:f.string().optional(),environmentExportName:f.string().optional(),revisionHash:f.string()}).strict(),_j=Vi.extend({configResolver:Jc.optional(),description:f.string().optional(),entryPath:f.string(),nodeId:f.string(),parentNodeId:f.string(),rootPath:f.string(),summary:f.object({channels:f.number(),connections:f.number(),hooks:f.number(),instructions:f.number(),memories:f.number(),schedules:f.number(),skills:f.number(),tools:f.number()}).strict()}).strict(),Pj=Vi.extend({description:f.string(),nodeId:f.string(),parentNodeId:f.string(),url:f.string().optional()}).strict(),Oj=f.object({action:f.enum(["subagent-call","task-cancel","workflow-tool-call"]).optional(),audience:f.array(f.enum(["root-session","delegated-task-child"])),kind:f.enum(["dispatch","provider-tool"]),sourceId:f.string()}).strict(),TA=f.object({kind:f.enum(["disabled","shadowed"]),logicalPath:f.string(),owner:dm,sourceId:f.string(),winnerSourceId:f.string().optional()}).strict(),MA=f.object({agent:f.object({agentRoot:f.string(),appRoot:f.string(),config:Yr.extend({binding:EA}).strict(),description:f.string().optional(),model:bj,name:f.string(),nodeId:f.string(),outputSchema:f.unknown().optional()}).strict(),capabilities:f.object({devRoutes:f.boolean()}).strict(),channels:f.object({routes:f.array(Tj),shadowed:f.array(Ej)}).strict(),composition:f.object({disabled:f.array(TA),shadowed:f.array(TA)}).strict(),connections:f.array(Aj),diagnostics:f.object({discoveryErrors:f.number(),discoveryWarnings:f.number()}).strict(),hooks:f.array(Mj),instructions:f.object({dynamic:f.array(Jc),static:f.array(Cj)}).strict(),instrumentation:Yr.optional(),kernelEffects:f.array(Oj),kind:f.literal("eve-agent-info"),memories:f.array(Rj),mode:f.enum(["development","production"]),remoteAgents:f.object({entries:f.array(Pj),total:f.number()}).strict(),sandbox:Dj,schedules:f.array(kj),skills:f.object({dynamic:f.array(Jc),static:f.array(Ij)}).strict(),subagents:f.object({local:f.array(_j),total:f.number()}).strict(),tools:f.object({dynamic:f.array(Jc),static:f.array(Sj)}).strict(),version:f.literal(5),workspace:f.object({resourceRoot:f.unknown(),rootEntries:f.array(f.string())}).strict()}).strict().superRefine((e,t)=>{let a=(o,i,s)=>{let l=new Set;o.forEach((u,c)=>{let d=i(u);l.has(d)&&t.addIssue({code:"custom",message:`Duplicate public identity "${d}".`,path:[...s,c]}),l.add(d)})},n=(o,i,s)=>{(!Number.isSafeInteger(o)||o<0||o!==i.length)&&t.addIssue({code:"custom",message:`Expected total ${i.length}, received ${o}.`,path:[...s]})};a(e.tools.static,o=>o.name,["tools","static"]),a(e.tools.dynamic,o=>o.slug,["tools","dynamic"]),a(e.skills.static,o=>o.name,["skills","static"]),a(e.skills.dynamic,o=>o.slug,["skills","dynamic"]),a(e.instructions.static,o=>o.name,["instructions","static"]),a(e.instructions.dynamic,o=>o.slug,["instructions","dynamic"]),a(e.schedules,o=>o.name,["schedules"]),a(e.connections,o=>o.connectionName,["connections"]),a(e.hooks,o=>o.slug,["hooks"]),a(e.memories,o=>o.slot,["memories"]),a(e.channels.routes,o=>`${o.method} ${Nj(o.urlPath)}`,["channels","routes"]),a(e.subagents.local,o=>o.nodeId,["subagents","local"]),a(e.remoteAgents.entries,o=>o.nodeId,["remoteAgents","entries"]),n(e.subagents.total,e.subagents.local,["subagents","total"]),n(e.remoteAgents.total,e.remoteAgents.entries,["remoteAgents","total"]);let r=[[e.agent.config,["agent","config"]],...e.agent.model.source===void 0?[]:[[e.agent.model.source,["agent","model","source"]]],...e.agent.model.routing.kind==="dynamic"?[[e.agent.model.routing.resolver,["agent","model","routing","resolver"]]]:[],...e.channels.routes.map((o,i)=>[o,["channels","routes",i]]),...e.connections.map((o,i)=>[o,["connections",i]]),...e.hooks.map((o,i)=>[o,["hooks",i]]),...e.instructions.dynamic.map((o,i)=>[o,["instructions","dynamic",i]]),...e.instructions.static.map((o,i)=>[o,["instructions","static",i]]),...e.memories.map((o,i)=>[o,["memories",i]]),...e.instrumentation===void 0?[]:[[e.instrumentation,["instrumentation"]]],...e.remoteAgents.entries.map((o,i)=>[o,["remoteAgents","entries",i]]),...e.schedules.map((o,i)=>[o,["schedules",i]]),...e.skills.dynamic.map((o,i)=>[o,["skills","dynamic",i]]),...e.skills.static.map((o,i)=>[o,["skills","static",i]]),...e.subagents.local.flatMap((o,i)=>o.configResolver===void 0?[]:[[o.configResolver,["subagents","local",i,"configResolver"]]]),...e.tools.dynamic.map((o,i)=>[o,["tools","dynamic",i]]),...e.tools.static.map((o,i)=>[o,["tools","static",i]]),[e.sandbox,["sandbox"]]];for(let[o,i]of r){if(o.sourceKind==="module"&&o.binding===void 0){t.addIssue({code:"custom",message:"Module source is missing its compiled binding.",path:[...i,"binding"]});continue}if(o.sourceKind!=="module"&&o.binding!==void 0){t.addIssue({code:"custom",message:`${o.sourceKind} source cannot carry a module binding.`,path:[...i,"binding"]});continue}o.binding!==void 0&&(o.binding.logicalPath!==o.logicalPath&&t.addIssue({code:"custom",message:"Source and binding logical paths do not match.",path:[...i,"binding","logicalPath"]}),JSON.stringify(o.binding.owner)!==JSON.stringify(o.owner)&&t.addIssue({code:"custom",message:"Source and binding owners do not match.",path:[...i,"binding","owner"]}))}});function Nj(e){return e.replace(/^\/+|\/+$/g,"").split("/").map(t=>t.startsWith(":")||/^\[[^\]]+\]$/.test(t)?":":t).join("/")}var RA="x-vercel-trusted-oidc-idp-token";var Qc,ed,$i,Wi,jo,fm,PA,_A,Xv=(_A=class{constructor(e){ue(this,jo);ue(this,Qc);ue(this,ed);ue(this,$i);ue(this,Wi);K(this,"sessions");q(this,$i,e.host),q(this,Qc,e.auth),q(this,ed,e.headers),q(this,Wi,e.redirect),this.sessions=new Wv({host:b(this,$i),redirect:b(this,Wi),resolveHeaders:t=>Y(this,jo,fm).call(this,t)})}async health(){let e=yr(b(this,$i),EE),t=await Y(this,jo,fm).call(this),a=await fetch(e,DA({headers:t},b(this,Wi)));if(!a.ok){let o=await a.text();throw new Za(a.status,o,a.headers)}let n;try{n=await a.json()}catch{throw new sm}let r=CA.safeParse(n);if(!r.success)throw new sm(r.error.issues.slice(0,5).map(o=>{let i=o.path.join(".");return i.length===0?o.message:`${i}: ${o.message}`}));return r.data}async info(e={}){let t=await this.fetch(AE,e);if(!t.ok){let r=await t.text();throw new Za(t.status,r,t.headers)}let a;try{a=await t.json()}catch{throw new im}let n=MA.safeParse(a);if(!n.success)throw new im(n.error.issues.slice(0,5).map(r=>{let o=r.path.join(".");return o.length===0?r.message:`${o}: ${r.message}`}));return n.data}async fetch(e,t={}){let a=yr(b(this,$i),e),n=await Y(this,jo,fm).call(this,Bj(t.headers));return await fetch(a,DA({...t,headers:n},b(this,Wi)))}},Qc=new WeakMap,ed=new WeakMap,$i=new WeakMap,Wi=new WeakMap,jo=new WeakSet,fm=async function(e){let t=new Headers,[a,n]=await Promise.all([Uj(b(this,ed)),Y(this,jo,PA).call(this)]);for(let[r,o]of Object.entries(a))t.set(r,o);for(let[r,o]of Object.entries(n))t.set(r,o);if(e)for(let[r,o]of Object.entries(e))t.set(r,o);return t},PA=async function(){let e=b(this,Qc);if(!e)return{};if("vercelOidc"in e){let t=(await Gv(e.vercelOidc.token)).trim();return t.length===0?{}:{authorization:`Bearer ${t}`,[RA]:t}}if("bearer"in e){let t=(await Gv(e.bearer)).trim();return t.length===0?{}:{authorization:`Bearer ${t}`}}if("basic"in e){let t=await Gv(e.basic.password);return{authorization:`Basic ${IA(e.basic.username,t)}`}}return{}},_A);async function Gv(e){return typeof e=="function"?e():e}async function Uj(e){return e===void 0?{}:typeof e=="function"?await e():e}function Bj(e){return e===void 0?{}:Object.fromEntries(new Headers(e).entries())}function DA(e,t){return t===void 0?e:{...e,redirect:t}}function Kv(){let e=new Set;return{admit(t){let a=t.meta?.id;return a===void 0||!e.has(a)&&(e.add(a),!0)},get size(){return e.size}}}var Gi,Xi,Zr,Ki,td,ad,nd,El,pm,OA,UA=(OA=class{constructor(e,t){ue(this,El);ue(this,Gi,new AbortController);ue(this,Xi,new Set);ue(this,Zr,Promise.withResolvers());K(this,"caughtUp",b(this,Zr).promise);ue(this,Ki,!1);ue(this,td);ue(this,ad);ue(this,nd);this.setOptions(t),this.caughtUp.catch(()=>{}),t.catchUp||b(this,Zr).resolve(),(async()=>{try{for await(let a of bA(e,{signal:b(this,Gi).signal,resolveHeaders:()=>b(this,ad),resolveReconnectPolicy:()=>b(this,nd),startIndex:t.startIndex,onCaughtUp:t.catchUp?()=>b(this,Zr).resolve():void 0})){if(b(this,Gi).signal.aborted)return;t.onEvent(a);for(let n of b(this,Xi))n.push(a);if(a.type==="session.completed"||a.type==="session.failed")break}b(this,Zr).resolve(),Y(this,El,pm).call(this)}catch(a){b(this,Zr).reject(a),Y(this,El,pm).call(this,a),b(this,Gi).signal.aborted||t.onError(a)}})()}subscribe(e){let t=new zj(()=>b(this,Xi).delete(t),e);return b(this,Ki)?t.end(b(this,td)):b(this,Xi).add(t),t}get ended(){return b(this,Ki)}setOptions(e){"headers"in e&&q(this,ad,e.headers),"streamReconnectPolicy"in e&&q(this,nd,e.streamReconnectPolicy)}close(){let e=new DOMException("Session stream was detached.","AbortError");b(this,Gi).abort(e),b(this,Zr).reject(e),Y(this,El,pm).call(this,e)}},Gi=new WeakMap,Xi=new WeakMap,Zr=new WeakMap,Ki=new WeakMap,td=new WeakMap,ad=new WeakMap,nd=new WeakMap,El=new WeakSet,pm=function(e){if(!b(this,Ki)){q(this,Ki,!0),q(this,td,e);for(let t of b(this,Xi))t.end(e)}},OA),Vo,Yi,Zi,Al,rd,NA,zj=(NA=class{constructor(e,t){ue(this,Vo,[]);ue(this,Yi,Promise.withResolvers());ue(this,Zi,!1);ue(this,Al);ue(this,rd);let a=()=>this.end(t?.reason);t?.addEventListener("abort",a,{once:!0}),q(this,rd,()=>{t?.removeEventListener("abort",a),e()}),t?.aborted&&a()}push(e){b(this,Zi)||(b(this,Vo).push(e),b(this,Yi).resolve())}end(e){b(this,Zi)||(q(this,Zi,!0),q(this,Al,e),b(this,Yi).resolve())}[Symbol.dispose](){this.end(),q(this,Vo,[]),b(this,rd).call(this)}discard(){q(this,Vo,[])}async*[Symbol.asyncIterator](){for(;;){for(;b(this,Vo).length>0;)yield b(this,Vo).shift();if(b(this,Zi)){if(b(this,Al)!==void 0)throw b(this,Al);return}q(this,Yi,Promise.withResolvers()),await b(this,Yi).promise}}},Vo=new WeakMap,Yi=new WeakMap,Zi=new WeakMap,Al=new WeakMap,rd=new WeakMap,NA);var $o,Ja,vr,Ml,mm,BA,zA=(BA=class{constructor(e,t){ue(this,Ml);ue(this,$o);ue(this,Ja);ue(this,vr);q(this,$o,e),q(this,Ja,t),q(this,vr,Y(this,Ml,mm).call(this))}get data(){return b(this,vr)}reset(){q(this,Ja,[]),q(this,vr,b(this,$o).initial())}append(e){q(this,Ja,[...b(this,Ja),e]),q(this,vr,b(this,$o).reduce(b(this,vr),e))}remove(e){q(this,Ja,b(this,Ja).filter(t=>!e(t))),q(this,vr,Y(this,Ml,mm).call(this))}replace(e,t){let a=b(this,Ja).findIndex(e);q(this,Ja,a===-1?[...b(this,Ja),t]:b(this,Ja).map((n,r)=>r===a?t:n)),q(this,vr,Y(this,Ml,mm).call(this))}},$o=new WeakMap,Ja=new WeakMap,vr=new WeakMap,Ml=new WeakSet,mm=function(){let e=b(this,$o).initial();for(let t of b(this,Ja))e=b(this,$o).reduce(e,t);return e},BA);function qA(e){let t=e.at(-1);return t!==void 0&&xn(t)&&(t.type!=="session.waiting"||Fj(e).size===0)}function Fj(e){let t=new Set;for(let a of e)Bi(t,a);return t}function Yv(e){if(e.message!==void 0==(e.inputResponses!==void 0))throw Error("A turn requires exactly one of message or inputResponses.")}var FA=0;function HA(){let e=globalThis.crypto?.randomUUID;return e===void 0?(FA+=1,`submission_${FA.toString()}`):e.call(globalThis.crypto)}function od(e,t){return e?AbortSignal.any([e,t]):t}function jA(e){if(typeof e=="string")return e;let t=[];for(let a of e)a.type==="text"?t.push(a.text):a.type==="file"&&t.push(a.filename?`[file: ${a.filename}]`:"[file]");return t.join(`
140
+ - `)}`,Error(ae)}let oe=`${s}/$ref`,Ie=Nt(e,le,a,n,r,o,i,oe,l);if(Ie.valid||W.push({instanceLocation:i,keyword:"$ref",keywordLocation:oe,error:"A subschema had errors."},...Ie.errors),a==="4"||a==="7")return{valid:W.length===0,errors:W}}if(Array.isArray(h)){let le=h.length,oe=!1;for(let Ie=0;Ie<le;Ie++)if(c===h[Ie]||h[Ie]==="integer"&&c==="number"&&e%1==0&&e===e){oe=!0;break}oe||W.push({instanceLocation:i,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h.join('", "')}".`})}else h==="integer"?(c!=="number"||e%1||e!==e)&&W.push({instanceLocation:i,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h}".`}):h!==void 0&&c!==h&&W.push({instanceLocation:i,keyword:"type",keywordLocation:`${s}/type`,error:`Instance type "${c}" is invalid. Expected "${h}".`});if(v!==void 0&&(c==="object"||c==="array"?Kc(e,v)||W.push({instanceLocation:i,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(v)}.`}):e!==v&&W.push({instanceLocation:i,keyword:"const",keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(v)}.`})),I!==void 0&&(c==="object"||c==="array"?I.some(le=>Kc(e,le))||W.push({instanceLocation:i,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(I)}.`}):I.some(le=>e===le)||W.push({instanceLocation:i,keyword:"enum",keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(I)}.`})),w!==void 0){let le=`${s}/not`;Nt(e,w,a,n,r,o,i,le).valid&&W.push({instanceLocation:i,keyword:"not",keywordLocation:le,error:'Instance matched "not" schema.'})}let ct=[];if(g!==void 0){let le=`${s}/anyOf`,oe=W.length,Ie=!1;for(let ae=0;ae<g.length;ae++){let k=g[ae],D=Object.create(l),F=Nt(e,k,a,n,r,m===!0?o:null,i,`${le}/${ae}`,D);W.push(...F.errors),Ie||(Ie=F.valid),F.valid&&ct.push(D)}Ie?W.length=oe:W.splice(oe,0,{instanceLocation:i,keyword:"anyOf",keywordLocation:le,error:"Instance does not match any subschemas."})}if(S!==void 0){let le=`${s}/allOf`,oe=W.length,Ie=!0;for(let ae=0;ae<S.length;ae++){let k=S[ae],D=Object.create(l),F=Nt(e,k,a,n,r,m===!0?o:null,i,`${le}/${ae}`,D);W.push(...F.errors),Ie&&(Ie=F.valid),F.valid&&ct.push(D)}Ie?W.length=oe:W.splice(oe,0,{instanceLocation:i,keyword:"allOf",keywordLocation:le,error:"Instance does not match every subschema."})}if(E!==void 0){let le=`${s}/oneOf`,oe=W.length,Ie=E.filter((ae,k)=>{let D=Object.create(l),F=Nt(e,ae,a,n,r,m===!0?o:null,i,`${le}/${k}`,D);return W.push(...F.errors),F.valid&&ct.push(D),F.valid}).length;Ie===1?W.length=oe:W.splice(oe,0,{instanceLocation:i,keyword:"oneOf",keywordLocation:le,error:`Instance does not match exactly one subschema (${Ie} matches).`})}if((c==="object"||c==="array")&&Object.assign(l,...ct),T!==void 0){let le=`${s}/if`;if(Nt(e,T,a,n,r,o,i,le,l).valid){if(R!==void 0){let oe=Nt(e,R,a,n,r,o,i,`${s}/then`,l);oe.valid||W.push({instanceLocation:i,keyword:"if",keywordLocation:le,error:'Instance does not match "then" schema.'},...oe.errors)}}else if(O!==void 0){let oe=Nt(e,O,a,n,r,o,i,`${s}/else`,l);oe.valid||W.push({instanceLocation:i,keyword:"if",keywordLocation:le,error:'Instance does not match "else" schema.'},...oe.errors)}}if(c==="object"){if(y!==void 0)for(let ae of y)ae in e||W.push({instanceLocation:i,keyword:"required",keywordLocation:`${s}/required`,error:`Instance does not have required property "${ae}".`});let le=Object.keys(e);if(Z!==void 0&&le.length<Z&&W.push({instanceLocation:i,keyword:"minProperties",keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${Z} properties.`}),X!==void 0&&le.length>X&&W.push({instanceLocation:i,keyword:"maxProperties",keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${X} properties.`}),B!==void 0){let ae=`${s}/propertyNames`;for(let k in e){let D=`${i}/${Jn(k)}`,F=Nt(k,B,a,n,r,o,D,ae);F.valid||W.push({instanceLocation:i,keyword:"propertyNames",keywordLocation:ae,error:`Property name "${k}" does not match schema.`},...F.errors)}}if(P!==void 0){let ae=`${s}/dependantRequired`;for(let k in P)if(k in e){let D=P[k];for(let F of D)F in e||W.push({instanceLocation:i,keyword:"dependentRequired",keywordLocation:ae,error:`Instance has "${k}" but does not have "${F}".`})}}if(J!==void 0)for(let ae in J){let k=`${s}/dependentSchemas`;if(ae in e){let D=Nt(e,J[ae],a,n,r,o,i,`${k}/${Jn(ae)}`,l);D.valid||W.push({instanceLocation:i,keyword:"dependentSchemas",keywordLocation:k,error:`Instance has "${ae}" but does not match dependant schema.`},...D.errors)}}if(ge!==void 0){let ae=`${s}/dependencies`;for(let k in ge)if(k in e){let D=ge[k];if(Array.isArray(D))for(let F of D)F in e||W.push({instanceLocation:i,keyword:"dependencies",keywordLocation:ae,error:`Instance has "${k}" but does not have "${F}".`});else{let F=Nt(e,D,a,n,r,o,i,`${ae}/${Jn(k)}`);F.valid||W.push({instanceLocation:i,keyword:"dependencies",keywordLocation:ae,error:`Instance has "${k}" but does not match dependant schema.`},...F.errors)}}}let oe=Object.create(null),Ie=!1;if(A!==void 0){let ae=`${s}/properties`;for(let k in A){if(!(k in e))continue;let D=`${i}/${Jn(k)}`,F=Nt(e[k],A[k],a,n,r,o,D,`${ae}/${Jn(k)}`);if(F.valid)l[k]=oe[k]=!0;else if(Ie=r,W.push({instanceLocation:i,keyword:"properties",keywordLocation:ae,error:`Property "${k}" does not match schema.`},...F.errors),Ie)break}}if(!Ie&&Q!==void 0){let ae=`${s}/patternProperties`;for(let k in Q){let D=new RegExp(k,"u"),F=Q[k];for(let fe in e){if(!D.test(fe))continue;let Ve=`${i}/${Jn(fe)}`,Ft=Nt(e[fe],F,a,n,r,o,Ve,`${ae}/${Jn(k)}`);Ft.valid?l[fe]=oe[fe]=!0:(Ie=r,W.push({instanceLocation:i,keyword:"patternProperties",keywordLocation:ae,error:`Property "${fe}" matches pattern "${k}" but does not match associated schema.`},...Ft.errors))}}}if(!Ie&&$!==void 0){let ae=`${s}/additionalProperties`;for(let k in e){if(oe[k])continue;let D=`${i}/${Jn(k)}`,F=Nt(e[k],$,a,n,r,o,D,ae);F.valid?l[k]=!0:(Ie=r,W.push({instanceLocation:i,keyword:"additionalProperties",keywordLocation:ae,error:`Property "${k}" does not match additional properties schema.`},...F.errors))}}else if(!Ie&&H!==void 0){let ae=`${s}/unevaluatedProperties`;for(let k in e)if(!l[k]){let D=`${i}/${Jn(k)}`,F=Nt(e[k],H,a,n,r,o,D,ae);F.valid?l[k]=!0:W.push({instanceLocation:i,keyword:"unevaluatedProperties",keywordLocation:ae,error:`Property "${k}" does not match unevaluated properties schema.`},...F.errors)}}}else if(c==="array"){be!==void 0&&e.length>be&&W.push({instanceLocation:i,keyword:"maxItems",keywordLocation:`${s}/maxItems`,error:`Array has too many items (${e.length} > ${be}).`}),We!==void 0&&e.length<We&&W.push({instanceLocation:i,keyword:"minItems",keywordLocation:`${s}/minItems`,error:`Array has too few items (${e.length} < ${We}).`});let le=e.length,oe=0,Ie=!1;if(C!==void 0){let ae=`${s}/prefixItems`,k=Math.min(C.length,le);for(;oe<k;oe++){let D=Nt(e[oe],C[oe],a,n,r,o,`${i}/${oe}`,`${ae}/${oe}`);if(l[oe]=!0,!D.valid&&(Ie=r,W.push({instanceLocation:i,keyword:"prefixItems",keywordLocation:ae,error:"Items did not match schema."},...D.errors),Ie))break}}if(ze!==void 0){let ae=`${s}/items`;if(Array.isArray(ze)){let k=Math.min(ze.length,le);for(;oe<k;oe++){let D=Nt(e[oe],ze[oe],a,n,r,o,`${i}/${oe}`,`${ae}/${oe}`);if(l[oe]=!0,!D.valid&&(Ie=r,W.push({instanceLocation:i,keyword:"items",keywordLocation:ae,error:"Items did not match schema."},...D.errors),Ie))break}}else for(;oe<le;oe++){let k=Nt(e[oe],ze,a,n,r,o,`${i}/${oe}`,ae);if(l[oe]=!0,!k.valid&&(Ie=r,W.push({instanceLocation:i,keyword:"items",keywordLocation:ae,error:"Items did not match schema."},...k.errors),Ie))break}if(!Ie&&ot!==void 0){let k=`${s}/additionalItems`;for(;oe<le;oe++){let D=Nt(e[oe],ot,a,n,r,o,`${i}/${oe}`,k);l[oe]=!0,D.valid||(Ie=r,W.push({instanceLocation:i,keyword:"additionalItems",keywordLocation:k,error:"Items did not match additional items schema."},...D.errors))}}}if(te!==void 0)if(le===0&&re===void 0)W.push({instanceLocation:i,keyword:"contains",keywordLocation:`${s}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(re!==void 0&&le<re)W.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array has less items (${le}) than minContains (${re}).`});else{let ae=`${s}/contains`,k=W.length,D=0;for(let F=0;F<le;F++){let fe=Nt(e[F],te,a,n,r,o,`${i}/${F}`,ae);fe.valid?(l[F]=!0,D++):W.push(...fe.errors)}D>=(re||0)&&(W.length=k),re===void 0&&ke===void 0&&D===0?W.splice(k,0,{instanceLocation:i,keyword:"contains",keywordLocation:ae,error:"Array does not contain item matching schema."}):re!==void 0&&D<re?W.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${s}/minContains`,error:`Array must contain at least ${re} items matching schema. Only ${D} items were found.`}):ke!==void 0&&D>ke&&W.push({instanceLocation:i,keyword:"maxContains",keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${ke} items matching schema. ${D} items were found.`})}if(!Ie&&x!==void 0){let ae=`${s}/unevaluatedItems`;for(;oe<le;oe++){if(l[oe])continue;let k=Nt(e[oe],x,a,n,r,o,`${i}/${oe}`,ae);l[oe]=!0,k.valid||W.push({instanceLocation:i,keyword:"unevaluatedItems",keywordLocation:ae,error:"Items did not match unevaluated items schema."},...k.errors)}}if(Oe)for(let ae=0;ae<le;ae++){let k=e[ae],D=typeof k=="object"&&!!k;for(let F=0;F<le;F++){if(ae===F)continue;let fe=e[F];(k===fe||D&&typeof fe=="object"&&fe&&Kc(k,fe))&&(W.push({instanceLocation:i,keyword:"uniqueItems",keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${ae} and ${F}.`}),ae=2**53-1,F=2**53-1)}}}else if(c==="number"){if(a==="4"?(we!==void 0&&(Le===!0&&e<=we||e<we)&&W.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${e} is less than ${Le?"or equal to ":""} ${we}.`}),ce!==void 0&&(ie===!0&&e>=ce||e>ce)&&W.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${e} is greater than ${ie?"or equal to ":""} ${ce}.`})):(we!==void 0&&e<we&&W.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${s}/minimum`,error:`${e} is less than ${we}.`}),ce!==void 0&&e>ce&&W.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${s}/maximum`,error:`${e} is greater than ${ce}.`}),Le!==void 0&&e<=Le&&W.push({instanceLocation:i,keyword:"exclusiveMinimum",keywordLocation:`${s}/exclusiveMinimum`,error:`${e} is less than ${Le}.`}),ie!==void 0&&e>=ie&&W.push({instanceLocation:i,keyword:"exclusiveMaximum",keywordLocation:`${s}/exclusiveMaximum`,error:`${e} is greater than or equal to ${ie}.`})),xe!==void 0){let le=e%xe;Math.abs(0-le)>=11920929e-14&&Math.abs(xe-le)>=11920929e-14&&W.push({instanceLocation:i,keyword:"multipleOf",keywordLocation:`${s}/multipleOf`,error:`${e} is not a multiple of ${xe}.`})}}else if(c==="string"){let le=Ne===void 0&&_e===void 0?0:Z9(e);Ne!==void 0&&le<Ne&&W.push({instanceLocation:i,keyword:"minLength",keywordLocation:`${s}/minLength`,error:`String is too short (${le} < ${Ne}).`}),_e!==void 0&&le>_e&&W.push({instanceLocation:i,keyword:"maxLength",keywordLocation:`${s}/maxLength`,error:`String is too long (${le} > ${_e}).`}),Fe!==void 0&&!new RegExp(Fe,"u").test(e)&&W.push({instanceLocation:i,keyword:"pattern",keywordLocation:`${s}/pattern`,error:"String does not match pattern."}),U!==void 0&&dA[U]&&!dA[U](e)&&W.push({instanceLocation:i,keyword:"format",keywordLocation:`${s}/format`,error:`String does not match format "${U}".`})}return{valid:W.length===0,errors:W}}var mA=class{constructor(e,t="2019-09",a=!0){K(this,"schema");K(this,"draft");K(this,"shortCircuit");K(this,"lookup");this.schema=e,this.draft=t,this.shortCircuit=a,this.lookup=qi(e)}validate(e){return Nt(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){t&&(e={...e,$id:t}),qi(e,this.lookup)}};function yA(e){return ej(e,"output")}function J9(e,t){let a=()=>structuredClone(e),n={"~standard":{version:1,vendor:"eve",validate:nj(e,t),jsonSchema:{input:a,output:a}}};return Q9.add(n),n}var Q9=new WeakSet,Vne=J9({});function ej(e,t){return e==null?e:tj(e,t)}function tj(e,t){let a=aj(e),n=a?.jsonSchema,r=typeof n=="object"&&n?n[t]:void 0,o=typeof a?.vendor=="string"?a.vendor:"unknown";if(a!==void 0&&typeof r!="function"&&o==="zod"){if(t==="input"){let l=Oi(e),{$schema:u,...c}=qc(l.jsonSchema);return c}throw Error("Zod 3 cannot emit an output JSON Schema. Upgrade to Zod 4 or provide a plain JSON Schema object.")}if(a!==void 0&&typeof r!="function")throw Error(`Standard Schema vendor "${o}" does not support JSON Schema conversion. Provide a Standard Schema implementation with JSON Schema conversion or a plain JSON Schema object.`);let{$schema:i,...s}=qc(a===void 0?e:r({target:"draft-07"}));return s}function aj(e){if(typeof e!="object"||!e||!("~standard"in e))return;let t=e["~standard"];return typeof t=="object"&&t?t:void 0}function nj(e,t){let a,n=!1,r=(o,i)=>(n||(n=!0,console.warn(`[eve] Tool schema cannot validate values locally; passing them through unvalidated: ${i}`)),{value:o});return o=>{if(a===void 0){let u=sj(e);if(typeof u=="string")return a=null,r(o,u);a=u}if(a===null)return{value:o};let i;try{i=a.validate(o)}catch(u){return o===void 0?{issues:[{message:"Expected a JSON value."}]}:r(o,jc(u))}if(!i.valid)return{issues:mj(i.errors)};let s=zv(e,e,o),l=t?.(s);return l===void 0?{value:s}:{issues:[{message:l}]}}}function zv(e,t,a){let n=a;for(let r of wA(e,t)){let{items:o,properties:i}=r;if(gr(n)&&gr(i))n=rj(e,i,n);else if(Array.isArray(n)&&gr(o)){let s=n,l=s.map(u=>zv(e,o,u));l.some((u,c)=>u!==s[c])&&(n=l)}}return n}function rj(e,t,a){let n=a;for(let[r,o]of Object.entries(t)){let i=Object.hasOwn(a,r)?a[r]:void 0,s=i===void 0?oj(e,o):zv(e,o,i);s!==i&&(n===a&&(n={...a}),n[r]=s)}return n}function oj(e,t){for(let a of wA(e,t))if("default"in a)return structuredClone(a.default)}function*wA(e,t){let a=new Set,n=t;for(;gr(n)&&!a.has(n);)a.add(n),yield n,n=ij(e,n.$ref)}function ij(e,t){if(typeof t!="string"||t!=="#"&&!t.startsWith("#/"))return;let a=e;for(let n of Bv(t)){if(typeof a!="object"||!a||!Object.hasOwn(a,n))return;a=a[n]}return a}function sj(e){try{let t=structuredClone(e);return Yc(t)??new mA(t,"2020-12",!1)}catch(t){return jc(t)}}var lj=new Set(["array","boolean","integer","null","number","object","string"]),uj=[["exclusiveMinimum","minimum"],["exclusiveMaximum","maximum"]],cj=["additionalItems","additionalProperties","contains","else","if","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],dj=["allOf","anyOf","oneOf","prefixItems"],fj=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"];function Yc(e){if(typeof e=="boolean")return;if(typeof e!="object"||!e||Array.isArray(e))return"a subschema is neither an object nor a boolean";let t=e;delete t.format;for(let[s,l]of uj)typeof t[s]=="boolean"&&(t[s]&&typeof t[l]=="number"?(t[s]=t[l],delete t[l]):delete t[s]);let{enum:a,pattern:n,required:r,type:o}=t;if(o!==void 0&&!(Array.isArray(o)?o.every(hA):hA(o)))return`unsupported type ${JSON.stringify(o)}`;if(a!==void 0&&!Array.isArray(a))return"`enum` is not an array";if(r!==void 0&&!(Array.isArray(r)&&r.every(s=>typeof s=="string")))return"`required` is not an array of strings";if(n!==void 0&&!gA(n))return`invalid pattern ${JSON.stringify(n)}`;for(let s of cj)if(s in t){let l=Yc(t[s]);if(l!==void 0)return l}let i=t.items;for(let s of Array.isArray(i)?i:i===void 0?[]:[i]){let l=Yc(s);if(l!==void 0)return l}for(let s of dj){let l=t[s];if(l!==void 0){if(!Array.isArray(l))return`\`${s}\` is not an array`;for(let u of l){let c=Yc(u);if(c!==void 0)return c}}}for(let s of fj){let l=t[s];if(l!==void 0){if(typeof l!="object"||!l||Array.isArray(l))return`\`${s}\` is not an object`;for(let[u,c]of Object.entries(l)){if(s==="patternProperties"&&!gA(u))return`invalid pattern ${JSON.stringify(u)}`;if(s==="dependencies"&&Array.isArray(c))continue;let d=Yc(c);if(d!==void 0)return d}}}}function hA(e){return typeof e=="string"&&lj.has(e)}function gA(e){if(typeof e!="string")return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}var pj=/\/(?:additional|unevaluated)Properties$/;function mj(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],o=e[n+1];if(pj.test(r.keywordLocation)&&o?.keyword==="false"){let i=Bv(o.instanceLocation).at(-1);t.push({keyword:"false",location:o.instanceLocation,message:`Unrecognized key: ${JSON.stringify(i)}`,object:r.instanceLocation}),n++}else t.push({keyword:r.keyword,location:r.instanceLocation,message:r.error})}let a=t.filter(n=>n.object===void 0||!t.some(r=>r.object===void 0&&(r.location===n.location||r.location.startsWith(`${n.location}/`))));return a.filter((n,r)=>{let o=a[r+1];return o===void 0?!0:o.location.startsWith(`${n.location}/`)?!1:n.keyword!=="$ref"||o.location!==n.location}).map(({location:n,message:r,object:o})=>{let i=Bv(o??n);return i.length===0?{message:r}:{message:r,path:i}})}function Bv(e){return e.split("/").slice(1).map(t=>{let a=t;try{a=decodeURIComponent(t)}catch{}return a.replaceAll("~1","/").replaceAll("~0","~")})}var vA=Symbol("followClientSession"),La,Ut,oa,qv,Hv,xA,jv,Vv,cm,Hi,Zc=(Hi=class{constructor(t,a){ue(this,oa);ue(this,La);ue(this,Ut);q(this,La,t),q(this,Ut,a)}static async create(t,a){var i;let n=await $v(t,Ta,a,!0),{sessionId:r}=await Fv(n),o=new Hi(t,{sessionId:r,streamIndex:0});return{response:Y(i=o,oa,Hv).call(i,n,a,0),session:o}}static async prewarm(t,a={}){let{sessionId:n}=await Fv(await gj(t,a));return new Hi(t,{sessionId:n,streamIndex:0})}get state(){return b(this,Ut)}async snapshot(t){t?.signal?.throwIfAborted();let a=[];for await(let n of Y(this,oa,cm).call(this,{follow:!1,signal:t?.signal,startIndex:0}))a.push(n);return t?.signal?.throwIfAborted(),{events:a,session:{sessionId:b(this,Ut).sessionId,streamIndex:a.length}}}async send(t,a={}){return await Y(this,oa,qv).call(this,{...a,message:t},!0)}async respond(t,a={}){if(t.length===0)throw Error("ClientSession.respond() requires at least one input response.");return await Y(this,oa,qv).call(this,{...a,inputResponses:t},!1)}async cancel(t){return await sA({context:b(this,La),options:t,sessionId:b(this,Ut).sessionId})}async clear(){return await lA({context:b(this,La),sessionId:b(this,Ut).sessionId})}async compact(){return await uA({context:b(this,La),sessionId:b(this,Ut).sessionId})}async reset(t){return await cA({context:b(this,La),options:t,sessionId:b(this,Ut).sessionId})}stream(t){if(t?.follow===!1&&(t.startIndex??b(this,Ut).streamIndex)<0)throw Error("stream({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.");return Y(this,oa,jv).call(this,t)}streamSubagent(t,a){if(t.data.sessionId!==b(this,Ut).sessionId)throw Error(`streamSubagent() requires a subagent.called event from session ${b(this,Ut).sessionId}, but it came from session ${t.data.sessionId}.`);if(typeof t.data.childStreamPath!="string")throw Error(`streamSubagent() requires a subagent.called event with childStreamPath, but call ${t.data.callId} has none. The event was recorded by an older eve version.`);let n=a?.startIndex??0;if(a?.follow===!1&&n<0)throw Error("streamSubagent({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.");return Uv({follow:a?.follow,host:b(this,La).host,path:t.data.childStreamPath,redirect:b(this,La).redirect,resolveHeaders:()=>b(this,La).resolveHeaders(),signal:a?.signal,startIndex:n,streamReconnectPolicy:a?.streamReconnectPolicy})}[vA](t){return Y(this,oa,jv).call(this,{...t,keepAlive:!0})}},La=new WeakMap,Ut=new WeakMap,oa=new WeakSet,qv=async function(t,a){let n=b(this,Ut).streamIndex,r=ME(b(this,Ut).sessionId),o=a?await hj(b(this,La),r,t):await $v(b(this,La),r,t,!1),{sessionId:i,deliveryId:s}=await Fv(o,b(this,Ut).sessionId);if(i!==b(this,Ut).sessionId)throw Error("Message route returned a different session id.");if(t.message!==void 0&&s===void 0)throw Error("Message route did not return a delivery id. Update the server before sending with this client.");return Y(this,oa,Hv).call(this,o,t,n,t.message===void 0?void 0:s)},Hv=function(t,a,n,r){return t.body?.cancel().catch(()=>{}),new _v({cancelTurn:async o=>await this.cancel({turnId:o}),createStream:o=>Y(this,oa,xA).call(this,n,a,r,o),deliveryId:r,sessionId:b(this,Ut).sessionId})},xA=async function*(t,a,n,r){let o=0,i=n===void 0,s=!1,l=new Set;try{for await(let u of r??Y(this,oa,cm).call(this,{headers:a.headers,keepAlive:!0,signal:a.signal,startIndex:t,streamReconnectPolicy:a.streamReconnectPolicy})){if(o+=1,n!==void 0){let c=u.meta?.deliveryIds?.includes(n)===!0,d=u.type==="session.failed"||u.type==="session.completed";if(!c&&d&&(!i||u.type==="session.completed"))throw Error("The session ended before the accepted message reached its turn boundary.");if(!i&&!c||!d&&u.meta?.deliveryIds!==void 0&&!c)continue;i=!0}if(Bi(l,u),s=xn(u)&&(u.type!=="session.waiting"||l.size===0),yield u,s)break}if(n!==void 0&&!s&&!a.signal?.aborted)throw Error("The response stream ended before the accepted message reached its turn boundary.")}finally{Y(this,oa,Vv).call(this,t+o)}},jv=async function*(t){let a=t?.startIndex??b(this,Ut).streamIndex,n=0;for await(let r of Y(this,oa,cm).call(this,{follow:t?.follow,headers:t?.headers,keepAlive:t?.keepAlive,onCaughtUp:t?.onCaughtUp,resolveHeaders:t?.resolveHeaders,resolveReconnectPolicy:t?.resolveReconnectPolicy,signal:t?.signal,startIndex:a,streamReconnectPolicy:t?.streamReconnectPolicy}))n+=1,a>=0&&Y(this,oa,Vv).call(this,a+n),yield r},Vv=function(t){q(this,Ut,{sessionId:b(this,Ut).sessionId,streamIndex:Math.max(b(this,Ut).streamIndex,t)})},cm=function(t){return Uv({onCaughtUp:t.onCaughtUp,follow:t.follow,host:b(this,La).host,keepAlive:t.keepAlive,resolveHeaders:()=>b(this,La).resolveHeaders(t.resolveHeaders?.()??t.headers),path:kv(b(this,Ut).sessionId),redirect:b(this,La).redirect,signal:t.signal,startIndex:t.startIndex,streamReconnectPolicy:t.streamReconnectPolicy,resolveReconnectPolicy:t.resolveReconnectPolicy})},Hi);function bA(e,t){return e[vA](t)}async function hj(e,t,a){let n=Date.now()+2e4,r=250;for(;;){try{return await $v(e,t,a,!1)}catch(o){if(!yj(o))throw o;let i=n-Date.now();if(i<=0)throw o;await Xc(Math.min(r,i),a.signal)}a.signal?.throwIfAborted(),r=Math.min(r*2,2e3)}}async function gj(e,t){let a=await e.resolveHeaders(t.headers),n=await fetch(yr(e.host,Ta),{headers:a,method:"POST",redirect:e.redirect,signal:t.signal??null});if(!n.ok){let r=await n.text();throw new Za(n.status,r,n.headers)}return n}function yj(e){return e instanceof Za&&e.status===409&&e.code==="session_not_ready"}async function $v(e,t,a,n){let r=wj(a,n);if(r===null)throw Error(n?"Creating a session requires a non-empty message.":"A session turn requires a non-empty message or inputResponses.");let o=await e.resolveHeaders(a.headers);o.set("content-type","application/json");let i=await fetch(yr(e.host,t),{body:JSON.stringify(r),headers:o,method:"POST",redirect:e.redirect,signal:a.signal??null});if(!i.ok){let s=await i.text();throw new Za(i.status,s,i.headers)}return i}async function Fv(e,t){let a=await e.json(),n=(typeof a.sessionId=="string"?a.sessionId:void 0)??e.headers.get(UE)?.trim()??t;if(!n)throw Error("Message route did not return a session id.");return{sessionId:n,deliveryId:typeof a.deliveryId=="string"&&a.deliveryId.length>0?a.deliveryId:void 0}}function wj(e,t){let a={};e.message!==void 0&&(a.message=e.message),e.inputResponses!==void 0&&e.inputResponses.length>0&&(a.inputResponses=e.inputResponses),!t&&e.message!==void 0&&e.turnPolicy!==void 0&&(a.turnPolicy=e.turnPolicy),e.message!==void 0&&e.taskDeliveryPolicy!==void 0&&(a.taskDeliveryPolicy=e.taskDeliveryPolicy),e.clientContext!==void 0&&(a.clientContext=e.clientContext);let n=yA(e.outputSchema);return n!==void 0&&(a.outputSchema=n),t&&a.message===void 0||a.message===void 0&&a.inputResponses===void 0?null:a}var ji,SA,Wv=(SA=class{constructor(e){ue(this,ji);q(this,ji,e)}async create(e={}){return"message"in e?await Zc.create(b(this,ji),e):{session:await Zc.prewarm(b(this,ji),e)}}attach(e,t){if(e.length===0)throw Error("sessionId must be a non-empty string.");return new Zc(b(this,ji),{sessionId:e,streamIndex:t?.streamIndex??0})}},ji=new WeakMap,SA);function IA(e,t){let a=new TextEncoder().encode(`${e}:${t}`),n=Array.from(a,r=>String.fromCodePoint(r)).join("");return btoa(n)}var CA=f.object({ok:f.literal(!0),status:f.literal("ready"),workflowId:f.string().min(1)}).strict();var dm=f.discriminatedUnion("kind",[f.object({kind:f.literal("application")}).strict(),f.object({feature:f.string(),kind:f.literal("framework")}).strict(),f.object({kind:f.literal("extension"),namespace:f.string(),packageName:f.string()}).strict()]),LA=f.discriminatedUnion("kind",[f.object({externalDependencies:f.array(f.string()),extensionScope:f.object({namespace:f.string(),sourceRoot:f.string()}).strict().optional(),kind:f.literal("filesystem"),sourcePath:f.string()}).strict(),f.object({dependencies:f.record(f.string(),f.string()).optional(),kind:f.literal("programmatic"),moduleId:f.string(),parameters:f.record(f.string(),f.unknown()).optional(),registryId:f.string(),revision:f.string(),semanticRevision:f.string().optional()}).strict()]),EA=f.object({backing:LA,logicalPath:f.string(),owner:dm}).strict(),Yr=f.object({binding:EA.optional(),exportName:f.string().optional(),logicalPath:f.string(),owner:dm,sourceId:f.string(),sourceKind:f.enum(["markdown","module","skill-package"])}).strict(),Vi=Yr.extend({name:f.string()}).strict(),Jc=Yr.extend({eventNames:f.array(f.string()),slug:f.string()}).strict(),vj=f.discriminatedUnion("kind",[f.object({kind:f.literal("gateway"),target:f.string(),byok:f.string().optional()}).strict(),f.object({kind:f.literal("external"),provider:f.string()}).strict()]),xj=f.union([f.object({kind:f.literal("external"),provider:f.string()}).strict(),f.object({kind:f.literal("chatgpt"),state:f.enum(["checking","ready","signed-out","reauth-required","unavailable"]),accountLabel:f.string().optional()}).strict(),f.object({kind:f.literal("gateway"),connected:f.literal(!0),credential:f.enum(["api-key","oidc","oauth"]),team:f.optional(f.string())}).strict(),f.object({kind:f.literal("gateway"),connected:f.literal(!1)}).strict()]),kA={contextWindowTokens:f.number().optional(),providerOptions:f.unknown().optional(),reasoning:f.enum(["provider-default","none","minimal","low","medium","high","xhigh"]).optional().catch(void 0),source:Yr.optional()},bj=f.union([f.object({...kA,endpoint:xj.optional(),id:f.string(),routing:vj}).strict(),f.object({...kA,endpoint:f.never().optional(),id:f.never().optional(),routing:f.object({kind:f.literal("dynamic"),resolver:Jc}).strict()}).strict()]),Sj=Vi.extend({description:f.string(),hasAuth:f.boolean(),hasExecute:f.boolean(),hasModelOutputProjection:f.boolean(),hasOutputSchema:f.boolean(),inputSchema:f.unknown(),outputSchema:f.unknown().optional(),requiresApproval:f.boolean()}).strict(),Ij=Vi.extend({description:f.string(),license:f.string().optional(),markdown:f.string(),metadata:f.record(f.string(),f.string()).optional()}).strict(),Cj=Vi.extend({content:f.string(),role:f.enum(["system","user"])}).strict(),kj=Vi.extend({cron:f.string(),hasRun:f.boolean(),markdown:f.string().optional()}).strict(),AA=f.enum(["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS","WEBSOCKET"]),Tj=Vi.extend({adapterKind:f.string().optional(),method:AA,urlPath:f.string()}).strict(),Lj=f.object({backing:f.union([LA,f.object({kind:f.literal("resource"),sourcePath:f.string()}).strict()]),form:f.enum(["derived","direct"]),layer:f.enum(["framework-default","extension-package","extension-override","application"]),logicalPath:f.string(),owner:dm,sourceId:f.string()}).strict(),Ej=f.object({method:AA,source:Lj,urlPath:f.string(),winnerSourceId:f.string()}).strict(),Aj=Yr.extend({connectionName:f.string(),description:f.string(),hasApproval:f.boolean(),hasAuthorization:f.boolean(),hasHeaders:f.boolean(),protocol:f.string(),toolFilter:f.unknown().optional(),url:f.string()}).strict(),Mj=Yr.extend({eventNames:f.array(f.string()),slug:f.string()}).strict(),Rj=Yr.extend({description:f.string().optional(),slot:f.string(),visibility:f.enum(["scope","session"])}).strict(),Dj=Yr.extend({provider:f.string().optional(),environmentExportName:f.string().optional(),revisionHash:f.string()}).strict(),_j=Vi.extend({configResolver:Jc.optional(),description:f.string().optional(),entryPath:f.string(),nodeId:f.string(),parentNodeId:f.string(),rootPath:f.string(),summary:f.object({channels:f.number(),connections:f.number(),hooks:f.number(),instructions:f.number(),memories:f.number(),schedules:f.number(),skills:f.number(),tools:f.number()}).strict()}).strict(),Pj=Vi.extend({description:f.string(),nodeId:f.string(),parentNodeId:f.string(),url:f.string().optional()}).strict(),Oj=f.object({action:f.enum(["subagent-call","task-cancel","workflow-tool-call"]).optional(),audience:f.array(f.enum(["root-session","delegated-task-child"])),kind:f.enum(["dispatch","provider-tool"]),sourceId:f.string()}).strict(),TA=f.object({kind:f.enum(["disabled","shadowed"]),logicalPath:f.string(),owner:dm,sourceId:f.string(),winnerSourceId:f.string().optional()}).strict(),MA=f.object({agent:f.object({agentRoot:f.string(),appRoot:f.string(),config:Yr.extend({binding:EA}).strict(),description:f.string().optional(),model:bj,name:f.string(),nodeId:f.string(),outputSchema:f.unknown().optional()}).strict(),capabilities:f.object({devRoutes:f.boolean()}).strict(),channels:f.object({routes:f.array(Tj),shadowed:f.array(Ej)}).strict(),composition:f.object({disabled:f.array(TA),shadowed:f.array(TA)}).strict(),connections:f.array(Aj),diagnostics:f.object({discoveryErrors:f.number(),discoveryWarnings:f.number()}).strict(),hooks:f.array(Mj),instructions:f.object({dynamic:f.array(Jc),static:f.array(Cj)}).strict(),instrumentation:Yr.optional(),kernelEffects:f.array(Oj),kind:f.literal("eve-agent-info"),memories:f.array(Rj),mode:f.enum(["development","production"]),remoteAgents:f.object({entries:f.array(Pj),total:f.number()}).strict(),sandbox:Dj,schedules:f.array(kj),skills:f.object({dynamic:f.array(Jc),static:f.array(Ij)}).strict(),subagents:f.object({local:f.array(_j),total:f.number()}).strict(),tools:f.object({dynamic:f.array(Jc),static:f.array(Sj)}).strict(),version:f.literal(5),workspace:f.object({resourceRoot:f.unknown(),rootEntries:f.array(f.string())}).strict()}).strict().superRefine((e,t)=>{let a=(o,i,s)=>{let l=new Set;o.forEach((u,c)=>{let d=i(u);l.has(d)&&t.addIssue({code:"custom",message:`Duplicate public identity "${d}".`,path:[...s,c]}),l.add(d)})},n=(o,i,s)=>{(!Number.isSafeInteger(o)||o<0||o!==i.length)&&t.addIssue({code:"custom",message:`Expected total ${i.length}, received ${o}.`,path:[...s]})};a(e.tools.static,o=>o.name,["tools","static"]),a(e.tools.dynamic,o=>o.slug,["tools","dynamic"]),a(e.skills.static,o=>o.name,["skills","static"]),a(e.skills.dynamic,o=>o.slug,["skills","dynamic"]),a(e.instructions.static,o=>o.name,["instructions","static"]),a(e.instructions.dynamic,o=>o.slug,["instructions","dynamic"]),a(e.schedules,o=>o.name,["schedules"]),a(e.connections,o=>o.connectionName,["connections"]),a(e.hooks,o=>o.slug,["hooks"]),a(e.memories,o=>o.slot,["memories"]),a(e.channels.routes,o=>`${o.method} ${Nj(o.urlPath)}`,["channels","routes"]),a(e.subagents.local,o=>o.nodeId,["subagents","local"]),a(e.remoteAgents.entries,o=>o.nodeId,["remoteAgents","entries"]),n(e.subagents.total,e.subagents.local,["subagents","total"]),n(e.remoteAgents.total,e.remoteAgents.entries,["remoteAgents","total"]);let r=[[e.agent.config,["agent","config"]],...e.agent.model.source===void 0?[]:[[e.agent.model.source,["agent","model","source"]]],...e.agent.model.routing.kind==="dynamic"?[[e.agent.model.routing.resolver,["agent","model","routing","resolver"]]]:[],...e.channels.routes.map((o,i)=>[o,["channels","routes",i]]),...e.connections.map((o,i)=>[o,["connections",i]]),...e.hooks.map((o,i)=>[o,["hooks",i]]),...e.instructions.dynamic.map((o,i)=>[o,["instructions","dynamic",i]]),...e.instructions.static.map((o,i)=>[o,["instructions","static",i]]),...e.memories.map((o,i)=>[o,["memories",i]]),...e.instrumentation===void 0?[]:[[e.instrumentation,["instrumentation"]]],...e.remoteAgents.entries.map((o,i)=>[o,["remoteAgents","entries",i]]),...e.schedules.map((o,i)=>[o,["schedules",i]]),...e.skills.dynamic.map((o,i)=>[o,["skills","dynamic",i]]),...e.skills.static.map((o,i)=>[o,["skills","static",i]]),...e.subagents.local.flatMap((o,i)=>o.configResolver===void 0?[]:[[o.configResolver,["subagents","local",i,"configResolver"]]]),...e.tools.dynamic.map((o,i)=>[o,["tools","dynamic",i]]),...e.tools.static.map((o,i)=>[o,["tools","static",i]]),[e.sandbox,["sandbox"]]];for(let[o,i]of r){if(o.sourceKind==="module"&&o.binding===void 0){t.addIssue({code:"custom",message:"Module source is missing its compiled binding.",path:[...i,"binding"]});continue}if(o.sourceKind!=="module"&&o.binding!==void 0){t.addIssue({code:"custom",message:`${o.sourceKind} source cannot carry a module binding.`,path:[...i,"binding"]});continue}o.binding!==void 0&&(o.binding.logicalPath!==o.logicalPath&&t.addIssue({code:"custom",message:"Source and binding logical paths do not match.",path:[...i,"binding","logicalPath"]}),JSON.stringify(o.binding.owner)!==JSON.stringify(o.owner)&&t.addIssue({code:"custom",message:"Source and binding owners do not match.",path:[...i,"binding","owner"]}))}});function Nj(e){return e.replace(/^\/+|\/+$/g,"").split("/").map(t=>t.startsWith(":")||/^\[[^\]]+\]$/.test(t)?":":t).join("/")}var RA="x-vercel-trusted-oidc-idp-token";var Qc,ed,$i,Wi,jo,fm,PA,_A,Xv=(_A=class{constructor(e){ue(this,jo);ue(this,Qc);ue(this,ed);ue(this,$i);ue(this,Wi);K(this,"sessions");q(this,$i,e.host),q(this,Qc,e.auth),q(this,ed,e.headers),q(this,Wi,e.redirect),this.sessions=new Wv({host:b(this,$i),redirect:b(this,Wi),resolveHeaders:t=>Y(this,jo,fm).call(this,t)})}async health(){let e=yr(b(this,$i),EE),t=await Y(this,jo,fm).call(this),a=await fetch(e,DA({headers:t},b(this,Wi)));if(!a.ok){let o=await a.text();throw new Za(a.status,o,a.headers)}let n;try{n=await a.json()}catch{throw new sm}let r=CA.safeParse(n);if(!r.success)throw new sm(r.error.issues.slice(0,5).map(o=>{let i=o.path.join(".");return i.length===0?o.message:`${i}: ${o.message}`}));return r.data}async info(e={}){let t=await this.fetch(AE,e);if(!t.ok){let r=await t.text();throw new Za(t.status,r,t.headers)}let a;try{a=await t.json()}catch{throw new im}let n=MA.safeParse(a);if(!n.success)throw new im(n.error.issues.slice(0,5).map(r=>{let o=r.path.join(".");return o.length===0?r.message:`${o}: ${r.message}`}));return n.data}async fetch(e,t={}){let a=yr(b(this,$i),e),n=await Y(this,jo,fm).call(this,Bj(t.headers));return await fetch(a,DA({...t,headers:n},b(this,Wi)))}},Qc=new WeakMap,ed=new WeakMap,$i=new WeakMap,Wi=new WeakMap,jo=new WeakSet,fm=async function(e){let t=new Headers,[a,n]=await Promise.all([Uj(b(this,ed)),Y(this,jo,PA).call(this)]);for(let[r,o]of Object.entries(a))t.set(r,o);for(let[r,o]of Object.entries(n))t.set(r,o);if(e)for(let[r,o]of Object.entries(e))t.set(r,o);return t},PA=async function(){let e=b(this,Qc);if(!e)return{};if("vercelOidc"in e){let t=(await Gv(e.vercelOidc.token)).trim();return t.length===0?{}:{authorization:`Bearer ${t}`,[RA]:t}}if("bearer"in e){let t=(await Gv(e.bearer)).trim();return t.length===0?{}:{authorization:`Bearer ${t}`}}if("basic"in e){let t=await Gv(e.basic.password);return{authorization:`Basic ${IA(e.basic.username,t)}`}}return{}},_A);async function Gv(e){return typeof e=="function"?e():e}async function Uj(e){return e===void 0?{}:typeof e=="function"?await e():e}function Bj(e){return e===void 0?{}:Object.fromEntries(new Headers(e).entries())}function DA(e,t){return t===void 0?e:{...e,redirect:t}}function Kv(){let e=new Set;return{admit(t){let a=t.meta?.id;return a===void 0||!e.has(a)&&(e.add(a),!0)},get size(){return e.size}}}var Gi,Xi,Zr,Ki,td,ad,nd,El,pm,OA,UA=(OA=class{constructor(e,t){ue(this,El);ue(this,Gi,new AbortController);ue(this,Xi,new Set);ue(this,Zr,Promise.withResolvers());K(this,"caughtUp",b(this,Zr).promise);ue(this,Ki,!1);ue(this,td);ue(this,ad);ue(this,nd);this.setOptions(t),this.caughtUp.catch(()=>{}),t.catchUp||b(this,Zr).resolve(),(async()=>{try{for await(let a of bA(e,{signal:b(this,Gi).signal,resolveHeaders:()=>b(this,ad),resolveReconnectPolicy:()=>b(this,nd),startIndex:t.startIndex,onCaughtUp:t.catchUp?()=>b(this,Zr).resolve():void 0})){if(b(this,Gi).signal.aborted)return;t.onEvent(a);for(let n of b(this,Xi))n.push(a);if(a.type==="session.completed"||a.type==="session.failed")break}b(this,Zr).resolve(),Y(this,El,pm).call(this)}catch(a){b(this,Zr).reject(a),Y(this,El,pm).call(this,a),b(this,Gi).signal.aborted||t.onError(a)}})()}subscribe(e){let t=new zj(()=>b(this,Xi).delete(t),e);return b(this,Ki)?t.end(b(this,td)):b(this,Xi).add(t),t}get ended(){return b(this,Ki)}setOptions(e){"headers"in e&&q(this,ad,e.headers),"streamReconnectPolicy"in e&&q(this,nd,e.streamReconnectPolicy)}close(){let e=new DOMException("Session stream was detached.","AbortError");b(this,Gi).abort(e),b(this,Zr).reject(e),Y(this,El,pm).call(this,e)}},Gi=new WeakMap,Xi=new WeakMap,Zr=new WeakMap,Ki=new WeakMap,td=new WeakMap,ad=new WeakMap,nd=new WeakMap,El=new WeakSet,pm=function(e){if(!b(this,Ki)){q(this,Ki,!0),q(this,td,e);for(let t of b(this,Xi))t.end(e)}},OA),Vo,Yi,Zi,Al,rd,NA,zj=(NA=class{constructor(e,t){ue(this,Vo,[]);ue(this,Yi,Promise.withResolvers());ue(this,Zi,!1);ue(this,Al);ue(this,rd);let a=()=>this.end(t?.reason);t?.addEventListener("abort",a,{once:!0}),q(this,rd,()=>{t?.removeEventListener("abort",a),e()}),t?.aborted&&a()}push(e){b(this,Zi)||(b(this,Vo).push(e),b(this,Yi).resolve())}end(e){b(this,Zi)||(q(this,Zi,!0),q(this,Al,e),b(this,Yi).resolve())}[Symbol.dispose](){this.end(),q(this,Vo,[]),b(this,rd).call(this)}discard(){q(this,Vo,[])}async*[Symbol.asyncIterator](){for(;;){for(;b(this,Vo).length>0;)yield b(this,Vo).shift();if(b(this,Zi)){if(b(this,Al)!==void 0)throw b(this,Al);return}q(this,Yi,Promise.withResolvers()),await b(this,Yi).promise}}},Vo=new WeakMap,Yi=new WeakMap,Zi=new WeakMap,Al=new WeakMap,rd=new WeakMap,NA);var $o,Ja,vr,Ml,mm,BA,zA=(BA=class{constructor(e,t){ue(this,Ml);ue(this,$o);ue(this,Ja);ue(this,vr);q(this,$o,e),q(this,Ja,t),q(this,vr,Y(this,Ml,mm).call(this))}get data(){return b(this,vr)}reset(){q(this,Ja,[]),q(this,vr,b(this,$o).initial())}append(e){q(this,Ja,[...b(this,Ja),e]),q(this,vr,b(this,$o).reduce(b(this,vr),e))}remove(e){q(this,Ja,b(this,Ja).filter(t=>!e(t))),q(this,vr,Y(this,Ml,mm).call(this))}replace(e,t){let a=b(this,Ja).findIndex(e);q(this,Ja,a===-1?[...b(this,Ja),t]:b(this,Ja).map((n,r)=>r===a?t:n)),q(this,vr,Y(this,Ml,mm).call(this))}},$o=new WeakMap,Ja=new WeakMap,vr=new WeakMap,Ml=new WeakSet,mm=function(){let e=b(this,$o).initial();for(let t of b(this,Ja))e=b(this,$o).reduce(e,t);return e},BA);function qA(e){let t=e.at(-1);return t!==void 0&&xn(t)&&(t.type!=="session.waiting"||Fj(e).size===0)}function Fj(e){let t=new Set;for(let a of e)Bi(t,a);return t}function Yv(e){if(e.message!==void 0==(e.inputResponses!==void 0))throw Error("A turn requires exactly one of message or inputResponses.")}var FA=0;function HA(){let e=globalThis.crypto?.randomUUID;return e===void 0?(FA+=1,`submission_${FA.toString()}`):e.call(globalThis.crypto)}function od(e,t){return e?AbortSignal.any([e,t]):t}function jA(e){if(typeof e=="string")return e;let t=[];for(let a of e)a.type==="text"?t.push(a.text):a.type==="file"&&t.push(a.filename?`[file: ${a.filename}]`:"[file]");return t.join(`
141
141
  `)}function Zv(e){return e instanceof Error&&e.name==="AbortError"}function VA(e){if(e.type!=="session.failed")return;let t=Error(e.data.message);return t.name=e.data.code,t}function Jv(e){let t=Promise.withResolvers(),a=Promise.withResolvers(),n={abortController:new AbortController,acceptedFollowUps:0,cancel:()=>e(n),completion:a.promise,followUpDispatches:new Set,receivedFollowUps:0,receivedFollowUpEvents:new Map,followUpSubmissionIds:new Set,resolveCompletion:a.resolve,response:t.promise,resolveResponse:t.resolve};return n}async function Qv(e,t,a){for(;e.followUpDispatches.size>0;)await Promise.allSettled(e.followUpDispatches);if(!(e.receivedFollowUps>=e.acceptedFollowUps))for await(let n of t){if(!a())return;if(e.receivedFollowUps+=e.receivedFollowUpEvents.get(n)??0,e.receivedFollowUpEvents.delete(n),xn(n)){for(;e.followUpDispatches.size>0;)await Promise.allSettled(e.followUpDispatches);if(e.receivedFollowUps>=e.acceptedFollowUps)return}}}async function id(e,t){if(t===void 0)return await e;let a=Promise.withResolvers(),n=()=>a.reject(t.reason);t.addEventListener("abort",n,{once:!0}),t.aborted&&n();try{return await Promise.race([a.promise,e])}finally{t.removeEventListener("abort",n)}}var sd,Qn,Sa,Wo,ex,tx,$A,WA=($A=class{constructor(e,t){ue(this,Wo);ue(this,sd);ue(this,Qn);ue(this,Sa,[]);q(this,Qn,e),q(this,sd,t)}reset(){q(this,Sa,[])}submit(e,t){if(e.message===void 0)return;let a={createdAt:Date.now(),eventStartIndex:t,id:HA(),message:jA(e.message),requiresDeliveryId:!0};return q(this,Sa,[...b(this,Sa),a]),b(this,sd)&&b(this,Qn).append({data:{createdAt:a.createdAt,message:a.message,submissionId:a.id},type:"client.message.submitted"}),a.id}apply(e){if(e.type!=="message.received"){b(this,Qn).append(e);return}if(e.data.kind==="execution.background_task"){b(this,Qn).append(e);return}let t=Y(this,Wo,ex).call(this,e);if(t.length===0){b(this,Qn).append(e);return}return Y(this,Wo,tx).call(this,t,e,!1)}correlate(e,t,a){if(e===void 0)return;q(this,Sa,b(this,Sa).map(r=>r.id===e?{...r,deliveryId:t,requiresDeliveryId:t!==void 0}:r));let n=b(this,Sa).find(r=>r.id===e);if(n!==void 0)for(let r of a.slice(n.eventStartIndex)){if(r.type!=="message.received"||r.data.kind==="execution.background_task")continue;let o=Y(this,Wo,ex).call(this,r);if(o.some(i=>i.id===e))return Y(this,Wo,tx).call(this,o,r,!0)}}fail(e,t){let a=t===void 0?b(this,Sa)[0]:b(this,Sa).find(n=>n.id===t);a!==void 0&&(q(this,Sa,b(this,Sa).filter(n=>n.id!==a.id)),b(this,Qn).replace(n=>n.type==="client.message.submitted"&&n.data.submissionId===a.id,{data:{createdAt:a.createdAt,error:{message:e.message},message:a.message,submissionId:a.id},type:"client.message.failed"}))}failAll(e){for(let t of b(this,Sa))this.fail(e,t.id)}},sd=new WeakMap,Qn=new WeakMap,Sa=new WeakMap,Wo=new WeakSet,ex=function(e){return b(this,Sa).filter(t=>t.deliveryId===void 0?!t.requiresDeliveryId:e.meta.deliveryIds?.includes(t.deliveryId)===!0)},tx=function(e,t,a){let n=e.map(o=>o.id),r=new Set(n);return q(this,Sa,b(this,Sa).filter(o=>!r.has(o.id))),a||b(this,Qn).replace(o=>o.type==="client.message.submitted"&&o.data.submissionId===n[0],t),b(this,Qn).remove(o=>o.type==="client.message.submitted"&&r.has(o.data.submissionId)),{alreadyProjected:a,event:t,ids:n}},$A);var qj=Symbol("detachEveAgentStore"),Hj=Symbol("attachEveAgentStore"),Go,Dl,_l,Qa,Xo,Ji,ld,Ko,Pl,Ol,_t,ha,It,Aa,en,Nn,er,Qi,xr,xt,Yo,mt,se,ax,XA,KA,YA,Rl,nx,rx,Ia,ZA,JA,hm,ox,ix,Ea,GA,sx=(GA=class{constructor(e){ue(this,se);ue(this,Go);ue(this,Dl);ue(this,_l,!1);ue(this,Qa);ue(this,Xo,new Set);ue(this,Ji);ue(this,ld);ue(this,Ko);ue(this,Pl,new Set);ue(this,Ol,Kv());ue(this,_t);ue(this,ha,{});ue(this,It);ue(this,Aa);ue(this,en);ue(this,Nn,0);ue(this,er);ue(this,Qi);ue(this,xr);ue(this,xt);ue(this,Yo);ue(this,mt,"ready");q(this,Dl,e.prewarm??!1),q(this,Ji,e.session!==void 0),q(this,Go,b(this,Ji)?void 0:new Xv({auth:e.auth,headers:e.headers,host:e.host??""}));let t=[];for(let a of e.initialEvents??[])b(this,Ol).admit(a)&&t.push(a),Bi(b(this,Xo),a);q(this,Aa,t),q(this,Ko,new zA(e.reducer,b(this,Aa))),q(this,ld,e.optimistic??!0),q(this,en,new WA(b(this,Ko),b(this,ld))),q(this,xt,e.session??(e.initialSession===void 0?void 0:b(this,Go)?.sessions.attach(e.initialSession.sessionId,{streamIndex:e.initialSession.streamIndex}))),q(this,Yo,Y(this,se,ix).call(this))}get snapshot(){return b(this,Yo)}setCallbacks(e){q(this,ha,e)}subscribe(e){return b(this,Pl).add(e),()=>{b(this,Pl).delete(e)}}prewarm(){if(b(this,er)!==void 0)return b(this,er);if(b(this,xt)!==void 0||b(this,Ji))return Promise.resolve();if(b(this,_t)!==void 0)return b(this,_t).response.then(o=>{if(o===void 0)throw b(this,It)??new DOMException("Session creation was aborted.","AbortError")});let e=b(this,Go);if(e===void 0)return Promise.reject(Error("This eve agent store does not own a session client."));let t=b(this,Nn),a=new AbortController;q(this,Qi,a);let n=(async()=>{try{let o=await e.sessions.create({signal:a.signal});if(t!==b(this,Nn))return;q(this,xt,o.session),q(this,It,void 0),b(this,mt)==="error"&&q(this,mt,"ready"),b(this,ha).onSessionChange?.(o.session.state),Y(this,se,Ea).call(this),Y(this,se,Rl).call(this)}catch(o){throw t===b(this,Nn)&&b(this,_t)===void 0&&b(this,It)===void 0&&(q(this,It,Ui(o)),q(this,mt,"error"),b(this,ha).onError?.(b(this,It)),Y(this,se,Ea).call(this)),o}})();q(this,er,n);let r=()=>{b(this,er)===n&&(q(this,er,void 0),q(this,Qi,void 0))};return n.then(r,r),n}async send(e){return await Y(this,se,ax).call(this,e,b(this,ha).prepareSend)}resume(){if(b(this,xr)!==void 0)return b(this,xr);let e=Y(this,se,XA).call(this);q(this,xr,e);let t=()=>{b(this,xr)===e&&q(this,xr,void 0)};return e.then(t,t),e}cancel(){let e=b(this,_t);return e===void 0?b(this,mt)==="streaming"&&b(this,xt)!==void 0?b(this,xt).cancel():Promise.resolve({status:"no_active_turn"}):e.cancel()}[Hj](){q(this,_l,!0),b(this,Dl)&&b(this,xt)===void 0&&this.prewarm().catch(()=>{})}[qj](){q(this,_l,!1),b(this,Qa)?.close(),q(this,Qa,void 0),b(this,_t)?.abortController.abort(),Y(this,se,nx).call(this),q(this,xr,void 0)}reset(){b(this,Qa)?.close(),q(this,Qa,void 0),b(this,Xo).clear();let e=b(this,_t);q(this,_t,void 0),e?.resolveResponse(void 0),e?.resolveCompletion(),e?.abortController.abort(),Y(this,se,nx).call(this),q(this,xr,void 0),b(this,Ji)||q(this,xt,void 0),q(this,Aa,[]),q(this,Ol,Kv()),b(this,en).reset(),b(this,Ko).reset(),q(this,It,void 0),q(this,mt,"ready"),b(this,ha).onSessionChange?.(b(this,xt)?.state),Y(this,se,Ea).call(this),b(this,Dl)&&b(this,_l)&&this.prewarm().catch(()=>{})}},Go=new WeakMap,Dl=new WeakMap,_l=new WeakMap,Qa=new WeakMap,Xo=new WeakMap,Ji=new WeakMap,ld=new WeakMap,Ko=new WeakMap,Pl=new WeakMap,Ol=new WeakMap,_t=new WeakMap,ha=new WeakMap,It=new WeakMap,Aa=new WeakMap,en=new WeakMap,Nn=new WeakMap,er=new WeakMap,Qi=new WeakMap,xr=new WeakMap,xt=new WeakMap,Yo=new WeakMap,mt=new WeakMap,se=new WeakSet,ax=async function(e,t){if(b(this,_t)!==void 0){if(b(this,mt)==="resuming")throw Error("eve session is resuming.");return await Y(this,se,KA).call(this,b(this,_t),e,t)}let a=Jv(r=>r.acceptedFollowUps>0&&b(this,xt)!==void 0?b(this,xt).cancel():r.response.then(o=>o===void 0?{status:"no_active_turn"}:o.cancel()));q(this,_t,a),q(this,It,void 0),q(this,mt,"submitted"),Y(this,se,Ea).call(this);let n;try{let r=await(t===void 0?e:id(Promise.resolve(t(e)),od(e.signal,a.abortController.signal)));if(Yv(r),!Y(this,se,Ia).call(this,a))return;let o=b(this,en).submit(r,b(this,Aa).length);Y(this,se,ZA).call(this,r),Y(this,se,Ea).call(this);let i={...r,signal:od(r.signal,a.abortController.signal)},s=await Y(this,se,YA).call(this,i),l=s.response;if(n=s.reader,!Y(this,se,Ia).call(this,a))return;a.resolveResponse(l),Y(this,se,hm).call(this,b(this,en).correlate(o,Pv(l),b(this,Aa)))&&Y(this,se,Ea).call(this);for await(let u of XE(l,n)){if(!Y(this,se,Ia).call(this,a))return;a.receivedFollowUps+=a.receivedFollowUpEvents.get(u)??0,a.receivedFollowUpEvents.delete(u)}if(!Y(this,se,Ia).call(this,a)||(await Qv(a,n,()=>Y(this,se,Ia).call(this,a)),!Y(this,se,Ia).call(this,a)))return;q(this,mt,b(this,It)===void 0?"ready":"error")}catch(r){if(!Y(this,se,Ia).call(this,a))return;if(Zv(r))q(this,mt,"ready"),b(this,en).fail(Ui(r));else{let o=b(this,It)!==void 0;b(this,It)??q(this,It,Ui(r)),q(this,mt,"error"),b(this,en).fail(b(this,It)),o||b(this,ha).onError?.(b(this,It))}}finally{n?.[Symbol.dispose](),Y(this,se,rx).call(this,a)}},XA=async function(){if(b(this,mt)==="resuming"||b(this,mt)==="streaming"||b(this,mt)==="submitted")throw Error("eve session is already processing a turn.");if(b(this,xt)===void 0)throw Error("An eve session is required before resuming.");let e=b(this,xt),t=Jv(()=>e.cancel());q(this,_t,t),t.resolveResponse(void 0),q(this,It,void 0),q(this,mt,"resuming"),Y(this,se,Ea).call(this);let a;try{let n=Y(this,se,Rl).call(this,{catchUp:!0,startIndex:b(this,Aa).length===e.state.streamIndex?e.state.streamIndex:0});if(a=n.subscribe(t.abortController.signal),await n.caughtUp,!Y(this,se,Ia).call(this,t))return;a.discard();let r=b(this,Aa).at(-1);if(r!==void 0&&Y(this,se,ox).call(this,r),r!==void 0&&b(this,It)===void 0&&!qA(b(this,Aa))){q(this,mt,"streaming"),Y(this,se,Ea).call(this);for await(let o of a){if(!Y(this,se,Ia).call(this,t))return;if(t.receivedFollowUps+=t.receivedFollowUpEvents.get(o)??0,t.receivedFollowUpEvents.delete(o),xn(o)&&b(this,Xo).size===0)break}}await Qv(t,a,()=>Y(this,se,Ia).call(this,t)),Y(this,se,Ia).call(this,t)&&q(this,mt,b(this,It)===void 0?"ready":"error")}catch(n){if(!Y(this,se,Ia).call(this,t))return;Zv(n)?q(this,mt,"ready"):(q(this,It,Ui(n)),q(this,mt,"error"),b(this,ha).onError?.(b(this,It)))}finally{a?.[Symbol.dispose](),Y(this,se,rx).call(this,t)}},KA=async function(e,t,a){if(t.message===void 0||t.turnPolicy!=="steer")throw Error('eve session is already processing a turn. Send a message with turnPolicy: "steer" to guide it at the next boundary.');let n=b(this,Nn),r=od(t.signal,e.abortController.signal),o=await id(Promise.resolve(a?.(t)),r)??t;if(n!==b(this,Nn))return;if(Yv(o),o.message===void 0||o.turnPolicy!=="steer")throw Error('An in-flight follow-up requires a message with turnPolicy: "steer".');if(!Y(this,se,Ia).call(this,e))return await Y(this,se,ax).call(this,o);let i=b(this,en).submit(o,b(this,Aa).length);i!==void 0&&e.followUpSubmissionIds.add(i),Y(this,se,Ea).call(this),Y(this,se,Rl).call(this,{headers:o.headers,streamReconnectPolicy:o.streamReconnectPolicy});let s;s=(async()=>{try{let l=od(o.signal,e.abortController.signal);if(await id(e.response,l),!Y(this,se,Ia).call(this,e)||b(this,xt)===void 0)throw Error("The active eve turn ended before the follow-up could be sent.");let{message:u,...c}=o,d=await b(this,xt).send(u,{...c,signal:l});e.acceptedFollowUps+=1,Y(this,se,hm).call(this,b(this,en).correlate(i,Pv(d),b(this,Aa)))&&Y(this,se,Ea).call(this)}catch(l){throw Y(this,se,Ia).call(this,e)&&(b(this,en).fail(Ui(l),i),Y(this,se,Ea).call(this)),l}finally{e.followUpDispatches.delete(s)}})(),e.followUpDispatches.add(s),await s,await e.completion},YA=async function(e){let t={headers:e.headers,streamReconnectPolicy:e.streamReconnectPolicy};if(b(this,er)!==void 0&&(await id(b(this,er).catch(n=>{if(b(this,xt)!==void 0)throw n}),e.signal),e.signal?.throwIfAborted()),b(this,xt)===void 0){if(b(this,Go)===void 0)throw Error("An external eve session is required before sending.");if(e.message===void 0)throw Error("Cannot answer an input request before the session starts.");let n=await b(this,Go).sessions.create({...e,message:e.message});return e.signal?.throwIfAborted(),q(this,xt,n.session),b(this,ha).onSessionChange?.(n.session.state),Y(this,se,Ea).call(this),{response:n.response,reader:Y(this,se,Rl).call(this,t).subscribe(e.signal)}}let a=Y(this,se,Rl).call(this,t).subscribe(e.signal);try{if(e.inputResponses===void 0){let{message:o,...i}=e;return{response:await b(this,xt).send(o,i),reader:a}}let{inputResponses:n,...r}=e;return{response:await b(this,xt).respond(n,r),reader:a}}catch(n){throw a[Symbol.dispose](),n}},Rl=function(e={}){if(b(this,Qa)!==void 0&&!b(this,Qa).ended)return b(this,Qa).setOptions(e),b(this,Qa);if(b(this,xt)===void 0)throw Error("A session is required before opening its stream.");let t=b(this,xt),a=b(this,Nn);return q(this,Qa,new UA(t,{...e,onEvent:n=>{a===b(this,Nn)&&Y(this,se,JA).call(this,n)},onError:n=>{a===b(this,Nn)&&(q(this,Qa,void 0),b(this,_t)===void 0&&(q(this,It,Ui(n)),q(this,mt,"error"),b(this,ha).onError?.(b(this,It)),Y(this,se,Ea).call(this)))}})),b(this,Qa)},nx=function(){q(this,Nn,b(this,Nn)+1),b(this,Qi)?.abort(),q(this,Qi,void 0),q(this,er,void 0)},rx=function(e){if(Y(this,se,Ia).call(this,e)){e.resolveResponse(void 0),q(this,_t,void 0);try{b(this,ha).onSessionChange?.(b(this,xt)?.state),Y(this,se,Ea).call(this),b(this,ha).onFinish?.(b(this,Yo))}finally{e.resolveCompletion()}}},Ia=function(e){return b(this,_t)===e},ZA=function(e){e.inputResponses!==void 0&&e.inputResponses.length!==0&&b(this,Ko).append({data:{createdAt:Date.now(),responses:e.inputResponses},type:"client.input.responded"})},JA=function(e){if(!b(this,Ol).admit(e))return;let t=b(this,mt)==="streaming";Bi(b(this,Xo),e),q(this,Aa,[...b(this,Aa),e]),Y(this,se,hm).call(this,b(this,en).apply(e)),b(this,ha).onEvent?.(e),Y(this,se,ox).call(this,e);let a=xn(e)&&b(this,Xo).size===0;b(this,mt)!=="resuming"&&b(this,It)===void 0&&("data"in e&&"turnId"in e.data&&q(this,mt,"streaming"),b(this,_t)===void 0&&a&&q(this,mt,"ready")),b(this,ha).onSessionChange?.(b(this,xt)?.state),b(this,mt)!=="resuming"&&Y(this,se,Ea).call(this),b(this,_t)===void 0&&t&&a&&b(this,ha).onFinish?.(b(this,Yo))},hm=function(e){if(e===void 0)return!1;let t=0;for(let a of e.ids)b(this,_t)?.followUpSubmissionIds.delete(a)&&(t+=1);if(t>0&&b(this,_t)!==void 0)if(e.alreadyProjected)b(this,_t).receivedFollowUps+=t;else{let a=b(this,_t).receivedFollowUpEvents.get(e.event)??0;b(this,_t).receivedFollowUpEvents.set(e.event,a+t)}return!0},ox=function(e){let t=VA(e);t!==void 0&&(q(this,mt,"error"),b(this,en).failAll(t),b(this,It)===void 0&&(q(this,It,t),b(this,ha).onError?.(t)))},ix=function(){return{data:b(this,Ko).data,error:b(this,It),events:b(this,Aa),session:b(this,xt)?.state,status:b(this,mt)}},Ea=function(){q(this,Yo,Y(this,se,ix).call(this));for(let e of b(this,Pl))e()},GA);function jj(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function Vj(e){let t=new AbortController;for(let a of e){if(a.aborted)return t.abort(a.reason),t.signal;a.addEventListener("abort",()=>t.abort(a.reason),{once:!0,signal:t.signal})}return t.signal}function QA(){"withResolvers"in Promise||Object.defineProperty(Promise,"withResolvers",{value:jj,configurable:!0,writable:!0}),"any"in AbortSignal||Object.defineProperty(AbortSignal,"any",{value:Vj,configurable:!0,writable:!0})}var $j=3e4;function Wj(){let e=crypto.getRandomValues(new Uint8Array(32));return btoa(String.fromCharCode(...e)).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function ux(e){let t=e.channelId??"";return e.threadId===void 0?t:`${t}:${e.threadId}`}function lx(e){return`waniwani:eve-conversation:${e}`}function cx(e){try{let t=JSON.parse(localStorage.getItem(lx(e))??"null");return typeof t=="object"&&t!==null&&"conversationId"in t&&typeof t.conversationId=="string"&&"ownerSecret"in t&&typeof t.ownerSecret=="string"?{conversationId:t.conversationId,ownerSecret:t.ownerSecret}:null}catch{return null}}function Ul(e,t){try{t?localStorage.setItem(lx(e),JSON.stringify(t)):localStorage.removeItem(lx(e))}catch{}}function eM(e){return JSON.stringify(e).replace(/[\u007f-\uffff]/g,t=>`\\u${t.charCodeAt(0).toString(16).padStart(4,"0")}`)}function Gj(e){return{...e.documents?.length?{"x-waniwani-documents":eM(e.documents)}:{},...e.extra&&Object.keys(e.extra).length>0?{"x-waniwani-extra":eM(e.extra)}:{}}}var Xj={initial:()=>{},reduce:()=>{}},Nl=class e{constructor(t,a,n){this.open=t;this.secret=a;K(this,"grant");K(this,"refreshing",null);K(this,"store");K(this,"forward");K(this,"caughtUp");K(this,"used",!1);this.grant=n,QA(),this.store=new sx({host:n.eveHost,auth:{bearer:()=>this.bearer()},initialSession:{sessionId:n.sessionId,streamIndex:0},optimistic:!1,reducer:Xj}),this.store.setCallbacks({onEvent:r=>this.forward?.(r)}),this.caughtUp=this.store.resume().catch(()=>{})}static async create(t){let a=Wj(),n=await t.open({operation:"create",requestId:crypto.randomUUID(),ownerSecret:a,channelId:t.channelId,visitorId:t.visitorId});return n?await new e(t.open,a,n).reachable():null}static async resume(t){let a=await t.open({operation:"resume",...t.saved});return a?await new e(t.open,t.saved.ownerSecret,a).reachable():null}async reachable(){return await this.caughtUp,this.store.snapshot.error===void 0?this:(this.close(),null)}get sessionId(){return this.grant.sessionId}get saved(){return{conversationId:this.grant.conversationId,ownerSecret:this.secret}}get followups(){return this.grant.followups}async history(){await this.caughtUp;let{events:t}=this.store.snapshot;return this.used||(this.used=t.some(a=>a.type==="message.received")),t}async bearer(){return this.grant.expiresAt-$j>Date.now()?this.grant.accessToken:(this.refreshing??(this.refreshing=this.open({operation:"refresh",conversationId:this.grant.conversationId,ownerSecret:this.secret}).then(t=>{if(!t)throw new Error("The conversation left the direct runtime");return this.grant=t,t.accessToken}).finally(()=>{this.refreshing=null})),await this.refreshing)}turn(t,a,n){this.used=!0;let r=()=>{this.store.cancel()};return n?.addEventListener("abort",r,{once:!0}),new ReadableStream({start:async i=>{let s=!1;this.forward=u=>{s||(s=u.type==="turn.failed"||u.type==="session.failed"),i.enqueue(u)},await this.caughtUp;let l=await this.store.send({message:t,signal:n,headers:Gj(a)}).then(()=>this.store.snapshot.error,u=>u instanceof Error?u:new Error(String(u)));this.forward=void 0,n?.removeEventListener("abort",r),l&&!s&&!n?.aborted&&i.enqueue({type:"session.failed",data:{code:"transport_failed",message:l.message,sessionId:this.sessionId}}),i.close()}}).pipeThrough(om())}close(){this.forward=void 0,this.store.reset()}};function Bl(e,t){let a=e[t];return typeof a=="string"&&a?a:void 0}function Kj(e){let t=e.visitor;return typeof t=="object"&&t!==null&&"id"in t&&typeof t.id=="string"?t.id:void 0}function Yj(e){return e.filter(t=>t.role==="user").map(t=>t.parts.flatMap(a=>a.type==="text"?[a.text]:[]).join(`
142
- `))}function tM(e){return fetch(new URL(e.path,new URL(e.sessionApi,location.href)),{method:"POST",headers:{...e.headers(),"content-type":"application/json"},body:JSON.stringify(e.body),cache:"no-store",signal:e.signal})}function Zj(e){return async t=>{let a=await tM({...e,path:"followups",body:t,signal:AbortSignal.timeout(8e3)}),n=a.ok?await a.json():null,r=typeof n=="object"&&n!==null&&"data"in n?n.data:null,o=typeof r=="object"&&r!==null&&"suggestions"in r?r.suggestions:null;return Array.isArray(o)?o.filter(i=>typeof i=="string"):[]}}function Jj(e){let t="",a=!1,n=new Set;return new TransformStream({async transform(r,o){if(r.type==="text-delta"&&(t+=r.delta),r.type==="tool-input-available"&&n.add(r.toolName),r.type==="error"&&(a=!0),r.type==="finish"&&!a&&!e.signal?.aborted&&t.trim()){let i=await e.suggest(t,[...n]).catch(()=>[]);i.length>0&&o.enqueue({type:"data-suggestions",data:{suggestions:i}})}o.enqueue(r)}})}function Qj(e){return async t=>{let a=await tM({...e,path:e.sessionApi,body:t});if(!a.ok)throw new Error(`Opening the chat failed (${a.status})`);let n=await a.json(),r=typeof n=="object"&&n!==null&&"data"in n?n.data:null;if(typeof r!="object"||r===null||!("transport"in r))throw new Error("The session route answered no transport");if(r.transport!=="eve-native")return null;let o={...r},i=o.session,s=typeof i=="object"&&i!==null&&"sessionId"in i?i.sessionId:void 0,l=Bl(o,"conversationId"),u=Bl(o,"eveHost"),c=Bl(o,"accessToken"),d=Date.parse(Bl(o,"expiresAt")??"");if(!l||!u||!c||typeof s!="string"||Number.isNaN(d))throw new Error("The session route answered an incomplete session");return{conversationId:l,eveHost:u,sessionId:s,accessToken:c,expiresAt:d,followups:o.followups===!0}}}function eV(e){let t=e.extra;return typeof t=="object"&&t!==null&&!Array.isArray(t)?Object.fromEntries(Object.entries(t)):void 0}var dx=class{constructor(t){this.options=t;K(this,"pending");K(this,"threadOnFallback",!1);K(this,"generation",0)}get channelId(){return Bl(this.options.body(),"channelId")}key(){return ux({channelId:this.channelId,threadId:this.options.threadId()})}keepsSession(){return this.options.open!==void 0}prepare(){this.open(this.options.hasMessages())}open(t){this.options.open&&(this.pending??(this.pending=this.start(this.options.open,t)))}async restore(){let{open:t}=this.options;if(!t||this.options.threadHistory())return[];let a=this.key(),n=cx(a);if(!n)return[];let r=this.generation,o=Nl.resume({open:t,saved:n}).catch(()=>null).then(s=>this.kept(s,r));this.pending=o;let i=await o;return i?await kE(await i.history()):(Ul(a,null),this.pending===o&&(this.pending=void 0),[])}reset(){Ul(this.key(),null),this.dispose()}forget(t){Ul(ux({channelId:this.channelId,threadId:t}),null)}dispose(){this.generation+=1,this.threadOnFallback=!1,this.pending?.then(t=>t?.close()).catch(()=>{}),this.pending=void 0}async start(t,a){let n=this.generation,r=this.key(),o=cx(r);if(o){let u=await Nl.resume({open:t,saved:o}).catch(()=>null);return!u&&n===this.generation&&Ul(r,null),this.kept(u,n)}if(a)return null;let i=this.options.body(),s=await Nl.create({open:t,channelId:Bl(i,"channelId"),visitorId:Kj(i)}),l=this.kept(s,n);return n===this.generation&&Ul(r,l?.saved??null),l}kept(t,a){return t&&a!==this.generation?(t.close(),null):t}async sendMessages(t){let a=t.messages.filter(m=>m.role==="user").length<=1;a&&(this.threadOnFallback=!1);let r=[...t.messages].reverse().find(m=>m.role==="user")?.parts.some(m=>m.type==="file")??!1;if(this.threadOnFallback||r||!this.options.open)return this.threadOnFallback=!0,await this.options.fallback.sendMessages(t);this.open(!a);let o=await this.pending?.catch(()=>null);if(o?.used&&a&&(this.reset(),this.open(!1),o=await this.pending?.catch(()=>null)),!o)return this.threadOnFallback=!0,await this.options.fallback.sendMessages(t);this.options.onSession(o.sessionId);let{documents:i}=this.options.takeTurnInput(),s=Yj(t.messages),l=s.at(-1)??"",u=l.trim()?l:i?.map(m=>m.filename).join(", ")??l,c=o.turn(u,{documents:i,extra:eV(this.options.body())},t.abortSignal),{suggest:d}=this.options;if(!o.followups||!d)return c;let{saved:p}=o;return c.pipeThrough(Jj({suggest:(m,h)=>d({...p,answerText:m.slice(-8e3),recentUserMessages:s.slice(-3).map(v=>v.slice(-2e3)),toolNames:h.slice(0,20)}),signal:t.abortSignal}))}async reconnectToStream(t){return await this.pending?.catch(()=>null)?null:await this.options.fallback.reconnectToStream(t)}};function aM(e){let t=typeof e=="string"?()=>e:e;return a=>{let n=r=>{let o=t();return o?r(o):void 0};return new dx({...a,get open(){return n(r=>Qj({sessionApi:r,headers:a.headers}))},get suggest(){return n(r=>Zj({sessionApi:r,headers:a.headers}))}})}}function zl(e){let t=(0,gm.useRef)(e);t.current=e;let[a]=(0,gm.useState)(()=>aM(()=>t.current));return a}var nM=j(Ee(),1),rM="(max-width: 639px)";function tV(e){let t=window.matchMedia(rM);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function aV(){return window.matchMedia(rM).matches}function nV(){return!1}function oM(){return(0,nM.useSyncExternalStore)(tV,aV,nV)}var ym=j(Ee(),1);function fx(e,t){return e.find(a=>a.text===t)?.id??null}async function iM(e){let{api:t,token:a,name:n,source:r,sessionId:o,properties:i}=e;if(typeof window>"u"||!t||!a)return;let s=Cc(t);if(s)try{let l=new Date().toISOString(),u=JSON.stringify({sentAt:l,source:{sdk:"@waniwani/sdk",version:"0.1.0"},events:[{id:crypto.randomUUID(),type:"mcp.event",name:n,source:r,timestamp:l,correlation:{visitorId:ma(),sessionId:o},properties:{...i,url:window.location.href},metadata:{}}]});await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:u,keepalive:!0})}catch{}}async function sM(e){let{api:t,token:a,channelId:n,mode:r,source:o,sessionId:i,promptId:s,origin:l,text:u,index:c}=e;await iM({api:t,token:a,name:"suggestion.clicked",source:o,sessionId:i,properties:{promptId:s,origin:l,text:u,index:c,channelId:n,mode:r}})}function lM(e,t){return t.map(a=>({id:fx(e,a),text:a}))}async function uM(e){let{api:t,token:a,channelId:n,mode:r,source:o,sessionId:i,prompts:s,origin:l}=e;s.length!==0&&await iM({api:t,token:a,name:"suggestion.shown",source:o,sessionId:i,properties:{prompts:s,count:s.length,origin:l,channelId:n,mode:r}})}function Fl(e){let{widgetEvents:t,api:a,token:n,channelId:r,source:o,mode:i,pagePrompts:s}=e,l=(0,ym.useRef)(e.getSessionId);l.current=e.getSessionId,(0,ym.useEffect)(()=>{if(!(!a||!n))return t.subscribe(u=>{if(u.name==="suggestion.clicked"){let{text:c,origin:d,index:p}=u.properties;sM({api:a,token:n,channelId:r,mode:i,source:o,sessionId:l.current(),promptId:fx(s??[],c),origin:d,text:c,index:p});return}if(u.name==="suggestions.shown"){let{texts:c,origin:d}=u.properties;uM({api:a,token:n,channelId:r,mode:i,source:o,sessionId:l.current(),prompts:lM(s??[],c),origin:d})}})},[t,a,n,r,o,i,s])}var ql=j(Ee(),1),rV=80,oV=50,iV=15e3,cM=500;function Hl(e,t=!0){let[a,n]=(0,ql.useState)(""),r=(0,ql.useRef)(void 0);return(0,ql.useEffect)(()=>{if(!t){n("");return}let o=0,i=!1,s=!1,l=()=>{s||(i?(o--,n(e.slice(0,o)),o<=0?(i=!1,r.current=setTimeout(l,cM)):r.current=setTimeout(l,oV)):(o++,n(e.slice(0,o)),o>=e.length?(i=!0,r.current=setTimeout(l,iV)):r.current=setTimeout(l,rV)))};return r.current=setTimeout(l,cM),()=>{s=!0,clearTimeout(r.current)}},[e,t]),a}var tr=j(Ee(),1);var dM=["en","fr","es"];function jl(e){return dM.includes(e)}function px(e){if(e&&jl(e))return e;if(e){let a=e.split("-")[0]?.toLowerCase();if(a&&jl(a))return a}let t=[];if(typeof navigator<"u"&&(navigator.language&&t.push(navigator.language),navigator.languages&&t.push(...navigator.languages)),typeof document<"u"){let a=document.documentElement.getAttribute("lang");a&&t.push(a)}for(let a of t){let n=a.toLowerCase();if(jl(n))return n;let r=n.split("-")[0];if(r&&jl(r))return r}return"en"}var wm={promptInput:{placeholder:"What would you like to know?",uploadFiles:"Upload files",uploadFilesUpTo:"Upload a document, up to {limit}",uploadFilesUpToWithPages:"Upload a document, up to {limit} and {pages} pages",stop:"Stop",submit:"Submit",removeAttachments:"Remove all attachments",removeAttachment:"Remove attachment",uploading:"Uploading\u2026",retry:"Retry",retryUpload:"Retry the upload",uploadFailed:"The upload did not finish.",dropToAttach:"Drop to attach",errorAccept:"{name} is not a file type this chat accepts.",errorTooLarge:"{name} is larger than {limit}.",errorTooMany:"You can attach up to {limit} files."},workingIndicator:{default:"On it\u2026"},reasoning:{thinking:"Thinking\u2026",thoughtBrief:"Thought for a few seconds",thoughtForSeconds:e=>`Thought for ${e} second${e===1?"":"s"}`},chainOfThought:{working:"Working on it\u2026",done:"Thought process"},tool:{copy:"Copy",copied:"Copied",request:"Request",response:"Response",error:"Error"},attachments:{attachmentFallback:"attachment",kindPdf:"PDF",kindImage:"Image",kindFile:"File",fileFallback:"file"},threadMenu:{newChat:"New chat",threadHistory:"Thread history",deleteThread:"Delete thread",noPreviousChats:"No previous chats yet.",hiddenThreads:e=>`${e} older thread${e===1?"":"s"} hidden`},chatQueue:{attachmentFallback:"(attachment)",removeFromQueue:"Remove from queue",queued:e=>`${e} queued`},poweredBy:{label:"AI agent powered by"},aiDisclaimer:{default:"can make mistakes"},exportSession:{saving:"saving...",saved:"saved",error:"error",export:"export",tooltip:"Save scenario to Waniwani"},widgetErrorBoundary:{failedToLoad:"Widget failed to load",retry:"Retry"},launcher:{prompt:"Ask anything\u2026",open:"Open chat",close:"Close chat",minimize:"Minimize"}};var fM={promptInput:{placeholder:"\xBFQu\xE9 te gustar\xEDa saber?",uploadFiles:"Subir archivos",uploadFilesUpTo:"Subir un documento, hasta {limit}",uploadFilesUpToWithPages:"Subir un documento, hasta {limit} y {pages} p\xE1ginas",stop:"Detener",submit:"Enviar",removeAttachments:"Eliminar todos los archivos adjuntos",removeAttachment:"Quitar archivo",uploading:"Subiendo\u2026",retry:"Reintentar",retryUpload:"Reintentar la subida",uploadFailed:"La subida no se complet\xF3.",dropToAttach:"Suelta para adjuntar",errorAccept:"{name} no es un tipo de archivo que acepte este chat.",errorTooLarge:"{name} supera {limit}.",errorTooMany:"Puedes adjuntar hasta {limit} archivos."},workingIndicator:{default:"Un momento\u2026"},reasoning:{thinking:"Pensando\u2026",thoughtBrief:"Pensado durante unos segundos",thoughtForSeconds:e=>`Pensado durante ${e} segundo${e===1?"":"s"}`},chainOfThought:{working:"Estoy en ello\u2026",done:"Razonamiento"},tool:{copy:"Copiar",copied:"Copiado",request:"Solicitud",response:"Respuesta",error:"Error"},attachments:{attachmentFallback:"adjunto",kindPdf:"PDF",kindImage:"Imagen",kindFile:"Archivo",fileFallback:"archivo"},threadMenu:{newChat:"Nueva conversaci\xF3n",threadHistory:"Historial",deleteThread:"Eliminar conversaci\xF3n",noPreviousChats:"A\xFAn no hay conversaciones anteriores.",hiddenThreads:e=>`${e} conversaci\xF3n${e===1?"":"es"} anterior${e===1?"":"es"} oculta${e===1?"":"s"}`},chatQueue:{attachmentFallback:"(adjunto)",removeFromQueue:"Quitar de la cola",queued:e=>`${e} en cola`},poweredBy:{label:"Agente IA con tecnolog\xEDa de"},aiDisclaimer:{default:"puede cometer errores"},exportSession:{saving:"guardando...",saved:"guardado",error:"error",export:"exportar",tooltip:"Guardar escenario en Waniwani"},widgetErrorBoundary:{failedToLoad:"No se pudo cargar el widget",retry:"Reintentar"},launcher:{prompt:"Pregunta lo que quieras\u2026",open:"Abrir chat",close:"Cerrar chat",minimize:"Minimizar"}};var pM={promptInput:{placeholder:"Que souhaitez-vous savoir ?",uploadFiles:"Importer des fichiers",uploadFilesUpTo:"Joindre un document, jusqu'\xE0 {limit}",uploadFilesUpToWithPages:"Envoyer un document, jusqu'\xE0 {limit} et {pages} pages",stop:"Arr\xEAter",submit:"Envoyer",removeAttachments:"Supprimer toutes les pi\xE8ces jointes",removeAttachment:"Retirer la pi\xE8ce jointe",uploading:"Envoi en cours\u2026",retry:"R\xE9essayer",retryUpload:"R\xE9essayer l'envoi",uploadFailed:"L'envoi ne s'est pas termin\xE9.",dropToAttach:"D\xE9posez pour joindre",errorAccept:"{name} n'est pas un type de fichier accept\xE9 par ce chat.",errorTooLarge:"{name} d\xE9passe {limit}.",errorTooMany:"Vous pouvez joindre jusqu'\xE0 {limit} fichiers."},workingIndicator:{default:"Un instant\u2026"},reasoning:{thinking:"R\xE9flexion\u2026",thoughtBrief:"R\xE9flexion pendant quelques secondes",thoughtForSeconds:e=>`R\xE9flexion pendant ${e} seconde${e===1?"":"s"}`},chainOfThought:{working:"Je m'en occupe\u2026",done:"Raisonnement"},tool:{copy:"Copier",copied:"Copi\xE9",request:"Requ\xEAte",response:"R\xE9ponse",error:"Erreur"},attachments:{attachmentFallback:"pi\xE8ce jointe",kindPdf:"PDF",kindImage:"Image",kindFile:"Fichier",fileFallback:"fichier"},threadMenu:{newChat:"Nouvelle conversation",threadHistory:"Historique",deleteThread:"Supprimer la conversation",noPreviousChats:"Aucune conversation pr\xE9c\xE9dente.",hiddenThreads:e=>`${e} conversation${e===1?"":"s"} plus ancienne${e===1?"":"s"} masqu\xE9e${e===1?"":"s"}`},chatQueue:{attachmentFallback:"(pi\xE8ce jointe)",removeFromQueue:"Retirer de la file",queued:e=>`${e} en attente`},poweredBy:{label:"Agent IA propuls\xE9 par"},aiDisclaimer:{default:"peut faire des erreurs"},exportSession:{saving:"enregistrement...",saved:"enregistr\xE9",error:"erreur",export:"exporter",tooltip:"Enregistrer le sc\xE9nario dans Waniwani"},widgetErrorBoundary:{failedToLoad:"\xC9chec du chargement du widget",retry:"R\xE9essayer"},launcher:{prompt:"Posez votre question\u2026",open:"Ouvrir le chat",close:"Fermer le chat",minimize:"R\xE9duire"}};var mx={en:wm,fr:pM,es:fM};var hM=j(me(),1),mM=(0,tr.createContext)(null);function sV(e,t){if(!t)return e;let a={...e};for(let n of Object.keys(e)){let r=e[n],o=t[n];o&&typeof r=="object"&&(a[n]={...r,...o})}return a}function es({children:e,locale:t,messages:a}){let n=!!(t&&lV(t)),r=n?t:"en",[o,i]=(0,tr.useState)(r),[s,l]=(0,tr.useState)(n);(0,tr.useEffect)(()=>{i(px(t)),l(!0)},[t]);let u=(0,tr.useMemo)(()=>{let c=mx[o]??mx["en"];return{locale:o,t:sV(c,a),ready:s}},[o,a,s]);return(0,hM.jsx)(mM.Provider,{value:u,children:e})}function lV(e){return e==="en"||e==="fr"||e==="es"}function Ue(){let e=(0,tr.useContext)(mM);return e||{locale:"en",t:wm,ready:!0}}function hx(e,t){let a=Date.now()-e;if(a<6e4)try{return new Intl.RelativeTimeFormat(t,{numeric:"auto",style:"narrow"}).format(0,"second")}catch{return"just now"}let n,r;a<60*6e4?(n=-Math.floor(a/6e4),r="minute"):a<1440*6e4?(n=-Math.floor(a/(60*6e4)),r="hour"):(n=-Math.floor(a/(1440*6e4)),r="day");try{return new Intl.RelativeTimeFormat(t,{numeric:"auto",style:"short"}).format(n,r)}catch{return`${Math.abs(n)}${r==="minute"?"m":r==="hour"?"h":"d"} ago`}}var Qe=j(Ee(),1);var ud=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,a)=>(a&=63,a<36?t+=a.toString(36):a<62?t+=(a-26).toString(36).toUpperCase():a>62?t+="-":t+="_",t),"");var Be=j(Ee(),1);var ts=new Map;function gM(e,t){if(ts.has(e)){URL.revokeObjectURL(t);return}for(ts.set(e,t);ts.size>20;){let a=ts.keys().next();if(a.done)return;let n=ts.get(a.value);ts.delete(a.value),n&&URL.revokeObjectURL(n)}}function yM(e){return ts.get(e)}var wM=j(me(),1),br=({className:e,variant:t="default",size:a="default",type:n="button",...r})=>(0,wM.jsx)("button",{type:n,className:V("ww:inline-flex ww:cursor-pointer ww:items-center ww:justify-center ww:rounded-md ww:font-medium ww:transition-colors ww:disabled:pointer-events-none ww:disabled:opacity-50",t==="default"&&"ww:bg-primary ww:text-primary-foreground ww:hover:bg-primary/90",t==="outline"&&"ww:border ww:border-border ww:bg-background ww:hover:bg-accent ww:hover:text-accent-foreground",t==="ghost"&&"ww:hover:bg-accent ww:hover:text-accent-foreground",a==="default"&&"ww:h-9 ww:px-4 ww:py-2 ww:text-sm",a==="sm"&&"ww:h-8 ww:px-3 ww:text-xs",a==="icon"&&"ww:size-9 ww:!rounded-full",a==="icon-sm"&&"ww:size-7 ww:!rounded-full",e),...r});var vM=j(Ee(),1);var Bt=j(me(),1),xM=({files:e,className:t,...a})=>e.length===0?null:(0,Bt.jsx)("div",{className:V("ww:flex ww:flex-wrap ww:gap-1.5",t),...a,children:e.map((n,r)=>(0,Bt.jsx)(uV,{file:n},r))});function uV({file:e}){let{t}=Ue();return e.mediaType?.startsWith("image/")&&e.url?(0,Bt.jsx)("img",{src:e.url,alt:e.filename??t.attachments.attachmentFallback,className:"ww:h-16 ww:max-w-32 ww:rounded ww:object-cover"}):(0,Bt.jsxs)("span",{className:"ww:inline-flex ww:items-center ww:gap-1.5 ww:rounded ww:bg-background/20 ww:px-2 ww:py-1 ww:text-xs",children:[(0,Bt.jsx)(vl,{className:"ww:size-3 ww:shrink-0"}),(0,Bt.jsx)("span",{className:"ww:max-w-24 ww:truncate",children:e.filename??t.attachments.fileFallback})]})}function bM(e,t){return e.startsWith("image/")?t.attachments.kindImage:e==="application/pdf"?t.attachments.kindPdf:t.attachments.kindFile}function cV({mediaType:e}){return e.startsWith("image/")?(0,Bt.jsx)(Dc,{className:"ww:size-5 ww:text-muted-foreground"}):e==="application/pdf"?(0,Bt.jsx)(Mc,{className:"ww:size-5 ww:text-muted-foreground"}):(0,Bt.jsx)(vl,{className:"ww:size-5 ww:text-muted-foreground"})}function gx({filename:e,mediaType:t,previewUrl:a,subtitle:n,tone:r="default",children:o,className:i}){let{t:s}=Ue(),l=bM(t,s);return(0,Bt.jsxs)("li",{"aria-label":`${e}, ${l}`,className:V("ww:relative ww:flex ww:w-60 ww:max-w-full ww:cursor-default ww:items-center ww:gap-2.5 ww:overflow-hidden ww:rounded-xl ww:border ww:bg-background ww:p-2.5",r==="error"?"ww:border-destructive/50":"ww:border-border",i),children:[(0,Bt.jsx)("span",{className:"ww:flex ww:size-10 ww:shrink-0 ww:items-center ww:justify-center ww:overflow-hidden ww:rounded-xl ww:bg-muted",children:a?(0,Bt.jsx)("img",{alt:"",className:"ww:size-full ww:object-cover ww:object-center",src:a}):(0,Bt.jsx)(cV,{mediaType:t})}),(0,Bt.jsxs)("span",{className:"ww:flex ww:min-w-0 ww:flex-col",children:[(0,Bt.jsx)("span",{className:"ww:truncate ww:font-medium ww:text-sm",title:e,children:e}),(0,Bt.jsx)("span",{className:V("ww:truncate ww:text-xs",r==="error"?"ww:text-destructive":"ww:text-muted-foreground"),children:n??l})]}),o]})}function SM(e){if(typeof e!="object"||e===null)return[];let t=e.documents;return Array.isArray(t)?t.filter(a=>typeof a=="object"&&a!==null&&typeof a.documentId=="string"&&typeof a.filename=="string"&&typeof a.mediaType=="string"):[]}var IM=({documents:e,className:t,...a})=>e.length===0?null:(0,Bt.jsx)("ul",{className:V("ww:flex ww:list-none ww:flex-wrap ww:items-end ww:justify-end ww:gap-2 ww:p-0",t),...a,children:e.map((n,r)=>(0,Bt.jsx)(dV,{document:n},`${n.documentId}-${r}`))});function dV({document:e}){let{t}=Ue(),[a,n]=(0,vM.useState)(!1),r=e.mediaType.startsWith("image/")?yM(e.documentId):void 0;return r&&!a?(0,Bt.jsx)("li",{children:(0,Bt.jsx)("img",{alt:`${e.filename}, ${bM(e.mediaType,t)}`,className:"ww:max-h-80 ww:max-w-72 ww:rounded-xl ww:border ww:border-border ww:object-contain",onError:()=>n(!0),src:r,title:e.filename})}):(0,Bt.jsx)(gx,{filename:e.filename,mediaType:e.mediaType})}var Et=j(me(),1),fV=async e=>{try{let a=await(await fetch(e)).blob();return new Promise(n=>{let r=new FileReader;r.onloadend=()=>n(r.result),r.onerror=()=>n(null),r.readAsDataURL(a)})}catch{return null}},pV=(e,t)=>{if(!t)return!0;let a=t.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean);if(a.length===0)return!0;let n=e.type.toLowerCase(),r=e.name.toLowerCase();return a.some(o=>o.startsWith(".")?r.endsWith(o):o.endsWith("/*")?n.startsWith(o.slice(0,-1)):n===o)},kM=(0,Be.createContext)(null),vm=()=>{let e=(0,Be.useContext)(kM);if(!e)throw new Error("usePromptInputAttachments must be used within a PromptInput");return e},TM=({className:e,accept:t,multiple:a,globalDrop:n,maxFiles:r,maxFileSize:o,maxPdfPages:i,attachmentsEnabled:s=!0,upload:l,onDiscard:u,onError:c,onSubmit:d,children:p,...m})=>{let{t:h,locale:v}=Ue(),I=(0,Be.useRef)(null),y=(0,Be.useRef)(null),[w,g]=(0,Be.useState)([]),S=(0,Be.useRef)(w),E=(0,Be.useRef)(new Map),T=(0,Be.useRef)(l),R=(0,Be.useRef)(c),O=(0,Be.useRef)(u);(0,Be.useEffect)(()=>{T.current=l,R.current=c,O.current=u},[l,c,u]);let U=(0,Be.useCallback)(x=>{S.current=x,g(x)},[]),A=(0,Be.useCallback)(()=>{I.current?.click()},[]),Q=(0,Be.useCallback)((x,te)=>{U(S.current.map(re=>re.id===x?{...re,...te}:re))},[U]),$=(0,Be.useCallback)((x,te)=>{let re=T.current;if(!re)return;let ke=new AbortController,We=re(te,ke.signal,be=>{Q(x,{progress:be})}).then(be=>(Q(x,{status:"ready",progress:1,documentId:be.documentId,error:void 0}),be)).catch(be=>{if(ke.signal.aborted)return null;let Oe=be instanceof Error?be.message:h.promptInput.uploadFailed;return Q(x,{status:"failed",error:Oe}),R.current?.({code:"upload_failed",message:Oe}),null});E.current.set(x,{file:te,controller:ke,done:We})},[Q,h]),H=(0,Be.useCallback)(x=>{let te=[...x];if(!s||te.length===0)return;let re=(ce,Le)=>R.current?.({code:ce,message:Le}),ke=[];for(let ce of te){if(!pV(ce,t)){re("accept",h.promptInput.errorAccept.replace("{name}",ce.name));continue}if(o&&ce.size>o){re("max_file_size",h.promptInput.errorTooLarge.replace("{name}",ce.name).replace("{limit}",LM(o,v)));continue}ke.push(ce)}if(ke.length===0)return;let We=typeof r=="number"?Math.max(0,r-S.current.length):void 0,be=typeof We=="number"?ke.slice(0,We):ke;if(be.length<ke.length&&re("max_files",h.promptInput.errorTooMany.replace("{limit}",String(r))),be.length===0)return;let Oe=!!T.current,we=be.map(ce=>({file:ce,item:{filename:ce.name,id:ud(),mediaType:ce.type,type:"file",url:URL.createObjectURL(ce),status:Oe?"uploading":"ready",progress:0}}));U([...S.current,...we.map(ce=>ce.item)]);for(let ce of we)$(ce.item.id,ce.file)},[r,o,t,s,$,U,h,v]),Z=(0,Be.useCallback)(x=>{let te=E.current.get(x);te&&(Q(x,{status:"uploading",progress:0,error:void 0}),$(x,te.file))},[Q,$]),X=(0,Be.useCallback)((x,te)=>{E.current.get(x.id)?.controller.abort(),E.current.delete(x.id),x.url&&(!te&&!!x.documentId&&!!x.mediaType?.startsWith("image/")&&x.documentId?gM(x.documentId,x.url):URL.revokeObjectURL(x.url)),te&&x.documentId&&O.current?.({documentId:x.documentId,filename:x.filename??"",mediaType:x.mediaType??""})},[]),B=(0,Be.useCallback)(x=>{let te=S.current.find(re=>re.id===x);te&&X(te,!0),U(S.current.filter(re=>re.id!==x))},[X,U]),P=(0,Be.useCallback)(()=>{for(let x of S.current)X(x,!0);U([])},[X,U]),J=(0,Be.useRef)(s);(0,Be.useEffect)(()=>{let x=J.current;J.current=s,x&&!s&&P()},[s,P]);let ge=(0,Be.useCallback)(()=>{for(let x of S.current)X(x,!1);U([])},[X,U]);(0,Be.useEffect)(()=>()=>{for(let x of S.current)E.current.get(x.id)?.controller.abort(),x.url&&URL.revokeObjectURL(x.url)},[]);let C=(0,Be.useCallback)(x=>{x.currentTarget.files&&H(x.currentTarget.files),x.currentTarget.value=""},[H]);(0,Be.useEffect)(()=>{if(!n)return;let x=re=>{re.dataTransfer?.types?.includes("Files")&&re.preventDefault()},te=re=>{re.dataTransfer?.types?.includes("Files")&&re.preventDefault(),re.dataTransfer?.files&&re.dataTransfer.files.length>0&&H(re.dataTransfer.files)};return document.addEventListener("dragover",x),document.addEventListener("drop",te),()=>{document.removeEventListener("dragover",x),document.removeEventListener("drop",te)}},[H,n]);let ze=(0,Be.useCallback)(async x=>{x.preventDefault();let te=x.currentTarget,re=new FormData(te).get("message")||"",ke=new Map;for(;ke.size<E.current.size;)await Promise.all([...E.current.entries()].filter(([we])=>!ke.has(we)).map(async([we,ce])=>{ke.set(we,await ce.done)}));for(let we of ke.keys())E.current.has(we)||ke.delete(we);if([...ke.values()].some(we=>we===null)){R.current?.({code:"upload_failed",message:h.promptInput.uploadFailed});return}let We=[...ke.values()].filter(we=>we!==null),be=T.current?[]:S.current,Oe=await Promise.all(be.map(async({id:we,status:ce,progress:Le,error:ie,...xe})=>{if(xe.url?.startsWith("blob:")){let Ne=await fV(xe.url);return{...xe,url:Ne??xe.url}}return xe}));try{let we=d({documents:We,files:Oe,text:re},x);we instanceof Promise&&await we,te.reset(),ge()}catch{}},[d,ge,h]),ot=(0,Be.useMemo)(()=>({add:H,clear:P,files:w,openFileDialog:A,remove:B,retry:Z,maxFileSize:o,maxPdfPages:i}),[w,H,B,Z,P,A,o,i]);return(0,Et.jsxs)(kM.Provider,{value:ot,children:[(0,Et.jsx)("input",{accept:t,"aria-label":h.promptInput.uploadFiles,className:"ww:hidden",multiple:a,onChange:C,ref:I,title:h.promptInput.uploadFiles,type:"file"}),(0,Et.jsx)("form",{className:V("ww:relative ww:flex ww:w-full ww:flex-col ww:rounded-lg ww:border ww:border-border ww:bg-background",e),onSubmit:ze,ref:y,...m,children:p})]})},CM=1024*1024;function LM(e,t){let a=e>=CM;return new Intl.NumberFormat(t,{style:"unit",unit:a?"megabyte":"kilobyte",maximumFractionDigits:0}).format(a?e/CM:Math.max(1,e/1024))}var EM=({onChange:e,onKeyDown:t,className:a,placeholder:n,...r})=>{let{t:o}=Ue(),i=vm(),[s,l]=(0,Be.useState)(!1),u=n??o.promptInput.placeholder,c=(0,Be.useCallback)(p=>{if(t?.(p),!p.defaultPrevented){if(p.key==="Enter"){if(s||p.nativeEvent.isComposing||p.shiftKey)return;p.preventDefault();let{form:m}=p.currentTarget;if(m?.querySelector('[data-submit-blocked="true"]')||m?.querySelector('button[type="submit"]')?.disabled)return;m?.requestSubmit()}if(p.key==="Backspace"&&p.currentTarget.value===""&&i.files.length>0){p.preventDefault();let m=i.files.at(-1);m&&i.remove(m.id)}}},[t,s,i]),d=(0,Be.useCallback)(p=>{let m=p.clipboardData?.items;if(!m)return;let h=[];for(let v of m)if(v.kind==="file"){let I=v.getAsFile();I&&h.push(I)}h.length>0&&(p.preventDefault(),i.add(h))},[i]);return(0,Et.jsx)("textarea",{className:V("ww:field-sizing-content ww:max-h-48 ww:min-h-0 ww:w-full ww:resize-none ww:border-0 ww:bg-transparent ww:px-3 ww:py-2 ww:text-base ww:sm:text-sm ww:outline-none ww:placeholder:text-muted-foreground",a),name:"message",onCompositionEnd:()=>l(!1),onCompositionStart:()=>l(!0),onKeyDown:c,onPaste:d,placeholder:u,onChange:e,...r})},AM=({className:e,status:t,onStop:a,onClick:n,children:r,disabled:o,...i})=>{let{t:s}=Ue(),l=t==="submitted"||t==="streaming",u=l&&a!==void 0,c=(0,Et.jsx)(pr,{className:"ww:size-4"});t==="submitted"?c=(0,Et.jsx)(_c,{className:"ww:size-4 ww:animate-spin"}):t==="streaming"&&(c=(0,Et.jsx)(Pc,{className:"ww:size-4"}));let d=(0,Be.useCallback)(p=>{if(l&&a){p.preventDefault(),a();return}n?.(p)},[l,a,n]);return(0,Et.jsx)(br,{"aria-label":l?s.promptInput.stop:s.promptInput.submit,className:V("ww:bg-foreground ww:text-background ww:hover:bg-foreground ww:rounded-full",e),"data-submit-blocked":o?"true":void 0,disabled:u?!1:o,onClick:d,size:"icon-sm",type:u?"button":"submit",variant:"ghost",...i,children:r??c})},MM=({className:e,children:t,...a})=>{let{t:n,locale:r}=Ue(),o=vm();if(o.files.length>0)return(0,Et.jsxs)(br,{className:V("ww:group ww:relative",e),onClick:()=>o.clear(),size:"icon-sm",type:"button",variant:"ghost","aria-label":n.promptInput.removeAttachments,...a,children:[(0,Et.jsx)("span",{className:"ww:flex ww:size-5 ww:items-center ww:justify-center ww:rounded-full ww:bg-primary ww:text-[10px] ww:font-medium ww:text-primary-foreground ww:transition-opacity ww:group-hover:opacity-0",children:o.files.length}),(0,Et.jsx)(wn,{className:"ww:absolute ww:size-4 ww:opacity-0 ww:transition-opacity ww:group-hover:opacity-100"})]});let s=o.maxFileSize?(o.maxPdfPages?n.promptInput.uploadFilesUpToWithPages.replace("{pages}",String(o.maxPdfPages)):n.promptInput.uploadFilesUpTo).replace("{limit}",LM(o.maxFileSize,r)):n.promptInput.uploadFiles;return(0,Et.jsx)(br,{"aria-label":s,className:V(e),title:s,onClick:()=>o.openFileDialog(),size:"icon-sm",type:"button",variant:"ghost",...a,children:t??(0,Et.jsx)(xl,{className:"ww:size-4"})})},RM=({className:e,...t})=>{let a=vm();return a.files.length===0?null:(0,Et.jsx)("ul",{className:V("ww:flex ww:list-none ww:flex-wrap ww:gap-2 ww:p-0",e),...t,children:a.files.map(n=>(0,Et.jsx)(mV,{file:n},n.id))})};function mV({file:e}){let{t}=Ue(),a=vm(),n=e.status==="failed",r=e.status==="uploading";return(0,Et.jsxs)(gx,{filename:e.filename??t.attachments.fileFallback,mediaType:e.mediaType??"",previewUrl:e.mediaType?.startsWith("image/")?e.url:void 0,subtitle:n?e.error:r?t.promptInput.uploading:void 0,tone:n?"error":"default",children:[n?(0,Et.jsx)("button",{"aria-label":t.promptInput.retryUpload,className:"ww:ml-auto ww:shrink-0 ww:text-destructive ww:text-xs ww:underline ww:underline-offset-2",onClick:()=>a.retry(e.id),type:"button",children:t.promptInput.retry}):null,(0,Et.jsx)("button",{"aria-label":t.promptInput.removeAttachment,className:V("ww:shrink-0 ww:rounded-full ww:p-1 ww:opacity-60 ww:transition-opacity hover:ww:bg-muted hover:ww:opacity-100",n?null:"ww:ml-auto"),onClick:()=>a.remove(e.id),type:"button",children:(0,Et.jsx)(wn,{className:"ww:size-3.5"})}),r?(0,Et.jsx)("span",{"aria-hidden":!0,className:"ww:absolute ww:bottom-0 ww:left-0 ww:h-0.5 ww:bg-primary ww:transition-[width] ww:duration-200",style:{width:`${Math.round(e.progress*100)}%`}}):null]})}var DM=({enabled:e=!0})=>{let{t}=Ue(),[a,n]=(0,Be.useState)(!1);return(0,Be.useEffect)(()=>{if(!e)return;let r=0,o=u=>!!u.dataTransfer?.types?.includes("Files"),i=u=>{o(u)&&(r+=1,n(!0))},s=u=>{o(u)&&(r=Math.max(0,r-1),r===0&&n(!1))},l=()=>{r=0,n(!1)};return document.addEventListener("dragenter",i),document.addEventListener("dragleave",s),document.addEventListener("drop",l),()=>{document.removeEventListener("dragenter",i),document.removeEventListener("dragleave",s),document.removeEventListener("drop",l)}},[e]),e&&a?(0,Et.jsx)("div",{className:"ww:pointer-events-none ww:absolute ww:inset-0 ww:z-50 ww:flex ww:items-center ww:justify-center ww:rounded-2xl ww:border-2 ww:border-primary ww:border-dashed ww:bg-background/85",children:(0,Et.jsxs)("span",{className:"ww:flex ww:items-center ww:gap-2 ww:text-sm ww:font-medium",children:[(0,Et.jsx)(xl,{className:"ww:size-4"}),t.promptInput.dropToAttach]})}):null};var PM=j(me(),1);function _M({text:e}){let{t}=Ue();return e===!1?null:(0,PM.jsx)("span",{className:"ww:whitespace-nowrap ww:text-[10px] ww:sm:text-[11px] ww:text-muted-foreground ww:opacity-70",children:e||t.aiDisclaimer.default})}var xm=j(Ee(),1);var as=j(me(),1),OM=({className:e,...t})=>(0,as.jsx)("div",{className:V("ww:flex ww:flex-col ww:gap-1 ww:px-3 ww:py-2",e),...t}),NM=({className:e,...t})=>(0,as.jsx)("li",{className:V("ww:group ww:flex ww:items-center ww:gap-2 ww:rounded-md ww:px-2 ww:py-1 ww:text-sm ww:transition-colors ww:hover:bg-muted",e),...t}),UM=({className:e,...t})=>(0,as.jsx)("span",{className:V("ww:inline-block ww:size-2 ww:shrink-0 ww:rounded-full ww:border ww:border-muted-foreground/50",e),...t}),BM=({className:e,...t})=>(0,as.jsx)("span",{className:V("ww:line-clamp-1 ww:grow ww:break-words ww:text-muted-foreground",e),...t}),zM=({className:e,...t})=>(0,as.jsx)("div",{className:V("ww:flex ww:shrink-0 ww:gap-1 ww:opacity-0 ww:transition-opacity ww:group-hover:opacity-100",e),...t}),FM=({className:e,...t})=>(0,as.jsx)(br,{className:V("ww:size-auto ww:rounded ww:p-1 ww:text-muted-foreground ww:hover:bg-muted-foreground/10 ww:hover:text-foreground",e),size:"icon",type:"button",variant:"ghost",...t});var Un=j(me(),1),qM=(0,xm.memo)(({message:e,onRemove:t})=>{let{t:a}=Ue(),n=(0,xm.useCallback)(()=>t(e.id),[t,e.id]);return(0,Un.jsxs)(NM,{children:[(0,Un.jsx)(UM,{}),(0,Un.jsx)(BM,{children:e.text||a.chatQueue.attachmentFallback}),(0,Un.jsx)(zM,{children:(0,Un.jsx)(FM,{"aria-label":a.chatQueue.removeFromQueue,onClick:n,children:(0,Un.jsx)(wn,{className:"ww:size-3"})})})]})});qM.displayName="ChatQueueItem";function HM({queuedMessages:e,onRemove:t,className:a}){let{t:n}=Ue();return e.length===0?null:(0,Un.jsxs)(OM,{className:V("ww:border-t ww:border-border",a),children:[(0,Un.jsx)("div",{className:"ww:text-[11px] ww:font-medium ww:text-muted-foreground ww:px-2",children:n.chatQueue.queued(e.length)}),(0,Un.jsx)("ul",{children:e.map(r=>(0,Un.jsx)(qM,{message:r,onRemove:t},r.id))})]})}var nn=j(Ee(),1);var zt=j(Ee(),1);Ch();var xU=j(Ee(),1);var bU=j(me(),1),PK=({as:e="span",className:t,duration:a=2,style:n,children:r,...o})=>{let i={backgroundImage:"linear-gradient(90deg, var(--ww-color-muted-foreground) 0%, var(--ww-color-muted-foreground) 40%, var(--ww-color-foreground) 50%, var(--ww-color-muted-foreground) 60%, var(--ww-color-muted-foreground) 100%)",backgroundSize:"250% 100%",WebkitBackgroundClip:"text",backgroundClip:"text",color:"transparent",animation:`ww-shimmer ${a}s linear infinite`,...n};return(0,bU.jsx)(e,{"data-waniwani-shimmer":"",className:V("ww:inline-block",t),style:i,...o,children:r})},or=(0,xU.memo)(PK);or.displayName="Shimmer";var Da=j(me(),1),SU=(0,zt.createContext)(null);function IU(){let e=(0,zt.useContext)(SU);if(!e)throw new Error("Reasoning components must be used within <Reasoning>");return e}var OK=1e3,NK=1e3,Ud=(0,zt.memo)(({className:e,isStreaming:t=!1,open:a,defaultOpen:n,onOpenChange:r,duration:o,children:i,...s})=>{let l=n??t,u=n===!1,c=a!==void 0,[d,p]=(0,zt.useState)(l),m=c?a:d,h=(0,zt.useCallback)(R=>{c||p(R),r?.(R)},[c,r]),[v,I]=(0,zt.useState)(void 0),y=o??v,w=(0,zt.useRef)(t),[g,S]=(0,zt.useState)(!1),E=(0,zt.useRef)(null);(0,zt.useEffect)(()=>{t?(w.current=!0,E.current===null&&(E.current=Date.now())):E.current!==null&&(I(Math.ceil((Date.now()-E.current)/NK)),E.current=null)},[t]),(0,zt.useEffect)(()=>{t&&!m&&!u&&h(!0)},[t,m,u,h]),(0,zt.useEffect)(()=>{if(w.current&&!t&&m&&!g){let R=setTimeout(()=>{h(!1),S(!0)},OK);return()=>clearTimeout(R)}},[t,m,g,h]);let T=(0,zt.useMemo)(()=>({isStreaming:t,isOpen:m,setIsOpen:h,duration:y}),[t,m,h,y]);return(0,Da.jsx)(SU.Provider,{value:T,children:(0,Da.jsx)("div",{className:V("ww:mb-4 ww:flex ww:flex-col ww:gap-2",e),"data-state":m?"open":"closed",style:{animation:"ww-fade-in 0.2s ease-out"},...s,children:i})})});Ud.displayName="Reasoning";var Bd=(0,zt.memo)(({className:e,children:t,getThinkingMessage:a,hideIcon:n=!1,onClick:r,...o})=>{let{t:i}=Ue(),{isStreaming:s,isOpen:l,duration:u,setIsOpen:c}=IU(),p=a??((m,h)=>m||h===0?(0,Da.jsx)(or,{duration:1.6,children:i.reasoning.thinking}):h===void 0?(0,Da.jsx)("span",{children:i.reasoning.thoughtBrief}):(0,Da.jsx)("span",{children:i.reasoning.thoughtForSeconds(h)}));return(0,Da.jsx)("button",{type:"button","aria-expanded":l,onClick:m=>{c(!l),r?.(m)},className:V("ww:flex ww:w-full ww:items-center ww:gap-2 ww:text-sm ww:text-muted-foreground ww:transition-colors ww:hover:text-foreground",e),...o,children:t??(0,Da.jsxs)(Da.Fragment,{children:[!n&&(0,Da.jsx)(Gr,{className:"ww:size-4 ww:shrink-0"}),p(s,u)]})})});Bd.displayName="ReasoningTrigger";var zd=(0,zt.memo)(({className:e,children:t,...a})=>{let{isOpen:n}=IU();return(0,Da.jsx)("div",{className:V("ww:grid ww:transition-[grid-template-rows,opacity] ww:duration-200 ww:ease-out",n?"ww:grid-rows-[1fr] ww:opacity-100":"ww:grid-rows-[0fr] ww:opacity-0"),children:(0,Da.jsx)("div",{className:"ww:min-h-0 ww:overflow-hidden",children:(0,Da.jsx)("div",{className:V("ww:text-sm ww:text-muted-foreground",e),...a,children:(0,Da.jsx)(au,{children:t})})})})});zd.displayName="ReasoningContent";var Ye=j(me(),1),UK=500,CU=(0,nn.createContext)(null);function kU(){let e=(0,nn.useContext)(CU);if(!e)throw new Error("ChainOfThought components must be used within <ChainOfThought>");return e}function TU({className:e,isWorking:t=!1,activeStep:a,open:n,defaultOpen:r=!1,onOpenChange:o,children:i,...s}){let l=n!==void 0,[u,c]=(0,nn.useState)(r),d=l?n:u,p=(0,nn.useCallback)(I=>{l||c(I),o?.(I)},[l,o]),[m,h]=(0,nn.useState)(!t);(0,nn.useEffect)(()=>{if(t){h(!1);return}let I=setTimeout(()=>h(!0),UK);return()=>clearTimeout(I)},[t]);let v=(0,nn.useMemo)(()=>({open:d,setOpen:p,isWorking:t,settled:m,activeStep:a}),[d,p,t,m,a]);return(0,Ye.jsx)(CU.Provider,{value:v,children:(0,Ye.jsx)("div",{className:V("ww:mb-4 ww:flex ww:flex-col ww:gap-2",e),"data-state":d?"open":"closed",style:{animation:"ww-fade-in 0.2s ease-out"},...s,children:i})})}function LU({className:e,label:t,workingLabel:a,children:n,...r}){let{open:o,setOpen:i,isWorking:s,settled:l,activeStep:u}=kU();if(!l){let c=u?.icon,d=u?.label??a??t??"";return(0,Ye.jsx)("div",{className:V("ww:flex ww:min-h-5 ww:w-full ww:items-center ww:gap-1.5 ww:text-sm ww:text-muted-foreground",e),children:(0,Ye.jsxs)("span",{className:"ww:flex ww:min-w-0 ww:items-center ww:gap-1.5",style:{animation:"ww-fade-in 0.25s ease-out"},children:[c&&(0,Ye.jsx)(c,{className:V("ww:size-4 ww:shrink-0",s&&"ww:animate-pulse")}),(0,Ye.jsx)("span",{className:"ww:truncate",children:s?(0,Ye.jsx)(or,{duration:2.6,children:d}):d})]},d)})}return(0,Ye.jsxs)("button",{type:"button",onClick:()=>i(!o),"aria-expanded":o,className:V("ww:flex ww:min-h-5 ww:w-full ww:items-center ww:gap-1.5 ww:text-sm ww:text-muted-foreground ww:transition-colors ww:hover:text-foreground",e),style:{animation:"ww-fade-in 0.25s ease-out"},...r,children:[(0,Ye.jsx)("span",{className:"ww:truncate",children:n??t}),(0,Ye.jsx)(zo,{className:V("ww:size-4 ww:shrink-0 ww:transition-transform ww:duration-200",o&&"ww:rotate-180")})]})}function EU({className:e,children:t,...a}){let{open:n}=kU();return(0,Ye.jsx)("div",{className:V("ww:grid ww:transition-[grid-template-rows,opacity] ww:duration-200 ww:ease-out",n?"ww:grid-rows-[1fr] ww:opacity-100":"ww:grid-rows-[0fr] ww:opacity-0"),children:(0,Ye.jsx)("div",{className:"ww:min-h-0 ww:overflow-hidden",children:(0,Ye.jsx)("div",{className:V("ww:flex ww:flex-col",e),...a,children:t})})})}function AU({icon:e,isLast:t,running:a,error:n}){return(0,Ye.jsxs)("div",{className:"ww:flex ww:flex-col ww:items-center ww:self-stretch",children:[(0,Ye.jsx)("span",{className:"ww:flex ww:h-5 ww:items-center",children:(0,Ye.jsx)(e,{className:V("ww:size-4 ww:shrink-0",n?"ww:text-destructive":a?"ww:animate-pulse ww:text-foreground":"ww:text-muted-foreground")})}),!t&&(0,Ye.jsx)("span",{className:"ww:w-px ww:flex-1 ww:bg-border"})]})}function VS({className:e,icon:t,title:a,state:n,isLast:r=!1,children:o,...i}){let s=n==="input-available"||n==="input-streaming",l=n==="output-error",u=o!=null,[c,d]=(0,nn.useState)(!1),p=a??"",m=s?(0,Ye.jsx)(or,{duration:1.6,children:p}):(0,Ye.jsx)("span",{className:"ww:truncate",children:p});return(0,Ye.jsxs)("div",{className:V("ww:flex ww:gap-2",e),...i,children:[(0,Ye.jsx)(AU,{icon:t,isLast:r,running:s,error:l}),(0,Ye.jsxs)("div",{className:V("ww:min-w-0 ww:flex-1",!r&&"ww:pb-3"),children:[u?(0,Ye.jsxs)("button",{type:"button",onClick:()=>d(h=>!h),"aria-expanded":c,className:"ww:flex ww:w-full ww:items-center ww:gap-1.5 ww:text-left ww:text-sm ww:text-muted-foreground ww:transition-colors ww:hover:text-foreground",children:[m,(0,Ye.jsx)(zo,{className:V("ww:size-3.5 ww:shrink-0 ww:transition-transform ww:duration-200",c&&"ww:rotate-180")})]}):(0,Ye.jsx)("div",{className:"ww:flex ww:items-center ww:text-sm ww:text-muted-foreground",children:m}),u&&(0,Ye.jsx)("div",{className:V("ww:grid ww:transition-[grid-template-rows,opacity] ww:duration-200 ww:ease-out",c?"ww:grid-rows-[1fr] ww:opacity-100":"ww:grid-rows-[0fr] ww:opacity-0"),children:(0,Ye.jsx)("div",{className:"ww:min-h-0 ww:overflow-hidden",children:(0,Ye.jsx)("div",{className:"ww:mt-2 ww:space-y-3 ww:rounded-lg ww:border ww:border-border ww:bg-background ww:p-3",children:o})})})]})]})}function MU({isStreaming:e=!1,isLast:t=!1,children:a}){return(0,Ye.jsxs)("div",{className:"ww:flex ww:gap-2",children:[(0,Ye.jsx)(AU,{icon:Gr,isLast:t,running:e}),(0,Ye.jsx)("div",{className:V("ww:min-w-0 ww:flex-1",!t&&"ww:pb-3"),children:(0,Ye.jsxs)(Ud,{isStreaming:e,className:"ww:mb-0",children:[(0,Ye.jsx)(Bd,{hideIcon:!0}),(0,Ye.jsx)(zd,{children:a})]})})]})}var $S={name:"cjk-noop",type:"cjk",remarkPluginsBefore:[],remarkPluginsAfter:[],remarkPlugins:[]};var RU={name:"shiki-noop",type:"code-highlighter",supportsLanguage:()=>!1,getSupportedLanguages:()=>[],getThemes:()=>["github-light","github-dark"],highlight:()=>null};var PU=j(Ee(),1);var oo=j(Ee(),1),BK=5,DU=400;function _U(e,t,a={}){let{msPerChar:n=BK}=a,[r,o]=(0,oo.useState)(t?"":e),i=(0,oo.useRef)(e),s=(0,oo.useRef)(t?0:e.length),l=(0,oo.useRef)(0),u=(0,oo.useRef)(null);return(e.length<s.current||!e.startsWith(r.slice(0,s.current)))&&(s.current=t?0:e.length),i.current=e,(0,oo.useEffect)(()=>{if(!t){u.current!==null&&(cancelAnimationFrame(u.current),u.current=null),s.current=e.length,o(e);return}if(i.current.length-s.current>DU&&(s.current=i.current.length-DU),u.current!==null)return;let d=p=>{let m=i.current;if(s.current>=m.length){u.current=null;return}l.current===0&&(l.current=p);let h=p-l.current;if(h>=n){let v=Math.min(Math.floor(h/n),m.length-s.current);s.current+=v,o(m.slice(0,s.current)),l.current=p}u.current=requestAnimationFrame(d)};return u.current=requestAnimationFrame(d),()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null)}},[e,t,n]),r}var Fd=j(me(),1),WS=({className:e,from:t,children:a,...n})=>(0,Fd.jsx)("div",{className:V("ww-message ww:group ww:flex ww:w-full",t==="user"?"ww-message-user is-user ww:ml-auto ww:flex-col ww:items-end ww:[max-width:var(--ww-msg-max-width,80%)]":"ww-message-assistant is-assistant ww:flex-col",e),...n,children:(0,Fd.jsx)("div",{className:V("ww:flex ww:min-w-0 ww:flex-col ww:gap-2","ww:w-full"),children:a})}),GS=({children:e,className:t,...a})=>(0,Fd.jsx)("div",{className:V("ww-bubble ww:flex ww:w-fit ww:min-w-0 ww:max-w-full ww:flex-col ww:gap-2 ww:overflow-hidden","ww:[font-size:var(--ww-font-size,1rem)] ww:[line-height:var(--ww-line-height,1.5)]","ww:group-[.is-user]:ml-auto ww:group-[.is-user]:bg-user-bubble ww:group-[.is-user]:[color:var(--ww-color-user-bubble-text)] ww:group-[.is-user]:[border-radius:var(--ww-msg-radius,8px)] ww:group-[.is-user]:[padding:var(--ww-msg-pad-y,12px)_var(--ww-msg-pad-x,16px)]","ww:group-[.is-assistant]:text-foreground",t),...a,children:e}),zK={cjk:$S,code:RU},FK={cjk:$S},qK={enabled:!1};function HK({className:e,linkSafety:t,isStreaming:a,children:n,...r}){let i=_U(typeof n=="string"?n:"",!!a),s=typeof n=="string"?i:n;return(0,Fd.jsx)(au,{className:V("ww:size-full ww:[&>*:first-child]:mt-0 ww:[&>*:last-child]:mb-0",e),linkSafety:t??qK,plugins:a?FK:zK,...r,children:s})}var Ah=(0,PU.memo)(HK,(e,t)=>e.children===t.children&&e.isStreaming===t.isStreaming);Ah.displayName="MessageResponse";var ua=j(Ee(),1);function XS(e){if(!(typeof e!="object"||e===null))return e}function OU(e){return XS(e?.ui)}function KS(e){if(!e)return;let t=OU(e)?.resourceUri;if(typeof t=="string"&&t.length>0)return t;let a=e["ui/resourceUri"];if(typeof a=="string"&&a.length>0)return a;let n=e["openai/outputTemplate"];if(typeof n=="string"&&n.length>0)return n}function qd(e){return OU(e)?.autoHeight===!0}function YS(e){return XS(XS(e)?._meta)}var qe=j(me(),1);function jK(e,t=80){if(e==null)return String(e);if(typeof e!="object")return String(e).slice(0,t);if(Array.isArray(e))return`Array(${e.length})`;let a=JSON.stringify(e);if(a.length<=t)return a;let n=Object.entries(e),r=[],o=t-2;for(let[i,s]of n){if(o<=8)break;let l=i.length>4?`${i.slice(0,4)}\u2026`:i,u;typeof s=="string"?u=s.length>2?`'${s.slice(0,1)}\u2026`:`'${s}'`:Array.isArray(s)?u=`Array(${s.length})`:typeof s=="object"&&s!==null?u="{\u2026}":u=String(s);let c=`${l}\u2009${u}`;r.push(c),o-=c.length+3}return`{${r.join(", ")}}`}function VK({text:e,className:t}){let{t:a}=Ue(),[n,r]=(0,ua.useState)(!1),o=(0,ua.useRef)(null);(0,ua.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let i=(0,ua.useCallback)(async s=>{s.stopPropagation();try{await navigator.clipboard.writeText(e),r(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>r(!1),2e3)}catch{}},[e]);return(0,qe.jsx)(br,{variant:"ghost",size:"sm",onClick:i,className:V("ww:h-auto ww:gap-1 ww:px-1.5 ww:py-0.5 ww:text-xs ww:text-muted-foreground ww:hover:text-foreground",t),children:n?(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Lc,{className:"ww:size-3.5"}),(0,qe.jsx)("span",{children:a.tool.copied})]}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Ac,{className:"ww:size-3.5"}),(0,qe.jsx)("span",{children:a.tool.copy})]})})}function NU({data:e,label:t,className:a,...n}){let[r,o]=(0,ua.useState)(!1),i=(0,ua.useMemo)(()=>JSON.stringify(e,null,2),[e]),s=jK(e);return(0,qe.jsxs)("div",{className:V("ww:rounded-lg ww:bg-tool-card",a),...n,children:[(0,qe.jsxs)("div",{className:"ww:flex ww:items-center ww:justify-between ww:px-3 ww:pt-2.5 ww:pb-1.5",children:[(0,qe.jsx)("span",{className:"ww:text-xs ww:font-medium ww:text-muted-foreground",children:t}),(0,qe.jsx)(VK,{text:i})]}),(0,qe.jsxs)("button",{type:"button",onClick:()=>o(l=>!l),className:"ww:flex ww:w-full ww:items-start ww:gap-2 ww:px-3 ww:pb-3 ww:text-left",children:[(0,qe.jsx)(Ec,{className:V("ww:mt-0.5 ww:size-3.5 ww:shrink-0 ww:text-muted-foreground ww:transition-transform ww:duration-150",r&&"ww:rotate-90")}),r?(0,qe.jsx)("pre",{className:"ww:overflow-x-auto ww:text-xs ww:font-mono ww:text-foreground ww:whitespace-pre-wrap ww:break-all",children:(0,qe.jsx)("code",{children:i})}):(0,qe.jsx)("span",{className:"ww:truncate ww:text-xs ww:font-mono ww:text-foreground/80",children:s})]})]})}var ZS=(0,ua.createContext)({open:!1,toggle:()=>{}});function UU({className:e,defaultOpen:t=!1,children:a,...n}){let[r,o]=(0,ua.useState)(t);return(0,qe.jsx)(ZS.Provider,{value:{open:r,toggle:()=>o(i=>!i)},children:(0,qe.jsx)("div",{className:V("ww:mb-4 ww:w-full",e),"data-state":r?"open":"closed",style:{animation:"ww-fade-in 0.2s ease-out"},...n,children:a})})}function BU({className:e,title:t,state:a,...n}){let{open:r,toggle:o}=(0,ua.useContext)(ZS),i=a==="input-available"||a==="input-streaming",s=t??"";return(0,qe.jsxs)("button",{type:"button",onClick:o,className:V("ww:flex ww:w-full ww:items-center ww:gap-2 ww:text-sm ww:text-muted-foreground ww:transition-colors ww:hover:text-foreground",e),"aria-expanded":r,...n,children:[(0,qe.jsx)(_i,{className:"ww:size-4 ww:shrink-0"}),(0,qe.jsx)("span",{className:"ww:truncate",children:i?(0,qe.jsx)(or,{duration:1.6,children:s}):s}),(0,qe.jsx)(zo,{className:V("ww:size-4 ww:shrink-0 ww:transition-transform ww:duration-200",r&&"ww:rotate-180")})]})}function zU({className:e,title:t,state:a,...n}){let r=a==="input-available"||a==="input-streaming",o=t??"";return(0,qe.jsx)("div",{className:V("ww:mb-4 ww:flex ww:items-center ww:gap-2 ww:text-sm ww:text-muted-foreground",e),style:{animation:"ww-fade-in 0.2s ease-out"},...n,children:(0,qe.jsx)("span",{className:"ww:truncate",children:r?(0,qe.jsx)(or,{duration:1.6,children:o}):o})})}function FU({className:e,children:t,...a}){let{open:n}=(0,ua.useContext)(ZS);return(0,qe.jsx)("div",{className:V("ww:grid ww:transition-[grid-template-rows,opacity] ww:duration-200 ww:ease-out",n?"ww:grid-rows-[1fr] ww:opacity-100":"ww:grid-rows-[0fr] ww:opacity-0"),children:(0,qe.jsx)("div",{className:"ww:min-h-0 ww:overflow-hidden",children:(0,qe.jsx)("div",{className:V("ww:mt-2 ww:space-y-3 ww:rounded-lg ww:border ww:border-border ww:bg-background ww:p-3",e),...a,children:t})})})}function JS({className:e,input:t,debug:a,...n}){let{t:r}=Ue(),o=(0,ua.useMemo)(()=>{if(!a&&typeof t=="object"&&t!==null&&!Array.isArray(t)){let{_meta:i,...s}=t;return s}return t},[t,a]);return(0,qe.jsx)(NU,{data:o,label:r.tool.request,className:e,...n})}function Hd(e,t,a){if(e){let n=KS(a?.[e]?._meta);if(n)return n}return KS(YS(t))}function qU(e,t,a){return e&&qd(a?.[e]?._meta)?!0:qd(YS(t))}function QS({className:e,output:t,errorText:a,debug:n,...r}){let{t:o}=Ue(),i=(0,ua.useMemo)(()=>{if(!n&&typeof t=="object"&&t!==null&&!Array.isArray(t)){let{_meta:s,...l}=t;return l}return t},[t,n]);return t||a?a?(0,qe.jsxs)("div",{className:V("ww:space-y-2",e),...r,children:[(0,qe.jsx)("h4",{className:"ww:text-xs ww:font-medium ww:uppercase ww:tracking-wide ww:text-muted-foreground",children:o.tool.error}),(0,qe.jsx)("div",{className:"ww:rounded-lg ww:bg-destructive/10 ww:p-3 ww:text-xs ww:text-destructive",children:a})]}):(0,qe.jsx)(NU,{data:i,label:o.tool.response,className:e,...r}):null}var jd=j(me(),1);function HU(e){return e.type==="text"||e.type==="reasoning"||e.type==="file"||"toolCallId"in e}function jU(e){return e.parts.some(HU)}function VU(e,t,a){if(t!=="submitted"&&t!=="streaming")return!1;let n=e[e.length-1];return!n||n.role!=="assistant"?!0:!n.parts.some(o=>!(!HU(o)||a?.ignoreToolParts&&"toolCallId"in o||a?.ignoreReasoningParts&&o.type==="reasoning"))}function $U({className:e,...t}){let{t:a}=Ue();return(0,jd.jsxs)("div",{"aria-live":"polite",className:V("ww:mb-4 ww:flex ww:w-full ww:items-center ww:gap-2 ww:text-sm ww:text-muted-foreground",e),style:{animation:"ww-fade-in 0.2s ease-out"},...t,children:[(0,jd.jsx)(Oc,{className:"ww:size-4 ww:shrink-0"}),(0,jd.jsx)(or,{duration:1.6,children:a.workingIndicator.default})]})}var ut=j(Ee(),1);function nu(e){if(!e)return!1;let t=Array.isArray(e.content)&&e.content.length>0,a=typeof e.structuredContent=="object"&&e.structuredContent!==null&&Object.keys(e.structuredContent).length>0;return t||a}function WU(e,t){return!nu(e)&&!nu(t)?null:nu(e)?nu(t)?{...e.content||t.content?{content:[...e.content??[],...t.content??[]]}:{},...e.structuredContent||t.structuredContent?{structuredContent:{...e.structuredContent??{},...t.structuredContent??{}}}:{}}:{...e.content?{content:[...e.content]}:{},...e.structuredContent?{structuredContent:{...e.structuredContent}}:{}}:{...t?.content?{content:[...t.content]}:{},...t?.structuredContent?{structuredContent:{...t.structuredContent}}:{}}}var io=j(Ee(),1);var GU=(0,io.createContext)(()=>{});function XU(){return(0,io.useContext)(GU)}var KU=GU.Provider;function $K(e){let t=window.requestIdleCallback;typeof t=="function"?t(e):setTimeout(e,500)}function ru(e){let t=(0,io.useRef)(e);t.current=e;let a=(0,io.useRef)(!1);(0,io.useEffect)(()=>{if(!e.painted||a.current)return;a.current=!0;let n=requestAnimationFrame(()=>{let r=t.current;Di(r.paintMark),$K(()=>L1(r))});return()=>cancelAnimationFrame(n)},[e.painted])}var YU=j(me(),1),WK="/api/mcp/resource",GK=500,XK=0,KK=16,YK="2026-01-26",ZK=300,JK=3e3,QK=3,eY=2e3;function tY(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function aY(e,t,a){return Hd(e,t,a)?!1:t._meta?.["waniwani/autoInjectResultText"]!==!1}function Mh({resourceUri:e,toolInput:t,toolResult:a,resourceEndpoint:n=WK,chatSessionId:r,isDark:o=!1,className:i,autoHeight:s=!1,onOpenLink:l,onFollowUp:u,onCallTool:c,onDisplayModeChange:d,isFullscreen:p=!1,toolDefinitions:m}){let h=(0,ut.useRef)(null),v=(0,ut.useRef)(t),I=(0,ut.useRef)(a),y=(0,ut.useRef)({width:0,height:0}),w=(0,ut.useRef)(null),g=(0,ut.useRef)(!1),S=(0,ut.useRef)(0),E=(0,ut.useRef)("inline"),[T,R]=(0,ut.useState)(XK),[O,U]=(0,ut.useState)(void 0),A=(0,ut.useRef)(l),Q=(0,ut.useRef)(u),$=(0,ut.useRef)(c),H=(0,ut.useRef)(d),Z=(0,ut.useRef)(r),X=(0,ut.useRef)(m);v.current=t,I.current=a,A.current=l,Q.current=u,$.current=c,H.current=d,Z.current=r,X.current=m;let B=(0,ut.useCallback)(x=>s?Math.max(x+KK,0):Math.min(Math.max(x,50),GK),[s]),P=(0,ut.useMemo)(()=>{let x=n.includes("?")?"&":"?";return`${n}${x}uri=${encodeURIComponent(e)}`},[n,e]),J=XU(),ge=(0,ut.useRef)(null),C=(0,ut.useRef)(void 0);(0,ut.useEffect)(()=>{let x=A1(e,J);return ge.current=x,()=>{clearTimeout(C.current),x.has("initialized")||x.report("timeout",S.current),ge.current=null}},[e,J]);let ze=(0,ut.useRef)(o);ze.current=o;let ot=(0,ut.useRef)(p);return(0,ut.useEffect)(()=>{ot.current=p,y.current.height=-1,w.current&&(w.current.cancel(),w.current=null)},[p]),(0,ut.useEffect)(()=>{if(!g.current)return;let x=h.current;x?.contentWindow&&x.contentWindow.postMessage({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:{theme:o?"dark":"light"}},"*")},[o]),(0,ut.useEffect)(()=>{let x=h.current;if(!x)return;let te=!1,re=!1,ke=null,We=null,be=setTimeout(()=>{if(te||re||S.current>=QK)return;S.current+=1;let ce=new URL(x.src);ce.searchParams.set("_retry",String(S.current)),x.src=ce.toString()},JK),Oe=ce=>{x.contentWindow?.postMessage(ce,"*")},we=ce=>{if(te||ce.source!==x.contentWindow)return;let Le=ce.data;if(!Le||typeof Le!="object"||Le.jsonrpc!=="2.0")return;let ie=Le.method,xe=Le.id;if(ie==="ui/initialize"&&xe!=null){re=!0,ge.current?.mark("initialize"),clearTimeout(be),Oe({jsonrpc:"2.0",id:xe,result:{protocolVersion:Le.params?.protocolVersion??YK,hostInfo:{name:"Waniwani Chat",version:"1.0.0"},hostCapabilities:{openLinks:{},message:{text:{}},tools:{},updateModelContext:{text:{},structuredContent:{}}},hostContext:{theme:ze.current?"dark":"light",displayMode:E.current}}});return}if(ie==="ui/notifications/initialized"){g.current=!0,ge.current?.mark("initialized"),C.current=setTimeout(()=>ge.current?.report("ok",S.current),eY);let Ne=v.current,_e=I.current,Fe=_e._meta&&typeof _e._meta=="object"?_e._meta:null,Ae=tY(Z.current),de=Fe&&typeof Fe.waniwani=="object"&&Fe.waniwani!==null?Fe.waniwani:null,W=de||Ae?{...de??{},...Ae?{sessionId:Ae}:{}}:void 0,ct=Fe||W?{...Fe??{},...W?{waniwani:W}:{}}:void 0;Oe({jsonrpc:"2.0",method:"ui/notifications/tool-input",params:{arguments:Ne}});let le=_e.content??[{type:"text",text:JSON.stringify(_e)}];Oe({jsonrpc:"2.0",method:"ui/notifications/tool-result",params:{content:le,structuredContent:_e.structuredContent,_meta:ct,meta:ct}});return}if(ie==="ui/notifications/size-changed"){clearTimeout(C.current),ge.current?.mark("firstSize"),ge.current?.report("ok",S.current);let Ne=Le.params,_e=typeof Ne?.height=="number"?Ne.height:void 0,Fe=typeof Ne?.width=="number"?Ne.width:void 0,Ae=y.current,de=_e!==void 0&&_e!==Ae.height,W=Fe!==void 0&&Fe!==Ae.width;if(!de&&!W)return;if(de&&_e!==void 0){if(Ae.height=_e,ot.current)return;let ct=B(_e),le=x.getBoundingClientRect().height;if(w.current&&(w.current.cancel(),w.current=null),R(ct),x.animate&&Math.abs(le-ct)>2){let oe=x.animate([{height:`${le}px`},{height:`${ct}px`}],{duration:ZK,easing:"ease-out",fill:"forwards"});w.current=oe,oe.onfinish=()=>{w.current===oe&&(oe.cancel(),w.current=null)}}}W&&s&&Fe!==void 0&&(Ae.width=Fe,U(Fe));return}if(ie==="ui/open-link"&&xe!=null){let Ne=Le.params?.url;typeof Ne=="string"&&(A.current?A.current(Ne):window.open(Ne,"_blank","noopener,noreferrer")),Oe({jsonrpc:"2.0",id:xe,result:{}});return}if(ie==="ui/message"&&xe!=null){if(Q.current&&Le.params){let Ne=Le.params,_e=ke;if(ke=null,We){clearTimeout(We.timer);let Fe=We.text;We=null;let Ae=(Ne.content??[]).map(de=>de.text??"").join("").trim();Ne={...Ne,content:[{type:"text",text:`${Ae}
142
+ `))}function tM(e){return fetch(new URL(e.path,new URL(e.sessionApi,location.href)),{method:"POST",headers:{...e.headers(),"content-type":"application/json"},body:JSON.stringify(e.body),cache:"no-store",signal:e.signal})}function Zj(e){return async t=>{let a=await tM({...e,path:"followups",body:t,signal:AbortSignal.timeout(8e3)}),n=a.ok?await a.json():null,r=typeof n=="object"&&n!==null&&"data"in n?n.data:null,o=typeof r=="object"&&r!==null&&"suggestions"in r?r.suggestions:null;return Array.isArray(o)?o.filter(i=>typeof i=="string"):[]}}function Jj(e){let t="",a=!1,n=new Set;return new TransformStream({async transform(r,o){if(r.type==="text-delta"&&(t+=r.delta),r.type==="tool-input-available"&&n.add(r.toolName),r.type==="error"&&(a=!0),r.type==="finish"&&!a&&!e.signal?.aborted&&t.trim()){let i=await e.suggest(t,[...n]).catch(()=>[]);i.length>0&&o.enqueue({type:"data-suggestions",data:{suggestions:i}})}o.enqueue(r)}})}function Qj(e){return async t=>{let a=await tM({...e,path:e.sessionApi,body:t});if(!a.ok)throw new Error(`Opening the chat failed (${a.status})`);let n=await a.json(),r=typeof n=="object"&&n!==null&&"data"in n?n.data:null;if(typeof r!="object"||r===null||!("transport"in r))throw new Error("The session route answered no transport");if(r.transport!=="eve-native")return null;let o={...r},i=o.session,s=typeof i=="object"&&i!==null&&"sessionId"in i?i.sessionId:void 0,l=Bl(o,"conversationId"),u=Bl(o,"eveHost"),c=Bl(o,"accessToken"),d=Date.parse(Bl(o,"expiresAt")??"");if(!l||!u||!c||typeof s!="string"||Number.isNaN(d))throw new Error("The session route answered an incomplete session");return{conversationId:l,eveHost:u,sessionId:s,accessToken:c,expiresAt:d,followups:o.followups===!0}}}function eV(e){let t=e.extra;return typeof t=="object"&&t!==null&&!Array.isArray(t)?Object.fromEntries(Object.entries(t)):void 0}var dx=class{constructor(t){this.options=t;K(this,"pending");K(this,"threadOnFallback",!1);K(this,"generation",0)}get channelId(){return Bl(this.options.body(),"channelId")}key(){return ux({channelId:this.channelId,threadId:this.options.threadId()})}keepsSession(){return this.options.open!==void 0}prepare(){this.open(this.options.hasMessages())}open(t){this.options.open&&(this.pending??(this.pending=this.start(this.options.open,t)))}async restore(){let{open:t}=this.options;if(!t||this.options.threadHistory())return[];let a=this.key(),n=cx(a);if(!n)return[];let r=this.generation,o=Nl.resume({open:t,saved:n}).catch(()=>null).then(s=>this.kept(s,r));this.pending=o;let i=await o;return i?await kE(await i.history()):(Ul(a,null),this.pending===o&&(this.pending=void 0),[])}reset(){Ul(this.key(),null),this.dispose()}forget(t){Ul(ux({channelId:this.channelId,threadId:t}),null)}dispose(){this.generation+=1,this.threadOnFallback=!1,this.pending?.then(t=>t?.close()).catch(()=>{}),this.pending=void 0}async start(t,a){let n=this.generation,r=this.key(),o=cx(r);if(o){let u=await Nl.resume({open:t,saved:o}).catch(()=>null);return!u&&n===this.generation&&Ul(r,null),this.kept(u,n)}if(a)return null;let i=this.options.body(),s=await Nl.create({open:t,channelId:Bl(i,"channelId"),visitorId:Kj(i)}),l=this.kept(s,n);return n===this.generation&&Ul(r,l?.saved??null),l}kept(t,a){return t&&a!==this.generation?(t.close(),null):t}async sendMessages(t){let a=t.messages.filter(m=>m.role==="user").length<=1;a&&(this.threadOnFallback=!1);let r=[...t.messages].reverse().find(m=>m.role==="user")?.parts.some(m=>m.type==="file")??!1;if(this.threadOnFallback||r||!this.options.open)return this.threadOnFallback=!0,await this.options.fallback.sendMessages(t);this.open(!a);let o=await this.pending?.catch(()=>null);if(o?.used&&a&&(this.reset(),this.open(!1),o=await this.pending?.catch(()=>null)),!o)return this.threadOnFallback=!0,await this.options.fallback.sendMessages(t);this.options.onSession(o.sessionId);let{documents:i}=this.options.takeTurnInput(),s=Yj(t.messages),l=s.at(-1)??"",u=l.trim()?l:i?.map(m=>m.filename).join(", ")??l,c=o.turn(u,{documents:i,extra:eV(this.options.body())},t.abortSignal),{suggest:d}=this.options;if(!o.followups||!d)return c;let{saved:p}=o;return c.pipeThrough(Jj({suggest:(m,h)=>d({...p,answerText:m.slice(-8e3),recentUserMessages:s.slice(-3).map(v=>v.slice(-2e3)),toolNames:h.slice(0,20)}),signal:t.abortSignal}))}async reconnectToStream(t){return await this.pending?.catch(()=>null)?null:await this.options.fallback.reconnectToStream(t)}};function aM(e){let t=typeof e=="string"?()=>e:e;return a=>{let n=r=>{let o=t();return o?r(o):void 0};return new dx({...a,get open(){return n(r=>Qj({sessionApi:r,headers:a.headers}))},get suggest(){return n(r=>Zj({sessionApi:r,headers:a.headers}))}})}}function zl(e){let t=(0,gm.useRef)(e);t.current=e;let[a]=(0,gm.useState)(()=>aM(()=>t.current));return a}var nM=j(Ee(),1),rM="(max-width: 639px)";function tV(e){let t=window.matchMedia(rM);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function aV(){return window.matchMedia(rM).matches}function nV(){return!1}function oM(){return(0,nM.useSyncExternalStore)(tV,aV,nV)}var ym=j(Ee(),1);function fx(e,t){return e.find(a=>a.text===t)?.id??null}async function iM(e){let{api:t,token:a,name:n,source:r,sessionId:o,properties:i}=e;if(typeof window>"u"||!t||!a)return;let s=Cc(t);if(s)try{let l=new Date().toISOString(),u=JSON.stringify({sentAt:l,source:{sdk:"@waniwani/sdk",version:"0.1.0"},events:[{id:crypto.randomUUID(),type:"mcp.event",name:n,source:r,timestamp:l,correlation:{visitorId:ma(),sessionId:o},properties:{...i,url:window.location.href},metadata:{}}]});await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:u,keepalive:!0})}catch{}}async function sM(e){let{api:t,token:a,channelId:n,mode:r,source:o,sessionId:i,promptId:s,origin:l,text:u,index:c}=e;await iM({api:t,token:a,name:"suggestion.clicked",source:o,sessionId:i,properties:{promptId:s,origin:l,text:u,index:c,channelId:n,mode:r}})}function lM(e,t){return t.map(a=>({id:fx(e,a),text:a}))}async function uM(e){let{api:t,token:a,channelId:n,mode:r,source:o,sessionId:i,prompts:s,origin:l}=e;s.length!==0&&await iM({api:t,token:a,name:"suggestion.shown",source:o,sessionId:i,properties:{prompts:s,count:s.length,origin:l,channelId:n,mode:r}})}function Fl(e){let{widgetEvents:t,api:a,token:n,channelId:r,source:o,mode:i,pagePrompts:s}=e,l=(0,ym.useRef)(e.getSessionId);l.current=e.getSessionId,(0,ym.useEffect)(()=>{if(!(!a||!n))return t.subscribe(u=>{if(u.name==="suggestion.clicked"){let{text:c,origin:d,index:p}=u.properties;sM({api:a,token:n,channelId:r,mode:i,source:o,sessionId:l.current(),promptId:fx(s??[],c),origin:d,text:c,index:p});return}if(u.name==="suggestions.shown"){let{texts:c,origin:d}=u.properties;uM({api:a,token:n,channelId:r,mode:i,source:o,sessionId:l.current(),prompts:lM(s??[],c),origin:d})}})},[t,a,n,r,o,i,s])}var ql=j(Ee(),1),rV=80,oV=50,iV=15e3,cM=500;function Hl(e,t=!0){let[a,n]=(0,ql.useState)(""),r=(0,ql.useRef)(void 0);return(0,ql.useEffect)(()=>{if(!t){n("");return}let o=0,i=!1,s=!1,l=()=>{s||(i?(o--,n(e.slice(0,o)),o<=0?(i=!1,r.current=setTimeout(l,cM)):r.current=setTimeout(l,oV)):(o++,n(e.slice(0,o)),o>=e.length?(i=!0,r.current=setTimeout(l,iV)):r.current=setTimeout(l,rV)))};return r.current=setTimeout(l,cM),()=>{s=!0,clearTimeout(r.current)}},[e,t]),a}var tr=j(Ee(),1);var dM=["en","fr","es"];function jl(e){return dM.includes(e)}function px(e){if(e&&jl(e))return e;if(e){let a=e.split("-")[0]?.toLowerCase();if(a&&jl(a))return a}let t=[];if(typeof navigator<"u"&&(navigator.language&&t.push(navigator.language),navigator.languages&&t.push(...navigator.languages)),typeof document<"u"){let a=document.documentElement.getAttribute("lang");a&&t.push(a)}for(let a of t){let n=a.toLowerCase();if(jl(n))return n;let r=n.split("-")[0];if(r&&jl(r))return r}return"en"}var wm={promptInput:{placeholder:"What would you like to know?",uploadFiles:"Upload files",uploadFilesUpTo:"Upload a document, up to {limit}",uploadFilesUpToWithPages:"Upload a document, up to {limit} and {pages} pages",stop:"Stop",submit:"Submit",removeAttachments:"Remove all attachments",removeAttachment:"Remove attachment",uploading:"Uploading\u2026",retry:"Retry",retryUpload:"Retry the upload",uploadFailed:"The upload did not finish.",dropToAttach:"Drop to attach",errorAccept:"{name} is not a file type this chat accepts.",errorTooLarge:"{name} is larger than {limit}.",errorTooMany:"You can attach up to {limit} files."},workingIndicator:{default:"On it\u2026"},reasoning:{thinking:"Thinking\u2026",thoughtBrief:"Thought for a few seconds",thoughtForSeconds:e=>`Thought for ${e} second${e===1?"":"s"}`},chainOfThought:{working:"Working on it\u2026",done:"Thought process"},tool:{copy:"Copy",copied:"Copied",request:"Request",response:"Response",error:"Error"},attachments:{attachmentFallback:"attachment",kindPdf:"PDF",kindImage:"Image",kindFile:"File",fileFallback:"file"},threadMenu:{newChat:"New chat",threadHistory:"Thread history",deleteThread:"Delete thread",noPreviousChats:"No previous chats yet.",hiddenThreads:e=>`${e} older thread${e===1?"":"s"} hidden`},chatQueue:{attachmentFallback:"(attachment)",removeFromQueue:"Remove from queue",queued:e=>`${e} queued`},poweredBy:{label:"AI agent powered by"},aiDisclaimer:{default:"can make mistakes"},exportSession:{saving:"saving...",saved:"saved",error:"error",export:"export",tooltip:"Save scenario to Waniwani"},widgetErrorBoundary:{failedToLoad:"Widget failed to load",retry:"Retry"},launcher:{prompt:"Ask anything\u2026",open:"Open chat",close:"Close chat",minimize:"Minimize"}};var fM={promptInput:{placeholder:"\xBFQu\xE9 te gustar\xEDa saber?",uploadFiles:"Subir archivos",uploadFilesUpTo:"Subir un documento, hasta {limit}",uploadFilesUpToWithPages:"Subir un documento, hasta {limit} y {pages} p\xE1ginas",stop:"Detener",submit:"Enviar",removeAttachments:"Eliminar todos los archivos adjuntos",removeAttachment:"Quitar archivo",uploading:"Subiendo\u2026",retry:"Reintentar",retryUpload:"Reintentar la subida",uploadFailed:"La subida no se complet\xF3.",dropToAttach:"Suelta para adjuntar",errorAccept:"{name} no es un tipo de archivo que acepte este chat.",errorTooLarge:"{name} supera {limit}.",errorTooMany:"Puedes adjuntar hasta {limit} archivos."},workingIndicator:{default:"Un momento\u2026"},reasoning:{thinking:"Pensando\u2026",thoughtBrief:"Pensado durante unos segundos",thoughtForSeconds:e=>`Pensado durante ${e} segundo${e===1?"":"s"}`},chainOfThought:{working:"Estoy en ello\u2026",done:"Razonamiento"},tool:{copy:"Copiar",copied:"Copiado",request:"Solicitud",response:"Respuesta",error:"Error"},attachments:{attachmentFallback:"adjunto",kindPdf:"PDF",kindImage:"Imagen",kindFile:"Archivo",fileFallback:"archivo"},threadMenu:{newChat:"Nueva conversaci\xF3n",threadHistory:"Historial",deleteThread:"Eliminar conversaci\xF3n",noPreviousChats:"A\xFAn no hay conversaciones anteriores.",hiddenThreads:e=>`${e} conversaci\xF3n${e===1?"":"es"} anterior${e===1?"":"es"} oculta${e===1?"":"s"}`},chatQueue:{attachmentFallback:"(adjunto)",removeFromQueue:"Quitar de la cola",queued:e=>`${e} en cola`},poweredBy:{label:"Agente IA con tecnolog\xEDa de"},aiDisclaimer:{default:"puede cometer errores"},exportSession:{saving:"guardando...",saved:"guardado",error:"error",export:"exportar",tooltip:"Guardar escenario en Waniwani"},widgetErrorBoundary:{failedToLoad:"No se pudo cargar el widget",retry:"Reintentar"},launcher:{prompt:"Pregunta lo que quieras\u2026",open:"Abrir chat",close:"Cerrar chat",minimize:"Minimizar"}};var pM={promptInput:{placeholder:"Que souhaitez-vous savoir ?",uploadFiles:"Importer des fichiers",uploadFilesUpTo:"Joindre un document, jusqu'\xE0 {limit}",uploadFilesUpToWithPages:"Envoyer un document, jusqu'\xE0 {limit} et {pages} pages",stop:"Arr\xEAter",submit:"Envoyer",removeAttachments:"Supprimer toutes les pi\xE8ces jointes",removeAttachment:"Retirer la pi\xE8ce jointe",uploading:"Envoi en cours\u2026",retry:"R\xE9essayer",retryUpload:"R\xE9essayer l'envoi",uploadFailed:"L'envoi ne s'est pas termin\xE9.",dropToAttach:"D\xE9posez pour joindre",errorAccept:"{name} n'est pas un type de fichier accept\xE9 par ce chat.",errorTooLarge:"{name} d\xE9passe {limit}.",errorTooMany:"Vous pouvez joindre jusqu'\xE0 {limit} fichiers."},workingIndicator:{default:"Un instant\u2026"},reasoning:{thinking:"R\xE9flexion\u2026",thoughtBrief:"R\xE9flexion pendant quelques secondes",thoughtForSeconds:e=>`R\xE9flexion pendant ${e} seconde${e===1?"":"s"}`},chainOfThought:{working:"Je m'en occupe\u2026",done:"Raisonnement"},tool:{copy:"Copier",copied:"Copi\xE9",request:"Requ\xEAte",response:"R\xE9ponse",error:"Erreur"},attachments:{attachmentFallback:"pi\xE8ce jointe",kindPdf:"PDF",kindImage:"Image",kindFile:"Fichier",fileFallback:"fichier"},threadMenu:{newChat:"Nouvelle conversation",threadHistory:"Historique",deleteThread:"Supprimer la conversation",noPreviousChats:"Aucune conversation pr\xE9c\xE9dente.",hiddenThreads:e=>`${e} conversation${e===1?"":"s"} plus ancienne${e===1?"":"s"} masqu\xE9e${e===1?"":"s"}`},chatQueue:{attachmentFallback:"(pi\xE8ce jointe)",removeFromQueue:"Retirer de la file",queued:e=>`${e} en attente`},poweredBy:{label:"Agent IA propuls\xE9 par"},aiDisclaimer:{default:"peut faire des erreurs"},exportSession:{saving:"enregistrement...",saved:"enregistr\xE9",error:"erreur",export:"exporter",tooltip:"Enregistrer le sc\xE9nario dans Waniwani"},widgetErrorBoundary:{failedToLoad:"\xC9chec du chargement du widget",retry:"R\xE9essayer"},launcher:{prompt:"Posez votre question\u2026",open:"Ouvrir le chat",close:"Fermer le chat",minimize:"R\xE9duire"}};var mx={en:wm,fr:pM,es:fM};var hM=j(me(),1),mM=(0,tr.createContext)(null);function sV(e,t){if(!t)return e;let a={...e};for(let n of Object.keys(e)){let r=e[n],o=t[n];o&&typeof r=="object"&&(a[n]={...r,...o})}return a}function es({children:e,locale:t,messages:a}){let n=!!(t&&lV(t)),r=n?t:"en",[o,i]=(0,tr.useState)(r),[s,l]=(0,tr.useState)(n);(0,tr.useEffect)(()=>{i(px(t)),l(!0)},[t]);let u=(0,tr.useMemo)(()=>{let c=mx[o]??mx["en"];return{locale:o,t:sV(c,a),ready:s}},[o,a,s]);return(0,hM.jsx)(mM.Provider,{value:u,children:e})}function lV(e){return e==="en"||e==="fr"||e==="es"}function Ue(){let e=(0,tr.useContext)(mM);return e||{locale:"en",t:wm,ready:!0}}function hx(e,t){let a=Date.now()-e;if(a<6e4)try{return new Intl.RelativeTimeFormat(t,{numeric:"auto",style:"narrow"}).format(0,"second")}catch{return"just now"}let n,r;a<60*6e4?(n=-Math.floor(a/6e4),r="minute"):a<1440*6e4?(n=-Math.floor(a/(60*6e4)),r="hour"):(n=-Math.floor(a/(1440*6e4)),r="day");try{return new Intl.RelativeTimeFormat(t,{numeric:"auto",style:"short"}).format(n,r)}catch{return`${Math.abs(n)}${r==="minute"?"m":r==="hour"?"h":"d"} ago`}}var Qe=j(Ee(),1);var ud=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((t,a)=>(a&=63,a<36?t+=a.toString(36):a<62?t+=(a-26).toString(36).toUpperCase():a>62?t+="-":t+="_",t),"");var Be=j(Ee(),1);var ts=new Map;function gM(e,t){if(ts.has(e)){URL.revokeObjectURL(t);return}for(ts.set(e,t);ts.size>20;){let a=ts.keys().next();if(a.done)return;let n=ts.get(a.value);ts.delete(a.value),n&&URL.revokeObjectURL(n)}}function yM(e){return ts.get(e)}var wM=j(me(),1),br=({className:e,variant:t="default",size:a="default",type:n="button",...r})=>(0,wM.jsx)("button",{type:n,className:V("ww:inline-flex ww:cursor-pointer ww:items-center ww:justify-center ww:rounded-md ww:font-medium ww:transition-colors ww:disabled:pointer-events-none ww:disabled:opacity-50",t==="default"&&"ww:bg-primary ww:text-primary-foreground ww:hover:bg-primary/90",t==="outline"&&"ww:border ww:border-border ww:bg-background ww:hover:bg-accent ww:hover:text-accent-foreground",t==="ghost"&&"ww:hover:bg-accent ww:hover:text-accent-foreground",a==="default"&&"ww:h-9 ww:px-4 ww:py-2 ww:text-sm",a==="sm"&&"ww:h-8 ww:px-3 ww:text-xs",a==="icon"&&"ww:size-9 ww:!rounded-full",a==="icon-sm"&&"ww:size-7 ww:!rounded-full",e),...r});var vM=j(Ee(),1);var Bt=j(me(),1),xM=({files:e,className:t,...a})=>e.length===0?null:(0,Bt.jsx)("div",{className:V("ww:flex ww:flex-wrap ww:gap-1.5",t),...a,children:e.map((n,r)=>(0,Bt.jsx)(uV,{file:n},r))});function uV({file:e}){let{t}=Ue();return e.mediaType?.startsWith("image/")&&e.url?(0,Bt.jsx)("img",{src:e.url,alt:e.filename??t.attachments.attachmentFallback,className:"ww:h-16 ww:max-w-32 ww:rounded ww:object-cover"}):(0,Bt.jsxs)("span",{className:"ww:inline-flex ww:items-center ww:gap-1.5 ww:rounded ww:bg-background/20 ww:px-2 ww:py-1 ww:text-xs",children:[(0,Bt.jsx)(vl,{className:"ww:size-3 ww:shrink-0"}),(0,Bt.jsx)("span",{className:"ww:max-w-24 ww:truncate",children:e.filename??t.attachments.fileFallback})]})}function bM(e,t){return e.startsWith("image/")?t.attachments.kindImage:e==="application/pdf"?t.attachments.kindPdf:t.attachments.kindFile}function cV({mediaType:e}){return e.startsWith("image/")?(0,Bt.jsx)(Dc,{className:"ww:size-5 ww:text-muted-foreground"}):e==="application/pdf"?(0,Bt.jsx)(Mc,{className:"ww:size-5 ww:text-muted-foreground"}):(0,Bt.jsx)(vl,{className:"ww:size-5 ww:text-muted-foreground"})}function gx({filename:e,mediaType:t,previewUrl:a,subtitle:n,tone:r="default",children:o,className:i}){let{t:s}=Ue(),l=bM(t,s);return(0,Bt.jsxs)("li",{"aria-label":`${e}, ${l}`,className:V("ww:relative ww:flex ww:w-60 ww:max-w-full ww:cursor-default ww:items-center ww:gap-2.5 ww:overflow-hidden ww:rounded-xl ww:border ww:bg-background ww:p-2.5",r==="error"?"ww:border-destructive/50":"ww:border-border",i),children:[(0,Bt.jsx)("span",{className:"ww:flex ww:size-10 ww:shrink-0 ww:items-center ww:justify-center ww:overflow-hidden ww:rounded-xl ww:bg-muted",children:a?(0,Bt.jsx)("img",{alt:"",className:"ww:size-full ww:object-cover ww:object-center",src:a}):(0,Bt.jsx)(cV,{mediaType:t})}),(0,Bt.jsxs)("span",{className:"ww:flex ww:min-w-0 ww:flex-col",children:[(0,Bt.jsx)("span",{className:"ww:truncate ww:font-medium ww:text-sm",title:e,children:e}),(0,Bt.jsx)("span",{className:V("ww:truncate ww:text-xs",r==="error"?"ww:text-destructive":"ww:text-muted-foreground"),children:n??l})]}),o]})}function SM(e){if(typeof e!="object"||e===null)return[];let t=e.documents;return Array.isArray(t)?t.filter(a=>typeof a=="object"&&a!==null&&typeof a.documentId=="string"&&typeof a.filename=="string"&&typeof a.mediaType=="string"):[]}var IM=({documents:e,className:t,...a})=>e.length===0?null:(0,Bt.jsx)("ul",{className:V("ww:flex ww:list-none ww:flex-wrap ww:items-end ww:justify-end ww:gap-2 ww:p-0",t),...a,children:e.map((n,r)=>(0,Bt.jsx)(dV,{document:n},`${n.documentId}-${r}`))});function dV({document:e}){let{t}=Ue(),[a,n]=(0,vM.useState)(!1),r=e.mediaType.startsWith("image/")?yM(e.documentId):void 0;return r&&!a?(0,Bt.jsx)("li",{children:(0,Bt.jsx)("img",{alt:`${e.filename}, ${bM(e.mediaType,t)}`,className:"ww:max-h-80 ww:max-w-72 ww:rounded-xl ww:border ww:border-border ww:object-contain",onError:()=>n(!0),src:r,title:e.filename})}):(0,Bt.jsx)(gx,{filename:e.filename,mediaType:e.mediaType})}var Et=j(me(),1),fV=async e=>{try{let a=await(await fetch(e)).blob();return new Promise(n=>{let r=new FileReader;r.onloadend=()=>n(r.result),r.onerror=()=>n(null),r.readAsDataURL(a)})}catch{return null}},pV=(e,t)=>{if(!t)return!0;let a=t.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean);if(a.length===0)return!0;let n=e.type.toLowerCase(),r=e.name.toLowerCase();return a.some(o=>o.startsWith(".")?r.endsWith(o):o.endsWith("/*")?n.startsWith(o.slice(0,-1)):n===o)},kM=(0,Be.createContext)(null),vm=()=>{let e=(0,Be.useContext)(kM);if(!e)throw new Error("usePromptInputAttachments must be used within a PromptInput");return e},TM=({className:e,accept:t,multiple:a,globalDrop:n,maxFiles:r,maxFileSize:o,maxPdfPages:i,attachmentsEnabled:s=!0,upload:l,onDiscard:u,onError:c,onSubmit:d,children:p,...m})=>{let{t:h,locale:v}=Ue(),I=(0,Be.useRef)(null),y=(0,Be.useRef)(null),[w,g]=(0,Be.useState)([]),S=(0,Be.useRef)(w),E=(0,Be.useRef)(new Map),T=(0,Be.useRef)(l),R=(0,Be.useRef)(c),O=(0,Be.useRef)(u);(0,Be.useEffect)(()=>{T.current=l,R.current=c,O.current=u},[l,c,u]);let U=(0,Be.useCallback)(x=>{S.current=x,g(x)},[]),A=(0,Be.useCallback)(()=>{I.current?.click()},[]),Q=(0,Be.useCallback)((x,te)=>{U(S.current.map(re=>re.id===x?{...re,...te}:re))},[U]),$=(0,Be.useCallback)((x,te)=>{let re=T.current;if(!re)return;let ke=new AbortController,We=re(te,ke.signal,be=>{Q(x,{progress:be})}).then(be=>(Q(x,{status:"ready",progress:1,documentId:be.documentId,error:void 0}),be)).catch(be=>{if(ke.signal.aborted)return null;let Oe=be instanceof Error?be.message:h.promptInput.uploadFailed;return Q(x,{status:"failed",error:Oe}),R.current?.({code:"upload_failed",message:Oe}),null});E.current.set(x,{file:te,controller:ke,done:We})},[Q,h]),H=(0,Be.useCallback)(x=>{let te=[...x];if(!s||te.length===0)return;let re=(ce,Le)=>R.current?.({code:ce,message:Le}),ke=[];for(let ce of te){if(!pV(ce,t)){re("accept",h.promptInput.errorAccept.replace("{name}",ce.name));continue}if(o&&ce.size>o){re("max_file_size",h.promptInput.errorTooLarge.replace("{name}",ce.name).replace("{limit}",LM(o,v)));continue}ke.push(ce)}if(ke.length===0)return;let We=typeof r=="number"?Math.max(0,r-S.current.length):void 0,be=typeof We=="number"?ke.slice(0,We):ke;if(be.length<ke.length&&re("max_files",h.promptInput.errorTooMany.replace("{limit}",String(r))),be.length===0)return;let Oe=!!T.current,we=be.map(ce=>({file:ce,item:{filename:ce.name,id:ud(),mediaType:ce.type,type:"file",url:URL.createObjectURL(ce),status:Oe?"uploading":"ready",progress:0}}));U([...S.current,...we.map(ce=>ce.item)]);for(let ce of we)$(ce.item.id,ce.file)},[r,o,t,s,$,U,h,v]),Z=(0,Be.useCallback)(x=>{let te=E.current.get(x);te&&(Q(x,{status:"uploading",progress:0,error:void 0}),$(x,te.file))},[Q,$]),X=(0,Be.useCallback)((x,te)=>{E.current.get(x.id)?.controller.abort(),E.current.delete(x.id),x.url&&(!te&&!!x.documentId&&!!x.mediaType?.startsWith("image/")&&x.documentId?gM(x.documentId,x.url):URL.revokeObjectURL(x.url)),te&&x.documentId&&O.current?.({documentId:x.documentId,filename:x.filename??"",mediaType:x.mediaType??""})},[]),B=(0,Be.useCallback)(x=>{let te=S.current.find(re=>re.id===x);te&&X(te,!0),U(S.current.filter(re=>re.id!==x))},[X,U]),P=(0,Be.useCallback)(()=>{for(let x of S.current)X(x,!0);U([])},[X,U]),J=(0,Be.useRef)(s);(0,Be.useEffect)(()=>{let x=J.current;J.current=s,x&&!s&&P()},[s,P]);let ge=(0,Be.useCallback)(()=>{for(let x of S.current)X(x,!1);U([])},[X,U]);(0,Be.useEffect)(()=>()=>{for(let x of S.current)E.current.get(x.id)?.controller.abort(),x.url&&URL.revokeObjectURL(x.url)},[]);let C=(0,Be.useCallback)(x=>{x.currentTarget.files&&H(x.currentTarget.files),x.currentTarget.value=""},[H]);(0,Be.useEffect)(()=>{if(!n)return;let x=re=>{re.dataTransfer?.types?.includes("Files")&&re.preventDefault()},te=re=>{re.dataTransfer?.types?.includes("Files")&&re.preventDefault(),re.dataTransfer?.files&&re.dataTransfer.files.length>0&&H(re.dataTransfer.files)};return document.addEventListener("dragover",x),document.addEventListener("drop",te),()=>{document.removeEventListener("dragover",x),document.removeEventListener("drop",te)}},[H,n]);let ze=(0,Be.useCallback)(async x=>{x.preventDefault();let te=x.currentTarget,re=new FormData(te).get("message")||"",ke=new Map;for(;ke.size<E.current.size;)await Promise.all([...E.current.entries()].filter(([we])=>!ke.has(we)).map(async([we,ce])=>{ke.set(we,await ce.done)}));for(let we of ke.keys())E.current.has(we)||ke.delete(we);if([...ke.values()].some(we=>we===null)){R.current?.({code:"upload_failed",message:h.promptInput.uploadFailed});return}let We=[...ke.values()].filter(we=>we!==null),be=T.current?[]:S.current,Oe=await Promise.all(be.map(async({id:we,status:ce,progress:Le,error:ie,...xe})=>{if(xe.url?.startsWith("blob:")){let Ne=await fV(xe.url);return{...xe,url:Ne??xe.url}}return xe}));try{let we=d({documents:We,files:Oe,text:re},x);we instanceof Promise&&await we,te.reset(),ge()}catch{}},[d,ge,h]),ot=(0,Be.useMemo)(()=>({add:H,clear:P,files:w,openFileDialog:A,remove:B,retry:Z,maxFileSize:o,maxPdfPages:i}),[w,H,B,Z,P,A,o,i]);return(0,Et.jsxs)(kM.Provider,{value:ot,children:[(0,Et.jsx)("input",{accept:t,"aria-label":h.promptInput.uploadFiles,className:"ww:hidden",multiple:a,onChange:C,ref:I,title:h.promptInput.uploadFiles,type:"file"}),(0,Et.jsx)("form",{className:V("ww:relative ww:flex ww:w-full ww:flex-col ww:rounded-lg ww:border ww:border-border ww:bg-background",e),onSubmit:ze,ref:y,...m,children:p})]})},CM=1024*1024;function LM(e,t){let a=e>=CM;return new Intl.NumberFormat(t,{style:"unit",unit:a?"megabyte":"kilobyte",maximumFractionDigits:0}).format(a?e/CM:Math.max(1,e/1024))}var EM=({onChange:e,onKeyDown:t,className:a,placeholder:n,...r})=>{let{t:o}=Ue(),i=vm(),[s,l]=(0,Be.useState)(!1),u=n??o.promptInput.placeholder,c=(0,Be.useCallback)(p=>{if(t?.(p),!p.defaultPrevented){if(p.key==="Enter"){if(s||p.nativeEvent.isComposing||p.shiftKey)return;p.preventDefault();let{form:m}=p.currentTarget;if(m?.querySelector('[data-submit-blocked="true"]')||m?.querySelector('button[type="submit"]')?.disabled)return;m?.requestSubmit()}if(p.key==="Backspace"&&p.currentTarget.value===""&&i.files.length>0){p.preventDefault();let m=i.files.at(-1);m&&i.remove(m.id)}}},[t,s,i]),d=(0,Be.useCallback)(p=>{let m=p.clipboardData?.items;if(!m)return;let h=[];for(let v of m)if(v.kind==="file"){let I=v.getAsFile();I&&h.push(I)}h.length>0&&(p.preventDefault(),i.add(h))},[i]);return(0,Et.jsx)("textarea",{className:V("ww:field-sizing-content ww:max-h-48 ww:min-h-0 ww:w-full ww:resize-none ww:border-0 ww:bg-transparent ww:px-3 ww:py-2 ww:text-base ww:sm:text-sm ww:outline-none ww:placeholder:text-muted-foreground",a),name:"message",onCompositionEnd:()=>l(!1),onCompositionStart:()=>l(!0),onKeyDown:c,onPaste:d,placeholder:u,onChange:e,...r})},AM=({className:e,status:t,onStop:a,onClick:n,children:r,disabled:o,...i})=>{let{t:s}=Ue(),l=t==="submitted"||t==="streaming",u=l&&a!==void 0,c=(0,Et.jsx)(pr,{className:"ww:size-4"});t==="submitted"?c=(0,Et.jsx)(_c,{className:"ww:size-4 ww:animate-spin"}):t==="streaming"&&(c=(0,Et.jsx)(Pc,{className:"ww:size-4"}));let d=(0,Be.useCallback)(p=>{if(l&&a){p.preventDefault(),a();return}n?.(p)},[l,a,n]);return(0,Et.jsx)(br,{"aria-label":l?s.promptInput.stop:s.promptInput.submit,className:V("ww:bg-foreground ww:text-background ww:hover:bg-foreground ww:rounded-full",e),"data-submit-blocked":o?"true":void 0,disabled:u?!1:o,onClick:d,size:"icon-sm",type:u?"button":"submit",variant:"ghost",...i,children:r??c})},MM=({className:e,children:t,...a})=>{let{t:n,locale:r}=Ue(),o=vm();if(o.files.length>0)return(0,Et.jsxs)(br,{className:V("ww:group ww:relative",e),onClick:()=>o.clear(),size:"icon-sm",type:"button",variant:"ghost","aria-label":n.promptInput.removeAttachments,...a,children:[(0,Et.jsx)("span",{className:"ww:flex ww:size-5 ww:items-center ww:justify-center ww:rounded-full ww:bg-primary ww:text-[10px] ww:font-medium ww:text-primary-foreground ww:transition-opacity ww:group-hover:opacity-0",children:o.files.length}),(0,Et.jsx)(wn,{className:"ww:absolute ww:size-4 ww:opacity-0 ww:transition-opacity ww:group-hover:opacity-100"})]});let s=o.maxFileSize?(o.maxPdfPages?n.promptInput.uploadFilesUpToWithPages.replace("{pages}",String(o.maxPdfPages)):n.promptInput.uploadFilesUpTo).replace("{limit}",LM(o.maxFileSize,r)):n.promptInput.uploadFiles;return(0,Et.jsx)(br,{"aria-label":s,className:V(e),title:s,onClick:()=>o.openFileDialog(),size:"icon-sm",type:"button",variant:"ghost",...a,children:t??(0,Et.jsx)(xl,{className:"ww:size-4"})})},RM=({className:e,...t})=>{let a=vm();return a.files.length===0?null:(0,Et.jsx)("ul",{className:V("ww:flex ww:list-none ww:flex-wrap ww:gap-2 ww:p-0",e),...t,children:a.files.map(n=>(0,Et.jsx)(mV,{file:n},n.id))})};function mV({file:e}){let{t}=Ue(),a=vm(),n=e.status==="failed",r=e.status==="uploading";return(0,Et.jsxs)(gx,{filename:e.filename??t.attachments.fileFallback,mediaType:e.mediaType??"",previewUrl:e.mediaType?.startsWith("image/")?e.url:void 0,subtitle:n?e.error:r?t.promptInput.uploading:void 0,tone:n?"error":"default",children:[n?(0,Et.jsx)("button",{"aria-label":t.promptInput.retryUpload,className:"ww:ml-auto ww:shrink-0 ww:text-destructive ww:text-xs ww:underline ww:underline-offset-2",onClick:()=>a.retry(e.id),type:"button",children:t.promptInput.retry}):null,(0,Et.jsx)("button",{"aria-label":t.promptInput.removeAttachment,className:V("ww:shrink-0 ww:rounded-full ww:p-1 ww:opacity-60 ww:transition-opacity hover:ww:bg-muted hover:ww:opacity-100",n?null:"ww:ml-auto"),onClick:()=>a.remove(e.id),type:"button",children:(0,Et.jsx)(wn,{className:"ww:size-3.5"})}),r?(0,Et.jsx)("span",{"aria-hidden":!0,className:"ww:absolute ww:bottom-0 ww:left-0 ww:h-0.5 ww:bg-primary ww:transition-[width] ww:duration-200",style:{width:`${Math.round(e.progress*100)}%`}}):null]})}var DM=({enabled:e=!0})=>{let{t}=Ue(),[a,n]=(0,Be.useState)(!1);return(0,Be.useEffect)(()=>{if(!e)return;let r=0,o=u=>!!u.dataTransfer?.types?.includes("Files"),i=u=>{o(u)&&(r+=1,n(!0))},s=u=>{o(u)&&(r=Math.max(0,r-1),r===0&&n(!1))},l=()=>{r=0,n(!1)};return document.addEventListener("dragenter",i),document.addEventListener("dragleave",s),document.addEventListener("drop",l),()=>{document.removeEventListener("dragenter",i),document.removeEventListener("dragleave",s),document.removeEventListener("drop",l)}},[e]),e&&a?(0,Et.jsx)("div",{className:"ww:pointer-events-none ww:absolute ww:inset-0 ww:z-50 ww:flex ww:items-center ww:justify-center ww:rounded-2xl ww:border-2 ww:border-primary ww:border-dashed ww:bg-background/85",children:(0,Et.jsxs)("span",{className:"ww:flex ww:items-center ww:gap-2 ww:text-sm ww:font-medium",children:[(0,Et.jsx)(xl,{className:"ww:size-4"}),t.promptInput.dropToAttach]})}):null};var PM=j(me(),1);function _M({text:e}){let{t}=Ue();return e===!1?null:(0,PM.jsx)("span",{className:"ww:whitespace-nowrap ww:text-[10px] ww:sm:text-[11px] ww:text-muted-foreground ww:opacity-70",children:e||t.aiDisclaimer.default})}var xm=j(Ee(),1);var as=j(me(),1),OM=({className:e,...t})=>(0,as.jsx)("div",{className:V("ww:flex ww:flex-col ww:gap-1 ww:px-3 ww:py-2",e),...t}),NM=({className:e,...t})=>(0,as.jsx)("li",{className:V("ww:group ww:flex ww:items-center ww:gap-2 ww:rounded-md ww:px-2 ww:py-1 ww:text-sm ww:transition-colors ww:hover:bg-muted",e),...t}),UM=({className:e,...t})=>(0,as.jsx)("span",{className:V("ww:inline-block ww:size-2 ww:shrink-0 ww:rounded-full ww:border ww:border-muted-foreground/50",e),...t}),BM=({className:e,...t})=>(0,as.jsx)("span",{className:V("ww:line-clamp-1 ww:grow ww:break-words ww:text-muted-foreground",e),...t}),zM=({className:e,...t})=>(0,as.jsx)("div",{className:V("ww:flex ww:shrink-0 ww:gap-1 ww:opacity-0 ww:transition-opacity ww:group-hover:opacity-100",e),...t}),FM=({className:e,...t})=>(0,as.jsx)(br,{className:V("ww:size-auto ww:rounded ww:p-1 ww:text-muted-foreground ww:hover:bg-muted-foreground/10 ww:hover:text-foreground",e),size:"icon",type:"button",variant:"ghost",...t});var Un=j(me(),1),qM=(0,xm.memo)(({message:e,onRemove:t})=>{let{t:a}=Ue(),n=(0,xm.useCallback)(()=>t(e.id),[t,e.id]);return(0,Un.jsxs)(NM,{children:[(0,Un.jsx)(UM,{}),(0,Un.jsx)(BM,{children:e.text||a.chatQueue.attachmentFallback}),(0,Un.jsx)(zM,{children:(0,Un.jsx)(FM,{"aria-label":a.chatQueue.removeFromQueue,onClick:n,children:(0,Un.jsx)(wn,{className:"ww:size-3"})})})]})});qM.displayName="ChatQueueItem";function HM({queuedMessages:e,onRemove:t,className:a}){let{t:n}=Ue();return e.length===0?null:(0,Un.jsxs)(OM,{className:V("ww:border-t ww:border-border",a),children:[(0,Un.jsx)("div",{className:"ww:text-[11px] ww:font-medium ww:text-muted-foreground ww:px-2",children:n.chatQueue.queued(e.length)}),(0,Un.jsx)("ul",{children:e.map(r=>(0,Un.jsx)(qM,{message:r,onRemove:t},r.id))})]})}var nn=j(Ee(),1);var zt=j(Ee(),1);Ch();var xU=j(Ee(),1);var bU=j(me(),1),PK=({as:e="span",className:t,duration:a=2,style:n,children:r,...o})=>{let i={backgroundImage:"linear-gradient(90deg, var(--ww-color-muted-foreground) 0%, var(--ww-color-muted-foreground) 40%, var(--ww-color-foreground) 50%, var(--ww-color-muted-foreground) 60%, var(--ww-color-muted-foreground) 100%)",backgroundSize:"250% 100%",WebkitBackgroundClip:"text",backgroundClip:"text",color:"transparent",animation:`ww-shimmer ${a}s linear infinite`,...n};return(0,bU.jsx)(e,{"data-waniwani-shimmer":"",className:V("ww:inline-block",t),style:i,...o,children:r})},or=(0,xU.memo)(PK);or.displayName="Shimmer";var Da=j(me(),1),SU=(0,zt.createContext)(null);function IU(){let e=(0,zt.useContext)(SU);if(!e)throw new Error("Reasoning components must be used within <Reasoning>");return e}var OK=1e3,NK=1e3,Ud=(0,zt.memo)(({className:e,isStreaming:t=!1,open:a,defaultOpen:n,onOpenChange:r,duration:o,children:i,...s})=>{let l=n??t,u=n===!1,c=a!==void 0,[d,p]=(0,zt.useState)(l),m=c?a:d,h=(0,zt.useCallback)(R=>{c||p(R),r?.(R)},[c,r]),[v,I]=(0,zt.useState)(void 0),y=o??v,w=(0,zt.useRef)(t),[g,S]=(0,zt.useState)(!1),E=(0,zt.useRef)(null);(0,zt.useEffect)(()=>{t?(w.current=!0,E.current===null&&(E.current=Date.now())):E.current!==null&&(I(Math.ceil((Date.now()-E.current)/NK)),E.current=null)},[t]),(0,zt.useEffect)(()=>{t&&!m&&!u&&h(!0)},[t,m,u,h]),(0,zt.useEffect)(()=>{if(w.current&&!t&&m&&!g){let R=setTimeout(()=>{h(!1),S(!0)},OK);return()=>clearTimeout(R)}},[t,m,g,h]);let T=(0,zt.useMemo)(()=>({isStreaming:t,isOpen:m,setIsOpen:h,duration:y}),[t,m,h,y]);return(0,Da.jsx)(SU.Provider,{value:T,children:(0,Da.jsx)("div",{className:V("ww:mb-4 ww:flex ww:flex-col ww:gap-2",e),"data-state":m?"open":"closed",style:{animation:"ww-fade-in 0.2s ease-out"},...s,children:i})})});Ud.displayName="Reasoning";var Bd=(0,zt.memo)(({className:e,children:t,getThinkingMessage:a,hideIcon:n=!1,onClick:r,...o})=>{let{t:i}=Ue(),{isStreaming:s,isOpen:l,duration:u,setIsOpen:c}=IU(),p=a??((m,h)=>m||h===0?(0,Da.jsx)(or,{duration:1.6,children:i.reasoning.thinking}):h===void 0?(0,Da.jsx)("span",{children:i.reasoning.thoughtBrief}):(0,Da.jsx)("span",{children:i.reasoning.thoughtForSeconds(h)}));return(0,Da.jsx)("button",{type:"button","aria-expanded":l,onClick:m=>{c(!l),r?.(m)},className:V("ww:flex ww:w-full ww:items-center ww:gap-2 ww:text-sm ww:text-muted-foreground ww:transition-colors ww:hover:text-foreground",e),...o,children:t??(0,Da.jsxs)(Da.Fragment,{children:[!n&&(0,Da.jsx)(Gr,{className:"ww:size-4 ww:shrink-0"}),p(s,u)]})})});Bd.displayName="ReasoningTrigger";var zd=(0,zt.memo)(({className:e,children:t,...a})=>{let{isOpen:n}=IU();return(0,Da.jsx)("div",{className:V("ww:grid ww:transition-[grid-template-rows,opacity] ww:duration-200 ww:ease-out",n?"ww:grid-rows-[1fr] ww:opacity-100":"ww:grid-rows-[0fr] ww:opacity-0"),children:(0,Da.jsx)("div",{className:"ww:min-h-0 ww:overflow-hidden",children:(0,Da.jsx)("div",{className:V("ww:text-sm ww:text-muted-foreground",e),...a,children:(0,Da.jsx)(au,{children:t})})})})});zd.displayName="ReasoningContent";var Ye=j(me(),1),UK=500,CU=(0,nn.createContext)(null);function kU(){let e=(0,nn.useContext)(CU);if(!e)throw new Error("ChainOfThought components must be used within <ChainOfThought>");return e}function TU({className:e,isWorking:t=!1,activeStep:a,open:n,defaultOpen:r=!1,onOpenChange:o,children:i,...s}){let l=n!==void 0,[u,c]=(0,nn.useState)(r),d=l?n:u,p=(0,nn.useCallback)(I=>{l||c(I),o?.(I)},[l,o]),[m,h]=(0,nn.useState)(!t);(0,nn.useEffect)(()=>{if(t){h(!1);return}let I=setTimeout(()=>h(!0),UK);return()=>clearTimeout(I)},[t]);let v=(0,nn.useMemo)(()=>({open:d,setOpen:p,isWorking:t,settled:m,activeStep:a}),[d,p,t,m,a]);return(0,Ye.jsx)(CU.Provider,{value:v,children:(0,Ye.jsx)("div",{className:V("ww:mb-4 ww:flex ww:flex-col ww:gap-2",e),"data-state":d?"open":"closed",style:{animation:"ww-fade-in 0.2s ease-out"},...s,children:i})})}function LU({className:e,label:t,workingLabel:a,children:n,...r}){let{open:o,setOpen:i,isWorking:s,settled:l,activeStep:u}=kU();if(!l){let c=u?.icon,d=u?.label??a??t??"";return(0,Ye.jsx)("div",{className:V("ww:flex ww:min-h-5 ww:w-full ww:items-center ww:gap-1.5 ww:text-sm ww:text-muted-foreground",e),children:(0,Ye.jsxs)("span",{className:"ww:flex ww:min-w-0 ww:items-center ww:gap-1.5",style:{animation:"ww-fade-in 0.25s ease-out"},children:[c&&(0,Ye.jsx)(c,{className:V("ww:size-4 ww:shrink-0",s&&"ww:animate-pulse")}),(0,Ye.jsx)("span",{className:"ww:truncate",children:s?(0,Ye.jsx)(or,{duration:2.6,children:d}):d})]},d)})}return(0,Ye.jsxs)("button",{type:"button",onClick:()=>i(!o),"aria-expanded":o,className:V("ww:flex ww:min-h-5 ww:w-full ww:items-center ww:gap-1.5 ww:text-sm ww:text-muted-foreground ww:transition-colors ww:hover:text-foreground",e),style:{animation:"ww-fade-in 0.25s ease-out"},...r,children:[(0,Ye.jsx)("span",{className:"ww:truncate",children:n??t}),(0,Ye.jsx)(zo,{className:V("ww:size-4 ww:shrink-0 ww:transition-transform ww:duration-200",o&&"ww:rotate-180")})]})}function EU({className:e,children:t,...a}){let{open:n}=kU();return(0,Ye.jsx)("div",{className:V("ww:grid ww:transition-[grid-template-rows,opacity] ww:duration-200 ww:ease-out",n?"ww:grid-rows-[1fr] ww:opacity-100":"ww:grid-rows-[0fr] ww:opacity-0"),children:(0,Ye.jsx)("div",{className:"ww:min-h-0 ww:overflow-hidden",children:(0,Ye.jsx)("div",{className:V("ww:flex ww:flex-col",e),...a,children:t})})})}function AU({icon:e,isLast:t,running:a,error:n}){return(0,Ye.jsxs)("div",{className:"ww:flex ww:flex-col ww:items-center ww:self-stretch",children:[(0,Ye.jsx)("span",{className:"ww:flex ww:h-5 ww:items-center",children:(0,Ye.jsx)(e,{className:V("ww:size-4 ww:shrink-0",n?"ww:text-destructive":a?"ww:animate-pulse ww:text-foreground":"ww:text-muted-foreground")})}),!t&&(0,Ye.jsx)("span",{className:"ww:w-px ww:flex-1 ww:bg-border"})]})}function VS({className:e,icon:t,title:a,state:n,isLast:r=!1,children:o,...i}){let s=n==="input-available"||n==="input-streaming",l=n==="output-error",u=o!=null,[c,d]=(0,nn.useState)(!1),p=a??"",m=s?(0,Ye.jsx)(or,{duration:1.6,children:p}):(0,Ye.jsx)("span",{className:"ww:truncate",children:p});return(0,Ye.jsxs)("div",{className:V("ww:flex ww:gap-2",e),...i,children:[(0,Ye.jsx)(AU,{icon:t,isLast:r,running:s,error:l}),(0,Ye.jsxs)("div",{className:V("ww:min-w-0 ww:flex-1",!r&&"ww:pb-3"),children:[u?(0,Ye.jsxs)("button",{type:"button",onClick:()=>d(h=>!h),"aria-expanded":c,className:"ww:flex ww:w-full ww:items-center ww:gap-1.5 ww:text-left ww:text-sm ww:text-muted-foreground ww:transition-colors ww:hover:text-foreground",children:[m,(0,Ye.jsx)(zo,{className:V("ww:size-3.5 ww:shrink-0 ww:transition-transform ww:duration-200",c&&"ww:rotate-180")})]}):(0,Ye.jsx)("div",{className:"ww:flex ww:items-center ww:text-sm ww:text-muted-foreground",children:m}),u&&(0,Ye.jsx)("div",{className:V("ww:grid ww:transition-[grid-template-rows,opacity] ww:duration-200 ww:ease-out",c?"ww:grid-rows-[1fr] ww:opacity-100":"ww:grid-rows-[0fr] ww:opacity-0"),children:(0,Ye.jsx)("div",{className:"ww:min-h-0 ww:overflow-hidden",children:(0,Ye.jsx)("div",{className:"ww:mt-2 ww:space-y-3 ww:rounded-lg ww:border ww:border-border ww:bg-background ww:p-3",children:o})})})]})]})}function MU({isStreaming:e=!1,isLast:t=!1,children:a}){return(0,Ye.jsxs)("div",{className:"ww:flex ww:gap-2",children:[(0,Ye.jsx)(AU,{icon:Gr,isLast:t,running:e}),(0,Ye.jsx)("div",{className:V("ww:min-w-0 ww:flex-1",!t&&"ww:pb-3"),children:(0,Ye.jsxs)(Ud,{isStreaming:e,className:"ww:mb-0",children:[(0,Ye.jsx)(Bd,{hideIcon:!0}),(0,Ye.jsx)(zd,{children:a})]})})]})}var $S={name:"cjk-noop",type:"cjk",remarkPluginsBefore:[],remarkPluginsAfter:[],remarkPlugins:[]};var RU={name:"shiki-noop",type:"code-highlighter",supportsLanguage:()=>!1,getSupportedLanguages:()=>[],getThemes:()=>["github-light","github-dark"],highlight:()=>null};var PU=j(Ee(),1);var oo=j(Ee(),1),BK=5,DU=400;function _U(e,t,a={}){let{msPerChar:n=BK}=a,[r,o]=(0,oo.useState)(t?"":e),i=(0,oo.useRef)(e),s=(0,oo.useRef)(t?0:e.length),l=(0,oo.useRef)(0),u=(0,oo.useRef)(null);return(e.length<s.current||!e.startsWith(r.slice(0,s.current)))&&(s.current=t?0:e.length),i.current=e,(0,oo.useEffect)(()=>{if(!t){u.current!==null&&(cancelAnimationFrame(u.current),u.current=null),s.current=e.length,o(e);return}if(i.current.length-s.current>DU&&(s.current=i.current.length-DU),u.current!==null)return;let d=p=>{let m=i.current;if(s.current>=m.length){u.current=null;return}l.current===0&&(l.current=p);let h=p-l.current;if(h>=n){let v=Math.min(Math.floor(h/n),m.length-s.current);s.current+=v,o(m.slice(0,s.current)),l.current=p}u.current=requestAnimationFrame(d)};return u.current=requestAnimationFrame(d),()=>{u.current!==null&&(cancelAnimationFrame(u.current),u.current=null)}},[e,t,n]),r}var Fd=j(me(),1),WS=({className:e,from:t,children:a,...n})=>(0,Fd.jsx)("div",{className:V("ww-message ww:group ww:flex ww:w-full",t==="user"?"ww-message-user is-user ww:ml-auto ww:flex-col ww:items-end ww:[max-width:var(--ww-msg-max-width,80%)]":"ww-message-assistant is-assistant ww:flex-col",e),...n,children:(0,Fd.jsx)("div",{className:V("ww:flex ww:min-w-0 ww:flex-col ww:gap-2","ww:w-full"),children:a})}),GS=({children:e,className:t,...a})=>(0,Fd.jsx)("div",{className:V("ww-bubble ww:flex ww:w-fit ww:min-w-0 ww:max-w-full ww:flex-col ww:gap-2 ww:overflow-hidden","ww:[font-size:var(--ww-font-size,1rem)] ww:[line-height:var(--ww-line-height,1.5)]","ww:group-[.is-user]:ml-auto ww:group-[.is-user]:bg-user-bubble ww:group-[.is-user]:[color:var(--ww-color-user-bubble-text)] ww:group-[.is-user]:[border-radius:var(--ww-msg-radius,8px)] ww:group-[.is-user]:[padding:var(--ww-msg-pad-y,12px)_var(--ww-msg-pad-x,16px)]","ww:group-[.is-assistant]:text-foreground",t),...a,children:e}),zK={cjk:$S,code:RU},FK={cjk:$S},qK={enabled:!1};function HK({className:e,linkSafety:t,isStreaming:a,children:n,...r}){let i=_U(typeof n=="string"?n:"",!!a),s=typeof n=="string"?i:n;return(0,Fd.jsx)(au,{className:V("ww:size-full ww:[&>*:first-child]:mt-0 ww:[&>*:last-child]:mb-0",e),linkSafety:t??qK,plugins:a?FK:zK,...r,children:s})}var Ah=(0,PU.memo)(HK,(e,t)=>e.children===t.children&&e.isStreaming===t.isStreaming);Ah.displayName="MessageResponse";var ua=j(Ee(),1);function XS(e){if(!(typeof e!="object"||e===null))return e}function OU(e){return XS(e?.ui)}function KS(e){if(!e)return;let t=OU(e)?.resourceUri;if(typeof t=="string"&&t.length>0)return t;let a=e["ui/resourceUri"];if(typeof a=="string"&&a.length>0)return a;let n=e["openai/outputTemplate"];if(typeof n=="string"&&n.length>0)return n}function qd(e){return OU(e)?.autoHeight===!0}function YS(e){return XS(XS(e)?._meta)}var qe=j(me(),1);function jK(e,t=80){if(e==null)return String(e);if(typeof e!="object")return String(e).slice(0,t);if(Array.isArray(e))return`Array(${e.length})`;let a=JSON.stringify(e);if(a.length<=t)return a;let n=Object.entries(e),r=[],o=t-2;for(let[i,s]of n){if(o<=8)break;let l=i.length>4?`${i.slice(0,4)}\u2026`:i,u;typeof s=="string"?u=s.length>2?`'${s.slice(0,1)}\u2026`:`'${s}'`:Array.isArray(s)?u=`Array(${s.length})`:typeof s=="object"&&s!==null?u="{\u2026}":u=String(s);let c=`${l}\u2009${u}`;r.push(c),o-=c.length+3}return`{${r.join(", ")}}`}function VK({text:e,className:t}){let{t:a}=Ue(),[n,r]=(0,ua.useState)(!1),o=(0,ua.useRef)(null);(0,ua.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let i=(0,ua.useCallback)(async s=>{s.stopPropagation();try{await navigator.clipboard.writeText(e),r(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>r(!1),2e3)}catch{}},[e]);return(0,qe.jsx)(br,{variant:"ghost",size:"sm",onClick:i,className:V("ww:h-auto ww:gap-1 ww:px-1.5 ww:py-0.5 ww:text-xs ww:text-muted-foreground ww:hover:text-foreground",t),children:n?(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Lc,{className:"ww:size-3.5"}),(0,qe.jsx)("span",{children:a.tool.copied})]}):(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(Ac,{className:"ww:size-3.5"}),(0,qe.jsx)("span",{children:a.tool.copy})]})})}function NU({data:e,label:t,className:a,...n}){let[r,o]=(0,ua.useState)(!1),i=(0,ua.useMemo)(()=>JSON.stringify(e,null,2),[e]),s=jK(e);return(0,qe.jsxs)("div",{className:V("ww:rounded-lg ww:bg-tool-card",a),...n,children:[(0,qe.jsxs)("div",{className:"ww:flex ww:items-center ww:justify-between ww:px-3 ww:pt-2.5 ww:pb-1.5",children:[(0,qe.jsx)("span",{className:"ww:text-xs ww:font-medium ww:text-muted-foreground",children:t}),(0,qe.jsx)(VK,{text:i})]}),(0,qe.jsxs)("button",{type:"button",onClick:()=>o(l=>!l),className:"ww:flex ww:w-full ww:items-start ww:gap-2 ww:px-3 ww:pb-3 ww:text-left",children:[(0,qe.jsx)(Ec,{className:V("ww:mt-0.5 ww:size-3.5 ww:shrink-0 ww:text-muted-foreground ww:transition-transform ww:duration-150",r&&"ww:rotate-90")}),r?(0,qe.jsx)("pre",{className:"ww:overflow-x-auto ww:text-xs ww:font-mono ww:text-foreground ww:whitespace-pre-wrap ww:break-all",children:(0,qe.jsx)("code",{children:i})}):(0,qe.jsx)("span",{className:"ww:truncate ww:text-xs ww:font-mono ww:text-foreground/80",children:s})]})]})}var ZS=(0,ua.createContext)({open:!1,toggle:()=>{}});function UU({className:e,defaultOpen:t=!1,children:a,...n}){let[r,o]=(0,ua.useState)(t);return(0,qe.jsx)(ZS.Provider,{value:{open:r,toggle:()=>o(i=>!i)},children:(0,qe.jsx)("div",{className:V("ww:mb-4 ww:w-full",e),"data-state":r?"open":"closed",style:{animation:"ww-fade-in 0.2s ease-out"},...n,children:a})})}function BU({className:e,title:t,state:a,...n}){let{open:r,toggle:o}=(0,ua.useContext)(ZS),i=a==="input-available"||a==="input-streaming",s=t??"";return(0,qe.jsxs)("button",{type:"button",onClick:o,className:V("ww:flex ww:w-full ww:items-center ww:gap-2 ww:text-sm ww:text-muted-foreground ww:transition-colors ww:hover:text-foreground",e),"aria-expanded":r,...n,children:[(0,qe.jsx)(_i,{className:"ww:size-4 ww:shrink-0"}),(0,qe.jsx)("span",{className:"ww:truncate",children:i?(0,qe.jsx)(or,{duration:1.6,children:s}):s}),(0,qe.jsx)(zo,{className:V("ww:size-4 ww:shrink-0 ww:transition-transform ww:duration-200",r&&"ww:rotate-180")})]})}function zU({className:e,title:t,state:a,...n}){let r=a==="input-available"||a==="input-streaming",o=t??"";return(0,qe.jsx)("div",{className:V("ww:mb-4 ww:flex ww:items-center ww:gap-2 ww:text-sm ww:text-muted-foreground",e),style:{animation:"ww-fade-in 0.2s ease-out"},...n,children:(0,qe.jsx)("span",{className:"ww:truncate",children:r?(0,qe.jsx)(or,{duration:1.6,children:o}):o})})}function FU({className:e,children:t,...a}){let{open:n}=(0,ua.useContext)(ZS);return(0,qe.jsx)("div",{className:V("ww:grid ww:transition-[grid-template-rows,opacity] ww:duration-200 ww:ease-out",n?"ww:grid-rows-[1fr] ww:opacity-100":"ww:grid-rows-[0fr] ww:opacity-0"),children:(0,qe.jsx)("div",{className:"ww:min-h-0 ww:overflow-hidden",children:(0,qe.jsx)("div",{className:V("ww:mt-2 ww:space-y-3 ww:rounded-lg ww:border ww:border-border ww:bg-background ww:p-3",e),...a,children:t})})})}function $K(e,t){if(t||typeof e!="object"||e===null||Array.isArray(e))return e;let{_meta:a,telemetry:n,...r}=e;return r}function JS({className:e,input:t,debug:a,...n}){let{t:r}=Ue(),o=(0,ua.useMemo)(()=>$K(t,a),[t,a]);return(0,qe.jsx)(NU,{data:o,label:r.tool.request,className:e,...n})}function Hd(e,t,a){if(e){let n=KS(a?.[e]?._meta);if(n)return n}return KS(YS(t))}function qU(e,t,a){return e&&qd(a?.[e]?._meta)?!0:qd(YS(t))}function QS({className:e,output:t,errorText:a,debug:n,...r}){let{t:o}=Ue(),i=(0,ua.useMemo)(()=>{if(!n&&typeof t=="object"&&t!==null&&!Array.isArray(t)){let{_meta:s,...l}=t;return l}return t},[t,n]);return t||a?a?(0,qe.jsxs)("div",{className:V("ww:space-y-2",e),...r,children:[(0,qe.jsx)("h4",{className:"ww:text-xs ww:font-medium ww:uppercase ww:tracking-wide ww:text-muted-foreground",children:o.tool.error}),(0,qe.jsx)("div",{className:"ww:rounded-lg ww:bg-destructive/10 ww:p-3 ww:text-xs ww:text-destructive",children:a})]}):(0,qe.jsx)(NU,{data:i,label:o.tool.response,className:e,...r}):null}var jd=j(me(),1);function HU(e){return e.type==="text"||e.type==="reasoning"||e.type==="file"||"toolCallId"in e}function jU(e){return e.parts.some(HU)}function VU(e,t,a){if(t!=="submitted"&&t!=="streaming")return!1;let n=e[e.length-1];return!n||n.role!=="assistant"?!0:!n.parts.some(o=>!(!HU(o)||a?.ignoreToolParts&&"toolCallId"in o||a?.ignoreReasoningParts&&o.type==="reasoning"))}function $U({className:e,...t}){let{t:a}=Ue();return(0,jd.jsxs)("div",{"aria-live":"polite",className:V("ww:mb-4 ww:flex ww:w-full ww:items-center ww:gap-2 ww:text-sm ww:text-muted-foreground",e),style:{animation:"ww-fade-in 0.2s ease-out"},...t,children:[(0,jd.jsx)(Oc,{className:"ww:size-4 ww:shrink-0"}),(0,jd.jsx)(or,{duration:1.6,children:a.workingIndicator.default})]})}var ut=j(Ee(),1);function nu(e){if(!e)return!1;let t=Array.isArray(e.content)&&e.content.length>0,a=typeof e.structuredContent=="object"&&e.structuredContent!==null&&Object.keys(e.structuredContent).length>0;return t||a}function WU(e,t){return!nu(e)&&!nu(t)?null:nu(e)?nu(t)?{...e.content||t.content?{content:[...e.content??[],...t.content??[]]}:{},...e.structuredContent||t.structuredContent?{structuredContent:{...e.structuredContent??{},...t.structuredContent??{}}}:{}}:{...e.content?{content:[...e.content]}:{},...e.structuredContent?{structuredContent:{...e.structuredContent}}:{}}:{...t?.content?{content:[...t.content]}:{},...t?.structuredContent?{structuredContent:{...t.structuredContent}}:{}}}var io=j(Ee(),1);var GU=(0,io.createContext)(()=>{});function XU(){return(0,io.useContext)(GU)}var KU=GU.Provider;function WK(e){let t=window.requestIdleCallback;typeof t=="function"?t(e):setTimeout(e,500)}function ru(e){let t=(0,io.useRef)(e);t.current=e;let a=(0,io.useRef)(!1);(0,io.useEffect)(()=>{if(!e.painted||a.current)return;a.current=!0;let n=requestAnimationFrame(()=>{let r=t.current;Di(r.paintMark),WK(()=>L1(r))});return()=>cancelAnimationFrame(n)},[e.painted])}var YU=j(me(),1),GK="/api/mcp/resource",XK=500,KK=0,YK=16,ZK="2026-01-26",JK=300,QK=3e3,eY=3,tY=2e3;function aY(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function nY(e,t,a){return Hd(e,t,a)?!1:t._meta?.["waniwani/autoInjectResultText"]!==!1}function Mh({resourceUri:e,toolInput:t,toolResult:a,resourceEndpoint:n=GK,chatSessionId:r,isDark:o=!1,className:i,autoHeight:s=!1,onOpenLink:l,onFollowUp:u,onCallTool:c,onDisplayModeChange:d,isFullscreen:p=!1,toolDefinitions:m}){let h=(0,ut.useRef)(null),v=(0,ut.useRef)(t),I=(0,ut.useRef)(a),y=(0,ut.useRef)({width:0,height:0}),w=(0,ut.useRef)(null),g=(0,ut.useRef)(!1),S=(0,ut.useRef)(0),E=(0,ut.useRef)("inline"),[T,R]=(0,ut.useState)(KK),[O,U]=(0,ut.useState)(void 0),A=(0,ut.useRef)(l),Q=(0,ut.useRef)(u),$=(0,ut.useRef)(c),H=(0,ut.useRef)(d),Z=(0,ut.useRef)(r),X=(0,ut.useRef)(m);v.current=t,I.current=a,A.current=l,Q.current=u,$.current=c,H.current=d,Z.current=r,X.current=m;let B=(0,ut.useCallback)(x=>s?Math.max(x+YK,0):Math.min(Math.max(x,50),XK),[s]),P=(0,ut.useMemo)(()=>{let x=n.includes("?")?"&":"?";return`${n}${x}uri=${encodeURIComponent(e)}`},[n,e]),J=XU(),ge=(0,ut.useRef)(null),C=(0,ut.useRef)(void 0);(0,ut.useEffect)(()=>{let x=A1(e,J);return ge.current=x,()=>{clearTimeout(C.current),x.has("initialized")||x.report("timeout",S.current),ge.current=null}},[e,J]);let ze=(0,ut.useRef)(o);ze.current=o;let ot=(0,ut.useRef)(p);return(0,ut.useEffect)(()=>{ot.current=p,y.current.height=-1,w.current&&(w.current.cancel(),w.current=null)},[p]),(0,ut.useEffect)(()=>{if(!g.current)return;let x=h.current;x?.contentWindow&&x.contentWindow.postMessage({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:{theme:o?"dark":"light"}},"*")},[o]),(0,ut.useEffect)(()=>{let x=h.current;if(!x)return;let te=!1,re=!1,ke=null,We=null,be=setTimeout(()=>{if(te||re||S.current>=eY)return;S.current+=1;let ce=new URL(x.src);ce.searchParams.set("_retry",String(S.current)),x.src=ce.toString()},QK),Oe=ce=>{x.contentWindow?.postMessage(ce,"*")},we=ce=>{if(te||ce.source!==x.contentWindow)return;let Le=ce.data;if(!Le||typeof Le!="object"||Le.jsonrpc!=="2.0")return;let ie=Le.method,xe=Le.id;if(ie==="ui/initialize"&&xe!=null){re=!0,ge.current?.mark("initialize"),clearTimeout(be),Oe({jsonrpc:"2.0",id:xe,result:{protocolVersion:Le.params?.protocolVersion??ZK,hostInfo:{name:"Waniwani Chat",version:"1.0.0"},hostCapabilities:{openLinks:{},message:{text:{}},tools:{},updateModelContext:{text:{},structuredContent:{}}},hostContext:{theme:ze.current?"dark":"light",displayMode:E.current}}});return}if(ie==="ui/notifications/initialized"){g.current=!0,ge.current?.mark("initialized"),C.current=setTimeout(()=>ge.current?.report("ok",S.current),tY);let Ne=v.current,_e=I.current,Fe=_e._meta&&typeof _e._meta=="object"?_e._meta:null,Ae=aY(Z.current),de=Fe&&typeof Fe.waniwani=="object"&&Fe.waniwani!==null?Fe.waniwani:null,W=de||Ae?{...de??{},...Ae?{sessionId:Ae}:{}}:void 0,ct=Fe||W?{...Fe??{},...W?{waniwani:W}:{}}:void 0;Oe({jsonrpc:"2.0",method:"ui/notifications/tool-input",params:{arguments:Ne}});let le=_e.content??[{type:"text",text:JSON.stringify(_e)}];Oe({jsonrpc:"2.0",method:"ui/notifications/tool-result",params:{content:le,structuredContent:_e.structuredContent,_meta:ct,meta:ct}});return}if(ie==="ui/notifications/size-changed"){clearTimeout(C.current),ge.current?.mark("firstSize"),ge.current?.report("ok",S.current);let Ne=Le.params,_e=typeof Ne?.height=="number"?Ne.height:void 0,Fe=typeof Ne?.width=="number"?Ne.width:void 0,Ae=y.current,de=_e!==void 0&&_e!==Ae.height,W=Fe!==void 0&&Fe!==Ae.width;if(!de&&!W)return;if(de&&_e!==void 0){if(Ae.height=_e,ot.current)return;let ct=B(_e),le=x.getBoundingClientRect().height;if(w.current&&(w.current.cancel(),w.current=null),R(ct),x.animate&&Math.abs(le-ct)>2){let oe=x.animate([{height:`${le}px`},{height:`${ct}px`}],{duration:JK,easing:"ease-out",fill:"forwards"});w.current=oe,oe.onfinish=()=>{w.current===oe&&(oe.cancel(),w.current=null)}}}W&&s&&Fe!==void 0&&(Ae.width=Fe,U(Fe));return}if(ie==="ui/open-link"&&xe!=null){let Ne=Le.params?.url;typeof Ne=="string"&&(A.current?A.current(Ne):window.open(Ne,"_blank","noopener,noreferrer")),Oe({jsonrpc:"2.0",id:xe,result:{}});return}if(ie==="ui/message"&&xe!=null){if(Q.current&&Le.params){let Ne=Le.params,_e=ke;if(ke=null,We){clearTimeout(We.timer);let Fe=We.text;We=null;let Ae=(Ne.content??[]).map(de=>de.text??"").join("").trim();Ne={...Ne,content:[{type:"text",text:`${Ae}
143
143
 
144
- ${Fe}`}]}}Q.current({...Ne,..._e?{modelContext:_e}:{}})}Oe({jsonrpc:"2.0",id:xe,result:{}});return}if(ie==="ui/update-model-context"&&xe!=null){ke=WU(ke,Le.params),Oe({jsonrpc:"2.0",id:xe,result:{}});return}if(ie==="tools/call"&&xe!=null){let Ne=$.current;if(!Ne){Oe({jsonrpc:"2.0",id:xe,error:{code:-32601,message:"tools/call not supported"}});return}let _e=Le.params?.name;Ne({name:_e,arguments:Le.params?.arguments??{}}).then(Fe=>{Oe({jsonrpc:"2.0",id:xe,result:Fe});let Ae=Fe.content?.map(de=>de.text??"").join("").trim();Ae&&aY(_e,Fe,X.current)&&(We&&clearTimeout(We.timer),We={text:Ae,timer:setTimeout(()=>{if(te)return;let de=ke;ke=null,We=null,Q.current?.({role:"user",content:[{type:"text",text:Ae}],...de?{modelContext:de}:{}})},500)})}).catch(Fe=>{let Ae=Fe instanceof Error?Fe.message:"Tool call failed";Oe({jsonrpc:"2.0",id:xe,error:{code:-32e3,message:Ae}})});return}if(ie==="ui/request-display-mode"&&xe!=null){let Ne=Le.params?.mode,_e=Ne==="fullscreen"||Ne==="inline"||Ne==="pip"?Ne:"inline";E.current=_e,Oe({jsonrpc:"2.0",id:xe,result:{mode:_e}}),Oe({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:{displayMode:_e}}),H.current?.(_e);return}if(ie==="ui/resource-teardown"&&xe!=null){Oe({jsonrpc:"2.0",id:xe,result:{}});return}ie==="ping"&&xe!=null&&Oe({jsonrpc:"2.0",id:xe,result:{}})};return window.addEventListener("message",we),()=>{te=!0,clearTimeout(be),We&&clearTimeout(We.timer),window.removeEventListener("message",we)}},[s,B]),(0,YU.jsx)("iframe",{ref:h,src:P,onLoad:()=>ge.current?.mark("iframeLoad"),sandbox:"allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox",className:V(!p&&"ww:rounded-md ww:border ww:border-border",i),style:{height:p?"100%":T,minWidth:p||!O?void 0:`min(${O}px, 100%)`,width:"100%",border:"none",colorScheme:o?"dark":"auto"},title:"MCP App"})}var si=j(me(),1);function ZU({icon:e,title:t,description:a,suggestions:n,onSuggestionSelect:r}){return(0,si.jsxs)("div",{className:"ww:flex ww:flex-col ww:items-center ww:justify-center ww:py-12 ww:px-6 ww:text-center ww:min-h-full",children:[e&&(0,si.jsx)("div",{className:"ww:mb-4 ww:flex ww:items-center ww:justify-center ww:size-12 ww:rounded-xl ww:bg-foreground ww:text-background",children:e}),(0,si.jsx)("h2",{className:"ww:text-lg ww:font-semibold ww:text-foreground",children:t}),a&&(0,si.jsx)("p",{className:"ww:mt-1 ww:text-sm ww:text-muted-foreground ww:max-w-sm",children:a}),n&&n.length>0&&(0,si.jsx)("div",{className:"ww:mt-6 ww:w-full ww:max-w-md ww:flex ww:flex-col ww:gap-2",children:n.map((o,i)=>(0,si.jsx)("button",{type:"button",onClick:()=>r?.(o),className:V("ww:w-full ww:text-left ww:rounded-xl ww:border ww:border-border ww:bg-background ww:px-4 ww:py-3 ww:text-sm","ww:text-foreground ww:hover:bg-accent ww:hover:border-primary/30","ww:transition-all ww:duration-200 ww:ease-out ww:cursor-pointer","ww:animate-[ww-fade-in_0.2s_ease-out_both]"),style:{animationDelay:`${i*50}ms`},children:o},o))})]})}var JU=j(Ee(),1);var ou=j(me(),1);function nY({onRetry:e}){let{t}=Ue();return(0,ou.jsxs)("div",{className:"ww:flex ww:items-center ww:justify-between ww:rounded-md ww:border ww:border-border ww:bg-muted/50 ww:px-4 ww:py-3 ww:text-sm ww:text-muted-foreground",children:[(0,ou.jsx)("span",{children:t.widgetErrorBoundary.failedToLoad}),(0,ou.jsx)("button",{type:"button",onClick:e,className:"ww:text-xs ww:font-medium ww:text-primary ww:hover:underline",children:t.widgetErrorBoundary.retry})]})}var Rh=class extends JU.Component{constructor(){super(...arguments);K(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(a){console.warn("[Waniwani] Widget failed to render:",a.message)}render(){return this.state.hasError?(0,ou.jsx)(nY,{onRetry:()=>this.setState({hasError:!1})}):this.props.children}};var He=j(me(),1);function e0(e){return e?e.replace(/[-_]/g," ").replace(/^\w/,t=>t.toUpperCase()):"Tool"}function QU(e){return e&&/search|find|lookup|query|web|browse|google/i.test(e)?Rc:_i}function eB({messages:e,status:t,welcomeMessage:a,welcome:n,onSuggestionSelect:r,resourceEndpoint:o,chatSessionId:i,isDark:s,onFollowUp:l,onCallTool:u,onWidgetDisplayModeChange:c,fullscreenToolCallId:d,debug:p,showToolCalls:m=!0,toolDefinitions:h,messageClassNames:v}){let{t:I}=Ue(),y=e[e.length-1],w=e.length>0,g=d!=null,S=!g&&VU(e,t,{ignoreToolParts:m===!1,ignoreReasoningParts:m===!1});return(0,He.jsxs)(He.Fragment,{children:[!g&&(!w&&n?(0,He.jsx)(ZU,{...n,onSuggestionSelect:r}):a&&(0,He.jsx)(WS,{from:"assistant",children:(0,He.jsx)(GS,{children:(0,He.jsx)(Ah,{children:a})})})),e.map(E=>{let T=E.parts.filter(B=>B.type==="text"),R=E.parts.filter(B=>B.type==="reasoning"),O=E.parts.filter(B=>B.type==="file"),U=SM(E.metadata),A=E.parts.filter(B=>"toolCallId"in B),Q=E.parts.filter(B=>B.type==="reasoning"||"toolCallId"in B),$=E===y&&E.role==="assistant",H=T.length>0,Z=g?A.some(B=>B.toolCallId===d):!1,X=m!==!1&&!Z&&Q.length>=2;return g&&!Z?(0,He.jsx)("div",{style:{display:"none"}},E.id):E.role==="assistant"&&!jU(E)?(0,He.jsx)("div",{style:{display:"none"}},E.id):m===!1&&E.role==="assistant"&&!H&&O.length===0&&A.every(B=>{let P="output"in B?B.output:void 0;return P===void 0||!o||!Hd(B.toolName,P,h)})?(0,He.jsx)("div",{style:{display:"none"}},E.id):(0,He.jsxs)(WS,{from:E.role,className:v?.message,children:[m!==!1&&!Z&&!X&&R.map((B,P)=>(0,He.jsxs)(Ud,{isStreaming:B.state==="streaming",children:[(0,He.jsx)(Bd,{}),(0,He.jsx)(zd,{children:B.text})]},`reasoning-${E.id}-${P}`)),X&&(()=>{let B=Q[Q.length-1],P=B.type==="reasoning"?{icon:Gr,label:I.reasoning.thinking}:{icon:QU(B.toolName),label:B.title??e0(B.toolName)};return(0,He.jsxs)(TU,{isWorking:$&&(t==="streaming"||t==="submitted"),activeStep:P,children:[(0,He.jsx)(LU,{workingLabel:I.chainOfThought.working,label:I.chainOfThought.done}),(0,He.jsx)(EU,{children:Q.map((J,ge)=>{let C=ge===Q.length-1;if(J.type==="reasoning")return(0,He.jsx)(MU,{isStreaming:J.state==="streaming",isLast:C,children:J.text},`reasoning-${E.id}-${ge}`);let ze=J.title??e0(J.toolName),ot=QU(J.toolName);if(m==="titles-only")return(0,He.jsx)(VS,{icon:ot,title:ze,state:J.state,isLast:C},J.toolCallId);let x="output"in J?J.output:void 0;return(0,He.jsxs)(VS,{icon:ot,title:ze,state:J.state,isLast:C,children:[(0,He.jsx)(JS,{input:J.input,debug:p}),x!==void 0&&(0,He.jsx)(QS,{output:x,errorText:"errorText"in J?J.errorText:void 0,debug:p})]},J.toolCallId)})})]})})(),m!==!1&&!Z&&!X&&A.length===1&&(()=>{let B=A[0],P=B.title??e0(B.toolName);if(m==="titles-only")return(0,He.jsx)(zU,{title:P,state:B.state});let J="output"in B?B.output:void 0;return(0,He.jsxs)(UU,{children:[(0,He.jsx)(BU,{title:P,state:B.state}),(0,He.jsxs)(FU,{children:[(0,He.jsx)(JS,{input:B.input,debug:p}),J!==void 0&&(0,He.jsx)(QS,{output:J,errorText:"errorText"in B?B.errorText:void 0,debug:p})]})]})})(),A.map(B=>{let P="output"in B?B.output:void 0,J=Hd(B.toolName,P,h),ge=qU(B.toolName,P,h),C=B.toolCallId===d;return J&&o&&P!==void 0?(0,He.jsx)("div",{style:C?{position:"absolute",inset:0,zIndex:10,display:"flex",flexDirection:"column",overflow:"hidden",background:"var(--ww-color-background)"}:void 0,children:J&&o&&P!==void 0&&(0,He.jsx)(Rh,{children:(0,He.jsx)(Mh,{isFullscreen:C,resourceUri:J,toolInput:B.input??{},toolResult:{content:P.content,structuredContent:P.structuredContent,_meta:P._meta},resourceEndpoint:o,chatSessionId:i,isDark:s,autoHeight:ge,toolDefinitions:h,onFollowUp:l,onCallTool:u,onDisplayModeChange:c?ze=>c(ze,{toolCallId:B.toolCallId,resourceUri:J,toolInput:B.input??{},toolResult:{content:P.content,structuredContent:P.structuredContent,_meta:P._meta},autoHeight:ge}):void 0})})},B.toolCallId):null}),!Z&&U.length>0&&(0,He.jsx)(IM,{documents:U}),!Z&&(0,He.jsx)("div",{children:(0,He.jsxs)(GS,{className:V(E.role==="user"?v?.userBubble:v?.assistantBubble),children:[O.length>0&&(0,He.jsx)(xM,{files:O}),H?T.map((B,P)=>{let J=$&&t==="streaming"&&P===T.length-1;return(0,He.jsx)(Ah,{isStreaming:J,children:B.type==="text"?B.text:""},`${E.id}-${P}`)}):null]})})]},E.id)}),S&&(0,He.jsx)($U,{})]})}var li=j(me(),1);function rY({label:e}){return(0,li.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[(0,li.jsx)("title",{children:e}),(0,li.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,li.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function Dh({onClick:e}){let{t}=Ue();return(0,li.jsx)("button",{type:"button",onClick:e,title:t.threadMenu.newChat,"aria-label":t.threadMenu.newChat,className:"ww:p-1.5 ww:rounded-md ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/5 ww:transition-colors ww:cursor-pointer",children:(0,li.jsx)(rY,{label:t.threadMenu.newChat})})}var Vd=j(me(),1),oY="https://app.waniwani.ai/assets/waniwani-logo.svg",iY="https://waniwani.ai";function tB(){let{t:e}=Ue();return(0,Vd.jsxs)("a",{href:iY,target:"_blank",rel:"noopener noreferrer",className:"ww:flex ww:items-center ww:gap-1.5 ww:whitespace-nowrap ww:text-[10px] ww:sm:text-[11px] ww:text-muted-foreground ww:opacity-70 hover:ww:opacity-100 ww:transition-opacity",children:[(0,Vd.jsx)("span",{children:e.poweredBy.label}),(0,Vd.jsx)("img",{src:oY,alt:"Waniwani",width:72,height:10,"data-waniwani-logo":"",className:"ww:h-2.5 ww:w-auto"})]})}var iu=j(Ee(),1);var bt=j(me(),1),aB=20;function sY({label:e}){return(0,bt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[(0,bt.jsx)("title",{children:e}),(0,bt.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,bt.jsx)("polyline",{points:"3 4 3 9 8 9"}),(0,bt.jsx)("line",{x1:"12",y1:"7",x2:"12",y2:"12"}),(0,bt.jsx)("line",{x1:"12",y1:"12",x2:"15",y2:"14"})]})}function lY({label:e}){return(0,bt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[(0,bt.jsx)("title",{children:e}),(0,bt.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,bt.jsx)("path",{d:"M19 6l-2 14a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L5 6"}),(0,bt.jsx)("path",{d:"M10 11v6"}),(0,bt.jsx)("path",{d:"M14 11v6"})]})}function nB({threads:e,activeThreadId:t,onNewThread:a,onSelectThread:n,onDeleteThread:r}){let{locale:o,t:i}=Ue(),[s,l]=(0,iu.useState)(!1),u=(0,iu.useRef)(null);(0,iu.useEffect)(()=>{if(!s)return;let p=m=>{let h=u.current;h&&(m.composedPath().includes(h)||l(!1))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=e.slice(0,aB),d=Math.max(0,e.length-aB);return(0,bt.jsxs)("div",{ref:u,className:"ww:relative ww:flex ww:items-center ww:gap-1",children:[(0,bt.jsx)(Dh,{onClick:a}),(0,bt.jsx)("button",{type:"button",onClick:()=>l(p=>!p),title:i.threadMenu.threadHistory,"aria-label":i.threadMenu.threadHistory,"aria-expanded":s,className:"ww:p-1.5 ww:rounded-md ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/5 ww:transition-colors ww:cursor-pointer",children:(0,bt.jsx)(sY,{label:i.threadMenu.threadHistory})}),s&&(0,bt.jsxs)("div",{role:"menu",className:"ww:absolute ww:right-0 ww:top-full ww:mt-1 ww:w-72 ww:max-h-80 ww:overflow-y-auto ww:rounded-lg ww:border ww:border-border ww:bg-background ww:shadow-lg ww:z-50",children:[c.length===0&&(0,bt.jsx)("div",{className:"ww:px-3 ww:py-3 ww:text-xs ww:text-muted-foreground",children:i.threadMenu.noPreviousChats}),c.map(p=>{let m=p.threadId===t,h=Date.parse(p.updatedAt);return(0,bt.jsxs)("div",{className:`ww:flex ww:items-center ww:gap-2 ww:px-3 ww:py-2 ww:text-xs hover:ww:bg-foreground/5 ${m?"ww:bg-foreground/5":""}`,children:[(0,bt.jsxs)("button",{type:"button",onClick:()=>{n(p.threadId),l(!1)},className:"ww:flex-1 ww:min-w-0 ww:text-left ww:cursor-pointer",children:[(0,bt.jsx)("div",{className:"ww:truncate ww:text-foreground ww:font-medium",children:p.title}),(0,bt.jsx)("div",{className:"ww:text-[10px] ww:text-muted-foreground",children:Number.isNaN(h)?"":hx(h,o)})]}),(0,bt.jsx)("button",{type:"button",onClick:v=>{v.stopPropagation(),r(p.threadId)},title:i.threadMenu.deleteThread,"aria-label":i.threadMenu.deleteThread,className:"ww:p-1 ww:rounded ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/10 ww:transition-colors ww:cursor-pointer",children:(0,bt.jsx)(lY,{label:i.threadMenu.deleteThread})})]},p.threadId)}),d>0&&(0,bt.jsx)("div",{className:"ww:px-3 ww:py-2 ww:text-[10px] ww:text-muted-foreground ww:border-t ww:border-border",children:i.threadMenu.hiddenThreads(d)})]})]})}var _h=j(Ee(),1);function su(e){let t=new Set;return{subscribe(a){return t.add(a),()=>{t.delete(a)}},emit(a){let{sessionId:n,...r}=a,o=a.name==="session.started"?a.properties.sessionId:void 0,i={...r,mode:e.mode,sessionId:Object.hasOwn(a,"sessionId")?n:o??e.getSessionId?.(),timestamp:Date.now()};for(let s of[...t])try{s(i)}catch(l){console.warn("[Waniwani] onEvent subscriber threw:",l)}}}}function rB(){return{subscribe(){return()=>{}},emit(){}}}var oB=(0,_h.createContext)(rB());function Ph(){return(0,_h.useContext)(oB)}var lu=oB.Provider;var Oh=j(Ee(),1);function iB(e){let t=(0,Oh.useRef)(e);return t.current=e,(0,Oh.useCallback)(async a=>{let{api:n,headers:r,onCallTool:o,sessionId:i}=t.current;if(o)return o(a);let s=Na(n??"/api/waniwani","/tool"),l=typeof i=="string"&&i.trim().length>0?i.trim():void 0,u=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",...l?{"X-Session-Id":l}:{},...r},body:JSON.stringify(a)});if(!u.ok)throw new Error(`Tool call failed: ${u.status} ${u.statusText}`);return u.json()},[])}var qn=j(Ee(),1);var dB=j(lB(),1);var Xd=j(Ee(),1);var Bh=j(Ee(),1);var cB=(e,t,a)=>{if(!t.has(e))throw TypeError("Cannot "+a)},At=(e,t,a)=>(cB(e,t,"read from private field"),a?a.call(e):t.get(e)),kr=(e,t,a)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,a)},ui=(e,t,a,n)=>(cB(e,t,"write to private field"),n?n.call(e,a):t.set(e,a),a);function cY(e,t){return t!=null?(0,dB.default)(e,t):e}var Fn,Nh,Uh,$d,Wd,Gd,uu,t0,a0,dY=class{constructor(e=[]){kr(this,Fn,void 0),kr(this,Nh,"ready"),kr(this,Uh,void 0),kr(this,$d,new Set),kr(this,Wd,new Set),kr(this,Gd,new Set),this.pushMessage=t=>{ui(this,Fn,At(this,Fn).concat(t)),At(this,uu).call(this)},this.popMessage=()=>{ui(this,Fn,At(this,Fn).slice(0,-1)),At(this,uu).call(this)},this.replaceMessage=(t,a)=>{ui(this,Fn,[...At(this,Fn).slice(0,t),this.snapshot(a),...At(this,Fn).slice(t+1)]),At(this,uu).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,a)=>{let n=a?cY(t,a):t;return At(this,$d).add(n),()=>{At(this,$d).delete(n)}},this["~registerStatusCallback"]=t=>(At(this,Wd).add(t),()=>{At(this,Wd).delete(t)}),this["~registerErrorCallback"]=t=>(At(this,Gd).add(t),()=>{At(this,Gd).delete(t)}),kr(this,uu,()=>{At(this,$d).forEach(t=>t())}),kr(this,t0,()=>{At(this,Wd).forEach(t=>t())}),kr(this,a0,()=>{At(this,Gd).forEach(t=>t())}),ui(this,Fn,e)}get status(){return At(this,Nh)}set status(e){ui(this,Nh,e),At(this,t0).call(this)}get error(){return At(this,Uh)}set error(e){ui(this,Uh,e),At(this,a0).call(this)}get messages(){return At(this,Fn)}set messages(e){ui(this,Fn,[...e]),At(this,uu).call(this)}};Fn=new WeakMap;Nh=new WeakMap;Uh=new WeakMap;$d=new WeakMap;Wd=new WeakMap;Gd=new WeakMap;uu=new WeakMap;t0=new WeakMap;a0=new WeakMap;var cu,uB=class extends CE{constructor({messages:e,...t}){let a=new dY(e);super({...t,state:a}),kr(this,cu,void 0),this["~registerMessagesCallback"]=(n,r)=>At(this,cu)["~registerMessagesCallback"](n,r),this["~registerStatusCallback"]=n=>At(this,cu)["~registerStatusCallback"](n),this["~registerErrorCallback"]=n=>At(this,cu)["~registerErrorCallback"](n),ui(this,cu,a)}};cu=new WeakMap;function fB({experimental_throttle:e,resume:t=!1,...a}={}){let n=(0,qn.useRef)("chat"in a?{}:{onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});"chat"in a||(n.current={onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});let r={...a,onToolCall:p=>{var m,h;return(h=(m=n.current).onToolCall)==null?void 0:h.call(m,p)},onData:p=>{var m,h;return(h=(m=n.current).onData)==null?void 0:h.call(m,p)},onFinish:p=>{var m,h;return(h=(m=n.current).onFinish)==null?void 0:h.call(m,p)},onError:p=>{var m,h;return(h=(m=n.current).onError)==null?void 0:h.call(m,p)},sendAutomaticallyWhen:p=>{var m,h,v;return(v=(h=(m=n.current).sendAutomaticallyWhen)==null?void 0:h.call(m,p))!=null?v:!1}},o=(0,qn.useRef)("chat"in a?a.chat:new uB(r));("chat"in a&&a.chat!==o.current||"id"in a&&o.current.id!==a.id)&&(o.current="chat"in a?a.chat:new uB(r));let s=(0,qn.useCallback)(p=>o.current["~registerMessagesCallback"](p,e),[e,o.current.id]),l=(0,qn.useSyncExternalStore)(s,()=>o.current.messages,()=>o.current.messages),u=(0,qn.useSyncExternalStore)(o.current["~registerStatusCallback"],()=>o.current.status,()=>o.current.status),c=(0,qn.useSyncExternalStore)(o.current["~registerErrorCallback"],()=>o.current.error,()=>o.current.error),d=(0,qn.useCallback)(p=>{typeof p=="function"&&(p=p(o.current.messages)),o.current.messages=p},[o]);return(0,qn.useEffect)(()=>{t&&o.current.resumeStream()},[t,o]),{id:o.current.id,messages:l,setMessages:d,sendMessage:o.current.sendMessage,regenerate:o.current.regenerate,clearError:o.current.clearError,stop:o.current.stop,error:c,resumeStream:o.current.resumeStream,status:u,addToolResult:o.current.addToolOutput,addToolOutput:o.current.addToolOutput,addToolApprovalResponse:o.current.addToolApprovalResponse}}var ee=j(Ee(),1);var fY="/api/mcp/modules/documents",pY=2e4,mY=3e5,Hn=class extends Error{constructor(a,n){super(n);K(this,"code");this.name="DocumentUploadError",this.code=a}};function pB(e,t){return Fp(e,`${fY}${t}`)}function hY(e){return pB(e,"/upload-url")}function mB(e,t){let a=new Headers(e);return new Headers(t).forEach((n,r)=>{a.set(r,n)}),a}function gY(e){let t=e?.data;if(typeof t?.documentId!="string"||typeof t.uploadUrl!="string"||!(t.documentId&&t.uploadUrl))return null;let a={};for(let[n,r]of Object.entries(t.headers??{}))typeof r=="string"&&(a[n]=r);return{documentId:t.documentId,uploadUrl:t.uploadUrl,headers:a}}function yY(e){return e===403?new Hn("upload_disabled","This agent does not accept document uploads."):e===413?new Hn("max_file_size","That file is too large."):e===422||e===400?new Hn("accept","That file type is not accepted."):new Hn("upload_failed",`The upload could not be started (${e}).`)}function wY(e){return new Promise((t,a)=>{let n=new XMLHttpRequest;n.open("PUT",e.url,!0);for(let[i,s]of Object.entries(e.headers))n.setRequestHeader(i,s);n.timeout=mY;let r=()=>n.abort();e.signal.addEventListener("abort",r,{once:!0});let o=()=>e.signal.removeEventListener("abort",r);n.upload.onprogress=i=>{i.lengthComputable&&i.total>0&&e.onProgress?.(i.loaded/i.total)},n.onload=()=>{if(o(),n.status>=200&&n.status<300||n.status===412){e.onProgress?.(1),t();return}a(new Hn("upload_failed",`The upload was rejected (${n.status}).`))},n.onerror=()=>{o(),a(new Hn("upload_failed","The upload could not be completed."))},n.ontimeout=()=>{o(),a(new Hn("upload_failed","The upload timed out."))},n.onabort=()=>{o(),a(e.signal.reason instanceof Error?e.signal.reason:new Error("aborted"))},n.send(e.file)})}async function zh(e){let t=pB(e.api,`/${e.documentId}`);if(t)try{await fetch(t,{method:"DELETE",headers:mB(e.headers,e.uploadHeaders)})}catch{}}async function hB(e){e.signal.throwIfAborted();let t=hY(e.api);if(!t)throw new Hn("upload_disabled","This agent does not accept document uploads.");let a=new AbortController,n=setTimeout(()=>a.abort(),pY),r=()=>a.abort(e.signal.reason);e.signal.addEventListener("abort",r,{once:!0});let o;try{let s=mB(e.headers,e.uploadHeaders);s.set("Content-Type","application/json"),o=await fetch(t,{method:"POST",headers:s,signal:a.signal,body:JSON.stringify({filename:e.file.name,contentType:e.file.type,byteSize:e.file.size,...e.sessionId?{sessionId:e.sessionId}:{}})})}catch(s){throw e.signal.aborted?s:new Hn("upload_failed","The upload could not be started.")}finally{clearTimeout(n),e.signal.removeEventListener("abort",r)}if(!o.ok)throw yY(o.status);let i=gY(await o.json().catch(()=>null));if(e.signal.throwIfAborted(),!i)throw new Hn("upload_failed","The upload could not be started.");return await wY({url:i.uploadUrl,headers:i.headers,file:e.file,signal:e.signal,onProgress:e.onProgress}),{documentId:i.documentId,filename:e.file.name,mediaType:e.file.type}}function vY(e){let t=e?.cause,a=t?.issues??t?.errors;if(!Array.isArray(a))return null;let n=a.find(r=>r.code==="invalid_union");if(!n?.errors)return null;for(let r of n.errors){if(!Array.isArray(r)||r.some(s=>(s.code==="invalid_value"||s.code==="invalid_literal")&&s.path?.[0]==="type"))continue;let i=r.filter(s=>s.code==="unrecognized_keys").flatMap(s=>s.keys??[]);if(i.length>0)return i}return null}var Fh=class extends bv{processResponseStream(t){let a="",n=xv(),r=n.validate?.bind(n);return t.pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({async transform(o,i){a+=o;let s=a.split(`
145
- `);a=s.pop()??"";for(let l of s){let u=l.trim();if(!u.startsWith("data:"))continue;let c=u.slice(5).trim();if(c!=="[DONE]")try{let d=JSON.parse(c);if(!r){i.enqueue(d);continue}let p=await r(d);if(p.success){i.enqueue(p.value);continue}let m=vY(p.error);if(m?.length){let h={...d};for(let I of m)delete h[I];let v=await r(h);v.success&&i.enqueue(v.value)}}catch{}}}}))}};var gB=50,yB=1e3;function qh(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.threadId=="string"&&typeof t.memoryUserId=="string"&&typeof t.title=="string"&&Array.isArray(t.messages)&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string"}async function Hh(e){if(typeof indexedDB>"u")return null;let t=null;try{return t=await Xw(),await e(t)}catch{return null}finally{try{t?.close()}catch{}}}function n0(e){return new Promise((t,a)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>a(e.error)})}async function r0(e){return await Hh(async a=>{let o=a.transaction(yn,"readonly").objectStore(yn).index(qp),s=(await n0(o.getAll(e))??[]).filter(qh);return s.sort((l,u)=>l.updatedAt<u.updatedAt?1:-1),s})??[]}async function jh(e){return await Hh(async a=>{let r=a.transaction(yn,"readonly").objectStore(yn),o=await n0(r.get(e));return qh(o)?o:null})??null}async function o0(e){if(!qh(e))return;let t=e.messages.length>yB?{...e,messages:e.messages.slice(e.messages.length-yB)}:e;await Hh(async a=>{await new Promise((l,u)=>{let c=a.transaction(yn,"readwrite");c.oncomplete=()=>l(),c.onerror=()=>u(c.error),c.onabort=()=>u(c.error),c.objectStore(yn).put(t)});let n=a.transaction(yn,"readwrite"),r=n.objectStore(yn),o=r.index(qp),s=(await n0(o.getAll(t.memoryUserId))??[]).filter(qh);if(s.length>gB){s.sort((u,c)=>u.updatedAt<c.updatedAt?-1:1);let l=s.slice(0,s.length-gB);for(let u of l)r.delete(u.threadId)}return await new Promise((l,u)=>{n.oncomplete=()=>l(),n.onerror=()=>u(n.error),n.onabort=()=>u(n.error)}),null})}async function wB(e){await Hh(async t=>(await new Promise((a,n)=>{let r=t.transaction(yn,"readwrite");r.oncomplete=()=>a(),r.onerror=()=>n(r.error),r.onabort=()=>n(r.error),r.objectStore(yn).delete(e)}),null))}async function i0(e){return(await r0(e))[0]?.threadId??null}function vB(e){let t=e.trim();if(!t)return`Conversation on ${new Date().toISOString().slice(0,10)}`;let a=t.split(/\r?\n/,1)[0]??t;return a.length<=60?a:`${a.slice(0,60).trimEnd()}\u2026`}var xY="x-session-id",bY=250,SY=200;function xB(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():ud()}function Vh(){return new Date().toISOString()}function bB(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}async function IY(e,t){let a=Na(e,"/tools"),n=await fetch(a,{method:"GET",headers:t?{...t}:void 0});if(!n.ok)throw new Error(`[Waniwani] Failed to fetch /tools: ${n.status} ${n.statusText}`);let r=await n.json();if(!r||!Array.isArray(r.tools))return{};let o={};for(let i of r.tools)i&&typeof i.name=="string"&&(o[i.name]=i);return o}function SB(e){let{api:t="/api/waniwani",headers:a,uploadHeaders:n,body:r,onMessageSent:o,onResponseReceived:i,enableThreadHistory:s=!1,activeThreadId:l,onThreadChange:u}=e,c=e.visitorId;(0,ee.useEffect)(()=>Sc(c),[c]);let d=Ph(),p=(0,ee.useRef)(a),m=(0,ee.useRef)(n),h=(0,ee.useRef)(r),v=(0,ee.useRef)(s);(0,ee.useEffect)(()=>{v.current=s},[s]);let I=(0,ee.useRef)(void 0),y=(0,ee.useRef)(void 0),w=(0,ee.useRef)(null),[g,S]=(0,ee.useState)(void 0),E=(0,ee.useRef)(g),[T,R]=(0,ee.useState)(l),O=(0,ee.useRef)(T),[U,A]=(0,ee.useState)([]),[Q,$]=(0,ee.useState)(!s),H=(0,ee.useRef)(void 0),Z=(0,ee.useRef)(void 0),X=(0,ee.useRef)(void 0),B=(0,ee.useRef)(void 0),P=(0,ee.useRef)(0),J=(0,ee.useRef)(u);(0,ee.useEffect)(()=>{J.current=u},[u]);let ge=(0,ee.useCallback)(_=>{O.current=_,R(_),_&&(J.current?.(_),d.emit({name:"thread.changed",sessionId:E.current,properties:{threadId:_}}))},[d]),C=(0,ee.useCallback)(async()=>{if(!s)return;let _=w.current?.memoryUserId;if(!_)return;let he=await r0(_);A(he)},[s]),ze=(0,ee.useCallback)(()=>E.current,[]),ot=(0,ee.useCallback)(_=>{let he=bB(_);if(!he||E.current===he)return;let Se=E.current===void 0;E.current=he,S(he),Se&&d.emit({name:"session.started",properties:{sessionId:he}})},[d]),x=(0,ee.useCallback)(()=>{E.current=void 0,S(void 0)},[]);(0,ee.useEffect)(()=>{p.current=a,m.current=n},[a,n]),(0,ee.useEffect)(()=>{h.current=r},[r]),(0,ee.useEffect)(()=>{let _=!1,he=P.current;return(async()=>{try{let et=await Ic();if(_)return;w.current=et}catch{}if(!s)return;let Se=w.current?.memoryUserId;if(!Se){$(!0);return}try{let et=l??await i0(Se);if(_||he!==P.current)return;if(et){let Ot=await jh(et);if(_||he!==P.current)return;Ot&&Ot.memoryUserId===Se&&(O.current=Ot.threadId,R(Ot.threadId),H.current=Ot.createdAt,Z.current=Ot.title,Ot.sessionId&&(E.current=Ot.sessionId,S(Ot.sessionId)),ct(Ot.messages))}await C()}finally{_||$(!0)}})(),()=>{_=!0}},[]);let te=(0,ee.useRef)(null),re=(0,ee.useCallback)(_=>{let he=h.current?.[_];return typeof he=="string"?he:void 0},[]),ke=(0,ee.useCallback)(()=>({api:t,token:jp(p.current),channelId:re("channelId"),sessionId:E.current}),[t,re]),We=(0,ee.useCallback)(_=>{let he=te.current;te.current=null,he?.report(ke(),{mode:re("mode"),outcome:_})},[ke,re]),be=(0,ee.useCallback)(_=>{let he=typeof _=="object"&&_!==null&&!Array.isArray(_)?_:void 0,Se=w.current?.memoryUserId,et=w.current?.language,Ot={};return Se&&(Ot.memoryUserId=Se),et&&(Ot.locale=et),Object.keys(Ot).length>0||he?{...Ot,...he??{}}:void 0},[]),Oe=(0,ee.useCallback)(()=>{let _=O.current;return _||(_=xB(),H.current=Vh(),Z.current=void 0,ge(_)),_},[ge]),we=(0,ee.useRef)(new Fh({api:t,headers:()=>({...p.current}),body:()=>{let _={...h.current??{}},he=Object.hasOwn(_,"sessionId"),Se=bB(_.sessionId);if(Se)ot(Se),_.sessionId=Se;else if(he)x(),delete _.sessionId;else{let Qh=ze();Qh&&(_.sessionId=Qh)}nu(I.current)&&(_.modelContext=I.current),y.current?.length&&(_.documents=y.current);let et=w.current,Ot=ma();et&&(_.visitorContext={timezone:et.timezone,language:et.language,languages:et.languages,deviceType:et.deviceType,referrer:et.referrer,visitorId:Ot});let Kt=typeof _.visitor=="object"&&_.visitor!==null?_.visitor:{},g3=typeof Kt.client=="object"&&Kt.client!==null?Kt.client:{};_.visitor={...Kt,id:Ot,client:{...g3,...et&&{memoryUserId:et.memoryUserId}}};let w0=be(_.extra);return w0&&(_.extra=w0),v.current&&(Object.hasOwn(_,"threadId")?typeof _.threadId=="string"&&(O.current=_.threadId):_.threadId=Oe()),_},fetch:(async(_,he)=>{let Se=te.current;Se?.mark("requestStart");try{let et=await fetch(_,he);return I.current=void 0,ot(et.headers.get(xY)),Se?Se.instrument(et):et}finally{y.current=void 0}})})),ce=(0,ee.useRef)(e.transport?.({fallback:we.current,headers:()=>p.current,body:()=>{let _=be(h.current?.extra);return{channelId:re("channelId"),visitor:{id:ma()},..._?{extra:_}:{}}},threadHistory:()=>v.current,threadId:()=>v.current?Oe():void 0,hasMessages:()=>Ie.current.length>0,takeTurnInput:()=>{let _=y.current;return y.current=void 0,I.current=void 0,_?.length?{documents:_}:{}},onSession:ot})??we.current),Le=(0,ee.useRef)(null),ie=(0,ee.useRef)(null),xe=(0,ee.useRef)({}),[Ne,_e]=(0,ee.useState)(0),Fe=e.skipRemoteConfig===!0,Ae=(0,ee.useCallback)(async()=>{if(!Fe)try{let _=await IY(t,p.current);xe.current=_,_e(he=>he+1)}catch(_){console.warn("[Waniwani] Failed to fetch tool definitions:",_ instanceof Error?_.message:_)}},[t,Fe]);(0,ee.useEffect)(()=>{Ae()},[Ae]);let{messages:de,sendMessage:W,setMessages:ct,status:le,stop:oe}=fB({messages:e.initialMessages,transport:ce.current,onFinish({message:_,isAbort:he,isDisconnect:Se,isError:et}){te.current?.mark("streamEnd"),We(he||Se||et?"error":"ok"),i?.(),!he&&!Se&&!et&&d.emit({name:"message.received"}),Le.current&&(ie.current=_)},onError(_){We("error"),console.warn("[Waniwani] Chat error:",_.message),d.emit({name:"chat.error",properties:{message:_.message.slice(0,SY)}}),Le.current&&(Le.current.reject(_),Le.current=null)}}),Ie=(0,ee.useRef)(de);(0,ee.useEffect)(()=>{Ie.current=de},[de]);let ae=ce.current.keepsSession?.()??!1,k=(0,ee.useRef)(!1);(0,ee.useEffect)(()=>{!ae||k.current||Ie.current.length>0||(k.current=!0,ce.current.restore?.().then(_=>{_.length>0&&Ie.current.length===0&&ct(_)}).catch(()=>{}))},[ae]),(0,ee.useEffect)(()=>{let _=ce.current;return()=>_.dispose?.()},[]);let D=(0,ee.useCallback)(()=>{te.current=E1(Ie.current.filter(_=>_.role==="user").length+1)},[]),[F,fe]=(0,ee.useState)(!1),Ve=(0,ee.useCallback)(async()=>{fe(!0);try{await oe();let _=E.current;if(!_)return;await fetch(Na(t,"/cancel"),{method:"POST",headers:{"Content-Type":"application/json",...p.current},body:JSON.stringify({sessionId:_})})}catch{}finally{fe(!1)}},[t,oe]),Ft=(0,ee.useRef)(s);(0,ee.useEffect)(()=>{if(!s||Ft.current||(Ft.current=!0,Ie.current.length>0))return;let _=!1,he=P.current;return $(!1),(async()=>{try{let Se=w.current;if(!Se)try{Se=await Ic(),w.current=Se}catch{}let et=Se?.memoryUserId;if(!et||_||he!==P.current){_||$(!0);return}let Ot=l??await i0(et);if(_||he!==P.current)return;if(Ot){let Kt=await jh(Ot);if(_||he!==P.current)return;Kt&&Kt.memoryUserId===et&&(O.current=Kt.threadId,R(Kt.threadId),H.current=Kt.createdAt,Z.current=Kt.title,Kt.sessionId&&(E.current=Kt.sessionId,S(Kt.sessionId)),ct(Kt.messages))}await C()}finally{_||$(!0)}})(),()=>{_=!0}},[s]),(0,ee.useEffect)(()=>{if(le==="ready"&&Le.current&&ie.current){let _=Le.current,he=ie.current;Le.current=null,ie.current=null,_.resolve(he)}},[le]);let[In,ca]=(0,ee.useState)(""),so=typeof c!="function",lo=In.length>0;(0,ee.useEffect)(()=>{so&&lo&&ce.current.prepare?.()},[so,lo]);let[qt,Vn]=(0,ee.useState)([]),on=(0,ee.useRef)([]);on.current=qt;let xu=le==="submitted"||le==="streaming",nf=(0,ee.useCallback)(_=>{for(let he of _)for(let Se of he.documents??[])zh({documentId:Se.documentId,api:t,headers:p.current,uploadHeaders:m.current})},[t]),uo=(0,ee.useCallback)(()=>{nf(on.current),Vn([])},[nf]),i3=(0,ee.useCallback)(_=>{let he=on.current.find(Se=>Se.id===_);he&&nf([he]),Vn(Se=>Se.filter(et=>et.id!==_))},[nf]),s3=xu&&qt.length>0,l3=(0,ee.useCallback)(_=>{let he=!!_.text?.trim(),Se=!!(_.files?.length||_.documents?.length);if(he||Se){if(xu){if(qt.length>0)return;Vn(et=>[...et,{id:ud(),text:_.text||"",files:_.files??[],documents:_.documents??[],modelContext:_.modelContext}]),ca("");return}D(),I.current=_.modelContext,y.current=_.documents,W({text:_.text||"",files:_.files,..._.documents?.length&&{metadata:{documents:_.documents}}}),o?.(_.text||""),d.emit({name:"message.sent"}),ca("")}},[W,o,xu,qt.length,d,D]),u3=(0,ee.useCallback)(_=>new Promise((he,Se)=>{Le.current={resolve:he,reject:Se},D(),W({text:_}),o?.(_),d.emit({name:"message.sent"})}),[W,o,d,D]);(0,ee.useEffect)(()=>{if(le!=="ready"||F||qt.length===0)return;let[_,...he]=qt;Vn(he),D(),I.current=_.modelContext,y.current=_.documents,W({text:_.text,files:_.files.length>0?_.files:void 0,..._.documents.length>0&&{metadata:{documents:_.documents}}}),o?.(_.text),d.emit({name:"message.sent"})},[le,F,W,o,qt,d,D]);let c3=(0,ee.useCallback)(()=>{ce.current.reset?.(),ct([]),uo(),x(),ca(""),xe.current={},_e(_=>_+1),Ae()},[ct,x,Ae,uo]),rf=(0,ee.useCallback)(()=>{if(!v.current)return;let _=w.current?.memoryUserId,he=O.current,Se=Ie.current;if(!(!_||!he||Se.length===0)){if(H.current||(H.current=Vh()),!Z.current){let et=Se.find(Kt=>Kt.role==="user"),Ot=et?et.parts.map(Kt=>"text"in Kt&&typeof Kt.text=="string"?Kt.text:"").join(" "):"";Z.current=vB(Ot)}return{threadId:he,memoryUserId:_,title:Z.current,messages:Se,sessionId:E.current,createdAt:H.current,updatedAt:Vh()}}},[]),h0=(0,ee.useCallback)(async()=>{let _=rf();_&&(await o0(_),await C())},[rf,C]);(0,ee.useEffect)(()=>{if(s&&Q&&!(le==="submitted"||le==="streaming")&&de.length!==0)return X.current&&clearTimeout(X.current),X.current=setTimeout(()=>{X.current=void 0;let _=h0().finally(()=>{B.current===_&&(B.current=void 0)});B.current=_},bY),()=>{X.current&&clearTimeout(X.current)}},[s,Q,de,le,h0]);let of=(0,ee.useCallback)(()=>{let _=B.current,he=X.current,Se=he?rf():void 0;return he&&(clearTimeout(he),X.current=void 0),(async()=>{_&&await _,Se&&(await o0(Se),await C())})()},[rf,C]),d3=(0,ee.useCallback)(()=>{P.current+=1,of(),ce.current.dispose?.(),ct([]),uo(),x(),ca("");let _=xB();return H.current=Vh(),Z.current=void 0,ge(_),C(),_},[ct,x,ge,C,of,uo]),Jh=(0,ee.useCallback)(async _=>{P.current+=1;let he=P.current;if(await of(),he!==P.current)return;let Se=await jh(_);he===P.current&&Se&&(ce.current.dispose?.(),Se.sessionId?(E.current=Se.sessionId,S(Se.sessionId)):x(),ge(Se.threadId),H.current=Se.createdAt,Z.current=Se.title,ct(Se.messages),uo(),ca(""))},[ct,x,ge,of,uo]),f3=(0,ee.useCallback)(async _=>{if(O.current===_){P.current+=1,X.current&&(clearTimeout(X.current),X.current=void 0);let he=B.current;he&&await he}await wB(_),ce.current.forget?.(_),await C(),O.current===_&&(ce.current.dispose?.(),ct([]),uo(),x(),ca(""),O.current=void 0,R(void 0),H.current=void 0,Z.current=void 0)},[ct,x,C,uo]);(0,ee.useEffect)(()=>{s&&Q&&l!==void 0&&l!==O.current&&Jh(l)},[l,s,Q,Jh]);let p3=(0,ee.useCallback)(_=>{ca(_.target.value)},[]),g0=de[de.length-1],y0=de.length>0,m3=xu&&(!y0||g0.role==="user"),h3=xe.current;return{messages:de,status:le,text:In,setText:ca,handleSubmit:l3,handleTextChange:p3,isLoading:xu,showLoaderBubble:m3,lastMessage:g0,hasMessages:y0,sendMessage:W,sendMessageAndWait:u3,stop:Ve,reset:c3,queuedMessages:qt,queueFull:s3,removeQueuedMessage:i3,sessionId:g,toolDefinitions:h3,refreshToolDefinitions:Ae,threads:U,activeThreadId:T,isThreadHistoryReady:Q,startNewThread:d3,switchThread:Jh,deleteThread:f3,keepsSession:ae}}var bs=j(Ee(),1);var CY=6e3;function IB(e){let{api:t,headers:a,uploadHeaders:n,sessionId:r,documentUpload:o,allowAttachments:i}=e,[s,l]=(0,bs.useState)(null),u=(0,bs.useCallback)((p,m,h)=>hB({file:p,api:t,headers:a,uploadHeaders:n,sessionId:r,signal:m,onProgress:h}),[t,a,n,r]),c=(0,bs.useCallback)(p=>{zh({documentId:p.documentId,api:t,headers:a,uploadHeaders:n})},[t,a,n]);(0,bs.useEffect)(()=>{if(!s)return;let p=setTimeout(()=>l(null),CY);return()=>clearTimeout(p)},[s]);let d=o?.enabled??!1;return{enabled:o?o.enabled:!!i,accept:o?.accept.join(","),maxFileSize:o?.maxBytes,maxPdfPages:o?.maxPdfPages,maxFiles:o?.maxFiles,upload:d?u:void 0,onDiscard:d?c:void 0,error:s,reportError:l}}var Ha=j(Ee(),1);function du(e){return e.map(t=>({id:null,text:t}))}function Ss(e){let{flow:t,followup:a,page:n,channel:r}=e;return t!==null?{origin:"flow",suggestions:t}:a?.length?{origin:"followup",suggestions:a}:n?.length?{origin:"page",suggestions:n}:r?.length?{origin:"channel",suggestions:r}:null}function fu(e){return typeof e=="object"&&e!==null}function CB(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function kY(e){if(!fu(e)||!("toolCallId"in e)||!("output"in e))return null;let t=e.output;if(!fu(t)||!fu(t._meta))return null;let a=t._meta[Hw];return!fu(a)||!CB(a.suggestions)?null:a.suggestions}function kB(e){let t=null;for(let a of e.parts){let n=kY(a);n!==null&&(t=n)}return t}function TB(e){for(let t of e.parts){if(!fu(t)||t.type!=="data-suggestions")continue;let a=t.data;if(fu(a)&&CB(a.suggestions)&&a.suggestions.length>0)return a.suggestions}return null}function TY(e){return"page"in e||"channel"in e}function LY(e){return typeof e!="object"||e===null?{}:TY(e)?{rungs:e}:{initial:e.initial}}function LB(e){let{messages:t,status:a,suggestions:n}=e,r=n!==!1,{rungs:o,initial:i}=LY(n),s=(0,Ha.useMemo)(()=>({page:null,channel:du(i??[])}),[i]),l=o??s,u=(0,Ha.useMemo)(()=>r?Ss({flow:null,followup:null,...l}):null,[r,l]),c=(0,Ha.useMemo)(()=>u?.suggestions.map(g=>g.text)??[],[u]),[d,p]=(0,Ha.useState)(c),[m,h]=(0,Ha.useState)(u?.origin??"channel"),v=(0,Ha.useRef)(a),I=(0,Ha.useCallback)(()=>{p([])},[]),y=t.length>0;(0,Ha.useEffect)(()=>{y||(p(c),h(u?.origin??"channel"))},[c,u,y]);let w=t[t.length-1];return(0,Ha.useEffect)(()=>{w?.role==="user"&&I()},[w,I]),(0,Ha.useEffect)(()=>{let g=v.current;if(v.current=a,g!=="streaming"||a!=="ready"||!r)return;let S=[...t].reverse().find(O=>O.role==="assistant");if(!S)return;let E=kB(S),T=TB(S),R=Ss({flow:E===null?null:du(E),followup:T===null?null:du(T),page:null,channel:null});p(R?R.suggestions.map(O=>O.text):[]),h(R?.origin??"channel")},[a,r,t]),{suggestions:d,source:m,isLoading:!1,clear:I}}function EB(e,t){let a=t?.Authorization,n=typeof a=="string"&&a.startsWith("Bearer ")?a.slice(7):null;return Na(e,"/resource",n?{token:n}:void 0)}var EY={primaryColor:["--ww-primary","--ww-color-primary"],primaryForeground:["--ww-primary-fg","--ww-color-primary-foreground"],backgroundColor:["--ww-bg","--ww-color-background"],textColor:["--ww-text","--ww-color-foreground","--ww-color-accent-foreground"],mutedColor:["--ww-muted","--ww-color-muted-foreground"],borderColor:["--ww-border","--ww-color-border"],borderWidth:["--ww-border-width"],boxShadow:["--ww-shadow"],assistantBubbleColor:["--ww-assistant-bubble","--ww-color-accent"],userBubbleColor:["--ww-user-bubble"],inputBackgroundColor:["--ww-input-bg","--ww-color-input"],borderRadius:["--ww-radius"],messageBorderRadius:["--ww-msg-radius"],fontFamily:["--ww-font"],headerBackgroundColor:["--ww-header-bg"],headerTextColor:["--ww-header-text"],statusColor:["--ww-status"],toolCardColor:["--ww-tool-card","--ww-color-tool-card"],userBubbleTextColor:["--ww-user-bubble-text"],assistantBubbleTextColor:["--ww-assistant-bubble-text"],messagePaddingX:["--ww-msg-pad-x"],messagePaddingY:["--ww-msg-pad-y"],messageMaxWidth:["--ww-msg-max-width"],fontSize:["--ww-font-size"],lineHeight:["--ww-line-height"],glassTint:["--ww-glass-tint"],glassTintStrength:["--ww-glass-tint-opacity"]};function pu(e){let t={};for(let[a,n]of Object.entries(EY)){let r=e[a];if(r===void 0)continue;let o=typeof r=="number"?`${r}px`:String(r);for(let i of n)t[i]=o}return t}var nt=j(me(),1),mu=(0,Qe.forwardRef)(function(t,a){let{locale:n,messages:r}=t;return(0,nt.jsx)(es,{locale:n,messages:r,children:(0,nt.jsx)(AY,{...t,ref:a})})}),AY=(0,Qe.forwardRef)(function(t,a){let{t:n,ready:r}=Ue(),{appearance:o,className:i,classNames:s,allowAttachments:l=!1,documentUpload:u,welcomeMessage:c,welcome:d,placeholder:p=n.promptInput.placeholder,triggerEvent:m="triggerDemoRequest",api:h,mcp:v,debug:I=!1,readOnly:y=!1,title:w,headerActions:g,hideHeader:S=!1,enableThreadHistory:E=!1,showToolCalls:T=!0,initializing:R=!1,onScreen:O=!0,disclaimer:U}=t,A=o?.theme,Q=o?.variables,$=o?.assistantBubble??!1,H=Q?pu(Q):{},[Z,X]=(0,Qe.useState)(!1);(0,Qe.useEffect)(()=>{if(A!=="auto"||typeof window>"u")return;let k=window.matchMedia("(prefers-color-scheme: dark)");X(k.matches);let D=()=>X(k.matches);return k.addEventListener("change",D),()=>k.removeEventListener("change",D)},[A]);let B=A==="dark"||A==="auto"&&Z,P=SB({...t,api:h}),J=Ph(),ge=iB({...t,api:h,sessionId:P.sessionId,onCallTool:v?.onCallTool}),C=v?.resourceEndpoint??EB(h,t.headers),ze=(0,Qe.useRef)({});ze.current={api:h,token:jp(t.headers),channelId:typeof t.body?.channelId=="string"?t.body.channelId:void 0,sessionId:P.sessionId};let ot=(0,Qe.useCallback)(k=>{Vp("widget",ze.current,{widget:k.widget,outcome:k.outcome},k.metrics)},[]),x=Hl(p,!P.text),te=IB({api:h,headers:t.headers,uploadHeaders:t.uploadHeaders,sessionId:P.sessionId,documentUpload:u,allowAttachments:l}),[re,ke]=(0,Qe.useState)(null),[We,be]=(0,Qe.useState)(null),Oe=(0,Qe.useRef)(null),we=(0,Qe.useRef)(null),ce=(0,Qe.useRef)(null),Le=(0,Qe.useRef)(null),[ie,xe]=(0,Qe.useState)(!0),Ne=(0,Qe.useRef)(ie);Ne.current=ie;let _e=(0,Qe.useCallback)(()=>{let k=Oe.current;if(!k)return;let D=k.querySelector("textarea");D&&D.focus()},[]),Fe=(0,Qe.useCallback)((k="smooth")=>{let D=we.current;D&&D.scrollTo({top:D.scrollHeight,behavior:k})},[]);(0,Qe.useEffect)(()=>{let k=Le.current,D=we.current;if(!k||!D)return;let F=new IntersectionObserver(([fe])=>xe(fe.isIntersecting),{root:D,rootMargin:"0px 0px 200px 0px",threshold:0});return F.observe(k),()=>F.disconnect()},[]),(0,Qe.useEffect)(()=>{let k=we.current;if(!k)return;let D=F=>{let Ve=(F.target instanceof Element?F.target:null)?.closest("a");Ve?.href&&J.emit({name:"link.clicked",properties:{url:Ve.href}})};return k.addEventListener("click",D),()=>k.removeEventListener("click",D)},[J]),(0,Qe.useEffect)(()=>{(P.messages[P.messages.length-1]?.role==="user"||Ne.current)&&Fe("smooth")},[P.messages.length,P.messages[P.messages.length-1]]),(0,Qe.useEffect)(()=>{Fe("auto")},[Fe]),(0,Qe.useEffect)(()=>{if(typeof ResizeObserver>"u")return;let k=we.current,D=ce.current;if(!k&&!D)return;let F=k?.scrollHeight??0,fe=k?.clientHeight??0,Ve=new ResizeObserver(()=>{let Ft=we.current;if(!Ft)return;let In=Ft.scrollTop+fe>=F-5;F=Ft.scrollHeight,fe=Ft.clientHeight,In&&Fe("auto")});return k&&Ve.observe(k),D&&Ve.observe(D),()=>Ve.disconnect()},[Fe]);let Ae=LB({messages:P.messages,status:P.status,suggestions:t.suggestions}),de=(0,Qe.useRef)(null);(0,Qe.useEffect)(()=>{let k=Ae.suggestions;!O||k.length===0||de.current===k||(de.current=k,J.emit({name:"suggestions.shown",properties:{texts:k,origin:Ae.source}}))},[Ae.suggestions,Ae.source,J,O]);let W=d?.suggestions,ct=(0,Qe.useRef)(null);(0,Qe.useEffect)(()=>{!O||P.messages.length>0||!W?.length||ct.current===W||(ct.current=W,J.emit({name:"suggestions.shown",properties:{texts:W,origin:"channel"}}))},[W,P.messages.length,J,O]);let le=(0,Qe.useCallback)(k=>{let D=k.content.map(F=>F.text??"").join("").trim();D&&P.handleSubmit({text:D,files:[],modelContext:k.modelContext})},[P.handleSubmit]),oe=(0,Qe.useCallback)(k=>{let D=Ae.suggestions.indexOf(k),F=D>=0?D:d?.suggestions?.indexOf(k)??-1,fe=D>=0?Ae.source:"channel";J.emit({name:"suggestion.clicked",properties:{text:k,index:F,origin:fe}}),Ae.clear(),P.handleSubmit({text:k,files:[]})},[Ae.suggestions,Ae.source,Ae.clear,P.handleSubmit,d,J]);(0,Qe.useImperativeHandle)(a,()=>({sendMessage:k=>{P.handleSubmit({text:k,files:[]}),_e()},sendMessageAndWait:k=>P.sendMessageAndWait(k),reset:P.reset,focus:_e,get messages(){return P.messages},get sessionId(){return P.sessionId}}),[P.handleSubmit,P.sendMessageAndWait,P.reset,P.messages,P.sessionId,_e]),(0,Qe.useEffect)(()=>{if(!m)return;let k=D=>{let F=D.detail,fe=typeof F?.message=="string"?F.message:void 0;fe&&P.handleSubmit({text:fe,files:[]}),_e()};return window.addEventListener(m,k),()=>window.removeEventListener(m,k)},[m,P.handleSubmit,_e]);let Ie=!S&&!!(w||E||P.keepsSession||g),ae=R||!r;return(0,nt.jsxs)("div",{ref:Oe,style:{...H,maxHeight:"inherit",...re&&We?{height:We}:{},opacity:ae?0:1,transition:"opacity 220ms ease-out"},"data-waniwani-chat":"","data-waniwani-layout":"embed","data-assistant-bubble":$?"true":void 0,"data-color-scheme":A==="auto"?"auto":void 0,...ae?{"data-waniwani-initializing":""}:{},...B?{"data-waniwani-dark":""}:{},className:V("ww:relative ww:w-full ww:h-full ww:flex ww:flex-col ww:bg-background ww:text-foreground ww:font-[family-name:var(--ww-font)] ww:overflow-hidden",A==="dark"&&"dark",i,s?.root),children:[Ie&&(0,nt.jsxs)("div",{className:V("ww-header ww:shrink-0 ww:flex ww:items-center ww:gap-2 ww:pl-4 ww:pr-3 ww:py-3 ww:border-b ww:border-border",s?.header),style:{backgroundColor:"var(--ww-color-card-header)",color:"var(--ww-color-card-header-foreground)"},children:[w&&(0,nt.jsx)("div",{className:"ww:text-sm ww:font-semibold ww:truncate ww:flex-1 ww:min-w-0",children:w}),!w&&(0,nt.jsx)("div",{className:"ww:flex-1"}),!E&&P.keepsSession&&(0,nt.jsx)(Dh,{onClick:P.reset}),E&&(0,nt.jsx)(nB,{threads:P.threads,activeThreadId:P.activeThreadId,onNewThread:P.startNewThread,onSelectThread:k=>{P.switchThread(k)},onDeleteThread:k=>{P.deleteThread(k)}}),g]}),(0,nt.jsxs)("div",{ref:we,className:V("ww:relative ww:flex-1 ww:min-h-0",re?"ww:overflow-hidden":"ww:overflow-y-auto"),children:[(0,nt.jsxs)("div",{ref:ce,className:V("ww:mx-auto ww:w-full ww:max-w-3xl ww:px-4 ww:py-6 ww:flex ww:flex-col ww:gap-6",re&&"ww:!py-0"),children:[(0,nt.jsx)(KU,{value:ot,children:(0,nt.jsx)(eB,{messages:P.messages,status:P.status,welcomeMessage:c,welcome:d,onSuggestionSelect:oe,resourceEndpoint:C,chatSessionId:P.sessionId,isDark:B,onFollowUp:le,onCallTool:ge,fullscreenToolCallId:re,debug:I,showToolCalls:T,toolDefinitions:P.toolDefinitions,messageClassNames:{message:s?.message,userBubble:s?.userBubble,assistantBubble:s?.assistantBubble},onWidgetDisplayModeChange:(k,D)=>{if(k==="fullscreen"){let F=Oe.current?.getBoundingClientRect().height??0;be(F>0?F:null),ke(D.toolCallId)}else be(null),ke(null)}})}),(0,nt.jsx)("div",{ref:Le,"aria-hidden":!0,style:{height:1}})]}),!ie&&!re&&(0,nt.jsx)("div",{className:"ww:sticky ww:bottom-2 ww:flex ww:justify-center ww:pointer-events-none",children:(0,nt.jsx)(br,{type:"button",onClick:()=>Fe("smooth"),size:"icon",variant:"outline",className:"ww:rounded-full ww:shadow ww:pointer-events-auto","aria-label":"Scroll to latest",children:(0,nt.jsx)(Tc,{className:"ww:size-4"})})})]}),!y&&(0,nt.jsxs)("div",{className:"ww:shrink-0 ww:bg-background",style:re?{display:"none"}:void 0,children:[(0,nt.jsx)(Sl,{suggestions:Ae.suggestions,isLoading:Ae.isLoading,onSelect:oe}),(0,nt.jsx)(HM,{queuedMessages:P.queuedMessages,onRemove:P.removeQueuedMessage}),(0,nt.jsx)("div",{className:"ww:px-4 ww:pb-2 ww:pt-2",children:(0,nt.jsxs)("div",{className:"ww:mx-auto ww:w-full ww:max-w-3xl",children:[(0,nt.jsxs)(TM,{onSubmit:P.handleSubmit,attachmentsEnabled:te.enabled,globalDrop:te.enabled,multiple:te.enabled,accept:te.accept,maxFileSize:te.maxFileSize,maxPdfPages:te.maxPdfPages,maxFiles:te.maxFiles,upload:te.upload,onDiscard:te.onDiscard,onError:te.reportError,className:V("ww-input ww:rounded-2xl ww:border-border ww:bg-input",s?.input),children:[(0,nt.jsx)(DM,{enabled:te.enabled}),te.enabled&&(0,nt.jsx)(RM,{className:"ww:px-4 ww:pt-3"}),(0,nt.jsxs)("div",{className:"ww:flex ww:items-center ww:gap-1 ww:pl-4 ww:pr-3 ww:py-2.5",children:[te.enabled&&(0,nt.jsx)(MM,{}),(0,nt.jsx)(EM,{onChange:P.handleTextChange,value:P.text,placeholder:x,className:"ww:min-h-0 ww:py-1 ww:px-0"}),(0,nt.jsx)(AM,{status:P.status,disabled:P.queueFull,onStop:P.stop})]})]}),te.error&&(0,nt.jsx)("output",{className:"ww:block ww:pt-1.5 ww:text-center ww:text-destructive ww:text-xs",children:te.error.message}),(0,nt.jsxs)("div",{className:"ww:pt-2 ww:pb-1 ww:flex ww:flex-nowrap ww:justify-center ww:items-center ww:gap-1.5",children:[(0,nt.jsx)(tB,{}),(0,nt.jsx)(_M,{text:U})]})]})})]})]})});var Qd=j(Ee(),1);var AB="500px",MY="https://app.waniwani.ai/api/mcp/chat",RY={api:MY};function s0(){if(typeof document>"u")return null;if(document.currentScript instanceof HTMLScriptElement)return document.currentScript;let e=document.querySelector("script[src][data-token]");if(e instanceof HTMLScriptElement)return e;let t=document.querySelectorAll("script[src]");for(let a of t)if(a instanceof HTMLScriptElement&&/embed/i.test(a.src))return a;return null}function $h(){let e=s0();if(!e)return{};let t=J=>e.getAttribute(J)??void 0,a=J=>{let ge=e.getAttribute(J);if(ge==null)return;let C=ge.trim().toLowerCase();if(C==="true"||C==="1"||C==="")return!0;if(C==="false"||C==="0")return!1},n={},r=t("data-api");r&&(n.api=r);let o=t("data-token");o&&(n.token=o);let i=t("data-visitor-id");i&&(n.visitorId=i);let s=t("data-title");s&&(n.title=s);let l=t("data-welcome-message");l&&(n.welcomeMessage=l);let u=t("data-placeholder");u&&(n.placeholder=u);let c=t("data-mcp-server-url");c&&(n.mcpServerUrl=c);let d=t("data-webmcp");d&&(n.webmcp={enabled:d!=="false"&&d!=="off"});let p=t("data-channel-id");if(p&&(n.channelId=p),t("data-show-tool-calls")?.trim().toLowerCase()==="titles-only")n.showToolCalls="titles-only";else{let J=a("data-show-tool-calls");J!==void 0&&(n.showToolCalls=J)}let h=t("data-css");h&&(n.css=h);let v=t("data-suggestions");v&&(n.suggestions=v.split(",").map(J=>J.trim()).filter(Boolean));let I=a("data-enable-thread-history");I!==void 0&&(n.enableThreadHistory=I);let y=a("data-disable-page-view");y!==void 0&&(n.disablePageView=y);let w=a("data-hide-header");w!==void 0&&(n.hideHeader=w);let g=t("data-theme");(g==="light"||g==="dark"||g==="auto")&&(n.appearance={...n.appearance,theme:g});let S=a("data-assistant-bubble");S!==void 0&&(n.appearance={...n.appearance,assistantBubble:S});let E=t("data-locale");(E==="en"||E==="fr"||E==="es")&&(n.locale=E);let T=t("data-mode");(T==="inline"||T==="floating"||T==="composer"||T==="off")&&(n.mode=T);let R={},O=t("data-composer-variant")?.trim().toLowerCase();(O==="glow"||O==="outline")&&(R.variant=O);let U=t("data-composer-size")?.trim().toLowerCase();(U==="sm"||U==="md"||U==="lg")&&(R.size=U);let A=a("data-composer-suggestions");A!==void 0&&(R.showSuggestions=A);let Q=t("data-composer-align")?.trim().toLowerCase();(Q==="start"||Q==="center")&&(R.align=Q);let $=a("data-composer-trigger");$!==void 0&&(R.trigger=$);let H=a("data-composer-mobile-trigger");H!==void 0&&(R.mobileTrigger=H),Object.keys(R).length>0&&(n.composer=R);let Z=t("data-height");Z&&(n.height=Z);let X=t("data-launcher-text");X&&(n.launcherText=X);let B=t("data-appear-delay");if(B!==void 0){let J=Number.parseInt(B.trim(),10);Number.isFinite(J)&&J>=0&&(n.appearDelay=J)}let P=t("data-disclaimer");if(P!==void 0){let J=P.trim(),ge=J.toLowerCase();ge==="false"||ge==="0"?n.disclaimer=!1:J&&(n.disclaimer=J)}return n}function Kd(e){if(!e)return{};let t={};for(let a in e)e[a]!==void 0&&(t[a]=e[a]);return t}function Yd(e,t,a){let n=a??$h(),r=DY(t,n,e),o={...t?.composer??{},...Kd(n.composer),...Kd(e?.composer)},i=Object.keys(o).length>0,s={token:"",...RY,...Kd(t),...Kd(n),...Kd(e),...r?{appearance:r}:{},...i?{composer:o}:{}};if(!s.token)throw new Error("[Waniwani] Missing required config: `token`. Set data-token on the script tag or pass it to Waniwani.chat.init().");return s}function DY(e,t,a){let n=a?.appearance?.theme??t.appearance?.theme??e?.appearance?.theme,r={...e?.appearance?.variables??{},...t.appearance?.variables??{},...a?.appearance?.variables??{}},o=Object.keys(r).length>0,i=a?.appearance?.assistantBubble??t.appearance?.assistantBubble??e?.appearance?.assistantBubble;if(!n&&!o&&i===void 0)return;let s={};return n&&(s.theme=n),o&&(s.variables=r),i!==void 0&&(s.assistantBubble=i),s}var OB=j(Ee(),1);var Wh=j(Ee(),1);function _Y(e){return e?.patterns??e?.rules??[]}var MB="\0\0";function PY(e){let a=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*\\\*/g,MB).replace(/\\\*/g,"[^/]*").split(MB).join(".*");return new RegExp(`^${a}$`)}function RB(e,t){try{return PY(e).test(t)}catch{return!1}}function Zd(e,t){if(!e)return!0;let a=!1;for(let n of _Y(e))if(RB(n.glob,t)){if(n.action==="hide")return!1;a=!0}return a?!0:(e.default??"show")!=="hide"}function DB(e,t){for(let a of e?.appearRules??[])if(RB(a.glob,t))return a.appearAfter;return null}var l0="waniwani:locationchange",_B=!1;function OY(){if(!(_B||typeof history>"u")){_B=!0;for(let e of["pushState","replaceState"]){let t=history[e];history[e]=function(...n){let r=t.apply(this,n);return window.dispatchEvent(new Event(l0)),r}}}}function NY(e){return OY(),window.addEventListener(l0,e),window.addEventListener("popstate",e),()=>{window.removeEventListener(l0,e),window.removeEventListener("popstate",e)}}function UY(){return window.location.pathname}function BY(){return"/"}function Jd(){return(0,Wh.useSyncExternalStore)(NY,UY,BY)}function hu(e,t){let a=Jd(),n=t&&Zd(e,a);return(0,Wh.useEffect)(()=>{Ua("visibility gate",{pathname:a,ready:t,visible:n,rules:e})},[a,t,n]),n}var zY=3,FY=["low","medium","high"];function u0(e){if(e.length===0)return;let t=Math.floor(Math.random()*e.length),[a]=e.splice(t,1);return a}function qY(e){let t=new Map,a=[];for(let o of e)if(o.tier){let i=t.get(o.tier)??[];i.push(o),t.set(o.tier,i)}else a.push(o);let n=[];for(let o of FY){let i=u0(t.get(o)??[])??u0(a);i&&n.push(i)}let r=[...t.values()].flat().concat(a);for(;n.length<Math.min(zY,e.length);){let o=u0(r);if(!o)break;n.push(o)}return n}function PB(e){let t;try{t=new URL(e,"http://localhost").pathname}catch{t="/"}let a=t.replace(/\/+$/,"");return(a===""?"/":a).toLowerCase()}function NB(e){return Array.isArray(e)?e.flatMap(t=>{let a=t;if(typeof a?.url!="string"||a.url.length===0||!Array.isArray(a.prompts))return[];let n=a.prompts.flatMap(r=>{let o=r;return typeof o?.text!="string"||o.text.length===0?[]:[{id:typeof o.id=="string"?o.id:null,text:o.text,tier:o.tier==="low"||o.tier==="medium"||o.tier==="high"?o.tier:void 0}]});return n.length>0?[{url:a.url,prompts:n}]:[]}):[]}function gu(e){let{pageSuggestions:t,suggestions:a}=e,n=Jd();return(0,OB.useMemo)(()=>{let r=PB(n),o=t?.find(s=>PB(s.url)===r),i=o?qY(o.prompts).map(({id:s,text:l})=>({id:s,text:l})):null;return Ua("configured suggestions resolve",{pathname:r,matched:!!o,count:i?.length??0}),{page:i,channel:du(a??[])}},[n,t,a])}var HY="waniwani:config:";function UB(e,t,a){return`${HY}${e}|${t}|${a??""}`}function ci(e,t,a){if(typeof window>"u")return null;try{let n=window.sessionStorage.getItem(UB(e,t,a));if(!n)return null;let r=JSON.parse(n);return r&&typeof r=="object"?r:null}catch{return null}}function jY(e,t,a,n){if(!(typeof window>"u"))try{window.sessionStorage.setItem(UB(e,t,a),JSON.stringify(n))}catch{}}var VY=600;function $Y(e){if(typeof e!="object"||e===null||typeof e.enabled!="boolean")return null;let t=Array.isArray(e.accept)?e.accept.filter(n=>typeof n=="string"):[],a=n=>typeof n=="number"&&Number.isFinite(n)&&n>0;return e.enabled?a(e.maxBytes)&&a(e.maxPdfPages)&&a(e.maxFiles)&&t.length>0?{enabled:!0,maxBytes:e.maxBytes,maxPdfPages:e.maxPdfPages,maxFiles:e.maxFiles,accept:t}:null:{enabled:!1,maxBytes:0,maxPdfPages:0,maxFiles:0,accept:t}}async function WY(e,t,a,n){Di("configStart");let r=await GY(e,t,a,n);return Di("configEnd"),a?.aborted||Jw(r.metadata),r}async function GY(e,t,a,n){try{let r=Na(e,"/config",n?{channel:n}:void 0),o=await fetch(r,{method:"GET",headers:{Authorization:`Bearer ${t}`},signal:a});if(!o.ok)return{};let i=await o.json(),s=i&&typeof i=="object"&&"data"in i&&i.data?i.data:i;return s?XY(s):{}}catch{return{}}}function XY(e){let t={};e.source!=null&&(t.source=e.source),e.channelId!=null&&(t.channelId=e.channelId),e.title!=null&&(t.title=e.title),e.welcomeMessage!=null&&(t.welcomeMessage=e.welcomeMessage),e.placeholder!=null&&(t.placeholder=e.placeholder),e.suggestions!=null&&e.suggestions.length>0&&(t.suggestions=e.suggestions);let a=NB(e.pageSuggestions);a.length>0&&(t.pageSuggestions=a),typeof e.enableThreadHistory=="boolean"&&(t.enableThreadHistory=e.enableThreadHistory),typeof e.sessionApi=="string"&&e.sessionApi&&(t.sessionApi=e.sessionApi),typeof e.webmcp?.enabled=="boolean"&&(t.webmcp={enabled:e.webmcp.enabled}),e.toolCallDisplay==="full"?t.showToolCalls=!0:e.toolCallDisplay==="titles-only"?t.showToolCalls="titles-only":e.toolCallDisplay==="hidden"&&(t.showToolCalls=!1),e.visibility&&(t.visibility=e.visibility);let n=$Y(e.documentUpload);return n&&(t.documentUpload=n),e.metadata&&typeof e.metadata=="object"&&(t.metadata=e.metadata),t}function yu(e,t,a){let[n,r]=(0,Qd.useState)(e),[o,i]=(0,Qd.useState)(!1);return(0,Qd.useEffect)(()=>{let s=e.api,l=e.token,u=e.channelId;if(!s||!l){i(!0);return}let c=h=>{e.disablePageView||M1({api:s,token:l,channelId:u??h.channelId,mode:e.mode==="off"?void 0:e.mode,source:h.source})},d=ci(s,l,u);if(d)try{let h=Yd(t,d,a);r(h),$p("cache"),Jw(d.metadata),i(!0),Ua("config resolved (sessionStorage cache)",{config:h,visibility:h.visibility}),c(d)}catch{}let p=new AbortController,m=setTimeout(()=>{$p("timeout"),i(!0)},VY);return WY(s,l,p.signal,u).then(h=>{if(!p.signal.aborted){if(Ua("remote /config response",h),Object.keys(h).length>0){jY(s,l,u,h);try{let v=Yd(t,h,a);r(v),Ua("config resolved (remote)",{config:v,visibility:v.visibility})}catch(v){console.error("[Waniwani] Failed to apply remote config:",v)}}$p("remote"),i(!0),c(h)}}).catch(h=>{console.error("[Waniwani] Remote config fetch failed:",h),i(!0)}).finally(()=>clearTimeout(m)),()=>{p.abort(),clearTimeout(m)}},[e.api,e.token,e.channelId]),{config:n,ready:o}}var Gt=j(me(),1),KY={sm:{row:"ww:gap-1 ww:pl-3 ww:pr-1 ww:py-1",field:"ww:py-1 ww:text-base ww:sm:text-sm",send:"ww:size-7",sendIcon:"ww:size-3.5",radius:12},md:{row:"ww:gap-1 ww:pl-3.5 ww:pr-1.5 ww:py-1.5 ww:sm:pl-4 ww:sm:pr-2 ww:sm:py-2",field:"ww:py-1.5 ww:text-base ww:sm:text-sm",send:"ww:size-8",sendIcon:"ww:size-4",radius:16},lg:{row:"ww:gap-2 ww:pl-5 ww:pr-2 ww:py-2.5 ww:sm:pl-6 ww:sm:pr-2.5 ww:sm:py-3",field:"ww:py-2 ww:text-base",send:"ww:size-10",sendIcon:"ww:size-5",radius:20}},BB="var(--ww-composer-bg, var(--ww-color-input))",YY="var(--ww-composer-border-color, var(--ww-color-border))",ZY="var(--ww-composer-border-width, 1px)",zB="var(--ww-composer-send-bg, var(--ww-color-foreground))",FB="var(--ww-composer-send-fg, var(--ww-color-background))",HB=(0,rt.forwardRef)(function(t,a){return(0,Gt.jsx)(es,{locale:t.config.locale,children:(0,Gt.jsx)(JY,{...t,ref:a})})}),JY=(0,rt.forwardRef)(function({config:t,programmatic:a,scriptConfig:n,panelContainer:r,onVisibilityChange:o},i){let{t:s}=Ue(),{config:l,ready:u}=yu(t,a,n),c=hu(l.visibility,u);(0,rt.useEffect)(()=>{o?.(c)},[c,o]),ru({api:l.api,token:l.token,channelId:l.channelId,mode:"composer",paintMark:"chatVisible",painted:u});let d=(0,rt.useRef)(null),p=(0,rt.useMemo)(()=>su({mode:"composer",getSessionId:()=>d.current?.sessionId}),[]),m=l.onEvent;(0,rt.useEffect)(()=>{if(m)return p.subscribe(m)},[m,p]);let h=(0,rt.useRef)(null),v=(0,rt.useRef)(null),[I,y]=(0,rt.useState)(!1),[w,g]=(0,rt.useState)(""),[S,E]=(0,rt.useState)(0),T=l.appearance?.theme,R=l.appearance?.variables,O=(0,rt.useMemo)(()=>R?pu(R):{},[R]),U=gu(l),A=(0,rt.useMemo)(()=>Ss({flow:null,followup:null,...U}),[U]),Q=(0,rt.useMemo)(()=>A?.suggestions.map(de=>de.text)??[],[A]);Fl({widgetEvents:p,api:l.api,token:l.token,channelId:l.channelId,source:l.source,mode:"composer",pagePrompts:U.page,getSessionId:()=>d.current?.sessionId});let $=(0,rt.useRef)(null);(0,rt.useEffect)(()=>{!c||!A||$.current!==A&&($.current=A,p.emit({name:"suggestions.shown",properties:{texts:Q,origin:A.origin}}))},[c,A,Q,p]);let H=l.composer??{},Z=H.variant??"glow",X=KY[H.size??"md"],B=H.showSuggestions??!0,P=H.align==="center",J=oM(),ge=(H.trigger??!1)||J&&(H.mobileTrigger??!0),C=l.launcherText??l.placeholder??s.launcher.prompt,ze=Hl(C,!ge&&w.length===0),ot="var(--ww-shadow, 0 10px 30px rgba(0, 0, 0, 0.08))";(0,rt.useEffect)(()=>{let de=h.current;if(de){if(!w){de.style.height="";return}de.style.height="auto",de.style.height=`${de.scrollHeight}px`}},[w]),(0,rt.useEffect)(()=>{S>0&&I&&d.current?.focus()},[S,I]);let x=(0,rt.useRef)(!1);(0,rt.useEffect)(()=>{u&&!x.current&&(x.current=!0,p.emit({name:"chat.ready"}))},[u,p]);let te=(0,rt.useRef)(!1);(0,rt.useEffect)(()=>{let de=c&&I;de!==te.current&&(te.current=de,p.emit({name:de?"chat.opened":"chat.closed"}))},[c,I,p]);let re=(0,rt.useCallback)(de=>{y(!0),E(ct=>ct+1);let W=de.trim();W&&d.current?.sendMessage(W)},[]);(0,rt.useImperativeHandle)(i,()=>({open:()=>y(!0),close:()=>y(!1),toggle:()=>y(de=>!de),sendMessage:de=>re(de),sendMessageAndWait:async de=>{y(!0);let W=d.current;if(W)return await W.sendMessageAndWait(de)},reset:()=>d.current?.reset(),focus:()=>{I?E(de=>de+1):(h.current??v.current)?.focus()},getMessages:()=>d.current?.messages??[],getSessionId:()=>d.current?.sessionId}),[re,I]);let ke=(0,rt.useCallback)(()=>{w.trim()&&(re(w),g(""))},[w,re]),We=(0,rt.useCallback)(()=>{(d.current?.messages.length??0)>0&&(y(!0),E(de=>de+1))},[]),be={mode:"composer"},Oe=zl(l.sessionApi);l.mcpServerUrl&&(be.mcpServerUrl=l.mcpServerUrl),l.channelId&&(be.channelId=l.channelId);let we=(0,Gt.jsx)("button",{type:"button",onClick:()=>y(!1),"aria-label":s.launcher.close,className:"ww:flex ww:size-7 ww:items-center ww:justify-center ww:rounded-md ww:text-muted-foreground ww:transition-colors hover:ww:bg-accent hover:ww:text-foreground ww:cursor-pointer",children:(0,Gt.jsx)(wn,{className:"ww:size-4"})}),ce=(0,Gt.jsxs)("div",{className:V("ww:flex ww:items-end",X.row),children:[(0,Gt.jsx)("textarea",{ref:h,rows:1,value:w,placeholder:ze,onChange:de=>g(de.target.value),onFocus:We,onKeyDown:de=>{de.key==="Enter"&&!de.shiftKey&&(de.preventDefault(),ke())},className:V("ww:min-w-0 ww:flex-1 ww:resize-none ww:bg-transparent ww:max-h-36 ww:text-foreground ww:outline-none ww:placeholder:text-muted-foreground",X.field,!w&&"ww:overflow-hidden ww:whitespace-nowrap ww:text-ellipsis ww:placeholder:overflow-hidden ww:placeholder:text-ellipsis")}),(0,Gt.jsx)("button",{type:"button",onClick:ke,disabled:!w.trim(),"aria-label":s.promptInput.submit,className:V("ww:relative ww:flex ww:shrink-0 ww:items-center ww:justify-center ww:rounded-full ww:transition-opacity hover:ww:opacity-90 disabled:ww:opacity-40",X.send),style:{background:zB,color:FB},children:(0,Gt.jsx)(pr,{className:X.sendIcon})})]}),Le=(0,Gt.jsxs)("button",{ref:v,type:"button",onClick:()=>re(""),className:V("ww:flex ww:w-full ww:items-center ww:text-left ww:cursor-pointer",X.row,P&&"ww:justify-center"),children:[(0,Gt.jsx)("span",{className:V("ww:min-w-0 ww:flex-1 ww:truncate ww:text-muted-foreground",X.field,P&&"ww:flex-none"),children:C}),(0,Gt.jsx)("span",{"aria-hidden":!0,className:V("ww:flex ww:shrink-0 ww:items-center ww:justify-center ww:rounded-full",X.send,P&&"ww:ml-3"),style:{background:zB,color:FB},children:(0,Gt.jsx)(pr,{className:X.sendIcon})})]}),ie=ge?Le:ce,xe=`var(--ww-composer-radius, ${X.radius}px)`,Ne={borderRadius:xe,background:BB,borderColor:YY,borderWidth:ZY,borderStyle:"solid",boxShadow:`var(--ww-composer-shadow, ${ot})`},_e=Z==="glow"?(0,Gt.jsx)(Yp,{animated:u,backgroundColor:BB,borderRadius:xe,edgeSensitivity:30,coneSpread:25,colors:["#c084fc","#f472b6","#38bdf8"],style:Ne,children:ie}):(0,Gt.jsx)("div",{className:V(ge&&"ww:transition-colors hover:ww:border-primary/40"),style:Ne,children:ie}),Fe=(0,Gt.jsxs)("div",{"data-waniwani-chat":"","data-color-scheme":T==="auto"?"auto":void 0,"data-waniwani-composer":"input","data-composer-variant":Z,inert:I,className:V("ww:w-full ww:font-[family-name:var(--ww-font-sans)]",T==="dark"&&"dark"),style:O,children:[_e,B&&Q.length>0&&(0,Gt.jsx)(Sl,{suggestions:Q,onSelect:de=>{p.emit({name:"suggestion.clicked",properties:{text:de,index:Q.indexOf(de),origin:A?.origin??"channel"}}),re(de)},align:P?"center":"start",className:"ww:px-0.5 ww:pt-2.5 ww:pb-0"})]}),Ae=(0,Gt.jsx)("div",{"data-waniwani-chat":"","data-color-scheme":T==="auto"?"auto":void 0,className:V("ww:contents ww:font-[family-name:var(--ww-font-sans)]",T==="dark"&&"dark"),style:O,children:(0,Gt.jsx)("div",{role:"dialog","aria-label":l.title??C,"data-waniwani-floating":"panel","data-state":c&&I?"shown":"hidden",style:{boxShadow:ot},className:V("ww:fixed ww:z-[2147483002] ww:flex ww:flex-col ww:overflow-hidden ww:bg-background","ww:inset-0 ww:w-full ww:rounded-none","ww:sm:inset-auto ww:sm:bottom-4 ww:sm:left-0 ww:sm:right-0 ww:sm:mx-auto ww:sm:h-[720px] ww:sm:max-h-[calc(100dvh-2rem)] ww:sm:w-[calc(100vw-2rem)] ww:sm:max-w-[1000px] ww:sm:rounded-2xl ww:sm:border ww:sm:border-border"),children:(0,Gt.jsx)(mu,{transport:Oe,ref:d,api:l.api??"",headers:{Authorization:`Bearer ${l.token}`},skipRemoteConfig:!0,body:be,appearance:l.appearance,title:l.title,headerActions:we,hideHeader:!1,onScreen:I,welcomeMessage:l.welcomeMessage,placeholder:l.placeholder,suggestions:U,enableThreadHistory:l.enableThreadHistory,documentUpload:l.documentUpload,showToolCalls:l.showToolCalls,locale:l.locale,initializing:!u})})});return(0,Gt.jsxs)(lu,{value:p,children:[Fe,(0,qB.createPortal)(Ae,r)]})});var c0="/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--ww-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--ww-color-black:#000;--ww-spacing:.25rem;--ww-container-sm:24rem;--ww-container-md:28rem;--ww-container-3xl:48rem;--ww-text-xs:.75rem;--ww-text-xs--line-height:calc(1/.75);--ww-text-sm:.875rem;--ww-text-sm--line-height:calc(1.25/.875);--ww-text-base:1rem;--ww-text-base--line-height:calc(1.5/1);--ww-text-lg:1.125rem;--ww-text-lg--line-height:calc(1.75/1.125);--ww-font-weight-medium:500;--ww-font-weight-semibold:600;--ww-tracking-wide:.025em;--ww-tracking-wider:.05em;--ww-radius-md:.375rem;--ww-radius-lg:.5rem;--ww-radius-xl:.75rem;--ww-radius-2xl:1rem;--ww-ease-out:cubic-bezier(0,0,.2,1);--ww-animate-spin:spin 1s linear infinite;--ww-animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--ww-blur-md:12px;--ww-blur-xl:24px;--ww-default-transition-duration:.15s;--ww-default-transition-timing-function:cubic-bezier(.4,0,.2,1);--ww-default-font-family:var(--ww-font-sans,system-ui,-apple-system,\"Segoe UI\",sans-serif);--ww-default-mono-font-family:var(--ww-font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--ww-default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--ww-default-font-feature-settings,normal);font-variation-settings:var(--ww-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--ww-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--ww-default-mono-font-feature-settings,normal);font-variation-settings:var(--ww-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.ww\\:pointer-events-auto{pointer-events:auto}.ww\\:pointer-events-none{pointer-events:none}.ww\\:absolute{position:absolute}.ww\\:fixed{position:fixed}.ww\\:relative{position:relative}.ww\\:sticky{position:sticky}.ww\\:inset-0{inset:calc(var(--ww-spacing)*0)}.ww\\:top-2{top:calc(var(--ww-spacing)*2)}.ww\\:top-full{top:100%}.ww\\:right-0{right:calc(var(--ww-spacing)*0)}.ww\\:right-2{right:calc(var(--ww-spacing)*2)}.ww\\:bottom-0{bottom:calc(var(--ww-spacing)*0)}.ww\\:bottom-2{bottom:calc(var(--ww-spacing)*2)}.ww\\:bottom-3{bottom:calc(var(--ww-spacing)*3)}.ww\\:bottom-4{bottom:calc(var(--ww-spacing)*4)}.ww\\:left-0{left:calc(var(--ww-spacing)*0)}.ww\\:left-\\[50\\%\\]{left:50%}.ww\\:isolate{isolation:isolate}.ww\\:-z-\\[1\\]{z-index:calc(1*-1)}.ww\\:z-10{z-index:10}.ww\\:z-50{z-index:50}.ww\\:z-\\[1\\]{z-index:1}.ww\\:z-\\[2147483000\\]{z-index:2147483000}.ww\\:z-\\[2147483002\\]{z-index:2147483002}.ww\\:mx-auto{margin-inline:auto}.ww\\:mt-0\\.5{margin-top:calc(var(--ww-spacing)*.5)}.ww\\:mt-1{margin-top:calc(var(--ww-spacing)*1)}.ww\\:mt-2{margin-top:calc(var(--ww-spacing)*2)}.ww\\:mt-6{margin-top:calc(var(--ww-spacing)*6)}.ww\\:mb-0{margin-bottom:calc(var(--ww-spacing)*0)}.ww\\:mb-4{margin-bottom:calc(var(--ww-spacing)*4)}.ww\\:mb-6{margin-bottom:calc(var(--ww-spacing)*6)}.ww\\:ml-3{margin-left:calc(var(--ww-spacing)*3)}.ww\\:ml-auto{margin-left:auto}.ww\\:line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.ww\\:block{display:block}.ww\\:contents{display:contents}.ww\\:flex{display:flex}.ww\\:grid{display:grid}.ww\\:hidden{display:none}.ww\\:inline-block{display:inline-block}.ww\\:inline-flex{display:inline-flex}.ww\\:field-sizing-content{field-sizing:content}.ww\\:size-2{width:calc(var(--ww-spacing)*2);height:calc(var(--ww-spacing)*2)}.ww\\:size-3{width:calc(var(--ww-spacing)*3);height:calc(var(--ww-spacing)*3)}.ww\\:size-3\\.5{width:calc(var(--ww-spacing)*3.5);height:calc(var(--ww-spacing)*3.5)}.ww\\:size-4{width:calc(var(--ww-spacing)*4);height:calc(var(--ww-spacing)*4)}.ww\\:size-5{width:calc(var(--ww-spacing)*5);height:calc(var(--ww-spacing)*5)}.ww\\:size-7{width:calc(var(--ww-spacing)*7);height:calc(var(--ww-spacing)*7)}.ww\\:size-8{width:calc(var(--ww-spacing)*8);height:calc(var(--ww-spacing)*8)}.ww\\:size-9{width:calc(var(--ww-spacing)*9);height:calc(var(--ww-spacing)*9)}.ww\\:size-10{width:calc(var(--ww-spacing)*10);height:calc(var(--ww-spacing)*10)}.ww\\:size-12{width:calc(var(--ww-spacing)*12);height:calc(var(--ww-spacing)*12)}.ww\\:size-auto{width:auto;height:auto}.ww\\:size-full{width:100%;height:100%}.ww\\:h-0\\.5{height:calc(var(--ww-spacing)*.5)}.ww\\:h-2\\.5{height:calc(var(--ww-spacing)*2.5)}.ww\\:h-5{height:calc(var(--ww-spacing)*5)}.ww\\:h-8{height:calc(var(--ww-spacing)*8)}.ww\\:h-9{height:calc(var(--ww-spacing)*9)}.ww\\:h-16{height:calc(var(--ww-spacing)*16)}.ww\\:h-auto{height:auto}.ww\\:h-full{height:100%}.ww\\:max-h-36{max-height:calc(var(--ww-spacing)*36)}.ww\\:max-h-48{max-height:calc(var(--ww-spacing)*48)}.ww\\:max-h-80{max-height:calc(var(--ww-spacing)*80)}.ww\\:min-h-0{min-height:calc(var(--ww-spacing)*0)}.ww\\:min-h-5{min-height:calc(var(--ww-spacing)*5)}.ww\\:min-h-full{min-height:100%}.ww\\:w-60{width:calc(var(--ww-spacing)*60)}.ww\\:w-72{width:calc(var(--ww-spacing)*72)}.ww\\:w-\\[calc\\(100vw-2rem\\)\\]{width:calc(100vw - 2rem)}.ww\\:w-auto{width:auto}.ww\\:w-fit{width:fit-content}.ww\\:w-full{width:100%}.ww\\:w-px{width:1px}.ww\\:\\[max-width\\:var\\(--ww-msg-max-width\\,80\\%\\)\\]{max-width:var(--ww-msg-max-width,80%)}.ww\\:max-w-3xl{max-width:var(--ww-container-3xl)}.ww\\:max-w-24{max-width:calc(var(--ww-spacing)*24)}.ww\\:max-w-32{max-width:calc(var(--ww-spacing)*32)}.ww\\:max-w-72{max-width:calc(var(--ww-spacing)*72)}.ww\\:max-w-\\[440px\\]{max-width:440px}.ww\\:max-w-\\[720px\\]{max-width:720px}.ww\\:max-w-full{max-width:100%}.ww\\:max-w-md{max-width:var(--ww-container-md)}.ww\\:max-w-sm{max-width:var(--ww-container-sm)}.ww\\:min-w-0{min-width:calc(var(--ww-spacing)*0)}.ww\\:flex-1{flex:1}.ww\\:flex-none{flex:none}.ww\\:shrink-0{flex-shrink:0}.ww\\:grow{flex-grow:1}.ww\\:translate-x-\\[-50\\%\\]{--tw-translate-x:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.ww\\:rotate-90{rotate:90deg}.ww\\:rotate-180{rotate:180deg}.ww\\:animate-\\[ww-fade-in_0\\.2s_ease-out_both\\]{animation:.2s ease-out both ww-fade-in}.ww\\:animate-pulse{animation:var(--ww-animate-pulse)}.ww\\:animate-spin{animation:var(--ww-animate-spin)}.ww\\:cursor-default{cursor:default}.ww\\:cursor-pointer{cursor:pointer}.ww\\:resize-none{resize:none}.ww\\:list-none{list-style-type:none}.ww\\:grid-rows-\\[0fr\\]{grid-template-rows:0fr}.ww\\:grid-rows-\\[1fr\\]{grid-template-rows:1fr}.ww\\:flex-col{flex-direction:column}.ww\\:flex-nowrap{flex-wrap:nowrap}.ww\\:flex-wrap{flex-wrap:wrap}.ww\\:items-center{align-items:center}.ww\\:items-end{align-items:flex-end}.ww\\:items-start{align-items:flex-start}.ww\\:justify-between{justify-content:space-between}.ww\\:justify-center{justify-content:center}.ww\\:justify-end{justify-content:flex-end}.ww\\:gap-1{gap:calc(var(--ww-spacing)*1)}.ww\\:gap-1\\.5{gap:calc(var(--ww-spacing)*1.5)}.ww\\:gap-2{gap:calc(var(--ww-spacing)*2)}.ww\\:gap-2\\.5{gap:calc(var(--ww-spacing)*2.5)}.ww\\:gap-3{gap:calc(var(--ww-spacing)*3)}.ww\\:gap-6{gap:calc(var(--ww-spacing)*6)}:where(.ww\\:space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--ww-spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--ww-spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.ww\\:space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--ww-spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--ww-spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}.ww\\:self-stretch{align-self:stretch}.ww\\:truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ww\\:overflow-auto{overflow:auto}.ww\\:overflow-hidden{overflow:hidden}.ww\\:overflow-x-auto{overflow-x:auto}.ww\\:overflow-y-auto{overflow-y:auto}.ww\\:overflow-y-hidden{overflow-y:hidden}.ww\\:\\!rounded-full{border-radius:3.40282e38px!important}.ww\\:rounded{border-radius:var(--ww-radius,16px)}.ww\\:rounded-2xl{border-radius:var(--ww-radius-2xl)}.ww\\:rounded-\\[20px\\]{border-radius:20px}.ww\\:rounded-\\[inherit\\]{border-radius:inherit}.ww\\:rounded-full{border-radius:3.40282e38px}.ww\\:rounded-lg{border-radius:var(--ww-radius-lg)}.ww\\:rounded-md{border-radius:var(--ww-radius-md)}.ww\\:rounded-none{border-radius:0}.ww\\:rounded-xl{border-radius:var(--ww-radius-xl)}.ww\\:border{border-style:var(--tw-border-style);border-width:1px}.ww\\:border-0{border-style:var(--tw-border-style);border-width:0}.ww\\:border-2{border-style:var(--tw-border-style);border-width:2px}.ww\\:border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.ww\\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.ww\\:border-dashed{--tw-border-style:dashed;border-style:dashed}.ww\\:border-none{--tw-border-style:none;border-style:none}.ww\\:border-border{border-color:var(--ww-color-border,#e5e7eb)}.ww\\:border-muted-foreground\\/50{border-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:border-muted-foreground\\/50{border-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)50%,transparent)}}.ww\\:border-primary{border-color:var(--ww-color-primary,#6366f1)}.ww\\:border-transparent{border-color:#0000}.ww\\:bg-accent{background-color:var(--ww-color-accent,#f3f4f6)}.ww\\:bg-background,.ww\\:bg-background\\/20{background-color:var(--ww-color-background,#fff)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-background\\/20{background-color:color-mix(in oklab,var(--ww-color-background,#fff)20%,transparent)}}.ww\\:bg-background\\/85{background-color:var(--ww-color-background,#fff)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-background\\/85{background-color:color-mix(in oklab,var(--ww-color-background,#fff)85%,transparent)}}.ww\\:bg-black\\/45{background-color:var(--ww-color-black)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-black\\/45{background-color:color-mix(in oklab,var(--ww-color-black)45%,transparent)}}.ww\\:bg-border{background-color:var(--ww-color-border,#e5e7eb)}.ww\\:bg-foreground,.ww\\:bg-foreground\\/5{background-color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-foreground\\/5{background-color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)5%,transparent)}}.ww\\:bg-input{background-color:var(--ww-color-input,#f9fafb)}.ww\\:bg-muted{background-color:var(--ww-color-muted,#f1f5f9)}.ww\\:bg-muted-foreground\\/60{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted-foreground\\/60{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)60%,transparent)}}.ww\\:bg-muted\\/50{background-color:var(--ww-color-muted,#f1f5f9)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted\\/50{background-color:color-mix(in oklab,var(--ww-color-muted,#f1f5f9)50%,transparent)}}.ww\\:bg-primary{background-color:var(--ww-color-primary,#6366f1)}.ww\\:bg-tool-card{background-color:var(--ww-color-tool-card,#f4f4f5)}.ww\\:bg-transparent{background-color:#0000}.ww\\:object-contain{object-fit:contain}.ww\\:object-cover{object-fit:cover}.ww\\:object-center{object-position:center}.ww\\:p-0{padding:calc(var(--ww-spacing)*0)}.ww\\:p-1{padding:calc(var(--ww-spacing)*1)}.ww\\:p-1\\.5{padding:calc(var(--ww-spacing)*1.5)}.ww\\:p-2{padding:calc(var(--ww-spacing)*2)}.ww\\:p-2\\.5{padding:calc(var(--ww-spacing)*2.5)}.ww\\:p-3{padding:calc(var(--ww-spacing)*3)}.ww\\:px-0{padding-inline:calc(var(--ww-spacing)*0)}.ww\\:px-0\\.5{padding-inline:calc(var(--ww-spacing)*.5)}.ww\\:px-1\\.5{padding-inline:calc(var(--ww-spacing)*1.5)}.ww\\:px-2{padding-inline:calc(var(--ww-spacing)*2)}.ww\\:px-3{padding-inline:calc(var(--ww-spacing)*3)}.ww\\:px-3\\.5{padding-inline:calc(var(--ww-spacing)*3.5)}.ww\\:px-4{padding-inline:calc(var(--ww-spacing)*4)}.ww\\:px-6{padding-inline:calc(var(--ww-spacing)*6)}.ww\\:\\!py-0{padding-block:calc(var(--ww-spacing)*0)!important}.ww\\:py-0\\.5{padding-block:calc(var(--ww-spacing)*.5)}.ww\\:py-1{padding-block:calc(var(--ww-spacing)*1)}.ww\\:py-1\\.5{padding-block:calc(var(--ww-spacing)*1.5)}.ww\\:py-2{padding-block:calc(var(--ww-spacing)*2)}.ww\\:py-2\\.5{padding-block:calc(var(--ww-spacing)*2.5)}.ww\\:py-3{padding-block:calc(var(--ww-spacing)*3)}.ww\\:py-6{padding-block:calc(var(--ww-spacing)*6)}.ww\\:py-12{padding-block:calc(var(--ww-spacing)*12)}.ww\\:pt-1{padding-top:calc(var(--ww-spacing)*1)}.ww\\:pt-1\\.5{padding-top:calc(var(--ww-spacing)*1.5)}.ww\\:pt-2{padding-top:calc(var(--ww-spacing)*2)}.ww\\:pt-2\\.5{padding-top:calc(var(--ww-spacing)*2.5)}.ww\\:pt-3{padding-top:calc(var(--ww-spacing)*3)}.ww\\:pr-1{padding-right:calc(var(--ww-spacing)*1)}.ww\\:pr-1\\.5{padding-right:calc(var(--ww-spacing)*1.5)}.ww\\:pr-2{padding-right:calc(var(--ww-spacing)*2)}.ww\\:pr-3{padding-right:calc(var(--ww-spacing)*3)}.ww\\:pr-9{padding-right:calc(var(--ww-spacing)*9)}.ww\\:pb-0{padding-bottom:calc(var(--ww-spacing)*0)}.ww\\:pb-1{padding-bottom:calc(var(--ww-spacing)*1)}.ww\\:pb-1\\.5{padding-bottom:calc(var(--ww-spacing)*1.5)}.ww\\:pb-2{padding-bottom:calc(var(--ww-spacing)*2)}.ww\\:pb-2\\.5{padding-bottom:calc(var(--ww-spacing)*2.5)}.ww\\:pb-3{padding-bottom:calc(var(--ww-spacing)*3)}.ww\\:pl-1{padding-left:calc(var(--ww-spacing)*1)}.ww\\:pl-3{padding-left:calc(var(--ww-spacing)*3)}.ww\\:pl-3\\.5{padding-left:calc(var(--ww-spacing)*3.5)}.ww\\:pl-4{padding-left:calc(var(--ww-spacing)*4)}.ww\\:pl-5{padding-left:calc(var(--ww-spacing)*5)}.ww\\:text-center{text-align:center}.ww\\:text-left{text-align:left}.ww\\:font-\\[family-name\\:var\\(--ww-font\\)\\]{font-family:var(--ww-font)}.ww\\:font-\\[family-name\\:var\\(--ww-font-sans\\)\\]{font-family:var(--ww-font-sans)}.ww\\:font-mono{font-family:var(--ww-font-mono)}.ww\\:text-base{font-size:var(--ww-text-base);line-height:var(--tw-leading,var(--ww-text-base--line-height))}.ww\\:text-lg{font-size:var(--ww-text-lg);line-height:var(--tw-leading,var(--ww-text-lg--line-height))}.ww\\:text-sm{font-size:var(--ww-text-sm);line-height:var(--tw-leading,var(--ww-text-sm--line-height))}.ww\\:text-xs{font-size:var(--ww-text-xs);line-height:var(--tw-leading,var(--ww-text-xs--line-height))}.ww\\:\\[font-size\\:var\\(--ww-font-size\\,1rem\\)\\]{font-size:var(--ww-font-size,1rem)}.ww\\:text-\\[10px\\]{font-size:10px}.ww\\:text-\\[11px\\]{font-size:11px}.ww\\:\\[line-height\\:var\\(--ww-line-height\\,1\\.5\\)\\]{line-height:var(--ww-line-height,1.5)}.ww\\:font-medium{--tw-font-weight:var(--ww-font-weight-medium);font-weight:var(--ww-font-weight-medium)}.ww\\:font-semibold{--tw-font-weight:var(--ww-font-weight-semibold);font-weight:var(--ww-font-weight-semibold)}.ww\\:tracking-wide{--tw-tracking:var(--ww-tracking-wide);letter-spacing:var(--ww-tracking-wide)}.ww\\:tracking-wider{--tw-tracking:var(--ww-tracking-wider);letter-spacing:var(--ww-tracking-wider)}.ww\\:break-words{overflow-wrap:break-word}.ww\\:break-all{word-break:break-all}.ww\\:text-ellipsis{text-overflow:ellipsis}.ww\\:whitespace-nowrap{white-space:nowrap}.ww\\:whitespace-pre-wrap{white-space:pre-wrap}.ww\\:text-background{color:var(--ww-color-background,#fff)}.ww\\:text-foreground,.ww\\:text-foreground\\/80{color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:text-foreground\\/80{color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)80%,transparent)}}.ww\\:text-muted-foreground{color:var(--ww-color-muted-foreground,#6b7280)}.ww\\:text-primary{color:var(--ww-color-primary,#6366f1)}.ww\\:text-primary-foreground{color:var(--ww-color-primary-foreground,#1f2937)}.ww\\:uppercase{text-transform:uppercase}.ww\\:italic{font-style:italic}.ww\\:underline{text-decoration-line:underline}.ww\\:underline-offset-2{text-underline-offset:2px}.ww\\:opacity-0{opacity:0}.ww\\:opacity-60{opacity:.6}.ww\\:opacity-70{opacity:.7}.ww\\:opacity-100{opacity:1}.ww\\:shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:ring-\\[\\#0a6c74\\]{--tw-ring-color:#0a6c74}.ww\\:backdrop-blur-md{--tw-backdrop-blur:blur(var(--ww-blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.ww\\:backdrop-blur-xl{--tw-backdrop-blur:blur(var(--ww-blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.ww\\:backdrop-saturate-150{--tw-backdrop-saturate:saturate(150%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.ww\\:transition-\\[grid-template-rows\\,opacity\\]{transition-property:grid-template-rows,opacity;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-\\[max-width\\]{transition-property:max-width;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-\\[width\\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:duration-150{--tw-duration:.15s;transition-duration:.15s}.ww\\:duration-200{--tw-duration:.2s;transition-duration:.2s}.ww\\:duration-300{--tw-duration:.3s;transition-duration:.3s}.ww\\:ease-out{--tw-ease:var(--ww-ease-out);transition-timing-function:var(--ww-ease-out)}.ww\\:outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.ww\\:group-hover\\:opacity-0:is(:where(.ww\\:group):hover *){opacity:0}.ww\\:group-hover\\:opacity-100:is(:where(.ww\\:group):hover *){opacity:1}}.ww\\:group-\\[\\.is-assistant\\]\\:text-foreground:is(:where(.ww\\:group).is-assistant *){color:var(--ww-color-foreground,#1f2937)}.ww\\:group-\\[\\.is-user\\]\\:ml-auto:is(:where(.ww\\:group).is-user *){margin-left:auto}.ww\\:group-\\[\\.is-user\\]\\:\\[border-radius\\:var\\(--ww-msg-radius\\,8px\\)\\]:is(:where(.ww\\:group).is-user *){border-radius:var(--ww-msg-radius,8px)}.ww\\:group-\\[\\.is-user\\]\\:bg-user-bubble:is(:where(.ww\\:group).is-user *){background-color:var(--ww-color-user-bubble,#f4f4f4)}.ww\\:group-\\[\\.is-user\\]\\:\\[padding\\:var\\(--ww-msg-pad-y\\,12px\\)_var\\(--ww-msg-pad-x\\,16px\\)\\]:is(:where(.ww\\:group).is-user *){padding:var(--ww-msg-pad-y,12px)var(--ww-msg-pad-x,16px)}.ww\\:group-\\[\\.is-user\\]\\:\\[color\\:var\\(--ww-color-user-bubble-text\\)\\]:is(:where(.ww\\:group).is-user *){color:var(--ww-color-user-bubble-text)}.ww\\:placeholder\\:overflow-hidden::placeholder{overflow:hidden}.ww\\:placeholder\\:text-ellipsis::placeholder{text-overflow:ellipsis}.ww\\:placeholder\\:text-muted-foreground::placeholder{color:var(--ww-color-muted-foreground,#6b7280)}@media (hover:hover){.ww\\:hover\\:border-primary\\/30:hover{border-color:var(--ww-color-primary,#6366f1)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:border-primary\\/30:hover{border-color:color-mix(in oklab,var(--ww-color-primary,#6366f1)30%,transparent)}}.ww\\:hover\\:bg-accent:hover{background-color:var(--ww-color-accent,#f3f4f6)}.ww\\:hover\\:bg-border:hover{background-color:var(--ww-color-border,#e5e7eb)}.ww\\:hover\\:bg-foreground:hover{background-color:var(--ww-color-foreground,#1f2937)}.ww\\:hover\\:bg-muted:hover{background-color:var(--ww-color-muted,#f1f5f9)}.ww\\:hover\\:bg-muted-foreground\\/10:hover{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:bg-muted-foreground\\/10:hover{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)10%,transparent)}}.ww\\:hover\\:bg-primary\\/90:hover{background-color:var(--ww-color-primary,#6366f1)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab,var(--ww-color-primary,#6366f1)90%,transparent)}}.ww\\:hover\\:text-accent-foreground:hover{color:var(--ww-color-accent-foreground,#1f2937)}.ww\\:hover\\:text-foreground:hover{color:var(--ww-color-foreground,#1f2937)}.ww\\:hover\\:underline:hover{text-decoration-line:underline}}.ww\\:disabled\\:pointer-events-none:disabled{pointer-events:none}.ww\\:disabled\\:opacity-40:disabled{opacity:.4}.ww\\:disabled\\:opacity-50:disabled{opacity:.5}@media (min-width:40rem){.ww\\:sm\\:inset-auto{inset:auto}.ww\\:sm\\:right-0{right:calc(var(--ww-spacing)*0)}.ww\\:sm\\:bottom-4{bottom:calc(var(--ww-spacing)*4)}.ww\\:sm\\:left-0{left:calc(var(--ww-spacing)*0)}.ww\\:sm\\:mx-auto{margin-inline:auto}.ww\\:sm\\:h-\\[720px\\]{height:720px}.ww\\:sm\\:max-h-\\[calc\\(100dvh-2rem\\)\\]{max-height:calc(100dvh - 2rem)}.ww\\:sm\\:w-\\[calc\\(100vw-2rem\\)\\]{width:calc(100vw - 2rem)}.ww\\:sm\\:max-w-\\[1000px\\]{max-width:1000px}.ww\\:sm\\:rounded-2xl{border-radius:var(--ww-radius-2xl)}.ww\\:sm\\:border{border-style:var(--tw-border-style);border-width:1px}.ww\\:sm\\:border-border{border-color:var(--ww-color-border,#e5e7eb)}.ww\\:sm\\:py-2{padding-block:calc(var(--ww-spacing)*2)}.ww\\:sm\\:py-3{padding-block:calc(var(--ww-spacing)*3)}.ww\\:sm\\:pr-2{padding-right:calc(var(--ww-spacing)*2)}.ww\\:sm\\:pr-2\\.5{padding-right:calc(var(--ww-spacing)*2.5)}.ww\\:sm\\:pl-4{padding-left:calc(var(--ww-spacing)*4)}.ww\\:sm\\:pl-6{padding-left:calc(var(--ww-spacing)*6)}.ww\\:sm\\:text-sm{font-size:var(--ww-text-sm);line-height:var(--tw-leading,var(--ww-text-sm--line-height))}.ww\\:sm\\:text-\\[11px\\]{font-size:11px}}.ww\\:\\[\\&\\>\\*\\:first-child\\]\\:mt-0>:first-child{margin-top:calc(var(--ww-spacing)*0)}.ww\\:\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:calc(var(--ww-spacing)*0)}}@keyframes ww-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes ww-fade-out{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@keyframes ww-pulse{0%,80%,to{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}}@keyframes ww-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){[data-waniwani-chat] [data-waniwani-shimmer]{color:var(--ww-color-muted-foreground)!important;animation:none!important}}[data-waniwani-floating=dock]{transition:opacity .32s,transform .42s cubic-bezier(.22,1,.36,1),max-width .3s,visibility 0s linear .42s}[data-waniwani-floating=dock][data-appeared=true][data-state=shown]{visibility:visible;opacity:1;pointer-events:auto;transition:opacity .32s,transform .42s cubic-bezier(.22,1,.36,1),max-width .3s,visibility;transform:translateY(0)}[data-waniwani-floating=dock][data-appeared=false],[data-waniwani-floating=dock][data-state=hidden]{opacity:0;visibility:hidden;pointer-events:none;transform:translateY(1rem)}[data-waniwani-floating=panel]{transition:clip-path .44s cubic-bezier(.22,1,.36,1),opacity .26s,visibility 0s linear .44s}[data-waniwani-floating=panel][data-state=shown]{visibility:visible;opacity:1;pointer-events:auto;clip-path:inset(-40px round 18px);transition:clip-path .44s cubic-bezier(.22,1,.36,1),opacity .26s,visibility}[data-waniwani-floating=panel][data-state=hidden]{opacity:0;visibility:hidden;pointer-events:none;clip-path:inset(calc(100% - 60px) 12% 0 round 24px)}@media (max-width:639px){[data-waniwani-floating=panel][data-state=shown]{clip-path:inset(0)}[data-waniwani-floating=panel][data-state=hidden]{clip-path:inset(calc(100% - 72px) 6% 0 round 22px)}}@media (prefers-reduced-motion:reduce){[data-waniwani-floating=dock],[data-waniwani-floating=panel]{clip-path:none;transition:visibility 0s linear 10ms}[data-waniwani-floating=dock][data-appeared=true][data-state=shown],[data-waniwani-floating=panel][data-state=shown]{transition:visibility}}[data-waniwani-chat] ::-webkit-scrollbar{width:8px}[data-waniwani-chat] ::-webkit-scrollbar-track{background:0 0}[data-waniwani-chat] ::-webkit-scrollbar-thumb{background:var(--ww-color-border);border-radius:9999px}[data-waniwani-chat] ::-webkit-scrollbar-thumb:hover{background:var(--ww-color-muted-foreground)}[data-waniwani-chat] *{scrollbar-width:thin;scrollbar-color:var(--ww-color-border)transparent}[data-waniwani-chat]{--ww-color-background:var(--ww-bg,#fff);--ww-color-foreground:var(--ww-text,#1f2937);--ww-color-primary:var(--ww-primary,#6366f1);--ww-color-primary-foreground:var(--ww-primary-fg,#1f2937);--ww-color-muted-foreground:var(--ww-muted,#6b7280);--ww-color-border:var(--ww-border,#e5e7eb);--ww-color-input:var(--ww-input-bg,#f9fafb);--ww-color-accent:var(--ww-assistant-bubble,#f3f4f6);--ww-color-accent-foreground:var(--ww-text,#1f2937);--ww-color-user-bubble:var(--ww-user-bubble,#f4f4f4);--ww-color-card:var(--ww-bg,#fff);--ww-color-card-foreground:var(--ww-text,#1f2937);--ww-color-card-header:var(--ww-header-bg,#fff);--ww-color-card-header-foreground:var(--ww-header-text,#1f2937);--ww-color-status:var(--ww-status,#22c55e);--ww-color-tool-card:var(--ww-tool-card,#f4f4f5);--ww-radius:var(--ww-radius,16px);--ww-font-sans:var(--ww-font,system-ui,-apple-system,\"Segoe UI\",sans-serif);--ww-color-user-bubble-text:var(--ww-user-bubble-text,var(--ww-color-primary-foreground));--ww-color-assistant-bubble-text:var(--ww-assistant-bubble-text,var(--ww-color-foreground));--ww-glass:var(--ww-glass-tint,transparent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat]{--ww-glass:color-mix(in srgb,var(--ww-glass-tint,transparent)calc(var(--ww-glass-tint-opacity,0)*100%),#eceef499)}}[data-waniwani-chat]{--ww-glass-border:#0000000f;border-style:solid;border-width:var(--ww-border-width,0);border-color:var(--ww-color-border);box-shadow:var(--ww-shadow,none)}[data-waniwani-chat][data-assistant-bubble=true] .ww-message-assistant .ww-bubble{background:var(--ww-color-accent);color:var(--ww-color-assistant-bubble-text);border-radius:var(--ww-msg-radius,8px);padding:var(--ww-msg-pad-y,12px)var(--ww-msg-pad-x,16px);width:fit-content;max-width:var(--ww-msg-max-width,80%)}.dark [data-waniwani-chat],[data-waniwani-chat].dark{--ww-color-background:var(--ww-bg,#212121);--ww-color-foreground:var(--ww-text,#ececec);--ww-color-primary:var(--ww-primary,#6366f1);--ww-color-primary-foreground:var(--ww-primary-fg,#fff);--ww-color-muted-foreground:var(--ww-muted,#8e8ea0);--ww-color-border:var(--ww-border,#444);--ww-color-input:var(--ww-input-bg,#2f2f2f);--ww-color-accent:var(--ww-assistant-bubble,#2f2f2f);--ww-color-accent-foreground:var(--ww-text,#ececec);--ww-color-user-bubble:var(--ww-user-bubble,#303030);--ww-color-card:var(--ww-bg,#212121);--ww-color-card-foreground:var(--ww-text,#ececec);--ww-color-card-header:var(--ww-header-bg,#1e1e1e);--ww-color-card-header-foreground:var(--ww-header-text,#ececec);--ww-color-status:var(--ww-status,#22c55e);--ww-color-tool-card:var(--ww-tool-card,#262626);--ww-color-user-bubble-text:var(--ww-user-bubble-text,#fff);--ww-color-assistant-bubble-text:var(--ww-assistant-bubble-text,var(--ww-color-foreground));--ww-glass:var(--ww-glass-tint,transparent)}@supports (color:color-mix(in lab, red, red)){.dark [data-waniwani-chat],[data-waniwani-chat].dark{--ww-glass:color-mix(in srgb,var(--ww-glass-tint,transparent)calc(var(--ww-glass-tint-opacity,0)*100%),#282a3480)}}.dark [data-waniwani-chat],[data-waniwani-chat].dark{--ww-glass-border:#ffffff1f}@media (prefers-color-scheme:dark){[data-waniwani-chat][data-color-scheme=auto]{--ww-color-background:var(--ww-bg,#212121);--ww-color-foreground:var(--ww-text,#ececec);--ww-color-primary:var(--ww-primary,#6366f1);--ww-color-primary-foreground:var(--ww-primary-fg,#fff);--ww-color-muted-foreground:var(--ww-muted,#8e8ea0);--ww-color-border:var(--ww-border,#444);--ww-color-input:var(--ww-input-bg,#2f2f2f);--ww-color-accent:var(--ww-assistant-bubble,#2f2f2f);--ww-color-accent-foreground:var(--ww-text,#ececec);--ww-color-user-bubble:var(--ww-user-bubble,#303030);--ww-color-card:var(--ww-bg,#212121);--ww-color-card-foreground:var(--ww-text,#ececec);--ww-color-card-header:var(--ww-header-bg,#1e1e1e);--ww-color-card-header-foreground:var(--ww-header-text,#ececec);--ww-color-status:var(--ww-status,#22c55e);--ww-color-tool-card:var(--ww-tool-card,#262626);--ww-color-user-bubble-text:var(--ww-user-bubble-text,#fff);--ww-color-assistant-bubble-text:var(--ww-assistant-bubble-text,var(--ww-color-foreground));--ww-glass:var(--ww-glass-tint,transparent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat][data-color-scheme=auto]{--ww-glass:color-mix(in srgb,var(--ww-glass-tint,transparent)calc(var(--ww-glass-tint-opacity,0)*100%),#282a3480)}}[data-waniwani-chat][data-color-scheme=auto]{--ww-glass-border:#ffffff1f}}[data-waniwani-chat] [data-streamdown=table-wrapper]{flex-direction:column;gap:.5rem;margin-top:1rem;margin-bottom:1rem;display:flex}[data-waniwani-chat] [data-streamdown=table-wrapper]>div:first-child:has(button){justify-content:flex-end;align-items:center;gap:.25rem;display:flex}[data-waniwani-chat] [data-streamdown=table-wrapper]>div:last-child{overflow-x:auto}[data-waniwani-chat] [data-streamdown=table]{border-collapse:collapse;border:1px solid var(--ww-color-border);border-radius:.75rem;width:100%;overflow:hidden}[data-waniwani-chat] [data-streamdown=table-header]{background-color:var(--ww-color-accent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=table-header]{background-color:color-mix(in srgb,var(--ww-color-accent)80%,transparent)}}[data-waniwani-chat] [data-streamdown=table-body]{background-color:var(--ww-color-accent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=table-body]{background-color:color-mix(in srgb,var(--ww-color-accent)40%,transparent)}}[data-waniwani-chat] [data-streamdown=table-body]>tr+tr{border-top:1px solid var(--ww-color-border)}[data-waniwani-chat] [data-streamdown=table-row]{border-bottom:1px solid var(--ww-color-border)}[data-waniwani-chat] [data-streamdown=table-header-cell]{white-space:nowrap;text-align:left;padding:.5rem 1rem;font-size:.875rem;font-weight:600}[data-waniwani-chat] [data-streamdown=table-cell]{padding:.5rem 1rem;font-size:.875rem}[data-waniwani-chat] [data-streamdown=link]{color:var(--ww-color-primary);overflow-wrap:anywhere;cursor:pointer;font-weight:500;text-decoration:underline}[data-waniwani-chat].dark [data-streamdown=link],.dark [data-waniwani-chat] [data-streamdown=link]{color:var(--ww-color-primary)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat].dark [data-streamdown=link],.dark [data-waniwani-chat] [data-streamdown=link]{color:color-mix(in oklab,var(--ww-color-primary)55%,white)}}@media (prefers-color-scheme:dark){[data-waniwani-chat][data-color-scheme=auto] [data-streamdown=link]{color:var(--ww-color-primary)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat][data-color-scheme=auto] [data-streamdown=link]{color:color-mix(in oklab,var(--ww-color-primary)55%,white)}}}[data-waniwani-chat].dark [data-waniwani-logo],.dark [data-waniwani-chat] [data-waniwani-logo]{filter:invert()}@media (prefers-color-scheme:dark){[data-waniwani-chat][data-color-scheme=auto] [data-waniwani-logo]{filter:invert()}}[data-waniwani-chat] [data-streamdown=link-safety-modal]{z-index:50;background-color:var(--ww-color-background);justify-content:center;align-items:center;display:flex;position:fixed;inset:0}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=link-safety-modal]{background-color:color-mix(in srgb,var(--ww-color-background)50%,transparent)}}[data-waniwani-chat] [data-streamdown=link-safety-modal]{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div{border:1px solid var(--ww-color-border);background-color:var(--ww-color-background);width:100%;max-width:28rem;color:var(--ww-color-foreground);border-radius:.75rem;flex-direction:column;gap:1rem;margin:0 1rem;padding:1.5rem;display:flex;position:relative;box-shadow:0 10px 25px #0000001a}[data-waniwani-chat] [data-streamdown=link-safety-modal] button{cursor:pointer}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>button:first-child{color:var(--ww-color-muted-foreground);background:0 0;border:none;border-radius:.375rem;padding:.25rem;transition:background-color .15s,color .15s;position:absolute;top:1rem;right:1rem}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>button:first-child:hover{background-color:var(--ww-color-accent);color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type{flex-direction:column;gap:.5rem;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type>div{align-items:center;gap:.5rem;font-size:1.125rem;font-weight:600;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type>p{color:var(--ww-color-muted-foreground);font-size:.875rem}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:nth-child(3){word-break:break-all;background-color:var(--ww-color-accent);border-radius:.375rem;max-height:8rem;padding:.75rem;font-family:ui-monospace,monospace;font-size:.875rem;overflow-y:auto}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child{gap:.5rem;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button{border:none;border-radius:.375rem;flex:1;justify-content:center;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.875rem;font-weight:500;transition:background-color .15s;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:first-child{border:1px solid var(--ww-color-border);background-color:var(--ww-color-background);color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:first-child:hover{background-color:var(--ww-color-accent)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:last-child{background-color:var(--ww-color-primary);color:#fff}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:last-child:hover{opacity:.9}[data-waniwani-chat] [data-streamdown=ordered-list]{white-space:normal;list-style-type:decimal;list-style-position:inside}[data-waniwani-chat] li [data-streamdown=ordered-list]{padding-left:1.5rem}[data-waniwani-chat] [data-streamdown=unordered-list]{white-space:normal;list-style-type:disc;list-style-position:inside}[data-waniwani-chat] li [data-streamdown=unordered-list]{padding-left:1.5rem}[data-waniwani-chat] [data-streamdown=list-item]{padding-top:.25rem;padding-bottom:.25rem}[data-waniwani-chat] [data-streamdown=list-item]>p{display:inline}[data-waniwani-chat] [data-streamdown=inline-code]{background-color:var(--ww-color-accent);border-radius:.25rem;padding:.125rem .375rem;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,monospace;font-size:.875rem}[data-waniwani-chat] [data-streamdown=heading-1]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.875rem;font-weight:600;line-height:2.25rem}[data-waniwani-chat] [data-streamdown=heading-2]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.5rem;font-weight:600;line-height:2rem}[data-waniwani-chat] [data-streamdown=heading-3]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.25rem;font-weight:600;line-height:1.75rem}[data-waniwani-chat] [data-streamdown=heading-4]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.125rem;font-weight:600;line-height:1.75rem}[data-waniwani-chat] [data-streamdown=heading-5]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1rem;font-weight:600;line-height:1.5rem}[data-waniwani-chat] [data-streamdown=heading-6]{margin-top:1.5rem;margin-bottom:.5rem;font-size:.875rem;font-weight:600;line-height:1.25rem}[data-waniwani-chat] [data-streamdown=blockquote]{border-left:4px solid var(--ww-color-muted-foreground);margin-top:1rem;margin-bottom:1rem}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=blockquote]{border-left:4px solid color-mix(in srgb,var(--ww-color-muted-foreground)30%,transparent)}}[data-waniwani-chat] [data-streamdown=blockquote]{color:var(--ww-color-muted-foreground);padding-left:1rem;font-style:italic}[data-waniwani-chat] [data-streamdown=horizontal-rule]{border-color:var(--ww-color-border);margin-top:1.5rem;margin-bottom:1.5rem}[data-waniwani-chat] [data-streamdown=strong]{font-weight:600}[data-waniwani-chat] [data-streamdown=image-wrapper]{margin-top:1rem;margin-bottom:1rem;display:inline-block;position:relative}[data-waniwani-chat] [data-streamdown=image]{border-radius:.5rem;max-width:100%}[data-waniwani-chat] [data-streamdown=code-block]{border:1px solid var(--ww-color-border);border-radius:.75rem;width:100%;margin-top:1rem;margin-bottom:1rem;overflow:hidden}[data-waniwani-chat] [data-streamdown=code-block-header]{background-color:var(--ww-color-accent);justify-content:space-between;align-items:center;display:flex}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=code-block-header]{background-color:color-mix(in srgb,var(--ww-color-accent)80%,transparent)}}[data-waniwani-chat] [data-streamdown=code-block-header]{color:var(--ww-color-muted-foreground);padding:.75rem;font-size:.75rem}[data-waniwani-chat] [data-streamdown=code-block-body]{padding:1rem;font-size:.875rem;overflow-x:auto}[data-waniwani-chat] [data-streamdown=code-block-copy-button],[data-waniwani-chat] [data-streamdown=code-block-download-button]{cursor:pointer;color:var(--ww-color-muted-foreground);background:0 0;border:none;padding:.25rem;transition:color .15s}[data-waniwani-chat] [data-streamdown=code-block-copy-button]:hover,[data-waniwani-chat] [data-streamdown=code-block-download-button]:hover{color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=mermaid-block]{border:1px solid var(--ww-color-border);border-radius:.75rem;height:auto;margin-top:1rem;margin-bottom:1rem;padding:1rem;position:relative}[data-waniwani-chat] [data-streamdown=mermaid]{width:100%;height:100%}@property --tw-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\"*\";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-tracking{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-backdrop-blur{syntax:\"*\";inherits:false}@property --tw-backdrop-brightness{syntax:\"*\";inherits:false}@property --tw-backdrop-contrast{syntax:\"*\";inherits:false}@property --tw-backdrop-grayscale{syntax:\"*\";inherits:false}@property --tw-backdrop-hue-rotate{syntax:\"*\";inherits:false}@property --tw-backdrop-invert{syntax:\"*\";inherits:false}@property --tw-backdrop-opacity{syntax:\"*\";inherits:false}@property --tw-backdrop-saturate{syntax:\"*\";inherits:false}@property --tw-backdrop-sepia{syntax:\"*\";inherits:false}@property --tw-duration{syntax:\"*\";inherits:false}@property --tw-ease{syntax:\"*\";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}";function QY(e){return e.startsWith("__WANIWANI")}function Gh(e){if(!c0||QY(c0))return;let t=document.createElement("style");t.textContent=c0,e.appendChild(t)}var je=j(Ee(),1);var Xh=j(Ee(),1),eZ=3e3,tZ=120,aZ=24;function jB(e){let[t,a]=(0,Xh.useState)(!1);return(0,Xh.useEffect)(()=>{if(!e||typeof document>"u"){a(!1);return}let n=!1,r=null,o=null,i=null,s=u=>{r=new IntersectionObserver(c=>{let d=c[0];d&&a(!d.isIntersecting&&d.boundingClientRect.bottom<=0)},{rootMargin:`0px 0px -${aZ}px 0px`,threshold:0}),r.observe(u)},l=()=>{if(n)return;let u=null;try{u=document.querySelector(e)}catch{a(!0);return}if(u){s(u);return}o=setTimeout(l,tZ)};return l(),i=setTimeout(()=>{n||r||(o&&clearTimeout(o),a(!0))},eZ),()=>{n=!0,r?.disconnect(),o&&clearTimeout(o),i&&clearTimeout(i)}},[e]),t}var Mt=j(me(),1),nZ=2e3,rZ=90,oZ=1e3,VB=(0,je.forwardRef)(function(t,a){return(0,Mt.jsx)(es,{locale:t.config.locale,children:(0,Mt.jsx)(iZ,{...t,ref:a})})}),iZ=(0,je.forwardRef)(function({config:t,programmatic:a,scriptConfig:n},r){let{t:o}=Ue(),{config:i,ready:s}=yu(t,a,n),l=hu(i.visibility,s),u=Jd(),c=l?DB(i.visibility,u):null,d=jB(c),p=(0,je.useRef)(null),m=(0,je.useMemo)(()=>su({mode:"floating",getSessionId:()=>p.current?.sessionId}),[]),h=i.onEvent;(0,je.useEffect)(()=>{if(h)return m.subscribe(h)},[h,m]);let v=(0,je.useRef)(null),I=(0,je.useRef)(null),y=(0,je.useRef)(!1),[w,g]=(0,je.useState)("input"),[S,E]=(0,je.useState)(""),[T,R]=(0,je.useState)(!1),[O,U]=(0,je.useState)(!1),[A,Q]=(0,je.useState)(0),$=i.appearance?.theme,H=i.appearance?.variables,Z=(0,je.useMemo)(()=>H?pu(H):{},[H]),X=gu(i),B=(0,je.useMemo)(()=>Ss({flow:null,followup:null,...X}),[X]),P=(0,je.useMemo)(()=>B?.suggestions.map(ie=>ie.text)??[],[B]);Fl({widgetEvents:m,api:i.api,token:i.token,channelId:i.channelId,source:i.source,mode:"floating",pagePrompts:X.page,getSessionId:()=>p.current?.sessionId});let J=(0,je.useRef)(null);(0,je.useEffect)(()=>{!O||!B||J.current!==B&&(J.current=B,m.emit({name:"suggestions.shown",properties:{texts:P,origin:B.origin}}))},[O,B,P,m]);let ge=i.launcherText??i.placeholder??o.launcher.prompt,C=Hl(ge,S.length===0),ze="var(--ww-shadow, 0 10px 30px rgba(0, 0, 0, 0.08))";(0,je.useEffect)(()=>{if(!l){R(!1);return}if(c){R(d);return}let ie=i.appearDelay??nZ,xe=setTimeout(()=>R(!0),Math.max(0,ie));return()=>clearTimeout(xe)},[l,i.appearDelay,c,d]),(0,je.useEffect)(()=>{if(!T||P.length===0)return;let ie=setTimeout(()=>{y.current||g(xe=>xe==="input"?"expanded":xe)},oZ);return()=>clearTimeout(ie)},[T,P.length]),(0,je.useEffect)(()=>{A>0&&w==="open"&&p.current?.focus()},[A,w]);let ot=(0,je.useRef)(!1);(0,je.useEffect)(()=>{s&&!ot.current&&(ot.current=!0,m.emit({name:"chat.ready"}))},[s,m]),ru({api:i.api,token:i.token,channelId:i.channelId,mode:"floating",paintMark:"launcherPainted",painted:s&&l});let x=(0,je.useRef)(!1);(0,je.useEffect)(()=>{let ie=l&&w==="open";ie!==x.current&&(x.current=ie,m.emit({name:ie?"chat.opened":"chat.closed"}))},[l,w,m]);let te=(0,je.useCallback)(()=>{g("open")},[]),re=(0,je.useCallback)(()=>{y.current=!0,g("input")},[]);(0,je.useEffect)(()=>{if(w!=="expanded"){U(!1);return}let ie=setTimeout(()=>U(!0),rZ);return()=>clearTimeout(ie)},[w]);let ke=(0,je.useCallback)(ie=>{te();let xe=ie.trim();xe&&p.current?.sendMessage(xe)},[te]);(0,je.useImperativeHandle)(r,()=>({open:()=>te(),close:()=>re(),toggle:()=>{g(ie=>ie==="open"?"input":"open")},sendMessage:ie=>ke(ie),sendMessageAndWait:async ie=>{te();let xe=p.current;if(xe)return await xe.sendMessageAndWait(ie)},reset:()=>p.current?.reset(),focus:()=>{te(),Q(ie=>ie+1)},getMessages:()=>p.current?.messages??[],getSessionId:()=>p.current?.sessionId}),[ke,te,re]);let We=(0,je.useCallback)(()=>{S.trim()&&(ke(S),E(""))},[S,ke]),be=(0,je.useCallback)(()=>{(p.current?.messages.length??0)>0?(g("open"),Q(ie=>ie+1)):(y.current=!1,g(ie=>ie==="input"?"expanded":ie))},[]),Oe={mode:"floating"},we=zl(i.sessionApi);i.mcpServerUrl&&(Oe.mcpServerUrl=i.mcpServerUrl),i.channelId&&(Oe.channelId=i.channelId);let ce=P.length>0&&w!=="input",Le=(0,Mt.jsx)("button",{type:"button",onClick:re,"aria-label":o.launcher.close,className:"ww:flex ww:size-7 ww:items-center ww:justify-center ww:rounded-md ww:text-muted-foreground ww:transition-colors hover:ww:bg-accent hover:ww:text-foreground ww:cursor-pointer",children:(0,Mt.jsx)(wn,{className:"ww:size-4"})});return(0,Mt.jsx)(lu,{value:m,children:(0,Mt.jsx)("div",{"data-waniwani-chat":"","data-color-scheme":$==="auto"?"auto":void 0,className:V("ww:contents ww:font-[family-name:var(--ww-font-sans)]",$==="dark"&&"dark"),style:Z,children:l&&(0,Mt.jsxs)(Mt.Fragment,{children:[(0,Mt.jsx)("div",{ref:I,"data-waniwani-floating":"dock","data-state":w==="open"?"hidden":"shown","data-appeared":T?"true":"false",className:V("ww:fixed ww:bottom-3 ww:sm:bottom-4 ww:left-0 ww:right-0 ww:mx-auto ww:z-[2147483002] ww:flex ww:flex-col","ww:w-[calc(100vw-2rem)] ww:transition-[max-width] ww:duration-300 ww:ease-out",ce?"ww:max-w-[720px]":"ww:max-w-[440px]"),children:(0,Mt.jsxs)("div",{className:V("ww:relative ww:flex ww:flex-col ww:rounded-[20px] ww:border ww:transition-all ww:duration-300 ww:ease-out",ce?"ww:p-2 ww:backdrop-blur-xl ww:backdrop-saturate-150":"ww:border-transparent ww:p-0"),style:ce?{boxShadow:ze,backgroundColor:"var(--ww-glass)",borderColor:"var(--ww-glass-border)"}:void 0,children:[ce&&w!=="open"&&(0,Mt.jsx)("button",{type:"button",onClick:re,"aria-label":o.launcher.close,className:"ww:absolute ww:right-2 ww:top-2 ww:z-10 ww:flex ww:size-7 ww:items-center ww:justify-center ww:rounded-md ww:text-muted-foreground ww:transition-colors hover:ww:bg-accent hover:ww:text-foreground ww:cursor-pointer",children:(0,Mt.jsx)(wn,{className:"ww:size-4"})}),P.length>0&&(0,Mt.jsx)("div",{className:V("ww:grid ww:transition-all ww:duration-300 ww:ease-out",O?"ww:grid-rows-[1fr] ww:opacity-100":"ww:pointer-events-none ww:grid-rows-[0fr] ww:opacity-0"),children:(0,Mt.jsx)("div",{className:"ww:overflow-hidden",children:(0,Mt.jsx)(Sl,{suggestions:P,onSelect:ie=>{m.emit({name:"suggestion.clicked",properties:{text:ie,index:P.indexOf(ie),origin:B?.origin??"channel"}}),ke(ie)},className:"ww:pl-1 ww:pr-9 ww:pt-1 ww:pb-2.5"})})}),(0,Mt.jsx)(Yp,{animated:T,backgroundColor:"var(--ww-color-input)",borderRadius:16,edgeSensitivity:30,coneSpread:25,colors:["#c084fc","#f472b6","#38bdf8"],className:"ww:border-border",style:{boxShadow:ze},children:(0,Mt.jsxs)("div",{className:"ww:flex ww:items-center ww:gap-1 ww:pl-3.5 ww:pr-1.5 ww:py-1.5 ww:sm:pl-4 ww:sm:pr-2 ww:sm:py-2",children:[(0,Mt.jsx)("input",{ref:v,type:"text",value:S,placeholder:C,onChange:ie=>E(ie.target.value),onFocus:be,onKeyDown:ie=>{ie.key==="Enter"&&!ie.shiftKey&&(ie.preventDefault(),We())},className:"ww:min-w-0 ww:flex-1 ww:bg-transparent ww:py-1 ww:text-base ww:sm:text-sm ww:text-foreground ww:outline-none ww:placeholder:text-muted-foreground"}),(0,Mt.jsx)("button",{type:"button",onClick:We,disabled:!S.trim(),"aria-label":o.promptInput.submit,className:"ww:relative ww:flex ww:size-8 ww:shrink-0 ww:items-center ww:justify-center ww:rounded-full ww:bg-foreground ww:text-background ww:transition-opacity hover:ww:opacity-90 disabled:ww:opacity-40",children:(0,Mt.jsx)(pr,{className:"ww:size-4"})})]})})]})}),(0,Mt.jsx)("div",{role:"dialog","aria-label":i.title??ge,"data-waniwani-floating":"panel","data-state":w==="open"?"shown":"hidden",style:{boxShadow:ze},className:V("ww:fixed ww:z-[2147483002] ww:flex ww:flex-col ww:overflow-hidden ww:bg-background","ww:inset-0 ww:w-full ww:rounded-none","ww:sm:inset-auto ww:sm:bottom-4 ww:sm:left-0 ww:sm:right-0 ww:sm:mx-auto ww:sm:h-[720px] ww:sm:max-h-[calc(100dvh-2rem)] ww:sm:w-[calc(100vw-2rem)] ww:sm:max-w-[1000px] ww:sm:rounded-2xl ww:sm:border ww:sm:border-border"),children:(0,Mt.jsx)(mu,{transport:we,ref:p,api:i.api??"",headers:{Authorization:`Bearer ${i.token}`},skipRemoteConfig:!0,body:Oe,appearance:i.appearance,title:i.title,headerActions:Le,hideHeader:!1,onScreen:w==="open",welcomeMessage:i.welcomeMessage,placeholder:i.placeholder,suggestions:X,enableThreadHistory:i.enableThreadHistory,documentUpload:i.documentUpload,showToolCalls:i.showToolCalls,locale:i.locale,initializing:!s})})]})})})});var rn=j(Ee(),1);var d0=j(me(),1),$B=(0,rn.forwardRef)(function({config:t,programmatic:a,scriptConfig:n,onReady:r,onVisibilityChange:o},i){let{config:s,ready:l}=yu(t,a,n),u=(0,rn.useRef)(null),c=(0,rn.useMemo)(()=>su({mode:"inline",getSessionId:()=>u.current?.sessionId}),[]),d=s.onEvent;(0,rn.useEffect)(()=>{if(d)return c.subscribe(d)},[d,c]);let p=(0,rn.useRef)(!1);(0,rn.useEffect)(()=>{l&&!p.current&&(p.current=!0,c.emit({name:"chat.ready"}))},[l,c]),(0,rn.useEffect)(()=>{r?.()},[]);let m=hu(s.visibility,l);(0,rn.useEffect)(()=>{o?.(m)},[m,o]),ru({api:s.api,token:s.token,channelId:s.channelId,mode:"inline",paintMark:"chatVisible",painted:l}),(0,rn.useImperativeHandle)(i,()=>({get chat(){return u.current}}),[]);let h=gu(s);Fl({widgetEvents:c,api:s.api,token:s.token,channelId:s.channelId,source:s.source,mode:"inline",pagePrompts:h.page,getSessionId:()=>u.current?.sessionId});let v={mode:"inline"},I=zl(s.sessionApi);return s.mcpServerUrl&&(v.mcpServerUrl=s.mcpServerUrl),s.channelId&&(v.channelId=s.channelId),(0,d0.jsx)(lu,{value:c,children:(0,d0.jsx)(mu,{transport:I,ref:u,api:s.api??"",headers:{Authorization:`Bearer ${s.token}`},skipRemoteConfig:!0,body:v,appearance:s.appearance,title:s.title,hideHeader:s.hideHeader,welcomeMessage:s.welcomeMessage,placeholder:s.placeholder,suggestions:h,enableThreadHistory:s.enableThreadHistory,documentUpload:s.documentUpload,showToolCalls:s.showToolCalls,locale:s.locale,initializing:!l})})});var ef=j(Ee(),1),JB=j(qw(),1);function WB(){if(typeof document>"u"&&typeof navigator>"u")return null;let e=(typeof document<"u"?document.modelContext:void 0)??(typeof navigator<"u"?navigator.modelContext:void 0);return e&&typeof e.registerTool=="function"?e:null}function f0(){return WB()!==null}function sZ(){return{url:location.href,title:document.title}}async function p0(e){let{endpoint:t,listEndpoint:a,headers:n,sessionId:r,visitorId:o,channelId:i,onWidget:s}=e,l=e.logger??console,u=WB();if(!u)return null;let c=new AbortController,d=()=>c.abort();window.addEventListener("pagehide",d);let p=!1,m=()=>{p||(p=!0,window.removeEventListener("pagehide",d),c.abort())};function h(){return{sessionId:r,visitorId:o,channelId:i,page:sZ()}}async function v(g,S){let E=await fetch(t,{method:"POST",headers:{"content-type":"application/json",...n},body:JSON.stringify(g),...S?{signal:S}:{}});if(!E.ok)throw new Error(`webmcp ${g.action} failed: ${E.status}`);return await E.json()}async function I(){if(a)try{let g=await fetch(a);if(g.ok)return await g.json();l.info(`[webmcp] list GET answered ${g.status}, using POST`)}catch(g){l.info("[webmcp] list GET failed, using POST",g)}return v({...h(),action:"list"})}let y=[];try{let g=await I();y=Array.isArray(g?.tools)?g.tools:[]}catch(g){return l.error("[webmcp] could not list site tools",g),m(),null}let w=[];return await Promise.all(y.map(async g=>{try{await u.registerTool({name:g.name,description:g.description??"",...g.inputSchema?{inputSchema:g.inputSchema}:{},...g.annotations?{annotations:g.annotations}:{},execute:async(S,E)=>{let T=await v({...h(),action:"call",name:g.name,arguments:S??{}},E?.signal);return T?.widget&&s?.(T.widget),{content:T?.content??[]}}},{signal:c.signal}),w.push(g)}catch(S){l.error(`[webmcp] could not register ${g.name}`,S)}})),l.info(`[webmcp] registered ${w.length} site tool(s)`),{get tools(){return w},callTool:({name:g,arguments:S})=>v({...h(),action:"call",name:g,arguments:S??{}}),dispose:m}}function GB(e,t,a){if(e.webmcp?.enabled===!1||t===!1)return null;let n=e.api??"";if(!e.token)return null;let r=e.mcpServerUrl?{mcpServerUrl:e.mcpServerUrl}:void 0,o=e.channelId??a;return{toolsEndpoint:Na(n,"/webmcp",r),listEndpoint:Na(n,"/webmcp/tools",{token:e.token,...o&&{channel:o},...r}),...o&&{channelId:o},headers:{Authorization:`Bearer ${e.token}`},resourceEndpoint:Na(n,"/resource",{token:e.token,...r})}}var di=j(Ee(),1);var wu=j(me(),1),XB=672,KB=32;function YB({widget:e,onCallTool:t,toolsEndpoint:a,headers:n,resourceEndpoint:r,onClose:o,isDark:i=!1}){let[s,l]=(0,di.useState)(null);(0,di.useEffect)(()=>{let m=()=>l({width:window.innerWidth,height:window.innerHeight});return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]);let u=e?.preview===!0;(0,di.useEffect)(()=>{if(!e||!u)return;let m=h=>{h.key==="Escape"&&o()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[e,u,o]),(0,di.useEffect)(()=>{if(!e)return;let m=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=m}},[e]);let c=(0,di.useCallback)(async m=>{if(t)return t(m);if(!a)throw new Error("webmcp overlay needs onCallTool");let h=await fetch(a,{method:"POST",headers:{"content-type":"application/json",...n},body:JSON.stringify({action:"call",...m})});if(!h.ok)throw new Error(`webmcp tool call failed: ${h.status}`);return await h.json()},[t,a,n]);if(!e)return null;let d=s?Math.min(XB,s.width-KB):XB,p=s?s.height-KB:void 0;return(0,wu.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Waniwani",className:V("ww:fixed ww:inset-0 ww:z-[2147483000] ww:flex ww:items-center ww:justify-center ww:bg-black/45 ww:backdrop-blur-md",i&&"dark"),children:[u&&(0,wu.jsx)("button",{type:"button","aria-label":"Close",onClick:o,className:"ww:absolute ww:inset-0 ww:h-full ww:w-full ww:cursor-pointer ww:border-none ww:bg-transparent ww:p-0"}),(0,wu.jsx)("div",{className:"ww:relative ww:overflow-auto ww:rounded-2xl ww:bg-background ww:shadow-2xl",style:{width:d,maxHeight:p},children:(0,wu.jsx)(Mh,{resourceUri:e.viewUri,resourceEndpoint:r,toolInput:e.data,toolResult:e.result,autoHeight:qd(e.result._meta),isDark:i,onCallTool:c,onOpenLink:m=>window.open(m,"_blank","noopener")},`${r}|${e.viewUri}`)})]})}var m0=j(me(),1),ZB="waniwani:webmcp:session";function lZ(){try{let e=sessionStorage.getItem(ZB);if(e)return e;let t=crypto.randomUUID();return sessionStorage.setItem(ZB,t),t}catch{return`s-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}}function uZ(e){let t=e.token?ci(e.api??"",e.token,e.channelId):null,a=GB(e,t?.webmcp?.enabled,t?.channelId);return a||Ua("[webmcp] not publishing site tools: switched off, or no token"),a}function cZ(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function dZ(){let e=null,t=null;return{emit(a){e?e(a):t=a},subscribe(a){return e=a,t&&(a(t),t=null),()=>{e===a&&(e=null)}}}}function fZ({resourceEndpoint:e,subscribe:t,callTool:a}){let[n,r]=ef.default.useState(null),[o,i]=ef.default.useState(cZ);return ef.default.useEffect(()=>t(r),[t]),ef.default.useEffect(()=>{let s;try{s=window.matchMedia("(prefers-color-scheme: dark)")}catch{return}let l=()=>i(s.matches);return s.addEventListener("change",l),()=>s.removeEventListener("change",l)},[]),(0,m0.jsx)(YB,{widget:n,onCallTool:a,resourceEndpoint:e,isDark:o,onClose:()=>r(null)})}function QB(e){if(!f0())return null;let t=uZ(e);if(!t)return null;let a=document.createElement("div");a.setAttribute("data-waniwani-webmcp",""),a.style.cssText="position:relative;z-index:2147483001;",document.body.appendChild(a);let n=a.attachShadow({mode:"open"});Gh(n);let r=document.createElement("div");n.appendChild(r);let o=dZ(),i=null,s=!1;p0({endpoint:t.toolsEndpoint,listEndpoint:t.listEndpoint,headers:t.headers,channelId:t.channelId,sessionId:lZ(),visitorId:ma(),onWidget:o.emit}).then(c=>{if(s){c?.dispose();return}i=c}).catch(c=>{console.error("[webmcp] could not publish site tools",c)});let l=async c=>{if(!i)throw new Error("webmcp bridge is not registered");let d=await i.callTool(c);return d.widget?.interactive&&o.emit(d.widget),d},u=JB.default.createRoot(r);return u.render((0,m0.jsx)(fZ,{resourceEndpoint:t.resourceEndpoint,subscribe:o.subscribe,callTool:l})),{getTools:()=>(i?.tools??[]).map(c=>c.name),destroy:()=>{s=!0,i?.dispose(),u.unmount(),a.remove()}}}var Pt=null,jn=null,Xt=null,Is=null,Kh=null,pZ="waniwani-chat-sizing",mZ="waniwani-chat-defaults",hZ="waniwani-chat-chrome",gZ="waniwani-chat-auto-card",yZ=`:where([data-waniwani-embed]){height:${AB}}`,wZ=":where([data-waniwani-embed]){border-radius:16px;overflow:hidden}",vZ=":where([data-waniwani-embed]){border-style:solid;border-width:var(--ww-border-width,0);border-color:var(--ww-border,transparent);box-shadow:var(--ww-shadow,none)}",xZ=":where([data-waniwani-embed][data-waniwani-auto]){width:100%;max-width:28rem;margin-inline:auto;border-radius:16px;overflow:hidden;border-style:solid;border-width:var(--ww-border-width,1px);border-color:var(--ww-border,rgba(0,0,0,0.1));box-shadow:var(--ww-shadow,0 10px 30px rgba(0,0,0,0.08))}",bZ="waniwani-chat-composer-auto",SZ=":where([data-waniwani-embed][data-waniwani-auto]){width:100%;max-width:40rem;margin-inline:auto}";function tf(e,t){if(typeof document>"u"||document.getElementById(e))return;let a=document.createElement("style");a.id=e,a.textContent=t,document.head.appendChild(a)}function a3(e,t){let a=t.appearance?.variables;!a||!(e instanceof HTMLElement)||(typeof a.borderWidth=="number"&&e.style.setProperty("--ww-border-width",`${a.borderWidth}px`),a.borderColor&&e.style.setProperty("--ww-border",a.borderColor),a.boxShadow&&e.style.setProperty("--ww-shadow",a.boxShadow))}function Yh(e,t){Gh(e);let a=document.createElement("style");if(a.textContent="[data-waniwani-chat]{border-width:0;box-shadow:none}",e.appendChild(a),t.css)try{let n=new URL(t.css,window.location.href);if(n.protocol==="https:"||n.protocol==="http:"){let r=document.createElement("link");r.rel="stylesheet",r.href=n.href,e.appendChild(r)}else console.warn("[Waniwani] Custom CSS URL must use http or https protocol.")}catch{console.warn("[Waniwani] Invalid custom CSS URL:",t.css)}}var e3="data-waniwani-embed",af="data-waniwani-auto";function n3(e){let t=document.querySelector(`[${e3}]`);if(t)return t;let a=document.createElement("div");a.setAttribute(e3,""),a.setAttribute(af,"");let n=e?!!document.head?.contains(e):!1;return e?.parentNode&&!n?e.parentNode.insertBefore(a,e):document.body.appendChild(a),a}function IZ(e){return/^\d+$/.test(e.trim())?`${e.trim()}px`:e.trim()}function CZ(e,t,a,n){let r=n3(n);tf(pZ,yZ),e.height&&r instanceof HTMLElement&&(r.style.height=IZ(e.height)),e.appearance?.theme&&tf(mZ,wZ),tf(hZ,vZ),r.hasAttribute(af)&&tf(gZ,xZ),a3(r,e),Xt=document.createElement("div"),Xt.id="waniwani-chat-embed",Xt.style.cssText="width:100%;height:100%;max-height:inherit;display:flex;flex-direction:column;flex:1 1 auto;min-height:0;",r.appendChild(Xt);let o=Xt,i=()=>{let d=getComputedStyle(r);if(!d.maxHeight.endsWith("px")){o.style.removeProperty("max-height");return}let p=Number.parseFloat(d.maxHeight);if(!Number.isFinite(p)){o.style.removeProperty("max-height");return}let m=p;d.boxSizing==="border-box"&&(m-=(Number.parseFloat(d.paddingTop)||0)+(Number.parseFloat(d.paddingBottom)||0)+(Number.parseFloat(d.borderTopWidth)||0)+(Number.parseFloat(d.borderBottomWidth)||0)),m>0?o.style.maxHeight=`${m}px`:o.style.removeProperty("max-height")};i(),Kh=new ResizeObserver(i),Kh.observe(r);let s=Xt.attachShadow({mode:"open"});Yh(s,e);let l=document.createElement("div");l.className="ww:contents",s.appendChild(l);let u=Cs.default.createRef(),c=d=>{r instanceof HTMLElement&&(r.style.display=d?"":"none")};if(e.token){let d=ci(e.api??"",e.token,e.channelId);d?.visibility&&!Zd(d.visibility,window.location.pathname)&&c(!1)}return jn=Zh.default.createRoot(l),jn.render(Cs.default.createElement($B,{ref:u,config:e,programmatic:t,scriptConfig:a,onVisibilityChange:c})),{destroy:()=>{Kh?.disconnect(),Kh=null,jn?.unmount(),jn=null,Xt?.remove(),Xt=null,r.hasAttribute(af)&&r.remove(),Pt=null},open:()=>{},close:()=>{},toggle:()=>{},sendMessage:d=>u.current?.chat?.sendMessage(d),sendMessageAndWait:async d=>{let p=u.current?.chat;if(p)return await p.sendMessageAndWait(d)},reset:()=>u.current?.chat?.reset(),focus:()=>u.current?.chat?.focus(),getMessages:()=>u.current?.chat?.messages??[],getSessionId:()=>u.current?.chat?.sessionId}}function kZ(e,t,a){Xt=document.createElement("div"),Xt.id="waniwani-chat-embed",Xt.style.cssText="position:fixed;inset:0;z-index:2147483000;pointer-events:none;",document.body.appendChild(Xt);let n=Xt.attachShadow({mode:"open"});Yh(n,e);let r=document.createElement("div");r.className="ww:contents",n.appendChild(r);let o=Cs.default.createRef();return jn=Zh.default.createRoot(r),jn.render(Cs.default.createElement(VB,{ref:o,config:e,programmatic:t,scriptConfig:a})),{destroy:()=>{jn?.unmount(),jn=null,Xt?.remove(),Xt=null,Pt=null},open:()=>o.current?.open(),close:()=>o.current?.close(),toggle:()=>o.current?.toggle(),sendMessage:i=>o.current?.sendMessage(i),sendMessageAndWait:async i=>{if(o.current)return o.current.sendMessageAndWait(i)},reset:()=>o.current?.reset(),focus:()=>o.current?.focus(),getMessages:()=>o.current?.getMessages()??[],getSessionId:()=>o.current?.getSessionId()}}function TZ(){return{destroy:()=>{Pt=null},open:()=>{},close:()=>{},toggle:()=>{},sendMessage:()=>{},sendMessageAndWait:async()=>{},reset:()=>{},focus:()=>{},getMessages:()=>[],getSessionId:()=>{}}}function LZ(e,t,a,n){let r=n3(n);r.hasAttribute(af)&&tf(bZ,SZ),a3(r,e),Xt=document.createElement("div"),Xt.id="waniwani-chat-embed",Xt.style.cssText="display:block;width:100%;",r.appendChild(Xt);let o=Xt.attachShadow({mode:"open"});Yh(o,e);let i=document.createElement("div");i.className="ww:contents",o.appendChild(i),Is=document.createElement("div"),Is.id="waniwani-chat-panel",Is.style.cssText="position:fixed;inset:0;z-index:2147483000;pointer-events:none;",document.body.appendChild(Is);let s=Is.attachShadow({mode:"open"});Yh(s,e);let l=document.createElement("div");l.className="ww:contents",s.appendChild(l);let u=Cs.default.createRef(),c=d=>{r instanceof HTMLElement&&(r.style.display=d?"":"none")};if(e.token){let d=ci(e.api??"",e.token,e.channelId);d?.visibility&&!Zd(d.visibility,window.location.pathname)&&c(!1)}return jn=Zh.default.createRoot(i),jn.render(Cs.default.createElement(HB,{ref:u,config:e,programmatic:t,scriptConfig:a,panelContainer:l,onVisibilityChange:c})),{destroy:()=>{jn?.unmount(),jn=null,Xt?.remove(),Xt=null,Is?.remove(),Is=null,r.hasAttribute(af)&&r.remove(),Pt=null},open:()=>u.current?.open(),close:()=>u.current?.close(),toggle:()=>u.current?.toggle(),sendMessage:d=>u.current?.sendMessage(d),sendMessageAndWait:async d=>{if(u.current)return u.current.sendMessageAndWait(d)},reset:()=>u.current?.reset(),focus:()=>u.current?.focus(),getMessages:()=>u.current?.getMessages()??[],getSessionId:()=>u.current?.getSessionId()}}function r3(e){if(Pt)return console.warn("[Waniwani] Chat widget is already initialized. Call destroy() first to re-initialize."),Pt;let t=s0(),a=$h(),n=Yd(e,void 0,a);Sc(n.visitorId);let r=null;try{r=QB(n)}catch(l){console.error("[Waniwani] WebMCP setup failed",l)}let o;n.mode==="off"?o=TZ():n.mode==="floating"?o=kZ(n,e,a):n.mode==="composer"?o=LZ(n,e,a,t):o=CZ(n,e,a,t);let i=n.api??"",s=n.token?R1({api:i,token:n.token,channelId:()=>n.channelId??ci(i,n.token,n.channelId)?.channelId,getSource:()=>ci(i,n.token,n.channelId)?.source??void 0,getSessionId:()=>o.getSessionId()}):Wp("no public token configured (set data-token or pass token to init())");return Pt={...o,track:s.track,identify:(l,u)=>s.identify(l,u),setVisitorId:l=>wl(l),getVisitorId:()=>ma(),destroy:()=>{s.shutdown(),r?.destroy(),o.destroy()}},Pt}function EZ(){Pt&&Pt.destroy()}var o3=Wp("chat widget is not initialized (call WaniWani.chat.init() first)"),vu=()=>Pt?Pt.track:o3.track;window.WaniWani=window.WaniWani||{};window.WaniWani.chat={init:r3,destroy:EZ,open:()=>Pt?.open(),close:()=>Pt?.close(),toggle:()=>Pt?.toggle(),sendMessage:e=>Pt?.sendMessage(e),sendMessageAndWait:async e=>{if(Pt)return Pt.sendMessageAndWait(e)},reset:()=>Pt?.reset(),focus:()=>Pt?.focus(),getMessages:()=>Pt?.getMessages()??[],getSessionId:()=>Pt?.getSessionId(),track:Object.assign(e=>vu()(e),{priceShown:e=>vu().priceShown(e),pricesCompared:e=>vu().pricesCompared(e),optionSelected:e=>vu().optionSelected(e),leadQualified:e=>vu().leadQualified(e),converted:e=>vu().converted(e)}),identify:(e,t)=>Pt?Pt.identify(e,t):o3.identify(e,t),setVisitorId:e=>wl(e),getVisitorId:()=>ma()};function t3(){if($h().token)try{r3()}catch(t){console.error("[Waniwani] Auto-initialization failed:",t)}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t3):t3();})();
144
+ ${Fe}`}]}}Q.current({...Ne,..._e?{modelContext:_e}:{}})}Oe({jsonrpc:"2.0",id:xe,result:{}});return}if(ie==="ui/update-model-context"&&xe!=null){ke=WU(ke,Le.params),Oe({jsonrpc:"2.0",id:xe,result:{}});return}if(ie==="tools/call"&&xe!=null){let Ne=$.current;if(!Ne){Oe({jsonrpc:"2.0",id:xe,error:{code:-32601,message:"tools/call not supported"}});return}let _e=Le.params?.name;Ne({name:_e,arguments:Le.params?.arguments??{}}).then(Fe=>{Oe({jsonrpc:"2.0",id:xe,result:Fe});let Ae=Fe.content?.map(de=>de.text??"").join("").trim();Ae&&nY(_e,Fe,X.current)&&(We&&clearTimeout(We.timer),We={text:Ae,timer:setTimeout(()=>{if(te)return;let de=ke;ke=null,We=null,Q.current?.({role:"user",content:[{type:"text",text:Ae}],...de?{modelContext:de}:{}})},500)})}).catch(Fe=>{let Ae=Fe instanceof Error?Fe.message:"Tool call failed";Oe({jsonrpc:"2.0",id:xe,error:{code:-32e3,message:Ae}})});return}if(ie==="ui/request-display-mode"&&xe!=null){let Ne=Le.params?.mode,_e=Ne==="fullscreen"||Ne==="inline"||Ne==="pip"?Ne:"inline";E.current=_e,Oe({jsonrpc:"2.0",id:xe,result:{mode:_e}}),Oe({jsonrpc:"2.0",method:"ui/notifications/host-context-changed",params:{displayMode:_e}}),H.current?.(_e);return}if(ie==="ui/resource-teardown"&&xe!=null){Oe({jsonrpc:"2.0",id:xe,result:{}});return}ie==="ping"&&xe!=null&&Oe({jsonrpc:"2.0",id:xe,result:{}})};return window.addEventListener("message",we),()=>{te=!0,clearTimeout(be),We&&clearTimeout(We.timer),window.removeEventListener("message",we)}},[s,B]),(0,YU.jsx)("iframe",{ref:h,src:P,onLoad:()=>ge.current?.mark("iframeLoad"),sandbox:"allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox",className:V(!p&&"ww:rounded-md ww:border ww:border-border",i),style:{height:p?"100%":T,minWidth:p||!O?void 0:`min(${O}px, 100%)`,width:"100%",border:"none",colorScheme:o?"dark":"auto"},title:"MCP App"})}var si=j(me(),1);function ZU({icon:e,title:t,description:a,suggestions:n,onSuggestionSelect:r}){return(0,si.jsxs)("div",{className:"ww:flex ww:flex-col ww:items-center ww:justify-center ww:py-12 ww:px-6 ww:text-center ww:min-h-full",children:[e&&(0,si.jsx)("div",{className:"ww:mb-4 ww:flex ww:items-center ww:justify-center ww:size-12 ww:rounded-xl ww:bg-foreground ww:text-background",children:e}),(0,si.jsx)("h2",{className:"ww:text-lg ww:font-semibold ww:text-foreground",children:t}),a&&(0,si.jsx)("p",{className:"ww:mt-1 ww:text-sm ww:text-muted-foreground ww:max-w-sm",children:a}),n&&n.length>0&&(0,si.jsx)("div",{className:"ww:mt-6 ww:w-full ww:max-w-md ww:flex ww:flex-col ww:gap-2",children:n.map((o,i)=>(0,si.jsx)("button",{type:"button",onClick:()=>r?.(o),className:V("ww:w-full ww:text-left ww:rounded-xl ww:border ww:border-border ww:bg-background ww:px-4 ww:py-3 ww:text-sm","ww:text-foreground ww:hover:bg-accent ww:hover:border-primary/30","ww:transition-all ww:duration-200 ww:ease-out ww:cursor-pointer","ww:animate-[ww-fade-in_0.2s_ease-out_both]"),style:{animationDelay:`${i*50}ms`},children:o},o))})]})}var JU=j(Ee(),1);var ou=j(me(),1);function rY({onRetry:e}){let{t}=Ue();return(0,ou.jsxs)("div",{className:"ww:flex ww:items-center ww:justify-between ww:rounded-md ww:border ww:border-border ww:bg-muted/50 ww:px-4 ww:py-3 ww:text-sm ww:text-muted-foreground",children:[(0,ou.jsx)("span",{children:t.widgetErrorBoundary.failedToLoad}),(0,ou.jsx)("button",{type:"button",onClick:e,className:"ww:text-xs ww:font-medium ww:text-primary ww:hover:underline",children:t.widgetErrorBoundary.retry})]})}var Rh=class extends JU.Component{constructor(){super(...arguments);K(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(a){console.warn("[Waniwani] Widget failed to render:",a.message)}render(){return this.state.hasError?(0,ou.jsx)(rY,{onRetry:()=>this.setState({hasError:!1})}):this.props.children}};var He=j(me(),1);function eI(e){return e?e.replace(/[-_]/g," ").replace(/^\w/,t=>t.toUpperCase()):"Tool"}function QU(e){return e&&/search|find|lookup|query|web|browse|google/i.test(e)?Rc:_i}function eB({messages:e,status:t,welcomeMessage:a,welcome:n,onSuggestionSelect:r,resourceEndpoint:o,chatSessionId:i,isDark:s,onFollowUp:l,onCallTool:u,onWidgetDisplayModeChange:c,fullscreenToolCallId:d,debug:p,showToolCalls:m=!0,toolDefinitions:h,messageClassNames:v}){let{t:I}=Ue(),y=e[e.length-1],w=e.length>0,g=d!=null,S=!g&&VU(e,t,{ignoreToolParts:m===!1,ignoreReasoningParts:m===!1});return(0,He.jsxs)(He.Fragment,{children:[!g&&(!w&&n?(0,He.jsx)(ZU,{...n,onSuggestionSelect:r}):a&&(0,He.jsx)(WS,{from:"assistant",children:(0,He.jsx)(GS,{children:(0,He.jsx)(Ah,{children:a})})})),e.map(E=>{let T=E.parts.filter(B=>B.type==="text"),R=E.parts.filter(B=>B.type==="reasoning"),O=E.parts.filter(B=>B.type==="file"),U=SM(E.metadata),A=E.parts.filter(B=>"toolCallId"in B),Q=E.parts.filter(B=>B.type==="reasoning"||"toolCallId"in B),$=E===y&&E.role==="assistant",H=T.length>0,Z=g?A.some(B=>B.toolCallId===d):!1,X=m!==!1&&!Z&&Q.length>=2;return g&&!Z?(0,He.jsx)("div",{style:{display:"none"}},E.id):E.role==="assistant"&&!jU(E)?(0,He.jsx)("div",{style:{display:"none"}},E.id):m===!1&&E.role==="assistant"&&!H&&O.length===0&&A.every(B=>{let P="output"in B?B.output:void 0;return P===void 0||!o||!Hd(B.toolName,P,h)})?(0,He.jsx)("div",{style:{display:"none"}},E.id):(0,He.jsxs)(WS,{from:E.role,className:v?.message,children:[m!==!1&&!Z&&!X&&R.map((B,P)=>(0,He.jsxs)(Ud,{isStreaming:B.state==="streaming",children:[(0,He.jsx)(Bd,{}),(0,He.jsx)(zd,{children:B.text})]},`reasoning-${E.id}-${P}`)),X&&(()=>{let B=Q[Q.length-1],P=B.type==="reasoning"?{icon:Gr,label:I.reasoning.thinking}:{icon:QU(B.toolName),label:B.title??eI(B.toolName)};return(0,He.jsxs)(TU,{isWorking:$&&(t==="streaming"||t==="submitted"),activeStep:P,children:[(0,He.jsx)(LU,{workingLabel:I.chainOfThought.working,label:I.chainOfThought.done}),(0,He.jsx)(EU,{children:Q.map((J,ge)=>{let C=ge===Q.length-1;if(J.type==="reasoning")return(0,He.jsx)(MU,{isStreaming:J.state==="streaming",isLast:C,children:J.text},`reasoning-${E.id}-${ge}`);let ze=J.title??eI(J.toolName),ot=QU(J.toolName);if(m==="titles-only")return(0,He.jsx)(VS,{icon:ot,title:ze,state:J.state,isLast:C},J.toolCallId);let x="output"in J?J.output:void 0;return(0,He.jsxs)(VS,{icon:ot,title:ze,state:J.state,isLast:C,children:[(0,He.jsx)(JS,{input:J.input,debug:p}),x!==void 0&&(0,He.jsx)(QS,{output:x,errorText:"errorText"in J?J.errorText:void 0,debug:p})]},J.toolCallId)})})]})})(),m!==!1&&!Z&&!X&&A.length===1&&(()=>{let B=A[0],P=B.title??eI(B.toolName);if(m==="titles-only")return(0,He.jsx)(zU,{title:P,state:B.state});let J="output"in B?B.output:void 0;return(0,He.jsxs)(UU,{children:[(0,He.jsx)(BU,{title:P,state:B.state}),(0,He.jsxs)(FU,{children:[(0,He.jsx)(JS,{input:B.input,debug:p}),J!==void 0&&(0,He.jsx)(QS,{output:J,errorText:"errorText"in B?B.errorText:void 0,debug:p})]})]})})(),A.map(B=>{let P="output"in B?B.output:void 0,J=Hd(B.toolName,P,h),ge=qU(B.toolName,P,h),C=B.toolCallId===d;return J&&o&&P!==void 0?(0,He.jsx)("div",{style:C?{position:"absolute",inset:0,zIndex:10,display:"flex",flexDirection:"column",overflow:"hidden",background:"var(--ww-color-background)"}:void 0,children:J&&o&&P!==void 0&&(0,He.jsx)(Rh,{children:(0,He.jsx)(Mh,{isFullscreen:C,resourceUri:J,toolInput:B.input??{},toolResult:{content:P.content,structuredContent:P.structuredContent,_meta:P._meta},resourceEndpoint:o,chatSessionId:i,isDark:s,autoHeight:ge,toolDefinitions:h,onFollowUp:l,onCallTool:u,onDisplayModeChange:c?ze=>c(ze,{toolCallId:B.toolCallId,resourceUri:J,toolInput:B.input??{},toolResult:{content:P.content,structuredContent:P.structuredContent,_meta:P._meta},autoHeight:ge}):void 0})})},B.toolCallId):null}),!Z&&U.length>0&&(0,He.jsx)(IM,{documents:U}),!Z&&(0,He.jsx)("div",{children:(0,He.jsxs)(GS,{className:V(E.role==="user"?v?.userBubble:v?.assistantBubble),children:[O.length>0&&(0,He.jsx)(xM,{files:O}),H?T.map((B,P)=>{let J=$&&t==="streaming"&&P===T.length-1;return(0,He.jsx)(Ah,{isStreaming:J,children:B.type==="text"?B.text:""},`${E.id}-${P}`)}):null]})})]},E.id)}),S&&(0,He.jsx)($U,{})]})}var li=j(me(),1);function oY({label:e}){return(0,li.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[(0,li.jsx)("title",{children:e}),(0,li.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,li.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function Dh({onClick:e}){let{t}=Ue();return(0,li.jsx)("button",{type:"button",onClick:e,title:t.threadMenu.newChat,"aria-label":t.threadMenu.newChat,className:"ww:p-1.5 ww:rounded-md ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/5 ww:transition-colors ww:cursor-pointer",children:(0,li.jsx)(oY,{label:t.threadMenu.newChat})})}var Vd=j(me(),1),iY="https://app.waniwani.ai/assets/waniwani-logo.svg",sY="https://waniwani.ai";function tB(){let{t:e}=Ue();return(0,Vd.jsxs)("a",{href:sY,target:"_blank",rel:"noopener noreferrer",className:"ww:flex ww:items-center ww:gap-1.5 ww:whitespace-nowrap ww:text-[10px] ww:sm:text-[11px] ww:text-muted-foreground ww:opacity-70 hover:ww:opacity-100 ww:transition-opacity",children:[(0,Vd.jsx)("span",{children:e.poweredBy.label}),(0,Vd.jsx)("img",{src:iY,alt:"Waniwani",width:72,height:10,"data-waniwani-logo":"",className:"ww:h-2.5 ww:w-auto"})]})}var iu=j(Ee(),1);var bt=j(me(),1),aB=20;function lY({label:e}){return(0,bt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[(0,bt.jsx)("title",{children:e}),(0,bt.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,bt.jsx)("polyline",{points:"3 4 3 9 8 9"}),(0,bt.jsx)("line",{x1:"12",y1:"7",x2:"12",y2:"12"}),(0,bt.jsx)("line",{x1:"12",y1:"12",x2:"15",y2:"14"})]})}function uY({label:e}){return(0,bt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e,children:[(0,bt.jsx)("title",{children:e}),(0,bt.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,bt.jsx)("path",{d:"M19 6l-2 14a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L5 6"}),(0,bt.jsx)("path",{d:"M10 11v6"}),(0,bt.jsx)("path",{d:"M14 11v6"})]})}function nB({threads:e,activeThreadId:t,onNewThread:a,onSelectThread:n,onDeleteThread:r}){let{locale:o,t:i}=Ue(),[s,l]=(0,iu.useState)(!1),u=(0,iu.useRef)(null);(0,iu.useEffect)(()=>{if(!s)return;let p=m=>{let h=u.current;h&&(m.composedPath().includes(h)||l(!1))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let c=e.slice(0,aB),d=Math.max(0,e.length-aB);return(0,bt.jsxs)("div",{ref:u,className:"ww:relative ww:flex ww:items-center ww:gap-1",children:[(0,bt.jsx)(Dh,{onClick:a}),(0,bt.jsx)("button",{type:"button",onClick:()=>l(p=>!p),title:i.threadMenu.threadHistory,"aria-label":i.threadMenu.threadHistory,"aria-expanded":s,className:"ww:p-1.5 ww:rounded-md ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/5 ww:transition-colors ww:cursor-pointer",children:(0,bt.jsx)(lY,{label:i.threadMenu.threadHistory})}),s&&(0,bt.jsxs)("div",{role:"menu",className:"ww:absolute ww:right-0 ww:top-full ww:mt-1 ww:w-72 ww:max-h-80 ww:overflow-y-auto ww:rounded-lg ww:border ww:border-border ww:bg-background ww:shadow-lg ww:z-50",children:[c.length===0&&(0,bt.jsx)("div",{className:"ww:px-3 ww:py-3 ww:text-xs ww:text-muted-foreground",children:i.threadMenu.noPreviousChats}),c.map(p=>{let m=p.threadId===t,h=Date.parse(p.updatedAt);return(0,bt.jsxs)("div",{className:`ww:flex ww:items-center ww:gap-2 ww:px-3 ww:py-2 ww:text-xs hover:ww:bg-foreground/5 ${m?"ww:bg-foreground/5":""}`,children:[(0,bt.jsxs)("button",{type:"button",onClick:()=>{n(p.threadId),l(!1)},className:"ww:flex-1 ww:min-w-0 ww:text-left ww:cursor-pointer",children:[(0,bt.jsx)("div",{className:"ww:truncate ww:text-foreground ww:font-medium",children:p.title}),(0,bt.jsx)("div",{className:"ww:text-[10px] ww:text-muted-foreground",children:Number.isNaN(h)?"":hx(h,o)})]}),(0,bt.jsx)("button",{type:"button",onClick:v=>{v.stopPropagation(),r(p.threadId)},title:i.threadMenu.deleteThread,"aria-label":i.threadMenu.deleteThread,className:"ww:p-1 ww:rounded ww:text-muted-foreground hover:ww:text-foreground hover:ww:bg-foreground/10 ww:transition-colors ww:cursor-pointer",children:(0,bt.jsx)(uY,{label:i.threadMenu.deleteThread})})]},p.threadId)}),d>0&&(0,bt.jsx)("div",{className:"ww:px-3 ww:py-2 ww:text-[10px] ww:text-muted-foreground ww:border-t ww:border-border",children:i.threadMenu.hiddenThreads(d)})]})]})}var _h=j(Ee(),1);function su(e){let t=new Set;return{subscribe(a){return t.add(a),()=>{t.delete(a)}},emit(a){let{sessionId:n,...r}=a,o=a.name==="session.started"?a.properties.sessionId:void 0,i={...r,mode:e.mode,sessionId:Object.hasOwn(a,"sessionId")?n:o??e.getSessionId?.(),timestamp:Date.now()};for(let s of[...t])try{s(i)}catch(l){console.warn("[Waniwani] onEvent subscriber threw:",l)}}}}function rB(){return{subscribe(){return()=>{}},emit(){}}}var oB=(0,_h.createContext)(rB());function Ph(){return(0,_h.useContext)(oB)}var lu=oB.Provider;var Oh=j(Ee(),1);function iB(e){let t=(0,Oh.useRef)(e);return t.current=e,(0,Oh.useCallback)(async a=>{let{api:n,headers:r,onCallTool:o,sessionId:i}=t.current;if(o)return o(a);let s=Na(n??"/api/waniwani","/tool"),l=typeof i=="string"&&i.trim().length>0?i.trim():void 0,u=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",...l?{"X-Session-Id":l}:{},...r},body:JSON.stringify(a)});if(!u.ok)throw new Error(`Tool call failed: ${u.status} ${u.statusText}`);return u.json()},[])}var qn=j(Ee(),1);var dB=j(lB(),1);var Xd=j(Ee(),1);var Bh=j(Ee(),1);var cB=(e,t,a)=>{if(!t.has(e))throw TypeError("Cannot "+a)},At=(e,t,a)=>(cB(e,t,"read from private field"),a?a.call(e):t.get(e)),kr=(e,t,a)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,a)},ui=(e,t,a,n)=>(cB(e,t,"write to private field"),n?n.call(e,a):t.set(e,a),a);function dY(e,t){return t!=null?(0,dB.default)(e,t):e}var Fn,Nh,Uh,$d,Wd,Gd,uu,tI,aI,fY=class{constructor(e=[]){kr(this,Fn,void 0),kr(this,Nh,"ready"),kr(this,Uh,void 0),kr(this,$d,new Set),kr(this,Wd,new Set),kr(this,Gd,new Set),this.pushMessage=t=>{ui(this,Fn,At(this,Fn).concat(t)),At(this,uu).call(this)},this.popMessage=()=>{ui(this,Fn,At(this,Fn).slice(0,-1)),At(this,uu).call(this)},this.replaceMessage=(t,a)=>{ui(this,Fn,[...At(this,Fn).slice(0,t),this.snapshot(a),...At(this,Fn).slice(t+1)]),At(this,uu).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,a)=>{let n=a?dY(t,a):t;return At(this,$d).add(n),()=>{At(this,$d).delete(n)}},this["~registerStatusCallback"]=t=>(At(this,Wd).add(t),()=>{At(this,Wd).delete(t)}),this["~registerErrorCallback"]=t=>(At(this,Gd).add(t),()=>{At(this,Gd).delete(t)}),kr(this,uu,()=>{At(this,$d).forEach(t=>t())}),kr(this,tI,()=>{At(this,Wd).forEach(t=>t())}),kr(this,aI,()=>{At(this,Gd).forEach(t=>t())}),ui(this,Fn,e)}get status(){return At(this,Nh)}set status(e){ui(this,Nh,e),At(this,tI).call(this)}get error(){return At(this,Uh)}set error(e){ui(this,Uh,e),At(this,aI).call(this)}get messages(){return At(this,Fn)}set messages(e){ui(this,Fn,[...e]),At(this,uu).call(this)}};Fn=new WeakMap;Nh=new WeakMap;Uh=new WeakMap;$d=new WeakMap;Wd=new WeakMap;Gd=new WeakMap;uu=new WeakMap;tI=new WeakMap;aI=new WeakMap;var cu,uB=class extends CE{constructor({messages:e,...t}){let a=new fY(e);super({...t,state:a}),kr(this,cu,void 0),this["~registerMessagesCallback"]=(n,r)=>At(this,cu)["~registerMessagesCallback"](n,r),this["~registerStatusCallback"]=n=>At(this,cu)["~registerStatusCallback"](n),this["~registerErrorCallback"]=n=>At(this,cu)["~registerErrorCallback"](n),ui(this,cu,a)}};cu=new WeakMap;function fB({experimental_throttle:e,resume:t=!1,...a}={}){let n=(0,qn.useRef)("chat"in a?{}:{onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});"chat"in a||(n.current={onToolCall:a.onToolCall,onData:a.onData,onFinish:a.onFinish,onError:a.onError,sendAutomaticallyWhen:a.sendAutomaticallyWhen});let r={...a,onToolCall:p=>{var m,h;return(h=(m=n.current).onToolCall)==null?void 0:h.call(m,p)},onData:p=>{var m,h;return(h=(m=n.current).onData)==null?void 0:h.call(m,p)},onFinish:p=>{var m,h;return(h=(m=n.current).onFinish)==null?void 0:h.call(m,p)},onError:p=>{var m,h;return(h=(m=n.current).onError)==null?void 0:h.call(m,p)},sendAutomaticallyWhen:p=>{var m,h,v;return(v=(h=(m=n.current).sendAutomaticallyWhen)==null?void 0:h.call(m,p))!=null?v:!1}},o=(0,qn.useRef)("chat"in a?a.chat:new uB(r));("chat"in a&&a.chat!==o.current||"id"in a&&o.current.id!==a.id)&&(o.current="chat"in a?a.chat:new uB(r));let s=(0,qn.useCallback)(p=>o.current["~registerMessagesCallback"](p,e),[e,o.current.id]),l=(0,qn.useSyncExternalStore)(s,()=>o.current.messages,()=>o.current.messages),u=(0,qn.useSyncExternalStore)(o.current["~registerStatusCallback"],()=>o.current.status,()=>o.current.status),c=(0,qn.useSyncExternalStore)(o.current["~registerErrorCallback"],()=>o.current.error,()=>o.current.error),d=(0,qn.useCallback)(p=>{typeof p=="function"&&(p=p(o.current.messages)),o.current.messages=p},[o]);return(0,qn.useEffect)(()=>{t&&o.current.resumeStream()},[t,o]),{id:o.current.id,messages:l,setMessages:d,sendMessage:o.current.sendMessage,regenerate:o.current.regenerate,clearError:o.current.clearError,stop:o.current.stop,error:c,resumeStream:o.current.resumeStream,status:u,addToolResult:o.current.addToolOutput,addToolOutput:o.current.addToolOutput,addToolApprovalResponse:o.current.addToolApprovalResponse}}var ee=j(Ee(),1);var pY="/api/mcp/modules/documents",mY=2e4,hY=3e5,Hn=class extends Error{constructor(a,n){super(n);K(this,"code");this.name="DocumentUploadError",this.code=a}};function pB(e,t){return Fp(e,`${pY}${t}`)}function gY(e){return pB(e,"/upload-url")}function mB(e,t){let a=new Headers(e);return new Headers(t).forEach((n,r)=>{a.set(r,n)}),a}function yY(e){let t=e?.data;if(typeof t?.documentId!="string"||typeof t.uploadUrl!="string"||!(t.documentId&&t.uploadUrl))return null;let a={};for(let[n,r]of Object.entries(t.headers??{}))typeof r=="string"&&(a[n]=r);return{documentId:t.documentId,uploadUrl:t.uploadUrl,headers:a}}function wY(e){return e===403?new Hn("upload_disabled","This agent does not accept document uploads."):e===413?new Hn("max_file_size","That file is too large."):e===422||e===400?new Hn("accept","That file type is not accepted."):new Hn("upload_failed",`The upload could not be started (${e}).`)}function vY(e){return new Promise((t,a)=>{let n=new XMLHttpRequest;n.open("PUT",e.url,!0);for(let[i,s]of Object.entries(e.headers))n.setRequestHeader(i,s);n.timeout=hY;let r=()=>n.abort();e.signal.addEventListener("abort",r,{once:!0});let o=()=>e.signal.removeEventListener("abort",r);n.upload.onprogress=i=>{i.lengthComputable&&i.total>0&&e.onProgress?.(i.loaded/i.total)},n.onload=()=>{if(o(),n.status>=200&&n.status<300||n.status===412){e.onProgress?.(1),t();return}a(new Hn("upload_failed",`The upload was rejected (${n.status}).`))},n.onerror=()=>{o(),a(new Hn("upload_failed","The upload could not be completed."))},n.ontimeout=()=>{o(),a(new Hn("upload_failed","The upload timed out."))},n.onabort=()=>{o(),a(e.signal.reason instanceof Error?e.signal.reason:new Error("aborted"))},n.send(e.file)})}async function zh(e){let t=pB(e.api,`/${e.documentId}`);if(t)try{await fetch(t,{method:"DELETE",headers:mB(e.headers,e.uploadHeaders)})}catch{}}async function hB(e){e.signal.throwIfAborted();let t=gY(e.api);if(!t)throw new Hn("upload_disabled","This agent does not accept document uploads.");let a=new AbortController,n=setTimeout(()=>a.abort(),mY),r=()=>a.abort(e.signal.reason);e.signal.addEventListener("abort",r,{once:!0});let o;try{let s=mB(e.headers,e.uploadHeaders);s.set("Content-Type","application/json"),o=await fetch(t,{method:"POST",headers:s,signal:a.signal,body:JSON.stringify({filename:e.file.name,contentType:e.file.type,byteSize:e.file.size,...e.sessionId?{sessionId:e.sessionId}:{}})})}catch(s){throw e.signal.aborted?s:new Hn("upload_failed","The upload could not be started.")}finally{clearTimeout(n),e.signal.removeEventListener("abort",r)}if(!o.ok)throw wY(o.status);let i=yY(await o.json().catch(()=>null));if(e.signal.throwIfAborted(),!i)throw new Hn("upload_failed","The upload could not be started.");return await vY({url:i.uploadUrl,headers:i.headers,file:e.file,signal:e.signal,onProgress:e.onProgress}),{documentId:i.documentId,filename:e.file.name,mediaType:e.file.type}}function xY(e){let t=e?.cause,a=t?.issues??t?.errors;if(!Array.isArray(a))return null;let n=a.find(r=>r.code==="invalid_union");if(!n?.errors)return null;for(let r of n.errors){if(!Array.isArray(r)||r.some(s=>(s.code==="invalid_value"||s.code==="invalid_literal")&&s.path?.[0]==="type"))continue;let i=r.filter(s=>s.code==="unrecognized_keys").flatMap(s=>s.keys??[]);if(i.length>0)return i}return null}var Fh=class extends bv{processResponseStream(t){let a="",n=xv(),r=n.validate?.bind(n);return t.pipeThrough(new TextDecoderStream).pipeThrough(new TransformStream({async transform(o,i){a+=o;let s=a.split(`
145
+ `);a=s.pop()??"";for(let l of s){let u=l.trim();if(!u.startsWith("data:"))continue;let c=u.slice(5).trim();if(c!=="[DONE]")try{let d=JSON.parse(c);if(!r){i.enqueue(d);continue}let p=await r(d);if(p.success){i.enqueue(p.value);continue}let m=xY(p.error);if(m?.length){let h={...d};for(let I of m)delete h[I];let v=await r(h);v.success&&i.enqueue(v.value)}}catch{}}}}))}};var gB=50,yB=1e3;function qh(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.threadId=="string"&&typeof t.memoryUserId=="string"&&typeof t.title=="string"&&Array.isArray(t.messages)&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string"}async function Hh(e){if(typeof indexedDB>"u")return null;let t=null;try{return t=await Xw(),await e(t)}catch{return null}finally{try{t?.close()}catch{}}}function nI(e){return new Promise((t,a)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>a(e.error)})}async function rI(e){return await Hh(async a=>{let o=a.transaction(yn,"readonly").objectStore(yn).index(qp),s=(await nI(o.getAll(e))??[]).filter(qh);return s.sort((l,u)=>l.updatedAt<u.updatedAt?1:-1),s})??[]}async function jh(e){return await Hh(async a=>{let r=a.transaction(yn,"readonly").objectStore(yn),o=await nI(r.get(e));return qh(o)?o:null})??null}async function oI(e){if(!qh(e))return;let t=e.messages.length>yB?{...e,messages:e.messages.slice(e.messages.length-yB)}:e;await Hh(async a=>{await new Promise((l,u)=>{let c=a.transaction(yn,"readwrite");c.oncomplete=()=>l(),c.onerror=()=>u(c.error),c.onabort=()=>u(c.error),c.objectStore(yn).put(t)});let n=a.transaction(yn,"readwrite"),r=n.objectStore(yn),o=r.index(qp),s=(await nI(o.getAll(t.memoryUserId))??[]).filter(qh);if(s.length>gB){s.sort((u,c)=>u.updatedAt<c.updatedAt?-1:1);let l=s.slice(0,s.length-gB);for(let u of l)r.delete(u.threadId)}return await new Promise((l,u)=>{n.oncomplete=()=>l(),n.onerror=()=>u(n.error),n.onabort=()=>u(n.error)}),null})}async function wB(e){await Hh(async t=>(await new Promise((a,n)=>{let r=t.transaction(yn,"readwrite");r.oncomplete=()=>a(),r.onerror=()=>n(r.error),r.onabort=()=>n(r.error),r.objectStore(yn).delete(e)}),null))}async function iI(e){return(await rI(e))[0]?.threadId??null}function vB(e){let t=e.trim();if(!t)return`Conversation on ${new Date().toISOString().slice(0,10)}`;let a=t.split(/\r?\n/,1)[0]??t;return a.length<=60?a:`${a.slice(0,60).trimEnd()}\u2026`}var bY="x-session-id",SY=250,IY=200;function xB(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():ud()}function Vh(){return new Date().toISOString()}function bB(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}async function CY(e,t){let a=Na(e,"/tools"),n=await fetch(a,{method:"GET",headers:t?{...t}:void 0});if(!n.ok)throw new Error(`[Waniwani] Failed to fetch /tools: ${n.status} ${n.statusText}`);let r=await n.json();if(!r||!Array.isArray(r.tools))return{};let o={};for(let i of r.tools)i&&typeof i.name=="string"&&(o[i.name]=i);return o}function SB(e){let{api:t="/api/waniwani",headers:a,uploadHeaders:n,body:r,onMessageSent:o,onResponseReceived:i,enableThreadHistory:s=!1,activeThreadId:l,onThreadChange:u}=e,c=e.visitorId;(0,ee.useEffect)(()=>Sc(c),[c]);let d=Ph(),p=(0,ee.useRef)(a),m=(0,ee.useRef)(n),h=(0,ee.useRef)(r),v=(0,ee.useRef)(s);(0,ee.useEffect)(()=>{v.current=s},[s]);let I=(0,ee.useRef)(void 0),y=(0,ee.useRef)(void 0),w=(0,ee.useRef)(null),[g,S]=(0,ee.useState)(void 0),E=(0,ee.useRef)(g),[T,R]=(0,ee.useState)(l),O=(0,ee.useRef)(T),[U,A]=(0,ee.useState)([]),[Q,$]=(0,ee.useState)(!s),H=(0,ee.useRef)(void 0),Z=(0,ee.useRef)(void 0),X=(0,ee.useRef)(void 0),B=(0,ee.useRef)(void 0),P=(0,ee.useRef)(0),J=(0,ee.useRef)(u);(0,ee.useEffect)(()=>{J.current=u},[u]);let ge=(0,ee.useCallback)(_=>{O.current=_,R(_),_&&(J.current?.(_),d.emit({name:"thread.changed",sessionId:E.current,properties:{threadId:_}}))},[d]),C=(0,ee.useCallback)(async()=>{if(!s)return;let _=w.current?.memoryUserId;if(!_)return;let he=await rI(_);A(he)},[s]),ze=(0,ee.useCallback)(()=>E.current,[]),ot=(0,ee.useCallback)(_=>{let he=bB(_);if(!he||E.current===he)return;let Se=E.current===void 0;E.current=he,S(he),Se&&d.emit({name:"session.started",properties:{sessionId:he}})},[d]),x=(0,ee.useCallback)(()=>{E.current=void 0,S(void 0)},[]);(0,ee.useEffect)(()=>{p.current=a,m.current=n},[a,n]),(0,ee.useEffect)(()=>{h.current=r},[r]),(0,ee.useEffect)(()=>{let _=!1,he=P.current;return(async()=>{try{let et=await Ic();if(_)return;w.current=et}catch{}if(!s)return;let Se=w.current?.memoryUserId;if(!Se){$(!0);return}try{let et=l??await iI(Se);if(_||he!==P.current)return;if(et){let Ot=await jh(et);if(_||he!==P.current)return;Ot&&Ot.memoryUserId===Se&&(O.current=Ot.threadId,R(Ot.threadId),H.current=Ot.createdAt,Z.current=Ot.title,Ot.sessionId&&(E.current=Ot.sessionId,S(Ot.sessionId)),ct(Ot.messages))}await C()}finally{_||$(!0)}})(),()=>{_=!0}},[]);let te=(0,ee.useRef)(null),re=(0,ee.useCallback)(_=>{let he=h.current?.[_];return typeof he=="string"?he:void 0},[]),ke=(0,ee.useCallback)(()=>({api:t,token:jp(p.current),channelId:re("channelId"),sessionId:E.current}),[t,re]),We=(0,ee.useCallback)(_=>{let he=te.current;te.current=null,he?.report(ke(),{mode:re("mode"),outcome:_})},[ke,re]),be=(0,ee.useCallback)(_=>{let he=typeof _=="object"&&_!==null&&!Array.isArray(_)?_:void 0,Se=w.current?.memoryUserId,et=w.current?.language,Ot={};return Se&&(Ot.memoryUserId=Se),et&&(Ot.locale=et),Object.keys(Ot).length>0||he?{...Ot,...he??{}}:void 0},[]),Oe=(0,ee.useCallback)(()=>{let _=O.current;return _||(_=xB(),H.current=Vh(),Z.current=void 0,ge(_)),_},[ge]),we=(0,ee.useRef)(new Fh({api:t,headers:()=>({...p.current}),body:()=>{let _={...h.current??{}},he=Object.hasOwn(_,"sessionId"),Se=bB(_.sessionId);if(Se)ot(Se),_.sessionId=Se;else if(he)x(),delete _.sessionId;else{let Qh=ze();Qh&&(_.sessionId=Qh)}nu(I.current)&&(_.modelContext=I.current),y.current?.length&&(_.documents=y.current);let et=w.current,Ot=ma();et&&(_.visitorContext={timezone:et.timezone,language:et.language,languages:et.languages,deviceType:et.deviceType,referrer:et.referrer,visitorId:Ot});let Kt=typeof _.visitor=="object"&&_.visitor!==null?_.visitor:{},g3=typeof Kt.client=="object"&&Kt.client!==null?Kt.client:{};_.visitor={...Kt,id:Ot,client:{...g3,...et&&{memoryUserId:et.memoryUserId}}};let wI=be(_.extra);return wI&&(_.extra=wI),v.current&&(Object.hasOwn(_,"threadId")?typeof _.threadId=="string"&&(O.current=_.threadId):_.threadId=Oe()),_},fetch:(async(_,he)=>{let Se=te.current;Se?.mark("requestStart");try{let et=await fetch(_,he);return I.current=void 0,ot(et.headers.get(bY)),Se?Se.instrument(et):et}finally{y.current=void 0}})})),ce=(0,ee.useRef)(e.transport?.({fallback:we.current,headers:()=>p.current,body:()=>{let _=be(h.current?.extra);return{channelId:re("channelId"),visitor:{id:ma()},..._?{extra:_}:{}}},threadHistory:()=>v.current,threadId:()=>v.current?Oe():void 0,hasMessages:()=>Ie.current.length>0,takeTurnInput:()=>{let _=y.current;return y.current=void 0,I.current=void 0,_?.length?{documents:_}:{}},onSession:ot})??we.current),Le=(0,ee.useRef)(null),ie=(0,ee.useRef)(null),xe=(0,ee.useRef)({}),[Ne,_e]=(0,ee.useState)(0),Fe=e.skipRemoteConfig===!0,Ae=(0,ee.useCallback)(async()=>{if(!Fe)try{let _=await CY(t,p.current);xe.current=_,_e(he=>he+1)}catch(_){console.warn("[Waniwani] Failed to fetch tool definitions:",_ instanceof Error?_.message:_)}},[t,Fe]);(0,ee.useEffect)(()=>{Ae()},[Ae]);let{messages:de,sendMessage:W,setMessages:ct,status:le,stop:oe}=fB({messages:e.initialMessages,transport:ce.current,onFinish({message:_,isAbort:he,isDisconnect:Se,isError:et}){te.current?.mark("streamEnd"),We(he||Se||et?"error":"ok"),i?.(),!he&&!Se&&!et&&d.emit({name:"message.received"}),Le.current&&(ie.current=_)},onError(_){We("error"),console.warn("[Waniwani] Chat error:",_.message),d.emit({name:"chat.error",properties:{message:_.message.slice(0,IY)}}),Le.current&&(Le.current.reject(_),Le.current=null)}}),Ie=(0,ee.useRef)(de);(0,ee.useEffect)(()=>{Ie.current=de},[de]);let ae=ce.current.keepsSession?.()??!1,k=(0,ee.useRef)(!1);(0,ee.useEffect)(()=>{!ae||k.current||Ie.current.length>0||(k.current=!0,ce.current.restore?.().then(_=>{_.length>0&&Ie.current.length===0&&ct(_)}).catch(()=>{}))},[ae]),(0,ee.useEffect)(()=>{let _=ce.current;return()=>_.dispose?.()},[]);let D=(0,ee.useCallback)(()=>{te.current=E1(Ie.current.filter(_=>_.role==="user").length+1)},[]),[F,fe]=(0,ee.useState)(!1),Ve=(0,ee.useCallback)(async()=>{fe(!0);try{await oe();let _=E.current;if(!_)return;await fetch(Na(t,"/cancel"),{method:"POST",headers:{"Content-Type":"application/json",...p.current},body:JSON.stringify({sessionId:_})})}catch{}finally{fe(!1)}},[t,oe]),Ft=(0,ee.useRef)(s);(0,ee.useEffect)(()=>{if(!s||Ft.current||(Ft.current=!0,Ie.current.length>0))return;let _=!1,he=P.current;return $(!1),(async()=>{try{let Se=w.current;if(!Se)try{Se=await Ic(),w.current=Se}catch{}let et=Se?.memoryUserId;if(!et||_||he!==P.current){_||$(!0);return}let Ot=l??await iI(et);if(_||he!==P.current)return;if(Ot){let Kt=await jh(Ot);if(_||he!==P.current)return;Kt&&Kt.memoryUserId===et&&(O.current=Kt.threadId,R(Kt.threadId),H.current=Kt.createdAt,Z.current=Kt.title,Kt.sessionId&&(E.current=Kt.sessionId,S(Kt.sessionId)),ct(Kt.messages))}await C()}finally{_||$(!0)}})(),()=>{_=!0}},[s]),(0,ee.useEffect)(()=>{if(le==="ready"&&Le.current&&ie.current){let _=Le.current,he=ie.current;Le.current=null,ie.current=null,_.resolve(he)}},[le]);let[In,ca]=(0,ee.useState)(""),so=typeof c!="function",lo=In.length>0;(0,ee.useEffect)(()=>{so&&lo&&ce.current.prepare?.()},[so,lo]);let[qt,Vn]=(0,ee.useState)([]),on=(0,ee.useRef)([]);on.current=qt;let xu=le==="submitted"||le==="streaming",nf=(0,ee.useCallback)(_=>{for(let he of _)for(let Se of he.documents??[])zh({documentId:Se.documentId,api:t,headers:p.current,uploadHeaders:m.current})},[t]),uo=(0,ee.useCallback)(()=>{nf(on.current),Vn([])},[nf]),i3=(0,ee.useCallback)(_=>{let he=on.current.find(Se=>Se.id===_);he&&nf([he]),Vn(Se=>Se.filter(et=>et.id!==_))},[nf]),s3=xu&&qt.length>0,l3=(0,ee.useCallback)(_=>{let he=!!_.text?.trim(),Se=!!(_.files?.length||_.documents?.length);if(he||Se){if(xu){if(qt.length>0)return;Vn(et=>[...et,{id:ud(),text:_.text||"",files:_.files??[],documents:_.documents??[],modelContext:_.modelContext}]),ca("");return}D(),I.current=_.modelContext,y.current=_.documents,W({text:_.text||"",files:_.files,..._.documents?.length&&{metadata:{documents:_.documents}}}),o?.(_.text||""),d.emit({name:"message.sent"}),ca("")}},[W,o,xu,qt.length,d,D]),u3=(0,ee.useCallback)(_=>new Promise((he,Se)=>{Le.current={resolve:he,reject:Se},D(),W({text:_}),o?.(_),d.emit({name:"message.sent"})}),[W,o,d,D]);(0,ee.useEffect)(()=>{if(le!=="ready"||F||qt.length===0)return;let[_,...he]=qt;Vn(he),D(),I.current=_.modelContext,y.current=_.documents,W({text:_.text,files:_.files.length>0?_.files:void 0,..._.documents.length>0&&{metadata:{documents:_.documents}}}),o?.(_.text),d.emit({name:"message.sent"})},[le,F,W,o,qt,d,D]);let c3=(0,ee.useCallback)(()=>{ce.current.reset?.(),ct([]),uo(),x(),ca(""),xe.current={},_e(_=>_+1),Ae()},[ct,x,Ae,uo]),rf=(0,ee.useCallback)(()=>{if(!v.current)return;let _=w.current?.memoryUserId,he=O.current,Se=Ie.current;if(!(!_||!he||Se.length===0)){if(H.current||(H.current=Vh()),!Z.current){let et=Se.find(Kt=>Kt.role==="user"),Ot=et?et.parts.map(Kt=>"text"in Kt&&typeof Kt.text=="string"?Kt.text:"").join(" "):"";Z.current=vB(Ot)}return{threadId:he,memoryUserId:_,title:Z.current,messages:Se,sessionId:E.current,createdAt:H.current,updatedAt:Vh()}}},[]),hI=(0,ee.useCallback)(async()=>{let _=rf();_&&(await oI(_),await C())},[rf,C]);(0,ee.useEffect)(()=>{if(s&&Q&&!(le==="submitted"||le==="streaming")&&de.length!==0)return X.current&&clearTimeout(X.current),X.current=setTimeout(()=>{X.current=void 0;let _=hI().finally(()=>{B.current===_&&(B.current=void 0)});B.current=_},SY),()=>{X.current&&clearTimeout(X.current)}},[s,Q,de,le,hI]);let of=(0,ee.useCallback)(()=>{let _=B.current,he=X.current,Se=he?rf():void 0;return he&&(clearTimeout(he),X.current=void 0),(async()=>{_&&await _,Se&&(await oI(Se),await C())})()},[rf,C]),d3=(0,ee.useCallback)(()=>{P.current+=1,of(),ce.current.dispose?.(),ct([]),uo(),x(),ca("");let _=xB();return H.current=Vh(),Z.current=void 0,ge(_),C(),_},[ct,x,ge,C,of,uo]),Jh=(0,ee.useCallback)(async _=>{P.current+=1;let he=P.current;if(await of(),he!==P.current)return;let Se=await jh(_);he===P.current&&Se&&(ce.current.dispose?.(),Se.sessionId?(E.current=Se.sessionId,S(Se.sessionId)):x(),ge(Se.threadId),H.current=Se.createdAt,Z.current=Se.title,ct(Se.messages),uo(),ca(""))},[ct,x,ge,of,uo]),f3=(0,ee.useCallback)(async _=>{if(O.current===_){P.current+=1,X.current&&(clearTimeout(X.current),X.current=void 0);let he=B.current;he&&await he}await wB(_),ce.current.forget?.(_),await C(),O.current===_&&(ce.current.dispose?.(),ct([]),uo(),x(),ca(""),O.current=void 0,R(void 0),H.current=void 0,Z.current=void 0)},[ct,x,C,uo]);(0,ee.useEffect)(()=>{s&&Q&&l!==void 0&&l!==O.current&&Jh(l)},[l,s,Q,Jh]);let p3=(0,ee.useCallback)(_=>{ca(_.target.value)},[]),gI=de[de.length-1],yI=de.length>0,m3=xu&&(!yI||gI.role==="user"),h3=xe.current;return{messages:de,status:le,text:In,setText:ca,handleSubmit:l3,handleTextChange:p3,isLoading:xu,showLoaderBubble:m3,lastMessage:gI,hasMessages:yI,sendMessage:W,sendMessageAndWait:u3,stop:Ve,reset:c3,queuedMessages:qt,queueFull:s3,removeQueuedMessage:i3,sessionId:g,toolDefinitions:h3,refreshToolDefinitions:Ae,threads:U,activeThreadId:T,isThreadHistoryReady:Q,startNewThread:d3,switchThread:Jh,deleteThread:f3,keepsSession:ae}}var bs=j(Ee(),1);var kY=6e3;function IB(e){let{api:t,headers:a,uploadHeaders:n,sessionId:r,documentUpload:o,allowAttachments:i}=e,[s,l]=(0,bs.useState)(null),u=(0,bs.useCallback)((p,m,h)=>hB({file:p,api:t,headers:a,uploadHeaders:n,sessionId:r,signal:m,onProgress:h}),[t,a,n,r]),c=(0,bs.useCallback)(p=>{zh({documentId:p.documentId,api:t,headers:a,uploadHeaders:n})},[t,a,n]);(0,bs.useEffect)(()=>{if(!s)return;let p=setTimeout(()=>l(null),kY);return()=>clearTimeout(p)},[s]);let d=o?.enabled??!1;return{enabled:o?o.enabled:!!i,accept:o?.accept.join(","),maxFileSize:o?.maxBytes,maxPdfPages:o?.maxPdfPages,maxFiles:o?.maxFiles,upload:d?u:void 0,onDiscard:d?c:void 0,error:s,reportError:l}}var Ha=j(Ee(),1);function du(e){return e.map(t=>({id:null,text:t}))}function Ss(e){let{flow:t,followup:a,page:n,channel:r}=e;return t!==null?{origin:"flow",suggestions:t}:a?.length?{origin:"followup",suggestions:a}:n?.length?{origin:"page",suggestions:n}:r?.length?{origin:"channel",suggestions:r}:null}function fu(e){return typeof e=="object"&&e!==null}function CB(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function TY(e){if(!fu(e)||!("toolCallId"in e)||!("output"in e))return null;let t=e.output;if(!fu(t)||!fu(t._meta))return null;let a=t._meta[Hw];return!fu(a)||!CB(a.suggestions)?null:a.suggestions}function kB(e){let t=null;for(let a of e.parts){let n=TY(a);n!==null&&(t=n)}return t}function TB(e){for(let t of e.parts){if(!fu(t)||t.type!=="data-suggestions")continue;let a=t.data;if(fu(a)&&CB(a.suggestions)&&a.suggestions.length>0)return a.suggestions}return null}function LY(e){return"page"in e||"channel"in e}function EY(e){return typeof e!="object"||e===null?{}:LY(e)?{rungs:e}:{initial:e.initial}}function LB(e){let{messages:t,status:a,suggestions:n}=e,r=n!==!1,{rungs:o,initial:i}=EY(n),s=(0,Ha.useMemo)(()=>({page:null,channel:du(i??[])}),[i]),l=o??s,u=(0,Ha.useMemo)(()=>r?Ss({flow:null,followup:null,...l}):null,[r,l]),c=(0,Ha.useMemo)(()=>u?.suggestions.map(g=>g.text)??[],[u]),[d,p]=(0,Ha.useState)(c),[m,h]=(0,Ha.useState)(u?.origin??"channel"),v=(0,Ha.useRef)(a),I=(0,Ha.useCallback)(()=>{p([])},[]),y=t.length>0;(0,Ha.useEffect)(()=>{y||(p(c),h(u?.origin??"channel"))},[c,u,y]);let w=t[t.length-1];return(0,Ha.useEffect)(()=>{w?.role==="user"&&I()},[w,I]),(0,Ha.useEffect)(()=>{let g=v.current;if(v.current=a,g!=="streaming"||a!=="ready"||!r)return;let S=[...t].reverse().find(O=>O.role==="assistant");if(!S)return;let E=kB(S),T=TB(S),R=Ss({flow:E===null?null:du(E),followup:T===null?null:du(T),page:null,channel:null});p(R?R.suggestions.map(O=>O.text):[]),h(R?.origin??"channel")},[a,r,t]),{suggestions:d,source:m,isLoading:!1,clear:I}}function EB(e,t){let a=t?.Authorization,n=typeof a=="string"&&a.startsWith("Bearer ")?a.slice(7):null;return Na(e,"/resource",n?{token:n}:void 0)}var AY={primaryColor:["--ww-primary","--ww-color-primary"],primaryForeground:["--ww-primary-fg","--ww-color-primary-foreground"],backgroundColor:["--ww-bg","--ww-color-background"],textColor:["--ww-text","--ww-color-foreground","--ww-color-accent-foreground"],mutedColor:["--ww-muted","--ww-color-muted-foreground"],borderColor:["--ww-border","--ww-color-border"],borderWidth:["--ww-border-width"],boxShadow:["--ww-shadow"],assistantBubbleColor:["--ww-assistant-bubble","--ww-color-accent"],userBubbleColor:["--ww-user-bubble"],inputBackgroundColor:["--ww-input-bg","--ww-color-input"],borderRadius:["--ww-radius"],messageBorderRadius:["--ww-msg-radius"],fontFamily:["--ww-font"],headerBackgroundColor:["--ww-header-bg"],headerTextColor:["--ww-header-text"],statusColor:["--ww-status"],toolCardColor:["--ww-tool-card","--ww-color-tool-card"],userBubbleTextColor:["--ww-user-bubble-text"],assistantBubbleTextColor:["--ww-assistant-bubble-text"],messagePaddingX:["--ww-msg-pad-x"],messagePaddingY:["--ww-msg-pad-y"],messageMaxWidth:["--ww-msg-max-width"],fontSize:["--ww-font-size"],lineHeight:["--ww-line-height"],glassTint:["--ww-glass-tint"],glassTintStrength:["--ww-glass-tint-opacity"]};function pu(e){let t={};for(let[a,n]of Object.entries(AY)){let r=e[a];if(r===void 0)continue;let o=typeof r=="number"?`${r}px`:String(r);for(let i of n)t[i]=o}return t}var nt=j(me(),1),mu=(0,Qe.forwardRef)(function(t,a){let{locale:n,messages:r}=t;return(0,nt.jsx)(es,{locale:n,messages:r,children:(0,nt.jsx)(MY,{...t,ref:a})})}),MY=(0,Qe.forwardRef)(function(t,a){let{t:n,ready:r}=Ue(),{appearance:o,className:i,classNames:s,allowAttachments:l=!1,documentUpload:u,welcomeMessage:c,welcome:d,placeholder:p=n.promptInput.placeholder,triggerEvent:m="triggerDemoRequest",api:h,mcp:v,debug:I=!1,readOnly:y=!1,title:w,headerActions:g,hideHeader:S=!1,enableThreadHistory:E=!1,showToolCalls:T=!0,initializing:R=!1,onScreen:O=!0,disclaimer:U}=t,A=o?.theme,Q=o?.variables,$=o?.assistantBubble??!1,H=Q?pu(Q):{},[Z,X]=(0,Qe.useState)(!1);(0,Qe.useEffect)(()=>{if(A!=="auto"||typeof window>"u")return;let k=window.matchMedia("(prefers-color-scheme: dark)");X(k.matches);let D=()=>X(k.matches);return k.addEventListener("change",D),()=>k.removeEventListener("change",D)},[A]);let B=A==="dark"||A==="auto"&&Z,P=SB({...t,api:h}),J=Ph(),ge=iB({...t,api:h,sessionId:P.sessionId,onCallTool:v?.onCallTool}),C=v?.resourceEndpoint??EB(h,t.headers),ze=(0,Qe.useRef)({});ze.current={api:h,token:jp(t.headers),channelId:typeof t.body?.channelId=="string"?t.body.channelId:void 0,sessionId:P.sessionId};let ot=(0,Qe.useCallback)(k=>{Vp("widget",ze.current,{widget:k.widget,outcome:k.outcome},k.metrics)},[]),x=Hl(p,!P.text),te=IB({api:h,headers:t.headers,uploadHeaders:t.uploadHeaders,sessionId:P.sessionId,documentUpload:u,allowAttachments:l}),[re,ke]=(0,Qe.useState)(null),[We,be]=(0,Qe.useState)(null),Oe=(0,Qe.useRef)(null),we=(0,Qe.useRef)(null),ce=(0,Qe.useRef)(null),Le=(0,Qe.useRef)(null),[ie,xe]=(0,Qe.useState)(!0),Ne=(0,Qe.useRef)(ie);Ne.current=ie;let _e=(0,Qe.useCallback)(()=>{let k=Oe.current;if(!k)return;let D=k.querySelector("textarea");D&&D.focus()},[]),Fe=(0,Qe.useCallback)((k="smooth")=>{let D=we.current;D&&D.scrollTo({top:D.scrollHeight,behavior:k})},[]);(0,Qe.useEffect)(()=>{let k=Le.current,D=we.current;if(!k||!D)return;let F=new IntersectionObserver(([fe])=>xe(fe.isIntersecting),{root:D,rootMargin:"0px 0px 200px 0px",threshold:0});return F.observe(k),()=>F.disconnect()},[]),(0,Qe.useEffect)(()=>{let k=we.current;if(!k)return;let D=F=>{let Ve=(F.target instanceof Element?F.target:null)?.closest("a");Ve?.href&&J.emit({name:"link.clicked",properties:{url:Ve.href}})};return k.addEventListener("click",D),()=>k.removeEventListener("click",D)},[J]),(0,Qe.useEffect)(()=>{(P.messages[P.messages.length-1]?.role==="user"||Ne.current)&&Fe("smooth")},[P.messages.length,P.messages[P.messages.length-1]]),(0,Qe.useEffect)(()=>{Fe("auto")},[Fe]),(0,Qe.useEffect)(()=>{if(typeof ResizeObserver>"u")return;let k=we.current,D=ce.current;if(!k&&!D)return;let F=k?.scrollHeight??0,fe=k?.clientHeight??0,Ve=new ResizeObserver(()=>{let Ft=we.current;if(!Ft)return;let In=Ft.scrollTop+fe>=F-5;F=Ft.scrollHeight,fe=Ft.clientHeight,In&&Fe("auto")});return k&&Ve.observe(k),D&&Ve.observe(D),()=>Ve.disconnect()},[Fe]);let Ae=LB({messages:P.messages,status:P.status,suggestions:t.suggestions}),de=(0,Qe.useRef)(null);(0,Qe.useEffect)(()=>{let k=Ae.suggestions;!O||k.length===0||de.current===k||(de.current=k,J.emit({name:"suggestions.shown",properties:{texts:k,origin:Ae.source}}))},[Ae.suggestions,Ae.source,J,O]);let W=d?.suggestions,ct=(0,Qe.useRef)(null);(0,Qe.useEffect)(()=>{!O||P.messages.length>0||!W?.length||ct.current===W||(ct.current=W,J.emit({name:"suggestions.shown",properties:{texts:W,origin:"channel"}}))},[W,P.messages.length,J,O]);let le=(0,Qe.useCallback)(k=>{let D=k.content.map(F=>F.text??"").join("").trim();D&&P.handleSubmit({text:D,files:[],modelContext:k.modelContext})},[P.handleSubmit]),oe=(0,Qe.useCallback)(k=>{let D=Ae.suggestions.indexOf(k),F=D>=0?D:d?.suggestions?.indexOf(k)??-1,fe=D>=0?Ae.source:"channel";J.emit({name:"suggestion.clicked",properties:{text:k,index:F,origin:fe}}),Ae.clear(),P.handleSubmit({text:k,files:[]})},[Ae.suggestions,Ae.source,Ae.clear,P.handleSubmit,d,J]);(0,Qe.useImperativeHandle)(a,()=>({sendMessage:k=>{P.handleSubmit({text:k,files:[]}),_e()},sendMessageAndWait:k=>P.sendMessageAndWait(k),reset:P.reset,focus:_e,get messages(){return P.messages},get sessionId(){return P.sessionId}}),[P.handleSubmit,P.sendMessageAndWait,P.reset,P.messages,P.sessionId,_e]),(0,Qe.useEffect)(()=>{if(!m)return;let k=D=>{let F=D.detail,fe=typeof F?.message=="string"?F.message:void 0;fe&&P.handleSubmit({text:fe,files:[]}),_e()};return window.addEventListener(m,k),()=>window.removeEventListener(m,k)},[m,P.handleSubmit,_e]);let Ie=!S&&!!(w||E||P.keepsSession||g),ae=R||!r;return(0,nt.jsxs)("div",{ref:Oe,style:{...H,maxHeight:"inherit",...re&&We?{height:We}:{},opacity:ae?0:1,transition:"opacity 220ms ease-out"},"data-waniwani-chat":"","data-waniwani-layout":"embed","data-assistant-bubble":$?"true":void 0,"data-color-scheme":A==="auto"?"auto":void 0,...ae?{"data-waniwani-initializing":""}:{},...B?{"data-waniwani-dark":""}:{},className:V("ww:relative ww:w-full ww:h-full ww:flex ww:flex-col ww:bg-background ww:text-foreground ww:font-[family-name:var(--ww-font)] ww:overflow-hidden",A==="dark"&&"dark",i,s?.root),children:[Ie&&(0,nt.jsxs)("div",{className:V("ww-header ww:shrink-0 ww:flex ww:items-center ww:gap-2 ww:pl-4 ww:pr-3 ww:py-3 ww:border-b ww:border-border",s?.header),style:{backgroundColor:"var(--ww-color-card-header)",color:"var(--ww-color-card-header-foreground)"},children:[w&&(0,nt.jsx)("div",{className:"ww:text-sm ww:font-semibold ww:truncate ww:flex-1 ww:min-w-0",children:w}),!w&&(0,nt.jsx)("div",{className:"ww:flex-1"}),!E&&P.keepsSession&&(0,nt.jsx)(Dh,{onClick:P.reset}),E&&(0,nt.jsx)(nB,{threads:P.threads,activeThreadId:P.activeThreadId,onNewThread:P.startNewThread,onSelectThread:k=>{P.switchThread(k)},onDeleteThread:k=>{P.deleteThread(k)}}),g]}),(0,nt.jsxs)("div",{ref:we,className:V("ww:relative ww:flex-1 ww:min-h-0",re?"ww:overflow-hidden":"ww:overflow-y-auto"),children:[(0,nt.jsxs)("div",{ref:ce,className:V("ww:mx-auto ww:w-full ww:max-w-3xl ww:px-4 ww:py-6 ww:flex ww:flex-col ww:gap-6",re&&"ww:!py-0"),children:[(0,nt.jsx)(KU,{value:ot,children:(0,nt.jsx)(eB,{messages:P.messages,status:P.status,welcomeMessage:c,welcome:d,onSuggestionSelect:oe,resourceEndpoint:C,chatSessionId:P.sessionId,isDark:B,onFollowUp:le,onCallTool:ge,fullscreenToolCallId:re,debug:I,showToolCalls:T,toolDefinitions:P.toolDefinitions,messageClassNames:{message:s?.message,userBubble:s?.userBubble,assistantBubble:s?.assistantBubble},onWidgetDisplayModeChange:(k,D)=>{if(k==="fullscreen"){let F=Oe.current?.getBoundingClientRect().height??0;be(F>0?F:null),ke(D.toolCallId)}else be(null),ke(null)}})}),(0,nt.jsx)("div",{ref:Le,"aria-hidden":!0,style:{height:1}})]}),!ie&&!re&&(0,nt.jsx)("div",{className:"ww:sticky ww:bottom-2 ww:flex ww:justify-center ww:pointer-events-none",children:(0,nt.jsx)(br,{type:"button",onClick:()=>Fe("smooth"),size:"icon",variant:"outline",className:"ww:rounded-full ww:shadow ww:pointer-events-auto","aria-label":"Scroll to latest",children:(0,nt.jsx)(Tc,{className:"ww:size-4"})})})]}),!y&&(0,nt.jsxs)("div",{className:"ww:shrink-0 ww:bg-background",style:re?{display:"none"}:void 0,children:[(0,nt.jsx)(Sl,{suggestions:Ae.suggestions,isLoading:Ae.isLoading,onSelect:oe}),(0,nt.jsx)(HM,{queuedMessages:P.queuedMessages,onRemove:P.removeQueuedMessage}),(0,nt.jsx)("div",{className:"ww:px-4 ww:pb-2 ww:pt-2",children:(0,nt.jsxs)("div",{className:"ww:mx-auto ww:w-full ww:max-w-3xl",children:[(0,nt.jsxs)(TM,{onSubmit:P.handleSubmit,attachmentsEnabled:te.enabled,globalDrop:te.enabled,multiple:te.enabled,accept:te.accept,maxFileSize:te.maxFileSize,maxPdfPages:te.maxPdfPages,maxFiles:te.maxFiles,upload:te.upload,onDiscard:te.onDiscard,onError:te.reportError,className:V("ww-input ww:rounded-2xl ww:border-border ww:bg-input",s?.input),children:[(0,nt.jsx)(DM,{enabled:te.enabled}),te.enabled&&(0,nt.jsx)(RM,{className:"ww:px-4 ww:pt-3"}),(0,nt.jsxs)("div",{className:"ww:flex ww:items-center ww:gap-1 ww:pl-4 ww:pr-3 ww:py-2.5",children:[te.enabled&&(0,nt.jsx)(MM,{}),(0,nt.jsx)(EM,{onChange:P.handleTextChange,value:P.text,placeholder:x,className:"ww:min-h-0 ww:py-1 ww:px-0"}),(0,nt.jsx)(AM,{status:P.status,disabled:P.queueFull,onStop:P.stop})]})]}),te.error&&(0,nt.jsx)("output",{className:"ww:block ww:pt-1.5 ww:text-center ww:text-destructive ww:text-xs",children:te.error.message}),(0,nt.jsxs)("div",{className:"ww:pt-2 ww:pb-1 ww:flex ww:flex-nowrap ww:justify-center ww:items-center ww:gap-1.5",children:[(0,nt.jsx)(tB,{}),(0,nt.jsx)(_M,{text:U})]})]})})]})]})});var Qd=j(Ee(),1);var AB="500px",RY="https://app.waniwani.ai/api/mcp/chat",DY={api:RY};function sI(){if(typeof document>"u")return null;if(document.currentScript instanceof HTMLScriptElement)return document.currentScript;let e=document.querySelector("script[src][data-token]");if(e instanceof HTMLScriptElement)return e;let t=document.querySelectorAll("script[src]");for(let a of t)if(a instanceof HTMLScriptElement&&/embed/i.test(a.src))return a;return null}function $h(){let e=sI();if(!e)return{};let t=J=>e.getAttribute(J)??void 0,a=J=>{let ge=e.getAttribute(J);if(ge==null)return;let C=ge.trim().toLowerCase();if(C==="true"||C==="1"||C==="")return!0;if(C==="false"||C==="0")return!1},n={},r=t("data-api");r&&(n.api=r);let o=t("data-token");o&&(n.token=o);let i=t("data-visitor-id");i&&(n.visitorId=i);let s=t("data-title");s&&(n.title=s);let l=t("data-welcome-message");l&&(n.welcomeMessage=l);let u=t("data-placeholder");u&&(n.placeholder=u);let c=t("data-mcp-server-url");c&&(n.mcpServerUrl=c);let d=t("data-webmcp");d&&(n.webmcp={enabled:d!=="false"&&d!=="off"});let p=t("data-channel-id");if(p&&(n.channelId=p),t("data-show-tool-calls")?.trim().toLowerCase()==="titles-only")n.showToolCalls="titles-only";else{let J=a("data-show-tool-calls");J!==void 0&&(n.showToolCalls=J)}let h=t("data-css");h&&(n.css=h);let v=t("data-suggestions");v&&(n.suggestions=v.split(",").map(J=>J.trim()).filter(Boolean));let I=a("data-enable-thread-history");I!==void 0&&(n.enableThreadHistory=I);let y=a("data-disable-page-view");y!==void 0&&(n.disablePageView=y);let w=a("data-hide-header");w!==void 0&&(n.hideHeader=w);let g=t("data-theme");(g==="light"||g==="dark"||g==="auto")&&(n.appearance={...n.appearance,theme:g});let S=a("data-assistant-bubble");S!==void 0&&(n.appearance={...n.appearance,assistantBubble:S});let E=t("data-locale");(E==="en"||E==="fr"||E==="es")&&(n.locale=E);let T=t("data-mode");(T==="inline"||T==="floating"||T==="composer"||T==="off")&&(n.mode=T);let R={},O=t("data-composer-variant")?.trim().toLowerCase();(O==="glow"||O==="outline")&&(R.variant=O);let U=t("data-composer-size")?.trim().toLowerCase();(U==="sm"||U==="md"||U==="lg")&&(R.size=U);let A=a("data-composer-suggestions");A!==void 0&&(R.showSuggestions=A);let Q=t("data-composer-align")?.trim().toLowerCase();(Q==="start"||Q==="center")&&(R.align=Q);let $=a("data-composer-trigger");$!==void 0&&(R.trigger=$);let H=a("data-composer-mobile-trigger");H!==void 0&&(R.mobileTrigger=H),Object.keys(R).length>0&&(n.composer=R);let Z=t("data-height");Z&&(n.height=Z);let X=t("data-launcher-text");X&&(n.launcherText=X);let B=t("data-appear-delay");if(B!==void 0){let J=Number.parseInt(B.trim(),10);Number.isFinite(J)&&J>=0&&(n.appearDelay=J)}let P=t("data-disclaimer");if(P!==void 0){let J=P.trim(),ge=J.toLowerCase();ge==="false"||ge==="0"?n.disclaimer=!1:J&&(n.disclaimer=J)}return n}function Kd(e){if(!e)return{};let t={};for(let a in e)e[a]!==void 0&&(t[a]=e[a]);return t}function Yd(e,t,a){let n=a??$h(),r=_Y(t,n,e),o={...t?.composer??{},...Kd(n.composer),...Kd(e?.composer)},i=Object.keys(o).length>0,s={token:"",...DY,...Kd(t),...Kd(n),...Kd(e),...r?{appearance:r}:{},...i?{composer:o}:{}};if(!s.token)throw new Error("[Waniwani] Missing required config: `token`. Set data-token on the script tag or pass it to Waniwani.chat.init().");return s}function _Y(e,t,a){let n=a?.appearance?.theme??t.appearance?.theme??e?.appearance?.theme,r={...e?.appearance?.variables??{},...t.appearance?.variables??{},...a?.appearance?.variables??{}},o=Object.keys(r).length>0,i=a?.appearance?.assistantBubble??t.appearance?.assistantBubble??e?.appearance?.assistantBubble;if(!n&&!o&&i===void 0)return;let s={};return n&&(s.theme=n),o&&(s.variables=r),i!==void 0&&(s.assistantBubble=i),s}var OB=j(Ee(),1);var Wh=j(Ee(),1);function PY(e){return e?.patterns??e?.rules??[]}var MB="\0\0";function OY(e){let a=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*\\\*/g,MB).replace(/\\\*/g,"[^/]*").split(MB).join(".*");return new RegExp(`^${a}$`)}function RB(e,t){try{return OY(e).test(t)}catch{return!1}}function Zd(e,t){if(!e)return!0;let a=!1;for(let n of PY(e))if(RB(n.glob,t)){if(n.action==="hide")return!1;a=!0}return a?!0:(e.default??"show")!=="hide"}function DB(e,t){for(let a of e?.appearRules??[])if(RB(a.glob,t))return a.appearAfter;return null}var lI="waniwani:locationchange",_B=!1;function NY(){if(!(_B||typeof history>"u")){_B=!0;for(let e of["pushState","replaceState"]){let t=history[e];history[e]=function(...n){let r=t.apply(this,n);return window.dispatchEvent(new Event(lI)),r}}}}function UY(e){return NY(),window.addEventListener(lI,e),window.addEventListener("popstate",e),()=>{window.removeEventListener(lI,e),window.removeEventListener("popstate",e)}}function BY(){return window.location.pathname}function zY(){return"/"}function Jd(){return(0,Wh.useSyncExternalStore)(UY,BY,zY)}function hu(e,t){let a=Jd(),n=t&&Zd(e,a);return(0,Wh.useEffect)(()=>{Ua("visibility gate",{pathname:a,ready:t,visible:n,rules:e})},[a,t,n]),n}var FY=3,qY=["low","medium","high"];function uI(e){if(e.length===0)return;let t=Math.floor(Math.random()*e.length),[a]=e.splice(t,1);return a}function HY(e){let t=new Map,a=[];for(let o of e)if(o.tier){let i=t.get(o.tier)??[];i.push(o),t.set(o.tier,i)}else a.push(o);let n=[];for(let o of qY){let i=uI(t.get(o)??[])??uI(a);i&&n.push(i)}let r=[...t.values()].flat().concat(a);for(;n.length<Math.min(FY,e.length);){let o=uI(r);if(!o)break;n.push(o)}return n}function PB(e){let t;try{t=new URL(e,"http://localhost").pathname}catch{t="/"}let a=t.replace(/\/+$/,"");return(a===""?"/":a).toLowerCase()}function NB(e){return Array.isArray(e)?e.flatMap(t=>{let a=t;if(typeof a?.url!="string"||a.url.length===0||!Array.isArray(a.prompts))return[];let n=a.prompts.flatMap(r=>{let o=r;return typeof o?.text!="string"||o.text.length===0?[]:[{id:typeof o.id=="string"?o.id:null,text:o.text,tier:o.tier==="low"||o.tier==="medium"||o.tier==="high"?o.tier:void 0}]});return n.length>0?[{url:a.url,prompts:n}]:[]}):[]}function gu(e){let{pageSuggestions:t,suggestions:a}=e,n=Jd();return(0,OB.useMemo)(()=>{let r=PB(n),o=t?.find(s=>PB(s.url)===r),i=o?HY(o.prompts).map(({id:s,text:l})=>({id:s,text:l})):null;return Ua("configured suggestions resolve",{pathname:r,matched:!!o,count:i?.length??0}),{page:i,channel:du(a??[])}},[n,t,a])}var jY="waniwani:config:";function UB(e,t,a){return`${jY}${e}|${t}|${a??""}`}function ci(e,t,a){if(typeof window>"u")return null;try{let n=window.sessionStorage.getItem(UB(e,t,a));if(!n)return null;let r=JSON.parse(n);return r&&typeof r=="object"?r:null}catch{return null}}function VY(e,t,a,n){if(!(typeof window>"u"))try{window.sessionStorage.setItem(UB(e,t,a),JSON.stringify(n))}catch{}}var $Y=600;function WY(e){if(typeof e!="object"||e===null||typeof e.enabled!="boolean")return null;let t=Array.isArray(e.accept)?e.accept.filter(n=>typeof n=="string"):[],a=n=>typeof n=="number"&&Number.isFinite(n)&&n>0;return e.enabled?a(e.maxBytes)&&a(e.maxPdfPages)&&a(e.maxFiles)&&t.length>0?{enabled:!0,maxBytes:e.maxBytes,maxPdfPages:e.maxPdfPages,maxFiles:e.maxFiles,accept:t}:null:{enabled:!1,maxBytes:0,maxPdfPages:0,maxFiles:0,accept:t}}async function GY(e,t,a,n){Di("configStart");let r=await XY(e,t,a,n);return Di("configEnd"),a?.aborted||Jw(r.metadata),r}async function XY(e,t,a,n){try{let r=Na(e,"/config",n?{channel:n}:void 0),o=await fetch(r,{method:"GET",headers:{Authorization:`Bearer ${t}`},signal:a});if(!o.ok)return{};let i=await o.json(),s=i&&typeof i=="object"&&"data"in i&&i.data?i.data:i;return s?KY(s):{}}catch{return{}}}function KY(e){let t={};e.source!=null&&(t.source=e.source),e.channelId!=null&&(t.channelId=e.channelId),e.title!=null&&(t.title=e.title),e.welcomeMessage!=null&&(t.welcomeMessage=e.welcomeMessage),e.placeholder!=null&&(t.placeholder=e.placeholder),e.suggestions!=null&&e.suggestions.length>0&&(t.suggestions=e.suggestions);let a=NB(e.pageSuggestions);a.length>0&&(t.pageSuggestions=a),typeof e.enableThreadHistory=="boolean"&&(t.enableThreadHistory=e.enableThreadHistory),typeof e.sessionApi=="string"&&e.sessionApi&&(t.sessionApi=e.sessionApi),typeof e.webmcp?.enabled=="boolean"&&(t.webmcp={enabled:e.webmcp.enabled}),e.toolCallDisplay==="full"?t.showToolCalls=!0:e.toolCallDisplay==="titles-only"?t.showToolCalls="titles-only":e.toolCallDisplay==="hidden"&&(t.showToolCalls=!1),e.visibility&&(t.visibility=e.visibility);let n=WY(e.documentUpload);return n&&(t.documentUpload=n),e.metadata&&typeof e.metadata=="object"&&(t.metadata=e.metadata),t}function yu(e,t,a){let[n,r]=(0,Qd.useState)(e),[o,i]=(0,Qd.useState)(!1);return(0,Qd.useEffect)(()=>{let s=e.api,l=e.token,u=e.channelId;if(!s||!l){i(!0);return}let c=h=>{e.disablePageView||M1({api:s,token:l,channelId:u??h.channelId,mode:e.mode==="off"?void 0:e.mode,source:h.source})},d=ci(s,l,u);if(d)try{let h=Yd(t,d,a);r(h),$p("cache"),Jw(d.metadata),i(!0),Ua("config resolved (sessionStorage cache)",{config:h,visibility:h.visibility}),c(d)}catch{}let p=new AbortController,m=setTimeout(()=>{$p("timeout"),i(!0)},$Y);return GY(s,l,p.signal,u).then(h=>{if(!p.signal.aborted){if(Ua("remote /config response",h),Object.keys(h).length>0){VY(s,l,u,h);try{let v=Yd(t,h,a);r(v),Ua("config resolved (remote)",{config:v,visibility:v.visibility})}catch(v){console.error("[Waniwani] Failed to apply remote config:",v)}}$p("remote"),i(!0),c(h)}}).catch(h=>{console.error("[Waniwani] Remote config fetch failed:",h),i(!0)}).finally(()=>clearTimeout(m)),()=>{p.abort(),clearTimeout(m)}},[e.api,e.token,e.channelId]),{config:n,ready:o}}var Gt=j(me(),1),YY={sm:{row:"ww:gap-1 ww:pl-3 ww:pr-1 ww:py-1",field:"ww:py-1 ww:text-base ww:sm:text-sm",send:"ww:size-7",sendIcon:"ww:size-3.5",radius:12},md:{row:"ww:gap-1 ww:pl-3.5 ww:pr-1.5 ww:py-1.5 ww:sm:pl-4 ww:sm:pr-2 ww:sm:py-2",field:"ww:py-1.5 ww:text-base ww:sm:text-sm",send:"ww:size-8",sendIcon:"ww:size-4",radius:16},lg:{row:"ww:gap-2 ww:pl-5 ww:pr-2 ww:py-2.5 ww:sm:pl-6 ww:sm:pr-2.5 ww:sm:py-3",field:"ww:py-2 ww:text-base",send:"ww:size-10",sendIcon:"ww:size-5",radius:20}},BB="var(--ww-composer-bg, var(--ww-color-input))",ZY="var(--ww-composer-border-color, var(--ww-color-border))",JY="var(--ww-composer-border-width, 1px)",zB="var(--ww-composer-send-bg, var(--ww-color-foreground))",FB="var(--ww-composer-send-fg, var(--ww-color-background))",HB=(0,rt.forwardRef)(function(t,a){return(0,Gt.jsx)(es,{locale:t.config.locale,children:(0,Gt.jsx)(QY,{...t,ref:a})})}),QY=(0,rt.forwardRef)(function({config:t,programmatic:a,scriptConfig:n,panelContainer:r,onVisibilityChange:o},i){let{t:s}=Ue(),{config:l,ready:u}=yu(t,a,n),c=hu(l.visibility,u);(0,rt.useEffect)(()=>{o?.(c)},[c,o]),ru({api:l.api,token:l.token,channelId:l.channelId,mode:"composer",paintMark:"chatVisible",painted:u});let d=(0,rt.useRef)(null),p=(0,rt.useMemo)(()=>su({mode:"composer",getSessionId:()=>d.current?.sessionId}),[]),m=l.onEvent;(0,rt.useEffect)(()=>{if(m)return p.subscribe(m)},[m,p]);let h=(0,rt.useRef)(null),v=(0,rt.useRef)(null),[I,y]=(0,rt.useState)(!1),[w,g]=(0,rt.useState)(""),[S,E]=(0,rt.useState)(0),T=l.appearance?.theme,R=l.appearance?.variables,O=(0,rt.useMemo)(()=>R?pu(R):{},[R]),U=gu(l),A=(0,rt.useMemo)(()=>Ss({flow:null,followup:null,...U}),[U]),Q=(0,rt.useMemo)(()=>A?.suggestions.map(de=>de.text)??[],[A]);Fl({widgetEvents:p,api:l.api,token:l.token,channelId:l.channelId,source:l.source,mode:"composer",pagePrompts:U.page,getSessionId:()=>d.current?.sessionId});let $=(0,rt.useRef)(null);(0,rt.useEffect)(()=>{!c||!A||$.current!==A&&($.current=A,p.emit({name:"suggestions.shown",properties:{texts:Q,origin:A.origin}}))},[c,A,Q,p]);let H=l.composer??{},Z=H.variant??"glow",X=YY[H.size??"md"],B=H.showSuggestions??!0,P=H.align==="center",J=oM(),ge=(H.trigger??!1)||J&&(H.mobileTrigger??!0),C=l.launcherText??l.placeholder??s.launcher.prompt,ze=Hl(C,!ge&&w.length===0),ot="var(--ww-shadow, 0 10px 30px rgba(0, 0, 0, 0.08))";(0,rt.useEffect)(()=>{let de=h.current;if(de){if(!w){de.style.height="";return}de.style.height="auto",de.style.height=`${de.scrollHeight}px`}},[w]),(0,rt.useEffect)(()=>{S>0&&I&&d.current?.focus()},[S,I]);let x=(0,rt.useRef)(!1);(0,rt.useEffect)(()=>{u&&!x.current&&(x.current=!0,p.emit({name:"chat.ready"}))},[u,p]);let te=(0,rt.useRef)(!1);(0,rt.useEffect)(()=>{let de=c&&I;de!==te.current&&(te.current=de,p.emit({name:de?"chat.opened":"chat.closed"}))},[c,I,p]);let re=(0,rt.useCallback)(de=>{y(!0),E(ct=>ct+1);let W=de.trim();W&&d.current?.sendMessage(W)},[]);(0,rt.useImperativeHandle)(i,()=>({open:()=>y(!0),close:()=>y(!1),toggle:()=>y(de=>!de),sendMessage:de=>re(de),sendMessageAndWait:async de=>{y(!0);let W=d.current;if(W)return await W.sendMessageAndWait(de)},reset:()=>d.current?.reset(),focus:()=>{I?E(de=>de+1):(h.current??v.current)?.focus()},getMessages:()=>d.current?.messages??[],getSessionId:()=>d.current?.sessionId}),[re,I]);let ke=(0,rt.useCallback)(()=>{w.trim()&&(re(w),g(""))},[w,re]),We=(0,rt.useCallback)(()=>{(d.current?.messages.length??0)>0&&(y(!0),E(de=>de+1))},[]),be={mode:"composer"},Oe=zl(l.sessionApi);l.mcpServerUrl&&(be.mcpServerUrl=l.mcpServerUrl),l.channelId&&(be.channelId=l.channelId);let we=(0,Gt.jsx)("button",{type:"button",onClick:()=>y(!1),"aria-label":s.launcher.close,className:"ww:flex ww:size-7 ww:items-center ww:justify-center ww:rounded-md ww:text-muted-foreground ww:transition-colors hover:ww:bg-accent hover:ww:text-foreground ww:cursor-pointer",children:(0,Gt.jsx)(wn,{className:"ww:size-4"})}),ce=(0,Gt.jsxs)("div",{className:V("ww:flex ww:items-end",X.row),children:[(0,Gt.jsx)("textarea",{ref:h,rows:1,value:w,placeholder:ze,onChange:de=>g(de.target.value),onFocus:We,onKeyDown:de=>{de.key==="Enter"&&!de.shiftKey&&(de.preventDefault(),ke())},className:V("ww:min-w-0 ww:flex-1 ww:resize-none ww:bg-transparent ww:max-h-36 ww:text-foreground ww:outline-none ww:placeholder:text-muted-foreground",X.field,!w&&"ww:overflow-hidden ww:whitespace-nowrap ww:text-ellipsis ww:placeholder:overflow-hidden ww:placeholder:text-ellipsis")}),(0,Gt.jsx)("button",{type:"button",onClick:ke,disabled:!w.trim(),"aria-label":s.promptInput.submit,className:V("ww:relative ww:flex ww:shrink-0 ww:items-center ww:justify-center ww:rounded-full ww:transition-opacity hover:ww:opacity-90 disabled:ww:opacity-40",X.send),style:{background:zB,color:FB},children:(0,Gt.jsx)(pr,{className:X.sendIcon})})]}),Le=(0,Gt.jsxs)("button",{ref:v,type:"button",onClick:()=>re(""),className:V("ww:flex ww:w-full ww:items-center ww:text-left ww:cursor-pointer",X.row,P&&"ww:justify-center"),children:[(0,Gt.jsx)("span",{className:V("ww:min-w-0 ww:flex-1 ww:truncate ww:text-muted-foreground",X.field,P&&"ww:flex-none"),children:C}),(0,Gt.jsx)("span",{"aria-hidden":!0,className:V("ww:flex ww:shrink-0 ww:items-center ww:justify-center ww:rounded-full",X.send,P&&"ww:ml-3"),style:{background:zB,color:FB},children:(0,Gt.jsx)(pr,{className:X.sendIcon})})]}),ie=ge?Le:ce,xe=`var(--ww-composer-radius, ${X.radius}px)`,Ne={borderRadius:xe,background:BB,borderColor:ZY,borderWidth:JY,borderStyle:"solid",boxShadow:`var(--ww-composer-shadow, ${ot})`},_e=Z==="glow"?(0,Gt.jsx)(Yp,{animated:u,backgroundColor:BB,borderRadius:xe,edgeSensitivity:30,coneSpread:25,colors:["#c084fc","#f472b6","#38bdf8"],style:Ne,children:ie}):(0,Gt.jsx)("div",{className:V(ge&&"ww:transition-colors hover:ww:border-primary/40"),style:Ne,children:ie}),Fe=(0,Gt.jsxs)("div",{"data-waniwani-chat":"","data-color-scheme":T==="auto"?"auto":void 0,"data-waniwani-composer":"input","data-composer-variant":Z,inert:I,className:V("ww:w-full ww:font-[family-name:var(--ww-font-sans)]",T==="dark"&&"dark"),style:O,children:[_e,B&&Q.length>0&&(0,Gt.jsx)(Sl,{suggestions:Q,onSelect:de=>{p.emit({name:"suggestion.clicked",properties:{text:de,index:Q.indexOf(de),origin:A?.origin??"channel"}}),re(de)},align:P?"center":"start",className:"ww:px-0.5 ww:pt-2.5 ww:pb-0"})]}),Ae=(0,Gt.jsx)("div",{"data-waniwani-chat":"","data-color-scheme":T==="auto"?"auto":void 0,className:V("ww:contents ww:font-[family-name:var(--ww-font-sans)]",T==="dark"&&"dark"),style:O,children:(0,Gt.jsx)("div",{role:"dialog","aria-label":l.title??C,"data-waniwani-floating":"panel","data-state":c&&I?"shown":"hidden",style:{boxShadow:ot},className:V("ww:fixed ww:z-[2147483002] ww:flex ww:flex-col ww:overflow-hidden ww:bg-background","ww:inset-0 ww:w-full ww:rounded-none","ww:sm:inset-auto ww:sm:bottom-4 ww:sm:left-0 ww:sm:right-0 ww:sm:mx-auto ww:sm:h-[720px] ww:sm:max-h-[calc(100dvh-2rem)] ww:sm:w-[calc(100vw-2rem)] ww:sm:max-w-[1000px] ww:sm:rounded-2xl ww:sm:border ww:sm:border-border"),children:(0,Gt.jsx)(mu,{transport:Oe,ref:d,api:l.api??"",headers:{Authorization:`Bearer ${l.token}`},skipRemoteConfig:!0,body:be,appearance:l.appearance,title:l.title,headerActions:we,hideHeader:!1,onScreen:I,welcomeMessage:l.welcomeMessage,placeholder:l.placeholder,suggestions:U,enableThreadHistory:l.enableThreadHistory,documentUpload:l.documentUpload,showToolCalls:l.showToolCalls,locale:l.locale,initializing:!u})})});return(0,Gt.jsxs)(lu,{value:p,children:[Fe,(0,qB.createPortal)(Ae,r)]})});var cI="/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--ww-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--ww-color-black:#000;--ww-spacing:.25rem;--ww-container-sm:24rem;--ww-container-md:28rem;--ww-container-3xl:48rem;--ww-text-xs:.75rem;--ww-text-xs--line-height:calc(1/.75);--ww-text-sm:.875rem;--ww-text-sm--line-height:calc(1.25/.875);--ww-text-base:1rem;--ww-text-base--line-height:calc(1.5/1);--ww-text-lg:1.125rem;--ww-text-lg--line-height:calc(1.75/1.125);--ww-font-weight-medium:500;--ww-font-weight-semibold:600;--ww-tracking-wide:.025em;--ww-tracking-wider:.05em;--ww-radius-md:.375rem;--ww-radius-lg:.5rem;--ww-radius-xl:.75rem;--ww-radius-2xl:1rem;--ww-ease-out:cubic-bezier(0,0,.2,1);--ww-animate-spin:spin 1s linear infinite;--ww-animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--ww-blur-md:12px;--ww-blur-xl:24px;--ww-default-transition-duration:.15s;--ww-default-transition-timing-function:cubic-bezier(.4,0,.2,1);--ww-default-font-family:var(--ww-font-sans,system-ui,-apple-system,\"Segoe UI\",sans-serif);--ww-default-mono-font-family:var(--ww-font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--ww-default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--ww-default-font-feature-settings,normal);font-variation-settings:var(--ww-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--ww-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--ww-default-mono-font-feature-settings,normal);font-variation-settings:var(--ww-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.ww\\:pointer-events-auto{pointer-events:auto}.ww\\:pointer-events-none{pointer-events:none}.ww\\:absolute{position:absolute}.ww\\:fixed{position:fixed}.ww\\:relative{position:relative}.ww\\:sticky{position:sticky}.ww\\:inset-0{inset:calc(var(--ww-spacing)*0)}.ww\\:top-2{top:calc(var(--ww-spacing)*2)}.ww\\:top-full{top:100%}.ww\\:right-0{right:calc(var(--ww-spacing)*0)}.ww\\:right-2{right:calc(var(--ww-spacing)*2)}.ww\\:bottom-0{bottom:calc(var(--ww-spacing)*0)}.ww\\:bottom-2{bottom:calc(var(--ww-spacing)*2)}.ww\\:bottom-3{bottom:calc(var(--ww-spacing)*3)}.ww\\:bottom-4{bottom:calc(var(--ww-spacing)*4)}.ww\\:left-0{left:calc(var(--ww-spacing)*0)}.ww\\:left-\\[50\\%\\]{left:50%}.ww\\:isolate{isolation:isolate}.ww\\:-z-\\[1\\]{z-index:calc(1*-1)}.ww\\:z-10{z-index:10}.ww\\:z-50{z-index:50}.ww\\:z-\\[1\\]{z-index:1}.ww\\:z-\\[2147483000\\]{z-index:2147483000}.ww\\:z-\\[2147483002\\]{z-index:2147483002}.ww\\:mx-auto{margin-inline:auto}.ww\\:mt-0\\.5{margin-top:calc(var(--ww-spacing)*.5)}.ww\\:mt-1{margin-top:calc(var(--ww-spacing)*1)}.ww\\:mt-2{margin-top:calc(var(--ww-spacing)*2)}.ww\\:mt-6{margin-top:calc(var(--ww-spacing)*6)}.ww\\:mb-0{margin-bottom:calc(var(--ww-spacing)*0)}.ww\\:mb-4{margin-bottom:calc(var(--ww-spacing)*4)}.ww\\:mb-6{margin-bottom:calc(var(--ww-spacing)*6)}.ww\\:ml-3{margin-left:calc(var(--ww-spacing)*3)}.ww\\:ml-auto{margin-left:auto}.ww\\:line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.ww\\:block{display:block}.ww\\:contents{display:contents}.ww\\:flex{display:flex}.ww\\:grid{display:grid}.ww\\:hidden{display:none}.ww\\:inline-block{display:inline-block}.ww\\:inline-flex{display:inline-flex}.ww\\:field-sizing-content{field-sizing:content}.ww\\:size-2{width:calc(var(--ww-spacing)*2);height:calc(var(--ww-spacing)*2)}.ww\\:size-3{width:calc(var(--ww-spacing)*3);height:calc(var(--ww-spacing)*3)}.ww\\:size-3\\.5{width:calc(var(--ww-spacing)*3.5);height:calc(var(--ww-spacing)*3.5)}.ww\\:size-4{width:calc(var(--ww-spacing)*4);height:calc(var(--ww-spacing)*4)}.ww\\:size-5{width:calc(var(--ww-spacing)*5);height:calc(var(--ww-spacing)*5)}.ww\\:size-7{width:calc(var(--ww-spacing)*7);height:calc(var(--ww-spacing)*7)}.ww\\:size-8{width:calc(var(--ww-spacing)*8);height:calc(var(--ww-spacing)*8)}.ww\\:size-9{width:calc(var(--ww-spacing)*9);height:calc(var(--ww-spacing)*9)}.ww\\:size-10{width:calc(var(--ww-spacing)*10);height:calc(var(--ww-spacing)*10)}.ww\\:size-12{width:calc(var(--ww-spacing)*12);height:calc(var(--ww-spacing)*12)}.ww\\:size-auto{width:auto;height:auto}.ww\\:size-full{width:100%;height:100%}.ww\\:h-0\\.5{height:calc(var(--ww-spacing)*.5)}.ww\\:h-2\\.5{height:calc(var(--ww-spacing)*2.5)}.ww\\:h-5{height:calc(var(--ww-spacing)*5)}.ww\\:h-8{height:calc(var(--ww-spacing)*8)}.ww\\:h-9{height:calc(var(--ww-spacing)*9)}.ww\\:h-16{height:calc(var(--ww-spacing)*16)}.ww\\:h-auto{height:auto}.ww\\:h-full{height:100%}.ww\\:max-h-36{max-height:calc(var(--ww-spacing)*36)}.ww\\:max-h-48{max-height:calc(var(--ww-spacing)*48)}.ww\\:max-h-80{max-height:calc(var(--ww-spacing)*80)}.ww\\:min-h-0{min-height:calc(var(--ww-spacing)*0)}.ww\\:min-h-5{min-height:calc(var(--ww-spacing)*5)}.ww\\:min-h-full{min-height:100%}.ww\\:w-60{width:calc(var(--ww-spacing)*60)}.ww\\:w-72{width:calc(var(--ww-spacing)*72)}.ww\\:w-\\[calc\\(100vw-2rem\\)\\]{width:calc(100vw - 2rem)}.ww\\:w-auto{width:auto}.ww\\:w-fit{width:fit-content}.ww\\:w-full{width:100%}.ww\\:w-px{width:1px}.ww\\:\\[max-width\\:var\\(--ww-msg-max-width\\,80\\%\\)\\]{max-width:var(--ww-msg-max-width,80%)}.ww\\:max-w-3xl{max-width:var(--ww-container-3xl)}.ww\\:max-w-24{max-width:calc(var(--ww-spacing)*24)}.ww\\:max-w-32{max-width:calc(var(--ww-spacing)*32)}.ww\\:max-w-72{max-width:calc(var(--ww-spacing)*72)}.ww\\:max-w-\\[440px\\]{max-width:440px}.ww\\:max-w-\\[720px\\]{max-width:720px}.ww\\:max-w-full{max-width:100%}.ww\\:max-w-md{max-width:var(--ww-container-md)}.ww\\:max-w-sm{max-width:var(--ww-container-sm)}.ww\\:min-w-0{min-width:calc(var(--ww-spacing)*0)}.ww\\:flex-1{flex:1}.ww\\:flex-none{flex:none}.ww\\:shrink-0{flex-shrink:0}.ww\\:grow{flex-grow:1}.ww\\:translate-x-\\[-50\\%\\]{--tw-translate-x:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.ww\\:rotate-90{rotate:90deg}.ww\\:rotate-180{rotate:180deg}.ww\\:animate-\\[ww-fade-in_0\\.2s_ease-out_both\\]{animation:.2s ease-out both ww-fade-in}.ww\\:animate-pulse{animation:var(--ww-animate-pulse)}.ww\\:animate-spin{animation:var(--ww-animate-spin)}.ww\\:cursor-default{cursor:default}.ww\\:cursor-pointer{cursor:pointer}.ww\\:resize-none{resize:none}.ww\\:list-none{list-style-type:none}.ww\\:grid-rows-\\[0fr\\]{grid-template-rows:0fr}.ww\\:grid-rows-\\[1fr\\]{grid-template-rows:1fr}.ww\\:flex-col{flex-direction:column}.ww\\:flex-nowrap{flex-wrap:nowrap}.ww\\:flex-wrap{flex-wrap:wrap}.ww\\:items-center{align-items:center}.ww\\:items-end{align-items:flex-end}.ww\\:items-start{align-items:flex-start}.ww\\:justify-between{justify-content:space-between}.ww\\:justify-center{justify-content:center}.ww\\:justify-end{justify-content:flex-end}.ww\\:gap-1{gap:calc(var(--ww-spacing)*1)}.ww\\:gap-1\\.5{gap:calc(var(--ww-spacing)*1.5)}.ww\\:gap-2{gap:calc(var(--ww-spacing)*2)}.ww\\:gap-2\\.5{gap:calc(var(--ww-spacing)*2.5)}.ww\\:gap-3{gap:calc(var(--ww-spacing)*3)}.ww\\:gap-6{gap:calc(var(--ww-spacing)*6)}:where(.ww\\:space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--ww-spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--ww-spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.ww\\:space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--ww-spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--ww-spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}.ww\\:self-stretch{align-self:stretch}.ww\\:truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ww\\:overflow-auto{overflow:auto}.ww\\:overflow-hidden{overflow:hidden}.ww\\:overflow-x-auto{overflow-x:auto}.ww\\:overflow-y-auto{overflow-y:auto}.ww\\:overflow-y-hidden{overflow-y:hidden}.ww\\:\\!rounded-full{border-radius:3.40282e38px!important}.ww\\:rounded{border-radius:var(--ww-radius,16px)}.ww\\:rounded-2xl{border-radius:var(--ww-radius-2xl)}.ww\\:rounded-\\[20px\\]{border-radius:20px}.ww\\:rounded-\\[inherit\\]{border-radius:inherit}.ww\\:rounded-full{border-radius:3.40282e38px}.ww\\:rounded-lg{border-radius:var(--ww-radius-lg)}.ww\\:rounded-md{border-radius:var(--ww-radius-md)}.ww\\:rounded-none{border-radius:0}.ww\\:rounded-xl{border-radius:var(--ww-radius-xl)}.ww\\:border{border-style:var(--tw-border-style);border-width:1px}.ww\\:border-0{border-style:var(--tw-border-style);border-width:0}.ww\\:border-2{border-style:var(--tw-border-style);border-width:2px}.ww\\:border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.ww\\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.ww\\:border-dashed{--tw-border-style:dashed;border-style:dashed}.ww\\:border-none{--tw-border-style:none;border-style:none}.ww\\:border-border{border-color:var(--ww-color-border,#e5e7eb)}.ww\\:border-muted-foreground\\/50{border-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:border-muted-foreground\\/50{border-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)50%,transparent)}}.ww\\:border-primary{border-color:var(--ww-color-primary,#6366f1)}.ww\\:border-transparent{border-color:#0000}.ww\\:bg-accent{background-color:var(--ww-color-accent,#f3f4f6)}.ww\\:bg-background,.ww\\:bg-background\\/20{background-color:var(--ww-color-background,#fff)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-background\\/20{background-color:color-mix(in oklab,var(--ww-color-background,#fff)20%,transparent)}}.ww\\:bg-background\\/85{background-color:var(--ww-color-background,#fff)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-background\\/85{background-color:color-mix(in oklab,var(--ww-color-background,#fff)85%,transparent)}}.ww\\:bg-black\\/45{background-color:var(--ww-color-black)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-black\\/45{background-color:color-mix(in oklab,var(--ww-color-black)45%,transparent)}}.ww\\:bg-border{background-color:var(--ww-color-border,#e5e7eb)}.ww\\:bg-foreground,.ww\\:bg-foreground\\/5{background-color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-foreground\\/5{background-color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)5%,transparent)}}.ww\\:bg-input{background-color:var(--ww-color-input,#f9fafb)}.ww\\:bg-muted{background-color:var(--ww-color-muted,#f1f5f9)}.ww\\:bg-muted-foreground\\/60{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted-foreground\\/60{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)60%,transparent)}}.ww\\:bg-muted\\/50{background-color:var(--ww-color-muted,#f1f5f9)}@supports (color:color-mix(in lab, red, red)){.ww\\:bg-muted\\/50{background-color:color-mix(in oklab,var(--ww-color-muted,#f1f5f9)50%,transparent)}}.ww\\:bg-primary{background-color:var(--ww-color-primary,#6366f1)}.ww\\:bg-tool-card{background-color:var(--ww-color-tool-card,#f4f4f5)}.ww\\:bg-transparent{background-color:#0000}.ww\\:object-contain{object-fit:contain}.ww\\:object-cover{object-fit:cover}.ww\\:object-center{object-position:center}.ww\\:p-0{padding:calc(var(--ww-spacing)*0)}.ww\\:p-1{padding:calc(var(--ww-spacing)*1)}.ww\\:p-1\\.5{padding:calc(var(--ww-spacing)*1.5)}.ww\\:p-2{padding:calc(var(--ww-spacing)*2)}.ww\\:p-2\\.5{padding:calc(var(--ww-spacing)*2.5)}.ww\\:p-3{padding:calc(var(--ww-spacing)*3)}.ww\\:px-0{padding-inline:calc(var(--ww-spacing)*0)}.ww\\:px-0\\.5{padding-inline:calc(var(--ww-spacing)*.5)}.ww\\:px-1\\.5{padding-inline:calc(var(--ww-spacing)*1.5)}.ww\\:px-2{padding-inline:calc(var(--ww-spacing)*2)}.ww\\:px-3{padding-inline:calc(var(--ww-spacing)*3)}.ww\\:px-3\\.5{padding-inline:calc(var(--ww-spacing)*3.5)}.ww\\:px-4{padding-inline:calc(var(--ww-spacing)*4)}.ww\\:px-6{padding-inline:calc(var(--ww-spacing)*6)}.ww\\:\\!py-0{padding-block:calc(var(--ww-spacing)*0)!important}.ww\\:py-0\\.5{padding-block:calc(var(--ww-spacing)*.5)}.ww\\:py-1{padding-block:calc(var(--ww-spacing)*1)}.ww\\:py-1\\.5{padding-block:calc(var(--ww-spacing)*1.5)}.ww\\:py-2{padding-block:calc(var(--ww-spacing)*2)}.ww\\:py-2\\.5{padding-block:calc(var(--ww-spacing)*2.5)}.ww\\:py-3{padding-block:calc(var(--ww-spacing)*3)}.ww\\:py-6{padding-block:calc(var(--ww-spacing)*6)}.ww\\:py-12{padding-block:calc(var(--ww-spacing)*12)}.ww\\:pt-1{padding-top:calc(var(--ww-spacing)*1)}.ww\\:pt-1\\.5{padding-top:calc(var(--ww-spacing)*1.5)}.ww\\:pt-2{padding-top:calc(var(--ww-spacing)*2)}.ww\\:pt-2\\.5{padding-top:calc(var(--ww-spacing)*2.5)}.ww\\:pt-3{padding-top:calc(var(--ww-spacing)*3)}.ww\\:pr-1{padding-right:calc(var(--ww-spacing)*1)}.ww\\:pr-1\\.5{padding-right:calc(var(--ww-spacing)*1.5)}.ww\\:pr-2{padding-right:calc(var(--ww-spacing)*2)}.ww\\:pr-3{padding-right:calc(var(--ww-spacing)*3)}.ww\\:pr-9{padding-right:calc(var(--ww-spacing)*9)}.ww\\:pb-0{padding-bottom:calc(var(--ww-spacing)*0)}.ww\\:pb-1{padding-bottom:calc(var(--ww-spacing)*1)}.ww\\:pb-1\\.5{padding-bottom:calc(var(--ww-spacing)*1.5)}.ww\\:pb-2{padding-bottom:calc(var(--ww-spacing)*2)}.ww\\:pb-2\\.5{padding-bottom:calc(var(--ww-spacing)*2.5)}.ww\\:pb-3{padding-bottom:calc(var(--ww-spacing)*3)}.ww\\:pl-1{padding-left:calc(var(--ww-spacing)*1)}.ww\\:pl-3{padding-left:calc(var(--ww-spacing)*3)}.ww\\:pl-3\\.5{padding-left:calc(var(--ww-spacing)*3.5)}.ww\\:pl-4{padding-left:calc(var(--ww-spacing)*4)}.ww\\:pl-5{padding-left:calc(var(--ww-spacing)*5)}.ww\\:text-center{text-align:center}.ww\\:text-left{text-align:left}.ww\\:font-\\[family-name\\:var\\(--ww-font\\)\\]{font-family:var(--ww-font)}.ww\\:font-\\[family-name\\:var\\(--ww-font-sans\\)\\]{font-family:var(--ww-font-sans)}.ww\\:font-mono{font-family:var(--ww-font-mono)}.ww\\:text-base{font-size:var(--ww-text-base);line-height:var(--tw-leading,var(--ww-text-base--line-height))}.ww\\:text-lg{font-size:var(--ww-text-lg);line-height:var(--tw-leading,var(--ww-text-lg--line-height))}.ww\\:text-sm{font-size:var(--ww-text-sm);line-height:var(--tw-leading,var(--ww-text-sm--line-height))}.ww\\:text-xs{font-size:var(--ww-text-xs);line-height:var(--tw-leading,var(--ww-text-xs--line-height))}.ww\\:\\[font-size\\:var\\(--ww-font-size\\,1rem\\)\\]{font-size:var(--ww-font-size,1rem)}.ww\\:text-\\[10px\\]{font-size:10px}.ww\\:text-\\[11px\\]{font-size:11px}.ww\\:\\[line-height\\:var\\(--ww-line-height\\,1\\.5\\)\\]{line-height:var(--ww-line-height,1.5)}.ww\\:font-medium{--tw-font-weight:var(--ww-font-weight-medium);font-weight:var(--ww-font-weight-medium)}.ww\\:font-semibold{--tw-font-weight:var(--ww-font-weight-semibold);font-weight:var(--ww-font-weight-semibold)}.ww\\:tracking-wide{--tw-tracking:var(--ww-tracking-wide);letter-spacing:var(--ww-tracking-wide)}.ww\\:tracking-wider{--tw-tracking:var(--ww-tracking-wider);letter-spacing:var(--ww-tracking-wider)}.ww\\:break-words{overflow-wrap:break-word}.ww\\:break-all{word-break:break-all}.ww\\:text-ellipsis{text-overflow:ellipsis}.ww\\:whitespace-nowrap{white-space:nowrap}.ww\\:whitespace-pre-wrap{white-space:pre-wrap}.ww\\:text-background{color:var(--ww-color-background,#fff)}.ww\\:text-foreground,.ww\\:text-foreground\\/80{color:var(--ww-color-foreground,#1f2937)}@supports (color:color-mix(in lab, red, red)){.ww\\:text-foreground\\/80{color:color-mix(in oklab,var(--ww-color-foreground,#1f2937)80%,transparent)}}.ww\\:text-muted-foreground{color:var(--ww-color-muted-foreground,#6b7280)}.ww\\:text-primary{color:var(--ww-color-primary,#6366f1)}.ww\\:text-primary-foreground{color:var(--ww-color-primary-foreground,#1f2937)}.ww\\:uppercase{text-transform:uppercase}.ww\\:italic{font-style:italic}.ww\\:underline{text-decoration-line:underline}.ww\\:underline-offset-2{text-underline-offset:2px}.ww\\:opacity-0{opacity:0}.ww\\:opacity-60{opacity:.6}.ww\\:opacity-70{opacity:.7}.ww\\:opacity-100{opacity:1}.ww\\:shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ww\\:ring-\\[\\#0a6c74\\]{--tw-ring-color:#0a6c74}.ww\\:backdrop-blur-md{--tw-backdrop-blur:blur(var(--ww-blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.ww\\:backdrop-blur-xl{--tw-backdrop-blur:blur(var(--ww-blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.ww\\:backdrop-saturate-150{--tw-backdrop-saturate:saturate(150%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.ww\\:transition-\\[grid-template-rows\\,opacity\\]{transition-property:grid-template-rows,opacity;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-\\[max-width\\]{transition-property:max-width;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-\\[width\\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--ww-default-transition-timing-function));transition-duration:var(--tw-duration,var(--ww-default-transition-duration))}.ww\\:duration-150{--tw-duration:.15s;transition-duration:.15s}.ww\\:duration-200{--tw-duration:.2s;transition-duration:.2s}.ww\\:duration-300{--tw-duration:.3s;transition-duration:.3s}.ww\\:ease-out{--tw-ease:var(--ww-ease-out);transition-timing-function:var(--ww-ease-out)}.ww\\:outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.ww\\:group-hover\\:opacity-0:is(:where(.ww\\:group):hover *){opacity:0}.ww\\:group-hover\\:opacity-100:is(:where(.ww\\:group):hover *){opacity:1}}.ww\\:group-\\[\\.is-assistant\\]\\:text-foreground:is(:where(.ww\\:group).is-assistant *){color:var(--ww-color-foreground,#1f2937)}.ww\\:group-\\[\\.is-user\\]\\:ml-auto:is(:where(.ww\\:group).is-user *){margin-left:auto}.ww\\:group-\\[\\.is-user\\]\\:\\[border-radius\\:var\\(--ww-msg-radius\\,8px\\)\\]:is(:where(.ww\\:group).is-user *){border-radius:var(--ww-msg-radius,8px)}.ww\\:group-\\[\\.is-user\\]\\:bg-user-bubble:is(:where(.ww\\:group).is-user *){background-color:var(--ww-color-user-bubble,#f4f4f4)}.ww\\:group-\\[\\.is-user\\]\\:\\[padding\\:var\\(--ww-msg-pad-y\\,12px\\)_var\\(--ww-msg-pad-x\\,16px\\)\\]:is(:where(.ww\\:group).is-user *){padding:var(--ww-msg-pad-y,12px)var(--ww-msg-pad-x,16px)}.ww\\:group-\\[\\.is-user\\]\\:\\[color\\:var\\(--ww-color-user-bubble-text\\)\\]:is(:where(.ww\\:group).is-user *){color:var(--ww-color-user-bubble-text)}.ww\\:placeholder\\:overflow-hidden::placeholder{overflow:hidden}.ww\\:placeholder\\:text-ellipsis::placeholder{text-overflow:ellipsis}.ww\\:placeholder\\:text-muted-foreground::placeholder{color:var(--ww-color-muted-foreground,#6b7280)}@media (hover:hover){.ww\\:hover\\:border-primary\\/30:hover{border-color:var(--ww-color-primary,#6366f1)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:border-primary\\/30:hover{border-color:color-mix(in oklab,var(--ww-color-primary,#6366f1)30%,transparent)}}.ww\\:hover\\:bg-accent:hover{background-color:var(--ww-color-accent,#f3f4f6)}.ww\\:hover\\:bg-border:hover{background-color:var(--ww-color-border,#e5e7eb)}.ww\\:hover\\:bg-foreground:hover{background-color:var(--ww-color-foreground,#1f2937)}.ww\\:hover\\:bg-muted:hover{background-color:var(--ww-color-muted,#f1f5f9)}.ww\\:hover\\:bg-muted-foreground\\/10:hover{background-color:var(--ww-color-muted-foreground,#6b7280)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:bg-muted-foreground\\/10:hover{background-color:color-mix(in oklab,var(--ww-color-muted-foreground,#6b7280)10%,transparent)}}.ww\\:hover\\:bg-primary\\/90:hover{background-color:var(--ww-color-primary,#6366f1)}@supports (color:color-mix(in lab, red, red)){.ww\\:hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab,var(--ww-color-primary,#6366f1)90%,transparent)}}.ww\\:hover\\:text-accent-foreground:hover{color:var(--ww-color-accent-foreground,#1f2937)}.ww\\:hover\\:text-foreground:hover{color:var(--ww-color-foreground,#1f2937)}.ww\\:hover\\:underline:hover{text-decoration-line:underline}}.ww\\:disabled\\:pointer-events-none:disabled{pointer-events:none}.ww\\:disabled\\:opacity-40:disabled{opacity:.4}.ww\\:disabled\\:opacity-50:disabled{opacity:.5}@media (min-width:40rem){.ww\\:sm\\:inset-auto{inset:auto}.ww\\:sm\\:right-0{right:calc(var(--ww-spacing)*0)}.ww\\:sm\\:bottom-4{bottom:calc(var(--ww-spacing)*4)}.ww\\:sm\\:left-0{left:calc(var(--ww-spacing)*0)}.ww\\:sm\\:mx-auto{margin-inline:auto}.ww\\:sm\\:h-\\[720px\\]{height:720px}.ww\\:sm\\:max-h-\\[calc\\(100dvh-2rem\\)\\]{max-height:calc(100dvh - 2rem)}.ww\\:sm\\:w-\\[calc\\(100vw-2rem\\)\\]{width:calc(100vw - 2rem)}.ww\\:sm\\:max-w-\\[1000px\\]{max-width:1000px}.ww\\:sm\\:rounded-2xl{border-radius:var(--ww-radius-2xl)}.ww\\:sm\\:border{border-style:var(--tw-border-style);border-width:1px}.ww\\:sm\\:border-border{border-color:var(--ww-color-border,#e5e7eb)}.ww\\:sm\\:py-2{padding-block:calc(var(--ww-spacing)*2)}.ww\\:sm\\:py-3{padding-block:calc(var(--ww-spacing)*3)}.ww\\:sm\\:pr-2{padding-right:calc(var(--ww-spacing)*2)}.ww\\:sm\\:pr-2\\.5{padding-right:calc(var(--ww-spacing)*2.5)}.ww\\:sm\\:pl-4{padding-left:calc(var(--ww-spacing)*4)}.ww\\:sm\\:pl-6{padding-left:calc(var(--ww-spacing)*6)}.ww\\:sm\\:text-sm{font-size:var(--ww-text-sm);line-height:var(--tw-leading,var(--ww-text-sm--line-height))}.ww\\:sm\\:text-\\[11px\\]{font-size:11px}}.ww\\:\\[\\&\\>\\*\\:first-child\\]\\:mt-0>:first-child{margin-top:calc(var(--ww-spacing)*0)}.ww\\:\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:calc(var(--ww-spacing)*0)}}@keyframes ww-fade-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes ww-fade-out{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@keyframes ww-pulse{0%,80%,to{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}}@keyframes ww-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media (prefers-reduced-motion:reduce){[data-waniwani-chat] [data-waniwani-shimmer]{color:var(--ww-color-muted-foreground)!important;animation:none!important}}[data-waniwani-floating=dock]{transition:opacity .32s,transform .42s cubic-bezier(.22,1,.36,1),max-width .3s,visibility 0s linear .42s}[data-waniwani-floating=dock][data-appeared=true][data-state=shown]{visibility:visible;opacity:1;pointer-events:auto;transition:opacity .32s,transform .42s cubic-bezier(.22,1,.36,1),max-width .3s,visibility;transform:translateY(0)}[data-waniwani-floating=dock][data-appeared=false],[data-waniwani-floating=dock][data-state=hidden]{opacity:0;visibility:hidden;pointer-events:none;transform:translateY(1rem)}[data-waniwani-floating=panel]{transition:clip-path .44s cubic-bezier(.22,1,.36,1),opacity .26s,visibility 0s linear .44s}[data-waniwani-floating=panel][data-state=shown]{visibility:visible;opacity:1;pointer-events:auto;clip-path:inset(-40px round 18px);transition:clip-path .44s cubic-bezier(.22,1,.36,1),opacity .26s,visibility}[data-waniwani-floating=panel][data-state=hidden]{opacity:0;visibility:hidden;pointer-events:none;clip-path:inset(calc(100% - 60px) 12% 0 round 24px)}@media (max-width:639px){[data-waniwani-floating=panel][data-state=shown]{clip-path:inset(0)}[data-waniwani-floating=panel][data-state=hidden]{clip-path:inset(calc(100% - 72px) 6% 0 round 22px)}}@media (prefers-reduced-motion:reduce){[data-waniwani-floating=dock],[data-waniwani-floating=panel]{clip-path:none;transition:visibility 0s linear 10ms}[data-waniwani-floating=dock][data-appeared=true][data-state=shown],[data-waniwani-floating=panel][data-state=shown]{transition:visibility}}[data-waniwani-chat] ::-webkit-scrollbar{width:8px}[data-waniwani-chat] ::-webkit-scrollbar-track{background:0 0}[data-waniwani-chat] ::-webkit-scrollbar-thumb{background:var(--ww-color-border);border-radius:9999px}[data-waniwani-chat] ::-webkit-scrollbar-thumb:hover{background:var(--ww-color-muted-foreground)}[data-waniwani-chat] *{scrollbar-width:thin;scrollbar-color:var(--ww-color-border)transparent}[data-waniwani-chat]{--ww-color-background:var(--ww-bg,#fff);--ww-color-foreground:var(--ww-text,#1f2937);--ww-color-primary:var(--ww-primary,#6366f1);--ww-color-primary-foreground:var(--ww-primary-fg,#1f2937);--ww-color-muted-foreground:var(--ww-muted,#6b7280);--ww-color-border:var(--ww-border,#e5e7eb);--ww-color-input:var(--ww-input-bg,#f9fafb);--ww-color-accent:var(--ww-assistant-bubble,#f3f4f6);--ww-color-accent-foreground:var(--ww-text,#1f2937);--ww-color-user-bubble:var(--ww-user-bubble,#f4f4f4);--ww-color-card:var(--ww-bg,#fff);--ww-color-card-foreground:var(--ww-text,#1f2937);--ww-color-card-header:var(--ww-header-bg,#fff);--ww-color-card-header-foreground:var(--ww-header-text,#1f2937);--ww-color-status:var(--ww-status,#22c55e);--ww-color-tool-card:var(--ww-tool-card,#f4f4f5);--ww-radius:var(--ww-radius,16px);--ww-font-sans:var(--ww-font,system-ui,-apple-system,\"Segoe UI\",sans-serif);--ww-color-user-bubble-text:var(--ww-user-bubble-text,var(--ww-color-primary-foreground));--ww-color-assistant-bubble-text:var(--ww-assistant-bubble-text,var(--ww-color-foreground));--ww-glass:var(--ww-glass-tint,transparent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat]{--ww-glass:color-mix(in srgb,var(--ww-glass-tint,transparent)calc(var(--ww-glass-tint-opacity,0)*100%),#eceef499)}}[data-waniwani-chat]{--ww-glass-border:#0000000f;border-style:solid;border-width:var(--ww-border-width,0);border-color:var(--ww-color-border);box-shadow:var(--ww-shadow,none)}[data-waniwani-chat][data-assistant-bubble=true] .ww-message-assistant .ww-bubble{background:var(--ww-color-accent);color:var(--ww-color-assistant-bubble-text);border-radius:var(--ww-msg-radius,8px);padding:var(--ww-msg-pad-y,12px)var(--ww-msg-pad-x,16px);width:fit-content;max-width:var(--ww-msg-max-width,80%)}.dark [data-waniwani-chat],[data-waniwani-chat].dark{--ww-color-background:var(--ww-bg,#212121);--ww-color-foreground:var(--ww-text,#ececec);--ww-color-primary:var(--ww-primary,#6366f1);--ww-color-primary-foreground:var(--ww-primary-fg,#fff);--ww-color-muted-foreground:var(--ww-muted,#8e8ea0);--ww-color-border:var(--ww-border,#444);--ww-color-input:var(--ww-input-bg,#2f2f2f);--ww-color-accent:var(--ww-assistant-bubble,#2f2f2f);--ww-color-accent-foreground:var(--ww-text,#ececec);--ww-color-user-bubble:var(--ww-user-bubble,#303030);--ww-color-card:var(--ww-bg,#212121);--ww-color-card-foreground:var(--ww-text,#ececec);--ww-color-card-header:var(--ww-header-bg,#1e1e1e);--ww-color-card-header-foreground:var(--ww-header-text,#ececec);--ww-color-status:var(--ww-status,#22c55e);--ww-color-tool-card:var(--ww-tool-card,#262626);--ww-color-user-bubble-text:var(--ww-user-bubble-text,#fff);--ww-color-assistant-bubble-text:var(--ww-assistant-bubble-text,var(--ww-color-foreground));--ww-glass:var(--ww-glass-tint,transparent)}@supports (color:color-mix(in lab, red, red)){.dark [data-waniwani-chat],[data-waniwani-chat].dark{--ww-glass:color-mix(in srgb,var(--ww-glass-tint,transparent)calc(var(--ww-glass-tint-opacity,0)*100%),#282a3480)}}.dark [data-waniwani-chat],[data-waniwani-chat].dark{--ww-glass-border:#ffffff1f}@media (prefers-color-scheme:dark){[data-waniwani-chat][data-color-scheme=auto]{--ww-color-background:var(--ww-bg,#212121);--ww-color-foreground:var(--ww-text,#ececec);--ww-color-primary:var(--ww-primary,#6366f1);--ww-color-primary-foreground:var(--ww-primary-fg,#fff);--ww-color-muted-foreground:var(--ww-muted,#8e8ea0);--ww-color-border:var(--ww-border,#444);--ww-color-input:var(--ww-input-bg,#2f2f2f);--ww-color-accent:var(--ww-assistant-bubble,#2f2f2f);--ww-color-accent-foreground:var(--ww-text,#ececec);--ww-color-user-bubble:var(--ww-user-bubble,#303030);--ww-color-card:var(--ww-bg,#212121);--ww-color-card-foreground:var(--ww-text,#ececec);--ww-color-card-header:var(--ww-header-bg,#1e1e1e);--ww-color-card-header-foreground:var(--ww-header-text,#ececec);--ww-color-status:var(--ww-status,#22c55e);--ww-color-tool-card:var(--ww-tool-card,#262626);--ww-color-user-bubble-text:var(--ww-user-bubble-text,#fff);--ww-color-assistant-bubble-text:var(--ww-assistant-bubble-text,var(--ww-color-foreground));--ww-glass:var(--ww-glass-tint,transparent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat][data-color-scheme=auto]{--ww-glass:color-mix(in srgb,var(--ww-glass-tint,transparent)calc(var(--ww-glass-tint-opacity,0)*100%),#282a3480)}}[data-waniwani-chat][data-color-scheme=auto]{--ww-glass-border:#ffffff1f}}[data-waniwani-chat] [data-streamdown=table-wrapper]{flex-direction:column;gap:.5rem;margin-top:1rem;margin-bottom:1rem;display:flex}[data-waniwani-chat] [data-streamdown=table-wrapper]>div:first-child:has(button){justify-content:flex-end;align-items:center;gap:.25rem;display:flex}[data-waniwani-chat] [data-streamdown=table-wrapper]>div:last-child{overflow-x:auto}[data-waniwani-chat] [data-streamdown=table]{border-collapse:collapse;border:1px solid var(--ww-color-border);border-radius:.75rem;width:100%;overflow:hidden}[data-waniwani-chat] [data-streamdown=table-header]{background-color:var(--ww-color-accent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=table-header]{background-color:color-mix(in srgb,var(--ww-color-accent)80%,transparent)}}[data-waniwani-chat] [data-streamdown=table-body]{background-color:var(--ww-color-accent)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=table-body]{background-color:color-mix(in srgb,var(--ww-color-accent)40%,transparent)}}[data-waniwani-chat] [data-streamdown=table-body]>tr+tr{border-top:1px solid var(--ww-color-border)}[data-waniwani-chat] [data-streamdown=table-row]{border-bottom:1px solid var(--ww-color-border)}[data-waniwani-chat] [data-streamdown=table-header-cell]{white-space:nowrap;text-align:left;padding:.5rem 1rem;font-size:.875rem;font-weight:600}[data-waniwani-chat] [data-streamdown=table-cell]{padding:.5rem 1rem;font-size:.875rem}[data-waniwani-chat] [data-streamdown=link]{color:var(--ww-color-primary);overflow-wrap:anywhere;cursor:pointer;font-weight:500;text-decoration:underline}[data-waniwani-chat].dark [data-streamdown=link],.dark [data-waniwani-chat] [data-streamdown=link]{color:var(--ww-color-primary)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat].dark [data-streamdown=link],.dark [data-waniwani-chat] [data-streamdown=link]{color:color-mix(in oklab,var(--ww-color-primary)55%,white)}}@media (prefers-color-scheme:dark){[data-waniwani-chat][data-color-scheme=auto] [data-streamdown=link]{color:var(--ww-color-primary)}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat][data-color-scheme=auto] [data-streamdown=link]{color:color-mix(in oklab,var(--ww-color-primary)55%,white)}}}[data-waniwani-chat].dark [data-waniwani-logo],.dark [data-waniwani-chat] [data-waniwani-logo]{filter:invert()}@media (prefers-color-scheme:dark){[data-waniwani-chat][data-color-scheme=auto] [data-waniwani-logo]{filter:invert()}}[data-waniwani-chat] [data-streamdown=link-safety-modal]{z-index:50;background-color:var(--ww-color-background);justify-content:center;align-items:center;display:flex;position:fixed;inset:0}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=link-safety-modal]{background-color:color-mix(in srgb,var(--ww-color-background)50%,transparent)}}[data-waniwani-chat] [data-streamdown=link-safety-modal]{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div{border:1px solid var(--ww-color-border);background-color:var(--ww-color-background);width:100%;max-width:28rem;color:var(--ww-color-foreground);border-radius:.75rem;flex-direction:column;gap:1rem;margin:0 1rem;padding:1.5rem;display:flex;position:relative;box-shadow:0 10px 25px #0000001a}[data-waniwani-chat] [data-streamdown=link-safety-modal] button{cursor:pointer}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>button:first-child{color:var(--ww-color-muted-foreground);background:0 0;border:none;border-radius:.375rem;padding:.25rem;transition:background-color .15s,color .15s;position:absolute;top:1rem;right:1rem}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>button:first-child:hover{background-color:var(--ww-color-accent);color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type{flex-direction:column;gap:.5rem;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type>div{align-items:center;gap:.5rem;font-size:1.125rem;font-weight:600;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:first-of-type>p{color:var(--ww-color-muted-foreground);font-size:.875rem}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:nth-child(3){word-break:break-all;background-color:var(--ww-color-accent);border-radius:.375rem;max-height:8rem;padding:.75rem;font-family:ui-monospace,monospace;font-size:.875rem;overflow-y:auto}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child{gap:.5rem;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button{border:none;border-radius:.375rem;flex:1;justify-content:center;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.875rem;font-weight:500;transition:background-color .15s;display:flex}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:first-child{border:1px solid var(--ww-color-border);background-color:var(--ww-color-background);color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:first-child:hover{background-color:var(--ww-color-accent)}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:last-child{background-color:var(--ww-color-primary);color:#fff}[data-waniwani-chat] [data-streamdown=link-safety-modal]>div>div:last-child>button:last-child:hover{opacity:.9}[data-waniwani-chat] [data-streamdown=ordered-list]{white-space:normal;list-style-type:decimal;list-style-position:inside}[data-waniwani-chat] li [data-streamdown=ordered-list]{padding-left:1.5rem}[data-waniwani-chat] [data-streamdown=unordered-list]{white-space:normal;list-style-type:disc;list-style-position:inside}[data-waniwani-chat] li [data-streamdown=unordered-list]{padding-left:1.5rem}[data-waniwani-chat] [data-streamdown=list-item]{padding-top:.25rem;padding-bottom:.25rem}[data-waniwani-chat] [data-streamdown=list-item]>p{display:inline}[data-waniwani-chat] [data-streamdown=inline-code]{background-color:var(--ww-color-accent);border-radius:.25rem;padding:.125rem .375rem;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,monospace;font-size:.875rem}[data-waniwani-chat] [data-streamdown=heading-1]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.875rem;font-weight:600;line-height:2.25rem}[data-waniwani-chat] [data-streamdown=heading-2]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.5rem;font-weight:600;line-height:2rem}[data-waniwani-chat] [data-streamdown=heading-3]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.25rem;font-weight:600;line-height:1.75rem}[data-waniwani-chat] [data-streamdown=heading-4]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1.125rem;font-weight:600;line-height:1.75rem}[data-waniwani-chat] [data-streamdown=heading-5]{margin-top:1.5rem;margin-bottom:.5rem;font-size:1rem;font-weight:600;line-height:1.5rem}[data-waniwani-chat] [data-streamdown=heading-6]{margin-top:1.5rem;margin-bottom:.5rem;font-size:.875rem;font-weight:600;line-height:1.25rem}[data-waniwani-chat] [data-streamdown=blockquote]{border-left:4px solid var(--ww-color-muted-foreground);margin-top:1rem;margin-bottom:1rem}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=blockquote]{border-left:4px solid color-mix(in srgb,var(--ww-color-muted-foreground)30%,transparent)}}[data-waniwani-chat] [data-streamdown=blockquote]{color:var(--ww-color-muted-foreground);padding-left:1rem;font-style:italic}[data-waniwani-chat] [data-streamdown=horizontal-rule]{border-color:var(--ww-color-border);margin-top:1.5rem;margin-bottom:1.5rem}[data-waniwani-chat] [data-streamdown=strong]{font-weight:600}[data-waniwani-chat] [data-streamdown=image-wrapper]{margin-top:1rem;margin-bottom:1rem;display:inline-block;position:relative}[data-waniwani-chat] [data-streamdown=image]{border-radius:.5rem;max-width:100%}[data-waniwani-chat] [data-streamdown=code-block]{border:1px solid var(--ww-color-border);border-radius:.75rem;width:100%;margin-top:1rem;margin-bottom:1rem;overflow:hidden}[data-waniwani-chat] [data-streamdown=code-block-header]{background-color:var(--ww-color-accent);justify-content:space-between;align-items:center;display:flex}@supports (color:color-mix(in lab, red, red)){[data-waniwani-chat] [data-streamdown=code-block-header]{background-color:color-mix(in srgb,var(--ww-color-accent)80%,transparent)}}[data-waniwani-chat] [data-streamdown=code-block-header]{color:var(--ww-color-muted-foreground);padding:.75rem;font-size:.75rem}[data-waniwani-chat] [data-streamdown=code-block-body]{padding:1rem;font-size:.875rem;overflow-x:auto}[data-waniwani-chat] [data-streamdown=code-block-copy-button],[data-waniwani-chat] [data-streamdown=code-block-download-button]{cursor:pointer;color:var(--ww-color-muted-foreground);background:0 0;border:none;padding:.25rem;transition:color .15s}[data-waniwani-chat] [data-streamdown=code-block-copy-button]:hover,[data-waniwani-chat] [data-streamdown=code-block-download-button]:hover{color:var(--ww-color-foreground)}[data-waniwani-chat] [data-streamdown=mermaid-block]{border:1px solid var(--ww-color-border);border-radius:.75rem;height:auto;margin-top:1rem;margin-bottom:1rem;padding:1rem;position:relative}[data-waniwani-chat] [data-streamdown=mermaid]{width:100%;height:100%}@property --tw-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\"*\";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-tracking{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-backdrop-blur{syntax:\"*\";inherits:false}@property --tw-backdrop-brightness{syntax:\"*\";inherits:false}@property --tw-backdrop-contrast{syntax:\"*\";inherits:false}@property --tw-backdrop-grayscale{syntax:\"*\";inherits:false}@property --tw-backdrop-hue-rotate{syntax:\"*\";inherits:false}@property --tw-backdrop-invert{syntax:\"*\";inherits:false}@property --tw-backdrop-opacity{syntax:\"*\";inherits:false}@property --tw-backdrop-saturate{syntax:\"*\";inherits:false}@property --tw-backdrop-sepia{syntax:\"*\";inherits:false}@property --tw-duration{syntax:\"*\";inherits:false}@property --tw-ease{syntax:\"*\";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}";function eZ(e){return e.startsWith("__WANIWANI")}function Gh(e){if(!cI||eZ(cI))return;let t=document.createElement("style");t.textContent=cI,e.appendChild(t)}var je=j(Ee(),1);var Xh=j(Ee(),1),tZ=3e3,aZ=120,nZ=24;function jB(e){let[t,a]=(0,Xh.useState)(!1);return(0,Xh.useEffect)(()=>{if(!e||typeof document>"u"){a(!1);return}let n=!1,r=null,o=null,i=null,s=u=>{r=new IntersectionObserver(c=>{let d=c[0];d&&a(!d.isIntersecting&&d.boundingClientRect.bottom<=0)},{rootMargin:`0px 0px -${nZ}px 0px`,threshold:0}),r.observe(u)},l=()=>{if(n)return;let u=null;try{u=document.querySelector(e)}catch{a(!0);return}if(u){s(u);return}o=setTimeout(l,aZ)};return l(),i=setTimeout(()=>{n||r||(o&&clearTimeout(o),a(!0))},tZ),()=>{n=!0,r?.disconnect(),o&&clearTimeout(o),i&&clearTimeout(i)}},[e]),t}var Mt=j(me(),1),rZ=2e3,oZ=90,iZ=1e3,VB=(0,je.forwardRef)(function(t,a){return(0,Mt.jsx)(es,{locale:t.config.locale,children:(0,Mt.jsx)(sZ,{...t,ref:a})})}),sZ=(0,je.forwardRef)(function({config:t,programmatic:a,scriptConfig:n},r){let{t:o}=Ue(),{config:i,ready:s}=yu(t,a,n),l=hu(i.visibility,s),u=Jd(),c=l?DB(i.visibility,u):null,d=jB(c),p=(0,je.useRef)(null),m=(0,je.useMemo)(()=>su({mode:"floating",getSessionId:()=>p.current?.sessionId}),[]),h=i.onEvent;(0,je.useEffect)(()=>{if(h)return m.subscribe(h)},[h,m]);let v=(0,je.useRef)(null),I=(0,je.useRef)(null),y=(0,je.useRef)(!1),[w,g]=(0,je.useState)("input"),[S,E]=(0,je.useState)(""),[T,R]=(0,je.useState)(!1),[O,U]=(0,je.useState)(!1),[A,Q]=(0,je.useState)(0),$=i.appearance?.theme,H=i.appearance?.variables,Z=(0,je.useMemo)(()=>H?pu(H):{},[H]),X=gu(i),B=(0,je.useMemo)(()=>Ss({flow:null,followup:null,...X}),[X]),P=(0,je.useMemo)(()=>B?.suggestions.map(ie=>ie.text)??[],[B]);Fl({widgetEvents:m,api:i.api,token:i.token,channelId:i.channelId,source:i.source,mode:"floating",pagePrompts:X.page,getSessionId:()=>p.current?.sessionId});let J=(0,je.useRef)(null);(0,je.useEffect)(()=>{!O||!B||J.current!==B&&(J.current=B,m.emit({name:"suggestions.shown",properties:{texts:P,origin:B.origin}}))},[O,B,P,m]);let ge=i.launcherText??i.placeholder??o.launcher.prompt,C=Hl(ge,S.length===0),ze="var(--ww-shadow, 0 10px 30px rgba(0, 0, 0, 0.08))";(0,je.useEffect)(()=>{if(!l){R(!1);return}if(c){R(d);return}let ie=i.appearDelay??rZ,xe=setTimeout(()=>R(!0),Math.max(0,ie));return()=>clearTimeout(xe)},[l,i.appearDelay,c,d]),(0,je.useEffect)(()=>{if(!T||P.length===0)return;let ie=setTimeout(()=>{y.current||g(xe=>xe==="input"?"expanded":xe)},iZ);return()=>clearTimeout(ie)},[T,P.length]),(0,je.useEffect)(()=>{A>0&&w==="open"&&p.current?.focus()},[A,w]);let ot=(0,je.useRef)(!1);(0,je.useEffect)(()=>{s&&!ot.current&&(ot.current=!0,m.emit({name:"chat.ready"}))},[s,m]),ru({api:i.api,token:i.token,channelId:i.channelId,mode:"floating",paintMark:"launcherPainted",painted:s&&l});let x=(0,je.useRef)(!1);(0,je.useEffect)(()=>{let ie=l&&w==="open";ie!==x.current&&(x.current=ie,m.emit({name:ie?"chat.opened":"chat.closed"}))},[l,w,m]);let te=(0,je.useCallback)(()=>{g("open")},[]),re=(0,je.useCallback)(()=>{y.current=!0,g("input")},[]);(0,je.useEffect)(()=>{if(w!=="expanded"){U(!1);return}let ie=setTimeout(()=>U(!0),oZ);return()=>clearTimeout(ie)},[w]);let ke=(0,je.useCallback)(ie=>{te();let xe=ie.trim();xe&&p.current?.sendMessage(xe)},[te]);(0,je.useImperativeHandle)(r,()=>({open:()=>te(),close:()=>re(),toggle:()=>{g(ie=>ie==="open"?"input":"open")},sendMessage:ie=>ke(ie),sendMessageAndWait:async ie=>{te();let xe=p.current;if(xe)return await xe.sendMessageAndWait(ie)},reset:()=>p.current?.reset(),focus:()=>{te(),Q(ie=>ie+1)},getMessages:()=>p.current?.messages??[],getSessionId:()=>p.current?.sessionId}),[ke,te,re]);let We=(0,je.useCallback)(()=>{S.trim()&&(ke(S),E(""))},[S,ke]),be=(0,je.useCallback)(()=>{(p.current?.messages.length??0)>0?(g("open"),Q(ie=>ie+1)):(y.current=!1,g(ie=>ie==="input"?"expanded":ie))},[]),Oe={mode:"floating"},we=zl(i.sessionApi);i.mcpServerUrl&&(Oe.mcpServerUrl=i.mcpServerUrl),i.channelId&&(Oe.channelId=i.channelId);let ce=P.length>0&&w!=="input",Le=(0,Mt.jsx)("button",{type:"button",onClick:re,"aria-label":o.launcher.close,className:"ww:flex ww:size-7 ww:items-center ww:justify-center ww:rounded-md ww:text-muted-foreground ww:transition-colors hover:ww:bg-accent hover:ww:text-foreground ww:cursor-pointer",children:(0,Mt.jsx)(wn,{className:"ww:size-4"})});return(0,Mt.jsx)(lu,{value:m,children:(0,Mt.jsx)("div",{"data-waniwani-chat":"","data-color-scheme":$==="auto"?"auto":void 0,className:V("ww:contents ww:font-[family-name:var(--ww-font-sans)]",$==="dark"&&"dark"),style:Z,children:l&&(0,Mt.jsxs)(Mt.Fragment,{children:[(0,Mt.jsx)("div",{ref:I,"data-waniwani-floating":"dock","data-state":w==="open"?"hidden":"shown","data-appeared":T?"true":"false",className:V("ww:fixed ww:bottom-3 ww:sm:bottom-4 ww:left-0 ww:right-0 ww:mx-auto ww:z-[2147483002] ww:flex ww:flex-col","ww:w-[calc(100vw-2rem)] ww:transition-[max-width] ww:duration-300 ww:ease-out",ce?"ww:max-w-[720px]":"ww:max-w-[440px]"),children:(0,Mt.jsxs)("div",{className:V("ww:relative ww:flex ww:flex-col ww:rounded-[20px] ww:border ww:transition-all ww:duration-300 ww:ease-out",ce?"ww:p-2 ww:backdrop-blur-xl ww:backdrop-saturate-150":"ww:border-transparent ww:p-0"),style:ce?{boxShadow:ze,backgroundColor:"var(--ww-glass)",borderColor:"var(--ww-glass-border)"}:void 0,children:[ce&&w!=="open"&&(0,Mt.jsx)("button",{type:"button",onClick:re,"aria-label":o.launcher.close,className:"ww:absolute ww:right-2 ww:top-2 ww:z-10 ww:flex ww:size-7 ww:items-center ww:justify-center ww:rounded-md ww:text-muted-foreground ww:transition-colors hover:ww:bg-accent hover:ww:text-foreground ww:cursor-pointer",children:(0,Mt.jsx)(wn,{className:"ww:size-4"})}),P.length>0&&(0,Mt.jsx)("div",{className:V("ww:grid ww:transition-all ww:duration-300 ww:ease-out",O?"ww:grid-rows-[1fr] ww:opacity-100":"ww:pointer-events-none ww:grid-rows-[0fr] ww:opacity-0"),children:(0,Mt.jsx)("div",{className:"ww:overflow-hidden",children:(0,Mt.jsx)(Sl,{suggestions:P,onSelect:ie=>{m.emit({name:"suggestion.clicked",properties:{text:ie,index:P.indexOf(ie),origin:B?.origin??"channel"}}),ke(ie)},className:"ww:pl-1 ww:pr-9 ww:pt-1 ww:pb-2.5"})})}),(0,Mt.jsx)(Yp,{animated:T,backgroundColor:"var(--ww-color-input)",borderRadius:16,edgeSensitivity:30,coneSpread:25,colors:["#c084fc","#f472b6","#38bdf8"],className:"ww:border-border",style:{boxShadow:ze},children:(0,Mt.jsxs)("div",{className:"ww:flex ww:items-center ww:gap-1 ww:pl-3.5 ww:pr-1.5 ww:py-1.5 ww:sm:pl-4 ww:sm:pr-2 ww:sm:py-2",children:[(0,Mt.jsx)("input",{ref:v,type:"text",value:S,placeholder:C,onChange:ie=>E(ie.target.value),onFocus:be,onKeyDown:ie=>{ie.key==="Enter"&&!ie.shiftKey&&(ie.preventDefault(),We())},className:"ww:min-w-0 ww:flex-1 ww:bg-transparent ww:py-1 ww:text-base ww:sm:text-sm ww:text-foreground ww:outline-none ww:placeholder:text-muted-foreground"}),(0,Mt.jsx)("button",{type:"button",onClick:We,disabled:!S.trim(),"aria-label":o.promptInput.submit,className:"ww:relative ww:flex ww:size-8 ww:shrink-0 ww:items-center ww:justify-center ww:rounded-full ww:bg-foreground ww:text-background ww:transition-opacity hover:ww:opacity-90 disabled:ww:opacity-40",children:(0,Mt.jsx)(pr,{className:"ww:size-4"})})]})})]})}),(0,Mt.jsx)("div",{role:"dialog","aria-label":i.title??ge,"data-waniwani-floating":"panel","data-state":w==="open"?"shown":"hidden",style:{boxShadow:ze},className:V("ww:fixed ww:z-[2147483002] ww:flex ww:flex-col ww:overflow-hidden ww:bg-background","ww:inset-0 ww:w-full ww:rounded-none","ww:sm:inset-auto ww:sm:bottom-4 ww:sm:left-0 ww:sm:right-0 ww:sm:mx-auto ww:sm:h-[720px] ww:sm:max-h-[calc(100dvh-2rem)] ww:sm:w-[calc(100vw-2rem)] ww:sm:max-w-[1000px] ww:sm:rounded-2xl ww:sm:border ww:sm:border-border"),children:(0,Mt.jsx)(mu,{transport:we,ref:p,api:i.api??"",headers:{Authorization:`Bearer ${i.token}`},skipRemoteConfig:!0,body:Oe,appearance:i.appearance,title:i.title,headerActions:Le,hideHeader:!1,onScreen:w==="open",welcomeMessage:i.welcomeMessage,placeholder:i.placeholder,suggestions:X,enableThreadHistory:i.enableThreadHistory,documentUpload:i.documentUpload,showToolCalls:i.showToolCalls,locale:i.locale,initializing:!s})})]})})})});var rn=j(Ee(),1);var dI=j(me(),1),$B=(0,rn.forwardRef)(function({config:t,programmatic:a,scriptConfig:n,onReady:r,onVisibilityChange:o},i){let{config:s,ready:l}=yu(t,a,n),u=(0,rn.useRef)(null),c=(0,rn.useMemo)(()=>su({mode:"inline",getSessionId:()=>u.current?.sessionId}),[]),d=s.onEvent;(0,rn.useEffect)(()=>{if(d)return c.subscribe(d)},[d,c]);let p=(0,rn.useRef)(!1);(0,rn.useEffect)(()=>{l&&!p.current&&(p.current=!0,c.emit({name:"chat.ready"}))},[l,c]),(0,rn.useEffect)(()=>{r?.()},[]);let m=hu(s.visibility,l);(0,rn.useEffect)(()=>{o?.(m)},[m,o]),ru({api:s.api,token:s.token,channelId:s.channelId,mode:"inline",paintMark:"chatVisible",painted:l}),(0,rn.useImperativeHandle)(i,()=>({get chat(){return u.current}}),[]);let h=gu(s);Fl({widgetEvents:c,api:s.api,token:s.token,channelId:s.channelId,source:s.source,mode:"inline",pagePrompts:h.page,getSessionId:()=>u.current?.sessionId});let v={mode:"inline"},I=zl(s.sessionApi);return s.mcpServerUrl&&(v.mcpServerUrl=s.mcpServerUrl),s.channelId&&(v.channelId=s.channelId),(0,dI.jsx)(lu,{value:c,children:(0,dI.jsx)(mu,{transport:I,ref:u,api:s.api??"",headers:{Authorization:`Bearer ${s.token}`},skipRemoteConfig:!0,body:v,appearance:s.appearance,title:s.title,hideHeader:s.hideHeader,welcomeMessage:s.welcomeMessage,placeholder:s.placeholder,suggestions:h,enableThreadHistory:s.enableThreadHistory,documentUpload:s.documentUpload,showToolCalls:s.showToolCalls,locale:s.locale,initializing:!l})})});var ef=j(Ee(),1),JB=j(qw(),1);function WB(){if(typeof document>"u"&&typeof navigator>"u")return null;let e=(typeof document<"u"?document.modelContext:void 0)??(typeof navigator<"u"?navigator.modelContext:void 0);return e&&typeof e.registerTool=="function"?e:null}function fI(){return WB()!==null}function lZ(){return{url:location.href,title:document.title}}async function pI(e){let{endpoint:t,listEndpoint:a,headers:n,sessionId:r,visitorId:o,channelId:i,onWidget:s}=e,l=e.logger??console,u=WB();if(!u)return null;let c=new AbortController,d=()=>c.abort();window.addEventListener("pagehide",d);let p=!1,m=()=>{p||(p=!0,window.removeEventListener("pagehide",d),c.abort())};function h(){return{sessionId:r,visitorId:o,channelId:i,page:lZ()}}async function v(g,S){let E=await fetch(t,{method:"POST",headers:{"content-type":"application/json",...n},body:JSON.stringify(g),...S?{signal:S}:{}});if(!E.ok)throw new Error(`webmcp ${g.action} failed: ${E.status}`);return await E.json()}async function I(){if(a)try{let g=await fetch(a);if(g.ok)return await g.json();l.info(`[webmcp] list GET answered ${g.status}, using POST`)}catch(g){l.info("[webmcp] list GET failed, using POST",g)}return v({...h(),action:"list"})}let y=[];try{let g=await I();y=Array.isArray(g?.tools)?g.tools:[]}catch(g){return l.error("[webmcp] could not list site tools",g),m(),null}let w=[];return await Promise.all(y.map(async g=>{try{await u.registerTool({name:g.name,description:g.description??"",...g.inputSchema?{inputSchema:g.inputSchema}:{},...g.annotations?{annotations:g.annotations}:{},execute:async(S,E)=>{let T=await v({...h(),action:"call",name:g.name,arguments:S??{}},E?.signal);return T?.widget&&s?.(T.widget),{content:T?.content??[]}}},{signal:c.signal}),w.push(g)}catch(S){l.error(`[webmcp] could not register ${g.name}`,S)}})),l.info(`[webmcp] registered ${w.length} site tool(s)`),{get tools(){return w},callTool:({name:g,arguments:S})=>v({...h(),action:"call",name:g,arguments:S??{}}),dispose:m}}function GB(e,t,a){if(e.webmcp?.enabled===!1||t===!1)return null;let n=e.api??"";if(!e.token)return null;let r=e.mcpServerUrl?{mcpServerUrl:e.mcpServerUrl}:void 0,o=e.channelId??a;return{toolsEndpoint:Na(n,"/webmcp",r),listEndpoint:Na(n,"/webmcp/tools",{token:e.token,...o&&{channel:o},...r}),...o&&{channelId:o},headers:{Authorization:`Bearer ${e.token}`},resourceEndpoint:Na(n,"/resource",{token:e.token,...r})}}var di=j(Ee(),1);var wu=j(me(),1),XB=672,KB=32;function YB({widget:e,onCallTool:t,toolsEndpoint:a,headers:n,resourceEndpoint:r,onClose:o,isDark:i=!1}){let[s,l]=(0,di.useState)(null);(0,di.useEffect)(()=>{let m=()=>l({width:window.innerWidth,height:window.innerHeight});return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]);let u=e?.preview===!0;(0,di.useEffect)(()=>{if(!e||!u)return;let m=h=>{h.key==="Escape"&&o()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[e,u,o]),(0,di.useEffect)(()=>{if(!e)return;let m=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=m}},[e]);let c=(0,di.useCallback)(async m=>{if(t)return t(m);if(!a)throw new Error("webmcp overlay needs onCallTool");let h=await fetch(a,{method:"POST",headers:{"content-type":"application/json",...n},body:JSON.stringify({action:"call",...m})});if(!h.ok)throw new Error(`webmcp tool call failed: ${h.status}`);return await h.json()},[t,a,n]);if(!e)return null;let d=s?Math.min(XB,s.width-KB):XB,p=s?s.height-KB:void 0;return(0,wu.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Waniwani",className:V("ww:fixed ww:inset-0 ww:z-[2147483000] ww:flex ww:items-center ww:justify-center ww:bg-black/45 ww:backdrop-blur-md",i&&"dark"),children:[u&&(0,wu.jsx)("button",{type:"button","aria-label":"Close",onClick:o,className:"ww:absolute ww:inset-0 ww:h-full ww:w-full ww:cursor-pointer ww:border-none ww:bg-transparent ww:p-0"}),(0,wu.jsx)("div",{className:"ww:relative ww:overflow-auto ww:rounded-2xl ww:bg-background ww:shadow-2xl",style:{width:d,maxHeight:p},children:(0,wu.jsx)(Mh,{resourceUri:e.viewUri,resourceEndpoint:r,toolInput:e.data,toolResult:e.result,autoHeight:qd(e.result._meta),isDark:i,onCallTool:c,onOpenLink:m=>window.open(m,"_blank","noopener")},`${r}|${e.viewUri}`)})]})}var mI=j(me(),1),ZB="waniwani:webmcp:session";function uZ(){try{let e=sessionStorage.getItem(ZB);if(e)return e;let t=crypto.randomUUID();return sessionStorage.setItem(ZB,t),t}catch{return`s-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}}function cZ(e){let t=e.token?ci(e.api??"",e.token,e.channelId):null,a=GB(e,t?.webmcp?.enabled,t?.channelId);return a||Ua("[webmcp] not publishing site tools: switched off, or no token"),a}function dZ(){try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function fZ(){let e=null,t=null;return{emit(a){e?e(a):t=a},subscribe(a){return e=a,t&&(a(t),t=null),()=>{e===a&&(e=null)}}}}function pZ({resourceEndpoint:e,subscribe:t,callTool:a}){let[n,r]=ef.default.useState(null),[o,i]=ef.default.useState(dZ);return ef.default.useEffect(()=>t(r),[t]),ef.default.useEffect(()=>{let s;try{s=window.matchMedia("(prefers-color-scheme: dark)")}catch{return}let l=()=>i(s.matches);return s.addEventListener("change",l),()=>s.removeEventListener("change",l)},[]),(0,mI.jsx)(YB,{widget:n,onCallTool:a,resourceEndpoint:e,isDark:o,onClose:()=>r(null)})}function QB(e){if(!fI())return null;let t=cZ(e);if(!t)return null;let a=document.createElement("div");a.setAttribute("data-waniwani-webmcp",""),a.style.cssText="position:relative;z-index:2147483001;",document.body.appendChild(a);let n=a.attachShadow({mode:"open"});Gh(n);let r=document.createElement("div");n.appendChild(r);let o=fZ(),i=null,s=!1;pI({endpoint:t.toolsEndpoint,listEndpoint:t.listEndpoint,headers:t.headers,channelId:t.channelId,sessionId:uZ(),visitorId:ma(),onWidget:o.emit}).then(c=>{if(s){c?.dispose();return}i=c}).catch(c=>{console.error("[webmcp] could not publish site tools",c)});let l=async c=>{if(!i)throw new Error("webmcp bridge is not registered");let d=await i.callTool(c);return d.widget?.interactive&&o.emit(d.widget),d},u=JB.default.createRoot(r);return u.render((0,mI.jsx)(pZ,{resourceEndpoint:t.resourceEndpoint,subscribe:o.subscribe,callTool:l})),{getTools:()=>(i?.tools??[]).map(c=>c.name),destroy:()=>{s=!0,i?.dispose(),u.unmount(),a.remove()}}}var Pt=null,jn=null,Xt=null,Is=null,Kh=null,mZ="waniwani-chat-sizing",hZ="waniwani-chat-defaults",gZ="waniwani-chat-chrome",yZ="waniwani-chat-auto-card",wZ=`:where([data-waniwani-embed]){height:${AB}}`,vZ=":where([data-waniwani-embed]){border-radius:16px;overflow:hidden}",xZ=":where([data-waniwani-embed]){border-style:solid;border-width:var(--ww-border-width,0);border-color:var(--ww-border,transparent);box-shadow:var(--ww-shadow,none)}",bZ=":where([data-waniwani-embed][data-waniwani-auto]){width:100%;max-width:28rem;margin-inline:auto;border-radius:16px;overflow:hidden;border-style:solid;border-width:var(--ww-border-width,1px);border-color:var(--ww-border,rgba(0,0,0,0.1));box-shadow:var(--ww-shadow,0 10px 30px rgba(0,0,0,0.08))}",SZ="waniwani-chat-composer-auto",IZ=":where([data-waniwani-embed][data-waniwani-auto]){width:100%;max-width:40rem;margin-inline:auto}";function tf(e,t){if(typeof document>"u"||document.getElementById(e))return;let a=document.createElement("style");a.id=e,a.textContent=t,document.head.appendChild(a)}function a3(e,t){let a=t.appearance?.variables;!a||!(e instanceof HTMLElement)||(typeof a.borderWidth=="number"&&e.style.setProperty("--ww-border-width",`${a.borderWidth}px`),a.borderColor&&e.style.setProperty("--ww-border",a.borderColor),a.boxShadow&&e.style.setProperty("--ww-shadow",a.boxShadow))}function Yh(e,t){Gh(e);let a=document.createElement("style");if(a.textContent="[data-waniwani-chat]{border-width:0;box-shadow:none}",e.appendChild(a),t.css)try{let n=new URL(t.css,window.location.href);if(n.protocol==="https:"||n.protocol==="http:"){let r=document.createElement("link");r.rel="stylesheet",r.href=n.href,e.appendChild(r)}else console.warn("[Waniwani] Custom CSS URL must use http or https protocol.")}catch{console.warn("[Waniwani] Invalid custom CSS URL:",t.css)}}var e3="data-waniwani-embed",af="data-waniwani-auto";function n3(e){let t=document.querySelector(`[${e3}]`);if(t)return t;let a=document.createElement("div");a.setAttribute(e3,""),a.setAttribute(af,"");let n=e?!!document.head?.contains(e):!1;return e?.parentNode&&!n?e.parentNode.insertBefore(a,e):document.body.appendChild(a),a}function CZ(e){return/^\d+$/.test(e.trim())?`${e.trim()}px`:e.trim()}function kZ(e,t,a,n){let r=n3(n);tf(mZ,wZ),e.height&&r instanceof HTMLElement&&(r.style.height=CZ(e.height)),e.appearance?.theme&&tf(hZ,vZ),tf(gZ,xZ),r.hasAttribute(af)&&tf(yZ,bZ),a3(r,e),Xt=document.createElement("div"),Xt.id="waniwani-chat-embed",Xt.style.cssText="width:100%;height:100%;max-height:inherit;display:flex;flex-direction:column;flex:1 1 auto;min-height:0;",r.appendChild(Xt);let o=Xt,i=()=>{let d=getComputedStyle(r);if(!d.maxHeight.endsWith("px")){o.style.removeProperty("max-height");return}let p=Number.parseFloat(d.maxHeight);if(!Number.isFinite(p)){o.style.removeProperty("max-height");return}let m=p;d.boxSizing==="border-box"&&(m-=(Number.parseFloat(d.paddingTop)||0)+(Number.parseFloat(d.paddingBottom)||0)+(Number.parseFloat(d.borderTopWidth)||0)+(Number.parseFloat(d.borderBottomWidth)||0)),m>0?o.style.maxHeight=`${m}px`:o.style.removeProperty("max-height")};i(),Kh=new ResizeObserver(i),Kh.observe(r);let s=Xt.attachShadow({mode:"open"});Yh(s,e);let l=document.createElement("div");l.className="ww:contents",s.appendChild(l);let u=Cs.default.createRef(),c=d=>{r instanceof HTMLElement&&(r.style.display=d?"":"none")};if(e.token){let d=ci(e.api??"",e.token,e.channelId);d?.visibility&&!Zd(d.visibility,window.location.pathname)&&c(!1)}return jn=Zh.default.createRoot(l),jn.render(Cs.default.createElement($B,{ref:u,config:e,programmatic:t,scriptConfig:a,onVisibilityChange:c})),{destroy:()=>{Kh?.disconnect(),Kh=null,jn?.unmount(),jn=null,Xt?.remove(),Xt=null,r.hasAttribute(af)&&r.remove(),Pt=null},open:()=>{},close:()=>{},toggle:()=>{},sendMessage:d=>u.current?.chat?.sendMessage(d),sendMessageAndWait:async d=>{let p=u.current?.chat;if(p)return await p.sendMessageAndWait(d)},reset:()=>u.current?.chat?.reset(),focus:()=>u.current?.chat?.focus(),getMessages:()=>u.current?.chat?.messages??[],getSessionId:()=>u.current?.chat?.sessionId}}function TZ(e,t,a){Xt=document.createElement("div"),Xt.id="waniwani-chat-embed",Xt.style.cssText="position:fixed;inset:0;z-index:2147483000;pointer-events:none;",document.body.appendChild(Xt);let n=Xt.attachShadow({mode:"open"});Yh(n,e);let r=document.createElement("div");r.className="ww:contents",n.appendChild(r);let o=Cs.default.createRef();return jn=Zh.default.createRoot(r),jn.render(Cs.default.createElement(VB,{ref:o,config:e,programmatic:t,scriptConfig:a})),{destroy:()=>{jn?.unmount(),jn=null,Xt?.remove(),Xt=null,Pt=null},open:()=>o.current?.open(),close:()=>o.current?.close(),toggle:()=>o.current?.toggle(),sendMessage:i=>o.current?.sendMessage(i),sendMessageAndWait:async i=>{if(o.current)return o.current.sendMessageAndWait(i)},reset:()=>o.current?.reset(),focus:()=>o.current?.focus(),getMessages:()=>o.current?.getMessages()??[],getSessionId:()=>o.current?.getSessionId()}}function LZ(){return{destroy:()=>{Pt=null},open:()=>{},close:()=>{},toggle:()=>{},sendMessage:()=>{},sendMessageAndWait:async()=>{},reset:()=>{},focus:()=>{},getMessages:()=>[],getSessionId:()=>{}}}function EZ(e,t,a,n){let r=n3(n);r.hasAttribute(af)&&tf(SZ,IZ),a3(r,e),Xt=document.createElement("div"),Xt.id="waniwani-chat-embed",Xt.style.cssText="display:block;width:100%;",r.appendChild(Xt);let o=Xt.attachShadow({mode:"open"});Yh(o,e);let i=document.createElement("div");i.className="ww:contents",o.appendChild(i),Is=document.createElement("div"),Is.id="waniwani-chat-panel",Is.style.cssText="position:fixed;inset:0;z-index:2147483000;pointer-events:none;",document.body.appendChild(Is);let s=Is.attachShadow({mode:"open"});Yh(s,e);let l=document.createElement("div");l.className="ww:contents",s.appendChild(l);let u=Cs.default.createRef(),c=d=>{r instanceof HTMLElement&&(r.style.display=d?"":"none")};if(e.token){let d=ci(e.api??"",e.token,e.channelId);d?.visibility&&!Zd(d.visibility,window.location.pathname)&&c(!1)}return jn=Zh.default.createRoot(i),jn.render(Cs.default.createElement(HB,{ref:u,config:e,programmatic:t,scriptConfig:a,panelContainer:l,onVisibilityChange:c})),{destroy:()=>{jn?.unmount(),jn=null,Xt?.remove(),Xt=null,Is?.remove(),Is=null,r.hasAttribute(af)&&r.remove(),Pt=null},open:()=>u.current?.open(),close:()=>u.current?.close(),toggle:()=>u.current?.toggle(),sendMessage:d=>u.current?.sendMessage(d),sendMessageAndWait:async d=>{if(u.current)return u.current.sendMessageAndWait(d)},reset:()=>u.current?.reset(),focus:()=>u.current?.focus(),getMessages:()=>u.current?.getMessages()??[],getSessionId:()=>u.current?.getSessionId()}}function r3(e){if(Pt)return console.warn("[Waniwani] Chat widget is already initialized. Call destroy() first to re-initialize."),Pt;let t=sI(),a=$h(),n=Yd(e,void 0,a);Sc(n.visitorId);let r=null;try{r=QB(n)}catch(l){console.error("[Waniwani] WebMCP setup failed",l)}let o;n.mode==="off"?o=LZ():n.mode==="floating"?o=TZ(n,e,a):n.mode==="composer"?o=EZ(n,e,a,t):o=kZ(n,e,a,t);let i=n.api??"",s=n.token?R1({api:i,token:n.token,channelId:()=>n.channelId??ci(i,n.token,n.channelId)?.channelId,getSource:()=>ci(i,n.token,n.channelId)?.source??void 0,getSessionId:()=>o.getSessionId()}):Wp("no public token configured (set data-token or pass token to init())");return Pt={...o,track:s.track,identify:(l,u)=>s.identify(l,u),setVisitorId:l=>wl(l),getVisitorId:()=>ma(),destroy:()=>{s.shutdown(),r?.destroy(),o.destroy()}},Pt}function AZ(){Pt&&Pt.destroy()}var o3=Wp("chat widget is not initialized (call WaniWani.chat.init() first)"),vu=()=>Pt?Pt.track:o3.track;window.WaniWani=window.WaniWani||{};window.WaniWani.chat={init:r3,destroy:AZ,open:()=>Pt?.open(),close:()=>Pt?.close(),toggle:()=>Pt?.toggle(),sendMessage:e=>Pt?.sendMessage(e),sendMessageAndWait:async e=>{if(Pt)return Pt.sendMessageAndWait(e)},reset:()=>Pt?.reset(),focus:()=>Pt?.focus(),getMessages:()=>Pt?.getMessages()??[],getSessionId:()=>Pt?.getSessionId(),track:Object.assign(e=>vu()(e),{priceShown:e=>vu().priceShown(e),pricesCompared:e=>vu().pricesCompared(e),optionSelected:e=>vu().optionSelected(e),leadQualified:e=>vu().leadQualified(e),converted:e=>vu().converted(e)}),identify:(e,t)=>Pt?Pt.identify(e,t):o3.identify(e,t),setVisitorId:e=>wl(e),getVisitorId:()=>ma()};function t3(){if($h().token)try{r3()}catch(t){console.error("[Waniwani] Auto-initialization failed:",t)}}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t3):t3();})();
146
146
  /*! Bundled license information:
147
147
 
148
148
  react/cjs/react.production.js: