@mastra/deployer-cloud 1.23.0-alpha.9 → 1.23.0
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.
- package/CHANGELOG.md +10 -0
- package/dist/studio/assets/{chunk-ZCJMLMGS-DJujhP13.js → chunk-ZCJMLMGS-DzjqpxSO.js} +1 -1
- package/dist/studio/assets/{index-BCygcIbA.js → index--M_-_-M3.js} +1 -1
- package/dist/studio/assets/{index-JxRg60yf.js → index-04Ga1pOq.js} +1 -1
- package/dist/studio/assets/{index-Bk9TuSgc.js → index-B1BoslNp.js} +1 -1
- package/dist/studio/assets/{index-DA4EkWzj.js → index-B9ojti2l.js} +1 -1
- package/dist/studio/assets/{index-MRpUtCW9.js → index-BCdyfE3O.js} +1 -1
- package/dist/studio/assets/{index-Cf0Ubdpj.js → index-BFfBKqFP.js} +1 -1
- package/dist/studio/assets/{index-CsnaQUo7.js → index-BxdRtlHb.js} +1 -1
- package/dist/studio/assets/{index-BR0NQGVO.js → index-BzQgA4o5.js} +1 -1
- package/dist/studio/assets/{index-BnaKZjni.js → index-CgRhknyO.js} +1 -1
- package/dist/studio/assets/{index-D9fB74IM.js → index-D1h4EPgk.js} +1 -1
- package/dist/studio/assets/{index-B6rIFuqy.js → index-D4xZzb1p.js} +1 -1
- package/dist/studio/assets/{index-CsruLyV3.js → index-DJ5VARKf.js} +1 -1
- package/dist/studio/assets/{index-DLYHAKqB.js → index-DhP3NFK_.js} +1 -1
- package/dist/studio/assets/{index-yHw3Ngb5.js → index-DigVG8_v.js} +1 -1
- package/dist/studio/assets/{index-DvZgbxSc.js → index-DluSEK8w.js} +1 -1
- package/dist/studio/assets/{index-DmVqfev1.js → index-W7WFFo7e.js} +1 -1
- package/dist/studio/assets/{index-Df7cXN4g.js → index-Ywo4_gGm.js} +1 -1
- package/dist/studio/assets/{index-DGH2qv3c.js → index-uoIcq-p2.js} +1 -1
- package/dist/studio/assets/{main-D4akO2Ky.js → main-OkSDUNYq.js} +6 -6
- package/dist/studio/assets/{token-APYSY3BW-RPVF55TR-D3-svBOT.js → token-APYSY3BW-RPVF55TR-DmO_XXIS.js} +1 -1
- package/dist/studio/assets/token-util-RMHT2CPJ-VVUHOXBL-Ck8yJN4U.js +1 -0
- package/dist/studio/index.html +1 -1
- package/package.json +6 -6
- package/versions.json +1 -1
- package/dist/studio/assets/token-util-RMHT2CPJ-VVUHOXBL-CCyfz7Dr.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./token-util-RMHT2CPJ-VVUHOXBL-
|
|
2
|
-
import{_ as nt}from"./index-DGH2qv3c.js";function D8e(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const s=Object.getOwnPropertyDescriptor(r,a);s&&Object.defineProperty(e,a,s.get?s:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var p$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var RB={exports:{}},YE={};var l0e;function D_t(){if(l0e)return YE;l0e=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,s){var i=null;if(s!==void 0&&(i=""+s),a.key!==void 0&&(i=""+a.key),"key"in a){s={};for(var l in a)l!=="key"&&(s[l]=a[l])}else s=a;return a=s.ref,{$$typeof:e,type:r,key:i,ref:a!==void 0?a:null,props:s}}return YE.Fragment=t,YE.jsx=n,YE.jsxs=n,YE}var c0e;function $_t(){return c0e||(c0e=1,RB.exports=D_t()),RB.exports}var o=$_t(),PB={exports:{}},dr={},u0e;function L_t(){if(u0e)return dr;u0e=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),p=Symbol.iterator;function m(V){return V===null||typeof V!="object"?null:(V=p&&V[p]||V["@@iterator"],typeof V=="function"?V:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,x={};function w(V,R,H){this.props=V,this.context=R,this.refs=x,this.updater=H||g}w.prototype.isReactComponent={},w.prototype.setState=function(V,R){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,R,"setState")},w.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function O(){}O.prototype=w.prototype;function k(V,R,H){this.props=V,this.context=R,this.refs=x,this.updater=H||g}var _=k.prototype=new O;_.constructor=k,v(_,w.prototype),_.isPureReactComponent=!0;var C=Array.isArray;function T(){}var j={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function I(V,R,H){var G=H.ref;return{$$typeof:t,type:V,key:R,ref:G!==void 0?G:null,props:H}}function P(V,R){return I(V.type,R,V.props)}function M(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function F(V){var R={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(H){return R[H]})}var D=/\/+/g;function U(V,R){return typeof V=="object"&&V!==null&&V.key!=null?F(""+V.key):R.toString(36)}function B(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(T,T):(V.status="pending",V.then(function(R){V.status==="pending"&&(V.status="fulfilled",V.value=R)},function(R){V.status==="pending"&&(V.status="rejected",V.reason=R)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function z(V,R,H,G,J){var ie=typeof V;(ie==="undefined"||ie==="boolean")&&(V=null);var ne=!1;if(V===null)ne=!0;else switch(ie){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(V.$$typeof){case t:case n:ne=!0;break;case f:return ne=V._init,z(ne(V._payload),R,H,G,J)}}if(ne)return J=J(V),ne=G===""?"."+U(V,0):G,C(J)?(H="",ne!=null&&(H=ne.replace(D,"$&/")+"/"),z(J,R,H,"",function(fe){return fe})):J!=null&&(M(J)&&(J=P(J,H+(J.key==null||V&&V.key===J.key?"":(""+J.key).replace(D,"$&/")+"/")+ne)),R.push(J)),1;ne=0;var ae=G===""?".":G+":";if(C(V))for(var le=0;le<V.length;le++)G=V[le],ie=ae+U(G,le),ne+=z(G,R,H,ie,J);else if(le=m(V),typeof le=="function")for(V=le.call(V),le=0;!(G=V.next()).done;)G=G.value,ie=ae+U(G,le++),ne+=z(G,R,H,ie,J);else if(ie==="object"){if(typeof V.then=="function")return z(B(V),R,H,G,J);throw R=String(V),Error("Objects are not valid as a React child (found: "+(R==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.")}return ne}function Q(V,R,H){if(V==null)return V;var G=[],J=0;return z(V,G,"","",function(ie){return R.call(H,ie,J++)}),G}function W(V){if(V._status===-1){var R=V._result;R=R(),R.then(function(H){(V._status===0||V._status===-1)&&(V._status=1,V._result=H)},function(H){(V._status===0||V._status===-1)&&(V._status=2,V._result=H)}),V._status===-1&&(V._status=0,V._result=R)}if(V._status===1)return V._result.default;throw V._result}var $=typeof reportError=="function"?reportError:function(V){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var R=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof V=="object"&&V!==null&&typeof V.message=="string"?String(V.message):String(V),error:V});if(!window.dispatchEvent(R))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",V);return}console.error(V)},Z={map:Q,forEach:function(V,R,H){Q(V,function(){R.apply(this,arguments)},H)},count:function(V){var R=0;return Q(V,function(){R++}),R},toArray:function(V){return Q(V,function(R){return R})||[]},only:function(V){if(!M(V))throw Error("React.Children.only expected to receive a single React element child.");return V}};return dr.Activity=h,dr.Children=Z,dr.Component=w,dr.Fragment=r,dr.Profiler=s,dr.PureComponent=k,dr.StrictMode=a,dr.Suspense=u,dr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,dr.__COMPILER_RUNTIME={__proto__:null,c:function(V){return j.H.useMemoCache(V)}},dr.cache=function(V){return function(){return V.apply(null,arguments)}},dr.cacheSignal=function(){return null},dr.cloneElement=function(V,R,H){if(V==null)throw Error("The argument must be a React element, but you passed "+V+".");var G=v({},V.props),J=V.key;if(R!=null)for(ie in R.key!==void 0&&(J=""+R.key),R)!A.call(R,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&R.ref===void 0||(G[ie]=R[ie]);var ie=arguments.length-2;if(ie===1)G.children=H;else if(1<ie){for(var ne=Array(ie),ae=0;ae<ie;ae++)ne[ae]=arguments[ae+2];G.children=ne}return I(V.type,J,G)},dr.createContext=function(V){return V={$$typeof:l,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null},V.Provider=V,V.Consumer={$$typeof:i,_context:V},V},dr.createElement=function(V,R,H){var G,J={},ie=null;if(R!=null)for(G in R.key!==void 0&&(ie=""+R.key),R)A.call(R,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(J[G]=R[G]);var ne=arguments.length-2;if(ne===1)J.children=H;else if(1<ne){for(var ae=Array(ne),le=0;le<ne;le++)ae[le]=arguments[le+2];J.children=ae}if(V&&V.defaultProps)for(G in ne=V.defaultProps,ne)J[G]===void 0&&(J[G]=ne[G]);return I(V,ie,J)},dr.createRef=function(){return{current:null}},dr.forwardRef=function(V){return{$$typeof:c,render:V}},dr.isValidElement=M,dr.lazy=function(V){return{$$typeof:f,_payload:{_status:-1,_result:V},_init:W}},dr.memo=function(V,R){return{$$typeof:d,type:V,compare:R===void 0?null:R}},dr.startTransition=function(V){var R=j.T,H={};j.T=H;try{var G=V(),J=j.S;J!==null&&J(H,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,$)}catch(ie){$(ie)}finally{R!==null&&H.types!==null&&(R.types=H.types),j.T=R}},dr.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},dr.use=function(V){return j.H.use(V)},dr.useActionState=function(V,R,H){return j.H.useActionState(V,R,H)},dr.useCallback=function(V,R){return j.H.useCallback(V,R)},dr.useContext=function(V){return j.H.useContext(V)},dr.useDebugValue=function(){},dr.useDeferredValue=function(V,R){return j.H.useDeferredValue(V,R)},dr.useEffect=function(V,R){return j.H.useEffect(V,R)},dr.useEffectEvent=function(V){return j.H.useEffectEvent(V)},dr.useId=function(){return j.H.useId()},dr.useImperativeHandle=function(V,R,H){return j.H.useImperativeHandle(V,R,H)},dr.useInsertionEffect=function(V,R){return j.H.useInsertionEffect(V,R)},dr.useLayoutEffect=function(V,R){return j.H.useLayoutEffect(V,R)},dr.useMemo=function(V,R){return j.H.useMemo(V,R)},dr.useOptimistic=function(V,R){return j.H.useOptimistic(V,R)},dr.useReducer=function(V,R,H){return j.H.useReducer(V,R,H)},dr.useRef=function(V){return j.H.useRef(V)},dr.useState=function(V){return j.H.useState(V)},dr.useSyncExternalStore=function(V,R,H){return j.H.useSyncExternalStore(V,R,H)},dr.useTransition=function(){return j.H.useTransition()},dr.version="19.2.4",dr}var d0e;function a_(){return d0e||(d0e=1,PB.exports=L_t()),PB.exports}var b=a_();const Ne=mo(b),Iw=D8e({__proto__:null,default:Ne},[b]);var MB={exports:{}},XE={},DB={exports:{}},$B={};var f0e;function F_t(){return f0e||(f0e=1,(function(e){function t(B,z){var Q=B.length;B.push(z);e:for(;0<Q;){var W=Q-1>>>1,$=B[W];if(0<a($,z))B[W]=z,B[Q]=$,Q=W;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var z=B[0],Q=B.pop();if(Q!==z){B[0]=Q;e:for(var W=0,$=B.length,Z=$>>>1;W<Z;){var V=2*(W+1)-1,R=B[V],H=V+1,G=B[H];if(0>a(R,Q))H<$&&0>a(G,R)?(B[W]=G,B[H]=Q,W=H):(B[W]=R,B[V]=Q,W=V);else if(H<$&&0>a(G,Q))B[W]=G,B[H]=Q,W=H;else break e}}return z}function a(B,z){var Q=B.sortIndex-z.sortIndex;return Q!==0?Q:B.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,g=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function k(B){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=B)r(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function _(B){if(g=!1,k(B),!m)if(n(c)!==null)m=!0,C||(C=!0,M());else{var z=n(u);z!==null&&U(_,z.startTime-B)}}var C=!1,T=-1,j=5,A=-1;function I(){return v?!0:!(e.unstable_now()-A<j)}function P(){if(v=!1,C){var B=e.unstable_now();A=B;var z=!0;try{e:{m=!1,g&&(g=!1,w(T),T=-1),p=!0;var Q=h;try{t:{for(k(B),f=n(c);f!==null&&!(f.expirationTime>B&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,h=f.priorityLevel;var $=W(f.expirationTime<=B);if(B=e.unstable_now(),typeof $=="function"){f.callback=$,k(B),z=!0;break t}f===n(c)&&r(c),k(B)}else r(c);f=n(c)}if(f!==null)z=!0;else{var Z=n(u);Z!==null&&U(_,Z.startTime-B),z=!1}}break e}finally{f=null,h=Q,p=!1}z=void 0}}finally{z?M():C=!1}}}var M;if(typeof O=="function")M=function(){O(P)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,D=F.port2;F.port1.onmessage=P,M=function(){D.postMessage(null)}}else M=function(){x(P,0)};function U(B,z){T=x(function(){B(e.unstable_now())},z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(B){switch(h){case 1:case 2:case 3:var z=3;break;default:z=h}var Q=h;h=z;try{return B()}finally{h=Q}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(B,z){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Q=h;h=B;try{return z()}finally{h=Q}},e.unstable_scheduleCallback=function(B,z,Q){var W=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?W+Q:W):Q=W,B){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=Q+$,B={id:d++,callback:z,priorityLevel:B,startTime:Q,expirationTime:$,sortIndex:-1},Q>W?(B.sortIndex=Q,t(u,B),n(c)===null&&B===n(u)&&(g?(w(T),T=-1):g=!0,U(_,Q-W))):(B.sortIndex=$,t(c,B),m||p||(m=!0,C||(C=!0,M()))),B},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(B){var z=h;return function(){var Q=h;h=z;try{return B.apply(this,arguments)}finally{h=Q}}}})($B)),$B}var h0e;function z_t(){return h0e||(h0e=1,DB.exports=F_t()),DB.exports}var LB={exports:{}},Al={};var p0e;function B_t(){if(p0e)return Al;p0e=1;var e=a_();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)u+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function s(c,u,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:f==null?null:""+f,children:c,containerInfo:u,implementation:d}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return Al.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Al.createPortal=function(c,u){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return s(c,u,null,d)},Al.flushSync=function(c){var u=i.T,d=r.p;try{if(i.T=null,r.p=2,c)return c()}finally{i.T=u,r.p=d,r.d.f()}},Al.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(c,u))},Al.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},Al.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin),h=typeof u.integrity=="string"?u.integrity:void 0,p=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?r.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:h,fetchPriority:p}):d==="script"&&r.d.X(c,{crossOrigin:f,integrity:h,fetchPriority:p,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},Al.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=l(u.as,u.crossOrigin);r.d.M(c,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&r.d.M(c)},Al.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin);r.d.L(c,d,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},Al.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=l(u.as,u.crossOrigin);r.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else r.d.m(c)},Al.requestFormReset=function(c){r.d.r(c)},Al.unstable_batchedUpdates=function(c,u){return c(u)},Al.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},Al.useFormStatus=function(){return i.H.useHostTransitionStatus()},Al.version="19.2.4",Al}var m0e;function $8e(){if(m0e)return LB.exports;m0e=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),LB.exports=B_t(),LB.exports}var g0e;function U_t(){if(g0e)return XE;g0e=1;var e={env:{}};var t=z_t(),n=a_(),r=$8e();function a(y){var S="https://react.dev/errors/"+y;if(1<arguments.length){S+="?args[]="+encodeURIComponent(arguments[1]);for(var E=2;E<arguments.length;E++)S+="&args[]="+encodeURIComponent(arguments[E])}return"Minified React error #"+y+"; visit "+S+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(y){return!(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)}function i(y){var S=y,E=y;if(y.alternate)for(;S.return;)S=S.return;else{y=S;do S=y,(S.flags&4098)!==0&&(E=S.return),y=S.return;while(y)}return S.tag===3?E:null}function l(y){if(y.tag===13){var S=y.memoizedState;if(S===null&&(y=y.alternate,y!==null&&(S=y.memoizedState)),S!==null)return S.dehydrated}return null}function c(y){if(y.tag===31){var S=y.memoizedState;if(S===null&&(y=y.alternate,y!==null&&(S=y.memoizedState)),S!==null)return S.dehydrated}return null}function u(y){if(i(y)!==y)throw Error(a(188))}function d(y){var S=y.alternate;if(!S){if(S=i(y),S===null)throw Error(a(188));return S!==y?null:y}for(var E=y,N=S;;){var L=E.return;if(L===null)break;var q=L.alternate;if(q===null){if(N=L.return,N!==null){E=N;continue}break}if(L.child===q.child){for(q=L.child;q;){if(q===E)return u(L),y;if(q===N)return u(L),S;q=q.sibling}throw Error(a(188))}if(E.return!==N.return)E=L,N=q;else{for(var ee=!1,de=L.child;de;){if(de===E){ee=!0,E=L,N=q;break}if(de===N){ee=!0,N=L,E=q;break}de=de.sibling}if(!ee){for(de=q.child;de;){if(de===E){ee=!0,E=q,N=L;break}if(de===N){ee=!0,N=q,E=L;break}de=de.sibling}if(!ee)throw Error(a(189))}}if(E.alternate!==N)throw Error(a(190))}if(E.tag!==3)throw Error(a(188));return E.stateNode.current===E?y:S}function f(y){var S=y.tag;if(S===5||S===26||S===27||S===6)return y;for(y=y.child;y!==null;){if(S=f(y),S!==null)return S;y=y.sibling}return null}var h=Object.assign,p=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),k=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),M=Symbol.iterator;function F(y){return y===null||typeof y!="object"?null:(y=M&&y[M]||y["@@iterator"],typeof y=="function"?y:null)}var D=Symbol.for("react.client.reference");function U(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===D?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case v:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case C:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof y=="object")switch(y.$$typeof){case g:return"Portal";case k:return y.displayName||"Context";case O:return(y._context.displayName||"Context")+".Consumer";case _:var S=y.render;return y=y.displayName,y||(y=S.displayName||S.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case j:return S=y.displayName||null,S!==null?S:U(y.type)||"Memo";case A:S=y._payload,y=y._init;try{return U(y(S))}catch{}}return null}var B=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},$=[],Z=-1;function V(y){return{current:y}}function R(y){0>Z||(y.current=$[Z],$[Z]=null,Z--)}function H(y,S){Z++,$[Z]=y.current,y.current=S}var G=V(null),J=V(null),ie=V(null),ne=V(null);function ae(y,S){switch(H(ie,S),H(J,y),H(G,null),S.nodeType){case 9:case 11:y=(y=S.documentElement)&&(y=y.namespaceURI)?Axe(y):0;break;default:if(y=S.tagName,S=S.namespaceURI)S=Axe(S),y=Ixe(S,y);else switch(y){case"svg":y=1;break;case"math":y=2;break;default:y=0}}R(G),H(G,y)}function le(){R(G),R(J),R(ie)}function fe(y){y.memoizedState!==null&&H(ne,y);var S=G.current,E=Ixe(S,y.type);S!==E&&(H(J,y),H(G,E))}function X(y){J.current===y&&(R(G),R(J)),ne.current===y&&(R(ne),QE._currentValue=W)}var re,oe;function ge(y){if(re===void 0)try{throw Error()}catch(E){var S=E.stack.trim().match(/\n( *(at )?)/);re=S&&S[1]||"",oe=-1<E.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./token-util-RMHT2CPJ-VVUHOXBL-Ck8yJN4U.js","./chunk-ZCJMLMGS-DzjqpxSO.js","./index-uoIcq-p2.js","./token-APYSY3BW-RPVF55TR-DmO_XXIS.js","./index-DhP3NFK_.js","./index-BFfBKqFP.js","./index-B9ojti2l.js","./index-04Ga1pOq.js","./index-Ywo4_gGm.js","./index-BzQgA4o5.js","./index--M_-_-M3.js","./index-DJ5VARKf.js","./index-CgRhknyO.js","./index-D4xZzb1p.js","./index-BCdyfE3O.js","./index-W7WFFo7e.js","./index-B1BoslNp.js","./index-DigVG8_v.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-BxdRtlHb.js","./index-DluSEK8w.js","./index-D1h4EPgk.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as nt}from"./index-uoIcq-p2.js";function D8e(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const s=Object.getOwnPropertyDescriptor(r,a);s&&Object.defineProperty(e,a,s.get?s:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var p$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var RB={exports:{}},YE={};var l0e;function D_t(){if(l0e)return YE;l0e=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,s){var i=null;if(s!==void 0&&(i=""+s),a.key!==void 0&&(i=""+a.key),"key"in a){s={};for(var l in a)l!=="key"&&(s[l]=a[l])}else s=a;return a=s.ref,{$$typeof:e,type:r,key:i,ref:a!==void 0?a:null,props:s}}return YE.Fragment=t,YE.jsx=n,YE.jsxs=n,YE}var c0e;function $_t(){return c0e||(c0e=1,RB.exports=D_t()),RB.exports}var o=$_t(),PB={exports:{}},dr={},u0e;function L_t(){if(u0e)return dr;u0e=1;var e={env:{}};var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),p=Symbol.iterator;function m(V){return V===null||typeof V!="object"?null:(V=p&&V[p]||V["@@iterator"],typeof V=="function"?V:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,x={};function w(V,R,H){this.props=V,this.context=R,this.refs=x,this.updater=H||g}w.prototype.isReactComponent={},w.prototype.setState=function(V,R){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,R,"setState")},w.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function O(){}O.prototype=w.prototype;function k(V,R,H){this.props=V,this.context=R,this.refs=x,this.updater=H||g}var _=k.prototype=new O;_.constructor=k,v(_,w.prototype),_.isPureReactComponent=!0;var C=Array.isArray;function T(){}var j={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function I(V,R,H){var G=H.ref;return{$$typeof:t,type:V,key:R,ref:G!==void 0?G:null,props:H}}function P(V,R){return I(V.type,R,V.props)}function M(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function F(V){var R={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(H){return R[H]})}var D=/\/+/g;function U(V,R){return typeof V=="object"&&V!==null&&V.key!=null?F(""+V.key):R.toString(36)}function B(V){switch(V.status){case"fulfilled":return V.value;case"rejected":throw V.reason;default:switch(typeof V.status=="string"?V.then(T,T):(V.status="pending",V.then(function(R){V.status==="pending"&&(V.status="fulfilled",V.value=R)},function(R){V.status==="pending"&&(V.status="rejected",V.reason=R)})),V.status){case"fulfilled":return V.value;case"rejected":throw V.reason}}throw V}function z(V,R,H,G,J){var ie=typeof V;(ie==="undefined"||ie==="boolean")&&(V=null);var ne=!1;if(V===null)ne=!0;else switch(ie){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(V.$$typeof){case t:case n:ne=!0;break;case f:return ne=V._init,z(ne(V._payload),R,H,G,J)}}if(ne)return J=J(V),ne=G===""?"."+U(V,0):G,C(J)?(H="",ne!=null&&(H=ne.replace(D,"$&/")+"/"),z(J,R,H,"",function(fe){return fe})):J!=null&&(M(J)&&(J=P(J,H+(J.key==null||V&&V.key===J.key?"":(""+J.key).replace(D,"$&/")+"/")+ne)),R.push(J)),1;ne=0;var ae=G===""?".":G+":";if(C(V))for(var le=0;le<V.length;le++)G=V[le],ie=ae+U(G,le),ne+=z(G,R,H,ie,J);else if(le=m(V),typeof le=="function")for(V=le.call(V),le=0;!(G=V.next()).done;)G=G.value,ie=ae+U(G,le++),ne+=z(G,R,H,ie,J);else if(ie==="object"){if(typeof V.then=="function")return z(B(V),R,H,G,J);throw R=String(V),Error("Objects are not valid as a React child (found: "+(R==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.")}return ne}function Q(V,R,H){if(V==null)return V;var G=[],J=0;return z(V,G,"","",function(ie){return R.call(H,ie,J++)}),G}function W(V){if(V._status===-1){var R=V._result;R=R(),R.then(function(H){(V._status===0||V._status===-1)&&(V._status=1,V._result=H)},function(H){(V._status===0||V._status===-1)&&(V._status=2,V._result=H)}),V._status===-1&&(V._status=0,V._result=R)}if(V._status===1)return V._result.default;throw V._result}var $=typeof reportError=="function"?reportError:function(V){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var R=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof V=="object"&&V!==null&&typeof V.message=="string"?String(V.message):String(V),error:V});if(!window.dispatchEvent(R))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",V);return}console.error(V)},Z={map:Q,forEach:function(V,R,H){Q(V,function(){R.apply(this,arguments)},H)},count:function(V){var R=0;return Q(V,function(){R++}),R},toArray:function(V){return Q(V,function(R){return R})||[]},only:function(V){if(!M(V))throw Error("React.Children.only expected to receive a single React element child.");return V}};return dr.Activity=h,dr.Children=Z,dr.Component=w,dr.Fragment=r,dr.Profiler=s,dr.PureComponent=k,dr.StrictMode=a,dr.Suspense=u,dr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,dr.__COMPILER_RUNTIME={__proto__:null,c:function(V){return j.H.useMemoCache(V)}},dr.cache=function(V){return function(){return V.apply(null,arguments)}},dr.cacheSignal=function(){return null},dr.cloneElement=function(V,R,H){if(V==null)throw Error("The argument must be a React element, but you passed "+V+".");var G=v({},V.props),J=V.key;if(R!=null)for(ie in R.key!==void 0&&(J=""+R.key),R)!A.call(R,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&R.ref===void 0||(G[ie]=R[ie]);var ie=arguments.length-2;if(ie===1)G.children=H;else if(1<ie){for(var ne=Array(ie),ae=0;ae<ie;ae++)ne[ae]=arguments[ae+2];G.children=ne}return I(V.type,J,G)},dr.createContext=function(V){return V={$$typeof:l,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null},V.Provider=V,V.Consumer={$$typeof:i,_context:V},V},dr.createElement=function(V,R,H){var G,J={},ie=null;if(R!=null)for(G in R.key!==void 0&&(ie=""+R.key),R)A.call(R,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(J[G]=R[G]);var ne=arguments.length-2;if(ne===1)J.children=H;else if(1<ne){for(var ae=Array(ne),le=0;le<ne;le++)ae[le]=arguments[le+2];J.children=ae}if(V&&V.defaultProps)for(G in ne=V.defaultProps,ne)J[G]===void 0&&(J[G]=ne[G]);return I(V,ie,J)},dr.createRef=function(){return{current:null}},dr.forwardRef=function(V){return{$$typeof:c,render:V}},dr.isValidElement=M,dr.lazy=function(V){return{$$typeof:f,_payload:{_status:-1,_result:V},_init:W}},dr.memo=function(V,R){return{$$typeof:d,type:V,compare:R===void 0?null:R}},dr.startTransition=function(V){var R=j.T,H={};j.T=H;try{var G=V(),J=j.S;J!==null&&J(H,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,$)}catch(ie){$(ie)}finally{R!==null&&H.types!==null&&(R.types=H.types),j.T=R}},dr.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},dr.use=function(V){return j.H.use(V)},dr.useActionState=function(V,R,H){return j.H.useActionState(V,R,H)},dr.useCallback=function(V,R){return j.H.useCallback(V,R)},dr.useContext=function(V){return j.H.useContext(V)},dr.useDebugValue=function(){},dr.useDeferredValue=function(V,R){return j.H.useDeferredValue(V,R)},dr.useEffect=function(V,R){return j.H.useEffect(V,R)},dr.useEffectEvent=function(V){return j.H.useEffectEvent(V)},dr.useId=function(){return j.H.useId()},dr.useImperativeHandle=function(V,R,H){return j.H.useImperativeHandle(V,R,H)},dr.useInsertionEffect=function(V,R){return j.H.useInsertionEffect(V,R)},dr.useLayoutEffect=function(V,R){return j.H.useLayoutEffect(V,R)},dr.useMemo=function(V,R){return j.H.useMemo(V,R)},dr.useOptimistic=function(V,R){return j.H.useOptimistic(V,R)},dr.useReducer=function(V,R,H){return j.H.useReducer(V,R,H)},dr.useRef=function(V){return j.H.useRef(V)},dr.useState=function(V){return j.H.useState(V)},dr.useSyncExternalStore=function(V,R,H){return j.H.useSyncExternalStore(V,R,H)},dr.useTransition=function(){return j.H.useTransition()},dr.version="19.2.4",dr}var d0e;function a_(){return d0e||(d0e=1,PB.exports=L_t()),PB.exports}var b=a_();const Ne=mo(b),Iw=D8e({__proto__:null,default:Ne},[b]);var MB={exports:{}},XE={},DB={exports:{}},$B={};var f0e;function F_t(){return f0e||(f0e=1,(function(e){function t(B,z){var Q=B.length;B.push(z);e:for(;0<Q;){var W=Q-1>>>1,$=B[W];if(0<a($,z))B[W]=z,B[Q]=$,Q=W;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var z=B[0],Q=B.pop();if(Q!==z){B[0]=Q;e:for(var W=0,$=B.length,Z=$>>>1;W<Z;){var V=2*(W+1)-1,R=B[V],H=V+1,G=B[H];if(0>a(R,Q))H<$&&0>a(G,R)?(B[W]=G,B[H]=Q,W=H):(B[W]=R,B[V]=Q,W=V);else if(H<$&&0>a(G,Q))B[W]=G,B[H]=Q,W=H;else break e}}return z}function a(B,z){var Q=B.sortIndex-z.sortIndex;return Q!==0?Q:B.id-z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,g=!1,v=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function k(B){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=B)r(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function _(B){if(g=!1,k(B),!m)if(n(c)!==null)m=!0,C||(C=!0,M());else{var z=n(u);z!==null&&U(_,z.startTime-B)}}var C=!1,T=-1,j=5,A=-1;function I(){return v?!0:!(e.unstable_now()-A<j)}function P(){if(v=!1,C){var B=e.unstable_now();A=B;var z=!0;try{e:{m=!1,g&&(g=!1,w(T),T=-1),p=!0;var Q=h;try{t:{for(k(B),f=n(c);f!==null&&!(f.expirationTime>B&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,h=f.priorityLevel;var $=W(f.expirationTime<=B);if(B=e.unstable_now(),typeof $=="function"){f.callback=$,k(B),z=!0;break t}f===n(c)&&r(c),k(B)}else r(c);f=n(c)}if(f!==null)z=!0;else{var Z=n(u);Z!==null&&U(_,Z.startTime-B),z=!1}}break e}finally{f=null,h=Q,p=!1}z=void 0}}finally{z?M():C=!1}}}var M;if(typeof O=="function")M=function(){O(P)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,D=F.port2;F.port1.onmessage=P,M=function(){D.postMessage(null)}}else M=function(){x(P,0)};function U(B,z){T=x(function(){B(e.unstable_now())},z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(B){switch(h){case 1:case 2:case 3:var z=3;break;default:z=h}var Q=h;h=z;try{return B()}finally{h=Q}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(B,z){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var Q=h;h=B;try{return z()}finally{h=Q}},e.unstable_scheduleCallback=function(B,z,Q){var W=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?W+Q:W):Q=W,B){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=Q+$,B={id:d++,callback:z,priorityLevel:B,startTime:Q,expirationTime:$,sortIndex:-1},Q>W?(B.sortIndex=Q,t(u,B),n(c)===null&&B===n(u)&&(g?(w(T),T=-1):g=!0,U(_,Q-W))):(B.sortIndex=$,t(c,B),m||p||(m=!0,C||(C=!0,M()))),B},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(B){var z=h;return function(){var Q=h;h=z;try{return B.apply(this,arguments)}finally{h=Q}}}})($B)),$B}var h0e;function z_t(){return h0e||(h0e=1,DB.exports=F_t()),DB.exports}var LB={exports:{}},Al={};var p0e;function B_t(){if(p0e)return Al;p0e=1;var e=a_();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)u+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function s(c,u,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:f==null?null:""+f,children:c,containerInfo:u,implementation:d}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return Al.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Al.createPortal=function(c,u){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return s(c,u,null,d)},Al.flushSync=function(c){var u=i.T,d=r.p;try{if(i.T=null,r.p=2,c)return c()}finally{i.T=u,r.p=d,r.d.f()}},Al.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(c,u))},Al.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},Al.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin),h=typeof u.integrity=="string"?u.integrity:void 0,p=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;d==="style"?r.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:f,integrity:h,fetchPriority:p}):d==="script"&&r.d.X(c,{crossOrigin:f,integrity:h,fetchPriority:p,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},Al.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=l(u.as,u.crossOrigin);r.d.M(c,{crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&r.d.M(c)},Al.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=l(d,u.crossOrigin);r.d.L(c,d,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},Al.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=l(u.as,u.crossOrigin);r.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:d,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else r.d.m(c)},Al.requestFormReset=function(c){r.d.r(c)},Al.unstable_batchedUpdates=function(c,u){return c(u)},Al.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},Al.useFormStatus=function(){return i.H.useHostTransitionStatus()},Al.version="19.2.4",Al}var m0e;function $8e(){if(m0e)return LB.exports;m0e=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),LB.exports=B_t(),LB.exports}var g0e;function U_t(){if(g0e)return XE;g0e=1;var e={env:{}};var t=z_t(),n=a_(),r=$8e();function a(y){var S="https://react.dev/errors/"+y;if(1<arguments.length){S+="?args[]="+encodeURIComponent(arguments[1]);for(var E=2;E<arguments.length;E++)S+="&args[]="+encodeURIComponent(arguments[E])}return"Minified React error #"+y+"; visit "+S+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(y){return!(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)}function i(y){var S=y,E=y;if(y.alternate)for(;S.return;)S=S.return;else{y=S;do S=y,(S.flags&4098)!==0&&(E=S.return),y=S.return;while(y)}return S.tag===3?E:null}function l(y){if(y.tag===13){var S=y.memoizedState;if(S===null&&(y=y.alternate,y!==null&&(S=y.memoizedState)),S!==null)return S.dehydrated}return null}function c(y){if(y.tag===31){var S=y.memoizedState;if(S===null&&(y=y.alternate,y!==null&&(S=y.memoizedState)),S!==null)return S.dehydrated}return null}function u(y){if(i(y)!==y)throw Error(a(188))}function d(y){var S=y.alternate;if(!S){if(S=i(y),S===null)throw Error(a(188));return S!==y?null:y}for(var E=y,N=S;;){var L=E.return;if(L===null)break;var q=L.alternate;if(q===null){if(N=L.return,N!==null){E=N;continue}break}if(L.child===q.child){for(q=L.child;q;){if(q===E)return u(L),y;if(q===N)return u(L),S;q=q.sibling}throw Error(a(188))}if(E.return!==N.return)E=L,N=q;else{for(var ee=!1,de=L.child;de;){if(de===E){ee=!0,E=L,N=q;break}if(de===N){ee=!0,N=L,E=q;break}de=de.sibling}if(!ee){for(de=q.child;de;){if(de===E){ee=!0,E=q,N=L;break}if(de===N){ee=!0,N=q,E=L;break}de=de.sibling}if(!ee)throw Error(a(189))}}if(E.alternate!==N)throw Error(a(190))}if(E.tag!==3)throw Error(a(188));return E.stateNode.current===E?y:S}function f(y){var S=y.tag;if(S===5||S===26||S===27||S===6)return y;for(y=y.child;y!==null;){if(S=f(y),S!==null)return S;y=y.sibling}return null}var h=Object.assign,p=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),k=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),M=Symbol.iterator;function F(y){return y===null||typeof y!="object"?null:(y=M&&y[M]||y["@@iterator"],typeof y=="function"?y:null)}var D=Symbol.for("react.client.reference");function U(y){if(y==null)return null;if(typeof y=="function")return y.$$typeof===D?null:y.displayName||y.name||null;if(typeof y=="string")return y;switch(y){case v:return"Fragment";case w:return"Profiler";case x:return"StrictMode";case C:return"Suspense";case T:return"SuspenseList";case I:return"Activity"}if(typeof y=="object")switch(y.$$typeof){case g:return"Portal";case k:return y.displayName||"Context";case O:return(y._context.displayName||"Context")+".Consumer";case _:var S=y.render;return y=y.displayName,y||(y=S.displayName||S.name||"",y=y!==""?"ForwardRef("+y+")":"ForwardRef"),y;case j:return S=y.displayName||null,S!==null?S:U(y.type)||"Memo";case A:S=y._payload,y=y._init;try{return U(y(S))}catch{}}return null}var B=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},$=[],Z=-1;function V(y){return{current:y}}function R(y){0>Z||(y.current=$[Z],$[Z]=null,Z--)}function H(y,S){Z++,$[Z]=y.current,y.current=S}var G=V(null),J=V(null),ie=V(null),ne=V(null);function ae(y,S){switch(H(ie,S),H(J,y),H(G,null),S.nodeType){case 9:case 11:y=(y=S.documentElement)&&(y=y.namespaceURI)?Axe(y):0;break;default:if(y=S.tagName,S=S.namespaceURI)S=Axe(S),y=Ixe(S,y);else switch(y){case"svg":y=1;break;case"math":y=2;break;default:y=0}}R(G),H(G,y)}function le(){R(G),R(J),R(ie)}function fe(y){y.memoizedState!==null&&H(ne,y);var S=G.current,E=Ixe(S,y.type);S!==E&&(H(J,y),H(G,E))}function X(y){J.current===y&&(R(G),R(J)),ne.current===y&&(R(ne),QE._currentValue=W)}var re,oe;function ge(y){if(re===void 0)try{throw Error()}catch(E){var S=E.stack.trim().match(/\n( *(at )?)/);re=S&&S[1]||"",oe=-1<E.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<E.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+re+y+oe}var ce=!1;function ue(y,S){if(!y||ce)return"";ce=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var N={DetermineComponentFrameRoot:function(){try{if(S){var ht=function(){throw Error()};if(Object.defineProperty(ht.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ht,[])}catch(at){var Xe=at}Reflect.construct(y,[],ht)}else{try{ht.call()}catch(at){Xe=at}y.call(ht.prototype)}}else{try{throw Error()}catch(at){Xe=at}(ht=y())&&typeof ht.catch=="function"&&ht.catch(function(){})}}catch(at){if(at&&Xe&&typeof at.stack=="string")return[at.stack,Xe.stack]}return[null,null]}};N.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var L=Object.getOwnPropertyDescriptor(N.DetermineComponentFrameRoot,"name");L&&L.configurable&&Object.defineProperty(N.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var q=N.DetermineComponentFrameRoot(),ee=q[0],de=q[1];if(ee&&de){var Ae=ee.split(`
|
|
5
5
|
`),Ze=de.split(`
|
|
@@ -56,7 +56,7 @@ Error message: ${cle(n)}`,cause:n}),this[W0e]=!0,this.value=t}static isInstance(
|
|
|
56
56
|
]))`;continue}else if(a[u]==="$"){s+=`($|(?=[\r
|
|
57
57
|
]))`;continue}}if(r.s&&a[u]==="."){s+=l?`${a[u]}\r
|
|
58
58
|
`:`[${a[u]}\r
|
|
59
|
-
]`;continue}s+=a[u],a[u]==="\\"?i=!0:l&&a[u]==="]"?l=!1:!l&&a[u]==="["&&(l=!0)}return s}function JVe(e,t){var n,r,a,s,i,l;const c={type:"object",additionalProperties:(n=ts(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===He.ZodString&&((a=e.keyType._def.checks)!=null&&a.length)){const{type:u,...d}=KVe(e.keyType._def,t);return{...c,propertyNames:d}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===He.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===He.ZodBranded&&e.keyType._def.type._def.typeName===He.ZodString&&((l=e.keyType._def.type._def.checks)!=null&&l.length)){const{type:u,...d}=YVe(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function MNt(e,t){if(t.mapStrategy==="record")return JVe(e,t);const n=ts(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Td(),r=ts(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Td();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function DNt(e){const t=e.values,r=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),a=Array.from(new Set(r.map(s=>typeof s)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:r}}function $Nt(){return{not:Td()}}function LNt(){return{type:"null"}}var Zee={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function FNt(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in Zee&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((a,s)=>{const i=Zee[s._def.typeName];return i&&!a.includes(i)?[...a,i]:a},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((a,s)=>{const i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...a,i];case"bigint":return[...a,"integer"];case"object":if(s._def.value===null)return[...a,"null"];default:return a}},[]);if(r.length===n.length){const a=r.filter((s,i,l)=>l.indexOf(s)===i);return{type:a.length>1?a:a[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,a)=>[...r,...a._def.values.filter(s=>!r.includes(s))],[])};return zNt(e,t)}var zNt=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,a)=>ts(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function BNt(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Zee[e.innerType._def.typeName],"null"]};const n=ts(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function UNt(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function qNt(e,t){const n={type:"object",properties:{}},r=[],a=e.shape();for(const i in a){let l=a[i];if(l===void 0||l._def===void 0)continue;const c=HNt(l),u=ts(l._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});u!==void 0&&(n.properties[i]=u,c||r.push(i))}r.length&&(n.required=r);const s=VNt(e,t);return s!==void 0&&(n.additionalProperties=s),n}function VNt(e,t){if(e.catchall._def.typeName!=="ZodNever")return ts(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 HNt(e){try{return e.isOptional()}catch{return!0}}var QNt=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return ts(e.innerType._def,t);const r=ts(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Td()},r]}:Td()},WNt=(e,t)=>{if(t.pipeStrategy==="input")return ts(e.in._def,t);if(t.pipeStrategy==="output")return ts(e.out._def,t);const n=ts(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=ts(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(a=>a!==void 0)}};function GNt(e,t){return ts(e.type._def,t)}function ZNt(e,t){const r={type:"array",uniqueItems:!0,items:ts(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}function YNt(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>ts(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:ts(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>ts(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function XNt(){return{not:Td()}}function KNt(){return Td()}var JNt=(e,t)=>ts(e.innerType._def,t),eAt=(e,t,n)=>{switch(t){case He.ZodString:return KVe(e,n);case He.ZodNumber:return UNt(e);case He.ZodObject:return qNt(e,n);case He.ZodBigInt:return ONt(e);case He.ZodBoolean:return kNt();case He.ZodDate:return XVe(e,n);case He.ZodUndefined:return XNt();case He.ZodNull:return LNt();case He.ZodArray:return SNt(e,n);case He.ZodUnion:case He.ZodDiscriminatedUnion:return FNt(e,n);case He.ZodIntersection:return ANt(e,n);case He.ZodTuple:return YNt(e,n);case He.ZodRecord:return JVe(e,n);case He.ZodLiteral:return INt(e);case He.ZodEnum:return TNt(e);case He.ZodNativeEnum:return DNt(e);case He.ZodNullable:return BNt(e,n);case He.ZodOptional:return QNt(e,n);case He.ZodMap:return MNt(e,n);case He.ZodSet:return ZNt(e,n);case He.ZodLazy:return()=>e.getter()._def;case He.ZodPromise:return GNt(e,n);case He.ZodNaN:case He.ZodNever:return $Nt();case He.ZodEffects:return jNt(e,n);case He.ZodAny:return Td();case He.ZodUnknown:return KNt();case He.ZodDefault:return CNt(e,n);case He.ZodBranded:return YVe(e,n);case He.ZodReadonly:return JNt(e,n);case He.ZodCatch:return _Nt(e,n);case He.ZodPipeline:return WNt(e,n);case He.ZodFunction:case He.ZodVoid:case He.ZodSymbol:return;default:return(r=>{})()}};function ts(e,t,n=!1){var r;const a=t.seen.get(e);if(t.override){const c=(r=t.override)==null?void 0:r.call(t,e,t,a,n);if(c!==xNt)return c}if(a&&!n){const c=tAt(a,t);if(c!==void 0)return c}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=eAt(e,e.typeName,t),l=typeof i=="function"?ts(i(),t):i;if(l&&nAt(e,t,l),t.postProcess){const c=t.postProcess(l,e,t);return s.jsonSchema=l,c}return s.jsonSchema=l,l}var tAt=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:bNt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Td()):t.$refStrategy==="seen"?Td():void 0}},nAt=(e,t,n)=>(e.description&&(n.description=e.description),n),rAt=e=>{const t=wNt(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},aAt=(e,t)=>{var n;const r=rAt(t);let a=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,f])=>{var h;return{...u,[d]:(h=ts(f._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?h:Td()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(n=ts(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))!=null?n:Td(),l=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;l!==void 0&&(i.title=l);const c=s===void 0?a?{...i,[r.definitionPath]:a}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...a,[s]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},sAt=aAt;function iAt(e,t){var n;const r=(n=void 0)!=null?n:!1;return dle(()=>sAt(e,{$refStrategy:r?"root":"none"}),{validate:async a=>{const s=await e.safeParseAsync(a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function oAt(e,t){var n;const r=(n=void 0)!=null?n:!1;return dle(()=>b2(ZA(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async a=>{const s=await Soe(e,a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function lAt(e){return"_zod"in e}function Kh(e,t){return lAt(e)?oAt(e):iAt(e)}var Yee=Symbol.for("vercel.ai.schema");function L5(e){let t;return()=>(t==null&&(t=e()),t)}function dle(e,{validate:t}={}){return{[Yee]:!0,_type:void 0,[j$]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function cAt(e){return typeof e=="object"&&e!==null&&Yee in e&&e[Yee]===!0&&"jsonSchema"in e&&"validate"in e}function uAt(e){return e==null?dle({properties:{},additionalProperties:!1}):cAt(e)?e:typeof e=="function"?e():Kh(e)}function dAt(e){return e?.replace(/\/$/,"")}var fAt={},eHe=Q3({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-context.js"(e,t){var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,i=(h,p)=>{for(var m in p)n(h,m,{get:p[m],enumerable:!0})},l=(h,p,m,g)=>{if(p&&typeof p=="object"||typeof p=="function")for(let v of a(p))!s.call(h,v)&&v!==m&&n(h,v,{get:()=>p[v],enumerable:!(g=r(p,v))||g.enumerable});return h},c=h=>l(n({},"__esModule",{value:!0}),h),u={};i(u,{SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>f}),t.exports=c(u);var d=Symbol.for("@vercel/request-context");function f(){return globalThis[d]?.get?.()??{}}}}),hAt=Q3({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(e,t){var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,i=(m,g)=>{for(var v in g)n(m,v,{get:g[v],enumerable:!0})},l=(m,g,v,x)=>{if(g&&typeof g=="object"||typeof g=="function")for(let w of a(g))!s.call(m,w)&&w!==v&&n(m,w,{get:()=>g[w],enumerable:!(x=r(g,w))||x.enumerable});return m},c=m=>l(n({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>h,getVercelOidcTokenSync:()=>p}),t.exports=c(u);var d=eHe(),f=Y_t();async function h(){let m="",g;try{m=p()}catch(v){g=v}try{const[{getTokenPayload:v,isExpired:x},{refreshToken:w}]=await Promise.all([await nt(()=>import("./token-util-RMHT2CPJ-VVUHOXBL-CCyfz7Dr.js"),__vite__mapDeps([0,1,2]),import.meta.url),await nt(()=>import("./token-APYSY3BW-RPVF55TR-D3-svBOT.js"),__vite__mapDeps([3,1,2]),import.meta.url)]);(!m||x(v(m)))&&(await w(),m=p())}catch(v){let x=g instanceof Error?g.message:"";throw v instanceof Error&&(x=`${x}
|
|
59
|
+
]`;continue}s+=a[u],a[u]==="\\"?i=!0:l&&a[u]==="]"?l=!1:!l&&a[u]==="["&&(l=!0)}return s}function JVe(e,t){var n,r,a,s,i,l;const c={type:"object",additionalProperties:(n=ts(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===He.ZodString&&((a=e.keyType._def.checks)!=null&&a.length)){const{type:u,...d}=KVe(e.keyType._def,t);return{...c,propertyNames:d}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===He.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===He.ZodBranded&&e.keyType._def.type._def.typeName===He.ZodString&&((l=e.keyType._def.type._def.checks)!=null&&l.length)){const{type:u,...d}=YVe(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function MNt(e,t){if(t.mapStrategy==="record")return JVe(e,t);const n=ts(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Td(),r=ts(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Td();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function DNt(e){const t=e.values,r=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),a=Array.from(new Set(r.map(s=>typeof s)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:r}}function $Nt(){return{not:Td()}}function LNt(){return{type:"null"}}var Zee={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function FNt(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in Zee&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((a,s)=>{const i=Zee[s._def.typeName];return i&&!a.includes(i)?[...a,i]:a},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((a,s)=>{const i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...a,i];case"bigint":return[...a,"integer"];case"object":if(s._def.value===null)return[...a,"null"];default:return a}},[]);if(r.length===n.length){const a=r.filter((s,i,l)=>l.indexOf(s)===i);return{type:a.length>1?a:a[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,a)=>[...r,...a._def.values.filter(s=>!r.includes(s))],[])};return zNt(e,t)}var zNt=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,a)=>ts(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function BNt(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Zee[e.innerType._def.typeName],"null"]};const n=ts(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function UNt(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function qNt(e,t){const n={type:"object",properties:{}},r=[],a=e.shape();for(const i in a){let l=a[i];if(l===void 0||l._def===void 0)continue;const c=HNt(l),u=ts(l._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});u!==void 0&&(n.properties[i]=u,c||r.push(i))}r.length&&(n.required=r);const s=VNt(e,t);return s!==void 0&&(n.additionalProperties=s),n}function VNt(e,t){if(e.catchall._def.typeName!=="ZodNever")return ts(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 HNt(e){try{return e.isOptional()}catch{return!0}}var QNt=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return ts(e.innerType._def,t);const r=ts(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Td()},r]}:Td()},WNt=(e,t)=>{if(t.pipeStrategy==="input")return ts(e.in._def,t);if(t.pipeStrategy==="output")return ts(e.out._def,t);const n=ts(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=ts(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(a=>a!==void 0)}};function GNt(e,t){return ts(e.type._def,t)}function ZNt(e,t){const r={type:"array",uniqueItems:!0,items:ts(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}function YNt(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>ts(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:ts(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>ts(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function XNt(){return{not:Td()}}function KNt(){return Td()}var JNt=(e,t)=>ts(e.innerType._def,t),eAt=(e,t,n)=>{switch(t){case He.ZodString:return KVe(e,n);case He.ZodNumber:return UNt(e);case He.ZodObject:return qNt(e,n);case He.ZodBigInt:return ONt(e);case He.ZodBoolean:return kNt();case He.ZodDate:return XVe(e,n);case He.ZodUndefined:return XNt();case He.ZodNull:return LNt();case He.ZodArray:return SNt(e,n);case He.ZodUnion:case He.ZodDiscriminatedUnion:return FNt(e,n);case He.ZodIntersection:return ANt(e,n);case He.ZodTuple:return YNt(e,n);case He.ZodRecord:return JVe(e,n);case He.ZodLiteral:return INt(e);case He.ZodEnum:return TNt(e);case He.ZodNativeEnum:return DNt(e);case He.ZodNullable:return BNt(e,n);case He.ZodOptional:return QNt(e,n);case He.ZodMap:return MNt(e,n);case He.ZodSet:return ZNt(e,n);case He.ZodLazy:return()=>e.getter()._def;case He.ZodPromise:return GNt(e,n);case He.ZodNaN:case He.ZodNever:return $Nt();case He.ZodEffects:return jNt(e,n);case He.ZodAny:return Td();case He.ZodUnknown:return KNt();case He.ZodDefault:return CNt(e,n);case He.ZodBranded:return YVe(e,n);case He.ZodReadonly:return JNt(e,n);case He.ZodCatch:return _Nt(e,n);case He.ZodPipeline:return WNt(e,n);case He.ZodFunction:case He.ZodVoid:case He.ZodSymbol:return;default:return(r=>{})()}};function ts(e,t,n=!1){var r;const a=t.seen.get(e);if(t.override){const c=(r=t.override)==null?void 0:r.call(t,e,t,a,n);if(c!==xNt)return c}if(a&&!n){const c=tAt(a,t);if(c!==void 0)return c}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=eAt(e,e.typeName,t),l=typeof i=="function"?ts(i(),t):i;if(l&&nAt(e,t,l),t.postProcess){const c=t.postProcess(l,e,t);return s.jsonSchema=l,c}return s.jsonSchema=l,l}var tAt=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:bNt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Td()):t.$refStrategy==="seen"?Td():void 0}},nAt=(e,t,n)=>(e.description&&(n.description=e.description),n),rAt=e=>{const t=wNt(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},aAt=(e,t)=>{var n;const r=rAt(t);let a=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,f])=>{var h;return{...u,[d]:(h=ts(f._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?h:Td()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(n=ts(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))!=null?n:Td(),l=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;l!==void 0&&(i.title=l);const c=s===void 0?a?{...i,[r.definitionPath]:a}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...a,[s]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},sAt=aAt;function iAt(e,t){var n;const r=(n=void 0)!=null?n:!1;return dle(()=>sAt(e,{$refStrategy:r?"root":"none"}),{validate:async a=>{const s=await e.safeParseAsync(a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function oAt(e,t){var n;const r=(n=void 0)!=null?n:!1;return dle(()=>b2(ZA(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async a=>{const s=await Soe(e,a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function lAt(e){return"_zod"in e}function Kh(e,t){return lAt(e)?oAt(e):iAt(e)}var Yee=Symbol.for("vercel.ai.schema");function L5(e){let t;return()=>(t==null&&(t=e()),t)}function dle(e,{validate:t}={}){return{[Yee]:!0,_type:void 0,[j$]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function cAt(e){return typeof e=="object"&&e!==null&&Yee in e&&e[Yee]===!0&&"jsonSchema"in e&&"validate"in e}function uAt(e){return e==null?dle({properties:{},additionalProperties:!1}):cAt(e)?e:typeof e=="function"?e():Kh(e)}function dAt(e){return e?.replace(/\/$/,"")}var fAt={},eHe=Q3({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-context.js"(e,t){var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,i=(h,p)=>{for(var m in p)n(h,m,{get:p[m],enumerable:!0})},l=(h,p,m,g)=>{if(p&&typeof p=="object"||typeof p=="function")for(let v of a(p))!s.call(h,v)&&v!==m&&n(h,v,{get:()=>p[v],enumerable:!(g=r(p,v))||g.enumerable});return h},c=h=>l(n({},"__esModule",{value:!0}),h),u={};i(u,{SYMBOL_FOR_REQ_CONTEXT:()=>d,getContext:()=>f}),t.exports=c(u);var d=Symbol.for("@vercel/request-context");function f(){return globalThis[d]?.get?.()??{}}}}),hAt=Q3({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(e,t){var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,i=(m,g)=>{for(var v in g)n(m,v,{get:g[v],enumerable:!0})},l=(m,g,v,x)=>{if(g&&typeof g=="object"||typeof g=="function")for(let w of a(g))!s.call(m,w)&&w!==v&&n(m,w,{get:()=>g[w],enumerable:!(x=r(g,w))||x.enumerable});return m},c=m=>l(n({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>h,getVercelOidcTokenSync:()=>p}),t.exports=c(u);var d=eHe(),f=Y_t();async function h(){let m="",g;try{m=p()}catch(v){g=v}try{const[{getTokenPayload:v,isExpired:x},{refreshToken:w}]=await Promise.all([await nt(()=>import("./token-util-RMHT2CPJ-VVUHOXBL-Ck8yJN4U.js"),__vite__mapDeps([0,1,2]),import.meta.url),await nt(()=>import("./token-APYSY3BW-RPVF55TR-DmO_XXIS.js"),__vite__mapDeps([3,1,2]),import.meta.url)]);(!m||x(v(m)))&&(await w(),m=p())}catch(v){let x=g instanceof Error?g.message:"";throw v instanceof Error&&(x=`${x}
|
|
60
60
|
${v.message}`),x?new f.VercelOidcTokenError(x):v}return m}function p(){const m=(0,d.getContext)().headers?.["x-vercel-oidc-token"]??fAt.VERCEL_OIDC_TOKEN;if(!m)throw new Error("The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?");return m}}}),tHe=Q3({"../../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/index.js"(e,t){var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,i=(h,p)=>{for(var m in p)n(h,m,{get:p[m],enumerable:!0})},l=(h,p,m,g)=>{if(p&&typeof p=="object"||typeof p=="function")for(let v of a(p))!s.call(h,v)&&v!==m&&n(h,v,{get:()=>p[v],enumerable:!(g=r(p,v))||g.enumerable});return h},c=h=>l(n({},"__esModule",{value:!0}),h),u={};i(u,{getContext:()=>f.getContext,getVercelOidcToken:()=>d.getVercelOidcToken,getVercelOidcTokenSync:()=>d.getVercelOidcTokenSync}),t.exports=c(u);var d=hAt(),f=eHe()}}),pAt=z8e(tHe()),mAt=z8e(tHe()),gAt="vercel.ai.gateway.error",qB=Symbol.for(gAt),ewe,twe,Cc=class nHe extends(twe=Error,ewe=qB,twe){constructor({message:t,statusCode:n=500,cause:r}){super(t),this[ewe]=!0,this.statusCode=n,this.cause=r}static isInstance(t){return nHe.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&qB in t&&t[qB]===!0}},rHe="GatewayAuthenticationError",vAt=`vercel.ai.gateway.error.${rHe}`,nwe=Symbol.for(vAt),rwe,awe,aHe=class sHe extends(awe=Cc,rwe=nwe,awe){constructor({message:t="Authentication failed",statusCode:n=401,cause:r}={}){super({message:t,statusCode:n,cause:r}),this[rwe]=!0,this.name=rHe,this.type="authentication_error"}static isInstance(t){return Cc.hasMarker(t)&&nwe in t}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,message:r="Authentication failed",statusCode:a=401,cause:s}){let i;return t?i=`AI Gateway authentication failed: Invalid API key.
|
|
61
61
|
|
|
62
62
|
Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
@@ -212,7 +212,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
212
212
|
constructor(\${params}) {
|
|
213
213
|
\${}
|
|
214
214
|
}
|
|
215
|
-
}`,{label:"class",detail:"definition",type:"keyword"}),Yc('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Yc('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],xat=Ede.concat([Yc("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Yc("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Yc("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),B_e=new Ott,wat=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function dC(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const zln=["FunctionDeclaration"],Bln={FunctionDeclaration:dC("function"),ClassDeclaration:dC("class"),ClassExpression:()=>!0,EnumDeclaration:dC("constant"),TypeAliasDeclaration:dC("type"),NamespaceDeclaration:dC("namespace"),VariableDefinition(e,t){e.matchContext(zln)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function Sat(e,t){let n=B_e.get(t);if(n)return n;let r=[],a=!0;function s(i,l){let c=e.sliceString(i.from,i.to);r.push({label:c,type:l})}return t.cursor(Ua.IncludeAnonymous).iterate(i=>{if(a)a=!1;else if(i.name){let l=Bln[i.name];if(l&&l(i,s)||wat.has(i.name))return!1}else if(i.to-i.from>8192){for(let l of Sat(e,i.node))r.push(l);return!1}}),B_e.set(t,r),r}const ML=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Cde=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Oat(e){let t=ps(e.state).resolveInner(e.pos,-1);if(Cde.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&ML.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let a=t;a;a=a.parent)wat.has(a.name)&&(r=r.concat(Sat(e.state.doc,a)));return{options:r,from:n?t.from:e.pos,validFor:ML}}function CU(e,t,n){var r;let a=[];for(;;){let s=t.firstChild,i;if(s?.name=="VariableName")return a.push(e(s)),{path:a.reverse(),name:n};if(s?.name=="MemberExpression"&&((r=i=s.lastChild)===null||r===void 0?void 0:r.name)=="PropertyName")a.push(e(i)),t=s;else return null}}function kat(e){let t=r=>e.state.doc.sliceString(r.from,r.to),n=ps(e.state).resolveInner(e.pos,-1);return n.name=="PropertyName"?CU(t,n.parent,t(n)):(n.name=="."||n.name=="?.")&&n.parent.name=="MemberExpression"?CU(t,n.parent,""):Cde.indexOf(n.name)>-1?null:n.name=="VariableName"||n.to-n.from<20&&ML.test(t(n))?{path:[],name:t(n)}:n.name=="MemberExpression"?CU(t,n,""):e.explicit?{path:[],name:""}:null}function Uln(e,t){let n=e,r=[],a=new Set;for(let s=0;;s++){for(let l of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(l)||a.has(l))continue;a.add(l);let c;try{c=n[l]}catch{continue}r.push({label:l,type:typeof c=="function"?/^[A-Z]/.test(l)?"class":t?"function":"method":t?"variable":"property",boost:-s})}let i=Object.getPrototypeOf(e);if(!i)return r;e=i}}function qln(e){let t=new Map;return n=>{let r=kat(n);if(!r)return null;let a=e;for(let i of r.path)if(a=a[i],!a)return null;let s=t.get(a);return s||t.set(a,s=Uln(a,!r.path.length)),{from:n.pos-r.name.length,options:s,validFor:ML}}}const Lf=nw.define({name:"javascript",parser:Fln.configure({props:[Xw.add({IfStatement:yO({except:/^\s*({|else\b)/}),TryStatement:yO({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Fan,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:Lan({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":yO({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Kw.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":ide,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let n=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,r=e.lastChild;return!n||n.type.isError?null:{from:n.to,to:r.type.isError?e.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),_at={test:e=>/^JSX/.test(e.name),facet:lF({commentTokens:{block:{open:"{/*",close:"*/}"}}})},jde=Lf.configure({dialect:"ts"},"typescript"),Tde=Lf.configure({dialect:"jsx",props:[rde.add(e=>e.isTop?[_at]:void 0)]}),Nde=Lf.configure({dialect:"jsx ts",props:[rde.add(e=>e.isTop?[_at]:void 0)]},"typescript");let Eat=e=>({label:e,type:"keyword"});const Cat="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Eat),Vln=Cat.concat(["declare","implements","private","protected","public"].map(Eat));function DL(e={}){let t=e.jsx?e.typescript?Nde:Tde:e.typescript?jde:Lf,n=e.typescript?xat.concat(Vln):Ede.concat(Cat);return new aw(t,[Lf.data.of({autocomplete:ksn(Cde,Srt(n))}),Lf.data.of({autocomplete:Oat}),e.jsx?jat:[]])}function Hln(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function U_e(e,t,n=e.length){for(let r=t?.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return e.sliceString(r.from,Math.min(r.to,n));return""}const Qln=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),jat=xt.inputHandler.of((e,t,n,r,a)=>{if((Qln?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Lf.isActiveAt(e.state,t,-1))return!1;let s=a(),{state:i}=s,l=i.changeByRange(c=>{var u;let{head:d}=c,f=ps(i).resolveInner(d-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(i.doc.sliceString(d-1,d)!=r||f.name=="JSXAttributeValue"&&f.to>d)){if(r==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(r=="/"&&f.name=="JSXStartCloseTag"){let p=f.parent,m=p.parent;if(m&&p.from==d-2&&((h=U_e(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${h}>`;return{range:ot.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(r==">"){let p=Hln(f);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(h=U_e(i.doc,p,d)))return{range:c,changes:{from:d,insert:`</${h}>`}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function Wln(e,t){return t||(t={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:!0,node:!0,es6:!0,es2015:!0,es2017:!0,es2020:!0},rules:{}},e.getRules().forEach((n,r)=>{var a;!((a=n.meta.docs)===null||a===void 0)&&a.recommended&&(t.rules[r]=2)})),n=>{let{state:r}=n,a=[];for(let{from:s,to:i}of Lf.findRegions(r)){let l=r.doc.lineAt(s),c={line:l.number-1,col:s-l.from,pos:s};for(let u of e.verify(r.sliceDoc(s,i),t))a.push(Gln(u,r.doc,c))}return a}}function q_e(e,t,n,r){return n.line(e+r.line).from+t+(e==1?r.col-1:-1)}function Gln(e,t,n){let r=q_e(e.line,e.column,t,n),a={from:r,to:e.endLine!=null&&e.endColumn!=1?q_e(e.endLine,e.endColumn,t,n):r,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:e.severity==1?"warning":"error"};if(e.fix){let{range:s,text:i}=e.fix,l=s[0]+n.pos-r,c=s[1]+n.pos-r;a.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+l,to:d+c,insert:i},scrollIntoView:!0})}}]}return a}const GM=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:jat,completionPath:kat,esLint:Wln,javascript:DL,javascriptLanguage:Lf,jsxLanguage:Tde,localCompletionSource:Oat,scopeCompletionSource:qln,snippets:Ede,tsxLanguage:Nde,typescriptLanguage:jde,typescriptSnippets:xat},Symbol.toStringTag,{value:"Module"})),fC=["_blank","_self","_top","_parent"],jU=["ascii","utf-8","utf-16","latin1","latin1"],TU=["get","post","put","delete"],NU=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Zu=["true","false"],Pn={},Zln={a:{attrs:{href:null,ping:null,type:null,media:null,target:fC,hreflang:null}},abbr:Pn,address:Pn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Pn,aside:Pn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Pn,base:{attrs:{href:null,target:fC}},bdi:Pn,bdo:Pn,blockquote:{attrs:{cite:null}},body:Pn,br:Pn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:NU,formmethod:TU,formnovalidate:["novalidate"],formtarget:fC,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Pn,center:Pn,cite:Pn,code:Pn,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Pn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Pn,div:Pn,dl:Pn,dt:Pn,em:Pn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Pn,figure:Pn,footer:Pn,form:{attrs:{action:null,name:null,"accept-charset":jU,autocomplete:["on","off"],enctype:NU,method:TU,novalidate:["novalidate"],target:fC}},h1:Pn,h2:Pn,h3:Pn,h4:Pn,h5:Pn,h6:Pn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Pn,hgroup:Pn,hr:Pn,html:{attrs:{manifest:null}},i:Pn,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:NU,formmethod:TU,formnovalidate:["novalidate"],formtarget:fC,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Pn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Pn,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Pn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:jU,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Pn,noscript:Pn,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Pn,param:{attrs:{name:null,value:null}},pre:Pn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Pn,rt:Pn,ruby:Pn,samp:Pn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:jU}},section:Pn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Pn,source:{attrs:{src:null,type:null,media:null}},span:Pn,strong:Pn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Pn,summary:Pn,sup:Pn,table:Pn,tbody:Pn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Pn,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Pn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Pn,time:{attrs:{datetime:null}},title:Pn,tr:Pn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Pn,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Pn},Tat={accesskey:null,class:null,contenteditable:Zu,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Zu,autocorrect:Zu,autocapitalize:Zu,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Zu,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Zu,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Zu,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Zu,"aria-hidden":Zu,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Zu,"aria-multiselectable":Zu,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Zu,"aria-relevant":null,"aria-required":Zu,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Nat="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of Nat)Tat[e]=null;let jN=class{constructor(t,n){this.tags={...Zln,...t},this.globalAttrs={...Tat,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};jN.default=new jN;function vk(e,t,n=e.length){if(!t)return"";let r=t.firstChild,a=r&&r.getChild("TagName");return a?e.sliceString(a.from,Math.min(a.to,n)):""}function yk(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function Aat(e,t,n){let r=n.tags[vk(e,yk(t))];return r?.children||n.allTags}function Ade(e,t){let n=[];for(let r=yk(t);r&&!r.type.isTop;r=yk(r.parent)){let a=vk(e,r);if(a&&r.lastChild.name=="CloseTag")break;a&&n.indexOf(a)<0&&(t.name=="EndTag"||t.from>=r.firstChild.to)&&n.push(a)}return n}const Iat=/^[:\-\.\w\u00b7-\uffff]*$/;function V_e(e,t,n,r,a){let s=/\s*>/.test(e.sliceDoc(a,a+5))?"":">",i=yk(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:a,options:Aat(e.doc,i,t).map(l=>({label:l,type:"type"})).concat(Ade(e.doc,n).map((l,c)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function H_e(e,t,n,r){let a=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:Ade(e.doc,t).map((s,i)=>({label:s,apply:s+a,type:"type",boost:99-i})),validFor:Iat}}function Yln(e,t,n,r){let a=[],s=0;for(let i of Aat(e.doc,n,t))a.push({label:"<"+i,type:"type"});for(let i of Ade(e.doc,n))a.push({label:"</"+i+">",type:"type",boost:99-s++});return{from:r,to:r,options:a,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Xln(e,t,n,r,a){let s=yk(n),i=s?t.tags[vk(e.doc,s)]:null,l=i&&i.attrs?Object.keys(i.attrs):[],c=i&&i.globalAttrs===!1?l:l.length?l.concat(t.globalAttrNames):t.globalAttrNames;return{from:r,to:a,options:c.map(u=>({label:u,type:"property"})),validFor:Iat}}function Kln(e,t,n,r,a){var s;let i=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],c;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let f=yk(n),h=f?t.tags[vk(e.doc,f)]:null;d=h?.attrs&&h.attrs[u]}if(d){let f=e.sliceDoc(r,a).toLowerCase(),h='"',p='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",p=e.sliceDoc(a,a+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let m of d)l.push({label:m,apply:h+m+p,type:"constant"})}}return{from:r,to:a,options:l,validFor:c}}function Rat(e,t){let{state:n,pos:r}=t,a=ps(n).resolveInner(r,-1),s=a.resolve(r);for(let i=r,l;s==a&&(l=a.childBefore(i));){let c=l.lastChild;if(!c||!c.type.isError||c.from<c.to)break;s=a=l,i=c.from}return a.name=="TagName"?a.parent&&/CloseTag$/.test(a.parent.name)?H_e(n,a,a.from,r):V_e(n,e,a,a.from,r):a.name=="StartTag"||a.name=="IncompleteTag"?V_e(n,e,a,r,r):a.name=="StartCloseTag"||a.name=="IncompleteCloseTag"?H_e(n,a,r,r):a.name=="OpenTag"||a.name=="SelfClosingTag"||a.name=="AttributeName"?Xln(n,e,a,a.name=="AttributeName"?a.from:r,r):a.name=="Is"||a.name=="AttributeValue"||a.name=="UnquotedAttributeValue"?Kln(n,e,a,a.name=="Is"?r:a.from,r):t.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?Yln(n,e,a,r):null}function Pat(e){return Rat(jN.default,e)}function Mat(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new jN(t,n):jN.default;return a=>Rat(r,a)}const Jln=Lf.parser.configure({top:"SingleExpression"}),Dat=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:jde.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Tde.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:Nde.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:Jln},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Lf.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:CN.parser}],$at=[{name:"style",parser:CN.parser.configure({top:"Styles"})}].concat(Nat.map(e=>({name:e,parser:Lf.parser}))),Lat=nw.define({name:"html",parser:jon.configure({props:[Xw.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let r=e.node;;){let a=r.lastChild;if(!a||a.name!="Element"||a.to!=r.to)break;t=r=a}return t&&!((n=t.lastChild)&&(n.name=="CloseTag"||n.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),Kw.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:n.name=="CloseTag"?n.from:e.to}}}),mrt.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),tT=Lat.configure({wrap:uat(Dat,$at)});function Fat(e={}){let t="",n;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=uat((e.nestedLanguages||[]).concat(Dat),(e.nestedAttributes||[]).concat($at)));let r=n?Lat.configure({wrap:n,dialect:t}):t?tT.configure({dialect:t}):tT;return new aw(r,[tT.data.of({autocomplete:Mat(e)}),e.autoCloseTags!==!1?zat:[],DL().support,yat().support])}const Q_e=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),zat=xt.inputHandler.of((e,t,n,r,a)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!tT.isActiveAt(e.state,t,-1))return!1;let s=a(),{state:i}=s,l=i.changeByRange(c=>{var u,d,f;let h=i.doc.sliceString(c.from-1,c.to)==r,{head:p}=c,m=ps(i).resolveInner(p,-1),g;if(h&&r==">"&&m.name=="EndTag"){let v=m.parent;if(((d=(u=v.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=vk(i.doc,v.parent,p))&&!Q_e.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`</${g}>`;return{range:c,changes:{from:p,to:x,insert:w}}}}else if(h&&r=="/"&&m.name=="IncompleteCloseTag"){let v=m.parent;if(m.from==p-2&&((f=v.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=vk(i.doc,v,p))&&!Q_e.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`${g}>`;return{range:ot.cursor(p+w.length,-1),changes:{from:p,to:x,insert:w}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),ecn=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:zat,html:Fat,htmlCompletionSource:Pat,htmlCompletionSourceWith:Mat,htmlLanguage:tT},Symbol.toStringTag,{value:"Module"})),Bat=lF({commentTokens:{block:{open:"<!--",close:"-->"}}}),Uat=new lr,qat=Nin.configure({props:[Kw.add(e=>!e.is("Block")||e.is("Document")||Xne(e)!=null||tcn(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),Uat.add(Xne),Xw.add({Document:()=>null}),Hy.add({Document:Bat})]});function Xne(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function tcn(e){return e.name=="OrderedList"||e.name=="BulletList"}function ncn(e,t){let n=e;for(;;){let r=n.nextSibling,a;if(!r||(a=Xne(r.type))!=null&&a<=t)break;n=r}return n.to}const rcn=rrt.of((e,t,n)=>{for(let r=ps(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let a=r.type.prop(Uat);if(a==null)continue;let s=ncn(r,a);if(s>n)return{from:n,to:s}}return null});function Ide(e){return new hd(Bat,e,[],"markdown")}const Vat=Ide(qat),acn=qat.configure([Bin,qin,Uin,Vin,{props:[Kw.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),ow=Ide(acn);function scn(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=Ke.matchLanguageName(e,n,!0),r instanceof Ke)return r.support?r.support.language.parser:rw.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}class AU{constructor(t,n,r,a,s,i,l){this.node=t,this.from=n,this.to=r,this.spaceBefore=a,this.spaceAfter=s,this.type=i,this.item=l}blank(t,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;r.length<t;)r+=" ";return r}else{for(let a=this.to-this.from-r.length-this.spaceAfter.length;a>0;a--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(t,n){let r=this.node.name=="OrderedList"?String(+Qat(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function Hat(e,t){let n=[],r=[];for(let a=e;a;a=a.parent){if(a.name=="FencedCode")return r;(a.name=="ListItem"||a.name=="Blockquote")&&n.push(a)}for(let a=n.length-1;a>=0;a--){let s=n[a],i,l=t.lineAt(s.from),c=s.from-l.from;if(s.name=="Blockquote"&&(i=/^ *>( ?)/.exec(l.text.slice(c))))r.push(new AU(s,c,c+i[0].length,"",i[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=i[3],d=i[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),r.push(new AU(s.parent,c,c+d,i[1],u,i[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(i=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=i[4],d=i[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=i[2];i[3]&&(f+=i[3].replace(/[xX]/," ")),r.push(new AU(s.parent,c,c+d,i[1],u,f,s))}}return r}function Qat(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function IU(e,t,n,r=0){for(let a=-1,s=e;;){if(s.name=="ListItem"){let l=Qat(s,t),c=+l[2];if(a>=0){if(c!=a+1)return;n.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(a+2+r)})}a=c}let i=s.nextSibling;if(!i)break;s=i}}function Rde(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(j_)!=" ")return e;let r=Vh(e,4,n),a="";for(let s=r;s>0;)s>=4?(a+=" ",s-=4):(a+=" ",s--);return a+e.slice(n)}const Wat=(e={})=>({state:t,dispatch:n})=>{let r=ps(t),{doc:a}=t,s=null,i=t.changeByRange(l=>{if(!l.empty||!ow.isActiveAt(t,l.from,-1)&&!ow.isActiveAt(t,l.from,1))return s={range:l};let c=l.from,u=a.lineAt(c),d=Hat(r.resolveInner(c,-1),a);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return s={range:l};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return s={range:l};let h=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&h){let x=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(x.to>=c||w&&w.to<c||u.from>0&&!/[^\s>]/.test(a.lineAt(u.from-1).text)||e.nonTightLists===!1){let O=d.length>1?d[d.length-2]:null,k,_="";O&&O.item?(k=u.from+O.from,_=O.marker(a,1)):k=u.from+(O?O.to:0);let C=[{from:k,to:c,insert:_}];return f.node.name=="OrderedList"&&IU(f.item,a,C,-2),O&&O.node.name=="OrderedList"&&IU(O.item,a,C),{range:ot.cursor(k+_.length),changes:C}}else{let O=G_e(d,t,u);return{range:ot.cursor(c+O.length+1),changes:{from:u.from,insert:O+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let x=a.lineAt(u.from-1),w=/>\s*$/.exec(x.text);if(w&&w.index==f.from){let O=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(O),changes:O}}}let p=[];f.node.name=="OrderedList"&&IU(f.item,a,p);let m=f.item&&f.item.from<u.from,g="";if(!m||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=f.to)for(let x=0,w=d.length-1;x<=w;x++)g+=x==w&&!m?d[x].marker(a,1):d[x].blank(x<w?Vh(u.text,4,d[x+1].from)-g.length:null);let v=c;for(;v>u.from&&/\s/.test(u.text.charAt(v-u.from-1));)v--;return g=Rde(g,t),icn(f.node,t.doc)&&(g=G_e(d,t,u)+t.lineBreak+g),p.push({from:v,to:c,insert:t.lineBreak+g}),{range:ot.cursor(v+g.length+1),changes:p}});return s?!1:(n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},Gat=Wat();function W_e(e){return e.name=="QuoteMark"||e.name=="ListMark"}function icn(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let n=e.firstChild,r=e.getChild("ListItem","ListItem");if(!r)return!1;let a=t.lineAt(n.to),s=t.lineAt(r.from),i=/^[\s>]*$/.test(a.text);return a.number+(i?0:1)<s.number}function G_e(e,t,n){let r="";for(let a=0,s=e.length-2;a<=s;a++)r+=e[a].blank(a<s?Vh(n.text,4,e[a+1].from)-r.length:null,a<s);return Rde(r,t)}function ocn(e,t){let n=e.resolveInner(t,-1),r=t;W_e(n)&&(r=n.from,n=n.parent);for(let a;a=n.childBefore(r);)if(W_e(a))r=a.from;else if(a.name=="OrderedList"||a.name=="BulletList")n=a.lastChild,r=n.to;else break;return n}const Zat=({state:e,dispatch:t})=>{let n=ps(e),r=null,a=e.changeByRange(s=>{let i=s.from,{doc:l}=e;if(s.empty&&ow.isActiveAt(e,s.from)){let c=l.lineAt(i),u=Hat(ocn(n,i),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(i-c.from>f&&!/\S/.test(c.text.slice(f,i-c.from)))return{range:ot.cursor(c.from+f),changes:{from:c.from+f,to:i}};if(i-c.from==f&&(!d.item||c.from<=d.item.from||!/\S/.test(c.text.slice(0,d.to)))){let h=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let p=d.blank(Vh(c.text,4,d.to)-Vh(c.text,4,d.from));return h==c.from&&(p=Rde(p,e)),{range:ot.cursor(h+p.length),changes:{from:h,to:c.from+d.to,insert:p}}}if(h<i)return{range:ot.cursor(h),changes:{from:h,to:i}}}}}return r={range:s}});return r?!1:(t(e.update(a,{scrollIntoView:!0,userEvent:"delete"})),!0)},Yat=[{key:"Enter",run:Gat},{key:"Backspace",run:Zat}],Xat=Fat({matchClosingTags:!1});function Pde(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:a}=Vat,completeHTMLTags:s=!0,pasteURLAsLink:i=!0,htmlTagLanguage:l=Xat}=e;if(!(a instanceof hF))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[l.support,rcn],d;i&&u.push(Kat),n instanceof aw?(u.push(n.support),d=n.language):n&&(d=n);let f=t||d?scn(t,d):void 0;c.push(Iin({codeParser:f,htmlParser:l.language.parser})),r&&u.push(tp.high(C_.of(Yat)));let h=Ide(a.configure(c));return s&&u.push(h.data.of({autocomplete:lcn})),new aw(h,u)}function lcn(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let a=ps(t).resolveInner(n,-1);for(;a&&!a.type.isTop;){if(a.name=="CodeBlock"||a.name=="FencedCode"||a.name=="ProcessingInstructionBlock"||a.name=="CommentBlock"||a.name=="Link"||a.name=="Image")return null;a=a.parent}return{from:n-r[0].length,to:n,options:ccn(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let RU=null;function ccn(){if(RU)return RU;let e=Pat(new ude(Ir.create({extensions:Xat}),0,!0));return RU=e?e.options:[]}const ucn=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Kat=xt.domEventHandlers({paste:(e,t)=>{var n;let{main:r}=t.state.selection;if(r.empty)return!1;let a=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!a||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(a)||(/^www\./.test(a)&&(a="https://"+a),!ow.isActiveAt(t.state,r.from,1)))return!1;let s=ps(t.state),i=!1;return s.iterate({from:r.from,to:r.to,enter:l=>{(l.from>r.from||ucn.test(l.name))&&(i=!0)},leave:l=>{l.to<r.to&&(i=!0)}}),i?!1:(t.dispatch({changes:[{from:r.from,insert:"["},{from:r.to,insert:`](${a})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),dcn=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:Vat,deleteMarkupBackward:Zat,insertNewlineContinueMarkup:Gat,insertNewlineContinueMarkupCommand:Wat,markdown:Pde,markdownKeymap:Yat,markdownLanguage:ow,pasteURLAsLink:Kat},Symbol.toStringTag,{value:"Module"}));function gt(e){return new aw(ode.define(e))}function my(e){return nt(()=>import("./index-DLYHAKqB.js"),__vite__mapDeps([4,2]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const Jat=[Ke.of({name:"C",extensions:["c","h","ino"],load(){return nt(()=>import("./index-Cf0Ubdpj.js"),__vite__mapDeps([5,2]),import.meta.url).then(e=>e.cpp())}}),Ke.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return nt(()=>import("./index-Cf0Ubdpj.js"),__vite__mapDeps([5,2]),import.meta.url).then(e=>e.cpp())}}),Ke.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return my("Cassandra")}}),Ke.of({name:"CSS",extensions:["css"],load(){return nt(()=>Promise.resolve().then(()=>lln),void 0,import.meta.url).then(e=>e.css())}}),Ke.of({name:"Go",extensions:["go"],load(){return nt(()=>import("./index-DA4EkWzj.js"),__vite__mapDeps([6,2]),import.meta.url).then(e=>e.go())}}),Ke.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return nt(()=>Promise.resolve().then(()=>ecn),void 0,import.meta.url).then(e=>e.html())}}),Ke.of({name:"Java",extensions:["java"],load(){return nt(()=>import("./index-JxRg60yf.js"),__vite__mapDeps([7,2]),import.meta.url).then(e=>e.java())}}),Ke.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return nt(()=>Promise.resolve().then(()=>GM),void 0,import.meta.url).then(e=>e.javascript())}}),Ke.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return nt(()=>import("./index-Df7cXN4g.js"),__vite__mapDeps([8,2]),import.meta.url).then(e=>e.jinja())}}),Ke.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return nt(()=>Promise.resolve().then(()=>Ssn),void 0,import.meta.url).then(e=>e.json())}}),Ke.of({name:"JSX",extensions:["jsx"],load(){return nt(()=>Promise.resolve().then(()=>GM),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ke.of({name:"LESS",extensions:["less"],load(){return nt(()=>import("./index-BR0NQGVO.js"),__vite__mapDeps([9,2]),import.meta.url).then(e=>e.less())}}),Ke.of({name:"Liquid",extensions:["liquid"],load(){return nt(()=>import("./index-BCygcIbA.js"),__vite__mapDeps([10,2]),import.meta.url).then(e=>e.liquid())}}),Ke.of({name:"MariaDB SQL",load(){return my("MariaSQL")}}),Ke.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return nt(()=>Promise.resolve().then(()=>dcn),void 0,import.meta.url).then(e=>e.markdown())}}),Ke.of({name:"MS SQL",load(){return my("MSSQL")}}),Ke.of({name:"MySQL",load(){return my("MySQL")}}),Ke.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return nt(()=>import("./index-CsruLyV3.js"),__vite__mapDeps([11,2]),import.meta.url).then(e=>e.php())}}),Ke.of({name:"PLSQL",extensions:["pls"],load(){return my("PLSQL")}}),Ke.of({name:"PostgreSQL",load(){return my("PostgreSQL")}}),Ke.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return nt(()=>import("./index-BnaKZjni.js"),__vite__mapDeps([12,2]),import.meta.url).then(e=>e.python())}}),Ke.of({name:"Rust",extensions:["rs"],load(){return nt(()=>import("./index-B6rIFuqy.js"),__vite__mapDeps([13,2]),import.meta.url).then(e=>e.rust())}}),Ke.of({name:"Sass",extensions:["sass"],load(){return nt(()=>import("./index-MRpUtCW9.js"),__vite__mapDeps([14,2]),import.meta.url).then(e=>e.sass({indented:!0}))}}),Ke.of({name:"SCSS",extensions:["scss"],load(){return nt(()=>import("./index-MRpUtCW9.js"),__vite__mapDeps([14,2]),import.meta.url).then(e=>e.sass())}}),Ke.of({name:"SQL",extensions:["sql"],load(){return my("StandardSQL")}}),Ke.of({name:"SQLite",load(){return my("SQLite")}}),Ke.of({name:"TSX",extensions:["tsx"],load(){return nt(()=>Promise.resolve().then(()=>GM),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ke.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return nt(()=>Promise.resolve().then(()=>GM),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ke.of({name:"WebAssembly",extensions:["wat","wast"],load(){return nt(()=>import("./index-DmVqfev1.js"),__vite__mapDeps([15,2]),import.meta.url).then(e=>e.wast())}}),Ke.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return nt(()=>import("./index-Bk9TuSgc.js"),__vite__mapDeps([16,2]),import.meta.url).then(e=>e.xml())}}),Ke.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return nt(()=>import("./index-yHw3Ngb5.js"),__vite__mapDeps([17,2]),import.meta.url).then(e=>e.yaml())}}),Ke.of({name:"APL",extensions:["dyalog","apl"],load(){return nt(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>gt(e.apl))}}),Ke.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return nt(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>gt(e.asciiArmor))}}),Ke.of({name:"ASN.1",extensions:["asn","asn1"],load(){return nt(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>gt(e.asn1({})))}}),Ke.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return nt(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>gt(e.asterisk))}}),Ke.of({name:"Brainfuck",extensions:["b","bf"],load(){return nt(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>gt(e.brainfuck))}}),Ke.of({name:"Cobol",extensions:["cob","cpy"],load(){return nt(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>gt(e.cobol))}}),Ke.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.csharp))}}),Ke.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"ClojureScript",extensions:["cljs"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return nt(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>gt(e.gss))}}),Ke.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return nt(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>gt(e.cmake))}}),Ke.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return nt(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>gt(e.coffeeScript))}}),Ke.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return nt(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>gt(e.commonLisp))}}),Ke.of({name:"Cypher",extensions:["cyp","cypher"],load(){return nt(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>gt(e.cypher))}}),Ke.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return nt(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>gt(e.cython))}}),Ke.of({name:"Crystal",extensions:["cr"],load(){return nt(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>gt(e.crystal))}}),Ke.of({name:"D",extensions:["d"],load(){return nt(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>gt(e.d))}}),Ke.of({name:"Dart",extensions:["dart"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.dart))}}),Ke.of({name:"diff",extensions:["diff","patch"],load(){return nt(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>gt(e.diff))}}),Ke.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return nt(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([18,19]),import.meta.url).then(e=>gt(e.dockerFile))}}),Ke.of({name:"DTD",extensions:["dtd"],load(){return nt(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>gt(e.dtd))}}),Ke.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return nt(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>gt(e.dylan))}}),Ke.of({name:"EBNF",load(){return nt(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>gt(e.ebnf))}}),Ke.of({name:"ECL",extensions:["ecl"],load(){return nt(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>gt(e.ecl))}}),Ke.of({name:"edn",extensions:["edn"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"Eiffel",extensions:["e"],load(){return nt(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>gt(e.eiffel))}}),Ke.of({name:"Elm",extensions:["elm"],load(){return nt(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>gt(e.elm))}}),Ke.of({name:"Erlang",extensions:["erl"],load(){return nt(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>gt(e.erlang))}}),Ke.of({name:"Esper",load(){return nt(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>gt(e.esper))}}),Ke.of({name:"Factor",extensions:["factor"],load(){return nt(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([20,19]),import.meta.url).then(e=>gt(e.factor))}}),Ke.of({name:"FCL",load(){return nt(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>gt(e.fcl))}}),Ke.of({name:"Forth",extensions:["forth","fth","4th"],load(){return nt(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>gt(e.forth))}}),Ke.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return nt(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>gt(e.fortran))}}),Ke.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.fSharp))}}),Ke.of({name:"Gas",extensions:["s"],load(){return nt(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>gt(e.gas))}}),Ke.of({name:"Gherkin",extensions:["feature"],load(){return nt(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>gt(e.gherkin))}}),Ke.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return nt(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>gt(e.groovy))}}),Ke.of({name:"Haskell",extensions:["hs"],load(){return nt(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>gt(e.haskell))}}),Ke.of({name:"Haxe",extensions:["hx"],load(){return nt(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>gt(e.haxe))}}),Ke.of({name:"HXML",extensions:["hxml"],load(){return nt(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>gt(e.hxml))}}),Ke.of({name:"HTTP",load(){return nt(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>gt(e.http))}}),Ke.of({name:"IDL",extensions:["pro"],load(){return nt(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>gt(e.idl))}}),Ke.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return nt(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>gt(e.jsonld))}}),Ke.of({name:"Julia",extensions:["jl"],load(){return nt(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>gt(e.julia))}}),Ke.of({name:"Kotlin",extensions:["kt","kts"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.kotlin))}}),Ke.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return nt(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>gt(e.liveScript))}}),Ke.of({name:"Lua",extensions:["lua"],load(){return nt(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>gt(e.lua))}}),Ke.of({name:"mIRC",extensions:["mrc"],load(){return nt(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>gt(e.mirc))}}),Ke.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return nt(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>gt(e.mathematica))}}),Ke.of({name:"Modelica",extensions:["mo"],load(){return nt(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>gt(e.modelica))}}),Ke.of({name:"MUMPS",extensions:["mps"],load(){return nt(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>gt(e.mumps))}}),Ke.of({name:"Mbox",extensions:["mbox"],load(){return nt(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>gt(e.mbox))}}),Ke.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return nt(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>gt(e.nginx))}}),Ke.of({name:"NSIS",extensions:["nsh","nsi"],load(){return nt(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([21,19]),import.meta.url).then(e=>gt(e.nsis))}}),Ke.of({name:"NTriples",extensions:["nt","nq"],load(){return nt(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>gt(e.ntriples))}}),Ke.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.objectiveC))}}),Ke.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.objectiveCpp))}}),Ke.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.oCaml))}}),Ke.of({name:"Octave",extensions:["m"],load(){return nt(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>gt(e.octave))}}),Ke.of({name:"Oz",extensions:["oz"],load(){return nt(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>gt(e.oz))}}),Ke.of({name:"Pascal",extensions:["p","pas"],load(){return nt(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>gt(e.pascal))}}),Ke.of({name:"Perl",extensions:["pl","pm"],load(){return nt(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>gt(e.perl))}}),Ke.of({name:"Pig",extensions:["pig"],load(){return nt(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>gt(e.pig))}}),Ke.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return nt(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>gt(e.powerShell))}}),Ke.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return nt(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>gt(e.properties))}}),Ke.of({name:"ProtoBuf",extensions:["proto"],load(){return nt(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>gt(e.protobuf))}}),Ke.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return nt(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([22,23]),import.meta.url).then(e=>gt(e.pug))}}),Ke.of({name:"Puppet",extensions:["pp"],load(){return nt(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>gt(e.puppet))}}),Ke.of({name:"Q",extensions:["q"],load(){return nt(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>gt(e.q))}}),Ke.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return nt(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>gt(e.r))}}),Ke.of({name:"RPM Changes",load(){return nt(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>gt(e.rpmChanges))}}),Ke.of({name:"RPM Spec",extensions:["spec"],load(){return nt(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>gt(e.rpmSpec))}}),Ke.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return nt(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>gt(e.ruby))}}),Ke.of({name:"SAS",extensions:["sas"],load(){return nt(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>gt(e.sas))}}),Ke.of({name:"Scala",extensions:["scala"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.scala))}}),Ke.of({name:"Scheme",extensions:["scm","ss"],load(){return nt(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>gt(e.scheme))}}),Ke.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return nt(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>gt(e.shell))}}),Ke.of({name:"Sieve",extensions:["siv","sieve"],load(){return nt(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>gt(e.sieve))}}),Ke.of({name:"Smalltalk",extensions:["st"],load(){return nt(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>gt(e.smalltalk))}}),Ke.of({name:"Solr",load(){return nt(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>gt(e.solr))}}),Ke.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.sml))}}),Ke.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return nt(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>gt(e.sparql))}}),Ke.of({name:"Spreadsheet",alias:["excel","formula"],load(){return nt(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>gt(e.spreadsheet))}}),Ke.of({name:"Squirrel",extensions:["nut"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.squirrel))}}),Ke.of({name:"Stylus",extensions:["styl"],load(){return nt(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>gt(e.stylus))}}),Ke.of({name:"Swift",extensions:["swift"],load(){return nt(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>gt(e.swift))}}),Ke.of({name:"sTeX",load(){return nt(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>gt(e.stex))}}),Ke.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return nt(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>gt(e.stex))}}),Ke.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return nt(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>gt(e.verilog))}}),Ke.of({name:"Tcl",extensions:["tcl"],load(){return nt(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>gt(e.tcl))}}),Ke.of({name:"Textile",extensions:["textile"],load(){return nt(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>gt(e.textile))}}),Ke.of({name:"TiddlyWiki",load(){return nt(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>gt(e.tiddlyWiki))}}),Ke.of({name:"Tiki wiki",load(){return nt(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>gt(e.tiki))}}),Ke.of({name:"TOML",extensions:["toml"],load(){return nt(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>gt(e.toml))}}),Ke.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return nt(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>gt(e.troff))}}),Ke.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return nt(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>gt(e.ttcn))}}),Ke.of({name:"TTCN_CFG",extensions:["cfg"],load(){return nt(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>gt(e.ttcnCfg))}}),Ke.of({name:"Turtle",extensions:["ttl"],load(){return nt(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>gt(e.turtle))}}),Ke.of({name:"Web IDL",extensions:["webidl"],load(){return nt(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>gt(e.webIDL))}}),Ke.of({name:"VB.NET",extensions:["vb"],load(){return nt(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>gt(e.vb))}}),Ke.of({name:"VBScript",extensions:["vbs"],load(){return nt(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>gt(e.vbScript))}}),Ke.of({name:"Velocity",extensions:["vtl"],load(){return nt(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>gt(e.velocity))}}),Ke.of({name:"Verilog",extensions:["v"],load(){return nt(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>gt(e.verilog))}}),Ke.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return nt(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>gt(e.vhdl))}}),Ke.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return nt(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>gt(e.xQuery))}}),Ke.of({name:"Yacas",extensions:["ys"],load(){return nt(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>gt(e.yacas))}}),Ke.of({name:"Z80",extensions:["z80"],load(){return nt(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>gt(e.z80))}}),Ke.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.mscgen))}}),Ke.of({name:"Xù",extensions:["xu"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.xu))}}),Ke.of({name:"MsGenny",extensions:["msgenny"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.msgenny))}}),Ke.of({name:"Vue",extensions:["vue"],load(){return nt(()=>import("./index-CsnaQUo7.js"),__vite__mapDeps([24,2]),import.meta.url).then(e=>e.vue())}}),Ke.of({name:"Angular Template",load(){return nt(()=>import("./index-DvZgbxSc.js"),__vite__mapDeps([25,2]),import.meta.url).then(e=>e.angular())}})];var fcn=e=>{var{theme:t,settings:n={},styles:r=[]}=e,a={".cm-gutters":{}},s={};n.background&&(s.backgroundColor=n.background),n.backgroundImage&&(s.backgroundImage=n.backgroundImage),n.foreground&&(s.color=n.foreground),n.fontSize&&(s.fontSize=n.fontSize),(n.background||n.foreground)&&(a["&"]=s),n.fontFamily&&(a["&.cm-editor .cm-scroller"]={fontFamily:n.fontFamily}),n.gutterBackground&&(a[".cm-gutters"].backgroundColor=n.gutterBackground),n.gutterForeground&&(a[".cm-gutters"].color=n.gutterForeground),n.gutterBorder&&(a[".cm-gutters"].borderRightColor=n.gutterBorder),n.caret&&(a[".cm-content"]={caretColor:n.caret},a[".cm-cursor, .cm-dropCursor"]={borderLeftColor:n.caret});var i={};n.gutterActiveForeground&&(i.color=n.gutterActiveForeground),n.lineHighlight&&(a[".cm-activeLine"]={backgroundColor:n.lineHighlight},i.backgroundColor=n.lineHighlight),a[".cm-activeLineGutter"]=i,n.selection&&(a["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:n.selection+" !important"}),n.selectionMatch&&(a["& .cm-selectionMatch"]={backgroundColor:n.selectionMatch});var l=xt.theme(a,{dark:t==="dark"}),c=$m.define(r),u=[l,Jw(c)];return u},hcn={background:"#282a36",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"#282a36",gutterForeground:"#6D8A88",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},pcn=[{tag:se.comment,color:"#6272a4"},{tag:se.string,color:"#f1fa8c"},{tag:se.atom,color:"#bd93f9"},{tag:se.meta,color:"#f8f8f2"},{tag:[se.keyword,se.operator,se.tagName],color:"#ff79c6"},{tag:[se.function(se.propertyName),se.propertyName],color:"#66d9ef"},{tag:[se.definition(se.variableName),se.function(se.variableName),se.className,se.attributeName],color:"#50fa7b"},{tag:se.atom,color:"#bd93f9"}],FI=e=>{var{theme:t="dark",settings:n={},styles:r=[]}=e||{};return fcn({theme:t,settings:Ob({},hcn,n),styles:[...pcn,...r]})};FI();const mcn=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Dde(e.state,n.from);return r.line?gcn(e):r.block?ycn(e):!1};function Mde(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let a=e(t,n);return a?(r(n.update(a)),!0):!1}}const gcn=Mde(wcn,0),vcn=Mde(est,0),ycn=Mde((e,t)=>est(e,t,xcn(t)),0);function Dde(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const hC=50;function bcn(e,{open:t,close:n},r,a){let s=e.sliceDoc(r-hC,r),i=e.sliceDoc(a,a+hC),l=/\s*$/.exec(s)[0].length,c=/^\s*/.exec(i)[0].length,u=s.length-l;if(s.slice(u-t.length,u)==t&&i.slice(c,c+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:a+c,margin:c&&1}};let d,f;a-r<=2*hC?d=f=e.sliceDoc(r,a):(d=e.sliceDoc(r,r+hC),f=e.sliceDoc(a-hC,a));let h=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-n.length;return d.slice(h,h+t.length)==t&&f.slice(m,m+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:a-p-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function xcn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),a=n.to<=r.to?r:e.doc.lineAt(n.to);a.from>r.from&&a.from==n.to&&(a=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let s=t.length-1;s>=0&&t[s].to>r.from?t[s].to=a.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:a.to})}return t}function est(e,t,n=t.selection.ranges){let r=n.map(s=>Dde(t,s.from).block);if(!r.every(s=>s))return null;let a=n.map((s,i)=>bcn(t,r[i],s.from,s.to));if(e!=2&&!a.every(s=>s))return{changes:t.changes(n.map((s,i)=>a[i]?[]:[{from:s.from,insert:r[i].open+" "},{from:s.to,insert:" "+r[i].close}]))};if(e!=1&&a.some(s=>s)){let s=[];for(let i=0,l;i<a.length;i++)if(l=a[i]){let c=r[i],{open:u,close:d}=l;s.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:s}}return null}function wcn(e,t,n=t.selection.ranges){let r=[],a=-1;for(let{from:s,to:i}of n){let l=r.length,c=1e9,u=Dde(t,s).line;if(u){for(let d=s;d<=i;){let f=t.doc.lineAt(d);if(f.from>a&&(s==i||i>f.from)){a=f.from;let h=/^\s*/.exec(f.text)[0].length,p=h==f.length,m=f.text.slice(h,h+u.length)==u?h:-1;h<f.text.length&&h<c&&(c=h),r.push({line:f,comment:m,token:u,indent:h,empty:p,single:!1})}d=f.to+1}if(c<1e9)for(let d=l;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=c);r.length==l+1&&(r[l].single=!0)}}if(e!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of r)(f||!d)&&s.push({from:l.from+u,insert:c+" "});let i=t.changes(s);return{changes:i,selection:t.selection.map(i,1)}}else if(e!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:i,comment:l,token:c}of r)if(l>=0){let u=i.from+l,d=u+c.length;i.text[d-i.from]==" "&&d++,s.push({from:u,to:d})}return{changes:s}}return null}const Kne=Mm.define(),Scn=Mm.define(),Ocn=Jt.define(),tst=Jt.define({combine(e){return Dm(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,a)=>t(r,a)||n(r,a)})}}),nst=vo.define({create(){return tm.empty},update(e,t){let n=t.state.facet(tst),r=t.annotation(Kne);if(r){let c=du.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=$L(d,d.length,n.minDepth,c):d=sst(d,t.startState.selection),new tm(u==0?r.rest:d,u==0?d:r.rest)}let a=t.annotation(Scn);if((a=="full"||a=="before")&&(e=e.isolate()),t.annotation(co.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=du.fromTransaction(t),i=t.annotation(co.time),l=t.annotation(co.userEvent);return s?e=e.addChanges(s,i,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,i,l,n.newGroupDelay)),(a=="full"||a=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new tm(e.done.map(du.fromJSON),e.undone.map(du.fromJSON))}});function kcn(e={}){return[nst,tst.of(e),xt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?rst:t.inputType=="historyRedo"?Jne:null;return r?(t.preventDefault(),r(n)):!1}})]}function pF(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let a=n.field(nst,!1);if(!a)return!1;let s=a.pop(e,n,t);return s?(r(s),!0):!1}}const rst=pF(0,!1),Jne=pF(1,!1),_cn=pF(0,!0),Ecn=pF(1,!0);class du{constructor(t,n,r,a,s){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=a,this.selectionsAfter=s}setSelAfter(t){return new du(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(a=>a.toJSON())}}static fromJSON(t){return new du(t.changes&&ao.fromJSON(t.changes),[],t.mapped&&lm.fromJSON(t.mapped),t.startSelection&&ot.fromJSON(t.startSelection),t.selectionsAfter.map(ot.fromJSON))}static fromTransaction(t,n){let r=Nf;for(let a of t.startState.facet(Ocn)){let s=a(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new du(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Nf)}static selection(t){return new du(void 0,Nf,void 0,void 0,t)}}function $L(e,t,n,r){let a=t+1>n+20?t-n-1:0,s=e.slice(a,t);return s.push(r),s}function Ccn(e,t){let n=[],r=!1;return e.iterChangedRanges((a,s)=>n.push(a,s)),t.iterChangedRanges((a,s,i,l)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];l>=u&&i<=d&&(r=!0)}}),r}function jcn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function ast(e,t){return e.length?t.length?e.concat(t):e:t}const Nf=[],Tcn=200;function sst(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Tcn));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),$L(e,e.length-1,1e9,n.setSelAfter(r)))}else return[du.selection([t])]}function Ncn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function PU(e,t){if(!e.length)return e;let n=e.length,r=Nf;for(;n;){let a=Acn(e[n-1],t,r);if(a.changes&&!a.changes.empty||a.effects.length){let s=e.slice(0,n);return s[n-1]=a,s}else t=a.mapped,n--,r=a.selectionsAfter}return r.length?[du.selection(r)]:Nf}function Acn(e,t,n){let r=ast(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):Nf,n);if(!e.changes)return du.selection(r);let a=e.changes.map(t),s=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(s):s;return new du(a,er.mapEffects(e.effects,t),i,e.startSelection.map(s),r)}const Icn=/^(input\.type|delete)($|\.)/;class tm{constructor(t,n,r=0,a=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=a}isolate(){return this.prevTime?new tm(this.done,this.undone):this}addChanges(t,n,r,a,s){let i=this.done,l=i[i.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!r||Icn.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime<a.newGroupDelay&&a.joinToEvent(s,Ccn(l.changes,t.changes))||r=="input.type.compose")?i=$L(i,i.length-1,a.minDepth,new du(t.changes.compose(l.changes),ast(er.mapEffects(t.effects,l.changes),l.effects),l.mapped,l.startSelection,Nf)):i=$L(i,i.length,a.minDepth,t),new tm(i,Nf,n,r)}addSelection(t,n,r,a){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Nf;return s.length>0&&n-this.prevTime<a&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&jcn(s[s.length-1],t)?this:new tm(sst(this.done,t),this.undone,n,r)}addMapping(t){return new tm(PU(this.done,t),PU(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let a=t==0?this.done:this.undone;if(a.length==0)return null;let s=a[a.length-1],i=s.selectionsAfter[0]||n.selection;if(r&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Kne.of({side:t,rest:Ncn(a),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=a.length==1?Nf:a.slice(0,a.length-1);return s.mapped&&(l=PU(l,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Kne.of({side:t,rest:l,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}tm.empty=new tm(Nf,Nf);const Rcn=[{key:"Mod-z",run:rst,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Jne,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Jne,preventDefault:!0},{key:"Mod-u",run:_cn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ecn,preventDefault:!0}];function N_(e,t){return ot.create(e.ranges.map(t),e.mainIndex)}function np(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function rp({state:e,dispatch:t},n){let r=N_(e.selection,n);return r.eq(e.selection,!0)?!1:(t(np(e,r)),!0)}function mF(e,t){return ot.cursor(t?e.to:e.from)}function ist(e,t){return rp(e,n=>n.empty?e.moveByChar(n,t):mF(n,t))}function nc(e){return e.textDirectionAt(e.state.selection.main.head)==xs.LTR}const ost=e=>ist(e,!nc(e)),lst=e=>ist(e,nc(e));function cst(e,t){return rp(e,n=>n.empty?e.moveByGroup(n,t):mF(n,t))}const Pcn=e=>cst(e,!nc(e)),Mcn=e=>cst(e,nc(e));function Dcn(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function gF(e,t,n){let r=ps(e).resolveInner(t.head),a=n?lr.closedBy:lr.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;Dcn(e,u,a)?r=u:c=n?u.to:u.from}let s=r.type.prop(a),i,l;return s&&(i=n?em(e,r.from,1):em(e,r.to,-1))&&i.matched?l=n?i.end.to:i.end.from:l=n?r.to:r.from,ot.cursor(l,n?-1:1)}const $cn=e=>rp(e,t=>gF(e.state,t,!nc(e))),Lcn=e=>rp(e,t=>gF(e.state,t,nc(e)));function ust(e,t){return rp(e,n=>{if(!n.empty)return mF(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const dst=e=>ust(e,!1),fst=e=>ust(e,!0);function hst(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,a;if(t){for(let s of e.state.facet(xt.scrollMargins)){let i=s(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}a=e.scrollDOM.clientHeight-n-r}else a=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,a-5)}}function pst(e,t){let n=hst(e),{state:r}=e,a=N_(r.selection,i=>i.empty?e.moveVertically(i,t,n.height):mF(i,t));if(a.eq(r.selection))return!1;let s;if(n.selfScroll){let i=e.coordsAtPos(r.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,u=l.bottom-n.marginBottom;i&&i.top>c&&i.bottom<u&&(s=xt.scrollIntoView(a.main.head,{y:"start",yMargin:i.top-c}))}return e.dispatch(np(r,a),{effects:s}),!0}const Z_e=e=>pst(e,!1),ere=e=>pst(e,!0);function Zb(e,t,n){let r=e.lineBlockAt(t.head),a=e.moveToLineBoundary(t,n);if(a.head==t.head&&a.head!=(n?r.to:r.from)&&(a=e.moveToLineBoundary(t,n,!1)),!n&&a.head==r.from&&r.length){let s=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&t.head!=r.from+s&&(a=ot.cursor(r.from+s))}return a}const Fcn=e=>rp(e,t=>Zb(e,t,!0)),zcn=e=>rp(e,t=>Zb(e,t,!1)),Bcn=e=>rp(e,t=>Zb(e,t,!nc(e))),Ucn=e=>rp(e,t=>Zb(e,t,nc(e))),qcn=e=>rp(e,t=>ot.cursor(e.lineBlockAt(t.head).from,1)),Vcn=e=>rp(e,t=>ot.cursor(e.lineBlockAt(t.head).to,-1));function Hcn(e,t,n){let r=!1,a=N_(e.selection,s=>{let i=em(e,s.head,-1)||em(e,s.head,1)||s.head>0&&em(e,s.head-1,1)||s.head<e.doc.length&&em(e,s.head+1,-1);if(!i||!i.end)return s;r=!0;let l=i.start.from==s.head?i.end.to:i.end.from;return ot.cursor(l)});return r?(t(np(e,a)),!0):!1}const Qcn=({state:e,dispatch:t})=>Hcn(e,t);function Jf(e,t){let n=N_(e.state.selection,r=>{let a=t(r);return ot.range(r.anchor,a.head,a.goalColumn,a.bidiLevel||void 0)});return n.eq(e.state.selection)?!1:(e.dispatch(np(e.state,n)),!0)}function mst(e,t){return Jf(e,n=>e.moveByChar(n,t))}const gst=e=>mst(e,!nc(e)),vst=e=>mst(e,nc(e));function yst(e,t){return Jf(e,n=>e.moveByGroup(n,t))}const Wcn=e=>yst(e,!nc(e)),Gcn=e=>yst(e,nc(e)),Zcn=e=>Jf(e,t=>gF(e.state,t,!nc(e))),Ycn=e=>Jf(e,t=>gF(e.state,t,nc(e)));function bst(e,t){return Jf(e,n=>e.moveVertically(n,t))}const xst=e=>bst(e,!1),wst=e=>bst(e,!0);function Sst(e,t){return Jf(e,n=>e.moveVertically(n,t,hst(e).height))}const Y_e=e=>Sst(e,!1),X_e=e=>Sst(e,!0),Xcn=e=>Jf(e,t=>Zb(e,t,!0)),Kcn=e=>Jf(e,t=>Zb(e,t,!1)),Jcn=e=>Jf(e,t=>Zb(e,t,!nc(e))),eun=e=>Jf(e,t=>Zb(e,t,nc(e))),tun=e=>Jf(e,t=>ot.cursor(e.lineBlockAt(t.head).from)),nun=e=>Jf(e,t=>ot.cursor(e.lineBlockAt(t.head).to)),K_e=({state:e,dispatch:t})=>(t(np(e,{anchor:0})),!0),J_e=({state:e,dispatch:t})=>(t(np(e,{anchor:e.doc.length})),!0),eEe=({state:e,dispatch:t})=>(t(np(e,{anchor:e.selection.main.anchor,head:0})),!0),tEe=({state:e,dispatch:t})=>(t(np(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),run=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),aun=({state:e,dispatch:t})=>{let n=vF(e).map(({from:r,to:a})=>ot.range(r,Math.min(a+1,e.doc.length)));return t(e.update({selection:ot.create(n),userEvent:"select"})),!0},sun=({state:e,dispatch:t})=>{let n=N_(e.selection,r=>{let a=ps(e),s=a.resolveStack(r.from,1);if(r.empty){let i=a.resolveStack(r.from,-1);i.node.from>=s.node.from&&i.node.to<=s.node.to&&(s=i)}for(let i=s;i;i=i.next){let{node:l}=i;if((l.from<r.from&&l.to>=r.to||l.to>r.to&&l.from<=r.from)&&i.next)return ot.range(l.to,l.from)}return r});return n.eq(e.selection)?!1:(t(np(e,n)),!0)};function Ost(e,t){let{state:n}=e,r=n.selection,a=n.selection.ranges.slice();for(let s of n.selection.ranges){let i=n.doc.lineAt(s.head);if(t?i.to<e.state.doc.length:i.from>0)for(let l=s;;){let c=e.moveVertically(l,t);if(c.head<i.from||c.head>i.to){a.some(u=>u.head==c.head)||a.push(c);break}else{if(c.head==l.head)break;l=c}}}return a.length==r.ranges.length?!1:(e.dispatch(np(n,ot.create(a,a.length-1))),!0)}const iun=e=>Ost(e,!1),oun=e=>Ost(e,!0),lun=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=ot.create([n.main]):n.main.empty||(r=ot.create([ot.cursor(n.main.head)])),r?(t(np(e,r)),!0):!1};function zI(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,a=r.changeByRange(s=>{let{from:i,to:l}=s;if(i==l){let c=t(s);c<i?(n="delete.backward",c=ZM(e,c,!1)):c>i&&(n="delete.forward",c=ZM(e,c,!0)),i=Math.min(i,c),l=Math.max(l,c)}else i=ZM(e,i,!1),l=ZM(e,l,!0);return i==l?{range:s}:{changes:{from:i,to:l},range:ot.cursor(i,i<s.head?-1:1)}});return a.changes.empty?!1:(e.dispatch(r.update(a,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?xt.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function ZM(e,t,n){if(e instanceof xt)for(let r of e.state.facet(xt.atomicRanges).map(a=>a(e)))r.between(t,t,(a,s)=>{a<t&&s>t&&(t=n?s:a)});return t}const kst=(e,t,n)=>zI(e,r=>{let a=r.from,{state:s}=e,i=s.doc.lineAt(a),l,c;if(n&&!t&&a>i.from&&a<i.from+200&&!/[^ \t]/.test(l=i.text.slice(0,a-i.from))){if(l[l.length-1]==" ")return a-1;let u=Vh(l,s.tabSize),d=u%sw(s)||sw(s);for(let f=0;f<d&&l[l.length-1-f]==" ";f++)a--;c=a}else c=Zo(i.text,a-i.from,t,t)+i.from,c==a&&i.number!=(t?s.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(i.text.slice(c-i.from,a-i.from))&&(c=Zo(i.text,c-i.from,!1,!1)+i.from);return c}),tre=e=>kst(e,!1,!0),_st=e=>kst(e,!0,!1),Est=(e,t)=>zI(e,n=>{let r=n.head,{state:a}=e,s=a.doc.lineAt(r),i=a.charCategorizer(r);for(let l=null;;){if(r==(t?s.to:s.from)){r==n.head&&s.number!=(t?a.doc.lines:1)&&(r+=t?1:-1);break}let c=Zo(s.text,r-s.from,t)+s.from,u=s.text.slice(Math.min(r,c)-s.from,Math.max(r,c)-s.from),d=i(u);if(l!=null&&d!=l)break;(u!=" "||r!=n.head)&&(l=d),r=c}return r}),Cst=e=>Est(e,!1),cun=e=>Est(e,!0),uun=e=>zI(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),dun=e=>zI(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),fun=e=>zI(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),hun=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Ca.of(["",""])},range:ot.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},pun=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let a=r.from,s=e.doc.lineAt(a),i=a==s.from?a-1:Zo(s.text,a-s.from,!1)+s.from,l=a==s.to?a+1:Zo(s.text,a-s.from,!0)+s.from;return{changes:{from:i,to:l,insert:e.doc.slice(a,l).append(e.doc.slice(i,a))},range:ot.cursor(l)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function vF(e){let t=[],n=-1;for(let r of e.selection.ranges){let a=e.doc.lineAt(r.from),s=e.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=e.doc.lineAt(r.to-1)),n>=a.number){let i=t[t.length-1];i.to=s.to,i.ranges.push(r)}else t.push({from:a.from,to:s.to,ranges:[r]});n=s.number+1}return t}function jst(e,t,n){if(e.readOnly)return!1;let r=[],a=[];for(let s of vF(e)){if(n?s.to==e.doc.length:s.from==0)continue;let i=e.doc.lineAt(n?s.to+1:s.from-1),l=i.length+1;if(n){r.push({from:s.to,to:i.to},{from:s.from,insert:i.text+e.lineBreak});for(let c of s.ranges)a.push(ot.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}else{r.push({from:i.from,to:s.from},{from:s.to,insert:e.lineBreak+i.text});for(let c of s.ranges)a.push(ot.range(c.anchor-l,c.head-l))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:ot.create(a,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const mun=({state:e,dispatch:t})=>jst(e,t,!1),gun=({state:e,dispatch:t})=>jst(e,t,!0);function Tst(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of vF(e))n?r.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak}):r.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)});let a=e.changes(r);return t(e.update({changes:a,selection:e.selection.map(a,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const vun=({state:e,dispatch:t})=>Tst(e,t,!1),yun=({state:e,dispatch:t})=>Tst(e,t,!0),bun=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(vF(t).map(({from:a,to:s})=>(a>0?a--:s<t.doc.length&&s++,{from:a,to:s}))),r=N_(t.selection,a=>{let s;if(e.lineWrapping){let i=e.lineBlockAt(a.head),l=e.coordsAtPos(a.head,a.assoc||1);l&&(s=i.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(a,!0,s)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function xun(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=ps(e).resolveInner(t),r=n.childBefore(t),a=n.childAfter(t),s;return r&&a&&r.to<=t&&a.from>=t&&(s=r.type.prop(lr.closedBy))&&s.indexOf(a.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(r.to,a.from))?{from:r.to,to:a.from}:null}const nEe=Nst(!1),wun=Nst(!0);function Nst(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(a=>{let{from:s,to:i}=a,l=t.doc.lineAt(s),c=!e&&s==i&&xun(t,s);e&&(s=i=(i<=l.to?l:t.doc.lineAt(i)).to);let u=new cF(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=ade(u,s);for(d==null&&(d=Vh(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));i<l.to&&/\s/.test(l.text[i-l.from]);)i++;c?{from:s,to:i}=c:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let f=["",bN(t,d)];return c&&f.push(bN(t,u.lineIndent(l.from,-1))),{changes:{from:s,to:i,insert:Ca.of(f)},range:ot.cursor(s+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function $de(e,t){let n=-1;return e.changeByRange(r=>{let a=[];for(let i=r.from;i<=r.to;){let l=e.doc.lineAt(i);l.number>n&&(r.empty||r.to>l.from)&&(t(l,a,r),n=l.number),i=l.to+1}let s=e.changes(a);return{changes:a,range:ot.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const Sun=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new cF(e,{overrideIndentation:s=>{let i=n[s];return i??-1}}),a=$de(e,(s,i,l)=>{let c=ade(r,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=bN(e,c);(u!=d||l.from<s.from+u.length)&&(n[s.from]=c,i.push({from:s.from,to:s.from+u.length,insert:d}))});return a.changes.empty||t(e.update(a,{userEvent:"indent"})),!0},Ast=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update($de(e,(n,r)=>{r.push({from:n.from,insert:e.facet(j_)})}),{userEvent:"input.indent"})),!0),Ist=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update($de(e,(n,r)=>{let a=/^\s*/.exec(n.text)[0];if(!a)return;let s=Vh(a,e.tabSize),i=0,l=bN(e,Math.max(0,s-sw(e)));for(;i<a.length&&i<l.length&&a.charCodeAt(i)==l.charCodeAt(i);)i++;r.push({from:n.from+i,to:n.from+a.length,insert:l.slice(i)})}),{userEvent:"delete.dedent"})),!0),Oun=e=>(e.setTabFocusMode(),!0),kun=[{key:"Ctrl-b",run:ost,shift:gst,preventDefault:!0},{key:"Ctrl-f",run:lst,shift:vst},{key:"Ctrl-p",run:dst,shift:xst},{key:"Ctrl-n",run:fst,shift:wst},{key:"Ctrl-a",run:qcn,shift:tun},{key:"Ctrl-e",run:Vcn,shift:nun},{key:"Ctrl-d",run:_st},{key:"Ctrl-h",run:tre},{key:"Ctrl-k",run:uun},{key:"Ctrl-Alt-h",run:Cst},{key:"Ctrl-o",run:hun},{key:"Ctrl-t",run:pun},{key:"Ctrl-v",run:ere}],_un=[{key:"ArrowLeft",run:ost,shift:gst,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Pcn,shift:Wcn,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Bcn,shift:Jcn,preventDefault:!0},{key:"ArrowRight",run:lst,shift:vst,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Mcn,shift:Gcn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Ucn,shift:eun,preventDefault:!0},{key:"ArrowUp",run:dst,shift:xst,preventDefault:!0},{mac:"Cmd-ArrowUp",run:K_e,shift:eEe},{mac:"Ctrl-ArrowUp",run:Z_e,shift:Y_e},{key:"ArrowDown",run:fst,shift:wst,preventDefault:!0},{mac:"Cmd-ArrowDown",run:J_e,shift:tEe},{mac:"Ctrl-ArrowDown",run:ere,shift:X_e},{key:"PageUp",run:Z_e,shift:Y_e},{key:"PageDown",run:ere,shift:X_e},{key:"Home",run:zcn,shift:Kcn,preventDefault:!0},{key:"Mod-Home",run:K_e,shift:eEe},{key:"End",run:Fcn,shift:Xcn,preventDefault:!0},{key:"Mod-End",run:J_e,shift:tEe},{key:"Enter",run:nEe,shift:nEe},{key:"Mod-a",run},{key:"Backspace",run:tre,shift:tre,preventDefault:!0},{key:"Delete",run:_st,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Cst,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:cun,preventDefault:!0},{mac:"Mod-Backspace",run:dun,preventDefault:!0},{mac:"Mod-Delete",run:fun,preventDefault:!0}].concat(kun.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Eun=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:$cn,shift:Zcn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Lcn,shift:Ycn},{key:"Alt-ArrowUp",run:mun},{key:"Shift-Alt-ArrowUp",run:vun},{key:"Alt-ArrowDown",run:gun},{key:"Shift-Alt-ArrowDown",run:yun},{key:"Mod-Alt-ArrowUp",run:iun},{key:"Mod-Alt-ArrowDown",run:oun},{key:"Escape",run:lun},{key:"Mod-Enter",run:wun},{key:"Alt-l",mac:"Ctrl-l",run:aun},{key:"Mod-i",run:sun,preventDefault:!0},{key:"Mod-[",run:Ist},{key:"Mod-]",run:Ast},{key:"Mod-Alt-\\",run:Sun},{key:"Shift-Mod-k",run:bun},{key:"Shift-Mod-\\",run:Qcn},{key:"Mod-/",run:mcn},{key:"Alt-A",run:vcn},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Oun}].concat(_un),Cun={key:"Tab",run:Ast,shift:Ist},rEe=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class bk{constructor(t,n,r=0,a=t.length,s,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(r,a),this.bufferStart=r,this.normalize=s?l=>s(rEe(l)):rEe,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return tu(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=zue(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=Bp(t);let a=this.normalize(n);if(a.length)for(let s=0,i=r;;s++){let l=a.charCodeAt(s),c=this.match(l,i,this.bufferPos+this.bufferStart);if(s==a.length-1){if(c)return this.value=c,this;break}i==r&&s<n.length&&n.charCodeAt(s)==l&&i++}}}match(t,n,r){let a=null;for(let s=0;s<this.matches.length;s+=2){let i=this.matches[s],l=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?a={from:this.matches[s+1],to:r}:(this.matches[s]++,l=!0)),l||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?a={from:n,to:r}:this.matches.push(1,n)),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}}typeof Symbol<"u"&&(bk.prototype[Symbol.iterator]=function(){return this});const Rst={from:-1,to:-1,match:/.*/.exec("")},Lde="gm"+(/x/.unicode==null?"":"u");class Pst{constructor(t,n,r,a=0,s=t.length){if(this.text=t,this.to=s,this.curLine="",this.done=!1,this.value=Rst,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Mst(t,n,r,a,s);this.re=new RegExp(n,Lde+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=t.iter();let i=t.lineAt(a);this.curLineStart=i.from,this.matchPos=LL(t,a),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,a=r+n[0].length;if(this.matchPos=LL(this.text,a+(r==a?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<a||r>this.value.to)&&(!this.test||this.test(r,a,n)))return this.value={from:r,to:a,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const MU=new WeakMap;class xO{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let a=MU.get(t);if(!a||a.from>=r||a.to<=n){let l=new xO(n,t.sliceString(n,r));return MU.set(t,l),l}if(a.from==n&&a.to==r)return a;let{text:s,from:i}=a;return i>n&&(s=t.sliceString(n,i)+s,i=n),a.to<r&&(s+=t.sliceString(a.to,r)),MU.set(t,new xO(i,s)),new xO(n,s.slice(n-i,r-i))}}class Mst{constructor(t,n,r,a,s){this.text=t,this.to=s,this.done=!1,this.value=Rst,this.matchPos=LL(t,a),this.re=new RegExp(n,Lde+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=xO.get(t,a,this.chunkEnd(a+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,a=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,a,n)))return this.value={from:r,to:a,match:n},this.matchPos=LL(this.text,a+(r==a?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=xO.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Pst.prototype[Symbol.iterator]=Mst.prototype[Symbol.iterator]=function(){return this});function jun(e){try{return new RegExp(e,Lde),!0}catch{return!1}}function LL(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}function nre(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),n=ys("input",{class:"cm-textfield",name:"line",value:t}),r=ys("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),e.dispatch({effects:nT.of(!1)}),e.focus()):s.keyCode==13&&(s.preventDefault(),a())},onsubmit:s=>{s.preventDefault(),a()}},ys("label",e.state.phrase("Go to line"),": ",n)," ",ys("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),ys("button",{name:"close",onclick:()=>{e.dispatch({effects:nT.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]));function a(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!s)return;let{state:i}=e,l=i.doc.lineAt(i.selection.main.head),[,c,u,d,f]=s,h=d?+d.slice(1):0,p=u?+u:l.number;if(u&&f){let v=p/100;c&&(v=v*(c=="-"?-1:1)+l.number/i.doc.lines),p=Math.round(i.doc.lines*v)}else u&&c&&(p=p*(c=="-"?-1:1)+l.number);let m=i.doc.line(Math.max(1,Math.min(i.doc.lines,p))),g=ot.cursor(m.from+Math.max(0,Math.min(h,m.length)));e.dispatch({effects:[nT.of(!1),xt.scrollIntoView(g.from,{y:"center"})],selection:g}),e.focus()}return{dom:r}}const nT=er.define(),aEe=vo.define({create(){return!0},update(e,t){for(let n of t.effects)n.is(nT)&&(e=n.value);return e},provide:e=>yN.from(e,t=>t?nre:null)}),Tun=e=>{let t=vN(e,nre);if(!t){let n=[nT.of(!0)];e.state.field(aEe,!1)==null&&n.push(er.appendConfig.of([aEe,Nun])),e.dispatch({effects:n}),t=vN(e,nre)}return t&&t.dom.querySelector("input").select(),!0},Nun=xt.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Aun={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Iun=Jt.define({combine(e){return Dm(e,Aun,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Run(e){return[Lun,$un]}const Pun=on.mark({class:"cm-selectionMatch"}),Mun=on.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function sEe(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=ri.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=ri.Word)}function Dun(e,t,n,r){return e(t.sliceDoc(n,n+1))==ri.Word&&e(t.sliceDoc(r-1,r))==ri.Word}const $un=ii.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Iun),{state:n}=e,r=n.selection;if(r.ranges.length>1)return on.none;let a=r.main,s,i=null;if(a.empty){if(!t.highlightWordAroundCursor)return on.none;let c=n.wordAt(a.head);if(!c)return on.none;i=n.charCategorizer(a.head),s=n.sliceDoc(c.from,c.to)}else{let c=a.to-a.from;if(c<t.minSelectionLength||c>200)return on.none;if(t.wholeWords){if(s=n.sliceDoc(a.from,a.to),i=n.charCategorizer(a.head),!(sEe(i,n,a.from,a.to)&&Dun(i,n,a.from,a.to)))return on.none}else if(s=n.sliceDoc(a.from,a.to),!s)return on.none}let l=[];for(let c of e.visibleRanges){let u=new bk(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||sEe(i,n,d,f))&&(a.empty&&d<=a.from&&f>=a.to?l.push(Mun.range(d,f)):(d>=a.to||f<=a.from)&&l.push(Pun.range(d,f)),l.length>t.maxMatches))return on.none}}return on.set(l)}},{decorations:e=>e.decorations}),Lun=xt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Fun=({state:e,dispatch:t})=>{let{selection:n}=e,r=ot.create(n.ranges.map(a=>e.wordAt(a.head)||ot.cursor(a.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function zun(e,t){let{main:n,ranges:r}=e.selection,a=e.wordAt(n.head),s=a&&a.from==n.from&&a.to==n.to;for(let i=!1,l=new bk(e.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(i)return null;l=new bk(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),i=!0}else{if(i&&r.some(c=>c.from==l.value.from))continue;if(s){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const Bun=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return Fun({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(s=>e.sliceDoc(s.from,s.to)!=r))return!1;let a=zun(e,r);return a?(t(e.update({selection:e.selection.addRange(ot.range(a.from,a.to),!1),effects:xt.scrollIntoView(a.to)})),!0):!1},A_=Jt.define({combine(e){return Dm(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Jun(t),scrollToMatch:t=>xt.scrollIntoView(t)})}});class Dst{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||jun(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
215
|
+
}`,{label:"class",detail:"definition",type:"keyword"}),Yc('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Yc('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],xat=Ede.concat([Yc("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Yc("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Yc("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),B_e=new Ott,wat=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function dC(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const zln=["FunctionDeclaration"],Bln={FunctionDeclaration:dC("function"),ClassDeclaration:dC("class"),ClassExpression:()=>!0,EnumDeclaration:dC("constant"),TypeAliasDeclaration:dC("type"),NamespaceDeclaration:dC("namespace"),VariableDefinition(e,t){e.matchContext(zln)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function Sat(e,t){let n=B_e.get(t);if(n)return n;let r=[],a=!0;function s(i,l){let c=e.sliceString(i.from,i.to);r.push({label:c,type:l})}return t.cursor(Ua.IncludeAnonymous).iterate(i=>{if(a)a=!1;else if(i.name){let l=Bln[i.name];if(l&&l(i,s)||wat.has(i.name))return!1}else if(i.to-i.from>8192){for(let l of Sat(e,i.node))r.push(l);return!1}}),B_e.set(t,r),r}const ML=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Cde=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Oat(e){let t=ps(e.state).resolveInner(e.pos,-1);if(Cde.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&ML.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let a=t;a;a=a.parent)wat.has(a.name)&&(r=r.concat(Sat(e.state.doc,a)));return{options:r,from:n?t.from:e.pos,validFor:ML}}function CU(e,t,n){var r;let a=[];for(;;){let s=t.firstChild,i;if(s?.name=="VariableName")return a.push(e(s)),{path:a.reverse(),name:n};if(s?.name=="MemberExpression"&&((r=i=s.lastChild)===null||r===void 0?void 0:r.name)=="PropertyName")a.push(e(i)),t=s;else return null}}function kat(e){let t=r=>e.state.doc.sliceString(r.from,r.to),n=ps(e.state).resolveInner(e.pos,-1);return n.name=="PropertyName"?CU(t,n.parent,t(n)):(n.name=="."||n.name=="?.")&&n.parent.name=="MemberExpression"?CU(t,n.parent,""):Cde.indexOf(n.name)>-1?null:n.name=="VariableName"||n.to-n.from<20&&ML.test(t(n))?{path:[],name:t(n)}:n.name=="MemberExpression"?CU(t,n,""):e.explicit?{path:[],name:""}:null}function Uln(e,t){let n=e,r=[],a=new Set;for(let s=0;;s++){for(let l of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(l)||a.has(l))continue;a.add(l);let c;try{c=n[l]}catch{continue}r.push({label:l,type:typeof c=="function"?/^[A-Z]/.test(l)?"class":t?"function":"method":t?"variable":"property",boost:-s})}let i=Object.getPrototypeOf(e);if(!i)return r;e=i}}function qln(e){let t=new Map;return n=>{let r=kat(n);if(!r)return null;let a=e;for(let i of r.path)if(a=a[i],!a)return null;let s=t.get(a);return s||t.set(a,s=Uln(a,!r.path.length)),{from:n.pos-r.name.length,options:s,validFor:ML}}}const Lf=nw.define({name:"javascript",parser:Fln.configure({props:[Xw.add({IfStatement:yO({except:/^\s*({|else\b)/}),TryStatement:yO({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Fan,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:Lan({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":yO({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Kw.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":ide,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let n=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,r=e.lastChild;return!n||n.type.isError?null:{from:n.to,to:r.type.isError?e.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),_at={test:e=>/^JSX/.test(e.name),facet:lF({commentTokens:{block:{open:"{/*",close:"*/}"}}})},jde=Lf.configure({dialect:"ts"},"typescript"),Tde=Lf.configure({dialect:"jsx",props:[rde.add(e=>e.isTop?[_at]:void 0)]}),Nde=Lf.configure({dialect:"jsx ts",props:[rde.add(e=>e.isTop?[_at]:void 0)]},"typescript");let Eat=e=>({label:e,type:"keyword"});const Cat="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Eat),Vln=Cat.concat(["declare","implements","private","protected","public"].map(Eat));function DL(e={}){let t=e.jsx?e.typescript?Nde:Tde:e.typescript?jde:Lf,n=e.typescript?xat.concat(Vln):Ede.concat(Cat);return new aw(t,[Lf.data.of({autocomplete:ksn(Cde,Srt(n))}),Lf.data.of({autocomplete:Oat}),e.jsx?jat:[]])}function Hln(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function U_e(e,t,n=e.length){for(let r=t?.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return e.sliceString(r.from,Math.min(r.to,n));return""}const Qln=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),jat=xt.inputHandler.of((e,t,n,r,a)=>{if((Qln?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Lf.isActiveAt(e.state,t,-1))return!1;let s=a(),{state:i}=s,l=i.changeByRange(c=>{var u;let{head:d}=c,f=ps(i).resolveInner(d-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(i.doc.sliceString(d-1,d)!=r||f.name=="JSXAttributeValue"&&f.to>d)){if(r==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(r=="/"&&f.name=="JSXStartCloseTag"){let p=f.parent,m=p.parent;if(m&&p.from==d-2&&((h=U_e(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${h}>`;return{range:ot.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(r==">"){let p=Hln(f);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(h=U_e(i.doc,p,d)))return{range:c,changes:{from:d,insert:`</${h}>`}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function Wln(e,t){return t||(t={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:!0,node:!0,es6:!0,es2015:!0,es2017:!0,es2020:!0},rules:{}},e.getRules().forEach((n,r)=>{var a;!((a=n.meta.docs)===null||a===void 0)&&a.recommended&&(t.rules[r]=2)})),n=>{let{state:r}=n,a=[];for(let{from:s,to:i}of Lf.findRegions(r)){let l=r.doc.lineAt(s),c={line:l.number-1,col:s-l.from,pos:s};for(let u of e.verify(r.sliceDoc(s,i),t))a.push(Gln(u,r.doc,c))}return a}}function q_e(e,t,n,r){return n.line(e+r.line).from+t+(e==1?r.col-1:-1)}function Gln(e,t,n){let r=q_e(e.line,e.column,t,n),a={from:r,to:e.endLine!=null&&e.endColumn!=1?q_e(e.endLine,e.endColumn,t,n):r,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:e.severity==1?"warning":"error"};if(e.fix){let{range:s,text:i}=e.fix,l=s[0]+n.pos-r,c=s[1]+n.pos-r;a.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+l,to:d+c,insert:i},scrollIntoView:!0})}}]}return a}const GM=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:jat,completionPath:kat,esLint:Wln,javascript:DL,javascriptLanguage:Lf,jsxLanguage:Tde,localCompletionSource:Oat,scopeCompletionSource:qln,snippets:Ede,tsxLanguage:Nde,typescriptLanguage:jde,typescriptSnippets:xat},Symbol.toStringTag,{value:"Module"})),fC=["_blank","_self","_top","_parent"],jU=["ascii","utf-8","utf-16","latin1","latin1"],TU=["get","post","put","delete"],NU=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Zu=["true","false"],Pn={},Zln={a:{attrs:{href:null,ping:null,type:null,media:null,target:fC,hreflang:null}},abbr:Pn,address:Pn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Pn,aside:Pn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Pn,base:{attrs:{href:null,target:fC}},bdi:Pn,bdo:Pn,blockquote:{attrs:{cite:null}},body:Pn,br:Pn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:NU,formmethod:TU,formnovalidate:["novalidate"],formtarget:fC,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Pn,center:Pn,cite:Pn,code:Pn,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Pn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Pn,div:Pn,dl:Pn,dt:Pn,em:Pn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Pn,figure:Pn,footer:Pn,form:{attrs:{action:null,name:null,"accept-charset":jU,autocomplete:["on","off"],enctype:NU,method:TU,novalidate:["novalidate"],target:fC}},h1:Pn,h2:Pn,h3:Pn,h4:Pn,h5:Pn,h6:Pn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Pn,hgroup:Pn,hr:Pn,html:{attrs:{manifest:null}},i:Pn,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:NU,formmethod:TU,formnovalidate:["novalidate"],formtarget:fC,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Pn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Pn,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Pn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:jU,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Pn,noscript:Pn,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Pn,param:{attrs:{name:null,value:null}},pre:Pn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Pn,rt:Pn,ruby:Pn,samp:Pn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:jU}},section:Pn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Pn,source:{attrs:{src:null,type:null,media:null}},span:Pn,strong:Pn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Pn,summary:Pn,sup:Pn,table:Pn,tbody:Pn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Pn,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Pn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Pn,time:{attrs:{datetime:null}},title:Pn,tr:Pn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Pn,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Pn},Tat={accesskey:null,class:null,contenteditable:Zu,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Zu,autocorrect:Zu,autocapitalize:Zu,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Zu,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Zu,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Zu,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Zu,"aria-hidden":Zu,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Zu,"aria-multiselectable":Zu,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Zu,"aria-relevant":null,"aria-required":Zu,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Nat="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of Nat)Tat[e]=null;let jN=class{constructor(t,n){this.tags={...Zln,...t},this.globalAttrs={...Tat,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};jN.default=new jN;function vk(e,t,n=e.length){if(!t)return"";let r=t.firstChild,a=r&&r.getChild("TagName");return a?e.sliceString(a.from,Math.min(a.to,n)):""}function yk(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function Aat(e,t,n){let r=n.tags[vk(e,yk(t))];return r?.children||n.allTags}function Ade(e,t){let n=[];for(let r=yk(t);r&&!r.type.isTop;r=yk(r.parent)){let a=vk(e,r);if(a&&r.lastChild.name=="CloseTag")break;a&&n.indexOf(a)<0&&(t.name=="EndTag"||t.from>=r.firstChild.to)&&n.push(a)}return n}const Iat=/^[:\-\.\w\u00b7-\uffff]*$/;function V_e(e,t,n,r,a){let s=/\s*>/.test(e.sliceDoc(a,a+5))?"":">",i=yk(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:a,options:Aat(e.doc,i,t).map(l=>({label:l,type:"type"})).concat(Ade(e.doc,n).map((l,c)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function H_e(e,t,n,r){let a=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:Ade(e.doc,t).map((s,i)=>({label:s,apply:s+a,type:"type",boost:99-i})),validFor:Iat}}function Yln(e,t,n,r){let a=[],s=0;for(let i of Aat(e.doc,n,t))a.push({label:"<"+i,type:"type"});for(let i of Ade(e.doc,n))a.push({label:"</"+i+">",type:"type",boost:99-s++});return{from:r,to:r,options:a,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Xln(e,t,n,r,a){let s=yk(n),i=s?t.tags[vk(e.doc,s)]:null,l=i&&i.attrs?Object.keys(i.attrs):[],c=i&&i.globalAttrs===!1?l:l.length?l.concat(t.globalAttrNames):t.globalAttrNames;return{from:r,to:a,options:c.map(u=>({label:u,type:"property"})),validFor:Iat}}function Kln(e,t,n,r,a){var s;let i=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],c;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let f=yk(n),h=f?t.tags[vk(e.doc,f)]:null;d=h?.attrs&&h.attrs[u]}if(d){let f=e.sliceDoc(r,a).toLowerCase(),h='"',p='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",p=e.sliceDoc(a,a+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let m of d)l.push({label:m,apply:h+m+p,type:"constant"})}}return{from:r,to:a,options:l,validFor:c}}function Rat(e,t){let{state:n,pos:r}=t,a=ps(n).resolveInner(r,-1),s=a.resolve(r);for(let i=r,l;s==a&&(l=a.childBefore(i));){let c=l.lastChild;if(!c||!c.type.isError||c.from<c.to)break;s=a=l,i=c.from}return a.name=="TagName"?a.parent&&/CloseTag$/.test(a.parent.name)?H_e(n,a,a.from,r):V_e(n,e,a,a.from,r):a.name=="StartTag"||a.name=="IncompleteTag"?V_e(n,e,a,r,r):a.name=="StartCloseTag"||a.name=="IncompleteCloseTag"?H_e(n,a,r,r):a.name=="OpenTag"||a.name=="SelfClosingTag"||a.name=="AttributeName"?Xln(n,e,a,a.name=="AttributeName"?a.from:r,r):a.name=="Is"||a.name=="AttributeValue"||a.name=="UnquotedAttributeValue"?Kln(n,e,a,a.name=="Is"?r:a.from,r):t.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?Yln(n,e,a,r):null}function Pat(e){return Rat(jN.default,e)}function Mat(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new jN(t,n):jN.default;return a=>Rat(r,a)}const Jln=Lf.parser.configure({top:"SingleExpression"}),Dat=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:jde.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:Tde.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:Nde.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:Jln},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Lf.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:CN.parser}],$at=[{name:"style",parser:CN.parser.configure({top:"Styles"})}].concat(Nat.map(e=>({name:e,parser:Lf.parser}))),Lat=nw.define({name:"html",parser:jon.configure({props:[Xw.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let r=e.node;;){let a=r.lastChild;if(!a||a.name!="Element"||a.to!=r.to)break;t=r=a}return t&&!((n=t.lastChild)&&(n.name=="CloseTag"||n.name=="SelfClosingTag"))?e.lineIndent(t.from)+e.unit:null}}),Kw.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!="OpenTag"?null:{from:t.to,to:n.name=="CloseTag"?n.from:e.to}}}),mrt.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),tT=Lat.configure({wrap:uat(Dat,$at)});function Fat(e={}){let t="",n;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=uat((e.nestedLanguages||[]).concat(Dat),(e.nestedAttributes||[]).concat($at)));let r=n?Lat.configure({wrap:n,dialect:t}):t?tT.configure({dialect:t}):tT;return new aw(r,[tT.data.of({autocomplete:Mat(e)}),e.autoCloseTags!==!1?zat:[],DL().support,yat().support])}const Q_e=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),zat=xt.inputHandler.of((e,t,n,r,a)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!tT.isActiveAt(e.state,t,-1))return!1;let s=a(),{state:i}=s,l=i.changeByRange(c=>{var u,d,f;let h=i.doc.sliceString(c.from-1,c.to)==r,{head:p}=c,m=ps(i).resolveInner(p,-1),g;if(h&&r==">"&&m.name=="EndTag"){let v=m.parent;if(((d=(u=v.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=vk(i.doc,v.parent,p))&&!Q_e.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`</${g}>`;return{range:c,changes:{from:p,to:x,insert:w}}}}else if(h&&r=="/"&&m.name=="IncompleteCloseTag"){let v=m.parent;if(m.from==p-2&&((f=v.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=vk(i.doc,v,p))&&!Q_e.has(g)){let x=p+(i.doc.sliceString(p,p+1)===">"?1:0),w=`${g}>`;return{range:ot.cursor(p+w.length,-1),changes:{from:p,to:x,insert:w}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,i.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),ecn=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:zat,html:Fat,htmlCompletionSource:Pat,htmlCompletionSourceWith:Mat,htmlLanguage:tT},Symbol.toStringTag,{value:"Module"})),Bat=lF({commentTokens:{block:{open:"<!--",close:"-->"}}}),Uat=new lr,qat=Nin.configure({props:[Kw.add(e=>!e.is("Block")||e.is("Document")||Xne(e)!=null||tcn(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),Uat.add(Xne),Xw.add({Document:()=>null}),Hy.add({Document:Bat})]});function Xne(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function tcn(e){return e.name=="OrderedList"||e.name=="BulletList"}function ncn(e,t){let n=e;for(;;){let r=n.nextSibling,a;if(!r||(a=Xne(r.type))!=null&&a<=t)break;n=r}return n.to}const rcn=rrt.of((e,t,n)=>{for(let r=ps(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let a=r.type.prop(Uat);if(a==null)continue;let s=ncn(r,a);if(s>n)return{from:n,to:s}}return null});function Ide(e){return new hd(Bat,e,[],"markdown")}const Vat=Ide(qat),acn=qat.configure([Bin,qin,Uin,Vin,{props:[Kw.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),ow=Ide(acn);function scn(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=Ke.matchLanguageName(e,n,!0),r instanceof Ke)return r.support?r.support.language.parser:rw.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}class AU{constructor(t,n,r,a,s,i,l){this.node=t,this.from=n,this.to=r,this.spaceBefore=a,this.spaceAfter=s,this.type=i,this.item=l}blank(t,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;r.length<t;)r+=" ";return r}else{for(let a=this.to-this.from-r.length-this.spaceAfter.length;a>0;a--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(t,n){let r=this.node.name=="OrderedList"?String(+Qat(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function Hat(e,t){let n=[],r=[];for(let a=e;a;a=a.parent){if(a.name=="FencedCode")return r;(a.name=="ListItem"||a.name=="Blockquote")&&n.push(a)}for(let a=n.length-1;a>=0;a--){let s=n[a],i,l=t.lineAt(s.from),c=s.from-l.from;if(s.name=="Blockquote"&&(i=/^ *>( ?)/.exec(l.text.slice(c))))r.push(new AU(s,c,c+i[0].length,"",i[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=i[3],d=i[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),r.push(new AU(s.parent,c,c+d,i[1],u,i[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(i=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=i[4],d=i[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=i[2];i[3]&&(f+=i[3].replace(/[xX]/," ")),r.push(new AU(s.parent,c,c+d,i[1],u,f,s))}}return r}function Qat(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function IU(e,t,n,r=0){for(let a=-1,s=e;;){if(s.name=="ListItem"){let l=Qat(s,t),c=+l[2];if(a>=0){if(c!=a+1)return;n.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(a+2+r)})}a=c}let i=s.nextSibling;if(!i)break;s=i}}function Rde(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(j_)!=" ")return e;let r=Vh(e,4,n),a="";for(let s=r;s>0;)s>=4?(a+=" ",s-=4):(a+=" ",s--);return a+e.slice(n)}const Wat=(e={})=>({state:t,dispatch:n})=>{let r=ps(t),{doc:a}=t,s=null,i=t.changeByRange(l=>{if(!l.empty||!ow.isActiveAt(t,l.from,-1)&&!ow.isActiveAt(t,l.from,1))return s={range:l};let c=l.from,u=a.lineAt(c),d=Hat(r.resolveInner(c,-1),a);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return s={range:l};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return s={range:l};let h=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&h){let x=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(x.to>=c||w&&w.to<c||u.from>0&&!/[^\s>]/.test(a.lineAt(u.from-1).text)||e.nonTightLists===!1){let O=d.length>1?d[d.length-2]:null,k,_="";O&&O.item?(k=u.from+O.from,_=O.marker(a,1)):k=u.from+(O?O.to:0);let C=[{from:k,to:c,insert:_}];return f.node.name=="OrderedList"&&IU(f.item,a,C,-2),O&&O.node.name=="OrderedList"&&IU(O.item,a,C),{range:ot.cursor(k+_.length),changes:C}}else{let O=G_e(d,t,u);return{range:ot.cursor(c+O.length+1),changes:{from:u.from,insert:O+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let x=a.lineAt(u.from-1),w=/>\s*$/.exec(x.text);if(w&&w.index==f.from){let O=t.changes([{from:x.from+w.index,to:x.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(O),changes:O}}}let p=[];f.node.name=="OrderedList"&&IU(f.item,a,p);let m=f.item&&f.item.from<u.from,g="";if(!m||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=f.to)for(let x=0,w=d.length-1;x<=w;x++)g+=x==w&&!m?d[x].marker(a,1):d[x].blank(x<w?Vh(u.text,4,d[x+1].from)-g.length:null);let v=c;for(;v>u.from&&/\s/.test(u.text.charAt(v-u.from-1));)v--;return g=Rde(g,t),icn(f.node,t.doc)&&(g=G_e(d,t,u)+t.lineBreak+g),p.push({from:v,to:c,insert:t.lineBreak+g}),{range:ot.cursor(v+g.length+1),changes:p}});return s?!1:(n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},Gat=Wat();function W_e(e){return e.name=="QuoteMark"||e.name=="ListMark"}function icn(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let n=e.firstChild,r=e.getChild("ListItem","ListItem");if(!r)return!1;let a=t.lineAt(n.to),s=t.lineAt(r.from),i=/^[\s>]*$/.test(a.text);return a.number+(i?0:1)<s.number}function G_e(e,t,n){let r="";for(let a=0,s=e.length-2;a<=s;a++)r+=e[a].blank(a<s?Vh(n.text,4,e[a+1].from)-r.length:null,a<s);return Rde(r,t)}function ocn(e,t){let n=e.resolveInner(t,-1),r=t;W_e(n)&&(r=n.from,n=n.parent);for(let a;a=n.childBefore(r);)if(W_e(a))r=a.from;else if(a.name=="OrderedList"||a.name=="BulletList")n=a.lastChild,r=n.to;else break;return n}const Zat=({state:e,dispatch:t})=>{let n=ps(e),r=null,a=e.changeByRange(s=>{let i=s.from,{doc:l}=e;if(s.empty&&ow.isActiveAt(e,s.from)){let c=l.lineAt(i),u=Hat(ocn(n,i),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(i-c.from>f&&!/\S/.test(c.text.slice(f,i-c.from)))return{range:ot.cursor(c.from+f),changes:{from:c.from+f,to:i}};if(i-c.from==f&&(!d.item||c.from<=d.item.from||!/\S/.test(c.text.slice(0,d.to)))){let h=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let p=d.blank(Vh(c.text,4,d.to)-Vh(c.text,4,d.from));return h==c.from&&(p=Rde(p,e)),{range:ot.cursor(h+p.length),changes:{from:h,to:c.from+d.to,insert:p}}}if(h<i)return{range:ot.cursor(h),changes:{from:h,to:i}}}}}return r={range:s}});return r?!1:(t(e.update(a,{scrollIntoView:!0,userEvent:"delete"})),!0)},Yat=[{key:"Enter",run:Gat},{key:"Backspace",run:Zat}],Xat=Fat({matchClosingTags:!1});function Pde(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:a}=Vat,completeHTMLTags:s=!0,pasteURLAsLink:i=!0,htmlTagLanguage:l=Xat}=e;if(!(a instanceof hF))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[l.support,rcn],d;i&&u.push(Kat),n instanceof aw?(u.push(n.support),d=n.language):n&&(d=n);let f=t||d?scn(t,d):void 0;c.push(Iin({codeParser:f,htmlParser:l.language.parser})),r&&u.push(tp.high(C_.of(Yat)));let h=Ide(a.configure(c));return s&&u.push(h.data.of({autocomplete:lcn})),new aw(h,u)}function lcn(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let a=ps(t).resolveInner(n,-1);for(;a&&!a.type.isTop;){if(a.name=="CodeBlock"||a.name=="FencedCode"||a.name=="ProcessingInstructionBlock"||a.name=="CommentBlock"||a.name=="Link"||a.name=="Image")return null;a=a.parent}return{from:n-r[0].length,to:n,options:ccn(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let RU=null;function ccn(){if(RU)return RU;let e=Pat(new ude(Ir.create({extensions:Xat}),0,!0));return RU=e?e.options:[]}const ucn=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Kat=xt.domEventHandlers({paste:(e,t)=>{var n;let{main:r}=t.state.selection;if(r.empty)return!1;let a=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!a||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(a)||(/^www\./.test(a)&&(a="https://"+a),!ow.isActiveAt(t.state,r.from,1)))return!1;let s=ps(t.state),i=!1;return s.iterate({from:r.from,to:r.to,enter:l=>{(l.from>r.from||ucn.test(l.name))&&(i=!0)},leave:l=>{l.to<r.to&&(i=!0)}}),i?!1:(t.dispatch({changes:[{from:r.from,insert:"["},{from:r.to,insert:`](${a})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}}),dcn=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:Vat,deleteMarkupBackward:Zat,insertNewlineContinueMarkup:Gat,insertNewlineContinueMarkupCommand:Wat,markdown:Pde,markdownKeymap:Yat,markdownLanguage:ow,pasteURLAsLink:Kat},Symbol.toStringTag,{value:"Module"}));function gt(e){return new aw(ode.define(e))}function my(e){return nt(()=>import("./index-DhP3NFK_.js"),__vite__mapDeps([4,2]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const Jat=[Ke.of({name:"C",extensions:["c","h","ino"],load(){return nt(()=>import("./index-BFfBKqFP.js"),__vite__mapDeps([5,2]),import.meta.url).then(e=>e.cpp())}}),Ke.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return nt(()=>import("./index-BFfBKqFP.js"),__vite__mapDeps([5,2]),import.meta.url).then(e=>e.cpp())}}),Ke.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return my("Cassandra")}}),Ke.of({name:"CSS",extensions:["css"],load(){return nt(()=>Promise.resolve().then(()=>lln),void 0,import.meta.url).then(e=>e.css())}}),Ke.of({name:"Go",extensions:["go"],load(){return nt(()=>import("./index-B9ojti2l.js"),__vite__mapDeps([6,2]),import.meta.url).then(e=>e.go())}}),Ke.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return nt(()=>Promise.resolve().then(()=>ecn),void 0,import.meta.url).then(e=>e.html())}}),Ke.of({name:"Java",extensions:["java"],load(){return nt(()=>import("./index-04Ga1pOq.js"),__vite__mapDeps([7,2]),import.meta.url).then(e=>e.java())}}),Ke.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return nt(()=>Promise.resolve().then(()=>GM),void 0,import.meta.url).then(e=>e.javascript())}}),Ke.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return nt(()=>import("./index-Ywo4_gGm.js"),__vite__mapDeps([8,2]),import.meta.url).then(e=>e.jinja())}}),Ke.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return nt(()=>Promise.resolve().then(()=>Ssn),void 0,import.meta.url).then(e=>e.json())}}),Ke.of({name:"JSX",extensions:["jsx"],load(){return nt(()=>Promise.resolve().then(()=>GM),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ke.of({name:"LESS",extensions:["less"],load(){return nt(()=>import("./index-BzQgA4o5.js"),__vite__mapDeps([9,2]),import.meta.url).then(e=>e.less())}}),Ke.of({name:"Liquid",extensions:["liquid"],load(){return nt(()=>import("./index--M_-_-M3.js"),__vite__mapDeps([10,2]),import.meta.url).then(e=>e.liquid())}}),Ke.of({name:"MariaDB SQL",load(){return my("MariaSQL")}}),Ke.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return nt(()=>Promise.resolve().then(()=>dcn),void 0,import.meta.url).then(e=>e.markdown())}}),Ke.of({name:"MS SQL",load(){return my("MSSQL")}}),Ke.of({name:"MySQL",load(){return my("MySQL")}}),Ke.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return nt(()=>import("./index-DJ5VARKf.js"),__vite__mapDeps([11,2]),import.meta.url).then(e=>e.php())}}),Ke.of({name:"PLSQL",extensions:["pls"],load(){return my("PLSQL")}}),Ke.of({name:"PostgreSQL",load(){return my("PostgreSQL")}}),Ke.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return nt(()=>import("./index-CgRhknyO.js"),__vite__mapDeps([12,2]),import.meta.url).then(e=>e.python())}}),Ke.of({name:"Rust",extensions:["rs"],load(){return nt(()=>import("./index-D4xZzb1p.js"),__vite__mapDeps([13,2]),import.meta.url).then(e=>e.rust())}}),Ke.of({name:"Sass",extensions:["sass"],load(){return nt(()=>import("./index-BCdyfE3O.js"),__vite__mapDeps([14,2]),import.meta.url).then(e=>e.sass({indented:!0}))}}),Ke.of({name:"SCSS",extensions:["scss"],load(){return nt(()=>import("./index-BCdyfE3O.js"),__vite__mapDeps([14,2]),import.meta.url).then(e=>e.sass())}}),Ke.of({name:"SQL",extensions:["sql"],load(){return my("StandardSQL")}}),Ke.of({name:"SQLite",load(){return my("SQLite")}}),Ke.of({name:"TSX",extensions:["tsx"],load(){return nt(()=>Promise.resolve().then(()=>GM),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ke.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return nt(()=>Promise.resolve().then(()=>GM),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ke.of({name:"WebAssembly",extensions:["wat","wast"],load(){return nt(()=>import("./index-W7WFFo7e.js"),__vite__mapDeps([15,2]),import.meta.url).then(e=>e.wast())}}),Ke.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return nt(()=>import("./index-B1BoslNp.js"),__vite__mapDeps([16,2]),import.meta.url).then(e=>e.xml())}}),Ke.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return nt(()=>import("./index-DigVG8_v.js"),__vite__mapDeps([17,2]),import.meta.url).then(e=>e.yaml())}}),Ke.of({name:"APL",extensions:["dyalog","apl"],load(){return nt(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>gt(e.apl))}}),Ke.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return nt(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>gt(e.asciiArmor))}}),Ke.of({name:"ASN.1",extensions:["asn","asn1"],load(){return nt(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>gt(e.asn1({})))}}),Ke.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return nt(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>gt(e.asterisk))}}),Ke.of({name:"Brainfuck",extensions:["b","bf"],load(){return nt(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>gt(e.brainfuck))}}),Ke.of({name:"Cobol",extensions:["cob","cpy"],load(){return nt(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>gt(e.cobol))}}),Ke.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.csharp))}}),Ke.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"ClojureScript",extensions:["cljs"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return nt(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>gt(e.gss))}}),Ke.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return nt(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>gt(e.cmake))}}),Ke.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return nt(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>gt(e.coffeeScript))}}),Ke.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return nt(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>gt(e.commonLisp))}}),Ke.of({name:"Cypher",extensions:["cyp","cypher"],load(){return nt(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>gt(e.cypher))}}),Ke.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return nt(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>gt(e.cython))}}),Ke.of({name:"Crystal",extensions:["cr"],load(){return nt(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>gt(e.crystal))}}),Ke.of({name:"D",extensions:["d"],load(){return nt(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>gt(e.d))}}),Ke.of({name:"Dart",extensions:["dart"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.dart))}}),Ke.of({name:"diff",extensions:["diff","patch"],load(){return nt(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>gt(e.diff))}}),Ke.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return nt(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([18,19]),import.meta.url).then(e=>gt(e.dockerFile))}}),Ke.of({name:"DTD",extensions:["dtd"],load(){return nt(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>gt(e.dtd))}}),Ke.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return nt(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>gt(e.dylan))}}),Ke.of({name:"EBNF",load(){return nt(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>gt(e.ebnf))}}),Ke.of({name:"ECL",extensions:["ecl"],load(){return nt(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>gt(e.ecl))}}),Ke.of({name:"edn",extensions:["edn"],load(){return nt(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>gt(e.clojure))}}),Ke.of({name:"Eiffel",extensions:["e"],load(){return nt(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>gt(e.eiffel))}}),Ke.of({name:"Elm",extensions:["elm"],load(){return nt(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>gt(e.elm))}}),Ke.of({name:"Erlang",extensions:["erl"],load(){return nt(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>gt(e.erlang))}}),Ke.of({name:"Esper",load(){return nt(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>gt(e.esper))}}),Ke.of({name:"Factor",extensions:["factor"],load(){return nt(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([20,19]),import.meta.url).then(e=>gt(e.factor))}}),Ke.of({name:"FCL",load(){return nt(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>gt(e.fcl))}}),Ke.of({name:"Forth",extensions:["forth","fth","4th"],load(){return nt(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>gt(e.forth))}}),Ke.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return nt(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>gt(e.fortran))}}),Ke.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.fSharp))}}),Ke.of({name:"Gas",extensions:["s"],load(){return nt(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>gt(e.gas))}}),Ke.of({name:"Gherkin",extensions:["feature"],load(){return nt(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>gt(e.gherkin))}}),Ke.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return nt(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>gt(e.groovy))}}),Ke.of({name:"Haskell",extensions:["hs"],load(){return nt(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>gt(e.haskell))}}),Ke.of({name:"Haxe",extensions:["hx"],load(){return nt(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>gt(e.haxe))}}),Ke.of({name:"HXML",extensions:["hxml"],load(){return nt(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>gt(e.hxml))}}),Ke.of({name:"HTTP",load(){return nt(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>gt(e.http))}}),Ke.of({name:"IDL",extensions:["pro"],load(){return nt(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>gt(e.idl))}}),Ke.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return nt(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>gt(e.jsonld))}}),Ke.of({name:"Julia",extensions:["jl"],load(){return nt(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>gt(e.julia))}}),Ke.of({name:"Kotlin",extensions:["kt","kts"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.kotlin))}}),Ke.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return nt(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>gt(e.liveScript))}}),Ke.of({name:"Lua",extensions:["lua"],load(){return nt(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>gt(e.lua))}}),Ke.of({name:"mIRC",extensions:["mrc"],load(){return nt(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>gt(e.mirc))}}),Ke.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return nt(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>gt(e.mathematica))}}),Ke.of({name:"Modelica",extensions:["mo"],load(){return nt(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>gt(e.modelica))}}),Ke.of({name:"MUMPS",extensions:["mps"],load(){return nt(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>gt(e.mumps))}}),Ke.of({name:"Mbox",extensions:["mbox"],load(){return nt(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>gt(e.mbox))}}),Ke.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return nt(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>gt(e.nginx))}}),Ke.of({name:"NSIS",extensions:["nsh","nsi"],load(){return nt(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([21,19]),import.meta.url).then(e=>gt(e.nsis))}}),Ke.of({name:"NTriples",extensions:["nt","nq"],load(){return nt(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>gt(e.ntriples))}}),Ke.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.objectiveC))}}),Ke.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.objectiveCpp))}}),Ke.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.oCaml))}}),Ke.of({name:"Octave",extensions:["m"],load(){return nt(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>gt(e.octave))}}),Ke.of({name:"Oz",extensions:["oz"],load(){return nt(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>gt(e.oz))}}),Ke.of({name:"Pascal",extensions:["p","pas"],load(){return nt(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>gt(e.pascal))}}),Ke.of({name:"Perl",extensions:["pl","pm"],load(){return nt(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>gt(e.perl))}}),Ke.of({name:"Pig",extensions:["pig"],load(){return nt(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>gt(e.pig))}}),Ke.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return nt(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>gt(e.powerShell))}}),Ke.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return nt(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>gt(e.properties))}}),Ke.of({name:"ProtoBuf",extensions:["proto"],load(){return nt(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>gt(e.protobuf))}}),Ke.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return nt(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([22,23]),import.meta.url).then(e=>gt(e.pug))}}),Ke.of({name:"Puppet",extensions:["pp"],load(){return nt(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>gt(e.puppet))}}),Ke.of({name:"Q",extensions:["q"],load(){return nt(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>gt(e.q))}}),Ke.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return nt(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>gt(e.r))}}),Ke.of({name:"RPM Changes",load(){return nt(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>gt(e.rpmChanges))}}),Ke.of({name:"RPM Spec",extensions:["spec"],load(){return nt(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>gt(e.rpmSpec))}}),Ke.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return nt(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>gt(e.ruby))}}),Ke.of({name:"SAS",extensions:["sas"],load(){return nt(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>gt(e.sas))}}),Ke.of({name:"Scala",extensions:["scala"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.scala))}}),Ke.of({name:"Scheme",extensions:["scm","ss"],load(){return nt(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>gt(e.scheme))}}),Ke.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return nt(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>gt(e.shell))}}),Ke.of({name:"Sieve",extensions:["siv","sieve"],load(){return nt(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>gt(e.sieve))}}),Ke.of({name:"Smalltalk",extensions:["st"],load(){return nt(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>gt(e.smalltalk))}}),Ke.of({name:"Solr",load(){return nt(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>gt(e.solr))}}),Ke.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return nt(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>gt(e.sml))}}),Ke.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return nt(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>gt(e.sparql))}}),Ke.of({name:"Spreadsheet",alias:["excel","formula"],load(){return nt(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>gt(e.spreadsheet))}}),Ke.of({name:"Squirrel",extensions:["nut"],load(){return nt(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>gt(e.squirrel))}}),Ke.of({name:"Stylus",extensions:["styl"],load(){return nt(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>gt(e.stylus))}}),Ke.of({name:"Swift",extensions:["swift"],load(){return nt(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>gt(e.swift))}}),Ke.of({name:"sTeX",load(){return nt(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>gt(e.stex))}}),Ke.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return nt(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>gt(e.stex))}}),Ke.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return nt(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>gt(e.verilog))}}),Ke.of({name:"Tcl",extensions:["tcl"],load(){return nt(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>gt(e.tcl))}}),Ke.of({name:"Textile",extensions:["textile"],load(){return nt(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>gt(e.textile))}}),Ke.of({name:"TiddlyWiki",load(){return nt(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>gt(e.tiddlyWiki))}}),Ke.of({name:"Tiki wiki",load(){return nt(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>gt(e.tiki))}}),Ke.of({name:"TOML",extensions:["toml"],load(){return nt(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>gt(e.toml))}}),Ke.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return nt(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>gt(e.troff))}}),Ke.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return nt(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>gt(e.ttcn))}}),Ke.of({name:"TTCN_CFG",extensions:["cfg"],load(){return nt(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>gt(e.ttcnCfg))}}),Ke.of({name:"Turtle",extensions:["ttl"],load(){return nt(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>gt(e.turtle))}}),Ke.of({name:"Web IDL",extensions:["webidl"],load(){return nt(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>gt(e.webIDL))}}),Ke.of({name:"VB.NET",extensions:["vb"],load(){return nt(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>gt(e.vb))}}),Ke.of({name:"VBScript",extensions:["vbs"],load(){return nt(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>gt(e.vbScript))}}),Ke.of({name:"Velocity",extensions:["vtl"],load(){return nt(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>gt(e.velocity))}}),Ke.of({name:"Verilog",extensions:["v"],load(){return nt(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>gt(e.verilog))}}),Ke.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return nt(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>gt(e.vhdl))}}),Ke.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return nt(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>gt(e.xQuery))}}),Ke.of({name:"Yacas",extensions:["ys"],load(){return nt(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>gt(e.yacas))}}),Ke.of({name:"Z80",extensions:["z80"],load(){return nt(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>gt(e.z80))}}),Ke.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.mscgen))}}),Ke.of({name:"Xù",extensions:["xu"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.xu))}}),Ke.of({name:"MsGenny",extensions:["msgenny"],load(){return nt(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>gt(e.msgenny))}}),Ke.of({name:"Vue",extensions:["vue"],load(){return nt(()=>import("./index-BxdRtlHb.js"),__vite__mapDeps([24,2]),import.meta.url).then(e=>e.vue())}}),Ke.of({name:"Angular Template",load(){return nt(()=>import("./index-DluSEK8w.js"),__vite__mapDeps([25,2]),import.meta.url).then(e=>e.angular())}})];var fcn=e=>{var{theme:t,settings:n={},styles:r=[]}=e,a={".cm-gutters":{}},s={};n.background&&(s.backgroundColor=n.background),n.backgroundImage&&(s.backgroundImage=n.backgroundImage),n.foreground&&(s.color=n.foreground),n.fontSize&&(s.fontSize=n.fontSize),(n.background||n.foreground)&&(a["&"]=s),n.fontFamily&&(a["&.cm-editor .cm-scroller"]={fontFamily:n.fontFamily}),n.gutterBackground&&(a[".cm-gutters"].backgroundColor=n.gutterBackground),n.gutterForeground&&(a[".cm-gutters"].color=n.gutterForeground),n.gutterBorder&&(a[".cm-gutters"].borderRightColor=n.gutterBorder),n.caret&&(a[".cm-content"]={caretColor:n.caret},a[".cm-cursor, .cm-dropCursor"]={borderLeftColor:n.caret});var i={};n.gutterActiveForeground&&(i.color=n.gutterActiveForeground),n.lineHighlight&&(a[".cm-activeLine"]={backgroundColor:n.lineHighlight},i.backgroundColor=n.lineHighlight),a[".cm-activeLineGutter"]=i,n.selection&&(a["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:n.selection+" !important"}),n.selectionMatch&&(a["& .cm-selectionMatch"]={backgroundColor:n.selectionMatch});var l=xt.theme(a,{dark:t==="dark"}),c=$m.define(r),u=[l,Jw(c)];return u},hcn={background:"#282a36",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"#282a36",gutterForeground:"#6D8A88",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},pcn=[{tag:se.comment,color:"#6272a4"},{tag:se.string,color:"#f1fa8c"},{tag:se.atom,color:"#bd93f9"},{tag:se.meta,color:"#f8f8f2"},{tag:[se.keyword,se.operator,se.tagName],color:"#ff79c6"},{tag:[se.function(se.propertyName),se.propertyName],color:"#66d9ef"},{tag:[se.definition(se.variableName),se.function(se.variableName),se.className,se.attributeName],color:"#50fa7b"},{tag:se.atom,color:"#bd93f9"}],FI=e=>{var{theme:t="dark",settings:n={},styles:r=[]}=e||{};return fcn({theme:t,settings:Ob({},hcn,n),styles:[...pcn,...r]})};FI();const mcn=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Dde(e.state,n.from);return r.line?gcn(e):r.block?ycn(e):!1};function Mde(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let a=e(t,n);return a?(r(n.update(a)),!0):!1}}const gcn=Mde(wcn,0),vcn=Mde(est,0),ycn=Mde((e,t)=>est(e,t,xcn(t)),0);function Dde(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const hC=50;function bcn(e,{open:t,close:n},r,a){let s=e.sliceDoc(r-hC,r),i=e.sliceDoc(a,a+hC),l=/\s*$/.exec(s)[0].length,c=/^\s*/.exec(i)[0].length,u=s.length-l;if(s.slice(u-t.length,u)==t&&i.slice(c,c+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:a+c,margin:c&&1}};let d,f;a-r<=2*hC?d=f=e.sliceDoc(r,a):(d=e.sliceDoc(r,r+hC),f=e.sliceDoc(a-hC,a));let h=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,m=f.length-p-n.length;return d.slice(h,h+t.length)==t&&f.slice(m,m+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:a-p-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function xcn(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),a=n.to<=r.to?r:e.doc.lineAt(n.to);a.from>r.from&&a.from==n.to&&(a=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let s=t.length-1;s>=0&&t[s].to>r.from?t[s].to=a.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:a.to})}return t}function est(e,t,n=t.selection.ranges){let r=n.map(s=>Dde(t,s.from).block);if(!r.every(s=>s))return null;let a=n.map((s,i)=>bcn(t,r[i],s.from,s.to));if(e!=2&&!a.every(s=>s))return{changes:t.changes(n.map((s,i)=>a[i]?[]:[{from:s.from,insert:r[i].open+" "},{from:s.to,insert:" "+r[i].close}]))};if(e!=1&&a.some(s=>s)){let s=[];for(let i=0,l;i<a.length;i++)if(l=a[i]){let c=r[i],{open:u,close:d}=l;s.push({from:u.pos-c.open.length,to:u.pos+u.margin},{from:d.pos-d.margin,to:d.pos+c.close.length})}return{changes:s}}return null}function wcn(e,t,n=t.selection.ranges){let r=[],a=-1;for(let{from:s,to:i}of n){let l=r.length,c=1e9,u=Dde(t,s).line;if(u){for(let d=s;d<=i;){let f=t.doc.lineAt(d);if(f.from>a&&(s==i||i>f.from)){a=f.from;let h=/^\s*/.exec(f.text)[0].length,p=h==f.length,m=f.text.slice(h,h+u.length)==u?h:-1;h<f.text.length&&h<c&&(c=h),r.push({line:f,comment:m,token:u,indent:h,empty:p,single:!1})}d=f.to+1}if(c<1e9)for(let d=l;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=c);r.length==l+1&&(r[l].single=!0)}}if(e!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of r)(f||!d)&&s.push({from:l.from+u,insert:c+" "});let i=t.changes(s);return{changes:i,selection:t.selection.map(i,1)}}else if(e!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:i,comment:l,token:c}of r)if(l>=0){let u=i.from+l,d=u+c.length;i.text[d-i.from]==" "&&d++,s.push({from:u,to:d})}return{changes:s}}return null}const Kne=Mm.define(),Scn=Mm.define(),Ocn=Jt.define(),tst=Jt.define({combine(e){return Dm(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,a)=>t(r,a)||n(r,a)})}}),nst=vo.define({create(){return tm.empty},update(e,t){let n=t.state.facet(tst),r=t.annotation(Kne);if(r){let c=du.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=$L(d,d.length,n.minDepth,c):d=sst(d,t.startState.selection),new tm(u==0?r.rest:d,u==0?d:r.rest)}let a=t.annotation(Scn);if((a=="full"||a=="before")&&(e=e.isolate()),t.annotation(co.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=du.fromTransaction(t),i=t.annotation(co.time),l=t.annotation(co.userEvent);return s?e=e.addChanges(s,i,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,i,l,n.newGroupDelay)),(a=="full"||a=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new tm(e.done.map(du.fromJSON),e.undone.map(du.fromJSON))}});function kcn(e={}){return[nst,tst.of(e),xt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?rst:t.inputType=="historyRedo"?Jne:null;return r?(t.preventDefault(),r(n)):!1}})]}function pF(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let a=n.field(nst,!1);if(!a)return!1;let s=a.pop(e,n,t);return s?(r(s),!0):!1}}const rst=pF(0,!1),Jne=pF(1,!1),_cn=pF(0,!0),Ecn=pF(1,!0);class du{constructor(t,n,r,a,s){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=a,this.selectionsAfter=s}setSelAfter(t){return new du(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(a=>a.toJSON())}}static fromJSON(t){return new du(t.changes&&ao.fromJSON(t.changes),[],t.mapped&&lm.fromJSON(t.mapped),t.startSelection&&ot.fromJSON(t.startSelection),t.selectionsAfter.map(ot.fromJSON))}static fromTransaction(t,n){let r=Nf;for(let a of t.startState.facet(Ocn)){let s=a(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new du(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Nf)}static selection(t){return new du(void 0,Nf,void 0,void 0,t)}}function $L(e,t,n,r){let a=t+1>n+20?t-n-1:0,s=e.slice(a,t);return s.push(r),s}function Ccn(e,t){let n=[],r=!1;return e.iterChangedRanges((a,s)=>n.push(a,s)),t.iterChangedRanges((a,s,i,l)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];l>=u&&i<=d&&(r=!0)}}),r}function jcn(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function ast(e,t){return e.length?t.length?e.concat(t):e:t}const Nf=[],Tcn=200;function sst(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Tcn));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),$L(e,e.length-1,1e9,n.setSelAfter(r)))}else return[du.selection([t])]}function Ncn(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function PU(e,t){if(!e.length)return e;let n=e.length,r=Nf;for(;n;){let a=Acn(e[n-1],t,r);if(a.changes&&!a.changes.empty||a.effects.length){let s=e.slice(0,n);return s[n-1]=a,s}else t=a.mapped,n--,r=a.selectionsAfter}return r.length?[du.selection(r)]:Nf}function Acn(e,t,n){let r=ast(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):Nf,n);if(!e.changes)return du.selection(r);let a=e.changes.map(t),s=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(s):s;return new du(a,er.mapEffects(e.effects,t),i,e.startSelection.map(s),r)}const Icn=/^(input\.type|delete)($|\.)/;class tm{constructor(t,n,r=0,a=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=a}isolate(){return this.prevTime?new tm(this.done,this.undone):this}addChanges(t,n,r,a,s){let i=this.done,l=i[i.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!r||Icn.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime<a.newGroupDelay&&a.joinToEvent(s,Ccn(l.changes,t.changes))||r=="input.type.compose")?i=$L(i,i.length-1,a.minDepth,new du(t.changes.compose(l.changes),ast(er.mapEffects(t.effects,l.changes),l.effects),l.mapped,l.startSelection,Nf)):i=$L(i,i.length,a.minDepth,t),new tm(i,Nf,n,r)}addSelection(t,n,r,a){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Nf;return s.length>0&&n-this.prevTime<a&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&jcn(s[s.length-1],t)?this:new tm(sst(this.done,t),this.undone,n,r)}addMapping(t){return new tm(PU(this.done,t),PU(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,n,r){let a=t==0?this.done:this.undone;if(a.length==0)return null;let s=a[a.length-1],i=s.selectionsAfter[0]||n.selection;if(r&&s.selectionsAfter.length)return n.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Kne.of({side:t,rest:Ncn(a),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=a.length==1?Nf:a.slice(0,a.length-1);return s.mapped&&(l=PU(l,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Kne.of({side:t,rest:l,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}tm.empty=new tm(Nf,Nf);const Rcn=[{key:"Mod-z",run:rst,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Jne,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Jne,preventDefault:!0},{key:"Mod-u",run:_cn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ecn,preventDefault:!0}];function N_(e,t){return ot.create(e.ranges.map(t),e.mainIndex)}function np(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function rp({state:e,dispatch:t},n){let r=N_(e.selection,n);return r.eq(e.selection,!0)?!1:(t(np(e,r)),!0)}function mF(e,t){return ot.cursor(t?e.to:e.from)}function ist(e,t){return rp(e,n=>n.empty?e.moveByChar(n,t):mF(n,t))}function nc(e){return e.textDirectionAt(e.state.selection.main.head)==xs.LTR}const ost=e=>ist(e,!nc(e)),lst=e=>ist(e,nc(e));function cst(e,t){return rp(e,n=>n.empty?e.moveByGroup(n,t):mF(n,t))}const Pcn=e=>cst(e,!nc(e)),Mcn=e=>cst(e,nc(e));function Dcn(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function gF(e,t,n){let r=ps(e).resolveInner(t.head),a=n?lr.closedBy:lr.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;Dcn(e,u,a)?r=u:c=n?u.to:u.from}let s=r.type.prop(a),i,l;return s&&(i=n?em(e,r.from,1):em(e,r.to,-1))&&i.matched?l=n?i.end.to:i.end.from:l=n?r.to:r.from,ot.cursor(l,n?-1:1)}const $cn=e=>rp(e,t=>gF(e.state,t,!nc(e))),Lcn=e=>rp(e,t=>gF(e.state,t,nc(e)));function ust(e,t){return rp(e,n=>{if(!n.empty)return mF(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const dst=e=>ust(e,!1),fst=e=>ust(e,!0);function hst(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,a;if(t){for(let s of e.state.facet(xt.scrollMargins)){let i=s(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}a=e.scrollDOM.clientHeight-n-r}else a=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,a-5)}}function pst(e,t){let n=hst(e),{state:r}=e,a=N_(r.selection,i=>i.empty?e.moveVertically(i,t,n.height):mF(i,t));if(a.eq(r.selection))return!1;let s;if(n.selfScroll){let i=e.coordsAtPos(r.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,u=l.bottom-n.marginBottom;i&&i.top>c&&i.bottom<u&&(s=xt.scrollIntoView(a.main.head,{y:"start",yMargin:i.top-c}))}return e.dispatch(np(r,a),{effects:s}),!0}const Z_e=e=>pst(e,!1),ere=e=>pst(e,!0);function Zb(e,t,n){let r=e.lineBlockAt(t.head),a=e.moveToLineBoundary(t,n);if(a.head==t.head&&a.head!=(n?r.to:r.from)&&(a=e.moveToLineBoundary(t,n,!1)),!n&&a.head==r.from&&r.length){let s=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&t.head!=r.from+s&&(a=ot.cursor(r.from+s))}return a}const Fcn=e=>rp(e,t=>Zb(e,t,!0)),zcn=e=>rp(e,t=>Zb(e,t,!1)),Bcn=e=>rp(e,t=>Zb(e,t,!nc(e))),Ucn=e=>rp(e,t=>Zb(e,t,nc(e))),qcn=e=>rp(e,t=>ot.cursor(e.lineBlockAt(t.head).from,1)),Vcn=e=>rp(e,t=>ot.cursor(e.lineBlockAt(t.head).to,-1));function Hcn(e,t,n){let r=!1,a=N_(e.selection,s=>{let i=em(e,s.head,-1)||em(e,s.head,1)||s.head>0&&em(e,s.head-1,1)||s.head<e.doc.length&&em(e,s.head+1,-1);if(!i||!i.end)return s;r=!0;let l=i.start.from==s.head?i.end.to:i.end.from;return ot.cursor(l)});return r?(t(np(e,a)),!0):!1}const Qcn=({state:e,dispatch:t})=>Hcn(e,t);function Jf(e,t){let n=N_(e.state.selection,r=>{let a=t(r);return ot.range(r.anchor,a.head,a.goalColumn,a.bidiLevel||void 0)});return n.eq(e.state.selection)?!1:(e.dispatch(np(e.state,n)),!0)}function mst(e,t){return Jf(e,n=>e.moveByChar(n,t))}const gst=e=>mst(e,!nc(e)),vst=e=>mst(e,nc(e));function yst(e,t){return Jf(e,n=>e.moveByGroup(n,t))}const Wcn=e=>yst(e,!nc(e)),Gcn=e=>yst(e,nc(e)),Zcn=e=>Jf(e,t=>gF(e.state,t,!nc(e))),Ycn=e=>Jf(e,t=>gF(e.state,t,nc(e)));function bst(e,t){return Jf(e,n=>e.moveVertically(n,t))}const xst=e=>bst(e,!1),wst=e=>bst(e,!0);function Sst(e,t){return Jf(e,n=>e.moveVertically(n,t,hst(e).height))}const Y_e=e=>Sst(e,!1),X_e=e=>Sst(e,!0),Xcn=e=>Jf(e,t=>Zb(e,t,!0)),Kcn=e=>Jf(e,t=>Zb(e,t,!1)),Jcn=e=>Jf(e,t=>Zb(e,t,!nc(e))),eun=e=>Jf(e,t=>Zb(e,t,nc(e))),tun=e=>Jf(e,t=>ot.cursor(e.lineBlockAt(t.head).from)),nun=e=>Jf(e,t=>ot.cursor(e.lineBlockAt(t.head).to)),K_e=({state:e,dispatch:t})=>(t(np(e,{anchor:0})),!0),J_e=({state:e,dispatch:t})=>(t(np(e,{anchor:e.doc.length})),!0),eEe=({state:e,dispatch:t})=>(t(np(e,{anchor:e.selection.main.anchor,head:0})),!0),tEe=({state:e,dispatch:t})=>(t(np(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),run=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),aun=({state:e,dispatch:t})=>{let n=vF(e).map(({from:r,to:a})=>ot.range(r,Math.min(a+1,e.doc.length)));return t(e.update({selection:ot.create(n),userEvent:"select"})),!0},sun=({state:e,dispatch:t})=>{let n=N_(e.selection,r=>{let a=ps(e),s=a.resolveStack(r.from,1);if(r.empty){let i=a.resolveStack(r.from,-1);i.node.from>=s.node.from&&i.node.to<=s.node.to&&(s=i)}for(let i=s;i;i=i.next){let{node:l}=i;if((l.from<r.from&&l.to>=r.to||l.to>r.to&&l.from<=r.from)&&i.next)return ot.range(l.to,l.from)}return r});return n.eq(e.selection)?!1:(t(np(e,n)),!0)};function Ost(e,t){let{state:n}=e,r=n.selection,a=n.selection.ranges.slice();for(let s of n.selection.ranges){let i=n.doc.lineAt(s.head);if(t?i.to<e.state.doc.length:i.from>0)for(let l=s;;){let c=e.moveVertically(l,t);if(c.head<i.from||c.head>i.to){a.some(u=>u.head==c.head)||a.push(c);break}else{if(c.head==l.head)break;l=c}}}return a.length==r.ranges.length?!1:(e.dispatch(np(n,ot.create(a,a.length-1))),!0)}const iun=e=>Ost(e,!1),oun=e=>Ost(e,!0),lun=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=ot.create([n.main]):n.main.empty||(r=ot.create([ot.cursor(n.main.head)])),r?(t(np(e,r)),!0):!1};function zI(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,a=r.changeByRange(s=>{let{from:i,to:l}=s;if(i==l){let c=t(s);c<i?(n="delete.backward",c=ZM(e,c,!1)):c>i&&(n="delete.forward",c=ZM(e,c,!0)),i=Math.min(i,c),l=Math.max(l,c)}else i=ZM(e,i,!1),l=ZM(e,l,!0);return i==l?{range:s}:{changes:{from:i,to:l},range:ot.cursor(i,i<s.head?-1:1)}});return a.changes.empty?!1:(e.dispatch(r.update(a,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?xt.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function ZM(e,t,n){if(e instanceof xt)for(let r of e.state.facet(xt.atomicRanges).map(a=>a(e)))r.between(t,t,(a,s)=>{a<t&&s>t&&(t=n?s:a)});return t}const kst=(e,t,n)=>zI(e,r=>{let a=r.from,{state:s}=e,i=s.doc.lineAt(a),l,c;if(n&&!t&&a>i.from&&a<i.from+200&&!/[^ \t]/.test(l=i.text.slice(0,a-i.from))){if(l[l.length-1]==" ")return a-1;let u=Vh(l,s.tabSize),d=u%sw(s)||sw(s);for(let f=0;f<d&&l[l.length-1-f]==" ";f++)a--;c=a}else c=Zo(i.text,a-i.from,t,t)+i.from,c==a&&i.number!=(t?s.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(i.text.slice(c-i.from,a-i.from))&&(c=Zo(i.text,c-i.from,!1,!1)+i.from);return c}),tre=e=>kst(e,!1,!0),_st=e=>kst(e,!0,!1),Est=(e,t)=>zI(e,n=>{let r=n.head,{state:a}=e,s=a.doc.lineAt(r),i=a.charCategorizer(r);for(let l=null;;){if(r==(t?s.to:s.from)){r==n.head&&s.number!=(t?a.doc.lines:1)&&(r+=t?1:-1);break}let c=Zo(s.text,r-s.from,t)+s.from,u=s.text.slice(Math.min(r,c)-s.from,Math.max(r,c)-s.from),d=i(u);if(l!=null&&d!=l)break;(u!=" "||r!=n.head)&&(l=d),r=c}return r}),Cst=e=>Est(e,!1),cun=e=>Est(e,!0),uun=e=>zI(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),dun=e=>zI(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),fun=e=>zI(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),hun=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Ca.of(["",""])},range:ot.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},pun=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let a=r.from,s=e.doc.lineAt(a),i=a==s.from?a-1:Zo(s.text,a-s.from,!1)+s.from,l=a==s.to?a+1:Zo(s.text,a-s.from,!0)+s.from;return{changes:{from:i,to:l,insert:e.doc.slice(a,l).append(e.doc.slice(i,a))},range:ot.cursor(l)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function vF(e){let t=[],n=-1;for(let r of e.selection.ranges){let a=e.doc.lineAt(r.from),s=e.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=e.doc.lineAt(r.to-1)),n>=a.number){let i=t[t.length-1];i.to=s.to,i.ranges.push(r)}else t.push({from:a.from,to:s.to,ranges:[r]});n=s.number+1}return t}function jst(e,t,n){if(e.readOnly)return!1;let r=[],a=[];for(let s of vF(e)){if(n?s.to==e.doc.length:s.from==0)continue;let i=e.doc.lineAt(n?s.to+1:s.from-1),l=i.length+1;if(n){r.push({from:s.to,to:i.to},{from:s.from,insert:i.text+e.lineBreak});for(let c of s.ranges)a.push(ot.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}else{r.push({from:i.from,to:s.from},{from:s.to,insert:e.lineBreak+i.text});for(let c of s.ranges)a.push(ot.range(c.anchor-l,c.head-l))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:ot.create(a,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const mun=({state:e,dispatch:t})=>jst(e,t,!1),gun=({state:e,dispatch:t})=>jst(e,t,!0);function Tst(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of vF(e))n?r.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak}):r.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)});let a=e.changes(r);return t(e.update({changes:a,selection:e.selection.map(a,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const vun=({state:e,dispatch:t})=>Tst(e,t,!1),yun=({state:e,dispatch:t})=>Tst(e,t,!0),bun=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(vF(t).map(({from:a,to:s})=>(a>0?a--:s<t.doc.length&&s++,{from:a,to:s}))),r=N_(t.selection,a=>{let s;if(e.lineWrapping){let i=e.lineBlockAt(a.head),l=e.coordsAtPos(a.head,a.assoc||1);l&&(s=i.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(a,!0,s)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function xun(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=ps(e).resolveInner(t),r=n.childBefore(t),a=n.childAfter(t),s;return r&&a&&r.to<=t&&a.from>=t&&(s=r.type.prop(lr.closedBy))&&s.indexOf(a.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(a.from).from&&!/\S/.test(e.sliceDoc(r.to,a.from))?{from:r.to,to:a.from}:null}const nEe=Nst(!1),wun=Nst(!0);function Nst(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(a=>{let{from:s,to:i}=a,l=t.doc.lineAt(s),c=!e&&s==i&&xun(t,s);e&&(s=i=(i<=l.to?l:t.doc.lineAt(i)).to);let u=new cF(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=ade(u,s);for(d==null&&(d=Vh(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));i<l.to&&/\s/.test(l.text[i-l.from]);)i++;c?{from:s,to:i}=c:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let f=["",bN(t,d)];return c&&f.push(bN(t,u.lineIndent(l.from,-1))),{changes:{from:s,to:i,insert:Ca.of(f)},range:ot.cursor(s+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function $de(e,t){let n=-1;return e.changeByRange(r=>{let a=[];for(let i=r.from;i<=r.to;){let l=e.doc.lineAt(i);l.number>n&&(r.empty||r.to>l.from)&&(t(l,a,r),n=l.number),i=l.to+1}let s=e.changes(a);return{changes:a,range:ot.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const Sun=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new cF(e,{overrideIndentation:s=>{let i=n[s];return i??-1}}),a=$de(e,(s,i,l)=>{let c=ade(r,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=bN(e,c);(u!=d||l.from<s.from+u.length)&&(n[s.from]=c,i.push({from:s.from,to:s.from+u.length,insert:d}))});return a.changes.empty||t(e.update(a,{userEvent:"indent"})),!0},Ast=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update($de(e,(n,r)=>{r.push({from:n.from,insert:e.facet(j_)})}),{userEvent:"input.indent"})),!0),Ist=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update($de(e,(n,r)=>{let a=/^\s*/.exec(n.text)[0];if(!a)return;let s=Vh(a,e.tabSize),i=0,l=bN(e,Math.max(0,s-sw(e)));for(;i<a.length&&i<l.length&&a.charCodeAt(i)==l.charCodeAt(i);)i++;r.push({from:n.from+i,to:n.from+a.length,insert:l.slice(i)})}),{userEvent:"delete.dedent"})),!0),Oun=e=>(e.setTabFocusMode(),!0),kun=[{key:"Ctrl-b",run:ost,shift:gst,preventDefault:!0},{key:"Ctrl-f",run:lst,shift:vst},{key:"Ctrl-p",run:dst,shift:xst},{key:"Ctrl-n",run:fst,shift:wst},{key:"Ctrl-a",run:qcn,shift:tun},{key:"Ctrl-e",run:Vcn,shift:nun},{key:"Ctrl-d",run:_st},{key:"Ctrl-h",run:tre},{key:"Ctrl-k",run:uun},{key:"Ctrl-Alt-h",run:Cst},{key:"Ctrl-o",run:hun},{key:"Ctrl-t",run:pun},{key:"Ctrl-v",run:ere}],_un=[{key:"ArrowLeft",run:ost,shift:gst,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Pcn,shift:Wcn,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Bcn,shift:Jcn,preventDefault:!0},{key:"ArrowRight",run:lst,shift:vst,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Mcn,shift:Gcn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Ucn,shift:eun,preventDefault:!0},{key:"ArrowUp",run:dst,shift:xst,preventDefault:!0},{mac:"Cmd-ArrowUp",run:K_e,shift:eEe},{mac:"Ctrl-ArrowUp",run:Z_e,shift:Y_e},{key:"ArrowDown",run:fst,shift:wst,preventDefault:!0},{mac:"Cmd-ArrowDown",run:J_e,shift:tEe},{mac:"Ctrl-ArrowDown",run:ere,shift:X_e},{key:"PageUp",run:Z_e,shift:Y_e},{key:"PageDown",run:ere,shift:X_e},{key:"Home",run:zcn,shift:Kcn,preventDefault:!0},{key:"Mod-Home",run:K_e,shift:eEe},{key:"End",run:Fcn,shift:Xcn,preventDefault:!0},{key:"Mod-End",run:J_e,shift:tEe},{key:"Enter",run:nEe,shift:nEe},{key:"Mod-a",run},{key:"Backspace",run:tre,shift:tre,preventDefault:!0},{key:"Delete",run:_st,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Cst,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:cun,preventDefault:!0},{mac:"Mod-Backspace",run:dun,preventDefault:!0},{mac:"Mod-Delete",run:fun,preventDefault:!0}].concat(kun.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Eun=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:$cn,shift:Zcn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Lcn,shift:Ycn},{key:"Alt-ArrowUp",run:mun},{key:"Shift-Alt-ArrowUp",run:vun},{key:"Alt-ArrowDown",run:gun},{key:"Shift-Alt-ArrowDown",run:yun},{key:"Mod-Alt-ArrowUp",run:iun},{key:"Mod-Alt-ArrowDown",run:oun},{key:"Escape",run:lun},{key:"Mod-Enter",run:wun},{key:"Alt-l",mac:"Ctrl-l",run:aun},{key:"Mod-i",run:sun,preventDefault:!0},{key:"Mod-[",run:Ist},{key:"Mod-]",run:Ast},{key:"Mod-Alt-\\",run:Sun},{key:"Shift-Mod-k",run:bun},{key:"Shift-Mod-\\",run:Qcn},{key:"Mod-/",run:mcn},{key:"Alt-A",run:vcn},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Oun}].concat(_un),Cun={key:"Tab",run:Ast,shift:Ist},rEe=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class bk{constructor(t,n,r=0,a=t.length,s,i){this.test=i,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(r,a),this.bufferStart=r,this.normalize=s?l=>s(rEe(l)):rEe,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return tu(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=zue(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=Bp(t);let a=this.normalize(n);if(a.length)for(let s=0,i=r;;s++){let l=a.charCodeAt(s),c=this.match(l,i,this.bufferPos+this.bufferStart);if(s==a.length-1){if(c)return this.value=c,this;break}i==r&&s<n.length&&n.charCodeAt(s)==l&&i++}}}match(t,n,r){let a=null;for(let s=0;s<this.matches.length;s+=2){let i=this.matches[s],l=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?a={from:this.matches[s+1],to:r}:(this.matches[s]++,l=!0)),l||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?a={from:n,to:r}:this.matches.push(1,n)),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}}typeof Symbol<"u"&&(bk.prototype[Symbol.iterator]=function(){return this});const Rst={from:-1,to:-1,match:/.*/.exec("")},Lde="gm"+(/x/.unicode==null?"":"u");class Pst{constructor(t,n,r,a=0,s=t.length){if(this.text=t,this.to=s,this.curLine="",this.done=!1,this.value=Rst,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new Mst(t,n,r,a,s);this.re=new RegExp(n,Lde+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=t.iter();let i=t.lineAt(a);this.curLineStart=i.from,this.matchPos=LL(t,a),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,a=r+n[0].length;if(this.matchPos=LL(this.text,a+(r==a?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<a||r>this.value.to)&&(!this.test||this.test(r,a,n)))return this.value={from:r,to:a,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const MU=new WeakMap;class xO{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let a=MU.get(t);if(!a||a.from>=r||a.to<=n){let l=new xO(n,t.sliceString(n,r));return MU.set(t,l),l}if(a.from==n&&a.to==r)return a;let{text:s,from:i}=a;return i>n&&(s=t.sliceString(n,i)+s,i=n),a.to<r&&(s+=t.sliceString(a.to,r)),MU.set(t,new xO(i,s)),new xO(n,s.slice(n-i,r-i))}}class Mst{constructor(t,n,r,a,s){this.text=t,this.to=s,this.done=!1,this.value=Rst,this.matchPos=LL(t,a),this.re=new RegExp(n,Lde+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=xO.get(t,a,this.chunkEnd(a+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,a=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,a,n)))return this.value={from:r,to:a,match:n},this.matchPos=LL(this.text,a+(r==a?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=xO.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Pst.prototype[Symbol.iterator]=Mst.prototype[Symbol.iterator]=function(){return this});function jun(e){try{return new RegExp(e,Lde),!0}catch{return!1}}function LL(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}function nre(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),n=ys("input",{class:"cm-textfield",name:"line",value:t}),r=ys("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),e.dispatch({effects:nT.of(!1)}),e.focus()):s.keyCode==13&&(s.preventDefault(),a())},onsubmit:s=>{s.preventDefault(),a()}},ys("label",e.state.phrase("Go to line"),": ",n)," ",ys("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),ys("button",{name:"close",onclick:()=>{e.dispatch({effects:nT.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]));function a(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!s)return;let{state:i}=e,l=i.doc.lineAt(i.selection.main.head),[,c,u,d,f]=s,h=d?+d.slice(1):0,p=u?+u:l.number;if(u&&f){let v=p/100;c&&(v=v*(c=="-"?-1:1)+l.number/i.doc.lines),p=Math.round(i.doc.lines*v)}else u&&c&&(p=p*(c=="-"?-1:1)+l.number);let m=i.doc.line(Math.max(1,Math.min(i.doc.lines,p))),g=ot.cursor(m.from+Math.max(0,Math.min(h,m.length)));e.dispatch({effects:[nT.of(!1),xt.scrollIntoView(g.from,{y:"center"})],selection:g}),e.focus()}return{dom:r}}const nT=er.define(),aEe=vo.define({create(){return!0},update(e,t){for(let n of t.effects)n.is(nT)&&(e=n.value);return e},provide:e=>yN.from(e,t=>t?nre:null)}),Tun=e=>{let t=vN(e,nre);if(!t){let n=[nT.of(!0)];e.state.field(aEe,!1)==null&&n.push(er.appendConfig.of([aEe,Nun])),e.dispatch({effects:n}),t=vN(e,nre)}return t&&t.dom.querySelector("input").select(),!0},Nun=xt.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Aun={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Iun=Jt.define({combine(e){return Dm(e,Aun,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Run(e){return[Lun,$un]}const Pun=on.mark({class:"cm-selectionMatch"}),Mun=on.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function sEe(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=ri.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=ri.Word)}function Dun(e,t,n,r){return e(t.sliceDoc(n,n+1))==ri.Word&&e(t.sliceDoc(r-1,r))==ri.Word}const $un=ii.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Iun),{state:n}=e,r=n.selection;if(r.ranges.length>1)return on.none;let a=r.main,s,i=null;if(a.empty){if(!t.highlightWordAroundCursor)return on.none;let c=n.wordAt(a.head);if(!c)return on.none;i=n.charCategorizer(a.head),s=n.sliceDoc(c.from,c.to)}else{let c=a.to-a.from;if(c<t.minSelectionLength||c>200)return on.none;if(t.wholeWords){if(s=n.sliceDoc(a.from,a.to),i=n.charCategorizer(a.head),!(sEe(i,n,a.from,a.to)&&Dun(i,n,a.from,a.to)))return on.none}else if(s=n.sliceDoc(a.from,a.to),!s)return on.none}let l=[];for(let c of e.visibleRanges){let u=new bk(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||sEe(i,n,d,f))&&(a.empty&&d<=a.from&&f>=a.to?l.push(Mun.range(d,f)):(d>=a.to||f<=a.from)&&l.push(Pun.range(d,f)),l.length>t.maxMatches))return on.none}}return on.set(l)}},{decorations:e=>e.decorations}),Lun=xt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Fun=({state:e,dispatch:t})=>{let{selection:n}=e,r=ot.create(n.ranges.map(a=>e.wordAt(a.head)||ot.cursor(a.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function zun(e,t){let{main:n,ranges:r}=e.selection,a=e.wordAt(n.head),s=a&&a.from==n.from&&a.to==n.to;for(let i=!1,l=new bk(e.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(i)return null;l=new bk(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),i=!0}else{if(i&&r.some(c=>c.from==l.value.from))continue;if(s){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const Bun=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return Fun({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(s=>e.sliceDoc(s.from,s.to)!=r))return!1;let a=zun(e,r);return a?(t(e.update({selection:e.selection.addRange(ot.range(a.from,a.to),!1),effects:xt.scrollIntoView(a.to)})),!0):!1},A_=Jt.define({combine(e){return Dm(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Jun(t),scrollToMatch:t=>xt.scrollIntoView(t)})}});class Dst{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||jun(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?`
|
|
216
216
|
`:r=="r"?"\r":r=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new Hun(this):new qun(this)}getCursor(t,n=0,r){let a=t.doc?t:Ir.create({doc:t});return r==null&&(r=a.doc.length),this.regexp?E1(this,a,n,r):_1(this,a,n,r)}}class $st{constructor(t){this.spec=t}}function _1(e,t,n,r){return new bk(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:a=>a.toLowerCase(),e.wholeWord?Uun(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function Uun(e,t){return(n,r,a,s)=>((s>n||s+a.length<r)&&(s=Math.max(0,n-2),a=e.sliceString(s,Math.min(e.length,r+2))),(t(FL(a,n-s))!=ri.Word||t(zL(a,n-s))!=ri.Word)&&(t(zL(a,r-s))!=ri.Word||t(FL(a,r-s))!=ri.Word))}class qun extends $st{constructor(t){super(t)}nextMatch(t,n,r){let a=_1(this.spec,t,r,t.doc.length).nextOverlapping();if(a.done){let s=Math.min(t.doc.length,n+this.spec.unquoted.length);a=_1(this.spec,t,0,s).nextOverlapping()}return a.done||a.value.from==n&&a.value.to==r?null:a.value}prevMatchInRange(t,n,r){for(let a=r;;){let s=Math.max(n,a-1e4-this.spec.unquoted.length),i=_1(this.spec,t,s,a),l=null;for(;!i.nextOverlapping().done;)l=i.value;if(l)return l;if(s==n)return null;a-=1e4}}prevMatch(t,n,r){let a=this.prevMatchInRange(t,0,n);return a||(a=this.prevMatchInRange(t,Math.max(0,r-this.spec.unquoted.length),t.doc.length)),a&&(a.from!=n||a.to!=r)?a:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,n){let r=_1(this.spec,t,0,t.doc.length),a=[];for(;!r.next().done;){if(a.length>=n)return null;a.push(r.value)}return a}highlight(t,n,r,a){let s=_1(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)a(s.value.from,s.value.to)}}function E1(e,t,n,r){return new Pst(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?Vun(t.charCategorizer(t.selection.main.head)):void 0},n,r)}function FL(e,t){return e.slice(Zo(e,t,!1),t)}function zL(e,t){return e.slice(t,Zo(e,t))}function Vun(e){return(t,n,r)=>!r[0].length||(e(FL(r.input,r.index))!=ri.Word||e(zL(r.input,r.index))!=ri.Word)&&(e(zL(r.input,r.index+r[0].length))!=ri.Word||e(FL(r.input,r.index+r[0].length))!=ri.Word)}class Hun extends $st{nextMatch(t,n,r){let a=E1(this.spec,t,r,t.doc.length).next();return a.done&&(a=E1(this.spec,t,0,n).next()),a.done?null:a.value}prevMatchInRange(t,n,r){for(let a=1;;a++){let s=Math.max(n,r-a*1e4),i=E1(this.spec,t,s,r),l=null;for(;!i.next().done;)l=i.value;if(l&&(s==n||l.from>s+10))return l;if(s==n)return null}}prevMatch(t,n,r){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return t.match[0];if(r=="$")return"$";for(let a=r.length;a>0;a--){let s=+r.slice(0,a);if(s>0&&s<t.match.length)return t.match[s]+r.slice(a)}return n})}matchAll(t,n){let r=E1(this.spec,t,0,t.doc.length),a=[];for(;!r.next().done;){if(a.length>=n)return null;a.push(r.value)}return a}highlight(t,n,r,a){let s=E1(this.spec,t,Math.max(0,n-250),Math.min(r+250,t.doc.length));for(;!s.next().done;)a(s.value.from,s.value.to)}}const TN=er.define(),Fde=er.define(),tb=vo.define({create(e){return new DU(rre(e).create(),null)},update(e,t){for(let n of t.effects)n.is(TN)?e=new DU(n.value.create(),e.panel):n.is(Fde)&&(e=new DU(e.query,n.value?zde:null));return e},provide:e=>yN.from(e,t=>t.panel)});class DU{constructor(t,n){this.query=t,this.panel=n}}const Qun=on.mark({class:"cm-searchMatch"}),Wun=on.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Gun=ii.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(tb))}update(e){let t=e.state.field(tb);(t!=e.startState.field(tb)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return on.none;let{view:n}=this,r=new ku;for(let a=0,s=n.visibleRanges,i=s.length;a<i;a++){let{from:l,to:c}=s[a];for(;a<i-1&&c>s[a+1].from-500;)c=s[++a].to;e.highlight(n.state,l,c,(u,d)=>{let f=n.state.selection.ranges.some(h=>h.from==u&&h.to==d);r.add(u,d,f?Wun:Qun)})}return r.finish()}},{decorations:e=>e.decorations});function BI(e){return t=>{let n=t.state.field(tb,!1);return n&&n.query.spec.valid?e(t,n):zst(t)}}const BL=BI((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let a=ot.single(r.from,r.to),s=e.state.facet(A_);return e.dispatch({selection:a,effects:[Bde(e,r),s.scrollToMatch(a.main,e)],userEvent:"select.search"}),Fst(e),!0}),UL=BI((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,a=t.prevMatch(n,r,r);if(!a)return!1;let s=ot.single(a.from,a.to),i=e.state.facet(A_);return e.dispatch({selection:s,effects:[Bde(e,a),i.scrollToMatch(s.main,e)],userEvent:"select.search"}),Fst(e),!0}),Zun=BI((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:ot.create(n.map(r=>ot.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),Yun=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:a}=n.main,s=[],i=0;for(let l=new bk(e.doc,e.sliceDoc(r,a));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(i=s.length),s.push(ot.range(l.value.from,l.value.to))}return t(e.update({selection:ot.create(s,i),userEvent:"select.search.matches"})),!0},iEe=BI((e,{query:t})=>{let{state:n}=e,{from:r,to:a}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,r,r);if(!s)return!1;let i=s,l=[],c,u,d=[];i.from==r&&i.to==a&&(u=n.toText(t.getReplacement(i)),l.push({from:i.from,to:i.to,insert:u}),i=t.nextMatch(n,i.from,i.to),d.push(xt.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let f=e.state.changes(l);return i&&(c=ot.single(i.from,i.to).map(f),d.push(Bde(e,i)),d.push(n.facet(A_).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),Xun=BI((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(a=>{let{from:s,to:i}=a;return{from:s,to:i,insert:t.getReplacement(a)}});if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:xt.announce.of(r),userEvent:"input.replace.all"}),!0});function zde(e){return e.state.facet(A_).createPanel(e)}function rre(e,t){var n,r,a,s,i;let l=e.selection.main,c=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!c)return t;let u=e.facet(A_);return new Dst({search:((n=t?.literal)!==null&&n!==void 0?n:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=t?.caseSensitive)!==null&&r!==void 0?r:u.caseSensitive,literal:(a=t?.literal)!==null&&a!==void 0?a:u.literal,regexp:(s=t?.regexp)!==null&&s!==void 0?s:u.regexp,wholeWord:(i=t?.wholeWord)!==null&&i!==void 0?i:u.wholeWord})}function Lst(e){let t=vN(e,zde);return t&&t.dom.querySelector("[main-field]")}function Fst(e){let t=Lst(e);t&&t==e.root.activeElement&&t.select()}const zst=e=>{let t=e.state.field(tb,!1);if(t&&t.panel){let n=Lst(e);if(n&&n!=e.root.activeElement){let r=rre(e.state,t.query.spec);r.valid&&e.dispatch({effects:TN.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Fde.of(!0),t?TN.of(rre(e.state,t.query.spec)):er.appendConfig.of(tdn)]});return!0},Bst=e=>{let t=e.state.field(tb,!1);if(!t||!t.panel)return!1;let n=vN(e,zde);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Fde.of(!1)}),!0},Kun=[{key:"Mod-f",run:zst,scope:"editor search-panel"},{key:"F3",run:BL,shift:UL,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:BL,shift:UL,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Bst,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Yun},{key:"Mod-Alt-g",run:Tun},{key:"Mod-d",run:Bun,preventDefault:!0}];class Jun{constructor(t){this.view=t;let n=this.query=t.state.field(tb).query.spec;this.commit=this.commit.bind(this),this.searchField=ys("input",{value:n.search,placeholder:Yu(t,"Find"),"aria-label":Yu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ys("input",{value:n.replace,placeholder:Yu(t,"Replace"),"aria-label":Yu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ys("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=ys("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=ys("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(a,s,i){return ys("button",{class:"cm-button",name:a,onclick:s,type:"button"},i)}this.dom=ys("div",{onkeydown:a=>this.keydown(a),class:"cm-search"},[this.searchField,r("next",()=>BL(t),[Yu(t,"next")]),r("prev",()=>UL(t),[Yu(t,"previous")]),r("select",()=>Zun(t),[Yu(t,"all")]),ys("label",null,[this.caseField,Yu(t,"match case")]),ys("label",null,[this.reField,Yu(t,"regexp")]),ys("label",null,[this.wordField,Yu(t,"by word")]),...t.state.readOnly?[]:[ys("br"),this.replaceField,r("replace",()=>iEe(t),[Yu(t,"replace")]),r("replaceAll",()=>Xun(t),[Yu(t,"replace all")])],ys("button",{name:"close",onclick:()=>Bst(t),"aria-label":Yu(t,"close"),type:"button"},["×"])])}commit(){let t=new Dst({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:TN.of(t)}))}keydown(t){jrn(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?UL:BL)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),iEe(this.view))}update(t){for(let n of t.transactions)for(let r of n.effects)r.is(TN)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(A_).top}}function Yu(e,t){return e.state.phrase(t)}const YM=30,XM=/[\s\.,:;?!]/;function Bde(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),a=e.state.doc.lineAt(n).to,s=Math.max(r.from,t-YM),i=Math.min(a,n+YM),l=e.state.sliceDoc(s,i);if(s!=r.from){for(let c=0;c<YM;c++)if(!XM.test(l[c+1])&&XM.test(l[c])){l=l.slice(c);break}}if(i!=a){for(let c=l.length-1;c>l.length-YM;c--)if(!XM.test(l[c-1])&&XM.test(l[c])){l=l.slice(0,c);break}}return xt.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}const edn=xt.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),tdn=[tb,tp.low(Gun),edn];class oEe{constructor(t,n,r){this.from=t,this.to=n,this.diagnostic=r}}class r0{constructor(t,n,r){this.diagnostics=t,this.panel=n,this.selected=r}static init(t,n,r){let a=r.facet(NN).markerFilter;a&&(t=a(t,r));let s=t.slice().sort((d,f)=>d.from-f.from||d.to-f.to),i=new ku,l=[],c=0;for(let d=0;;){let f=d==s.length?null:s[d];if(!f&&!l.length)break;let h,p;for(l.length?(h=c,p=l.reduce((g,v)=>Math.min(g,v.to),f&&f.from>h?f.from:1e8)):(h=f.from,p=f.to,l.push(f),d++);d<s.length;){let g=s[d];if(g.from==h&&(g.to>g.from||g.to==h))l.push(g),d++,p=Math.min(g.to,p);else{p=Math.min(g.from,p);break}}let m=pdn(l);if(l.some(g=>g.from==g.to||g.from==g.to-1&&r.doc.lineAt(g.from).to==g.from))i.add(h,h,on.widget({widget:new udn(m),diagnostics:l.slice()}));else{let g=l.reduce((v,x)=>x.markClass?v+" "+x.markClass:v,"");i.add(h,p,on.mark({class:"cm-lintRange cm-lintRange-"+m+g,diagnostics:l.slice(),inclusiveEnd:l.some(v=>v.to>p)}))}c=p;for(let g=0;g<l.length;g++)l[g].to<=c&&l.splice(g--,1)}let u=i.finish();return new r0(u,n,xk(u))}}function xk(e,t=null,n=0){let r=null;return e.between(n,1e9,(a,s,{spec:i})=>{if(!(t&&i.diagnostics.indexOf(t)<0))if(!r)r=new oEe(a,s,t||i.diagnostics[0]);else{if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new oEe(r.from,s,r.diagnostic)}}),r}function ndn(e,t){let n=t.pos,r=t.end||n,a=e.state.facet(NN).hideOn(e,n,r);if(a!=null)return a;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(i=>i.is(Ust))||e.changes.touchesRange(s.from,Math.max(s.to,r)))}function rdn(e,t){return e.field(pd,!1)?t:t.concat(er.appendConfig.of(mdn))}const Ust=er.define(),Ude=er.define(),qst=er.define(),pd=vo.define({create(){return new r0(on.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,a=e.panel;if(e.selected){let s=t.changes.mapPos(e.selected.from,1);r=xk(n,e.selected.diagnostic,s)||xk(n,null,s)}!n.size&&a&&t.state.facet(NN).autoPanel&&(a=null),e=new r0(n,a,r)}for(let n of t.effects)if(n.is(Ust)){let r=t.state.facet(NN).autoPanel?n.value.length?AN.open:null:e.panel;e=r0.init(n.value,r,t.state)}else n.is(Ude)?e=new r0(e.diagnostics,n.value?AN.open:null,e.selected):n.is(qst)&&(e=new r0(e.diagnostics,e.panel,n.value));return e},provide:e=>[yN.from(e,t=>t.panel),xt.decorations.from(e,t=>t.diagnostics)]}),adn=on.mark({class:"cm-lintRange cm-lintRange-active"});function sdn(e,t,n){let{diagnostics:r}=e.state.field(pd),a,s=-1,i=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||n>0)&&(t<u||n<0)))return a=d.diagnostics,s=c,i=u,!1});let l=e.state.facet(NN).tooltipFilter;return a&&l&&(a=l(a,e.state)),a?{pos:s,end:i,above:e.state.doc.lineAt(s).to<i,create(){return{dom:idn(e,a)}}}:null}function idn(e,t){return ys("ul",{class:"cm-tooltip-lint"},t.map(n=>Hst(e,n,!1)))}const odn=e=>{let t=e.state.field(pd,!1);(!t||!t.panel)&&e.dispatch({effects:rdn(e.state,[Ude.of(!0)])});let n=vN(e,AN.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},lEe=e=>{let t=e.state.field(pd,!1);return!t||!t.panel?!1:(e.dispatch({effects:Ude.of(!1)}),!0)},ldn=e=>{let t=e.state.field(pd,!1);if(!t)return!1;let n=e.state.selection.main,r=t.diagnostics.iter(n.to+1);return!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},cdn=[{key:"Mod-Shift-m",run:odn,preventDefault:!0},{key:"F8",run:ldn}],NN=Jt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Dm(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:cEe,tooltipFilter:cEe,needsRefresh:(t,n)=>t?n?r=>t(r)||n(r):t:n,hideOn:(t,n)=>t?n?(r,a,s)=>t(r,a,s)||n(r,a,s):t:n,autoPanel:(t,n)=>t||n})}}});function cEe(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Vst(e){let t=[];if(e)e:for(let{name:n}of e){for(let r=0;r<n.length;r++){let a=n[r];if(/[a-zA-Z]/.test(a)&&!t.some(s=>s.toLowerCase()==a.toLowerCase())){t.push(a);continue e}}t.push("")}return t}function Hst(e,t,n){var r;let a=n?Vst(t.actions):[];return ys("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},ys("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(r=t.actions)===null||r===void 0?void 0:r.map((s,i)=>{let l=!1,c=p=>{if(p.preventDefault(),l)return;l=!0;let m=xk(e.state.field(pd).diagnostics,t);m&&s.apply(e,m.from,m.to)},{name:u}=s,d=a[i]?u.indexOf(a[i]):-1,f=d<0?u:[u.slice(0,d),ys("u",u.slice(d,d+1)),u.slice(d+1)],h=s.markClass?" "+s.markClass:"";return ys("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${a[i]})"`}.`},f)}),t.source&&ys("div",{class:"cm-diagnosticSource"},t.source))}class udn extends qd{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return ys("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class uEe{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Hst(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class AN{constructor(t){this.view=t,this.items=[];let n=a=>{if(a.keyCode==27)lEe(this.view),this.view.focus();else if(a.keyCode==38||a.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(a.keyCode==40||a.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(a.keyCode==36)this.moveSelection(0);else if(a.keyCode==35)this.moveSelection(this.items.length-1);else if(a.keyCode==13)this.view.focus();else if(a.keyCode>=65&&a.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],i=Vst(s.actions);for(let l=0;l<i.length;l++)if(i[l].toUpperCase().charCodeAt(0)==a.keyCode){let c=xk(this.view.state.field(pd).diagnostics,s);c&&s.actions[l].apply(t,c.from,c.to)}}else return;a.preventDefault()},r=a=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(a.target)&&this.moveSelection(s)};this.list=ys("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=ys("div",{class:"cm-panel-lint"},this.list,ys("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>lEe(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(pd).selected;if(!t)return-1;for(let n=0;n<this.items.length;n++)if(this.items[n].diagnostic==t.diagnostic)return n;return-1}update(){let{diagnostics:t,selected:n}=this.view.state.field(pd),r=0,a=!1,s=null,i=new Set;for(t.between(0,this.view.state.doc.length,(l,c,{spec:u})=>{for(let d of u.diagnostics){if(i.has(d))continue;i.add(d);let f=-1,h;for(let p=r;p<this.items.length;p++)if(this.items[p].diagnostic==d){f=p;break}f<0?(h=new uEe(this.view,d),this.items.splice(r,0,h),a=!0):(h=this.items[f],f>r&&(this.items.splice(r,f-r),a=!0)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),s=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)a=!0,this.items.pop();this.items.length==0&&(this.items.push(new uEe(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),a=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let u=c.height/this.list.offsetHeight;l.top<c.top?this.list.scrollTop-=(c.top-l.top)/u:l.bottom>c.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),a&&this.sync()}sync(){let t=this.list.firstChild;function n(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)n();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(pd),r=xk(n.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:qst.of(r)})}static open(t){return new AN(t)}}function ddn(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}function KM(e){return ddn(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const fdn=xt.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:KM("#d11")},".cm-lintRange-warning":{backgroundImage:KM("orange")},".cm-lintRange-info":{backgroundImage:KM("#999")},".cm-lintRange-hint":{backgroundImage:KM("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function hdn(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function pdn(e){let t="hint",n=1;for(let r of e){let a=hdn(r.severity);a>n&&(n=a,t=r.severity)}return t}const mdn=[pd,xt.decorations.compute([pd],e=>{let{selected:t,panel:n}=e.field(pd);return!t||!n||t.from==t.to?on.none:on.set([adn.range(t.from,t.to)])}),man(sdn,{hideOn:ndn}),fdn];var dEe=function(t){t===void 0&&(t={});var{crosshairCursor:n=!1}=t,r=[];t.closeBracketsKeymap!==!1&&(r=r.concat(uin)),t.defaultKeymap!==!1&&(r=r.concat(Eun)),t.searchKeymap!==!1&&(r=r.concat(Kun)),t.historyKeymap!==!1&&(r=r.concat(Rcn)),t.foldKeymap!==!1&&(r=r.concat(Zan)),t.completionKeymap!==!1&&(r=r.concat(Irt)),t.lintKeymap!==!1&&(r=r.concat(cdn));var a=[];return t.lineNumbers!==!1&&a.push(_an()),t.highlightActiveLineGutter!==!1&&a.push(jan()),t.highlightSpecialChars!==!1&&a.push(Vrn()),t.history!==!1&&a.push(kcn()),t.foldGutter!==!1&&a.push(Jan()),t.drawSelection!==!1&&a.push(Prn()),t.dropCursor!==!1&&a.push(Frn()),t.allowMultipleSelections!==!1&&a.push(Ir.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&a.push(Ban()),t.syntaxHighlighting!==!1&&a.push(Jw(rsn,{fallback:!0})),t.bracketMatching!==!1&&a.push(usn()),t.closeBrackets!==!1&&a.push(iin()),t.autocompletion!==!1&&a.push(Art()),t.rectangularSelection!==!1&&a.push(aan()),n!==!1&&a.push(oan()),t.highlightActiveLine!==!1&&a.push(Yrn()),t.highlightSelectionMatches!==!1&&a.push(Run()),t.tabSize&&typeof t.tabSize=="number"&&a.push(j_.of(" ".repeat(t.tabSize))),a.concat([C_.of(r.flat())]).filter(Boolean)};const gdn="#e5c07b",fEe="#e06c75",vdn="#56b6c2",ydn="#ffffff",F2="#abb2bf",are="#7d8799",bdn="#61afef",xdn="#98c379",hEe="#d19a66",wdn="#c678dd",Sdn="#21252b",pEe="#2c313a",mEe="#282c34",$U="#353a42",Odn="#3E4451",gEe="#528bff",kdn=xt.theme({"&":{color:F2,backgroundColor:mEe},".cm-content":{caretColor:gEe},".cm-cursor, .cm-dropCursor":{borderLeftColor:gEe},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Odn},".cm-panels":{backgroundColor:Sdn,color:F2},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:mEe,color:are,border:"none"},".cm-activeLineGutter":{backgroundColor:pEe},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:$U},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:$U,borderBottomColor:$U},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:pEe,color:F2}}},{dark:!0}),_dn=$m.define([{tag:se.keyword,color:wdn},{tag:[se.name,se.deleted,se.character,se.propertyName,se.macroName],color:fEe},{tag:[se.function(se.variableName),se.labelName],color:bdn},{tag:[se.color,se.constant(se.name),se.standard(se.name)],color:hEe},{tag:[se.definition(se.name),se.separator],color:F2},{tag:[se.typeName,se.className,se.number,se.changed,se.annotation,se.modifier,se.self,se.namespace],color:gdn},{tag:[se.operator,se.operatorKeyword,se.url,se.escape,se.regexp,se.link,se.special(se.string)],color:vdn},{tag:[se.meta,se.comment],color:are},{tag:se.strong,fontWeight:"bold"},{tag:se.emphasis,fontStyle:"italic"},{tag:se.strikethrough,textDecoration:"line-through"},{tag:se.link,color:are,textDecoration:"underline"},{tag:se.heading,fontWeight:"bold",color:fEe},{tag:[se.atom,se.bool,se.special(se.variableName)],color:hEe},{tag:[se.processingInstruction,se.string,se.inserted],color:xdn},{tag:se.invalid,color:ydn}]),Edn=[kdn,Jw(_dn)];var Cdn=xt.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),jdn=function(t){t===void 0&&(t={});var{indentWithTab:n=!0,editable:r=!0,readOnly:a=!1,theme:s="light",placeholder:i="",basicSetup:l=!0}=t,c=[];switch(n&&c.unshift(C_.of([Cun])),l&&(typeof l=="boolean"?c.unshift(dEe()):c.unshift(dEe(l))),i&&c.unshift(ean(i)),s){case"light":c.push(Cdn);break;case"dark":c.push(Edn);break;case"none":break;default:c.push(s);break}return r===!1&&c.push(xt.editable.of(!1)),a&&c.push(Ir.readOnly.of(!0)),[...c]},Tdn=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(t=>!t.empty)});class Ndn{constructor(t,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(t)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var t=this.callbacks.slice();this.callbacks.length=0,t.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}let vEe=class{constructor(){this.interval=null,this.latches=new Set}add(t){this.latches.add(t),this.start()}remove(t){this.latches.delete(t),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(t=>{t.tick(),t.isDone&&this.remove(t)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}};var LU=null,Adn=()=>typeof window>"u"?new vEe:(LU||(LU=new vEe),LU),yEe=Mm.define(),Idn=200,Rdn=[];function Pdn(e){var{value:t,selection:n,onChange:r,onStatistics:a,onCreateEditor:s,onUpdate:i,extensions:l=Rdn,autoFocus:c,theme:u="light",height:d=null,minHeight:f=null,maxHeight:h=null,width:p=null,minWidth:m=null,maxWidth:g=null,placeholder:v="",editable:x=!0,readOnly:w=!1,indentWithTab:O=!0,basicSetup:k=!0,root:_,initialState:C}=e,[T,j]=b.useState(),[A,I]=b.useState(),[P,M]=b.useState(),F=b.useState(()=>({current:null}))[0],D=b.useState(()=>({current:null}))[0],U=xt.theme({"&":{height:d,minHeight:f,maxHeight:h,width:p,minWidth:m,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),B=xt.updateListener.of(W=>{if(W.docChanged&&typeof r=="function"&&!W.transactions.some(V=>V.annotation(yEe))){F.current?F.current.reset():(F.current=new Ndn(()=>{if(D.current){var V=D.current;D.current=null,V()}F.current=null},Idn),Adn().add(F.current));var $=W.state.doc,Z=$.toString();r(Z,W)}a&&a(Tdn(W))}),z=jdn({theme:u,editable:x,readOnly:w,placeholder:v,indentWithTab:O,basicSetup:k}),Q=[B,U,...z];return i&&typeof i=="function"&&Q.push(xt.updateListener.of(i)),Q=Q.concat(l),b.useLayoutEffect(()=>{if(T&&!P){var W={doc:t,selection:n,extensions:Q},$=C?Ir.fromJSON(C.json,W,C.fields):Ir.create(W);if(M($),!A){var Z=new xt({state:$,parent:T,root:_});I(Z),s&&s(Z,$)}}return()=>{A&&(M(void 0),I(void 0))}},[T,P]),b.useEffect(()=>{e.container&&j(e.container)},[e.container]),b.useEffect(()=>()=>{A&&(A.destroy(),I(void 0)),F.current&&(F.current.cancel(),F.current=null)},[A]),b.useEffect(()=>{c&&A&&A.focus()},[c,A]),b.useEffect(()=>{A&&A.dispatch({effects:er.reconfigure.of(Q)})},[u,l,d,f,h,p,m,g,v,x,w,O,k,r,i]),b.useEffect(()=>{if(t!==void 0){var W=A?A.state.doc.toString():"";if(A&&t!==W){var $=F.current&&!F.current.isDone,Z=()=>{A&&t!==A.state.doc.toString()&&A.dispatch({changes:{from:0,to:A.state.doc.toString().length,insert:t||""},annotations:[yEe.of(!0)]})};$?D.current=Z:Z()}}},[t,A]),{state:P,setState:M,view:A,setView:I,container:T,setContainer:j}}var Mdn=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Eu=b.forwardRef((e,t)=>{var{className:n,value:r="",selection:a,extensions:s=[],onChange:i,onStatistics:l,onCreateEditor:c,onUpdate:u,autoFocus:d,theme:f="light",height:h,minHeight:p,maxHeight:m,width:g,minWidth:v,maxWidth:x,basicSetup:w,placeholder:O,indentWithTab:k,editable:_,readOnly:C,root:T,initialState:j}=e,A=oue(e,Mdn),I=b.useRef(null),{state:P,view:M,container:F,setContainer:D}=Pdn({root:T,value:r,autoFocus:d,theme:f,height:h,minHeight:p,maxHeight:m,width:g,minWidth:v,maxWidth:x,basicSetup:w,placeholder:O,indentWithTab:k,editable:_,readOnly:C,selection:a,onChange:i,onStatistics:l,onCreateEditor:c,onUpdate:u,extensions:s,initialState:j});b.useImperativeHandle(t,()=>({editor:I.current,state:P,view:M}),[I,F,P,M]);var U=b.useCallback(z=>{I.current=z,D(z)},[D]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var B=typeof f=="string"?"cm-theme-"+f:"cm-theme";return o.jsx("div",Ob({ref:U,className:""+B+(n?" "+n:"")},A))});Eu.displayName="CodeMirror";function Ddn(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const $dn=e=>{switch(e){case"success":return zdn;case"info":return Udn;case"warning":return Bdn;case"error":return qdn;default:return null}},Ldn=Array(12).fill(0),Fdn=({visible:e,className:t})=>Ne.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Ne.createElement("div",{className:"sonner-spinner"},Ldn.map((n,r)=>Ne.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),zdn=Ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ne.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Bdn=Ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ne.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Udn=Ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ne.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),qdn=Ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ne.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Vdn=Ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Ne.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ne.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Hdn=()=>{const[e,t]=Ne.useState(document.hidden);return Ne.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let sre=1;class Qdn{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...a}=t,s=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:sre++,i=this.toasts.find(c=>c.id===s),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(c=>c.id===s?(this.publish({...c,...t,id:s,title:r}),{...c,...t,id:s,dismissible:l,title:r}):c):this.addToast({title:r,...a,dismissible:l,id:s}),s},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const a=Promise.resolve(t instanceof Function?t():t);let s=r!==void 0,i;const l=a.then(async u=>{if(i=["resolve",u],Ne.isValidElement(u))s=!1,this.create({id:r,type:"default",message:u});else if(Gdn(u)&&!u.ok){s=!1;const f=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,h=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,m=typeof f=="object"&&!Ne.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:h,...m})}else if(u instanceof Error){s=!1;const f=typeof n.error=="function"?await n.error(u):n.error,h=typeof n.description=="function"?await n.description(u):n.description,m=typeof f=="object"&&!Ne.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:h,...m})}else if(n.success!==void 0){s=!1;const f=typeof n.success=="function"?await n.success(u):n.success,h=typeof n.description=="function"?await n.description(u):n.description,m=typeof f=="object"&&!Ne.isValidElement(f)?f:{message:f};this.create({id:r,type:"success",description:h,...m})}}).catch(async u=>{if(i=["reject",u],n.error!==void 0){s=!1;const d=typeof n.error=="function"?await n.error(u):n.error,f=typeof n.description=="function"?await n.description(u):n.description,p=typeof d=="object"&&!Ne.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:f,...p})}}).finally(()=>{s&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((u,d)=>l.then(()=>i[0]==="reject"?d(i[1]):u(i[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:c}:Object.assign(r,{unwrap:c})},this.custom=(t,n)=>{const r=n?.id||sre++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Xc=new Qdn,Wdn=(e,t)=>{const n=t?.id||sre++;return Xc.addToast({title:e,...t,id:n}),n},Gdn=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Zdn=Wdn,Ydn=()=>Xc.toasts,Xdn=()=>Xc.getActiveToasts(),Gl=Object.assign(Zdn,{success:Xc.success,info:Xc.info,warning:Xc.warning,error:Xc.error,custom:Xc.custom,message:Xc.message,promise:Xc.promise,dismiss:Xc.dismiss,loading:Xc.loading},{getHistory:Ydn,getToasts:Xdn});Ddn("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function JM(e){return e.label!==void 0}const Kdn=3,Jdn="24px",efn="16px",bEe=4e3,tfn=356,nfn=14,rfn=45,afn=200;function Op(...e){return e.filter(Boolean).join(" ")}function sfn(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const ifn=e=>{var t,n,r,a,s,i,l,c,u;const{invert:d,toast:f,unstyled:h,interacting:p,setHeights:m,visibleToasts:g,heights:v,index:x,toasts:w,expanded:O,removeToast:k,defaultRichColors:_,closeButton:C,style:T,cancelButtonStyle:j,actionButtonStyle:A,className:I="",descriptionClassName:P="",duration:M,position:F,gap:D,expandByDefault:U,classNames:B,icons:z,closeButtonAriaLabel:Q="Close toast"}=e,[W,$]=Ne.useState(null),[Z,V]=Ne.useState(null),[R,H]=Ne.useState(!1),[G,J]=Ne.useState(!1),[ie,ne]=Ne.useState(!1),[ae,le]=Ne.useState(!1),[fe,X]=Ne.useState(!1),[re,oe]=Ne.useState(0),[ge,ce]=Ne.useState(0),ue=Ne.useRef(f.duration||M||bEe),we=Ne.useRef(null),Ee=Ne.useRef(null),Me=x===0,K=x+1<=g,te=f.type,me=f.dismissible!==!1,Te=f.className||"",Pe=f.descriptionClassName||"",pe=Ne.useMemo(()=>v.findIndex(st=>st.toastId===f.id)||0,[v,f.id]),ke=Ne.useMemo(()=>{var st;return(st=f.closeButton)!=null?st:C},[f.closeButton,C]),he=Ne.useMemo(()=>f.duration||M||bEe,[f.duration,M]),Ce=Ne.useRef(0),$e=Ne.useRef(0),it=Ne.useRef(0),yt=Ne.useRef(null),[Gt,Ue]=F.split("-"),Ve=Ne.useMemo(()=>v.reduce((st,Ht,jn)=>jn>=pe?st:st+Ht.height,0),[v,pe]),Re=Hdn(),Se=f.invert||d,Ie=te==="loading";$e.current=Ne.useMemo(()=>pe*D+Ve,[pe,Ve]),Ne.useEffect(()=>{ue.current=he},[he]),Ne.useEffect(()=>{H(!0)},[]),Ne.useEffect(()=>{const st=Ee.current;if(st){const Ht=st.getBoundingClientRect().height;return ce(Ht),m(jn=>[{toastId:f.id,height:Ht,position:f.position},...jn]),()=>m(jn=>jn.filter(nn=>nn.toastId!==f.id))}},[m,f.id]),Ne.useLayoutEffect(()=>{if(!R)return;const st=Ee.current,Ht=st.style.height;st.style.height="auto";const jn=st.getBoundingClientRect().height;st.style.height=Ht,ce(jn),m(nn=>nn.find($n=>$n.toastId===f.id)?nn.map($n=>$n.toastId===f.id?{...$n,height:jn}:$n):[{toastId:f.id,height:jn,position:f.position},...nn])},[R,f.title,f.description,m,f.id,f.jsx,f.action,f.cancel]);const Qe=Ne.useCallback(()=>{J(!0),oe($e.current),m(st=>st.filter(Ht=>Ht.toastId!==f.id)),setTimeout(()=>{k(f)},afn)},[f,k,m,$e]);Ne.useEffect(()=>{if(f.promise&&te==="loading"||f.duration===1/0||f.type==="loading")return;let st;return O||p||Re?(()=>{if(it.current<Ce.current){const nn=new Date().getTime()-Ce.current;ue.current=ue.current-nn}it.current=new Date().getTime()})():ue.current!==1/0&&(Ce.current=new Date().getTime(),st=setTimeout(()=>{f.onAutoClose==null||f.onAutoClose.call(f,f),Qe()},ue.current)),()=>clearTimeout(st)},[O,p,f,te,Re,Qe]),Ne.useEffect(()=>{f.delete&&(Qe(),f.onDismiss==null||f.onDismiss.call(f,f))},[Qe,f.delete]);function et(){var st;if(z?.loading){var Ht;return Ne.createElement("div",{className:Op(B?.loader,f==null||(Ht=f.classNames)==null?void 0:Ht.loader,"sonner-loader"),"data-visible":te==="loading"},z.loading)}return Ne.createElement(Fdn,{className:Op(B?.loader,f==null||(st=f.classNames)==null?void 0:st.loader),visible:te==="loading"})}const lt=f.icon||z?.[te]||$dn(te);var an,Rn;return Ne.createElement("li",{tabIndex:0,ref:Ee,className:Op(I,Te,B?.toast,f==null||(t=f.classNames)==null?void 0:t.toast,B?.default,B?.[te],f==null||(n=f.classNames)==null?void 0:n[te]),"data-sonner-toast":"","data-rich-colors":(an=f.richColors)!=null?an:_,"data-styled":!(f.jsx||f.unstyled||h),"data-mounted":R,"data-promise":!!f.promise,"data-swiped":fe,"data-removed":G,"data-visible":K,"data-y-position":Gt,"data-x-position":Ue,"data-index":x,"data-front":Me,"data-swiping":ie,"data-dismissible":me,"data-type":te,"data-invert":Se,"data-swipe-out":ae,"data-swipe-direction":Z,"data-expanded":!!(O||U&&R),"data-testid":f.testId,style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${G?re:$e.current}px`,"--initial-height":U?"auto":`${ge}px`,...T,...f.style},onDragEnd:()=>{ne(!1),$(null),yt.current=null},onPointerDown:st=>{st.button!==2&&(Ie||!me||(we.current=new Date,oe($e.current),st.target.setPointerCapture(st.pointerId),st.target.tagName!=="BUTTON"&&(ne(!0),yt.current={x:st.clientX,y:st.clientY})))},onPointerUp:()=>{var st,Ht,jn;if(ae||!me)return;yt.current=null;const nn=Number(((st=Ee.current)==null?void 0:st.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Nr=Number(((Ht=Ee.current)==null?void 0:Ht.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),$n=new Date().getTime()-((jn=we.current)==null?void 0:jn.getTime()),Nt=W==="x"?nn:Nr,mr=Math.abs(Nt)/$n;if(Math.abs(Nt)>=rfn||mr>.11){oe($e.current),f.onDismiss==null||f.onDismiss.call(f,f),V(W==="x"?nn>0?"right":"left":Nr>0?"down":"up"),Qe(),le(!0);return}else{var En,Oe;(En=Ee.current)==null||En.style.setProperty("--swipe-amount-x","0px"),(Oe=Ee.current)==null||Oe.style.setProperty("--swipe-amount-y","0px")}X(!1),ne(!1),$(null)},onPointerMove:st=>{var Ht,jn,nn;if(!yt.current||!me||((Ht=window.getSelection())==null?void 0:Ht.toString().length)>0)return;const $n=st.clientY-yt.current.y,Nt=st.clientX-yt.current.x;var mr;const En=(mr=e.swipeDirections)!=null?mr:sfn(F);!W&&(Math.abs(Nt)>1||Math.abs($n)>1)&&$(Math.abs(Nt)>Math.abs($n)?"x":"y");let Oe={x:0,y:0};const De=Be=>1/(1.5+Math.abs(Be)/20);if(W==="y"){if(En.includes("top")||En.includes("bottom"))if(En.includes("top")&&$n<0||En.includes("bottom")&&$n>0)Oe.y=$n;else{const Be=$n*De($n);Oe.y=Math.abs(Be)<Math.abs($n)?Be:$n}}else if(W==="x"&&(En.includes("left")||En.includes("right")))if(En.includes("left")&&Nt<0||En.includes("right")&&Nt>0)Oe.x=Nt;else{const Be=Nt*De(Nt);Oe.x=Math.abs(Be)<Math.abs(Nt)?Be:Nt}(Math.abs(Oe.x)>0||Math.abs(Oe.y)>0)&&X(!0),(jn=Ee.current)==null||jn.style.setProperty("--swipe-amount-x",`${Oe.x}px`),(nn=Ee.current)==null||nn.style.setProperty("--swipe-amount-y",`${Oe.y}px`)}},ke&&!f.jsx&&te!=="loading"?Ne.createElement("button",{"aria-label":Q,"data-disabled":Ie,"data-close-button":!0,onClick:Ie||!me?()=>{}:()=>{Qe(),f.onDismiss==null||f.onDismiss.call(f,f)},className:Op(B?.closeButton,f==null||(r=f.classNames)==null?void 0:r.closeButton)},(Rn=z?.close)!=null?Rn:Vdn):null,(te||f.icon||f.promise)&&f.icon!==null&&(z?.[te]!==null||f.icon)?Ne.createElement("div",{"data-icon":"",className:Op(B?.icon,f==null||(a=f.classNames)==null?void 0:a.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||et():null,f.type!=="loading"?lt:null):null,Ne.createElement("div",{"data-content":"",className:Op(B?.content,f==null||(s=f.classNames)==null?void 0:s.content)},Ne.createElement("div",{"data-title":"",className:Op(B?.title,f==null||(i=f.classNames)==null?void 0:i.title)},f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title),f.description?Ne.createElement("div",{"data-description":"",className:Op(P,Pe,B?.description,f==null||(l=f.classNames)==null?void 0:l.description)},typeof f.description=="function"?f.description():f.description):null),Ne.isValidElement(f.cancel)?f.cancel:f.cancel&&JM(f.cancel)?Ne.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||j,onClick:st=>{JM(f.cancel)&&me&&(f.cancel.onClick==null||f.cancel.onClick.call(f.cancel,st),Qe())},className:Op(B?.cancelButton,f==null||(c=f.classNames)==null?void 0:c.cancelButton)},f.cancel.label):null,Ne.isValidElement(f.action)?f.action:f.action&&JM(f.action)?Ne.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||A,onClick:st=>{JM(f.action)&&(f.action.onClick==null||f.action.onClick.call(f.action,st),!st.defaultPrevented&&Qe())},className:Op(B?.actionButton,f==null||(u=f.classNames)==null?void 0:u.actionButton)},f.action.label):null)};function xEe(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function ofn(e,t){const n={};return[e,t].forEach((r,a)=>{const s=a===1,i=s?"--mobile-offset":"--offset",l=s?efn:Jdn;function c(u){["top","right","bottom","left"].forEach(d=>{n[`${i}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${i}-${u}`]=l:n[`${i}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):c(l)}),n}const Qst=Ne.forwardRef(function(t,n){const{id:r,invert:a,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:l,closeButton:c,className:u,offset:d,mobileOffset:f,theme:h="light",richColors:p,duration:m,style:g,visibleToasts:v=Kdn,toastOptions:x,dir:w=xEe(),gap:O=nfn,icons:k,containerAriaLabel:_="Notifications"}=t,[C,T]=Ne.useState([]),j=Ne.useMemo(()=>r?C.filter(R=>R.toasterId===r):C.filter(R=>!R.toasterId),[C,r]),A=Ne.useMemo(()=>Array.from(new Set([s].concat(j.filter(R=>R.position).map(R=>R.position)))),[j,s]),[I,P]=Ne.useState([]),[M,F]=Ne.useState(!1),[D,U]=Ne.useState(!1),[B,z]=Ne.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Q=Ne.useRef(null),W=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=Ne.useRef(null),Z=Ne.useRef(!1),V=Ne.useCallback(R=>{T(H=>{var G;return(G=H.find(J=>J.id===R.id))!=null&&G.delete||Xc.dismiss(R.id),H.filter(({id:J})=>J!==R.id)})},[]);return Ne.useEffect(()=>Xc.subscribe(R=>{if(R.dismiss){requestAnimationFrame(()=>{T(H=>H.map(G=>G.id===R.id?{...G,delete:!0}:G))});return}setTimeout(()=>{Ble.flushSync(()=>{T(H=>{const G=H.findIndex(J=>J.id===R.id);return G!==-1?[...H.slice(0,G),{...H[G],...R},...H.slice(G+1)]:[R,...H]})})})}),[C]),Ne.useEffect(()=>{if(h!=="system"){z(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;const R=window.matchMedia("(prefers-color-scheme: dark)");try{R.addEventListener("change",({matches:H})=>{z(H?"dark":"light")})}catch{R.addListener(({matches:G})=>{try{z(G?"dark":"light")}catch(J){console.error(J)}})}},[h]),Ne.useEffect(()=>{C.length<=1&&F(!1)},[C]),Ne.useEffect(()=>{const R=H=>{var G;if(i.every(ne=>H[ne]||H.code===ne)){var ie;F(!0),(ie=Q.current)==null||ie.focus()}H.code==="Escape"&&(document.activeElement===Q.current||(G=Q.current)!=null&&G.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i]),Ne.useEffect(()=>{if(Q.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,Z.current=!1)}},[Q.current]),Ne.createElement("section",{ref:n,"aria-label":`${_} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((R,H)=>{var G;const[J,ie]=R.split("-");return j.length?Ne.createElement("ol",{key:R,dir:w==="auto"?xEe():w,tabIndex:-1,ref:Q,className:u,"data-sonner-toaster":!0,"data-sonner-theme":B,"data-y-position":J,"data-x-position":ie,style:{"--front-toast-height":`${((G=I[0])==null?void 0:G.height)||0}px`,"--width":`${tfn}px`,"--gap":`${O}px`,...g,...ofn(d,f)},onBlur:ne=>{Z.current&&!ne.currentTarget.contains(ne.relatedTarget)&&(Z.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||Z.current||(Z.current=!0,$.current=ne.relatedTarget)},onMouseEnter:()=>F(!0),onMouseMove:()=>F(!0),onMouseLeave:()=>{D||F(!1)},onDragEnd:()=>F(!1),onPointerDown:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||U(!0)},onPointerUp:()=>U(!1)},j.filter(ne=>!ne.position&&H===0||ne.position===R).map((ne,ae)=>{var le,fe;return Ne.createElement(ifn,{key:ne.id,icons:k,index:ae,toast:ne,defaultRichColors:p,duration:(le=x?.duration)!=null?le:m,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:a,visibleToasts:v,closeButton:(fe=x?.closeButton)!=null?fe:c,interacting:D,position:R,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:V,toasts:j.filter(X=>X.position==ne.position),heights:I.filter(X=>X.position==ne.position),setHeights:P,expandByDefault:l,gap:O,expanded:M,swipeDirections:t.swipeDirections})})):null}))});function lfn(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function cfn(e,t,n){const a=K6((n||{}).ignore||[]),s=ufn(t);let i=-1;for(;++i<s.length;)ptt(e,"text",l);function l(u,d){let f=-1,h;for(;++f<d.length;){const p=d[f],m=h?h.children:void 0;if(a(p,m?m.indexOf(p):void 0,h))return;h=p}if(h)return c(u,d)}function c(u,d){const f=d[d.length-1],h=s[i][0],p=s[i][1];let m=0;const v=f.children.indexOf(u);let x=!1,w=[];h.lastIndex=0;let O=h.exec(u.value);for(;O;){const k=O.index,_={index:O.index,input:O.input,stack:[...d,u]};let C=p(...O,_);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?h.lastIndex=k+1:(m!==k&&w.push({type:"text",value:u.value.slice(m,k)}),Array.isArray(C)?w.push(...C):C&&w.push(C),m=k+O[0].length,x=!0),!h.global)break;O=h.exec(u.value)}return x?(m<u.value.length&&w.push({type:"text",value:u.value.slice(m)}),f.children.splice(v,1,...w)):w=[u],v+w.length}}function ufn(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([dfn(a[0]),ffn(a[1])])}return t}function dfn(e){return typeof e=="string"?new RegExp(lfn(e),"g"):e}function ffn(e){return typeof e=="function"?e:function(){return e}}const FU="phrasing",zU=["autolink","link","image","label"];function hfn(){return{transforms:[xfn],enter:{literalAutolink:mfn,literalAutolinkEmail:BU,literalAutolinkHttp:BU,literalAutolinkWww:BU},exit:{literalAutolink:bfn,literalAutolinkEmail:yfn,literalAutolinkHttp:gfn,literalAutolinkWww:vfn}}}function pfn(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:FU,notInConstruct:zU},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:FU,notInConstruct:zU},{character:":",before:"[ps]",after:"\\/",inConstruct:FU,notInConstruct:zU}]}}function mfn(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function BU(e){this.config.enter.autolinkProtocol.call(this,e)}function gfn(e){this.config.exit.autolinkProtocol.call(this,e)}function vfn(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function yfn(e){this.config.exit.autolinkEmail.call(this,e)}function bfn(e){this.exit(e)}function xfn(e){cfn(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,wfn],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Sfn]],{ignore:["link","linkReference"]})}function wfn(e,t,n,r,a){let s="";if(!Wst(a)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!Ofn(n)))return!1;const i=kfn(n+r);if(!i[0])return!1;const l={type:"link",title:null,url:s+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[l,{type:"text",value:i[1]}]:l}function Sfn(e,t,n,r){return!Wst(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Ofn(e){const 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 kfn(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=o1e(e,"(");let s=o1e(e,")");for(;r!==-1&&a>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Wst(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||X0(n)||Z6(n))&&(!t||n!==47)}Gst.peek=Rfn;function _fn(){this.buffer()}function Efn(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Cfn(){this.buffer()}function jfn(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Tfn(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Lh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Nfn(e){this.exit(e)}function Afn(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Lh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ifn(e){this.exit(e)}function Rfn(){return"["}function Gst(e,t,n,r){const a=n.createTracker(r);let s=a.move("[^");const i=n.enter("footnoteReference"),l=n.enter("reference");return s+=a.move(n.safe(n.associationId(e),{after:"]",before:s})),l(),i(),s+=a.move("]"),s}function Pfn(){return{enter:{gfmFootnoteCallString:_fn,gfmFootnoteCall:Efn,gfmFootnoteDefinitionLabelString:Cfn,gfmFootnoteDefinition:jfn},exit:{gfmFootnoteCallString:Tfn,gfmFootnoteCall:Nfn,gfmFootnoteDefinitionLabelString:Afn,gfmFootnoteDefinition:Ifn}}}function Mfn(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Gst},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,s,i){const l=s.createTracker(i);let c=l.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return c+=l.move(s.safe(s.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?`
|
|
217
217
|
`:" ")+s.indentLines(s.containerFlow(r,l.current()),t?Zst:Dfn))),u(),c}}function Dfn(e,t,n){return t===0?e:Zst(e,t,n)}function Zst(e,t,n){return(n?"":" ")+e}const $fn=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Yst.peek=Ufn;function Lfn(){return{canContainEols:["delete"],enter:{strikethrough:zfn},exit:{strikethrough:Bfn}}}function Ffn(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$fn}],handlers:{delete:Yst}}}function zfn(e){this.enter({type:"delete",children:[]},e)}function Bfn(e){this.exit(e)}function Yst(e,t,n,r){const a=n.createTracker(r),s=n.enter("strikethrough");let i=a.move("~~");return i+=n.containerPhrasing(e,{...a.current(),before:i,after:"~"}),i+=a.move("~~"),s(),i}function Ufn(){return"~"}function qfn(e){return e.length}function Vfn(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||qfn,s=[],i=[],l=[],c=[];let u=0,d=-1;for(;++d<e.length;){const g=[],v=[];let x=-1;for(e[d].length>u&&(u=e[d].length);++x<e[d].length;){const w=Hfn(e[d][x]);if(n.alignDelimiters!==!1){const O=a(w);v[x]=O,(c[x]===void 0||O>c[x])&&(c[x]=O)}g.push(w)}i[d]=g,l[d]=v}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)s[f]=wEe(r[f]);else{const g=wEe(r);for(;++f<u;)s[f]=g}f=-1;const h=[],p=[];for(;++f<u;){const g=s[f];let v="",x="";g===99?(v=":",x=":"):g===108?v=":":g===114&&(x=":");let w=n.alignDelimiters===!1?1:Math.max(1,c[f]-v.length-x.length);const O=v+"-".repeat(w)+x;n.alignDelimiters!==!1&&(w=v.length+w+x.length,w>c[f]&&(c[f]=w),p[f]=w),h[f]=O}i.splice(1,0,h),l.splice(1,0,p),d=-1;const m=[];for(;++d<i.length;){const g=i[d],v=l[d];f=-1;const x=[];for(;++f<u;){const w=g[f]||"";let O="",k="";if(n.alignDelimiters!==!1){const _=c[f]-(v[f]||0),C=s[f];C===114?O=" ".repeat(_):C===99?_%2?(O=" ".repeat(_/2+.5),k=" ".repeat(_/2-.5)):(O=" ".repeat(_/2),k=O):k=" ".repeat(_)}n.delimiterStart!==!1&&!f&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||f)&&x.push(" "),n.alignDelimiters!==!1&&x.push(O),x.push(w),n.alignDelimiters!==!1&&x.push(k),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&x.push("|")}m.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return m.join(`
|
|
218
218
|
`)}function Hfn(e){return e==null?"":String(e)}function wEe(e){const 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}function Qfn(e,t,n,r){const a=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const i=n.indentLines(n.containerFlow(e,s.current()),Wfn);return a(),i}function Wfn(e,t,n){return">"+(n?"":" ")+e}function Gfn(e,t){return SEe(e,t.inConstruct,!0)&&!SEe(e,t.notInConstruct,!1)}function SEe(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function OEe(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
|
|
@@ -458,7 +458,7 @@ ${J.current.stack}
|
|
|
458
458
|
`&&(I=`
|
|
459
459
|
`);var W=0,$=!1;this.parse=function(Z,V,R){if(typeof Z!="string")throw new Error("Input must be a string");var H=Z.length,G=A.length,J=I.length,ie=P.length,ne=T(M),ae=[],le=[],fe=[],X=W=0;if(!Z)return Te();if(D||D!==!1&&Z.indexOf(z)===-1){for(var re=Z.split(I),oe=0;oe<re.length;oe++){if(fe=re[oe],W+=fe.length,oe!==re.length-1)W+=I.length;else if(R)return Te();if(!P||fe.substring(0,ie)!==P){if(ne){if(ae=[],Me(fe.split(A)),Pe(),$)return Te()}else Me(fe.split(A));if(F&&F<=oe)return ae=ae.slice(0,F),Te(!0)}}return Te()}for(var ge=Z.indexOf(A,W),ce=Z.indexOf(I,W),ue=new RegExp(v(Q)+v(z),"g"),we=Z.indexOf(z,W);;)if(Z[W]===z)for(we=W,W++;;){if((we=Z.indexOf(z,we+1))===-1)return R||le.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:ae.length,index:W}),te();if(we===H-1)return te(Z.substring(W,we).replace(ue,z));if(z===Q&&Z[we+1]===Q)we++;else if(z===Q||we===0||Z[we-1]!==Q){ge!==-1&&ge<we+1&&(ge=Z.indexOf(A,we+1));var Ee=K((ce=ce!==-1&&ce<we+1?Z.indexOf(I,we+1):ce)===-1?ge:Math.min(ge,ce));if(Z.substr(we+1+Ee,G)===A){fe.push(Z.substring(W,we).replace(ue,z)),Z[W=we+1+Ee+G]!==z&&(we=Z.indexOf(z,W)),ge=Z.indexOf(A,W),ce=Z.indexOf(I,W);break}if(Ee=K(ce),Z.substring(we+1+Ee,we+1+Ee+J)===I){if(fe.push(Z.substring(W,we).replace(ue,z)),me(we+1+Ee+J),ge=Z.indexOf(A,W),we=Z.indexOf(z,W),ne&&(Pe(),$))return Te();if(F&&ae.length>=F)return Te(!0);break}le.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:ae.length,index:W}),we++}}else if(P&&fe.length===0&&Z.substring(W,W+ie)===P){if(ce===-1)return Te();W=ce+J,ce=Z.indexOf(I,W),ge=Z.indexOf(A,W)}else if(ge!==-1&&(ge<ce||ce===-1))fe.push(Z.substring(W,ge)),W=ge+G,ge=Z.indexOf(A,W);else{if(ce===-1)break;if(fe.push(Z.substring(W,ce)),me(ce+J),ne&&(Pe(),$))return Te();if(F&&ae.length>=F)return Te(!0)}return te();function Me(pe){ae.push(pe),X=W}function K(pe){var ke=0;return ke=pe!==-1&&(pe=Z.substring(we+1,pe))&&pe.trim()===""?pe.length:ke}function te(pe){return R||(pe===void 0&&(pe=Z.substring(W)),fe.push(pe),W=H,Me(fe),ne&&Pe()),Te()}function me(pe){W=pe,Me(fe),fe=[],ce=Z.indexOf(I,W)}function Te(pe){if(j.header&&!V&&ae.length&&!B){var ke=ae[0],he=Object.create(null),Ce=new Set(ke);let $e=!1;for(let it=0;it<ke.length;it++){let yt=ke[it];if(he[yt=T(j.transformHeader)?j.transformHeader(yt,it):yt]){let Gt,Ue=he[yt];for(;Gt=yt+"_"+Ue,Ue++,Ce.has(Gt););Ce.add(Gt),ke[it]=Gt,he[yt]++,$e=!0,(U=U===null?{}:U)[Gt]=yt}else he[yt]=1,ke[it]=yt;Ce.add(yt)}$e&&console.warn("Duplicate headers found and renamed."),B=!0}return{data:ae,errors:le,meta:{delimiter:A,linebreak:I,aborted:$,truncated:!!pe,cursor:X+(V||0),renamedHeaders:U}}}function Pe(){M(Te()),ae=[],le=[]}},this.abort=function(){$=!0},this.getCharIndex=function(){return W}}function w(j){var A=j.data,I=l[A.workerId],P=!1;if(A.error)I.userError(A.error,A.file);else if(A.results&&A.results.data){var M={abort:function(){P=!0,O(A.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:k,resume:k};if(T(I.userStep)){for(var F=0;F<A.results.data.length&&(I.userStep({data:A.results.data[F],errors:A.results.errors,meta:A.results.meta},M),!P);F++);delete A.results}else T(I.userChunk)&&(I.userChunk(A.results,M,A.file),delete A.results)}A.finished&&!P&&O(A.workerId,A.results)}function O(j,A){var I=l[j];T(I.userComplete)&&I.userComplete(A),I.terminate(),delete l[j]}function k(){throw new Error("Not implemented.")}function _(j){if(typeof j!="object"||j===null)return j;var A,I=Array.isArray(j)?[]:{};for(A in j)I[A]=_(j[A]);return I}function C(j,A){return function(){j.apply(A,arguments)}}function T(j){return typeof j=="function"}return u.parse=function(j,A){var I=(A=A||{}).dynamicTyping||!1;if(T(I)&&(A.dynamicTypingFunction=I,I={}),A.dynamicTyping=I,A.transform=!!T(A.transform)&&A.transform,!A.worker||!u.WORKERS_SUPPORTED)return I=null,u.NODE_STREAM_INPUT,typeof j=="string"?(j=(P=>P.charCodeAt(0)!==65279?P:P.slice(1))(j),I=new(A.download?f:p)(A)):j.readable===!0&&T(j.read)&&T(j.on)?I=new m(A):(r.File&&j instanceof File||j instanceof Object)&&(I=new h(A)),I.stream(j);(I=(()=>{var P;return!!u.WORKERS_SUPPORTED&&(P=(()=>{var M=r.URL||r.webkitURL||null,F=n.toString();return u.BLOB_URL||(u.BLOB_URL=M.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",F,")();"],{type:"text/javascript"})))})(),(P=new r.Worker(P)).onmessage=w,P.id=c++,l[P.id]=P)})()).userStep=A.step,I.userChunk=A.chunk,I.userComplete=A.complete,I.userError=A.error,A.step=T(A.step),A.chunk=T(A.chunk),A.complete=T(A.complete),A.error=T(A.error),delete A.worker,I.postMessage({input:j,config:A,workerId:I.id})},u.unparse=function(j,A){var I=!1,P=!0,M=",",F=`\r
|
|
460
460
|
`,D='"',U=D+D,B=!1,z=null,Q=!1,W=((()=>{if(typeof A=="object"){if(typeof A.delimiter!="string"||u.BAD_DELIMITERS.filter(function(V){return A.delimiter.indexOf(V)!==-1}).length||(M=A.delimiter),typeof A.quotes!="boolean"&&typeof A.quotes!="function"&&!Array.isArray(A.quotes)||(I=A.quotes),typeof A.skipEmptyLines!="boolean"&&typeof A.skipEmptyLines!="string"||(B=A.skipEmptyLines),typeof A.newline=="string"&&(F=A.newline),typeof A.quoteChar=="string"&&(D=A.quoteChar),typeof A.header=="boolean"&&(P=A.header),Array.isArray(A.columns)){if(A.columns.length===0)throw new Error("Option columns is empty");z=A.columns}A.escapeChar!==void 0&&(U=A.escapeChar+D),A.escapeFormulae instanceof RegExp?Q=A.escapeFormulae:typeof A.escapeFormulae=="boolean"&&A.escapeFormulae&&(Q=/^[=+\-@\t\r].*$/)}})(),new RegExp(v(D),"g"));if(typeof j=="string"&&(j=JSON.parse(j)),Array.isArray(j)){if(!j.length||Array.isArray(j[0]))return $(null,j,B);if(typeof j[0]=="object")return $(z||Object.keys(j[0]),j,B)}else if(typeof j=="object")return typeof j.data=="string"&&(j.data=JSON.parse(j.data)),Array.isArray(j.data)&&(j.fields||(j.fields=j.meta&&j.meta.fields||z),j.fields||(j.fields=Array.isArray(j.data[0])?j.fields:typeof j.data[0]=="object"?Object.keys(j.data[0]):[]),Array.isArray(j.data[0])||typeof j.data[0]=="object"||(j.data=[j.data])),$(j.fields||[],j.data||[],B);throw new Error("Unable to serialize unrecognized input");function $(V,R,H){var G="",J=(typeof V=="string"&&(V=JSON.parse(V)),typeof R=="string"&&(R=JSON.parse(R)),Array.isArray(V)&&0<V.length),ie=!Array.isArray(R[0]);if(J&&P){for(var ne=0;ne<V.length;ne++)0<ne&&(G+=M),G+=Z(V[ne],ne);0<R.length&&(G+=F)}for(var ae=0;ae<R.length;ae++){var le=(J?V:R[ae]).length,fe=!1,X=J?Object.keys(R[ae]).length===0:R[ae].length===0;if(H&&!J&&(fe=H==="greedy"?R[ae].join("").trim()==="":R[ae].length===1&&R[ae][0].length===0),H==="greedy"&&J){for(var re=[],oe=0;oe<le;oe++){var ge=ie?V[oe]:oe;re.push(R[ae][ge])}fe=re.join("").trim()===""}if(!fe){for(var ce=0;ce<le;ce++){0<ce&&!X&&(G+=M);var ue=J&&ie?V[ce]:ce;G+=Z(R[ae][ue],ce)}ae<R.length-1&&(!H||0<le&&!X)&&(G+=F)}}return G}function Z(V,R){var H,G;return V==null?"":V.constructor===Date?JSON.stringify(V).slice(1,25):(G=!1,Q&&typeof V=="string"&&Q.test(V)&&(V="'"+V,G=!0),H=V.toString().replace(W,U),(G=G||I===!0||typeof I=="function"&&I(V,R)||Array.isArray(I)&&I[R]||((J,ie)=>{for(var ne=0;ne<ie.length;ne++)if(-1<J.indexOf(ie[ne]))return!0;return!1})(H,u.BAD_DELIMITERS)||-1<H.indexOf(M)||H.charAt(0)===" "||H.charAt(H.length-1)===" ")?D+H+D:H)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
|
|
461
|
-
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!s&&!!r.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=x,u.ParserHandle=g,u.NetworkStreamer=f,u.FileStreamer=h,u.StringStreamer=p,u.ReadableStreamStreamer=m,r.jQuery&&((a=r.jQuery).fn.parse=function(j){var A=j.config||{},I=[];return this.each(function(F){if(!(a(this).prop("tagName").toUpperCase()==="INPUT"&&a(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var D=0;D<this.files.length;D++)I.push({file:this.files[D],inputElem:this,instanceConfig:a.extend({},A)})}),P(),this;function P(){if(I.length===0)T(j.complete)&&j.complete();else{var F,D,U,B,z=I[0];if(T(j.before)){var Q=j.before(z.file,z.inputElem);if(typeof Q=="object"){if(Q.action==="abort")return F="AbortError",D=z.file,U=z.inputElem,B=Q.reason,void(T(j.error)&&j.error({name:F},D,U,B));if(Q.action==="skip")return void M();typeof Q.config=="object"&&(z.instanceConfig=a.extend(z.instanceConfig,Q.config))}else if(Q==="skip")return void M()}var W=z.instanceConfig.complete;z.instanceConfig.complete=function($){T(W)&&W($,z.file,z.inputElem),M()},u.parse(z.file,z.instanceConfig)}}function M(){I.splice(0,1),P()}}),i&&(r.onmessage=function(j){j=j.data,u.WORKER_ID===void 0&&j&&(u.WORKER_ID=j.workerId),typeof j.input=="string"?r.postMessage({workerId:u.WORKER_ID,results:u.parse(j.input,j.config),finished:!0}):(r.File&&j.input instanceof File||j.input instanceof Object)&&(j=u.parse(j.input,j.config))&&r.postMessage({workerId:u.WORKER_ID,results:j,finished:!0})}),(f.prototype=Object.create(d.prototype)).constructor=f,(h.prototype=Object.create(d.prototype)).constructor=h,(p.prototype=Object.create(p.prototype)).constructor=p,(m.prototype=Object.create(d.prototype)).constructor=m,u})})(s$)),s$.exports}var Der=Mer();const Syt=mo(Der);function Oyt(e){const t=e;if(t._def?.typeName)return t._def.typeName;const n=t._def?.type;if(typeof n=="string"&&n)return"Zod"+n.charAt(0).toUpperCase()+n.slice(1)}function $er(e,t){const n=e;if(t==="ZodNullable"||t==="ZodOptional"||t==="ZodDefault")return n._zod?.def?.innerType??n._def?.innerType;if(t==="ZodEffects")return n._zod?.def?.schema??n._def?.schema;if(t==="ZodBranded")return n._zod?.def?.type??n._def?.type}var kyt=La(["LIVE","TEST"]),_yt=La(["AGENT","WORKFLOW",...Object.values(Zme)]);je({description:be(),prompt:be()});var wA=qr(be(),zr()),au=wA.optional(),Ler=je({runId:be().optional(),input:zr().optional(),output:zr(),additionalContext:au,requestContext:au});je({runId:be().optional(),scorer:wA,input:zr(),output:zr(),metadata:au,additionalContext:au,source:kyt,entity:wA,entityType:_yt,requestContext:au,structuredOutput:Ps().optional(),traceId:be().optional(),spanId:be().optional(),resourceId:be().optional(),threadId:be().optional()});var Fer=_n();je({result:au,score:Fer,prompt:be().optional()});var zer=Ler.extend({runId:be(),extractStepResult:au,extractPrompt:be().optional()}),Ber=zer.extend({score:_n(),analyzeStepResult:au,analyzePrompt:be().optional()});Ber.extend({reason:be().optional(),reasonPrompt:be().optional()});var Yme=je({id:be(),scorerId:be(),entityId:be(),runId:be(),input:zr().optional(),output:zr(),additionalContext:au,requestContext:au,extractStepResult:au,extractPrompt:be().optional(),score:_n(),analyzeStepResult:au,analyzePrompt:be().optional(),reason:be().optional(),reasonPrompt:be().optional(),scorer:wA,metadata:au,source:kyt,entity:wA,entityType:_yt.optional(),structuredOutput:Ps().optional(),traceId:be().optional(),spanId:be().optional(),resourceId:be().optional(),threadId:be().optional(),preprocessStepResult:au,preprocessPrompt:be().optional(),generateScorePrompt:be().optional(),generateReasonPrompt:be().optional(),...Lme});Yme.omit({id:!0,createdAt:!0,updatedAt:!0});je({pagination:uS,scores:jt(Yme)});var Eyt=e=>Object.fromEntries(Object.keys(e).map(t=>[t,!0])),Uer=be().describe("Human-readable span name"),qer=be().describe("Parent span reference (null = root span)"),Cyt=Mw(Zme).describe("Span type (e.g., WORKFLOW_RUN, AGENT_RUN, TOOL_CALL, etc.)"),Ver=qr(be(),zr()).describe("Span-type specific attributes (e.g., model, tokens, tools)"),Her=jt(zr()).describe("References to related spans in other traces"),Qer=zr().describe("Input data passed to the span"),Wer=zr().describe("Output data returned from the span"),Ger=zr().describe("Error info - presence indicates failure (status derived from this)"),Zer=Ps().describe("Whether this is an event (point-in-time) vs a span (duration)"),Yer=Xh().describe("When the span started"),Xer=Xh().describe("When the span ended (null = running, status derived from this)"),fT=(e=>(e.SUCCESS="success",e.ERROR="error",e.RUNNING="running",e))(fT||{}),jyt=Mw(fT).describe("Current status of the trace"),Ker=u_(e=>e==="true"?!0:e==="false"?!1:e,Ps()).describe("True if any span in the trace encountered an error"),Tyt={...yer,metadata:Hme.nullish(),tags:Qme.nullish()},Xme={traceId:Vd,spanId:Iv};je({...Xme});var Jer=Eyt(Lme),etr=Eyt(Xme),Y_=je({...Xme,name:Uer,spanType:Cyt,isEvent:Zer,startedAt:Yer,parentSpanId:qer.nullish(),...Tyt,experimentId:be().nullish().describe("Experiment or eval run identifier"),attributes:Ver.nullish(),links:Her.nullish(),input:Qer.nullish(),output:Wer.nullish(),error:Ger.nullish(),endedAt:Xer.nullish(),requestContext:qr(be(),zr()).nullish().describe("Request context data"),...Lme}).describe("Span record data"),ttr=Y_.extend({status:jyt}).describe("Trace span with computed status (root spans only)"),Kme=Y_.omit(Jer);je({span:Kme}).describe("Arguments for creating a single span");je({records:jt(Kme)}).describe("Arguments for batch creating spans");je({traceId:Vd.min(1),spanId:Iv.min(1)}).describe("Arguments for getting a single span");je({span:Y_});je({traceId:Vd.min(1)}).describe("Arguments for getting a root span");je({span:Y_});je({traceId:Vd.min(1)}).describe("Arguments for getting a single trace");je({traceId:Vd,spans:jt(Y_)});var ntr=je({startedAt:Jae.optional().describe("Filter by span start time range"),endedAt:Jae.optional().describe("Filter by span end time range"),spanType:Cyt.optional(),...Tyt,status:jyt.optional(),hasChildError:Ker.optional()}).describe("Filters for querying traces"),rtr=La(["startedAt","endedAt"]).describe("Field to order by: 'startedAt' | 'endedAt'"),atr=je({field:rtr.default("startedAt").describe("Field to order by"),direction:_R.default("DESC").describe("Sort direction")}).describe("Order by configuration");je({filters:ntr.optional().describe("Optional filters to apply"),pagination:kR.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:atr.default({field:"startedAt",direction:"DESC"}).describe("Ordering configuration (defaults to startedAt desc)")}).describe("Arguments for listing traces");je({pagination:uS,spans:jt(ttr)});var Nyt=Kme.omit(etr);je({spanId:Iv,traceId:Vd,updates:Nyt.partial()}).describe("Arguments for updating a single span");je({records:jt(je({traceId:Vd,spanId:Iv,updates:Nyt.partial()}))}).describe("Arguments for batch updating spans");je({traceIds:jt(Vd)}).describe("Arguments for batch deleting traces");je({pagination:uS,scores:jt(Yme)});je({scorerName:be().min(1),targets:jt(je({traceId:Vd,spanId:Iv.optional()})).min(1)});je({status:be(),message:be(),traceCount:_n()});function str(e){let t=e,n=!1;for(;;){const r=Oyt(t);if(!r)break;(r==="ZodNullable"||r==="ZodOptional")&&(n=!0);const a=$er(t,r);if(!a)break;t=a}return{base:t,nullable:n}}function A5e(e){if("_zod"in e){const n=e._zod?.def?.checks;if(n&&Array.isArray(n))return n.map(r=>{if(typeof r=="object"&&r!==null&&"def"in r&&typeof r.def=="object"&&r.def!==null){const a=r.def;return a.check==="number_format"&&a.format==="safeint"?{kind:"int"}:a.check==="string_format"&&typeof a.format=="string"?{kind:a.format}:{kind:typeof a.check=="string"?a.check:"unknown"}}return{kind:"unknown"}})}if("_def"in e){const n=e._def?.checks;if(n&&Array.isArray(n))return n}return[]}function itr(e){const t=Oyt(e);return t==="ZodString"?A5e(e).some(r=>r.kind==="uuid")?"uuid":"text":t==="ZodNativeEnum"||t==="ZodEnum"?"text":t==="ZodNumber"?A5e(e).some(r=>r.kind==="int")?"integer":"float":t==="ZodBigInt"||t==="ZodBigint"?"bigint":t==="ZodDate"?"timestamp":t==="ZodBoolean"?"boolean":"jsonb"}function otr(e){const t=e.shape,n={};for(const[r,a]of Object.entries(t)){const{base:s,nullable:i}=str(a);n[r]={type:itr(s),nullable:i}}return n}otr(Y_);var I5e=1,ltr=.9,ctr=.8,utr=.17,xJ=.1,wJ=.999,dtr=.9999,ftr=.99,htr=/[\\\/_+.#"@\[\(\{&]/,ptr=/[\\\/_+.#"@\[\(\{&]/g,mtr=/[\s-]/,Ayt=/[\s-]/g;function ese(e,t,n,r,a,s,i){if(s===t.length)return a===e.length?I5e:ftr;var l=`${a},${s}`;if(i[l]!==void 0)return i[l];for(var c=r.charAt(s),u=n.indexOf(c,a),d=0,f,h,p,m;u>=0;)f=ese(e,t,n,r,u+1,s+1,i),f>d&&(u===a?f*=I5e:htr.test(e.charAt(u-1))?(f*=ctr,p=e.slice(a,u-1).match(ptr),p&&a>0&&(f*=Math.pow(wJ,p.length))):mtr.test(e.charAt(u-1))?(f*=ltr,m=e.slice(a,u-1).match(Ayt),m&&a>0&&(f*=Math.pow(wJ,m.length))):(f*=utr,a>0&&(f*=Math.pow(wJ,u-a))),e.charAt(u)!==t.charAt(s)&&(f*=dtr)),(f<xJ&&n.charAt(u-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(u-1)!==r.charAt(s))&&(h=ese(e,t,n,r,u+1,s+2,i),h*xJ>f&&(f=h*xJ)),f>d&&(d=f),u=n.indexOf(c,u+1);return i[l]=d,d}function R5e(e){return e.toLowerCase().replace(Ayt," ")}function gtr(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,ese(e,t,R5e(e),R5e(t),0,0,{})}var LC='[cmdk-group=""]',SJ='[cmdk-group-items=""]',vtr='[cmdk-group-heading=""]',Iyt='[cmdk-item=""]',P5e=`${Iyt}:not([aria-disabled="true"])`,tse="cmdk-item-select",N1="data-value",ytr=(e,t,n)=>gtr(e,t,n),Ryt=b.createContext(void 0),jR=()=>b.useContext(Ryt),Pyt=b.createContext(void 0),Jme=()=>b.useContext(Pyt),Myt=b.createContext(void 0),Dyt=b.forwardRef((e,t)=>{let n=A1(()=>{var V,R;return{search:"",value:(R=(V=e.value)!=null?V:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=A1(()=>new Set),a=A1(()=>new Map),s=A1(()=>new Map),i=A1(()=>new Set),l=$yt(e),{label:c,children:u,value:d,onValueChange:f,filter:h,shouldFilter:p,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...x}=e,w=Zi(),O=Zi(),k=Zi(),_=b.useRef(null),C=Ttr();Cw(()=>{if(d!==void 0){let V=d.trim();n.current.value=V,T.emit()}},[d]),Cw(()=>{C(6,F)},[]);let T=b.useMemo(()=>({subscribe:V=>(i.current.add(V),()=>i.current.delete(V)),snapshot:()=>n.current,setState:(V,R,H)=>{var G,J,ie,ne;if(!Object.is(n.current[V],R)){if(n.current[V]=R,V==="search")M(),I(),C(1,P);else if(V==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ae=document.getElementById(k);ae?ae.focus():(G=document.getElementById(w))==null||G.focus()}if(C(7,()=>{var ae;n.current.selectedItemId=(ae=D())==null?void 0:ae.id,T.emit()}),H||C(5,F),((J=l.current)==null?void 0:J.value)!==void 0){let ae=R??"";(ne=(ie=l.current).onValueChange)==null||ne.call(ie,ae);return}}T.emit()}},emit:()=>{i.current.forEach(V=>V())}}),[]),j=b.useMemo(()=>({value:(V,R,H)=>{var G;R!==((G=s.current.get(V))==null?void 0:G.value)&&(s.current.set(V,{value:R,keywords:H}),n.current.filtered.items.set(V,A(R,H)),C(2,()=>{I(),T.emit()}))},item:(V,R)=>(r.current.add(V),R&&(a.current.has(R)?a.current.get(R).add(V):a.current.set(R,new Set([V]))),C(3,()=>{M(),I(),n.current.value||P(),T.emit()}),()=>{s.current.delete(V),r.current.delete(V),n.current.filtered.items.delete(V);let H=D();C(4,()=>{M(),H?.getAttribute("id")===V&&P(),T.emit()})}),group:V=>(a.current.has(V)||a.current.set(V,new Set),()=>{s.current.delete(V),a.current.delete(V)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:w,inputId:k,labelId:O,listInnerRef:_}),[]);function A(V,R){var H,G;let J=(G=(H=l.current)==null?void 0:H.filter)!=null?G:ytr;return V?J(V,n.current.search,R):0}function I(){if(!n.current.search||l.current.shouldFilter===!1)return;let V=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(G=>{let J=a.current.get(G),ie=0;J.forEach(ne=>{let ae=V.get(ne);ie=Math.max(ae,ie)}),R.push([G,ie])});let H=_.current;U().sort((G,J)=>{var ie,ne;let ae=G.getAttribute("id"),le=J.getAttribute("id");return((ie=V.get(le))!=null?ie:0)-((ne=V.get(ae))!=null?ne:0)}).forEach(G=>{let J=G.closest(SJ);J?J.appendChild(G.parentElement===J?G:G.closest(`${SJ} > *`)):H.appendChild(G.parentElement===H?G:G.closest(`${SJ} > *`))}),R.sort((G,J)=>J[1]-G[1]).forEach(G=>{var J;let ie=(J=_.current)==null?void 0:J.querySelector(`${LC}[${N1}="${encodeURIComponent(G[0])}"]`);ie?.parentElement.appendChild(ie)})}function P(){let V=U().find(H=>H.getAttribute("aria-disabled")!=="true"),R=V?.getAttribute(N1);T.setState("value",R||void 0)}function M(){var V,R,H,G;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let J=0;for(let ie of r.current){let ne=(R=(V=s.current.get(ie))==null?void 0:V.value)!=null?R:"",ae=(G=(H=s.current.get(ie))==null?void 0:H.keywords)!=null?G:[],le=A(ne,ae);n.current.filtered.items.set(ie,le),le>0&&J++}for(let[ie,ne]of a.current)for(let ae of ne)if(n.current.filtered.items.get(ae)>0){n.current.filtered.groups.add(ie);break}n.current.filtered.count=J}function F(){var V,R,H;let G=D();G&&(((V=G.parentElement)==null?void 0:V.firstChild)===G&&((H=(R=G.closest(LC))==null?void 0:R.querySelector(vtr))==null||H.scrollIntoView({block:"nearest"})),G.scrollIntoView({block:"nearest"}))}function D(){var V;return(V=_.current)==null?void 0:V.querySelector(`${Iyt}[aria-selected="true"]`)}function U(){var V;return Array.from(((V=_.current)==null?void 0:V.querySelectorAll(P5e))||[])}function B(V){let R=U()[V];R&&T.setState("value",R.getAttribute(N1))}function z(V){var R;let H=D(),G=U(),J=G.findIndex(ne=>ne===H),ie=G[J+V];(R=l.current)!=null&&R.loop&&(ie=J+V<0?G[G.length-1]:J+V===G.length?G[0]:G[J+V]),ie&&T.setState("value",ie.getAttribute(N1))}function Q(V){let R=D(),H=R?.closest(LC),G;for(;H&&!G;)H=V>0?Ctr(H,LC):jtr(H,LC),G=H?.querySelector(P5e);G?T.setState("value",G.getAttribute(N1)):z(V)}let W=()=>B(U().length-1),$=V=>{V.preventDefault(),V.metaKey?W():V.altKey?Q(1):z(1)},Z=V=>{V.preventDefault(),V.metaKey?B(0):V.altKey?Q(-1):z(-1)};return b.createElement(go.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:V=>{var R;(R=x.onKeyDown)==null||R.call(x,V);let H=V.nativeEvent.isComposing||V.keyCode===229;if(!(V.defaultPrevented||H))switch(V.key){case"n":case"j":{v&&V.ctrlKey&&$(V);break}case"ArrowDown":{$(V);break}case"p":case"k":{v&&V.ctrlKey&&Z(V);break}case"ArrowUp":{Z(V);break}case"Home":{V.preventDefault(),B(0);break}case"End":{V.preventDefault(),W();break}case"Enter":{V.preventDefault();let G=D();if(G){let J=new Event(tse);G.dispatchEvent(J)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:Atr},c),e8(e,V=>b.createElement(Pyt.Provider,{value:T},b.createElement(Ryt.Provider,{value:j},V))))}),btr=b.forwardRef((e,t)=>{var n,r;let a=Zi(),s=b.useRef(null),i=b.useContext(Myt),l=jR(),c=$yt(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:i?.forceMount;Cw(()=>{if(!u)return l.item(a,i?.id)},[u]);let d=Lyt(a,s,[e.value,e.children,s],e.keywords),f=Jme(),h=Pb(C=>C.value&&C.value===d.current),p=Pb(C=>u||l.filter()===!1?!0:C.search?C.filtered.items.get(a)>0:!0);b.useEffect(()=>{let C=s.current;if(!(!C||e.disabled))return C.addEventListener(tse,m),()=>C.removeEventListener(tse,m)},[p,e.onSelect,e.disabled]);function m(){var C,T;g(),(T=(C=c.current).onSelect)==null||T.call(C,d.current)}function g(){f.setState("value",d.current,!0)}if(!p)return null;let{disabled:v,value:x,onSelect:w,forceMount:O,keywords:k,..._}=e;return b.createElement(go.div,{ref:pm(s,t),..._,id:a,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!h,"data-disabled":!!v,"data-selected":!!h,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)}),xtr=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...s}=e,i=Zi(),l=b.useRef(null),c=b.useRef(null),u=Zi(),d=jR(),f=Pb(p=>a||d.filter()===!1?!0:p.search?p.filtered.groups.has(i):!0);Cw(()=>d.group(i),[]),Lyt(i,l,[e.value,e.heading,c]);let h=b.useMemo(()=>({id:i,forceMount:a}),[a]);return b.createElement(go.div,{ref:pm(l,t),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),e8(e,p=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(Myt.Provider,{value:h},p))))}),wtr=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=b.useRef(null),s=Pb(i=>!i.search);return!n&&!s?null:b.createElement(go.div,{ref:pm(a,t),...r,"cmdk-separator":"",role:"separator"})}),Str=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,s=Jme(),i=Pb(u=>u.search),l=Pb(u=>u.selectedItemId),c=jR();return b.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),b.createElement(go.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:a?e.value:i,onChange:u=>{a||s.setState("search",u.target.value),n?.(u.target.value)}})}),Otr=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,s=b.useRef(null),i=b.useRef(null),l=Pb(u=>u.selectedItemId),c=jR();return b.useEffect(()=>{if(i.current&&s.current){let u=i.current,d=s.current,f,h=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let p=u.offsetHeight;d.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return h.observe(u),()=>{cancelAnimationFrame(f),h.unobserve(u)}}},[]),b.createElement(go.div,{ref:pm(s,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},e8(e,u=>b.createElement("div",{ref:pm(i,c.listInnerRef),"cmdk-list-sizer":""},u)))}),ktr=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:s,container:i,...l}=e;return b.createElement(g6,{open:n,onOpenChange:r},b.createElement(v6,{container:i},b.createElement(yI,{"cmdk-overlay":"",className:a}),b.createElement(bI,{"aria-label":e.label,"cmdk-dialog":"",className:s},b.createElement(Dyt,{ref:t,...l}))))}),_tr=b.forwardRef((e,t)=>Pb(n=>n.filtered.count===0)?b.createElement(go.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Etr=b.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...s}=e;return b.createElement(go.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},e8(e,i=>b.createElement("div",{"aria-hidden":!0},i)))}),Lu=Object.assign(Dyt,{List:Otr,Item:btr,Input:Str,Group:xtr,Separator:wtr,Dialog:ktr,Empty:_tr,Loading:Etr});function Ctr(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function jtr(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function $yt(e){let t=b.useRef(e);return Cw(()=>{t.current=e}),t}var Cw=typeof window>"u"?b.useEffect:b.useLayoutEffect;function A1(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function Pb(e){let t=Jme(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function Lyt(e,t,n,r=[]){let a=b.useRef(),s=jR();return Cw(()=>{var i;let l=(()=>{var u;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():a.current}})(),c=r.map(u=>u.trim());s.value(e,l,c),(i=t.current)==null||i.setAttribute(N1,l),a.current=l}),a}var Ttr=()=>{let[e,t]=b.useState(),n=A1(()=>new Map);return Cw(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function Ntr(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function e8({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(Ntr(t),{ref:t.ref},n(t.props.children)):n(t)}var Atr={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};class io{constructor(t,n,r,a){this.fromA=t,this.toA=n,this.fromB=r,this.toB=a}offset(t,n=t){return new io(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}}function jw(e,t,n,r,a,s){if(e==r)return[];let i=tge(e,t,n,r,a,s),l=nge(e,t+i,n,r,a+i,s);t+=i,n-=l,a+=i,s-=l;let c=n-t,u=s-a;if(!c||!u)return[new io(t,n,a,s)];if(c>u){let f=e.slice(t,n).indexOf(r.slice(a,s));if(f>-1)return[new io(t,t+f,a,a),new io(t+f+u,n,s,s)]}else if(u>c){let f=r.slice(a,s).indexOf(e.slice(t,n));if(f>-1)return[new io(t,t,a,a+f),new io(n,n,a+f+c,s)]}if(c==1||u==1)return[new io(t,n,a,s)];let d=Byt(e,t,n,r,a,s);if(d){let[f,h,p]=d;return jw(e,t,f,r,a,h).concat(jw(e,f+p,n,r,h+p,s))}return Itr(e,t,n,r,a,s)}let xj=1e9,wj=0,ege=!1;function Itr(e,t,n,r,a,s){let i=n-t,l=s-a;if(xj<1e9&&Math.min(i,l)>xj*16||wj>0&&Date.now()>wj)return Math.min(i,l)>xj*64?[new io(t,n,a,s)]:M5e(e,t,n,r,a,s);let c=Math.ceil((i+l)/2);OJ.reset(c),kJ.reset(c);let u=(p,m)=>e.charCodeAt(t+p)==r.charCodeAt(a+m),d=(p,m)=>e.charCodeAt(n-p-1)==r.charCodeAt(s-m-1),f=(i-l)%2!=0?kJ:null,h=f?null:OJ;for(let p=0;p<c;p++){if(p>xj||wj>0&&!(p&63)&&Date.now()>wj)return M5e(e,t,n,r,a,s);let m=OJ.advance(p,i,l,c,f,!1,u)||kJ.advance(p,i,l,c,h,!0,d);if(m)return Rtr(e,t,n,t+m[0],r,a,s,a+m[1])}return[new io(t,n,a,s)]}class Fyt{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,n,r,a,s,i,l){for(let c=-t+this.start;c<=t-this.end;c+=2){let u=a+c,d=c==-t||c!=t&&this.vec[u-1]<this.vec[u+1]?this.vec[u+1]:this.vec[u-1]+1,f=d-c;for(;d<n&&f<r&&l(d,f);)d++,f++;if(this.vec[u]=d,d>n)this.end+=2;else if(f>r)this.start+=2;else if(s){let h=a+(n-r)-c;if(h>=0&&h<this.len&&s.vec[h]!=-1)if(i){let p=s.vec[h];if(p>=n-d)return[p,a+p-h]}else{let p=n-s.vec[h];if(d>=p)return[d,f]}}}return null}}const OJ=new Fyt,kJ=new Fyt;function Rtr(e,t,n,r,a,s,i,l){let c=!1;return!qk(e,r)&&++r==n&&(c=!0),!qk(a,l)&&++l==i&&(c=!0),c?[new io(t,n,s,i)]:jw(e,t,r,a,s,l).concat(jw(e,r,n,a,l,i))}function zyt(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n=n<<1;return n}function tge(e,t,n,r,a,s){if(t==n||t==s||e.charCodeAt(t)!=r.charCodeAt(a))return 0;let i=zyt(n-t,s-a);for(let l=t,c=a;;){let u=l+i,d=c+i;if(u>n||d>s||e.slice(l,u)!=r.slice(c,d)){if(i==1)return l-t-(qk(e,l)?0:1);i=i>>1}else{if(u==n||d==s)return u-t;l=u,c=d}}}function nge(e,t,n,r,a,s){if(t==n||a==s||e.charCodeAt(n-1)!=r.charCodeAt(s-1))return 0;let i=zyt(n-t,s-a);for(let l=n,c=s;;){let u=l-i,d=c-i;if(u<t||d<a||e.slice(u,l)!=r.slice(d,c)){if(i==1)return n-l-(qk(e,l)?0:1);i=i>>1}else{if(u==t||d==a)return n-u;l=u,c=d}}}function nse(e,t,n,r,a,s,i,l){let c=r.slice(a,s),u=null;for(;;){if(u||i<l)return u;for(let d=t+i;;){qk(e,d)||d++;let f=d+i;if(qk(e,f)||(f+=f==d+1?1:-1),f>=n)break;let h=e.slice(d,f),p=-1;for(;(p=c.indexOf(h,p+1))!=-1;){let m=tge(e,f,n,r,a+p+h.length,s),g=nge(e,t,d,r,a,a+p),v=h.length+m+g;(!u||u[2]<v)&&(u=[d-g,a+p-g,v])}d=f}if(l<0)return u;i=i>>1}}function Byt(e,t,n,r,a,s){let i=n-t,l=s-a;if(i<l){let c=Byt(r,a,s,e,t,n);return c&&[c[1],c[0],c[2]]}return i<4||l*2<i?null:nse(e,t,n,r,a,s,Math.floor(i/4),-1)}function M5e(e,t,n,r,a,s){ege=!0;let i=n-t,l=s-a,c;if(i<l){let h=nse(r,a,s,e,t,n,Math.floor(i/6),50);c=h&&[h[1],h[0],h[2]]}else c=nse(e,t,n,r,a,s,Math.floor(l/6),50);if(!c)return[new io(t,n,a,s)];let[u,d,f]=c;return jw(e,t,u,r,a,d).concat(jw(e,u+f,n,r,d+f,s))}function Uyt(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],a=e[n];r.toA>a.fromA-t&&r.toB>a.fromB-t&&(e[n-1]=new io(r.fromA,a.toA,r.fromB,a.toB),e.splice(n--,1))}}function Ptr(e,t,n){for(;;){Uyt(n,1);let r=!1;for(let a=0;a<n.length;a++){let s=n[a],i,l;(i=tge(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=n[a]=new io(s.fromA+i,s.toA,s.fromB+i,s.toB)),(l=nge(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=n[a]=new io(s.fromA,s.toA-l,s.fromB,s.toB-l));let c=s.toA-s.fromA,u=s.toB-s.fromB;if(c&&u)continue;let d=s.fromA-(a?n[a-1].toA:0),f=(a<n.length-1?n[a+1].fromA:e.length)-s.toA;if(!d||!f)continue;let h=c?e.slice(s.fromA,s.toA):t.slice(s.fromB,s.toB);d<=h.length&&e.slice(s.fromA-d,s.fromA)==h.slice(h.length-d)?(n[a]=new io(s.fromA-d,s.toA-d,s.fromB-d,s.toB-d),r=!0):f<=h.length&&e.slice(s.toA,s.toA+f)==h.slice(0,f)&&(n[a]=new io(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),r=!0)}if(!r)break}return n}function Mtr(e,t,n){for(let r=0,a=0;a<e.length;a++){let s=e[a],i=s.toA-s.fromA,l=s.toB-s.fromB;if(i&&l||i>3||l>3){let c=a==e.length-1?t.length:e[a+1].fromA,u=s.fromA-r,d=c-s.toA,f=$5e(t,s.fromA,u),h=D5e(t,s.toA,d),p=s.fromA-f,m=h-s.toA;if((!i||!l)&&p&&m){let g=Math.max(i,l),[v,x,w]=i?[t,s.fromA,s.toA]:[n,s.fromB,s.toB];g>p&&t.slice(f,s.fromA)==v.slice(w-p,w)?(s=e[a]=new io(f,f+i,s.fromB-p,s.toB-p),f=s.fromA,h=D5e(t,s.toA,c-s.toA)):g>m&&t.slice(s.toA,h)==v.slice(x,x+m)&&(s=e[a]=new io(h-i,h,s.fromB+m,s.toB+m),h=s.toA,f=$5e(t,s.fromA,s.fromA-r)),p=s.fromA-f,m=h-s.toA}if(p||m)s=e[a]=new io(s.fromA-p,s.toA+m,s.fromB-p,s.toB+m);else if(i){if(!l){let g=F5e(t,s.fromA,s.toA),v,x=g<0?-1:L5e(t,s.toA,s.fromA);g>-1&&(v=g-s.fromA)<=d&&t.slice(s.fromA,g)==t.slice(s.toA,s.toA+v)?s=e[a]=s.offset(v):x>-1&&(v=s.toA-x)<=u&&t.slice(s.fromA-v,s.fromA)==t.slice(x,s.toA)&&(s=e[a]=s.offset(-v))}}else{let g=F5e(n,s.fromB,s.toB),v,x=g<0?-1:L5e(n,s.toB,s.fromB);g>-1&&(v=g-s.fromB)<=d&&n.slice(s.fromB,g)==n.slice(s.toB,s.toB+v)?s=e[a]=s.offset(v):x>-1&&(v=s.toB-x)<=u&&n.slice(s.fromB-v,s.fromB)==n.slice(x,s.toB)&&(s=e[a]=s.offset(-v))}}r=s.toA}return Uyt(e,3),e}let A0;try{A0=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function qyt(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Vyt(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?qyt(n)?1:0:A0?!Wyt(n)||t==e.length-1?A0.test(String.fromCharCode(n))?1:0:A0.test(e.slice(t,t+2))?2:0:0}function Hyt(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?qyt(n)?1:0:A0?!Gyt(n)||t==1?A0.test(String.fromCharCode(n))?1:0:A0.test(e.slice(t-2,t))?2:0:0}const Qyt=8;function D5e(e,t,n){if(t==e.length||!Hyt(e,t))return t;for(let r=t,a=t+n,s=0;s<Qyt;s++){let i=Vyt(e,r);if(!i||r+i>a)return r;r+=i}return t}function $5e(e,t,n){if(!t||!Vyt(e,t))return t;for(let r=t,a=t-n,s=0;s<Qyt;s++){let i=Hyt(e,r);if(!i||r-i<a)return r;r-=i}return t}function L5e(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function F5e(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}const Wyt=e=>e>=55296&&e<=56319,Gyt=e=>e>=56320&&e<=57343;function qk(e,t){return!t||t==e.length||!Wyt(e.charCodeAt(t-1))||!Gyt(e.charCodeAt(t))}function Dtr(e,t,n){var r;let a=n?.override;return a?a(e,t):(xj=((r=n?.scanLimit)!==null&&r!==void 0?r:1e9)>>1,wj=n?.timeout?Date.now()+n.timeout:0,ege=!1,Ptr(e,t,jw(e,0,e.length,t,0,t.length)))}function Zyt(){return!ege}function Yyt(e,t,n){return Mtr(Dtr(e,t,n),e,t)}const Hp=Jt.define({combine:e=>e[0]}),rse=er.define(),$tr=Jt.define(),Vk=vo.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(rse)&&(e=n.value);for(let n of t.state.facet($tr))e=n(e,t);return e}});class NO{constructor(t,n,r,a,s,i=!0){this.changes=t,this.fromA=n,this.toA=r,this.fromB=a,this.toB=s,this.precise=i}offset(t,n){return t||n?new NO(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(t,n,r){let a=Yyt(t.toString(),n.toString(),r);return Xyt(a,t,n,0,0,Zyt())}static updateA(t,n,r,a,s){return V5e(q5e(t,a,!0,r.length),t,n,r,s)}static updateB(t,n,r,a,s){return V5e(q5e(t,a,!1,n.length),t,n,r,s)}}function z5e(e,t,n,r){let a=n.lineAt(e),s=r.lineAt(t);return a.to==e&&s.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[a.from,s.from]}function B5e(e,t,n,r){let a=n.lineAt(e),s=r.lineAt(t);return a.from==e&&s.from==t?[e,t]:[a.to+1,s.to+1]}function Xyt(e,t,n,r,a,s){let i=[];for(let l=0;l<e.length;l++){let c=e[l],[u,d]=z5e(c.fromA+r,c.fromB+a,t,n),[f,h]=B5e(c.toA+r,c.toB+a,t,n),p=[c.offset(-u+r,-d+a)];for(;l<e.length-1;){let m=e[l+1],[g,v]=z5e(m.fromA+r,m.fromB+a,t,n);if(g>f+1&&v>h+1)break;p.push(m.offset(-u+r,-d+a)),[f,h]=B5e(m.toA+r,m.toB+a,t,n),l++}i.push(new NO(p,u,Math.max(u,f),d,Math.max(d,h),s))}return i}const zD=1e3;function U5e(e,t,n,r){let a=0,s=e.length;for(;;){if(a==s){let d=0,f=0;a&&({toA:d,toB:f}=e[a-1]);let h=t-(n?d:f);return[d+h,f+h]}let i=a+s>>1,l=e[i],[c,u]=n?[l.fromA,l.toA]:[l.fromB,l.toB];if(c>t)s=i;else if(u<=t)a=i+1;else return r?[l.fromA,l.fromB]:[l.toA,l.toB]}}function q5e(e,t,n,r){let a=[];return t.iterChangedRanges((s,i,l,c)=>{let u=0,d=n?t.length:r,f=0,h=n?r:t.length;s>zD&&([u,f]=U5e(e,s-zD,n,!0)),i<t.length-zD&&([d,h]=U5e(e,i+zD,n,!1));let p=c-l-(i-s),m,[g,v]=n?[p,0]:[0,p];a.length&&(m=a[a.length-1]).toA>=u?a[a.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:h,diffA:m.diffA+g,diffB:m.diffB+v}:a.push({fromA:u,toA:d,fromB:f,toB:h,diffA:g,diffB:v})}),a}function V5e(e,t,n,r,a){if(!e.length)return t;let s=[];for(let i=0,l=0,c=0,u=0;;i++){let d=i==e.length?null:e[i],f=d?d.fromA+l:n.length,h=d?d.fromB+c:r.length;for(;u<t.length;){let v=t[u];if(d&&(v.toA+l>f||v.toB+c>h))break;s.push(v.offset(l,c)),u++}if(!d)break;let p=d.toA+l+d.diffA,m=d.toB+c+d.diffB,g=Yyt(n.sliceString(f,p),r.sliceString(h,m),a);for(let v of Xyt(g,n,r,f,h,Zyt()))s.push(v);for(l+=d.diffA,c+=d.diffB;u<t.length;){let v=t[u];if(v.fromA+l>p&&v.fromB+c>m)break;u++}}return s}const Ltr={scanLimit:500},Kyt=ii.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=W5e(e))}update(e){(e.docChanged||e.viewportChanged||Ftr(e.startState,e.state)||ztr(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=W5e(e.view))}},{decorations:e=>e.deco}),BD=tp.low(Xnt({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(Kyt))===null||t===void 0?void 0:t.gutter)||Vr.empty}}));function Ftr(e,t){return e.field(Vk,!1)!=t.field(Vk,!1)}function ztr(e,t){return e.facet(Hp)!=t.facet(Hp)}const H5e=on.line({class:"cm-changedLine"}),Btr=on.mark({class:"cm-changedText"}),Utr=on.mark({tagName:"ins",class:"cm-insertedLine"}),qtr=on.mark({tagName:"del",class:"cm-deletedLine"}),Q5e=new class extends vm{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Vtr(e,t,n,r,a,s){let i=n?e.fromA:e.fromB,l=n?e.toA:e.toB,c=0;if(i!=l){a.add(i,i,H5e),a.add(i,l,n?qtr:Utr),s&&s.add(i,i,Q5e);for(let u=t.iterRange(i,l-1),d=i;!u.next().done;){if(u.lineBreak){d++,a.add(d,d,H5e),s&&s.add(d,d,Q5e);continue}let f=d+u.value.length;if(r)for(;c<e.changes.length;){let h=e.changes[c],p=i+(n?h.fromA:h.fromB),m=i+(n?h.toA:h.toB),g=Math.max(d,p),v=Math.min(f,m);if(g<v&&a.add(g,v,Btr),m<f)c++;else break}d=f}}}function W5e(e){let t=e.state.field(Vk),{side:n,highlightChanges:r,markGutter:a,overrideChunk:s}=e.state.facet(Hp),i=n=="a",l=new ku,c=a?new ku:null,{from:u,to:d}=e.viewport;for(let f of t){if((i?f.fromA:f.fromB)>=d)break;(i?f.toA:f.toB)>u&&(!s||!s(e.state,f,l,c))&&Vtr(f,e.state.doc,i,r,l,c)}return{deco:l.finish(),gutter:c&&c.finish()}}class UD extends qd{constructor(t){super(),this.height=t}eq(t){return this.height==t.height}toDOM(){let t=document.createElement("div");return t.className="cm-mergeSpacer",t.style.height=this.height+"px",t}updateDOM(t){return t.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const g3=er.define({map:(e,t)=>e.map(t)}),Sj=vo.define({create:()=>on.none,update:(e,t)=>{for(let n of t.effects)if(n.is(g3))return n.value;return e.map(t.changes)},provide:e=>xt.decorations.from(e)}),qD=.01;function G5e(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function Htr(e,t,n){let r=new ku,a=new ku,s=e.state.field(Sj).iter(),i=t.state.field(Sj).iter(),l=0,c=0,u=0,d=0,f=e.viewport,h=t.viewport;for(let v=0;;v++){let x=v<n.length?n[v]:null,w=x?x.fromA:e.state.doc.length,O=x?x.fromB:t.state.doc.length;if(l<w){let k=e.lineBlockAt(l).top+u,_=t.lineBlockAt(c).top+d,C=k-_;C<-qD?(u-=C,r.add(l,l,on.widget({widget:new UD(-C),block:!0,side:-1}))):C>qD&&(d+=C,a.add(c,c,on.widget({widget:new UD(C),block:!0,side:-1})))}if(w>l+1e3&&l<f.from&&w>f.from&&c<h.from&&O>h.from){let k=Math.min(f.from-l,h.from-c);l+=k,c+=k,v--}else if(x)l=x.toA,c=x.toB;else break;for(;s.value&&s.from<l;)u-=s.value.spec.widget.height,s.next();for(;i.value&&i.from<c;)d-=i.value.spec.widget.height,i.next()}for(;s.value;)u-=s.value.spec.widget.height,s.next();for(;i.value;)d-=i.value.spec.widget.height,i.next();let p=e.contentHeight+u-(t.contentHeight+d);p<qD?r.add(e.state.doc.length,e.state.doc.length,on.widget({widget:new UD(-p),block:!0,side:1})):p>qD&&a.add(t.state.doc.length,t.state.doc.length,on.widget({widget:new UD(p),block:!0,side:1}));let m=r.finish(),g=a.finish();G5e(m,e.state.field(Sj))||e.dispatch({effects:g3.of(m)}),G5e(g,t.state.field(Sj))||t.dispatch({effects:g3.of(g)})}const ase=er.define({map:(e,t)=>t.mapPos(e)});class Qtr extends qd{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=t.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",r=>{let a=t.posAtDOM(r.target);t.dispatch({effects:ase.of(a)});let{side:s,sibling:i}=t.state.facet(Hp);i&&i().dispatch({effects:ase.of(Wtr(a,t.state.field(Vk),s=="a"))})}),n}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Wtr(e,t,n){let r=0,a=0;for(let s=0;;s++){let i=s<t.length?t[s]:null;if(!i||(n?i.fromA:i.fromB)>=e)return a+(e-r);[r,a]=n?[i.toA,i.toB]:[i.toB,i.toA]}}const Gtr=vo.define({create(e){return on.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(ase)&&(e=e.update({filter:r=>r!=n.value}));return e},provide:e=>xt.decorations.from(e)});function Z5e({margin:e=3,minSize:t=4}){return Gtr.init(n=>Ztr(n,e,t))}function Ztr(e,t,n){let r=new ku,a=e.facet(Hp).side=="a",s=e.field(Vk),i=1;for(let l=0;;l++){let c=l<s.length?s[l]:null,u=l?i+t:1,d=c?e.doc.lineAt(a?c.fromA:c.fromB).number-1-t:e.doc.lines,f=d-u+1;if(f>=n&&r.add(e.doc.line(u).from,e.doc.line(d).to,on.replace({widget:new Qtr(f),block:!0})),!c)break;i=e.doc.lineAt(Math.min(e.doc.length,a?c.toA:c.toB)).number}return r.finish()}const Ytr=xt.styleModule.of(new nv({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),Xtr=xt.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Y5e=new E_,VD=new E_;class Ktr{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||Ltr;let n=[tp.low(Kyt),Xtr,Ytr,Sj,xt.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(h=>h.effects.some(p=>p.is(g3)))&&this.measure()})],r=[Hp.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&r.push(BD);let a=Ir.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],xt.editorAttributes.of({class:"cm-merge-a"}),VD.of(r),n]}),s=[Hp.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&s.push(BD);let i=Ir.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],xt.editorAttributes.of({class:"cm-merge-b"}),VD.of(s),n]});this.chunks=NO.build(a.doc,i.doc,this.diffConf);let l=[Vk.init(()=>this.chunks),Y5e.of(t.collapseUnchanged?Z5e(t.collapseUnchanged):[])];a=a.update({effects:er.appendConfig.of(l)}).state,i=i.update({effects:er.appendConfig.of(l)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let c=t.orientation||"a-b",u=document.createElement("div");u.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(c=="a-b"?u:d),this.editorDOM.appendChild(c=="a-b"?d:u),this.a=new xt({state:a,parent:u,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new xt({state:i,parent:d,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!t.revertControls,t.revertControls=="b-to-a",t.renderRevertControl),t.parent&&t.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(t,n){if(t.some(r=>r.docChanged)){let r=t[t.length-1],a=t.reduce((i,l)=>i.compose(l.changes),ao.empty(t[0].startState.doc.length));this.chunks=n==this.a?NO.updateA(this.chunks,r.newDoc,this.b.state.doc,a,this.diffConf):NO.updateB(this.chunks,this.a.state.doc,r.newDoc,a,this.diffConf),n.update([...t,r.state.update({effects:rse.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:rse.of(this.chunks)})]),this.scheduleMeasure()}else n.update(t)}reconfigure(t){if("diffConfig"in t&&(this.diffConf=t.diffConfig),"orientation"in t){let s=t.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let i=this.a.dom.parentNode,l=this.b.dom.parentNode;i.remove(),l.remove(),this.editorDOM.insertBefore(s?i:l,this.editorDOM.firstChild),this.editorDOM.appendChild(s?l:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in t||"renderRevertControl"in t){let s=!!this.revertDOM,i=this.revertToA,l=this.renderRevert;"revertControls"in t&&(s=!!t.revertControls,i=t.revertControls=="b-to-a"),"renderRevertControl"in t&&(l=t.renderRevertControl),this.setupRevertControls(s,i,l)}let n="highlightChanges"in t,r="gutter"in t,a="collapseUnchanged"in t;if(n||r||a){let s=[],i=[];if(n||r){let l=this.a.state.facet(Hp),c=r?t.gutter!==!1:l.markGutter,u=n?t.highlightChanges!==!1:l.highlightChanges;s.push(VD.reconfigure([Hp.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:c}),c?BD:[]])),i.push(VD.reconfigure([Hp.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:c}),c?BD:[]]))}if(a){let l=Y5e.reconfigure(t.collapseUnchanged?Z5e(t.collapseUnchanged):[]);s.push(l),i.push(l)}this.a.dispatch({effects:s}),this.b.dispatch({effects:i})}this.scheduleMeasure()}setupRevertControls(t,n,r){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=r,!t&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):t&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",a=>this.revertClicked(a)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let t=this.dom.ownerDocument.defaultView||window;this.measuring=t.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){Htr(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let t=this.revertDOM,n=t.firstChild,r=this.a.viewport,a=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let i=this.chunks[s];if(i.fromA>r.to||i.fromB>a.to)break;if(i.fromA<r.from||i.fromB<a.from)continue;let l=this.a.lineBlockAt(i.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=X5e(n);n&&n.dataset.chunk==String(s)?(n.style.top!=l&&(n.style.top=l),n=n.nextSibling):t.insertBefore(this.renderRevertButton(l,s),n)}for(;n;)n=X5e(n)}renderRevertButton(t,n){let r;if(this.renderRevert)r=this.renderRevert();else{r=document.createElement("button");let a=this.a.state.phrase("Revert this chunk");r.setAttribute("aria-label",a),r.setAttribute("title",a),r.textContent=this.revertToLeft?"⇜":"⇝"}return r.style.top=t,r.setAttribute("data-chunk",String(n)),r}revertClicked(t){let n=t.target,r;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(r=this.chunks[n.dataset.chunk])){let[a,s,i,l,c,u]=this.revertToA?[this.b,this.a,r.fromB,r.toB,r.fromA,r.toA]:[this.a,this.b,r.fromA,r.toA,r.fromB,r.toB],d=a.state.sliceDoc(i,Math.max(i,l-1));i!=l&&u<=s.state.doc.length&&(d+=a.state.lineBreak),s.dispatch({changes:{from:c,to:Math.min(s.state.doc.length,u),insert:d},userEvent:"revert"}),t.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function X5e(e){let t=e.nextSibling;return e.remove(),t}const _J=[400,401,403,404];function Yi(e){if(!e||typeof e!="object")return!1;if("status"in e&&e.status===401||"statusCode"in e&&e.statusCode===401)return!0;if("message"in e){const t=e.message;if(typeof t=="string")return/\bstatus:\s*401\b/.test(t)}return!1}function Va(e){if(!e||typeof e!="object")return!1;if("status"in e&&e.status===403||"statusCode"in e&&e.statusCode===403)return!0;if("message"in e){const t=e.message;if(typeof t=="string")return/\bstatus:\s*403\b/.test(t)}return!1}function Jyt(e){if(!e||typeof e!="object")return!1;if("status"in e){const t=e.status;return _J.includes(t)}if("statusCode"in e){const t=e.statusCode;return _J.includes(t)}if("message"in e){const t=e.message;if(typeof t=="string")return _J.some(n=>new RegExp(`\\bstatus:\\s*${n}\\b`).test(t))}return!1}function Jtr(e,t){return Jyt(t)?!1:e<3}function enr(e,t){return t in e&&typeof e[t]=="function"}const el=e=>{const t=["listWorkspaces","getWorkspace"],n=yie.has("workspaces-v1"),r=t.every(a=>enr(e,a));return n&&r},ebt=e=>{if(!(!e||typeof e!="object")){if("status"in e&&typeof e.status=="number")return e.status;if("statusCode"in e&&typeof e.statusCode=="number")return e.statusCode}},tnr=(e,t)=>ebt(e)===t,nnr=e=>{const t=ebt(e);return t!==void 0&&t>=400&&t<500},sse=e=>{if(tnr(e,501))return!0;if(e&&typeof e=="object"&&"message"in e){const t=e.message;return t.includes("Workspace v1 not supported")||t.includes("501")}return!1},hS=(e,t)=>nnr(t)||sse(t)||Jyt(t)?!1:e<3,K5e={modelSettings:{maxRetries:2,maxSteps:5,chatWithGenerateLegacy:!1,chatWithGenerate:!1}};function rnr({agentId:e,defaultSettings:t}){const[n,r]=b.useState(t),a=`mastra-agent-store-${e}`;return b.useEffect(()=>{try{const l=localStorage.getItem(a),c=l?JSON.parse(l):{},u={...c,modelSettings:{...K5e.modelSettings,...c?.modelSettings??{},...t?.modelSettings??{}}};r(u)}catch{}},[a,t]),{settings:n,setSettings:l=>{r(c=>({...c,...l})),localStorage.setItem(a,JSON.stringify({...l,agentId:e}))},resetAll:()=>{const l={modelSettings:{...K5e.modelSettings,...t?.modelSettings??{}}};r(l),localStorage.removeItem(a)}}}const tbt=b.createContext({});function rge({children:e,agentId:t,defaultSettings:n}){const{settings:r,setSettings:a,resetAll:s}=rnr({agentId:t,defaultSettings:n});return o.jsx(tbt.Provider,{value:{settings:r,setSettings:a,resetAll:s},children:e})}const age=()=>b.useContext(tbt),Br=Tle()(t2t(e=>({requestContext:{},theme:"dark",setRequestContext:t=>e({requestContext:t}),setTheme:t=>e({theme:t})}),{name:"mastra-playground-store"})),ise=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;function anr(e){return ise?.addEventListener("change",e),()=>ise?.removeEventListener("change",e)}function snr(){return ise?.matches??!0}function t8(){const e=Br(n=>n.theme),t=b.useSyncExternalStore(anr,snr,()=>!0);return e==="system"?t:e==="dark"}const sge=b.createContext(null);function TR({children:e}){const{requestContext:t}=Br(),[n,r]=b.useState(t),a=i=>r(i),s=()=>{r({})};return o.jsx(sge.Provider,{value:{schemaValues:n,setSchemaValues:a,clearSchemaValues:s},children:e})}function nbt(){const e=b.useContext(sge);if(!e)throw new Error("useSchemaRequestContext must be used within a SchemaRequestContextProvider");return e}function xo(){const{requestContext:e}=Br(),n=b.useContext(sge)?.schemaValues??{};return{...e??{},...n}}const rbt=({threadId:e,agentId:t,memory:n})=>{const r=Ye(),{requestContext:a}=Br();return Ot({queryKey:["memory","messages",e,t,"requestContext"],queryFn:async()=>e?await r.listThreadMessages(e,{agentId:t,requestContext:a,includeSystemReminders:!0}):null,enabled:n&&!!e,staleTime:0,gcTime:0,retry:!1,refetchOnWindowFocus:!1})},inr=({multiple:e=!0,onChange:t}={})=>{const n=f7t(s=>!s.isEditing),r=mI(),a=b.useCallback(()=>{const s=document.createElement("input");s.type="file",s.multiple=e,s.hidden=!0;const i=r.getState().attachmentAccept;i&&i!=="*"&&(s.accept=i),document.body.appendChild(s),s.onchange=l=>{const c=l.target.files;if(c){for(const u of c)r.addAttachment(u),t?.(Array.from(c));document.body.removeChild(s)}},s.oncancel=()=>{(!s.files||s.files.length===0)&&document.body.removeChild(s)},s.click()},[r,e]);if(!n)return a},Ql={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},NR="focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",onr="focus-within:outline-hidden focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",lnr="rounded-md",ige="bg-surface2 border-2 border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",oge="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",lge="disabled:opacity-50 disabled:cursor-not-allowed";function abt(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=abt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function sbt(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=abt(e))&&(r&&(r+=" "),r+=t);return r}const cnr=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},unr=(e,t)=>({classGroupId:e,validator:t}),ibt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),v3="-",J5e=[],dnr="arbitrary..",fnr=e=>{const t=pnr(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return hnr(i);const l=i.split(v3),c=l[0]===""&&l.length>1?1:0;return obt(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],u=n[i];return c?u?cnr(u,c):c:u||J5e}return n[i]||J5e}}},obt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],s=n.nextPart.get(a);if(s){const u=obt(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const l=t===0?e.join(v3):e.slice(t).join(v3),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},hnr=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?dnr+r:void 0})(),pnr=e=>{const{theme:t,classGroups:n}=e;return mnr(n,t)},mnr=(e,t)=>{const n=ibt();for(const r in e){const a=e[r];cge(a,n,r,t)}return n},cge=(e,t,n,r)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];gnr(i,t,n,r)}},gnr=(e,t,n,r)=>{if(typeof e=="string"){vnr(e,t,n);return}if(typeof e=="function"){ynr(e,t,n,r);return}bnr(e,t,n,r)},vnr=(e,t,n)=>{const r=e===""?t:lbt(t,e);r.classGroupId=n},ynr=(e,t,n,r)=>{if(xnr(e)){cge(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(unr(n,e))},bnr=(e,t,n,r)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[l,c]=a[i];cge(c,lbt(t,l),n,r)}},lbt=(e,t)=>{let n=e;const r=t.split(v3),a=r.length;for(let s=0;s<a;s++){const i=r[s];let l=n.nextPart.get(i);l||(l=ibt(),n.nextPart.set(i,l)),n=l}return n},xnr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,wnr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const a=(s,i)=>{n[s]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let i=n[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return a(s,i),i},set(s,i){s in n?n[s]=i:a(s,i)}}},ose="!",e6e=":",Snr=[],t6e=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),Onr=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const s=[];let i=0,l=0,c=0,u;const d=a.length;for(let g=0;g<d;g++){const v=a[g];if(i===0&&l===0){if(v===e6e){s.push(a.slice(c,g)),c=g+1;continue}if(v==="/"){u=g;continue}}v==="["?i++:v==="]"?i--:v==="("?l++:v===")"&&l--}const f=s.length===0?a:a.slice(c);let h=f,p=!1;f.endsWith(ose)?(h=f.slice(0,-1),p=!0):f.startsWith(ose)&&(h=f.slice(1),p=!0);const m=u&&u>c?u-c:void 0;return t6e(s,p,h,m)};if(t){const a=t+e6e,s=r;r=i=>i.startsWith(a)?s(i.slice(a.length)):t6e(Snr,!1,i,void 0,!0)}if(n){const a=r;r=s=>n({className:s,parseClassName:a})}return r},knr=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let s=0;s<n.length;s++){const i=n[s],l=i[0]==="[",c=t.has(i);l||c?(a.length>0&&(a.sort(),r.push(...a),a=[]),r.push(i)):a.push(i)}return a.length>0&&(a.sort(),r.push(...a)),r}},_nr=e=>({cache:wnr(e.cacheSize),parseClassName:Onr(e),sortModifiers:knr(e),...fnr(e)}),Enr=/\s+/,Cnr=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],l=e.trim().split(Enr);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let v=!!g,x=r(v?m.substring(0,g):m);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=r(m),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const w=h.length===0?"":h.length===1?h[0]:s(h).join(":"),O=p?w+ose:w,k=O+x;if(i.indexOf(k)>-1)continue;i.push(k);const _=a(x,v);for(let C=0;C<_.length;++C){const T=_[C];i.push(O+T)}c=d+(c.length>0?" "+c:c)}return c},jnr=(...e)=>{let t=0,n,r,a="";for(;t<e.length;)(n=e[t++])&&(r=cbt(n))&&(a&&(a+=" "),a+=r);return a},cbt=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=cbt(e[r]))&&(n&&(n+=" "),n+=t);return n},n6e=(e,...t)=>{let n,r,a,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=_nr(u),r=n.cache.get,a=n.cache.set,s=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=Cnr(c,n);return a(c,d),d};return s=i,(...c)=>s(jnr(...c))},Tnr=[],ko=e=>{const t=n=>n[e]||Tnr;return t.isThemeGetter=!0,t},ubt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dbt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Nnr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Anr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Inr=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Rnr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Pnr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Mnr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wy=e=>Nnr.test(e),Dr=e=>!!e&&!Number.isNaN(Number(e)),Sy=e=>!!e&&Number.isInteger(Number(e)),EJ=e=>e.endsWith("%")&&Dr(e.slice(0,-1)),bg=e=>Anr.test(e),fbt=()=>!0,Dnr=e=>Inr.test(e)&&!Rnr.test(e),uge=()=>!1,$nr=e=>Pnr.test(e),Lnr=e=>Mnr.test(e),Fnr=e=>!yn(e)&&!On(e),znr=e=>tx(e,mbt,uge),yn=e=>ubt.test(e),Fx=e=>tx(e,gbt,Dnr),r6e=e=>tx(e,Gnr,Dr),Bnr=e=>tx(e,ybt,fbt),Unr=e=>tx(e,vbt,uge),a6e=e=>tx(e,hbt,uge),qnr=e=>tx(e,pbt,Lnr),HD=e=>tx(e,bbt,$nr),On=e=>dbt.test(e),FC=e=>pS(e,gbt),Vnr=e=>pS(e,vbt),s6e=e=>pS(e,hbt),Hnr=e=>pS(e,mbt),Qnr=e=>pS(e,pbt),QD=e=>pS(e,bbt,!0),Wnr=e=>pS(e,ybt,!0),tx=(e,t,n)=>{const r=ubt.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},pS=(e,t,n=!1)=>{const r=dbt.exec(e);return r?r[1]?t(r[1]):n:!1},hbt=e=>e==="position"||e==="percentage",pbt=e=>e==="image"||e==="url",mbt=e=>e==="length"||e==="size"||e==="bg-size",gbt=e=>e==="length",Gnr=e=>e==="number",vbt=e=>e==="family-name",ybt=e=>e==="number"||e==="weight",bbt=e=>e==="shadow",i6e=()=>{const e=ko("color"),t=ko("font"),n=ko("text"),r=ko("font-weight"),a=ko("tracking"),s=ko("leading"),i=ko("breakpoint"),l=ko("container"),c=ko("spacing"),u=ko("radius"),d=ko("shadow"),f=ko("inset-shadow"),h=ko("text-shadow"),p=ko("drop-shadow"),m=ko("blur"),g=ko("perspective"),v=ko("aspect"),x=ko("ease"),w=ko("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...k(),On,yn],C=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[On,yn,c],A=()=>[wy,"full","auto",...j()],I=()=>[Sy,"none","subgrid",On,yn],P=()=>["auto",{span:["full",Sy,On,yn]},Sy,On,yn],M=()=>[Sy,"auto",On,yn],F=()=>["auto","min","max","fr",On,yn],D=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...j()],z=()=>[wy,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],Q=()=>[wy,"screen","full","dvw","lvw","svw","min","max","fit",...j()],W=()=>[wy,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],$=()=>[e,On,yn],Z=()=>[...k(),s6e,a6e,{position:[On,yn]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],R=()=>["auto","cover","contain",Hnr,znr,{size:[On,yn]}],H=()=>[EJ,FC,Fx],G=()=>["","none","full",u,On,yn],J=()=>["",Dr,FC,Fx],ie=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Dr,EJ,s6e,a6e],le=()=>["","none",m,On,yn],fe=()=>["none",Dr,On,yn],X=()=>["none",Dr,On,yn],re=()=>[Dr,On,yn],oe=()=>[wy,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[bg],breakpoint:[bg],color:[fbt],container:[bg],"drop-shadow":[bg],ease:["in","out","in-out"],font:[Fnr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[bg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[bg],shadow:[bg],spacing:["px",Dr],text:[bg],"text-shadow":[bg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wy,yn,On,v]}],container:["container"],columns:[{columns:[Dr,yn,On,l]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Sy,"auto",On,yn]}],basis:[{basis:[wy,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Dr,wy,"auto","initial","none",yn]}],grow:[{grow:["",Dr,On,yn]}],shrink:[{shrink:["",Dr,On,yn]}],order:[{order:[Sy,"first","last","none",On,yn]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...D(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...D()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":D()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],"inline-size":[{inline:["auto",...Q()]}],"min-inline-size":[{"min-inline":["auto",...Q()]}],"max-inline-size":[{"max-inline":["none",...Q()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[l,"screen",...z()]}],"min-w":[{"min-w":[l,"screen","none",...z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",n,FC,Fx]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Wnr,Bnr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",EJ,yn]}],"font-family":[{font:[Vnr,Unr,t]}],"font-features":[{"font-features":[yn]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,On,yn]}],"line-clamp":[{"line-clamp":[Dr,"none",On,r6e]}],leading:[{leading:[s,...j()]}],"list-image":[{"list-image":["none",On,yn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",On,yn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[Dr,"from-font","auto",On,Fx]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[Dr,"auto",On,yn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",On,yn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",On,yn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sy,On,yn],radial:["",On,yn],conic:[Sy,On,yn]},Qnr,qnr]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-bs":[{"border-bs":$()}],"border-color-be":[{"border-be":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Dr,On,yn]}],"outline-w":[{outline:["",Dr,FC,Fx]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",d,QD,HD]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",f,QD,HD]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[Dr,Fx]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",h,QD,HD]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[Dr,On,yn]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Dr]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[On,yn]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[Dr]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",On,yn]}],filter:[{filter:["","none",On,yn]}],blur:[{blur:le()}],brightness:[{brightness:[Dr,On,yn]}],contrast:[{contrast:[Dr,On,yn]}],"drop-shadow":[{"drop-shadow":["","none",p,QD,HD]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",Dr,On,yn]}],"hue-rotate":[{"hue-rotate":[Dr,On,yn]}],invert:[{invert:["",Dr,On,yn]}],saturate:[{saturate:[Dr,On,yn]}],sepia:[{sepia:["",Dr,On,yn]}],"backdrop-filter":[{"backdrop-filter":["","none",On,yn]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[Dr,On,yn]}],"backdrop-contrast":[{"backdrop-contrast":[Dr,On,yn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Dr,On,yn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Dr,On,yn]}],"backdrop-invert":[{"backdrop-invert":["",Dr,On,yn]}],"backdrop-opacity":[{"backdrop-opacity":[Dr,On,yn]}],"backdrop-saturate":[{"backdrop-saturate":[Dr,On,yn]}],"backdrop-sepia":[{"backdrop-sepia":["",Dr,On,yn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",On,yn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Dr,"initial",On,yn]}],ease:[{ease:["linear","initial",x,On,yn]}],delay:[{delay:[Dr,On,yn]}],animate:[{animate:["none",w,On,yn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,On,yn]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[On,yn,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",On,yn]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",On,yn]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[Dr,FC,Fx,r6e]}],stroke:[{stroke:["none",...$()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Znr=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:a={},override:s={}})=>(Oj(e,"cacheSize",t),Oj(e,"prefix",n),Oj(e,"experimentalParseClassName",r),WD(e.theme,s.theme),WD(e.classGroups,s.classGroups),WD(e.conflictingClassGroups,s.conflictingClassGroups),WD(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),Oj(e,"orderSensitiveModifiers",s.orderSensitiveModifiers),GD(e.theme,a.theme),GD(e.classGroups,a.classGroups),GD(e.conflictingClassGroups,a.conflictingClassGroups),GD(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),xbt(e,a,"orderSensitiveModifiers"),e),Oj=(e,t,n)=>{n!==void 0&&(e[t]=n)},WD=(e,t)=>{if(t)for(const n in t)Oj(e,n,t[n])},GD=(e,t)=>{if(t)for(const n in t)xbt(e,t,n)},xbt=(e,t,n)=>{const r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},Ynr=(e,...t)=>typeof e=="function"?n6e(i6e,e,...t):n6e(()=>Znr(i6e(),e),...t),Xnr=Object.keys({...G6,...hXt}),Knr=Object.keys(bXt),Jnr=Object.keys(pXt),err=Object.keys(mXt),trr=Object.keys(fXt),zx=Object.keys(yXt),nrr=Object.keys(gXt).concat(Object.keys(vXt)),rrr=Ynr({extend:{theme:{color:Xnr,spacing:Knr,radius:trr,leading:err,shadow:nrr},classGroups:{"font-size":[{text:Jnr}],h:[{h:zx}],w:[{w:zx}],size:[{size:zx}],"min-h":[{"min-h":zx}],"min-w":[{"min-w":zx}],"max-h":[{"max-h":zx}],"max-w":[{"max-w":zx}]}}});function Y(...e){return rrr(sbt(e))}const arr={sm:`${Ql.sm} text-ui-sm px-[.75em]`,md:`${Ql.md} text-ui-md px-[.75em]`,default:`${Ql.default} text-ui-md px-[.85em] `,lg:`${Ql.lg} text-ui-lg px-[1em] `},srr={default:"bg-surface3 border-2 border-border1 hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral5",primary:"bg-surface4 border-2 border-border2 hover:text-neutral6 hover:bg-surface5 active:bg-surface6 text-neutral6",cta:"bg-accent1/50 hover:bg-accent1/80 text-neutral5 font-semibold",ghost:"bg-transparent border-2 border-transparent hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral4",inputLike:ige,light:"",outline:""},irr=Y("flex items-center justify-center gap-[.75em] leading-0 transition-colors duration-200 ease-out-custom rounded-lg","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mx-[-.3em]","[&>svg]:opacity-50 [&:hover>svg]:opacity-100",lge,oge),orr={light:"default",outline:"default"};function lrr(e){return orr[e]??e}function X_(e){const t=lrr(e?.variant||"default"),n=e?.size||"default";return Y(irr,srr[t],arr[n],e?.iconOnly&&"[&>svg]:opacity-75")}function wbt(e){const t=[];return Ne.Children.forEach(e,n=>{Ne.isValidElement(n)&&n.type===Ne.Fragment?t.push(...wbt(n.props.children)):t.push(n)}),t}function crr(e){const t=wbt(e);return t.length>0&&t.every(n=>Ne.isValidElement(n))}const ye=Ne.forwardRef(({className:e,as:t,size:n="default",variant:r="default",disabled:a,children:s,...i},l)=>{const c=t||"button",u=crr(s);return o.jsx(c,{ref:l,disabled:a,className:Y(X_({variant:r,size:n,iconOnly:u}),e),...i,children:s})});ye.displayName="Button";const Fu=yFt,tr=bFt,nr=xFt,Kn=b.forwardRef(({className:e,sideOffset:t=4,children:n,...r},a)=>o.jsx(wFt,{children:o.jsxs(xGe,{ref:a,sideOffset:t,className:Y("z-50 overflow-hidden rounded-md bg-surface3 px-3 py-1.5 text-xs text-neutral4 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r,children:[n,o.jsx(SFt,{className:"fill-surface3"})]})}));Kn.displayName=xGe.displayName;const Ni=Ne.forwardRef(({tooltipContent:e,...t},n)=>o.jsxs(tr,{children:[o.jsx(nr,{asChild:!0,children:o.jsx(ye,{ref:n,...t})}),e&&o.jsx(Kn,{children:e})]}));Ni.displayName="ButtonWithTooltip";const Er=g6,Sbt=NYe,urr=v6,Obt=b.forwardRef(({className:e,...t},n)=>o.jsx(yI,{ref:n,className:Y("fixed inset-0 z-50 bg-overlay backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Obt.displayName=yI.displayName;const yr=b.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(urr,{children:[o.jsx(Obt,{}),o.jsxs(bI,{ref:r,className:Y("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-bottom-4","data-[state=open]:slide-in-from-bottom-4",e),...n,children:[t,o.jsxs(x6,{className:Y("absolute right-4 top-4 rounded-md p-1","text-neutral3 hover:text-neutral6 hover:bg-surface4","transition-all duration-normal ease-out-custom","focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","disabled:pointer-events-none"),children:[o.jsx(Wn,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));yr.displayName=bI.displayName;const Cr=({className:e,...t})=>o.jsx("div",{className:Y("flex flex-col space-y-1.5 text-center sm:text-left border-b border-border1 pb-4 px-6",e),...t});Cr.displayName="DialogHeader";const $d=({className:e,...t})=>o.jsx("div",{className:Y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});$d.displayName="DialogFooter";const Lr=({className:e,...t})=>o.jsx("div",{className:Y("overflow-y-auto px-6 max-h-[50vh]",e),...t});Lr.displayName="DialogBody";const br=b.forwardRef(({className:e,...t},n)=>o.jsx(y6,{ref:n,className:Y("text-ui-md font-medium",e),...t}));br.displayName=y6.displayName;const Ka=b.forwardRef(({className:e,...t},n)=>o.jsx(b6,{ref:n,className:Y("sr-only",e),...t}));Ka.displayName=b6.displayName;const o6e=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,l6e=sbt,AR=(e,t)=>n=>{var r;if(t?.variants==null)return l6e(e,n?.class,n?.className);const{variants:a,defaultVariants:s}=t,i=Object.keys(a).map(u=>{const d=n?.[u],f=s?.[u];if(d===null)return null;const h=o6e(d)||o6e(f);return a[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(m=>{let[g,v]=m;return Array.isArray(v)?v.includes({...s,...l}[g]):{...s,...l}[g]===v})?[...u,f,h]:u},[]);return l6e(e,i,c,n?.class,n?.className)},drr=AR(Y("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70"),{variants:{variant:{default:Y(ige,oge,lge),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${Ql.sm} text-ui-sm px-[.75em]`,md:`${Ql.md} text-ui-md px-[.75em]`,default:`${Ql.default} text-ui-md px-[.85em]`,lg:`${Ql.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),cn=b.forwardRef(({className:e,size:t,testId:n,variant:r,type:a,error:s,...i},l)=>o.jsx("input",{type:a,className:Y(drr({variant:r,size:t}),s&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":n,ref:l,"aria-invalid":s,...i}));cn.displayName="Input";const frr=AR("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),St=b.forwardRef(({className:e,...t},n)=>o.jsx(Qet,{ref:n,className:Y(frr(),e),...t}));St.displayName=Qet.displayName;const hrr={"ui-xs":"text-ui-xs leading-ui-xs","ui-sm":"text-ui-sm leading-ui-sm","ui-smd":"text-ui-smd leading-ui-smd","ui-md":"text-ui-md leading-ui-md","ui-lg":"text-ui-lg leading-ui-lg","header-xs":"text-header-xs leading-header-xs","header-sm":"text-header-sm leading-header-sm","header-md":"text-header-md leading-header-md","header-lg":"text-header-lg leading-header-lg","header-xl":"text-header-xl leading-header-xl"},prr={mono:"font-mono"},ve=({as:e="p",className:t,variant:n="ui-md",font:r,...a})=>o.jsx(e,{className:Y(hrr[n],r&&prr[r],t),...a}),Xs=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 15C10.3565 15 12.137 14.2625 13.4497 12.9497C14.7625 11.637 15.5 9.85652 15.5 8C15.5 6.14348 14.7625 4.36301 13.4497 3.05025C12.137 1.7375 10.3565 1 8.5 1C6.64348 1 4.86301 1.7375 3.55025 3.05025C2.2375 4.36301 1.5 6.14348 1.5 8C1.5 9.85652 2.2375 11.637 3.55025 12.9497C4.86301 14.2625 6.64348 15 8.5 15ZM5.621 10.879L4.611 11.889C3.84179 11.1198 3.31794 10.1398 3.1057 9.07291C2.89346 8.00601 3.00236 6.90013 3.41864 5.89512C3.83491 4.89012 4.53986 4.03112 5.44434 3.42676C6.34881 2.8224 7.41219 2.49983 8.5 2.49983C9.58781 2.49983 10.6512 2.8224 11.5557 3.42676C12.4601 4.03112 13.1651 4.89012 13.5814 5.89512C13.9976 6.90013 14.1065 8.00601 13.8943 9.07291C13.6821 10.1398 13.1582 11.1198 12.389 11.889L11.379 10.879C11.1004 10.6003 10.7696 10.3792 10.4055 10.2284C10.0414 10.0776 9.6511 9.99995 9.257 10H7.743C7.3489 9.99995 6.95865 10.0776 6.59455 10.2284C6.23045 10.3792 5.89963 10.6003 5.621 10.879Z",fill:"currentColor"}),o.jsx("path",{d:"M8.5 4C7.96957 4 7.46086 4.21071 7.08579 4.58579C6.71071 4.96086 6.5 5.46957 6.5 6V6.5C6.5 7.03043 6.71071 7.53914 7.08579 7.91421C7.46086 8.28929 7.96957 8.5 8.5 8.5C9.03043 8.5 9.53914 8.28929 9.91421 7.91421C10.2893 7.53914 10.5 7.03043 10.5 6.5V6C10.5 5.46957 10.2893 4.96086 9.91421 4.58579C9.53914 4.21071 9.03043 4 8.5 4Z",fill:"currentColor"})]}),mrr=e=>o.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M63.0002 0.968262C28.5152 0.968262 0.55957 15.6484 0.55957 33.7573V51.2428C0.55957 69.3517 28.5152 84.0319 63.0002 84.0319C97.4853 84.0319 125.441 69.3517 125.441 51.2428V33.7573C125.441 15.6484 97.4853 0.968262 63.0002 0.968262Z",stroke:"#707070"}),o.jsx("path",{d:"M119.322 35.1636C119.322 50.3595 94.1055 62.6782 62.9998 62.6782C31.894 62.6782 6.67773 50.3595 6.67773 35.1636V49.8363C6.67773 65.0322 31.894 77.351 62.9998 77.351C94.1055 77.351 119.322 65.0322 119.322 49.8363V35.1636Z",fill:"#2E2E2E",fillOpacity:"0.9"}),o.jsx("path",{d:"M119.322 35.1636C119.322 50.3595 94.1055 62.6782 62.9998 62.6782C31.894 62.6782 6.67773 50.3595 6.67773 35.1636M119.322 35.1636C119.322 19.9677 94.1055 7.64893 62.9998 7.64893C31.894 7.64893 6.67773 19.9677 6.67773 35.1636M119.322 35.1636V49.8363C119.322 65.0322 94.1055 77.351 62.9998 77.351C31.894 77.351 6.67773 65.0322 6.67773 49.8363V35.1636",stroke:"#424242"}),o.jsxs("g",{clipPath:"url(#clip0_21421_19519)",children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.5383 47.0955C45.0714 50.3122 53.9322 52.1193 63.1714 52.1193C72.4106 52.1193 81.2714 50.3122 87.8045 47.0955C94.3376 43.8787 98.0078 39.5159 98.0078 34.9668C98.0078 30.4177 94.3376 26.0549 87.8045 22.8381C81.2714 19.6214 72.4106 17.8143 63.1714 17.8143C53.9322 17.8143 45.0714 19.6214 38.5383 22.8381C32.0052 26.0549 28.3349 30.4177 28.3349 34.9668C28.3349 39.5159 32.0052 43.8787 38.5383 47.0955ZM42.9089 34.9668L35.8005 34.9668C35.8004 32.3013 37.4056 29.6956 40.4132 27.4793C43.4207 25.263 47.6956 23.5355 52.6971 22.5154C57.6986 21.4954 63.2022 21.2285 68.5118 21.7485C73.8214 22.2685 78.6986 23.552 82.5266 25.4368C86.3546 27.3216 88.9615 29.723 90.0176 32.3373C91.0737 34.9517 90.5316 37.6614 88.4599 40.1241C86.3881 42.5867 82.8797 44.6915 78.3784 46.1723C73.8771 47.6532 68.585 48.4435 63.1714 48.4435V44.9435C63.1717 43.9778 62.7855 43.0215 62.035 42.1293C61.2845 41.2372 60.1843 40.4265 58.7973 39.7438L53.4695 37.1205C52.0828 36.4376 50.4364 35.8959 48.6244 35.5263C46.8124 35.1568 44.8702 34.9667 42.9089 34.9668Z",fill:"#A9A9A9"}),o.jsx("path",{d:"M77.2474 28.0361C75.3808 27.1171 72.8492 26.6007 70.2094 26.6007C67.5696 26.6007 65.038 27.1171 63.1714 28.0361L61.4119 28.9025C59.5453 29.8215 58.4966 31.068 58.4966 32.3678C58.4966 33.6676 59.5453 34.9141 61.4119 35.8331C63.2785 36.7522 65.8101 37.2685 68.4499 37.2685C71.0897 37.2685 73.6213 36.7522 75.4879 35.8331L77.2474 34.9668C79.114 34.0477 80.1627 32.8012 80.1627 31.5015C80.1627 30.2017 79.114 28.9552 77.2474 28.0361Z",fill:"#A9A9A9"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21421_19519",children:o.jsx("rect",{width:"62.7591",height:"62.7591",fill:"white",transform:"matrix(0.897148 0.441731 -0.897148 0.441731 63.1714 7.24365)"})})})]}),grr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M11.0313 7.97578C11.0313 9.34436 9.92183 10.4538 8.55324 10.4538C7.18466 10.4538 6.0752 9.34436 6.0752 7.97578C6.0752 6.60719 7.18466 5.49773 8.55324 5.49773C9.92183 5.49773 11.0313 6.60719 11.0313 7.97578ZM11.0313 7.97578H14.573",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"}),o.jsx("path",{d:"M12.967 4.46154C11.9273 3.14431 10.3165 2.29883 8.50814 2.29883C5.37277 2.29883 2.83105 4.84055 2.83105 7.97591C2.83105 11.1113 5.37277 13.653 8.50814 13.653C10.3165 13.653 11.9273 12.8075 12.967 11.4903",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"})]}),dge=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.97865 4.57004C8.22604 4.75795 8.27426 5.11082 8.08635 5.35821L6.05486 8.03279C5.94873 8.17251 5.78348 8.25471 5.60803 8.25505C5.43257 8.2554 5.267 8.17385 5.16032 8.03454L3.80937 6.27034C3.6205 6.02369 3.66733 5.67063 3.91398 5.48176C4.16063 5.29288 4.51369 5.33972 4.70257 5.58637L5.6051 6.76498L7.19048 4.67774C7.37839 4.43036 7.73126 4.38213 7.97865 4.57004Z",fill:"currentColor"})]}),fge=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.89741 4.10293C8.11707 4.32261 8.11706 4.67877 7.89738 4.89843L6.79517 6.00058L7.8962 7.10155C8.11588 7.32122 8.11589 7.67737 7.89623 7.89705C7.67656 8.11673 7.32041 8.11674 7.10073 7.89707L5.99965 6.79605L4.89856 7.89707C4.67889 8.11673 4.32273 8.11672 4.10307 7.89704C3.88341 7.67737 3.88342 7.32121 4.10309 7.10155L5.20413 6.00058L4.10191 4.89843C3.88224 4.67877 3.88223 4.32262 4.10189 4.10294C4.32155 3.88326 4.67771 3.88325 4.89738 4.10292L5.99965 5.20511L7.10191 4.10291C7.32159 3.88325 7.67774 3.88326 7.89741 4.10293Z",fill:"currentColor"})]}),Fl=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.1747 3.18598L7.02554 1.95209C7.11557 1.89207 7.31087 1.87106 7.41016 1.90924L12.4139 3.83377C12.4683 3.85467 12.546 3.96798 12.546 4.03118V13.0167C12.546 13.265 12.7473 13.4663 12.9956 13.4663C13.2439 13.4663 13.4452 13.265 13.4452 13.0167V4.03118C13.4452 3.59605 13.1384 3.14906 12.7367 2.99456L7.73293 1.07004C7.36225 0.927472 6.86056 0.981451 6.52679 1.20396L4.20445 2.75219L3.90419 2.95236L3.90647 2.95824C3.69329 3.05449 3.55469 3.27599 3.55469 3.57581V11.7119C3.55469 12.2084 3.93067 12.7499 4.39251 12.9206L9.89804 14.955C10.3608 15.126 10.7359 14.8596 10.7359 14.3659V5.83295C10.7359 5.33662 10.3498 4.81289 9.88389 4.66643L5.1747 3.18598Z",fill:"currentColor"})}),kbt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:o.jsx("path",{d:"M7.5 0.75C3.6325 0.75 0.5 3.8825 0.5 7.75C0.5 10.8475 2.50375 13.4637 5.28625 14.3912C5.63625 14.4525 5.7675 14.2425 5.7675 14.0587C5.7675 13.8925 5.75875 13.3412 5.75875 12.755C4 13.0787 3.545 12.3262 3.405 11.9325C3.32625 11.7312 2.985 11.11 2.6875 10.9437C2.4425 10.8125 2.0925 10.4887 2.67875 10.48C3.23 10.4712 3.62375 10.9875 3.755 11.1975C4.385 12.2562 5.39125 11.9587 5.79375 11.775C5.855 11.32 6.03875 11.0137 6.24 10.8387C4.6825 10.6637 3.055 10.06 3.055 7.3825C3.055 6.62125 3.32625 5.99125 3.7725 5.50125C3.7025 5.32625 3.4575 4.60875 3.8425 3.64625C3.8425 3.64625 4.42875 3.4625 5.7675 4.36375C6.3275 4.20625 6.9225 4.1275 7.5175 4.1275C8.1125 4.1275 8.7075 4.20625 9.2675 4.36375C10.6062 3.45375 11.1925 3.64625 11.1925 3.64625C11.5775 4.60875 11.3325 5.32625 11.2625 5.50125C11.7087 5.99125 11.98 6.6125 11.98 7.3825C11.98 10.0687 10.3438 10.6637 8.78625 10.8387C9.04 11.0575 9.25875 11.4775 9.25875 12.1337C9.25875 13.07 9.25 13.8225 9.25 14.0587C9.25 14.2425 9.38125 14.4612 9.73125 14.3912C11.1209 13.9221 12.3284 13.029 13.1839 11.8377C14.0393 10.6463 14.4996 9.21668 14.5 7.75C14.5 3.8825 11.3675 0.75 7.5 0.75Z",fill:"currentColor"})}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_22095",children:o.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),_bt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[o.jsx("path",{d:"M13.5037 7.54867C13.5037 7.1144 13.4648 6.69683 13.3924 6.29596H7.62436V8.66776H10.9204C10.7756 9.43052 10.3413 10.0764 9.68994 10.5106V12.0529H11.6776C12.8356 10.9839 13.5037 9.41382 13.5037 7.54867Z",fill:"#4285F4"}),o.jsx("path",{d:"M7.62415 13.5339C9.27773 13.5339 10.6643 12.9882 11.6776 12.0529L9.68994 10.5106C9.14431 10.8781 8.44816 11.1009 7.62415 11.1009C6.03182 11.1009 4.67889 10.0263 4.19451 8.57877H2.15677V10.16C3.1645 12.1587 5.23008 13.5339 7.62415 13.5339Z",fill:"#34A853"}),o.jsx("path",{d:"M4.19472 8.57315C4.07223 8.20569 3.99985 7.81595 3.99985 7.40952C3.99985 7.00308 4.07223 6.61335 4.19472 6.24589V4.66469H2.15698C1.73941 5.4887 1.5 6.41849 1.5 7.40952C1.5 8.40055 1.73941 9.33034 2.15698 10.1543L3.74374 8.91834L4.19472 8.57315Z",fill:"#FBBC05"}),o.jsx("path",{d:"M7.62415 3.72376C8.5261 3.72376 9.32783 4.03555 9.96811 4.63685L11.7219 2.88306C10.6585 1.89202 9.27773 1.28516 7.62415 1.28516C5.23008 1.28516 3.16471 2.66036 2.15698 4.66469L4.19472 6.24589C4.6791 4.79832 6.03182 3.72376 7.62415 3.72376Z",fill:"#EA4335"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_20513",children:o.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),vrr={sm:"[&>svg]:h-icon-sm [&>svg]:w-icon-sm",default:"[&>svg]:h-icon-default [&>svg]:w-icon-default",lg:"[&>svg]:h-icon-lg [&>svg]:w-icon-lg"},_e=({children:e,className:t,size:n="default",...r})=>o.jsx("span",{className:Y("block",vrr[n],t),...r,children:e}),yrr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M4.31445 3.16083C3.78402 3.16083 3.27531 3.37154 2.90024 3.74661C2.52517 4.12169 2.31445 4.63039 2.31445 5.16083V5.66083C2.31445 6.19126 2.52517 6.69997 2.90024 7.07504C3.27531 7.45011 3.78402 7.66083 4.31445 7.66083C4.84489 7.66083 5.35359 7.45011 5.72867 7.07504C6.10374 6.69997 6.31445 6.19126 6.31445 5.66083V5.16083C6.31445 4.63039 6.10374 4.12169 5.72867 3.74661C5.35359 3.37154 4.84489 3.16083 4.31445 3.16083Z",fill:"currentColor"}),o.jsx("path",{d:"M6.76666 9.50235C6.57678 9.28532 6.30244 9.16083 6.01407 9.16083H4.50201C4.10791 9.16078 3.71766 9.23838 3.35356 9.38921C3.11733 9.48706 2.8951 9.6145 2.69205 9.76806C2.48056 9.928 2.38001 10.1888 2.38001 10.454V13.0642C2.38001 13.6165 2.82773 14.0642 3.38001 14.0642H8.55436C9.4135 14.0642 9.87269 13.0523 9.30695 12.4057L6.76666 9.50235Z",fill:"currentColor"}),o.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),hge=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M3.8674 9.19968L4.14554 10.8649C4.23965 11.4283 4.75254 11.8237 5.32137 11.7713L5.58252 11.7472C6.56555 11.6567 7.43309 12.3868 7.51181 13.3708L7.59308 14.3867C7.60422 14.5259 7.71868 14.6342 7.85825 14.6376L9.91053 14.6876C10.1066 14.6924 10.2434 14.4948 10.17 14.3129L8.90452 11.1782C8.80956 10.9429 8.65085 10.7389 8.44626 10.5889L7.90134 10.1895C7.70604 10.0464 7.55223 9.85411 7.45759 9.63124C7.15011 8.90712 6.6579 7.71234 6.37054 6.88944C6.19204 6.3783 5.79931 6.29158 5.45492 6.21553C4.98179 6.11106 4.5999 6.02673 4.99001 4.88985C5.66408 2.92541 8.06015 2.07904 10.6601 3.33088C12.6488 4.2884 13.1187 6.35416 13.0328 7.58237C13.0297 7.62768 13.0214 7.67186 13.0094 7.71566C12.8829 8.17534 12.368 8.40491 11.9415 8.19169L10.3022 7.37201C10.2069 7.32439 10.0927 7.33657 10.0096 7.40322L8.64809 8.49559C8.55405 8.57104 8.52072 8.69931 8.56615 8.811L10.8995 14.5478C10.9404 14.6483 11.0369 14.715 11.1454 14.7177L12.0572 14.7399C12.2581 14.7448 12.3951 14.5382 12.3124 14.3551L11.8681 13.3706C11.4211 12.3803 11.6047 11.2192 12.3354 10.4151L13.4616 9.17575C13.7473 8.86125 13.9224 8.46187 13.9599 8.03858L13.9763 7.85359C14.2866 4.35298 11.377 1.41272 7.87336 1.68639C6.03919 1.82965 4.45399 3.02228 3.80807 4.74492L3.70275 5.02579C3.5828 5.34571 3.62741 5.70411 3.82213 5.98485L3.88946 6.08192C4.12183 6.41695 4.0958 6.86726 3.82637 7.17328L3.06705 8.03572C2.96261 8.15435 2.98058 8.33664 3.10617 8.43259L3.66059 8.85617C3.77064 8.94026 3.84458 9.06307 3.8674 9.19968Z",fill:"currentColor"})}),pge=e=>o.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.40864 11.9983C7.58064 11.9733 6.84164 11.6153 6.31564 11.0563C6.31464 11.0563 6.31464 11.0553 6.31464 11.0553C5.78864 10.4963 5.47564 9.73633 5.50064 8.90833C5.52564 8.08033 5.88464 7.34133 6.44364 6.81533C7.00264 6.28833 7.76264 5.97633 8.59064 6.00133C9.41864 6.02633 10.1576 6.38433 10.6836 6.94333H10.6846C11.2106 7.50333 11.5236 8.26233 11.4986 9.09033C11.4726 9.91833 11.1146 10.6583 10.5556 11.1843C9.99664 11.7103 9.23664 12.0233 8.40864 11.9983ZM16.1266 8.15033L14.3606 7.74033C14.2316 7.14133 14.0146 6.57633 13.7216 6.05733L14.7726 4.57933C14.9116 4.38533 14.8926 4.12033 14.7296 3.94633L13.9206 3.08733C13.7576 2.91333 13.4946 2.87933 13.2916 3.00533L11.7526 3.96533C11.2526 3.64133 10.7016 3.39033 10.1116 3.22633L9.80964 1.43833C9.76964 1.20333 9.56964 1.02833 9.33164 1.02133L8.15264 0.985326C7.91364 0.978326 7.70364 1.14033 7.64964 1.37233L7.24064 3.13933C6.64164 3.26733 6.07664 3.48433 5.55664 3.77733L4.07864 2.72633C3.88464 2.58833 3.61964 2.60633 3.44664 2.76933L2.58664 3.57833C2.41364 3.74133 2.37964 4.00533 2.50564 4.20733L3.46564 5.74633C3.14164 6.24633 2.89064 6.79833 2.72564 7.38833L0.937635 7.68933C0.702635 7.72933 0.528635 7.92933 0.520635 8.16733L0.485635 9.34733C0.477635 9.58533 0.639635 9.79533 0.872635 9.84933L2.63864 10.2583C2.76764 10.8573 2.98464 11.4233 3.27764 11.9423L2.22564 13.4203C2.08764 13.6143 2.10564 13.8793 2.26964 14.0523L3.07864 14.9123C3.24164 15.0853 3.50464 15.1203 3.70664 14.9933L5.24564 14.0333C5.74663 14.3583 6.29764 14.6093 6.88764 14.7733L7.18964 16.5613C7.22864 16.7963 7.42864 16.9713 7.66764 16.9783L8.84663 17.0143C9.08564 17.0213 9.29564 16.8593 9.34964 16.6273L9.75864 14.8603C10.3576 14.7323 10.9226 14.5153 11.4416 14.2213L12.9206 15.2733C13.1146 15.4113 13.3786 15.3933 13.5526 15.2293L14.4116 14.4213C14.5856 14.2573 14.6196 13.9943 14.4936 13.7923L13.5336 12.2533C13.8576 11.7523 14.1086 11.2013 14.2726 10.6113L16.0616 10.3103C16.2966 10.2703 16.4706 10.0703 16.4776 9.83233L16.5136 8.65233C16.5206 8.41433 16.3586 8.20433 16.1266 8.15033Z",fill:"currentColor"})}),brr=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),Po=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.5605 1.42351C8.0791 0.904904 8.92215 0.906157 9.4395 1.42351L10.6922 2.67617C11.2108 3.19477 11.2095 4.03782 10.6922 4.55517L9.4395 5.80783C8.9209 6.32643 8.07785 6.32518 7.5605 5.80783L6.30784 4.55517C5.78923 4.03656 5.79049 3.19352 6.30784 2.67617L7.5605 1.42351ZM3.17618 5.80783C3.69478 5.28923 4.53782 5.29048 5.05517 5.80783L6.30784 7.0605C6.82644 7.5791 6.82519 8.42214 6.30784 8.93949L5.05517 10.1922C4.53657 10.7108 3.69353 10.7095 3.17618 10.1922L1.92351 8.93949C1.40491 8.42089 1.40616 7.57785 1.92351 7.0605L3.17618 5.80783ZM11.9448 5.80783C12.4634 5.28923 13.3065 5.29048 13.8238 5.80783L15.0765 7.0605C15.5951 7.5791 15.5938 8.42214 15.0765 8.93949L13.8238 10.1922C13.3052 10.7108 12.4622 10.7095 11.9448 10.1922L10.6922 8.93949C10.1736 8.42089 10.1748 7.57785 10.6922 7.0605L11.9448 5.80783ZM7.5605 10.1922C8.0791 9.67355 8.92215 9.67481 9.4395 10.1922L10.6922 11.4448C11.2108 11.9634 11.2095 12.8065 10.6922 13.3238L9.4395 14.5765C8.9209 15.0951 8.07785 15.0938 7.5605 14.5765L6.30784 13.3238C5.78923 12.8052 5.79049 11.9622 6.30784 11.4448L7.5605 10.1922Z",fill:"currentColor"})}),K_=e=>o.jsx(iXt,{...e}),tl=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.24388 2.4018C6.24388 2.0394 6.53767 1.74561 6.90008 1.74561H10.0991C10.4614 1.74561 10.7553 2.0394 10.7553 2.4018V4.57546C10.7553 4.93787 10.4614 5.23166 10.0991 5.23166H9.31982V7.35469L10.0033 9.22664C9.90442 9.20146 9.80035 9.1761 9.6915 9.14986L9.62652 9.13422C9.30473 9.05687 8.92256 8.96501 8.61993 8.84491C8.5819 8.82981 8.54147 8.81292 8.49957 8.79391C8.45767 8.81292 8.41724 8.82981 8.3792 8.84491C8.07657 8.96501 7.6944 9.05687 7.37261 9.13422L7.30763 9.14986C7.19879 9.1761 7.09471 9.20146 6.99577 9.22664L7.67932 7.35469V5.23166H6.90008C6.53767 5.23166 6.24388 4.93787 6.24388 4.57546V2.4018ZM6.99577 9.22664C6.99577 9.22664 6.99578 9.22664 6.99577 9.22664L6.43283 10.7683H6.81806C7.18047 10.7683 7.47426 11.0622 7.47426 11.4245V13.5982C7.47426 13.9606 7.18047 14.2544 6.81806 14.2544H3.61909C3.25668 14.2544 2.96289 13.9606 2.96289 13.5982V11.4245C2.96289 11.0622 3.25668 10.7683 3.61909 10.7683H4.26617C4.2921 10.4663 4.32783 10.1494 4.37744 9.85171C4.43762 9.49063 4.52982 9.08135 4.68998 8.76102C4.93975 8.2615 5.44743 8.01751 5.7771 7.88788C6.14684 7.74249 6.57537 7.63889 6.92317 7.55505C7.24707 7.47696 7.49576 7.41679 7.67932 7.35469L6.99577 9.22664ZM6.43283 10.7683L6.99577 9.22664C6.75846 9.28705 6.55067 9.34646 6.37745 9.41458C6.22784 9.47341 6.1623 9.51712 6.14023 9.53254C6.09752 9.63631 6.04409 9.83055 5.99562 10.1214C5.96201 10.3231 5.93498 10.5439 5.91341 10.7683H6.43283ZM10.0033 9.22664L9.31982 7.35469C9.50338 7.41679 9.75206 7.47696 10.076 7.55505C10.4238 7.63889 10.8523 7.74249 11.2221 7.88788C11.5517 8.01751 12.0594 8.2615 12.3091 8.76102C12.4693 9.08135 12.5615 9.49063 12.6217 9.85171C12.6713 10.1494 12.707 10.4663 12.733 10.7683H13.38C13.7424 10.7683 14.0362 11.0622 14.0362 11.4245V13.5982C14.0362 13.9606 13.7424 14.2544 13.38 14.2544H10.1811C9.81867 14.2544 9.52488 13.9606 9.52488 13.5982V11.4245C9.52488 11.0622 9.81867 10.7683 10.1811 10.7683H10.5663L10.0033 9.22664ZM10.0033 9.22664L10.5663 10.7683H11.0857C11.0642 10.5439 11.0372 10.3231 11.0035 10.1214C10.9551 9.83055 10.9016 9.63631 10.8589 9.53254C10.8369 9.51712 10.7713 9.47341 10.6217 9.41458C10.4485 9.34646 10.2407 9.28705 10.0033 9.22664Z",fill:"currentColor"})}),Tu=e=>o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M6.53918 9.32122C6.34324 9.51508 6.02724 9.51338 5.83338 9.31744C5.63952 9.1215 5.6412 8.80551 5.83713 8.61164L10.1958 4.29931C10.7996 3.70186 10.8017 2.72852 10.2041 2.12839L10.1899 2.11428C9.58767 1.52481 8.62251 1.53208 8.0292 2.13052L2.29396 7.91536C2.0999 8.1111 1.78388 8.11246 1.58813 7.9184C1.39239 7.72433 1.39103 7.40831 1.58509 7.21257L7.32036 1.42774C8.30005 0.439581 9.89369 0.427613 10.8881 1.40094L10.9116 1.42425C11.4942 2.00929 11.7316 2.80913 11.6232 3.56922C12.389 3.44866 13.1999 3.67918 13.7961 4.26273C14.804 5.24929 14.8147 6.86824 13.82 7.86808L8.5531 13.1619C8.50045 13.2148 8.50024 13.3002 8.55263 13.3534L9.65448 14.4717C9.84794 14.668 9.8456 14.984 9.64925 15.1775C9.45291 15.3709 9.13691 15.3686 8.94345 15.1723L7.84163 14.054C7.40505 13.6109 7.40677 12.8988 7.8455 12.4579L13.1124 7.16405C13.7161 6.55727 13.7095 5.57478 13.0979 4.97606C12.4925 4.38347 11.4942 4.40725 10.8978 5.00886L6.53918 9.32122Z",fill:"currentColor"}),o.jsx("path",{d:"M8.84622 2.75411C9.04697 2.56188 9.36555 2.56381 9.56395 2.76076C9.76234 2.95771 9.76658 3.27625 9.57582 3.4784L9.56661 3.48794L5.25912 7.82701C4.67023 8.42022 4.672 9.37798 5.26305 9.96904C5.85624 10.5622 6.81818 10.5615 7.41052 9.9675L11.6299 5.73599L11.6395 5.72671C11.8406 5.53493 12.1592 5.53756 12.3572 5.73496C12.5583 5.93548 12.5587 6.26104 12.3582 6.46214L8.13877 10.6937C7.14498 11.6903 5.53105 11.6915 4.53584 10.6963C3.5442 9.70461 3.54127 8.09774 4.52928 7.10248L8.83677 2.76342L8.84622 2.75411Z",fill:"currentColor"})]}),mge=e=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M1.5 8.5V8C1.5 7.60218 1.65804 7.22064 1.93934 6.93934C2.22064 6.65804 2.60218 6.5 3 6.5H13C13.3978 6.5 13.7794 6.65804 14.0607 6.93934C14.342 7.22064 14.5 7.60218 14.5 8V8.5M8.70667 4.20667L7.29333 2.79333C7.20048 2.70037 7.09022 2.62661 6.96886 2.57628C6.84749 2.52595 6.71739 2.50003 6.586 2.5H3C2.60218 2.5 2.22064 2.65804 1.93934 2.93934C1.65804 3.22064 1.5 3.60218 1.5 4V12C1.5 12.3978 1.65804 12.7794 1.93934 13.0607C2.22064 13.342 2.60218 13.5 3 13.5H13C13.3978 13.5 13.7794 13.342 14.0607 13.0607C14.342 12.7794 14.5 12.3978 14.5 12V6C14.5 5.60218 14.342 5.22064 14.0607 4.93934C13.7794 4.65804 13.3978 4.5 13 4.5H9.414C9.14887 4.49977 8.89402 4.39426 8.70667 4.20667Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});function x0(e){return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),o.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),o.jsx("path",{d:"M15 2v2"}),o.jsx("path",{d:"M15 20v2"}),o.jsx("path",{d:"M2 15h2"}),o.jsx("path",{d:"M2 9h2"}),o.jsx("path",{d:"M20 15h2"}),o.jsx("path",{d:"M20 9h2"}),o.jsx("path",{d:"M9 2v2"}),o.jsx("path",{d:"M9 20v2"})]})}const xrr={jpg:"image/jpg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",pdf:"application/pdf"},wrr=async e=>{try{const t=await fetch(e,{method:"HEAD"});if(!t.ok)throw new Error("Failed to get file content type");const n=t.headers.get("content-type");if(!n)throw new Error("Failed to get file content type");return n}catch{const r=new URL(e).pathname.split(".").pop();if(!r)return;const a=r.toLowerCase();return xrr[a]}},Srr=({onOpenChange:e,open:t})=>{const n=mI(),r=inr({onChange:()=>e(!1)}),a=async s=>{s.preventDefault();const l=new FormData(s.target).get("url-attachment")?.toString();if(l){const c=new File([],l,{type:await wrr(l)});n.addAttachment(c),e(!1)}};return o.jsx(Er,{onOpenChange:e,open:t,children:o.jsxs(yr,{children:[o.jsxs(Cr,{children:[o.jsx(br,{children:"Add attachment"}),o.jsx(Ka,{children:"Add a file attachment via URL or from your computer"})]}),o.jsxs(Lr,{children:[o.jsxs("form",{onSubmit:a,className:"flex flex-row items-end gap-4",children:[o.jsxs("div",{className:"w-full space-y-1",children:[o.jsx(St,{htmlFor:"url-attachment",className:"text-neutral3 text-ui-md",children:"Public URL"}),o.jsx(cn,{type:"text",name:"url-attachment",id:"url-attachment",className:"w-full",placeholder:"https://placehold.co/600x400/png"})]}),o.jsxs(ye,{type:"submit",className:"h-8!",variant:"light",children:[o.jsx(_e,{children:o.jsx(OZt,{})}),"Add"]})]}),o.jsx("hr",{className:"my-2 border border-border1"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ve,{variant:"ui-md",className:"text-neutral3",children:"Or from your computer"}),o.jsxs("button",{onClick:r,className:"w-full h-40 border border-border1 rounded-lg text-neutral3 border-dashed flex flex-col items-center justify-center gap-2 hover:bg-surface2 active:bg-surface3",children:[o.jsx(lGt,{className:"size-12"}),o.jsx(ve,{variant:"header-md",children:"Add a local file"})]})]})]})]})})},Orr=e=>{const[t,n]=b.useState(void 0);return b.useEffect(()=>{if(!e){n(void 0);return}const r=URL.createObjectURL(e);return n(r),()=>{URL.revokeObjectURL(r)}},[e]),t},krr=()=>{const{file:e,src:t}=E2(qZe(n=>{if(n.file)return n.file.name.startsWith("https://")?{src:n.file.name}:{file:n.file};const r=n.content?.filter(a=>a.type==="image")[0]?.image;return r?{src:r}:{}}));return Orr(e)??t},_rr=()=>{const e=mI(),[t,n]=b.useState(!1);return b.useEffect(()=>{e.subscribe(()=>{const r=e.getState().attachments;n(r.length>0)})},[e]),t},Err=e=>{const[t,n]=b.useState({isLoading:!1,text:""});return b.useEffect(()=>{if(!e)return;(async()=>{n(s=>({...s,isLoading:!0}));const a=await e.text();n(s=>({...s,isLoading:!1,text:a}))})()},[e]),t},y3="h-full w-full flex items-center justify-center",Ebt=({data:e,url:t})=>{const[n,r]=b.useState(!1);return t?o.jsx("a",{href:t,className:y3,target:"_blank",rel:"noreferrer noopener",children:o.jsx(Id,{className:"text-accent2","aria-label":"View PDF"})}):o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>r(!0),className:y3,type:"button",children:o.jsx(Id,{className:"text-accent2","aria-label":"View PDF"})}),o.jsx(Crr,{data:e,open:n,onOpenChange:r})]})},Crr=({data:e,open:t,onOpenChange:n})=>o.jsx(Er,{open:t,onOpenChange:n,children:o.jsxs(yr,{className:"max-w-4xl",children:[o.jsxs(Cr,{children:[o.jsx(br,{children:"PDF preview"}),o.jsx(Ka,{children:"Preview of the PDF document"})]}),o.jsx(Lr,{children:t&&o.jsx("iframe",{src:e,width:"100%",height:"600px"})})]})}),Cbt=({src:e})=>{const[t,n]=b.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>n(!0),type:"button",className:y3,children:o.jsx("img",{src:e,className:"object-cover aspect-ratio max-h-[140px] max-w-[320px]",alt:"Preview"})}),o.jsx(jrr,{src:e,open:t,onOpenChange:n})]})},jrr=({src:e,open:t,onOpenChange:n})=>o.jsx(Er,{open:t,onOpenChange:n,children:o.jsxs(yr,{className:"max-w-4xl",children:[o.jsxs(Cr,{children:[o.jsx(br,{children:"Image preview"}),o.jsx(Ka,{children:"Preview of the image"})]}),o.jsx(Lr,{children:t&&o.jsx("img",{src:e,alt:"Image"})})]})}),jbt=({data:e})=>{const[t,n]=b.useState(!1),r=e.replace(/<attachment[^>]*>/,"").replace(/<\/attachment>/g,"");return o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>n(!0),className:y3,type:"button",children:o.jsx(Id,{className:"text-neutral3"})}),o.jsx(Trr,{data:r,open:t,onOpenChange:n})]})},Trr=({data:e,open:t,onOpenChange:n})=>o.jsx(Er,{open:t,onOpenChange:n,children:o.jsxs(yr,{className:"max-w-4xl h-[80vh]",children:[o.jsxs(Cr,{children:[o.jsx(br,{children:"Text preview"}),o.jsx(Ka,{children:"Preview of the text file"})]}),o.jsx(Lr,{children:t&&o.jsx("div",{className:"whitespace-pre-wrap",children:e})})]})}),Nrr={sm:`${Ql.sm} w-form-sm`,md:`${Ql.md} w-form-md`,lg:`${Ql.lg} w-form-lg`,default:`${Ql.default}`},Arr={sm:"sm",md:"default",lg:"lg",default:"default"},Irr={default:"bg-surface2 hover:bg-surface4 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",light:"bg-surface3 hover:bg-surface5 text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",outline:"bg-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",ghost:"bg-transparent border-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-accent1 hover:bg-accent1/90 text-surface1 font-medium hover:shadow-glow-accent1 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none"},Rrr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",Tr=Ne.forwardRef(({className:e,children:t,tooltip:n,size:r="md",variant:a="default",disabled:s,...i},l)=>o.jsxs(tr,{children:[o.jsx(nr,{asChild:!0,children:o.jsx("button",{ref:l,disabled:s,"aria-label":typeof n=="string"?n:void 0,className:Y(Rrr,NR,Irr[a],Nrr[r],s&&"active:scale-100",e),...i,children:o.jsx(_e,{size:Arr[r],children:t})})}),o.jsx(Kn,{children:n})]}));Tr.displayName="IconButton";const Prr={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"};function Pt({color:e,className:t,size:n="md"}){return o.jsx("svg",{className:Y("animate-spin",Prr[n],t),style:{animationDuration:"800ms",animationTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)"},xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:e||"currentColor",className:"text-accent1"})})}const Tbt=async e=>new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const a=r.result;typeof a=="string"?t(a):n(new Error("Failed to convert file to base64."))},r.onerror=a=>{n(a)},r.readAsDataURL(e)}),Mrr=({document:e})=>{const{isLoading:t,text:n}=Err(e.file);return o.jsx("div",{className:"flex items-center justify-center h-full w-full",children:t?o.jsx(Pt,{className:"animate-spin"}):o.jsx(jbt,{data:n})})},Drr=({document:e})=>{const[t,n]=b.useState({isLoading:!1,text:""});b.useEffect(()=>{let a=!1;return(async()=>{if(!e.file)return;n(l=>({...l,isLoading:!0}));const i=await Tbt(e.file);a||n(l=>({...l,isLoading:!1,text:i}))})(),()=>{a=!0}},[e]);const r=e.file?.name.startsWith("https://");return o.jsx("div",{className:"flex items-center justify-center h-full w-full",children:t.isLoading?o.jsx(Pt,{className:"animate-spin"}):o.jsx(Ebt,{data:t.text,url:r?e.file?.name:void 0})})},$rr=()=>{const e=E2(i=>i.type==="image"),t=E2(i=>i.type==="document"?i:void 0),n=krr(),r=E2(i=>i.source!=="message"),s=t?.file?.name.startsWith("https://")?t?.file?.name:n;return o.jsx(o.Fragment,{children:o.jsxs("div",{className:"relative",children:[o.jsx(n6,{children:o.jsxs(tr,{children:[o.jsx(eet,{children:o.jsx(nr,{asChild:!0,children:o.jsx("div",{className:"overflow-hidden size-16 rounded-lg bg-surface3 border border-border1 ",children:e?o.jsx(Cbt,{src:s??""}):t?.contentType==="application/pdf"?o.jsx(Drr,{document:t}):t?o.jsx(Mrr,{document:t}):null})})}),o.jsx(Kn,{side:"top",children:o.jsx(tet,{})})]})}),r&&o.jsx(Lrr,{})]})})},Lrr=()=>o.jsx(gQt,{asChild:!0,children:o.jsx(Tr,{variant:"light",size:"md",tooltip:"Remove file",className:"absolute -right-3 -top-3 text-neutral3 hover:text-neutral6 bg-surface1 hover:bg-surface2 rounded-full p-1",children:o.jsx(_e,{children:o.jsx(_b,{})})})}),Frr=()=>_rr()?o.jsx("div",{className:"flex w-full flex-row items-center gap-4 pb-2",children:o.jsx(GZe,{components:{Attachment:$rr}})}):null;function zrr({containerRef:e}){const[t,n]=b.useState([]),[r,a]=b.useState(null),s=b.useRef(""),i=b.useRef(0),l=b.useCallback(()=>{const u=e.current;if(!u){s.current!==""&&(s.current="",n([]));return}const d=u.getBoundingClientRect(),f=Array.from(u.querySelectorAll("[data-om-badge]"));if(f.length===0){s.current!==""&&(s.current="",n([]));return}const h=[];for(let m=0;m<f.length;m++){const g=f[m],v=g.getAttribute("data-om-badge")||"",x=g.getAttribute("data-om-state")||"complete",w=g.getAttribute("data-om-type")||"observation",O=g.getBoundingClientRect();let k;const _=Brr(f,m,w);if(_){const A=parseFloat(getComputedStyle(_).marginBottom)||0;k=_.getBoundingClientRect().bottom+A-d.top}else k=0;const C=parseFloat(getComputedStyle(g).marginBottom)||0,j=O.bottom+C-d.top-k;j<=0||h.push({cycleId:v,omType:w,state:x,top:k,height:j})}const p=JSON.stringify(h);p!==s.current&&(s.current=p,n(h))},[e]);if(b.useEffect(()=>{const u=e.current;if(!u)return;l();const d=new ResizeObserver(()=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(l)});d.observe(u);const f=new MutationObserver(()=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(l)});return f.observe(u,{childList:!0,subtree:!0}),()=>{cancelAnimationFrame(i.current),d.disconnect(),f.disconnect()}},[l,e]),b.useEffect(()=>{const u=e.current;if(!u)return;const d=h=>{const p=h.target.closest("[data-om-badge]");p&&a(p.getAttribute("data-om-badge"))},f=h=>{h.target.closest("[data-om-badge]")&&a(null)};return u.addEventListener("mouseover",d),u.addEventListener("mouseout",f),()=>{u.removeEventListener("mouseover",d),u.removeEventListener("mouseout",f)}},[e]),t.length===0)return null;const c=t[t.length-1]?.cycleId??null;return o.jsx("div",{className:"pointer-events-none absolute inset-0",style:{zIndex:0},children:t.map(u=>{const d=u.cycleId===c,f=u.cycleId===r,h=r?f:d;return o.jsx(Urr,{highlight:u,visible:h},u.cycleId)})})}function Brr(e,t,n){for(let r=t-1;r>=0;r--){const a=e[r];if(a.getAttribute("data-om-state")!=="failed"&&(n==="observation"||a.getAttribute("data-om-type")==="reflection"))return a}return null}function Urr({highlight:e,visible:t}){const n=qrr(e.state),r=e.state.startsWith("buffering");return o.jsx("div",{className:"absolute left-0 right-0 transition-opacity duration-200",style:{top:e.top,height:e.height,border:`3px ${r?"dashed":"solid"} ${n}`,borderRadius:"0.5rem",opacity:t?1:0}})}function qrr(e){switch(e){case"complete":return"rgba(34, 197, 94, 0.4)";case"loading":return"rgba(59, 130, 246, 0.4)";case"failed":return"rgba(239, 68, 68, 0.4)";case"disconnected":return"rgba(234, 179, 8, 0.4)";case"buffering":return"rgba(168, 85, 247, 0.4)";case"buffering-complete":return"rgba(168, 85, 247, 0.4)";case"buffering-failed":return"rgba(239, 68, 68, 0.4)";case"activated":return"rgba(34, 197, 94, 0.4)";default:return"rgba(34, 197, 94, 0.4)"}}const Yn={colors:"transition-colors duration-normal ease-out-custom",all:"transition-all duration-normal ease-out-custom",opacity:"transition-opacity duration-normal ease-out-custom",allSlow:"transition-all duration-slow ease-out-custom"},nx={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},Vrr={default:"text-neutral3 bg-surface4",success:"text-accent1 bg-accent1Dark",error:"text-accent2 bg-accent2Dark",info:"text-accent5 bg-accent5Dark",warning:"text-accent6 bg-accent6Dark"},Hrr={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},wt=({icon:e,variant:t="default",className:n,children:r,...a})=>o.jsxs("div",{className:Y("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",Yn.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":Vrr[t],n),...a,children:[e&&o.jsx("span",{className:Hrr[t],children:o.jsx(_e,{children:e})}),r]}),n8=({children:e,initialCollapsed:t=!0,icon:n,title:r,collapsible:a=!0,extraInfo:s,"data-testid":i})=>{const[l,c]=b.useState(t);return b.useEffect(()=>{c(t)},[t]),o.jsxs("div",{className:"mb-4","data-testid":i,children:[o.jsxs("div",{className:"flex flex-row gap-2 items-center justify-between",children:[o.jsxs("button",{onClick:a?()=>c(u=>!u):void 0,className:"flex items-center gap-2 disabled:cursor-not-allowed",disabled:!a,type:"button",children:[o.jsx(_e,{children:o.jsx(bv,{className:Y("transition-all",l?"rotate-90":"rotate-180")})}),o.jsx(wt,{icon:n,children:r})]}),s]}),!l&&o.jsx("div",{className:"pt-2",children:o.jsx("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:e})})]})};function Qrr(e,t=5){if(!e?.properties)return[];const n=[];function r(a,s,i){if(i>t)return;const l=Array.isArray(a.type)?a.type.join(" | "):a.type;if(n.push({path:s,label:s,description:a.description??a.title,type:l}),a.properties)for(const[c,u]of Object.entries(a.properties))r(u,`${s}.${c}`,i+1);if(a.items?.properties)for(const[c,u]of Object.entries(a.items.properties))r(u,`${s}[].${c}`,i+1)}for(const[a,s]of Object.entries(e.properties))r(s,a,1);return n}function Wrr(e){const t=Qrr(e);return Art({override:[Grr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function Grr(e){return t=>{const r=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!r)return null;const a=r[1]??"",s=t.pos-a.length,i=a?e.filter(c=>c.path.toLowerCase().startsWith(a.toLowerCase())):e;if(i.length===0)return null;const l=i.map(c=>({label:c.path,displayLabel:c.path,detail:c.type,info:c.description,apply:(u,d,f,h)=>{const g=u.state.sliceDoc(h,h+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:f,to:h,insert:g},selection:{anchor:f+g.length}})}}));return{from:s,options:l,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const Zrr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,Yrr=on.mark({class:"cm-variable-highlight"}),c6e=new Wnt({regexp:Zrr,decoration:()=>Yrr}),Xrr=ii.fromClass(class{decorations;constructor(e){this.decorations=c6e.createDeco(e)}update(e){this.decorations=c6e.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),Krr=Xrr,Jrr={duration:5e3,cancel:{label:o.jsx(_e,{children:o.jsx(Wn,{})}),onClick:()=>{}},unstyled:!0,classNames:{toast:"bg-surface3 w-full h-auto rounded-lg gap-2 border border-border1 px-3 py-2 flex items-center justify-between pointer-events-auto shadow-card :data-content:flex-1",title:"text-xs font-medium text-neutral5",description:"text-xs text-neutral3",cancelButton:"bg-transparent! hover:bg-surface2! border-none! rounded-md! p-1.5! m-0! text-neutral3! hover:text-neutral6! shrink-0 transition-all",actionButton:"bg-white! flex items-center justify-center font-medium text-black! order-last hover:opacity-80"}};function Ed(e){const{classNames:t,...n}=Jrr,{classNames:r,...a}=e||{};return{...n,classNames:{...t,title:Y(t?.title,r?.title),toast:Y(t?.toast,r?.toast),cancelButton:Y(t?.cancelButton,r?.cancelButton),actionButton:Y(t?.actionButton,r?.actionButton),description:Y(t?.description,r?.description)},...a}}const Fe=(e,t={})=>{if(Array.isArray(e))return e.forEach(n=>Gl(n,Ed(t)));if(Ne.isValidElement(e))return Gl(e,Ed(t));if(typeof e=="string")return Gl(e,Ed(t));throw new Error("Invalid message type")};Fe.success=(e,t={})=>{const n={...t,icon:o.jsx(_e,{className:"text-accent1 shrink-0",children:o.jsx(vue,{})}),classNames:{...t.classNames,toast:Y("bg-accent1Darker border-accent1/30 border-l-[3px] border-l-accent1",t.classNames?.toast),title:Y("text-xs text-neutral5",t.classNames?.title),description:Y("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Gl.success(e,Ed(n));case"object":return e.forEach(r=>Gl.success(r,Ed(n)))}};Fe.error=(e,t={})=>{const n={...t,icon:o.jsx(_e,{className:"text-accent2 shrink-0",children:o.jsx(_b,{})}),classNames:{...t.classNames,toast:Y("bg-accent2Darker border-accent2/30 border-l-[3px] border-l-accent2",t.classNames?.toast),title:Y("text-xs text-neutral5",t.classNames?.title),description:Y("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Gl.error(e,Ed(n));case"object":return e.forEach(r=>Gl.error(r,Ed(n)))}};Fe.warning=(e,t={})=>{const n={...t,icon:o.jsx(_e,{className:"text-accent6 shrink-0",children:o.jsx(kb,{})}),classNames:{...t.classNames,toast:Y("bg-accent6Darker border-accent6/30 border-l-[3px] border-l-accent6",t.classNames?.toast),title:Y("text-xs text-neutral5",t.classNames?.title),description:Y("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Gl.warning(e,Ed(n));case"object":return e.forEach(r=>Gl.warning(r,Ed(n)))}};Fe.info=(e,t={})=>{const n={...t,icon:o.jsx(_e,{className:"text-accent3 shrink-0",children:o.jsx(ql,{})}),classNames:{...t.classNames,toast:Y("bg-accent3Darker border-accent3/30 border-l-[3px] border-l-accent3",t.classNames?.toast),title:Y("text-xs text-neutral5",t.classNames?.title),description:Y("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Gl.info(e,Ed(n));case"object":return e.forEach(r=>Gl.info(r,Ed(n)))}};Fe.custom=(e,t={})=>Gl(e,Ed(t));Fe.dismiss=e=>{e&&Gl.dismiss(e)};Fe.promise=({myPromise:e,loadingMessage:t,successMessage:n,errorMessage:r,onSuccess:a,onError:s,options:i={}})=>Gl.promise(e,{loading:t??"Loading...",success:l=>(a?.(l),n),error:l=>(s?.(l),r||l?.message||"Error..."),...Ed(i)});function Wf({text:e,copyMessage:t="Copied to clipboard!"}){const[n,r]=b.useState(!1),a=b.useRef(null),s=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{Fe.success(t),r(!0),a.current&&(clearTimeout(a.current),a.current=null),a.current=setTimeout(()=>{r(!1)},2e3)}).catch(()=>{Fe.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:n,handleCopy:s}}function hi({content:e,copyMessage:t,tooltip:n="Copy to clipboard",size:r="sm",className:a}){const[s,i]=b.useState(!1),{handleCopy:l}=Wf({text:e,copyMessage:t}),c=()=>{l(),i(!0),setTimeout(()=>i(!1),2e3)};return o.jsxs(tr,{children:[o.jsx(nr,{asChild:!0,children:o.jsx(ye,{onClick:c,type:"button",size:r,className:a,"aria-label":s?"Copied!":n,children:s?o.jsx(ca,{}):o.jsx(Kl,{})})}),o.jsx(Kn,{children:s?"Copied!":n})]})}function ear(){const e=FI({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"var(--neutral2)",background:"transparent",foreground:"var(--neutral6)",caret:"var(--neutral6)"},styles:[{tag:[se.className,se.propertyName],color:"var(--neutral6)"},{tag:se.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[se.heading1,se.heading2,se.heading3,se.heading4,se.heading5,se.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:se.emphasis,fontStyle:"italic",color:"var(--neutral6)"},{tag:se.strong,fontWeight:"bold",color:"var(--neutral6)"},{tag:se.link,color:"var(--accent3)",textDecoration:"underline"},{tag:se.url,color:"var(--accent3)"},{tag:se.monospace,color:"var(--neutral6)"},{tag:se.strikethrough,textDecoration:"line-through"},{tag:se.quote,fontStyle:"italic",color:"var(--neutral2)"}]}),t=xt.theme({".cm-editor":{backgroundColor:"transparent"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{color:"var(--neutral3)"},".cm-cursor":{borderLeftColor:"var(--neutral6)"},".cm-selectionBackground, .cm-content ::selection":{backgroundColor:"color-mix(in srgb, var(--accent3) 22%, transparent)"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}});return[e,t]}function tar(){const e=xt.theme({"&":{backgroundColor:"transparent",color:"var(--neutral6)",fontSize:"0.8rem"},"&.cm-editor .cm-scroller":{fontFamily:"var(--geist-mono)"},".cm-gutters":{backgroundColor:"transparent",color:"var(--neutral2)",borderRight:"none"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-activeLine":{backgroundColor:"transparent"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--neutral3)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--neutral6)"},"&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection":{background:"color-mix(in srgb, var(--accent3) 22%, transparent) !important"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}}),t=$m.define([{tag:[se.comment,se.bracket],color:"var(--neutral2)"},{tag:[se.string,se.meta,se.regexp],color:"var(--accent1)"},{tag:[se.atom,se.bool,se.special(se.variableName)],color:"var(--accent6)"},{tag:[se.keyword,se.operator,se.tagName],color:"var(--accent2)"},{tag:[se.function(se.propertyName),se.propertyName],color:"var(--accent5)"},{tag:[se.definition(se.variableName),se.function(se.variableName),se.className,se.attributeName],color:"var(--accent3)"},{tag:[se.variableName,se.number],color:"var(--accent5)"},{tag:[se.name,se.quote],color:"var(--accent1)"},{tag:se.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[se.heading1,se.heading2,se.heading3,se.heading4,se.heading5,se.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:[se.emphasis],fontStyle:"italic",color:"var(--neutral6)"},{tag:[se.strong],fontWeight:"bold",color:"var(--neutral6)"},{tag:se.link,color:"var(--accent3)",textDecoration:"underline"},{tag:se.url,color:"var(--accent3)"},{tag:se.monospace,color:"var(--neutral6)"},{tag:se.strikethrough,textDecoration:"line-through"},{tag:[se.deleted],color:"var(--accent2)"},{tag:se.invalid,color:"var(--error)"},{tag:[se.standard(se.tagName)],color:"var(--accent1)"}]);return[e,Jw(t)]}const Rv=()=>{const e=t8();return b.useMemo(()=>e?ear():tar(),[e])},oa=b.forwardRef(({data:e,value:t,onChange:n,showCopyButton:r=!0,className:a,language:s="json",highlightVariables:i=!1,placeholder:l,schema:c,autoFocus:u,lineNumbers:d=!0,editable:f,...h},p)=>{const m=Rv(),g=e?JSON.stringify(e,null,2):t??"",v=b.useMemo(()=>{const x=[];return s==="json"?x.push(Sd):s==="markdown"&&(x.push(Pde({base:ow,codeLanguages:Jat})),x.push(xt.lineWrapping)),i&&s==="markdown"&&x.push(Krr),c&&s==="markdown"&&x.push(Wrr(c)),f===!1&&x.push(Ir.readOnly.of(!0)),x},[s,i,c,f]);return o.jsxs("div",{className:Y("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",a),...h,children:[r&&o.jsx(hi,{content:g,className:"absolute top-2 right-2 z-20"}),o.jsx(Eu,{ref:p,value:g,theme:m,extensions:v,onChange:n,editable:f,"aria-label":"Code editor",placeholder:l,height:"100%",style:{height:"100%"},autoFocus:u,basicSetup:{lineNumbers:d}})]})});async function nar(e,t){const{codeToTokens:n,bundledLanguages:r}=await nt(async()=>{const{codeToTokens:s,bundledLanguages:i}=await import("./index-D9fB74IM.js");return{codeToTokens:s,bundledLanguages:i}},__vite__mapDeps([26,2]),import.meta.url);if(!(t in r))return null;const{tokens:a}=await n(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return a}const rar=({selectionReason:e,open:t,onOpenChange:n,input:r})=>{let a=null;if(r)try{a=typeof r=="object"?o.jsx(oa,{data:r}):o.jsx(oa,{data:JSON.parse(r)})}catch{a=o.jsx("pre",{className:"whitespace-pre-wrap",children:r})}return o.jsx(Er,{open:t,onOpenChange:n,children:o.jsxs(yr,{children:[o.jsxs(Cr,{children:[o.jsx(br,{children:"Agent Network Metadata"}),o.jsx(Ka,{children:"View the metadata of the agent's network choice."})]}),o.jsxs(Lr,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ve,{className:"text-neutral3",children:"Selection Reason"}),o.jsx("div",{className:"text-neutral6 text-ui-md",children:e})]}),a&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(ve,{className:"text-neutral3",children:"Input"}),o.jsx("div",{className:"text-neutral6 text-ui-md",children:a})]})]})]})})},gge=({selectionReason:e,input:t})=>{const[n,r]=b.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsx(Tr,{variant:"light",size:"md",tooltip:"Show selection reason",onClick:()=>r(a=>!a),children:o.jsx(AYt,{className:"text-neutral3 size-5"})}),o.jsx(rar,{selectionReason:e||"",open:n,onOpenChange:r,input:t})]})},Nbt=b.createContext(void 0);function aar({children:e,approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:l,toolCallApprovals:c,networkToolCallApprovals:u}){return o.jsx(Nbt.Provider,{value:{approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:l,toolCallApprovals:c,networkToolCallApprovals:u},children:e})}function sar(){const e=b.useContext(Nbt);if(!e)throw new Error("useToolCall must be used within a ToolCallProvider");return e}const IR=({toolCalled:e,toolCallId:t,toolApprovalMetadata:n,toolName:r,isNetwork:a,isGenerateMode:s})=>{const{approveToolcall:i,declineToolcall:l,approveToolcallGenerate:c,declineToolcallGenerate:u,isRunning:d,toolCallApprovals:f,approveNetworkToolcall:h,declineNetworkToolcall:p,networkToolCallApprovals:m}=sar(),g=()=>{a?h(r,n?.runId):s?c(t):i(t)},v=()=>{a?p(r,n?.runId):s?u(t):l(t)},x=a?m?.[n?.runId?`${n.runId}-${r}`:r]?.status:f?.[t]?.status;return n&&!e?o.jsxs("div",{children:[o.jsx("p",{className:"font-medium pb-2",children:"Approval required"}),o.jsxs("div",{className:"flex gap-2 items-center",children:[o.jsxs(ye,{onClick:g,disabled:d||!!x,className:x==="approved"?"text-accent1!":"",children:[o.jsx(_e,{children:o.jsx(ca,{})}),"Approve"]}),o.jsxs(ye,{onClick:v,disabled:d||!!x,className:x==="declined"?"text-accent2!":"",children:[o.jsx(_e,{children:o.jsx(Wn,{})}),"Decline"]})]})]}):null},iar=({agentId:e,messages:t=[],metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:l,toolCalled:c,isComplete:u=!1})=>{const d=n?.mode==="network"?n.selectionReason:void 0,f=n?.mode==="network"?n.agentInput:void 0,h=n?.mode==="stream"||n?.mode==="network"||n?.mode==="generate"?n?.requireApprovalMetadata:void 0,p=n?.mode==="stream"||n?.mode==="network"||n?.mode==="generate"?n?.suspendedTools:void 0,m=t.length>0&&t.every(x=>x.type==="text"?!0:x.toolOutput!==void 0);let g=m;i&&(g=c??m);let v=typeof l=="string"?o.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:l}):o.jsx(oa,{data:l,"data-testid":"tool-suspend-payload"});return o.jsxs(n8,{"data-testid":"agent-badge",icon:o.jsx(Xs,{className:"text-accent1"}),title:e,initialCollapsed:u&&!a,extraInfo:n?.mode==="network"&&o.jsx(gge,{selectionReason:d??"",input:f}),children:[t.map((x,w)=>{if(x.type==="text")return o.jsx(ytt,{children:x.content},w);let O;try{O=typeof x.toolOutput=="string"?JSON.parse(x.toolOutput):x.toolOutput}catch{O=x.toolOutput}return o.jsx(Ne.Fragment,{children:o.jsx(uxt,{toolName:x.toolName,argsText:typeof x.args=="string"?x.args:JSON.stringify(x.args),result:O,args:x.args,status:{type:"complete"},type:"tool-call",toolCallId:x.toolCallId,addResult:()=>{},resume:()=>{},metadata:{mode:"stream",requireApprovalMetadata:h,suspendedTools:p}})},w)}),v!==void 0&&l&&o.jsxs("div",{children:[o.jsx("p",{className:"font-medium pb-2",children:"Agent suspend payload"}),v]}),o.jsx(IR,{toolCalled:g,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,isGenerateMode:n?.mode==="generate"})]})};function jr({className:e,...t}){return o.jsx("div",{className:Y("rounded-md bg-surface4 relative overflow-hidden","before:absolute before:inset-0","before:-translate-x-full","before:animate-[shimmer_2s_infinite]","before:bg-linear-to-r before:from-transparent before:via-surface5/20 before:to-transparent",e),...t})}const vge=()=>o.jsx(n8,{icon:o.jsx(Pt,{color:G6.neutral3}),title:o.jsx(jr,{className:"ml-2 w-12 h-2"}),collapsible:!1}),oar=({agentId:e,result:t,metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:l,toolCalled:c,isComplete:u})=>{const{data:d,isLoading:f}=rbt({threadId:t?.subAgentThreadId,agentId:e,memory:!0});if(f)return o.jsx(vge,{});const h=d?.messages?NQe(d.messages):[];let p=t?.childMessages?.length?t.childMessages:void 0;if(!p&&t?.subAgentToolResults?.length){const m=t.subAgentToolResults.map(g=>({type:"tool",toolName:g.toolName,toolCallId:g.toolCallId,args:g.args,toolOutput:g.result}));t.text&&m.push({type:"text",content:t.text}),p=m}return p||(p=Ozt(h)),o.jsx(iar,{agentId:e,messages:p??[],metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:l,toolCalled:c,isComplete:u})},r8=({copiedDuration:e=1500}={})=>{const[t,n]=b.useState(!1);return{isCopied:t,copyToClipboard:a=>{a&&navigator.clipboard.writeText(a).then(()=>{n(!0),setTimeout(()=>n(!1),e)})}}},Abt=b.createContext({Link:b.forwardRef(()=>null),navigate:()=>{},paths:{agentLink:()=>"",agentsLink:()=>"",agentToolLink:()=>"",agentSkillLink:()=>"",agentThreadLink:()=>"",agentNewThreadLink:()=>"",workflowsLink:()=>"",workflowLink:()=>"",networkLink:()=>"",networkNewThreadLink:()=>"",networkThreadLink:()=>"",scorerLink:()=>"",cmsScorersCreateLink:()=>"",cmsScorerEditLink:()=>"",cmsAgentCreateLink:()=>"",cmsAgentEditLink:()=>"",promptBlockLink:()=>"",promptBlocksLink:()=>"",cmsPromptBlockCreateLink:()=>"",cmsPromptBlockEditLink:()=>"",toolLink:()=>"",skillLink:()=>"",workspacesLink:()=>"",workspaceLink:()=>"",workspaceSkillLink:()=>"",processorsLink:()=>"",processorLink:()=>"",mcpServerLink:()=>"",mcpServerToolLink:()=>"",workflowRunLink:()=>"",datasetLink:()=>"",datasetItemLink:()=>"",datasetExperimentLink:()=>"",experimentLink:()=>""}}),Ibt=({children:e,Link:t,navigate:n,paths:r})=>o.jsx(Abt.Provider,{value:{Link:t,navigate:n,paths:r},children:e}),rn=()=>{const e=b.useContext(Abt);if(!e)throw new Error("useLinkComponent must be used within a LinkComponentProvider");return e},lar=({toolName:e,args:t,result:n,toolCallId:r,toolApprovalMetadata:a,isNetwork:s,toolCalled:i})=>{const[l,c]=b.useState(!a),{isCopied:u,copyToClipboard:d}=r8();b.useEffect(()=>{c(!a)},[a]);const{Link:f}=rn();let h={path:"."};try{h=typeof t=="object"?t:JSON.parse(t)}catch{}const{path:p=".",maxDepth:m,showHidden:g,dirsOnly:v,exclude:x,extension:w}=h,O=[];m!==void 0&&m!==3&&O.push(`depth: ${m}`),g&&O.push("hidden"),v&&O.push("dirs only"),x&&O.push(`exclude: ${x}`),w&&O.push(`ext: ${w}`);let k="",_="";if(typeof n=="string"&&n){const M=n.lastIndexOf(`
|
|
461
|
+
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!s&&!!r.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=x,u.ParserHandle=g,u.NetworkStreamer=f,u.FileStreamer=h,u.StringStreamer=p,u.ReadableStreamStreamer=m,r.jQuery&&((a=r.jQuery).fn.parse=function(j){var A=j.config||{},I=[];return this.each(function(F){if(!(a(this).prop("tagName").toUpperCase()==="INPUT"&&a(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var D=0;D<this.files.length;D++)I.push({file:this.files[D],inputElem:this,instanceConfig:a.extend({},A)})}),P(),this;function P(){if(I.length===0)T(j.complete)&&j.complete();else{var F,D,U,B,z=I[0];if(T(j.before)){var Q=j.before(z.file,z.inputElem);if(typeof Q=="object"){if(Q.action==="abort")return F="AbortError",D=z.file,U=z.inputElem,B=Q.reason,void(T(j.error)&&j.error({name:F},D,U,B));if(Q.action==="skip")return void M();typeof Q.config=="object"&&(z.instanceConfig=a.extend(z.instanceConfig,Q.config))}else if(Q==="skip")return void M()}var W=z.instanceConfig.complete;z.instanceConfig.complete=function($){T(W)&&W($,z.file,z.inputElem),M()},u.parse(z.file,z.instanceConfig)}}function M(){I.splice(0,1),P()}}),i&&(r.onmessage=function(j){j=j.data,u.WORKER_ID===void 0&&j&&(u.WORKER_ID=j.workerId),typeof j.input=="string"?r.postMessage({workerId:u.WORKER_ID,results:u.parse(j.input,j.config),finished:!0}):(r.File&&j.input instanceof File||j.input instanceof Object)&&(j=u.parse(j.input,j.config))&&r.postMessage({workerId:u.WORKER_ID,results:j,finished:!0})}),(f.prototype=Object.create(d.prototype)).constructor=f,(h.prototype=Object.create(d.prototype)).constructor=h,(p.prototype=Object.create(p.prototype)).constructor=p,(m.prototype=Object.create(d.prototype)).constructor=m,u})})(s$)),s$.exports}var Der=Mer();const Syt=mo(Der);function Oyt(e){const t=e;if(t._def?.typeName)return t._def.typeName;const n=t._def?.type;if(typeof n=="string"&&n)return"Zod"+n.charAt(0).toUpperCase()+n.slice(1)}function $er(e,t){const n=e;if(t==="ZodNullable"||t==="ZodOptional"||t==="ZodDefault")return n._zod?.def?.innerType??n._def?.innerType;if(t==="ZodEffects")return n._zod?.def?.schema??n._def?.schema;if(t==="ZodBranded")return n._zod?.def?.type??n._def?.type}var kyt=La(["LIVE","TEST"]),_yt=La(["AGENT","WORKFLOW",...Object.values(Zme)]);je({description:be(),prompt:be()});var wA=qr(be(),zr()),au=wA.optional(),Ler=je({runId:be().optional(),input:zr().optional(),output:zr(),additionalContext:au,requestContext:au});je({runId:be().optional(),scorer:wA,input:zr(),output:zr(),metadata:au,additionalContext:au,source:kyt,entity:wA,entityType:_yt,requestContext:au,structuredOutput:Ps().optional(),traceId:be().optional(),spanId:be().optional(),resourceId:be().optional(),threadId:be().optional()});var Fer=_n();je({result:au,score:Fer,prompt:be().optional()});var zer=Ler.extend({runId:be(),extractStepResult:au,extractPrompt:be().optional()}),Ber=zer.extend({score:_n(),analyzeStepResult:au,analyzePrompt:be().optional()});Ber.extend({reason:be().optional(),reasonPrompt:be().optional()});var Yme=je({id:be(),scorerId:be(),entityId:be(),runId:be(),input:zr().optional(),output:zr(),additionalContext:au,requestContext:au,extractStepResult:au,extractPrompt:be().optional(),score:_n(),analyzeStepResult:au,analyzePrompt:be().optional(),reason:be().optional(),reasonPrompt:be().optional(),scorer:wA,metadata:au,source:kyt,entity:wA,entityType:_yt.optional(),structuredOutput:Ps().optional(),traceId:be().optional(),spanId:be().optional(),resourceId:be().optional(),threadId:be().optional(),preprocessStepResult:au,preprocessPrompt:be().optional(),generateScorePrompt:be().optional(),generateReasonPrompt:be().optional(),...Lme});Yme.omit({id:!0,createdAt:!0,updatedAt:!0});je({pagination:uS,scores:jt(Yme)});var Eyt=e=>Object.fromEntries(Object.keys(e).map(t=>[t,!0])),Uer=be().describe("Human-readable span name"),qer=be().describe("Parent span reference (null = root span)"),Cyt=Mw(Zme).describe("Span type (e.g., WORKFLOW_RUN, AGENT_RUN, TOOL_CALL, etc.)"),Ver=qr(be(),zr()).describe("Span-type specific attributes (e.g., model, tokens, tools)"),Her=jt(zr()).describe("References to related spans in other traces"),Qer=zr().describe("Input data passed to the span"),Wer=zr().describe("Output data returned from the span"),Ger=zr().describe("Error info - presence indicates failure (status derived from this)"),Zer=Ps().describe("Whether this is an event (point-in-time) vs a span (duration)"),Yer=Xh().describe("When the span started"),Xer=Xh().describe("When the span ended (null = running, status derived from this)"),fT=(e=>(e.SUCCESS="success",e.ERROR="error",e.RUNNING="running",e))(fT||{}),jyt=Mw(fT).describe("Current status of the trace"),Ker=u_(e=>e==="true"?!0:e==="false"?!1:e,Ps()).describe("True if any span in the trace encountered an error"),Tyt={...yer,metadata:Hme.nullish(),tags:Qme.nullish()},Xme={traceId:Vd,spanId:Iv};je({...Xme});var Jer=Eyt(Lme),etr=Eyt(Xme),Y_=je({...Xme,name:Uer,spanType:Cyt,isEvent:Zer,startedAt:Yer,parentSpanId:qer.nullish(),...Tyt,experimentId:be().nullish().describe("Experiment or eval run identifier"),attributes:Ver.nullish(),links:Her.nullish(),input:Qer.nullish(),output:Wer.nullish(),error:Ger.nullish(),endedAt:Xer.nullish(),requestContext:qr(be(),zr()).nullish().describe("Request context data"),...Lme}).describe("Span record data"),ttr=Y_.extend({status:jyt}).describe("Trace span with computed status (root spans only)"),Kme=Y_.omit(Jer);je({span:Kme}).describe("Arguments for creating a single span");je({records:jt(Kme)}).describe("Arguments for batch creating spans");je({traceId:Vd.min(1),spanId:Iv.min(1)}).describe("Arguments for getting a single span");je({span:Y_});je({traceId:Vd.min(1)}).describe("Arguments for getting a root span");je({span:Y_});je({traceId:Vd.min(1)}).describe("Arguments for getting a single trace");je({traceId:Vd,spans:jt(Y_)});var ntr=je({startedAt:Jae.optional().describe("Filter by span start time range"),endedAt:Jae.optional().describe("Filter by span end time range"),spanType:Cyt.optional(),...Tyt,status:jyt.optional(),hasChildError:Ker.optional()}).describe("Filters for querying traces"),rtr=La(["startedAt","endedAt"]).describe("Field to order by: 'startedAt' | 'endedAt'"),atr=je({field:rtr.default("startedAt").describe("Field to order by"),direction:_R.default("DESC").describe("Sort direction")}).describe("Order by configuration");je({filters:ntr.optional().describe("Optional filters to apply"),pagination:kR.default({page:0,perPage:10}).describe("Pagination settings"),orderBy:atr.default({field:"startedAt",direction:"DESC"}).describe("Ordering configuration (defaults to startedAt desc)")}).describe("Arguments for listing traces");je({pagination:uS,spans:jt(ttr)});var Nyt=Kme.omit(etr);je({spanId:Iv,traceId:Vd,updates:Nyt.partial()}).describe("Arguments for updating a single span");je({records:jt(je({traceId:Vd,spanId:Iv,updates:Nyt.partial()}))}).describe("Arguments for batch updating spans");je({traceIds:jt(Vd)}).describe("Arguments for batch deleting traces");je({pagination:uS,scores:jt(Yme)});je({scorerName:be().min(1),targets:jt(je({traceId:Vd,spanId:Iv.optional()})).min(1)});je({status:be(),message:be(),traceCount:_n()});function str(e){let t=e,n=!1;for(;;){const r=Oyt(t);if(!r)break;(r==="ZodNullable"||r==="ZodOptional")&&(n=!0);const a=$er(t,r);if(!a)break;t=a}return{base:t,nullable:n}}function A5e(e){if("_zod"in e){const n=e._zod?.def?.checks;if(n&&Array.isArray(n))return n.map(r=>{if(typeof r=="object"&&r!==null&&"def"in r&&typeof r.def=="object"&&r.def!==null){const a=r.def;return a.check==="number_format"&&a.format==="safeint"?{kind:"int"}:a.check==="string_format"&&typeof a.format=="string"?{kind:a.format}:{kind:typeof a.check=="string"?a.check:"unknown"}}return{kind:"unknown"}})}if("_def"in e){const n=e._def?.checks;if(n&&Array.isArray(n))return n}return[]}function itr(e){const t=Oyt(e);return t==="ZodString"?A5e(e).some(r=>r.kind==="uuid")?"uuid":"text":t==="ZodNativeEnum"||t==="ZodEnum"?"text":t==="ZodNumber"?A5e(e).some(r=>r.kind==="int")?"integer":"float":t==="ZodBigInt"||t==="ZodBigint"?"bigint":t==="ZodDate"?"timestamp":t==="ZodBoolean"?"boolean":"jsonb"}function otr(e){const t=e.shape,n={};for(const[r,a]of Object.entries(t)){const{base:s,nullable:i}=str(a);n[r]={type:itr(s),nullable:i}}return n}otr(Y_);var I5e=1,ltr=.9,ctr=.8,utr=.17,xJ=.1,wJ=.999,dtr=.9999,ftr=.99,htr=/[\\\/_+.#"@\[\(\{&]/,ptr=/[\\\/_+.#"@\[\(\{&]/g,mtr=/[\s-]/,Ayt=/[\s-]/g;function ese(e,t,n,r,a,s,i){if(s===t.length)return a===e.length?I5e:ftr;var l=`${a},${s}`;if(i[l]!==void 0)return i[l];for(var c=r.charAt(s),u=n.indexOf(c,a),d=0,f,h,p,m;u>=0;)f=ese(e,t,n,r,u+1,s+1,i),f>d&&(u===a?f*=I5e:htr.test(e.charAt(u-1))?(f*=ctr,p=e.slice(a,u-1).match(ptr),p&&a>0&&(f*=Math.pow(wJ,p.length))):mtr.test(e.charAt(u-1))?(f*=ltr,m=e.slice(a,u-1).match(Ayt),m&&a>0&&(f*=Math.pow(wJ,m.length))):(f*=utr,a>0&&(f*=Math.pow(wJ,u-a))),e.charAt(u)!==t.charAt(s)&&(f*=dtr)),(f<xJ&&n.charAt(u-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(u-1)!==r.charAt(s))&&(h=ese(e,t,n,r,u+1,s+2,i),h*xJ>f&&(f=h*xJ)),f>d&&(d=f),u=n.indexOf(c,u+1);return i[l]=d,d}function R5e(e){return e.toLowerCase().replace(Ayt," ")}function gtr(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,ese(e,t,R5e(e),R5e(t),0,0,{})}var LC='[cmdk-group=""]',SJ='[cmdk-group-items=""]',vtr='[cmdk-group-heading=""]',Iyt='[cmdk-item=""]',P5e=`${Iyt}:not([aria-disabled="true"])`,tse="cmdk-item-select",N1="data-value",ytr=(e,t,n)=>gtr(e,t,n),Ryt=b.createContext(void 0),jR=()=>b.useContext(Ryt),Pyt=b.createContext(void 0),Jme=()=>b.useContext(Pyt),Myt=b.createContext(void 0),Dyt=b.forwardRef((e,t)=>{let n=A1(()=>{var V,R;return{search:"",value:(R=(V=e.value)!=null?V:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=A1(()=>new Set),a=A1(()=>new Map),s=A1(()=>new Map),i=A1(()=>new Set),l=$yt(e),{label:c,children:u,value:d,onValueChange:f,filter:h,shouldFilter:p,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...x}=e,w=Zi(),O=Zi(),k=Zi(),_=b.useRef(null),C=Ttr();Cw(()=>{if(d!==void 0){let V=d.trim();n.current.value=V,T.emit()}},[d]),Cw(()=>{C(6,F)},[]);let T=b.useMemo(()=>({subscribe:V=>(i.current.add(V),()=>i.current.delete(V)),snapshot:()=>n.current,setState:(V,R,H)=>{var G,J,ie,ne;if(!Object.is(n.current[V],R)){if(n.current[V]=R,V==="search")M(),I(),C(1,P);else if(V==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ae=document.getElementById(k);ae?ae.focus():(G=document.getElementById(w))==null||G.focus()}if(C(7,()=>{var ae;n.current.selectedItemId=(ae=D())==null?void 0:ae.id,T.emit()}),H||C(5,F),((J=l.current)==null?void 0:J.value)!==void 0){let ae=R??"";(ne=(ie=l.current).onValueChange)==null||ne.call(ie,ae);return}}T.emit()}},emit:()=>{i.current.forEach(V=>V())}}),[]),j=b.useMemo(()=>({value:(V,R,H)=>{var G;R!==((G=s.current.get(V))==null?void 0:G.value)&&(s.current.set(V,{value:R,keywords:H}),n.current.filtered.items.set(V,A(R,H)),C(2,()=>{I(),T.emit()}))},item:(V,R)=>(r.current.add(V),R&&(a.current.has(R)?a.current.get(R).add(V):a.current.set(R,new Set([V]))),C(3,()=>{M(),I(),n.current.value||P(),T.emit()}),()=>{s.current.delete(V),r.current.delete(V),n.current.filtered.items.delete(V);let H=D();C(4,()=>{M(),H?.getAttribute("id")===V&&P(),T.emit()})}),group:V=>(a.current.has(V)||a.current.set(V,new Set),()=>{s.current.delete(V),a.current.delete(V)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:w,inputId:k,labelId:O,listInnerRef:_}),[]);function A(V,R){var H,G;let J=(G=(H=l.current)==null?void 0:H.filter)!=null?G:ytr;return V?J(V,n.current.search,R):0}function I(){if(!n.current.search||l.current.shouldFilter===!1)return;let V=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(G=>{let J=a.current.get(G),ie=0;J.forEach(ne=>{let ae=V.get(ne);ie=Math.max(ae,ie)}),R.push([G,ie])});let H=_.current;U().sort((G,J)=>{var ie,ne;let ae=G.getAttribute("id"),le=J.getAttribute("id");return((ie=V.get(le))!=null?ie:0)-((ne=V.get(ae))!=null?ne:0)}).forEach(G=>{let J=G.closest(SJ);J?J.appendChild(G.parentElement===J?G:G.closest(`${SJ} > *`)):H.appendChild(G.parentElement===H?G:G.closest(`${SJ} > *`))}),R.sort((G,J)=>J[1]-G[1]).forEach(G=>{var J;let ie=(J=_.current)==null?void 0:J.querySelector(`${LC}[${N1}="${encodeURIComponent(G[0])}"]`);ie?.parentElement.appendChild(ie)})}function P(){let V=U().find(H=>H.getAttribute("aria-disabled")!=="true"),R=V?.getAttribute(N1);T.setState("value",R||void 0)}function M(){var V,R,H,G;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let J=0;for(let ie of r.current){let ne=(R=(V=s.current.get(ie))==null?void 0:V.value)!=null?R:"",ae=(G=(H=s.current.get(ie))==null?void 0:H.keywords)!=null?G:[],le=A(ne,ae);n.current.filtered.items.set(ie,le),le>0&&J++}for(let[ie,ne]of a.current)for(let ae of ne)if(n.current.filtered.items.get(ae)>0){n.current.filtered.groups.add(ie);break}n.current.filtered.count=J}function F(){var V,R,H;let G=D();G&&(((V=G.parentElement)==null?void 0:V.firstChild)===G&&((H=(R=G.closest(LC))==null?void 0:R.querySelector(vtr))==null||H.scrollIntoView({block:"nearest"})),G.scrollIntoView({block:"nearest"}))}function D(){var V;return(V=_.current)==null?void 0:V.querySelector(`${Iyt}[aria-selected="true"]`)}function U(){var V;return Array.from(((V=_.current)==null?void 0:V.querySelectorAll(P5e))||[])}function B(V){let R=U()[V];R&&T.setState("value",R.getAttribute(N1))}function z(V){var R;let H=D(),G=U(),J=G.findIndex(ne=>ne===H),ie=G[J+V];(R=l.current)!=null&&R.loop&&(ie=J+V<0?G[G.length-1]:J+V===G.length?G[0]:G[J+V]),ie&&T.setState("value",ie.getAttribute(N1))}function Q(V){let R=D(),H=R?.closest(LC),G;for(;H&&!G;)H=V>0?Ctr(H,LC):jtr(H,LC),G=H?.querySelector(P5e);G?T.setState("value",G.getAttribute(N1)):z(V)}let W=()=>B(U().length-1),$=V=>{V.preventDefault(),V.metaKey?W():V.altKey?Q(1):z(1)},Z=V=>{V.preventDefault(),V.metaKey?B(0):V.altKey?Q(-1):z(-1)};return b.createElement(go.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:V=>{var R;(R=x.onKeyDown)==null||R.call(x,V);let H=V.nativeEvent.isComposing||V.keyCode===229;if(!(V.defaultPrevented||H))switch(V.key){case"n":case"j":{v&&V.ctrlKey&&$(V);break}case"ArrowDown":{$(V);break}case"p":case"k":{v&&V.ctrlKey&&Z(V);break}case"ArrowUp":{Z(V);break}case"Home":{V.preventDefault(),B(0);break}case"End":{V.preventDefault(),W();break}case"Enter":{V.preventDefault();let G=D();if(G){let J=new Event(tse);G.dispatchEvent(J)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:Atr},c),e8(e,V=>b.createElement(Pyt.Provider,{value:T},b.createElement(Ryt.Provider,{value:j},V))))}),btr=b.forwardRef((e,t)=>{var n,r;let a=Zi(),s=b.useRef(null),i=b.useContext(Myt),l=jR(),c=$yt(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:i?.forceMount;Cw(()=>{if(!u)return l.item(a,i?.id)},[u]);let d=Lyt(a,s,[e.value,e.children,s],e.keywords),f=Jme(),h=Pb(C=>C.value&&C.value===d.current),p=Pb(C=>u||l.filter()===!1?!0:C.search?C.filtered.items.get(a)>0:!0);b.useEffect(()=>{let C=s.current;if(!(!C||e.disabled))return C.addEventListener(tse,m),()=>C.removeEventListener(tse,m)},[p,e.onSelect,e.disabled]);function m(){var C,T;g(),(T=(C=c.current).onSelect)==null||T.call(C,d.current)}function g(){f.setState("value",d.current,!0)}if(!p)return null;let{disabled:v,value:x,onSelect:w,forceMount:O,keywords:k,..._}=e;return b.createElement(go.div,{ref:pm(s,t),..._,id:a,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!h,"data-disabled":!!v,"data-selected":!!h,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)}),xtr=b.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...s}=e,i=Zi(),l=b.useRef(null),c=b.useRef(null),u=Zi(),d=jR(),f=Pb(p=>a||d.filter()===!1?!0:p.search?p.filtered.groups.has(i):!0);Cw(()=>d.group(i),[]),Lyt(i,l,[e.value,e.heading,c]);let h=b.useMemo(()=>({id:i,forceMount:a}),[a]);return b.createElement(go.div,{ref:pm(l,t),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),e8(e,p=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},b.createElement(Myt.Provider,{value:h},p))))}),wtr=b.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=b.useRef(null),s=Pb(i=>!i.search);return!n&&!s?null:b.createElement(go.div,{ref:pm(a,t),...r,"cmdk-separator":"",role:"separator"})}),Str=b.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,s=Jme(),i=Pb(u=>u.search),l=Pb(u=>u.selectedItemId),c=jR();return b.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),b.createElement(go.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:a?e.value:i,onChange:u=>{a||s.setState("search",u.target.value),n?.(u.target.value)}})}),Otr=b.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,s=b.useRef(null),i=b.useRef(null),l=Pb(u=>u.selectedItemId),c=jR();return b.useEffect(()=>{if(i.current&&s.current){let u=i.current,d=s.current,f,h=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let p=u.offsetHeight;d.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return h.observe(u),()=>{cancelAnimationFrame(f),h.unobserve(u)}}},[]),b.createElement(go.div,{ref:pm(s,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},e8(e,u=>b.createElement("div",{ref:pm(i,c.listInnerRef),"cmdk-list-sizer":""},u)))}),ktr=b.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:s,container:i,...l}=e;return b.createElement(g6,{open:n,onOpenChange:r},b.createElement(v6,{container:i},b.createElement(yI,{"cmdk-overlay":"",className:a}),b.createElement(bI,{"aria-label":e.label,"cmdk-dialog":"",className:s},b.createElement(Dyt,{ref:t,...l}))))}),_tr=b.forwardRef((e,t)=>Pb(n=>n.filtered.count===0)?b.createElement(go.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Etr=b.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...s}=e;return b.createElement(go.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},e8(e,i=>b.createElement("div",{"aria-hidden":!0},i)))}),Lu=Object.assign(Dyt,{List:Otr,Item:btr,Input:Str,Group:xtr,Separator:wtr,Dialog:ktr,Empty:_tr,Loading:Etr});function Ctr(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function jtr(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function $yt(e){let t=b.useRef(e);return Cw(()=>{t.current=e}),t}var Cw=typeof window>"u"?b.useEffect:b.useLayoutEffect;function A1(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function Pb(e){let t=Jme(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function Lyt(e,t,n,r=[]){let a=b.useRef(),s=jR();return Cw(()=>{var i;let l=(()=>{var u;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(u=d.current.textContent)==null?void 0:u.trim():a.current}})(),c=r.map(u=>u.trim());s.value(e,l,c),(i=t.current)==null||i.setAttribute(N1,l),a.current=l}),a}var Ttr=()=>{let[e,t]=b.useState(),n=A1(()=>new Map);return Cw(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function Ntr(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function e8({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(Ntr(t),{ref:t.ref},n(t.props.children)):n(t)}var Atr={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};class io{constructor(t,n,r,a){this.fromA=t,this.toA=n,this.fromB=r,this.toB=a}offset(t,n=t){return new io(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}}function jw(e,t,n,r,a,s){if(e==r)return[];let i=tge(e,t,n,r,a,s),l=nge(e,t+i,n,r,a+i,s);t+=i,n-=l,a+=i,s-=l;let c=n-t,u=s-a;if(!c||!u)return[new io(t,n,a,s)];if(c>u){let f=e.slice(t,n).indexOf(r.slice(a,s));if(f>-1)return[new io(t,t+f,a,a),new io(t+f+u,n,s,s)]}else if(u>c){let f=r.slice(a,s).indexOf(e.slice(t,n));if(f>-1)return[new io(t,t,a,a+f),new io(n,n,a+f+c,s)]}if(c==1||u==1)return[new io(t,n,a,s)];let d=Byt(e,t,n,r,a,s);if(d){let[f,h,p]=d;return jw(e,t,f,r,a,h).concat(jw(e,f+p,n,r,h+p,s))}return Itr(e,t,n,r,a,s)}let xj=1e9,wj=0,ege=!1;function Itr(e,t,n,r,a,s){let i=n-t,l=s-a;if(xj<1e9&&Math.min(i,l)>xj*16||wj>0&&Date.now()>wj)return Math.min(i,l)>xj*64?[new io(t,n,a,s)]:M5e(e,t,n,r,a,s);let c=Math.ceil((i+l)/2);OJ.reset(c),kJ.reset(c);let u=(p,m)=>e.charCodeAt(t+p)==r.charCodeAt(a+m),d=(p,m)=>e.charCodeAt(n-p-1)==r.charCodeAt(s-m-1),f=(i-l)%2!=0?kJ:null,h=f?null:OJ;for(let p=0;p<c;p++){if(p>xj||wj>0&&!(p&63)&&Date.now()>wj)return M5e(e,t,n,r,a,s);let m=OJ.advance(p,i,l,c,f,!1,u)||kJ.advance(p,i,l,c,h,!0,d);if(m)return Rtr(e,t,n,t+m[0],r,a,s,a+m[1])}return[new io(t,n,a,s)]}class Fyt{constructor(){this.vec=[]}reset(t){this.len=t<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[t+1]=0,this.start=this.end=0}advance(t,n,r,a,s,i,l){for(let c=-t+this.start;c<=t-this.end;c+=2){let u=a+c,d=c==-t||c!=t&&this.vec[u-1]<this.vec[u+1]?this.vec[u+1]:this.vec[u-1]+1,f=d-c;for(;d<n&&f<r&&l(d,f);)d++,f++;if(this.vec[u]=d,d>n)this.end+=2;else if(f>r)this.start+=2;else if(s){let h=a+(n-r)-c;if(h>=0&&h<this.len&&s.vec[h]!=-1)if(i){let p=s.vec[h];if(p>=n-d)return[p,a+p-h]}else{let p=n-s.vec[h];if(d>=p)return[d,f]}}}return null}}const OJ=new Fyt,kJ=new Fyt;function Rtr(e,t,n,r,a,s,i,l){let c=!1;return!qk(e,r)&&++r==n&&(c=!0),!qk(a,l)&&++l==i&&(c=!0),c?[new io(t,n,s,i)]:jw(e,t,r,a,s,l).concat(jw(e,r,n,a,l,i))}function zyt(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n=n<<1;return n}function tge(e,t,n,r,a,s){if(t==n||t==s||e.charCodeAt(t)!=r.charCodeAt(a))return 0;let i=zyt(n-t,s-a);for(let l=t,c=a;;){let u=l+i,d=c+i;if(u>n||d>s||e.slice(l,u)!=r.slice(c,d)){if(i==1)return l-t-(qk(e,l)?0:1);i=i>>1}else{if(u==n||d==s)return u-t;l=u,c=d}}}function nge(e,t,n,r,a,s){if(t==n||a==s||e.charCodeAt(n-1)!=r.charCodeAt(s-1))return 0;let i=zyt(n-t,s-a);for(let l=n,c=s;;){let u=l-i,d=c-i;if(u<t||d<a||e.slice(u,l)!=r.slice(d,c)){if(i==1)return n-l-(qk(e,l)?0:1);i=i>>1}else{if(u==t||d==a)return n-u;l=u,c=d}}}function nse(e,t,n,r,a,s,i,l){let c=r.slice(a,s),u=null;for(;;){if(u||i<l)return u;for(let d=t+i;;){qk(e,d)||d++;let f=d+i;if(qk(e,f)||(f+=f==d+1?1:-1),f>=n)break;let h=e.slice(d,f),p=-1;for(;(p=c.indexOf(h,p+1))!=-1;){let m=tge(e,f,n,r,a+p+h.length,s),g=nge(e,t,d,r,a,a+p),v=h.length+m+g;(!u||u[2]<v)&&(u=[d-g,a+p-g,v])}d=f}if(l<0)return u;i=i>>1}}function Byt(e,t,n,r,a,s){let i=n-t,l=s-a;if(i<l){let c=Byt(r,a,s,e,t,n);return c&&[c[1],c[0],c[2]]}return i<4||l*2<i?null:nse(e,t,n,r,a,s,Math.floor(i/4),-1)}function M5e(e,t,n,r,a,s){ege=!0;let i=n-t,l=s-a,c;if(i<l){let h=nse(r,a,s,e,t,n,Math.floor(i/6),50);c=h&&[h[1],h[0],h[2]]}else c=nse(e,t,n,r,a,s,Math.floor(l/6),50);if(!c)return[new io(t,n,a,s)];let[u,d,f]=c;return jw(e,t,u,r,a,d).concat(jw(e,u+f,n,r,d+f,s))}function Uyt(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],a=e[n];r.toA>a.fromA-t&&r.toB>a.fromB-t&&(e[n-1]=new io(r.fromA,a.toA,r.fromB,a.toB),e.splice(n--,1))}}function Ptr(e,t,n){for(;;){Uyt(n,1);let r=!1;for(let a=0;a<n.length;a++){let s=n[a],i,l;(i=tge(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=n[a]=new io(s.fromA+i,s.toA,s.fromB+i,s.toB)),(l=nge(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=n[a]=new io(s.fromA,s.toA-l,s.fromB,s.toB-l));let c=s.toA-s.fromA,u=s.toB-s.fromB;if(c&&u)continue;let d=s.fromA-(a?n[a-1].toA:0),f=(a<n.length-1?n[a+1].fromA:e.length)-s.toA;if(!d||!f)continue;let h=c?e.slice(s.fromA,s.toA):t.slice(s.fromB,s.toB);d<=h.length&&e.slice(s.fromA-d,s.fromA)==h.slice(h.length-d)?(n[a]=new io(s.fromA-d,s.toA-d,s.fromB-d,s.toB-d),r=!0):f<=h.length&&e.slice(s.toA,s.toA+f)==h.slice(0,f)&&(n[a]=new io(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),r=!0)}if(!r)break}return n}function Mtr(e,t,n){for(let r=0,a=0;a<e.length;a++){let s=e[a],i=s.toA-s.fromA,l=s.toB-s.fromB;if(i&&l||i>3||l>3){let c=a==e.length-1?t.length:e[a+1].fromA,u=s.fromA-r,d=c-s.toA,f=$5e(t,s.fromA,u),h=D5e(t,s.toA,d),p=s.fromA-f,m=h-s.toA;if((!i||!l)&&p&&m){let g=Math.max(i,l),[v,x,w]=i?[t,s.fromA,s.toA]:[n,s.fromB,s.toB];g>p&&t.slice(f,s.fromA)==v.slice(w-p,w)?(s=e[a]=new io(f,f+i,s.fromB-p,s.toB-p),f=s.fromA,h=D5e(t,s.toA,c-s.toA)):g>m&&t.slice(s.toA,h)==v.slice(x,x+m)&&(s=e[a]=new io(h-i,h,s.fromB+m,s.toB+m),h=s.toA,f=$5e(t,s.fromA,s.fromA-r)),p=s.fromA-f,m=h-s.toA}if(p||m)s=e[a]=new io(s.fromA-p,s.toA+m,s.fromB-p,s.toB+m);else if(i){if(!l){let g=F5e(t,s.fromA,s.toA),v,x=g<0?-1:L5e(t,s.toA,s.fromA);g>-1&&(v=g-s.fromA)<=d&&t.slice(s.fromA,g)==t.slice(s.toA,s.toA+v)?s=e[a]=s.offset(v):x>-1&&(v=s.toA-x)<=u&&t.slice(s.fromA-v,s.fromA)==t.slice(x,s.toA)&&(s=e[a]=s.offset(-v))}}else{let g=F5e(n,s.fromB,s.toB),v,x=g<0?-1:L5e(n,s.toB,s.fromB);g>-1&&(v=g-s.fromB)<=d&&n.slice(s.fromB,g)==n.slice(s.toB,s.toB+v)?s=e[a]=s.offset(v):x>-1&&(v=s.toB-x)<=u&&n.slice(s.fromB-v,s.fromB)==n.slice(x,s.toB)&&(s=e[a]=s.offset(-v))}}r=s.toA}return Uyt(e,3),e}let A0;try{A0=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function qyt(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Vyt(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?qyt(n)?1:0:A0?!Wyt(n)||t==e.length-1?A0.test(String.fromCharCode(n))?1:0:A0.test(e.slice(t,t+2))?2:0:0}function Hyt(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?qyt(n)?1:0:A0?!Gyt(n)||t==1?A0.test(String.fromCharCode(n))?1:0:A0.test(e.slice(t-2,t))?2:0:0}const Qyt=8;function D5e(e,t,n){if(t==e.length||!Hyt(e,t))return t;for(let r=t,a=t+n,s=0;s<Qyt;s++){let i=Vyt(e,r);if(!i||r+i>a)return r;r+=i}return t}function $5e(e,t,n){if(!t||!Vyt(e,t))return t;for(let r=t,a=t-n,s=0;s<Qyt;s++){let i=Hyt(e,r);if(!i||r-i<a)return r;r-=i}return t}function L5e(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function F5e(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}const Wyt=e=>e>=55296&&e<=56319,Gyt=e=>e>=56320&&e<=57343;function qk(e,t){return!t||t==e.length||!Wyt(e.charCodeAt(t-1))||!Gyt(e.charCodeAt(t))}function Dtr(e,t,n){var r;let a=n?.override;return a?a(e,t):(xj=((r=n?.scanLimit)!==null&&r!==void 0?r:1e9)>>1,wj=n?.timeout?Date.now()+n.timeout:0,ege=!1,Ptr(e,t,jw(e,0,e.length,t,0,t.length)))}function Zyt(){return!ege}function Yyt(e,t,n){return Mtr(Dtr(e,t,n),e,t)}const Hp=Jt.define({combine:e=>e[0]}),rse=er.define(),$tr=Jt.define(),Vk=vo.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(rse)&&(e=n.value);for(let n of t.state.facet($tr))e=n(e,t);return e}});class NO{constructor(t,n,r,a,s,i=!0){this.changes=t,this.fromA=n,this.toA=r,this.fromB=a,this.toB=s,this.precise=i}offset(t,n){return t||n?new NO(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(t,n,r){let a=Yyt(t.toString(),n.toString(),r);return Xyt(a,t,n,0,0,Zyt())}static updateA(t,n,r,a,s){return V5e(q5e(t,a,!0,r.length),t,n,r,s)}static updateB(t,n,r,a,s){return V5e(q5e(t,a,!1,n.length),t,n,r,s)}}function z5e(e,t,n,r){let a=n.lineAt(e),s=r.lineAt(t);return a.to==e&&s.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[a.from,s.from]}function B5e(e,t,n,r){let a=n.lineAt(e),s=r.lineAt(t);return a.from==e&&s.from==t?[e,t]:[a.to+1,s.to+1]}function Xyt(e,t,n,r,a,s){let i=[];for(let l=0;l<e.length;l++){let c=e[l],[u,d]=z5e(c.fromA+r,c.fromB+a,t,n),[f,h]=B5e(c.toA+r,c.toB+a,t,n),p=[c.offset(-u+r,-d+a)];for(;l<e.length-1;){let m=e[l+1],[g,v]=z5e(m.fromA+r,m.fromB+a,t,n);if(g>f+1&&v>h+1)break;p.push(m.offset(-u+r,-d+a)),[f,h]=B5e(m.toA+r,m.toB+a,t,n),l++}i.push(new NO(p,u,Math.max(u,f),d,Math.max(d,h),s))}return i}const zD=1e3;function U5e(e,t,n,r){let a=0,s=e.length;for(;;){if(a==s){let d=0,f=0;a&&({toA:d,toB:f}=e[a-1]);let h=t-(n?d:f);return[d+h,f+h]}let i=a+s>>1,l=e[i],[c,u]=n?[l.fromA,l.toA]:[l.fromB,l.toB];if(c>t)s=i;else if(u<=t)a=i+1;else return r?[l.fromA,l.fromB]:[l.toA,l.toB]}}function q5e(e,t,n,r){let a=[];return t.iterChangedRanges((s,i,l,c)=>{let u=0,d=n?t.length:r,f=0,h=n?r:t.length;s>zD&&([u,f]=U5e(e,s-zD,n,!0)),i<t.length-zD&&([d,h]=U5e(e,i+zD,n,!1));let p=c-l-(i-s),m,[g,v]=n?[p,0]:[0,p];a.length&&(m=a[a.length-1]).toA>=u?a[a.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:h,diffA:m.diffA+g,diffB:m.diffB+v}:a.push({fromA:u,toA:d,fromB:f,toB:h,diffA:g,diffB:v})}),a}function V5e(e,t,n,r,a){if(!e.length)return t;let s=[];for(let i=0,l=0,c=0,u=0;;i++){let d=i==e.length?null:e[i],f=d?d.fromA+l:n.length,h=d?d.fromB+c:r.length;for(;u<t.length;){let v=t[u];if(d&&(v.toA+l>f||v.toB+c>h))break;s.push(v.offset(l,c)),u++}if(!d)break;let p=d.toA+l+d.diffA,m=d.toB+c+d.diffB,g=Yyt(n.sliceString(f,p),r.sliceString(h,m),a);for(let v of Xyt(g,n,r,f,h,Zyt()))s.push(v);for(l+=d.diffA,c+=d.diffB;u<t.length;){let v=t[u];if(v.fromA+l>p&&v.fromB+c>m)break;u++}}return s}const Ltr={scanLimit:500},Kyt=ii.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=W5e(e))}update(e){(e.docChanged||e.viewportChanged||Ftr(e.startState,e.state)||ztr(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=W5e(e.view))}},{decorations:e=>e.deco}),BD=tp.low(Xnt({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(Kyt))===null||t===void 0?void 0:t.gutter)||Vr.empty}}));function Ftr(e,t){return e.field(Vk,!1)!=t.field(Vk,!1)}function ztr(e,t){return e.facet(Hp)!=t.facet(Hp)}const H5e=on.line({class:"cm-changedLine"}),Btr=on.mark({class:"cm-changedText"}),Utr=on.mark({tagName:"ins",class:"cm-insertedLine"}),qtr=on.mark({tagName:"del",class:"cm-deletedLine"}),Q5e=new class extends vm{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Vtr(e,t,n,r,a,s){let i=n?e.fromA:e.fromB,l=n?e.toA:e.toB,c=0;if(i!=l){a.add(i,i,H5e),a.add(i,l,n?qtr:Utr),s&&s.add(i,i,Q5e);for(let u=t.iterRange(i,l-1),d=i;!u.next().done;){if(u.lineBreak){d++,a.add(d,d,H5e),s&&s.add(d,d,Q5e);continue}let f=d+u.value.length;if(r)for(;c<e.changes.length;){let h=e.changes[c],p=i+(n?h.fromA:h.fromB),m=i+(n?h.toA:h.toB),g=Math.max(d,p),v=Math.min(f,m);if(g<v&&a.add(g,v,Btr),m<f)c++;else break}d=f}}}function W5e(e){let t=e.state.field(Vk),{side:n,highlightChanges:r,markGutter:a,overrideChunk:s}=e.state.facet(Hp),i=n=="a",l=new ku,c=a?new ku:null,{from:u,to:d}=e.viewport;for(let f of t){if((i?f.fromA:f.fromB)>=d)break;(i?f.toA:f.toB)>u&&(!s||!s(e.state,f,l,c))&&Vtr(f,e.state.doc,i,r,l,c)}return{deco:l.finish(),gutter:c&&c.finish()}}class UD extends qd{constructor(t){super(),this.height=t}eq(t){return this.height==t.height}toDOM(){let t=document.createElement("div");return t.className="cm-mergeSpacer",t.style.height=this.height+"px",t}updateDOM(t){return t.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const g3=er.define({map:(e,t)=>e.map(t)}),Sj=vo.define({create:()=>on.none,update:(e,t)=>{for(let n of t.effects)if(n.is(g3))return n.value;return e.map(t.changes)},provide:e=>xt.decorations.from(e)}),qD=.01;function G5e(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function Htr(e,t,n){let r=new ku,a=new ku,s=e.state.field(Sj).iter(),i=t.state.field(Sj).iter(),l=0,c=0,u=0,d=0,f=e.viewport,h=t.viewport;for(let v=0;;v++){let x=v<n.length?n[v]:null,w=x?x.fromA:e.state.doc.length,O=x?x.fromB:t.state.doc.length;if(l<w){let k=e.lineBlockAt(l).top+u,_=t.lineBlockAt(c).top+d,C=k-_;C<-qD?(u-=C,r.add(l,l,on.widget({widget:new UD(-C),block:!0,side:-1}))):C>qD&&(d+=C,a.add(c,c,on.widget({widget:new UD(C),block:!0,side:-1})))}if(w>l+1e3&&l<f.from&&w>f.from&&c<h.from&&O>h.from){let k=Math.min(f.from-l,h.from-c);l+=k,c+=k,v--}else if(x)l=x.toA,c=x.toB;else break;for(;s.value&&s.from<l;)u-=s.value.spec.widget.height,s.next();for(;i.value&&i.from<c;)d-=i.value.spec.widget.height,i.next()}for(;s.value;)u-=s.value.spec.widget.height,s.next();for(;i.value;)d-=i.value.spec.widget.height,i.next();let p=e.contentHeight+u-(t.contentHeight+d);p<qD?r.add(e.state.doc.length,e.state.doc.length,on.widget({widget:new UD(-p),block:!0,side:1})):p>qD&&a.add(t.state.doc.length,t.state.doc.length,on.widget({widget:new UD(p),block:!0,side:1}));let m=r.finish(),g=a.finish();G5e(m,e.state.field(Sj))||e.dispatch({effects:g3.of(m)}),G5e(g,t.state.field(Sj))||t.dispatch({effects:g3.of(g)})}const ase=er.define({map:(e,t)=>t.mapPos(e)});class Qtr extends qd{constructor(t){super(),this.lines=t}eq(t){return this.lines==t.lines}toDOM(t){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=t.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",r=>{let a=t.posAtDOM(r.target);t.dispatch({effects:ase.of(a)});let{side:s,sibling:i}=t.state.facet(Hp);i&&i().dispatch({effects:ase.of(Wtr(a,t.state.field(Vk),s=="a"))})}),n}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Wtr(e,t,n){let r=0,a=0;for(let s=0;;s++){let i=s<t.length?t[s]:null;if(!i||(n?i.fromA:i.fromB)>=e)return a+(e-r);[r,a]=n?[i.toA,i.toB]:[i.toB,i.toA]}}const Gtr=vo.define({create(e){return on.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(ase)&&(e=e.update({filter:r=>r!=n.value}));return e},provide:e=>xt.decorations.from(e)});function Z5e({margin:e=3,minSize:t=4}){return Gtr.init(n=>Ztr(n,e,t))}function Ztr(e,t,n){let r=new ku,a=e.facet(Hp).side=="a",s=e.field(Vk),i=1;for(let l=0;;l++){let c=l<s.length?s[l]:null,u=l?i+t:1,d=c?e.doc.lineAt(a?c.fromA:c.fromB).number-1-t:e.doc.lines,f=d-u+1;if(f>=n&&r.add(e.doc.line(u).from,e.doc.line(d).to,on.replace({widget:new Qtr(f),block:!0})),!c)break;i=e.doc.lineAt(Math.min(e.doc.length,a?c.toA:c.toB)).number}return r.finish()}const Ytr=xt.styleModule.of(new nv({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),Xtr=xt.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Y5e=new E_,VD=new E_;class Ktr{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||Ltr;let n=[tp.low(Kyt),Xtr,Ytr,Sj,xt.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(h=>h.effects.some(p=>p.is(g3)))&&this.measure()})],r=[Hp.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&r.push(BD);let a=Ir.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],xt.editorAttributes.of({class:"cm-merge-a"}),VD.of(r),n]}),s=[Hp.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&s.push(BD);let i=Ir.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],xt.editorAttributes.of({class:"cm-merge-b"}),VD.of(s),n]});this.chunks=NO.build(a.doc,i.doc,this.diffConf);let l=[Vk.init(()=>this.chunks),Y5e.of(t.collapseUnchanged?Z5e(t.collapseUnchanged):[])];a=a.update({effects:er.appendConfig.of(l)}).state,i=i.update({effects:er.appendConfig.of(l)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let c=t.orientation||"a-b",u=document.createElement("div");u.className="cm-mergeViewEditor";let d=document.createElement("div");d.className="cm-mergeViewEditor",this.editorDOM.appendChild(c=="a-b"?u:d),this.editorDOM.appendChild(c=="a-b"?d:u),this.a=new xt({state:a,parent:u,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new xt({state:i,parent:d,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!t.revertControls,t.revertControls=="b-to-a",t.renderRevertControl),t.parent&&t.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(t,n){if(t.some(r=>r.docChanged)){let r=t[t.length-1],a=t.reduce((i,l)=>i.compose(l.changes),ao.empty(t[0].startState.doc.length));this.chunks=n==this.a?NO.updateA(this.chunks,r.newDoc,this.b.state.doc,a,this.diffConf):NO.updateB(this.chunks,this.a.state.doc,r.newDoc,a,this.diffConf),n.update([...t,r.state.update({effects:rse.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:rse.of(this.chunks)})]),this.scheduleMeasure()}else n.update(t)}reconfigure(t){if("diffConfig"in t&&(this.diffConf=t.diffConfig),"orientation"in t){let s=t.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let i=this.a.dom.parentNode,l=this.b.dom.parentNode;i.remove(),l.remove(),this.editorDOM.insertBefore(s?i:l,this.editorDOM.firstChild),this.editorDOM.appendChild(s?l:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in t||"renderRevertControl"in t){let s=!!this.revertDOM,i=this.revertToA,l=this.renderRevert;"revertControls"in t&&(s=!!t.revertControls,i=t.revertControls=="b-to-a"),"renderRevertControl"in t&&(l=t.renderRevertControl),this.setupRevertControls(s,i,l)}let n="highlightChanges"in t,r="gutter"in t,a="collapseUnchanged"in t;if(n||r||a){let s=[],i=[];if(n||r){let l=this.a.state.facet(Hp),c=r?t.gutter!==!1:l.markGutter,u=n?t.highlightChanges!==!1:l.highlightChanges;s.push(VD.reconfigure([Hp.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:c}),c?BD:[]])),i.push(VD.reconfigure([Hp.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:c}),c?BD:[]]))}if(a){let l=Y5e.reconfigure(t.collapseUnchanged?Z5e(t.collapseUnchanged):[]);s.push(l),i.push(l)}this.a.dispatch({effects:s}),this.b.dispatch({effects:i})}this.scheduleMeasure()}setupRevertControls(t,n,r){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=r,!t&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):t&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",a=>this.revertClicked(a)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let t=this.dom.ownerDocument.defaultView||window;this.measuring=t.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){Htr(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let t=this.revertDOM,n=t.firstChild,r=this.a.viewport,a=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let i=this.chunks[s];if(i.fromA>r.to||i.fromB>a.to)break;if(i.fromA<r.from||i.fromB<a.from)continue;let l=this.a.lineBlockAt(i.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=X5e(n);n&&n.dataset.chunk==String(s)?(n.style.top!=l&&(n.style.top=l),n=n.nextSibling):t.insertBefore(this.renderRevertButton(l,s),n)}for(;n;)n=X5e(n)}renderRevertButton(t,n){let r;if(this.renderRevert)r=this.renderRevert();else{r=document.createElement("button");let a=this.a.state.phrase("Revert this chunk");r.setAttribute("aria-label",a),r.setAttribute("title",a),r.textContent=this.revertToLeft?"⇜":"⇝"}return r.style.top=t,r.setAttribute("data-chunk",String(n)),r}revertClicked(t){let n=t.target,r;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(r=this.chunks[n.dataset.chunk])){let[a,s,i,l,c,u]=this.revertToA?[this.b,this.a,r.fromB,r.toB,r.fromA,r.toA]:[this.a,this.b,r.fromA,r.toA,r.fromB,r.toB],d=a.state.sliceDoc(i,Math.max(i,l-1));i!=l&&u<=s.state.doc.length&&(d+=a.state.lineBreak),s.dispatch({changes:{from:c,to:Math.min(s.state.doc.length,u),insert:d},userEvent:"revert"}),t.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function X5e(e){let t=e.nextSibling;return e.remove(),t}const _J=[400,401,403,404];function Yi(e){if(!e||typeof e!="object")return!1;if("status"in e&&e.status===401||"statusCode"in e&&e.statusCode===401)return!0;if("message"in e){const t=e.message;if(typeof t=="string")return/\bstatus:\s*401\b/.test(t)}return!1}function Va(e){if(!e||typeof e!="object")return!1;if("status"in e&&e.status===403||"statusCode"in e&&e.statusCode===403)return!0;if("message"in e){const t=e.message;if(typeof t=="string")return/\bstatus:\s*403\b/.test(t)}return!1}function Jyt(e){if(!e||typeof e!="object")return!1;if("status"in e){const t=e.status;return _J.includes(t)}if("statusCode"in e){const t=e.statusCode;return _J.includes(t)}if("message"in e){const t=e.message;if(typeof t=="string")return _J.some(n=>new RegExp(`\\bstatus:\\s*${n}\\b`).test(t))}return!1}function Jtr(e,t){return Jyt(t)?!1:e<3}function enr(e,t){return t in e&&typeof e[t]=="function"}const el=e=>{const t=["listWorkspaces","getWorkspace"],n=yie.has("workspaces-v1"),r=t.every(a=>enr(e,a));return n&&r},ebt=e=>{if(!(!e||typeof e!="object")){if("status"in e&&typeof e.status=="number")return e.status;if("statusCode"in e&&typeof e.statusCode=="number")return e.statusCode}},tnr=(e,t)=>ebt(e)===t,nnr=e=>{const t=ebt(e);return t!==void 0&&t>=400&&t<500},sse=e=>{if(tnr(e,501))return!0;if(e&&typeof e=="object"&&"message"in e){const t=e.message;return t.includes("Workspace v1 not supported")||t.includes("501")}return!1},hS=(e,t)=>nnr(t)||sse(t)||Jyt(t)?!1:e<3,K5e={modelSettings:{maxRetries:2,maxSteps:5,chatWithGenerateLegacy:!1,chatWithGenerate:!1}};function rnr({agentId:e,defaultSettings:t}){const[n,r]=b.useState(t),a=`mastra-agent-store-${e}`;return b.useEffect(()=>{try{const l=localStorage.getItem(a),c=l?JSON.parse(l):{},u={...c,modelSettings:{...K5e.modelSettings,...c?.modelSettings??{},...t?.modelSettings??{}}};r(u)}catch{}},[a,t]),{settings:n,setSettings:l=>{r(c=>({...c,...l})),localStorage.setItem(a,JSON.stringify({...l,agentId:e}))},resetAll:()=>{const l={modelSettings:{...K5e.modelSettings,...t?.modelSettings??{}}};r(l),localStorage.removeItem(a)}}}const tbt=b.createContext({});function rge({children:e,agentId:t,defaultSettings:n}){const{settings:r,setSettings:a,resetAll:s}=rnr({agentId:t,defaultSettings:n});return o.jsx(tbt.Provider,{value:{settings:r,setSettings:a,resetAll:s},children:e})}const age=()=>b.useContext(tbt),Br=Tle()(t2t(e=>({requestContext:{},theme:"dark",setRequestContext:t=>e({requestContext:t}),setTheme:t=>e({theme:t})}),{name:"mastra-playground-store"})),ise=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;function anr(e){return ise?.addEventListener("change",e),()=>ise?.removeEventListener("change",e)}function snr(){return ise?.matches??!0}function t8(){const e=Br(n=>n.theme),t=b.useSyncExternalStore(anr,snr,()=>!0);return e==="system"?t:e==="dark"}const sge=b.createContext(null);function TR({children:e}){const{requestContext:t}=Br(),[n,r]=b.useState(t),a=i=>r(i),s=()=>{r({})};return o.jsx(sge.Provider,{value:{schemaValues:n,setSchemaValues:a,clearSchemaValues:s},children:e})}function nbt(){const e=b.useContext(sge);if(!e)throw new Error("useSchemaRequestContext must be used within a SchemaRequestContextProvider");return e}function xo(){const{requestContext:e}=Br(),n=b.useContext(sge)?.schemaValues??{};return{...e??{},...n}}const rbt=({threadId:e,agentId:t,memory:n})=>{const r=Ye(),{requestContext:a}=Br();return Ot({queryKey:["memory","messages",e,t,"requestContext"],queryFn:async()=>e?await r.listThreadMessages(e,{agentId:t,requestContext:a,includeSystemReminders:!0}):null,enabled:n&&!!e,staleTime:0,gcTime:0,retry:!1,refetchOnWindowFocus:!1})},inr=({multiple:e=!0,onChange:t}={})=>{const n=f7t(s=>!s.isEditing),r=mI(),a=b.useCallback(()=>{const s=document.createElement("input");s.type="file",s.multiple=e,s.hidden=!0;const i=r.getState().attachmentAccept;i&&i!=="*"&&(s.accept=i),document.body.appendChild(s),s.onchange=l=>{const c=l.target.files;if(c){for(const u of c)r.addAttachment(u),t?.(Array.from(c));document.body.removeChild(s)}},s.oncancel=()=>{(!s.files||s.files.length===0)&&document.body.removeChild(s)},s.click()},[r,e]);if(!n)return a},Ql={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},NR="focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",onr="focus-within:outline-hidden focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",lnr="rounded-md",ige="bg-surface2 border-2 border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",oge="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",lge="disabled:opacity-50 disabled:cursor-not-allowed";function abt(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=abt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function sbt(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=abt(e))&&(r&&(r+=" "),r+=t);return r}const cnr=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},unr=(e,t)=>({classGroupId:e,validator:t}),ibt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),v3="-",J5e=[],dnr="arbitrary..",fnr=e=>{const t=pnr(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return hnr(i);const l=i.split(v3),c=l[0]===""&&l.length>1?1:0;return obt(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],u=n[i];return c?u?cnr(u,c):c:u||J5e}return n[i]||J5e}}},obt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],s=n.nextPart.get(a);if(s){const u=obt(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const l=t===0?e.join(v3):e.slice(t).join(v3),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},hnr=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?dnr+r:void 0})(),pnr=e=>{const{theme:t,classGroups:n}=e;return mnr(n,t)},mnr=(e,t)=>{const n=ibt();for(const r in e){const a=e[r];cge(a,n,r,t)}return n},cge=(e,t,n,r)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];gnr(i,t,n,r)}},gnr=(e,t,n,r)=>{if(typeof e=="string"){vnr(e,t,n);return}if(typeof e=="function"){ynr(e,t,n,r);return}bnr(e,t,n,r)},vnr=(e,t,n)=>{const r=e===""?t:lbt(t,e);r.classGroupId=n},ynr=(e,t,n,r)=>{if(xnr(e)){cge(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(unr(n,e))},bnr=(e,t,n,r)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[l,c]=a[i];cge(c,lbt(t,l),n,r)}},lbt=(e,t)=>{let n=e;const r=t.split(v3),a=r.length;for(let s=0;s<a;s++){const i=r[s];let l=n.nextPart.get(i);l||(l=ibt(),n.nextPart.set(i,l)),n=l}return n},xnr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,wnr=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const a=(s,i)=>{n[s]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let i=n[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return a(s,i),i},set(s,i){s in n?n[s]=i:a(s,i)}}},ose="!",e6e=":",Snr=[],t6e=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),Onr=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const s=[];let i=0,l=0,c=0,u;const d=a.length;for(let g=0;g<d;g++){const v=a[g];if(i===0&&l===0){if(v===e6e){s.push(a.slice(c,g)),c=g+1;continue}if(v==="/"){u=g;continue}}v==="["?i++:v==="]"?i--:v==="("?l++:v===")"&&l--}const f=s.length===0?a:a.slice(c);let h=f,p=!1;f.endsWith(ose)?(h=f.slice(0,-1),p=!0):f.startsWith(ose)&&(h=f.slice(1),p=!0);const m=u&&u>c?u-c:void 0;return t6e(s,p,h,m)};if(t){const a=t+e6e,s=r;r=i=>i.startsWith(a)?s(i.slice(a.length)):t6e(Snr,!1,i,void 0,!0)}if(n){const a=r;r=s=>n({className:s,parseClassName:a})}return r},knr=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let s=0;s<n.length;s++){const i=n[s],l=i[0]==="[",c=t.has(i);l||c?(a.length>0&&(a.sort(),r.push(...a),a=[]),r.push(i)):a.push(i)}return a.length>0&&(a.sort(),r.push(...a)),r}},_nr=e=>({cache:wnr(e.cacheSize),parseClassName:Onr(e),sortModifiers:knr(e),...fnr(e)}),Enr=/\s+/,Cnr=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],l=e.trim().split(Enr);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let v=!!g,x=r(v?m.substring(0,g):m);if(!x){if(!v){c=d+(c.length>0?" "+c:c);continue}if(x=r(m),!x){c=d+(c.length>0?" "+c:c);continue}v=!1}const w=h.length===0?"":h.length===1?h[0]:s(h).join(":"),O=p?w+ose:w,k=O+x;if(i.indexOf(k)>-1)continue;i.push(k);const _=a(x,v);for(let C=0;C<_.length;++C){const T=_[C];i.push(O+T)}c=d+(c.length>0?" "+c:c)}return c},jnr=(...e)=>{let t=0,n,r,a="";for(;t<e.length;)(n=e[t++])&&(r=cbt(n))&&(a&&(a+=" "),a+=r);return a},cbt=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=cbt(e[r]))&&(n&&(n+=" "),n+=t);return n},n6e=(e,...t)=>{let n,r,a,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=_nr(u),r=n.cache.get,a=n.cache.set,s=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=Cnr(c,n);return a(c,d),d};return s=i,(...c)=>s(jnr(...c))},Tnr=[],ko=e=>{const t=n=>n[e]||Tnr;return t.isThemeGetter=!0,t},ubt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dbt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Nnr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Anr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Inr=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Rnr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Pnr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Mnr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wy=e=>Nnr.test(e),Dr=e=>!!e&&!Number.isNaN(Number(e)),Sy=e=>!!e&&Number.isInteger(Number(e)),EJ=e=>e.endsWith("%")&&Dr(e.slice(0,-1)),bg=e=>Anr.test(e),fbt=()=>!0,Dnr=e=>Inr.test(e)&&!Rnr.test(e),uge=()=>!1,$nr=e=>Pnr.test(e),Lnr=e=>Mnr.test(e),Fnr=e=>!yn(e)&&!On(e),znr=e=>tx(e,mbt,uge),yn=e=>ubt.test(e),Fx=e=>tx(e,gbt,Dnr),r6e=e=>tx(e,Gnr,Dr),Bnr=e=>tx(e,ybt,fbt),Unr=e=>tx(e,vbt,uge),a6e=e=>tx(e,hbt,uge),qnr=e=>tx(e,pbt,Lnr),HD=e=>tx(e,bbt,$nr),On=e=>dbt.test(e),FC=e=>pS(e,gbt),Vnr=e=>pS(e,vbt),s6e=e=>pS(e,hbt),Hnr=e=>pS(e,mbt),Qnr=e=>pS(e,pbt),QD=e=>pS(e,bbt,!0),Wnr=e=>pS(e,ybt,!0),tx=(e,t,n)=>{const r=ubt.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},pS=(e,t,n=!1)=>{const r=dbt.exec(e);return r?r[1]?t(r[1]):n:!1},hbt=e=>e==="position"||e==="percentage",pbt=e=>e==="image"||e==="url",mbt=e=>e==="length"||e==="size"||e==="bg-size",gbt=e=>e==="length",Gnr=e=>e==="number",vbt=e=>e==="family-name",ybt=e=>e==="number"||e==="weight",bbt=e=>e==="shadow",i6e=()=>{const e=ko("color"),t=ko("font"),n=ko("text"),r=ko("font-weight"),a=ko("tracking"),s=ko("leading"),i=ko("breakpoint"),l=ko("container"),c=ko("spacing"),u=ko("radius"),d=ko("shadow"),f=ko("inset-shadow"),h=ko("text-shadow"),p=ko("drop-shadow"),m=ko("blur"),g=ko("perspective"),v=ko("aspect"),x=ko("ease"),w=ko("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...k(),On,yn],C=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[On,yn,c],A=()=>[wy,"full","auto",...j()],I=()=>[Sy,"none","subgrid",On,yn],P=()=>["auto",{span:["full",Sy,On,yn]},Sy,On,yn],M=()=>[Sy,"auto",On,yn],F=()=>["auto","min","max","fr",On,yn],D=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...j()],z=()=>[wy,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],Q=()=>[wy,"screen","full","dvw","lvw","svw","min","max","fit",...j()],W=()=>[wy,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],$=()=>[e,On,yn],Z=()=>[...k(),s6e,a6e,{position:[On,yn]}],V=()=>["no-repeat",{repeat:["","x","y","space","round"]}],R=()=>["auto","cover","contain",Hnr,znr,{size:[On,yn]}],H=()=>[EJ,FC,Fx],G=()=>["","none","full",u,On,yn],J=()=>["",Dr,FC,Fx],ie=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Dr,EJ,s6e,a6e],le=()=>["","none",m,On,yn],fe=()=>["none",Dr,On,yn],X=()=>["none",Dr,On,yn],re=()=>[Dr,On,yn],oe=()=>[wy,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[bg],breakpoint:[bg],color:[fbt],container:[bg],"drop-shadow":[bg],ease:["in","out","in-out"],font:[Fnr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[bg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[bg],shadow:[bg],spacing:["px",Dr],text:[bg],"text-shadow":[bg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wy,yn,On,v]}],container:["container"],columns:[{columns:[Dr,yn,On,l]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Sy,"auto",On,yn]}],basis:[{basis:[wy,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Dr,wy,"auto","initial","none",yn]}],grow:[{grow:["",Dr,On,yn]}],shrink:[{shrink:["",Dr,On,yn]}],order:[{order:[Sy,"first","last","none",On,yn]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...D(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...D()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":D()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:z()}],"inline-size":[{inline:["auto",...Q()]}],"min-inline-size":[{"min-inline":["auto",...Q()]}],"max-inline-size":[{"max-inline":["none",...Q()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[l,"screen",...z()]}],"min-w":[{"min-w":[l,"screen","none",...z()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",n,FC,Fx]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Wnr,Bnr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",EJ,yn]}],"font-family":[{font:[Vnr,Unr,t]}],"font-features":[{"font-features":[yn]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,On,yn]}],"line-clamp":[{"line-clamp":[Dr,"none",On,r6e]}],leading:[{leading:[s,...j()]}],"list-image":[{"list-image":["none",On,yn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",On,yn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:[Dr,"from-font","auto",On,Fx]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[Dr,"auto",On,yn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",On,yn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",On,yn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:V()}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sy,On,yn],radial:["",On,yn],conic:[Sy,On,yn]},Qnr,qnr]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:G()}],"rounded-s":[{"rounded-s":G()}],"rounded-e":[{"rounded-e":G()}],"rounded-t":[{"rounded-t":G()}],"rounded-r":[{"rounded-r":G()}],"rounded-b":[{"rounded-b":G()}],"rounded-l":[{"rounded-l":G()}],"rounded-ss":[{"rounded-ss":G()}],"rounded-se":[{"rounded-se":G()}],"rounded-ee":[{"rounded-ee":G()}],"rounded-es":[{"rounded-es":G()}],"rounded-tl":[{"rounded-tl":G()}],"rounded-tr":[{"rounded-tr":G()}],"rounded-br":[{"rounded-br":G()}],"rounded-bl":[{"rounded-bl":G()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-bs":[{"border-bs":J()}],"border-w-be":[{"border-be":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ie(),"hidden","none"]}],"divide-style":[{divide:[...ie(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-bs":[{"border-bs":$()}],"border-color-be":[{"border-be":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...ie(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Dr,On,yn]}],"outline-w":[{outline:["",Dr,FC,Fx]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",d,QD,HD]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",f,QD,HD]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[Dr,Fx]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",h,QD,HD]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[Dr,On,yn]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Dr]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[On,yn]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[Dr]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:V()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",On,yn]}],filter:[{filter:["","none",On,yn]}],blur:[{blur:le()}],brightness:[{brightness:[Dr,On,yn]}],contrast:[{contrast:[Dr,On,yn]}],"drop-shadow":[{"drop-shadow":["","none",p,QD,HD]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",Dr,On,yn]}],"hue-rotate":[{"hue-rotate":[Dr,On,yn]}],invert:[{invert:["",Dr,On,yn]}],saturate:[{saturate:[Dr,On,yn]}],sepia:[{sepia:["",Dr,On,yn]}],"backdrop-filter":[{"backdrop-filter":["","none",On,yn]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[Dr,On,yn]}],"backdrop-contrast":[{"backdrop-contrast":[Dr,On,yn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Dr,On,yn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Dr,On,yn]}],"backdrop-invert":[{"backdrop-invert":["",Dr,On,yn]}],"backdrop-opacity":[{"backdrop-opacity":[Dr,On,yn]}],"backdrop-saturate":[{"backdrop-saturate":[Dr,On,yn]}],"backdrop-sepia":[{"backdrop-sepia":["",Dr,On,yn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",On,yn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Dr,"initial",On,yn]}],ease:[{ease:["linear","initial",x,On,yn]}],delay:[{delay:[Dr,On,yn]}],animate:[{animate:["none",w,On,yn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,On,yn]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[On,yn,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",On,yn]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",On,yn]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[Dr,FC,Fx,r6e]}],stroke:[{stroke:["none",...$()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Znr=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:a={},override:s={}})=>(Oj(e,"cacheSize",t),Oj(e,"prefix",n),Oj(e,"experimentalParseClassName",r),WD(e.theme,s.theme),WD(e.classGroups,s.classGroups),WD(e.conflictingClassGroups,s.conflictingClassGroups),WD(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),Oj(e,"orderSensitiveModifiers",s.orderSensitiveModifiers),GD(e.theme,a.theme),GD(e.classGroups,a.classGroups),GD(e.conflictingClassGroups,a.conflictingClassGroups),GD(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),xbt(e,a,"orderSensitiveModifiers"),e),Oj=(e,t,n)=>{n!==void 0&&(e[t]=n)},WD=(e,t)=>{if(t)for(const n in t)Oj(e,n,t[n])},GD=(e,t)=>{if(t)for(const n in t)xbt(e,t,n)},xbt=(e,t,n)=>{const r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},Ynr=(e,...t)=>typeof e=="function"?n6e(i6e,e,...t):n6e(()=>Znr(i6e(),e),...t),Xnr=Object.keys({...G6,...hXt}),Knr=Object.keys(bXt),Jnr=Object.keys(pXt),err=Object.keys(mXt),trr=Object.keys(fXt),zx=Object.keys(yXt),nrr=Object.keys(gXt).concat(Object.keys(vXt)),rrr=Ynr({extend:{theme:{color:Xnr,spacing:Knr,radius:trr,leading:err,shadow:nrr},classGroups:{"font-size":[{text:Jnr}],h:[{h:zx}],w:[{w:zx}],size:[{size:zx}],"min-h":[{"min-h":zx}],"min-w":[{"min-w":zx}],"max-h":[{"max-h":zx}],"max-w":[{"max-w":zx}]}}});function Y(...e){return rrr(sbt(e))}const arr={sm:`${Ql.sm} text-ui-sm px-[.75em]`,md:`${Ql.md} text-ui-md px-[.75em]`,default:`${Ql.default} text-ui-md px-[.85em] `,lg:`${Ql.lg} text-ui-lg px-[1em] `},srr={default:"bg-surface3 border-2 border-border1 hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral5",primary:"bg-surface4 border-2 border-border2 hover:text-neutral6 hover:bg-surface5 active:bg-surface6 text-neutral6",cta:"bg-accent1/50 hover:bg-accent1/80 text-neutral5 font-semibold",ghost:"bg-transparent border-2 border-transparent hover:text-neutral6 hover:bg-surface4 active:bg-surface5 text-neutral4",inputLike:ige,light:"",outline:""},irr=Y("flex items-center justify-center gap-[.75em] leading-0 transition-colors duration-200 ease-out-custom rounded-lg","[&>svg]:w-[1.1em] [&>svg]:h-[1.1em] [&>svg]:mx-[-.3em]","[&>svg]:opacity-50 [&:hover>svg]:opacity-100",lge,oge),orr={light:"default",outline:"default"};function lrr(e){return orr[e]??e}function X_(e){const t=lrr(e?.variant||"default"),n=e?.size||"default";return Y(irr,srr[t],arr[n],e?.iconOnly&&"[&>svg]:opacity-75")}function wbt(e){const t=[];return Ne.Children.forEach(e,n=>{Ne.isValidElement(n)&&n.type===Ne.Fragment?t.push(...wbt(n.props.children)):t.push(n)}),t}function crr(e){const t=wbt(e);return t.length>0&&t.every(n=>Ne.isValidElement(n))}const ye=Ne.forwardRef(({className:e,as:t,size:n="default",variant:r="default",disabled:a,children:s,...i},l)=>{const c=t||"button",u=crr(s);return o.jsx(c,{ref:l,disabled:a,className:Y(X_({variant:r,size:n,iconOnly:u}),e),...i,children:s})});ye.displayName="Button";const Fu=yFt,tr=bFt,nr=xFt,Kn=b.forwardRef(({className:e,sideOffset:t=4,children:n,...r},a)=>o.jsx(wFt,{children:o.jsxs(xGe,{ref:a,sideOffset:t,className:Y("z-50 overflow-hidden rounded-md bg-surface3 px-3 py-1.5 text-xs text-neutral4 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r,children:[n,o.jsx(SFt,{className:"fill-surface3"})]})}));Kn.displayName=xGe.displayName;const Ni=Ne.forwardRef(({tooltipContent:e,...t},n)=>o.jsxs(tr,{children:[o.jsx(nr,{asChild:!0,children:o.jsx(ye,{ref:n,...t})}),e&&o.jsx(Kn,{children:e})]}));Ni.displayName="ButtonWithTooltip";const Er=g6,Sbt=NYe,urr=v6,Obt=b.forwardRef(({className:e,...t},n)=>o.jsx(yI,{ref:n,className:Y("fixed inset-0 z-50 bg-overlay backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Obt.displayName=yI.displayName;const yr=b.forwardRef(({className:e,children:t,...n},r)=>o.jsxs(urr,{children:[o.jsx(Obt,{}),o.jsxs(bI,{ref:r,className:Y("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%]","gap-4 border border-border1 bg-surface3 py-6 shadow-dialog rounded-lg","duration-slow","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-bottom-4","data-[state=open]:slide-in-from-bottom-4",e),...n,children:[t,o.jsxs(x6,{className:Y("absolute right-4 top-4 rounded-md p-1","text-neutral3 hover:text-neutral6 hover:bg-surface4","transition-all duration-normal ease-out-custom","focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring","disabled:pointer-events-none"),children:[o.jsx(Wn,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));yr.displayName=bI.displayName;const Cr=({className:e,...t})=>o.jsx("div",{className:Y("flex flex-col space-y-1.5 text-center sm:text-left border-b border-border1 pb-4 px-6",e),...t});Cr.displayName="DialogHeader";const $d=({className:e,...t})=>o.jsx("div",{className:Y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});$d.displayName="DialogFooter";const Lr=({className:e,...t})=>o.jsx("div",{className:Y("overflow-y-auto px-6 max-h-[50vh]",e),...t});Lr.displayName="DialogBody";const br=b.forwardRef(({className:e,...t},n)=>o.jsx(y6,{ref:n,className:Y("text-ui-md font-medium",e),...t}));br.displayName=y6.displayName;const Ka=b.forwardRef(({className:e,...t},n)=>o.jsx(b6,{ref:n,className:Y("sr-only",e),...t}));Ka.displayName=b6.displayName;const o6e=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,l6e=sbt,AR=(e,t)=>n=>{var r;if(t?.variants==null)return l6e(e,n?.class,n?.className);const{variants:a,defaultVariants:s}=t,i=Object.keys(a).map(u=>{const d=n?.[u],f=s?.[u];if(d===null)return null;const h=o6e(d)||o6e(f);return a[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(m=>{let[g,v]=m;return Array.isArray(v)?v.includes({...s,...l}[g]):{...s,...l}[g]===v})?[...u,f,h]:u},[]);return l6e(e,i,c,n?.class,n?.className)},drr=AR(Y("flex w-full text-neutral6 border bg-transparent","transition-all duration-normal ease-out-custom","placeholder:text-neutral2 placeholder:transition-opacity placeholder:duration-normal","focus:placeholder:opacity-70"),{variants:{variant:{default:Y(ige,oge,lge),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${Ql.sm} text-ui-sm px-[.75em]`,md:`${Ql.md} text-ui-md px-[.75em]`,default:`${Ql.default} text-ui-md px-[.85em]`,lg:`${Ql.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),cn=b.forwardRef(({className:e,size:t,testId:n,variant:r,type:a,error:s,...i},l)=>o.jsx("input",{type:a,className:Y(drr({variant:r,size:t}),s&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":n,ref:l,"aria-invalid":s,...i}));cn.displayName="Input";const frr=AR("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),St=b.forwardRef(({className:e,...t},n)=>o.jsx(Qet,{ref:n,className:Y(frr(),e),...t}));St.displayName=Qet.displayName;const hrr={"ui-xs":"text-ui-xs leading-ui-xs","ui-sm":"text-ui-sm leading-ui-sm","ui-smd":"text-ui-smd leading-ui-smd","ui-md":"text-ui-md leading-ui-md","ui-lg":"text-ui-lg leading-ui-lg","header-xs":"text-header-xs leading-header-xs","header-sm":"text-header-sm leading-header-sm","header-md":"text-header-md leading-header-md","header-lg":"text-header-lg leading-header-lg","header-xl":"text-header-xl leading-header-xl"},prr={mono:"font-mono"},ve=({as:e="p",className:t,variant:n="ui-md",font:r,...a})=>o.jsx(e,{className:Y(hrr[n],r&&prr[r],t),...a}),Xs=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 15C10.3565 15 12.137 14.2625 13.4497 12.9497C14.7625 11.637 15.5 9.85652 15.5 8C15.5 6.14348 14.7625 4.36301 13.4497 3.05025C12.137 1.7375 10.3565 1 8.5 1C6.64348 1 4.86301 1.7375 3.55025 3.05025C2.2375 4.36301 1.5 6.14348 1.5 8C1.5 9.85652 2.2375 11.637 3.55025 12.9497C4.86301 14.2625 6.64348 15 8.5 15ZM5.621 10.879L4.611 11.889C3.84179 11.1198 3.31794 10.1398 3.1057 9.07291C2.89346 8.00601 3.00236 6.90013 3.41864 5.89512C3.83491 4.89012 4.53986 4.03112 5.44434 3.42676C6.34881 2.8224 7.41219 2.49983 8.5 2.49983C9.58781 2.49983 10.6512 2.8224 11.5557 3.42676C12.4601 4.03112 13.1651 4.89012 13.5814 5.89512C13.9976 6.90013 14.1065 8.00601 13.8943 9.07291C13.6821 10.1398 13.1582 11.1198 12.389 11.889L11.379 10.879C11.1004 10.6003 10.7696 10.3792 10.4055 10.2284C10.0414 10.0776 9.6511 9.99995 9.257 10H7.743C7.3489 9.99995 6.95865 10.0776 6.59455 10.2284C6.23045 10.3792 5.89963 10.6003 5.621 10.879Z",fill:"currentColor"}),o.jsx("path",{d:"M8.5 4C7.96957 4 7.46086 4.21071 7.08579 4.58579C6.71071 4.96086 6.5 5.46957 6.5 6V6.5C6.5 7.03043 6.71071 7.53914 7.08579 7.91421C7.46086 8.28929 7.96957 8.5 8.5 8.5C9.03043 8.5 9.53914 8.28929 9.91421 7.91421C10.2893 7.53914 10.5 7.03043 10.5 6.5V6C10.5 5.46957 10.2893 4.96086 9.91421 4.58579C9.53914 4.21071 9.03043 4 8.5 4Z",fill:"currentColor"})]}),mrr=e=>o.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M63.0002 0.968262C28.5152 0.968262 0.55957 15.6484 0.55957 33.7573V51.2428C0.55957 69.3517 28.5152 84.0319 63.0002 84.0319C97.4853 84.0319 125.441 69.3517 125.441 51.2428V33.7573C125.441 15.6484 97.4853 0.968262 63.0002 0.968262Z",stroke:"#707070"}),o.jsx("path",{d:"M119.322 35.1636C119.322 50.3595 94.1055 62.6782 62.9998 62.6782C31.894 62.6782 6.67773 50.3595 6.67773 35.1636V49.8363C6.67773 65.0322 31.894 77.351 62.9998 77.351C94.1055 77.351 119.322 65.0322 119.322 49.8363V35.1636Z",fill:"#2E2E2E",fillOpacity:"0.9"}),o.jsx("path",{d:"M119.322 35.1636C119.322 50.3595 94.1055 62.6782 62.9998 62.6782C31.894 62.6782 6.67773 50.3595 6.67773 35.1636M119.322 35.1636C119.322 19.9677 94.1055 7.64893 62.9998 7.64893C31.894 7.64893 6.67773 19.9677 6.67773 35.1636M119.322 35.1636V49.8363C119.322 65.0322 94.1055 77.351 62.9998 77.351C31.894 77.351 6.67773 65.0322 6.67773 49.8363V35.1636",stroke:"#424242"}),o.jsxs("g",{clipPath:"url(#clip0_21421_19519)",children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.5383 47.0955C45.0714 50.3122 53.9322 52.1193 63.1714 52.1193C72.4106 52.1193 81.2714 50.3122 87.8045 47.0955C94.3376 43.8787 98.0078 39.5159 98.0078 34.9668C98.0078 30.4177 94.3376 26.0549 87.8045 22.8381C81.2714 19.6214 72.4106 17.8143 63.1714 17.8143C53.9322 17.8143 45.0714 19.6214 38.5383 22.8381C32.0052 26.0549 28.3349 30.4177 28.3349 34.9668C28.3349 39.5159 32.0052 43.8787 38.5383 47.0955ZM42.9089 34.9668L35.8005 34.9668C35.8004 32.3013 37.4056 29.6956 40.4132 27.4793C43.4207 25.263 47.6956 23.5355 52.6971 22.5154C57.6986 21.4954 63.2022 21.2285 68.5118 21.7485C73.8214 22.2685 78.6986 23.552 82.5266 25.4368C86.3546 27.3216 88.9615 29.723 90.0176 32.3373C91.0737 34.9517 90.5316 37.6614 88.4599 40.1241C86.3881 42.5867 82.8797 44.6915 78.3784 46.1723C73.8771 47.6532 68.585 48.4435 63.1714 48.4435V44.9435C63.1717 43.9778 62.7855 43.0215 62.035 42.1293C61.2845 41.2372 60.1843 40.4265 58.7973 39.7438L53.4695 37.1205C52.0828 36.4376 50.4364 35.8959 48.6244 35.5263C46.8124 35.1568 44.8702 34.9667 42.9089 34.9668Z",fill:"#A9A9A9"}),o.jsx("path",{d:"M77.2474 28.0361C75.3808 27.1171 72.8492 26.6007 70.2094 26.6007C67.5696 26.6007 65.038 27.1171 63.1714 28.0361L61.4119 28.9025C59.5453 29.8215 58.4966 31.068 58.4966 32.3678C58.4966 33.6676 59.5453 34.9141 61.4119 35.8331C63.2785 36.7522 65.8101 37.2685 68.4499 37.2685C71.0897 37.2685 73.6213 36.7522 75.4879 35.8331L77.2474 34.9668C79.114 34.0477 80.1627 32.8012 80.1627 31.5015C80.1627 30.2017 79.114 28.9552 77.2474 28.0361Z",fill:"#A9A9A9"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21421_19519",children:o.jsx("rect",{width:"62.7591",height:"62.7591",fill:"white",transform:"matrix(0.897148 0.441731 -0.897148 0.441731 63.1714 7.24365)"})})})]}),grr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M11.0313 7.97578C11.0313 9.34436 9.92183 10.4538 8.55324 10.4538C7.18466 10.4538 6.0752 9.34436 6.0752 7.97578C6.0752 6.60719 7.18466 5.49773 8.55324 5.49773C9.92183 5.49773 11.0313 6.60719 11.0313 7.97578ZM11.0313 7.97578H14.573",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"}),o.jsx("path",{d:"M12.967 4.46154C11.9273 3.14431 10.3165 2.29883 8.50814 2.29883C5.37277 2.29883 2.83105 4.84055 2.83105 7.97591C2.83105 11.1113 5.37277 13.653 8.50814 13.653C10.3165 13.653 11.9273 12.8075 12.967 11.4903",stroke:"currentColor",strokeWidth:"1.33333",strokeLinecap:"round"})]}),dge=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.97865 4.57004C8.22604 4.75795 8.27426 5.11082 8.08635 5.35821L6.05486 8.03279C5.94873 8.17251 5.78348 8.25471 5.60803 8.25505C5.43257 8.2554 5.267 8.17385 5.16032 8.03454L3.80937 6.27034C3.6205 6.02369 3.66733 5.67063 3.91398 5.48176C4.16063 5.29288 4.51369 5.33972 4.70257 5.58637L5.6051 6.76498L7.19048 4.67774C7.37839 4.43036 7.73126 4.38213 7.97865 4.57004Z",fill:"currentColor"})]}),fge=e=>o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.99982 2.0625C3.8252 2.0625 2.06232 3.82538 2.06232 6C2.06232 8.17462 3.8252 9.9375 5.99982 9.9375C8.17444 9.9375 9.93732 8.17462 9.93732 6C9.93732 3.82538 8.17444 2.0625 5.99982 2.0625ZM0.937317 6C0.937317 3.20406 3.20388 0.9375 5.99982 0.9375C8.79576 0.9375 11.0623 3.20406 11.0623 6C11.0623 8.79594 8.79576 11.0625 5.99982 11.0625C3.20388 11.0625 0.937317 8.79594 0.937317 6Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.89741 4.10293C8.11707 4.32261 8.11706 4.67877 7.89738 4.89843L6.79517 6.00058L7.8962 7.10155C8.11588 7.32122 8.11589 7.67737 7.89623 7.89705C7.67656 8.11673 7.32041 8.11674 7.10073 7.89707L5.99965 6.79605L4.89856 7.89707C4.67889 8.11673 4.32273 8.11672 4.10307 7.89704C3.88341 7.67737 3.88342 7.32121 4.10309 7.10155L5.20413 6.00058L4.10191 4.89843C3.88224 4.67877 3.88223 4.32262 4.10189 4.10294C4.32155 3.88326 4.67771 3.88325 4.89738 4.10292L5.99965 5.20511L7.10191 4.10291C7.32159 3.88325 7.67774 3.88326 7.89741 4.10293Z",fill:"currentColor"})]}),Fl=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.1747 3.18598L7.02554 1.95209C7.11557 1.89207 7.31087 1.87106 7.41016 1.90924L12.4139 3.83377C12.4683 3.85467 12.546 3.96798 12.546 4.03118V13.0167C12.546 13.265 12.7473 13.4663 12.9956 13.4663C13.2439 13.4663 13.4452 13.265 13.4452 13.0167V4.03118C13.4452 3.59605 13.1384 3.14906 12.7367 2.99456L7.73293 1.07004C7.36225 0.927472 6.86056 0.981451 6.52679 1.20396L4.20445 2.75219L3.90419 2.95236L3.90647 2.95824C3.69329 3.05449 3.55469 3.27599 3.55469 3.57581V11.7119C3.55469 12.2084 3.93067 12.7499 4.39251 12.9206L9.89804 14.955C10.3608 15.126 10.7359 14.8596 10.7359 14.3659V5.83295C10.7359 5.33662 10.3498 4.81289 9.88389 4.66643L5.1747 3.18598Z",fill:"currentColor"})}),kbt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:o.jsx("path",{d:"M7.5 0.75C3.6325 0.75 0.5 3.8825 0.5 7.75C0.5 10.8475 2.50375 13.4637 5.28625 14.3912C5.63625 14.4525 5.7675 14.2425 5.7675 14.0587C5.7675 13.8925 5.75875 13.3412 5.75875 12.755C4 13.0787 3.545 12.3262 3.405 11.9325C3.32625 11.7312 2.985 11.11 2.6875 10.9437C2.4425 10.8125 2.0925 10.4887 2.67875 10.48C3.23 10.4712 3.62375 10.9875 3.755 11.1975C4.385 12.2562 5.39125 11.9587 5.79375 11.775C5.855 11.32 6.03875 11.0137 6.24 10.8387C4.6825 10.6637 3.055 10.06 3.055 7.3825C3.055 6.62125 3.32625 5.99125 3.7725 5.50125C3.7025 5.32625 3.4575 4.60875 3.8425 3.64625C3.8425 3.64625 4.42875 3.4625 5.7675 4.36375C6.3275 4.20625 6.9225 4.1275 7.5175 4.1275C8.1125 4.1275 8.7075 4.20625 9.2675 4.36375C10.6062 3.45375 11.1925 3.64625 11.1925 3.64625C11.5775 4.60875 11.3325 5.32625 11.2625 5.50125C11.7087 5.99125 11.98 6.6125 11.98 7.3825C11.98 10.0687 10.3438 10.6637 8.78625 10.8387C9.04 11.0575 9.25875 11.4775 9.25875 12.1337C9.25875 13.07 9.25 13.8225 9.25 14.0587C9.25 14.2425 9.38125 14.4612 9.73125 14.3912C11.1209 13.9221 12.3284 13.029 13.1839 11.8377C14.0393 10.6463 14.4996 9.21668 14.5 7.75C14.5 3.8825 11.3675 0.75 7.5 0.75Z",fill:"currentColor"})}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_22095",children:o.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),_bt=e=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[o.jsx("path",{d:"M13.5037 7.54867C13.5037 7.1144 13.4648 6.69683 13.3924 6.29596H7.62436V8.66776H10.9204C10.7756 9.43052 10.3413 10.0764 9.68994 10.5106V12.0529H11.6776C12.8356 10.9839 13.5037 9.41382 13.5037 7.54867Z",fill:"#4285F4"}),o.jsx("path",{d:"M7.62415 13.5339C9.27773 13.5339 10.6643 12.9882 11.6776 12.0529L9.68994 10.5106C9.14431 10.8781 8.44816 11.1009 7.62415 11.1009C6.03182 11.1009 4.67889 10.0263 4.19451 8.57877H2.15677V10.16C3.1645 12.1587 5.23008 13.5339 7.62415 13.5339Z",fill:"#34A853"}),o.jsx("path",{d:"M4.19472 8.57315C4.07223 8.20569 3.99985 7.81595 3.99985 7.40952C3.99985 7.00308 4.07223 6.61335 4.19472 6.24589V4.66469H2.15698C1.73941 5.4887 1.5 6.41849 1.5 7.40952C1.5 8.40055 1.73941 9.33034 2.15698 10.1543L3.74374 8.91834L4.19472 8.57315Z",fill:"#FBBC05"}),o.jsx("path",{d:"M7.62415 3.72376C8.5261 3.72376 9.32783 4.03555 9.96811 4.63685L11.7219 2.88306C10.6585 1.89202 9.27773 1.28516 7.62415 1.28516C5.23008 1.28516 3.16471 2.66036 2.15698 4.66469L4.19472 6.24589C4.6791 4.79832 6.03182 3.72376 7.62415 3.72376Z",fill:"#EA4335"})]}),o.jsx("defs",{children:o.jsx("clipPath",{id:"clip0_21999_20513",children:o.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),vrr={sm:"[&>svg]:h-icon-sm [&>svg]:w-icon-sm",default:"[&>svg]:h-icon-default [&>svg]:w-icon-default",lg:"[&>svg]:h-icon-lg [&>svg]:w-icon-lg"},_e=({children:e,className:t,size:n="default",...r})=>o.jsx("span",{className:Y("block",vrr[n],t),...r,children:e}),yrr=e=>o.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M4.31445 3.16083C3.78402 3.16083 3.27531 3.37154 2.90024 3.74661C2.52517 4.12169 2.31445 4.63039 2.31445 5.16083V5.66083C2.31445 6.19126 2.52517 6.69997 2.90024 7.07504C3.27531 7.45011 3.78402 7.66083 4.31445 7.66083C4.84489 7.66083 5.35359 7.45011 5.72867 7.07504C6.10374 6.69997 6.31445 6.19126 6.31445 5.66083V5.16083C6.31445 4.63039 6.10374 4.12169 5.72867 3.74661C5.35359 3.37154 4.84489 3.16083 4.31445 3.16083Z",fill:"currentColor"}),o.jsx("path",{d:"M6.76666 9.50235C6.57678 9.28532 6.30244 9.16083 6.01407 9.16083H4.50201C4.10791 9.16078 3.71766 9.23838 3.35356 9.38921C3.11733 9.48706 2.8951 9.6145 2.69205 9.76806C2.48056 9.928 2.38001 10.1888 2.38001 10.454V13.0642C2.38001 13.6165 2.82773 14.0642 3.38001 14.0642H8.55436C9.4135 14.0642 9.87269 13.0523 9.30695 12.4057L6.76666 9.50235Z",fill:"currentColor"}),o.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),o.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),hge=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M3.8674 9.19968L4.14554 10.8649C4.23965 11.4283 4.75254 11.8237 5.32137 11.7713L5.58252 11.7472C6.56555 11.6567 7.43309 12.3868 7.51181 13.3708L7.59308 14.3867C7.60422 14.5259 7.71868 14.6342 7.85825 14.6376L9.91053 14.6876C10.1066 14.6924 10.2434 14.4948 10.17 14.3129L8.90452 11.1782C8.80956 10.9429 8.65085 10.7389 8.44626 10.5889L7.90134 10.1895C7.70604 10.0464 7.55223 9.85411 7.45759 9.63124C7.15011 8.90712 6.6579 7.71234 6.37054 6.88944C6.19204 6.3783 5.79931 6.29158 5.45492 6.21553C4.98179 6.11106 4.5999 6.02673 4.99001 4.88985C5.66408 2.92541 8.06015 2.07904 10.6601 3.33088C12.6488 4.2884 13.1187 6.35416 13.0328 7.58237C13.0297 7.62768 13.0214 7.67186 13.0094 7.71566C12.8829 8.17534 12.368 8.40491 11.9415 8.19169L10.3022 7.37201C10.2069 7.32439 10.0927 7.33657 10.0096 7.40322L8.64809 8.49559C8.55405 8.57104 8.52072 8.69931 8.56615 8.811L10.8995 14.5478C10.9404 14.6483 11.0369 14.715 11.1454 14.7177L12.0572 14.7399C12.2581 14.7448 12.3951 14.5382 12.3124 14.3551L11.8681 13.3706C11.4211 12.3803 11.6047 11.2192 12.3354 10.4151L13.4616 9.17575C13.7473 8.86125 13.9224 8.46187 13.9599 8.03858L13.9763 7.85359C14.2866 4.35298 11.377 1.41272 7.87336 1.68639C6.03919 1.82965 4.45399 3.02228 3.80807 4.74492L3.70275 5.02579C3.5828 5.34571 3.62741 5.70411 3.82213 5.98485L3.88946 6.08192C4.12183 6.41695 4.0958 6.86726 3.82637 7.17328L3.06705 8.03572C2.96261 8.15435 2.98058 8.33664 3.10617 8.43259L3.66059 8.85617C3.77064 8.94026 3.84458 9.06307 3.8674 9.19968Z",fill:"currentColor"})}),pge=e=>o.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.40864 11.9983C7.58064 11.9733 6.84164 11.6153 6.31564 11.0563C6.31464 11.0563 6.31464 11.0553 6.31464 11.0553C5.78864 10.4963 5.47564 9.73633 5.50064 8.90833C5.52564 8.08033 5.88464 7.34133 6.44364 6.81533C7.00264 6.28833 7.76264 5.97633 8.59064 6.00133C9.41864 6.02633 10.1576 6.38433 10.6836 6.94333H10.6846C11.2106 7.50333 11.5236 8.26233 11.4986 9.09033C11.4726 9.91833 11.1146 10.6583 10.5556 11.1843C9.99664 11.7103 9.23664 12.0233 8.40864 11.9983ZM16.1266 8.15033L14.3606 7.74033C14.2316 7.14133 14.0146 6.57633 13.7216 6.05733L14.7726 4.57933C14.9116 4.38533 14.8926 4.12033 14.7296 3.94633L13.9206 3.08733C13.7576 2.91333 13.4946 2.87933 13.2916 3.00533L11.7526 3.96533C11.2526 3.64133 10.7016 3.39033 10.1116 3.22633L9.80964 1.43833C9.76964 1.20333 9.56964 1.02833 9.33164 1.02133L8.15264 0.985326C7.91364 0.978326 7.70364 1.14033 7.64964 1.37233L7.24064 3.13933C6.64164 3.26733 6.07664 3.48433 5.55664 3.77733L4.07864 2.72633C3.88464 2.58833 3.61964 2.60633 3.44664 2.76933L2.58664 3.57833C2.41364 3.74133 2.37964 4.00533 2.50564 4.20733L3.46564 5.74633C3.14164 6.24633 2.89064 6.79833 2.72564 7.38833L0.937635 7.68933C0.702635 7.72933 0.528635 7.92933 0.520635 8.16733L0.485635 9.34733C0.477635 9.58533 0.639635 9.79533 0.872635 9.84933L2.63864 10.2583C2.76764 10.8573 2.98464 11.4233 3.27764 11.9423L2.22564 13.4203C2.08764 13.6143 2.10564 13.8793 2.26964 14.0523L3.07864 14.9123C3.24164 15.0853 3.50464 15.1203 3.70664 14.9933L5.24564 14.0333C5.74663 14.3583 6.29764 14.6093 6.88764 14.7733L7.18964 16.5613C7.22864 16.7963 7.42864 16.9713 7.66764 16.9783L8.84663 17.0143C9.08564 17.0213 9.29564 16.8593 9.34964 16.6273L9.75864 14.8603C10.3576 14.7323 10.9226 14.5153 11.4416 14.2213L12.9206 15.2733C13.1146 15.4113 13.3786 15.3933 13.5526 15.2293L14.4116 14.4213C14.5856 14.2573 14.6196 13.9943 14.4936 13.7923L13.5336 12.2533C13.8576 11.7523 14.1086 11.2013 14.2726 10.6113L16.0616 10.3103C16.2966 10.2703 16.4706 10.0703 16.4776 9.83233L16.5136 8.65233C16.5206 8.41433 16.3586 8.20433 16.1266 8.15033Z",fill:"currentColor"})}),brr=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),Po=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.5605 1.42351C8.0791 0.904904 8.92215 0.906157 9.4395 1.42351L10.6922 2.67617C11.2108 3.19477 11.2095 4.03782 10.6922 4.55517L9.4395 5.80783C8.9209 6.32643 8.07785 6.32518 7.5605 5.80783L6.30784 4.55517C5.78923 4.03656 5.79049 3.19352 6.30784 2.67617L7.5605 1.42351ZM3.17618 5.80783C3.69478 5.28923 4.53782 5.29048 5.05517 5.80783L6.30784 7.0605C6.82644 7.5791 6.82519 8.42214 6.30784 8.93949L5.05517 10.1922C4.53657 10.7108 3.69353 10.7095 3.17618 10.1922L1.92351 8.93949C1.40491 8.42089 1.40616 7.57785 1.92351 7.0605L3.17618 5.80783ZM11.9448 5.80783C12.4634 5.28923 13.3065 5.29048 13.8238 5.80783L15.0765 7.0605C15.5951 7.5791 15.5938 8.42214 15.0765 8.93949L13.8238 10.1922C13.3052 10.7108 12.4622 10.7095 11.9448 10.1922L10.6922 8.93949C10.1736 8.42089 10.1748 7.57785 10.6922 7.0605L11.9448 5.80783ZM7.5605 10.1922C8.0791 9.67355 8.92215 9.67481 9.4395 10.1922L10.6922 11.4448C11.2108 11.9634 11.2095 12.8065 10.6922 13.3238L9.4395 14.5765C8.9209 15.0951 8.07785 15.0938 7.5605 14.5765L6.30784 13.3238C5.78923 12.8052 5.79049 11.9622 6.30784 11.4448L7.5605 10.1922Z",fill:"currentColor"})}),K_=e=>o.jsx(iXt,{...e}),tl=e=>o.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.24388 2.4018C6.24388 2.0394 6.53767 1.74561 6.90008 1.74561H10.0991C10.4614 1.74561 10.7553 2.0394 10.7553 2.4018V4.57546C10.7553 4.93787 10.4614 5.23166 10.0991 5.23166H9.31982V7.35469L10.0033 9.22664C9.90442 9.20146 9.80035 9.1761 9.6915 9.14986L9.62652 9.13422C9.30473 9.05687 8.92256 8.96501 8.61993 8.84491C8.5819 8.82981 8.54147 8.81292 8.49957 8.79391C8.45767 8.81292 8.41724 8.82981 8.3792 8.84491C8.07657 8.96501 7.6944 9.05687 7.37261 9.13422L7.30763 9.14986C7.19879 9.1761 7.09471 9.20146 6.99577 9.22664L7.67932 7.35469V5.23166H6.90008C6.53767 5.23166 6.24388 4.93787 6.24388 4.57546V2.4018ZM6.99577 9.22664C6.99577 9.22664 6.99578 9.22664 6.99577 9.22664L6.43283 10.7683H6.81806C7.18047 10.7683 7.47426 11.0622 7.47426 11.4245V13.5982C7.47426 13.9606 7.18047 14.2544 6.81806 14.2544H3.61909C3.25668 14.2544 2.96289 13.9606 2.96289 13.5982V11.4245C2.96289 11.0622 3.25668 10.7683 3.61909 10.7683H4.26617C4.2921 10.4663 4.32783 10.1494 4.37744 9.85171C4.43762 9.49063 4.52982 9.08135 4.68998 8.76102C4.93975 8.2615 5.44743 8.01751 5.7771 7.88788C6.14684 7.74249 6.57537 7.63889 6.92317 7.55505C7.24707 7.47696 7.49576 7.41679 7.67932 7.35469L6.99577 9.22664ZM6.43283 10.7683L6.99577 9.22664C6.75846 9.28705 6.55067 9.34646 6.37745 9.41458C6.22784 9.47341 6.1623 9.51712 6.14023 9.53254C6.09752 9.63631 6.04409 9.83055 5.99562 10.1214C5.96201 10.3231 5.93498 10.5439 5.91341 10.7683H6.43283ZM10.0033 9.22664L9.31982 7.35469C9.50338 7.41679 9.75206 7.47696 10.076 7.55505C10.4238 7.63889 10.8523 7.74249 11.2221 7.88788C11.5517 8.01751 12.0594 8.2615 12.3091 8.76102C12.4693 9.08135 12.5615 9.49063 12.6217 9.85171C12.6713 10.1494 12.707 10.4663 12.733 10.7683H13.38C13.7424 10.7683 14.0362 11.0622 14.0362 11.4245V13.5982C14.0362 13.9606 13.7424 14.2544 13.38 14.2544H10.1811C9.81867 14.2544 9.52488 13.9606 9.52488 13.5982V11.4245C9.52488 11.0622 9.81867 10.7683 10.1811 10.7683H10.5663L10.0033 9.22664ZM10.0033 9.22664L10.5663 10.7683H11.0857C11.0642 10.5439 11.0372 10.3231 11.0035 10.1214C10.9551 9.83055 10.9016 9.63631 10.8589 9.53254C10.8369 9.51712 10.7713 9.47341 10.6217 9.41458C10.4485 9.34646 10.2407 9.28705 10.0033 9.22664Z",fill:"currentColor"})}),Tu=e=>o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("path",{d:"M6.53918 9.32122C6.34324 9.51508 6.02724 9.51338 5.83338 9.31744C5.63952 9.1215 5.6412 8.80551 5.83713 8.61164L10.1958 4.29931C10.7996 3.70186 10.8017 2.72852 10.2041 2.12839L10.1899 2.11428C9.58767 1.52481 8.62251 1.53208 8.0292 2.13052L2.29396 7.91536C2.0999 8.1111 1.78388 8.11246 1.58813 7.9184C1.39239 7.72433 1.39103 7.40831 1.58509 7.21257L7.32036 1.42774C8.30005 0.439581 9.89369 0.427613 10.8881 1.40094L10.9116 1.42425C11.4942 2.00929 11.7316 2.80913 11.6232 3.56922C12.389 3.44866 13.1999 3.67918 13.7961 4.26273C14.804 5.24929 14.8147 6.86824 13.82 7.86808L8.5531 13.1619C8.50045 13.2148 8.50024 13.3002 8.55263 13.3534L9.65448 14.4717C9.84794 14.668 9.8456 14.984 9.64925 15.1775C9.45291 15.3709 9.13691 15.3686 8.94345 15.1723L7.84163 14.054C7.40505 13.6109 7.40677 12.8988 7.8455 12.4579L13.1124 7.16405C13.7161 6.55727 13.7095 5.57478 13.0979 4.97606C12.4925 4.38347 11.4942 4.40725 10.8978 5.00886L6.53918 9.32122Z",fill:"currentColor"}),o.jsx("path",{d:"M8.84622 2.75411C9.04697 2.56188 9.36555 2.56381 9.56395 2.76076C9.76234 2.95771 9.76658 3.27625 9.57582 3.4784L9.56661 3.48794L5.25912 7.82701C4.67023 8.42022 4.672 9.37798 5.26305 9.96904C5.85624 10.5622 6.81818 10.5615 7.41052 9.9675L11.6299 5.73599L11.6395 5.72671C11.8406 5.53493 12.1592 5.53756 12.3572 5.73496C12.5583 5.93548 12.5587 6.26104 12.3582 6.46214L8.13877 10.6937C7.14498 11.6903 5.53105 11.6915 4.53584 10.6963C3.5442 9.70461 3.54127 8.09774 4.52928 7.10248L8.83677 2.76342L8.84622 2.75411Z",fill:"currentColor"})]}),mge=e=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:o.jsx("path",{d:"M1.5 8.5V8C1.5 7.60218 1.65804 7.22064 1.93934 6.93934C2.22064 6.65804 2.60218 6.5 3 6.5H13C13.3978 6.5 13.7794 6.65804 14.0607 6.93934C14.342 7.22064 14.5 7.60218 14.5 8V8.5M8.70667 4.20667L7.29333 2.79333C7.20048 2.70037 7.09022 2.62661 6.96886 2.57628C6.84749 2.52595 6.71739 2.50003 6.586 2.5H3C2.60218 2.5 2.22064 2.65804 1.93934 2.93934C1.65804 3.22064 1.5 3.60218 1.5 4V12C1.5 12.3978 1.65804 12.7794 1.93934 13.0607C2.22064 13.342 2.60218 13.5 3 13.5H13C13.3978 13.5 13.7794 13.342 14.0607 13.0607C14.342 12.7794 14.5 12.3978 14.5 12V6C14.5 5.60218 14.342 5.22064 14.0607 4.93934C13.7794 4.65804 13.3978 4.5 13 4.5H9.414C9.14887 4.49977 8.89402 4.39426 8.70667 4.20667Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});function x0(e){return o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",xmlns:"http://www.w3.org/2000/svg",...e,children:[o.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),o.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),o.jsx("path",{d:"M15 2v2"}),o.jsx("path",{d:"M15 20v2"}),o.jsx("path",{d:"M2 15h2"}),o.jsx("path",{d:"M2 9h2"}),o.jsx("path",{d:"M20 15h2"}),o.jsx("path",{d:"M20 9h2"}),o.jsx("path",{d:"M9 2v2"}),o.jsx("path",{d:"M9 20v2"})]})}const xrr={jpg:"image/jpg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",bmp:"image/bmp",ico:"image/x-icon",pdf:"application/pdf"},wrr=async e=>{try{const t=await fetch(e,{method:"HEAD"});if(!t.ok)throw new Error("Failed to get file content type");const n=t.headers.get("content-type");if(!n)throw new Error("Failed to get file content type");return n}catch{const r=new URL(e).pathname.split(".").pop();if(!r)return;const a=r.toLowerCase();return xrr[a]}},Srr=({onOpenChange:e,open:t})=>{const n=mI(),r=inr({onChange:()=>e(!1)}),a=async s=>{s.preventDefault();const l=new FormData(s.target).get("url-attachment")?.toString();if(l){const c=new File([],l,{type:await wrr(l)});n.addAttachment(c),e(!1)}};return o.jsx(Er,{onOpenChange:e,open:t,children:o.jsxs(yr,{children:[o.jsxs(Cr,{children:[o.jsx(br,{children:"Add attachment"}),o.jsx(Ka,{children:"Add a file attachment via URL or from your computer"})]}),o.jsxs(Lr,{children:[o.jsxs("form",{onSubmit:a,className:"flex flex-row items-end gap-4",children:[o.jsxs("div",{className:"w-full space-y-1",children:[o.jsx(St,{htmlFor:"url-attachment",className:"text-neutral3 text-ui-md",children:"Public URL"}),o.jsx(cn,{type:"text",name:"url-attachment",id:"url-attachment",className:"w-full",placeholder:"https://placehold.co/600x400/png"})]}),o.jsxs(ye,{type:"submit",className:"h-8!",variant:"light",children:[o.jsx(_e,{children:o.jsx(OZt,{})}),"Add"]})]}),o.jsx("hr",{className:"my-2 border border-border1"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ve,{variant:"ui-md",className:"text-neutral3",children:"Or from your computer"}),o.jsxs("button",{onClick:r,className:"w-full h-40 border border-border1 rounded-lg text-neutral3 border-dashed flex flex-col items-center justify-center gap-2 hover:bg-surface2 active:bg-surface3",children:[o.jsx(lGt,{className:"size-12"}),o.jsx(ve,{variant:"header-md",children:"Add a local file"})]})]})]})]})})},Orr=e=>{const[t,n]=b.useState(void 0);return b.useEffect(()=>{if(!e){n(void 0);return}const r=URL.createObjectURL(e);return n(r),()=>{URL.revokeObjectURL(r)}},[e]),t},krr=()=>{const{file:e,src:t}=E2(qZe(n=>{if(n.file)return n.file.name.startsWith("https://")?{src:n.file.name}:{file:n.file};const r=n.content?.filter(a=>a.type==="image")[0]?.image;return r?{src:r}:{}}));return Orr(e)??t},_rr=()=>{const e=mI(),[t,n]=b.useState(!1);return b.useEffect(()=>{e.subscribe(()=>{const r=e.getState().attachments;n(r.length>0)})},[e]),t},Err=e=>{const[t,n]=b.useState({isLoading:!1,text:""});return b.useEffect(()=>{if(!e)return;(async()=>{n(s=>({...s,isLoading:!0}));const a=await e.text();n(s=>({...s,isLoading:!1,text:a}))})()},[e]),t},y3="h-full w-full flex items-center justify-center",Ebt=({data:e,url:t})=>{const[n,r]=b.useState(!1);return t?o.jsx("a",{href:t,className:y3,target:"_blank",rel:"noreferrer noopener",children:o.jsx(Id,{className:"text-accent2","aria-label":"View PDF"})}):o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>r(!0),className:y3,type:"button",children:o.jsx(Id,{className:"text-accent2","aria-label":"View PDF"})}),o.jsx(Crr,{data:e,open:n,onOpenChange:r})]})},Crr=({data:e,open:t,onOpenChange:n})=>o.jsx(Er,{open:t,onOpenChange:n,children:o.jsxs(yr,{className:"max-w-4xl",children:[o.jsxs(Cr,{children:[o.jsx(br,{children:"PDF preview"}),o.jsx(Ka,{children:"Preview of the PDF document"})]}),o.jsx(Lr,{children:t&&o.jsx("iframe",{src:e,width:"100%",height:"600px"})})]})}),Cbt=({src:e})=>{const[t,n]=b.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>n(!0),type:"button",className:y3,children:o.jsx("img",{src:e,className:"object-cover aspect-ratio max-h-[140px] max-w-[320px]",alt:"Preview"})}),o.jsx(jrr,{src:e,open:t,onOpenChange:n})]})},jrr=({src:e,open:t,onOpenChange:n})=>o.jsx(Er,{open:t,onOpenChange:n,children:o.jsxs(yr,{className:"max-w-4xl",children:[o.jsxs(Cr,{children:[o.jsx(br,{children:"Image preview"}),o.jsx(Ka,{children:"Preview of the image"})]}),o.jsx(Lr,{children:t&&o.jsx("img",{src:e,alt:"Image"})})]})}),jbt=({data:e})=>{const[t,n]=b.useState(!1),r=e.replace(/<attachment[^>]*>/,"").replace(/<\/attachment>/g,"");return o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>n(!0),className:y3,type:"button",children:o.jsx(Id,{className:"text-neutral3"})}),o.jsx(Trr,{data:r,open:t,onOpenChange:n})]})},Trr=({data:e,open:t,onOpenChange:n})=>o.jsx(Er,{open:t,onOpenChange:n,children:o.jsxs(yr,{className:"max-w-4xl h-[80vh]",children:[o.jsxs(Cr,{children:[o.jsx(br,{children:"Text preview"}),o.jsx(Ka,{children:"Preview of the text file"})]}),o.jsx(Lr,{children:t&&o.jsx("div",{className:"whitespace-pre-wrap",children:e})})]})}),Nrr={sm:`${Ql.sm} w-form-sm`,md:`${Ql.md} w-form-md`,lg:`${Ql.lg} w-form-lg`,default:`${Ql.default}`},Arr={sm:"sm",md:"default",lg:"lg",default:"default"},Irr={default:"bg-surface2 hover:bg-surface4 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",light:"bg-surface3 hover:bg-surface5 text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",outline:"bg-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",ghost:"bg-transparent border-transparent hover:bg-surface2 text-neutral3 hover:text-neutral6 disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-accent1 hover:bg-accent1/90 text-surface1 font-medium hover:shadow-glow-accent1 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:shadow-none"},Rrr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",Tr=Ne.forwardRef(({className:e,children:t,tooltip:n,size:r="md",variant:a="default",disabled:s,...i},l)=>o.jsxs(tr,{children:[o.jsx(nr,{asChild:!0,children:o.jsx("button",{ref:l,disabled:s,"aria-label":typeof n=="string"?n:void 0,className:Y(Rrr,NR,Irr[a],Nrr[r],s&&"active:scale-100",e),...i,children:o.jsx(_e,{size:Arr[r],children:t})})}),o.jsx(Kn,{children:n})]}));Tr.displayName="IconButton";const Prr={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"};function Pt({color:e,className:t,size:n="md"}){return o.jsx("svg",{className:Y("animate-spin",Prr[n],t),style:{animationDuration:"800ms",animationTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)"},xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:e||"currentColor",className:"text-accent1"})})}const Tbt=async e=>new Promise((t,n)=>{const r=new FileReader;r.onload=()=>{const a=r.result;typeof a=="string"?t(a):n(new Error("Failed to convert file to base64."))},r.onerror=a=>{n(a)},r.readAsDataURL(e)}),Mrr=({document:e})=>{const{isLoading:t,text:n}=Err(e.file);return o.jsx("div",{className:"flex items-center justify-center h-full w-full",children:t?o.jsx(Pt,{className:"animate-spin"}):o.jsx(jbt,{data:n})})},Drr=({document:e})=>{const[t,n]=b.useState({isLoading:!1,text:""});b.useEffect(()=>{let a=!1;return(async()=>{if(!e.file)return;n(l=>({...l,isLoading:!0}));const i=await Tbt(e.file);a||n(l=>({...l,isLoading:!1,text:i}))})(),()=>{a=!0}},[e]);const r=e.file?.name.startsWith("https://");return o.jsx("div",{className:"flex items-center justify-center h-full w-full",children:t.isLoading?o.jsx(Pt,{className:"animate-spin"}):o.jsx(Ebt,{data:t.text,url:r?e.file?.name:void 0})})},$rr=()=>{const e=E2(i=>i.type==="image"),t=E2(i=>i.type==="document"?i:void 0),n=krr(),r=E2(i=>i.source!=="message"),s=t?.file?.name.startsWith("https://")?t?.file?.name:n;return o.jsx(o.Fragment,{children:o.jsxs("div",{className:"relative",children:[o.jsx(n6,{children:o.jsxs(tr,{children:[o.jsx(eet,{children:o.jsx(nr,{asChild:!0,children:o.jsx("div",{className:"overflow-hidden size-16 rounded-lg bg-surface3 border border-border1 ",children:e?o.jsx(Cbt,{src:s??""}):t?.contentType==="application/pdf"?o.jsx(Drr,{document:t}):t?o.jsx(Mrr,{document:t}):null})})}),o.jsx(Kn,{side:"top",children:o.jsx(tet,{})})]})}),r&&o.jsx(Lrr,{})]})})},Lrr=()=>o.jsx(gQt,{asChild:!0,children:o.jsx(Tr,{variant:"light",size:"md",tooltip:"Remove file",className:"absolute -right-3 -top-3 text-neutral3 hover:text-neutral6 bg-surface1 hover:bg-surface2 rounded-full p-1",children:o.jsx(_e,{children:o.jsx(_b,{})})})}),Frr=()=>_rr()?o.jsx("div",{className:"flex w-full flex-row items-center gap-4 pb-2",children:o.jsx(GZe,{components:{Attachment:$rr}})}):null;function zrr({containerRef:e}){const[t,n]=b.useState([]),[r,a]=b.useState(null),s=b.useRef(""),i=b.useRef(0),l=b.useCallback(()=>{const u=e.current;if(!u){s.current!==""&&(s.current="",n([]));return}const d=u.getBoundingClientRect(),f=Array.from(u.querySelectorAll("[data-om-badge]"));if(f.length===0){s.current!==""&&(s.current="",n([]));return}const h=[];for(let m=0;m<f.length;m++){const g=f[m],v=g.getAttribute("data-om-badge")||"",x=g.getAttribute("data-om-state")||"complete",w=g.getAttribute("data-om-type")||"observation",O=g.getBoundingClientRect();let k;const _=Brr(f,m,w);if(_){const A=parseFloat(getComputedStyle(_).marginBottom)||0;k=_.getBoundingClientRect().bottom+A-d.top}else k=0;const C=parseFloat(getComputedStyle(g).marginBottom)||0,j=O.bottom+C-d.top-k;j<=0||h.push({cycleId:v,omType:w,state:x,top:k,height:j})}const p=JSON.stringify(h);p!==s.current&&(s.current=p,n(h))},[e]);if(b.useEffect(()=>{const u=e.current;if(!u)return;l();const d=new ResizeObserver(()=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(l)});d.observe(u);const f=new MutationObserver(()=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(l)});return f.observe(u,{childList:!0,subtree:!0}),()=>{cancelAnimationFrame(i.current),d.disconnect(),f.disconnect()}},[l,e]),b.useEffect(()=>{const u=e.current;if(!u)return;const d=h=>{const p=h.target.closest("[data-om-badge]");p&&a(p.getAttribute("data-om-badge"))},f=h=>{h.target.closest("[data-om-badge]")&&a(null)};return u.addEventListener("mouseover",d),u.addEventListener("mouseout",f),()=>{u.removeEventListener("mouseover",d),u.removeEventListener("mouseout",f)}},[e]),t.length===0)return null;const c=t[t.length-1]?.cycleId??null;return o.jsx("div",{className:"pointer-events-none absolute inset-0",style:{zIndex:0},children:t.map(u=>{const d=u.cycleId===c,f=u.cycleId===r,h=r?f:d;return o.jsx(Urr,{highlight:u,visible:h},u.cycleId)})})}function Brr(e,t,n){for(let r=t-1;r>=0;r--){const a=e[r];if(a.getAttribute("data-om-state")!=="failed"&&(n==="observation"||a.getAttribute("data-om-type")==="reflection"))return a}return null}function Urr({highlight:e,visible:t}){const n=qrr(e.state),r=e.state.startsWith("buffering");return o.jsx("div",{className:"absolute left-0 right-0 transition-opacity duration-200",style:{top:e.top,height:e.height,border:`3px ${r?"dashed":"solid"} ${n}`,borderRadius:"0.5rem",opacity:t?1:0}})}function qrr(e){switch(e){case"complete":return"rgba(34, 197, 94, 0.4)";case"loading":return"rgba(59, 130, 246, 0.4)";case"failed":return"rgba(239, 68, 68, 0.4)";case"disconnected":return"rgba(234, 179, 8, 0.4)";case"buffering":return"rgba(168, 85, 247, 0.4)";case"buffering-complete":return"rgba(168, 85, 247, 0.4)";case"buffering-failed":return"rgba(239, 68, 68, 0.4)";case"activated":return"rgba(34, 197, 94, 0.4)";default:return"rgba(34, 197, 94, 0.4)"}}const Yn={colors:"transition-colors duration-normal ease-out-custom",all:"transition-all duration-normal ease-out-custom",opacity:"transition-opacity duration-normal ease-out-custom",allSlow:"transition-all duration-slow ease-out-custom"},nx={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},Vrr={default:"text-neutral3 bg-surface4",success:"text-accent1 bg-accent1Dark",error:"text-accent2 bg-accent2Dark",info:"text-accent5 bg-accent5Dark",warning:"text-accent6 bg-accent6Dark"},Hrr={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},wt=({icon:e,variant:t="default",className:n,children:r,...a})=>o.jsxs("div",{className:Y("font-mono text-ui-sm gap-1 h-badge-default inline-flex items-center rounded-full border border-border1 shrink-0",Yn.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":Vrr[t],n),...a,children:[e&&o.jsx("span",{className:Hrr[t],children:o.jsx(_e,{children:e})}),r]}),n8=({children:e,initialCollapsed:t=!0,icon:n,title:r,collapsible:a=!0,extraInfo:s,"data-testid":i})=>{const[l,c]=b.useState(t);return b.useEffect(()=>{c(t)},[t]),o.jsxs("div",{className:"mb-4","data-testid":i,children:[o.jsxs("div",{className:"flex flex-row gap-2 items-center justify-between",children:[o.jsxs("button",{onClick:a?()=>c(u=>!u):void 0,className:"flex items-center gap-2 disabled:cursor-not-allowed",disabled:!a,type:"button",children:[o.jsx(_e,{children:o.jsx(bv,{className:Y("transition-all",l?"rotate-90":"rotate-180")})}),o.jsx(wt,{icon:n,children:r})]}),s]}),!l&&o.jsx("div",{className:"pt-2",children:o.jsx("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:e})})]})};function Qrr(e,t=5){if(!e?.properties)return[];const n=[];function r(a,s,i){if(i>t)return;const l=Array.isArray(a.type)?a.type.join(" | "):a.type;if(n.push({path:s,label:s,description:a.description??a.title,type:l}),a.properties)for(const[c,u]of Object.entries(a.properties))r(u,`${s}.${c}`,i+1);if(a.items?.properties)for(const[c,u]of Object.entries(a.items.properties))r(u,`${s}[].${c}`,i+1)}for(const[a,s]of Object.entries(e.properties))r(s,a,1);return n}function Wrr(e){const t=Qrr(e);return Art({override:[Grr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function Grr(e){return t=>{const r=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!r)return null;const a=r[1]??"",s=t.pos-a.length,i=a?e.filter(c=>c.path.toLowerCase().startsWith(a.toLowerCase())):e;if(i.length===0)return null;const l=i.map(c=>({label:c.path,displayLabel:c.path,detail:c.type,info:c.description,apply:(u,d,f,h)=>{const g=u.state.sliceDoc(h,h+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:f,to:h,insert:g},selection:{anchor:f+g.length}})}}));return{from:s,options:l,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const Zrr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,Yrr=on.mark({class:"cm-variable-highlight"}),c6e=new Wnt({regexp:Zrr,decoration:()=>Yrr}),Xrr=ii.fromClass(class{decorations;constructor(e){this.decorations=c6e.createDeco(e)}update(e){this.decorations=c6e.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),Krr=Xrr,Jrr={duration:5e3,cancel:{label:o.jsx(_e,{children:o.jsx(Wn,{})}),onClick:()=>{}},unstyled:!0,classNames:{toast:"bg-surface3 w-full h-auto rounded-lg gap-2 border border-border1 px-3 py-2 flex items-center justify-between pointer-events-auto shadow-card :data-content:flex-1",title:"text-xs font-medium text-neutral5",description:"text-xs text-neutral3",cancelButton:"bg-transparent! hover:bg-surface2! border-none! rounded-md! p-1.5! m-0! text-neutral3! hover:text-neutral6! shrink-0 transition-all",actionButton:"bg-white! flex items-center justify-center font-medium text-black! order-last hover:opacity-80"}};function Ed(e){const{classNames:t,...n}=Jrr,{classNames:r,...a}=e||{};return{...n,classNames:{...t,title:Y(t?.title,r?.title),toast:Y(t?.toast,r?.toast),cancelButton:Y(t?.cancelButton,r?.cancelButton),actionButton:Y(t?.actionButton,r?.actionButton),description:Y(t?.description,r?.description)},...a}}const Fe=(e,t={})=>{if(Array.isArray(e))return e.forEach(n=>Gl(n,Ed(t)));if(Ne.isValidElement(e))return Gl(e,Ed(t));if(typeof e=="string")return Gl(e,Ed(t));throw new Error("Invalid message type")};Fe.success=(e,t={})=>{const n={...t,icon:o.jsx(_e,{className:"text-accent1 shrink-0",children:o.jsx(vue,{})}),classNames:{...t.classNames,toast:Y("bg-accent1Darker border-accent1/30 border-l-[3px] border-l-accent1",t.classNames?.toast),title:Y("text-xs text-neutral5",t.classNames?.title),description:Y("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Gl.success(e,Ed(n));case"object":return e.forEach(r=>Gl.success(r,Ed(n)))}};Fe.error=(e,t={})=>{const n={...t,icon:o.jsx(_e,{className:"text-accent2 shrink-0",children:o.jsx(_b,{})}),classNames:{...t.classNames,toast:Y("bg-accent2Darker border-accent2/30 border-l-[3px] border-l-accent2",t.classNames?.toast),title:Y("text-xs text-neutral5",t.classNames?.title),description:Y("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Gl.error(e,Ed(n));case"object":return e.forEach(r=>Gl.error(r,Ed(n)))}};Fe.warning=(e,t={})=>{const n={...t,icon:o.jsx(_e,{className:"text-accent6 shrink-0",children:o.jsx(kb,{})}),classNames:{...t.classNames,toast:Y("bg-accent6Darker border-accent6/30 border-l-[3px] border-l-accent6",t.classNames?.toast),title:Y("text-xs text-neutral5",t.classNames?.title),description:Y("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Gl.warning(e,Ed(n));case"object":return e.forEach(r=>Gl.warning(r,Ed(n)))}};Fe.info=(e,t={})=>{const n={...t,icon:o.jsx(_e,{className:"text-accent3 shrink-0",children:o.jsx(ql,{})}),classNames:{...t.classNames,toast:Y("bg-accent3Darker border-accent3/30 border-l-[3px] border-l-accent3",t.classNames?.toast),title:Y("text-xs text-neutral5",t.classNames?.title),description:Y("text-xs text-neutral4",t.classNames?.description)}};switch(typeof e){case"string":return Gl.info(e,Ed(n));case"object":return e.forEach(r=>Gl.info(r,Ed(n)))}};Fe.custom=(e,t={})=>Gl(e,Ed(t));Fe.dismiss=e=>{e&&Gl.dismiss(e)};Fe.promise=({myPromise:e,loadingMessage:t,successMessage:n,errorMessage:r,onSuccess:a,onError:s,options:i={}})=>Gl.promise(e,{loading:t??"Loading...",success:l=>(a?.(l),n),error:l=>(s?.(l),r||l?.message||"Error..."),...Ed(i)});function Wf({text:e,copyMessage:t="Copied to clipboard!"}){const[n,r]=b.useState(!1),a=b.useRef(null),s=b.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{Fe.success(t),r(!0),a.current&&(clearTimeout(a.current),a.current=null),a.current=setTimeout(()=>{r(!1)},2e3)}).catch(()=>{Fe.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:n,handleCopy:s}}function hi({content:e,copyMessage:t,tooltip:n="Copy to clipboard",size:r="sm",className:a}){const[s,i]=b.useState(!1),{handleCopy:l}=Wf({text:e,copyMessage:t}),c=()=>{l(),i(!0),setTimeout(()=>i(!1),2e3)};return o.jsxs(tr,{children:[o.jsx(nr,{asChild:!0,children:o.jsx(ye,{onClick:c,type:"button",size:r,className:a,"aria-label":s?"Copied!":n,children:s?o.jsx(ca,{}):o.jsx(Kl,{})})}),o.jsx(Kn,{children:s?"Copied!":n})]})}function ear(){const e=FI({settings:{fontFamily:"var(--geist-mono)",fontSize:"0.8rem",lineHighlight:"transparent",gutterBackground:"transparent",gutterForeground:"var(--neutral2)",background:"transparent",foreground:"var(--neutral6)",caret:"var(--neutral6)"},styles:[{tag:[se.className,se.propertyName],color:"var(--neutral6)"},{tag:se.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[se.heading1,se.heading2,se.heading3,se.heading4,se.heading5,se.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:se.emphasis,fontStyle:"italic",color:"var(--neutral6)"},{tag:se.strong,fontWeight:"bold",color:"var(--neutral6)"},{tag:se.link,color:"var(--accent3)",textDecoration:"underline"},{tag:se.url,color:"var(--accent3)"},{tag:se.monospace,color:"var(--neutral6)"},{tag:se.strikethrough,textDecoration:"line-through"},{tag:se.quote,fontStyle:"italic",color:"var(--neutral2)"}]}),t=xt.theme({".cm-editor":{backgroundColor:"transparent"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{color:"var(--neutral3)"},".cm-cursor":{borderLeftColor:"var(--neutral6)"},".cm-selectionBackground, .cm-content ::selection":{backgroundColor:"color-mix(in srgb, var(--accent3) 22%, transparent)"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}});return[e,t]}function tar(){const e=xt.theme({"&":{backgroundColor:"transparent",color:"var(--neutral6)",fontSize:"0.8rem"},"&.cm-editor .cm-scroller":{fontFamily:"var(--geist-mono)"},".cm-gutters":{backgroundColor:"transparent",color:"var(--neutral2)",borderRight:"none"},".cm-content":{color:"var(--neutral6)",caretColor:"var(--neutral6)"},".cm-activeLine":{backgroundColor:"transparent"},".cm-lineNumbers .cm-gutterElement":{color:"var(--neutral2)"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--neutral3)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--neutral6)"},"&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection":{background:"color-mix(in srgb, var(--accent3) 22%, transparent) !important"},".cm-tooltip-autocomplete":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",borderRadius:"6px",boxShadow:"0 8px 16px rgba(0, 0, 0, 0.2)"},".cm-tooltip-autocomplete > ul":{fontFamily:"var(--geist-mono)"},".cm-completionLabel":{color:"var(--neutral6)"},".cm-completionDetail":{color:"var(--neutral3)",fontSize:"0.7rem",marginLeft:"auto",paddingLeft:"12px"},".cm-completionInfo":{backgroundColor:"var(--surface2)",border:"1px solid var(--border1)",color:"var(--neutral3)",padding:"8px 12px"},".cm-completionIcon":{display:"none"},"ul.cm-completionList li[aria-selected]":{backgroundColor:"var(--surface4)",color:"var(--neutral6)"},".cm-line .cm-variable-highlight":{color:"var(--accent6) !important",fontWeight:"500"}}),t=$m.define([{tag:[se.comment,se.bracket],color:"var(--neutral2)"},{tag:[se.string,se.meta,se.regexp],color:"var(--accent1)"},{tag:[se.atom,se.bool,se.special(se.variableName)],color:"var(--accent6)"},{tag:[se.keyword,se.operator,se.tagName],color:"var(--accent2)"},{tag:[se.function(se.propertyName),se.propertyName],color:"var(--accent5)"},{tag:[se.definition(se.variableName),se.function(se.variableName),se.className,se.attributeName],color:"var(--accent3)"},{tag:[se.variableName,se.number],color:"var(--accent5)"},{tag:[se.name,se.quote],color:"var(--accent1)"},{tag:se.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[se.heading1,se.heading2,se.heading3,se.heading4,se.heading5,se.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:[se.emphasis],fontStyle:"italic",color:"var(--neutral6)"},{tag:[se.strong],fontWeight:"bold",color:"var(--neutral6)"},{tag:se.link,color:"var(--accent3)",textDecoration:"underline"},{tag:se.url,color:"var(--accent3)"},{tag:se.monospace,color:"var(--neutral6)"},{tag:se.strikethrough,textDecoration:"line-through"},{tag:[se.deleted],color:"var(--accent2)"},{tag:se.invalid,color:"var(--error)"},{tag:[se.standard(se.tagName)],color:"var(--accent1)"}]);return[e,Jw(t)]}const Rv=()=>{const e=t8();return b.useMemo(()=>e?ear():tar(),[e])},oa=b.forwardRef(({data:e,value:t,onChange:n,showCopyButton:r=!0,className:a,language:s="json",highlightVariables:i=!1,placeholder:l,schema:c,autoFocus:u,lineNumbers:d=!0,editable:f,...h},p)=>{const m=Rv(),g=e?JSON.stringify(e,null,2):t??"",v=b.useMemo(()=>{const x=[];return s==="json"?x.push(Sd):s==="markdown"&&(x.push(Pde({base:ow,codeLanguages:Jat})),x.push(xt.lineWrapping)),i&&s==="markdown"&&x.push(Krr),c&&s==="markdown"&&x.push(Wrr(c)),f===!1&&x.push(Ir.readOnly.of(!0)),x},[s,i,c,f]);return o.jsxs("div",{className:Y("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",a),...h,children:[r&&o.jsx(hi,{content:g,className:"absolute top-2 right-2 z-20"}),o.jsx(Eu,{ref:p,value:g,theme:m,extensions:v,onChange:n,editable:f,"aria-label":"Code editor",placeholder:l,height:"100%",style:{height:"100%"},autoFocus:u,basicSetup:{lineNumbers:d}})]})});async function nar(e,t){const{codeToTokens:n,bundledLanguages:r}=await nt(async()=>{const{codeToTokens:s,bundledLanguages:i}=await import("./index-D1h4EPgk.js");return{codeToTokens:s,bundledLanguages:i}},__vite__mapDeps([26,2]),import.meta.url);if(!(t in r))return null;const{tokens:a}=await n(e,{lang:t,defaultColor:!1,themes:{light:"github-light",dark:"github-dark"}});return a}const rar=({selectionReason:e,open:t,onOpenChange:n,input:r})=>{let a=null;if(r)try{a=typeof r=="object"?o.jsx(oa,{data:r}):o.jsx(oa,{data:JSON.parse(r)})}catch{a=o.jsx("pre",{className:"whitespace-pre-wrap",children:r})}return o.jsx(Er,{open:t,onOpenChange:n,children:o.jsxs(yr,{children:[o.jsxs(Cr,{children:[o.jsx(br,{children:"Agent Network Metadata"}),o.jsx(Ka,{children:"View the metadata of the agent's network choice."})]}),o.jsxs(Lr,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ve,{className:"text-neutral3",children:"Selection Reason"}),o.jsx("div",{className:"text-neutral6 text-ui-md",children:e})]}),a&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(ve,{className:"text-neutral3",children:"Input"}),o.jsx("div",{className:"text-neutral6 text-ui-md",children:a})]})]})]})})},gge=({selectionReason:e,input:t})=>{const[n,r]=b.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsx(Tr,{variant:"light",size:"md",tooltip:"Show selection reason",onClick:()=>r(a=>!a),children:o.jsx(AYt,{className:"text-neutral3 size-5"})}),o.jsx(rar,{selectionReason:e||"",open:n,onOpenChange:r,input:t})]})},Nbt=b.createContext(void 0);function aar({children:e,approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:l,toolCallApprovals:c,networkToolCallApprovals:u}){return o.jsx(Nbt.Provider,{value:{approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:l,toolCallApprovals:c,networkToolCallApprovals:u},children:e})}function sar(){const e=b.useContext(Nbt);if(!e)throw new Error("useToolCall must be used within a ToolCallProvider");return e}const IR=({toolCalled:e,toolCallId:t,toolApprovalMetadata:n,toolName:r,isNetwork:a,isGenerateMode:s})=>{const{approveToolcall:i,declineToolcall:l,approveToolcallGenerate:c,declineToolcallGenerate:u,isRunning:d,toolCallApprovals:f,approveNetworkToolcall:h,declineNetworkToolcall:p,networkToolCallApprovals:m}=sar(),g=()=>{a?h(r,n?.runId):s?c(t):i(t)},v=()=>{a?p(r,n?.runId):s?u(t):l(t)},x=a?m?.[n?.runId?`${n.runId}-${r}`:r]?.status:f?.[t]?.status;return n&&!e?o.jsxs("div",{children:[o.jsx("p",{className:"font-medium pb-2",children:"Approval required"}),o.jsxs("div",{className:"flex gap-2 items-center",children:[o.jsxs(ye,{onClick:g,disabled:d||!!x,className:x==="approved"?"text-accent1!":"",children:[o.jsx(_e,{children:o.jsx(ca,{})}),"Approve"]}),o.jsxs(ye,{onClick:v,disabled:d||!!x,className:x==="declined"?"text-accent2!":"",children:[o.jsx(_e,{children:o.jsx(Wn,{})}),"Decline"]})]})]}):null},iar=({agentId:e,messages:t=[],metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:l,toolCalled:c,isComplete:u=!1})=>{const d=n?.mode==="network"?n.selectionReason:void 0,f=n?.mode==="network"?n.agentInput:void 0,h=n?.mode==="stream"||n?.mode==="network"||n?.mode==="generate"?n?.requireApprovalMetadata:void 0,p=n?.mode==="stream"||n?.mode==="network"||n?.mode==="generate"?n?.suspendedTools:void 0,m=t.length>0&&t.every(x=>x.type==="text"?!0:x.toolOutput!==void 0);let g=m;i&&(g=c??m);let v=typeof l=="string"?o.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:l}):o.jsx(oa,{data:l,"data-testid":"tool-suspend-payload"});return o.jsxs(n8,{"data-testid":"agent-badge",icon:o.jsx(Xs,{className:"text-accent1"}),title:e,initialCollapsed:u&&!a,extraInfo:n?.mode==="network"&&o.jsx(gge,{selectionReason:d??"",input:f}),children:[t.map((x,w)=>{if(x.type==="text")return o.jsx(ytt,{children:x.content},w);let O;try{O=typeof x.toolOutput=="string"?JSON.parse(x.toolOutput):x.toolOutput}catch{O=x.toolOutput}return o.jsx(Ne.Fragment,{children:o.jsx(uxt,{toolName:x.toolName,argsText:typeof x.args=="string"?x.args:JSON.stringify(x.args),result:O,args:x.args,status:{type:"complete"},type:"tool-call",toolCallId:x.toolCallId,addResult:()=>{},resume:()=>{},metadata:{mode:"stream",requireApprovalMetadata:h,suspendedTools:p}})},w)}),v!==void 0&&l&&o.jsxs("div",{children:[o.jsx("p",{className:"font-medium pb-2",children:"Agent suspend payload"}),v]}),o.jsx(IR,{toolCalled:g,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,isGenerateMode:n?.mode==="generate"})]})};function jr({className:e,...t}){return o.jsx("div",{className:Y("rounded-md bg-surface4 relative overflow-hidden","before:absolute before:inset-0","before:-translate-x-full","before:animate-[shimmer_2s_infinite]","before:bg-linear-to-r before:from-transparent before:via-surface5/20 before:to-transparent",e),...t})}const vge=()=>o.jsx(n8,{icon:o.jsx(Pt,{color:G6.neutral3}),title:o.jsx(jr,{className:"ml-2 w-12 h-2"}),collapsible:!1}),oar=({agentId:e,result:t,metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:l,toolCalled:c,isComplete:u})=>{const{data:d,isLoading:f}=rbt({threadId:t?.subAgentThreadId,agentId:e,memory:!0});if(f)return o.jsx(vge,{});const h=d?.messages?NQe(d.messages):[];let p=t?.childMessages?.length?t.childMessages:void 0;if(!p&&t?.subAgentToolResults?.length){const m=t.subAgentToolResults.map(g=>({type:"tool",toolName:g.toolName,toolCallId:g.toolCallId,args:g.args,toolOutput:g.result}));t.text&&m.push({type:"text",content:t.text}),p=m}return p||(p=Ozt(h)),o.jsx(iar,{agentId:e,messages:p??[],metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:l,toolCalled:c,isComplete:u})},r8=({copiedDuration:e=1500}={})=>{const[t,n]=b.useState(!1);return{isCopied:t,copyToClipboard:a=>{a&&navigator.clipboard.writeText(a).then(()=>{n(!0),setTimeout(()=>n(!1),e)})}}},Abt=b.createContext({Link:b.forwardRef(()=>null),navigate:()=>{},paths:{agentLink:()=>"",agentsLink:()=>"",agentToolLink:()=>"",agentSkillLink:()=>"",agentThreadLink:()=>"",agentNewThreadLink:()=>"",workflowsLink:()=>"",workflowLink:()=>"",networkLink:()=>"",networkNewThreadLink:()=>"",networkThreadLink:()=>"",scorerLink:()=>"",cmsScorersCreateLink:()=>"",cmsScorerEditLink:()=>"",cmsAgentCreateLink:()=>"",cmsAgentEditLink:()=>"",promptBlockLink:()=>"",promptBlocksLink:()=>"",cmsPromptBlockCreateLink:()=>"",cmsPromptBlockEditLink:()=>"",toolLink:()=>"",skillLink:()=>"",workspacesLink:()=>"",workspaceLink:()=>"",workspaceSkillLink:()=>"",processorsLink:()=>"",processorLink:()=>"",mcpServerLink:()=>"",mcpServerToolLink:()=>"",workflowRunLink:()=>"",datasetLink:()=>"",datasetItemLink:()=>"",datasetExperimentLink:()=>"",experimentLink:()=>""}}),Ibt=({children:e,Link:t,navigate:n,paths:r})=>o.jsx(Abt.Provider,{value:{Link:t,navigate:n,paths:r},children:e}),rn=()=>{const e=b.useContext(Abt);if(!e)throw new Error("useLinkComponent must be used within a LinkComponentProvider");return e},lar=({toolName:e,args:t,result:n,toolCallId:r,toolApprovalMetadata:a,isNetwork:s,toolCalled:i})=>{const[l,c]=b.useState(!a),{isCopied:u,copyToClipboard:d}=r8();b.useEffect(()=>{c(!a)},[a]);const{Link:f}=rn();let h={path:"."};try{h=typeof t=="object"?t:JSON.parse(t)}catch{}const{path:p=".",maxDepth:m,showHidden:g,dirsOnly:v,exclude:x,extension:w}=h,O=[];m!==void 0&&m!==3&&O.push(`depth: ${m}`),g&&O.push("hidden"),v&&O.push("dirs only"),x&&O.push(`exclude: ${x}`),w&&O.push(`ext: ${w}`);let k="",_="";if(typeof n=="string"&&n){const M=n.lastIndexOf(`
|
|
462
462
|
|
|
463
463
|
`);M!==-1?(k=n.slice(0,M),_=n.slice(M+2)):k=n}const C=!!k,T=i??C,j=Xn(M=>M.message),I=b.useMemo(()=>j.content.find(F=>F.type==="data"&&F.name==="workspace-metadata"&&F.data?.toolCallId===r),[j.content,r])?.data,P=()=>{!k||u||d(k)};return o.jsxs("div",{className:"mb-4","data-testid":"file-tree-badge",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[o.jsxs("button",{onClick:()=>c(M=>!M),className:"flex items-center gap-2 min-w-0",type:"button",children:[o.jsx(_e,{children:o.jsx(bv,{className:Y("transition-all",l?"rotate-90":"rotate-180")})}),o.jsxs(wt,{icon:o.jsx(ZGt,{className:"text-accent6",size:16}),children:["List Files ",o.jsx("span",{className:"text-neutral6 font-normal ml-1",children:p}),O.length>0&&o.jsxs("span",{className:"text-neutral4 font-normal ml-1",children:["(",O.join(", "),")"]})]})]}),I?.filesystem&&o.jsxs(f,{href:I.id?`/workspaces/${I.id}?path=${encodeURIComponent(p)}`:"/workspaces",className:"flex items-center gap-1.5 text-xs text-neutral6 px-1.5 py-0.5 rounded bg-surface3 border border-border1 hover:bg-surface4 hover:border-border2 transition-colors",children:[o.jsx(Wte,{className:"size-3"}),o.jsx("span",{children:I.name||I.filesystem.name})]}),l&&C&&_&&o.jsx("span",{className:"text-neutral6 text-xs",children:_})]}),!l&&o.jsxs("div",{className:"pt-2",children:[a&&!T&&o.jsxs("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-medium pb-2",children:"Tool arguments"}),o.jsx(oa,{data:h,"data-testid":"tool-args"})]}),o.jsx(IR,{toolCalled:T,toolCallId:r,toolApprovalMetadata:a,toolName:e,isNetwork:s})]}),T&&k&&o.jsxs("div",{className:"rounded-md border border-border1 bg-surface2 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border1 bg-surface3",children:[_&&o.jsx("span",{className:"text-neutral6 text-xs",children:_}),o.jsx(Tr,{variant:"light",size:"sm",tooltip:"Copy tree",onClick:P,disabled:!k,children:o.jsxs("span",{className:"grid",children:[o.jsx("span",{style:{gridArea:"1/1"},className:Y("transition-transform",u?"scale-100":"scale-0"),children:o.jsx(ca,{size:14})}),o.jsx("span",{style:{gridArea:"1/1"},className:Y("transition-transform",u?"scale-0":"scale-100"),children:o.jsx(Kl,{size:14})})]})})]}),o.jsx("pre",{className:"p-3 text-xs font-mono text-mastra-el-6 overflow-x-auto whitespace-pre max-h-dropdown-max-height overflow-y-auto",children:k})]}),T&&!C&&o.jsx("div",{className:"rounded-md border border-border1 bg-surface2 px-3 py-2",children:o.jsx("span",{className:"text-xs text-neutral6",children:"Loading..."})})]})]})};function Hk({children:e}){const t=e.replace(/\\n/g,`
|
|
464
464
|
`);return o.jsx(ytt,{remarkPlugins:[git],components:uar,className:"space-y-3",children:t})}const Rbt=Ne.memo(({children:e,language:t,...n})=>{const[r,a]=b.useState([]);return b.useEffect(()=>{nar(e,t).then(s=>{s&&a(s)})},[e,t]),r.length?o.jsx("pre",{...n,children:o.jsx("code",{children:r.map((s,i)=>o.jsxs(o.Fragment,{children:[o.jsx("span",{children:s.map((l,c)=>{const u=typeof l.htmlStyle=="string"?void 0:l.htmlStyle;return o.jsx("span",{className:"text-shiki-light bg-shiki-light-bg dark:text-shiki-dark dark:bg-shiki-dark-bg",style:u,children:l.content},c)})},i),i!==r.length-1&&`
|
|
@@ -513,4 +513,4 @@ Please change the parent <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}
|
|
|
513
513
|
`),c=s;c<l.length;c++){var u=l[c];if(!(u.length>1024)){var d=_ze.test(u)?u.replace(_ze,"$1"):u;if(!d.match(/\S*Error: /)){for(var f of n){var h=f(d,e);if(h){i.push(h);break}}if(i.length>=Eze)break}}}return(function(p){if(!p.length)return[];var m=Array.from(p);return m.reverse(),m.slice(0,Eze).map((g=>{return Bt({},g,{filename:g.filename||(v=m,v[v.length-1]||{}).filename,function:g.function||e_});var v}))})(i)}})("web:javascript",r1r,i1r)}class l1r{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=lo(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:r?t.stack:void 0,cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var n=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?n+": "+t.message:n}isDOMException(t){return A3(t,"DOMException")}isDOMError(t){return A3(t,"DOMError")}}class c1r{match(t){return(n=>n instanceof Error)(t)}coerce(t,n){return{type:this.getType(t),value:this.getMessage(t,n),stack:this.getStack(t),cause:t.cause?n.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,n){var r=t.message;return r.error&&typeof r.error.message=="string"?String(r.error.message):String(r)}getStack(t){return t.stacktrace||t.stack||void 0}}class u1r{constructor(){}match(t){return A3(t,"ErrorEvent")&&t.error!=null}coerce(t,n){var r,a=n.apply(t.error);return a||{type:"ErrorEvent",value:t.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var d1r=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class f1r{match(t){return typeof t=="string"}coerce(t,n){var r,[a,s]=this.getInfos(t);return{type:a??"Error",value:s??t,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(t){var n="Error",r=t,a=t.match(d1r);return a&&(n=a[1],r=a[2]),[n,r]}}var h1r=["fatal","error","warning","log","info","debug"];function F1t(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var a=n.slice(0,r).join(", ");if(!(a.length>t))return r===n.length||a.length<=t?a:a.slice(0,t)+"..."}return""}class p1r{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var r,a=this.getErrorPropertyFromObject(t);return a?n.apply(a):{type:this.getType(t),value:this.getValue(t),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return xve(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){var n="'"+t.name+"' captured as exception";return"message"in t&&typeof t.message=="string"&&(n+=" with message: '"+t.message+"'"),n}if("message"in t&&typeof t.message=="string")return t.message;var r=this.getObjectClassName(t);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+F1t(t)}isSeverityLevel(t){return lo(t)&&!Gse(t)&&h1r.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(XSr(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class m1r{match(t){return xve(t)}coerce(t,n){var r,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+F1t(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class g1r{match(t){return w1t(t)}coerce(t,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class v1r{match(t){return A3(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!xve(t))return!1;try{var n=t.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(t,n){var r,a=this.getUnhandledRejectionReason(t);return w1t(a)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(a),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(a)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}}var z1t=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,r={k:function(a){if(rt&&(vf.DEBUG||Bn.POSTHOG_DEBUG||n)&&!Yt(rt.console)&&rt.console){for(var s=("__rrweb_original__"in rt.console[a])?rt.console[a].__rrweb_original__:rt.console[a],i=arguments.length,l=new Array(i>1?i-1:0),c=1;c<i;c++)l[c-1]=arguments[c];s(e,...l)}},info:function(){for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];r.k("log",...s)},warn:function(){for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];r.k("warn",...s)},error:function(){for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];r.k("error",...s)},critical:function(){for(var a=arguments.length,s=new Array(a),i=0;i<a;i++)s[i]=arguments[i];console.error(e,...s)},uninitializedWarning:a=>{r.error("You must initialize PostHog before calling "+a)},createLogger:(a,s)=>z1t(e+" "+a,s)};return r},Xt=z1t("[PostHog.js]"),vi=Xt.createLogger,y1r=vi("[ExternalScriptsLoader]"),Cze=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return y1r.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=Wt?.querySelectorAll("script");if(r){for(var a,s=function(){if(r[i].src===t){var c=r[i];return c.__posthog_loading_callback_fired?{v:n()}:(c.addEventListener("load",(u=>{c.__posthog_loading_callback_fired=!0,n(void 0,u)})),c.onerror=u=>n(u),{v:void 0})}},i=0;i<r.length;i++)if(a=s())return a.v}var l=()=>{if(!Wt)return n("document not found");var c=Wt.createElement("script");if(c.type="text/javascript",c.crossOrigin="anonymous",c.src=t,c.onload=f=>{c.__posthog_loading_callback_fired=!0,n(void 0,f)},c.onerror=f=>n(f),e.config.prepare_external_dependency_script&&(c=e.config.prepare_external_dependency_script(c)),!c)return n("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")Wt.head.appendChild(c);else{var u,d=Wt.querySelectorAll("body > script");d.length>0?(u=d[0].parentNode)==null||u.insertBefore(c,d[0]):Wt.body.appendChild(c)}};Wt!=null&&Wt.body?l():Wt?.addEventListener("DOMContentLoaded",l)};Bn.__PosthogExtensions__=Bn.__PosthogExtensions__||{},Bn.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r="/static/"+t+".js?v="+e.version;if(t==="remote-config"&&(r="/array/"+e.config.token+"/config.js"),t==="toolbar"){var a=3e5;r=r+"&t="+Math.floor(Date.now()/a)*a}var s=e.requestRouter.endpointFor("assets",r);Cze(e,s,n)},Bn.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);Cze(e,r,n)};var R3={};function db(e,t,n){if(Ra(e)){if(mze&&e.forEach===mze)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,a=e.length;r<a;r++)if(r in e&&t.call(n,e[r],r)===R3)return}}}function Rs(e,t,n){if(!sa(e)){if(Ra(e))return db(e,t,n);if(DSr(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===R3)return}else for(var a in e)if(x1t.call(e,a)&&t.call(n,e[a],a)===R3)return}}var Hi=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return db(n,(function(a){for(var s in a)a[s]!==void 0&&(e[s]=a[s])})),e},t_=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return db(n,(function(a){db(a,(function(s){e.push(s)}))})),e};function f$(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var jze=function(e){try{return e()}catch{return}},b1r=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(a){Xt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Xt.critical(a)}}},_ve=function(e){var t={};return Rs(e,(function(n,r){(lo(n)&&n.length>0||Tm(n))&&(t[r]=n)})),t};function x1r(e,t){return n=e,r=s=>lo(s)&&!dp(t)?s.slice(0,t):s,a=new Set,(function s(i,l){return i!==Object(i)?r?r(i,l):i:a.has(i)?void 0:(a.add(i),Ra(i)?(c=[],db(i,(u=>{c.push(s(u))}))):(c={},Rs(i,((u,d)=>{a.has(u)||(c[d]=s(u,d))}))),c);var c})(n);var n,r,a}var w1r=["herokuapp.com","vercel.app","netlify.app"];function S1r(e){var t=e?.hostname;if(!lo(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of w1r)if(n===r)return!1;return!0}function B1t(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function ro(e,t,n,r){var{capture:a=!1,passive:s=!0}=r??{};e?.addEventListener(t,n,{capture:a,passive:s})}function U1t(e){return e.name==="ph_toolbar_internal"}var q1t="$people_distinct_id",jj="__alias",Tj="__timers",Tze="$autocapture_disabled_server_side",Jse="$heatmaps_enabled_server_side",Nze="$exception_capture_enabled_server_side",eie="$error_tracking_suppression_rules",Aze="$error_tracking_capture_extension_exceptions",Ize="$web_vitals_enabled_server_side",V1t="$dead_clicks_enabled_server_side",Rze="$product_tours_enabled_server_side",Pze="$web_vitals_allowed_metrics",d2="$session_recording_remote_config",P3="$sesid",H1t="$session_is_sampled",rO="$enabled_feature_flags",Nj="$early_access_features",tie="$feature_flag_details",Aj="$stored_person_properties",t0="$stored_group_properties",nie="$surveys",pT="$flag_call_reported",rie="$flag_call_reported_session_id",aie="$feature_flag_errors",M3="$feature_flag_evaluated_at",Pp="$user_state",sie="$client_session_props",iie="$capture_rate_limit",oie="$initial_campaign_params",lie="$initial_referrer_info",D3="$initial_person_info",$3="$epp",Q1t="__POSTHOG_TOOLBAR__",QC="$posthog_cookieless",O1r=[q1t,jj,"__cmpns",Tj,"$session_recording_enabled_server_side",Jse,P3,rO,eie,Pp,Nj,tie,t0,Aj,nie,pT,rie,aie,M3,sie,iie,oie,lie,$3,D3];Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Tm(e)&&isFinite(e)&&Math.floor(e)===e});var Mze="0123456789abcdef";class L3{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(a)||t<0||n<0||r<0||a<0||t>0xffffffffffff||n>4095||r>1073741823||a>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|n>>>8,s[7]=n,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=a>>>24,s[13]=a>>>16,s[14]=a>>>8,s[15]=a,new L3(s)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+Mze.charAt(this.bytes[n]>>>4)+Mze.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new L3(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class k1r{constructor(){this.P=0,this.T=0,this.R=new _1r}generate(){var t=this.generateOrAbort();if(Yt(t)){this.P=0;var n=this.generateOrAbort();if(Yt(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.P)this.P=t,this.I();else{if(!(t+1e4>this.P))return;this.T++,this.T>4398046511103&&(this.P++,this.I())}return L3.fromFieldsV7(this.P,Math.trunc(this.T/Math.pow(2,30)),this.T&Math.pow(2,30)-1,this.R.nextUint32())}I(){this.T=1024*this.R.nextUint32()+(1023&this.R.nextUint32())}}var Dze,W1t=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};rt&&!Yt(rt.crypto)&&crypto.getRandomValues&&(W1t=e=>crypto.getRandomValues(e));class _1r{constructor(){this.C=new Uint32Array(8),this.O=1/0}nextUint32(){return this.O>=this.C.length&&(W1t(this.C),this.O=0),this.C[this.O++]}}var Yy=()=>E1r().toString(),E1r=()=>(Dze||(Dze=new k1r)).generate(),WC="",C1r=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function j1r(e,t){if(t){var n=(function(a,s){if(s===void 0&&(s=Wt),WC)return WC;if(!s||["localhost","127.0.0.1"].includes(a))return"";for(var i=a.split("."),l=Math.min(i.length,8),c="dmn_chk_"+Yy();!WC&&l--;){var u=i.slice(l).join("."),d=c+"=1;domain=."+u+";path=/";s.cookie=d+";max-age=3",s.cookie.includes(c)&&(s.cookie=d+";max-age=0",WC=u)}return WC})(e);if(!n){var r=(a=>{var s=a.match(C1r);return s?s[0]:""})(e);r!==n&&Xt.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Qp={F:()=>!!Wt,M:function(e){Xt.error("cookieStore error: "+e)},A:function(e){if(Wt){try{for(var t=e+"=",n=Wt.cookie.split(";").filter((s=>s.length)),r=0;r<n.length;r++){for(var a=n[r];a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}},D:function(e){var t;try{t=JSON.parse(Qp.A(e))||{}}catch{}return t},L:function(e,t,n,r,a){if(Wt)try{var s="",i="",l=j1r(Wt.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),s="; expires="+c.toUTCString()}a&&(i="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+l+i;return u.length>3686.4&&Xt.warn("cookieStore warning: large cookie, len="+u.length),Wt.cookie=u,u}catch{return}},j:function(e,t){if(Wt!=null&&Wt.cookie)try{Qp.L(e,"",-1,t)}catch{return}}},iee=null,di={F:function(){if(!dp(iee))return iee;var e=!0;if(Yt(rt))e=!1;else try{var t="__mplssupport__";di.L(t,"xyz"),di.A(t)!=='"xyz"'&&(e=!1),di.j(t)}catch{e=!1}return e||Xt.error("localStorage unsupported; falling back to cookie store"),iee=e,e},M:function(e){Xt.error("localStorage error: "+e)},A:function(e){try{return rt?.localStorage.getItem(e)}catch(t){di.M(t)}return null},D:function(e){try{return JSON.parse(di.A(e))||{}}catch{}return null},L:function(e,t){try{rt?.localStorage.setItem(e,JSON.stringify(t))}catch(n){di.M(n)}},j:function(e){try{rt?.localStorage.removeItem(e)}catch(t){di.M(t)}}},T1r=["$device_id","distinct_id",P3,H1t,$3,D3,Pp],f2={},N1r={F:function(){return!0},M:function(e){Xt.error("memoryStorage error: "+e)},A:function(e){return f2[e]||null},D:function(e){return f2[e]||null},L:function(e,t){f2[e]=t},j:function(e){delete f2[e]}},Vx=null,ml={F:function(){if(!dp(Vx))return Vx;if(Vx=!0,Yt(rt))Vx=!1;else try{var e="__support__";ml.L(e,"xyz"),ml.A(e)!=='"xyz"'&&(Vx=!1),ml.j(e)}catch{Vx=!1}return Vx},M:function(e){Xt.error("sessionStorage error: ",e)},A:function(e){try{return rt?.sessionStorage.getItem(e)}catch(t){ml.M(t)}return null},D:function(e){try{return JSON.parse(ml.A(e))||null}catch{}return null},L:function(e,t){try{rt?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){ml.M(n)}},j:function(e){try{rt?.sessionStorage.removeItem(e)}catch(t){ml.M(t)}}},jg=(function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e})({});class A1r{constructor(t){this._instance=t}get N(){return this._instance.config}get consent(){return this.U()?jg.DENIED:this.H}isOptedOut(){return this.N.cookieless_mode==="always"||this.consent===jg.DENIED||this.consent===jg.PENDING&&(this.N.opt_out_capturing_by_default||this.N.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===jg.DENIED}optInOut(t){this.B.L(this.q,t?1:0,this.N.cookie_expiration,this.N.cross_subdomain_cookie,this.N.secure_cookie)}reset(){this.B.j(this.q,this.N.cross_subdomain_cookie)}get q(){var{token:t,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+t:"__ph_opt_in_out_"+t)}get H(){var t=this.B.A(this.q);return ree(t)?jg.GRANTED:Zr(FSr,t)?jg.DENIED:jg.PENDING}get B(){if(!this.V){var t=this.N.opt_out_capturing_persistence_type;this.V=t==="localStorage"?di:Qp;var n=t==="localStorage"?Qp:di;n.A(this.q)&&(this.V.A(this.q)||this.optInOut(ree(n.A(this.q))),n.j(this.q,this.N.cross_subdomain_cookie))}return this.V}U(){return!!this.N.respect_dnt&&!!B1t([yd?.doNotTrack,yd?.msDoNotTrack,Bn.doNotTrack],(t=>ree(t)))}}var h2=vi("[Dead Clicks]"),I1r=()=>!0,R1r=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(V1t)),r=e.instance.config.capture_dead_clicks;return Xg(r)?r:!!No(r)||n};class $ze{get lazyLoadedDeadClicksAutocapture(){return this.W}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[V1t]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.G((()=>{this.Y()})):this.stop()}G(t){var n,r;(n=Bn.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&t(),(r=Bn.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?h2.error("failed to load script",a):t()}))}Y(){var t;if(Wt){if(!this.W&&(t=Bn.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=No(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.W=Bn.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.W.start(Wt),h2.info("starting...")}}else h2.error("`document` not found. Cannot start.")}stop(){this.W&&(this.W.stop(),this.W=void 0,h2.info("stopping..."))}}var oee=vi("[SegmentIntegration]");function P1r(e,t){var n=e.config.segment;if(!n)return t();(function(r,a){var s=r.config.segment;if(!s)return a();var i=c=>{var u=()=>c.anonymousId()||Yy();r.config.get_device_id=u,c.id()&&(r.register({distinct_id:c.id(),$device_id:u()}),r.persistence.set_property(Pp,"identified")),a()},l=s.user();"then"in l&&Bg(l.then)?l.then(i):i(l)})(e,(()=>{n.register((r=>{Promise&&Promise.resolve||oee.warn("This browser does not have Promise support, and can not use the segment integration");var a=(s,i)=>{if(!i)return s;s.event.userId||s.event.anonymousId===r.get_distinct_id()||(oee.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(oee.info("UserId set, identifying with PostHog"),r.identify(s.event.userId));var l=r.calculateEventProperties(i,s.event.properties);return s.event.properties=Object.assign({},l,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:s=>a(s,s.event.event),page:s=>a(s,"$pageview"),identify:s=>a(s,"$identify"),screen:s=>a(s,"$screen")}})(e)).then((()=>{t()}))}))}var G1t="posthog-js";function Z1t(e,t){var{organization:n,projectId:r,prefix:a,severityAllowList:s=["error"],sendExceptionsToPostHog:i=!0}=t===void 0?{}:t;return l=>{var c,u,d,f,h;if(!(s==="*"||s.includes(l.level))||!e.__loaded)return l;l.tags||(l.tags={});var p=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());l.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(l.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var m,g=((c=l.exception)==null?void 0:c.values)||[],v=g.map((w=>Bt({},w,{stacktrace:w.stacktrace?Bt({},w.stacktrace,{type:"raw",frames:(w.stacktrace.frames||[]).map((O=>Bt({},O,{platform:"web:javascript"})))}):void 0}))),x={$exception_message:((u=g[0])==null?void 0:u.value)||l.message,$exception_type:(d=g[0])==null?void 0:d.type,$exception_level:l.level,$exception_list:v,$sentry_event_id:l.event_id,$sentry_exception:l.exception,$sentry_exception_message:((f=g[0])==null?void 0:f.value)||l.message,$sentry_exception_type:(h=g[0])==null?void 0:h.type,$sentry_tags:l.tags};return n&&r&&(x.$sentry_url=(a||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+l.event_id),i&&((m=e.exceptions)==null||m.sendExceptionEvent(x)),l}}class M1r{constructor(t,n,r,a,s,i){this.name=G1t,this.setupOnce=function(l){l(Z1t(t,{organization:n,projectId:r,prefix:a,severityAllowList:s,sendExceptionsToPostHog:i==null||i}))}}}class Lze{constructor(t){this.J=(n,r,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength)&&(Xt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:a}),this.K=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.X()}X(){var t;this.Z=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.J)}destroy(){var t;(t=this.Z)==null||t.call(this),this.Z=void 0}doPageView(t,n){var r,a=this.tt(t,n);return this.K={pathname:(r=rt?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.tt(t,(n=this.K)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.K)==null?void 0:t.pageViewId}}tt(t,n){var r=this.K;if(!r)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:i,lastScrollY:l,maxScrollY:c,maxContentHeight:u,lastContentY:d,maxContentY:f}=s;if(!(Yt(i)||Yt(l)||Yt(c)||Yt(u)||Yt(d)||Yt(f))){i=Math.ceil(i),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d),f=Math.ceil(f);var h=i<=1?1:im(l/i,0,1,Xt),p=i<=1?1:im(c/i,0,1,Xt),m=u<=1?1:im(d/u,0,1,Xt),g=u<=1?1:im(f/u,0,1,Xt);a=Hi(a,{$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:m,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:g})}}return r.pathname&&(a.$prev_pageview_pathname=r.pathname),r.timestamp&&(a.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),a}}var F3=e=>{var t=Wt?.createElement("a");return Yt(t)?null:(t.href=e,t)},D1r=function(e,t){var n,r;t===void 0&&(t="&");var a=[];return Rs(e,(function(s,i){Yt(s)||Yt(i)||i==="undefined"||(n=encodeURIComponent((l=>l instanceof File)(s)?s.name:s.toString()),r=encodeURIComponent(i),a[a.length]=r+"="+n)})),a.join(t)},z3=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;a<r.length;a++){var s=r[a].split("=");if(s[0]===t){n=s;break}}if(!Ra(n)||n.length<2)return"";var i=n[1];try{i=decodeURIComponent(i)}catch{Xt.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},RA=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),a=r[0]||"",s=r[1],i=a.split("?"),l=i[1],c=i[0],u=(l||"").split("&"),d=[],f=0;f<u.length;f++){var h=u[f].split("=");Ra(h)&&(t.includes(h[0])?d.push(h[0]+"="+n):d.push(u[f]))}var p=c;return l!=null&&(p+="?"+d.join("&")),s!=null&&(p+="#"+s),p},B3=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},p2="https?://(.*)",n_=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],$1r=t_(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],n_),PA="<masked>",L1r=["li_fat_id"];function Y1t(e,t,n){if(!Wt)return{};var r,a=t?t_([],n_,n||[]):[],s=X1t(RA(Wt.URL,a,PA),e),i=(r={},Rs(L1r,(function(l){var c=Qp.A(l);r[l]=c||null})),r);return Hi(i,s)}function X1t(e,t){var n=$1r.concat(t||[]),r={};return Rs(n,(function(a){var s=z3(e,a);r[a]=s||null})),r}function K1t(e){var t=(function(s){return s?s.search(p2+"google.([^/?]*)")===0?"google":s.search(p2+"bing.com")===0?"bing":s.search(p2+"yahoo.com")===0?"yahoo":s.search(p2+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!dp(t)){r.$search_engine=t;var a=Wt?z3(Wt.referrer,n):"";a.length&&(r.ph_keyword=a)}return r}function Fze(){return navigator.language||navigator.userLanguage}function J1t(){return Wt?.referrer||"$direct"}function eOt(e,t){var n=e?t_([],n_,t||[]):[],r=vl?.href.substring(0,1e3);return{r:J1t().substring(0,1e3),u:r?RA(r,n,PA):void 0}}function tOt(e){var t,{r:n,u:r}=e,a={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=F3(n))==null?void 0:t.host};if(r){a.$current_url=r;var s=F3(r);a.$host=s?.host,a.$pathname=s?.pathname;var i=X1t(r);Hi(a,i)}if(n){var l=K1t(n);Hi(a,l)}return a}function nOt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function F1r(){try{return new Date().getTimezoneOffset()}catch{return}}function z1r(e,t){var n,r,a,s;if(!Kc)return{};var i,l,c,u,d,f,h,p,m=e?t_([],n_,t||[]):[],[g,v]=(function(x){for(var w=0;w<Oze.length;w++){var[O,k]=Oze[w],_=O.exec(x),C=_&&(Bg(k)?k(_,x):k);if(C)return C}return["",""]})(Kc);return Hi(_ve({$os:g,$os_version:v,$browser:$1t(Kc,navigator.vendor),$device:kze(Kc),$device_type:(l=Kc,c={userAgentDataPlatform:(n=navigator)==null||(n=n.userAgentData)==null?void 0:n.platform,maxTouchPoints:(r=navigator)==null?void 0:r.maxTouchPoints,screenWidth:rt==null||(a=rt.screen)==null?void 0:a.width,screenHeight:rt==null||(s=rt.screen)==null?void 0:s.height,devicePixelRatio:rt?.devicePixelRatio},p=kze(l),p===O1t||p===S1t||p==="Kobo"||p==="Kindle Fire"||p===D1t?Kk:p===AA||p===DO||p===IA||p===Yse?"Console":p===_1t?"Wearable":p?jd:c?.userAgentDataPlatform==="Android"&&((u=c?.maxTouchPoints)!==null&&u!==void 0?u:0)>0?Math.min((d=c?.screenWidth)!==null&&d!==void 0?d:0,(f=c?.screenHeight)!==null&&f!==void 0?f:0)/((h=c?.devicePixelRatio)!==null&&h!==void 0?h:1)>=600?Kk:jd:"Desktop"),$timezone:nOt(),$timezone_offset:F1r()}),{$current_url:RA(vl?.href,m,PA),$host:vl?.host,$pathname:vl?.pathname,$raw_user_agent:Kc.length>1e3?Kc.substring(0,997)+"...":Kc,$browser_version:YSr(Kc,navigator.vendor),$browser_language:Fze(),$browser_language_prefix:(i=Fze(),typeof i=="string"?i.split("-")[0]:void 0),$screen_height:rt?.screen.height,$screen_width:rt?.screen.width,$viewport_height:rt?.innerHeight,$viewport_width:rt?.innerWidth,$lib:vf.LIB_NAME,$lib_version:vf.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var B1r=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class lee{constructor(t,n){this.N=t,this.props={},this.it=!1,this.et=(r=>{var a="";return r.token&&(a=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+a+"_posthog"})(t),this.B=this.rt(t),this.load(),t.debug&&Xt.info("Persistence loaded",t.persistence,Bt({},this.props)),this.update_config(t,t,n),this.save()}isDisabled(){return!!this.st}rt(t){B1r.indexOf(t.persistence.toLowerCase())===-1&&(Xt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=(function(a){a===void 0&&(a=[]);var s=[...T1r,...a];return Bt({},di,{D:function(i){try{var l={};try{l=Qp.D(i)||{}}catch{}var c=Hi(l,JSON.parse(di.A(i)||"{}"));return di.L(i,c),c}catch{}return null},L:function(i,l,c,u,d,f){try{di.L(i,l,void 0,void 0,f);var h={};s.forEach((p=>{l[p]&&(h[p]=l[p])})),Object.keys(h).length&&Qp.L(i,h,c,u,d,f)}catch(p){di.M(p)}},j:function(i,l){try{rt?.localStorage.removeItem(i),Qp.j(i,l)}catch(c){di.M(c)}}})})(t.cookie_persisted_properties||[]),r=t.persistence.toLowerCase();return r==="localstorage"&&di.F()?di:r==="localstorage+cookie"&&n.F()?n:r==="sessionstorage"&&ml.F()?ml:r==="memory"?N1r:r==="cookie"?Qp:n.F()?n:Qp}nt(t){var n=t??this.N.feature_flag_cache_ttl_ms;if(!n||n<=0)return!1;var r=this.props[M3];return!r||typeof r!="number"||Date.now()-r>n}properties(){var t={};return Rs(this.props,((n,r)=>{if(r===rO&&No(n)){if(!this.nt())for(var a=Object.keys(n),s=0;s<a.length;s++)t["$feature/"+a[s]]=n[a[s]]}else l=r,c=!1,(dp(i=O1r)?c:gze&&i.indexOf===gze?i.indexOf(l)!=-1:(Rs(i,(function(u){if(c||(c=u===l))return R3})),c))||(t[r]=n);var i,l,c})),t}load(){if(!this.st){var t=this.B.D(this.et);t&&(this.props=Hi({},t))}}save(){this.st||this.B.L(this.et,this.props,this.ot,this.ut,this.ht,this.N.debug)}remove(){this.B.j(this.et,!1),this.B.j(this.et,!0)}clear(){this.remove(),this.props={}}register_once(t,n,r){if(No(t)){Yt(n)&&(n="None"),this.ot=Yt(r)?this.dt:r;var a=!1;if(Rs(t,((s,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==n||(this.props[i]=s,a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(No(t)){this.ot=Yt(n)?this.dt:n;var r=!1;if(Rs(t,((a,s)=>{t.hasOwnProperty(s)&&this.props[s]!==a&&(this.props[s]=a,r=!0)})),r)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.it){var t=Y1t(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);nO(_ve(t))||this.register(t),this.it=!0}}update_search_keyword(){var t;this.register((t=Wt?.referrer)?K1t(t):{})}update_referrer_info(){var t;this.register_once({$referrer:J1t(),$referring_domain:Wt!=null&&Wt.referrer&&((t=F3(Wt.referrer))==null?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[oie]||this.props[lie]||this.register_once({[D3]:eOt(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Rs([lie,oie],(i=>{var l=this.props[i];l&&Rs(l,(function(c,u){t["$initial_"+Wse(u)]=c}))}));var n,r,a=this.props[D3];if(a){var s=(n=tOt(a),r={},Rs(n,(function(i,l){r["$initial_"+Wse(l)]=i})),r);Hi(t,s)}return t}safe_merge(t){return Rs(this.props,(function(n,r){r in t||(t[r]=n)})),t}update_config(t,n,r){if(this.dt=this.ot=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!r),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==n.persistence||!((i,l)=>{if(i.length!==l.length)return!1;var c=[...i].sort(),u=[...l].sort();return c.every(((d,f)=>d===u[f]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[])){var a=this.rt(t),s=this.props;this.clear(),this.B=a,this.props=s,this.save()}}set_disabled(t){this.st=t,this.st?this.remove():this.save()}set_cross_subdomain(t){t!==this.ut&&(this.ut=t,this.remove(),this.save())}set_secure(t){t!==this.ht&&(this.ht=t,this.remove(),this.save())}set_event_timer(t,n){var r=this.props[Tj]||{};r[t]=n,this.props[Tj]=r,this.save()}remove_event_timer(t){var n=(this.props[Tj]||{})[t];return Yt(n)||(delete this.props[Tj][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var GC={Activation:"events",Cancellation:"cancelEvents"},cee={Popover:"popover",API:"api",Widget:"widget"},Ij={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},uee={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},cie={Popover:"popover",Inline:"inline"},U1r=(function(e){return e.SHOWN="product tour shown",e.DISMISSED="product tour dismissed",e.COMPLETED="product tour completed",e.STEP_SHOWN="product tour step shown",e.STEP_COMPLETED="product tour step completed",e.BUTTON_CLICKED="product tour button clicked",e.STEP_SELECTOR_FAILED="product tour step selector failed",e.BANNER_CONTAINER_SELECTOR_FAILED="product tour banner container selector failed",e.BANNER_ACTION_CLICKED="product tour banner action clicked",e})({}),zze=(function(e){return e.TOUR_ID="$product_tour_id",e.TOUR_NAME="$product_tour_name",e.TOUR_ITERATION="$product_tour_iteration",e.TOUR_RENDER_REASON="$product_tour_render_reason",e.TOUR_STEP_ID="$product_tour_step_id",e.TOUR_STEP_ORDER="$product_tour_step_order",e.TOUR_STEP_TYPE="$product_tour_step_type",e.TOUR_DISMISS_REASON="$product_tour_dismiss_reason",e.TOUR_BUTTON_TEXT="$product_tour_button_text",e.TOUR_BUTTON_ACTION="$product_tour_button_action",e.TOUR_BUTTON_LINK="$product_tour_button_link",e.TOUR_BUTTON_TOUR_ID="$product_tour_button_tour_id",e.TOUR_STEPS_COUNT="$product_tour_steps_count",e.TOUR_STEP_SELECTOR="$product_tour_step_selector",e.TOUR_STEP_SELECTOR_FOUND="$product_tour_step_selector_found",e.TOUR_STEP_ELEMENT_TAG="$product_tour_step_element_tag",e.TOUR_STEP_ELEMENT_ID="$product_tour_step_element_id",e.TOUR_STEP_ELEMENT_CLASSES="$product_tour_step_element_classes",e.TOUR_STEP_ELEMENT_TEXT="$product_tour_step_element_text",e.TOUR_ERROR="$product_tour_error",e.TOUR_MATCHES_COUNT="$product_tour_matches_count",e.TOUR_FAILURE_PHASE="$product_tour_failure_phase",e.TOUR_WAITED_FOR_ELEMENT="$product_tour_waited_for_element",e.TOUR_WAIT_DURATION_MS="$product_tour_wait_duration_ms",e.TOUR_BANNER_SELECTOR="$product_tour_banner_selector",e.TOUR_LINKED_SURVEY_ID="$product_tour_linked_survey_id",e.USE_MANUAL_SELECTOR="$use_manual_selector",e.INFERENCE_DATA_PRESENT="$inference_data_present",e.TOUR_LAST_SEEN_DATE="$product_tour_last_seen_date",e.TOUR_TYPE="$product_tour_type",e})({}),Bze=vi("[RateLimiter]");class q1r{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((a=>{Bze.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void Bze.warn('could not rate limit - continuing. Error: "'+a?.message+'"',{text:r})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return((t=this.instance.config.rate_limiting)==null?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max(((t=this.instance.config.rate_limiting)==null?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var n,r,a;t===void 0&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:i}=this,l=new Date().getTime(),c=(n=(r=this.instance.persistence)==null?void 0:r.get_property(iie))!==null&&n!==void 0?n:{tokens:s,last:l};c.tokens+=(l-c.last)/1e3*i,c.last=l,c.tokens>s&&(c.tokens=s);var u=c.tokens<1;return u||t||(c.tokens=Math.max(0,c.tokens-1)),!u||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+i+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,(a=this.instance.persistence)==null||a.set_property(iie,c),{isRateLimited:u,remainingTokens:c.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var ZC=vi("[RemoteConfig]");class rOt{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Bn._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}vt(t){var n,r;(n=Bn.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Bn.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}ct(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:n=>{t(n.json)}})}load(){try{if(this.remoteConfig)return ZC.info("Using preloaded remote config",this.remoteConfig),this.ft(this.remoteConfig),void this._t();if(this._instance.bt())return void ZC.warn("Remote config is disabled. Falling back to local config.");this.vt((t=>{if(!t)return ZC.info("No config found after loading remote JS config. Falling back to JSON."),void this.ct((n=>{this.ft(n),this._t()}));this.ft(t),this._t()}))}catch(t){ZC.error("Error loading remote config",t)}}stop(){this.yt&&(clearInterval(this.yt),this.yt=void 0)}refresh(){this._instance.bt()||Wt?.visibilityState==="hidden"||this._instance.reloadFeatureFlags()}_t(){var t;if(!this.yt){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.yt=setInterval((()=>{this.refresh()}),n))}}ft(t){var n;t||ZC.error("Failed to fetch remote config from PostHog."),this._instance.ft(t??{}),t?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var Mg=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),Bf=Uint8Array,gu=Uint16Array,r_=Uint32Array,Eve=new Bf([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Cve=new Bf([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Uze=new Bf([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),aOt=function(e,t){for(var n=new gu(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var a=new r_(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)a[s]=s-n[r]<<5|r;return[n,a]},sOt=aOt(Eve,2),V1r=sOt[0],uie=sOt[1];V1r[28]=258,uie[258]=28;for(var qze=aOt(Cve,0)[1],iOt=new gu(32768),Ws=0;Ws<32768;++Ws){var Hx=(43690&Ws)>>>1|(21845&Ws)<<1;Hx=(61680&(Hx=(52428&Hx)>>>2|(13107&Hx)<<2))>>>4|(3855&Hx)<<4,iOt[Ws]=((65280&Hx)>>>8|(255&Hx)<<8)>>>1}var mT=function(e,t,n){for(var r=e.length,a=0,s=new gu(t);a<r;++a)++s[e[a]-1];var i,l=new gu(t);for(a=0;a<t;++a)l[a]=l[a-1]+s[a-1]<<1;for(i=new gu(r),a=0;a<r;++a)i[a]=iOt[l[e[a]-1]++]>>>15-e[a];return i},Aw=new Bf(288);for(Ws=0;Ws<144;++Ws)Aw[Ws]=8;for(Ws=144;Ws<256;++Ws)Aw[Ws]=9;for(Ws=256;Ws<280;++Ws)Aw[Ws]=7;for(Ws=280;Ws<288;++Ws)Aw[Ws]=8;var U3=new Bf(32);for(Ws=0;Ws<32;++Ws)U3[Ws]=5;var H1r=mT(Aw,9),Q1r=mT(U3,5),oOt=function(e){return(e/8>>0)+(7&e&&1)},lOt=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof gu?gu:e instanceof r_?r_:Bf)(n-t);return r.set(e.subarray(t,n)),r},wg=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},YC=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},dee=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var a=n.length,s=n.slice();if(!a)return[new Bf(0),0];if(a==1){var i=new Bf(n[0].s+1);return i[n[0].s]=1,[i,1]}n.sort((function(_,C){return _.f-C.f})),n.push({s:-1,f:25001});var l=n[0],c=n[1],u=0,d=1,f=2;for(n[0]={s:-1,f:l.f+c.f,l,r:c};d!=a-1;)l=n[n[u].f<n[f].f?u++:f++],c=n[u!=d&&n[u].f<n[f].f?u++:f++],n[d++]={s:-1,f:l.f+c.f,l,r:c};var h=s[0].s;for(r=1;r<a;++r)s[r].s>h&&(h=s[r].s);var p=new gu(h+1),m=die(n[d-1],p,0);if(m>t){r=0;var g=0,v=m-t,x=1<<v;for(s.sort((function(_,C){return p[C.s]-p[_.s]||_.f-C.f}));r<a;++r){var w=s[r].s;if(!(p[w]>t))break;g+=x-(1<<m-p[w]),p[w]=t}for(g>>>=v;g>0;){var O=s[r].s;p[O]<t?g-=1<<t-p[O]++-1:++r}for(;r>=0&&g;--r){var k=s[r].s;p[k]==t&&(--p[k],++g)}m=t}return[new Bf(p),m]},die=function(e,t,n){return e.s==-1?Math.max(die(e.l,t,n+1),die(e.r,t,n+1)):t[e.s]=n},Vze=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new gu(++t),r=0,a=e[0],s=1,i=function(c){n[r++]=c},l=1;l<=t;++l)if(e[l]==a&&l!=t)++s;else{if(!a&&s>2){for(;s>138;s-=138)i(32754);s>2&&(i(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(i(a),--s;s>6;s-=6)i(8304);s>2&&(i(s-3<<5|8208),s=0)}for(;s--;)i(a);s=1,a=e[l]}return[n.subarray(0,r),t]},XC=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},fie=function(e,t,n){var r=n.length,a=oOt(t+2);e[a]=255&r,e[a+1]=r>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var s=0;s<r;++s)e[a+s+4]=n[s];return 8*(a+4+r)},Hze=function(e,t,n,r,a,s,i,l,c,u,d){wg(t,d++,n),++a[256];for(var f=dee(a,15),h=f[0],p=f[1],m=dee(s,15),g=m[0],v=m[1],x=Vze(h),w=x[0],O=x[1],k=Vze(g),_=k[0],C=k[1],T=new gu(19),j=0;j<w.length;++j)T[31&w[j]]++;for(j=0;j<_.length;++j)T[31&_[j]]++;for(var A=dee(T,7),I=A[0],P=A[1],M=19;M>4&&!I[Uze[M-1]];--M);var F,D,U,B,z=u+5<<3,Q=XC(a,Aw)+XC(s,U3)+i,W=XC(a,h)+XC(s,g)+i+14+3*M+XC(T,I)+(2*T[16]+3*T[17]+7*T[18]);if(z<=Q&&z<=W)return fie(t,d,e.subarray(c,c+u));if(wg(t,d,1+(W<Q)),d+=2,W<Q){F=mT(h,p),D=h,U=mT(g,v),B=g;var $=mT(I,P);for(wg(t,d,O-257),wg(t,d+5,C-1),wg(t,d+10,M-4),d+=14,j=0;j<M;++j)wg(t,d+3*j,I[Uze[j]]);d+=3*M;for(var Z=[w,_],V=0;V<2;++V){var R=Z[V];for(j=0;j<R.length;++j){var H=31&R[j];wg(t,d,$[H]),d+=I[H],H>15&&(wg(t,d,R[j]>>>5&127),d+=R[j]>>>12)}}}else F=H1r,D=Aw,U=Q1r,B=U3;for(j=0;j<l;++j)if(r[j]>255){H=r[j]>>>18&31,YC(t,d,F[H+257]),d+=D[H+257],H>7&&(wg(t,d,r[j]>>>23&31),d+=Eve[H]);var G=31&r[j];YC(t,d,U[G]),d+=B[G],G>3&&(YC(t,d,r[j]>>>5&8191),d+=Cve[G])}else YC(t,d,F[r[j]]),d+=D[r[j]];return YC(t,d,F[256]),d+D[256]},W1r=new r_([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),G1r=(function(){for(var e=new r_(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Z1r=function(e,t,n,r,a){return(function(s,i,l,c,u,d){var f=s.length,h=new Bf(c+f+5*(1+Math.floor(f/7e3))+u),p=h.subarray(c,h.length-u),m=0;if(!i||f<8)for(var g=0;g<=f;g+=65535){var v=g+65535;v<f?m=fie(p,m,s.subarray(g,v)):(p[g]=d,m=fie(p,m,s.subarray(g,f)))}else{for(var x=W1r[i-1],w=x>>>13,O=8191&x,k=(1<<l)-1,_=new gu(32768),C=new gu(k+1),T=Math.ceil(l/3),j=2*T,A=function(ue){return(s[ue]^s[ue+1]<<T^s[ue+2]<<j)&k},I=new r_(25e3),P=new gu(288),M=new gu(32),F=0,D=0,U=(g=0,0),B=0,z=0;g<f;++g){var Q=A(g),W=32767&g,$=C[Q];if(_[W]=$,C[Q]=W,B<=g){var Z=f-g;if((F>7e3||U>24576)&&Z>423){m=Hze(s,p,0,I,P,M,D,U,z,g-z,m),U=F=D=0,z=g;for(var V=0;V<286;++V)P[V]=0;for(V=0;V<30;++V)M[V]=0}var R=2,H=0,G=O,J=W-$&32767;if(Z>2&&Q==A(g-J))for(var ie=Math.min(w,Z)-1,ne=Math.min(32767,g),ae=Math.min(258,Z);J<=ne&&--G&&W!=$;){if(s[g+R]==s[g+R-J]){for(var le=0;le<ae&&s[g+le]==s[g+le-J];++le);if(le>R){if(R=le,H=J,le>ie)break;var fe=Math.min(J,le-2),X=0;for(V=0;V<fe;++V){var re=g-J+V+32768&32767,oe=re-_[re]+32768&32767;oe>X&&(X=oe,$=re)}}}J+=(W=$)-($=_[W])+32768&32767}if(H){I[U++]=268435456|uie[R]<<18|qze[H];var ge=31&uie[R],ce=31&qze[H];D+=Eve[ge]+Cve[ce],++P[257+ge],++M[ce],B=g+R,++F}else I[U++]=s[g],++P[s[g]]}}m=Hze(s,p,d,I,P,M,D,U,z,g-z,m)}return lOt(h,0,c+oOt(m)+u)})(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!0)},fee=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Y1r(e,t){t===void 0&&(t={});var n=(function(){var l=4294967295;return{p:function(c){for(var u=l,d=0;d<c.length;++d)u=G1r[255&u^c[d]]^u>>>8;l=u},d:function(){return 4294967295^l}}})(),r=e.length;n.p(e);var a,s=Z1r(e,t,10+((a=t).filename&&a.filename.length+1||0),8),i=s.length;return(function(l,c){var u=c.filename;if(l[0]=31,l[1]=139,l[2]=8,l[8]=c.level<2?4:c.level==9?2:0,l[9]=3,c.mtime!=0&&fee(l,4,Math.floor(new Date(c.mtime||Date.now())/1e3)),u){l[3]=8;for(var d=0;d<=u.length;++d)l[d+10]=u.charCodeAt(d)}})(s,t),fee(s,i-8,n.d()),fee(s,i-4,r),s}var X1r=function(e){var t,n,r,a,s="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,`
|
|
514
514
|
`).replace(/\r/g,`
|
|
515
515
|
`)).length,a=0;a<r;a++){var i=e.charCodeAt(a),l=null;i<128?n++:l=i>127&&i<2048?String.fromCharCode(i>>6|192,63&i|128):String.fromCharCode(i>>12|224,i>>6&63|128,63&i|128),dp(l)||(n>t&&(s+=e.substring(t,n)),s+=l,t=n=a+1)}return n>t&&(s+=e.substring(t,e.length)),s},K1r=!!Qse||!!Hse,q3=function(e,t,n){var r;n===void 0&&(n=!0);var[a,s]=e.split("?"),i=Bt({},t),l=(r=s?.split("&").map((u=>{var d,[f,h]=u.split("="),p=n&&(d=i[f])!==null&&d!==void 0?d:h;return delete i[f],f+"="+p})))!==null&&r!==void 0?r:[],c=D1r(i);return c&&l.push(c),a+"?"+l.join("&")},Rj=(e,t)=>JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t),hee=e=>{var{data:t,compression:n}=e;if(t){if(n===Mg.GZipJS){var r=Y1r((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var d=new Bf(l.length+(l.length>>>1)),f=0,h=function(v){d[f++]=v},p=0;p<u;++p){if(f+5>d.length){var m=new Bf(f+8+(u-p<<1));m.set(d),d=m}var g=l.charCodeAt(p);g<128||c?h(g):g<2048?(h(192|g>>>6),h(128|63&g)):g>55295&&g<57344?(h(240|(g=65536+(1047552&g)|1023&l.charCodeAt(++p))>>>18),h(128|g>>>12&63),h(128|g>>>6&63),h(128|63&g)):(h(224|g>>>12),h(128|g>>>6&63),h(128|63&g))}return lOt(d,0,f)})(Rj(t)),{mtime:0});return{contentType:"text/plain",body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Mg.Base64){var a=(function(l){var c,u,d,f,h,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,g=0,v="",x=[];if(!l)return l;l=X1r(l);do c=(h=l.charCodeAt(m++)<<16|l.charCodeAt(m++)<<8|l.charCodeAt(m++))>>18&63,u=h>>12&63,d=h>>6&63,f=63&h,x[g++]=p.charAt(c)+p.charAt(u)+p.charAt(d)+p.charAt(f);while(m<l.length);switch(v=x.join(""),l.length%3){case 1:v=v.slice(0,-2)+"==";break;case 2:v=v.slice(0,-1)+"="}return v})(Rj(t)),s=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Rj(l)))(a);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var i=Rj(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}}},h$=[];Hse&&h$.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:a,estimatedSize:s}=(t=hee(e))!==null&&t!==void 0?t:{},i=new Headers;Rs(e.headers,(function(d,f){i.append(f,d)})),r&&i.append("Content-Type",r);var l=e.url,c=null;if(vze){var u=new vze;c={signal:u.signal,timeout:setTimeout((()=>u.abort()),e.timeout)}}Hse(l,Bt({method:e?.method||"GET",headers:i,keepalive:e.method==="POST"&&(s||0)<52428.8,body:a,signal:(n=c)==null?void 0:n.signal},e.fetchOptions)).then((d=>d.text().then((f=>{var h={statusCode:d.status,text:f};if(d.status===200)try{h.json=JSON.parse(f)}catch(p){Xt.error(p)}e.callback==null||e.callback(h)})))).catch((d=>{Xt.error(d),e.callback==null||e.callback({statusCode:0,error:d})})).finally((()=>c?clearTimeout(c.timeout):null))}}),Qse&&h$.push({transport:"XHR",method:e=>{var t,n=new Qse;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:a}=(t=hee(e))!==null&&t!==void 0?t:{};Rs(e.headers,(function(s,i){n.setRequestHeader(i,s)})),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),e.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(s)}},n.send(a)}}),yd!=null&&yd.sendBeacon&&h$.push({transport:"sendBeacon",method:e=>{var t=q3(e.url,{beacon:"1"});try{var n,{contentType:r,body:a}=(n=hee(e))!==null&&n!==void 0?n:{},s=typeof a=="string"?new Blob([a],{type:r}):a;yd.sendBeacon(t,s)}catch{}}});var hie=3e3;class J1r{constructor(t,n){this.wt=!0,this.Et=[],this.St=im(n?.flush_interval_ms||hie,250,5e3,Xt.createLogger("flush interval"),hie),this.xt=t}enqueue(t){this.Et.push(t),this.$t||this.kt()}unload(){this.Pt();var t=this.Et.length>0?this.Tt():{},n=Object.values(t);[...n.filter((r=>r.url.indexOf("/e")===0)),...n.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.xt(Bt({},r,{transport:"sendBeacon"}))}))}enable(){this.wt=!1,this.kt()}kt(){var t=this;this.wt||(this.$t=setTimeout((()=>{if(this.Pt(),this.Et.length>0){var n=this.Tt(),r=function(){var s=n[a],i=new Date().getTime();s.data&&Ra(s.data)&&Rs(s.data,(l=>{l.offset=Math.abs(l.timestamp-i),delete l.timestamp})),t.xt(s)};for(var a in n)r()}}),this.St))}Pt(){clearTimeout(this.$t),this.$t=void 0}Tt(){var t={};return Rs(this.Et,(n=>{var r,a=n,s=(a?a.batchKey:null)||a.url;Yt(t[s])&&(t[s]=Bt({},a,{data:[]})),(r=t[s].data)==null||r.push(a.data)})),this.Et=[],t}}var eOr=["retriesPerformedSoFar"];class tOr{constructor(t){this.Rt=!1,this.It=3e3,this.Et=[],this._instance=t,this.Et=[],this.Ct=!0,!Yt(rt)&&"onLine"in rt.navigator&&(this.Ct=rt.navigator.onLine,this.Ot=()=>{this.Ct=!0,this.Ft()},this.Mt=()=>{this.Ct=!1},ro(rt,"online",this.Ot),ro(rt,"offline",this.Mt))}get length(){return this.Et.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,r=y1t(t,eOr);P1(n)&&(r.url=q3(r.url,{retry_count:n})),this._instance._send_request(Bt({},r,{callback:a=>{a.statusCode!==200&&(a.statusCode<400||a.statusCode>=500)&&(n??0)<10?this.At(Bt({retriesPerformedSoFar:n},r)):r.callback==null||r.callback(a)}}))}At(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=(function(i){var l=3e3*Math.pow(2,i),c=l/2,u=Math.min(18e5,l),d=(Math.random()-.5)*(u-c);return Math.ceil(u+d)})(n),a=Date.now()+r;this.Et.push({retryAt:a,requestOptions:t});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),Xt.warn(s),this.Rt||(this.Rt=!0,this.Dt())}Dt(){if(this.Lt&&clearTimeout(this.Lt),this.Et.length===0)return this.Rt=!1,void(this.Lt=void 0);this.Lt=setTimeout((()=>{this.Ct&&this.Et.length>0&&this.Ft(),this.Dt()}),this.It)}Ft(){var t=Date.now(),n=[],r=this.Et.filter((s=>s.retryAt<t||(n.push(s),!1)));if(this.Et=n,r.length>0)for(var{requestOptions:a}of r)this.retriableRequest(a)}unload(){for(var{requestOptions:t}of(this.Lt&&(clearTimeout(this.Lt),this.Lt=void 0),this.Rt=!1,Yt(rt)||(this.Ot&&(rt.removeEventListener("online",this.Ot),this.Ot=void 0),this.Mt&&(rt.removeEventListener("offline",this.Mt),this.Mt=void 0)),this.Et))try{this._instance._send_request(Bt({},t,{transport:"sendBeacon"}))}catch(n){Xt.error(n)}this.Et=[]}}class nOr{constructor(t){this.jt=()=>{var n,r,a,s;this.Nt||(this.Nt={});var i=this.scrollElement(),l=this.scrollY(),c=i?Math.max(0,i.scrollHeight-i.clientHeight):0,u=l+(i?.clientHeight||0),d=i?.scrollHeight||0;this.Nt.lastScrollY=Math.ceil(l),this.Nt.maxScrollY=Math.max(l,(n=this.Nt.maxScrollY)!==null&&n!==void 0?n:0),this.Nt.maxScrollHeight=Math.max(c,(r=this.Nt.maxScrollHeight)!==null&&r!==void 0?r:0),this.Nt.lastContentY=u,this.Nt.maxContentY=Math.max(u,(a=this.Nt.maxContentY)!==null&&a!==void 0?a:0),this.Nt.maxContentHeight=Math.max(d,(s=this.Nt.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=t}getContext(){return this.Nt}resetContext(){var t=this.Nt;return setTimeout(this.jt,0),t}startMeasuringScrollPosition(){ro(rt,"scroll",this.jt,{capture:!0}),ro(rt,"scrollend",this.jt,{capture:!0}),ro(rt,"resize",this.jt)}scrollElement(){if(!this._instance.config.scroll_root_selector)return rt?.document.documentElement;var t=Ra(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var n of t){var r=rt?.document.querySelector(n);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return rt&&(rt.scrollY||rt.pageYOffset||rt.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return rt&&(rt.scrollX||rt.pageXOffset||rt.document.documentElement.scrollLeft)||0}}var rOr=e=>eOt(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties);class Qze{constructor(t,n,r,a){this.Ut=s=>{var i=this.zt();if(!i||i.sessionId!==s){var l={sessionId:s,props:this.Ht(this._instance)};this.Bt.register({[sie]:l})}},this._instance=t,this.qt=n,this.Bt=r,this.Ht=a||rOr,this.qt.onSessionId(this.Ut)}zt(){return this.Bt.props[sie]}getSetOnceProps(){var t,n=(t=this.zt())==null?void 0:t.props;return n?"r"in n?tOt(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return Rs(_ve(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+Wse(r)]=n})),t}}class jve{constructor(){this.Vt={},this.Vt={}}on(t,n){return this.Vt[t]||(this.Vt[t]=[]),this.Vt[t].push(n),()=>{this.Vt[t]=this.Vt[t].filter((r=>r!==n))}}emit(t,n){for(var r of this.Vt[t]||[])r(n);for(var a of this.Vt["*"]||[])a(t,n)}}var pee=vi("[SessionId]");class Wze{on(t,n){return this.Wt.on(t,n)}constructor(t,n,r){var a;if(this.Gt=[],this.Yt=void 0,this.Wt=new jve,this.Jt=(d,f)=>!(!P1(d)||!P1(f))&&Math.abs(d-f)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.N=t.config,this.Bt=t.persistence,this.Kt=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Qt=n||Yy,this.Zt=r||Yy;var s=this.N.persistence_name||this.N.token,i=this.N.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*im(i,60,36e3,pee.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ti(),this.ii="ph_"+s+"_window_id",this.ei="ph_"+s+"_primary_window_exists",this.ri()){var l=ml.D(this.ii),c=ml.D(this.ei);l&&!c?this.Kt=l:ml.j(this.ii),ml.L(this.ei,!0)}if((a=this.N.bootstrap)!=null&&a.sessionID)try{var u=(d=>{var f=d.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(this.N.bootstrap.sessionID);this.si(this.N.bootstrap.sessionID,new Date().getTime(),u)}catch(d){pee.error("Invalid sessionID in bootstrap",d)}this.ni()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Yt(this.Gt)&&(this.Gt=[]),this.Gt.push(t),this.Xt&&t(this.Xt,this.Kt),()=>{this.Gt=this.Gt.filter((n=>n!==t))}}ri(){return this.N.persistence!=="memory"&&!this.Bt.st&&ml.F()}oi(t){t!==this.Kt&&(this.Kt=t,this.ri()&&ml.L(this.ii,t))}ai(){return this.Kt?this.Kt:this.ri()?ml.D(this.ii):null}si(t,n,r){t===this.Xt&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Xt=t,this.Bt.register({[P3]:[n,t,r]}))}li(){var t=this.Bt.props[P3];return Ra(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.si(null,null,null)}destroy(){clearTimeout(this.ui),this.ui=void 0,this.Yt&&rt&&(rt.removeEventListener("beforeunload",this.Yt,{capture:!1}),this.Yt=void 0),this.Gt=[]}ni(){this.Yt=()=>{this.ri()&&ml.j(this.ei)},ro(rt,"beforeunload",this.Yt,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.N.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[a,s,i]=this.li(),l=this.ai(),c=P1(i)&&Math.abs(r-i)>864e5,u=!1,d=!s,f=!d&&!t&&this.Jt(r,a);d||f||c?(s=this.Qt(),l=this.Zt(),pee.info("new session ID generated",{sessionId:s,windowId:l,changeReason:{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:c}}),i=r,u=!0):l||(l=this.Zt(),u=!0);var h=P1(a)&&t&&!c?a:r,p=P1(i)?i:new Date().getTime();return this.oi(l),this.si(s,h,p),t||this.ti(),u&&this.Gt.forEach((m=>m(s,l,u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:c}:void 0))),{sessionId:s,windowId:l,sessionStartTimestamp:p,changeReason:u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:a}}ti(){clearTimeout(this.ui),this.ui=setTimeout((()=>{var[t]=this.li();if(this.Jt(new Date().getTime(),t)){var n=this.Xt;this.resetSessionId(),this.Wt.emit("forcedIdleReset",{idleSessionId:n})}}),1.1*this.sessionTimeoutMs)}}var cOt=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&xze(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((a=>xze(a?.brand,t))))return!0}catch{}return!!e.webdriver},V3=function(e,t){if(!(function(n){try{new RegExp(n)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function Gze(e,t,n){return Rj({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var uOt={exact:(e,t)=>t.some((n=>e.some((r=>n===r)))),is_not:(e,t)=>t.every((n=>e.every((r=>n!==r)))),regex:(e,t)=>t.some((n=>e.some((r=>V3(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!V3(n,r))))),icontains:(e,t)=>t.map(m2).some((n=>e.map(m2).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(m2).every((n=>e.map(m2).every((r=>!n.includes(r))))),gt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((a=>r>parseFloat(a)))})),lt:(e,t)=>t.some((n=>{var r=parseFloat(n);return!isNaN(r)&&e.some((a=>r<parseFloat(a)))}))},m2=e=>e.toLowerCase();function dOt(e,t){return!e||Object.entries(e).every((n=>{var[r,a]=n,s=t?.[r];if(Yt(s)||dp(s))return!1;var i=[String(s)],l=uOt[a.operator];return!!l&&l(a.values,i)}))}var Pj=(function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e})({}),Zze="i.posthog.com";class aOr{constructor(t){this.hi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+Zze,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.hi[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hi[this.apiHost]=Pj.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hi[this.apiHost]=Pj.EU:this.hi[this.apiHost]=Pj.CUSTOM),this.hi[this.apiHost]}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(t==="flags")return this.flagsApiHost+n;if(this.region===Pj.CUSTOM)return this.apiHost+n;var r=Zze+n;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var gs=vi("[Surveys]"),fOt="seenSurvey_",sOr=(e,t)=>{var n="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(n="$survey_"+t+"/"+e.id+"/"+e.current_iteration),n},Yze=e=>((t,n)=>{var r=""+t+n.id;return n.current_iteration&&n.current_iteration>0&&(r=""+t+n.id+"_"+n.current_iteration),r})(fOt,e),iOr=[cee.Popover,cee.Widget,cee.API],oOr={ignoreConditions:!1,ignoreDelay:!1,displayType:cie.Popover},lOr=vi("[PostHog ExternalIntegrations]"),cOr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class uOr{constructor(t){this._instance=t}G(t,n){var r;(r=Bn.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(a=>{if(a)return lOr.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(i){var l,c,u;!a||(l=Bn.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[i]||t.G(cOr[i],(()=>{var d;(d=Bn.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[i])==null||d.start(t._instance)})),!a&&(c=Bn.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[i]&&((u=Bn.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[i])==null||u.stop())};for(var[r,a]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;n(r)}}}var gT={},mee=0,pie=()=>{},M1="posthog",hOt=!K1r&&Kc?.indexOf("MSIE")===-1&&Kc?.indexOf("Mozilla")===-1,Xze=e=>{var t;return Bt({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:S1r(Wt?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:pie,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,debug:vl&&lo(vl?.search)&&vl.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(rt==null||(t=rt.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:n=>{var r="Bad HTTP status: "+n.statusCode+" "+n.text;Xt.error(r)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:hie},error_tracking:{},_onCapture:pie,__preview_eager_load_replay:!1},(n=>({rageclick:!(n&&n>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(n&&n>="2025-05-24")||"history_change",session_recording:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},Kze=e=>{var t={};Yt(e.process_person)||(t.person_profiles=e.process_person),Yt(e.xhr_headers)||(t.request_headers=e.xhr_headers),Yt(e.cookie_name)||(t.persistence_name=e.cookie_name),Yt(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Yt(e.store_google)||(t.save_campaign_params=e.store_google),Yt(e.verbose)||(t.debug=e.verbose);var n=Hi({},t,e);return Ra(e.property_blacklist)&&(Yt(e.property_denylist)?n.property_denylist=e.property_blacklist:Ra(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Xt.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class dOr{constructor(){this.__forceAllowLocalhost=!1}get di(){return this.__forceAllowLocalhost}set di(t){Xt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Wp{vi(t,n){if(t){var r=this.ci.indexOf(t);r!==-1&&this.ci.splice(r,1)}return this.ci.push(n),n.initialize==null||n.initialize(),n}get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new dOr,this.fi=!1,this.version=vf.LIB_VERSION,this.pi=new jve,this.ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Xze(),this.SentryIntegration=M1r,this.sentryIntegration=r=>(function(a,s){var i=Z1t(a,s);return{name:G1t,processEvent:l=>i(l)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.gi=!1,this.mi=null,this.bi=null,this.yi=null,this.scrollManager=new nOr(this),this.pageViewManager=new Lze(this),this.rateLimiter=new q1r(this),this.requestRouter=new aOr(this),this.consent=new A1r(this),this.externalIntegrations=new uOr(this);var n=(t=Wp.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,a,s)=>{var i=lo(r)?{[r]:a}:r;this.setPersonProperties(i),s?.({})},set_once:(r,a,s)=>{var i=lo(r)?{[r]:a}:r;this.setPersonProperties(void 0,i),s?.({})}},this.on("eventCaptured",(r=>Xt.info('send "'+r?.event+'"',r)))}init(t,n,r){if(r&&r!==M1){var a,s=(a=gT[r])!==null&&a!==void 0?a:new Wp;return s._init(t,n,r),gT[r]=s,gT[M1][r]=s,s}return this._init(t,n,r)}_init(t,n,r){var a;if(n===void 0&&(n={}),Yt(t)||Gse(t))return Xt.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.wi(n.debug),this.Ei=n,this.Si=[],n.person_profiles?this.bi=n.person_profiles:n.process_person&&(this.bi=n.process_person),this.set_config(Hi({},Xze(n.defaults),Kze(n),{name:r,token:t})),this.config.on_xhr_error&&Xt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Mg.GZipJS;var s=this.xi();this.persistence=new lee(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new lee(Bt({},this.config,{persistence:"sessionStorage"}),s);var i=Bt({},this.persistence.props),l=Bt({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.$i=new J1r((m=>this.ki(m)),this.config.request_queue_config),this.Pi=new tOr(this),this.__request_queue=[];var c=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new Wze(this),this.sessionPropsManager=new Qze(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Xt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ti(c)}),0)):(Xt.info("Initializing extensions synchronously"),this.Ti(c)),vf.DEBUG=vf.DEBUG||this.config.debug,vf.DEBUG&&Xt.info("Starting in debug mode",{this:this,config:n,thisC:Bt({},this.config),p:i,s:l}),((a=n.bootstrap)==null?void 0:a.distinctID)!==void 0){var u,d,f=this.config.get_device_id(Yy()),h=(u=n.bootstrap)!=null&&u.isIdentifiedID?f:n.bootstrap.distinctID;this.persistence.set_property(Pp,(d=n.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:h})}if(c)this.register_once({distinct_id:QC,$device_id:null},"");else if(!this.get_distinct_id()){var p=this.config.get_device_id(Yy());this.register_once({distinct_id:p,$device_id:p},""),this.persistence.set_property(Pp,"anonymous")}return ro(rt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?P1r(this,(()=>this.Ri())):this.Ri(),Bg(this.config._onCapture)&&this.config._onCapture!==pie&&(Xt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(m=>this.config._onCapture(m.event,m)))),this.config.ip&&Xt.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Ti(t){var n,r,a,s,i,l,c,u=performance.now(),d=Bt({},Wp.__defaultExtensionClasses,this.config.__extensionClasses),f=[];d.featureFlags&&this.ci.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new d.featureFlags(this)),d.exceptions&&this.ci.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new d.exceptions(this)),d.historyAutocapture&&this.ci.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.ci.push(new d.tracingHeaders(this)),d.siteApps&&this.ci.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!t&&this.ci.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||f.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),d.autocapture&&this.ci.push(this.autocapture=new d.autocapture(this)),d.surveys&&this.ci.push(this.surveys=(a=this.surveys)!==null&&a!==void 0?a:new d.surveys(this)),d.logs&&this.ci.push(this.logs=(s=this.logs)!==null&&s!==void 0?s:new d.logs(this)),d.conversations&&this.ci.push(this.conversations=(i=this.conversations)!==null&&i!==void 0?i:new d.conversations(this)),d.productTours&&this.ci.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.ci.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.ci.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.ci.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.ci.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,R1r)),d.toolbar&&this.ci.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new d.toolbar(this)),d.experiments&&this.ci.push(this.experiments=(c=this.experiments)!==null&&c!==void 0?c:new d.experiments(this)),this.ci.forEach((h=>{h.initialize&&f.push((()=>{h.initialize==null||h.initialize()}))})),f.push((()=>{if(this.Ii){var h=this.Ii;this.Ii=void 0,this.ft(h)}})),this.Ci(f,u)}Ci(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.Ci(t,n)}),0);var r=t.shift();if(r)try{r()}catch(s){Xt.error("Error initializing extension:",s)}}var a=Math.round(performance.now()-n);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:a}),this.config.__preview_deferred_init_extensions&&Xt.info("PostHog extensions initialized ("+a+"ms)")}ft(t){var n;if(!Wt||!Wt.body)return Xt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.ft(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Ii=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Zr(t.supportedCompression,Mg.GZipJS)?Mg.GZipJS:Zr(t.supportedCompression,Mg.Base64)?Mg.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.bi?this.bi:"identified_only"}),this.ci.forEach((r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(t)))}Ri(){try{this.config.loaded(this)}catch(r){Xt.critical("`loaded` function failed",r)}if(this.Oi(),this.config.internal_or_test_user_hostname&&vl!=null&&vl.hostname){var t=vl.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Fi()}),1),this.Mi=new rOt(this),this.Mi.load()}Oi(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.$i)==null||t.enable())}_dom_loaded(){this.is_capturing()&&db(this.__request_queue,(t=>this.ki(t))),this.__request_queue=[],this.Oi()}_handle_unload(){var t,n,r;(t=this.surveys)==null||t.handlePageUnload(),this.config.request_batching?(this.Ai()&&this.capture("$pageleave"),(n=this.$i)==null||n.unload(),(r=this.Pi)==null||r.unload()):this.Ai()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(hOt?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=q3(t.url,{ip:this.config.ip?1:0}),t.headers=Bt({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,a,s,i=Bt({},n);i.timeout=i.timeout||6e4,i.url=q3(i.url,{_:new Date().getTime().toString(),ver:vf.JS_SDK_VERSION,compression:i.compression});var l=(r=i.transport)!==null&&r!==void 0?r:"fetch",c=h$.filter((d=>!i.disableTransport||!d.transport||!i.disableTransport.includes(d.transport))),u=(a=(s=B1t(c,(d=>d.transport===l)))==null?void 0:s.method)!==null&&a!==void 0?a:c[0].method;if(!u)throw new Error("No available transport method");u(i)})(Bt({},t,{callback:n=>{var r,a;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(a=this.config).on_request_error)==null||r.call(a,n)),t.callback==null||t.callback(n)}}))))}ki(t){this.Pi?this.Pi.retriableRequest(t):this._send_request(t)}_execute_array(t){mee++;try{var n,r=[],a=[],s=[];db(t,(l=>{l&&(n=l[0],Ra(n)?s.push(l):Bg(l)?l.call(this):Ra(l)&&n==="alias"?r.push(l):Ra(l)&&n.indexOf("capture")!==-1&&Bg(this[n])?s.push(l):a.push(l))}));var i=function(l,c){db(l,(function(u){if(Ra(u[0])){var d=c;Rs(u,(function(f){d=d[f[0]].apply(d,f.slice(1))}))}else this[u[0]].apply(this,u.slice(1))}),c)};i(r,this),i(a,this),i(s,this)}finally{mee--}}push(t){if(mee>0&&Ra(t)&&lo(t[0])){var n=Wp.prototype[t[0]];Bg(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,r){var a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.$i){if(this.is_capturing())if(!Yt(t)&&lo(t)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var i=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(i==null||!i.isRateLimited){n!=null&&n.$current_url&&!lo(n?.$current_url)&&(Xt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),t!=="$exception"||r!=null&&r.Di||Xt.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var l=new Date,c=r?.timestamp||l,u=Yy(),d={uuid:u,event:t,properties:this.calculateEventProperties(t,n||{},c,u)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),i&&(d.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens),r?.$set&&(d.$set=r?.$set);var f,h=t!=="$groupidentify",p=this.Li(r?.$set_once,h);if(p&&(d.$set_once=p),(d=x1r(d,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=c,Yt(r?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=l),t===Ij.DISMISSED||t===Ij.SENT){var m=n?.[uee.SURVEY_ID],g=n?.[uee.SURVEY_ITERATION];f={id:m,current_iteration:g},localStorage.getItem(Yze(f))||localStorage.setItem(Yze(f),"true"),d.$set=Bt({},d.$set,{[sOr({id:m,current_iteration:g},t===Ij.SENT?"responded":"dismissed")]:!0})}else t===Ij.SHOWN&&(d.$set=Bt({},d.$set,{[uee.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===U1r.SHOWN){var v=n?.[zze.TOUR_TYPE];v&&(d.$set=Bt({},d.$set,{[zze.TOUR_LAST_SEEN_DATE+"/"+v]:new Date().toISOString()}))}var x=Bt({},d.properties.$set,d.$set);if(nO(x)||this.setPersonPropertiesForFlags(x),!sa(this.config.before_send)){var w=this.ji(d);if(!w)return;d=w}this.pi.emit("eventCaptured",d);var O={method:"POST",url:(a=r?._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:d,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.ki(O):this.$i.enqueue(O),d}Xt.critical("This capture call is ignored due to client rate limiting.")}}else Xt.error("No event name provided to posthog.capture")}else Xt.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,r,a,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var i=s?void 0:this.persistence.remove_event_timer(t),l=Bt({},n);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(l.$cookieless_mode=!0),t==="$snapshot"){var c=Bt({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=c.distinct_id,(!lo(l.distinct_id)&&!Tm(l.distinct_id)||Gse(l.distinct_id))&&Xt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=z1r(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());l.$session_id=f,l.$window_id=h}this.sessionPropsManager&&Hi(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Hi(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(p=this.Pi)==null?void 0:p.length}catch(x){l.$sdk_debug_error_capturing_properties=String(x)}if(this.requestRouter.region===Pj.CUSTOM&&(l.$lib_custom_api_host=this.config.api_host),u=t!=="$pageview"||s?t!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,a),l=Hi(l,u),t==="$pageview"&&Wt&&(l.title=Wt.title),!Yt(i)){var m=r.getTime()-i;l.$duration=parseFloat((m/1e3).toFixed(3))}Kc&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Hi({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Ra(this.config.property_denylist)?Rs(this.config.property_denylist,(function(x){delete l[x]})):Xt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(Xt.error("sanitize_properties is deprecated. Use before_send instead"),l=g(l,t));var v=this.Ni();return l.$process_person_profile=v,v&&!s&&this.Ui("_calculate_event_properties"),l}Li(t,n){var r;if(n===void 0&&(n=!0),!this.persistence||!this.Ni()||this.fi)return t;var a=this.persistence.get_initial_props(),s=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),i=Hi({},a,s||{},t||{}),l=this.config.sanitize_properties;return l&&(Xt.error("sanitize_properties is deprecated. Use before_send instead"),i=l(i,"$set_once")),n&&(this.fi=!0),nO(i)?void 0:i}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var a;(a=this.persistence)==null||a.register_once(t,n,r)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}zi(t,n){this.register({[t]:n})}getFeatureFlag(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(t)}getFeatureFlagResult(t,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,n)}isFeatureEnabled(t,n){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(t,n)}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,r){var a;(a=this.featureFlags)==null||a.updateFlags(t,n,r)}updateEarlyAccessFeatureEnrollment(t,n,r){var a;(a=this.featureFlags)==null||a.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){var a;return n===void 0&&(n=!1),(a=this.featureFlags)==null?void 0:a.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.pi.on(t,n)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:"Surveys module not available"}),()=>{})}onSessionId(t){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(t,n):t([],{isLoaded:!1,error:"Surveys module not available"})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:"Surveys module not available"})}renderSurvey(t,n){var r;(r=this.surveys)==null||r.renderSurvey(t,n)}displaySurvey(t,n){var r;n===void 0&&(n=oOr),(r=this.surveys)==null||r.displaySurvey(t,n)}cancelPendingSurvey(t){var n;(n=this.surveys)==null||n.cancelPendingSurvey(t)}canRenderSurvey(t){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&n!==void 0?n:{visible:!1,disabledReason:"Surveys module not available"}}canRenderSurveyAsync(t,n){var r,a;return n===void 0&&(n=!1),(r=(a=this.surveys)==null?void 0:a.canRenderSurveyAsync(t,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:"Surveys module not available"})}identify(t,n,r){if(!this.__loaded||!this.persistence)return Xt.uninitializedWarning("posthog.identify");if(Tm(t)&&(t=t.toString(),Xt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))Xt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==QC){if(this.Ui("posthog.identify")){var a=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=a;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==a&&t!==this.get_property(jj)&&(this.unregister(jj),this.register({distinct_id:t}));var i,l=(this.persistence.get_property(Pp)||"anonymous")==="anonymous";t!==a&&l?(this.persistence.set_property(Pp,"identified"),this.setPersonPropertiesForFlags(Bt({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:r||{}}),this.yi=Gze(t,n,r),(i=this.featureFlags)==null||i.setAnonymousDistinctId(a)):(n||r)&&this.setPersonProperties(n,r),t!==a&&(this.reloadFeatureFlags(),this.unregister(pT))}}else Xt.critical('The string "'+QC+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Xt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this.Ui("posthog.setPersonProperties")){var r=Gze(this.get_distinct_id(),t,n);this.yi!==r?(this.setPersonPropertiesForFlags(Bt({},n||{},t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.yi=r):Xt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,r){if(t&&n){var a=this.getGroups();a[t]!==n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:Bt({},a,{[t]:n})}),r&&(this.capture("$groupidentify",{$group_type:t,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[t]:r})),a[t]===n||r||this.reloadFeatureFlags()}else Xt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){var t;(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,n){var r;n===void 0&&(n=!0),this.Ui("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,n))}resetGroupPropertiesForFlags(t){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(t)}reset(t){var n,r,a,s,i,l,c;if(Xt.info("reset"),!this.__loaded)return Xt.uninitializedWarning("posthog.reset");var u=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),(a=this.surveys)==null||a.reset(),(s=this.Mi)==null||s.stop(),(i=this.featureFlags)==null||i.reset(),(l=this.persistence)==null||l.set_property(Pp,"anonymous"),(c=this.sessionManager)==null||c.resetSessionId(),this.yi=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:QC,$device_id:null},"");else{var d=this.config.get_device_id(Yy());this.register_once({distinct_id:d,$device_id:t?d:u},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),this.reloadFeatureFlags()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(t!=null&&t.withTimestamp&&r){var s,i=(s=t.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-i,0)}return a}alias(t,n){return t===this.get_property(q1t)?(Xt.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ui("posthog.alias")?(Yt(n)&&(n=this.get_distinct_id()),t!==n?(this.zi(jj,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Xt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=Bt({},this.config);if(No(t)){var r,a,s,i,l,c,u,d,f;Hi(this.config,Kze(t));var h=this.xi();(r=this.persistence)==null||r.update_config(this.config,n,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new lee(Bt({},this.config,{persistence:"sessionStorage"}),h);var p=this.wi(this.config.debug);Xg(p)&&(this.config.debug=p),Xg(this.config.debug)&&(this.config.debug?(vf.DEBUG=!0,di.F()&&di.L("ph_debug",!0),Xt.info("set_config",{config:t,oldConfig:n,newConfig:Bt({},this.config)})):(vf.DEBUG=!1,di.F()&&di.j("ph_debug"))),(a=this.exceptionObserver)==null||a.onConfigChange(),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),(i=this.autocapture)==null||i.startIfEnabled(),(l=this.heatmaps)==null||l.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(u=this.deadClicksAutocapture)==null||u.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.Hi(),(f=this.externalIntegrations)==null||f.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){vf.LIB_NAME=t,vf.LIB_VERSION=n}startSessionRecording(t){var n=t===!0,r={sampling:n||!(t==null||!t.sampling),linked_flag:n||!(t==null||!t.linked_flag),url_trigger:n||!(t==null||!t.url_trigger),event_trigger:n||!(t==null||!t.event_trigger)};if(Object.values(r).some(Boolean)){var a,s,i,l,c;(a=this.sessionManager)==null||a.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),r.linked_flag&&((i=this.sessionRecording)==null||i.overrideLinkedFlag()),r.url_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("url")),r.event_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(Bt({},a,n))}}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&n!==void 0&&n}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:M1;return n!==M1&&(n=M1+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Pp))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(Pp))==="identified"}Ni(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&nO(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[jj])&&((n=this.persistence)==null||(n=n.props)==null||!n[$3]))}Ai(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Ni()||this.Ui("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Ui("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Ui(t){return this.config.person_profiles==="never"?(Xt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.zi($3,!0),!0)}xi(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||t&&!!n}Hi(){var t,n,r,a,s=this.xi();return((t=this.persistence)==null?void 0:t.st)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.st)!==s&&((a=this.sessionPersistence)==null||a.set_disabled(s)),s}opt_in_capturing(t){var n;if(this.config.cookieless_mode!=="always"){if(this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()){var r,a,s,i,l;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=new Wze(this),this.pageViewManager=new Lze(this),this.persistence&&(this.sessionPropsManager=new Qze(this,this.sessionManager,this.persistence));var c=(s=(i=this.config.__extensionClasses)==null?void 0:i.sessionRecording)!==null&&s!==void 0?s:(l=Wp.__defaultExtensionClasses)==null?void 0:l.sessionRecording;c&&(this.sessionRecording=this.vi(this.sessionRecording,new c(this)))}var u,d;this.consent.optInOut(!0),this.Hi(),this.Oi(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((u=this.surveys)==null||u.loadIfEnabled()),(Yt(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((d=t?.captureEventName)!==null&&d!==void 0?d:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Fi()}else Xt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t,n,r;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Hi(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:QC,$device_id:null}),(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.Fi())):Xt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===jg.GRANTED?"granted":t===jg.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Hi()}_is_bot(){return yd?cOt(yd,this.config.custom_blocked_useragents):void 0}Fi(){Wt&&(Wt.visibilityState==="visible"?this.gi||(this.gi=!0,this.capture("$pageview",{title:Wt.title},{send_instantly:!0}),this.mi&&(Wt.removeEventListener("visibilitychange",this.mi),this.mi=null)):this.mi||(this.mi=this.Fi.bind(this),ro(Wt,"visibilitychange",this.mi)))}debug(t){t===!1?(rt?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(rt?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}bt(){var t,n,r,a,s,i,l,c=this.Ei||{};return"advanced_disable_flags"in c?!!c.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Xt.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",a=!1,s=Xt,i=(n="advanced_disable_flags")in(t=c)&&!sa(t[n]),l=r in t&&!sa(t[r]),i?t[n]:l?(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),t[r]):a)}ji(t){if(sa(this.config.before_send))return t;var n=Ra(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var a of n){if(r=a(r),sa(r)){var s="Event '"+t.event+"' was rejected in beforeSend function";return $Sr(t.event)?Xt.warn(s+". This can cause unexpected behavior."):Xt.info(s),null}r.properties&&!nO(r.properties)||Xt.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var t;return(t=this.pageViewManager.K)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}wi(t){var n=Xg(t)&&!t,r=di.F()&&di.A("ph_debug")==="true";return!n&&(!!r||t)}}Wp.__defaultExtensionClasses={},(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=b1r(e.prototype[t[n]])})(Wp,["identify"]);function Jze(e){return e instanceof Element&&(e.id===Q1t||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function T8(e){return!!e&&e.nodeType===1}function fb(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function pOt(e){return!!e&&e.nodeType===3}function mOt(e){return!!e&&e.nodeType===11}function Tve(e){return e?C8(e).split(/\s+/):[]}function e8e(e){var t=rt?.location.href;return!!(t&&e&&e.some((n=>t.match(n))))}function H3(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Tve(t)}function gOt(e){return sa(e)?null:C8(e).split(/(\s+)/).filter((t=>MA(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function QR(e){var t="";return mie(e)&&!xOt(e)&&e.childNodes&&e.childNodes.length&&Rs(e.childNodes,(function(n){var r;pOt(n)&&n.textContent&&(t+=(r=gOt(n.textContent))!==null&&r!==void 0?r:"")})),C8(t)}function t8e(e){return Yt(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Nve=["a","button","form","input","select","textarea","label"];function vOt(e,t){if(Yt(t))return!0;var n,r=function(s){if(t.some((i=>s.matches(i))))return{v:!0}};for(var a of e)if(n=r(a))return n.v;return!1}function yOt(e){var t=e.parentNode;return!(!t||!T8(t))&&t}var fOr=["next","previous","prev",">","<"],n8e=10,r8e=[".ph-no-rageclick",".ph-no-capture"];function hOr(e,t){if(!rt||Ave(e))return!1;var n,r,a;if(Xg(t)?(n=!!t&&r8e,r=void 0):(n=(a=t?.css_selector_ignorelist)!==null&&a!==void 0?a:r8e,r=t?.content_ignorelist),n===!1)return!1;var{targetElementList:s}=bOt(e,!1);return!(function(i,l){if(i===!1||Yt(i))return!1;var c;if(i===!0)c=fOr;else{if(!Ra(i))return!1;if(i.length>n8e)return Xt.error("[PostHog] content_ignorelist array cannot exceed "+n8e+" items. Use css_selector_ignorelist for more complex matching."),!1;c=i.map((u=>u.toLowerCase()))}return l.some((u=>{var{safeText:d,ariaLabel:f}=u;return c.some((h=>d.includes(h)||f.includes(h)))}))})(r,s.map((i=>{var l;return{safeText:QR(i).toLowerCase(),ariaLabel:((l=i.getAttribute("aria-label"))==null?void 0:l.toLowerCase().trim())||""}})))&&!vOt(s,n)}var Ave=e=>!e||fb(e,"html")||!T8(e),bOt=(e,t)=>{if(!rt||Ave(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],a=e;a.parentNode&&!fb(a,"body");)if(mOt(a.parentNode))r.push(a.parentNode.host),a=a.parentNode.host;else{var s=yOt(a);if(!s)break;if(t||Nve.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var i=rt.getComputedStyle(s);i&&i.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(s),a=s}return{parentIsUsefulElement:n,targetElementList:r}};function pOr(e,t,n,r,a){var s,i,l,c;if(n===void 0&&(n=void 0),!rt||Ave(e)||(s=n)!=null&&s.url_allowlist&&!e8e(n.url_allowlist)||(i=n)!=null&&i.url_ignorelist&&e8e(n.url_ignorelist))return!1;if((l=n)!=null&&l.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some((m=>t.type===m)))return!1}var{parentIsUsefulElement:d,targetElementList:f}=bOt(e,r);if(!(function(m,g){var v=g?.element_allowlist;if(Yt(v))return!0;var x,w=function(k){if(v.some((_=>k.tagName.toLowerCase()===_)))return{v:!0}};for(var O of m)if(x=w(O))return x.v;return!1})(f,n)||!vOt(f,(c=n)==null?void 0:c.css_selector_allowlist))return!1;var h=rt.getComputedStyle(e);if(h&&h.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(a||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(a||["change","click"]).indexOf(t.type)>=0;default:return d?(a||["click"]).indexOf(t.type)>=0:(a||["click"]).indexOf(t.type)>=0&&(Nve.indexOf(p)>-1||e.getAttribute("contenteditable")==="true")}}function mie(e){for(var t=e;t.parentNode&&!fb(t,"body");t=t.parentNode){var n=H3(t);if(Zr(n,"ph-sensitive")||Zr(n,"ph-no-capture"))return!1}if(Zr(H3(e),"ph-include"))return!0;var r=e.type||"";if(lo(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var a=e.name||e.id||"";return!(lo(a)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,"")))}function xOt(e){return!!(fb(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||fb(e,"select")||fb(e,"textarea")||e.getAttribute("contenteditable")==="true")}var wOt="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",mOr=new RegExp("^(?:"+wOt+")$"),gOr=new RegExp(wOt),SOt="\\d{3}-?\\d{2}-?\\d{4}",vOr=new RegExp("^("+SOt+")$"),yOr=new RegExp("("+SOt+")");function MA(e,t){return t===void 0&&(t=!0),!(sa(e)||lo(e)&&(e=C8(e),(t?mOr:gOr).test((e||"").replace(/[- ]/g,""))||(t?vOr:yOr).test(e)))}function OOt(e){var t=QR(e);return MA(t=(t+" "+kOt(e)).trim())?t:""}function kOt(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Rs(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var a=QR(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+kOt(n)).trim())}catch(s){Xt.error("[AutoCapture]",s)}})),t}function bOr(e){return(function(t){var n=t.map((r=>{var a,s,i="";if(r.tag_name&&(i+=r.tag_name),r.attr_class)for(var l of(r.attr_class.sort(),r.attr_class))i+="."+l.replace(/"/g,"");var c=Bt({},r.text?{text:r.text}:{},{"nth-child":(a=r.nth_child)!==null&&a!==void 0?a:0,"nth-of-type":(s=r.nth_of_type)!==null&&s!==void 0?s:0},r.href?{href:r.href}:{},r.attr_id?{attr_id:r.attr_id}:{},r.attributes),u={};return f$(c).sort(((d,f)=>{var[h]=d,[p]=f;return h.localeCompare(p)})).forEach((d=>{var[f,h]=d;return u[a8e(f.toString())]=a8e(h.toString())})),i+=":",i+=f$(u).map((d=>{var[f,h]=d;return f+'="'+h+'"'})).join("")}));return n.join(";")})((function(t){return t.map((n=>{var r,a,s={text:(r=n.$el_text)==null?void 0:r.slice(0,400),tag_name:n.tag_name,href:(a=n.attr__href)==null?void 0:a.slice(0,2048),attr_class:xOr(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return f$(n).filter((i=>{var[l]=i;return l.indexOf("attr__")===0})).forEach((i=>{var[l,c]=i;return s.attributes[l]=c})),s}))})(e))}function a8e(e){return e.replace(/"|\\"/g,'\\"')}function xOr(e){var t=e.attr__class;return t?Ra(t)?t:Tve(t):void 0}class s8e{constructor(t){this.disabled=t===!1;var n=No(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(t,n,r){if(this.disabled)return!1;var a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<this.thresholdPx&&r-a.timestamp<this.timeoutMs){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var gee="$copy_autocapture",i8e=vi("[AutoCapture]");function vee(e,t){return t.length>e?t.slice(0,e)+"...":t}function wOr(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!T8(t));return t}function SOr(e,t,n,r){var a=e.tagName.toLowerCase(),s={tag_name:a};Nve.indexOf(a)>-1&&!n&&(a.toLowerCase()==="a"||a.toLowerCase()==="button"?s.$el_text=vee(1024,OOt(e)):s.$el_text=vee(1024,QR(e)));var i=H3(e);i.length>0&&(s.classes=i.filter((function(d){return d!==""}))),Rs(e.attributes,(function(d){var f;if((!xOt(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(r==null||!r.includes(d.name))&&!t&&MA(d.value)&&(f=d.name,!lo(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var h=d.value;d.name==="class"&&(h=Tve(h).join(" ")),s["attr__"+d.name]=vee(1024,h)}}));for(var l=1,c=1,u=e;u=wOr(u);)l++,u.tagName===e.tagName&&c++;return s.nth_child=l,s.nth_of_type=c,s}function OOr(e,t){for(var n,r,{e:a,maskAllElementAttributes:s,maskAllText:i,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],d=e;d.parentNode&&!fb(d,"body");)mOt(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var f,h=[],p={},m=!1,g=!1;if(Rs(u,(k=>{var _=mie(k);k.tagName.toLowerCase()==="a"&&(m=k.getAttribute("href"),m=_&&m&&MA(m)&&m),Zr(H3(k),"ph-no-capture")&&(g=!0),h.push(SOr(k,s,i,l));var C=(function(T){if(!mie(T))return{};var j={};return Rs(T.attributes,(function(A){if(A.name&&A.name.indexOf("data-ph-capture-attribute")===0){var I=A.name.replace("data-ph-capture-attribute-",""),P=A.value;I&&P&&MA(P)&&(j[I]=P)}})),j})(k);Hi(p,C)})),g)return{props:{},explicitNoCapture:g};if(i||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?h[0].$el_text=OOt(e):h[0].$el_text=QR(e)),m){var v,x;h[0].attr__href=m;var w=(v=F3(m))==null?void 0:v.host,O=rt==null||(x=rt.location)==null?void 0:x.host;w&&O&&w!==O&&(f=m)}return{props:Hi({$event_type:a.type,$ce_version:1},c?{}:{$elements:h},{$elements_chain:bOr(h)},(n=h[0])!=null&&n.$el_text?{$el_text:(r=h[0])==null?void 0:r.$el_text}:{},f&&a.type==="click"?{$external_click_url:f}:{},p)}}var KC=vi("[ExceptionAutocapture]");function o8e(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],a=n(r);return Bg(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=a,()=>{e[t]=r}}catch{return()=>{}}}var kOr=vi("[TracingHeaders]"),Oy=vi("[Web Vitals]"),l8e=9e5,c8e="disabled",u8e="lazy_loading",JC="awaiting_config",g2="missing_config";vi("[SessionRecording]");var gie="[SessionRecording]",Qx=vi(gie),_Or=vi("[Heatmaps]");function d8e(e){return No(e)&&"clientX"in e&&"clientY"in e&&Tm(e.clientX)&&Tm(e.clientY)}var f8e=vi("[Product Tours]"),yee="ph_product_tours",EOr=["$set_once","$set"],ky=vi("[SiteApps]");function b1(e,t,n){if(sa(e))return!1;switch(n){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}class COr{constructor(t){this.Bi=new jve,this.qi=(n,r)=>this.Vi(n,r)&&this.Wi(n,r)&&this.Gi(n,r)&&this.Yi(n,r),this.Vi=(n,r)=>r==null||!r.event||n?.event===r?.event,this._instance=t,this.Ji=new Set,this.Ki=new Set}init(){var t;if(!Yt((t=this._instance)==null?void 0:t._addCaptureHook)){var n;(n=this._instance)==null||n._addCaptureHook(((r,a)=>{this.on(r,a)}))}}register(t){var n,r;if(!Yt((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((i=>{var l,c;(l=this.Ki)==null||l.add(i),(c=i.steps)==null||c.forEach((u=>{var d;(d=this.Ji)==null||d.add(u?.event||"")}))})),(r=this._instance)!=null&&r.autocapture)){var a,s=new Set;t.forEach((i=>{var l;(l=i.steps)==null||l.forEach((c=>{c!=null&&c.selector&&s.add(c?.selector)}))})),(a=this._instance)==null||a.autocapture.setElementSelectors(s)}}on(t,n){var r;n!=null&&t.length!=0&&(this.Ji.has(t)||this.Ji.has(n?.event))&&this.Ki&&((r=this.Ki)==null?void 0:r.size)>0&&this.Ki.forEach((a=>{this.Xi(n,a)&&this.Bi.emit("actionCaptured",a.name)}))}Qi(t){this.onAction("actionCaptured",(n=>t(n)))}Xi(t,n){if(n?.steps==null)return!1;for(var r of n.steps)if(this.qi(t,r))return!0;return!1}onAction(t,n){return this.Bi.on(t,n)}Wi(t,n){if(n!=null&&n.url){var r,a=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!a||typeof a!="string"||!b1(a,n.url,n.url_matching||"contains"))return!1}return!0}Gi(t,n){return!!this.Zi(t,n)&&!!this.te(t,n)&&!!this.ie(t,n)}Zi(t,n){var r;if(n==null||!n.href)return!0;var a=this.ee(t);if(a.length>0)return a.some((l=>b1(l.href,n.href,n.href_matching||"exact")));var s,i=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!i&&b1((s=i.match(/(?::|")href="(.*?)"/))?s[1]:"",n.href,n.href_matching||"exact")}te(t,n){var r;if(n==null||!n.text)return!0;var a=this.ee(t);if(a.length>0)return a.some((u=>b1(u.text,n.text,n.text_matching||"exact")||b1(u.$el_text,n.text,n.text_matching||"exact")));var s,i,l,c=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!c&&(s=(function(u){for(var d,f=[],h=/(?::|")text="(.*?)"/g;!sa(d=h.exec(u));)f.includes(d[1])||f.push(d[1]);return f})(c),i=n.text,l=n.text_matching||"exact",s.some((u=>b1(u,i,l))))}ie(t,n){var r,a;if(n==null||!n.selector)return!0;var s=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(s!=null&&s.includes(n.selector))return!0;var i=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";if(n.selector_regex&&i)try{return new RegExp(n.selector_regex).test(i)}catch{return!1}return!1}ee(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t?.properties.$elements}Yi(t,n){return n==null||!n.properties||n.properties.length===0||dOt(n.properties.reduce(((r,a)=>{var s=Ra(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return r[a.key]={values:s,operator:a.operator||"exact"},r}),{}),t?.properties)}}class jOr{constructor(t){this._instance=t,this.re=new Map,this.se=new Map,this.ne=new Map}oe(t,n){return!!t&&dOt(t.propertyFilters,n?.properties)}ae(t,n){var r=new Map;return t.forEach((a=>{var s;(s=a.conditions)==null||(s=s[n])==null||(s=s.values)==null||s.forEach((i=>{if(i!=null&&i.name){var l=r.get(i.name)||[];l.push(a.id),r.set(i.name,l)}}))})),r}le(t,n,r){var a=(r===GC.Activation?this.re:this.se).get(t),s=[];return this.ue((i=>{s=i.filter((l=>a?.includes(l.id)))})),s.filter((i=>{var l,c=(l=i.conditions)==null||(l=l[r])==null||(l=l.values)==null?void 0:l.find((u=>u.name===t));return this.oe(c,n)}))}register(t){var n;Yt((n=this._instance)==null?void 0:n._addCaptureHook)||(this.he(t),this.de(t))}de(t){var n=t.filter((r=>{var a,s;return((a=r.conditions)==null?void 0:a.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));n.length!==0&&(this.ve==null&&(this.ve=new COr(this._instance),this.ve.init(),this.ve.Qi((r=>{this.onAction(r)}))),n.forEach((r=>{var a,s,i,l,c;r.conditions&&(a=r.conditions)!=null&&a.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((i=r.conditions)==null||(i=i.actions)==null||(i=i.values)==null?void 0:i.length)>0&&((l=this.ve)==null||l.register(r.conditions.actions.values),(c=r.conditions)==null||(c=c.actions)==null||(c=c.values)==null||c.forEach((u=>{if(u&&u.name){var d=this.ne.get(u.name);d&&d.push(r.id),this.ne.set(u.name,d||[r.id])}})))})))}he(t){var n,r=t.filter((s=>{var i,l;return((i=s.conditions)==null?void 0:i.events)&&((l=s.conditions)==null||(l=l.events)==null||(l=l.values)==null?void 0:l.length)>0})),a=t.filter((s=>{var i,l;return((i=s.conditions)==null?void 0:i.cancelEvents)&&((l=s.conditions)==null||(l=l.cancelEvents)==null||(l=l.values)==null?void 0:l.length)>0}));(r.length!==0||a.length!==0)&&((n=this._instance)==null||n._addCaptureHook(((s,i)=>{this.onEvent(s,i)})),this.re=this.ae(t,GC.Activation),this.se=this.ae(t,GC.Cancellation))}onEvent(t,n){var r,a=this.ce(),s=this.fe(),i=this.pe(),l=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[s])||[];if(i===t&&n&&l.length>0){var c,u;a.info("event matched, removing item from activated items",{event:t,eventPayload:n,existingActivatedItems:l});var d=(n==null||(c=n.properties)==null?void 0:c.$survey_id)||(n==null||(u=n.properties)==null?void 0:u.$product_tour_id);if(d){var f=l.indexOf(d);f>=0&&(l.splice(f,1),this._e(l))}}else{if(this.se.has(t)){var h=this.le(t,n,GC.Cancellation);h.length>0&&(a.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((m=>m.id))}),h.forEach((m=>{var g=l.indexOf(m.id);g>=0&&l.splice(g,1),this.ge(m.id)})),this._e(l))}if(this.re.has(t)){a.info("event name matched",{event:t,eventPayload:n,items:this.re.get(t)});var p=this.le(t,n,GC.Activation);this._e(l.concat(p.map((m=>m.id))||[]))}}}onAction(t){var n,r=this.fe(),a=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[r])||[];this.ne.has(t)&&this._e(a.concat(this.ne.get(t)||[]))}_e(t){var n,r=this.ce(),a=this.fe(),s=[...new Set(t)].filter((i=>!this.me(i)));r.info("updating activated items",{activatedItems:s}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[a]:s})}getActivatedIds(){var t,n=this.fe(),r=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n];return r||[]}getEventToItemsMap(){return this.re}be(){return this.ve}}class TOr extends jOr{constructor(t){super(t)}fe(){return"$surveys_activated"}pe(){return Ij.SHOWN}ue(t){var n;(n=this._instance)==null||n.getSurveys(t)}ge(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}ce(){return gs}me(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var NOr=rt!=null&&rt.location?B3(rt.location.hash,"__posthog")||B3(location.hash,"state"):null,h8e="_postHogToolbarParams",p8e=vi("[Toolbar]"),jy=(function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e})(jy||{}),Zc=vi("[FeatureFlags]"),ej=vi("[FeatureFlags]",{debugEnabled:!0}),AOr="errors_while_computing_flags",IOr="flag_missing",ROr="quota_limited",POr="timeout",MOr="connection_error",DOr="unknown_error",$Or=e=>"api_error_"+e,bee="$active_feature_flags",x1="$override_feature_flags",m8e="$feature_flag_payloads",tj="$override_feature_flag_payloads",g8e="$feature_flag_request_id",v8e=e=>{var t={};for(var[n,r]of f$(e||{}))r&&(t[n]=r);return t},LOr=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((n=>{var r;return[n,(r=t[n].variant)!==null&&r!==void 0?r:t[n].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((n=>t[n].enabled)).filter((n=>{var r;return(r=t[n].metadata)==null?void 0:r.payload})).map((n=>{var r;return[n,(r=t[n].metadata)==null?void 0:r.payload]})))):Zc.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e},FOr=(function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e})({}),xee=vi("[Error tracking]"),zOr={icontains:(e,t)=>!!rt&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!rt&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!rt&&V3(t.href,e),not_regex:(e,t)=>!!rt&&!V3(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Il{constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((a=>{Il.ye("retrieved web experiments from the server"),n.we=new Map,a.forEach((s=>{if(s.feature_flag_key){var i;n.we&&(Il.ye("setting flag key ",s.feature_flag_key," to web experiment ",s),(i=n.we)==null||i.set(s.feature_flag_key,s));var l=n._instance.getFeatureFlag(s.feature_flag_key);lo(l)&&s.variants[l]&&n.Ee(s.name,l,s.variants[l].transforms)}else if(s.variants)for(var c in s.variants){var u=s.variants[c];Il.Se(u)&&n.Ee(s.name,c,u.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Il.ye("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(sa(this.we))return this.we=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Il.ye("applying feature flags",t),t.forEach((n=>{var r;if(this.we&&(r=this.we)!=null&&r.has(n)){var a,s=this._instance.getFeatureFlag(n),i=(a=this.we)==null?void 0:a.get(n);s&&i!=null&&i.variants[s]&&this.Ee(i.name,s,i.variants[s].transforms)}}))}}previewWebExperiment(){var t=Il.getWindowLocation();if(t!=null&&t.search){var n=z3(t?.search,"__experiment_id"),r=z3(t?.search,"__experiment_variant");n&&r&&(Il.ye("previewing web experiments "+n+" && "+r),this.getWebExperiments((a=>{this.xe(parseInt(n),r,a)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this._instance.config.disable_web_experiments&&!r)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return t([]);var i=s.json.experiments||[];return t(i)}})}xe(t,n,r){var a=r.filter((s=>s.id===t));a&&a.length>0&&(Il.ye("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.Ee(a[0].name,n,a[0].variants[n].transforms))}static Se(t){return!sa(t.conditions)&&Il.$e(t)&&Il.ke(t)}static $e(t){var n;if(sa(t.conditions)||sa((n=t.conditions)==null?void 0:n.url))return!0;var r,a,s,i=Il.getWindowLocation();return!!i&&((r=t.conditions)==null||!r.url||zOr[(a=(s=t.conditions)==null?void 0:s.urlMatchType)!==null&&a!==void 0?a:"icontains"](t.conditions.url,i))}static getWindowLocation(){return rt?.location}static ke(t){var n;if(sa(t.conditions)||sa((n=t.conditions)==null?void 0:n.utm))return!0;var r=Y1t();if(r.utm_source){var a,s,i,l,c,u,d,f,h=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((s=t.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,p=(i=t.conditions)==null||(i=i.utm)==null||!i.utm_source||((l=t.conditions)==null||(l=l.utm)==null?void 0:l.utm_source)==r.utm_source,m=(c=t.conditions)==null||(c=c.utm)==null||!c.utm_medium||((u=t.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,g=(d=t.conditions)==null||(d=d.utm)==null||!d.utm_term||((f=t.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==r.utm_term;return h&&m&&g&&p}return!1}static ye(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];Xt.info("[WebExperiments] "+t,r)}Ee(t,n,r){this._is_bot()?Il.ye("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach((a=>{if(a.selector){var s;Il.ye("applying transform of variant "+n+" for experiment "+t+" ",a);var i=(s=document)==null?void 0:s.querySelectorAll(a.selector);i?.forEach((l=>{var c=l;a.html&&(c.innerHTML=a.html),a.css&&c.setAttribute("style",a.css)}))}})):Il.ye("Control variants leave the page unmodified.")}_is_bot(){return yd&&this._instance?cOt(yd,this._instance.config.custom_blocked_useragents):void 0}}var hf=vi("[Conversations]"),N8={featureFlags:class{constructor(e){this.Pe=!1,this.Te=!1,this.Re=!1,this.Ie=!1,this.Ce=!1,this.Oe=!1,this.Fe=!1,this.Me=!1,this._instance=e,this.featureFlagEventHandlers=[]}Ae(){var e,t;return(e=(t=this._instance.persistence)==null?void 0:t.nt(this._instance.config.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}De(){return!!this.Ae()&&(this.Me||this.Re||(this.Me=!0,Zc.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Le(){var e,t=(e=this._instance.config.evaluation_contexts)!==null&&e!==void 0?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.Fe||(Zc.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Fe=!0),t!=null&&t.length?t.filter((n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Zc.error("Invalid evaluation context found:",n,"Expected non-empty string"),r})):[]}je(){return this.Le().length>0}initialize(){var e,t,{config:n}=this._instance,r=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var a,s,i=(a=(s=n.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&a!==void 0?a:{},l=Object.keys(r).filter((u=>!!r[u])).reduce(((u,d)=>(u[d]=r[d]||!1,u)),{}),c=Object.keys(i).filter((u=>l[u])).reduce(((u,d)=>(i[d]&&(u[d]=i[d]),u)),{});this.receivedFeatureFlags({featureFlags:l,featureFlagPayloads:c})}}updateFlags(e,t,n){var r=n!=null&&n.merge?this.getFlagVariants():{},a=n!=null&&n.merge?this.getFlagPayloads():{},s=Bt({},r,e),i=Bt({},a,t),l={};for(var[c,u]of Object.entries(s)){var d=typeof u=="string";l[c]={key:c,enabled:!!d||!!u,variant:d?u:void 0,reason:void 0,metadata:Yt(i?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:i[c]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this.Te}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(tie),t=this._instance.get_property(x1),n=this._instance.get_property(tj);if(!n&&!t)return e||{};var r=Hi({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var s of a){var i,l,c=r[s],u=t?.[s],d=Yt(u)?(i=c?.enabled)!==null&&i!==void 0&&i:!!u,f=Yt(u)?c.variant:typeof u=="string"?u:void 0,h=n?.[s],p=Bt({},c,{enabled:d,variant:d?f??c?.variant:void 0});d!==c?.enabled&&(p.original_enabled=c?.enabled),f!==c?.variant&&(p.original_variant=c?.variant),h&&(p.metadata=Bt({},c?.metadata,{payload:h,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),r[s]=p}return this.Pe||(Zc.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.Pe=!0),r}getFlagVariants(){var e=this._instance.get_property(rO),t=this._instance.get_property(x1);if(!t)return e||{};for(var n=Hi({},e),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.Pe||(Zc.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Pe=!0),n}getFlagPayloads(){var e=this._instance.get_property(m8e),t=this._instance.get_property(tj);if(!t)return e||{};for(var n=Hi({},e||{}),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.Pe||(Zc.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Pe=!0),n}reloadFeatureFlags(){this.Ie||this._instance.config.advanced_disable_feature_flags||this.Ne||(this._instance.pi.emit("featureFlagsReloading",!0),this.Ne=setTimeout((()=>{this.Ue()}),5))}ze(){clearTimeout(this.Ne),this.Ne=void 0}ensureFlagsLoaded(){this.Te||this.Re||this.Ne||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Ie=e}Ue(e){var t;if(this.ze(),!this._instance.bt())if(this.Re)this.Ce=!0;else{var n=this._instance.config.token,r=this._instance.get_property("$device_id"),a={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Bt({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(Aj)||{}),group_properties:this._instance.get_property(t0),timezone:nOt()};dp(r)||Yt(r)||(a.$device_id=r),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(a.disable_flags=!0),this.je()&&(a.evaluation_contexts=this.Le());var s=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",i=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+s);this.Re=!0,this._instance._send_request({method:"POST",url:i,data:a,compression:this._instance.config.disable_compression?void 0:Mg.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var c,u,d,f=!0;if(l.statusCode===200&&(this.Ce||(this.$anon_distinct_id=void 0),f=!1),this.Re=!1,!a.disable_flags||this.Ce){this.Oe=!f;var h=[];l.error?l.error instanceof Error?h.push(l.error.name==="AbortError"?POr:MOr):h.push(DOr):l.statusCode!==200&&h.push($Or(l.statusCode)),(c=l.json)!=null&&c.errorsWhileComputingFlags&&h.push(AOr);var p=!((u=l.json)==null||(u=u.quotaLimited)==null||!u.includes(FOr.FeatureFlags));if(p&&h.push(ROr),(d=this._instance.persistence)==null||d.register({[aie]:h}),p)Zc.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var m;a.disable_flags||this.receivedFeatureFlags((m=l.json)!==null&&m!==void 0?m:{},f),this.Ce&&(this.Ce=!1,this.Ue())}}}})}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.Oe)if(this.Te||this.getFlags()&&this.getFlags().length>0){if(!this.De()){var r=this.getFeatureFlagResult(e,t);return(n=r?.variant)!==null&&n!==void 0?n:r?.enabled}}else Zc.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.Oe)if(this.Te||this.getFlags()&&this.getFlags().length>0){if(!this.De()){var n=this.getFlagVariants(),r=e in n,a=n[e],s=this.getFlagPayloads()[e],i=String(a),l=this._instance.get_property(g8e)||void 0,c=this._instance.get_property(M3)||void 0,u=this._instance.get_property(pT)||{};if(this._instance.config.advanced_feature_flags_dedup_per_session){var d,f=this._instance.get_session_id(),h=this._instance.get_property(rie);f&&f!==h&&(u={},(d=this._instance.persistence)==null||d.register({[pT]:u,[rie]:f}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(i))){var p,m,g,v,x,w,O,k,_,C;Ra(u[e])?u[e].push(i):u[e]=[i],(p=this._instance.persistence)==null||p.register({[pT]:u});var T=this.getFeatureFlagDetails(e),j=[...(m=this._instance.get_property(aie))!==null&&m!==void 0?m:[]];Yt(a)&&j.push(IOr);var A={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:s||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((g=this._instance.config.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[e])||null,$feature_flag_bootstrapped_payload:((v=this._instance.config.bootstrap)==null||(v=v.featureFlagPayloads)==null?void 0:v[e])||null,$used_bootstrap_value:!this.Oe};Yt(T==null||(x=T.metadata)==null?void 0:x.version)||(A.$feature_flag_version=T.metadata.version);var I,P=(w=T==null||(O=T.reason)==null?void 0:O.description)!==null&&w!==void 0?w:T==null||(k=T.reason)==null?void 0:k.code;P&&(A.$feature_flag_reason=P),T!=null&&(_=T.metadata)!=null&&_.id&&(A.$feature_flag_id=T.metadata.id),Yt(T?.original_variant)&&Yt(T?.original_enabled)||(A.$feature_flag_original_response=Yt(T.original_variant)?T.original_enabled:T.original_variant),T!=null&&(C=T.metadata)!=null&&C.original_payload&&(A.$feature_flag_original_payload=T==null||(I=T.metadata)==null?void 0:I.original_payload),j.length&&(A.$feature_flag_error=j.join(",")),this._instance.capture("$feature_flag_called",A)}if(r){var M=s;if(!Yt(s))try{M=JSON.parse(s)}catch{}return{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:M}}}}else Zc.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var n=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.je()&&(r.evaluation_contexts=this.Le()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this._instance.config.disable_compression?void 0:Mg.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:a=>{var s,i=(s=a.json)==null?void 0:s.featureFlagPayloads;t(i?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.Oe){if(this.Te||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return Yt(n)?void 0:!!n}Zc.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.Te=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),a=this.getFlagsWithDetails();(function(s,i,l,c,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var d=LOr(s),f=d.flags,h=d.featureFlags,p=d.featureFlagPayloads;if(h){var m=s.requestId,g=s.evaluatedAt;if(Ra(h)){Zc.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(h)for(var x=0;x<h.length;x++)v[h[x]]=!0;i&&i.register({[bee]:h,[rO]:v})}else{var w=h,O=p,k=f;if(s.errorsWhileComputingFlags)if(f){var _=new Set(Object.keys(f).filter((C=>{var T;return!((T=f[C])!=null&&T.failed)})));w=Bt({},l,Object.fromEntries(Object.entries(w).filter((C=>{var[T]=C;return _.has(T)})))),O=Bt({},c,Object.fromEntries(Object.entries(O||{}).filter((C=>{var[T]=C;return _.has(T)})))),k=Bt({},u,Object.fromEntries(Object.entries(k||{}).filter((C=>{var[T]=C;return _.has(T)}))))}else w=Bt({},l,w),O=Bt({},c,O),k=Bt({},u,k);i&&i.register(Bt({[bee]:Object.keys(v8e(w)),[rO]:w||{},[m8e]:O||{},[tie]:k||{}},m?{[g8e]:m}:{},g?{[M3]:g}:{}))}}})(e,this._instance.persistence,n,r,a),t||(this.Me=!1),this.He(t)}}override(e,t){t===void 0&&(t=!1),Zc.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Zc.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(x1),this._instance.persistence.unregister(tj),this.He(),ej.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;if(this.Pe=!!((t=n.suppressWarning)!==null&&t!==void 0&&t),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister(x1),ej.info("Flag overrides cleared");else if(n.flags){if(Ra(n.flags)){for(var r={},a=0;a<n.flags.length;a++)r[n.flags[a]]=!0;this._instance.persistence.register({[x1]:r})}else this._instance.persistence.register({[x1]:n.flags});ej.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(tj),ej.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[tj]:n.payloads}),ej.info("Payload overrides set",{payloads:n.payloads}))),void this.He()}this.He()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Te){var{flags:t,flagVariants:n}=this.Be();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,a=(this._instance.get_property(Nj)||[]).find((c=>c.flagKey===e)),s={["$feature_enrollment/"+e]:t},i={$feature_flag:e,$feature_enrollment:t,$set:s};a&&(i.$early_access_feature_name=a.name),n&&(i.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",i),this.setPersonPropertiesForFlags(s,!1);var l=Bt({},this.getFlagVariants(),{[e]:t});(r=this._instance.persistence)==null||r.register({[bee]:Object.keys(v8e(l)),[rO]:l}),this.He()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(Nj),a=n?"&"+n.map((s=>"stage="+s)).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+a),method:"GET",callback:s=>{var i,l;if(s.json){var c=s.json.earlyAccessFeatures;return(i=this._instance.persistence)==null||i.unregister(Nj),(l=this._instance.persistence)==null||l.register({[Nj]:c}),e(c)}}})}Be(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((n=>t[n])),flagVariants:Object.keys(t).filter((n=>t[n])).reduce(((n,r)=>(n[r]=t[r],n)),{})}}He(e){var{flags:t,flagVariants:n}=this.Be();this.featureFlagEventHandlers.forEach((r=>r(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(Aj)||{};this._instance.register({[Aj]:Bt({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Aj)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(t0)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((r=>{n[r]=Bt({},n[r],e[r]),delete e[r]})),this._instance.register({[t0]:Bt({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(t0)||{};this._instance.register({[t0]:Bt({},t,{[e]:{}})})}else this._instance.unregister(t0)}reset(){this.Te=!1,this.Re=!1,this.Ie=!1,this.Ce=!1,this.Oe=!1,this.$anon_distinct_id=void 0,this.ze(),this.Pe=!1}}},BOr={sessionRecording:class{get started(){var e;return!((e=this.qe)==null||!e.isStarted)}get status(){var e,t;return this.Ve===JC||this.Ve===g2?this.Ve:(e=(t=this.qe)==null?void 0:t.status)!==null&&e!==void 0?e:this.Ve}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ve=c8e,this.We=void 0,this._instance=e,!this._instance.sessionManager)throw Qx.error("started without valid sessionManager"),new Error(gie+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(gie+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ge(){var e,t=!((e=this._instance.get_property(d2))==null||!e.enabled),n=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return rt&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!this.Ge||(t=this.qe)==null||!t.isStarted){var n=!Yt(Object.assign)&&!Yt(Array.from);this.Ge&&n?(this.Ye(e),Qx.info("starting")):(this.Ve=c8e,this.stopRecording())}}Ye(e){var t,n,r;this.Ge&&(this.Ve!==JC&&this.Ve!==g2&&(this.Ve=u8e),Bn!=null&&(t=Bn.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Bn.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Je(e):(r=Bn.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Ke,(a=>{if(a)return Qx.error("could not load recorder",a);this.Je(e)})))}stopRecording(){var e,t;(e=this.We)==null||e.call(this),this.We=void 0,(t=this.qe)==null||t.stop()}Xe(){var e,t;(e=this.We)==null||e.call(this),this.We=void 0,(t=this.qe)==null||t.discard()}Qe(){var e;(e=this._instance.persistence)==null||e.unregister(H1t)}Ze(e,t){if(sa(e))return null;var n,r=Tm(e)?e:parseFloat(e);return typeof(n=r)=="number"&&Number.isFinite(n)&&n>=0&&n<=1?r:(Qx.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null)}tr(e){if(this._instance.persistence){var t,n,r=this._instance.persistence,a=()=>{var s,i=e.sessionRecording===!1?void 0:e.sessionRecording,l=this.Ze((s=this._instance.config.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),c=this.Ze(i?.sampleRate,"remote config sampleRate"),u=l??c;sa(u)&&this.Qe();var d=i?.minimumDurationMilliseconds;r.register({[d2]:Bt({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:Bt({capturePerformance:e.capturePerformance},i?.networkPayloadCapture),canvasRecording:{enabled:i?.recordCanvas,fps:i?.canvasFps,quality:i?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:Yt(d)?null:d,endpoint:i?.endpoint,triggerMatchType:i?.triggerMatchType,masking:i?.masking,urlTriggers:i?.urlTriggers})})};a(),(t=this.We)==null||t.call(this),this.We=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(a)}}onRemoteConfig(e){return"sessionRecording"in e?e.sessionRecording===!1?(this.tr(e),void this.Xe()):(this.tr(e),void this.startIfEnabledOrStop()):(this.Ve===JC&&(this.Ve=g2,Qx.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t="log"),(n=this.qe)!=null&&n.log?this.qe.log(e,t):Qx.warn("log called before recorder was ready")}get Ke(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(d2);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}ir(){var e,t=this._instance.get_property(d2);if(!t)return!1;var n=(e=(typeof t=="object"?t:JSON.parse(t)).cache_timestamp)!==null&&e!==void 0?e:Date.now();return Date.now()-n<=36e5}Je(e){var t,n;if((t=Bn.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");if(this.qe||(this.qe=(n=Bn.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.qe._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ir())return this.Ve===g2||this.Ve===JC?void 0:(this.Ve=JC,Qx.info("persisted remote config is stale, requesting fresh config before starting"),void new rOt(this._instance).load());this.Ve=u8e,this.qe.start(e)}onRRwebEmit(e){var t;(t=this.qe)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.qe||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.qe)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.qe||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.qe)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.qe||(n=this._instance.persistence)==null||n.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.qe)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.qe)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.qe)==null||!n.tryAddCustomEvent(e,t))}}},UOr={autocapture:class{constructor(e){this.er=!1,this.rr=null,this.sr=!1,this.instance=e,this.rageclicks=new s8e(e.config.rageclick),this.nr=null}initialize(){this.startIfEnabled()}get N(){var e,t,n=No(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((r=>new RegExp(r))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((r=>new RegExp(r))),n}ar(){if(this.isBrowserSupported()){if(rt&&Wt){var e=n=>{n=n||rt?.event;try{this.lr(n)}catch(r){i8e.error("Failed to capture event",r)}};if(ro(Wt,"submit",e,{capture:!0}),ro(Wt,"change",e,{capture:!0}),ro(Wt,"click",e,{capture:!0}),this.N.capture_copied_text){var t=n=>{n=n||rt?.event,this.lr(n,gee)};ro(Wt,"copy",t,{capture:!0}),ro(Wt,"cut",t,{capture:!0})}}}else i8e.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.er&&(this.ar(),this.er=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.sr=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Tze]:!!e.autocapture_opt_out}),this.rr=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.nr=e}getElementSelectors(e){var t,n=[];return(t=this.nr)==null||t.forEach((r=>{var a=Wt?.querySelectorAll(r);a?.forEach((s=>{e===s&&n.push(r)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Tze],r=this.rr;if(dp(r)&&!Xg(n)&&!this.instance.bt())return!1;var a=(t=this.rr)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!a}lr(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,r=t8e(e);pOt(r)&&(r=r.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&hOr(r,this.instance.config.rageclick)&&this.lr(e,"$rageclick");var a=t===gee;if(r&&pOr(r,e,this.N,a,a?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:i}=OOr(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.N.element_attribute_ignorelist,elementsChainAsString:this.sr});if(i)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(s.$element_selectors=l),t===gee){var c,u=gOt(rt==null||(c=rt.getSelection())==null?void 0:c.toString()),d=e.type||"clipboard";if(!u)return!1;s.$selected_content=u,s.$copy_type=d}return this.instance.capture(t,s),!0}}}isBrowserSupported(){return Bg(Wt?.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.ur=(rt==null||(t=rt.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Xt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.hr&&this.hr(),this.hr=void 0,Xt.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(rt&&rt.history){var n=this;(e=rt.history.pushState)!=null&&e.__posthog_wrapped__||o8e(rt.history,"pushState",(r=>function(a,s,i){r.call(this,a,s,i),n.dr("pushState")})),(t=rt.history.replaceState)!=null&&t.__posthog_wrapped__||o8e(rt.history,"replaceState",(r=>function(a,s,i){r.call(this,a,s,i),n.dr("replaceState")})),this.vr()}}dr(e){try{var t,n=rt==null||(t=rt.location)==null?void 0:t.pathname;if(!n)return;n!==this.ur&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ur=n}catch(r){Xt.error("Error capturing "+e+" pageview",r)}}vr(){if(!this.hr){var e=()=>{this.dr("popstate")};ro(rt,"popstate",e),this.hr=()=>{rt&&rt.removeEventListener("popstate",e)}}}},heatmaps:class{constructor(e){var t;this.cr=!1,this.er=!1,this.pr=null,this.instance=e,this.cr=!((t=this.instance.persistence)==null||!t.props[Jse]),this.rageclicks=new s8e(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return No(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return sa(this.instance.config.capture_heatmaps)?sa(this.instance.config.enable_heatmaps)?this.cr:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.er)return;_Or.info("starting..."),this._r(),this.gr()}else{var e;clearInterval((e=this.pr)!==null&&e!==void 0?e:void 0),this.mr(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Jse]:t}),this.cr=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.C;return this.C=void 0,e}br(e){this.yr(e.originalEvent,"deadclick")}gr(){this.pr&&clearInterval(this.pr),this.pr=(function(e){return e?.visibilityState==="visible"})(Wt)?setInterval(this.Ft.bind(this),this.flushIntervalMilliseconds):null}_r(){rt&&Wt&&(this.wr=this.Ft.bind(this),ro(rt,"beforeunload",this.wr),this.Er=e=>this.yr(e||rt?.event),ro(Wt,"click",this.Er,{capture:!0}),this.Sr=e=>this.$r(e||rt?.event),ro(Wt,"mousemove",this.Sr,{capture:!0}),this.kr=new $ze(this.instance,I1r,this.br.bind(this)),this.kr.startIfEnabledOrStop(),this.Pr=this.gr.bind(this),ro(Wt,"visibilitychange",this.Pr),this.er=!0)}mr(){var e;rt&&Wt&&(this.wr&&rt.removeEventListener("beforeunload",this.wr),this.Er&&Wt.removeEventListener("click",this.Er,{capture:!0}),this.Sr&&Wt.removeEventListener("mousemove",this.Sr,{capture:!0}),this.Pr&&Wt.removeEventListener("visibilitychange",this.Pr),clearTimeout(this.Tr),(e=this.kr)==null||e.stop(),this.er=!1)}Rr(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),s=(function(i,l,c){for(var u=i;u&&T8(u)&&!fb(u,"body");){if(u===c)return!1;if(Zr(l,rt?.getComputedStyle(u).position))return!0;u=yOt(u)}return!1})(t8e(e),["fixed","sticky"],a);return{x:e.clientX+(s?0:r),y:e.clientY+(s?0:n),target_fixed:s,type:t}}yr(e,t){var n;if(t===void 0&&(t="click"),!Jze(e.target)&&d8e(e)){var r=this.Rr(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Ir(Bt({},r,{type:"rageclick"})),this.Ir(r)}}$r(e){!Jze(e.target)&&d8e(e)&&(clearTimeout(this.Tr),this.Tr=setTimeout((()=>{this.Ir(this.Rr(e,"mousemove"))}),500))}Ir(e){if(rt){var t=rt.location.href,n=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,a=n?t_([],n_,r||[]):[],s=RA(t,a,PA);this.C=this.C||{},this.C[s]||(this.C[s]=[]),this.C[s].push(e)}}Ft(){this.C&&!nO(this.C)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:$ze,webVitalsAutocapture:class{constructor(e){var t;this.cr=!1,this.er=!1,this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Cr=()=>{clearTimeout(this.Or),this.C.metrics.length!==0&&(this._instance.capture("$web_vitals",this.C.metrics.reduce(((n,r)=>Bt({},n,{["$web_vitals_"+r.name+"_event"]:Bt({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Fr=n=>{var r,a=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(Yt(a))Oy.error("Could not read session ID. Dropping metrics!");else{this.C=this.C||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.Mr();Yt(s)||(sa(n?.name)||sa(n?.value)?Oy.error("Invalid metric received",n):this.Ar&&n.value>=this.Ar?Oy.error("Ignoring metric with value >= "+this.Ar,n):(this.C.url!==s&&(this.Cr(),this.Or=setTimeout(this.Cr,this.flushToCaptureTimeoutMs)),Yt(this.C.url)&&(this.C.url=s),this.C.firstMetricTimestamp=Yt(this.C.firstMetricTimestamp)?Date.now():this.C.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.C.metrics.push(Bt({},n,{$current_url:s,$session_id:a.sessionId,$window_id:a.windowId,timestamp:Date.now()})),this.C.metrics.length===this.allowedMetrics.length&&this.Cr()))}},this.Dr=()=>{if(!this.er){var n,r,a,s,i=Bn.__PosthogExtensions__;Yt(i)||Yt(i.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:a,onINP:s}=i.postHogWebVitalsCallbacks),n&&r&&a&&s?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Fr.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Fr.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Fr.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.Fr.bind(this)),this.er=!0):Oy.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.cr=!((t=this._instance.persistence)==null||!t.props[Ize]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=No(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return sa(n)?((t=this._instance.persistence)==null?void 0:t.props[Pze])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(No(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=No(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Ar(){var e=No(this._instance.config.capture_performance)&&Tm(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:l8e;return 0<e&&e<=6e4?l8e:e}get isEnabled(){var e=vl?.protocol;if(e!=="http:"&&e!=="https:")return Oy.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=No(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Xg(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Xg(t)?t:this.cr}startIfEnabled(){this.isEnabled&&!this.er&&(Oy.info("enabled, starting..."),this.G(this.Dr))}onRemoteConfig(e){if("capturePerformance"in e){var t=No(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=No(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ize]:t}),this._instance.persistence.register({[Pze]:n})),this.cr=t,this.startIfEnabled()}}G(e){var t,n;if((t=Bn.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var r=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=Bn.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,r,(a=>{a?Oy.error("failed to load script",a):e()}))}}Mr(){var e=rt?rt.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,n=this._instance.config.custom_personal_data_properties,r=t?t_([],n_,n||[]):[];return RA(e,r,PA)}Oy.error("Could not determine current URL")}}},qOr={exceptionObserver:class{constructor(e){var t,n,r;this.Dr=()=>{var a;if(rt&&this.isEnabled&&(a=Bn.__PosthogExtensions__)!=null&&a.errorWrappingFunctions){var s=Bn.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Bn.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=Bn.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Lr&&this.N.capture_unhandled_errors&&(this.Lr=s(this.captureException.bind(this))),!this.jr&&this.N.capture_unhandled_rejections&&(this.jr=i(this.captureException.bind(this))),!this.Nr&&this.N.capture_console_errors&&(this.Nr=l(this.captureException.bind(this)))}catch(c){KC.error("failed to start",c),this.Ur()}}},this._instance=e,this.zr=!((t=this._instance.persistence)==null||!t.props[Nze]),this.Hr=new zSr({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,h:KC}),this.N=this.Br(),this.startIfEnabledOrStop()}Br(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return No(e)?t=Bt({},t,e):(Yt(e)?this.zr:e)&&(t=Bt({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.N.capture_console_errors||this.N.capture_unhandled_errors||this.N.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(KC.info("enabled"),this.Ur(),this.G(this.Dr)):this.Ur()}G(e){var t,n;(t=Bn.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=Bn.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return KC.error("failed to load script",r);e()}))}Ur(){var e,t,n;(e=this.Lr)==null||e.call(this),this.Lr=void 0,(t=this.jr)==null||t.call(this),this.jr=void 0,(n=this.Nr)==null||n.call(this),this.Nr=void 0}onRemoteConfig(e){if("autocaptureExceptions"in e){var t=e.autocaptureExceptions;this.zr=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[Nze]:this.zr}),this.N=this.Br(),this.startIfEnabledOrStop()}}onConfigChange(){this.N=this.Br()}captureException(e){var t,n,r,a=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.Hr.consumeRateLimit(a)?KC.info("Skipping exception capture because of client rate limiting.",{exception:a}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.qr=[],this.Vr=new JSr([new l1r,new v1r,new u1r,new c1r,new m1r,new p1r,new f1r,new g1r],o1r()),this._instance=e,this.qr=(t=(n=this._instance.persistence)==null?void 0:n.get_property(eie))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,n,r;if("errorTracking"in e){var a=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],s=(r=e.errorTracking)==null?void 0:r.captureExtensionExceptions;this.qr=a,this._instance.persistence&&this._instance.persistence.register({[eie]:this.qr,[Aze]:s})}}get Wr(){var e,t=!!this._instance.get_property(Aze),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Vr.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.Gr(t)){if(this.Yr(t))return void xee.info("Skipping exception capture because a suppression rule matched");if(!this.Wr&&this.Jr(t))return void xee.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Kr(t))return void xee.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",Di:!0})}Yr(e){if(e.length===0)return!1;var t=e.reduce(((n,r)=>{var{type:a,value:s}=r;return lo(a)&&a.length>0&&n.$exception_types.push(a),lo(s)&&s.length>0&&n.$exception_values.push(s),n}),{$exception_types:[],$exception_values:[]});return this.qr.some((n=>{var r=n.values.map((a=>{var s,i=uOt[a.operator],l=Ra(a.value)?a.value:[a.value],c=(s=t[a.key])!==null&&s!==void 0?s:[];return l.length>0&&i(l,c)}));return n.type==="OR"?r.some(Boolean):r.every(Boolean)}))}Jr(e){return e.flatMap((t=>{var n,r;return(n=(r=t.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Kr(e){if(e.length>0){var t,n,r,a,s=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],i=s[s.length-1];return(r=i==null||(a=i.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}Gr(e){return!sa(e)&&Ra(e)}}},VOr=Bt({productTours:class{constructor(e){this.Xr=null,this.Qr=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this._instance.persistence&&this._instance.persistence.register({[Rze]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Xr||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(Rze)||this.G((()=>this.Zr()))}G(e){var t,n;(t=Bn.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Bn.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?f8e.error("Could not load product tours script",r):e()}))}Zr(){var e;!this.Xr&&(e=Bn.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Xr=Bn.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Ra(this.Qr)||t){var n=this._instance.persistence;if(n){var r=n.props[yee];if(Ra(r)&&!t)return this.Qr=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:a=>{var s=a.statusCode;if(s!==200||!a.json){var i="Product Tours API could not be loaded, status: "+s;return f8e.error(i),void e([],{isLoaded:!1,error:i})}var l=Ra(a.json.product_tours)?a.json.product_tours:[];this.Qr=l,n&&n.register({[yee]:l}),e(l,{isLoaded:!0})}})}else e(this.Qr,{isLoaded:!0})}getActiveProductTours(e){sa(this.Xr)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Xr.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Xr)==null||t.showTourById(e)}previewTour(e){this.Xr?this.Xr.previewTour(e):this.G((()=>{var t;this.Zr(),(t=this.Xr)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Xr)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Xr)==null||e.nextStep()}previousStep(){var e;(e=this.Xr)==null||e.previousStep()}clearCache(){var e;this.Qr=null,(e=this._instance.persistence)==null||e.unregister(yee)}resetTour(e){var t;(t=this.Xr)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Xr)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Xr)==null||t.cancelPendingTour(e)}}},N8),HOr={siteApps:class{constructor(e){this._instance=e,this.ts=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}es(e,t){if(t){var n=this.globalsForEvent(t);this.ts.push(n),this.ts.length>1e3&&(this.ts=this.ts.slice(10))}}get siteAppLoaders(){var e;return(e=Bn._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.es.bind(this));this.rs=()=>{e(),this.ts=[],this.rs=void 0}}}globalsForEvent(e){var t,n,r,a,s,i,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var[f,h]of Object.entries(d))c[f]={id:u[f],type:f,properties:h};var{$set_once:p,$set:m}=e;return{event:Bt({},y1t(e,EOr),{properties:Bt({},e.properties,m?{$set:Bt({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},m)}:{},p?{$set_once:Bt({},(r=(a=e.properties)==null?void 0:a.$set_once)!==null&&r!==void 0?r:{},p)}:{}),elements_chain:(s=(i=e.properties)==null?void 0:i.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var i;!t.errored&&this.ts.length&&(ky.info("Processing "+this.ts.length+" events for site app with id "+e.id),this.ts.forEach((l=>t.processEvent==null?void 0:t.processEvent(l))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((i=this.rs)==null||i.call(this))},r=!1,a=i=>{t.errored=!i,t.loaded=!0,ky.info("Site app with id "+e.id+" "+(i?"loaded":"errored")),r&&n()};try{var{processEvent:s}=e.init({posthog:this._instance,callback:i=>{a(i)}});s&&(t.processEvent=s),r=!0}catch(i){ky.error("Error while initializing PostHog app with config id "+e.id,i),a(!1)}if(r&&t.loaded)try{n()}catch(i){ky.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}ss(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}ns(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(r){ky.error("Error while processing event "+e.event+" for site app "+n.id,r)}}}onRemoteConfig(e){var t,n,r,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.ss(),void this._instance.on("eventCaptured",(c=>this.ns(c)))):void ky.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.rs)==null||n.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var s=function(c){var u;Bn["__$$ph_site_app_"+c]=a._instance,(u=Bn.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(a._instance,l,(d=>{if(d)return ky.error("Error while initializing PostHog app with config id "+c,d)}))};for(var{id:i,url:l}of e.siteApps)s(i)}else ky.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},QOr={tracingHeaders:class{constructor(e){this.os=void 0,this.ls=void 0,this.Dr=()=>{var t,n;Yt(this.os)&&((t=Bn.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Yt(this.ls)&&((n=Bn.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}G(e){var t,n;(t=Bn.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=Bn.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return kOr.error("failed to load script",r);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.G(this.Dr):((e=this.os)==null||e.call(this),(t=this.ls)==null||t.call(this),this.os=void 0,this.ls=void 0)}}},WOr=Bt({surveys:class{constructor(e){this.us=void 0,this._surveyManager=null,this.hs=!1,this.ds=[],this.vs=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(sa(t))return gs.warn("Flags not loaded yet. Not loading surveys.");var n=Ra(t);this.us=n?t.length>0:t,gs.info("flags response received, isSurveysEnabled: "+this.us),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(fOt)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((r=>localStorage.removeItem(r)))}loadIfEnabled(){if(!this._surveyManager)if(this.hs)gs.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)gs.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())gs.info("Not loading surveys in cookieless mode without consent.");else{var e=Bn?.__PosthogExtensions__;if(e){if(!Yt(this.us)||this._instance.config.advanced_enable_surveys){var t=this.us||this._instance.config.advanced_enable_surveys;this.hs=!0;try{var n=e.generateSurveys;if(n)return void this.cs(n,t);var r=e.loadExternalDependency;if(!r)return void this.fs("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(a=>{a||!e.generateSurveys?this.fs("Could not load surveys script",a):this.cs(e.generateSurveys,t)}))}catch(a){throw this.fs("Error initializing surveys",a),a}finally{this.hs=!1}}}else gs.error("PostHog Extensions not found.")}}cs(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new TOr(this._instance),gs.info("Surveys loaded successfully"),this.ps({isLoaded:!0})}fs(e,t){gs.error(e,t),this.ps({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.ds.push(e),this._surveyManager&&this.ps({isLoaded:!0}),()=>{this.ds=this.ds.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return gs.info("Disabled. Not loading surveys."),e([]);var n,r=this._instance.get_property(nie);if(r&&!t)return e(r,{isLoaded:!0});typeof Promise<"u"&&this.vs?this.vs.then((a=>{var{surveys:s,context:i}=a;return e(s,i)})):(typeof Promise<"u"&&(this.vs=new Promise((a=>{n=a}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:a=>{var s;this.vs=null;var i=a.statusCode;if(i!==200||!a.json){var l="Surveys API could not be loaded, status: "+i;gs.error(l);var c={isLoaded:!1,error:l};return e([],c),void(n==null||n({surveys:[],context:c}))}var u,d=a.json.surveys||[],f=d.filter((p=>(function(m){return!(!m.start_date||m.end_date)})(p)&&((function(m){var g;return!((g=m.conditions)==null||(g=g.events)==null||(g=g.values)==null||!g.length)})(p)||(function(m){var g;return!((g=m.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(p))));f.length>0&&((u=this._surveyEventReceiver)==null||u.register(f)),(s=this._instance.persistence)==null||s.register({[nie]:d});var h={isLoaded:!0};e(d,h),n?.({surveys:d,context:h})}}))}ps(e){for(var t of this.ds)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){gs.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!sa(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);gs.warn("init was not called")}_s(e){var t=null;return this.getSurveys((n=>{var r;t=(r=n.find((a=>a.id===e)))!==null&&r!==void 0?r:null})),t}gs(e){if(sa(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this._s(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(sa(this._surveyManager))return gs.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.gs(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return sa(this._surveyManager)?(gs.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((n=>{this.getSurveys((r=>{var a,s=(a=r.find((l=>l.id===e)))!==null&&a!==void 0?a:null;if(s){var i=this.gs(s);n({visible:i.eligible,disabledReason:i.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var r;if(sa(this._surveyManager))gs.warn("init was not called");else{var a=typeof e=="string"?this._s(e):e;if(a!=null&&a.id)if(iOr.includes(a.type)){var s=Wt?.querySelector(t);if(s)return(r=a.appearance)!=null&&r.surveyPopupDelaySeconds?(gs.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var i,l;gs.info("Rendering survey "+a.id+" with delay of "+((i=a.appearance)==null?void 0:i.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(a,s,n),gs.info("Survey "+a.id+" rendered")}),1e3*a.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(a,s,n);gs.warn("Survey element not found")}else gs.warn("Surveys of type "+a.type+" cannot be rendered in the app");else gs.warn("Survey not found")}}displaySurvey(e,t){var n;if(sa(this._surveyManager))gs.warn("init was not called");else{var r=this._s(e);if(r){var a=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=Bt({},r,{appearance:Bt({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==cie.Popover&&t.initialResponses&&gs.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var s=this.canRenderSurvey(r);if(!s.visible)return void gs.warn("Survey is not eligible to be displayed: ",s.disabledReason)}t.displayType!==cie.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}else gs.warn("Survey not found")}}cancelPendingSurvey(e){sa(this._surveyManager)?gs.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},N8),GOr={toolbar:class{constructor(e){this.instance=e}bs(e){Bn.ph_toolbar_state=e}ys(){var e;return(e=Bn.ph_toolbar_state)!==null&&e!==void 0?e:jy.UNINITIALIZED}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),U1t(this.instance.config)||!rt||!Wt)return!1;e=e??rt.location,n=n??rt.history;try{if(!t){try{rt.localStorage.setItem("test","test"),rt.localStorage.removeItem("test")}catch{return!1}t=rt?.localStorage}var r,a=NOr||B3(e.hash,"__posthog")||B3(e.hash,"state"),s=a?jze((()=>JSON.parse(atob(decodeURIComponent(a)))))||jze((()=>JSON.parse(decodeURIComponent(a)))):null;return s&&s.action==="ph_authorize"?((r=s).source="url",r&&Object.keys(r).length>0&&(s.desiredHash?e.hash=s.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(h8e)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch{return!1}}ws(e){var t=Bn.ph_load_toolbar||Bn.ph_load_editor;!sa(t)&&Bg(t)?t(e,this.instance):p8e.warn("No toolbar load function found")}loadToolbar(e){var t=!(Wt==null||!Wt.getElementById(Q1t));if(!rt||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=Bt({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(rt.localStorage.setItem(h8e,JSON.stringify(Bt({},r,{source:void 0}))),this.ys()===jy.LOADED)this.ws(r);else if(this.ys()===jy.UNINITIALIZED){var a;this.bs(jy.LOADING),(a=Bn.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(s=>{if(s)return p8e.error("[Toolbar] Failed to load",s),void this.bs(jy.UNINITIALIZED);this.bs(jy.LOADED),this.ws(r)})),ro(rt,"turbolinks:load",(()=>{this.bs(jy.UNINITIALIZED),this.loadToolbar(r)}))}return!0}Es(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},ZOr=Bt({experiments:Il},N8),YOr={conversations:class{constructor(e){this.Ss=void 0,this._conversationsManager=null,this.xs=!1,this.$s=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;sa(t)||(Xg(t)?this.Ss=t:(this.Ss=t.enabled,this.$s=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Ss=void 0,this.$s=null}loadIfEnabled(){if(!(this._conversationsManager||this.xs||this._instance.config.disable_conversations||U1t(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Bn?.__PosthogExtensions__;if(e&&!Yt(this.Ss)&&this.Ss)if(this.$s&&this.$s.token){this.xs=!0;try{var t=e.initConversations;if(t)return this.ks(t),void(this.xs=!1);var n=e.loadExternalDependency;if(!n)return void this.Ps("PostHog loadExternalDependency extension not found.");n(this._instance,"conversations",(r=>{r||!e.initConversations?this.Ps("Could not load conversations script",r):this.ks(e.initConversations),this.xs=!1}))}catch(r){this.Ps("Error initializing conversations",r),this.xs=!1}}else hf.error("Conversations enabled but missing token in remote config.")}}ks(e){if(this.$s)try{this._conversationsManager=e(this.$s,this._instance),hf.info("Conversations loaded successfully")}catch(t){this.Ps("Error completing conversations initialization",t)}else hf.error("Cannot complete initialization: remote config is null")}Ps(e,t){hf.error(e,t),this._conversationsManager=null,this.xs=!1}show(){this._conversationsManager?this._conversationsManager.show():hf.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ss===!0&&!dp(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,n){var r=this;return Cg((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(hf.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return Cg((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(hf.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return Cg((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(hf.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return Cg((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(hf.warn("Conversations not available yet."),null)}))()}requestRestoreLink(e){var t=this;return Cg((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(hf.warn("Conversations not available yet."),null)}))()}restoreFromToken(e){var t=this;return Cg((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(hf.warn("Conversations not available yet."),null)}))()}restoreFromUrlToken(){var e=this;return Cg((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(hf.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}}},XOr={logs:class{constructor(e){var t;this.Ts=!1,this.Rs=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Ts=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!sa(n)&&n&&(this.Ts=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Ts&&!this.Rs){var e=vi("[logs]"),t=Bn?.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(this._instance,"logs",(r=>{var a;r||(a=t.logs)==null||!a.initializeLogs?e.error("Could not load logs script",r):(t.logs.initializeLogs(this._instance),this.Rs=!0)})):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}}},KOr=Bt({},N8,BOr,UOr,qOr,VOr,HOr,WOr,QOr,GOr,ZOr,YOr,XOr);Wp.__defaultExtensionClasses=Bt({},KOr);var y8e,Dg=(y8e=gT[M1]=new Wp,(function(){function e(){e.done||(e.done=!0,hOt=!1,Rs(gT,(function(t){t._dom_loaded()})))}Wt!=null&&Wt.addEventListener?Wt.readyState==="complete"?e():ro(Wt,"DOMContentLoaded",e,{capture:!1}):rt&&Xt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),y8e),_Ot=b.createContext({client:Dg,bootstrap:void 0});function EOt(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(var s=0,i=r;s<i.length;s++){var l=i[s];if(!a.includes(l)||!EOt(e[l],t[l],n))return!1}return!0}function JOr(e){var t,n,r=e.children,a=e.client,s=e.apiKey,i=e.options,l=b.useRef(null),c=b.useMemo(function(){return a?(s&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),i&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),a):(s||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),Dg)},[a,s,JSON.stringify(i)]);return b.useEffect(function(){if(!a){var u=l.current;u?(s!==u.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),i&&!EOt(i,u.options)&&Dg.set_config(i),l.current={apiKey:s,options:i??{}}):(Dg.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),Dg.init(s,i),l.current={apiKey:s,options:i??{}})}},[a,s,JSON.stringify(i)]),Ne.createElement(_Ot.Provider,{value:{client:c,bootstrap:(t=i?.bootstrap)!==null&&t!==void 0?t:(n=a?.config)===null||n===void 0?void 0:n.bootstrap}},r)}var wee=function(e){return typeof e=="function"},vie=function(e,t){return vie=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(n[a]=r[a])},vie(e,t)};function ekr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");vie(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var tkr={componentStack:null,exceptionEvent:null,error:null},nkr={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){ekr(t,e);function t(n){var r=e.call(this,n)||this;return r.state=tkr,r}return t.prototype.componentDidCatch=function(n,r){var a=this.props.additionalProperties,s;wee(a)?s=a(n):typeof a=="object"&&(s=a);var i=this.context.client,l=i.captureException(n,s),c=r.componentStack;this.setState({error:n,componentStack:c??null,exceptionEvent:l})},t.prototype.render=function(){var n=this.props,r=n.children,a=n.fallback,s=this.state;if(s.componentStack==null)return wee(r)?r():r;var i=wee(a)?Ne.createElement(a,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent}):a;return Ne.isValidElement(i)?i:(console.warn(nkr.INVALID_FALLBACK),Ne.createElement(Ne.Fragment,null))},t.contextType=_Ot,t})(Ne.Component);function rkr({children:e}){return b.useEffect(()=>{if("brave"in navigator){console.info("[Analytics]: Telemetry is disabled for browser constraints.");return}if(window.MASTRA_TELEMETRY_DISABLED){console.info("[Analytics]: Telemetry is disabled.");return}Dg.init("phc_SBLpZVAB6jmHOct9CABq3PF0Yn5FU3G2FgT4xUr2XrT",{api_host:"https://us.posthog.com"}),Dg.register({mastraSource:"playground"})},[]),o.jsx(JOr,{client:Dg,children:e})}const akr=["/swagger-ui","/openapi.json"],COt=b.forwardRef(({children:e,href:t,...n},r)=>t&&akr.some(s=>t.startsWith(s))?o.jsx("a",{ref:r,href:t,...n,children:e}):o.jsx(Vt,{ref:r,to:t,viewTransition:!0,...n,children:e}));function skr(){const{data:e={},isLoading:t,error:n}=cp(),[r,a]=b.useState(""),{canCreateAgent:s}=Dxt(),{Link:i,paths:l}=rn(),c=l.cmsAgentCreateLink(),u=s&&!!c;return o.jsxs(ja,{children:[o.jsxs(ja.Top,{children:[o.jsxs(ft,{withMargins:!1,children:[o.jsx(ft.Column,{children:o.jsxs(ft.Title,{isLoading:t,children:[o.jsx(Xs,{})," Agents"]})}),o.jsxs(ft.Column,{className:"flex justify-end gap-2",children:[u&&o.jsx(Ni,{as:i,to:c,tooltipContent:"Create an agent",children:o.jsx(Lle,{})}),o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/agents/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Agents documentation",children:o.jsx(Sl,{})})]})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(zh,{onSearch:a,label:"Filter agents",placeholder:"Filter by name or instructions"})})]}),o.jsx(Opr,{agents:e,isLoading:t,error:n,search:r})]})}function ikr({agentId:e,threadId:t,threads:n,isLoading:r}){const{mutateAsync:a}=Oor(),{paths:s,navigate:i}=rn(),l=async c=>{await a({threadId:c,agentId:e}),c===t&&i(s.agentNewThreadLink(e))};return o.jsx(wcr,{resourceId:e,resourceType:"agent",threads:n||[],isLoading:r,threadId:t,onDelete:l})}function b8e(){const{agentId:e,threadId:t}=ss(),[n]=Di(),{data:r,isLoading:a,error:s}=Hd(e),{data:i}=nE(e),l=Lc(),c=t==="new",u=b.useMemo(()=>Qi(),[t]),d=!!i?.result,{data:f,isLoading:h,refetch:p}=Pxt({agentId:e,isMemoryEnabled:d,resourceId:e});b.useEffect(()=>{t||l(`/agents/${e}/chat/new`)},[t,e,l]);const m=n.get("messageId")??void 0,g=b.useMemo(()=>{if(!r)return{modelSettings:{}};const w=r.defaultOptions,{maxOutputTokens:O,...k}=w?.modelSettings??{};return{modelSettings:{...k,...O!==void 0&&{maxTokens:O},...w?.maxSteps!==void 0&&{maxSteps:w.maxSteps},...w?.providerOptions!==void 0&&{providerOptions:w.providerOptions}}}},[r]);if(s&&Yi(s))return o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})});if(s&&Va(s))return o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"agents"})});if(a)return null;if(!r)return o.jsx("div",{className:"text-center py-4",children:"Agent not found"});if(!t)return null;const v=c?u:t,x=async()=>{await p(),c&&l(`/agents/${e}/chat/${u}`)};return o.jsx(yge,{entityId:e,entityType:"agent",children:o.jsx(rge,{agentId:e,defaultSettings:g,children:o.jsx(TR,{children:o.jsx(kxt,{agentId:e,threadId:v,resourceId:e,children:o.jsx(cxt,{children:o.jsx(Tge,{agentId:e,threadId:v,children:o.jsx(bxt,{children:o.jsx(jxt,{children:o.jsx(oxt,{children:o.jsx(cur,{agentId:e,leftSlot:d&&o.jsx(ikr,{agentId:e,threadId:v,threads:f||[],isLoading:h}),browserOverlay:o.jsx(fur,{}),rightSlot:o.jsx(iur,{agentId:e,threadId:v}),children:o.jsx(Ige,{agentId:e,agentName:r?.name,modelVersion:r?.modelVersion,threadId:v,memory:d,refreshThreadList:x,modelList:r?.modelList,messageId:m,isNewThread:c},v)})},`${e}-${v}`)})})},`session-${e}-${v}`)},`browser-${e}-${v}`)})})})})}const v2="__custom__",okr=()=>{const e=rxt(),{requestContext:t,setRequestContext:n}=Br(),r=b.useMemo(()=>{if(!e)return v2;const s=JSON.stringify(t??{});for(const[i,l]of Object.entries(e))if(JSON.stringify(l)===s)return i;return v2},[e,t]),a=s=>{if(s===v2){n({});return}if(!e)return;const i=e[s];i&&n(i)};return o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(ub,{className:"h-5 w-8 shrink-0"}),"Mastra Studio",o.jsx(zse,{})]}),e&&Object.keys(e).length>0&&o.jsx(Ci,{children:o.jsxs(Gs,{value:r,onValueChange:a,children:[o.jsx(Ms,{size:"sm",className:"w-[200px]",children:o.jsx(Zs,{placeholder:"Select a preset..."})}),o.jsxs(Ds,{children:[o.jsx(Kr,{value:v2,children:"Custom"}),Object.keys(e).map(s=>o.jsx(Kr,{value:s,children:s},s))]})]})})]})};function x8e(){const{agentId:e,threadId:t}=ss(),[n]=Di(),{data:r,isLoading:a}=Hd(e),{data:s}=nE(e),i=Lc(),l=t==="new",c=b.useMemo(()=>Qi(),[t]),u=!!s?.result,{refetch:d}=Pxt({resourceId:e,agentId:e,isMemoryEnabled:u});b.useEffect(()=>{u&&(t||i(`/agents/${e}/session/new`))},[u,t,e,i]);const f=n.get("messageId")??void 0,h=b.useMemo(()=>{if(!r)return{modelSettings:{}};const g=r.defaultOptions,{maxOutputTokens:v,...x}=g?.modelSettings??{};return{modelSettings:{...x,...v!==void 0&&{maxTokens:v},...g?.maxSteps!==void 0&&{maxSteps:g.maxSteps},...g?.providerOptions!==void 0&&{providerOptions:g.providerOptions}}}},[r]);if(a)return null;if(!r)return o.jsx("div",{className:"text-center py-4",children:"Agent not found"});const p=l?c:t??c,m=async()=>{await d(),l&&i(`/agents/${e}/session/${c}`)};return o.jsx(yge,{entityId:e,entityType:"agent",children:o.jsx(rge,{agentId:e,defaultSettings:h,children:o.jsx(TR,{children:o.jsx(kxt,{agentId:e,threadId:p,resourceId:e,children:o.jsx(cxt,{children:o.jsx(Tge,{agentId:e,threadId:p,children:o.jsx(bxt,{children:o.jsx(jxt,{children:o.jsx(oxt,{children:o.jsxs(ln,{children:[o.jsx(okr,{}),o.jsx("div",{className:"grid overflow-y-auto relative bg-surface1 h-full pt-6",children:o.jsx(Ige,{agentId:e,agentName:r?.name,modelVersion:r?.modelVersion,threadId:p,memory:u,refreshThreadList:m,modelList:r?.modelList,messageId:f,isNewThread:l,hideModelSwitcher:!0},p)})]})})})})},`session-${e}-${p}`)},`browser-${e}-${p}`)})})})})}function lkr(){const{agentId:e}=ss(),{navigate:t}=rn(),{data:n,isLoading:r,error:a}=Hd(e),{data:s,isLoading:i}=Lge(e,{status:"draft"}),l=n?.source==="code",c=r||i,u=b.useMemo(()=>s||(n?Hge(n):{}),[s,n]),{form:d,handlePublish:f,handleSaveDraft:h,isSubmitting:p,isSavingDraft:m}=g8({mode:"edit",agentId:e??"",dataSource:u,isCodeAgentOverride:l,hasStoredOverride:l&&!!s,onSuccess:()=>{}}),[g,v]=b.useState(()=>{const x=sessionStorage.getItem(`pending-scorer-items-${e}`);if(x){sessionStorage.removeItem(`pending-scorer-items-${e}`);try{return JSON.parse(x)}catch{return null}}return null});return a&&Yi(a)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})}):a&&Va(a)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"agents"})}):c?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Pt,{className:"h-6 w-6"})}):n?o.jsx(Nge,{form:d,mode:"edit",agentId:e,isSubmitting:p,isSavingDraft:m,handlePublish:f,handleSaveDraft:h,isCodeAgentOverride:l,readOnly:!1,children:o.jsx(Khr,{agentId:e,onSwitchToReview:()=>t(`/agents/${e}/review`),pendingScorerItems:g,onPendingScorerItemsConsumed:()=>v(null)})}):o.jsx("div",{className:"text-center py-4",children:"Agent not found"})}function ckr(){const{agentId:e}=ss(),[t,n]=b.useState(null),{data:r,isLoading:a,error:s}=Hd(e),{data:i,isLoading:l}=Lge(e,{status:"draft"}),{data:c}=nE(e),u=r?.source==="code",d=a||l,f=!!c?.result,{data:h}=f0t({agentId:e??"",versionId:t??""}),{data:p}=aE({agentId:e??"",params:{sortDirection:"DESC"}}),m=i?.activeVersionId,g=p?.versions?.[0],v=!!(g&&g.id!==m),x=!!t&&!!h,w=x&&t!==g?.id,O=b.useMemo(()=>x&&h?h:i||(r?Hge(r):{}),[x,h,i,r]),{form:k,handlePublish:_,handleSaveDraft:C,isSubmitting:T,isSavingDraft:j,isDirty:A}=g8({mode:"edit",agentId:e??"",dataSource:O,isCodeAgentOverride:u,hasStoredOverride:u&&!!i,onSuccess:()=>{}}),I=b.useCallback(P=>{P===g?.id?n(null):n(P)},[g?.id]);return s&&Yi(s)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})}):s&&Va(s)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"agents"})}):d?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Pt,{className:"h-6 w-6"})}):r?o.jsx(Nge,{form:k,mode:"edit",agentId:e,isSubmitting:T,isSavingDraft:j,handlePublish:_,handleSaveDraft:C,isCodeAgentOverride:u,readOnly:w,children:o.jsx(Wfr,{agentId:e,agentName:r?.name,modelVersion:r?.modelVersion,agentVersionId:t??g?.id,hasMemory:f,activeVersionId:m,selectedVersionId:t??void 0,latestVersionId:g?.id,onVersionSelect:I,isDirty:A,isSavingDraft:j,isPublishing:T,hasDraft:v,readOnly:w,onSaveDraft:C,onPublish:_})}):o.jsx("div",{className:"text-center py-4",children:"Agent not found"})}function ukr(){const{agentId:e}=ss(),{navigate:t}=rn(),{data:n,isLoading:r,error:a}=Hd(e);if(a&&Yi(a))return o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})});if(a&&Va(a))return o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"agents"})});if(r)return o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Pt,{className:"h-6 w-6"})});if(!n)return o.jsx("div",{className:"text-center py-4",children:"Agent not found"});const s=i=>{sessionStorage.setItem(`pending-scorer-items-${e}`,JSON.stringify(i)),t(`/agents/${e}/evaluate`)};return o.jsx(spr,{agentId:e,onCreateScorer:s})}function dkr(){const{agentId:e}=ss(),[t]=Di();return o.jsx(wpr,{agentId:e,basePath:`/agents/${e}/traces`,initialTraceId:t.get("traceId")||void 0,initialSpanId:t.get("spanId")||void 0,initialSpanTab:t.get("tab")||void 0,initialScoreId:t.get("scoreId")||void 0})}function fkr(){return o.jsx(Mdr,{})}function hkr(){const{navigate:e,paths:t}=rn(),n=$c(),{form:r,handlePublish:a,isSubmitting:s,canPublish:i}=g8({mode:"create",onSuccess:l=>e(t.agentLink(l))});return o.jsxs(ln,{children:[o.jsxs(Qn,{className:"bg-surface1",children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(Xs,{})}),"Create an agent"]}),o.jsx(Ci,{children:o.jsx(ye,{variant:"primary",onClick:a,disabled:s||!i,className:"w-full",children:s?o.jsxs(o.Fragment,{children:[o.jsx(Pt,{className:"h-4 w-4"}),"Creating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(_e,{children:o.jsx(uWe,{})}),"Create agent"]})})})]}),o.jsx(Swt,{form:r,mode:"create",isSubmitting:s,handlePublish:a,basePath:"/cms/agents/create",currentPath:n.pathname,children:o.jsx(Xk,{})})]})}function w8e({agentId:e,selectedVersionId:t,versionData:n,readOnly:r=!1,form:a,handlePublish:s,handleSaveDraft:i,isSubmitting:l,isSavingDraft:c,onVersionSelect:u,activeVersionId:d,latestVersionId:f,hideVersionPanel:h=!1,isCodeAgentOverride:p=!1}){const[,m]=Di(),g=$c(),w=!!t&&!!n&&t!==f?o.jsxs(gc,{variant:"info",className:"mb-4",children:[o.jsx(vc,{children:"This is a previous version"}),o.jsx(kf,{as:"p",children:"You are seeing a specific version of the agent."}),o.jsx("div",{className:"pt-2",children:o.jsx(ye,{type:"button",variant:"light",size:"sm",onClick:()=>m({}),children:"View latest version"})})]}):void 0,O=h?void 0:o.jsx(Rfr,{agentId:e,selectedVersionId:t??void 0,onVersionSelect:u,activeVersionId:d});return o.jsx(Swt,{form:a,mode:"edit",agentId:e,isSubmitting:l,isSavingDraft:c,handlePublish:s,handleSaveDraft:i,readOnly:r,isCodeAgentOverride:p,basePath:`/cms/agents/${e}/edit`,currentPath:g.pathname,banner:w,versionId:t??void 0,rightPanel:O,children:o.jsx(Xk,{})})}function pkr(){const{agentId:e}=ss(),{navigate:t,paths:n}=rn(),r=Lc(),a=$c(),[s,i]=Di(),l=s.get("versionId"),{data:c,isLoading:u}=Hd(e),{data:d,isLoading:f}=Lge(e,{status:"draft"}),h=c?.source==="code",p=d??null,m=u||f,g=`/cms/agents/${e}/edit`,v=a.pathname===g||a.pathname===`${g}/`;b.useEffect(()=>{h&&v&&r(`${g}/instruction-blocks${a.search}${a.hash}`,{replace:!0})},[h,v,r,g,a.search,a.hash]);const{data:x}=f0t({agentId:e??"",versionId:l??""}),{data:w}=aE({agentId:e??"",params:{sortDirection:"DESC"}}),O=p?.activeVersionId,k=w?.versions?.[0],_=!!(k&&k.id!==O),C=!!l&&!!x,T=b.useMemo(()=>C&&x?x:p||(c?Hge(c):{}),[C,x,p,c]),j=p?.name??c?.name,{form:A,handlePublish:I,handleSaveDraft:P,isSubmitting:M,isSavingDraft:F,isDirty:D}=g8({mode:"edit",agentId:e??"",dataSource:T,isCodeAgentOverride:h,hasStoredOverride:h&&!!d,onSuccess:Q=>t(n.agentLink(Q))}),U=b.useCallback(Q=>{i(Q?{versionId:Q}:{})},[i]),B=!m&&!p&&!c,z=!m&&!!e&&(!!p||!!c);return o.jsxs(ln,{children:[o.jsxs(Qn,{className:"bg-surface1",children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(Xs,{})}),m&&o.jsx(jr,{className:"h-6 w-[200px]"}),B&&"Agent not found",z&&`Edit agent: ${j}`,z&&_&&o.jsx(wt,{variant:"info",children:"Unpublished changes"})]}),z&&o.jsxs(Ci,{children:[o.jsx(ye,{onClick:P,disabled:!D||F||M,children:F?o.jsxs(o.Fragment,{children:[o.jsx(Pt,{className:"h-4 w-4"}),"Saving..."]}):o.jsxs(o.Fragment,{children:[o.jsx(_3t,{}),"Save"]})}),o.jsx(ye,{variant:"primary",onClick:I,disabled:!_&&!D||M||F,children:M?o.jsxs(o.Fragment,{children:[o.jsx(Pt,{className:"h-4 w-4"}),"Publishing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(uWe,{}),"Publish"]})})]})]}),B?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Agent not found"}),o.jsx("div",{className:"hidden",children:o.jsx(w8e,{agentId:e??"",selectedVersionId:l,versionData:x,readOnly:!0,form:A,handlePublish:I,handleSaveDraft:P,isSubmitting:M,isSavingDraft:F,onVersionSelect:U,activeVersionId:O,latestVersionId:k?.id})})]}):o.jsx(w8e,{agentId:e??"",selectedVersionId:l,versionData:x,form:A,handlePublish:I,handleSaveDraft:P,isSubmitting:M,isSavingDraft:F,onVersionSelect:U,activeVersionId:O,latestVersionId:k?.id,hideVersionPanel:h&&!d,isCodeAgentOverride:h})]})}function mkr(){return o.jsx(ydr,{})}function gkr(){return o.jsx(Q0t,{})}function vkr(){return o.jsx(Fdr,{})}function ykr(){return o.jsx(Ddr,{})}function bkr(){return o.jsx(Ofr,{})}function xkr(){return o.jsx(Z0t,{})}function wkr(){return o.jsx(Wdr,{})}function Skr(){return o.jsx(Ldr,{})}function Okr(){const{navigate:e,paths:t}=rn();return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(Sl,{})}),"Create a prompt block"]})}),o.jsx(Bur,{onSuccess:n=>e(t.cmsPromptBlockEditLink(n.id))})]})}function S8e(e){return{name:e.name,description:e.description||void 0,content:e.content,rules:e.rules||void 0,requestContextSchema:e.variables||void 0}}function kkr({block:e,blockId:t,selectedVersionId:n,hasDraft:r}){const a=Ye(),s=as(),{navigate:i,paths:l}=rn(),{updateStoredPromptBlock:c}=u8(t),[u,d]=b.useState(!1),[f,h]=b.useState(!1),{data:p}=Uur({blockId:t,versionId:n??""}),m=!!n&&!!p,g=m?p:e,v=b.useMemo(()=>({name:g.name||"",description:g.description||"",content:g.content||"",rules:g.rules,variables:g.requestContextSchema}),[g]),{form:x}=N0t({initialValues:v}),[w,O]=b.useState(0);b.useEffect(()=>{v&&!x.formState.isDirty&&(x.reset(v),O(C=>C+1))},[v,x]);const k=b.useCallback(async()=>{if(!await x.trigger()){Fe.error("Please fill in all required fields");return}h(!0);try{const T=S8e(x.getValues());await c.mutateAsync(T),x.reset(x.getValues()),Fe.success("Draft saved")}catch(T){Fe.error(`Failed to save draft: ${T instanceof Error?T.message:"Unknown error"}`)}finally{h(!1)}},[x,c]),_=b.useCallback(async()=>{if(!await x.trigger()){Fe.error("Please fill in all required fields");return}d(!0);try{const T=S8e(x.getValues());await c.mutateAsync(T);const A=(await a.getStoredPromptBlock(t).listVersions({sortDirection:"DESC",perPage:1})).versions[0];if(!A)throw new Error("No version found to publish");await a.getStoredPromptBlock(t).activateVersion(A.id),s.invalidateQueries({queryKey:["stored-prompt-blocks"]}),s.invalidateQueries({queryKey:["stored-prompt-block"]}),s.invalidateQueries({queryKey:["prompt-block-versions",t]}),Fe.success("Prompt block published"),i(l.promptBlocksLink())}catch(T){Fe.error(`Failed to publish: ${T instanceof Error?T.message:"Unknown error"}`)}finally{d(!1)}},[x,c,a,t,i,l,s]);return o.jsxs(Db,{leftSlot:o.jsx(T0t,{form:x,onPublish:_,onSaveDraft:k,isSubmitting:u,isSavingDraft:f,isDirty:x.formState.isDirty,hasDraft:r,formResetKey:w,mode:"edit",blockId:t}),children:[m&&o.jsxs(gc,{variant:"info",className:"m-4 mb-0",children:[o.jsx(vc,{children:"This is a previous version"}),o.jsx(kf,{as:"p",children:"You are seeing a specific version of the prompt block."})]}),o.jsx("form",{className:"h-full",children:o.jsx(y0t,{form:x})})]})}function _kr(){const{promptBlockId:e}=ss(),[t,n]=Di(),r=t.get("versionId"),{data:a,isLoading:s}=v0t(e,{status:"draft"}),{data:i}=A0t({blockId:e??"",params:{sortDirection:"DESC"}}),l=a?.activeVersionId,c=i?.versions?.[0],u=!!(c&&(!l||c.id!==l)),d=b.useCallback(f=>{n(f?{versionId:f}:{})},[n]);return s?o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(Sl,{})}),o.jsx(jr,{className:"h-6 w-[200px]"})]})}),o.jsx(Db,{leftSlot:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(Pt,{className:"h-8 w-8"})}),children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(Pt,{className:"h-8 w-8"})})})]}):!a||!e?o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(Sl,{})}),"Prompt block not found"]})}),o.jsx(Db,{leftSlot:o.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Prompt block not found"}),children:o.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Prompt block not found"})})]}):o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(Sl,{})}),"Edit prompt block: ",a.name,u&&o.jsx(wt,{variant:"info",children:"Unpublished changes"})]}),o.jsx(Ci,{children:o.jsx(Vur,{blockId:e,value:r??"",onValueChange:d,activeVersionId:l})})]}),o.jsx(kkr,{block:a,blockId:e,selectedVersionId:r,hasDraft:u})]})}function Ekr(){const{navigate:e,paths:t}=rn();return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(By,{})}),"Create a scorer"]})}),o.jsx(rcr,{onSuccess:n=>e(t.scorerLink(n.id))})]})}function O8e(e){return{name:e.name,description:e.description||void 0,type:e.type,model:e.model,instructions:e.instructions||void 0,scoreRange:e.scoreRange,defaultSampling:e.defaultSampling?.type==="ratio"&&typeof e.defaultSampling.rate=="number"?e.defaultSampling:{type:"none"}}}function Ckr({scorer:e,scorerId:t,selectedVersionId:n}){const r=Ye(),a=as(),{navigate:s,paths:i}=rn(),{updateStoredScorer:l}=Dge(t),[c,u]=b.useState(!1),[d,f]=b.useState(!1),h=b.useRef(null),{data:p}=scr({scorerId:t,versionId:n??""}),m=!!n&&!!p,g=m?p:e,v=b.useMemo(()=>({name:g.name||"",description:g.description||"",type:"llm-judge",model:{provider:g.model?.provider||"",name:g.model?.name||""},instructions:g.instructions||"",scoreRange:{min:g.scoreRange?.min??0,max:g.scoreRange?.max??1},defaultSampling:g.defaultSampling}),[g]),{form:x}=Kxt({initialValues:v});b.useEffect(()=>{v&&x.reset(v)},[v,x]);const w=b.useCallback(async()=>{if(!await x.trigger()){Fe.error("Please fill in all required fields");return}f(!0);try{const _=O8e(x.getValues());await l.mutateAsync(_),Fe.success("Draft saved")}catch(_){Fe.error(`Failed to save draft: ${_ instanceof Error?_.message:"Unknown error"}`)}finally{f(!1)}},[x,l]),O=b.useCallback(async()=>{if(!await x.trigger()){Fe.error("Please fill in all required fields");return}u(!0);try{const _=O8e(x.getValues());await l.mutateAsync(_);const T=(await r.getStoredScorer(t).listVersions({sortDirection:"DESC",perPage:1})).versions[0];T&&await r.getStoredScorer(t).activateVersion(T.id),a.invalidateQueries({queryKey:["scorers"]}),a.invalidateQueries({queryKey:["stored-scorers"]}),Fe.success("Scorer published"),s(i.scorerLink(t))}catch(_){Fe.error(`Failed to publish scorer: ${_ instanceof Error?_.message:"Unknown error"}`)}finally{u(!1)}},[x,l,r,t,s,i,a]);return o.jsxs(Db,{leftSlot:o.jsx(Yxt,{form:x,onPublish:O,onSaveDraft:w,isSubmitting:c,isSavingDraft:d,formRef:h,mode:"edit"}),children:[m&&o.jsxs(gc,{variant:"info",className:"m-4 mb-0",children:[o.jsx(vc,{children:"This is a previous version"}),o.jsx(kf,{as:"p",children:"You are seeing a specific version of the scorer."})]}),o.jsx("form",{ref:h,className:"h-full",children:o.jsx(Xxt,{form:x})})]})}function jkr(){const{scorerId:e}=ss(),[t,n]=Di(),r=t.get("versionId"),{data:a,isLoading:s}=ncr(e,{status:"draft"}),{data:i}=Jxt({scorerId:e??"",params:{sortDirection:"DESC"}}),l=a?.activeVersionId,c=i?.versions?.[0],u=!!(c&&l&&c.id!==l),d=b.useCallback(f=>{n(f?{versionId:f}:{})},[n]);return s?o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(By,{})}),o.jsx(jr,{className:"h-6 w-[200px]"})]})}),o.jsx(Db,{leftSlot:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(Pt,{className:"h-8 w-8"})}),children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(Pt,{className:"h-8 w-8"})})})]}):!a||!e?o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(By,{})}),"Scorer not found"]})}),o.jsx(Db,{leftSlot:o.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Scorer not found"}),children:o.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Scorer not found"})})]}):o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(By,{})}),"Edit scorer: ",a.name,u&&o.jsx(wt,{variant:"info",children:"Unpublished changes"})]}),o.jsx(Ci,{children:o.jsx(ocr,{scorerId:e,value:r??"",onValueChange:d,variant:"outline",activeVersionId:l})})]}),o.jsx(Ckr,{scorer:a,scorerId:e,selectedVersionId:r})]})}const Tkr=new Set(["items","experiments","review"]);function Nkr(){const{datasetId:e}=ss(),t=Lc(),[n,r]=Di(),a=n.get("tab"),s=a&&Tkr.has(a)?a:"items",i=C=>{r(C==="items"?{}:{tab:C},{replace:!0})},[l,c]=b.useState(!1),[u,d]=b.useState(!1),[f,h]=b.useState(!1),[p,m]=b.useState(!1),[g,v]=b.useState(null),{data:x,error:w}=Hm(e??"");if(!e)return o.jsx(ln,{children:o.jsx(Rc,{children:o.jsx("div",{className:"text-neutral3 p-4",children:"Dataset not found"})})});if(w&&Yi(w))return o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})});if(w&&Va(w))return o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"datasets"})})});const O=C=>{t(`/evaluation/datasets/${e}/experiments/${C}`)},k=()=>{t("/evaluation?tab=datasets")},_=C=>{v(C?.version??null)};return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=datasets",children:[o.jsx(_e,{children:o.jsx(Ou,{})}),"Datasets"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:o.jsx(jgr,{value:e,variant:"ghost"})})]})}),o.jsxs(Rc,{className:"content-stretch",children:[o.jsx(Fvr,{datasetId:e,onAddItemClick:()=>d(!0),onEditClick:()=>h(!0),onDeleteClick:()=>m(!0),activeDatasetVersion:g,onVersionSelect:_,initialTab:s,onTabChange:i,experimentTriggerSlot:o.jsxs(ye,{variant:"primary",onClick:()=>c(!0),children:[o.jsx(S3t,{}),g!=null?`Run on v${g}`:"Run Experiment"]})}),o.jsx(Hvr,{datasetId:e,version:g??void 0,open:l,onOpenChange:c,onSuccess:O}),o.jsx(Bvr,{datasetId:e,open:u,onOpenChange:d}),x&&o.jsx(Egr,{open:f,onOpenChange:h,dataset:{id:x.id,name:x.name,description:x?.description||"",inputSchema:x.inputSchema,groundTruthSchema:x.groundTruthSchema}}),x&&o.jsx(Cgr,{open:p,onOpenChange:m,datasetId:x.id,datasetName:x.name,onSuccess:k})]})]})}function Akr(){const{datasetId:e,experimentId:t}=ss(),{data:n}=Hm(e??""),{data:r,isLoading:a,error:s}=T3(e,t),{data:i,isLoading:l,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d}=v8({datasetId:e,experimentId:t,experimentStatus:r?.status});return!e||!t?null:a?o.jsx(ln,{children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(Pt,{})})}):s&&Yi(s)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})}):s&&Va(s)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"datasets"})})}):s||!r?o.jsx(ln,{children:o.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",s instanceof Error?s.message:"Unknown error"]})}):o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=datasets",children:[o.jsx(_e,{children:o.jsx(Ou,{})}),"Datasets"]}),o.jsx(dn,{as:Vt,to:`/evaluation/datasets/${e}`,children:n?.name}),o.jsx(dn,{isCurrent:!0,as:"span",children:"Experiment"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsx(lSt,{experimentId:t,experiment:r}),o.jsx(oSt,{experimentId:t,experimentStatus:r?.status,results:i??[],isLoading:l,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d})]})})]})}function Ikr(){const{datasetId:e}=ss(),[t,n]=Di(),{data:r,error:a}=Hm(e??""),s=t.get("baseline")??"",i=t.get("contender")??"";return a&&Yi(a)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})}):a&&Va(a)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"datasets"})})}):!e||!s||!i?o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=datasets",children:[o.jsx(_e,{children:o.jsx(Ou,{})}),"Datasets"]}),o.jsxs(dn,{isCurrent:!0,as:"span",children:[o.jsx(_e,{children:o.jsx(Lj,{})}),"Compare Experiments"]})]})}),o.jsx(Rc,{children:o.jsxs("div",{className:"text-neutral4 text-center py-8",children:[o.jsx("p",{children:"Select two experiments to compare."}),o.jsxs("p",{className:"text-sm mt-2",children:["Use the URL format: /datasets/","{datasetId}","/experiments?baseline=","{experimentIdA}","&contender=","{experimentIdB}"]})]})})]}):o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=datasets",children:[o.jsx(_e,{children:o.jsx(Ou,{})}),"Datasets"]}),o.jsx(dn,{as:Vt,to:`/evaluation/datasets/${e}`,children:r?.name??e?.slice(0,8)}),o.jsxs(dn,{isCurrent:!0,as:"span",children:[o.jsx(_e,{children:o.jsx(Lj,{})}),"Experiments Comparison"]})]})}),o.jsx(Rc,{children:o.jsxs("div",{className:"max-w-[100rem] w-full px-12 mx-auto grid content-start ",children:[o.jsxs(ft,{children:[o.jsxs(ft.Column,{children:[o.jsxs(ft.Title,{children:[o.jsx(Lj,{})," Dataset Experiments Comparison"]}),o.jsxs(ft.Description,{children:["Comparing"," ",o.jsx(Vt,{to:`/datasets/${e}/experiments/${s}`,children:s.slice(0,8)})," vs"," ",o.jsx(Vt,{to:`/datasets/${e}/experiments/${i}`,children:i.slice(0,8)})]})]}),o.jsx(ft.Column,{children:o.jsxs(ye,{as:Vt,to:`/evaluation/datasets/${e}`,children:[o.jsx(ek,{}),"Back to Dataset"]})})]}),o.jsx(hyr,{datasetId:e,experimentIdA:s,experimentIdB:i,onSwap:()=>{n({baseline:i,contender:s})}})]})})]})}function Rkr(){const{datasetId:e,itemId:t}=ss(),{Link:n}=rn(),r=Lc(),{data:a,isLoading:s,error:i}=Kge(e??"",t??""),{updateItem:l,deleteItem:c}=Ls(),{data:u}=Hm(e??""),d=a?.[0]??null,f=d?.isDeleted??!1,[h,p]=b.useState(null),m=b.useMemo(()=>!d||f?{input:"",groundTruth:"",metadata:""}:{input:JSON.stringify(d.input,null,2),groundTruth:d.groundTruth?JSON.stringify(d.groundTruth,null,2):"",metadata:d.metadata?JSON.stringify(d.metadata,null,2):""},[d,f]),g=d?.datasetVersion??0,[v,x]=b.useState(!1),[w,O]=b.useState(m.input),[k,_]=b.useState(m.groundTruth),[C,T]=b.useState(m.metadata),[j,A]=b.useState(g);g!==j&&(A(g),O(m.input),_(m.groundTruth),T(m.metadata));const[I,P]=b.useState(!1),M=V=>{p(f?V:V.isLatest?null:V)},F=()=>{p(null)},D=!f&&h!=null,U=()=>{D||x(!0)},B=()=>{D||P(!0)},z=async()=>{if(!e||!t)return;let V;try{V=JSON.parse(w)}catch{Fe.error("Input must be valid JSON");return}let R;if(k.trim())try{R=JSON.parse(k)}catch{Fe.error("Ground Truth must be valid JSON");return}let H;if(C.trim())try{H=JSON.parse(C)}catch{Fe.error("Metadata must be valid JSON");return}try{await l.mutateAsync({datasetId:e,itemId:t,input:V,groundTruth:R,metadata:H}),Fe.success("Item updated successfully"),x(!1)}catch(G){Fe.error(`Failed to update item: ${G instanceof Error?G.message:"Unknown error"}`)}},Q=()=>{d&&(O(JSON.stringify(d.input,null,2)),_(d.groundTruth?JSON.stringify(d.groundTruth,null,2):""),T(d.metadata?JSON.stringify(d.metadata,null,2):"")),x(!1)},W=async()=>{if(!(!e||!t))try{await c.mutateAsync({datasetId:e,itemId:t}),Fe.success("Item deleted successfully"),P(!1),r(`/evaluation/datasets/${e}`)}catch(V){Fe.error(`Failed to delete item: ${V instanceof Error?V.message:"Unknown error"}`)}},$=h??d,Z=$?{id:t??"",datasetId:e??"",datasetVersion:$.datasetVersion,input:$.input,groundTruth:$.groundTruth,metadata:$.metadata,createdAt:$.createdAt,updatedAt:$.updatedAt}:null;return i&&Yi(i)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})}):i&&Va(i)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"datasets"})})}):s?null:!e||!t||!a||a.length===0?o.jsx(ln,{children:o.jsx(Rc,{children:o.jsx("div",{className:"text-neutral3 p-4",children:"Item not found"})})}):o.jsxs(o.Fragment,{children:[o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=datasets",children:[o.jsx(_e,{children:o.jsx(Ou,{})}),"Datasets"]}),o.jsx(dn,{as:Vt,to:`/evaluation/datasets/${e}`,children:u?.name}),o.jsx(dn,{isCurrent:!0,as:"span",children:"Item"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-6 pb-4",children:o.jsxs("div",{className:"grid gap-6 max-w-[60rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsxs(ft,{children:[o.jsxs(ft.Column,{children:[o.jsxs(ft.Title,{children:[o.jsx(r3t,{}),t," ",o.jsx(hi,{content:t})]}),o.jsx(ft.Description,{children:o.jsxs(ha,{children:["Item of ",o.jsx(Ou,{})," ",u?.name]})}),o.jsxs(ft.Description,{children:[o.jsxs(ha,{children:[o.jsx(z4t,{})," Created at"," ",d?.createdAt?Cn(new Date(d.createdAt),"MMM d, yyyy"):""]}),o.jsxs(ha,{children:[o.jsx(Q5,{})," Latest version v",d?.datasetVersion??""]})]})]}),o.jsx(ft.Column,{children:!v&&!f&&o.jsxs(ns,{children:[o.jsxs(ye,{onClick:U,disabled:D,title:D?"Return to latest version to edit":void 0,children:[o.jsx(y3t,{})," Edit"]}),o.jsxs(ye,{onClick:B,disabled:D,title:D?"Return to latest version to delete":void 0,children:[o.jsx(P3t,{})," Delete"]})]})})]}),o.jsxs(Cd,{className:v?"grid-cols-1":"grid-cols-[1fr_auto]",children:[o.jsxs(gn,{withRightSeparator:!v,children:[f&&d&&o.jsxs(Wo,{variant:"destructive",children:[o.jsx(cte,{}),o.jsxs(Wo.Message,{children:["This item was deleted at version v",d.datasetVersion]})]}),!f&&D&&h&&o.jsx(o.Fragment,{children:o.jsxs(Wo,{variant:"warning",children:[o.jsx(cte,{}),o.jsxs(Wo.Message,{children:["Viewing version v",h.datasetVersion]}),o.jsxs(Wo.Button,{onClick:F,children:[o.jsx(A4t,{})," Return to the latest version"]})]})}),v?o.jsx(eSt,{inputValue:w,setInputValue:O,groundTruthValue:k,setGroundTruthValue:_,metadataValue:C,setMetadataValue:T,validationErrors:null,onSave:z,onCancel:Q,isSaving:l.isPending}):Z?o.jsx(S8,{item:Z,Link:n}):o.jsx("div",{className:"text-neutral4 text-sm",children:"Item data not available"})]}),!v&&o.jsx(gn,{children:o.jsx(pyr,{datasetId:e,itemId:t,onClose:()=>{},onVersionSelect:M,onCompareVersionsClick:V=>{r(`/evaluation/datasets/${e}/items/${t}/versions?ids=${V.join(",")}`)},activeVersion:h?.datasetVersion??null})})]})]})})]}),o.jsx(Lt,{open:I,onOpenChange:P,children:o.jsxs(Lt.Content,{children:[o.jsxs(Lt.Header,{children:[o.jsx(Lt.Title,{children:"Delete Item"}),o.jsx(Lt.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),o.jsxs(Lt.Footer,{children:[o.jsx(Lt.Cancel,{children:"Cancel"}),o.jsx(Lt.Action,{onClick:W,children:c.isPending?"Deleting...":"Delete"})]})]})})]})}function k8e(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function Pkr(){const{datasetId:e}=ss(),[t,n]=Di(),r=t.get("items")?.split(",").filter(Boolean)??[],{data:a,error:s}=Hm(e??""),{Link:i}=rn(),[l,c]=b.useState(!1),{data:u}=Rse(e??"",r[0]??""),{data:d}=Rse(e??"",r[1]??"");return s&&Yi(s)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})}):s&&Va(s)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"datasets"})})}):!e||r.length<2?o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=datasets",children:[o.jsx(_e,{children:o.jsx(Ou,{})}),"Datasets"]}),o.jsx(dn,{isCurrent:!0,as:"span",children:"Compare Items"})]})}),o.jsx(Rc,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two items to compare."})})})]}):o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=datasets",children:[o.jsx(_e,{children:o.jsx(Ou,{})}),"Datasets"]}),o.jsx(dn,{as:Vt,to:`/evaluation/datasets/${e}`,children:a?.name||e?.slice(0,8)}),o.jsx(dn,{isCurrent:!0,as:"span",children:"Compare Items"})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:`/evaluation/datasets/${e}`,variant:"outline",children:[o.jsx(_e,{children:o.jsx(ek,{})}),"Back to Dataset"]})})]}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:Y("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":l}),children:[o.jsxs(ft,{children:[o.jsxs(ft.Column,{children:[o.jsxs(ft.Title,{children:[o.jsx(Lj,{}),"Compare Dataset Items"]}),o.jsx(ft.Description,{children:o.jsxs(ha,{children:["Comparing ",r.length," items of"," ",o.jsx(Vt,{to:`/evaluation/datasets/${e}`,className:"text-info1 hover:underline",children:a?.name||e?.slice(0,8)})]})})]}),o.jsx(ft.Column,{children:o.jsxs(ns,{children:[o.jsxs(ye,{as:Vt,to:`/evaluation/datasets/${e}`,children:[o.jsx(ek,{}),"Back to Dataset"]}),o.jsx(ye,{variant:"primary",onClick:()=>c(f=>!f),children:l?o.jsxs(o.Fragment,{children:[o.jsx(dWe,{})," Default View"]}):o.jsxs(o.Fragment,{children:[o.jsx(X4t,{})," Diff View"]})})]})})]}),o.jsx(Cd,{className:"grid-cols-[1fr_3vw_1fr]",children:r.map((f,h)=>o.jsxs(b.Fragment,{children:[o.jsx(Mkr,{datasetId:e,itemId:f,Link:i,idx:h,itemIds:r,showContent:!l,onItemChange:p=>{const m=[...r];m[h]=p,n({items:m.join(",")})}}),h==0&&o.jsx("div",{className:Y("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},f))}),l&&u&&d&&o.jsx(jSt,{codeA:k8e(u),codeB:k8e(d)})]})})]})}function Mkr({datasetId:e,itemId:t,Link:n,idx:r,itemIds:a,onItemChange:s,showContent:i=!0}){const{data:l,isLoading:c}=Rse(e,t),{data:u}=Gk(e),d=new Set(a.filter((h,p)=>p!==r)),f=(u??[]).map(h=>({value:h.id,label:h.id,disabled:d.has(h.id)}));return o.jsxs(gn,{children:[o.jsxs(gn.Toolbar,{className:"flex gap-4",children:[o.jsx(c8,{label:"Item",name:`compare-item-${r}`,value:t,onValueChange:s,options:f,placeholder:"Select item",labelIsHidden:!0}),o.jsxs(ye,{as:n,to:`/datasets/${e}/items/${t}`,children:[o.jsx(Q5,{}),"Versions"]})]}),i&&o.jsx(gn.Content,{children:c?o.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):l?o.jsxs(o.Fragment,{children:[o.jsx(tSt,{item:l}),o.jsx(S8,{item:l,Link:n})]}):o.jsxs("div",{className:"text-neutral4 text-sm",children:["Item ",t.slice(0,8)," not found"]})})]})}function _8e(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function Dkr(){const{datasetId:e,itemId:t}=ss(),[n,r]=Di(),[a,s]=b.useState(!1),i=n.get("ids")?.split(",").map(Number).filter(p=>!isNaN(p)&&p>0)??[],{data:l,error:c}=Hm(e??""),{Link:u}=rn(),{data:d}=Kge(e??"",t??""),{data:f}=Lse(e??"",t??"",i[0]??0,l?.version),{data:h}=Lse(e??"",t??"",i[1]??0,l?.version);return c&&Yi(c)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})}):c&&Va(c)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"datasets"})})}):!e||!t||i.length<2?o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=datasets",children:[o.jsx(_e,{children:o.jsx(Ou,{})}),"Datasets"]}),o.jsx(dn,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),o.jsx(Rc,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two versions to compare."})})})]}):o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=datasets",children:[o.jsx(_e,{children:o.jsx(Ou,{})}),"Datasets"]}),o.jsx(dn,{as:Vt,to:`/evaluation/datasets/${e}`,children:l?.name}),o.jsx(dn,{as:Vt,to:`/datasets/${e}/items/${t}`,children:"Item"}),o.jsx(dn,{isCurrent:!0,as:"span",children:"Compare Versions"})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:`/datasets/${e}/items/${t}`,variant:"outline",children:[o.jsx(_e,{children:o.jsx(ek,{})}),"Back to Item"]})})]}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:Y("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":a}),children:[o.jsxs(ft,{children:[o.jsxs(ft.Column,{children:[o.jsxs(ft.Title,{children:[o.jsx(Lj,{}),"Compare Dataset Item Versions"]}),o.jsx(ft.Description,{children:o.jsxs(ha,{children:["Comparing ",i.length," versions of"," ",o.jsx(Vt,{to:`/datasets/${e}/items/${t}`,className:"text-info1 hover:underline",children:t})]})})]}),o.jsx(ft.Column,{children:o.jsxs(ns,{children:[o.jsxs(ye,{as:Vt,to:`/datasets/${e}/items/${t}`,children:[o.jsx(ek,{}),"Back to Item"]}),o.jsx(ye,{variant:"primary",onClick:()=>s(p=>!p),children:a?o.jsxs(o.Fragment,{children:[o.jsx(dWe,{})," Default View"]}):o.jsxs(o.Fragment,{children:[o.jsx(c3t,{})," Diff View"]})})]})})]}),o.jsx(Cd,{className:"grid-cols-[1fr_3vw_1fr]",children:i.map((p,m)=>o.jsxs(b.Fragment,{children:[o.jsx($kr,{datasetId:e,itemId:t,datasetVersion:p,latestVersion:l?.version,allVersions:d??[],versionNumbers:i,Link:u,idx:m,showContent:!a,onVersionChange:g=>{const v=[...i];v[m]=g,r({ids:v.join(",")})}}),m===0&&o.jsx("div",{className:Y("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},p))}),a&&f&&h&&o.jsx(jSt,{codeA:_8e(f),codeB:_8e(h)})]})})]})}function $kr({datasetId:e,itemId:t,datasetVersion:n,latestVersion:r,allVersions:a,versionNumbers:s,Link:i,idx:l,showContent:c=!0,onVersionChange:u}){const{data:d,isLoading:f}=Lse(e,t,n,r),h=new Set(s.filter((g,v)=>v!==l)),p=a.map(g=>{const v=typeof g.updatedAt=="string"?new Date(g.updatedAt):g.updatedAt;return{value:String(g.datasetVersion),label:o.jsxs(o.Fragment,{children:[o.jsxs("b",{children:["v. ",g.datasetVersion]})," - ",Cn(v,"MMM d, yyyy h:mm a"),g.isLatest?o.jsx(Ss,{color:"blue",size:"small",children:"Latest"}):null]}),disabled:h.has(g.datasetVersion)}}),m=d?{id:d.id,datasetId:e,datasetVersion:d.datasetVersion,input:d.input,groundTruth:d.groundTruth,metadata:d.metadata,createdAt:d.createdAt,updatedAt:d.updatedAt}:null;return o.jsxs(gn,{children:[o.jsxs(gn.Toolbar,{className:"grid gap-4 grid-cols-[auto_1fr]",children:[o.jsx(Q5,{className:"w-6 h-6 opacity-50"}),o.jsx(c8,{label:"Version",name:`compare-version-${l}`,value:String(n),onValueChange:g=>u(Number(g)),options:p,placeholder:"Select version",labelIsHidden:!0,className:"w-full"})]}),c&&o.jsx(gn.Content,{children:f?o.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):!d||!m?o.jsxs("div",{className:"text-neutral4 text-sm",children:["Version ",n," not found"]}):o.jsx(S8,{item:m,Link:i})})]})}function Lkr(){const{datasetId:e}=ss(),[t]=Di(),n=t.get("ids")?.split(",").map(Number).filter(g=>!isNaN(g)&&g>0)??[],r=Lc(),{data:a,error:s}=Hm(e??""),i=Gk(e??"",void 0,n[0]??null),l=Gk(e??"",void 0,n[1]??null),c=b.useMemo(()=>i.data??[],[i.data]),u=b.useMemo(()=>l.data??[],[l.data]),d=b.useMemo(()=>{const g=new Map;for(const v of[...c,...u])g.has(v.id)||g.set(v.id,{id:v.id,createdAt:new Date(v.createdAt)});return[...g.values()].sort((v,x)=>x.createdAt.getTime()-v.createdAt.getTime())},[c,u]),f=b.useMemo(()=>new Map(c.map(g=>[g.id,g])),[c]),h=b.useMemo(()=>new Map(u.map(g=>[g.id,g])),[u]);if(s&&Yi(s))return o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})});if(s&&Va(s))return o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"datasets"})})});if(!e||n.length<2)return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=datasets",children:[o.jsx(_e,{children:o.jsx(Ou,{})}),"Datasets"]}),o.jsx(dn,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),o.jsx(Rc,{children:o.jsx("div",{className:"text-neutral4 text-center py-8",children:o.jsx("p",{children:"Select at least two versions to compare."})})})]});const p=(g,v,x)=>{r(`/datasets/${e}/items/${g}/versions?ids=${v?.datasetVersion??""},${x?.datasetVersion??""}`)},m=(g,v)=>{r(`/evaluation/datasets/${e}/versions?ids=${g},${v}`,{replace:!0})};return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=datasets",children:[o.jsx(_e,{children:o.jsx(Ou,{})}),"Datasets"]}),o.jsx(dn,{as:Vt,to:`/evaluation/datasets/${e}`,children:a?.name||e?.slice(0,8)}),o.jsxs(dn,{isCurrent:!0,as:"span",children:[o.jsx(_e,{children:o.jsx(ASe,{})}),"Compare Versions"]})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsxs(ft,{children:[o.jsxs(ft.Column,{children:[o.jsxs(ft.Title,{children:[o.jsx(ASe,{})," Compare Dataset Versions"]}),o.jsx(ft.Description,{children:o.jsxs(ha,{children:[o.jsx(Q5,{})," Comparing ",n.length," versions of"," ",a?.name||e?.slice(0,8)]})})]}),o.jsx(ft.Column,{children:o.jsxs(ye,{as:Vt,to:`/evaluation/datasets/${e}`,children:[o.jsx(ek,{}),"Back to Dataset"]})})]}),o.jsx(Cd,{children:o.jsxs(gn,{children:[o.jsx(vyr,{datasetId:e,versionA:String(n[0]),versionB:String(n[1]),onVersionChange:m}),o.jsx(wyr,{datasetId:e,versionA:n[0],versionB:n[1],allItems:d,itemsAMap:f,itemsBMap:h,onItemClick:p})]})})]})})]})}const Fkr="tab",zkr=["overview","scorers","datasets","experiments"];function Bkr(){const[e]=Di(),t=e.get(Fkr),n=t&&zkr.includes(t)?t:"overview",[r,a]=b.useState(!1),[s,i]=b.useState(""),[l,c]=b.useState("all"),[u,d]=b.useState(""),[f,h]=b.useState("all"),[p,m]=b.useState("all"),[g,v]=b.useState("all"),[x,w]=b.useState(""),[O,k]=b.useState("all"),[_,C]=b.useState("all"),{data:T}=xSt(),j=b.useMemo(()=>T?.datasets??[],[T?.datasets]),A=b.useMemo(()=>Ibr(j),[j]),I=b.useMemo(()=>$br(j),[j]),P=()=>{i(""),c("all")},M=()=>{d(""),h("all"),m("all"),v("all")},F=()=>{w(""),k("all"),C("all")},D=l!=="all"||s!=="",U=f!=="all"||p!=="all"||g!=="all"||u!=="",B=O!=="all"||_!=="all"||x!=="",z={overview:{icon:o.jsx(pWe,{}),label:"Evaluation"},scorers:{icon:o.jsx(cWe,{}),label:"Scorers"},datasets:{icon:o.jsx(Ou,{}),label:"Datasets"},experiments:{icon:o.jsx(vWe,{}),label:"Experiments"}},{icon:Q,label:W}=z[n];return o.jsxs(ja,{children:[o.jsxs(ja.Top,{children:[o.jsx(ft,{withMargins:!1,children:o.jsx(ft.Column,{children:o.jsxs(ft.Title,{children:[Q," ",W]})})}),n==="scorers"&&o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(zh,{label:"Search scorers",placeholder:"Filter by scorer name",onSearch:i}),o.jsxs(ns,{children:[o.jsx(oo,{label:"Source",labelIsHidden:!0,name:"filter-source",options:[...zbr],value:l,onValueChange:c,className:"whitespace-nowrap"}),D&&o.jsxs(ye,{onClick:P,size:"sm",variant:"light",children:[o.jsx(o7,{className:"size-3"})," Reset"]})]})]}),n==="datasets"&&o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(zh,{label:"Search datasets",placeholder:"Filter by dataset name",onSearch:d}),o.jsxs(ns,{children:[o.jsx(oo,{label:"Target",labelIsHidden:!0,name:"filter-target",options:[...jbr],value:f,onValueChange:h,className:"whitespace-nowrap"}),o.jsx(oo,{label:"Experiments",labelIsHidden:!0,name:"filter-experiments",options:[...Tbr],value:p,onValueChange:m,className:"whitespace-nowrap"}),A.length>1&&o.jsx(oo,{label:"Tags",labelIsHidden:!0,name:"filter-tags",options:A,value:g,onValueChange:v,className:"whitespace-nowrap"}),U&&o.jsxs(ye,{onClick:M,size:"sm",variant:"light",children:[o.jsx(o7,{className:"size-3"})," Reset"]})]})]}),o.jsxs(ye,{variant:"primary",size:"sm",onClick:()=>a(!0),children:[o.jsx(Lle,{className:"size-4"})," Create Dataset"]})]}),n==="experiments"&&o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(zh,{label:"Search experiments",placeholder:"Filter by experiment, dataset, or target",onSearch:w}),o.jsxs(ns,{children:[o.jsx(oo,{label:"Status",labelIsHidden:!0,name:"filter-status",options:[...Rbr],value:O,onValueChange:k,className:"whitespace-nowrap"}),o.jsx(oo,{label:"Dataset",labelIsHidden:!0,name:"filter-dataset",options:I,value:_,onValueChange:C,className:"whitespace-nowrap"}),B&&o.jsxs(ye,{onClick:F,size:"sm",variant:"light",children:[o.jsx(o7,{className:"size-3"})," Reset"]})]})]})]}),o.jsx("div",{className:"overflow-y-auto px-4 pt-2",children:o.jsx(Wbr,{activeTab:n,scorerSearch:s,scorerSourceFilter:l,datasetSearch:u,datasetTargetFilter:f,datasetExperimentFilter:p,datasetTagFilter:g,experimentSearch:x,experimentStatusFilter:O,experimentDatasetFilter:_})}),o.jsx(Iwt,{open:r,onOpenChange:a})]})}function Ukr(){const{experimentId:e}=ss(),{data:t,isLoading:n}=ugr(),a=t?.experiments?.find(p=>p.id===e)?.datasetId??"",{data:s,isLoading:i,error:l}=T3(a,e??""),{data:c,isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h}=v8({datasetId:a,experimentId:e??"",experimentStatus:s?.status});return e?n||i||!a?o.jsx(ln,{children:o.jsx("div",{className:"flex items-center justify-center h-full",children:o.jsx(Pt,{})})}):l&&Yi(l)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})}):l&&Va(l)?o.jsx(ln,{children:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"datasets"})})}):l||!s?o.jsx(ln,{children:o.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",l instanceof Error?l.message:"Unknown error"]})}):o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=experiments",children:[o.jsx(_e,{children:o.jsx(pWe,{})}),"Experiments"]}),o.jsx(dn,{isCurrent:!0,as:"span",children:"Experiment"})]})}),o.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:o.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[o.jsx(lSt,{experimentId:e,experiment:s}),o.jsx(oSt,{experimentId:e,experimentStatus:s?.status,results:c??[],isLoading:u,setEndOfListElement:d,isFetchingNextPage:f,hasNextPage:h})]})})]}):null}function qkr(){const[e]=Di(),t=Lc(),n=e.get("redirect")||"/",a=e.get("mode")==="signup"?"signup":"signin",s=e.get("error_description")||e.get("error")||null,i=()=>{n.startsWith("http")?window.location.href=n:t(n,{replace:!0})};return o.jsx(LSt,{redirectUri:n,onSuccess:i,initialMode:a,errorMessage:s})}const Vkr=20;function Hkr(e,t,n){if(e?.pagination?.hasMore)return n+1}function Qkr(e){return e.pages.flatMap(t=>t.logs??[])}const Wkr=({filters:e}={})=>{const t=Ye(),{inView:n,setRef:r}=J_(),a=qw({queryKey:["logs",e],queryFn:({pageParam:c})=>t.listLogsVNext({pagination:{page:c,perPage:Vkr},filters:e,orderBy:{field:"timestamp",direction:"DESC"}}),initialPageParam:0,getNextPageParam:Hkr,select:Qkr,retry:!1,refetchInterval:3e3}),{hasNextPage:s,isFetchingNextPage:i,fetchNextPage:l}=a;return b.useEffect(()=>{n&&s&&!i&&l()},[n,s,i,l]),{...a,data:a.data,setEndOfListElement:r}},See="period",E8e="logId",C8e="traceId",j8e="spanId",Gkr={"24h":1440*60*1e3,"3d":4320*60*1e3,"7d":10080*60*1e3,"14d":336*60*60*1e3,"30d":720*60*60*1e3};function Zkr(){const[e,t]=Di(),n=e.get(See),r=Sbr(n)?n:"24h",a=e.get(E8e),s=e.get(C8e),i=e.get(j8e),l=b.useCallback(A=>{t(I=>{const P=new URLSearchParams(I);return A==="24h"?P.delete(See):P.set(See,A),P},{replace:!0})},[t]),c=b.useCallback(A=>{t(I=>{const P=new URLSearchParams(I);for(const[M,F]of Object.entries(A)){const D=M==="logId"?E8e:M==="traceId"?C8e:j8e;F?P.set(D,F):P.delete(D)}return P},{replace:!0})},[t]),u=b.useMemo(()=>{const A=Gkr[r];if(A)return{timestamp:{start:new Date(Date.now()-A)}}},[r]),{data:d=[],isLoading:f,error:h,isFetchingNextPage:p,hasNextPage:m,setEndOfListElement:g}=Wkr({filters:u}),{searchQuery:v,setSearchQuery:x,filterGroups:w,filterColumns:O,toggleComparator:k,removeFilterGroup:_,clearAllFilters:C,updateFilterGroups:T,filteredLogs:j}=xbr(d);return o.jsxs(ja,{className:"max-w-none",children:[o.jsxs(ja.Top,{children:[o.jsx(ft,{withMargins:!1,children:o.jsx(ft.Column,{children:o.jsxs(ft.Title,{children:[o.jsx(mWe,{})," Logs"]})})}),o.jsx(ybr,{onSearchChange:x,datePreset:r,onDatePresetChange:l,filterGroups:w,filterColumns:O,onToggleComparator:k,onRemoveFilterGroup:_,onClearAllFilters:C,onFilterGroupsChange:T,onReset:()=>{x(""),C(),l("24h")},isLoading:f,hasActiveFilters:v.length>0||w.length>0||r!=="24h"})]}),o.jsx(hbr,{logs:j,isLoading:f,isFetchingNextPage:p,hasNextPage:m,setEndOfListElement:g,error:h instanceof Error?h:null,hasActiveFilters:v.length>0||w.length>0,featuredLogId:a,featuredTraceId:s,featuredSpanId:i,onFeaturedChange:c})]})}const Ykr=()=>{const{data:e=[],isLoading:t,error:n}=zR(),[r,a]=b.useState("");return o.jsxs(ja,{children:[o.jsxs(ja.Top,{children:[o.jsxs(ft,{withMargins:!1,children:[o.jsx(ft.Column,{children:o.jsxs(ft.Title,{isLoading:t,children:[o.jsx(Tu,{})," MCP Servers"]})}),o.jsx(ft.Column,{className:"flex justify-end gap-2",children:o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to MCP documentation",children:o.jsx(Sl,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(zh,{onSearch:a,label:"Filter MCP servers",placeholder:"Filter by name"})})]}),o.jsx(Oxr,{mcpServers:e,isLoading:t,error:n,search:r,onSearch:a})]})},Xkr=()=>{const{serverId:e}=ss(),{data:t=[],isLoading:n}=zR(),r=t.find(a=>a.id===e);return o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/mcps",children:[o.jsx(_e,{children:o.jsx(Tu,{})}),"MCP Servers"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:o.jsx(W0t,{value:e,variant:"ghost"})})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"MCP documentation"]})})]}),o.jsx(Exr,{isLoading:n,server:r})]})},Kkr=()=>{const{data:e}=zR(),{serverId:t,toolId:n}=ss(),{data:r,isLoading:a}=NSt(t,n),s=e?.find(c=>c.id===t),i=r?.name,l=s?.name||"";return a||!r?null:o.jsxs("div",{className:"h-full w-full bg-surface2 overflow-y-hidden",children:[o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/mcps",children:[o.jsx(_e,{children:o.jsx(Tu,{})}),"MCP Servers"]}),o.jsx(dn,{as:Vt,to:`/mcps/${t}`,children:l}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:i})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"MCP documentation"]})})]}),o.jsx(_xr,{toolId:n,serverId:t})]})},Oee="period";function Jkr(){const[e,t]=Di(),n=e.get(Oee),r=Kpr(n)?n:"24h",a=b.useCallback(s=>{t(i=>{const l=new URLSearchParams(i);return s==="24h"?l.delete(Oee):l.set(Oee,s),l},{replace:!0})},[t]);return o.jsx(rmr,{initialPreset:r,onPresetChange:a,children:o.jsxs("div",{className:"w-full px-[3vw] mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[o.jsxs(ft,{withMargins:!1,className:"mt-6 mb-4",children:[o.jsx(ft.Column,{children:o.jsxs(ft.Title,{children:[o.jsx(Dle,{})," Metrics"]})}),o.jsxs(ft.Column,{className:"flex justify-end gap-2",children:[o.jsx(qmr,{}),o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/observability/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Metrics documentation",children:o.jsx(Sl,{})})]})]}),o.jsx(Bmr,{})]})})}const e_r=(e,t)=>{const n=Ye();return Ot({queryKey:["trace",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return await n.getTrace(e)},enabled:!!e,refetchInterval:3e3,...t})},t_r=async({client:e,page:t,perPage:n,filters:r})=>e.listTraces({pagination:{page:t,perPage:n},filters:r}),n_r=25;function r_r(e,t,n){if(e?.pagination?.hasMore)return n+1}function a_r(e){const t=new Set,n=e.pages.flatMap(a=>a.spans??[]).filter(a=>t.has(a.traceId)?!1:(t.add(a.traceId),!0)),r={};for(const a of e.pages)a.threadTitles&&Object.assign(r,a.threadTitles);return{spans:n,threadTitles:r}}const s_r=({filters:e})=>{const t=Ye(),{inView:n,setRef:r}=J_(),a=qw({queryKey:["traces",e],queryFn:({pageParam:c})=>t_r({client:t,page:c,perPage:n_r,filters:e}),initialPageParam:0,getNextPageParam:r_r,select:a_r,placeholderData:$zt,retry:!1,refetchInterval:c=>Va(c.state.error)?!1:3e3}),{hasNextPage:s,isFetchingNextPage:i,fetchNextPage:l}=a;return b.useEffect(()=>{n&&s&&!i&&l()},[n,s,i,l]),{...a,setEndOfListElement:r}};function i_r(){const e=Lc(),[t,n]=Di(),[r,a]=b.useState(),[s,i]=b.useState({value:"all",label:"All",type:"all"}),[l,c]=b.useState(()=>new Date(Date.now()-1440*60*1e3)),[u,d]=b.useState(void 0),[f,h]=b.useState(!1),[p,m]=b.useState(!1),[g,v]=b.useState(""),[x,w]=b.useState([]),[O,k]=b.useState(!1),[_,C]=b.useState({}),[T,j]=b.useState("last-24h"),[A,I]=b.useState({}),{data:P={},isLoading:M}=cp(),{data:F,isLoading:D}=Dv(),{data:U={},isLoading:B}=up(),{data:z=[]}=ogr(),{data:Q=[]}=lgr(),{data:W=[]}=cgr(),{data:$,isLoading:Z}=e_r(r,{enabled:!!r}),V=t.get("traceId"),R=t.get("spanId"),H=t.get("tab"),G=t.get("scoreId"),J=b.useMemo(()=>{if(Object.keys(_).length!==0)return _},[_]),{data:ie,isLoading:ne,isFetchingNextPage:ae,hasNextPage:le,setEndOfListElement:fe,error:X,isError:re}=s_r({filters:{...s?.type!=="all"&&{entityId:s?.value,entityType:s?.type},...l&&{startedAt:{start:l}},...u&&{endedAt:{end:u}},...x.length>0&&{tags:x},...O&&{status:"error"},...J&&{metadata:J},...Object.fromEntries(Object.entries(A).filter(([,Ie])=>Ie.trim()))}}),oe=b.useMemo(()=>ie?.spans??[],[ie?.spans]),ge=b.useDeferredValue(g),ce=b.useMemo(()=>{if(!ge.trim())return oe;const Ie=ge.trim().toLowerCase();return oe.filter(Qe=>{if(Qe.traceId?.toLowerCase().includes(Ie)||Qe.name?.toLowerCase().includes(Ie)||Qe.entityId?.toLowerCase().includes(Ie)||Qe.entityName?.toLowerCase().includes(Ie))return!0;const et=Qe.metadata;if(et&&typeof et=="object"){for(const lt of Object.values(et))if(String(lt).toLowerCase().includes(Ie))return!0}return!1})},[oe,ge]),ue=ie?.threadTitles??{},we=b.useRef({}),Ee=b.useRef({}),Me=b.useMemo(()=>{let Ie=!1;const Qe=we.current;for(const lt of oe){const an=lt.metadata;if(an&&typeof an=="object")for(const[Rn,st]of Object.entries(an)){if(st==null)continue;Qe[Rn]||(Qe[Rn]=new Set,Ie=!0);const Ht=String(st);Qe[Rn].has(Ht)||(Qe[Rn].add(Ht),Ie=!0)}}if(!Ie)return Ee.current;const et=Object.fromEntries(Object.entries(Qe).map(([lt,an])=>[lt,[...an].sort()]));return Ee.current=et,et},[oe]),K=b.useRef({}),te=b.useRef({}),me=b.useMemo(()=>{let Ie=!1;const Qe=K.current;for(const lt of oe)for(const an of Wwt){const Rn=lt[an];Rn!=null&&typeof Rn=="string"&&Rn.trim()&&(Qe[an]||(Qe[an]=new Set,Ie=!0),Qe[an].has(Rn)||(Qe[an].add(Rn),Ie=!0))}for(const lt of Q)Qe.environment||(Qe.environment=new Set,Ie=!0),Qe.environment.has(lt)||(Qe.environment.add(lt),Ie=!0);for(const lt of W)Qe.serviceName||(Qe.serviceName=new Set,Ie=!0),Qe.serviceName.has(lt)||(Qe.serviceName.add(lt),Ie=!0);if(!Ie)return te.current;const et=Object.fromEntries(Object.entries(Qe).map(([lt,an])=>[lt,[...an].sort()]));return te.current=et,et},[oe,Q,W]);b.useEffect(()=>{if(V){V!==r&&a(V),m(!0);return}r&&a(void 0),p&&m(!1)},[p,r,V]);const Te=b.useMemo(()=>(Object.entries(P)||[]).map(([Ie,Qe])=>({value:Qe.id,label:Qe.name,type:km.AGENT})),[P]),Pe=b.useMemo(()=>(Object.entries(F||{})||[]).map(([,Ie])=>({value:Ie.name,label:Ie.name,type:km.WORKFLOW_RUN})),[F]),pe=b.useMemo(()=>[{value:"all",label:"All",type:"all"},...Te,...Pe],[Te,Pe]),ke=t.get("entity"),he=pe.find(Ie=>Ie.value===ke);he&&he.value!==s?.value&&i(he);const Ce=()=>{a(void 0),n({entity:"all",traceId:""}),m(!1),c(void 0),d(void 0),h(!1),v(""),w([]),k(!1),C({}),j("last-24h"),I({}),we.current={},Ee.current={},K.current={},te.current={}},$e=(Ie,Qe)=>{if(Qe==="from")return c(Ie);d(Ie)},it=Ie=>{Ie?.value&&n({entity:Ie.value})},yt=Ie=>{if(Ie===r){e("/observability");return}e(`/observability?traceId=${encodeURIComponent(Ie)}`)},Gt=re?vxr(X):void 0,Ue=b.useMemo(()=>{if(!f)return ce.map(lt=>({id:lt.traceId}));const{groups:Ie,ungrouped:Qe}=Qwt(ce),et=[];for(const lt of Ie)for(const an of lt.traces)et.push({id:an.traceId});for(const lt of Qe)et.push({id:lt.traceId});return et},[ce,f]);if(X&&Yi(X))return o.jsxs(ja,{children:[o.jsx(ja.Top,{children:o.jsxs(ft,{withMargins:!1,children:[o.jsxs(ft.Column,{children:[o.jsxs(ft.Title,{children:[o.jsx(O0,{})," Observability"]}),o.jsx(ft.Description,{children:"Explore observability traces for your entities"})]}),o.jsx(ft.Column,{className:"flex justify-end gap-2",children:o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Observability documentation",tooltipContent:"Go to Observability documentation",children:o.jsx(Sl,{})})})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})]});if(X&&Va(X))return o.jsxs(ja,{children:[o.jsx(ja.Top,{children:o.jsxs(ft,{withMargins:!1,children:[o.jsxs(ft.Column,{children:[o.jsxs(ft.Title,{children:[o.jsx(O0,{})," Observability"]}),o.jsx(ft.Description,{children:"Explore observability traces for your entities"})]}),o.jsx(ft.Column,{className:"flex justify-end gap-2",children:o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Observability documentation",tooltipContent:"Go to Observability documentation",children:o.jsx(Sl,{})})})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"traces"})})]});const Ve=s?.value!=="all"||l||u||g.trim()||x.length>0||O||Object.keys(_).length>0||Object.values(A).some(Ie=>Ie.trim()),Re=y8({entries:Ue,id:r,update:a}),Se=b8({entries:Ue,id:r,update:a});return o.jsxs(o.Fragment,{children:[o.jsxs(ja,{className:"grid-rows-[auto_1fr] overflow-y-auto",children:[o.jsxs(ja.Top,{children:[o.jsxs(ft,{withMargins:!1,children:[o.jsxs(ft.Column,{children:[o.jsxs(ft.Title,{isLoading:ne,children:[o.jsx(O0,{})," Observability"]}),o.jsx(ft.Description,{children:"Explore observability traces for your entities"})]}),o.jsx(ft.Column,{className:"flex justify-end gap-2",children:o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/observability/tracing/overview",target:"_blank",rel:"noopener noreferrer","aria-label":"Observability documentation",tooltipContent:"Go to Observability documentation",children:o.jsx(Sl,{})})})]}),o.jsx(Wmr,{onEntityChange:it,onReset:Ce,selectedEntity:s,entityOptions:pe,onDateChange:$e,selectedDateFrom:l,selectedDateTo:u,isLoading:ne||M||D,groupByThread:f,onGroupByThreadChange:h,searchQuery:g,onSearchChange:v,selectedTags:x,availableTags:z,onTagsChange:w,errorOnly:O,onErrorOnlyChange:k,selectedMetadata:_,availableMetadata:Me,onMetadataChange:C,datePreset:T,onDatePresetChange:j,contextFilters:A,availableContextValues:me,onContextFiltersChange:I})]}),ne?o.jsx(Jwt,{columns:w8}):o.jsx(rgr,{traces:ce,selectedTraceId:r,onTraceClick:yt,errorMsg:Gt?.error,setEndOfListElement:fe,filtersApplied:!!Ve,isFetchingNextPage:ae,hasNextPage:le,groupByThread:f,threadTitles:ue})]}),o.jsx(Qge,{traceSpans:$?.spans,traceId:r,initialSpanId:R||void 0,initialSpanTab:H==="scores"?"scores":"details",initialScoreId:G||void 0,traceDetails:ce.find(Ie=>Ie.traceId===r),isOpen:p,onClose:()=>{e("/observability"),m(!1)},onNext:Re,onPrevious:Se,isLoadingSpans:Z,computeTraceLink:(Ie,Qe)=>`/observability?traceId=${Ie}${Qe?`&spanId=${Qe}`:""}`,scorers:U,isLoadingScorers:B})]})}const o_r=[{title:"Metrics",description:"View system performance metrics, request latencies, and throughput across your agents and workflows.",icon:Dle,href:"/metrics"},{title:"Traces",description:"Explore distributed traces to debug and understand the execution flow of your AI operations.",icon:O0,href:"/observability"}];function l_r(){return o.jsxs(ja,{children:[o.jsx(ja.Top,{children:o.jsx(ft,{withMargins:!1,children:o.jsx(ft.Column,{children:o.jsxs(ft.Title,{children:[o.jsx(O0,{})," Observability"]})})})}),o.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:o_r.map(e=>o.jsxs(Vt,{to:e.href,className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}const c_r=[{title:"Agents",description:"Create and manage AI agents with tools, memory, and custom instructions.",icon:Xs,href:"/agents"},{title:"Prompts",description:"Design and version reusable prompt templates for your agents.",icon:lI,href:"/prompts"},{title:"Workflows",description:"Build step-based execution flows with suspend, resume, and branching.",icon:tl,href:"/workflows"},{title:"Processors",description:"Configure data processors for transforming and routing information.",icon:fWe,href:"/processors"},{title:"MCP Servers",description:"Connect to Model Context Protocol servers for external tool access.",icon:Tu,href:"/mcps"},{title:"Tools",description:"Browse and test the tools available to your agents and workflows.",icon:Po,href:"/tools"},{title:"Workspaces",description:"Organize your projects and resources into isolated workspaces.",icon:gf,href:"/workspaces"},{title:"Request Context",description:"Inspect request-scoped context propagation for dynamic configuration.",icon:$le,href:"/request-context"}];function u_r(){return o.jsxs(ja,{children:[o.jsx(ja.Top,{children:o.jsx(ft,{withMargins:!1,children:o.jsx(ft.Column,{children:o.jsx(ft.Title,{children:"Primitives"})})})}),o.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 max-w-5xl",children:c_r.map(e=>o.jsxs(Vt,{to:e.href,className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function d_r(){const{paths:e}=rn(),{data:t,isLoading:n}=g0t(),{isCmsAvailable:r}=Mge(),[a,s]=b.useState(""),i=t?.promptBlocks??[];return o.jsxs(ja,{children:[o.jsxs(ja.Top,{children:[o.jsxs(ft,{withMargins:!1,children:[o.jsx(ft.Column,{children:o.jsxs(ft.Title,{isLoading:n,children:[o.jsx(lI,{})," Prompts"]})}),o.jsxs(ft.Column,{className:"flex justify-end gap-2",children:[o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/agents/agent-instructions#prompt-blocks",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Prompts documentation",children:o.jsx(Sl,{})}),r&&o.jsxs(ye,{as:Vt,to:e.cmsPromptBlockCreateLink(),variant:"primary",children:[o.jsx(Lle,{}),"Create Prompt"]})]})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(zh,{onSearch:s,label:"Filter prompts",placeholder:"Filter by name or description"})})]}),o.jsx(Qur,{promptBlocks:i,isLoading:n,search:a,onSearch:s})]})}function f_r(){return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx($le,{})}),"Request Context"]})}),o.jsx(Rc,{children:o.jsx(qor,{children:o.jsx($xt,{})})})]})}const h_r=[{title:"Mastra APIs",description:"Explore and test the available REST API endpoints with the interactive Swagger UI.",icon:J4t,href:"/swagger-ui",external:!1},{title:"Documentation",description:"Read the official Mastra documentation for guides, references, and tutorials.",icon:Sl,href:"https://mastra.ai/en/docs",external:!0},{title:"Github",description:"Browse the source code, report issues, and contribute to the Mastra project.",icon:hWe,href:"https://github.com/mastra-ai/mastra",external:!0},{title:"Community",description:"Join the Mastra Discord community for help, discussion, and collaboration.",icon:m3t,href:"https://discord.gg/BTYqqHKUrf",external:!0},{title:"Share with your team",description:"Running Mastra Studio locally? Deploy to the cloud so your team can collaborate.",icon:Q4t,href:"https://mastra.ai/cloud",external:!0},{title:"Talk to our Sales team",description:"Get a custom demo, discuss on-prem deployments, and how we can help you accelerate getting agents into production.",icon:L4t,href:"https://mastra.ai/contact?ref=studio",external:!0}];function p_r(){return o.jsxs(ja,{children:[o.jsx(ja.Top,{children:o.jsx(ft,{withMargins:!1,children:o.jsx(ft.Column,{children:o.jsxs(ft.Title,{children:[o.jsx(Sl,{})," Resources"]})})})}),o.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:h_r.map(e=>o.jsxs("a",{href:e.href,...e.external?{target:"_blank",rel:"noreferrer"}:{},className:"group flex flex-col gap-3 rounded-lg border border-border1 bg-surface2 p-5 transition-colors hover:border-accent1 hover:bg-surface3",children:[o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),o.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title}),e.external&&o.jsx(hWe,{className:"h-3.5 w-3.5 text-icon3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]}),o.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function m_r(){const{scorerId:e}=ss(),[t,n]=Di(),r=t.get("scoreId")??void 0,[a,s]=b.useState(r),[i,l]=b.useState(0),[c,u]=b.useState(!!r),[d,f]=b.useState({value:"all",label:"All Entities",type:"ALL"}),{scorer:h,isLoading:p,error:m}=glr(e),{data:g={},isLoading:v,error:x}=cp(),{data:w,isLoading:O,error:k}=Dv(),{data:_,isLoading:C,error:T}=mlr({scorerId:e,page:i,entityId:d?.value==="all"?void 0:d?.value,entityType:d?.type==="ALL"?void 0:d?.type}),j=b.useMemo(()=>h?.agentIds?.filter(H=>g[H]).map(H=>({value:H,label:g[H].name,type:"AGENT"}))||[],[h?.agentIds,g]),A=b.useMemo(()=>h?.workflowIds?.map(H=>({value:H,label:H,type:"WORKFLOW"}))||[],[h?.workflowIds]),I=b.useMemo(()=>[{value:"all",label:"All Entities",type:"ALL"},...j,...A],[j,A]),P=t.get("entity"),M=I.find(H=>H.value===P);M&&M.value!==d?.value&&f(M),b.useEffect(()=>{if(m){const H=m instanceof Error?m.message:"Failed to load scorer";Fe.error(`Error loading scorer: ${H}`)}},[m]),b.useEffect(()=>{if(x){const H=x instanceof Error?x.message:"Failed to load agents";Fe.error(`Error loading agents: ${H}`)}},[x]),b.useEffect(()=>{if(k){const H=k instanceof Error?k.message:"Failed to load workflows";Fe.error(`Error loading workflows: ${H}`)}},[k]);const F=b.useMemo(()=>_?.scores||[],[_?.scores]),D=_?.pagination,U=h?.agentIds?.map(H=>({name:H,id:Object.entries(g).find(([,G])=>G.name===H)?.[0]}))||[],B=h?.workflowIds?.map(H=>({name:H,id:Object.entries(w||{}).find(([,G])=>G.name===H)?.[0]}))||[],Q=[{key:"entities",label:"Entities",value:([...U.map(H=>({id:H.id,name:H.name,type:"AGENT"})),...B.map(H=>({id:H.id,name:H.name,type:"WORKFLOW"}))]||[]).map(H=>({id:H.id,name:H.name||H.id,path:`${H.type==="AGENT"?"/agents":"/workflows"}/${H.name}`}))}],W=H=>{H?.value&&n(G=>{const J=new URLSearchParams(G);return J.set("entity",H.value),J})};if(b.useEffect(()=>{const H=t.get("scoreId")??void 0;if(H===a)return;if(!H){s(void 0),u(!1);return}F.find(J=>J.id===H)&&(s(H),u(!0))},[t,F]),Yi(m)||Yi(x)||Yi(k))return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=scorers",children:[o.jsx(_e,{children:o.jsx(By,{})}),"Scorers"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})]});if(m&&Va(m))return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=scorers",children:[o.jsx(_e,{children:o.jsx(By,{})}),"Scorers"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"scorers"})})]});if(p||m||x||k)return null;const $=H=>{s(H),u(!0),n(G=>{const J=new URLSearchParams(G);return J.set("scoreId",H),J})},Z=H=>{s(H),n(G=>{const J=new URLSearchParams(G);return H?J.set("scoreId",H):J.delete("scoreId"),J})},V=y8({entries:F,id:a,update:Z}),R=b8({entries:F,id:a,update:Z});return o.jsxs(o.Fragment,{children:[o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/evaluation?tab=scorers",children:[o.jsx(_e,{children:o.jsx(By,{})}),"Scorers"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:o.jsx(vlr,{value:e,variant:"ghost"})})]}),o.jsxs(Ci,{children:[h?.scorer?.source==="stored"&&o.jsxs(ye,{variant:"light",as:Vt,to:`/cms/scorers/${e}/edit`,children:[o.jsx(_e,{children:o.jsx(x3t,{})}),"Edit"]}),o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/evals/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Scorers documentation"]})]})]}),o.jsx("div",{className:Y("grid overflow-y-auto h-full"),children:o.jsxs("div",{className:Y("max-w-[100rem] w-full px-12 mx-auto grid content-start gap-8 h-full"),children:[o.jsx(l$,{title:h?.scorer?.config?.name||"loading",description:h?.scorer?.config?.description||"loading",icon:o.jsx(By,{})}),o.jsx(sx,{data:Q,LinkComponent:Vt,isLoading:v||O}),o.jsx(plr,{selectedEntity:d,entityOptions:I,onEntityChange:W,onReset:()=>{n(H=>{const G=new URLSearchParams(H);return G.set("entity","all"),G})},isLoading:C||v||O}),C?o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Pt,{})}):o.jsx(Zor,{scores:F,selectedScoreId:a,pagination:{total:D?.total||0,hasMore:D?.hasMore||!1,perPage:D?.perPage||0,page:D?.page||0},onScoreClick:$,onPageChange:l,errorMsg:T?.message})]})})]}),o.jsx(Bxt,{scorerName:h?.scorer?.config?.name,score:g_r(F.find(H=>H.id===a)),isOpen:c,onClose:()=>{u(!1),s(void 0),n(H=>{const G=new URLSearchParams(H);return G.delete("scoreId"),G})},onNext:V,onPrevious:R,computeTraceLink:(H,G)=>`/observability?traceId=${H}${G?`&spanId=${G}`:""}`})]})}const g_r=e=>{if(e)return{...e,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt)}},v_r=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}],y_r=()=>{const{baseUrl:e,headers:t,apiPrefix:n}=Pge(),{theme:r,setTheme:a}=Br(),[s,i]=b.useState(r),l=b.useRef(r);return b.useEffect(()=>{i(r),l.current=r},[r]),o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(pge,{})}),"Settings"]})}),o.jsx(Rc,{children:o.jsxs("div",{className:"max-w-2xl mx-auto w-full mt-8 space-y-8",children:[o.jsx("section",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsx("h2",{className:"text-icon6 font-medium",children:"Theme"}),o.jsx(c8,{name:"theme",label:"Theme mode",value:s,onValueChange:c=>{const u=c;l.current=u,i(u)},options:v_r.map(c=>({...c}))})]})}),o.jsx(Zxt,{initialConfig:{baseUrl:e,headers:t,apiPrefix:n},onSave:()=>{a(l.current)}})]})})]})};function b_r(){const[e]=Di(),t=Lc(),n=e.get("redirect")||"/",r=()=>{n.startsWith("http")?window.location.href=n:t(n,{replace:!0})};return o.jsx(LSt,{redirectUri:n,onSuccess:r,initialMode:"signup"})}async function jOt(){const e=await fetch("https://mastra.ai/api/templates.json");if(!e.ok)throw new Error(`Failed to fetch templates: ${e.statusText}`);const t=await e.json(),n=[{title:"Weather Agent",slug:"weather-agent",githubUrl:"https://github.com/mastra-ai/weather-agent",description:"Get weather information of any city.",longDescription:"One Agent, one Workflow and one Tool to bring you the weather in your city.",imageURL:"",tags:["Agent","Workflow","Tool"],useCase:"",supportedProviders:["openai","anthropic","google","groq"],agents:["weatherAgent"],tools:["weatherTool"],workflows:["weatherWorkflow"]},...t],r=Array.from(new Set(n.flatMap(s=>s.tags))),a=Array.from(new Set(n.flatMap(s=>s.supportedProviders)));return{templates:n,tags:r,providers:a}}async function x_r({repo:e,owner:t}){const n=await fetch(`https://api.github.com/repos/${t}/${e}`);if(!n.ok)throw new Error(`Failed to fetch template: ${n.statusText}`);const r=await n.json();if(!r.is_template)throw new Error("Repo is not a template, please update the repo settings to make it a template");return{title:r.name,slug:r.name,description:r.description??"",imageURL:"",tags:[],useCase:"",longDescription:r.description??"",githubUrl:r.html_url,supportedProviders:[]}}async function w_r({repoOrSlug:e,owner:t}){const{templates:n}=await jOt(),r=n.find(a=>a.slug===e);if(!r){if(e.startsWith("template-")){const s=n.find(i=>`template-${i.slug}`===e);if(s)return s}const a=await x_r({repo:e,owner:t});if(a)return a;throw new Error(`Template ${e} not found`)}return r}async function S_r({repo:e,owner:t,branch:n}){const r=`https://raw.githubusercontent.com/${t}/${e}/${n}/.env.example`,a=await fetch(r);return a.ok?(await a.text()).split(`
|
|
516
|
-
`).reduce((l,c)=>{if(!c||c.startsWith("#"))return l;const[u,d]=c.split("=");return u&&(l[u]=d?.split("")?.every(f=>f==="*")?"":d?.replaceAll('"',"")),l},{}):{}}const O_r=()=>Ot({queryKey:["mastra-templates"],queryFn:jOt}),k_r=({repoOrSlug:e,owner:t})=>Ot({queryKey:["template-repo",e,t],queryFn:()=>w_r({repoOrSlug:e,owner:t})}),__r=({repo:e,owner:t,branch:n})=>Ot({queryKey:["template-repo-env-vars",e,t,n],queryFn:()=>S_r({repo:e,owner:t,branch:n})}),E_r=()=>{const e=Ye();return Ot({queryKey:["agent-builder-workflow"],queryFn:async()=>await e.getAgentBuilderAction("merge-template").details()})},C_r=()=>{const e=Ye();return qn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").createRun({runId:t})})},j_r=()=>{const e=Ye();return qn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").runById(t)})},T8e=e=>{if(typeof e=="string")return e;if(e==null)return"Unknown error";if(e instanceof Error)return typeof e.message=="string"&&e.message.length>0?e.message:"Unknown error";if(typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)},N8e=(e,t,n)=>{let r={...t};if(!(r.payload?.workflowState?.steps&&Object.keys(r.payload.workflowState.steps).length>0)&&n?.allSteps&&(r.payload={...r.payload,workflowState:{...r.payload?.workflowState,steps:Object.keys(n.allSteps).reduce((s,i)=>(s[i]={id:i,description:n.allSteps[i].description,status:"pending"},s),{})}}),e.type==="start"||e.type==="workflow-start"){const s={};n?.allSteps&&Object.entries(n.allSteps).forEach(([l,c])=>{s[l]={id:c.id,description:c.description,status:"pending"}});const i=e.runId||e.payload?.runId;r={...r,runId:i,eventTimestamp:new Date().toISOString(),status:"running",phase:"initializing",payload:{workflowState:{status:"running",steps:s},currentStep:null}}}if(e.type==="step-start"||e.type==="workflow-step-start"){const s=e.payload.id;r={...r,phase:"processing",payload:{...r.payload,currentStep:{id:s,status:"running",startTime:new Date,...e.payload},workflowState:{...r.payload.workflowState,steps:{...r.payload.workflowState.steps,[s]:{...r.payload.workflowState.steps[s],status:"running",startTime:new Date,...e.payload}}}}}}if(e.type==="step-result"||e.type==="workflow-step-result"){const s=e.payload.id,i=e.payload.status,l=e.payload.error;if(r={...r,payload:{...r.payload,currentStep:{...r.payload.currentStep,status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date},workflowState:{...r.payload.workflowState,steps:{...r.payload.workflowState.steps,[s]:{...r.payload.workflowState.steps[s],status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date}}}}},i==="failed"&&l){const c=T8e(l);r={...r,status:"failed",error:c,phase:"error",failedStep:{id:s,error:c,description:e.payload.description||s},payload:{...r.payload,workflowState:{...r.payload.workflowState,status:"failed"}},errorTimestamp:new Date}}}if((e.type==="step-finish"||e.type==="workflow-step-finish")&&(r={...r,payload:{...r.payload,currentStep:null}}),(e.type==="finish"||e.type==="workflow-finish")&&(r.phase==="error"||r.status==="failed"?r={...r,completedAt:new Date}:r={...r,status:e.payload.status||"completed",phase:"completed",payload:{...r.payload,currentStep:null,workflowState:{...r.payload.workflowState,status:e.payload.status||"completed"}},completedAt:new Date}),e.type==="error"){const s=T8e(e.payload.error);r={...r,status:"failed",error:s,phase:"error",payload:{...r.payload,workflowState:{...r.payload.workflowState,status:"failed"}},errorTimestamp:new Date}}return{newState:r}},T_r=(e,t)=>{try{localStorage.setItem(`template-install-${e}`,JSON.stringify({state:t,timestamp:Date.now()}))}catch(n){console.warn("Failed to save template state to localStorage:",n)}},TOt=(e,t)=>{const[n,r]=b.useState({}),[a,s]=b.useState(!1);return{streamResult:n,isStreaming:a,processStream:async(l,c)=>{if(s(!0),r({}),!l)throw new Error("No stream returned");const u=l.getReader();let d={runId:c||t,eventTimestamp:new Date().toISOString(),phase:"running",payload:{workflowState:{steps:{}},currentStep:null}};try{for(;;){const{done:f,value:h}=await u.read();if(f)break;const{newState:p}=N8e(h,d,e);if(d=p,r(p),h.runId||c||t){const m=h.runId||c||t;T_r(m,p)}}}catch(f){console.error("💥 [processStream] Error processing template installation stream:",f);const{newState:h}=N8e({type:"error",payload:{error:f instanceof Error?f.message:"Unknown error"}},d,e);r(h)}finally{s(!1),u.releaseLock()}}}},N_r=e=>{const t=Ye(),{streamResult:n,isStreaming:r,processStream:a}=TOt(e);return{streamInstall:qn({mutationFn:async({inputData:i,selectedModel:l,runId:c})=>{for(let d=1;d<=3;d++)try{const f=t.getAgentBuilderAction("merge-template"),h=new JO;h.set("selectedModel",l);const p=await f.stream({inputData:i,requestContext:h},c);await a(p,c);return}catch(f){console.error(`💥 [streamInstall] Attempt ${d} failed:`,f);const h=f?.message?.includes("Failed to fetch")||f?.message?.includes("NetworkError")||f?.message?.includes("network error")||f?.message?.includes("fetch")||f?.code==="NETWORK_ERROR"||f?.name==="TypeError";if(console.warn(`Stream attempt ${d}/3 failed:`,f),h){const p=c?`Network error during template installation (likely hot reload). Please refresh the page to resume from where you left off using runId: ${c}`:"Network error during template installation (likely hot reload). Please try again.";throw console.error("🔌 Stream network error:",p),new Error(p)}throw console.error("❌ [streamInstall] Non-network error or max retries reached, throwing:",f),f}}}),streamResult:n,isStreaming:r}},A_r=e=>{const t=Ye(),{streamResult:n,isStreaming:r,processStream:a}=TOt(e);return{observeInstall:qn({mutationFn:async({runId:i})=>{for(let u=1;u<=3;u++)try{const f=await t.getAgentBuilderAction("merge-template").observeStream({runId:i});await a(f,i);return}catch(d){console.error(`💥 [observeInstall] Attempt ${u} failed:`,d);const f=d?.message?.includes("Failed to fetch")||d?.message?.includes("NetworkError")||d?.message?.includes("network error")||d?.message?.includes("fetch")||d?.code==="NETWORK_ERROR"||d?.name==="TypeError";if(console.warn(`ObserveStream attempt ${u}/3 failed:`,d),f&&u<3){console.info(`🔄 ObserveStream network error detected (likely hot reload), retrying in 2000ms... (attempt ${u+1}/3)`),await new Promise(h=>setTimeout(h,2e3));continue}throw console.error("❌ [observeInstall] Non-network error or max retries reached, throwing:",d),d}}}),streamResult:n,isStreaming:r}};function I_r(){const{data:e,isLoading:t}=O_r(),{templates:n,tags:r,providers:a}=e??{templates:[],tags:[],providers:[]},[s,i]=b.useState("all"),[l,c]=b.useState("all"),[u,d]=b.useState(""),f=[{value:"all",label:"Any tag"}];(r||[]).forEach(w=>{f.push({value:w,label:w})});const h=[{value:"all",label:"Any provider"}];(a||[]).forEach(w=>{h.push({value:w,label:w})});const p=(w,O)=>{O==="tag"?i(w):O==="provider"&&c(w)},m=w=>{d(w)},g=()=>{i("all"),c("all"),d("")},v=n.filter(w=>!(u&&!w.title.toLowerCase().includes(u)&&!w.description.toLowerCase().includes(u)||s!=="all"&&!w.tags.includes(s)||l!=="all"&&!w.supportedProviders.includes(l))),x=u||s!=="all"||l!=="all";return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gWe,{})}),"Templates"]})}),o.jsxs("div",{className:Y("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[o.jsx(Fpr,{selectedTag:s,onTagChange:w=>p(w,"tag"),tagOptions:f,selectedProvider:l,onProviderChange:w=>p(w,"provider"),providerOptions:h,searchTerm:u,onSearchChange:m,onReset:x?g:void 0,className:"max-w-[80rem]",isLoading:t}),o.jsx(Bpr,{templates:v,linkComponent:Vt,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const R_r="1.23.0-alpha.9";function P_r(){const{templateSlug:e}=ss(),[t,n]=Di(),[r,a]=b.useState(""),[s,i]=b.useState(""),[l,c]=b.useState(""),[u,d]=b.useState({}),[f,h]=b.useState([]),[p,m]=b.useState(null),[g,v]=b.useState(!1),[x,w]=b.useState(""),[O,k]=b.useState(!1),[_,C]=b.useState(!1),[T,j]=b.useState([]),{data:A,isLoading:I}=k_r({repoOrSlug:e,owner:"mastra-ai"}),M=R_r?.includes("beta")??!1?"beta":"main",{data:F,isLoading:D}=__r({repo:A?.githubUrl?new URL(A.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:M}),{data:U,isLoading:B}=E_r(),{mutateAsync:z,isPending:Q}=C_r(),{mutateAsync:W}=j_r(),{streamInstall:$,streamResult:Z,isStreaming:V}=N_r(U),{observeInstall:R,streamResult:H,isStreaming:G}=A_r(U);b.useEffect(()=>{const re=t.get("runId");re&&!g&&!p&&!V&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:re}),w(re),W({runId:re}).then(oe=>{const ge=oe.snapshot;if(ge?.status==="success"&&ge?.result?.success)v(!0);else if(ge?.result?.success===!1)if(ge?.result?.validationResults&&!ge?.result?.validationResults?.valid&&ge?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ue,errors:we}=ge.result.validationResults,Ee=`Template installation completed but ${ue} validation issue${ue>1?"s":""} remain unresolved.`;m(Ee),j(we||[])}else{const ue=ge?.result?.message||ge?.result?.error||"Template installation failed";m(typeof ue=="string"?ue:String(ue))}}).catch(oe=>{console.error("❌ Failed to fetch run details:",oe),m("Failed to retrieve installation status after reload")}))},[t,g,p,V,G,W]),b.useEffect(()=>{const re=t.get("runId"),oe=t.get("resume"),ge=t.get("provider");if(re&&oe==="true"&&ge&&!V&&!G&&!O&&!_&&U){w(re),k(!0);try{W({runId:re}).then(ce=>{if(ce.snapshot?.status==="running")return R.mutateAsync({runId:re})}).then(()=>{n(ce=>{const ue=new URLSearchParams(ce);return ue.delete("resume"),ue})}).catch(ce=>{console.error("❌ Failed to resume template installation:",ce),ce.message?.includes("404")||ce.message?.includes("not found")?m("Template installation run not found. It may have expired or been completed."):m("Failed to resume template installation. Please try again.")})}catch(ce){console.error("❌ Auto-resume failed with error:",ce),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,V,G,O,_,U,W,R,n]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ie=[{key:"tools",label:"Tools",value:A?.tools?.length?A.tools.map(re=>re).join(", "):"n/a",icon:o.jsx(Po,{})},{key:"agents",label:"Agents",value:A?.agents?.length?A.agents.map(re=>re).join(", "):"n/a",icon:o.jsx(Xs,{})},{key:"workflows",label:"Workflows",value:A?.workflows?.length?A.workflows.map(re=>re).join(", "):"n/a",icon:o.jsx(L3t,{})},{key:"providers",label:"Providers",value:A?.supportedProviders?.length?A.supportedProviders.join(", "):"n/a",icon:o.jsx(D4t,{})},{key:"tags",label:"Tags",value:A?.tags?.length?A.tags.join(", "):"n/a",icon:o.jsx(A3t,{})}],ne=[{...ie[0]},{...ie[1]},{...ie[2]}].filter(re=>re.value!=="n/a");b.useEffect(()=>{F&&d(F)},[F]),b.useEffect(()=>{const re=Z||H;re?.phase==="error"&&re?.error&&m(typeof re.error=="string"?re.error:String(re.error))},[Z?.phase,Z?.error,H?.phase,H?.error]);const ae=re=>{a(re)},le=async re=>(i(re.provider),c(re.modelId),{message:"Model updated successfully"}),fe=async()=>{const re=Object.entries(u).reduce((oe,[ge,ce])=>(ce===""&&oe.push(ge),oe),[]);if(re.length>0){h(re);return}if(A){m(null),v(!1),w(""),C(!0);try{const ge={repo:A.githubUrl||`https://github.com/mastra-ai/template-${A.slug}`,ref:M,slug:A.slug,variables:u},{runId:ce}=await z({});w(ce),n(ue=>{const we=new URLSearchParams(ue);return we.set("runId",ce),we.set("resume","true"),we.set("provider",r||"openai"),we}),await $.mutateAsync({inputData:ge,selectedModel:{provider:s,modelId:l},runId:ce})}catch(oe){C(!1),m(oe?.message||"Template installation failed"),console.error("Template installation failed",oe)}}},X=re=>{const{name:oe,value:ge}=re.target;ge.trim()===""?h(ce=>[...ce,oe]):h(ce=>ce.filter(ue=>ue!==oe)),d(ce=>({...ce,[oe]:ge}))};return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/templates",children:[o.jsx(_e,{children:o.jsx(gWe,{})}),"Templates"]}),o.jsx(dn,{as:Vt,to:`/templates/${A?.slug}`,isCurrent:!0,children:A?.title&&A.title})]})}),o.jsx("div",{className:Y("w-full lg:px-12 h-full overflow-y-scroll"),children:o.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[o.jsx(Upr,{isLoading:I,title:A?.title,description:A?.longDescription,imageURL:A?.imageURL,githubUrl:A?.githubUrl,infoData:ie,templateSlug:e}),A&&o.jsxs(o.Fragment,{children:[(V||G)&&o.jsx(Gpr,{name:A.title,streamResult:G?H:Z,runId:x,workflowInfo:U}),g&&o.jsx(Zpr,{name:A.title,installedEntities:ne,linkComponent:Vt}),p&&o.jsx(Ypr,{errorMsg:p,validationErrors:T.length>0?T:Z?.validationResults?.errors||H?.validationResults?.errors}),!V&&!G&&!g&&!p&&o.jsx(qpr,{providerOptions:J,selectedProvider:r,onProviderChange:ae,variables:u,setVariables:d,errors:f,setErrors:h,handleInstallTemplate:fe,handleVariableChange:X,isLoadingEnvVars:D||B,isInstalling:Q,defaultModelProvider:s,defaultModelId:l,onModelUpdate:le})]})]})})]})}const M_r=()=>{const{toolId:e,agentId:t}=ss();return o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/agents",children:[o.jsx(_e,{children:o.jsx(Xs,{})}),"Agents"]}),o.jsx(dn,{as:Vt,to:`/agents/${t}/chat`,children:t}),o.jsx(dn,{as:Vt,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[o.jsx(_e,{children:o.jsx(Fl,{})}),"Tools documentation"]})})]}),o.jsx(Icr,{toolId:e,agentId:t})]})},D_r=()=>{const{toolId:e}=ss();return o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/tools",children:[o.jsx(_e,{children:o.jsx(Po,{})}),"Tools"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:o.jsx(Lpr,{value:e,variant:"ghost"})})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Tools documentation"]})})]}),o.jsx($pr,{toolId:e})]})};function $_r(){const{data:e,isLoading:t,error:n}=Dv(),[r,a]=b.useState("");return o.jsxs(ja,{children:[o.jsxs(ja.Top,{children:[o.jsxs(ft,{withMargins:!1,children:[o.jsx(ft.Column,{children:o.jsxs(ft.Title,{isLoading:t,children:[o.jsx(tl,{})," Workflows"]})}),o.jsx(ft.Column,{className:"flex justify-end gap-2",children:o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workflows documentation",children:o.jsx(Sl,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(zh,{onSearch:a,label:"Filter workflows",placeholder:"Filter by name or description"})})]}),o.jsx(sir,{workflows:e||{},isLoading:t,error:n,search:r,onSearch:a})]})}const A8e=()=>{const{workflowId:e}=ss(),{data:t,isLoading:n,error:r}=RR(e);return r&&Yi(r)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})}):r&&Va(r)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"workflows"})}):o.jsx(Kbt,{workflowId:e,workflow:t??void 0,isLoading:n})};function I8e(){const{workspaceId:e}=ss(),[t,n]=Di(),r=Lc(),[a,s]=b.useState(!1),[i,l]=b.useState(!1),[c,u]=b.useState(!1),[d,f]=b.useState(null),[h,p]=b.useState(null),[m,g]=b.useState(!1),v=t.get("file"),x=t.get("tab"),{data:w,error:O,isLoading:k}=pwt(),_=w?.workspaces??[],C=e??_[0]?.id,{data:T,isLoading:j,error:A}=afr(C),I=Yi(O)||Yi(A),P=Va(O)||Va(A),M=t.get("path")||".",F=sse(O)||sse(A),D=C?_.find(Se=>Se.id===C):void 0,U=Se=>{const Ie=new URLSearchParams(t);for(const[Qe,et]of Object.entries(Se))et===null?Ie.delete(Qe):Ie.set(Qe,et);n(Ie)},B=Se=>{g(!1),s(!1),r(`/workspaces/${Se}`)},z=Se=>{U({path:Se==="."||Se===""?null:Se,file:null})},Q=Se=>{U({file:Se})},W=Se=>{U({tab:Se})},$=M,Z=v,{data:V,isLoading:R,error:H,refetch:G}=sfr($,{enabled:T?.isWorkspaceConfigured&&T?.capabilities?.hasFilesystem,workspaceId:C}),J=ofr(),ie=lfr(),{data:ne,isLoading:ae}=mwt(Z??"",{enabled:!!Z,workspaceId:C}),{data:le,isLoading:fe,refetch:X}=ufr({workspaceId:C}),re=vfr(),oe=yfr(),ge=bfr(),ce=T?.isWorkspaceConfigured??!1,ue=T?.capabilities?.hasFilesystem??!1,we=T?.capabilities?.hasSkills??!1,Ee=T?.capabilities?.canBM25??!1,Me=T?.capabilities?.canVector??!1,K=D?.safety?.readOnly??!1,te=ue&&!K,me=T?.mounts,Te=me?.filter(Se=>!Se.readOnly).map(Se=>({path:Se.path,displayName:Se.displayName,icon:Se.icon,provider:Se.provider,name:Se.name})),Pe=me&&me.length>1?me.map(Se=>Se.path):void 0,pe=b.useCallback(Se=>{C&&re.mutate({...Se,workspaceId:C},{onSuccess:async Ie=>{if(Ie.success){u(!1);const{data:Qe,error:et}=await X();if(et||!Qe){Fe.success(`Skill "${Ie.skillName}" installed successfully (${Ie.filesWritten} files)`);return}Qe.skills.some(an=>an.name===Ie.skillName)?Fe.success(`Skill "${Ie.skillName}" installed successfully (${Ie.filesWritten} files)`):(g(!0),Fe.warning(`Skill "${Ie.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else Fe.error("Failed to install skill")},onError:Ie=>{Fe.error(`Failed to install skill: ${Ie instanceof Error?Ie.message:"Unknown error"}`)}})},[C,re,X]),ke=b.useCallback(Se=>{C&&(p(Se),oe.mutate({workspaceId:C,skillName:Se},{onSuccess:Ie=>{if(p(null),Ie.updated.length>0){const Qe=Ie.updated[0];Qe.success?(Fe.success(`Skill "${Se}" updated successfully (${Qe.filesWritten} files)`),X()):Fe.error(`Failed to update skill: ${Qe.error??"Unknown error"}`)}else Fe.error("Failed to update skill: No update result returned")},onError:Ie=>{p(null),Fe.error(`Failed to update skill: ${Ie instanceof Error?Ie.message:"Unknown error"}`)}}))},[C,oe,X]),he=b.useCallback(Se=>{C&&(f(Se),ge.mutate({workspaceId:C,skillName:Se},{onSuccess:Ie=>{f(null),Ie.success?(Fe.success(`Skill "${Ie.skillName}" removed successfully`),X()):Fe.error(`Failed to remove skill "${Ie.skillName}"`)},onError:Ie=>{f(null),Fe.error(`Failed to remove skill: ${Ie instanceof Error?Ie.message:"Unknown error"}`)}}))},[C,ge,X]),$e=x==="files"&&ue?"files":x==="skills"&&we?"skills":ue?"files":we?"skills":"files",it=le?.skills??[],yt=le?.isSkillsConfigured??!1,Gt=V?.entries??[],Ue=ue&&(Ee||Me),Ve=we&&yt&&it.length>0,Re=Ue||Ve;return I?o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Workspaces documentation"]})})]}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})]}):P?o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Workspaces documentation"]})})]}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"workspaces"})})]}):F?o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Workspaces documentation"]})})]}),o.jsx("div",{className:"grid overflow-y-auto h-full",children:o.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[o.jsx(l$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:o.jsx(gf,{})}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[o.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-amber-500/10 mb-6",children:o.jsx(cte,{className:"h-8 w-8 text-amber-500"})}),o.jsx("h2",{className:"text-xl font-semibold text-neutral6 mb-2",children:"Workspace Not Supported"}),o.jsxs("p",{className:"text-neutral4 max-w-md mb-6",children:["The workspace feature requires a newer version of ",o.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),". Please upgrade your dependencies to enable workspace functionality."]}),o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[o.jsx(_e,{children:o.jsx(Fl,{})}),"Learn More"]})]})]})})]}):k?o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(_e,{children:o.jsx(Fl,{})}),"Workspaces documentation"]})})]}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Pt,{})})]}):!j&&!k&&!ce?o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Workspaces documentation"]})})]}),o.jsx("div",{className:"grid overflow-y-auto h-full",children:o.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[o.jsx(l$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:o.jsx(gf,{})}),o.jsx(Dxr,{})]})})]}):o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsxs(Ci,{children:[Re&&o.jsxs(ye,{variant:"light",onClick:()=>s(!a),children:[o.jsx(_e,{children:o.jsx(j3t,{className:"h-4 w-4"})}),"Search"]}),o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(_e,{children:o.jsx(Fl,{})}),"Workspaces documentation"]})]})]}),o.jsx("div",{className:"grid overflow-y-auto h-full",children:o.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start gap-6 h-full w-full",children:[o.jsx(l$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:o.jsx(gf,{})}),_.length>1&&o.jsxs("div",{className:"relative",children:[o.jsxs("button",{onClick:()=>l(!i),className:"flex items-center gap-2 px-3 py-2 text-sm border border-border1 rounded-lg bg-surface2 hover:bg-surface3 transition-colors w-full max-w-md",children:[D?.source==="agent"?o.jsx(w2,{className:"h-4 w-4 text-accent1"}):o.jsx(i7,{className:"h-4 w-4 text-neutral4"}),o.jsxs("span",{className:"flex-1 text-left truncate",children:[D?.name??"Select workspace",D?.source==="agent"&&D.agentName&&o.jsxs("span",{className:"text-neutral4 ml-1",children:["(",D.agentName,")"]})]}),o.jsx(V4t,{className:`h-4 w-4 text-neutral4 transition-transform ${i?"rotate-180":""}`})]}),i&&o.jsx("div",{className:"absolute z-50 mt-1 w-full max-w-md bg-surface2 border border-border1 rounded-lg shadow-lg overflow-hidden",children:_.map(Se=>o.jsxs("button",{onClick:()=>{B(Se.id),l(!1)},className:`flex items-center gap-3 px-3 py-2 w-full text-left hover:bg-surface3 transition-colors ${D?.id===Se.id?"bg-surface3":""}`,children:[Se.source==="agent"?o.jsx(w2,{className:"h-4 w-4 text-accent1 flex-shrink-0"}):o.jsx(i7,{className:"h-4 w-4 text-neutral4 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm font-medium text-neutral6 truncate",children:Se.name}),o.jsx("div",{className:"text-xs text-neutral4 truncate",children:Se.source==="agent"?`Agent: ${Se.agentName}`:"Global workspace"})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[Se.safety?.readOnly&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"}),Se.capabilities.hasFilesystem&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"FS"}),Se.capabilities.hasSandbox&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Sandbox"}),Se.capabilities.hasSkills&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Skills"})]})]},Se.id))})]}),_.length===1&&D&&o.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral4",children:[D.source==="agent"?o.jsx(w2,{className:"h-4 w-4 text-accent1"}):o.jsx(i7,{className:"h-4 w-4"}),o.jsx("span",{children:D.name}),D.source==="agent"&&D.agentName&&o.jsxs("span",{className:"text-neutral3",children:["(",D.agentName,")"]}),K&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),a&&Re&&C&&o.jsx(L_r,{workspaceId:C,canSearchFiles:Ue,canSearchSkills:Ve,canBM25:Ee,canVector:Me,showInitWarning:!j&&T?.status!=="ready",onViewFileResult:Se=>{U({file:Se,tab:"files"})},onViewSkillResult:(Se,Ie)=>{C&&r(`/workspaces/${C}/skills/${encodeURIComponent(Se)}?path=${encodeURIComponent(Ie)}`)}},C),o.jsxs("div",{className:"flex gap-2 border-b border-border1",children:[ue&&o.jsxs("button",{onClick:()=>W("files"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${$e==="files"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[o.jsx(lI,{className:"h-4 w-4"}),"Files"]}),we&&o.jsxs("button",{onClick:()=>W("skills"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${$e==="skills"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[o.jsx(z$,{className:"h-4 w-4"}),"Skills",yt&&it.length>0&&o.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:it.length})]})]}),o.jsxs("div",{className:"pb-8",children:[$e==="files"&&ue&&o.jsx("div",{className:"space-y-4",children:o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[o.jsx(Ixr,{entries:Gt,currentPath:$,isLoading:R,error:H,onNavigate:z,onFileSelect:Q,onRefresh:()=>G(),onCreateDirectory:K?void 0:Se=>ie.mutate({path:Se,workspaceId:C}),onDelete:K?void 0:Se=>J.mutate({path:Se,recursive:!0,force:!0,workspaceId:C})}),Z&&o.jsx(Mxr,{path:Z,content:ne?.content??"",isLoading:ae,mimeType:ne?.mimeType,onClose:()=>Q(null)})]})}),$e==="skills"&&we&&o.jsx(Hxr,{skills:it,isLoading:fe,isSkillsConfigured:yt,hasUndiscoveredAgentSkills:m,basePath:C?`/workspaces/${C}/skills`:"/workspaces",onAddSkill:te?()=>u(!0):void 0,onUpdateSkill:te?ke:void 0,onRemoveSkill:te?he:void 0,updatingSkillName:h??void 0,removingSkillName:d??void 0,mountPaths:Pe}),!ue&&!we&&o.jsx("div",{className:"py-12 text-center text-neutral4",children:o.jsx("p",{children:"No workspace capabilities are configured."})})]})]})}),C&&te&&o.jsx(Xxr,{open:c,onOpenChange:u,workspaceId:C,onInstall:pe,isInstalling:re.isPending,installedSkillIds:it.filter(Se=>Se.skillsShSource).map(Se=>`${Se.skillsShSource.owner}/${Se.skillsShSource.repo}/${Se.name}`),installedSkillNames:it.filter(Se=>!Se.skillsShSource).map(Se=>Se.name),writableMounts:Te,installedSkillPaths:Object.fromEntries(it.filter(Se=>Se.path).map(Se=>[Se.name,Se.path]))})]})}function L_r({workspaceId:e,canSearchFiles:t,canSearchSkills:n,canBM25:r,canVector:a,showInitWarning:s,onViewFileResult:i,onViewSkillResult:l}){const c=cfr(),u=hfr();return o.jsxs("div",{className:"border border-border1 rounded-lg p-4 bg-surface2 space-y-4",children:[t&&o.jsxs("div",{children:[o.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[o.jsx(lI,{className:"h-4 w-4"}),"Search Indexed Files"]}),s&&o.jsxs("p",{className:"text-xs text-amber-400 mb-3",children:["File search requires ",o.jsx("code",{className:"text-amber-300",children:"workspace.init()"})," to index files from your configured ",o.jsx("code",{className:"text-amber-300",children:"autoIndexPaths"}),"."]}),o.jsx($xr,{onSearch:d=>c.mutate({...d,workspaceId:e}),isSearching:c.isPending,searchResults:c.data?{...c.data,results:c.data.results.filter(d=>!d.id.startsWith("skill:"))}:void 0,canBM25:r,canVector:a,onViewResult:i})]}),n&&o.jsxs("div",{children:[o.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[o.jsx(z$,{className:"h-4 w-4"}),"Search Skills"]}),o.jsx(Fxr,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>l(d.skillName,d.skillPath)})]})]})}function F_r(e,t){return e==null||t==null?null:e in t?e:null}function z_r(){const{skillName:e,workspaceId:t}=ss(),[n]=Di(),r=as(),a=e?decodeURIComponent(e):"",s=n.get("path"),i=s?decodeURIComponent(s):void 0,l=n.get("agentId"),c=l?decodeURIComponent(l):null,d=r.getQueriesData({queryKey:["agents"]})?.[0]?.[1]??null,f=F_r(c,d),h=f?`/agents/${f}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[p,m]=b.useState(null),{data:g,isLoading:v,error:x}=dfr(a,{workspaceId:t,path:i}),{data:w}=mwt(g?.path?`${g.path}/SKILL.md`:"",{enabled:!!g?.path,workspaceId:t}),{data:O,isLoading:k}=ffr(a,p??"",{enabled:!!p,workspaceId:t,path:i}),_=C=>f?o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:h,children:[o.jsx(_e,{children:o.jsx(w2,{className:"h-4 w-4"})}),f]}),o.jsxs(dn,{as:"span",to:"",isCurrent:!0,children:[o.jsx(_e,{children:o.jsx(z$,{className:"h-4 w-4"})}),C]})]}):o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:h,children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsxs(dn,{as:Vt,to:h,children:[o.jsx(_e,{children:o.jsx(z$,{className:"h-4 w-4"})}),"Skills"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:C})]});return v?o.jsxs(ln,{children:[o.jsx(Qn,{children:_("Loading...")}),o.jsx("div",{className:"grid place-items-center h-full",children:o.jsx("div",{className:"h-8 w-8 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})})]}):x&&Yi(x)?o.jsxs(ln,{children:[o.jsx(Qn,{children:_("Session Expired")}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})]}):x&&Va(x)?o.jsxs(ln,{children:[o.jsx(Qn,{children:_("Permission Denied")}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"workspaces"})})]}):x||!g?o.jsxs(ln,{children:[o.jsx(Qn,{children:_("Error")}),o.jsx("div",{className:"grid place-items-center h-full",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load skill"}),o.jsx("p",{className:"text-sm text-neutral3",children:x?.message??"Skill not found"})]})})]}):o.jsxs(ln,{children:[o.jsxs(Qn,{children:[_(g.name),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[o.jsx(_e,{children:o.jsx(Fl,{})}),"Documentation"]})})]}),o.jsx("div",{className:"grid overflow-y-auto overflow-x-hidden h-full",children:o.jsx("div",{className:"max-w-[100rem] px-[3rem] mx-auto py-8 h-full w-full overflow-x-hidden",children:o.jsx(Zxr,{skill:g,rawSkillMd:w?.content,onReferenceClick:m})})}),o.jsx(Yxr,{open:!!p,onOpenChange:C=>!C&&m(null),skillName:g.name,referencePath:p??"",content:O?.content,isLoading:k})]})}const B_r=[{key:"primitives",title:"Primitives",href:"/primitives",links:[{name:"Agents",url:"/agents",icon:o.jsx(Xs,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"agents:read"},{name:"Prompts",url:"/prompts",icon:o.jsx(lI,{}),isOnMastraPlatform:!0,indent:!0},{name:"Workflows",url:"/workflows",icon:o.jsx(tl,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workflows:read"},{name:"Processors",url:"/processors",icon:o.jsx(fWe,{}),isOnMastraPlatform:!1,indent:!0,requiredPermission:"processors:read"},{name:"MCP Servers",url:"/mcps",icon:o.jsx(Tu,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"mcps:read"},{name:"Tools",url:"/tools",icon:o.jsx(Po,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"tools:read"},{name:"Workspaces",url:"/workspaces",icon:o.jsx(gf,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workspaces:read"},{name:"Request Context",url:"/request-context",icon:o.jsx($le,{}),isOnMastraPlatform:!0,indent:!0}]},{key:"evaluation",title:"Evaluation",href:"/evaluation",links:[{name:"Scorers",url:"/evaluation?tab=scorers",icon:o.jsx(cWe,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"scorers:read"},{name:"Datasets",url:"/evaluation?tab=datasets",icon:o.jsx(Ou,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]},{name:"Experiments",url:"/evaluation?tab=experiments",icon:o.jsx(vWe,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]}]},{key:"observability",title:"Observability",href:"/observability-overview",links:[{name:"Metrics",url:"/metrics",icon:o.jsx(Dle,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Traces",url:"/observability",icon:o.jsx(O0,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Logs",url:"/logs",icon:o.jsx(mWe,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"}]},{key:"bottom",separator:!0,links:[{name:"Settings",url:"/settings",icon:o.jsx(pge,{}),isOnMastraPlatform:!1},{name:"Resources",url:"/resources",icon:o.jsx(Sl,{}),isOnMastraPlatform:!0}]}],U_r={scorers:"/evaluation/scorers",datasets:"/evaluation/datasets",experiments:"/evaluation/experiments"};function R8e(e,t,n){if(e.url.includes("?")){const[r,a]=e.url.split("?"),s=new URLSearchParams(a).get("tab"),i=new URLSearchParams(n).get("tab");if(t===r&&s&&s===i)return!0;if(s){const l=U_r[s];if(l&&(t===l||t.startsWith(l+"/")))return!0}return!1}return t===e.url||t.startsWith(e.url+"/")}function q_r(){const{state:e}=lve(),t=$c(),n=t.pathname,{isMastraPlatform:r}=DSt(),{data:a}=eE(),{isCmsAvailable:s,isLoading:i}=Mge(),{hasPermission:l,hasAnyPermission:c,rbacEnabled:u,isAuthenticated:d,isLoading:f}=Pv(),h=a&&DR(a),p=new Set(["/prompts"]),m=g=>p.has(g.url)&&!s&&!i||r&&!g.isOnMastraPlatform?!1:u&&d&&f?!0:!(g.requiredPermission&&!l(g.requiredPermission)||g.requiredAnyPermission&&!c(g.requiredAnyPermission));return o.jsxs(vh,{children:[o.jsx("div",{className:"pt-3 mb-4 -ml-0.5 sticky top-0 bg-surface1 z-10",children:e==="collapsed"?o.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[o.jsx(ub,{className:"h-[1.5rem] w-[1.5rem] shrink-0 ml-3"}),h&&o.jsx(zse,{})]}):h?o.jsxs("span",{className:"flex items-center justify-between pl-3 pr-2",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(ub,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),o.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]}),o.jsx(zse,{})]}):o.jsxs("span",{className:"flex items-center gap-2 pl-3",children:[o.jsx(ub,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),o.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]})}),o.jsx(vh.Nav,{children:B_r.map(g=>{const v=g.links.filter(m),x=v.length>0&&g?.separator,w=v.some(k=>R8e(k,n,t.search)),O=!!(g.href&&n===g.href&&!w);return o.jsxs(vh.NavSection,{children:[g?.title?o.jsx(vh.NavHeader,{state:e,href:g.href,isActive:O,children:g.title}):o.jsx(o.Fragment,{children:x&&o.jsx(vh.NavSeparator,{})}),o.jsx(vh.NavList,{children:v.map(k=>{const _=R8e(k,n,t.search);return o.jsx(vh.NavLink,{state:e,link:k,isActive:_},k.name)})})]},g.key)})}),o.jsxs(vh.Bottom,{children:[e!=="collapsed"&&o.jsxs(o.Fragment,{children:[o.jsx(vh.NavSeparator,{}),o.jsx(Glr,{collapsed:!1})]}),o.jsx(vh.NavSeparator,{}),o.jsx("div",{className:"flex justify-end pb-3",children:o.jsx(vh.Trigger,{})})]})]})}const V_r=b.createContext({theme:"dark",setTheme:()=>null}),H_r=e=>e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";function NOt({children:e}){const t=Br(a=>a.theme),n=Br(a=>a.setTheme),r=t==="light"||t==="system"?t:"dark";return b.useEffect(()=>{const a=window.document.documentElement,s=c=>{const u=H_r(c);a.classList.remove("light","dark"),a.classList.add(u)};if(s(r),r!=="system")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>s("system");return i.addEventListener("change",l),()=>{i.removeEventListener("change",l)}},[r]),o.jsx(V_r.Provider,{value:{theme:r,setTheme:n},children:e})}const AOt="experimental-ui:",IOt="current",Q_r=Ne.createContext(null);function W_r(e,t){const n=window.localStorage.getItem(AOt+e);return n&&t.has(n)?n:IOt}function G_r({experiments:e,children:t}){const n=Ne.useMemo(()=>new Map(e.map(c=>[c.key,new Set(c.variants.map(u=>u.value))])),[e]),[r,a]=Ne.useState({});Ne.useLayoutEffect(()=>{const c={};for(const u of e){const d=n.get(u.key);c[u.key]=W_r(u.key,d)}a(c)},[e,n]);const s=Ne.useCallback(c=>r[c]??IOt,[r]),i=Ne.useCallback((c,u)=>{window.localStorage.setItem(AOt+c,u),a(d=>({...d,[c]:u}))},[]),l=Ne.useMemo(()=>({experiments:e,getVariant:s,setVariant:i}),[e,s,i]);return o.jsx(Q_r.Provider,{value:l,children:t})}const Z_r=[{key:"entity-list-page",name:"Entity List page UI",path:["/agents","/prompts","/tools","/datasets","/scorers","/mcps","/workflows","/processors"],variants:[{value:"current",label:"Current state"},{value:"new-proposal",label:"New proposal"}]}],Y_r=()=>({experimentalUIEnabled:typeof window<"u"&&window.MASTRA_EXPERIMENTAL_UI==="true"});function X_r({children:e}){const{data:t,isFetched:n}=eE(),r=n&&t?.enabled&&!DR(t),a=n&&!r;return o.jsxs(o.Fragment,{children:[o.jsx(a0r,{}),o.jsxs("div",{className:a?"grid h-full grid-cols-[auto_1fr]":"h-full",children:[a&&o.jsx(q_r,{}),o.jsx("div",{className:Y("bg-transparent overflow-y-auto",{"h-[calc(100%-1.5rem)]":r}),children:o.jsx(FSt,{children:e})})]})]})}const K_r=({children:e})=>{const{experimentalUIEnabled:t}=Y_r();return o.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[o.jsx(Qst,{position:"bottom-right"}),o.jsx(NOt,{defaultTheme:"dark",attribute:"class",children:o.jsx(Fu,{delayDuration:0,children:o.jsx(G_r,{experiments:t?Z_r:[],children:o.jsx(uxr,{children:o.jsx(X_r,{children:e})})})})})]})},J_r=({children:e})=>o.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[o.jsx(Qst,{position:"bottom-right"}),o.jsx(NOt,{defaultTheme:"dark",attribute:"class",children:o.jsx(Fu,{delayDuration:0,children:o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsx(FSt,{children:e})})})})]});function eEr({agentId:e}){return o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/agents",children:[o.jsx(_e,{children:o.jsx(Xs,{})}),"Agents"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:o.jsx(Ccr,{value:e,variant:"ghost"})})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Agents documentation"]})})]})}const tEr=({children:e})=>{const{agentId:t}=ss(),n=$c(),{isCmsAvailable:r}=Mge(),{hasObservability:a}=Klr(),s=yie.has("datasets"),i=r&&s,l=a&&s,{data:c}=Hd(t),u=kc(c?.provider??""),d=c?.modelId??"",f=c?.requestContextSchema,h=n.pathname.includes("/editor")?"versions":n.pathname.includes("/evaluate")?"evaluate":n.pathname.includes("/review")?"review":n.pathname.includes("/traces")?"traces":"chat",p=(h==="versions"||h==="evaluate"||h==="review")&&(i||l),m=o.jsxs(ln,{className:"grid-rows-[auto_auto_1fr]",children:[o.jsx(eEr,{agentId:t}),o.jsx(ipr,{agentId:t,activeTab:h,showPlayground:i,showObservability:l,rightSlot:p?o.jsx(opr,{requestContextSchema:f}):void 0}),e]});return o.jsx(TR,{children:o.jsx(xor,{defaultProvider:u,defaultModel:d,children:o.jsx(qhr,{children:o.jsx(wor,{children:m})})})})};function nEr(){const{data:e={},isLoading:t,error:n}=Zge(),[r,a]=b.useState("");return o.jsxs(ja,{children:[o.jsxs(ja.Top,{children:[o.jsxs(ft,{withMargins:!1,children:[o.jsx(ft.Column,{children:o.jsxs(ft.Title,{isLoading:t,children:[o.jsx(x0,{})," Processors"]})}),o.jsx(ft.Column,{className:"flex justify-end gap-2",children:o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Processors documentation",children:o.jsx(Sl,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(zh,{onSearch:a,label:"Filter processors",placeholder:"Filter by name"})})]}),o.jsx(Epr,{processors:e,isLoading:t,error:n,search:r,onSearch:a})]})}function rEr(){const{processorId:e}=ss(),{data:t,isLoading:n,error:r}=Fwt(e);return r&&Yi(r)?o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/processors",children:[o.jsx(_e,{children:o.jsx(x0,{})}),"Processors"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})]}):r&&Va(r)?o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/processors",children:[o.jsx(_e,{children:o.jsx(x0,{})}),"Processors"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"processors"})})]}):!n&&t?.isWorkflow?o.jsx(Wwr,{to:`/workflows/${e}/graph`,replace:!0}):n?o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/processors",children:[o.jsx(_e,{children:o.jsx(x0,{})}),"Processors"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:o.jsx(jr,{className:"h-6 w-32"})})]})}),o.jsxs("div",{className:"p-6",children:[o.jsx(jr,{className:"h-8 w-48 mb-4"}),o.jsx(jr,{className:"h-32 w-full"})]})]}):o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/processors",children:[o.jsx(_e,{children:o.jsx(x0,{})}),"Processors"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:o.jsx(Ipr,{value:e,variant:"ghost"})})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Processors documentation"]})})]}),o.jsx(Tpr,{processorId:e})]})}function aEr(){const{data:e={},isLoading:t}=cp(),{data:n={},isLoading:r,error:a}=p8(),[s,i]=b.useState(""),l=t||r;return o.jsxs(ja,{children:[o.jsxs(ja.Top,{children:[o.jsxs(ft,{withMargins:!1,children:[o.jsx(ft.Column,{children:o.jsxs(ft.Title,{isLoading:l,children:[o.jsx(Po,{})," Tools"]})}),o.jsx(ft.Column,{className:"flex justify-end gap-2",children:o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Tools documentation",children:o.jsx(Sl,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(zh,{onSearch:i,label:"Filter tools",placeholder:"Filter by name"})})]}),o.jsx(Mpr,{tools:n,agents:e,isLoading:l,error:a,search:s,onSearch:i})]})}const ROt={agentLink:e=>`/agents/${e}/chat/new`,agentToolLink:(e,t)=>`/agents/${e}/tools/${t}`,agentSkillLink:(e,t,n,r)=>r?`/workspaces/${r}/skills/${encodeURIComponent(t)}?agentId=${encodeURIComponent(e)}${n?`&path=${encodeURIComponent(n)}`:""}`:"/workspaces",agentsLink:()=>"/agents",agentNewThreadLink:e=>`/agents/${e}/chat/new`,agentThreadLink:(e,t,n)=>n?`/agents/${e}/chat/${t}?messageId=${n}`:`/agents/${e}/chat/${t}`,workflowsLink:()=>"/workflows",workflowLink:e=>`/workflows/${e}`,networkLink:e=>`/networks/v-next/${e}/chat`,networkNewThreadLink:e=>`/networks/v-next/${e}/chat/${Qi()}`,networkThreadLink:(e,t)=>`/networks/v-next/${e}/chat/${t}`,scorerLink:e=>`/evaluation/scorers/${e}`,cmsScorersCreateLink:()=>"/cms/scorers/create",cmsScorerEditLink:e=>`/cms/scorers/${e}/edit`,cmsAgentCreateLink:()=>"/cms/agents/create",cmsAgentEditLink:e=>`/cms/agents/${e}/edit`,promptBlockLink:e=>`/prompts/${e}`,promptBlocksLink:()=>"/prompts",cmsPromptBlockCreateLink:()=>"/cms/prompts/create",cmsPromptBlockEditLink:e=>`/cms/prompts/${e}/edit`,toolLink:e=>`/tools/${e}`,skillLink:(e,t,n)=>n?`/workspaces/${n}/skills/${encodeURIComponent(e)}${t?`?path=${encodeURIComponent(t)}`:""}`:"/workspaces",workspaceLink:e=>e?`/workspaces/${e}`:"/workspaces",workspaceSkillLink:(e,t,n)=>n?`/workspaces/${n}/skills/${encodeURIComponent(e)}${t?`?path=${encodeURIComponent(t)}`:""}`:"/workspaces",workspacesLink:()=>"/workspaces",processorsLink:()=>"/processors",processorLink:e=>`/processors/${e}`,mcpServerLink:e=>`/mcps/${e}`,mcpServerToolLink:(e,t)=>`/mcps/${e}/tools/${t}`,workflowRunLink:(e,t)=>`/workflows/${e}/graph/${t}`,datasetLink:e=>`/evaluation/datasets/${e}`,datasetItemLink:(e,t)=>`/evaluation/datasets/${e}/items/${t}`,datasetExperimentLink:(e,t)=>`/evaluation/datasets/${e}/experiments/${t}`,experimentLink:e=>`/evaluation/experiments/${e}`},sEr=()=>{const e=Lc(),t=n=>e(n,{viewTransition:!0});return o.jsx(Ibt,{Link:COt,navigate:t,paths:ROt,children:o.jsx(K_r,{children:o.jsx(Xk,{})})})},iEr=()=>{const e=Lc(),t=n=>e(n,{viewTransition:!0});return o.jsx(Ibt,{Link:COt,navigate:t,paths:ROt,children:o.jsx(J_r,{children:o.jsx(Xk,{})})})},oEr=!!window.MASTRA_CLOUD_API_ENDPOINT,P8e=yie.has("datasets"),M8e=[{index:!0,element:o.jsx(mkr,{})},{path:"instruction-blocks",element:o.jsx(gkr,{})},{path:"tools",element:o.jsx(xkr,{})},{path:"agents",element:o.jsx(fkr,{})},{path:"scorers",element:o.jsx(ykr,{})},{path:"workflows",element:o.jsx(Skr,{})},{path:"skills",element:o.jsx(bkr,{})},{path:"memory",element:o.jsx(vkr,{})},{path:"variables",element:o.jsx(wkr,{})}],lEr=[{path:"/login",element:o.jsx(qkr,{})},{path:"/signup",element:o.jsx(b_r,{})},{element:o.jsx(iEr,{}),children:[{path:"/agents/:agentId/session",element:o.jsx(x8e,{})},{path:"/agents/:agentId/session/:threadId",element:o.jsx(x8e,{})}]},{element:o.jsx(sEr,{}),children:[...oEr?[]:[{path:"/settings",element:o.jsx(y_r,{})},{path:"/templates",element:o.jsx(I_r,{})},{path:"/templates/:templateSlug",element:o.jsx(P_r,{})}],{path:"/logs",element:o.jsx(Zkr,{})},{path:"/primitives",element:o.jsx(u_r,{})},{path:"/evaluation",element:o.jsx(Bkr,{})},{path:"/evaluation/scorers/:scorerId",element:o.jsx(m_r,{})},{path:"/metrics",element:o.jsx(Jkr,{})},{path:"/observability-overview",element:o.jsx(l_r,{})},{path:"/observability",element:o.jsx(i_r,{})},{path:"/resources",element:o.jsx(p_r,{})},{path:"/agents",element:o.jsx(skr,{})},{path:"/cms/agents/create",element:o.jsx(hkr,{}),children:M8e},{path:"/cms/agents/:agentId/edit",element:o.jsx(pkr,{}),children:M8e},{path:"/cms/scorers/create",element:o.jsx(Ekr,{})},{path:"/cms/scorers/:scorerId/edit",element:o.jsx(jkr,{})},{path:"/prompts",element:o.jsx(d_r,{})},{path:"/cms/prompts/create",element:o.jsx(Okr,{})},{path:"/cms/prompts/:promptBlockId/edit",element:o.jsx(_kr,{})},{path:"/agents/:agentId/tools/:toolId",element:o.jsx(M_r,{})},{path:"/agents/:agentId",element:o.jsx(tEr,{children:o.jsx(Xk,{})}),children:[{index:!0,loader:({params:e})=>KJ(`/agents/${e.agentId}/chat`)},{path:"chat",element:o.jsx(b8e,{})},{path:"chat/:threadId",element:o.jsx(b8e,{})},...P8e?[{path:"editor",element:o.jsx(ckr,{})},{path:"evaluate",element:o.jsx(lkr,{})},{path:"review",element:o.jsx(ukr,{})}]:[],{path:"traces",element:o.jsx(dkr,{})}]},{path:"/tools",element:o.jsx(aEr,{})},{path:"/tools/:toolId",element:o.jsx(D_r,{})},{path:"/processors",element:o.jsx(nEr,{})},{path:"/processors/:processorId",element:o.jsx(rEr,{})},{path:"/mcps",element:o.jsx(Ykr,{})},{path:"/mcps/:serverId",element:o.jsx(Xkr,{})},{path:"/mcps/:serverId/tools/:toolId",element:o.jsx(Kkr,{})},{path:"/workspaces",element:o.jsx(I8e,{})},{path:"/workspaces/:workspaceId",element:o.jsx(I8e,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:o.jsx(z_r,{})},{path:"/workflows",element:o.jsx($_r,{})},{path:"/workflows/:workflowId",element:o.jsx(ISr,{children:o.jsx(Xk,{})}),children:[{index:!0,loader:({params:e})=>KJ(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:o.jsx(A8e,{})},{path:"graph/:runId",element:o.jsx(A8e,{})}]},...P8e?[{path:"/evaluation/datasets/:datasetId",element:o.jsx(Nkr,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId",element:o.jsx(Rkr,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId/versions",element:o.jsx(Dkr,{})},{path:"/evaluation/datasets/:datasetId/experiments/:experimentId",element:o.jsx(Akr,{})},{path:"/evaluation/experiments/:experimentId",element:o.jsx(Ukr,{})},{path:"/evaluation/datasets/:datasetId/experiments",element:o.jsx(Ikr,{})},{path:"/evaluation/datasets/:datasetId/items",element:o.jsx(Pkr,{})},{path:"/evaluation/datasets/:datasetId/versions",element:o.jsx(Lkr,{})}]:[],{index:!0,loader:()=>KJ("/agents")},{path:"/request-context",element:o.jsx(f_r,{})}]}];function cEr(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:n,apiPrefix:r,isLoading:a}=Pge(),s=b.useMemo(()=>t?Jxr(t,r):void 0,[t,r]);if(a)return null;if(!t)return o.jsx(Xlr,{});const i=bSr(lEr,{basename:e});return o.jsx(vzt,{baseUrl:t,headers:n,apiPrefix:r,customFetch:s,children:o.jsx(rkr,{children:o.jsx(Vwr,{router:i})})})}function uEr(){const e=window.MASTRA_SERVER_PROTOCOL||"http",t=window.MASTRA_SERVER_HOST||"localhost",n=window.MASTRA_SERVER_PORT||4111,r=window.MASTRA_API_PREFIX||"/api",a=window.MASTRA_CLOUD_API_ENDPOINT||"",s=window.MASTRA_AUTO_DETECT_URL==="true",i=a||(s?window.location.origin:`${e}://${t}:${n}`);return o.jsx(gxr,{children:o.jsx(Ulr,{endpoint:i,defaultApiPrefix:r,children:o.jsx(cEr,{})})})}V_t.createRoot(document.getElementById("root")).render(o.jsx(b.StrictMode,{children:o.jsx(uEr,{})}));const xCr=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{ktt as A,gat as B,Ett as C,mrt as D,Ud as E,Lf as F,fEr as G,Y_t as H,Ua as I,xCr as J,nw as L,Ott as N,Q3 as _,OFt as a,FFt as b,QEr as c,o1e as d,aw as e,MFt as f,yO as g,LFt as h,Xw as i,Kw as j,Yw as k,ksn as l,Srt as m,K0 as n,ps as o,Fan as p,Lan as q,ide as r,Jle as s,se as t,gL as u,Yc as v,jFt as w,xt as x,ot as y,Fat as z};
|
|
516
|
+
`).reduce((l,c)=>{if(!c||c.startsWith("#"))return l;const[u,d]=c.split("=");return u&&(l[u]=d?.split("")?.every(f=>f==="*")?"":d?.replaceAll('"',"")),l},{}):{}}const O_r=()=>Ot({queryKey:["mastra-templates"],queryFn:jOt}),k_r=({repoOrSlug:e,owner:t})=>Ot({queryKey:["template-repo",e,t],queryFn:()=>w_r({repoOrSlug:e,owner:t})}),__r=({repo:e,owner:t,branch:n})=>Ot({queryKey:["template-repo-env-vars",e,t,n],queryFn:()=>S_r({repo:e,owner:t,branch:n})}),E_r=()=>{const e=Ye();return Ot({queryKey:["agent-builder-workflow"],queryFn:async()=>await e.getAgentBuilderAction("merge-template").details()})},C_r=()=>{const e=Ye();return qn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").createRun({runId:t})})},j_r=()=>{const e=Ye();return qn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").runById(t)})},T8e=e=>{if(typeof e=="string")return e;if(e==null)return"Unknown error";if(e instanceof Error)return typeof e.message=="string"&&e.message.length>0?e.message:"Unknown error";if(typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)},N8e=(e,t,n)=>{let r={...t};if(!(r.payload?.workflowState?.steps&&Object.keys(r.payload.workflowState.steps).length>0)&&n?.allSteps&&(r.payload={...r.payload,workflowState:{...r.payload?.workflowState,steps:Object.keys(n.allSteps).reduce((s,i)=>(s[i]={id:i,description:n.allSteps[i].description,status:"pending"},s),{})}}),e.type==="start"||e.type==="workflow-start"){const s={};n?.allSteps&&Object.entries(n.allSteps).forEach(([l,c])=>{s[l]={id:c.id,description:c.description,status:"pending"}});const i=e.runId||e.payload?.runId;r={...r,runId:i,eventTimestamp:new Date().toISOString(),status:"running",phase:"initializing",payload:{workflowState:{status:"running",steps:s},currentStep:null}}}if(e.type==="step-start"||e.type==="workflow-step-start"){const s=e.payload.id;r={...r,phase:"processing",payload:{...r.payload,currentStep:{id:s,status:"running",startTime:new Date,...e.payload},workflowState:{...r.payload.workflowState,steps:{...r.payload.workflowState.steps,[s]:{...r.payload.workflowState.steps[s],status:"running",startTime:new Date,...e.payload}}}}}}if(e.type==="step-result"||e.type==="workflow-step-result"){const s=e.payload.id,i=e.payload.status,l=e.payload.error;if(r={...r,payload:{...r.payload,currentStep:{...r.payload.currentStep,status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date},workflowState:{...r.payload.workflowState,steps:{...r.payload.workflowState.steps,[s]:{...r.payload.workflowState.steps[s],status:e.payload.status,output:e.payload.output,error:e.payload.error,endTime:new Date}}}}},i==="failed"&&l){const c=T8e(l);r={...r,status:"failed",error:c,phase:"error",failedStep:{id:s,error:c,description:e.payload.description||s},payload:{...r.payload,workflowState:{...r.payload.workflowState,status:"failed"}},errorTimestamp:new Date}}}if((e.type==="step-finish"||e.type==="workflow-step-finish")&&(r={...r,payload:{...r.payload,currentStep:null}}),(e.type==="finish"||e.type==="workflow-finish")&&(r.phase==="error"||r.status==="failed"?r={...r,completedAt:new Date}:r={...r,status:e.payload.status||"completed",phase:"completed",payload:{...r.payload,currentStep:null,workflowState:{...r.payload.workflowState,status:e.payload.status||"completed"}},completedAt:new Date}),e.type==="error"){const s=T8e(e.payload.error);r={...r,status:"failed",error:s,phase:"error",payload:{...r.payload,workflowState:{...r.payload.workflowState,status:"failed"}},errorTimestamp:new Date}}return{newState:r}},T_r=(e,t)=>{try{localStorage.setItem(`template-install-${e}`,JSON.stringify({state:t,timestamp:Date.now()}))}catch(n){console.warn("Failed to save template state to localStorage:",n)}},TOt=(e,t)=>{const[n,r]=b.useState({}),[a,s]=b.useState(!1);return{streamResult:n,isStreaming:a,processStream:async(l,c)=>{if(s(!0),r({}),!l)throw new Error("No stream returned");const u=l.getReader();let d={runId:c||t,eventTimestamp:new Date().toISOString(),phase:"running",payload:{workflowState:{steps:{}},currentStep:null}};try{for(;;){const{done:f,value:h}=await u.read();if(f)break;const{newState:p}=N8e(h,d,e);if(d=p,r(p),h.runId||c||t){const m=h.runId||c||t;T_r(m,p)}}}catch(f){console.error("💥 [processStream] Error processing template installation stream:",f);const{newState:h}=N8e({type:"error",payload:{error:f instanceof Error?f.message:"Unknown error"}},d,e);r(h)}finally{s(!1),u.releaseLock()}}}},N_r=e=>{const t=Ye(),{streamResult:n,isStreaming:r,processStream:a}=TOt(e);return{streamInstall:qn({mutationFn:async({inputData:i,selectedModel:l,runId:c})=>{for(let d=1;d<=3;d++)try{const f=t.getAgentBuilderAction("merge-template"),h=new JO;h.set("selectedModel",l);const p=await f.stream({inputData:i,requestContext:h},c);await a(p,c);return}catch(f){console.error(`💥 [streamInstall] Attempt ${d} failed:`,f);const h=f?.message?.includes("Failed to fetch")||f?.message?.includes("NetworkError")||f?.message?.includes("network error")||f?.message?.includes("fetch")||f?.code==="NETWORK_ERROR"||f?.name==="TypeError";if(console.warn(`Stream attempt ${d}/3 failed:`,f),h){const p=c?`Network error during template installation (likely hot reload). Please refresh the page to resume from where you left off using runId: ${c}`:"Network error during template installation (likely hot reload). Please try again.";throw console.error("🔌 Stream network error:",p),new Error(p)}throw console.error("❌ [streamInstall] Non-network error or max retries reached, throwing:",f),f}}}),streamResult:n,isStreaming:r}},A_r=e=>{const t=Ye(),{streamResult:n,isStreaming:r,processStream:a}=TOt(e);return{observeInstall:qn({mutationFn:async({runId:i})=>{for(let u=1;u<=3;u++)try{const f=await t.getAgentBuilderAction("merge-template").observeStream({runId:i});await a(f,i);return}catch(d){console.error(`💥 [observeInstall] Attempt ${u} failed:`,d);const f=d?.message?.includes("Failed to fetch")||d?.message?.includes("NetworkError")||d?.message?.includes("network error")||d?.message?.includes("fetch")||d?.code==="NETWORK_ERROR"||d?.name==="TypeError";if(console.warn(`ObserveStream attempt ${u}/3 failed:`,d),f&&u<3){console.info(`🔄 ObserveStream network error detected (likely hot reload), retrying in 2000ms... (attempt ${u+1}/3)`),await new Promise(h=>setTimeout(h,2e3));continue}throw console.error("❌ [observeInstall] Non-network error or max retries reached, throwing:",d),d}}}),streamResult:n,isStreaming:r}};function I_r(){const{data:e,isLoading:t}=O_r(),{templates:n,tags:r,providers:a}=e??{templates:[],tags:[],providers:[]},[s,i]=b.useState("all"),[l,c]=b.useState("all"),[u,d]=b.useState(""),f=[{value:"all",label:"Any tag"}];(r||[]).forEach(w=>{f.push({value:w,label:w})});const h=[{value:"all",label:"Any provider"}];(a||[]).forEach(w=>{h.push({value:w,label:w})});const p=(w,O)=>{O==="tag"?i(w):O==="provider"&&c(w)},m=w=>{d(w)},g=()=>{i("all"),c("all"),d("")},v=n.filter(w=>!(u&&!w.title.toLowerCase().includes(u)&&!w.description.toLowerCase().includes(u)||s!=="all"&&!w.tags.includes(s)||l!=="all"&&!w.supportedProviders.includes(l))),x=u||s!=="all"||l!=="all";return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gWe,{})}),"Templates"]})}),o.jsxs("div",{className:Y("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[o.jsx(Fpr,{selectedTag:s,onTagChange:w=>p(w,"tag"),tagOptions:f,selectedProvider:l,onProviderChange:w=>p(w,"provider"),providerOptions:h,searchTerm:u,onSearchChange:m,onReset:x?g:void 0,className:"max-w-[80rem]",isLoading:t}),o.jsx(Bpr,{templates:v,linkComponent:Vt,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const R_r="1.23.0";function P_r(){const{templateSlug:e}=ss(),[t,n]=Di(),[r,a]=b.useState(""),[s,i]=b.useState(""),[l,c]=b.useState(""),[u,d]=b.useState({}),[f,h]=b.useState([]),[p,m]=b.useState(null),[g,v]=b.useState(!1),[x,w]=b.useState(""),[O,k]=b.useState(!1),[_,C]=b.useState(!1),[T,j]=b.useState([]),{data:A,isLoading:I}=k_r({repoOrSlug:e,owner:"mastra-ai"}),M=R_r?.includes("beta")??!1?"beta":"main",{data:F,isLoading:D}=__r({repo:A?.githubUrl?new URL(A.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:M}),{data:U,isLoading:B}=E_r(),{mutateAsync:z,isPending:Q}=C_r(),{mutateAsync:W}=j_r(),{streamInstall:$,streamResult:Z,isStreaming:V}=N_r(U),{observeInstall:R,streamResult:H,isStreaming:G}=A_r(U);b.useEffect(()=>{const re=t.get("runId");re&&!g&&!p&&!V&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:re}),w(re),W({runId:re}).then(oe=>{const ge=oe.snapshot;if(ge?.status==="success"&&ge?.result?.success)v(!0);else if(ge?.result?.success===!1)if(ge?.result?.validationResults&&!ge?.result?.validationResults?.valid&&ge?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ue,errors:we}=ge.result.validationResults,Ee=`Template installation completed but ${ue} validation issue${ue>1?"s":""} remain unresolved.`;m(Ee),j(we||[])}else{const ue=ge?.result?.message||ge?.result?.error||"Template installation failed";m(typeof ue=="string"?ue:String(ue))}}).catch(oe=>{console.error("❌ Failed to fetch run details:",oe),m("Failed to retrieve installation status after reload")}))},[t,g,p,V,G,W]),b.useEffect(()=>{const re=t.get("runId"),oe=t.get("resume"),ge=t.get("provider");if(re&&oe==="true"&&ge&&!V&&!G&&!O&&!_&&U){w(re),k(!0);try{W({runId:re}).then(ce=>{if(ce.snapshot?.status==="running")return R.mutateAsync({runId:re})}).then(()=>{n(ce=>{const ue=new URLSearchParams(ce);return ue.delete("resume"),ue})}).catch(ce=>{console.error("❌ Failed to resume template installation:",ce),ce.message?.includes("404")||ce.message?.includes("not found")?m("Template installation run not found. It may have expired or been completed."):m("Failed to resume template installation. Please try again.")})}catch(ce){console.error("❌ Auto-resume failed with error:",ce),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,V,G,O,_,U,W,R,n]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],ie=[{key:"tools",label:"Tools",value:A?.tools?.length?A.tools.map(re=>re).join(", "):"n/a",icon:o.jsx(Po,{})},{key:"agents",label:"Agents",value:A?.agents?.length?A.agents.map(re=>re).join(", "):"n/a",icon:o.jsx(Xs,{})},{key:"workflows",label:"Workflows",value:A?.workflows?.length?A.workflows.map(re=>re).join(", "):"n/a",icon:o.jsx(L3t,{})},{key:"providers",label:"Providers",value:A?.supportedProviders?.length?A.supportedProviders.join(", "):"n/a",icon:o.jsx(D4t,{})},{key:"tags",label:"Tags",value:A?.tags?.length?A.tags.join(", "):"n/a",icon:o.jsx(A3t,{})}],ne=[{...ie[0]},{...ie[1]},{...ie[2]}].filter(re=>re.value!=="n/a");b.useEffect(()=>{F&&d(F)},[F]),b.useEffect(()=>{const re=Z||H;re?.phase==="error"&&re?.error&&m(typeof re.error=="string"?re.error:String(re.error))},[Z?.phase,Z?.error,H?.phase,H?.error]);const ae=re=>{a(re)},le=async re=>(i(re.provider),c(re.modelId),{message:"Model updated successfully"}),fe=async()=>{const re=Object.entries(u).reduce((oe,[ge,ce])=>(ce===""&&oe.push(ge),oe),[]);if(re.length>0){h(re);return}if(A){m(null),v(!1),w(""),C(!0);try{const ge={repo:A.githubUrl||`https://github.com/mastra-ai/template-${A.slug}`,ref:M,slug:A.slug,variables:u},{runId:ce}=await z({});w(ce),n(ue=>{const we=new URLSearchParams(ue);return we.set("runId",ce),we.set("resume","true"),we.set("provider",r||"openai"),we}),await $.mutateAsync({inputData:ge,selectedModel:{provider:s,modelId:l},runId:ce})}catch(oe){C(!1),m(oe?.message||"Template installation failed"),console.error("Template installation failed",oe)}}},X=re=>{const{name:oe,value:ge}=re.target;ge.trim()===""?h(ce=>[...ce,oe]):h(ce=>ce.filter(ue=>ue!==oe)),d(ce=>({...ce,[oe]:ge}))};return o.jsxs(ln,{children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/templates",children:[o.jsx(_e,{children:o.jsx(gWe,{})}),"Templates"]}),o.jsx(dn,{as:Vt,to:`/templates/${A?.slug}`,isCurrent:!0,children:A?.title&&A.title})]})}),o.jsx("div",{className:Y("w-full lg:px-12 h-full overflow-y-scroll"),children:o.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[o.jsx(Upr,{isLoading:I,title:A?.title,description:A?.longDescription,imageURL:A?.imageURL,githubUrl:A?.githubUrl,infoData:ie,templateSlug:e}),A&&o.jsxs(o.Fragment,{children:[(V||G)&&o.jsx(Gpr,{name:A.title,streamResult:G?H:Z,runId:x,workflowInfo:U}),g&&o.jsx(Zpr,{name:A.title,installedEntities:ne,linkComponent:Vt}),p&&o.jsx(Ypr,{errorMsg:p,validationErrors:T.length>0?T:Z?.validationResults?.errors||H?.validationResults?.errors}),!V&&!G&&!g&&!p&&o.jsx(qpr,{providerOptions:J,selectedProvider:r,onProviderChange:ae,variables:u,setVariables:d,errors:f,setErrors:h,handleInstallTemplate:fe,handleVariableChange:X,isLoadingEnvVars:D||B,isInstalling:Q,defaultModelProvider:s,defaultModelId:l,onModelUpdate:le})]})]})})]})}const M_r=()=>{const{toolId:e,agentId:t}=ss();return o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/agents",children:[o.jsx(_e,{children:o.jsx(Xs,{})}),"Agents"]}),o.jsx(dn,{as:Vt,to:`/agents/${t}/chat`,children:t}),o.jsx(dn,{as:Vt,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[o.jsx(_e,{children:o.jsx(Fl,{})}),"Tools documentation"]})})]}),o.jsx(Icr,{toolId:e,agentId:t})]})},D_r=()=>{const{toolId:e}=ss();return o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/tools",children:[o.jsx(_e,{children:o.jsx(Po,{})}),"Tools"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:o.jsx(Lpr,{value:e,variant:"ghost"})})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Tools documentation"]})})]}),o.jsx($pr,{toolId:e})]})};function $_r(){const{data:e,isLoading:t,error:n}=Dv(),[r,a]=b.useState("");return o.jsxs(ja,{children:[o.jsxs(ja.Top,{children:[o.jsxs(ft,{withMargins:!1,children:[o.jsx(ft.Column,{children:o.jsxs(ft.Title,{isLoading:t,children:[o.jsx(tl,{})," Workflows"]})}),o.jsx(ft.Column,{className:"flex justify-end gap-2",children:o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workflows documentation",children:o.jsx(Sl,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(zh,{onSearch:a,label:"Filter workflows",placeholder:"Filter by name or description"})})]}),o.jsx(sir,{workflows:e||{},isLoading:t,error:n,search:r,onSearch:a})]})}const A8e=()=>{const{workflowId:e}=ss(),{data:t,isLoading:n,error:r}=RR(e);return r&&Yi(r)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})}):r&&Va(r)?o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"workflows"})}):o.jsx(Kbt,{workflowId:e,workflow:t??void 0,isLoading:n})};function I8e(){const{workspaceId:e}=ss(),[t,n]=Di(),r=Lc(),[a,s]=b.useState(!1),[i,l]=b.useState(!1),[c,u]=b.useState(!1),[d,f]=b.useState(null),[h,p]=b.useState(null),[m,g]=b.useState(!1),v=t.get("file"),x=t.get("tab"),{data:w,error:O,isLoading:k}=pwt(),_=w?.workspaces??[],C=e??_[0]?.id,{data:T,isLoading:j,error:A}=afr(C),I=Yi(O)||Yi(A),P=Va(O)||Va(A),M=t.get("path")||".",F=sse(O)||sse(A),D=C?_.find(Se=>Se.id===C):void 0,U=Se=>{const Ie=new URLSearchParams(t);for(const[Qe,et]of Object.entries(Se))et===null?Ie.delete(Qe):Ie.set(Qe,et);n(Ie)},B=Se=>{g(!1),s(!1),r(`/workspaces/${Se}`)},z=Se=>{U({path:Se==="."||Se===""?null:Se,file:null})},Q=Se=>{U({file:Se})},W=Se=>{U({tab:Se})},$=M,Z=v,{data:V,isLoading:R,error:H,refetch:G}=sfr($,{enabled:T?.isWorkspaceConfigured&&T?.capabilities?.hasFilesystem,workspaceId:C}),J=ofr(),ie=lfr(),{data:ne,isLoading:ae}=mwt(Z??"",{enabled:!!Z,workspaceId:C}),{data:le,isLoading:fe,refetch:X}=ufr({workspaceId:C}),re=vfr(),oe=yfr(),ge=bfr(),ce=T?.isWorkspaceConfigured??!1,ue=T?.capabilities?.hasFilesystem??!1,we=T?.capabilities?.hasSkills??!1,Ee=T?.capabilities?.canBM25??!1,Me=T?.capabilities?.canVector??!1,K=D?.safety?.readOnly??!1,te=ue&&!K,me=T?.mounts,Te=me?.filter(Se=>!Se.readOnly).map(Se=>({path:Se.path,displayName:Se.displayName,icon:Se.icon,provider:Se.provider,name:Se.name})),Pe=me&&me.length>1?me.map(Se=>Se.path):void 0,pe=b.useCallback(Se=>{C&&re.mutate({...Se,workspaceId:C},{onSuccess:async Ie=>{if(Ie.success){u(!1);const{data:Qe,error:et}=await X();if(et||!Qe){Fe.success(`Skill "${Ie.skillName}" installed successfully (${Ie.filesWritten} files)`);return}Qe.skills.some(an=>an.name===Ie.skillName)?Fe.success(`Skill "${Ie.skillName}" installed successfully (${Ie.filesWritten} files)`):(g(!0),Fe.warning(`Skill "${Ie.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else Fe.error("Failed to install skill")},onError:Ie=>{Fe.error(`Failed to install skill: ${Ie instanceof Error?Ie.message:"Unknown error"}`)}})},[C,re,X]),ke=b.useCallback(Se=>{C&&(p(Se),oe.mutate({workspaceId:C,skillName:Se},{onSuccess:Ie=>{if(p(null),Ie.updated.length>0){const Qe=Ie.updated[0];Qe.success?(Fe.success(`Skill "${Se}" updated successfully (${Qe.filesWritten} files)`),X()):Fe.error(`Failed to update skill: ${Qe.error??"Unknown error"}`)}else Fe.error("Failed to update skill: No update result returned")},onError:Ie=>{p(null),Fe.error(`Failed to update skill: ${Ie instanceof Error?Ie.message:"Unknown error"}`)}}))},[C,oe,X]),he=b.useCallback(Se=>{C&&(f(Se),ge.mutate({workspaceId:C,skillName:Se},{onSuccess:Ie=>{f(null),Ie.success?(Fe.success(`Skill "${Ie.skillName}" removed successfully`),X()):Fe.error(`Failed to remove skill "${Ie.skillName}"`)},onError:Ie=>{f(null),Fe.error(`Failed to remove skill: ${Ie instanceof Error?Ie.message:"Unknown error"}`)}}))},[C,ge,X]),$e=x==="files"&&ue?"files":x==="skills"&&we?"skills":ue?"files":we?"skills":"files",it=le?.skills??[],yt=le?.isSkillsConfigured??!1,Gt=V?.entries??[],Ue=ue&&(Ee||Me),Ve=we&&yt&&it.length>0,Re=Ue||Ve;return I?o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Workspaces documentation"]})})]}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})]}):P?o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Workspaces documentation"]})})]}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"workspaces"})})]}):F?o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Workspaces documentation"]})})]}),o.jsx("div",{className:"grid overflow-y-auto h-full",children:o.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[o.jsx(l$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:o.jsx(gf,{})}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[o.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-amber-500/10 mb-6",children:o.jsx(cte,{className:"h-8 w-8 text-amber-500"})}),o.jsx("h2",{className:"text-xl font-semibold text-neutral6 mb-2",children:"Workspace Not Supported"}),o.jsxs("p",{className:"text-neutral4 max-w-md mb-6",children:["The workspace feature requires a newer version of ",o.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),". Please upgrade your dependencies to enable workspace functionality."]}),o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[o.jsx(_e,{children:o.jsx(Fl,{})}),"Learn More"]})]})]})})]}):k?o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(_e,{children:o.jsx(Fl,{})}),"Workspaces documentation"]})})]}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Pt,{})})]}):!j&&!k&&!ce?o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Workspaces documentation"]})})]}),o.jsx("div",{className:"grid overflow-y-auto h-full",children:o.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[o.jsx(l$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:o.jsx(gf,{})}),o.jsx(Dxr,{})]})})]}):o.jsxs(ln,{children:[o.jsxs(Qn,{children:[o.jsxs(Ei,{children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsxs(Ci,{children:[Re&&o.jsxs(ye,{variant:"light",onClick:()=>s(!a),children:[o.jsx(_e,{children:o.jsx(j3t,{className:"h-4 w-4"})}),"Search"]}),o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(_e,{children:o.jsx(Fl,{})}),"Workspaces documentation"]})]})]}),o.jsx("div",{className:"grid overflow-y-auto h-full",children:o.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start gap-6 h-full w-full",children:[o.jsx(l$,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:o.jsx(gf,{})}),_.length>1&&o.jsxs("div",{className:"relative",children:[o.jsxs("button",{onClick:()=>l(!i),className:"flex items-center gap-2 px-3 py-2 text-sm border border-border1 rounded-lg bg-surface2 hover:bg-surface3 transition-colors w-full max-w-md",children:[D?.source==="agent"?o.jsx(w2,{className:"h-4 w-4 text-accent1"}):o.jsx(i7,{className:"h-4 w-4 text-neutral4"}),o.jsxs("span",{className:"flex-1 text-left truncate",children:[D?.name??"Select workspace",D?.source==="agent"&&D.agentName&&o.jsxs("span",{className:"text-neutral4 ml-1",children:["(",D.agentName,")"]})]}),o.jsx(V4t,{className:`h-4 w-4 text-neutral4 transition-transform ${i?"rotate-180":""}`})]}),i&&o.jsx("div",{className:"absolute z-50 mt-1 w-full max-w-md bg-surface2 border border-border1 rounded-lg shadow-lg overflow-hidden",children:_.map(Se=>o.jsxs("button",{onClick:()=>{B(Se.id),l(!1)},className:`flex items-center gap-3 px-3 py-2 w-full text-left hover:bg-surface3 transition-colors ${D?.id===Se.id?"bg-surface3":""}`,children:[Se.source==="agent"?o.jsx(w2,{className:"h-4 w-4 text-accent1 flex-shrink-0"}):o.jsx(i7,{className:"h-4 w-4 text-neutral4 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm font-medium text-neutral6 truncate",children:Se.name}),o.jsx("div",{className:"text-xs text-neutral4 truncate",children:Se.source==="agent"?`Agent: ${Se.agentName}`:"Global workspace"})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[Se.safety?.readOnly&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"}),Se.capabilities.hasFilesystem&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"FS"}),Se.capabilities.hasSandbox&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Sandbox"}),Se.capabilities.hasSkills&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Skills"})]})]},Se.id))})]}),_.length===1&&D&&o.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral4",children:[D.source==="agent"?o.jsx(w2,{className:"h-4 w-4 text-accent1"}):o.jsx(i7,{className:"h-4 w-4"}),o.jsx("span",{children:D.name}),D.source==="agent"&&D.agentName&&o.jsxs("span",{className:"text-neutral3",children:["(",D.agentName,")"]}),K&&o.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),a&&Re&&C&&o.jsx(L_r,{workspaceId:C,canSearchFiles:Ue,canSearchSkills:Ve,canBM25:Ee,canVector:Me,showInitWarning:!j&&T?.status!=="ready",onViewFileResult:Se=>{U({file:Se,tab:"files"})},onViewSkillResult:(Se,Ie)=>{C&&r(`/workspaces/${C}/skills/${encodeURIComponent(Se)}?path=${encodeURIComponent(Ie)}`)}},C),o.jsxs("div",{className:"flex gap-2 border-b border-border1",children:[ue&&o.jsxs("button",{onClick:()=>W("files"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${$e==="files"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[o.jsx(lI,{className:"h-4 w-4"}),"Files"]}),we&&o.jsxs("button",{onClick:()=>W("skills"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${$e==="skills"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[o.jsx(z$,{className:"h-4 w-4"}),"Skills",yt&&it.length>0&&o.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:it.length})]})]}),o.jsxs("div",{className:"pb-8",children:[$e==="files"&&ue&&o.jsx("div",{className:"space-y-4",children:o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[o.jsx(Ixr,{entries:Gt,currentPath:$,isLoading:R,error:H,onNavigate:z,onFileSelect:Q,onRefresh:()=>G(),onCreateDirectory:K?void 0:Se=>ie.mutate({path:Se,workspaceId:C}),onDelete:K?void 0:Se=>J.mutate({path:Se,recursive:!0,force:!0,workspaceId:C})}),Z&&o.jsx(Mxr,{path:Z,content:ne?.content??"",isLoading:ae,mimeType:ne?.mimeType,onClose:()=>Q(null)})]})}),$e==="skills"&&we&&o.jsx(Hxr,{skills:it,isLoading:fe,isSkillsConfigured:yt,hasUndiscoveredAgentSkills:m,basePath:C?`/workspaces/${C}/skills`:"/workspaces",onAddSkill:te?()=>u(!0):void 0,onUpdateSkill:te?ke:void 0,onRemoveSkill:te?he:void 0,updatingSkillName:h??void 0,removingSkillName:d??void 0,mountPaths:Pe}),!ue&&!we&&o.jsx("div",{className:"py-12 text-center text-neutral4",children:o.jsx("p",{children:"No workspace capabilities are configured."})})]})]})}),C&&te&&o.jsx(Xxr,{open:c,onOpenChange:u,workspaceId:C,onInstall:pe,isInstalling:re.isPending,installedSkillIds:it.filter(Se=>Se.skillsShSource).map(Se=>`${Se.skillsShSource.owner}/${Se.skillsShSource.repo}/${Se.name}`),installedSkillNames:it.filter(Se=>!Se.skillsShSource).map(Se=>Se.name),writableMounts:Te,installedSkillPaths:Object.fromEntries(it.filter(Se=>Se.path).map(Se=>[Se.name,Se.path]))})]})}function L_r({workspaceId:e,canSearchFiles:t,canSearchSkills:n,canBM25:r,canVector:a,showInitWarning:s,onViewFileResult:i,onViewSkillResult:l}){const c=cfr(),u=hfr();return o.jsxs("div",{className:"border border-border1 rounded-lg p-4 bg-surface2 space-y-4",children:[t&&o.jsxs("div",{children:[o.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[o.jsx(lI,{className:"h-4 w-4"}),"Search Indexed Files"]}),s&&o.jsxs("p",{className:"text-xs text-amber-400 mb-3",children:["File search requires ",o.jsx("code",{className:"text-amber-300",children:"workspace.init()"})," to index files from your configured ",o.jsx("code",{className:"text-amber-300",children:"autoIndexPaths"}),"."]}),o.jsx($xr,{onSearch:d=>c.mutate({...d,workspaceId:e}),isSearching:c.isPending,searchResults:c.data?{...c.data,results:c.data.results.filter(d=>!d.id.startsWith("skill:"))}:void 0,canBM25:r,canVector:a,onViewResult:i})]}),n&&o.jsxs("div",{children:[o.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[o.jsx(z$,{className:"h-4 w-4"}),"Search Skills"]}),o.jsx(Fxr,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>l(d.skillName,d.skillPath)})]})]})}function F_r(e,t){return e==null||t==null?null:e in t?e:null}function z_r(){const{skillName:e,workspaceId:t}=ss(),[n]=Di(),r=as(),a=e?decodeURIComponent(e):"",s=n.get("path"),i=s?decodeURIComponent(s):void 0,l=n.get("agentId"),c=l?decodeURIComponent(l):null,d=r.getQueriesData({queryKey:["agents"]})?.[0]?.[1]??null,f=F_r(c,d),h=f?`/agents/${f}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[p,m]=b.useState(null),{data:g,isLoading:v,error:x}=dfr(a,{workspaceId:t,path:i}),{data:w}=mwt(g?.path?`${g.path}/SKILL.md`:"",{enabled:!!g?.path,workspaceId:t}),{data:O,isLoading:k}=ffr(a,p??"",{enabled:!!p,workspaceId:t,path:i}),_=C=>f?o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:h,children:[o.jsx(_e,{children:o.jsx(w2,{className:"h-4 w-4"})}),f]}),o.jsxs(dn,{as:"span",to:"",isCurrent:!0,children:[o.jsx(_e,{children:o.jsx(z$,{className:"h-4 w-4"})}),C]})]}):o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:h,children:[o.jsx(_e,{children:o.jsx(gf,{className:"h-4 w-4"})}),"Workspace"]}),o.jsxs(dn,{as:Vt,to:h,children:[o.jsx(_e,{children:o.jsx(z$,{className:"h-4 w-4"})}),"Skills"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:C})]});return v?o.jsxs(ln,{children:[o.jsx(Qn,{children:_("Loading...")}),o.jsx("div",{className:"grid place-items-center h-full",children:o.jsx("div",{className:"h-8 w-8 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})})]}):x&&Yi(x)?o.jsxs(ln,{children:[o.jsx(Qn,{children:_("Session Expired")}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})]}):x&&Va(x)?o.jsxs(ln,{children:[o.jsx(Qn,{children:_("Permission Denied")}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"workspaces"})})]}):x||!g?o.jsxs(ln,{children:[o.jsx(Qn,{children:_("Error")}),o.jsx("div",{className:"grid place-items-center h-full",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load skill"}),o.jsx("p",{className:"text-sm text-neutral3",children:x?.message??"Skill not found"})]})})]}):o.jsxs(ln,{children:[o.jsxs(Qn,{children:[_(g.name),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[o.jsx(_e,{children:o.jsx(Fl,{})}),"Documentation"]})})]}),o.jsx("div",{className:"grid overflow-y-auto overflow-x-hidden h-full",children:o.jsx("div",{className:"max-w-[100rem] px-[3rem] mx-auto py-8 h-full w-full overflow-x-hidden",children:o.jsx(Zxr,{skill:g,rawSkillMd:w?.content,onReferenceClick:m})})}),o.jsx(Yxr,{open:!!p,onOpenChange:C=>!C&&m(null),skillName:g.name,referencePath:p??"",content:O?.content,isLoading:k})]})}const B_r=[{key:"primitives",title:"Primitives",href:"/primitives",links:[{name:"Agents",url:"/agents",icon:o.jsx(Xs,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"agents:read"},{name:"Prompts",url:"/prompts",icon:o.jsx(lI,{}),isOnMastraPlatform:!0,indent:!0},{name:"Workflows",url:"/workflows",icon:o.jsx(tl,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workflows:read"},{name:"Processors",url:"/processors",icon:o.jsx(fWe,{}),isOnMastraPlatform:!1,indent:!0,requiredPermission:"processors:read"},{name:"MCP Servers",url:"/mcps",icon:o.jsx(Tu,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"mcps:read"},{name:"Tools",url:"/tools",icon:o.jsx(Po,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"tools:read"},{name:"Workspaces",url:"/workspaces",icon:o.jsx(gf,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workspaces:read"},{name:"Request Context",url:"/request-context",icon:o.jsx($le,{}),isOnMastraPlatform:!0,indent:!0}]},{key:"evaluation",title:"Evaluation",href:"/evaluation",links:[{name:"Scorers",url:"/evaluation?tab=scorers",icon:o.jsx(cWe,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"scorers:read"},{name:"Datasets",url:"/evaluation?tab=datasets",icon:o.jsx(Ou,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]},{name:"Experiments",url:"/evaluation?tab=experiments",icon:o.jsx(vWe,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]}]},{key:"observability",title:"Observability",href:"/observability-overview",links:[{name:"Metrics",url:"/metrics",icon:o.jsx(Dle,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Traces",url:"/observability",icon:o.jsx(O0,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Logs",url:"/logs",icon:o.jsx(mWe,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"}]},{key:"bottom",separator:!0,links:[{name:"Settings",url:"/settings",icon:o.jsx(pge,{}),isOnMastraPlatform:!1},{name:"Resources",url:"/resources",icon:o.jsx(Sl,{}),isOnMastraPlatform:!0}]}],U_r={scorers:"/evaluation/scorers",datasets:"/evaluation/datasets",experiments:"/evaluation/experiments"};function R8e(e,t,n){if(e.url.includes("?")){const[r,a]=e.url.split("?"),s=new URLSearchParams(a).get("tab"),i=new URLSearchParams(n).get("tab");if(t===r&&s&&s===i)return!0;if(s){const l=U_r[s];if(l&&(t===l||t.startsWith(l+"/")))return!0}return!1}return t===e.url||t.startsWith(e.url+"/")}function q_r(){const{state:e}=lve(),t=$c(),n=t.pathname,{isMastraPlatform:r}=DSt(),{data:a}=eE(),{isCmsAvailable:s,isLoading:i}=Mge(),{hasPermission:l,hasAnyPermission:c,rbacEnabled:u,isAuthenticated:d,isLoading:f}=Pv(),h=a&&DR(a),p=new Set(["/prompts"]),m=g=>p.has(g.url)&&!s&&!i||r&&!g.isOnMastraPlatform?!1:u&&d&&f?!0:!(g.requiredPermission&&!l(g.requiredPermission)||g.requiredAnyPermission&&!c(g.requiredAnyPermission));return o.jsxs(vh,{children:[o.jsx("div",{className:"pt-3 mb-4 -ml-0.5 sticky top-0 bg-surface1 z-10",children:e==="collapsed"?o.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[o.jsx(ub,{className:"h-[1.5rem] w-[1.5rem] shrink-0 ml-3"}),h&&o.jsx(zse,{})]}):h?o.jsxs("span",{className:"flex items-center justify-between pl-3 pr-2",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx(ub,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),o.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]}),o.jsx(zse,{})]}):o.jsxs("span",{className:"flex items-center gap-2 pl-3",children:[o.jsx(ub,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),o.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]})}),o.jsx(vh.Nav,{children:B_r.map(g=>{const v=g.links.filter(m),x=v.length>0&&g?.separator,w=v.some(k=>R8e(k,n,t.search)),O=!!(g.href&&n===g.href&&!w);return o.jsxs(vh.NavSection,{children:[g?.title?o.jsx(vh.NavHeader,{state:e,href:g.href,isActive:O,children:g.title}):o.jsx(o.Fragment,{children:x&&o.jsx(vh.NavSeparator,{})}),o.jsx(vh.NavList,{children:v.map(k=>{const _=R8e(k,n,t.search);return o.jsx(vh.NavLink,{state:e,link:k,isActive:_},k.name)})})]},g.key)})}),o.jsxs(vh.Bottom,{children:[e!=="collapsed"&&o.jsxs(o.Fragment,{children:[o.jsx(vh.NavSeparator,{}),o.jsx(Glr,{collapsed:!1})]}),o.jsx(vh.NavSeparator,{}),o.jsx("div",{className:"flex justify-end pb-3",children:o.jsx(vh.Trigger,{})})]})]})}const V_r=b.createContext({theme:"dark",setTheme:()=>null}),H_r=e=>e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";function NOt({children:e}){const t=Br(a=>a.theme),n=Br(a=>a.setTheme),r=t==="light"||t==="system"?t:"dark";return b.useEffect(()=>{const a=window.document.documentElement,s=c=>{const u=H_r(c);a.classList.remove("light","dark"),a.classList.add(u)};if(s(r),r!=="system")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>s("system");return i.addEventListener("change",l),()=>{i.removeEventListener("change",l)}},[r]),o.jsx(V_r.Provider,{value:{theme:r,setTheme:n},children:e})}const AOt="experimental-ui:",IOt="current",Q_r=Ne.createContext(null);function W_r(e,t){const n=window.localStorage.getItem(AOt+e);return n&&t.has(n)?n:IOt}function G_r({experiments:e,children:t}){const n=Ne.useMemo(()=>new Map(e.map(c=>[c.key,new Set(c.variants.map(u=>u.value))])),[e]),[r,a]=Ne.useState({});Ne.useLayoutEffect(()=>{const c={};for(const u of e){const d=n.get(u.key);c[u.key]=W_r(u.key,d)}a(c)},[e,n]);const s=Ne.useCallback(c=>r[c]??IOt,[r]),i=Ne.useCallback((c,u)=>{window.localStorage.setItem(AOt+c,u),a(d=>({...d,[c]:u}))},[]),l=Ne.useMemo(()=>({experiments:e,getVariant:s,setVariant:i}),[e,s,i]);return o.jsx(Q_r.Provider,{value:l,children:t})}const Z_r=[{key:"entity-list-page",name:"Entity List page UI",path:["/agents","/prompts","/tools","/datasets","/scorers","/mcps","/workflows","/processors"],variants:[{value:"current",label:"Current state"},{value:"new-proposal",label:"New proposal"}]}],Y_r=()=>({experimentalUIEnabled:typeof window<"u"&&window.MASTRA_EXPERIMENTAL_UI==="true"});function X_r({children:e}){const{data:t,isFetched:n}=eE(),r=n&&t?.enabled&&!DR(t),a=n&&!r;return o.jsxs(o.Fragment,{children:[o.jsx(a0r,{}),o.jsxs("div",{className:a?"grid h-full grid-cols-[auto_1fr]":"h-full",children:[a&&o.jsx(q_r,{}),o.jsx("div",{className:Y("bg-transparent overflow-y-auto",{"h-[calc(100%-1.5rem)]":r}),children:o.jsx(FSt,{children:e})})]})]})}const K_r=({children:e})=>{const{experimentalUIEnabled:t}=Y_r();return o.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[o.jsx(Qst,{position:"bottom-right"}),o.jsx(NOt,{defaultTheme:"dark",attribute:"class",children:o.jsx(Fu,{delayDuration:0,children:o.jsx(G_r,{experiments:t?Z_r:[],children:o.jsx(uxr,{children:o.jsx(X_r,{children:e})})})})})]})},J_r=({children:e})=>o.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[o.jsx(Qst,{position:"bottom-right"}),o.jsx(NOt,{defaultTheme:"dark",attribute:"class",children:o.jsx(Fu,{delayDuration:0,children:o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsx(FSt,{children:e})})})})]});function eEr({agentId:e}){return o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/agents",children:[o.jsx(_e,{children:o.jsx(Xs,{})}),"Agents"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:o.jsx(Ccr,{value:e,variant:"ghost"})})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Agents documentation"]})})]})}const tEr=({children:e})=>{const{agentId:t}=ss(),n=$c(),{isCmsAvailable:r}=Mge(),{hasObservability:a}=Klr(),s=yie.has("datasets"),i=r&&s,l=a&&s,{data:c}=Hd(t),u=kc(c?.provider??""),d=c?.modelId??"",f=c?.requestContextSchema,h=n.pathname.includes("/editor")?"versions":n.pathname.includes("/evaluate")?"evaluate":n.pathname.includes("/review")?"review":n.pathname.includes("/traces")?"traces":"chat",p=(h==="versions"||h==="evaluate"||h==="review")&&(i||l),m=o.jsxs(ln,{className:"grid-rows-[auto_auto_1fr]",children:[o.jsx(eEr,{agentId:t}),o.jsx(ipr,{agentId:t,activeTab:h,showPlayground:i,showObservability:l,rightSlot:p?o.jsx(opr,{requestContextSchema:f}):void 0}),e]});return o.jsx(TR,{children:o.jsx(xor,{defaultProvider:u,defaultModel:d,children:o.jsx(qhr,{children:o.jsx(wor,{children:m})})})})};function nEr(){const{data:e={},isLoading:t,error:n}=Zge(),[r,a]=b.useState("");return o.jsxs(ja,{children:[o.jsxs(ja.Top,{children:[o.jsxs(ft,{withMargins:!1,children:[o.jsx(ft.Column,{children:o.jsxs(ft.Title,{isLoading:t,children:[o.jsx(x0,{})," Processors"]})}),o.jsx(ft.Column,{className:"flex justify-end gap-2",children:o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Processors documentation",children:o.jsx(Sl,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(zh,{onSearch:a,label:"Filter processors",placeholder:"Filter by name"})})]}),o.jsx(Epr,{processors:e,isLoading:t,error:n,search:r,onSearch:a})]})}function rEr(){const{processorId:e}=ss(),{data:t,isLoading:n,error:r}=Fwt(e);return r&&Yi(r)?o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/processors",children:[o.jsx(_e,{children:o.jsx(x0,{})}),"Processors"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(sl,{})})]}):r&&Va(r)?o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/processors",children:[o.jsx(_e,{children:o.jsx(x0,{})}),"Processors"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:e})]})}),o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(zs,{resource:"processors"})})]}):!n&&t?.isWorkflow?o.jsx(Wwr,{to:`/workflows/${e}/graph`,replace:!0}):n?o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsx(Qn,{children:o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/processors",children:[o.jsx(_e,{children:o.jsx(x0,{})}),"Processors"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:o.jsx(jr,{className:"h-6 w-32"})})]})}),o.jsxs("div",{className:"p-6",children:[o.jsx(jr,{className:"h-8 w-48 mb-4"}),o.jsx(jr,{className:"h-32 w-full"})]})]}):o.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[o.jsxs(Qn,{children:[o.jsxs(fs,{children:[o.jsxs(dn,{as:Vt,to:"/processors",children:[o.jsx(_e,{children:o.jsx(x0,{})}),"Processors"]}),o.jsx(dn,{as:"span",to:"",isCurrent:!0,children:o.jsx(Ipr,{value:e,variant:"ghost"})})]}),o.jsx(Ci,{children:o.jsxs(ye,{as:Vt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[o.jsx(Fl,{}),"Processors documentation"]})})]}),o.jsx(Tpr,{processorId:e})]})}function aEr(){const{data:e={},isLoading:t}=cp(),{data:n={},isLoading:r,error:a}=p8(),[s,i]=b.useState(""),l=t||r;return o.jsxs(ja,{children:[o.jsxs(ja.Top,{children:[o.jsxs(ft,{withMargins:!1,children:[o.jsx(ft.Column,{children:o.jsxs(ft.Title,{isLoading:l,children:[o.jsx(Po,{})," Tools"]})}),o.jsx(ft.Column,{className:"flex justify-end gap-2",children:o.jsx(Ni,{as:"a",href:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Tools documentation",children:o.jsx(Sl,{})})})]}),o.jsx("div",{className:"max-w-120",children:o.jsx(zh,{onSearch:i,label:"Filter tools",placeholder:"Filter by name"})})]}),o.jsx(Mpr,{tools:n,agents:e,isLoading:l,error:a,search:s,onSearch:i})]})}const ROt={agentLink:e=>`/agents/${e}/chat/new`,agentToolLink:(e,t)=>`/agents/${e}/tools/${t}`,agentSkillLink:(e,t,n,r)=>r?`/workspaces/${r}/skills/${encodeURIComponent(t)}?agentId=${encodeURIComponent(e)}${n?`&path=${encodeURIComponent(n)}`:""}`:"/workspaces",agentsLink:()=>"/agents",agentNewThreadLink:e=>`/agents/${e}/chat/new`,agentThreadLink:(e,t,n)=>n?`/agents/${e}/chat/${t}?messageId=${n}`:`/agents/${e}/chat/${t}`,workflowsLink:()=>"/workflows",workflowLink:e=>`/workflows/${e}`,networkLink:e=>`/networks/v-next/${e}/chat`,networkNewThreadLink:e=>`/networks/v-next/${e}/chat/${Qi()}`,networkThreadLink:(e,t)=>`/networks/v-next/${e}/chat/${t}`,scorerLink:e=>`/evaluation/scorers/${e}`,cmsScorersCreateLink:()=>"/cms/scorers/create",cmsScorerEditLink:e=>`/cms/scorers/${e}/edit`,cmsAgentCreateLink:()=>"/cms/agents/create",cmsAgentEditLink:e=>`/cms/agents/${e}/edit`,promptBlockLink:e=>`/prompts/${e}`,promptBlocksLink:()=>"/prompts",cmsPromptBlockCreateLink:()=>"/cms/prompts/create",cmsPromptBlockEditLink:e=>`/cms/prompts/${e}/edit`,toolLink:e=>`/tools/${e}`,skillLink:(e,t,n)=>n?`/workspaces/${n}/skills/${encodeURIComponent(e)}${t?`?path=${encodeURIComponent(t)}`:""}`:"/workspaces",workspaceLink:e=>e?`/workspaces/${e}`:"/workspaces",workspaceSkillLink:(e,t,n)=>n?`/workspaces/${n}/skills/${encodeURIComponent(e)}${t?`?path=${encodeURIComponent(t)}`:""}`:"/workspaces",workspacesLink:()=>"/workspaces",processorsLink:()=>"/processors",processorLink:e=>`/processors/${e}`,mcpServerLink:e=>`/mcps/${e}`,mcpServerToolLink:(e,t)=>`/mcps/${e}/tools/${t}`,workflowRunLink:(e,t)=>`/workflows/${e}/graph/${t}`,datasetLink:e=>`/evaluation/datasets/${e}`,datasetItemLink:(e,t)=>`/evaluation/datasets/${e}/items/${t}`,datasetExperimentLink:(e,t)=>`/evaluation/datasets/${e}/experiments/${t}`,experimentLink:e=>`/evaluation/experiments/${e}`},sEr=()=>{const e=Lc(),t=n=>e(n,{viewTransition:!0});return o.jsx(Ibt,{Link:COt,navigate:t,paths:ROt,children:o.jsx(K_r,{children:o.jsx(Xk,{})})})},iEr=()=>{const e=Lc(),t=n=>e(n,{viewTransition:!0});return o.jsx(Ibt,{Link:COt,navigate:t,paths:ROt,children:o.jsx(J_r,{children:o.jsx(Xk,{})})})},oEr=!!window.MASTRA_CLOUD_API_ENDPOINT,P8e=yie.has("datasets"),M8e=[{index:!0,element:o.jsx(mkr,{})},{path:"instruction-blocks",element:o.jsx(gkr,{})},{path:"tools",element:o.jsx(xkr,{})},{path:"agents",element:o.jsx(fkr,{})},{path:"scorers",element:o.jsx(ykr,{})},{path:"workflows",element:o.jsx(Skr,{})},{path:"skills",element:o.jsx(bkr,{})},{path:"memory",element:o.jsx(vkr,{})},{path:"variables",element:o.jsx(wkr,{})}],lEr=[{path:"/login",element:o.jsx(qkr,{})},{path:"/signup",element:o.jsx(b_r,{})},{element:o.jsx(iEr,{}),children:[{path:"/agents/:agentId/session",element:o.jsx(x8e,{})},{path:"/agents/:agentId/session/:threadId",element:o.jsx(x8e,{})}]},{element:o.jsx(sEr,{}),children:[...oEr?[]:[{path:"/settings",element:o.jsx(y_r,{})},{path:"/templates",element:o.jsx(I_r,{})},{path:"/templates/:templateSlug",element:o.jsx(P_r,{})}],{path:"/logs",element:o.jsx(Zkr,{})},{path:"/primitives",element:o.jsx(u_r,{})},{path:"/evaluation",element:o.jsx(Bkr,{})},{path:"/evaluation/scorers/:scorerId",element:o.jsx(m_r,{})},{path:"/metrics",element:o.jsx(Jkr,{})},{path:"/observability-overview",element:o.jsx(l_r,{})},{path:"/observability",element:o.jsx(i_r,{})},{path:"/resources",element:o.jsx(p_r,{})},{path:"/agents",element:o.jsx(skr,{})},{path:"/cms/agents/create",element:o.jsx(hkr,{}),children:M8e},{path:"/cms/agents/:agentId/edit",element:o.jsx(pkr,{}),children:M8e},{path:"/cms/scorers/create",element:o.jsx(Ekr,{})},{path:"/cms/scorers/:scorerId/edit",element:o.jsx(jkr,{})},{path:"/prompts",element:o.jsx(d_r,{})},{path:"/cms/prompts/create",element:o.jsx(Okr,{})},{path:"/cms/prompts/:promptBlockId/edit",element:o.jsx(_kr,{})},{path:"/agents/:agentId/tools/:toolId",element:o.jsx(M_r,{})},{path:"/agents/:agentId",element:o.jsx(tEr,{children:o.jsx(Xk,{})}),children:[{index:!0,loader:({params:e})=>KJ(`/agents/${e.agentId}/chat`)},{path:"chat",element:o.jsx(b8e,{})},{path:"chat/:threadId",element:o.jsx(b8e,{})},...P8e?[{path:"editor",element:o.jsx(ckr,{})},{path:"evaluate",element:o.jsx(lkr,{})},{path:"review",element:o.jsx(ukr,{})}]:[],{path:"traces",element:o.jsx(dkr,{})}]},{path:"/tools",element:o.jsx(aEr,{})},{path:"/tools/:toolId",element:o.jsx(D_r,{})},{path:"/processors",element:o.jsx(nEr,{})},{path:"/processors/:processorId",element:o.jsx(rEr,{})},{path:"/mcps",element:o.jsx(Ykr,{})},{path:"/mcps/:serverId",element:o.jsx(Xkr,{})},{path:"/mcps/:serverId/tools/:toolId",element:o.jsx(Kkr,{})},{path:"/workspaces",element:o.jsx(I8e,{})},{path:"/workspaces/:workspaceId",element:o.jsx(I8e,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:o.jsx(z_r,{})},{path:"/workflows",element:o.jsx($_r,{})},{path:"/workflows/:workflowId",element:o.jsx(ISr,{children:o.jsx(Xk,{})}),children:[{index:!0,loader:({params:e})=>KJ(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:o.jsx(A8e,{})},{path:"graph/:runId",element:o.jsx(A8e,{})}]},...P8e?[{path:"/evaluation/datasets/:datasetId",element:o.jsx(Nkr,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId",element:o.jsx(Rkr,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId/versions",element:o.jsx(Dkr,{})},{path:"/evaluation/datasets/:datasetId/experiments/:experimentId",element:o.jsx(Akr,{})},{path:"/evaluation/experiments/:experimentId",element:o.jsx(Ukr,{})},{path:"/evaluation/datasets/:datasetId/experiments",element:o.jsx(Ikr,{})},{path:"/evaluation/datasets/:datasetId/items",element:o.jsx(Pkr,{})},{path:"/evaluation/datasets/:datasetId/versions",element:o.jsx(Lkr,{})}]:[],{index:!0,loader:()=>KJ("/agents")},{path:"/request-context",element:o.jsx(f_r,{})}]}];function cEr(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:n,apiPrefix:r,isLoading:a}=Pge(),s=b.useMemo(()=>t?Jxr(t,r):void 0,[t,r]);if(a)return null;if(!t)return o.jsx(Xlr,{});const i=bSr(lEr,{basename:e});return o.jsx(vzt,{baseUrl:t,headers:n,apiPrefix:r,customFetch:s,children:o.jsx(rkr,{children:o.jsx(Vwr,{router:i})})})}function uEr(){const e=window.MASTRA_SERVER_PROTOCOL||"http",t=window.MASTRA_SERVER_HOST||"localhost",n=window.MASTRA_SERVER_PORT||4111,r=window.MASTRA_API_PREFIX||"/api",a=window.MASTRA_CLOUD_API_ENDPOINT||"",s=window.MASTRA_AUTO_DETECT_URL==="true",i=a||(s?window.location.origin:`${e}://${t}:${n}`);return o.jsx(gxr,{children:o.jsx(Ulr,{endpoint:i,defaultApiPrefix:r,children:o.jsx(cEr,{})})})}V_t.createRoot(document.getElementById("root")).render(o.jsx(b.StrictMode,{children:o.jsx(uEr,{})}));const xCr=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{ktt as A,gat as B,Ett as C,mrt as D,Ud as E,Lf as F,fEr as G,Y_t as H,Ua as I,xCr as J,nw as L,Ott as N,Q3 as _,OFt as a,FFt as b,QEr as c,o1e as d,aw as e,MFt as f,yO as g,LFt as h,Xw as i,Kw as j,Yw as k,ksn as l,Srt as m,K0 as n,ps as o,Fan as p,Lan as q,ide as r,Jle as s,se as t,gL as u,Yc as v,jFt as w,xt as x,ot as y,Fat as z};
|