@mastra/deployer-cloud 1.21.0-alpha.2 → 1.21.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.
Files changed (26) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/studio/assets/{chunk-ZCJMLMGS-CWBFTIiL.js → chunk-ZCJMLMGS-BnM7rIyY.js} +1 -1
  3. package/dist/studio/assets/{index-CurN84Qj.js → index-8mVKHX_j.js} +1 -1
  4. package/dist/studio/assets/{index-BWT9_XUW.js → index-BNAYYUc3.js} +1 -1
  5. package/dist/studio/assets/{index-BBMWNw5g.js → index-BPStdTZK.js} +1 -1
  6. package/dist/studio/assets/{index-BlBHa2EF.js → index-Bb2rMuNJ.js} +1 -1
  7. package/dist/studio/assets/{index-CGav4zeO.js → index-BrKAFMNo.js} +1 -1
  8. package/dist/studio/assets/{index-CLNfOe98.js → index-Bz0o5EJq.js} +1 -1
  9. package/dist/studio/assets/{index-Cy852hlX.js → index-C2fjAP9x.js} +1 -1
  10. package/dist/studio/assets/{index-Sw38Cezs.js → index-CDyzq8kO.js} +1 -1
  11. package/dist/studio/assets/{index-B8UI4wbI.js → index-CqPCldmj.js} +1 -1
  12. package/dist/studio/assets/{index-tR0P1-D4.js → index-CzXYaJgN.js} +1 -1
  13. package/dist/studio/assets/{index-BI4gw25f.js → index-D2aYjUYW.js} +1 -1
  14. package/dist/studio/assets/{index-BUBkwXfg.js → index-D5Ecjke_.js} +1 -1
  15. package/dist/studio/assets/{index-DwlzCg2q.js → index-DKdpjQsM.js} +1 -1
  16. package/dist/studio/assets/{index-BPKEjyfb.js → index-Dm9YxRl_.js} +1 -1
  17. package/dist/studio/assets/{index-CsEGWMVv.js → index-DmCxvSjO.js} +1 -1
  18. package/dist/studio/assets/{index-BjoQBvyi.js → index-FOl4sUk-.js} +1 -1
  19. package/dist/studio/assets/{index-HJbhYvS9.js → index-OK2VNs_f.js} +1 -1
  20. package/dist/studio/assets/{index-BeJj5mk-.js → index-UhzyOq43.js} +1 -1
  21. package/dist/studio/assets/{main-DVMqZ2mx.js → main-Z1_RZnwm.js} +6 -6
  22. package/dist/studio/assets/{token-APYSY3BW-RPVF55TR-BlIgi0Bi.js → token-APYSY3BW-RPVF55TR-DsOowoW5.js} +1 -1
  23. package/dist/studio/assets/token-util-RMHT2CPJ-VVUHOXBL-CyfEDU-Y.js +1 -0
  24. package/dist/studio/index.html +1 -1
  25. package/package.json +6 -6
  26. package/dist/studio/assets/token-util-RMHT2CPJ-VVUHOXBL-CejHYUVi.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./token-util-RMHT2CPJ-VVUHOXBL-CejHYUVi.js","./chunk-ZCJMLMGS-CWBFTIiL.js","./index-B8UI4wbI.js","./token-APYSY3BW-RPVF55TR-BlIgi0Bi.js","./index-CurN84Qj.js","./index-BI4gw25f.js","./index-tR0P1-D4.js","./index-BjoQBvyi.js","./index-BWT9_XUW.js","./index-BlBHa2EF.js","./index-CGav4zeO.js","./index-BPKEjyfb.js","./index-BUBkwXfg.js","./index-BBMWNw5g.js","./index-DwlzCg2q.js","./index-Sw38Cezs.js","./index-HJbhYvS9.js","./index-Cy852hlX.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-CLNfOe98.js","./index-CsEGWMVv.js","./index-BeJj5mk-.js"])))=>i.map(i=>d[i]);
2
- import{_ as We}from"./index-B8UI4wbI.js";function s8e(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 r$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xB={exports:{}},BE={};var zxe;function Kkt(){if(zxe)return BE;zxe=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 o in a)o!=="key"&&(s[o]=a[o])}else s=a;return a=s.ref,{$$typeof:e,type:r,key:i,ref:a!==void 0?a:null,props:s}}return BE.Fragment=t,BE.jsx=n,BE.jsxs=n,BE}var Bxe;function Jkt(){return Bxe||(Bxe=1,xB.exports=Kkt()),xB.exports}var l=Jkt(),wB={exports:{}},ur={},Uxe;function e_t(){if(Uxe)return ur;Uxe=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"),o=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"),p=Symbol.for("react.activity"),h=Symbol.iterator;function m(B){return B===null||typeof B!="object"?null:(B=h&&B[h]||B["@@iterator"],typeof B=="function"?B:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,b={};function w(B,R,Q){this.props=B,this.context=R,this.refs=b,this.updater=Q||g}w.prototype.isReactComponent={},w.prototype.setState=function(B,R){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,R,"setState")},w.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function O(){}O.prototype=w.prototype;function k(B,R,Q){this.props=B,this.context=R,this.refs=b,this.updater=Q||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(B,R,Q){var G=Q.ref;return{$$typeof:t,type:B,key:R,ref:G!==void 0?G:null,props:Q}}function P(B,R){return I(B.type,R,B.props)}function M(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function F(B){var R={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(Q){return R[Q]})}var D=/\/+/g;function U(B,R){return typeof B=="object"&&B!==null&&B.key!=null?F(""+B.key):R.toString(36)}function V(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(T,T):(B.status="pending",B.then(function(R){B.status==="pending"&&(B.status="fulfilled",B.value=R)},function(R){B.status==="pending"&&(B.status="rejected",B.reason=R)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function z(B,R,Q,G,J){var re=typeof B;(re==="undefined"||re==="boolean")&&(B=null);var ne=!1;if(B===null)ne=!0;else switch(re){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(B.$$typeof){case t:case n:ne=!0;break;case f:return ne=B._init,z(ne(B._payload),R,Q,G,J)}}if(ne)return J=J(B),ne=G===""?"."+U(B,0):G,C(J)?(Q="",ne!=null&&(Q=ne.replace(D,"$&/")+"/"),z(J,R,Q,"",function(me){return me})):J!=null&&(M(J)&&(J=P(J,Q+(J.key==null||B&&B.key===J.key?"":(""+J.key).replace(D,"$&/")+"/")+ne)),R.push(J)),1;ne=0;var se=G===""?".":G+":";if(C(B))for(var le=0;le<B.length;le++)G=B[le],re=se+U(G,le),ne+=z(G,R,Q,re,J);else if(le=m(B),typeof le=="function")for(B=le.call(B),le=0;!(G=B.next()).done;)G=G.value,re=se+U(G,le++),ne+=z(G,R,Q,re,J);else if(re==="object"){if(typeof B.then=="function")return z(V(B),R,Q,G,J);throw R=String(B),Error("Objects are not valid as a React child (found: "+(R==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.")}return ne}function H(B,R,Q){if(B==null)return B;var G=[],J=0;return z(B,G,"","",function(re){return R.call(Q,re,J++)}),G}function W(B){if(B._status===-1){var R=B._result;R=R(),R.then(function(Q){(B._status===0||B._status===-1)&&(B._status=1,B._result=Q)},function(Q){(B._status===0||B._status===-1)&&(B._status=2,B._result=Q)}),B._status===-1&&(B._status=0,B._result=R)}if(B._status===1)return B._result.default;throw B._result}var $=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var R=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(R))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",B);return}console.error(B)},Z={map:H,forEach:function(B,R,Q){H(B,function(){R.apply(this,arguments)},Q)},count:function(B){var R=0;return H(B,function(){R++}),R},toArray:function(B){return H(B,function(R){return R})||[]},only:function(B){if(!M(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return ur.Activity=p,ur.Children=Z,ur.Component=w,ur.Fragment=r,ur.Profiler=s,ur.PureComponent=k,ur.StrictMode=a,ur.Suspense=u,ur.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,ur.__COMPILER_RUNTIME={__proto__:null,c:function(B){return j.H.useMemoCache(B)}},ur.cache=function(B){return function(){return B.apply(null,arguments)}},ur.cacheSignal=function(){return null},ur.cloneElement=function(B,R,Q){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var G=v({},B.props),J=B.key;if(R!=null)for(re in R.key!==void 0&&(J=""+R.key),R)!A.call(R,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&R.ref===void 0||(G[re]=R[re]);var re=arguments.length-2;if(re===1)G.children=Q;else if(1<re){for(var ne=Array(re),se=0;se<re;se++)ne[se]=arguments[se+2];G.children=ne}return I(B.type,J,G)},ur.createContext=function(B){return B={$$typeof:o,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:i,_context:B},B},ur.createElement=function(B,R,Q){var G,J={},re=null;if(R!=null)for(G in R.key!==void 0&&(re=""+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=Q;else if(1<ne){for(var se=Array(ne),le=0;le<ne;le++)se[le]=arguments[le+2];J.children=se}if(B&&B.defaultProps)for(G in ne=B.defaultProps,ne)J[G]===void 0&&(J[G]=ne[G]);return I(B,re,J)},ur.createRef=function(){return{current:null}},ur.forwardRef=function(B){return{$$typeof:c,render:B}},ur.isValidElement=M,ur.lazy=function(B){return{$$typeof:f,_payload:{_status:-1,_result:B},_init:W}},ur.memo=function(B,R){return{$$typeof:d,type:B,compare:R===void 0?null:R}},ur.startTransition=function(B){var R=j.T,Q={};j.T=Q;try{var G=B(),J=j.S;J!==null&&J(Q,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,$)}catch(re){$(re)}finally{R!==null&&Q.types!==null&&(R.types=Q.types),j.T=R}},ur.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},ur.use=function(B){return j.H.use(B)},ur.useActionState=function(B,R,Q){return j.H.useActionState(B,R,Q)},ur.useCallback=function(B,R){return j.H.useCallback(B,R)},ur.useContext=function(B){return j.H.useContext(B)},ur.useDebugValue=function(){},ur.useDeferredValue=function(B,R){return j.H.useDeferredValue(B,R)},ur.useEffect=function(B,R){return j.H.useEffect(B,R)},ur.useEffectEvent=function(B){return j.H.useEffectEvent(B)},ur.useId=function(){return j.H.useId()},ur.useImperativeHandle=function(B,R,Q){return j.H.useImperativeHandle(B,R,Q)},ur.useInsertionEffect=function(B,R){return j.H.useInsertionEffect(B,R)},ur.useLayoutEffect=function(B,R){return j.H.useLayoutEffect(B,R)},ur.useMemo=function(B,R){return j.H.useMemo(B,R)},ur.useOptimistic=function(B,R){return j.H.useOptimistic(B,R)},ur.useReducer=function(B,R,Q){return j.H.useReducer(B,R,Q)},ur.useRef=function(B){return j.H.useRef(B)},ur.useState=function(B){return j.H.useState(B)},ur.useSyncExternalStore=function(B,R,Q){return j.H.useSyncExternalStore(B,R,Q)},ur.useTransition=function(){return j.H.useTransition()},ur.version="19.2.4",ur}var qxe;function Kk(){return qxe||(qxe=1,wB.exports=e_t()),wB.exports}var x=Kk();const Ce=fo(x),_w=s8e({__proto__:null,default:Ce},[x]);var SB={exports:{}},UE={},OB={exports:{}},kB={};var Vxe;function t_t(){return Vxe||(Vxe=1,(function(e){function t(V,z){var H=V.length;V.push(z);e:for(;0<H;){var W=H-1>>>1,$=V[W];if(0<a($,z))V[W]=z,V[H]=$,H=W;else break e}}function n(V){return V.length===0?null:V[0]}function r(V){if(V.length===0)return null;var z=V[0],H=V.pop();if(H!==z){V[0]=H;e:for(var W=0,$=V.length,Z=$>>>1;W<Z;){var B=2*(W+1)-1,R=V[B],Q=B+1,G=V[Q];if(0>a(R,H))Q<$&&0>a(G,R)?(V[W]=G,V[Q]=H,W=Q):(V[W]=R,V[B]=H,W=B);else if(Q<$&&0>a(G,H))V[W]=G,V[Q]=H,W=Q;else break e}}return z}function a(V,z){var H=V.sortIndex-z.sortIndex;return H!==0?H:V.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,o=i.now();e.unstable_now=function(){return i.now()-o}}var c=[],u=[],d=1,f=null,p=3,h=!1,m=!1,g=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function k(V){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=V)r(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function _(V){if(g=!1,k(V),!m)if(n(c)!==null)m=!0,C||(C=!0,M());else{var z=n(u);z!==null&&U(_,z.startTime-V)}}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 V=e.unstable_now();A=V;var z=!0;try{e:{m=!1,g&&(g=!1,w(T),T=-1),h=!0;var H=p;try{t:{for(k(V),f=n(c);f!==null&&!(f.expirationTime>V&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,p=f.priorityLevel;var $=W(f.expirationTime<=V);if(V=e.unstable_now(),typeof $=="function"){f.callback=$,k(V),z=!0;break t}f===n(c)&&r(c),k(V)}else r(c);f=n(c)}if(f!==null)z=!0;else{var Z=n(u);Z!==null&&U(_,Z.startTime-V),z=!1}}break e}finally{f=null,p=H,h=!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(){b(P,0)};function U(V,z){T=b(function(){V(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(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_next=function(V){switch(p){case 1:case 2:case 3:var z=3;break;default:z=p}var H=p;p=z;try{return V()}finally{p=H}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(V,z){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var H=p;p=V;try{return z()}finally{p=H}},e.unstable_scheduleCallback=function(V,z,H){var W=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?W+H:W):H=W,V){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=H+$,V={id:d++,callback:z,priorityLevel:V,startTime:H,expirationTime:$,sortIndex:-1},H>W?(V.sortIndex=H,t(u,V),n(c)===null&&V===n(u)&&(g?(w(T),T=-1):g=!0,U(_,H-W))):(V.sortIndex=$,t(c,V),m||h||(m=!0,C||(C=!0,M()))),V},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(V){var z=p;return function(){var H=p;p=z;try{return V.apply(this,arguments)}finally{p=H}}}})(kB)),kB}var Hxe;function n_t(){return Hxe||(Hxe=1,OB.exports=t_t()),OB.exports}var _B={exports:{}},jl={};var Qxe;function r_t(){if(Qxe)return jl;Qxe=1;var e=Kk();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 o(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return jl.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,jl.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)},jl.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()}},jl.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))},jl.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},jl.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=o(d,u.crossOrigin),p=typeof u.integrity=="string"?u.integrity:void 0,h=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:p,fetchPriority:h}):d==="script"&&r.d.X(c,{crossOrigin:f,integrity:p,fetchPriority:h,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},jl.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=o(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)},jl.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=o(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})}},jl.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=o(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)},jl.requestFormReset=function(c){r.d.r(c)},jl.unstable_batchedUpdates=function(c,u){return c(u)},jl.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},jl.useFormStatus=function(){return i.H.useHostTransitionStatus()},jl.version="19.2.4",jl}var Wxe;function i8e(){if(Wxe)return _B.exports;Wxe=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(),_B.exports=r_t(),_B.exports}var Gxe;function a_t(){if(Gxe)return UE;Gxe=1;var e={env:{}};var t=n_t(),n=Kk(),r=i8e();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 o(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 te=!1,he=L.child;he;){if(he===E){te=!0,E=L,N=q;break}if(he===N){te=!0,N=L,E=q;break}he=he.sibling}if(!te){for(he=q.child;he;){if(he===E){te=!0,E=q,N=L;break}if(he===N){te=!0,N=q,E=L;break}he=he.sibling}if(!te)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 p=Object.assign,h=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),b=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 b: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 V=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},$=[],Z=-1;function B(y){return{current:y}}function R(y){0>Z||(y.current=$[Z],$[Z]=null,Z--)}function Q(y,S){Z++,$[Z]=y.current,y.current=S}var G=B(null),J=B(null),re=B(null),ne=B(null);function se(y,S){switch(Q(re,S),Q(J,y),Q(G,null),S.nodeType){case 9:case 11:y=(y=S.documentElement)&&(y=y.namespaceURI)?cxe(y):0;break;default:if(y=S.tagName,S=S.namespaceURI)S=cxe(S),y=uxe(S,y);else switch(y){case"svg":y=1;break;case"math":y=2;break;default:y=0}}R(G),Q(G,y)}function le(){R(G),R(J),R(re)}function me(y){y.memoizedState!==null&&Q(ne,y);var S=G.current,E=uxe(S,y.type);S!==E&&(Q(J,y),Q(G,E))}function K(y){J.current===y&&(R(G),R(J)),ne.current===y&&(R(ne),$E._currentValue=W)}var ae,oe;function ve(y){if(ae===void 0)try{throw Error()}catch(E){var S=E.stack.trim().match(/\n( *(at )?)/);ae=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-CyfEDU-Y.js","./chunk-ZCJMLMGS-BnM7rIyY.js","./index-CqPCldmj.js","./token-APYSY3BW-RPVF55TR-DsOowoW5.js","./index-8mVKHX_j.js","./index-D2aYjUYW.js","./index-CzXYaJgN.js","./index-FOl4sUk-.js","./index-BNAYYUc3.js","./index-Bb2rMuNJ.js","./index-BrKAFMNo.js","./index-Dm9YxRl_.js","./index-D5Ecjke_.js","./index-BPStdTZK.js","./index-DKdpjQsM.js","./index-CDyzq8kO.js","./index-OK2VNs_f.js","./index-C2fjAP9x.js","./dockerfile-BKs6k2Af.js","./simple-mode-GW_nhZxv.js","./factor-kuTfRLto.js","./nsis-LdVXkNf5.js","./pug-DeIclll2.js","./javascript-iXu5QeM3.js","./index-Bz0o5EJq.js","./index-DmCxvSjO.js","./index-UhzyOq43.js"])))=>i.map(i=>d[i]);
2
+ import{_ as We}from"./index-CqPCldmj.js";function s8e(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 r$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function fo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xB={exports:{}},BE={};var zxe;function Kkt(){if(zxe)return BE;zxe=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 o in a)o!=="key"&&(s[o]=a[o])}else s=a;return a=s.ref,{$$typeof:e,type:r,key:i,ref:a!==void 0?a:null,props:s}}return BE.Fragment=t,BE.jsx=n,BE.jsxs=n,BE}var Bxe;function Jkt(){return Bxe||(Bxe=1,xB.exports=Kkt()),xB.exports}var l=Jkt(),wB={exports:{}},ur={},Uxe;function e_t(){if(Uxe)return ur;Uxe=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"),o=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"),p=Symbol.for("react.activity"),h=Symbol.iterator;function m(B){return B===null||typeof B!="object"?null:(B=h&&B[h]||B["@@iterator"],typeof B=="function"?B:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,b={};function w(B,R,Q){this.props=B,this.context=R,this.refs=b,this.updater=Q||g}w.prototype.isReactComponent={},w.prototype.setState=function(B,R){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,R,"setState")},w.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function O(){}O.prototype=w.prototype;function k(B,R,Q){this.props=B,this.context=R,this.refs=b,this.updater=Q||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(B,R,Q){var G=Q.ref;return{$$typeof:t,type:B,key:R,ref:G!==void 0?G:null,props:Q}}function P(B,R){return I(B.type,R,B.props)}function M(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function F(B){var R={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(Q){return R[Q]})}var D=/\/+/g;function U(B,R){return typeof B=="object"&&B!==null&&B.key!=null?F(""+B.key):R.toString(36)}function V(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(T,T):(B.status="pending",B.then(function(R){B.status==="pending"&&(B.status="fulfilled",B.value=R)},function(R){B.status==="pending"&&(B.status="rejected",B.reason=R)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function z(B,R,Q,G,J){var re=typeof B;(re==="undefined"||re==="boolean")&&(B=null);var ne=!1;if(B===null)ne=!0;else switch(re){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(B.$$typeof){case t:case n:ne=!0;break;case f:return ne=B._init,z(ne(B._payload),R,Q,G,J)}}if(ne)return J=J(B),ne=G===""?"."+U(B,0):G,C(J)?(Q="",ne!=null&&(Q=ne.replace(D,"$&/")+"/"),z(J,R,Q,"",function(me){return me})):J!=null&&(M(J)&&(J=P(J,Q+(J.key==null||B&&B.key===J.key?"":(""+J.key).replace(D,"$&/")+"/")+ne)),R.push(J)),1;ne=0;var se=G===""?".":G+":";if(C(B))for(var le=0;le<B.length;le++)G=B[le],re=se+U(G,le),ne+=z(G,R,Q,re,J);else if(le=m(B),typeof le=="function")for(B=le.call(B),le=0;!(G=B.next()).done;)G=G.value,re=se+U(G,le++),ne+=z(G,R,Q,re,J);else if(re==="object"){if(typeof B.then=="function")return z(V(B),R,Q,G,J);throw R=String(B),Error("Objects are not valid as a React child (found: "+(R==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.")}return ne}function H(B,R,Q){if(B==null)return B;var G=[],J=0;return z(B,G,"","",function(re){return R.call(Q,re,J++)}),G}function W(B){if(B._status===-1){var R=B._result;R=R(),R.then(function(Q){(B._status===0||B._status===-1)&&(B._status=1,B._result=Q)},function(Q){(B._status===0||B._status===-1)&&(B._status=2,B._result=Q)}),B._status===-1&&(B._status=0,B._result=R)}if(B._status===1)return B._result.default;throw B._result}var $=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var R=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(R))return}else if(typeof e=="object"&&typeof e.emit=="function"){e.emit("uncaughtException",B);return}console.error(B)},Z={map:H,forEach:function(B,R,Q){H(B,function(){R.apply(this,arguments)},Q)},count:function(B){var R=0;return H(B,function(){R++}),R},toArray:function(B){return H(B,function(R){return R})||[]},only:function(B){if(!M(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return ur.Activity=p,ur.Children=Z,ur.Component=w,ur.Fragment=r,ur.Profiler=s,ur.PureComponent=k,ur.StrictMode=a,ur.Suspense=u,ur.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,ur.__COMPILER_RUNTIME={__proto__:null,c:function(B){return j.H.useMemoCache(B)}},ur.cache=function(B){return function(){return B.apply(null,arguments)}},ur.cacheSignal=function(){return null},ur.cloneElement=function(B,R,Q){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var G=v({},B.props),J=B.key;if(R!=null)for(re in R.key!==void 0&&(J=""+R.key),R)!A.call(R,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&R.ref===void 0||(G[re]=R[re]);var re=arguments.length-2;if(re===1)G.children=Q;else if(1<re){for(var ne=Array(re),se=0;se<re;se++)ne[se]=arguments[se+2];G.children=ne}return I(B.type,J,G)},ur.createContext=function(B){return B={$$typeof:o,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:i,_context:B},B},ur.createElement=function(B,R,Q){var G,J={},re=null;if(R!=null)for(G in R.key!==void 0&&(re=""+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=Q;else if(1<ne){for(var se=Array(ne),le=0;le<ne;le++)se[le]=arguments[le+2];J.children=se}if(B&&B.defaultProps)for(G in ne=B.defaultProps,ne)J[G]===void 0&&(J[G]=ne[G]);return I(B,re,J)},ur.createRef=function(){return{current:null}},ur.forwardRef=function(B){return{$$typeof:c,render:B}},ur.isValidElement=M,ur.lazy=function(B){return{$$typeof:f,_payload:{_status:-1,_result:B},_init:W}},ur.memo=function(B,R){return{$$typeof:d,type:B,compare:R===void 0?null:R}},ur.startTransition=function(B){var R=j.T,Q={};j.T=Q;try{var G=B(),J=j.S;J!==null&&J(Q,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(T,$)}catch(re){$(re)}finally{R!==null&&Q.types!==null&&(R.types=Q.types),j.T=R}},ur.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},ur.use=function(B){return j.H.use(B)},ur.useActionState=function(B,R,Q){return j.H.useActionState(B,R,Q)},ur.useCallback=function(B,R){return j.H.useCallback(B,R)},ur.useContext=function(B){return j.H.useContext(B)},ur.useDebugValue=function(){},ur.useDeferredValue=function(B,R){return j.H.useDeferredValue(B,R)},ur.useEffect=function(B,R){return j.H.useEffect(B,R)},ur.useEffectEvent=function(B){return j.H.useEffectEvent(B)},ur.useId=function(){return j.H.useId()},ur.useImperativeHandle=function(B,R,Q){return j.H.useImperativeHandle(B,R,Q)},ur.useInsertionEffect=function(B,R){return j.H.useInsertionEffect(B,R)},ur.useLayoutEffect=function(B,R){return j.H.useLayoutEffect(B,R)},ur.useMemo=function(B,R){return j.H.useMemo(B,R)},ur.useOptimistic=function(B,R){return j.H.useOptimistic(B,R)},ur.useReducer=function(B,R,Q){return j.H.useReducer(B,R,Q)},ur.useRef=function(B){return j.H.useRef(B)},ur.useState=function(B){return j.H.useState(B)},ur.useSyncExternalStore=function(B,R,Q){return j.H.useSyncExternalStore(B,R,Q)},ur.useTransition=function(){return j.H.useTransition()},ur.version="19.2.4",ur}var qxe;function Kk(){return qxe||(qxe=1,wB.exports=e_t()),wB.exports}var x=Kk();const Ce=fo(x),_w=s8e({__proto__:null,default:Ce},[x]);var SB={exports:{}},UE={},OB={exports:{}},kB={};var Vxe;function t_t(){return Vxe||(Vxe=1,(function(e){function t(V,z){var H=V.length;V.push(z);e:for(;0<H;){var W=H-1>>>1,$=V[W];if(0<a($,z))V[W]=z,V[H]=$,H=W;else break e}}function n(V){return V.length===0?null:V[0]}function r(V){if(V.length===0)return null;var z=V[0],H=V.pop();if(H!==z){V[0]=H;e:for(var W=0,$=V.length,Z=$>>>1;W<Z;){var B=2*(W+1)-1,R=V[B],Q=B+1,G=V[Q];if(0>a(R,H))Q<$&&0>a(G,R)?(V[W]=G,V[Q]=H,W=Q):(V[W]=R,V[B]=H,W=B);else if(Q<$&&0>a(G,H))V[W]=G,V[Q]=H,W=Q;else break e}}return z}function a(V,z){var H=V.sortIndex-z.sortIndex;return H!==0?H:V.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,o=i.now();e.unstable_now=function(){return i.now()-o}}var c=[],u=[],d=1,f=null,p=3,h=!1,m=!1,g=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function k(V){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=V)r(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function _(V){if(g=!1,k(V),!m)if(n(c)!==null)m=!0,C||(C=!0,M());else{var z=n(u);z!==null&&U(_,z.startTime-V)}}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 V=e.unstable_now();A=V;var z=!0;try{e:{m=!1,g&&(g=!1,w(T),T=-1),h=!0;var H=p;try{t:{for(k(V),f=n(c);f!==null&&!(f.expirationTime>V&&I());){var W=f.callback;if(typeof W=="function"){f.callback=null,p=f.priorityLevel;var $=W(f.expirationTime<=V);if(V=e.unstable_now(),typeof $=="function"){f.callback=$,k(V),z=!0;break t}f===n(c)&&r(c),k(V)}else r(c);f=n(c)}if(f!==null)z=!0;else{var Z=n(u);Z!==null&&U(_,Z.startTime-V),z=!1}}break e}finally{f=null,p=H,h=!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(){b(P,0)};function U(V,z){T=b(function(){V(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(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_next=function(V){switch(p){case 1:case 2:case 3:var z=3;break;default:z=p}var H=p;p=z;try{return V()}finally{p=H}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(V,z){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var H=p;p=V;try{return z()}finally{p=H}},e.unstable_scheduleCallback=function(V,z,H){var W=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?W+H:W):H=W,V){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=H+$,V={id:d++,callback:z,priorityLevel:V,startTime:H,expirationTime:$,sortIndex:-1},H>W?(V.sortIndex=H,t(u,V),n(c)===null&&V===n(u)&&(g?(w(T),T=-1):g=!0,U(_,H-W))):(V.sortIndex=$,t(c,V),m||h||(m=!0,C||(C=!0,M()))),V},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(V){var z=p;return function(){var H=p;p=z;try{return V.apply(this,arguments)}finally{p=H}}}})(kB)),kB}var Hxe;function n_t(){return Hxe||(Hxe=1,OB.exports=t_t()),OB.exports}var _B={exports:{}},jl={};var Qxe;function r_t(){if(Qxe)return jl;Qxe=1;var e=Kk();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 o(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return jl.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,jl.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)},jl.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()}},jl.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))},jl.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},jl.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var d=u.as,f=o(d,u.crossOrigin),p=typeof u.integrity=="string"?u.integrity:void 0,h=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:p,fetchPriority:h}):d==="script"&&r.d.X(c,{crossOrigin:f,integrity:p,fetchPriority:h,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},jl.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var d=o(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)},jl.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var d=u.as,f=o(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})}},jl.preloadModule=function(c,u){if(typeof c=="string")if(u){var d=o(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)},jl.requestFormReset=function(c){r.d.r(c)},jl.unstable_batchedUpdates=function(c,u){return c(u)},jl.useFormState=function(c,u,d){return i.H.useFormState(c,u,d)},jl.useFormStatus=function(){return i.H.useHostTransitionStatus()},jl.version="19.2.4",jl}var Wxe;function i8e(){if(Wxe)return _B.exports;Wxe=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(),_B.exports=r_t(),_B.exports}var Gxe;function a_t(){if(Gxe)return UE;Gxe=1;var e={env:{}};var t=n_t(),n=Kk(),r=i8e();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 o(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 te=!1,he=L.child;he;){if(he===E){te=!0,E=L,N=q;break}if(he===N){te=!0,N=L,E=q;break}he=he.sibling}if(!te){for(he=q.child;he;){if(he===E){te=!0,E=q,N=L;break}if(he===N){te=!0,N=q,E=L;break}he=he.sibling}if(!te)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 p=Object.assign,h=Symbol.for("react.element"),m=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),b=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 b: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 V=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},$=[],Z=-1;function B(y){return{current:y}}function R(y){0>Z||(y.current=$[Z],$[Z]=null,Z--)}function Q(y,S){Z++,$[Z]=y.current,y.current=S}var G=B(null),J=B(null),re=B(null),ne=B(null);function se(y,S){switch(Q(re,S),Q(J,y),Q(G,null),S.nodeType){case 9:case 11:y=(y=S.documentElement)&&(y=y.namespaceURI)?cxe(y):0;break;default:if(y=S.tagName,S=S.namespaceURI)S=cxe(S),y=uxe(S,y);else switch(y){case"svg":y=1;break;case"math":y=2;break;default:y=0}}R(G),Q(G,y)}function le(){R(G),R(J),R(re)}function me(y){y.memoizedState!==null&&Q(ne,y);var S=G.current,E=uxe(S,y.type);S!==E&&(Q(J,y),Q(G,E))}function K(y){J.current===y&&(R(G),R(J)),ne.current===y&&(R(ne),$E._currentValue=W)}var ae,oe;function ve(y){if(ae===void 0)try{throw Error()}catch(E){var S=E.stack.trim().match(/\n( *(at )?)/);ae=S&&S[1]||"",oe=-1<E.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<E.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+ae+y+oe}var de=!1;function ue(y,S){if(!y||de)return"";de=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var N={DetermineComponentFrameRoot:function(){try{if(S){var lt=function(){throw Error()};if(Object.defineProperty(lt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(lt,[])}catch(Xe){var Ue=Xe}Reflect.construct(y,[],lt)}else{try{lt.call()}catch(Xe){Ue=Xe}y.call(lt.prototype)}}else{try{throw Error()}catch(Xe){Ue=Xe}(lt=y())&&typeof lt.catch=="function"&&lt.catch(function(){})}}catch(Xe){if(Xe&&Ue&&typeof Xe.stack=="string")return[Xe.stack,Ue.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(),te=q[0],he=q[1];if(te&&he){var Te=te.split(`
5
5
  `),Be=he.split(`
@@ -56,7 +56,7 @@ Error message: ${Xoe(n)}`,cause:n}),this[_0e]=!0,this.value=t}static isInstance(
56
56
  ]))`;continue}else if(a[u]==="$"){s+=`($|(?=[\r
57
57
  ]))`;continue}}if(r.s&&a[u]==="."){s+=o?`${a[u]}\r
58
58
  `:`[${a[u]}\r
59
- ]`;continue}s+=a[u],a[u]==="\\"?i=!0:o&&a[u]==="]"?o=!1:!o&&a[u]==="["&&(o=!0)}return s}function SVe(e,t){var n,r,a,s,i,o;const c={type:"object",additionalProperties:(n=Xa(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===Le.ZodString&&((a=e.keyType._def.checks)!=null&&a.length)){const{type:u,...d}=wVe(e.keyType._def,t);return{...c,propertyNames:d}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===Le.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===Le.ZodBranded&&e.keyType._def.type._def.typeName===Le.ZodString&&((o=e.keyType._def.type._def.checks)!=null&&o.length)){const{type:u,...d}=bVe(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function XTt(e,t){if(t.mapStrategy==="record")return SVe(e,t);const n=Xa(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||wd(),r=Xa(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||wd();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function KTt(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 JTt(){return{not:wd()}}function eNt(){return{type:"null"}}var Lee={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function tNt(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in Lee&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((a,s)=>{const i=Lee[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,o)=>o.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 nNt(e,t)}var nNt=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,a)=>Xa(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 rNt(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Lee[e.innerType._def.typeName],"null"]};const n=Xa(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function aNt(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 sNt(e,t){const n={type:"object",properties:{}},r=[],a=e.shape();for(const i in a){let o=a[i];if(o===void 0||o._def===void 0)continue;const c=oNt(o),u=Xa(o._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=iNt(e,t);return s!==void 0&&(n.additionalProperties=s),n}function iNt(e,t){if(e.catchall._def.typeName!=="ZodNever")return Xa(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 oNt(e){try{return e.isOptional()}catch{return!0}}var lNt=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return Xa(e.innerType._def,t);const r=Xa(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:wd()},r]}:wd()},cNt=(e,t)=>{if(t.pipeStrategy==="input")return Xa(e.in._def,t);if(t.pipeStrategy==="output")return Xa(e.out._def,t);const n=Xa(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=Xa(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(a=>a!==void 0)}};function uNt(e,t){return Xa(e.type._def,t)}function dNt(e,t){const r={type:"array",uniqueItems:!0,items:Xa(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 fNt(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>Xa(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Xa(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>Xa(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function pNt(){return{not:wd()}}function hNt(){return wd()}var mNt=(e,t)=>Xa(e.innerType._def,t),gNt=(e,t,n)=>{switch(t){case Le.ZodString:return wVe(e,n);case Le.ZodNumber:return aNt(e);case Le.ZodObject:return sNt(e,n);case Le.ZodBigInt:return FTt(e);case Le.ZodBoolean:return zTt();case Le.ZodDate:return xVe(e,n);case Le.ZodUndefined:return pNt();case Le.ZodNull:return eNt();case Le.ZodArray:return LTt(e,n);case Le.ZodUnion:case Le.ZodDiscriminatedUnion:return tNt(e,n);case Le.ZodIntersection:return WTt(e,n);case Le.ZodTuple:return fNt(e,n);case Le.ZodRecord:return SVe(e,n);case Le.ZodLiteral:return GTt(e);case Le.ZodEnum:return HTt(e);case Le.ZodNativeEnum:return KTt(e);case Le.ZodNullable:return rNt(e,n);case Le.ZodOptional:return lNt(e,n);case Le.ZodMap:return XTt(e,n);case Le.ZodSet:return dNt(e,n);case Le.ZodLazy:return()=>e.getter()._def;case Le.ZodPromise:return uNt(e,n);case Le.ZodNaN:case Le.ZodNever:return JTt();case Le.ZodEffects:return VTt(e,n);case Le.ZodAny:return wd();case Le.ZodUnknown:return hNt();case Le.ZodDefault:return qTt(e,n);case Le.ZodBranded:return bVe(e,n);case Le.ZodReadonly:return mNt(e,n);case Le.ZodCatch:return BTt(e,n);case Le.ZodPipeline:return cNt(e,n);case Le.ZodFunction:case Le.ZodVoid:case Le.ZodSymbol:return;default:return(r=>{})()}};function Xa(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!==DTt)return c}if(a&&!n){const c=vNt(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=gNt(e,e.typeName,t),o=typeof i=="function"?Xa(i(),t):i;if(o&&yNt(e,t,o),t.postProcess){const c=t.postProcess(o,e,t);return s.jsonSchema=o,c}return s.jsonSchema=o,o}var vNt=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:MTt(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`),wd()):t.$refStrategy==="seen"?wd():void 0}},yNt=(e,t,n)=>(e.description&&(n.description=e.description),n),bNt=e=>{const t=$Tt(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}]))}},xNt=(e,t)=>{var n;const r=bNt(t);let a=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,f])=>{var p;return{...u,[d]:(p=Xa(f._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?p:wd()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(n=Xa(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))!=null?n:wd(),o=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;o!==void 0&&(i.title=o);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},wNt=xNt;function SNt(e,t){var n;const r=(n=void 0)!=null?n:!1;return Joe(()=>wNt(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 ONt(e,t){var n;const r=(n=void 0)!=null?n:!1;return Joe(()=>l2(BA(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async a=>{const s=await uoe(e,a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function kNt(e){return"_zod"in e}function qp(e,t){return kNt(e)?ONt(e):SNt(e)}var Fee=Symbol.for("vercel.ai.schema");function C5(e){let t;return()=>(t==null&&(t=e()),t)}function Joe(e,{validate:t}={}){return{[Fee]:!0,_type:void 0,[v$]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function _Nt(e){return typeof e=="object"&&e!==null&&Fee in e&&e[Fee]===!0&&"jsonSchema"in e&&"validate"in e}function ENt(e){return e==null?Joe({properties:{},additionalProperties:!1}):_Nt(e)?e:typeof e=="function"?e():qp(e)}function CNt(e){return e?.replace(/\/$/,"")}var jNt={},OVe=M3({"../../../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=(p,h)=>{for(var m in h)n(p,m,{get:h[m],enumerable:!0})},o=(p,h,m,g)=>{if(h&&typeof h=="object"||typeof h=="function")for(let v of a(h))!s.call(p,v)&&v!==m&&n(p,v,{get:()=>h[v],enumerable:!(g=r(h,v))||g.enumerable});return p},c=p=>o(n({},"__esModule",{value:!0}),p),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?.()??{}}}}),TNt=M3({"../../../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})},o=(m,g,v,b)=>{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:!(b=r(g,w))||b.enumerable});return m},c=m=>o(n({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>h}),t.exports=c(u);var d=OVe(),f=f_t();async function p(){let m="",g;try{m=h()}catch(v){g=v}try{const[{getTokenPayload:v,isExpired:b},{refreshToken:w}]=await Promise.all([await We(()=>import("./token-util-RMHT2CPJ-VVUHOXBL-CejHYUVi.js"),__vite__mapDeps([0,1,2]),import.meta.url),await We(()=>import("./token-APYSY3BW-RPVF55TR-BlIgi0Bi.js"),__vite__mapDeps([3,1,2]),import.meta.url)]);(!m||b(v(m)))&&(await w(),m=h())}catch(v){let b=g instanceof Error?g.message:"";throw v instanceof Error&&(b=`${b}
59
+ ]`;continue}s+=a[u],a[u]==="\\"?i=!0:o&&a[u]==="]"?o=!1:!o&&a[u]==="["&&(o=!0)}return s}function SVe(e,t){var n,r,a,s,i,o;const c={type:"object",additionalProperties:(n=Xa(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===Le.ZodString&&((a=e.keyType._def.checks)!=null&&a.length)){const{type:u,...d}=wVe(e.keyType._def,t);return{...c,propertyNames:d}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===Le.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===Le.ZodBranded&&e.keyType._def.type._def.typeName===Le.ZodString&&((o=e.keyType._def.type._def.checks)!=null&&o.length)){const{type:u,...d}=bVe(e.keyType._def,t);return{...c,propertyNames:d}}}return c}function XTt(e,t){if(t.mapStrategy==="record")return SVe(e,t);const n=Xa(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||wd(),r=Xa(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||wd();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function KTt(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 JTt(){return{not:wd()}}function eNt(){return{type:"null"}}var Lee={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function tNt(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in Lee&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((a,s)=>{const i=Lee[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,o)=>o.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 nNt(e,t)}var nNt=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,a)=>Xa(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 rNt(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Lee[e.innerType._def.typeName],"null"]};const n=Xa(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function aNt(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 sNt(e,t){const n={type:"object",properties:{}},r=[],a=e.shape();for(const i in a){let o=a[i];if(o===void 0||o._def===void 0)continue;const c=oNt(o),u=Xa(o._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=iNt(e,t);return s!==void 0&&(n.additionalProperties=s),n}function iNt(e,t){if(e.catchall._def.typeName!=="ZodNever")return Xa(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 oNt(e){try{return e.isOptional()}catch{return!0}}var lNt=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return Xa(e.innerType._def,t);const r=Xa(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:wd()},r]}:wd()},cNt=(e,t)=>{if(t.pipeStrategy==="input")return Xa(e.in._def,t);if(t.pipeStrategy==="output")return Xa(e.out._def,t);const n=Xa(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=Xa(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(a=>a!==void 0)}};function uNt(e,t){return Xa(e.type._def,t)}function dNt(e,t){const r={type:"array",uniqueItems:!0,items:Xa(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 fNt(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>Xa(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:Xa(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>Xa(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function pNt(){return{not:wd()}}function hNt(){return wd()}var mNt=(e,t)=>Xa(e.innerType._def,t),gNt=(e,t,n)=>{switch(t){case Le.ZodString:return wVe(e,n);case Le.ZodNumber:return aNt(e);case Le.ZodObject:return sNt(e,n);case Le.ZodBigInt:return FTt(e);case Le.ZodBoolean:return zTt();case Le.ZodDate:return xVe(e,n);case Le.ZodUndefined:return pNt();case Le.ZodNull:return eNt();case Le.ZodArray:return LTt(e,n);case Le.ZodUnion:case Le.ZodDiscriminatedUnion:return tNt(e,n);case Le.ZodIntersection:return WTt(e,n);case Le.ZodTuple:return fNt(e,n);case Le.ZodRecord:return SVe(e,n);case Le.ZodLiteral:return GTt(e);case Le.ZodEnum:return HTt(e);case Le.ZodNativeEnum:return KTt(e);case Le.ZodNullable:return rNt(e,n);case Le.ZodOptional:return lNt(e,n);case Le.ZodMap:return XTt(e,n);case Le.ZodSet:return dNt(e,n);case Le.ZodLazy:return()=>e.getter()._def;case Le.ZodPromise:return uNt(e,n);case Le.ZodNaN:case Le.ZodNever:return JTt();case Le.ZodEffects:return VTt(e,n);case Le.ZodAny:return wd();case Le.ZodUnknown:return hNt();case Le.ZodDefault:return qTt(e,n);case Le.ZodBranded:return bVe(e,n);case Le.ZodReadonly:return mNt(e,n);case Le.ZodCatch:return BTt(e,n);case Le.ZodPipeline:return cNt(e,n);case Le.ZodFunction:case Le.ZodVoid:case Le.ZodSymbol:return;default:return(r=>{})()}};function Xa(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!==DTt)return c}if(a&&!n){const c=vNt(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=gNt(e,e.typeName,t),o=typeof i=="function"?Xa(i(),t):i;if(o&&yNt(e,t,o),t.postProcess){const c=t.postProcess(o,e,t);return s.jsonSchema=o,c}return s.jsonSchema=o,o}var vNt=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:MTt(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`),wd()):t.$refStrategy==="seen"?wd():void 0}},yNt=(e,t,n)=>(e.description&&(n.description=e.description),n),bNt=e=>{const t=$Tt(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}]))}},xNt=(e,t)=>{var n;const r=bNt(t);let a=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[d,f])=>{var p;return{...u,[d]:(p=Xa(f._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?p:wd()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(n=Xa(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))!=null?n:wd(),o=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;o!==void 0&&(i.title=o);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},wNt=xNt;function SNt(e,t){var n;const r=(n=void 0)!=null?n:!1;return Joe(()=>wNt(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 ONt(e,t){var n;const r=(n=void 0)!=null?n:!1;return Joe(()=>l2(BA(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async a=>{const s=await uoe(e,a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function kNt(e){return"_zod"in e}function qp(e,t){return kNt(e)?ONt(e):SNt(e)}var Fee=Symbol.for("vercel.ai.schema");function C5(e){let t;return()=>(t==null&&(t=e()),t)}function Joe(e,{validate:t}={}){return{[Fee]:!0,_type:void 0,[v$]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function _Nt(e){return typeof e=="object"&&e!==null&&Fee in e&&e[Fee]===!0&&"jsonSchema"in e&&"validate"in e}function ENt(e){return e==null?Joe({properties:{},additionalProperties:!1}):_Nt(e)?e:typeof e=="function"?e():qp(e)}function CNt(e){return e?.replace(/\/$/,"")}var jNt={},OVe=M3({"../../../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=(p,h)=>{for(var m in h)n(p,m,{get:h[m],enumerable:!0})},o=(p,h,m,g)=>{if(h&&typeof h=="object"||typeof h=="function")for(let v of a(h))!s.call(p,v)&&v!==m&&n(p,v,{get:()=>h[v],enumerable:!(g=r(h,v))||g.enumerable});return p},c=p=>o(n({},"__esModule",{value:!0}),p),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?.()??{}}}}),TNt=M3({"../../../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})},o=(m,g,v,b)=>{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:!(b=r(g,w))||b.enumerable});return m},c=m=>o(n({},"__esModule",{value:!0}),m),u={};i(u,{getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>h}),t.exports=c(u);var d=OVe(),f=f_t();async function p(){let m="",g;try{m=h()}catch(v){g=v}try{const[{getTokenPayload:v,isExpired:b},{refreshToken:w}]=await Promise.all([await We(()=>import("./token-util-RMHT2CPJ-VVUHOXBL-CyfEDU-Y.js"),__vite__mapDeps([0,1,2]),import.meta.url),await We(()=>import("./token-APYSY3BW-RPVF55TR-DsOowoW5.js"),__vite__mapDeps([3,1,2]),import.meta.url)]);(!m||b(v(m)))&&(await w(),m=h())}catch(v){let b=g instanceof Error?g.message:"";throw v instanceof Error&&(b=`${b}
60
60
  ${v.message}`),b?new f.VercelOidcTokenError(b):v}return m}function h(){const m=(0,d.getContext)().headers?.["x-vercel-oidc-token"]??jNt.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}}}),kVe=M3({"../../../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=(p,h)=>{for(var m in h)n(p,m,{get:h[m],enumerable:!0})},o=(p,h,m,g)=>{if(h&&typeof h=="object"||typeof h=="function")for(let v of a(h))!s.call(p,v)&&v!==m&&n(p,v,{get:()=>h[v],enumerable:!(g=r(h,v))||g.enumerable});return p},c=p=>o(n({},"__esModule",{value:!0}),p),u={};i(u,{getContext:()=>f.getContext,getVercelOidcToken:()=>d.getVercelOidcToken,getVercelOidcTokenSync:()=>d.getVercelOidcTokenSync}),t.exports=c(u);var d=TNt(),f=OVe()}}),NNt=c8e(kVe()),ANt=c8e(kVe()),INt="vercel.ai.gateway.error",NB=Symbol.for(INt),I0e,R0e,kc=class _Ve extends(R0e=Error,I0e=NB,R0e){constructor({message:t,statusCode:n=500,cause:r}){super(t),this[I0e]=!0,this.statusCode=n,this.cause=r}static isInstance(t){return _Ve.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&NB in t&&t[NB]===!0}},EVe="GatewayAuthenticationError",RNt=`vercel.ai.gateway.error.${EVe}`,P0e=Symbol.for(RNt),M0e,D0e,CVe=class jVe extends(D0e=kc,M0e=P0e,D0e){constructor({message:t="Authentication failed",statusCode:n=401,cause:r}={}){super({message:t,statusCode:n,cause:r}),this[M0e]=!0,this.name=EVe,this.type="authentication_error"}static isInstance(t){return kc.hasMarker(t)&&P0e 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"}),Gc('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Gc('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Vrt=dde.concat([Gc("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Gc("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Gc("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),v_e=new Wet,Hrt=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function nC(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const Qon=["FunctionDeclaration"],Won={FunctionDeclaration:nC("function"),ClassDeclaration:nC("class"),ClassExpression:()=>!0,EnumDeclaration:nC("constant"),TypeAliasDeclaration:nC("type"),NamespaceDeclaration:nC("namespace"),VariableDefinition(e,t){e.matchContext(Qon)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function Qrt(e,t){let n=v_e.get(t);if(n)return n;let r=[],a=!0;function s(i,o){let c=e.sliceString(i.from,i.to);r.push({label:c,type:o})}return t.cursor($a.IncludeAnonymous).iterate(i=>{if(a)a=!1;else if(i.name){let o=Won[i.name];if(o&&o(i,s)||Hrt.has(i.name))return!1}else if(i.to-i.from>8192){for(let o of Qrt(e,i.node))r.push(o);return!1}}),v_e.set(t,r),r}const kL=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,fde=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Wrt(e){let t=fs(e.state).resolveInner(e.pos,-1);if(fde.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&kL.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let a=t;a;a=a.parent)Hrt.has(a.name)&&(r=r.concat(Qrt(e.state.doc,a)));return{options:r,from:n?t.from:e.pos,validFor:kL}}function pU(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 Grt(e){let t=r=>e.state.doc.sliceString(r.from,r.to),n=fs(e.state).resolveInner(e.pos,-1);return n.name=="PropertyName"?pU(t,n.parent,t(n)):(n.name=="."||n.name=="?.")&&n.parent.name=="MemberExpression"?pU(t,n.parent,""):fde.indexOf(n.name)>-1?null:n.name=="VariableName"||n.to-n.from<20&&kL.test(t(n))?{path:[],name:t(n)}:n.name=="MemberExpression"?pU(t,n,""):e.explicit?{path:[],name:""}:null}function Gon(e,t){let n=e,r=[],a=new Set;for(let s=0;;s++){for(let o of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(o)||a.has(o))continue;a.add(o);let c;try{c=n[o]}catch{continue}r.push({label:o,type:typeof c=="function"?/^[A-Z]/.test(o)?"class":t?"function":"method":t?"variable":"property",boost:-s})}let i=Object.getPrototypeOf(e);if(!i)return r;e=i}}function Zon(e){let t=new Map;return n=>{let r=Grt(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=Gon(a,!r.path.length)),{from:n.pos-r.name.length,options:s,validFor:kL}}}const Cf=Z0.define({name:"javascript",parser:Hon.configure({props:[Hw.add({IfStatement:hO({except:/^\s*({|else\b)/}),TryStatement:hO({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Hrn,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:Vrn({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":hO({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}}),Qw.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Hue,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:"$"}}),Zrt={test:e=>/^JSX/.test(e.name),facet:Z6({commentTokens:{block:{open:"{/*",close:"*/}"}}})},pde=Cf.configure({dialect:"ts"},"typescript"),hde=Cf.configure({dialect:"jsx",props:[Uue.add(e=>e.isTop?[Zrt]:void 0)]}),mde=Cf.configure({dialect:"jsx ts",props:[Uue.add(e=>e.isTop?[Zrt]:void 0)]},"typescript");let Yrt=e=>({label:e,type:"keyword"});const Xrt="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(Yrt),Yon=Xrt.concat(["declare","implements","private","protected","public"].map(Yrt));function _L(e={}){let t=e.jsx?e.typescript?mde:hde:e.typescript?pde:Cf,n=e.typescript?Vrt.concat(Yon):dde.concat(Xrt);return new X0(t,[Cf.data.of({autocomplete:Nan(fde,Qnt(n))}),Cf.data.of({autocomplete:Wrt}),e.jsx?Krt:[]])}function Xon(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 y_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 Kon=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Krt=gt.inputHandler.of((e,t,n,r,a)=>{if((Kon?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Cf.isActiveAt(e.state,t,-1))return!1;let s=a(),{state:i}=s,o=i.changeByRange(c=>{var u;let{head:d}=c,f=fs(i).resolveInner(d-1,-1),p;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 h=f.parent,m=h.parent;if(m&&h.from==d-2&&((p=y_e(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${p}>`;return{range:nt.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(r==">"){let h=Xon(f);if(h&&h.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(p=y_e(i.doc,h,d)))return{range:c,changes:{from:d,insert:`</${p}>`}}}}return{range:c}});return o.changes.empty?!1:(e.dispatch([s,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function Jon(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 Cf.findRegions(r)){let o=r.doc.lineAt(s),c={line:o.number-1,col:s-o.from,pos:s};for(let u of e.verify(r.sliceDoc(s,i),t))a.push(eln(u,r.doc,c))}return a}}function b_e(e,t,n,r){return n.line(e+r.line).from+t+(e==1?r.col-1:-1)}function eln(e,t,n){let r=b_e(e.line,e.column,t,n),a={from:r,to:e.endLine!=null&&e.endColumn!=1?b_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,o=s[0]+n.pos-r,c=s[1]+n.pos-r;a.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+o,to:d+c,insert:i},scrollIntoView:!0})}}]}return a}const FM=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:Krt,completionPath:Grt,esLint:Jon,javascript:_L,javascriptLanguage:Cf,jsxLanguage:hde,localCompletionSource:Wrt,scopeCompletionSource:Zon,snippets:dde,tsxLanguage:mde,typescriptLanguage:pde,typescriptSnippets:Vrt},Symbol.toStringTag,{value:"Module"})),rC=["_blank","_self","_top","_parent"],hU=["ascii","utf-8","utf-16","latin1","latin1"],mU=["get","post","put","delete"],gU=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],qu=["true","false"],Cn={},tln={a:{attrs:{href:null,ping:null,type:null,media:null,target:rC,hreflang:null}},abbr:Cn,address:Cn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Cn,aside:Cn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Cn,base:{attrs:{href:null,target:rC}},bdi:Cn,bdo:Cn,blockquote:{attrs:{cite:null}},body:Cn,br:Cn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:gU,formmethod:mU,formnovalidate:["novalidate"],formtarget:rC,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Cn,center:Cn,cite:Cn,code:Cn,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:Cn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Cn,div:Cn,dl:Cn,dt:Cn,em:Cn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Cn,figure:Cn,footer:Cn,form:{attrs:{action:null,name:null,"accept-charset":hU,autocomplete:["on","off"],enctype:gU,method:mU,novalidate:["novalidate"],target:rC}},h1:Cn,h2:Cn,h3:Cn,h4:Cn,h5:Cn,h6:Cn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Cn,hgroup:Cn,hr:Cn,html:{attrs:{manifest:null}},i:Cn,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:gU,formmethod:mU,formnovalidate:["novalidate"],formtarget:rC,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:Cn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Cn,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:Cn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:hU,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:Cn,noscript:Cn,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:Cn,param:{attrs:{name:null,value:null}},pre:Cn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Cn,rt:Cn,ruby:Cn,samp:Cn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:hU}},section:Cn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Cn,source:{attrs:{src:null,type:null,media:null}},span:Cn,strong:Cn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Cn,summary:Cn,sup:Cn,table:Cn,tbody:Cn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Cn,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:Cn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Cn,time:{attrs:{datetime:null}},title:Cn,tr:Cn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Cn,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:Cn},Jrt={accesskey:null,class:null,contenteditable:qu,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:qu,autocorrect:qu,autocapitalize:qu,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":qu,"aria-autocomplete":["inline","list","both","none"],"aria-busy":qu,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":qu,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":qu,"aria-hidden":qu,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":qu,"aria-multiselectable":qu,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":qu,"aria-relevant":null,"aria-required":qu,"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},eat="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 eat)Jrt[e]=null;let xN=class{constructor(t,n){this.tags={...tln,...t},this.globalAttrs={...Jrt,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};xN.default=new xN;function pk(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 hk(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function tat(e,t,n){let r=n.tags[pk(e,hk(t))];return r?.children||n.allTags}function gde(e,t){let n=[];for(let r=hk(t);r&&!r.type.isTop;r=hk(r.parent)){let a=pk(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 nat=/^[:\-\.\w\u00b7-\uffff]*$/;function x_e(e,t,n,r,a){let s=/\s*>/.test(e.sliceDoc(a,a+5))?"":">",i=hk(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:a,options:tat(e.doc,i,t).map(o=>({label:o,type:"type"})).concat(gde(e.doc,n).map((o,c)=>({label:"/"+o,apply:"/"+o+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function w_e(e,t,n,r){let a=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:gde(e.doc,t).map((s,i)=>({label:s,apply:s+a,type:"type",boost:99-i})),validFor:nat}}function nln(e,t,n,r){let a=[],s=0;for(let i of tat(e.doc,n,t))a.push({label:"<"+i,type:"type"});for(let i of gde(e.doc,n))a.push({label:"</"+i+">",type:"type",boost:99-s++});return{from:r,to:r,options:a,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function rln(e,t,n,r,a){let s=hk(n),i=s?t.tags[pk(e.doc,s)]:null,o=i&&i.attrs?Object.keys(i.attrs):[],c=i&&i.globalAttrs===!1?o:o.length?o.concat(t.globalAttrNames):t.globalAttrNames;return{from:r,to:a,options:c.map(u=>({label:u,type:"property"})),validFor:nat}}function aln(e,t,n,r,a){var s;let i=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),o=[],c;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let f=hk(n),p=f?t.tags[pk(e.doc,f)]:null;d=p?.attrs&&p.attrs[u]}if(d){let f=e.sliceDoc(r,a).toLowerCase(),p='"',h='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,p="",h=e.sliceDoc(a,a+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let m of d)o.push({label:m,apply:p+m+h,type:"constant"})}}return{from:r,to:a,options:o,validFor:c}}function rat(e,t){let{state:n,pos:r}=t,a=fs(n).resolveInner(r,-1),s=a.resolve(r);for(let i=r,o;s==a&&(o=a.childBefore(i));){let c=o.lastChild;if(!c||!c.type.isError||c.from<c.to)break;s=a=o,i=c.from}return a.name=="TagName"?a.parent&&/CloseTag$/.test(a.parent.name)?w_e(n,a,a.from,r):x_e(n,e,a,a.from,r):a.name=="StartTag"||a.name=="IncompleteTag"?x_e(n,e,a,r,r):a.name=="StartCloseTag"||a.name=="IncompleteCloseTag"?w_e(n,a,r,r):a.name=="OpenTag"||a.name=="SelfClosingTag"||a.name=="AttributeName"?rln(n,e,a,a.name=="AttributeName"?a.from:r,r):a.name=="Is"||a.name=="AttributeValue"||a.name=="UnquotedAttributeValue"?aln(n,e,a,a.name=="Is"?r:a.from,r):t.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?nln(n,e,a,r):null}function aat(e){return rat(xN.default,e)}function sat(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new xN(t,n):xN.default;return a=>rat(r,a)}const sln=Cf.parser.configure({top:"SingleExpression"}),iat=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:pde.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:hde.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:mde.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:sln},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Cf.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:bN.parser}],oat=[{name:"style",parser:bN.parser.configure({top:"Styles"})}].concat(eat.map(e=>({name:e,parser:Cf.parser}))),lat=Z0.define({name:"html",parser:Pin.configure({props:[Hw.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}}),Qw.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}}}),Fnt.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Qj=lat.configure({wrap:Prt(iat,oat)});function cat(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=Prt((e.nestedLanguages||[]).concat(iat),(e.nestedAttributes||[]).concat(oat)));let r=n?lat.configure({wrap:n,dialect:t}):t?Qj.configure({dialect:t}):Qj;return new X0(r,[Qj.data.of({autocomplete:sat(e)}),e.autoCloseTags!==!1?uat:[],_L().support,Urt().support])}const S_e=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),uat=gt.inputHandler.of((e,t,n,r,a)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Qj.isActiveAt(e.state,t,-1))return!1;let s=a(),{state:i}=s,o=i.changeByRange(c=>{var u,d,f;let p=i.doc.sliceString(c.from-1,c.to)==r,{head:h}=c,m=fs(i).resolveInner(h,-1),g;if(p&&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=pk(i.doc,v.parent,h))&&!S_e.has(g)){let b=h+(i.doc.sliceString(h,h+1)===">"?1:0),w=`</${g}>`;return{range:c,changes:{from:h,to:b,insert:w}}}}else if(p&&r=="/"&&m.name=="IncompleteCloseTag"){let v=m.parent;if(m.from==h-2&&((f=v.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=pk(i.doc,v,h))&&!S_e.has(g)){let b=h+(i.doc.sliceString(h,h+1)===">"?1:0),w=`${g}>`;return{range:nt.cursor(h+w.length,-1),changes:{from:h,to:b,insert:w}}}}return{range:c}});return o.changes.empty?!1:(e.dispatch([s,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),iln=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:uat,html:cat,htmlCompletionSource:aat,htmlCompletionSourceWith:sat,htmlLanguage:Qj},Symbol.toStringTag,{value:"Module"})),dat=Z6({commentTokens:{block:{open:"<!--",close:"-->"}}}),fat=new lr,pat=Dsn.configure({props:[Qw.add(e=>!e.is("Block")||e.is("Document")||zne(e)!=null||oln(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),fat.add(zne),Hw.add({Document:()=>null}),Ly.add({Document:dat})]});function zne(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function oln(e){return e.name=="OrderedList"||e.name=="BulletList"}function lln(e,t){let n=e;for(;;){let r=n.nextSibling,a;if(!r||(a=zne(r.type))!=null&&a<=t)break;n=r}return n.to}const cln=Cnt.of((e,t,n)=>{for(let r=fs(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let a=r.type.prop(fat);if(a==null)continue;let s=lln(r,a);if(s>n)return{from:n,to:s}}return null});function vde(e){return new od(dat,e,[],"markdown")}const hat=vde(pat),uln=pat.configure([Wsn,Zsn,Gsn,Ysn,{props:[Qw.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),ew=vde(uln);function dln(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=Ve.matchLanguageName(e,n,!0),r instanceof Ve)return r.support?r.support.language.parser:Y0.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}class vU{constructor(t,n,r,a,s,i,o){this.node=t,this.from=n,this.to=r,this.spaceBefore=a,this.spaceAfter=s,this.type=i,this.item=o}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(+gat(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function mat(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,o=t.lineAt(s.from),c=s.from-o.from;if(s.name=="Blockquote"&&(i=/^ *>( ?)/.exec(o.text.slice(c))))r.push(new vU(s,c,c+i[0].length,"",i[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(o.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 vU(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(o.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 vU(s.parent,c,c+d,i[1],u,f,s))}}return r}function gat(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function yU(e,t,n,r=0){for(let a=-1,s=e;;){if(s.name=="ListItem"){let o=gat(s,t),c=+o[2];if(a>=0){if(c!=a+1)return;n.push({from:s.from+o[1].length,to:s.from+o[0].length,insert:String(a+2+r)})}a=c}let i=s.nextSibling;if(!i)break;s=i}}function yde(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(w_)!=" ")return e;let r=Pp(e,4,n),a="";for(let s=r;s>0;)s>=4?(a+=" ",s-=4):(a+=" ",s--);return a+e.slice(n)}const vat=(e={})=>({state:t,dispatch:n})=>{let r=fs(t),{doc:a}=t,s=null,i=t.changeByRange(o=>{if(!o.empty||!ew.isActiveAt(t,o.from,-1)&&!ew.isActiveAt(t,o.from,1))return s={range:o};let c=o.from,u=a.lineAt(c),d=mat(r.resolveInner(c,-1),a);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return s={range:o};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return s={range:o};let p=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&p){let b=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(b.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"&&yU(f.item,a,C,-2),O&&O.node.name=="OrderedList"&&yU(O.item,a,C),{range:nt.cursor(k+_.length),changes:C}}else{let O=k_e(d,t,u);return{range:nt.cursor(c+O.length+1),changes:{from:u.from,insert:O+t.lineBreak}}}}if(f.node.name=="Blockquote"&&p&&u.from){let b=a.lineAt(u.from-1),w=/>\s*$/.exec(b.text);if(w&&w.index==f.from){let O=t.changes([{from:b.from+w.index,to:b.to},{from:u.from+f.from,to:u.to}]);return{range:o.map(O),changes:O}}}let h=[];f.node.name=="OrderedList"&&yU(f.item,a,h);let m=f.item&&f.item.from<u.from,g="";if(!m||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=f.to)for(let b=0,w=d.length-1;b<=w;b++)g+=b==w&&!m?d[b].marker(a,1):d[b].blank(b<w?Pp(u.text,4,d[b+1].from)-g.length:null);let v=c;for(;v>u.from&&/\s/.test(u.text.charAt(v-u.from-1));)v--;return g=yde(g,t),fln(f.node,t.doc)&&(g=k_e(d,t,u)+t.lineBreak+g),h.push({from:v,to:c,insert:t.lineBreak+g}),{range:nt.cursor(v+g.length+1),changes:h}});return s?!1:(n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},yat=vat();function O_e(e){return e.name=="QuoteMark"||e.name=="ListMark"}function fln(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 k_e(e,t,n){let r="";for(let a=0,s=e.length-2;a<=s;a++)r+=e[a].blank(a<s?Pp(n.text,4,e[a+1].from)-r.length:null,a<s);return yde(r,t)}function pln(e,t){let n=e.resolveInner(t,-1),r=t;O_e(n)&&(r=n.from,n=n.parent);for(let a;a=n.childBefore(r);)if(O_e(a))r=a.from;else if(a.name=="OrderedList"||a.name=="BulletList")n=a.lastChild,r=n.to;else break;return n}const bat=({state:e,dispatch:t})=>{let n=fs(e),r=null,a=e.changeByRange(s=>{let i=s.from,{doc:o}=e;if(s.empty&&ew.isActiveAt(e,s.from)){let c=o.lineAt(i),u=mat(pln(n,i),o);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:nt.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 p=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let h=d.blank(Pp(c.text,4,d.to)-Pp(c.text,4,d.from));return p==c.from&&(h=yde(h,e)),{range:nt.cursor(p+h.length),changes:{from:p,to:c.from+d.to,insert:h}}}if(p<i)return{range:nt.cursor(p),changes:{from:p,to:i}}}}}return r={range:s}});return r?!1:(t(e.update(a,{scrollIntoView:!0,userEvent:"delete"})),!0)},xat=[{key:"Enter",run:yat},{key:"Backspace",run:bat}],wat=cat({matchClosingTags:!1});function bde(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:a}=hat,completeHTMLTags:s=!0,pasteURLAsLink:i=!0,htmlTagLanguage:o=wat}=e;if(!(a instanceof eF))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[o.support,cln],d;i&&u.push(Sat),n instanceof X0?(u.push(n.support),d=n.language):n&&(d=n);let f=t||d?dln(t,d):void 0;c.push(Lsn({codeParser:f,htmlParser:o.language.parser})),r&&u.push(Qp.high(x_.of(xat)));let p=vde(a.configure(c));return s&&u.push(p.data.of({autocomplete:hln})),new X0(p,u)}function hln(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let a=fs(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:mln(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let bU=null;function mln(){if(bU)return bU;let e=aat(new Zue(Mr.create({extensions:wat}),0,!0));return bU=e?e.options:[]}const gln=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Sat=gt.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),!ew.isActiveAt(t.state,r.from,1)))return!1;let s=fs(t.state),i=!1;return s.iterate({from:r.from,to:r.to,enter:o=>{(o.from>r.from||gln.test(o.name))&&(i=!0)},leave:o=>{o.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)}}),vln=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:hat,deleteMarkupBackward:bat,insertNewlineContinueMarkup:yat,insertNewlineContinueMarkupCommand:vat,markdown:bde,markdownKeymap:xat,markdownLanguage:ew,pasteURLAsLink:Sat},Symbol.toStringTag,{value:"Module"}));function pt(e){return new X0(Que.define(e))}function cy(e){return We(()=>import("./index-CurN84Qj.js"),__vite__mapDeps([4,2]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const Oat=[Ve.of({name:"C",extensions:["c","h","ino"],load(){return We(()=>import("./index-BI4gw25f.js"),__vite__mapDeps([5,2]),import.meta.url).then(e=>e.cpp())}}),Ve.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return We(()=>import("./index-BI4gw25f.js"),__vite__mapDeps([5,2]),import.meta.url).then(e=>e.cpp())}}),Ve.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return cy("Cassandra")}}),Ve.of({name:"CSS",extensions:["css"],load(){return We(()=>Promise.resolve().then(()=>hon),void 0,import.meta.url).then(e=>e.css())}}),Ve.of({name:"Go",extensions:["go"],load(){return We(()=>import("./index-tR0P1-D4.js"),__vite__mapDeps([6,2]),import.meta.url).then(e=>e.go())}}),Ve.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return We(()=>Promise.resolve().then(()=>iln),void 0,import.meta.url).then(e=>e.html())}}),Ve.of({name:"Java",extensions:["java"],load(){return We(()=>import("./index-BjoQBvyi.js"),__vite__mapDeps([7,2]),import.meta.url).then(e=>e.java())}}),Ve.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return We(()=>Promise.resolve().then(()=>FM),void 0,import.meta.url).then(e=>e.javascript())}}),Ve.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return We(()=>import("./index-BWT9_XUW.js"),__vite__mapDeps([8,2]),import.meta.url).then(e=>e.jinja())}}),Ve.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return We(()=>Promise.resolve().then(()=>jan),void 0,import.meta.url).then(e=>e.json())}}),Ve.of({name:"JSX",extensions:["jsx"],load(){return We(()=>Promise.resolve().then(()=>FM),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ve.of({name:"LESS",extensions:["less"],load(){return We(()=>import("./index-BlBHa2EF.js"),__vite__mapDeps([9,2]),import.meta.url).then(e=>e.less())}}),Ve.of({name:"Liquid",extensions:["liquid"],load(){return We(()=>import("./index-CGav4zeO.js"),__vite__mapDeps([10,2]),import.meta.url).then(e=>e.liquid())}}),Ve.of({name:"MariaDB SQL",load(){return cy("MariaSQL")}}),Ve.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return We(()=>Promise.resolve().then(()=>vln),void 0,import.meta.url).then(e=>e.markdown())}}),Ve.of({name:"MS SQL",load(){return cy("MSSQL")}}),Ve.of({name:"MySQL",load(){return cy("MySQL")}}),Ve.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return We(()=>import("./index-BPKEjyfb.js"),__vite__mapDeps([11,2]),import.meta.url).then(e=>e.php())}}),Ve.of({name:"PLSQL",extensions:["pls"],load(){return cy("PLSQL")}}),Ve.of({name:"PostgreSQL",load(){return cy("PostgreSQL")}}),Ve.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return We(()=>import("./index-BUBkwXfg.js"),__vite__mapDeps([12,2]),import.meta.url).then(e=>e.python())}}),Ve.of({name:"Rust",extensions:["rs"],load(){return We(()=>import("./index-BBMWNw5g.js"),__vite__mapDeps([13,2]),import.meta.url).then(e=>e.rust())}}),Ve.of({name:"Sass",extensions:["sass"],load(){return We(()=>import("./index-DwlzCg2q.js"),__vite__mapDeps([14,2]),import.meta.url).then(e=>e.sass({indented:!0}))}}),Ve.of({name:"SCSS",extensions:["scss"],load(){return We(()=>import("./index-DwlzCg2q.js"),__vite__mapDeps([14,2]),import.meta.url).then(e=>e.sass())}}),Ve.of({name:"SQL",extensions:["sql"],load(){return cy("StandardSQL")}}),Ve.of({name:"SQLite",load(){return cy("SQLite")}}),Ve.of({name:"TSX",extensions:["tsx"],load(){return We(()=>Promise.resolve().then(()=>FM),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ve.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return We(()=>Promise.resolve().then(()=>FM),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ve.of({name:"WebAssembly",extensions:["wat","wast"],load(){return We(()=>import("./index-Sw38Cezs.js"),__vite__mapDeps([15,2]),import.meta.url).then(e=>e.wast())}}),Ve.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return We(()=>import("./index-HJbhYvS9.js"),__vite__mapDeps([16,2]),import.meta.url).then(e=>e.xml())}}),Ve.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return We(()=>import("./index-Cy852hlX.js"),__vite__mapDeps([17,2]),import.meta.url).then(e=>e.yaml())}}),Ve.of({name:"APL",extensions:["dyalog","apl"],load(){return We(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>pt(e.apl))}}),Ve.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return We(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>pt(e.asciiArmor))}}),Ve.of({name:"ASN.1",extensions:["asn","asn1"],load(){return We(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>pt(e.asn1({})))}}),Ve.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return We(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>pt(e.asterisk))}}),Ve.of({name:"Brainfuck",extensions:["b","bf"],load(){return We(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>pt(e.brainfuck))}}),Ve.of({name:"Cobol",extensions:["cob","cpy"],load(){return We(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>pt(e.cobol))}}),Ve.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.csharp))}}),Ve.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return We(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ve.of({name:"ClojureScript",extensions:["cljs"],load(){return We(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ve.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return We(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>pt(e.gss))}}),Ve.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return We(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>pt(e.cmake))}}),Ve.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return We(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>pt(e.coffeeScript))}}),Ve.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return We(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>pt(e.commonLisp))}}),Ve.of({name:"Cypher",extensions:["cyp","cypher"],load(){return We(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>pt(e.cypher))}}),Ve.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return We(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>pt(e.cython))}}),Ve.of({name:"Crystal",extensions:["cr"],load(){return We(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>pt(e.crystal))}}),Ve.of({name:"D",extensions:["d"],load(){return We(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>pt(e.d))}}),Ve.of({name:"Dart",extensions:["dart"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.dart))}}),Ve.of({name:"diff",extensions:["diff","patch"],load(){return We(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>pt(e.diff))}}),Ve.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return We(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([18,19]),import.meta.url).then(e=>pt(e.dockerFile))}}),Ve.of({name:"DTD",extensions:["dtd"],load(){return We(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>pt(e.dtd))}}),Ve.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return We(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>pt(e.dylan))}}),Ve.of({name:"EBNF",load(){return We(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>pt(e.ebnf))}}),Ve.of({name:"ECL",extensions:["ecl"],load(){return We(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>pt(e.ecl))}}),Ve.of({name:"edn",extensions:["edn"],load(){return We(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ve.of({name:"Eiffel",extensions:["e"],load(){return We(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>pt(e.eiffel))}}),Ve.of({name:"Elm",extensions:["elm"],load(){return We(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>pt(e.elm))}}),Ve.of({name:"Erlang",extensions:["erl"],load(){return We(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>pt(e.erlang))}}),Ve.of({name:"Esper",load(){return We(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>pt(e.esper))}}),Ve.of({name:"Factor",extensions:["factor"],load(){return We(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([20,19]),import.meta.url).then(e=>pt(e.factor))}}),Ve.of({name:"FCL",load(){return We(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>pt(e.fcl))}}),Ve.of({name:"Forth",extensions:["forth","fth","4th"],load(){return We(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>pt(e.forth))}}),Ve.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return We(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>pt(e.fortran))}}),Ve.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return We(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.fSharp))}}),Ve.of({name:"Gas",extensions:["s"],load(){return We(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>pt(e.gas))}}),Ve.of({name:"Gherkin",extensions:["feature"],load(){return We(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>pt(e.gherkin))}}),Ve.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return We(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>pt(e.groovy))}}),Ve.of({name:"Haskell",extensions:["hs"],load(){return We(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>pt(e.haskell))}}),Ve.of({name:"Haxe",extensions:["hx"],load(){return We(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>pt(e.haxe))}}),Ve.of({name:"HXML",extensions:["hxml"],load(){return We(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>pt(e.hxml))}}),Ve.of({name:"HTTP",load(){return We(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>pt(e.http))}}),Ve.of({name:"IDL",extensions:["pro"],load(){return We(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>pt(e.idl))}}),Ve.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return We(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>pt(e.jsonld))}}),Ve.of({name:"Julia",extensions:["jl"],load(){return We(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>pt(e.julia))}}),Ve.of({name:"Kotlin",extensions:["kt","kts"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.kotlin))}}),Ve.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return We(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>pt(e.liveScript))}}),Ve.of({name:"Lua",extensions:["lua"],load(){return We(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>pt(e.lua))}}),Ve.of({name:"mIRC",extensions:["mrc"],load(){return We(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>pt(e.mirc))}}),Ve.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return We(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>pt(e.mathematica))}}),Ve.of({name:"Modelica",extensions:["mo"],load(){return We(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>pt(e.modelica))}}),Ve.of({name:"MUMPS",extensions:["mps"],load(){return We(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>pt(e.mumps))}}),Ve.of({name:"Mbox",extensions:["mbox"],load(){return We(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>pt(e.mbox))}}),Ve.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return We(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>pt(e.nginx))}}),Ve.of({name:"NSIS",extensions:["nsh","nsi"],load(){return We(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([21,19]),import.meta.url).then(e=>pt(e.nsis))}}),Ve.of({name:"NTriples",extensions:["nt","nq"],load(){return We(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>pt(e.ntriples))}}),Ve.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.objectiveC))}}),Ve.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.objectiveCpp))}}),Ve.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return We(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.oCaml))}}),Ve.of({name:"Octave",extensions:["m"],load(){return We(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>pt(e.octave))}}),Ve.of({name:"Oz",extensions:["oz"],load(){return We(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>pt(e.oz))}}),Ve.of({name:"Pascal",extensions:["p","pas"],load(){return We(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>pt(e.pascal))}}),Ve.of({name:"Perl",extensions:["pl","pm"],load(){return We(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>pt(e.perl))}}),Ve.of({name:"Pig",extensions:["pig"],load(){return We(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>pt(e.pig))}}),Ve.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return We(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>pt(e.powerShell))}}),Ve.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return We(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>pt(e.properties))}}),Ve.of({name:"ProtoBuf",extensions:["proto"],load(){return We(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>pt(e.protobuf))}}),Ve.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return We(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([22,23]),import.meta.url).then(e=>pt(e.pug))}}),Ve.of({name:"Puppet",extensions:["pp"],load(){return We(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>pt(e.puppet))}}),Ve.of({name:"Q",extensions:["q"],load(){return We(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>pt(e.q))}}),Ve.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return We(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>pt(e.r))}}),Ve.of({name:"RPM Changes",load(){return We(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>pt(e.rpmChanges))}}),Ve.of({name:"RPM Spec",extensions:["spec"],load(){return We(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>pt(e.rpmSpec))}}),Ve.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return We(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>pt(e.ruby))}}),Ve.of({name:"SAS",extensions:["sas"],load(){return We(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>pt(e.sas))}}),Ve.of({name:"Scala",extensions:["scala"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.scala))}}),Ve.of({name:"Scheme",extensions:["scm","ss"],load(){return We(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>pt(e.scheme))}}),Ve.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return We(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>pt(e.shell))}}),Ve.of({name:"Sieve",extensions:["siv","sieve"],load(){return We(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>pt(e.sieve))}}),Ve.of({name:"Smalltalk",extensions:["st"],load(){return We(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>pt(e.smalltalk))}}),Ve.of({name:"Solr",load(){return We(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>pt(e.solr))}}),Ve.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return We(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.sml))}}),Ve.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return We(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>pt(e.sparql))}}),Ve.of({name:"Spreadsheet",alias:["excel","formula"],load(){return We(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>pt(e.spreadsheet))}}),Ve.of({name:"Squirrel",extensions:["nut"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.squirrel))}}),Ve.of({name:"Stylus",extensions:["styl"],load(){return We(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>pt(e.stylus))}}),Ve.of({name:"Swift",extensions:["swift"],load(){return We(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>pt(e.swift))}}),Ve.of({name:"sTeX",load(){return We(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>pt(e.stex))}}),Ve.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return We(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>pt(e.stex))}}),Ve.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return We(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>pt(e.verilog))}}),Ve.of({name:"Tcl",extensions:["tcl"],load(){return We(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>pt(e.tcl))}}),Ve.of({name:"Textile",extensions:["textile"],load(){return We(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>pt(e.textile))}}),Ve.of({name:"TiddlyWiki",load(){return We(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>pt(e.tiddlyWiki))}}),Ve.of({name:"Tiki wiki",load(){return We(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>pt(e.tiki))}}),Ve.of({name:"TOML",extensions:["toml"],load(){return We(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>pt(e.toml))}}),Ve.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return We(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>pt(e.troff))}}),Ve.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return We(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>pt(e.ttcn))}}),Ve.of({name:"TTCN_CFG",extensions:["cfg"],load(){return We(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>pt(e.ttcnCfg))}}),Ve.of({name:"Turtle",extensions:["ttl"],load(){return We(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>pt(e.turtle))}}),Ve.of({name:"Web IDL",extensions:["webidl"],load(){return We(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>pt(e.webIDL))}}),Ve.of({name:"VB.NET",extensions:["vb"],load(){return We(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>pt(e.vb))}}),Ve.of({name:"VBScript",extensions:["vbs"],load(){return We(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>pt(e.vbScript))}}),Ve.of({name:"Velocity",extensions:["vtl"],load(){return We(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>pt(e.velocity))}}),Ve.of({name:"Verilog",extensions:["v"],load(){return We(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>pt(e.verilog))}}),Ve.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return We(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>pt(e.vhdl))}}),Ve.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return We(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>pt(e.xQuery))}}),Ve.of({name:"Yacas",extensions:["ys"],load(){return We(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>pt(e.yacas))}}),Ve.of({name:"Z80",extensions:["z80"],load(){return We(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>pt(e.z80))}}),Ve.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return We(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.mscgen))}}),Ve.of({name:"Xù",extensions:["xu"],load(){return We(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.xu))}}),Ve.of({name:"MsGenny",extensions:["msgenny"],load(){return We(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.msgenny))}}),Ve.of({name:"Vue",extensions:["vue"],load(){return We(()=>import("./index-CLNfOe98.js"),__vite__mapDeps([24,2]),import.meta.url).then(e=>e.vue())}}),Ve.of({name:"Angular Template",load(){return We(()=>import("./index-CsEGWMVv.js"),__vite__mapDeps([25,2]),import.meta.url).then(e=>e.angular())}})];var yln=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 o=gt.theme(a,{dark:t==="dark"}),c=Tm.define(r),u=[o,Ww(c)];return u},bln={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)"},xln=[{tag:ie.comment,color:"#6272a4"},{tag:ie.string,color:"#f1fa8c"},{tag:ie.atom,color:"#bd93f9"},{tag:ie.meta,color:"#f8f8f2"},{tag:[ie.keyword,ie.operator,ie.tagName],color:"#ff79c6"},{tag:[ie.function(ie.propertyName),ie.propertyName],color:"#66d9ef"},{tag:[ie.definition(ie.variableName),ie.function(ie.variableName),ie.className,ie.attributeName],color:"#50fa7b"},{tag:ie.atom,color:"#bd93f9"}],AI=e=>{var{theme:t="dark",settings:n={},styles:r=[]}=e||{};return yln({theme:t,settings:gb({},bln,n),styles:[...xln,...r]})};AI();const wln=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=wde(e.state,n.from);return r.line?Sln(e):r.block?kln(e):!1};function xde(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 Sln=xde(Cln,0),Oln=xde(kat,0),kln=xde((e,t)=>kat(e,t,Eln(t)),0);function wde(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const aC=50;function _ln(e,{open:t,close:n},r,a){let s=e.sliceDoc(r-aC,r),i=e.sliceDoc(a,a+aC),o=/\s*$/.exec(s)[0].length,c=/^\s*/.exec(i)[0].length,u=s.length-o;if(s.slice(u-t.length,u)==t&&i.slice(c,c+n.length)==n)return{open:{pos:r-o,margin:o&&1},close:{pos:a+c,margin:c&&1}};let d,f;a-r<=2*aC?d=f=e.sliceDoc(r,a):(d=e.sliceDoc(r,r+aC),f=e.sliceDoc(a-aC,a));let p=/^\s*/.exec(d)[0].length,h=/\s*$/.exec(f)[0].length,m=f.length-h-n.length;return d.slice(p,p+t.length)==t&&f.slice(m,m+n.length)==n?{open:{pos:r+p+t.length,margin:/\s/.test(d.charAt(p+t.length))?1:0},close:{pos:a-h-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function Eln(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 kat(e,t,n=t.selection.ranges){let r=n.map(s=>wde(t,s.from).block);if(!r.every(s=>s))return null;let a=n.map((s,i)=>_ln(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,o;i<a.length;i++)if(o=a[i]){let c=r[i],{open:u,close:d}=o;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 Cln(e,t,n=t.selection.ranges){let r=[],a=-1;for(let{from:s,to:i}of n){let o=r.length,c=1e9,u=wde(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 p=/^\s*/.exec(f.text)[0].length,h=p==f.length,m=f.text.slice(p,p+u.length)==u?p:-1;p<f.text.length&&p<c&&(c=p),r.push({line:f,comment:m,token:u,indent:p,empty:h,single:!1})}d=f.to+1}if(c<1e9)for(let d=o;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=c);r.length==o+1&&(r[o].single=!0)}}if(e!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:o,token:c,indent:u,empty:d,single:f}of r)(f||!d)&&s.push({from:o.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:o,token:c}of r)if(o>=0){let u=i.from+o,d=u+c.length;i.text[d-i.from]==" "&&d++,s.push({from:u,to:d})}return{changes:s}}return null}const Bne=Cm.define(),jln=Cm.define(),Tln=Yt.define(),_at=Yt.define({combine(e){return jm(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)})}}),Eat=ho.define({create(){return Gh.empty},update(e,t){let n=t.state.facet(_at),r=t.annotation(Bne);if(r){let c=cu.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=EL(d,d.length,n.minDepth,c):d=Tat(d,t.startState.selection),new Gh(u==0?r.rest:d,u==0?d:r.rest)}let a=t.annotation(jln);if((a=="full"||a=="before")&&(e=e.isolate()),t.annotation(so.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=cu.fromTransaction(t),i=t.annotation(so.time),o=t.annotation(so.userEvent);return s?e=e.addChanges(s,i,o,n,t):t.selection&&(e=e.addSelection(t.startState.selection,i,o,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 Gh(e.done.map(cu.fromJSON),e.undone.map(cu.fromJSON))}});function Nln(e={}){return[Eat,_at.of(e),gt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?Cat:t.inputType=="historyRedo"?Une:null;return r?(t.preventDefault(),r(n)):!1}})]}function tF(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let a=n.field(Eat,!1);if(!a)return!1;let s=a.pop(e,n,t);return s?(r(s),!0):!1}}const Cat=tF(0,!1),Une=tF(1,!1),Aln=tF(0,!0),Iln=tF(1,!0);class cu{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 cu(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 cu(t.changes&&to.fromJSON(t.changes),[],t.mapped&&tm.fromJSON(t.mapped),t.startSelection&&nt.fromJSON(t.startSelection),t.selectionsAfter.map(nt.fromJSON))}static fromTransaction(t,n){let r=yf;for(let a of t.startState.facet(Tln)){let s=a(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new cu(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,yf)}static selection(t){return new cu(void 0,yf,void 0,void 0,t)}}function EL(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 Rln(e,t){let n=[],r=!1;return e.iterChangedRanges((a,s)=>n.push(a,s)),t.iterChangedRanges((a,s,i,o)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];o>=u&&i<=d&&(r=!0)}}),r}function Pln(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function jat(e,t){return e.length?t.length?e.concat(t):e:t}const yf=[],Mln=200;function Tat(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Mln));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),EL(e,e.length-1,1e9,n.setSelAfter(r)))}else return[cu.selection([t])]}function Dln(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 xU(e,t){if(!e.length)return e;let n=e.length,r=yf;for(;n;){let a=$ln(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?[cu.selection(r)]:yf}function $ln(e,t,n){let r=jat(e.selectionsAfter.length?e.selectionsAfter.map(o=>o.map(t)):yf,n);if(!e.changes)return cu.selection(r);let a=e.changes.map(t),s=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(s):s;return new cu(a,Xn.mapEffects(e.effects,t),i,e.startSelection.map(s),r)}const Lln=/^(input\.type|delete)($|\.)/;class Gh{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 Gh(this.done,this.undone):this}addChanges(t,n,r,a,s){let i=this.done,o=i[i.length-1];return o&&o.changes&&!o.changes.empty&&t.changes&&(!r||Lln.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime<a.newGroupDelay&&a.joinToEvent(s,Rln(o.changes,t.changes))||r=="input.type.compose")?i=EL(i,i.length-1,a.minDepth,new cu(t.changes.compose(o.changes),jat(Xn.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,yf)):i=EL(i,i.length,a.minDepth,t),new Gh(i,yf,n,r)}addSelection(t,n,r,a){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:yf;return s.length>0&&n-this.prevTime<a&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Pln(s[s.length-1],t)?this:new Gh(Tat(this.done,t),this.undone,n,r)}addMapping(t){return new Gh(xU(this.done,t),xU(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:Bne.of({side:t,rest:Dln(a),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let o=a.length==1?yf:a.slice(0,a.length-1);return s.mapped&&(o=xU(o,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Bne.of({side:t,rest:o,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Gh.empty=new Gh(yf,yf);const Fln=[{key:"Mod-z",run:Cat,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Une,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Une,preventDefault:!0},{key:"Mod-u",run:Aln,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Iln,preventDefault:!0}];function O_(e,t){return nt.create(e.ranges.map(t),e.mainIndex)}function Wp(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Gp({state:e,dispatch:t},n){let r=O_(e.selection,n);return r.eq(e.selection,!0)?!1:(t(Wp(e,r)),!0)}function nF(e,t){return nt.cursor(t?e.to:e.from)}function Nat(e,t){return Gp(e,n=>n.empty?e.moveByChar(n,t):nF(n,t))}function Xl(e){return e.textDirectionAt(e.state.selection.main.head)==bs.LTR}const Aat=e=>Nat(e,!Xl(e)),Iat=e=>Nat(e,Xl(e));function Rat(e,t){return Gp(e,n=>n.empty?e.moveByGroup(n,t):nF(n,t))}const zln=e=>Rat(e,!Xl(e)),Bln=e=>Rat(e,Xl(e));function Uln(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 rF(e,t,n){let r=fs(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;Uln(e,u,a)?r=u:c=n?u.to:u.from}let s=r.type.prop(a),i,o;return s&&(i=n?Wh(e,r.from,1):Wh(e,r.to,-1))&&i.matched?o=n?i.end.to:i.end.from:o=n?r.to:r.from,nt.cursor(o,n?-1:1)}const qln=e=>Gp(e,t=>rF(e.state,t,!Xl(e))),Vln=e=>Gp(e,t=>rF(e.state,t,Xl(e)));function Pat(e,t){return Gp(e,n=>{if(!n.empty)return nF(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Mat=e=>Pat(e,!1),Dat=e=>Pat(e,!0);function $at(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,a;if(t){for(let s of e.state.facet(gt.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 Lat(e,t){let n=$at(e),{state:r}=e,a=O_(r.selection,i=>i.empty?e.moveVertically(i,t,n.height):nF(i,t));if(a.eq(r.selection))return!1;let s;if(n.selfScroll){let i=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),c=o.top+n.marginTop,u=o.bottom-n.marginBottom;i&&i.top>c&&i.bottom<u&&(s=gt.scrollIntoView(a.main.head,{y:"start",yMargin:i.top-c}))}return e.dispatch(Wp(r,a),{effects:s}),!0}const __e=e=>Lat(e,!1),qne=e=>Lat(e,!0);function Vb(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=nt.cursor(r.from+s))}return a}const Hln=e=>Gp(e,t=>Vb(e,t,!0)),Qln=e=>Gp(e,t=>Vb(e,t,!1)),Wln=e=>Gp(e,t=>Vb(e,t,!Xl(e))),Gln=e=>Gp(e,t=>Vb(e,t,Xl(e))),Zln=e=>Gp(e,t=>nt.cursor(e.lineBlockAt(t.head).from,1)),Yln=e=>Gp(e,t=>nt.cursor(e.lineBlockAt(t.head).to,-1));function Xln(e,t,n){let r=!1,a=O_(e.selection,s=>{let i=Wh(e,s.head,-1)||Wh(e,s.head,1)||s.head>0&&Wh(e,s.head-1,1)||s.head<e.doc.length&&Wh(e,s.head+1,-1);if(!i||!i.end)return s;r=!0;let o=i.start.from==s.head?i.end.to:i.end.from;return nt.cursor(o)});return r?(t(Wp(e,a)),!0):!1}const Kln=({state:e,dispatch:t})=>Xln(e,t);function Qf(e,t){let n=O_(e.state.selection,r=>{let a=t(r);return nt.range(r.anchor,a.head,a.goalColumn,a.bidiLevel||void 0)});return n.eq(e.state.selection)?!1:(e.dispatch(Wp(e.state,n)),!0)}function Fat(e,t){return Qf(e,n=>e.moveByChar(n,t))}const zat=e=>Fat(e,!Xl(e)),Bat=e=>Fat(e,Xl(e));function Uat(e,t){return Qf(e,n=>e.moveByGroup(n,t))}const Jln=e=>Uat(e,!Xl(e)),ecn=e=>Uat(e,Xl(e)),tcn=e=>Qf(e,t=>rF(e.state,t,!Xl(e))),ncn=e=>Qf(e,t=>rF(e.state,t,Xl(e)));function qat(e,t){return Qf(e,n=>e.moveVertically(n,t))}const Vat=e=>qat(e,!1),Hat=e=>qat(e,!0);function Qat(e,t){return Qf(e,n=>e.moveVertically(n,t,$at(e).height))}const E_e=e=>Qat(e,!1),C_e=e=>Qat(e,!0),rcn=e=>Qf(e,t=>Vb(e,t,!0)),acn=e=>Qf(e,t=>Vb(e,t,!1)),scn=e=>Qf(e,t=>Vb(e,t,!Xl(e))),icn=e=>Qf(e,t=>Vb(e,t,Xl(e))),ocn=e=>Qf(e,t=>nt.cursor(e.lineBlockAt(t.head).from)),lcn=e=>Qf(e,t=>nt.cursor(e.lineBlockAt(t.head).to)),j_e=({state:e,dispatch:t})=>(t(Wp(e,{anchor:0})),!0),T_e=({state:e,dispatch:t})=>(t(Wp(e,{anchor:e.doc.length})),!0),N_e=({state:e,dispatch:t})=>(t(Wp(e,{anchor:e.selection.main.anchor,head:0})),!0),A_e=({state:e,dispatch:t})=>(t(Wp(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ccn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),ucn=({state:e,dispatch:t})=>{let n=aF(e).map(({from:r,to:a})=>nt.range(r,Math.min(a+1,e.doc.length)));return t(e.update({selection:nt.create(n),userEvent:"select"})),!0},dcn=({state:e,dispatch:t})=>{let n=O_(e.selection,r=>{let a=fs(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:o}=i;if((o.from<r.from&&o.to>=r.to||o.to>r.to&&o.from<=r.from)&&i.next)return nt.range(o.to,o.from)}return r});return n.eq(e.selection)?!1:(t(Wp(e,n)),!0)};function Wat(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 o=s;;){let c=e.moveVertically(o,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==o.head)break;o=c}}}return a.length==r.ranges.length?!1:(e.dispatch(Wp(n,nt.create(a,a.length-1))),!0)}const fcn=e=>Wat(e,!1),pcn=e=>Wat(e,!0),hcn=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=nt.create([n.main]):n.main.empty||(r=nt.create([nt.cursor(n.main.head)])),r?(t(Wp(e,r)),!0):!1};function II(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,a=r.changeByRange(s=>{let{from:i,to:o}=s;if(i==o){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),o=Math.max(o,c)}else i=zM(e,i,!1),o=zM(e,o,!0);return i==o?{range:s}:{changes:{from:i,to:o},range:nt.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"?gt.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function zM(e,t,n){if(e instanceof gt)for(let r of e.state.facet(gt.atomicRanges).map(a=>a(e)))r.between(t,t,(a,s)=>{a<t&&s>t&&(t=n?s:a)});return t}const Gat=(e,t,n)=>II(e,r=>{let a=r.from,{state:s}=e,i=s.doc.lineAt(a),o,c;if(n&&!t&&a>i.from&&a<i.from+200&&!/[^ \t]/.test(o=i.text.slice(0,a-i.from))){if(o[o.length-1]==" ")return a-1;let u=Pp(o,s.tabSize),d=u%K0(s)||K0(s);for(let f=0;f<d&&o[o.length-1-f]==" ";f++)a--;c=a}else c=Qo(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=Qo(i.text,c-i.from,!1,!1)+i.from);return c}),Vne=e=>Gat(e,!1,!0),Zat=e=>Gat(e,!0,!1),Yat=(e,t)=>II(e,n=>{let r=n.head,{state:a}=e,s=a.doc.lineAt(r),i=a.charCategorizer(r);for(let o=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=Qo(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(o!=null&&d!=o)break;(u!=" "||r!=n.head)&&(o=d),r=c}return r}),Xat=e=>Yat(e,!1),mcn=e=>Yat(e,!0),gcn=e=>II(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),vcn=e=>II(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),ycn=e=>II(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),bcn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:_a.of(["",""])},range:nt.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},xcn=({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:Qo(s.text,a-s.from,!1)+s.from,o=a==s.to?a+1:Qo(s.text,a-s.from,!0)+s.from;return{changes:{from:i,to:o,insert:e.doc.slice(a,o).append(e.doc.slice(i,a))},range:nt.cursor(o)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function aF(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 Kat(e,t,n){if(e.readOnly)return!1;let r=[],a=[];for(let s of aF(e)){if(n?s.to==e.doc.length:s.from==0)continue;let i=e.doc.lineAt(n?s.to+1:s.from-1),o=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(nt.range(Math.min(e.doc.length,c.anchor+o),Math.min(e.doc.length,c.head+o)))}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(nt.range(c.anchor-o,c.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:nt.create(a,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const wcn=({state:e,dispatch:t})=>Kat(e,t,!1),Scn=({state:e,dispatch:t})=>Kat(e,t,!0);function Jat(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of aF(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 Ocn=({state:e,dispatch:t})=>Jat(e,t,!1),kcn=({state:e,dispatch:t})=>Jat(e,t,!0),_cn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(aF(t).map(({from:a,to:s})=>(a>0?a--:s<t.doc.length&&s++,{from:a,to:s}))),r=O_(t.selection,a=>{let s;if(e.lineWrapping){let i=e.lineBlockAt(a.head),o=e.coordsAtPos(a.head,a.assoc||1);o&&(s=i.bottom+e.documentTop-o.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 Ecn(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=fs(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 I_e=est(!1),Ccn=est(!0);function est(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(a=>{let{from:s,to:i}=a,o=t.doc.lineAt(s),c=!e&&s==i&&Ecn(t,s);e&&(s=i=(i<=o.to?o:t.doc.lineAt(i)).to);let u=new Y6(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=que(u,s);for(d==null&&(d=Pp(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;c?{from:s,to:i}=c:s>o.from&&s<o.from+100&&!/\S/.test(o.text.slice(0,s))&&(s=o.from);let f=["",dN(t,d)];return c&&f.push(dN(t,u.lineIndent(o.from,-1))),{changes:{from:s,to:i,insert:_a.of(f)},range:nt.cursor(s+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Sde(e,t){let n=-1;return e.changeByRange(r=>{let a=[];for(let i=r.from;i<=r.to;){let o=e.doc.lineAt(i);o.number>n&&(r.empty||r.to>o.from)&&(t(o,a,r),n=o.number),i=o.to+1}let s=e.changes(a);return{changes:a,range:nt.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const jcn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Y6(e,{overrideIndentation:s=>{let i=n[s];return i??-1}}),a=Sde(e,(s,i,o)=>{let c=que(r,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=dN(e,c);(u!=d||o.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},tst=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Sde(e,(n,r)=>{r.push({from:n.from,insert:e.facet(w_)})}),{userEvent:"input.indent"})),!0),nst=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Sde(e,(n,r)=>{let a=/^\s*/.exec(n.text)[0];if(!a)return;let s=Pp(a,e.tabSize),i=0,o=dN(e,Math.max(0,s-K0(e)));for(;i<a.length&&i<o.length&&a.charCodeAt(i)==o.charCodeAt(i);)i++;r.push({from:n.from+i,to:n.from+a.length,insert:o.slice(i)})}),{userEvent:"delete.dedent"})),!0),Tcn=e=>(e.setTabFocusMode(),!0),Ncn=[{key:"Ctrl-b",run:Aat,shift:zat,preventDefault:!0},{key:"Ctrl-f",run:Iat,shift:Bat},{key:"Ctrl-p",run:Mat,shift:Vat},{key:"Ctrl-n",run:Dat,shift:Hat},{key:"Ctrl-a",run:Zln,shift:ocn},{key:"Ctrl-e",run:Yln,shift:lcn},{key:"Ctrl-d",run:Zat},{key:"Ctrl-h",run:Vne},{key:"Ctrl-k",run:gcn},{key:"Ctrl-Alt-h",run:Xat},{key:"Ctrl-o",run:bcn},{key:"Ctrl-t",run:xcn},{key:"Ctrl-v",run:qne}],Acn=[{key:"ArrowLeft",run:Aat,shift:zat,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:zln,shift:Jln,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Wln,shift:scn,preventDefault:!0},{key:"ArrowRight",run:Iat,shift:Bat,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Bln,shift:ecn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Gln,shift:icn,preventDefault:!0},{key:"ArrowUp",run:Mat,shift:Vat,preventDefault:!0},{mac:"Cmd-ArrowUp",run:j_e,shift:N_e},{mac:"Ctrl-ArrowUp",run:__e,shift:E_e},{key:"ArrowDown",run:Dat,shift:Hat,preventDefault:!0},{mac:"Cmd-ArrowDown",run:T_e,shift:A_e},{mac:"Ctrl-ArrowDown",run:qne,shift:C_e},{key:"PageUp",run:__e,shift:E_e},{key:"PageDown",run:qne,shift:C_e},{key:"Home",run:Qln,shift:acn,preventDefault:!0},{key:"Mod-Home",run:j_e,shift:N_e},{key:"End",run:Hln,shift:rcn,preventDefault:!0},{key:"Mod-End",run:T_e,shift:A_e},{key:"Enter",run:I_e,shift:I_e},{key:"Mod-a",run:ccn},{key:"Backspace",run:Vne,shift:Vne,preventDefault:!0},{key:"Delete",run:Zat,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Xat,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:mcn,preventDefault:!0},{mac:"Mod-Backspace",run:vcn,preventDefault:!0},{mac:"Mod-Delete",run:ycn,preventDefault:!0}].concat(Ncn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Icn=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:qln,shift:tcn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Vln,shift:ncn},{key:"Alt-ArrowUp",run:wcn},{key:"Shift-Alt-ArrowUp",run:Ocn},{key:"Alt-ArrowDown",run:Scn},{key:"Shift-Alt-ArrowDown",run:kcn},{key:"Mod-Alt-ArrowUp",run:fcn},{key:"Mod-Alt-ArrowDown",run:pcn},{key:"Escape",run:hcn},{key:"Mod-Enter",run:Ccn},{key:"Alt-l",mac:"Ctrl-l",run:ucn},{key:"Mod-i",run:dcn,preventDefault:!0},{key:"Mod-[",run:nst},{key:"Mod-]",run:tst},{key:"Mod-Alt-\\",run:jcn},{key:"Shift-Mod-k",run:_cn},{key:"Shift-Mod-\\",run:Kln},{key:"Mod-/",run:wln},{key:"Alt-A",run:Oln},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Tcn}].concat(Acn),Rcn={key:"Tab",run:tst,shift:nst},R_e=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class mk{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?o=>s(R_e(o)):R_e,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 Jc(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=_ue(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=Ph(t);let a=this.normalize(n);if(a.length)for(let s=0,i=r;;s++){let o=a.charCodeAt(s),c=this.match(o,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)==o&&i++}}}match(t,n,r){let a=null;for(let s=0;s<this.matches.length;s+=2){let i=this.matches[s],o=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?a={from:this.matches[s+1],to:r}:(this.matches[s]++,o=!0)),o||(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"&&(mk.prototype[Symbol.iterator]=function(){return this});const rst={from:-1,to:-1,match:/.*/.exec("")},Ode="gm"+(/x/.unicode==null?"":"u");class ast{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 sst(t,n,r,a,s);this.re=new RegExp(n,Ode+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=t.iter();let i=t.lineAt(a);this.curLineStart=i.from,this.matchPos=CL(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=CL(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 wU=new WeakMap;class gO{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let a=wU.get(t);if(!a||a.from>=r||a.to<=n){let o=new gO(n,t.sliceString(n,r));return wU.set(t,o),o}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)),wU.set(t,new gO(i,s)),new gO(n,s.slice(n-i,r-i))}}class sst{constructor(t,n,r,a,s){this.text=t,this.to=s,this.done=!1,this.value=rst,this.matchPos=CL(t,a),this.re=new RegExp(n,Ode+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=gO.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=CL(this.text,a+(r==a?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=gO.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(ast.prototype[Symbol.iterator]=sst.prototype[Symbol.iterator]=function(){return this});function Pcn(e){try{return new RegExp(e,Ode),!0}catch{return!1}}function CL(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 Hne(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),n=vs("input",{class:"cm-textfield",name:"line",value:t}),r=vs("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),e.dispatch({effects:Wj.of(!1)}),e.focus()):s.keyCode==13&&(s.preventDefault(),a())},onsubmit:s=>{s.preventDefault(),a()}},vs("label",e.state.phrase("Go to line"),": ",n)," ",vs("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),vs("button",{name:"close",onclick:()=>{e.dispatch({effects:Wj.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,o=i.doc.lineAt(i.selection.main.head),[,c,u,d,f]=s,p=d?+d.slice(1):0,h=u?+u:o.number;if(u&&f){let v=h/100;c&&(v=v*(c=="-"?-1:1)+o.number/i.doc.lines),h=Math.round(i.doc.lines*v)}else u&&c&&(h=h*(c=="-"?-1:1)+o.number);let m=i.doc.line(Math.max(1,Math.min(i.doc.lines,h))),g=nt.cursor(m.from+Math.max(0,Math.min(p,m.length)));e.dispatch({effects:[Wj.of(!1),gt.scrollIntoView(g.from,{y:"center"})],selection:g}),e.focus()}return{dom:r}}const Wj=Xn.define(),P_e=ho.define({create(){return!0},update(e,t){for(let n of t.effects)n.is(Wj)&&(e=n.value);return e},provide:e=>uN.from(e,t=>t?Hne:null)}),Mcn=e=>{let t=cN(e,Hne);if(!t){let n=[Wj.of(!0)];e.state.field(P_e,!1)==null&&n.push(Xn.appendConfig.of([P_e,Dcn])),e.dispatch({effects:n}),t=cN(e,Hne)}return t&&t.dom.querySelector("input").select(),!0},Dcn=gt.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"}}}),$cn={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Lcn=Yt.define({combine(e){return jm(e,$cn,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Fcn(e){return[Vcn,qcn]}const zcn=nn.mark({class:"cm-selectionMatch"}),Bcn=nn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function M_e(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 Ucn(e,t,n,r){return e(t.sliceDoc(n,n+1))==ri.Word&&e(t.sliceDoc(r-1,r))==ri.Word}const qcn=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(Lcn),{state:n}=e,r=n.selection;if(r.ranges.length>1)return nn.none;let a=r.main,s,i=null;if(a.empty){if(!t.highlightWordAroundCursor)return nn.none;let c=n.wordAt(a.head);if(!c)return nn.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 nn.none;if(t.wholeWords){if(s=n.sliceDoc(a.from,a.to),i=n.charCategorizer(a.head),!(M_e(i,n,a.from,a.to)&&Ucn(i,n,a.from,a.to)))return nn.none}else if(s=n.sliceDoc(a.from,a.to),!s)return nn.none}let o=[];for(let c of e.visibleRanges){let u=new mk(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||M_e(i,n,d,f))&&(a.empty&&d<=a.from&&f>=a.to?o.push(Bcn.range(d,f)):(d>=a.to||f<=a.from)&&o.push(zcn.range(d,f)),o.length>t.maxMatches))return nn.none}}return nn.set(o)}},{decorations:e=>e.decorations}),Vcn=gt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Hcn=({state:e,dispatch:t})=>{let{selection:n}=e,r=nt.create(n.ranges.map(a=>e.wordAt(a.head)||nt.cursor(a.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function Qcn(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,o=new mk(e.doc,t,r[r.length-1].to);;)if(o.next(),o.done){if(i)return null;o=new mk(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),i=!0}else{if(i&&r.some(c=>c.from==o.value.from))continue;if(s){let c=e.wordAt(o.value.from);if(!c||c.from!=o.value.from||c.to!=o.value.to)continue}return o.value}}const Wcn=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return Hcn({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=Qcn(e,r);return a?(t(e.update({selection:e.selection.addRange(nt.range(a.from,a.to),!1),effects:gt.scrollIntoView(a.to)})),!0):!1},k_=Yt.define({combine(e){return jm(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new sun(t),scrollToMatch:t=>gt.scrollIntoView(t)})}});class ist{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||Pcn(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"}),Gc('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Gc('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Vrt=dde.concat([Gc("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Gc("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Gc("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),v_e=new Wet,Hrt=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function nC(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const Qon=["FunctionDeclaration"],Won={FunctionDeclaration:nC("function"),ClassDeclaration:nC("class"),ClassExpression:()=>!0,EnumDeclaration:nC("constant"),TypeAliasDeclaration:nC("type"),NamespaceDeclaration:nC("namespace"),VariableDefinition(e,t){e.matchContext(Qon)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function Qrt(e,t){let n=v_e.get(t);if(n)return n;let r=[],a=!0;function s(i,o){let c=e.sliceString(i.from,i.to);r.push({label:c,type:o})}return t.cursor($a.IncludeAnonymous).iterate(i=>{if(a)a=!1;else if(i.name){let o=Won[i.name];if(o&&o(i,s)||Hrt.has(i.name))return!1}else if(i.to-i.from>8192){for(let o of Qrt(e,i.node))r.push(o);return!1}}),v_e.set(t,r),r}const kL=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,fde=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Wrt(e){let t=fs(e.state).resolveInner(e.pos,-1);if(fde.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&kL.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let a=t;a;a=a.parent)Hrt.has(a.name)&&(r=r.concat(Qrt(e.state.doc,a)));return{options:r,from:n?t.from:e.pos,validFor:kL}}function pU(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 Grt(e){let t=r=>e.state.doc.sliceString(r.from,r.to),n=fs(e.state).resolveInner(e.pos,-1);return n.name=="PropertyName"?pU(t,n.parent,t(n)):(n.name=="."||n.name=="?.")&&n.parent.name=="MemberExpression"?pU(t,n.parent,""):fde.indexOf(n.name)>-1?null:n.name=="VariableName"||n.to-n.from<20&&kL.test(t(n))?{path:[],name:t(n)}:n.name=="MemberExpression"?pU(t,n,""):e.explicit?{path:[],name:""}:null}function Gon(e,t){let n=e,r=[],a=new Set;for(let s=0;;s++){for(let o of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(o)||a.has(o))continue;a.add(o);let c;try{c=n[o]}catch{continue}r.push({label:o,type:typeof c=="function"?/^[A-Z]/.test(o)?"class":t?"function":"method":t?"variable":"property",boost:-s})}let i=Object.getPrototypeOf(e);if(!i)return r;e=i}}function Zon(e){let t=new Map;return n=>{let r=Grt(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=Gon(a,!r.path.length)),{from:n.pos-r.name.length,options:s,validFor:kL}}}const Cf=Z0.define({name:"javascript",parser:Hon.configure({props:[Hw.add({IfStatement:hO({except:/^\s*({|else\b)/}),TryStatement:hO({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Hrn,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:Vrn({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":hO({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}}),Qw.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Hue,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:"$"}}),Zrt={test:e=>/^JSX/.test(e.name),facet:Z6({commentTokens:{block:{open:"{/*",close:"*/}"}}})},pde=Cf.configure({dialect:"ts"},"typescript"),hde=Cf.configure({dialect:"jsx",props:[Uue.add(e=>e.isTop?[Zrt]:void 0)]}),mde=Cf.configure({dialect:"jsx ts",props:[Uue.add(e=>e.isTop?[Zrt]:void 0)]},"typescript");let Yrt=e=>({label:e,type:"keyword"});const Xrt="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(Yrt),Yon=Xrt.concat(["declare","implements","private","protected","public"].map(Yrt));function _L(e={}){let t=e.jsx?e.typescript?mde:hde:e.typescript?pde:Cf,n=e.typescript?Vrt.concat(Yon):dde.concat(Xrt);return new X0(t,[Cf.data.of({autocomplete:Nan(fde,Qnt(n))}),Cf.data.of({autocomplete:Wrt}),e.jsx?Krt:[]])}function Xon(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 y_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 Kon=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Krt=gt.inputHandler.of((e,t,n,r,a)=>{if((Kon?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Cf.isActiveAt(e.state,t,-1))return!1;let s=a(),{state:i}=s,o=i.changeByRange(c=>{var u;let{head:d}=c,f=fs(i).resolveInner(d-1,-1),p;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 h=f.parent,m=h.parent;if(m&&h.from==d-2&&((p=y_e(i.doc,m.firstChild,d))||((u=m.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${p}>`;return{range:nt.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(r==">"){let h=Xon(f);if(h&&h.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(i.doc.sliceString(d,d+2))&&(p=y_e(i.doc,h,d)))return{range:c,changes:{from:d,insert:`</${p}>`}}}}return{range:c}});return o.changes.empty?!1:(e.dispatch([s,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});function Jon(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 Cf.findRegions(r)){let o=r.doc.lineAt(s),c={line:o.number-1,col:s-o.from,pos:s};for(let u of e.verify(r.sliceDoc(s,i),t))a.push(eln(u,r.doc,c))}return a}}function b_e(e,t,n,r){return n.line(e+r.line).from+t+(e==1?r.col-1:-1)}function eln(e,t,n){let r=b_e(e.line,e.column,t,n),a={from:r,to:e.endLine!=null&&e.endColumn!=1?b_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,o=s[0]+n.pos-r,c=s[1]+n.pos-r;a.actions=[{name:"fix",apply(u,d){u.dispatch({changes:{from:d+o,to:d+c,insert:i},scrollIntoView:!0})}}]}return a}const FM=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:Krt,completionPath:Grt,esLint:Jon,javascript:_L,javascriptLanguage:Cf,jsxLanguage:hde,localCompletionSource:Wrt,scopeCompletionSource:Zon,snippets:dde,tsxLanguage:mde,typescriptLanguage:pde,typescriptSnippets:Vrt},Symbol.toStringTag,{value:"Module"})),rC=["_blank","_self","_top","_parent"],hU=["ascii","utf-8","utf-16","latin1","latin1"],mU=["get","post","put","delete"],gU=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],qu=["true","false"],Cn={},tln={a:{attrs:{href:null,ping:null,type:null,media:null,target:rC,hreflang:null}},abbr:Cn,address:Cn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Cn,aside:Cn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Cn,base:{attrs:{href:null,target:rC}},bdi:Cn,bdo:Cn,blockquote:{attrs:{cite:null}},body:Cn,br:Cn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:gU,formmethod:mU,formnovalidate:["novalidate"],formtarget:rC,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Cn,center:Cn,cite:Cn,code:Cn,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:Cn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Cn,div:Cn,dl:Cn,dt:Cn,em:Cn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Cn,figure:Cn,footer:Cn,form:{attrs:{action:null,name:null,"accept-charset":hU,autocomplete:["on","off"],enctype:gU,method:mU,novalidate:["novalidate"],target:rC}},h1:Cn,h2:Cn,h3:Cn,h4:Cn,h5:Cn,h6:Cn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Cn,hgroup:Cn,hr:Cn,html:{attrs:{manifest:null}},i:Cn,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:gU,formmethod:mU,formnovalidate:["novalidate"],formtarget:rC,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:Cn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Cn,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:Cn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:hU,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:Cn,noscript:Cn,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:Cn,param:{attrs:{name:null,value:null}},pre:Cn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Cn,rt:Cn,ruby:Cn,samp:Cn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:hU}},section:Cn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Cn,source:{attrs:{src:null,type:null,media:null}},span:Cn,strong:Cn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Cn,summary:Cn,sup:Cn,table:Cn,tbody:Cn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Cn,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:Cn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Cn,time:{attrs:{datetime:null}},title:Cn,tr:Cn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Cn,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:Cn},Jrt={accesskey:null,class:null,contenteditable:qu,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:qu,autocorrect:qu,autocapitalize:qu,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":qu,"aria-autocomplete":["inline","list","both","none"],"aria-busy":qu,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":qu,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":qu,"aria-hidden":qu,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":qu,"aria-multiselectable":qu,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":qu,"aria-relevant":null,"aria-required":qu,"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},eat="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 eat)Jrt[e]=null;let xN=class{constructor(t,n){this.tags={...tln,...t},this.globalAttrs={...Jrt,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};xN.default=new xN;function pk(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 hk(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function tat(e,t,n){let r=n.tags[pk(e,hk(t))];return r?.children||n.allTags}function gde(e,t){let n=[];for(let r=hk(t);r&&!r.type.isTop;r=hk(r.parent)){let a=pk(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 nat=/^[:\-\.\w\u00b7-\uffff]*$/;function x_e(e,t,n,r,a){let s=/\s*>/.test(e.sliceDoc(a,a+5))?"":">",i=hk(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:a,options:tat(e.doc,i,t).map(o=>({label:o,type:"type"})).concat(gde(e.doc,n).map((o,c)=>({label:"/"+o,apply:"/"+o+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function w_e(e,t,n,r){let a=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:gde(e.doc,t).map((s,i)=>({label:s,apply:s+a,type:"type",boost:99-i})),validFor:nat}}function nln(e,t,n,r){let a=[],s=0;for(let i of tat(e.doc,n,t))a.push({label:"<"+i,type:"type"});for(let i of gde(e.doc,n))a.push({label:"</"+i+">",type:"type",boost:99-s++});return{from:r,to:r,options:a,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function rln(e,t,n,r,a){let s=hk(n),i=s?t.tags[pk(e.doc,s)]:null,o=i&&i.attrs?Object.keys(i.attrs):[],c=i&&i.globalAttrs===!1?o:o.length?o.concat(t.globalAttrNames):t.globalAttrNames;return{from:r,to:a,options:c.map(u=>({label:u,type:"property"})),validFor:nat}}function aln(e,t,n,r,a){var s;let i=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),o=[],c;if(i){let u=e.sliceDoc(i.from,i.to),d=t.globalAttrs[u];if(!d){let f=hk(n),p=f?t.tags[pk(e.doc,f)]:null;d=p?.attrs&&p.attrs[u]}if(d){let f=e.sliceDoc(r,a).toLowerCase(),p='"',h='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,p="",h=e.sliceDoc(a,a+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let m of d)o.push({label:m,apply:p+m+h,type:"constant"})}}return{from:r,to:a,options:o,validFor:c}}function rat(e,t){let{state:n,pos:r}=t,a=fs(n).resolveInner(r,-1),s=a.resolve(r);for(let i=r,o;s==a&&(o=a.childBefore(i));){let c=o.lastChild;if(!c||!c.type.isError||c.from<c.to)break;s=a=o,i=c.from}return a.name=="TagName"?a.parent&&/CloseTag$/.test(a.parent.name)?w_e(n,a,a.from,r):x_e(n,e,a,a.from,r):a.name=="StartTag"||a.name=="IncompleteTag"?x_e(n,e,a,r,r):a.name=="StartCloseTag"||a.name=="IncompleteCloseTag"?w_e(n,a,r,r):a.name=="OpenTag"||a.name=="SelfClosingTag"||a.name=="AttributeName"?rln(n,e,a,a.name=="AttributeName"?a.from:r,r):a.name=="Is"||a.name=="AttributeValue"||a.name=="UnquotedAttributeValue"?aln(n,e,a,a.name=="Is"?r:a.from,r):t.explicit&&(s.name=="Element"||s.name=="Text"||s.name=="Document")?nln(n,e,a,r):null}function aat(e){return rat(xN.default,e)}function sat(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new xN(t,n):xN.default;return a=>rat(r,a)}const sln=Cf.parser.configure({top:"SingleExpression"}),iat=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:pde.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:hde.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:mde.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:sln},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Cf.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:bN.parser}],oat=[{name:"style",parser:bN.parser.configure({top:"Styles"})}].concat(eat.map(e=>({name:e,parser:Cf.parser}))),lat=Z0.define({name:"html",parser:Pin.configure({props:[Hw.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}}),Qw.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}}}),Fnt.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Qj=lat.configure({wrap:Prt(iat,oat)});function cat(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=Prt((e.nestedLanguages||[]).concat(iat),(e.nestedAttributes||[]).concat(oat)));let r=n?lat.configure({wrap:n,dialect:t}):t?Qj.configure({dialect:t}):Qj;return new X0(r,[Qj.data.of({autocomplete:sat(e)}),e.autoCloseTags!==!1?uat:[],_L().support,Urt().support])}const S_e=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),uat=gt.inputHandler.of((e,t,n,r,a)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Qj.isActiveAt(e.state,t,-1))return!1;let s=a(),{state:i}=s,o=i.changeByRange(c=>{var u,d,f;let p=i.doc.sliceString(c.from-1,c.to)==r,{head:h}=c,m=fs(i).resolveInner(h,-1),g;if(p&&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=pk(i.doc,v.parent,h))&&!S_e.has(g)){let b=h+(i.doc.sliceString(h,h+1)===">"?1:0),w=`</${g}>`;return{range:c,changes:{from:h,to:b,insert:w}}}}else if(p&&r=="/"&&m.name=="IncompleteCloseTag"){let v=m.parent;if(m.from==h-2&&((f=v.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=pk(i.doc,v,h))&&!S_e.has(g)){let b=h+(i.doc.sliceString(h,h+1)===">"?1:0),w=`${g}>`;return{range:nt.cursor(h+w.length,-1),changes:{from:h,to:b,insert:w}}}}return{range:c}});return o.changes.empty?!1:(e.dispatch([s,i.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),iln=Object.freeze(Object.defineProperty({__proto__:null,autoCloseTags:uat,html:cat,htmlCompletionSource:aat,htmlCompletionSourceWith:sat,htmlLanguage:Qj},Symbol.toStringTag,{value:"Module"})),dat=Z6({commentTokens:{block:{open:"<!--",close:"-->"}}}),fat=new lr,pat=Dsn.configure({props:[Qw.add(e=>!e.is("Block")||e.is("Document")||zne(e)!=null||oln(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),fat.add(zne),Hw.add({Document:()=>null}),Ly.add({Document:dat})]});function zne(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function oln(e){return e.name=="OrderedList"||e.name=="BulletList"}function lln(e,t){let n=e;for(;;){let r=n.nextSibling,a;if(!r||(a=zne(r.type))!=null&&a<=t)break;n=r}return n.to}const cln=Cnt.of((e,t,n)=>{for(let r=fs(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let a=r.type.prop(fat);if(a==null)continue;let s=lln(r,a);if(s>n)return{from:n,to:s}}return null});function vde(e){return new od(dat,e,[],"markdown")}const hat=vde(pat),uln=pat.configure([Wsn,Zsn,Gsn,Ysn,{props:[Qw.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),ew=vde(uln);function dln(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=Ve.matchLanguageName(e,n,!0),r instanceof Ve)return r.support?r.support.language.parser:Y0.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}class vU{constructor(t,n,r,a,s,i,o){this.node=t,this.from=n,this.to=r,this.spaceBefore=a,this.spaceAfter=s,this.type=i,this.item=o}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(+gat(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}}function mat(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,o=t.lineAt(s.from),c=s.from-o.from;if(s.name=="Blockquote"&&(i=/^ *>( ?)/.exec(o.text.slice(c))))r.push(new vU(s,c,c+i[0].length,"",i[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(i=/^( *)\d+([.)])( *)/.exec(o.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 vU(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(o.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 vU(s.parent,c,c+d,i[1],u,f,s))}}return r}function gat(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function yU(e,t,n,r=0){for(let a=-1,s=e;;){if(s.name=="ListItem"){let o=gat(s,t),c=+o[2];if(a>=0){if(c!=a+1)return;n.push({from:s.from+o[1].length,to:s.from+o[0].length,insert:String(a+2+r)})}a=c}let i=s.nextSibling;if(!i)break;s=i}}function yde(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(w_)!=" ")return e;let r=Pp(e,4,n),a="";for(let s=r;s>0;)s>=4?(a+=" ",s-=4):(a+=" ",s--);return a+e.slice(n)}const vat=(e={})=>({state:t,dispatch:n})=>{let r=fs(t),{doc:a}=t,s=null,i=t.changeByRange(o=>{if(!o.empty||!ew.isActiveAt(t,o.from,-1)&&!ew.isActiveAt(t,o.from,1))return s={range:o};let c=o.from,u=a.lineAt(c),d=mat(r.resolveInner(c,-1),a);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return s={range:o};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return s={range:o};let p=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&p){let b=f.node.firstChild,w=f.node.getChild("ListItem","ListItem");if(b.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"&&yU(f.item,a,C,-2),O&&O.node.name=="OrderedList"&&yU(O.item,a,C),{range:nt.cursor(k+_.length),changes:C}}else{let O=k_e(d,t,u);return{range:nt.cursor(c+O.length+1),changes:{from:u.from,insert:O+t.lineBreak}}}}if(f.node.name=="Blockquote"&&p&&u.from){let b=a.lineAt(u.from-1),w=/>\s*$/.exec(b.text);if(w&&w.index==f.from){let O=t.changes([{from:b.from+w.index,to:b.to},{from:u.from+f.from,to:u.to}]);return{range:o.map(O),changes:O}}}let h=[];f.node.name=="OrderedList"&&yU(f.item,a,h);let m=f.item&&f.item.from<u.from,g="";if(!m||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=f.to)for(let b=0,w=d.length-1;b<=w;b++)g+=b==w&&!m?d[b].marker(a,1):d[b].blank(b<w?Pp(u.text,4,d[b+1].from)-g.length:null);let v=c;for(;v>u.from&&/\s/.test(u.text.charAt(v-u.from-1));)v--;return g=yde(g,t),fln(f.node,t.doc)&&(g=k_e(d,t,u)+t.lineBreak+g),h.push({from:v,to:c,insert:t.lineBreak+g}),{range:nt.cursor(v+g.length+1),changes:h}});return s?!1:(n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0)},yat=vat();function O_e(e){return e.name=="QuoteMark"||e.name=="ListMark"}function fln(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 k_e(e,t,n){let r="";for(let a=0,s=e.length-2;a<=s;a++)r+=e[a].blank(a<s?Pp(n.text,4,e[a+1].from)-r.length:null,a<s);return yde(r,t)}function pln(e,t){let n=e.resolveInner(t,-1),r=t;O_e(n)&&(r=n.from,n=n.parent);for(let a;a=n.childBefore(r);)if(O_e(a))r=a.from;else if(a.name=="OrderedList"||a.name=="BulletList")n=a.lastChild,r=n.to;else break;return n}const bat=({state:e,dispatch:t})=>{let n=fs(e),r=null,a=e.changeByRange(s=>{let i=s.from,{doc:o}=e;if(s.empty&&ew.isActiveAt(e,s.from)){let c=o.lineAt(i),u=mat(pln(n,i),o);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:nt.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 p=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let h=d.blank(Pp(c.text,4,d.to)-Pp(c.text,4,d.from));return p==c.from&&(h=yde(h,e)),{range:nt.cursor(p+h.length),changes:{from:p,to:c.from+d.to,insert:h}}}if(p<i)return{range:nt.cursor(p),changes:{from:p,to:i}}}}}return r={range:s}});return r?!1:(t(e.update(a,{scrollIntoView:!0,userEvent:"delete"})),!0)},xat=[{key:"Enter",run:yat},{key:"Backspace",run:bat}],wat=cat({matchClosingTags:!1});function bde(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:a}=hat,completeHTMLTags:s=!0,pasteURLAsLink:i=!0,htmlTagLanguage:o=wat}=e;if(!(a instanceof eF))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],u=[o.support,cln],d;i&&u.push(Sat),n instanceof X0?(u.push(n.support),d=n.language):n&&(d=n);let f=t||d?dln(t,d):void 0;c.push(Lsn({codeParser:f,htmlParser:o.language.parser})),r&&u.push(Qp.high(x_.of(xat)));let p=vde(a.configure(c));return s&&u.push(p.data.of({autocomplete:hln})),new X0(p,u)}function hln(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let a=fs(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:mln(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let bU=null;function mln(){if(bU)return bU;let e=aat(new Zue(Mr.create({extensions:wat}),0,!0));return bU=e?e.options:[]}const gln=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Sat=gt.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),!ew.isActiveAt(t.state,r.from,1)))return!1;let s=fs(t.state),i=!1;return s.iterate({from:r.from,to:r.to,enter:o=>{(o.from>r.from||gln.test(o.name))&&(i=!0)},leave:o=>{o.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)}}),vln=Object.freeze(Object.defineProperty({__proto__:null,commonmarkLanguage:hat,deleteMarkupBackward:bat,insertNewlineContinueMarkup:yat,insertNewlineContinueMarkupCommand:vat,markdown:bde,markdownKeymap:xat,markdownLanguage:ew,pasteURLAsLink:Sat},Symbol.toStringTag,{value:"Module"}));function pt(e){return new X0(Que.define(e))}function cy(e){return We(()=>import("./index-8mVKHX_j.js"),__vite__mapDeps([4,2]),import.meta.url).then(t=>t.sql({dialect:t[e]}))}const Oat=[Ve.of({name:"C",extensions:["c","h","ino"],load(){return We(()=>import("./index-D2aYjUYW.js"),__vite__mapDeps([5,2]),import.meta.url).then(e=>e.cpp())}}),Ve.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return We(()=>import("./index-D2aYjUYW.js"),__vite__mapDeps([5,2]),import.meta.url).then(e=>e.cpp())}}),Ve.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return cy("Cassandra")}}),Ve.of({name:"CSS",extensions:["css"],load(){return We(()=>Promise.resolve().then(()=>hon),void 0,import.meta.url).then(e=>e.css())}}),Ve.of({name:"Go",extensions:["go"],load(){return We(()=>import("./index-CzXYaJgN.js"),__vite__mapDeps([6,2]),import.meta.url).then(e=>e.go())}}),Ve.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return We(()=>Promise.resolve().then(()=>iln),void 0,import.meta.url).then(e=>e.html())}}),Ve.of({name:"Java",extensions:["java"],load(){return We(()=>import("./index-FOl4sUk-.js"),__vite__mapDeps([7,2]),import.meta.url).then(e=>e.java())}}),Ve.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return We(()=>Promise.resolve().then(()=>FM),void 0,import.meta.url).then(e=>e.javascript())}}),Ve.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load(){return We(()=>import("./index-BNAYYUc3.js"),__vite__mapDeps([8,2]),import.meta.url).then(e=>e.jinja())}}),Ve.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return We(()=>Promise.resolve().then(()=>jan),void 0,import.meta.url).then(e=>e.json())}}),Ve.of({name:"JSX",extensions:["jsx"],load(){return We(()=>Promise.resolve().then(()=>FM),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ve.of({name:"LESS",extensions:["less"],load(){return We(()=>import("./index-Bb2rMuNJ.js"),__vite__mapDeps([9,2]),import.meta.url).then(e=>e.less())}}),Ve.of({name:"Liquid",extensions:["liquid"],load(){return We(()=>import("./index-BrKAFMNo.js"),__vite__mapDeps([10,2]),import.meta.url).then(e=>e.liquid())}}),Ve.of({name:"MariaDB SQL",load(){return cy("MariaSQL")}}),Ve.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return We(()=>Promise.resolve().then(()=>vln),void 0,import.meta.url).then(e=>e.markdown())}}),Ve.of({name:"MS SQL",load(){return cy("MSSQL")}}),Ve.of({name:"MySQL",load(){return cy("MySQL")}}),Ve.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return We(()=>import("./index-Dm9YxRl_.js"),__vite__mapDeps([11,2]),import.meta.url).then(e=>e.php())}}),Ve.of({name:"PLSQL",extensions:["pls"],load(){return cy("PLSQL")}}),Ve.of({name:"PostgreSQL",load(){return cy("PostgreSQL")}}),Ve.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return We(()=>import("./index-D5Ecjke_.js"),__vite__mapDeps([12,2]),import.meta.url).then(e=>e.python())}}),Ve.of({name:"Rust",extensions:["rs"],load(){return We(()=>import("./index-BPStdTZK.js"),__vite__mapDeps([13,2]),import.meta.url).then(e=>e.rust())}}),Ve.of({name:"Sass",extensions:["sass"],load(){return We(()=>import("./index-DKdpjQsM.js"),__vite__mapDeps([14,2]),import.meta.url).then(e=>e.sass({indented:!0}))}}),Ve.of({name:"SCSS",extensions:["scss"],load(){return We(()=>import("./index-DKdpjQsM.js"),__vite__mapDeps([14,2]),import.meta.url).then(e=>e.sass())}}),Ve.of({name:"SQL",extensions:["sql"],load(){return cy("StandardSQL")}}),Ve.of({name:"SQLite",load(){return cy("SQLite")}}),Ve.of({name:"TSX",extensions:["tsx"],load(){return We(()=>Promise.resolve().then(()=>FM),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ve.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return We(()=>Promise.resolve().then(()=>FM),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ve.of({name:"WebAssembly",extensions:["wat","wast"],load(){return We(()=>import("./index-CDyzq8kO.js"),__vite__mapDeps([15,2]),import.meta.url).then(e=>e.wast())}}),Ve.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return We(()=>import("./index-OK2VNs_f.js"),__vite__mapDeps([16,2]),import.meta.url).then(e=>e.xml())}}),Ve.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return We(()=>import("./index-C2fjAP9x.js"),__vite__mapDeps([17,2]),import.meta.url).then(e=>e.yaml())}}),Ve.of({name:"APL",extensions:["dyalog","apl"],load(){return We(()=>import("./apl-B4CMkyY2.js"),[],import.meta.url).then(e=>pt(e.apl))}}),Ve.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return We(()=>import("./asciiarmor-Df11BRmG.js"),[],import.meta.url).then(e=>pt(e.asciiArmor))}}),Ve.of({name:"ASN.1",extensions:["asn","asn1"],load(){return We(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>pt(e.asn1({})))}}),Ve.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return We(()=>import("./asterisk-B-8jnY81.js"),[],import.meta.url).then(e=>pt(e.asterisk))}}),Ve.of({name:"Brainfuck",extensions:["b","bf"],load(){return We(()=>import("./brainfuck-C4LP7Hcl.js"),[],import.meta.url).then(e=>pt(e.brainfuck))}}),Ve.of({name:"Cobol",extensions:["cob","cpy"],load(){return We(()=>import("./cobol-CWcv1MsR.js"),[],import.meta.url).then(e=>pt(e.cobol))}}),Ve.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.csharp))}}),Ve.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return We(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ve.of({name:"ClojureScript",extensions:["cljs"],load(){return We(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ve.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return We(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>pt(e.gss))}}),Ve.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return We(()=>import("./cmake-BQqOBYOt.js"),[],import.meta.url).then(e=>pt(e.cmake))}}),Ve.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return We(()=>import("./coffeescript-S37ZYGWr.js"),[],import.meta.url).then(e=>pt(e.coffeeScript))}}),Ve.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return We(()=>import("./commonlisp-DBKNyK5s.js"),[],import.meta.url).then(e=>pt(e.commonLisp))}}),Ve.of({name:"Cypher",extensions:["cyp","cypher"],load(){return We(()=>import("./cypher-C_CwsFkJ.js"),[],import.meta.url).then(e=>pt(e.cypher))}}),Ve.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return We(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>pt(e.cython))}}),Ve.of({name:"Crystal",extensions:["cr"],load(){return We(()=>import("./crystal-SjHAIU92.js"),[],import.meta.url).then(e=>pt(e.crystal))}}),Ve.of({name:"D",extensions:["d"],load(){return We(()=>import("./d-pRatUO7H.js"),[],import.meta.url).then(e=>pt(e.d))}}),Ve.of({name:"Dart",extensions:["dart"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.dart))}}),Ve.of({name:"diff",extensions:["diff","patch"],load(){return We(()=>import("./diff-DbItnlRl.js"),[],import.meta.url).then(e=>pt(e.diff))}}),Ve.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return We(()=>import("./dockerfile-BKs6k2Af.js"),__vite__mapDeps([18,19]),import.meta.url).then(e=>pt(e.dockerFile))}}),Ve.of({name:"DTD",extensions:["dtd"],load(){return We(()=>import("./dtd-DF_7sFjM.js"),[],import.meta.url).then(e=>pt(e.dtd))}}),Ve.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return We(()=>import("./dylan-DwRh75JA.js"),[],import.meta.url).then(e=>pt(e.dylan))}}),Ve.of({name:"EBNF",load(){return We(()=>import("./ebnf-CDyGwa7X.js"),[],import.meta.url).then(e=>pt(e.ebnf))}}),Ve.of({name:"ECL",extensions:["ecl"],load(){return We(()=>import("./ecl-Cabwm37j.js"),[],import.meta.url).then(e=>pt(e.ecl))}}),Ve.of({name:"edn",extensions:["edn"],load(){return We(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>pt(e.clojure))}}),Ve.of({name:"Eiffel",extensions:["e"],load(){return We(()=>import("./eiffel-CnydiIhH.js"),[],import.meta.url).then(e=>pt(e.eiffel))}}),Ve.of({name:"Elm",extensions:["elm"],load(){return We(()=>import("./elm-vLlmbW-K.js"),[],import.meta.url).then(e=>pt(e.elm))}}),Ve.of({name:"Erlang",extensions:["erl"],load(){return We(()=>import("./erlang-BNw1qcRV.js"),[],import.meta.url).then(e=>pt(e.erlang))}}),Ve.of({name:"Esper",load(){return We(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>pt(e.esper))}}),Ve.of({name:"Factor",extensions:["factor"],load(){return We(()=>import("./factor-kuTfRLto.js"),__vite__mapDeps([20,19]),import.meta.url).then(e=>pt(e.factor))}}),Ve.of({name:"FCL",load(){return We(()=>import("./fcl-Kvtd6kyn.js"),[],import.meta.url).then(e=>pt(e.fcl))}}),Ve.of({name:"Forth",extensions:["forth","fth","4th"],load(){return We(()=>import("./forth-Ffai-XNe.js"),[],import.meta.url).then(e=>pt(e.forth))}}),Ve.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return We(()=>import("./fortran-DYz_wnZ1.js"),[],import.meta.url).then(e=>pt(e.fortran))}}),Ve.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return We(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.fSharp))}}),Ve.of({name:"Gas",extensions:["s"],load(){return We(()=>import("./gas-Bneqetm1.js"),[],import.meta.url).then(e=>pt(e.gas))}}),Ve.of({name:"Gherkin",extensions:["feature"],load(){return We(()=>import("./gherkin-heZmZLOM.js"),[],import.meta.url).then(e=>pt(e.gherkin))}}),Ve.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return We(()=>import("./groovy-D9Dt4D0W.js"),[],import.meta.url).then(e=>pt(e.groovy))}}),Ve.of({name:"Haskell",extensions:["hs"],load(){return We(()=>import("./haskell-Cw1EW3IL.js"),[],import.meta.url).then(e=>pt(e.haskell))}}),Ve.of({name:"Haxe",extensions:["hx"],load(){return We(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>pt(e.haxe))}}),Ve.of({name:"HXML",extensions:["hxml"],load(){return We(()=>import("./haxe-H-WmDvRZ.js"),[],import.meta.url).then(e=>pt(e.hxml))}}),Ve.of({name:"HTTP",load(){return We(()=>import("./http-DBlCnlav.js"),[],import.meta.url).then(e=>pt(e.http))}}),Ve.of({name:"IDL",extensions:["pro"],load(){return We(()=>import("./idl-BEugSyMb.js"),[],import.meta.url).then(e=>pt(e.idl))}}),Ve.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return We(()=>import("./javascript-iXu5QeM3.js"),[],import.meta.url).then(e=>pt(e.jsonld))}}),Ve.of({name:"Julia",extensions:["jl"],load(){return We(()=>import("./julia-DuME0IfC.js"),[],import.meta.url).then(e=>pt(e.julia))}}),Ve.of({name:"Kotlin",extensions:["kt","kts"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.kotlin))}}),Ve.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return We(()=>import("./livescript-BwQOo05w.js"),[],import.meta.url).then(e=>pt(e.liveScript))}}),Ve.of({name:"Lua",extensions:["lua"],load(){return We(()=>import("./lua-BgMRiT3U.js"),[],import.meta.url).then(e=>pt(e.lua))}}),Ve.of({name:"mIRC",extensions:["mrc"],load(){return We(()=>import("./mirc-CjQqDB4T.js"),[],import.meta.url).then(e=>pt(e.mirc))}}),Ve.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return We(()=>import("./mathematica-DTrFuWx2.js"),[],import.meta.url).then(e=>pt(e.mathematica))}}),Ve.of({name:"Modelica",extensions:["mo"],load(){return We(()=>import("./modelica-Dc1JOy9r.js"),[],import.meta.url).then(e=>pt(e.modelica))}}),Ve.of({name:"MUMPS",extensions:["mps"],load(){return We(()=>import("./mumps-BT43cFF4.js"),[],import.meta.url).then(e=>pt(e.mumps))}}),Ve.of({name:"Mbox",extensions:["mbox"],load(){return We(()=>import("./mbox-CNhZ1qSd.js"),[],import.meta.url).then(e=>pt(e.mbox))}}),Ve.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return We(()=>import("./nginx-DdIZxoE0.js"),[],import.meta.url).then(e=>pt(e.nginx))}}),Ve.of({name:"NSIS",extensions:["nsh","nsi"],load(){return We(()=>import("./nsis-LdVXkNf5.js"),__vite__mapDeps([21,19]),import.meta.url).then(e=>pt(e.nsis))}}),Ve.of({name:"NTriples",extensions:["nt","nq"],load(){return We(()=>import("./ntriples-BfvgReVJ.js"),[],import.meta.url).then(e=>pt(e.ntriples))}}),Ve.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.objectiveC))}}),Ve.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.objectiveCpp))}}),Ve.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return We(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.oCaml))}}),Ve.of({name:"Octave",extensions:["m"],load(){return We(()=>import("./octave-Ck1zUtKM.js"),[],import.meta.url).then(e=>pt(e.octave))}}),Ve.of({name:"Oz",extensions:["oz"],load(){return We(()=>import("./oz-BzwKVEFT.js"),[],import.meta.url).then(e=>pt(e.oz))}}),Ve.of({name:"Pascal",extensions:["p","pas"],load(){return We(()=>import("./pascal--L3eBynH.js"),[],import.meta.url).then(e=>pt(e.pascal))}}),Ve.of({name:"Perl",extensions:["pl","pm"],load(){return We(()=>import("./perl-CdXCOZ3F.js"),[],import.meta.url).then(e=>pt(e.perl))}}),Ve.of({name:"Pig",extensions:["pig"],load(){return We(()=>import("./pig-CevX1Tat.js"),[],import.meta.url).then(e=>pt(e.pig))}}),Ve.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return We(()=>import("./powershell-CaxLzxiJ.js"),[],import.meta.url).then(e=>pt(e.powerShell))}}),Ve.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return We(()=>import("./properties-C78fOPTZ.js"),[],import.meta.url).then(e=>pt(e.properties))}}),Ve.of({name:"ProtoBuf",extensions:["proto"],load(){return We(()=>import("./protobuf-ChK-085T.js"),[],import.meta.url).then(e=>pt(e.protobuf))}}),Ve.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return We(()=>import("./pug-DeIclll2.js"),__vite__mapDeps([22,23]),import.meta.url).then(e=>pt(e.pug))}}),Ve.of({name:"Puppet",extensions:["pp"],load(){return We(()=>import("./puppet-DMA9R1ak.js"),[],import.meta.url).then(e=>pt(e.puppet))}}),Ve.of({name:"Q",extensions:["q"],load(){return We(()=>import("./q-pXgVlZs6.js"),[],import.meta.url).then(e=>pt(e.q))}}),Ve.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return We(()=>import("./r-B6wPVr8A.js"),[],import.meta.url).then(e=>pt(e.r))}}),Ve.of({name:"RPM Changes",load(){return We(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>pt(e.rpmChanges))}}),Ve.of({name:"RPM Spec",extensions:["spec"],load(){return We(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>pt(e.rpmSpec))}}),Ve.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return We(()=>import("./ruby-B2Rjki9n.js"),[],import.meta.url).then(e=>pt(e.ruby))}}),Ve.of({name:"SAS",extensions:["sas"],load(){return We(()=>import("./sas-B4kiWyti.js"),[],import.meta.url).then(e=>pt(e.sas))}}),Ve.of({name:"Scala",extensions:["scala"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.scala))}}),Ve.of({name:"Scheme",extensions:["scm","ss"],load(){return We(()=>import("./scheme-C41bIUwD.js"),[],import.meta.url).then(e=>pt(e.scheme))}}),Ve.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return We(()=>import("./shell-CjFT_Tl9.js"),[],import.meta.url).then(e=>pt(e.shell))}}),Ve.of({name:"Sieve",extensions:["siv","sieve"],load(){return We(()=>import("./sieve-C3Gn_uJK.js"),[],import.meta.url).then(e=>pt(e.sieve))}}),Ve.of({name:"Smalltalk",extensions:["st"],load(){return We(()=>import("./smalltalk-CnHTOXQT.js"),[],import.meta.url).then(e=>pt(e.smalltalk))}}),Ve.of({name:"Solr",load(){return We(()=>import("./solr-DehyRSwq.js"),[],import.meta.url).then(e=>pt(e.solr))}}),Ve.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return We(()=>import("./mllike-BO34x3tv.js"),[],import.meta.url).then(e=>pt(e.sml))}}),Ve.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return We(()=>import("./sparql-DkYu6x3z.js"),[],import.meta.url).then(e=>pt(e.sparql))}}),Ve.of({name:"Spreadsheet",alias:["excel","formula"],load(){return We(()=>import("./spreadsheet-BCZA_wO0.js"),[],import.meta.url).then(e=>pt(e.spreadsheet))}}),Ve.of({name:"Squirrel",extensions:["nut"],load(){return We(()=>import("./clike-B9uivgTg.js"),[],import.meta.url).then(e=>pt(e.squirrel))}}),Ve.of({name:"Stylus",extensions:["styl"],load(){return We(()=>import("./stylus-B533Al4x.js"),[],import.meta.url).then(e=>pt(e.stylus))}}),Ve.of({name:"Swift",extensions:["swift"],load(){return We(()=>import("./swift-BzpIVaGY.js"),[],import.meta.url).then(e=>pt(e.swift))}}),Ve.of({name:"sTeX",load(){return We(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>pt(e.stex))}}),Ve.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return We(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url).then(e=>pt(e.stex))}}),Ve.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return We(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>pt(e.verilog))}}),Ve.of({name:"Tcl",extensions:["tcl"],load(){return We(()=>import("./tcl-DVfN8rqt.js"),[],import.meta.url).then(e=>pt(e.tcl))}}),Ve.of({name:"Textile",extensions:["textile"],load(){return We(()=>import("./textile-CnDTJFAw.js"),[],import.meta.url).then(e=>pt(e.textile))}}),Ve.of({name:"TiddlyWiki",load(){return We(()=>import("./tiddlywiki-DO-Gjzrf.js"),[],import.meta.url).then(e=>pt(e.tiddlyWiki))}}),Ve.of({name:"Tiki wiki",load(){return We(()=>import("./tiki-DGYXhP31.js"),[],import.meta.url).then(e=>pt(e.tiki))}}),Ve.of({name:"TOML",extensions:["toml"],load(){return We(()=>import("./toml-Bm5Em-hy.js"),[],import.meta.url).then(e=>pt(e.toml))}}),Ve.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return We(()=>import("./troff-wAsdV37c.js"),[],import.meta.url).then(e=>pt(e.troff))}}),Ve.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return We(()=>import("./ttcn-CfJYG6tj.js"),[],import.meta.url).then(e=>pt(e.ttcn))}}),Ve.of({name:"TTCN_CFG",extensions:["cfg"],load(){return We(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>pt(e.ttcnCfg))}}),Ve.of({name:"Turtle",extensions:["ttl"],load(){return We(()=>import("./turtle-B1tBg_DP.js"),[],import.meta.url).then(e=>pt(e.turtle))}}),Ve.of({name:"Web IDL",extensions:["webidl"],load(){return We(()=>import("./webidl-ZXfAyPTL.js"),[],import.meta.url).then(e=>pt(e.webIDL))}}),Ve.of({name:"VB.NET",extensions:["vb"],load(){return We(()=>import("./vb-CmGdzxic.js"),[],import.meta.url).then(e=>pt(e.vb))}}),Ve.of({name:"VBScript",extensions:["vbs"],load(){return We(()=>import("./vbscript-BuJXcnF6.js"),[],import.meta.url).then(e=>pt(e.vbScript))}}),Ve.of({name:"Velocity",extensions:["vtl"],load(){return We(()=>import("./velocity-D8B20fx6.js"),[],import.meta.url).then(e=>pt(e.velocity))}}),Ve.of({name:"Verilog",extensions:["v"],load(){return We(()=>import("./verilog-C6RDOZhf.js"),[],import.meta.url).then(e=>pt(e.verilog))}}),Ve.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return We(()=>import("./vhdl-lSbBsy5d.js"),[],import.meta.url).then(e=>pt(e.vhdl))}}),Ve.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load(){return We(()=>import("./xquery-DzFWVndE.js"),[],import.meta.url).then(e=>pt(e.xQuery))}}),Ve.of({name:"Yacas",extensions:["ys"],load(){return We(()=>import("./yacas-BJ4BC0dw.js"),[],import.meta.url).then(e=>pt(e.yacas))}}),Ve.of({name:"Z80",extensions:["z80"],load(){return We(()=>import("./z80-Hz9HOZM7.js"),[],import.meta.url).then(e=>pt(e.z80))}}),Ve.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return We(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.mscgen))}}),Ve.of({name:"Xù",extensions:["xu"],load(){return We(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.xu))}}),Ve.of({name:"MsGenny",extensions:["msgenny"],load(){return We(()=>import("./mscgen-BA5vi2Kp.js"),[],import.meta.url).then(e=>pt(e.msgenny))}}),Ve.of({name:"Vue",extensions:["vue"],load(){return We(()=>import("./index-Bz0o5EJq.js"),__vite__mapDeps([24,2]),import.meta.url).then(e=>e.vue())}}),Ve.of({name:"Angular Template",load(){return We(()=>import("./index-DmCxvSjO.js"),__vite__mapDeps([25,2]),import.meta.url).then(e=>e.angular())}})];var yln=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 o=gt.theme(a,{dark:t==="dark"}),c=Tm.define(r),u=[o,Ww(c)];return u},bln={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)"},xln=[{tag:ie.comment,color:"#6272a4"},{tag:ie.string,color:"#f1fa8c"},{tag:ie.atom,color:"#bd93f9"},{tag:ie.meta,color:"#f8f8f2"},{tag:[ie.keyword,ie.operator,ie.tagName],color:"#ff79c6"},{tag:[ie.function(ie.propertyName),ie.propertyName],color:"#66d9ef"},{tag:[ie.definition(ie.variableName),ie.function(ie.variableName),ie.className,ie.attributeName],color:"#50fa7b"},{tag:ie.atom,color:"#bd93f9"}],AI=e=>{var{theme:t="dark",settings:n={},styles:r=[]}=e||{};return yln({theme:t,settings:gb({},bln,n),styles:[...xln,...r]})};AI();const wln=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=wde(e.state,n.from);return r.line?Sln(e):r.block?kln(e):!1};function xde(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 Sln=xde(Cln,0),Oln=xde(kat,0),kln=xde((e,t)=>kat(e,t,Eln(t)),0);function wde(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const aC=50;function _ln(e,{open:t,close:n},r,a){let s=e.sliceDoc(r-aC,r),i=e.sliceDoc(a,a+aC),o=/\s*$/.exec(s)[0].length,c=/^\s*/.exec(i)[0].length,u=s.length-o;if(s.slice(u-t.length,u)==t&&i.slice(c,c+n.length)==n)return{open:{pos:r-o,margin:o&&1},close:{pos:a+c,margin:c&&1}};let d,f;a-r<=2*aC?d=f=e.sliceDoc(r,a):(d=e.sliceDoc(r,r+aC),f=e.sliceDoc(a-aC,a));let p=/^\s*/.exec(d)[0].length,h=/\s*$/.exec(f)[0].length,m=f.length-h-n.length;return d.slice(p,p+t.length)==t&&f.slice(m,m+n.length)==n?{open:{pos:r+p+t.length,margin:/\s/.test(d.charAt(p+t.length))?1:0},close:{pos:a-h-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function Eln(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 kat(e,t,n=t.selection.ranges){let r=n.map(s=>wde(t,s.from).block);if(!r.every(s=>s))return null;let a=n.map((s,i)=>_ln(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,o;i<a.length;i++)if(o=a[i]){let c=r[i],{open:u,close:d}=o;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 Cln(e,t,n=t.selection.ranges){let r=[],a=-1;for(let{from:s,to:i}of n){let o=r.length,c=1e9,u=wde(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 p=/^\s*/.exec(f.text)[0].length,h=p==f.length,m=f.text.slice(p,p+u.length)==u?p:-1;p<f.text.length&&p<c&&(c=p),r.push({line:f,comment:m,token:u,indent:p,empty:h,single:!1})}d=f.to+1}if(c<1e9)for(let d=o;d<r.length;d++)r[d].indent<r[d].line.text.length&&(r[d].indent=c);r.length==o+1&&(r[o].single=!0)}}if(e!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:o,token:c,indent:u,empty:d,single:f}of r)(f||!d)&&s.push({from:o.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:o,token:c}of r)if(o>=0){let u=i.from+o,d=u+c.length;i.text[d-i.from]==" "&&d++,s.push({from:u,to:d})}return{changes:s}}return null}const Bne=Cm.define(),jln=Cm.define(),Tln=Yt.define(),_at=Yt.define({combine(e){return jm(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)})}}),Eat=ho.define({create(){return Gh.empty},update(e,t){let n=t.state.facet(_at),r=t.annotation(Bne);if(r){let c=cu.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=EL(d,d.length,n.minDepth,c):d=Tat(d,t.startState.selection),new Gh(u==0?r.rest:d,u==0?d:r.rest)}let a=t.annotation(jln);if((a=="full"||a=="before")&&(e=e.isolate()),t.annotation(so.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=cu.fromTransaction(t),i=t.annotation(so.time),o=t.annotation(so.userEvent);return s?e=e.addChanges(s,i,o,n,t):t.selection&&(e=e.addSelection(t.startState.selection,i,o,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 Gh(e.done.map(cu.fromJSON),e.undone.map(cu.fromJSON))}});function Nln(e={}){return[Eat,_at.of(e),gt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?Cat:t.inputType=="historyRedo"?Une:null;return r?(t.preventDefault(),r(n)):!1}})]}function tF(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let a=n.field(Eat,!1);if(!a)return!1;let s=a.pop(e,n,t);return s?(r(s),!0):!1}}const Cat=tF(0,!1),Une=tF(1,!1),Aln=tF(0,!0),Iln=tF(1,!0);class cu{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 cu(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 cu(t.changes&&to.fromJSON(t.changes),[],t.mapped&&tm.fromJSON(t.mapped),t.startSelection&&nt.fromJSON(t.startSelection),t.selectionsAfter.map(nt.fromJSON))}static fromTransaction(t,n){let r=yf;for(let a of t.startState.facet(Tln)){let s=a(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new cu(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,yf)}static selection(t){return new cu(void 0,yf,void 0,void 0,t)}}function EL(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 Rln(e,t){let n=[],r=!1;return e.iterChangedRanges((a,s)=>n.push(a,s)),t.iterChangedRanges((a,s,i,o)=>{for(let c=0;c<n.length;){let u=n[c++],d=n[c++];o>=u&&i<=d&&(r=!0)}}),r}function Pln(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function jat(e,t){return e.length?t.length?e.concat(t):e:t}const yf=[],Mln=200;function Tat(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Mln));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),EL(e,e.length-1,1e9,n.setSelAfter(r)))}else return[cu.selection([t])]}function Dln(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 xU(e,t){if(!e.length)return e;let n=e.length,r=yf;for(;n;){let a=$ln(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?[cu.selection(r)]:yf}function $ln(e,t,n){let r=jat(e.selectionsAfter.length?e.selectionsAfter.map(o=>o.map(t)):yf,n);if(!e.changes)return cu.selection(r);let a=e.changes.map(t),s=t.mapDesc(e.changes,!0),i=e.mapped?e.mapped.composeDesc(s):s;return new cu(a,Xn.mapEffects(e.effects,t),i,e.startSelection.map(s),r)}const Lln=/^(input\.type|delete)($|\.)/;class Gh{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 Gh(this.done,this.undone):this}addChanges(t,n,r,a,s){let i=this.done,o=i[i.length-1];return o&&o.changes&&!o.changes.empty&&t.changes&&(!r||Lln.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime<a.newGroupDelay&&a.joinToEvent(s,Rln(o.changes,t.changes))||r=="input.type.compose")?i=EL(i,i.length-1,a.minDepth,new cu(t.changes.compose(o.changes),jat(Xn.mapEffects(t.effects,o.changes),o.effects),o.mapped,o.startSelection,yf)):i=EL(i,i.length,a.minDepth,t),new Gh(i,yf,n,r)}addSelection(t,n,r,a){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:yf;return s.length>0&&n-this.prevTime<a&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Pln(s[s.length-1],t)?this:new Gh(Tat(this.done,t),this.undone,n,r)}addMapping(t){return new Gh(xU(this.done,t),xU(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:Bne.of({side:t,rest:Dln(a),selection:i}),userEvent:t==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let o=a.length==1?yf:a.slice(0,a.length-1);return s.mapped&&(o=xU(o,s.mapped)),n.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Bne.of({side:t,rest:o,selection:i}),filter:!1,userEvent:t==0?"undo":"redo",scrollIntoView:!0})}else return null}}Gh.empty=new Gh(yf,yf);const Fln=[{key:"Mod-z",run:Cat,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Une,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Une,preventDefault:!0},{key:"Mod-u",run:Aln,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Iln,preventDefault:!0}];function O_(e,t){return nt.create(e.ranges.map(t),e.mainIndex)}function Wp(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Gp({state:e,dispatch:t},n){let r=O_(e.selection,n);return r.eq(e.selection,!0)?!1:(t(Wp(e,r)),!0)}function nF(e,t){return nt.cursor(t?e.to:e.from)}function Nat(e,t){return Gp(e,n=>n.empty?e.moveByChar(n,t):nF(n,t))}function Xl(e){return e.textDirectionAt(e.state.selection.main.head)==bs.LTR}const Aat=e=>Nat(e,!Xl(e)),Iat=e=>Nat(e,Xl(e));function Rat(e,t){return Gp(e,n=>n.empty?e.moveByGroup(n,t):nF(n,t))}const zln=e=>Rat(e,!Xl(e)),Bln=e=>Rat(e,Xl(e));function Uln(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 rF(e,t,n){let r=fs(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;Uln(e,u,a)?r=u:c=n?u.to:u.from}let s=r.type.prop(a),i,o;return s&&(i=n?Wh(e,r.from,1):Wh(e,r.to,-1))&&i.matched?o=n?i.end.to:i.end.from:o=n?r.to:r.from,nt.cursor(o,n?-1:1)}const qln=e=>Gp(e,t=>rF(e.state,t,!Xl(e))),Vln=e=>Gp(e,t=>rF(e.state,t,Xl(e)));function Pat(e,t){return Gp(e,n=>{if(!n.empty)return nF(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Mat=e=>Pat(e,!1),Dat=e=>Pat(e,!0);function $at(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,a;if(t){for(let s of e.state.facet(gt.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 Lat(e,t){let n=$at(e),{state:r}=e,a=O_(r.selection,i=>i.empty?e.moveVertically(i,t,n.height):nF(i,t));if(a.eq(r.selection))return!1;let s;if(n.selfScroll){let i=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),c=o.top+n.marginTop,u=o.bottom-n.marginBottom;i&&i.top>c&&i.bottom<u&&(s=gt.scrollIntoView(a.main.head,{y:"start",yMargin:i.top-c}))}return e.dispatch(Wp(r,a),{effects:s}),!0}const __e=e=>Lat(e,!1),qne=e=>Lat(e,!0);function Vb(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=nt.cursor(r.from+s))}return a}const Hln=e=>Gp(e,t=>Vb(e,t,!0)),Qln=e=>Gp(e,t=>Vb(e,t,!1)),Wln=e=>Gp(e,t=>Vb(e,t,!Xl(e))),Gln=e=>Gp(e,t=>Vb(e,t,Xl(e))),Zln=e=>Gp(e,t=>nt.cursor(e.lineBlockAt(t.head).from,1)),Yln=e=>Gp(e,t=>nt.cursor(e.lineBlockAt(t.head).to,-1));function Xln(e,t,n){let r=!1,a=O_(e.selection,s=>{let i=Wh(e,s.head,-1)||Wh(e,s.head,1)||s.head>0&&Wh(e,s.head-1,1)||s.head<e.doc.length&&Wh(e,s.head+1,-1);if(!i||!i.end)return s;r=!0;let o=i.start.from==s.head?i.end.to:i.end.from;return nt.cursor(o)});return r?(t(Wp(e,a)),!0):!1}const Kln=({state:e,dispatch:t})=>Xln(e,t);function Qf(e,t){let n=O_(e.state.selection,r=>{let a=t(r);return nt.range(r.anchor,a.head,a.goalColumn,a.bidiLevel||void 0)});return n.eq(e.state.selection)?!1:(e.dispatch(Wp(e.state,n)),!0)}function Fat(e,t){return Qf(e,n=>e.moveByChar(n,t))}const zat=e=>Fat(e,!Xl(e)),Bat=e=>Fat(e,Xl(e));function Uat(e,t){return Qf(e,n=>e.moveByGroup(n,t))}const Jln=e=>Uat(e,!Xl(e)),ecn=e=>Uat(e,Xl(e)),tcn=e=>Qf(e,t=>rF(e.state,t,!Xl(e))),ncn=e=>Qf(e,t=>rF(e.state,t,Xl(e)));function qat(e,t){return Qf(e,n=>e.moveVertically(n,t))}const Vat=e=>qat(e,!1),Hat=e=>qat(e,!0);function Qat(e,t){return Qf(e,n=>e.moveVertically(n,t,$at(e).height))}const E_e=e=>Qat(e,!1),C_e=e=>Qat(e,!0),rcn=e=>Qf(e,t=>Vb(e,t,!0)),acn=e=>Qf(e,t=>Vb(e,t,!1)),scn=e=>Qf(e,t=>Vb(e,t,!Xl(e))),icn=e=>Qf(e,t=>Vb(e,t,Xl(e))),ocn=e=>Qf(e,t=>nt.cursor(e.lineBlockAt(t.head).from)),lcn=e=>Qf(e,t=>nt.cursor(e.lineBlockAt(t.head).to)),j_e=({state:e,dispatch:t})=>(t(Wp(e,{anchor:0})),!0),T_e=({state:e,dispatch:t})=>(t(Wp(e,{anchor:e.doc.length})),!0),N_e=({state:e,dispatch:t})=>(t(Wp(e,{anchor:e.selection.main.anchor,head:0})),!0),A_e=({state:e,dispatch:t})=>(t(Wp(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ccn=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),ucn=({state:e,dispatch:t})=>{let n=aF(e).map(({from:r,to:a})=>nt.range(r,Math.min(a+1,e.doc.length)));return t(e.update({selection:nt.create(n),userEvent:"select"})),!0},dcn=({state:e,dispatch:t})=>{let n=O_(e.selection,r=>{let a=fs(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:o}=i;if((o.from<r.from&&o.to>=r.to||o.to>r.to&&o.from<=r.from)&&i.next)return nt.range(o.to,o.from)}return r});return n.eq(e.selection)?!1:(t(Wp(e,n)),!0)};function Wat(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 o=s;;){let c=e.moveVertically(o,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==o.head)break;o=c}}}return a.length==r.ranges.length?!1:(e.dispatch(Wp(n,nt.create(a,a.length-1))),!0)}const fcn=e=>Wat(e,!1),pcn=e=>Wat(e,!0),hcn=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=nt.create([n.main]):n.main.empty||(r=nt.create([nt.cursor(n.main.head)])),r?(t(Wp(e,r)),!0):!1};function II(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,a=r.changeByRange(s=>{let{from:i,to:o}=s;if(i==o){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),o=Math.max(o,c)}else i=zM(e,i,!1),o=zM(e,o,!0);return i==o?{range:s}:{changes:{from:i,to:o},range:nt.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"?gt.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function zM(e,t,n){if(e instanceof gt)for(let r of e.state.facet(gt.atomicRanges).map(a=>a(e)))r.between(t,t,(a,s)=>{a<t&&s>t&&(t=n?s:a)});return t}const Gat=(e,t,n)=>II(e,r=>{let a=r.from,{state:s}=e,i=s.doc.lineAt(a),o,c;if(n&&!t&&a>i.from&&a<i.from+200&&!/[^ \t]/.test(o=i.text.slice(0,a-i.from))){if(o[o.length-1]==" ")return a-1;let u=Pp(o,s.tabSize),d=u%K0(s)||K0(s);for(let f=0;f<d&&o[o.length-1-f]==" ";f++)a--;c=a}else c=Qo(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=Qo(i.text,c-i.from,!1,!1)+i.from);return c}),Vne=e=>Gat(e,!1,!0),Zat=e=>Gat(e,!0,!1),Yat=(e,t)=>II(e,n=>{let r=n.head,{state:a}=e,s=a.doc.lineAt(r),i=a.charCategorizer(r);for(let o=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=Qo(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(o!=null&&d!=o)break;(u!=" "||r!=n.head)&&(o=d),r=c}return r}),Xat=e=>Yat(e,!1),mcn=e=>Yat(e,!0),gcn=e=>II(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),vcn=e=>II(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),ycn=e=>II(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),bcn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:_a.of(["",""])},range:nt.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},xcn=({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:Qo(s.text,a-s.from,!1)+s.from,o=a==s.to?a+1:Qo(s.text,a-s.from,!0)+s.from;return{changes:{from:i,to:o,insert:e.doc.slice(a,o).append(e.doc.slice(i,a))},range:nt.cursor(o)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function aF(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 Kat(e,t,n){if(e.readOnly)return!1;let r=[],a=[];for(let s of aF(e)){if(n?s.to==e.doc.length:s.from==0)continue;let i=e.doc.lineAt(n?s.to+1:s.from-1),o=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(nt.range(Math.min(e.doc.length,c.anchor+o),Math.min(e.doc.length,c.head+o)))}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(nt.range(c.anchor-o,c.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:nt.create(a,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const wcn=({state:e,dispatch:t})=>Kat(e,t,!1),Scn=({state:e,dispatch:t})=>Kat(e,t,!0);function Jat(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of aF(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 Ocn=({state:e,dispatch:t})=>Jat(e,t,!1),kcn=({state:e,dispatch:t})=>Jat(e,t,!0),_cn=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(aF(t).map(({from:a,to:s})=>(a>0?a--:s<t.doc.length&&s++,{from:a,to:s}))),r=O_(t.selection,a=>{let s;if(e.lineWrapping){let i=e.lineBlockAt(a.head),o=e.coordsAtPos(a.head,a.assoc||1);o&&(s=i.bottom+e.documentTop-o.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 Ecn(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=fs(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 I_e=est(!1),Ccn=est(!0);function est(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(a=>{let{from:s,to:i}=a,o=t.doc.lineAt(s),c=!e&&s==i&&Ecn(t,s);e&&(s=i=(i<=o.to?o:t.doc.lineAt(i)).to);let u=new Y6(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=que(u,s);for(d==null&&(d=Pp(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));i<o.to&&/\s/.test(o.text[i-o.from]);)i++;c?{from:s,to:i}=c:s>o.from&&s<o.from+100&&!/\S/.test(o.text.slice(0,s))&&(s=o.from);let f=["",dN(t,d)];return c&&f.push(dN(t,u.lineIndent(o.from,-1))),{changes:{from:s,to:i,insert:_a.of(f)},range:nt.cursor(s+1+f[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Sde(e,t){let n=-1;return e.changeByRange(r=>{let a=[];for(let i=r.from;i<=r.to;){let o=e.doc.lineAt(i);o.number>n&&(r.empty||r.to>o.from)&&(t(o,a,r),n=o.number),i=o.to+1}let s=e.changes(a);return{changes:a,range:nt.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const jcn=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Y6(e,{overrideIndentation:s=>{let i=n[s];return i??-1}}),a=Sde(e,(s,i,o)=>{let c=que(r,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=dN(e,c);(u!=d||o.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},tst=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Sde(e,(n,r)=>{r.push({from:n.from,insert:e.facet(w_)})}),{userEvent:"input.indent"})),!0),nst=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(Sde(e,(n,r)=>{let a=/^\s*/.exec(n.text)[0];if(!a)return;let s=Pp(a,e.tabSize),i=0,o=dN(e,Math.max(0,s-K0(e)));for(;i<a.length&&i<o.length&&a.charCodeAt(i)==o.charCodeAt(i);)i++;r.push({from:n.from+i,to:n.from+a.length,insert:o.slice(i)})}),{userEvent:"delete.dedent"})),!0),Tcn=e=>(e.setTabFocusMode(),!0),Ncn=[{key:"Ctrl-b",run:Aat,shift:zat,preventDefault:!0},{key:"Ctrl-f",run:Iat,shift:Bat},{key:"Ctrl-p",run:Mat,shift:Vat},{key:"Ctrl-n",run:Dat,shift:Hat},{key:"Ctrl-a",run:Zln,shift:ocn},{key:"Ctrl-e",run:Yln,shift:lcn},{key:"Ctrl-d",run:Zat},{key:"Ctrl-h",run:Vne},{key:"Ctrl-k",run:gcn},{key:"Ctrl-Alt-h",run:Xat},{key:"Ctrl-o",run:bcn},{key:"Ctrl-t",run:xcn},{key:"Ctrl-v",run:qne}],Acn=[{key:"ArrowLeft",run:Aat,shift:zat,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:zln,shift:Jln,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Wln,shift:scn,preventDefault:!0},{key:"ArrowRight",run:Iat,shift:Bat,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Bln,shift:ecn,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Gln,shift:icn,preventDefault:!0},{key:"ArrowUp",run:Mat,shift:Vat,preventDefault:!0},{mac:"Cmd-ArrowUp",run:j_e,shift:N_e},{mac:"Ctrl-ArrowUp",run:__e,shift:E_e},{key:"ArrowDown",run:Dat,shift:Hat,preventDefault:!0},{mac:"Cmd-ArrowDown",run:T_e,shift:A_e},{mac:"Ctrl-ArrowDown",run:qne,shift:C_e},{key:"PageUp",run:__e,shift:E_e},{key:"PageDown",run:qne,shift:C_e},{key:"Home",run:Qln,shift:acn,preventDefault:!0},{key:"Mod-Home",run:j_e,shift:N_e},{key:"End",run:Hln,shift:rcn,preventDefault:!0},{key:"Mod-End",run:T_e,shift:A_e},{key:"Enter",run:I_e,shift:I_e},{key:"Mod-a",run:ccn},{key:"Backspace",run:Vne,shift:Vne,preventDefault:!0},{key:"Delete",run:Zat,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Xat,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:mcn,preventDefault:!0},{mac:"Mod-Backspace",run:vcn,preventDefault:!0},{mac:"Mod-Delete",run:ycn,preventDefault:!0}].concat(Ncn.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Icn=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:qln,shift:tcn},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Vln,shift:ncn},{key:"Alt-ArrowUp",run:wcn},{key:"Shift-Alt-ArrowUp",run:Ocn},{key:"Alt-ArrowDown",run:Scn},{key:"Shift-Alt-ArrowDown",run:kcn},{key:"Mod-Alt-ArrowUp",run:fcn},{key:"Mod-Alt-ArrowDown",run:pcn},{key:"Escape",run:hcn},{key:"Mod-Enter",run:Ccn},{key:"Alt-l",mac:"Ctrl-l",run:ucn},{key:"Mod-i",run:dcn,preventDefault:!0},{key:"Mod-[",run:nst},{key:"Mod-]",run:tst},{key:"Mod-Alt-\\",run:jcn},{key:"Shift-Mod-k",run:_cn},{key:"Shift-Mod-\\",run:Kln},{key:"Mod-/",run:wln},{key:"Alt-A",run:Oln},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Tcn}].concat(Acn),Rcn={key:"Tab",run:tst,shift:nst},R_e=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class mk{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?o=>s(R_e(o)):R_e,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 Jc(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=_ue(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=Ph(t);let a=this.normalize(n);if(a.length)for(let s=0,i=r;;s++){let o=a.charCodeAt(s),c=this.match(o,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)==o&&i++}}}match(t,n,r){let a=null;for(let s=0;s<this.matches.length;s+=2){let i=this.matches[s],o=!1;this.query.charCodeAt(i)==t&&(i==this.query.length-1?a={from:this.matches[s+1],to:r}:(this.matches[s]++,o=!0)),o||(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"&&(mk.prototype[Symbol.iterator]=function(){return this});const rst={from:-1,to:-1,match:/.*/.exec("")},Ode="gm"+(/x/.unicode==null?"":"u");class ast{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 sst(t,n,r,a,s);this.re=new RegExp(n,Ode+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=t.iter();let i=t.lineAt(a);this.curLineStart=i.from,this.matchPos=CL(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=CL(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 wU=new WeakMap;class gO{constructor(t,n){this.from=t,this.text=n}get to(){return this.from+this.text.length}static get(t,n,r){let a=wU.get(t);if(!a||a.from>=r||a.to<=n){let o=new gO(n,t.sliceString(n,r));return wU.set(t,o),o}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)),wU.set(t,new gO(i,s)),new gO(n,s.slice(n-i,r-i))}}class sst{constructor(t,n,r,a,s){this.text=t,this.to=s,this.done=!1,this.value=rst,this.matchPos=CL(t,a),this.re=new RegExp(n,Ode+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=gO.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=CL(this.text,a+(r==a?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=gO.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(ast.prototype[Symbol.iterator]=sst.prototype[Symbol.iterator]=function(){return this});function Pcn(e){try{return new RegExp(e,Ode),!0}catch{return!1}}function CL(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 Hne(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),n=vs("input",{class:"cm-textfield",name:"line",value:t}),r=vs("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),e.dispatch({effects:Wj.of(!1)}),e.focus()):s.keyCode==13&&(s.preventDefault(),a())},onsubmit:s=>{s.preventDefault(),a()}},vs("label",e.state.phrase("Go to line"),": ",n)," ",vs("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),vs("button",{name:"close",onclick:()=>{e.dispatch({effects:Wj.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,o=i.doc.lineAt(i.selection.main.head),[,c,u,d,f]=s,p=d?+d.slice(1):0,h=u?+u:o.number;if(u&&f){let v=h/100;c&&(v=v*(c=="-"?-1:1)+o.number/i.doc.lines),h=Math.round(i.doc.lines*v)}else u&&c&&(h=h*(c=="-"?-1:1)+o.number);let m=i.doc.line(Math.max(1,Math.min(i.doc.lines,h))),g=nt.cursor(m.from+Math.max(0,Math.min(p,m.length)));e.dispatch({effects:[Wj.of(!1),gt.scrollIntoView(g.from,{y:"center"})],selection:g}),e.focus()}return{dom:r}}const Wj=Xn.define(),P_e=ho.define({create(){return!0},update(e,t){for(let n of t.effects)n.is(Wj)&&(e=n.value);return e},provide:e=>uN.from(e,t=>t?Hne:null)}),Mcn=e=>{let t=cN(e,Hne);if(!t){let n=[Wj.of(!0)];e.state.field(P_e,!1)==null&&n.push(Xn.appendConfig.of([P_e,Dcn])),e.dispatch({effects:n}),t=cN(e,Hne)}return t&&t.dom.querySelector("input").select(),!0},Dcn=gt.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"}}}),$cn={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Lcn=Yt.define({combine(e){return jm(e,$cn,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Fcn(e){return[Vcn,qcn]}const zcn=nn.mark({class:"cm-selectionMatch"}),Bcn=nn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function M_e(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 Ucn(e,t,n,r){return e(t.sliceDoc(n,n+1))==ri.Word&&e(t.sliceDoc(r-1,r))==ri.Word}const qcn=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(Lcn),{state:n}=e,r=n.selection;if(r.ranges.length>1)return nn.none;let a=r.main,s,i=null;if(a.empty){if(!t.highlightWordAroundCursor)return nn.none;let c=n.wordAt(a.head);if(!c)return nn.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 nn.none;if(t.wholeWords){if(s=n.sliceDoc(a.from,a.to),i=n.charCategorizer(a.head),!(M_e(i,n,a.from,a.to)&&Ucn(i,n,a.from,a.to)))return nn.none}else if(s=n.sliceDoc(a.from,a.to),!s)return nn.none}let o=[];for(let c of e.visibleRanges){let u=new mk(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!i||M_e(i,n,d,f))&&(a.empty&&d<=a.from&&f>=a.to?o.push(Bcn.range(d,f)):(d>=a.to||f<=a.from)&&o.push(zcn.range(d,f)),o.length>t.maxMatches))return nn.none}}return nn.set(o)}},{decorations:e=>e.decorations}),Vcn=gt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Hcn=({state:e,dispatch:t})=>{let{selection:n}=e,r=nt.create(n.ranges.map(a=>e.wordAt(a.head)||nt.cursor(a.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function Qcn(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,o=new mk(e.doc,t,r[r.length-1].to);;)if(o.next(),o.done){if(i)return null;o=new mk(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),i=!0}else{if(i&&r.some(c=>c.from==o.value.from))continue;if(s){let c=e.wordAt(o.value.from);if(!c||c.from!=o.value.from||c.to!=o.value.to)continue}return o.value}}const Wcn=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return Hcn({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=Qcn(e,r);return a?(t(e.update({selection:e.selection.addRange(nt.range(a.from,a.to),!1),effects:gt.scrollIntoView(a.to)})),!0):!1},k_=Yt.define({combine(e){return jm(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new sun(t),scrollToMatch:t=>gt.scrollIntoView(t)})}});class ist{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||Pcn(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 Xcn(this):new Zcn(this)}getCursor(t,n=0,r){let a=t.doc?t:Mr.create({doc:t});return r==null&&(r=a.doc.length),this.regexp?O1(this,a,n,r):S1(this,a,n,r)}}class ost{constructor(t){this.spec=t}}function S1(e,t,n,r){return new mk(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:a=>a.toLowerCase(),e.wholeWord?Gcn(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function Gcn(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(jL(a,n-s))!=ri.Word||t(TL(a,n-s))!=ri.Word)&&(t(TL(a,r-s))!=ri.Word||t(jL(a,r-s))!=ri.Word))}class Zcn extends ost{constructor(t){super(t)}nextMatch(t,n,r){let a=S1(this.spec,t,r,t.doc.length).nextOverlapping();if(a.done){let s=Math.min(t.doc.length,n+this.spec.unquoted.length);a=S1(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=S1(this.spec,t,s,a),o=null;for(;!i.nextOverlapping().done;)o=i.value;if(o)return o;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=S1(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=S1(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 O1(e,t,n,r){return new ast(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?Ycn(t.charCategorizer(t.selection.main.head)):void 0},n,r)}function jL(e,t){return e.slice(Qo(e,t,!1),t)}function TL(e,t){return e.slice(t,Qo(e,t))}function Ycn(e){return(t,n,r)=>!r[0].length||(e(jL(r.input,r.index))!=ri.Word||e(TL(r.input,r.index))!=ri.Word)&&(e(TL(r.input,r.index+r[0].length))!=ri.Word||e(jL(r.input,r.index+r[0].length))!=ri.Word)}class Xcn extends ost{nextMatch(t,n,r){let a=O1(this.spec,t,r,t.doc.length).next();return a.done&&(a=O1(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=O1(this.spec,t,s,r),o=null;for(;!i.next().done;)o=i.value;if(o&&(s==n||o.from>s+10))return o;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=O1(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=O1(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 wN=Xn.define(),kde=Xn.define(),Gy=ho.define({create(e){return new SU(Qne(e).create(),null)},update(e,t){for(let n of t.effects)n.is(wN)?e=new SU(n.value.create(),e.panel):n.is(kde)&&(e=new SU(e.query,n.value?_de:null));return e},provide:e=>uN.from(e,t=>t.panel)});class SU{constructor(t,n){this.query=t,this.panel=n}}const Kcn=nn.mark({class:"cm-searchMatch"}),Jcn=nn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),eun=ii.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Gy))}update(e){let t=e.state.field(Gy);(t!=e.startState.field(Gy)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return nn.none;let{view:n}=this,r=new Su;for(let a=0,s=n.visibleRanges,i=s.length;a<i;a++){let{from:o,to:c}=s[a];for(;a<i-1&&c>s[a+1].from-500;)c=s[++a].to;e.highlight(n.state,o,c,(u,d)=>{let f=n.state.selection.ranges.some(p=>p.from==u&&p.to==d);r.add(u,d,f?Jcn:Kcn)})}return r.finish()}},{decorations:e=>e.decorations});function RI(e){return t=>{let n=t.state.field(Gy,!1);return n&&n.query.spec.valid?e(t,n):ust(t)}}const NL=RI((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let a=nt.single(r.from,r.to),s=e.state.facet(k_);return e.dispatch({selection:a,effects:[Ede(e,r),s.scrollToMatch(a.main,e)],userEvent:"select.search"}),cst(e),!0}),AL=RI((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,a=t.prevMatch(n,r,r);if(!a)return!1;let s=nt.single(a.from,a.to),i=e.state.facet(k_);return e.dispatch({selection:s,effects:[Ede(e,a),i.scrollToMatch(s.main,e)],userEvent:"select.search"}),cst(e),!0}),tun=RI((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:nt.create(n.map(r=>nt.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),nun=({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 o=new mk(e.doc,e.sliceDoc(r,a));!o.next().done;){if(s.length>1e3)return!1;o.value.from==r&&(i=s.length),s.push(nt.range(o.value.from,o.value.to))}return t(e.update({selection:nt.create(s,i),userEvent:"select.search.matches"})),!0},D_e=RI((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,o=[],c,u,d=[];i.from==r&&i.to==a&&(u=n.toText(t.getReplacement(i)),o.push({from:i.from,to:i.to,insert:u}),i=t.nextMatch(n,i.from,i.to),d.push(gt.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let f=e.state.changes(o);return i&&(c=nt.single(i.from,i.to).map(f),d.push(Ede(e,i)),d.push(n.facet(k_).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),run=RI((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:gt.announce.of(r),userEvent:"input.replace.all"}),!0});function _de(e){return e.state.facet(k_).createPanel(e)}function Qne(e,t){var n,r,a,s,i;let o=e.selection.main,c=o.empty||o.to>o.from+100?"":e.sliceDoc(o.from,o.to);if(t&&!c)return t;let u=e.facet(k_);return new ist({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=cN(e,_de);return t&&t.dom.querySelector("[main-field]")}function cst(e){let t=lst(e);t&&t==e.root.activeElement&&t.select()}const ust=e=>{let t=e.state.field(Gy,!1);if(t&&t.panel){let n=lst(e);if(n&&n!=e.root.activeElement){let r=Qne(e.state,t.query.spec);r.valid&&e.dispatch({effects:wN.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[kde.of(!0),t?wN.of(Qne(e.state,t.query.spec)):Xn.appendConfig.of(oun)]});return!0},dst=e=>{let t=e.state.field(Gy,!1);if(!t||!t.panel)return!1;let n=cN(e,_de);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:kde.of(!1)}),!0},aun=[{key:"Mod-f",run:ust,scope:"editor search-panel"},{key:"F3",run:NL,shift:AL,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:NL,shift:AL,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:dst,scope:"editor search-panel"},{key:"Mod-Shift-l",run:nun},{key:"Mod-Alt-g",run:Mcn},{key:"Mod-d",run:Wcn,preventDefault:!0}];class sun{constructor(t){this.view=t;let n=this.query=t.state.field(Gy).query.spec;this.commit=this.commit.bind(this),this.searchField=vs("input",{value:n.search,placeholder:Vu(t,"Find"),"aria-label":Vu(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=vs("input",{value:n.replace,placeholder:Vu(t,"Replace"),"aria-label":Vu(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=vs("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=vs("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=vs("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(a,s,i){return vs("button",{class:"cm-button",name:a,onclick:s,type:"button"},i)}this.dom=vs("div",{onkeydown:a=>this.keydown(a),class:"cm-search"},[this.searchField,r("next",()=>NL(t),[Vu(t,"next")]),r("prev",()=>AL(t),[Vu(t,"previous")]),r("select",()=>tun(t),[Vu(t,"all")]),vs("label",null,[this.caseField,Vu(t,"match case")]),vs("label",null,[this.reField,Vu(t,"regexp")]),vs("label",null,[this.wordField,Vu(t,"by word")]),...t.state.readOnly?[]:[vs("br"),this.replaceField,r("replace",()=>D_e(t),[Vu(t,"replace")]),r("replaceAll",()=>run(t),[Vu(t,"replace all")])],vs("button",{name:"close",onclick:()=>dst(t),"aria-label":Vu(t,"close"),type:"button"},["×"])])}commit(){let t=new ist({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:wN.of(t)}))}keydown(t){Pnn(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?AL:NL)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),D_e(this.view))}update(t){for(let n of t.transactions)for(let r of n.effects)r.is(wN)&&!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(k_).top}}function Vu(e,t){return e.state.phrase(t)}const BM=30,UM=/[\s\.,:;?!]/;function Ede(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-BM),i=Math.min(a,n+BM),o=e.state.sliceDoc(s,i);if(s!=r.from){for(let c=0;c<BM;c++)if(!UM.test(o[c+1])&&UM.test(o[c])){o=o.slice(c);break}}if(i!=a){for(let c=o.length-1;c>o.length-BM;c--)if(!UM.test(o[c-1])&&UM.test(o[c])){o=o.slice(0,c);break}}return gt.announce.of(`${e.state.phrase("current match")}. ${o} ${e.state.phrase("on line")} ${r.number}.`)}const iun=gt.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"}}),oun=[Gy,Qp.low(eun),iun];class $_e{constructor(t,n,r){this.from=t,this.to=n,this.diagnostic=r}}class Kx{constructor(t,n,r){this.diagnostics=t,this.panel=n,this.selected=r}static init(t,n,r){let a=r.facet(SN).markerFilter;a&&(t=a(t,r));let s=t.slice().sort((d,f)=>d.from-f.from||d.to-f.to),i=new Su,o=[],c=0;for(let d=0;;){let f=d==s.length?null:s[d];if(!f&&!o.length)break;let p,h;for(o.length?(p=c,h=o.reduce((g,v)=>Math.min(g,v.to),f&&f.from>p?f.from:1e8)):(p=f.from,h=f.to,o.push(f),d++);d<s.length;){let g=s[d];if(g.from==p&&(g.to>g.from||g.to==p))o.push(g),d++,h=Math.min(g.to,h);else{h=Math.min(g.from,h);break}}let m=xun(o);if(o.some(g=>g.from==g.to||g.from==g.to-1&&r.doc.lineAt(g.from).to==g.from))i.add(p,p,nn.widget({widget:new gun(m),diagnostics:o.slice()}));else{let g=o.reduce((v,b)=>b.markClass?v+" "+b.markClass:v,"");i.add(p,h,nn.mark({class:"cm-lintRange cm-lintRange-"+m+g,diagnostics:o.slice(),inclusiveEnd:o.some(v=>v.to>h)}))}c=h;for(let g=0;g<o.length;g++)o[g].to<=c&&o.splice(g--,1)}let u=i.finish();return new Kx(u,n,gk(u))}}function gk(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 $_e(a,s,t||i.diagnostics[0]);else{if(i.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new $_e(r.from,s,r.diagnostic)}}),r}function lun(e,t){let n=t.pos,r=t.end||n,a=e.state.facet(SN).hideOn(e,n,r);if(a!=null)return a;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(i=>i.is(fst))||e.changes.touchesRange(s.from,Math.max(s.to,r)))}function cun(e,t){return e.field(ld,!1)?t:t.concat(Xn.appendConfig.of(wun))}const fst=Xn.define(),Cde=Xn.define(),pst=Xn.define(),ld=ho.define({create(){return new Kx(nn.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=gk(n,e.selected.diagnostic,s)||gk(n,null,s)}!n.size&&a&&t.state.facet(SN).autoPanel&&(a=null),e=new Kx(n,a,r)}for(let n of t.effects)if(n.is(fst)){let r=t.state.facet(SN).autoPanel?n.value.length?ON.open:null:e.panel;e=Kx.init(n.value,r,t.state)}else n.is(Cde)?e=new Kx(e.diagnostics,n.value?ON.open:null,e.selected):n.is(pst)&&(e=new Kx(e.diagnostics,e.panel,n.value));return e},provide:e=>[uN.from(e,t=>t.panel),gt.decorations.from(e,t=>t.diagnostics)]}),uun=nn.mark({class:"cm-lintRange cm-lintRange-active"});function dun(e,t,n){let{diagnostics:r}=e.state.field(ld),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 o=e.state.facet(SN).tooltipFilter;return a&&o&&(a=o(a,e.state)),a?{pos:s,end:i,above:e.state.doc.lineAt(s).to<i,create(){return{dom:fun(e,a)}}}:null}function fun(e,t){return vs("ul",{class:"cm-tooltip-lint"},t.map(n=>mst(e,n,!1)))}const pun=e=>{let t=e.state.field(ld,!1);(!t||!t.panel)&&e.dispatch({effects:cun(e.state,[Cde.of(!0)])});let n=cN(e,ON.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},L_e=e=>{let t=e.state.field(ld,!1);return!t||!t.panel?!1:(e.dispatch({effects:Cde.of(!1)}),!0)},hun=e=>{let t=e.state.field(ld,!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)},mun=[{key:"Mod-Shift-m",run:pun,preventDefault:!0},{key:"F8",run:hun}],SN=Yt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...jm(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:F_e,tooltipFilter:F_e,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 F_e(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function hst(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 mst(e,t,n){var r;let a=n?hst(t.actions):[];return vs("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},vs("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 o=!1,c=h=>{if(h.preventDefault(),o)return;o=!0;let m=gk(e.state.field(ld).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),vs("u",u.slice(d,d+1)),u.slice(d+1)],p=s.markClass?" "+s.markClass:"";return vs("button",{type:"button",class:"cm-diagnosticAction"+p,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${a[i]})"`}.`},f)}),t.source&&vs("div",{class:"cm-diagnosticSource"},t.source))}class gun extends Pd{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return vs("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class z_e{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=mst(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ON{constructor(t){this.view=t,this.items=[];let n=a=>{if(a.keyCode==27)L_e(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=hst(s.actions);for(let o=0;o<i.length;o++)if(i[o].toUpperCase().charCodeAt(0)==a.keyCode){let c=gk(this.view.state.field(ld).diagnostics,s);c&&s.actions[o].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=vs("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:n,onclick:r}),this.dom=vs("div",{class:"cm-panel-lint"},this.list,vs("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>L_e(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(ld).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(ld),r=0,a=!1,s=null,i=new Set;for(t.between(0,this.view.state.doc.length,(o,c,{spec:u})=>{for(let d of u.diagnostics){if(i.has(d))continue;i.add(d);let f=-1,p;for(let h=r;h<this.items.length;h++)if(this.items[h].diagnostic==d){f=h;break}f<0?(p=new z_e(this.view,d),this.items.splice(r,0,p),a=!0):(p=this.items[f],f>r&&(this.items.splice(r,f-r),a=!0)),n&&p.diagnostic==n.diagnostic?p.dom.hasAttribute("aria-selected")||(p.dom.setAttribute("aria-selected","true"),s=p):p.dom.hasAttribute("aria-selected")&&p.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 z_e(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:o,panel:c})=>{let u=c.height/this.list.offsetHeight;o.top<c.top?this.list.scrollTop-=(c.top-o.top)/u:o.bottom>c.bottom&&(this.list.scrollTop+=(o.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(ld),r=gk(n.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:pst.of(r)})}static open(t){return new ON(t)}}function vun(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 qM(e){return vun(`<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 yun=gt.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:qM("#d11")},".cm-lintRange-warning":{backgroundImage:qM("orange")},".cm-lintRange-info":{backgroundImage:qM("#999")},".cm-lintRange-hint":{backgroundImage:qM("#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 bun(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function xun(e){let t="hint",n=1;for(let r of e){let a=bun(r.severity);a>n&&(n=a,t=r.severity)}return t}const wun=[ld,gt.decorations.compute([ld],e=>{let{selected:t,panel:n}=e.field(ld);return!t||!n||t.from==t.to?nn.none:nn.set([uun.range(t.from,t.to)])}),wrn(dun,{hideOn:lun}),yun];var B_e=function(t){t===void 0&&(t={});var{crosshairCursor:n=!1}=t,r=[];t.closeBracketsKeymap!==!1&&(r=r.concat(gsn)),t.defaultKeymap!==!1&&(r=r.concat(Icn)),t.searchKeymap!==!1&&(r=r.concat(aun)),t.historyKeymap!==!1&&(r=r.concat(Fln)),t.foldKeymap!==!1&&(r=r.concat(tan)),t.completionKeymap!==!1&&(r=r.concat(nrt)),t.lintKeymap!==!1&&(r=r.concat(mun));var a=[];return t.lineNumbers!==!1&&a.push(Arn()),t.highlightActiveLineGutter!==!1&&a.push(Prn()),t.highlightSpecialChars!==!1&&a.push(Ynn()),t.history!==!1&&a.push(Nln()),t.foldGutter!==!1&&a.push(san()),t.drawSelection!==!1&&a.push(znn()),t.dropCursor!==!1&&a.push(Hnn()),t.allowMultipleSelections!==!1&&a.push(Mr.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&a.push(Wrn()),t.syntaxHighlighting!==!1&&a.push(Ww(can,{fallback:!0})),t.bracketMatching!==!1&&a.push(gan()),t.closeBrackets!==!1&&a.push(fsn()),t.autocompletion!==!1&&a.push(trt()),t.rectangularSelection!==!1&&a.push(urn()),n!==!1&&a.push(prn()),t.highlightActiveLine!==!1&&a.push(nrn()),t.highlightSelectionMatches!==!1&&a.push(Fcn()),t.tabSize&&typeof t.tabSize=="number"&&a.push(w_.of(" ".repeat(t.tabSize))),a.concat([x_.of(r.flat())]).filter(Boolean)};const Sun="#e5c07b",U_e="#e06c75",Oun="#56b6c2",kun="#ffffff",j2="#abb2bf",Wne="#7d8799",_un="#61afef",Eun="#98c379",q_e="#d19a66",Cun="#c678dd",jun="#21252b",V_e="#2c313a",H_e="#282c34",OU="#353a42",Tun="#3E4451",Q_e="#528bff",Nun=gt.theme({"&":{color:j2,backgroundColor:H_e},".cm-content":{caretColor:Q_e},".cm-cursor, .cm-dropCursor":{borderLeftColor:Q_e},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Tun},".cm-panels":{backgroundColor:jun,color:j2},".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:H_e,color:Wne,border:"none"},".cm-activeLineGutter":{backgroundColor:V_e},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:OU},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:OU,borderBottomColor:OU},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:V_e,color:j2}}},{dark:!0}),Aun=Tm.define([{tag:ie.keyword,color:Cun},{tag:[ie.name,ie.deleted,ie.character,ie.propertyName,ie.macroName],color:U_e},{tag:[ie.function(ie.variableName),ie.labelName],color:_un},{tag:[ie.color,ie.constant(ie.name),ie.standard(ie.name)],color:q_e},{tag:[ie.definition(ie.name),ie.separator],color:j2},{tag:[ie.typeName,ie.className,ie.number,ie.changed,ie.annotation,ie.modifier,ie.self,ie.namespace],color:Sun},{tag:[ie.operator,ie.operatorKeyword,ie.url,ie.escape,ie.regexp,ie.link,ie.special(ie.string)],color:Oun},{tag:[ie.meta,ie.comment],color:Wne},{tag:ie.strong,fontWeight:"bold"},{tag:ie.emphasis,fontStyle:"italic"},{tag:ie.strikethrough,textDecoration:"line-through"},{tag:ie.link,color:Wne,textDecoration:"underline"},{tag:ie.heading,fontWeight:"bold",color:U_e},{tag:[ie.atom,ie.bool,ie.special(ie.variableName)],color:q_e},{tag:[ie.processingInstruction,ie.string,ie.inserted],color:Eun},{tag:ie.invalid,color:kun}]),Iun=[Nun,Ww(Aun)];var Run=gt.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Pun=function(t){t===void 0&&(t={});var{indentWithTab:n=!0,editable:r=!0,readOnly:a=!1,theme:s="light",placeholder:i="",basicSetup:o=!0}=t,c=[];switch(n&&c.unshift(x_.of([Rcn])),o&&(typeof o=="boolean"?c.unshift(B_e()):c.unshift(B_e(o))),i&&c.unshift(irn(i)),s){case"light":c.push(Run);break;case"dark":c.push(Iun);break;case"none":break;default:c.push(s);break}return r===!1&&c.push(gt.editable.of(!1)),a&&c.push(Mr.readOnly.of(!0)),[...c]},Mun=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 Dun{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 W_e=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 kU=null,$un=()=>typeof window>"u"?new W_e:(kU||(kU=new W_e),kU),G_e=Cm.define(),Lun=200,Fun=[];function zun(e){var{value:t,selection:n,onChange:r,onStatistics:a,onCreateEditor:s,onUpdate:i,extensions:o=Fun,autoFocus:c,theme:u="light",height:d=null,minHeight:f=null,maxHeight:p=null,width:h=null,minWidth:m=null,maxWidth:g=null,placeholder:v="",editable:b=!0,readOnly:w=!1,indentWithTab:O=!0,basicSetup:k=!0,root:_,initialState:C}=e,[T,j]=x.useState(),[A,I]=x.useState(),[P,M]=x.useState(),F=x.useState(()=>({current:null}))[0],D=x.useState(()=>({current:null}))[0],U=gt.theme({"&":{height:d,minHeight:f,maxHeight:p,width:h,minWidth:m,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),V=gt.updateListener.of(W=>{if(W.docChanged&&typeof r=="function"&&!W.transactions.some(B=>B.annotation(G_e))){F.current?F.current.reset():(F.current=new Dun(()=>{if(D.current){var B=D.current;D.current=null,B()}F.current=null},Lun),$un().add(F.current));var $=W.state.doc,Z=$.toString();r(Z,W)}a&&a(Mun(W))}),z=Pun({theme:u,editable:b,readOnly:w,placeholder:v,indentWithTab:O,basicSetup:k}),H=[V,U,...z];return i&&typeof i=="function"&&H.push(gt.updateListener.of(i)),H=H.concat(o),x.useLayoutEffect(()=>{if(T&&!P){var W={doc:t,selection:n,extensions:H},$=C?Mr.fromJSON(C.json,W,C.fields):Mr.create(W);if(M($),!A){var Z=new gt({state:$,parent:T,root:_});I(Z),s&&s(Z,$)}}return()=>{A&&(M(void 0),I(void 0))}},[T,P]),x.useEffect(()=>{e.container&&j(e.container)},[e.container]),x.useEffect(()=>()=>{A&&(A.destroy(),I(void 0)),F.current&&(F.current.cancel(),F.current=null)},[A]),x.useEffect(()=>{c&&A&&A.focus()},[c,A]),x.useEffect(()=>{A&&A.dispatch({effects:Xn.reconfigure.of(H)})},[u,o,d,f,p,h,m,g,v,b,w,O,k,r,i]),x.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:[G_e.of(!0)]})};$?D.current=Z:Z()}}},[t,A]),{state:P,setState:M,view:A,setView:I,container:T,setContainer:j}}var Bun=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],ku=x.forwardRef((e,t)=>{var{className:n,value:r="",selection:a,extensions:s=[],onChange:i,onStatistics:o,onCreateEditor:c,onUpdate:u,autoFocus:d,theme:f="light",height:p,minHeight:h,maxHeight:m,width:g,minWidth:v,maxWidth:b,basicSetup:w,placeholder:O,indentWithTab:k,editable:_,readOnly:C,root:T,initialState:j}=e,A=Gce(e,Bun),I=x.useRef(null),{state:P,view:M,container:F,setContainer:D}=zun({root:T,value:r,autoFocus:d,theme:f,height:p,minHeight:h,maxHeight:m,width:g,minWidth:v,maxWidth:b,basicSetup:w,placeholder:O,indentWithTab:k,editable:_,readOnly:C,selection:a,onChange:i,onStatistics:o,onCreateEditor:c,onUpdate:u,extensions:s,initialState:j});x.useImperativeHandle(t,()=>({editor:I.current,state:P,view:M}),[I,F,P,M]);var U=x.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 V=typeof f=="string"?"cm-theme-"+f:"cm-theme";return l.jsx("div",gb({ref:U,className:""+V+(n?" "+n:"")},A))});ku.displayName="CodeMirror";function Uun(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 qun=e=>{switch(e){case"success":return Qun;case"info":return Gun;case"warning":return Wun;case"error":return Zun;default:return null}},Vun=Array(12).fill(0),Hun=({visible:e,className:t})=>Ce.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Ce.createElement("div",{className:"sonner-spinner"},Vun.map((n,r)=>Ce.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Qun=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.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"})),Wun=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Ce.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"})),Gun=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.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"})),Zun=Ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Ce.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"})),Yun=Ce.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"},Ce.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Ce.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Xun=()=>{const[e,t]=Ce.useState(document.hidden);return Ce.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let Gne=1;class Kun{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:Gne++,i=this.toasts.find(c=>c.id===s),o=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:o,title:r}):c):this.addToast({title:r,...a,dismissible:o,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 o=a.then(async u=>{if(i=["resolve",u],Ce.isValidElement(u))s=!1,this.create({id:r,type:"default",message:u});else if(edn(u)&&!u.ok){s=!1;const f=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,p=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,m=typeof f=="object"&&!Ce.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:p,...m})}else if(u instanceof Error){s=!1;const f=typeof n.error=="function"?await n.error(u):n.error,p=typeof n.description=="function"?await n.description(u):n.description,m=typeof f=="object"&&!Ce.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:p,...m})}else if(n.success!==void 0){s=!1;const f=typeof n.success=="function"?await n.success(u):n.success,p=typeof n.description=="function"?await n.description(u):n.description,m=typeof f=="object"&&!Ce.isValidElement(f)?f:{message:f};this.create({id:r,type:"success",description:p,...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,h=typeof d=="object"&&!Ce.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:f,...h})}}).finally(()=>{s&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((u,d)=>o.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||Gne++;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 Zc=new Kun,Jun=(e,t)=>{const n=t?.id||Gne++;return Zc.addToast({title:e,...t,id:n}),n},edn=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",tdn=Jun,ndn=()=>Zc.toasts,rdn=()=>Zc.getActiveToasts(),Hl=Object.assign(tdn,{success:Zc.success,info:Zc.info,warning:Zc.warning,error:Zc.error,custom:Zc.custom,message:Zc.message,promise:Zc.promise,dismiss:Zc.dismiss,loading:Zc.loading},{getHistory:ndn,getToasts:rdn});Uun("[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 VM(e){return e.label!==void 0}const adn=3,sdn="24px",idn="16px",Z_e=4e3,odn=356,ldn=14,cdn=45,udn=200;function gh(...e){return e.filter(Boolean).join(" ")}function ddn(e){const[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}const fdn=e=>{var t,n,r,a,s,i,o,c,u;const{invert:d,toast:f,unstyled:p,interacting:h,setHeights:m,visibleToasts:g,heights:v,index:b,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:V,icons:z,closeButtonAriaLabel:H="Close toast"}=e,[W,$]=Ce.useState(null),[Z,B]=Ce.useState(null),[R,Q]=Ce.useState(!1),[G,J]=Ce.useState(!1),[re,ne]=Ce.useState(!1),[se,le]=Ce.useState(!1),[me,K]=Ce.useState(!1),[ae,oe]=Ce.useState(0),[ve,de]=Ce.useState(0),ue=Ce.useRef(f.duration||M||Z_e),be=Ce.useRef(null),ce=Ce.useRef(null),we=b===0,ee=b+1<=g,X=f.type,pe=f.dismissible!==!1,Se=f.className||"",je=f.descriptionClassName||"",fe=Ce.useMemo(()=>v.findIndex(et=>et.toastId===f.id)||0,[v,f.id]),ke=Ce.useMemo(()=>{var et;return(et=f.closeButton)!=null?et:C},[f.closeButton,C]),Ie=Ce.useMemo(()=>f.duration||M||Z_e,[f.duration,M]),Me=Ce.useRef(0),tt=Ce.useRef(0),kt=Ce.useRef(0),Gt=Ce.useRef(null),[xn,Tn]=F.split("-"),zt=Ce.useMemo(()=>v.reduce((et,Zt,An)=>An>=fe?et:et+Zt.height,0),[v,fe]),rt=Xun(),Ge=f.invert||d,Ze=X==="loading";tt.current=Ce.useMemo(()=>fe*D+zt,[fe,zt]),Ce.useEffect(()=>{ue.current=Ie},[Ie]),Ce.useEffect(()=>{Q(!0)},[]),Ce.useEffect(()=>{const et=ce.current;if(et){const Zt=et.getBoundingClientRect().height;return de(Zt),m(An=>[{toastId:f.id,height:Zt,position:f.position},...An]),()=>m(An=>An.filter(rn=>rn.toastId!==f.id))}},[m,f.id]),Ce.useLayoutEffect(()=>{if(!R)return;const et=ce.current,Zt=et.style.height;et.style.height="auto";const An=et.getBoundingClientRect().height;et.style.height=Zt,de(An),m(rn=>rn.find(In=>In.toastId===f.id)?rn.map(In=>In.toastId===f.id?{...In,height:An}:In):[{toastId:f.id,height:An,position:f.position},...rn])},[R,f.title,f.description,m,f.id,f.jsx,f.action,f.cancel]);const Ke=Ce.useCallback(()=>{J(!0),oe(tt.current),m(et=>et.filter(Zt=>Zt.toastId!==f.id)),setTimeout(()=>{k(f)},udn)},[f,k,m,tt]);Ce.useEffect(()=>{if(f.promise&&X==="loading"||f.duration===1/0||f.type==="loading")return;let et;return O||h||rt?(()=>{if(kt.current<Me.current){const rn=new Date().getTime()-Me.current;ue.current=ue.current-rn}kt.current=new Date().getTime()})():ue.current!==1/0&&(Me.current=new Date().getTime(),et=setTimeout(()=>{f.onAutoClose==null||f.onAutoClose.call(f,f),Ke()},ue.current)),()=>clearTimeout(et)},[O,h,f,X,rt,Ke]),Ce.useEffect(()=>{f.delete&&(Ke(),f.onDismiss==null||f.onDismiss.call(f,f))},[Ke,f.delete]);function yt(){var et;if(z?.loading){var Zt;return Ce.createElement("div",{className:gh(V?.loader,f==null||(Zt=f.classNames)==null?void 0:Zt.loader,"sonner-loader"),"data-visible":X==="loading"},z.loading)}return Ce.createElement(Hun,{className:gh(V?.loader,f==null||(et=f.classNames)==null?void 0:et.loader),visible:X==="loading"})}const ot=f.icon||z?.[X]||qun(X);var Mn,Qn;return Ce.createElement("li",{tabIndex:0,ref:ce,className:gh(I,Se,V?.toast,f==null||(t=f.classNames)==null?void 0:t.toast,V?.default,V?.[X],f==null||(n=f.classNames)==null?void 0:n[X]),"data-sonner-toast":"","data-rich-colors":(Mn=f.richColors)!=null?Mn:_,"data-styled":!(f.jsx||f.unstyled||p),"data-mounted":R,"data-promise":!!f.promise,"data-swiped":me,"data-removed":G,"data-visible":ee,"data-y-position":xn,"data-x-position":Tn,"data-index":b,"data-front":we,"data-swiping":re,"data-dismissible":pe,"data-type":X,"data-invert":Ge,"data-swipe-out":se,"data-swipe-direction":Z,"data-expanded":!!(O||U&&R),"data-testid":f.testId,style:{"--index":b,"--toasts-before":b,"--z-index":w.length-b,"--offset":`${G?ae:tt.current}px`,"--initial-height":U?"auto":`${ve}px`,...T,...f.style},onDragEnd:()=>{ne(!1),$(null),Gt.current=null},onPointerDown:et=>{et.button!==2&&(Ze||!pe||(be.current=new Date,oe(tt.current),et.target.setPointerCapture(et.pointerId),et.target.tagName!=="BUTTON"&&(ne(!0),Gt.current={x:et.clientX,y:et.clientY})))},onPointerUp:()=>{var et,Zt,An;if(se||!pe)return;Gt.current=null;const rn=Number(((et=ce.current)==null?void 0:et.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Cr=Number(((Zt=ce.current)==null?void 0:Zt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),In=new Date().getTime()-((An=be.current)==null?void 0:An.getTime()),jt=W==="x"?rn:Cr,mr=Math.abs(jt)/In;if(Math.abs(jt)>=cdn||mr>.11){oe(tt.current),f.onDismiss==null||f.onDismiss.call(f,f),B(W==="x"?rn>0?"right":"left":Cr>0?"down":"up"),Ke(),le(!0);return}else{var wn,Oe;(wn=ce.current)==null||wn.style.setProperty("--swipe-amount-x","0px"),(Oe=ce.current)==null||Oe.style.setProperty("--swipe-amount-y","0px")}K(!1),ne(!1),$(null)},onPointerMove:et=>{var Zt,An,rn;if(!Gt.current||!pe||((Zt=window.getSelection())==null?void 0:Zt.toString().length)>0)return;const In=et.clientY-Gt.current.y,jt=et.clientX-Gt.current.x;var mr;const wn=(mr=e.swipeDirections)!=null?mr:ddn(F);!W&&(Math.abs(jt)>1||Math.abs(In)>1)&&$(Math.abs(jt)>Math.abs(In)?"x":"y");let Oe={x:0,y:0};const Ne=Pe=>1/(1.5+Math.abs(Pe)/20);if(W==="y"){if(wn.includes("top")||wn.includes("bottom"))if(wn.includes("top")&&In<0||wn.includes("bottom")&&In>0)Oe.y=In;else{const Pe=In*Ne(In);Oe.y=Math.abs(Pe)<Math.abs(In)?Pe:In}}else if(W==="x"&&(wn.includes("left")||wn.includes("right")))if(wn.includes("left")&&jt<0||wn.includes("right")&&jt>0)Oe.x=jt;else{const Pe=jt*Ne(jt);Oe.x=Math.abs(Pe)<Math.abs(jt)?Pe:jt}(Math.abs(Oe.x)>0||Math.abs(Oe.y)>0)&&K(!0),(An=ce.current)==null||An.style.setProperty("--swipe-amount-x",`${Oe.x}px`),(rn=ce.current)==null||rn.style.setProperty("--swipe-amount-y",`${Oe.y}px`)}},ke&&!f.jsx&&X!=="loading"?Ce.createElement("button",{"aria-label":H,"data-disabled":Ze,"data-close-button":!0,onClick:Ze||!pe?()=>{}:()=>{Ke(),f.onDismiss==null||f.onDismiss.call(f,f)},className:gh(V?.closeButton,f==null||(r=f.classNames)==null?void 0:r.closeButton)},(Qn=z?.close)!=null?Qn:Yun):null,(X||f.icon||f.promise)&&f.icon!==null&&(z?.[X]!==null||f.icon)?Ce.createElement("div",{"data-icon":"",className:gh(V?.icon,f==null||(a=f.classNames)==null?void 0:a.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||yt():null,f.type!=="loading"?ot:null):null,Ce.createElement("div",{"data-content":"",className:gh(V?.content,f==null||(s=f.classNames)==null?void 0:s.content)},Ce.createElement("div",{"data-title":"",className:gh(V?.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?Ce.createElement("div",{"data-description":"",className:gh(P,je,V?.description,f==null||(o=f.classNames)==null?void 0:o.description)},typeof f.description=="function"?f.description():f.description):null),Ce.isValidElement(f.cancel)?f.cancel:f.cancel&&VM(f.cancel)?Ce.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||j,onClick:et=>{VM(f.cancel)&&pe&&(f.cancel.onClick==null||f.cancel.onClick.call(f.cancel,et),Ke())},className:gh(V?.cancelButton,f==null||(c=f.classNames)==null?void 0:c.cancelButton)},f.cancel.label):null,Ce.isValidElement(f.action)?f.action:f.action&&VM(f.action)?Ce.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||A,onClick:et=>{VM(f.action)&&(f.action.onClick==null||f.action.onClick.call(f.action,et),!et.defaultPrevented&&Ke())},className:gh(V?.actionButton,f==null||(u=f.classNames)==null?void 0:u.actionButton)},f.action.label):null)};function Y_e(){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 pdn(e,t){const n={};return[e,t].forEach((r,a)=>{const s=a===1,i=s?"--mobile-offset":"--offset",o=s?idn:sdn;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}`]=o:n[`${i}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):c(o)}),n}const gst=Ce.forwardRef(function(t,n){const{id:r,invert:a,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:o,closeButton:c,className:u,offset:d,mobileOffset:f,theme:p="light",richColors:h,duration:m,style:g,visibleToasts:v=adn,toastOptions:b,dir:w=Y_e(),gap:O=ldn,icons:k,containerAriaLabel:_="Notifications"}=t,[C,T]=Ce.useState([]),j=Ce.useMemo(()=>r?C.filter(R=>R.toasterId===r):C.filter(R=>!R.toasterId),[C,r]),A=Ce.useMemo(()=>Array.from(new Set([s].concat(j.filter(R=>R.position).map(R=>R.position)))),[j,s]),[I,P]=Ce.useState([]),[M,F]=Ce.useState(!1),[D,U]=Ce.useState(!1),[V,z]=Ce.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=Ce.useRef(null),W=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=Ce.useRef(null),Z=Ce.useRef(!1),B=Ce.useCallback(R=>{T(Q=>{var G;return(G=Q.find(J=>J.id===R.id))!=null&&G.delete||Zc.dismiss(R.id),Q.filter(({id:J})=>J!==R.id)})},[]);return Ce.useEffect(()=>Zc.subscribe(R=>{if(R.dismiss){requestAnimationFrame(()=>{T(Q=>Q.map(G=>G.id===R.id?{...G,delete:!0}:G))});return}setTimeout(()=>{jle.flushSync(()=>{T(Q=>{const G=Q.findIndex(J=>J.id===R.id);return G!==-1?[...Q.slice(0,G),{...Q[G],...R},...Q.slice(G+1)]:[R,...Q]})})})}),[C]),Ce.useEffect(()=>{if(p!=="system"){z(p);return}if(p==="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:Q})=>{z(Q?"dark":"light")})}catch{R.addListener(({matches:G})=>{try{z(G?"dark":"light")}catch(J){console.error(J)}})}},[p]),Ce.useEffect(()=>{C.length<=1&&F(!1)},[C]),Ce.useEffect(()=>{const R=Q=>{var G;if(i.every(ne=>Q[ne]||Q.code===ne)){var re;F(!0),(re=H.current)==null||re.focus()}Q.code==="Escape"&&(document.activeElement===H.current||(G=H.current)!=null&&G.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[i]),Ce.useEffect(()=>{if(H.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,Z.current=!1)}},[H.current]),Ce.createElement("section",{ref:n,"aria-label":`${_} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((R,Q)=>{var G;const[J,re]=R.split("-");return j.length?Ce.createElement("ol",{key:R,dir:w==="auto"?Y_e():w,tabIndex:-1,ref:H,className:u,"data-sonner-toaster":!0,"data-sonner-theme":V,"data-y-position":J,"data-x-position":re,style:{"--front-toast-height":`${((G=I[0])==null?void 0:G.height)||0}px`,"--width":`${odn}px`,"--gap":`${O}px`,...g,...pdn(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&&Q===0||ne.position===R).map((ne,se)=>{var le,me;return Ce.createElement(fdn,{key:ne.id,icons:k,index:se,toast:ne,defaultRichColors:h,duration:(le=b?.duration)!=null?le:m,className:b?.className,descriptionClassName:b?.descriptionClassName,invert:a,visibleToasts:v,closeButton:(me=b?.closeButton)!=null?me:c,interacting:D,position:R,style:b?.style,unstyled:b?.unstyled,classNames:b?.classNames,cancelButtonStyle:b?.cancelButtonStyle,actionButtonStyle:b?.actionButtonStyle,closeButtonAriaLabel:b?.closeButtonAriaLabel,removeToast:B,toasts:j.filter(K=>K.position==ne.position),heights:I.filter(K=>K.position==ne.position),setHeights:P,expandByDefault:o,gap:O,expanded:M,swipeDirections:t.swipeDirections})})):null}))});function hdn(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mdn(e,t,n){const a=F6((n||{}).ignore||[]),s=gdn(t);let i=-1;for(;++i<s.length;)Let(e,"text",o);function o(u,d){let f=-1,p;for(;++f<d.length;){const h=d[f],m=p?p.children:void 0;if(a(h,m?m.indexOf(h):void 0,p))return;p=h}if(p)return c(u,d)}function c(u,d){const f=d[d.length-1],p=s[i][0],h=s[i][1];let m=0;const v=f.children.indexOf(u);let b=!1,w=[];p.lastIndex=0;let O=p.exec(u.value);for(;O;){const k=O.index,_={index:O.index,input:O.input,stack:[...d,u]};let C=h(...O,_);if(typeof C=="string"&&(C=C.length>0?{type:"text",value:C}:void 0),C===!1?p.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,b=!0),!p.global)break;O=p.exec(u.value)}return b?(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 gdn(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([vdn(a[0]),ydn(a[1])])}return t}function vdn(e){return typeof e=="string"?new RegExp(hdn(e),"g"):e}function ydn(e){return typeof e=="function"?e:function(){return e}}const _U="phrasing",EU=["autolink","link","image","label"];function bdn(){return{transforms:[Edn],enter:{literalAutolink:wdn,literalAutolinkEmail:CU,literalAutolinkHttp:CU,literalAutolinkWww:CU},exit:{literalAutolink:_dn,literalAutolinkEmail:kdn,literalAutolinkHttp:Sdn,literalAutolinkWww:Odn}}}function xdn(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:_U,notInConstruct:EU},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:_U,notInConstruct:EU},{character:":",before:"[ps]",after:"\\/",inConstruct:_U,notInConstruct:EU}]}}function wdn(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function CU(e){this.config.enter.autolinkProtocol.call(this,e)}function Sdn(e){this.config.exit.autolinkProtocol.call(this,e)}function Odn(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 kdn(e){this.config.exit.autolinkEmail.call(this,e)}function _dn(e){this.exit(e)}function Edn(e){mdn(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Cdn],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),jdn]],{ignore:["link","linkReference"]})}function Cdn(e,t,n,r,a){let s="";if(!vst(a)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!Tdn(n)))return!1;const i=Ndn(n+r);if(!i[0])return!1;const o={type:"link",title:null,url:s+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[o,{type:"text",value:i[1]}]:o}function jdn(e,t,n,r){return!vst(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Tdn(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 Ndn(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=LSe(e,"(");let s=LSe(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 vst(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||V0(n)||D6(n))&&(!t||n!==47)}yst.peek=Fdn;function Adn(){this.buffer()}function Idn(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Rdn(){this.buffer()}function Pdn(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Mdn(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Np(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ddn(e){this.exit(e)}function $dn(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Np(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ldn(e){this.exit(e)}function Fdn(){return"["}function yst(e,t,n,r){const a=n.createTracker(r);let s=a.move("[^");const i=n.enter("footnoteReference"),o=n.enter("reference");return s+=a.move(n.safe(n.associationId(e),{after:"]",before:s})),o(),i(),s+=a.move("]"),s}function zdn(){return{enter:{gfmFootnoteCallString:Adn,gfmFootnoteCall:Idn,gfmFootnoteDefinitionLabelString:Rdn,gfmFootnoteDefinition:Pdn},exit:{gfmFootnoteCallString:Mdn,gfmFootnoteCall:Ddn,gfmFootnoteDefinitionLabelString:$dn,gfmFootnoteDefinition:Ldn}}}function Bdn(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:yst},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,s,i){const o=s.createTracker(i);let c=o.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return c+=o.move(s.safe(s.associationId(r),{before:c,after:"]"})),d(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((t?`
217
217
  `:" ")+s.indentLines(s.containerFlow(r,o.current()),t?bst:Udn))),u(),c}}function Udn(e,t,n){return t===0?e:bst(e,t,n)}function bst(e,t,n){return(n?"":" ")+e}const qdn=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];xst.peek=Gdn;function Vdn(){return{canContainEols:["delete"],enter:{strikethrough:Qdn},exit:{strikethrough:Wdn}}}function Hdn(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:qdn}],handlers:{delete:xst}}}function Qdn(e){this.enter({type:"delete",children:[]},e)}function Wdn(e){this.exit(e)}function xst(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 Gdn(){return"~"}function Zdn(e){return e.length}function Ydn(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||Zdn,s=[],i=[],o=[],c=[];let u=0,d=-1;for(;++d<e.length;){const g=[],v=[];let b=-1;for(e[d].length>u&&(u=e[d].length);++b<e[d].length;){const w=Xdn(e[d][b]);if(n.alignDelimiters!==!1){const O=a(w);v[b]=O,(c[b]===void 0||O>c[b])&&(c[b]=O)}g.push(w)}i[d]=g,o[d]=v}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)s[f]=X_e(r[f]);else{const g=X_e(r);for(;++f<u;)s[f]=g}f=-1;const p=[],h=[];for(;++f<u;){const g=s[f];let v="",b="";g===99?(v=":",b=":"):g===108?v=":":g===114&&(b=":");let w=n.alignDelimiters===!1?1:Math.max(1,c[f]-v.length-b.length);const O=v+"-".repeat(w)+b;n.alignDelimiters!==!1&&(w=v.length+w+b.length,w>c[f]&&(c[f]=w),h[f]=w),p[f]=O}i.splice(1,0,p),o.splice(1,0,h),d=-1;const m=[];for(;++d<i.length;){const g=i[d],v=o[d];f=-1;const b=[];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&&b.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||f)&&b.push(" "),n.alignDelimiters!==!1&&b.push(O),b.push(w),n.alignDelimiters!==!1&&b.push(k),n.padding!==!1&&b.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&b.push("|")}m.push(n.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return m.join(`
218
218
  `)}function Xdn(e){return e==null?"":String(e)}function X_e(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 Kdn(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()),Jdn);return a(),i}function Jdn(e,t,n){return">"+(n?"":" ")+e}function efn(e,t){return K_e(e,t.inConstruct,!0)&&!K_e(e,t.notInConstruct,!1)}function K_e(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 J_e(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,B,R){if(typeof Z!="string")throw new Error("Input must be a string");var Q=Z.length,G=A.length,J=I.length,re=P.length,ne=T(M),se=[],le=[],me=[],K=W=0;if(!Z)return Se();if(D||D!==!1&&Z.indexOf(z)===-1){for(var ae=Z.split(I),oe=0;oe<ae.length;oe++){if(me=ae[oe],W+=me.length,oe!==ae.length-1)W+=I.length;else if(R)return Se();if(!P||me.substring(0,re)!==P){if(ne){if(se=[],we(me.split(A)),je(),$)return Se()}else we(me.split(A));if(F&&F<=oe)return se=se.slice(0,F),Se(!0)}}return Se()}for(var ve=Z.indexOf(A,W),de=Z.indexOf(I,W),ue=new RegExp(v(H)+v(z),"g"),be=Z.indexOf(z,W);;)if(Z[W]===z)for(be=W,W++;;){if((be=Z.indexOf(z,be+1))===-1)return R||le.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:se.length,index:W}),X();if(be===Q-1)return X(Z.substring(W,be).replace(ue,z));if(z===H&&Z[be+1]===H)be++;else if(z===H||be===0||Z[be-1]!==H){ve!==-1&&ve<be+1&&(ve=Z.indexOf(A,be+1));var ce=ee((de=de!==-1&&de<be+1?Z.indexOf(I,be+1):de)===-1?ve:Math.min(ve,de));if(Z.substr(be+1+ce,G)===A){me.push(Z.substring(W,be).replace(ue,z)),Z[W=be+1+ce+G]!==z&&(be=Z.indexOf(z,W)),ve=Z.indexOf(A,W),de=Z.indexOf(I,W);break}if(ce=ee(de),Z.substring(be+1+ce,be+1+ce+J)===I){if(me.push(Z.substring(W,be).replace(ue,z)),pe(be+1+ce+J),ve=Z.indexOf(A,W),be=Z.indexOf(z,W),ne&&(je(),$))return Se();if(F&&se.length>=F)return Se(!0);break}le.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:se.length,index:W}),be++}}else if(P&&me.length===0&&Z.substring(W,W+re)===P){if(de===-1)return Se();W=de+J,de=Z.indexOf(I,W),ve=Z.indexOf(A,W)}else if(ve!==-1&&(ve<de||de===-1))me.push(Z.substring(W,ve)),W=ve+G,ve=Z.indexOf(A,W);else{if(de===-1)break;if(me.push(Z.substring(W,de)),pe(de+J),ne&&(je(),$))return Se();if(F&&se.length>=F)return Se(!0)}return X();function we(fe){se.push(fe),K=W}function ee(fe){var ke=0;return ke=fe!==-1&&(fe=Z.substring(be+1,fe))&&fe.trim()===""?fe.length:ke}function X(fe){return R||(fe===void 0&&(fe=Z.substring(W)),me.push(fe),W=Q,we(me),ne&&je()),Se()}function pe(fe){W=fe,we(me),me=[],de=Z.indexOf(I,W)}function Se(fe){if(j.header&&!B&&se.length&&!V){var ke=se[0],Ie=Object.create(null),Me=new Set(ke);let tt=!1;for(let kt=0;kt<ke.length;kt++){let Gt=ke[kt];if(Ie[Gt=T(j.transformHeader)?j.transformHeader(Gt,kt):Gt]){let xn,Tn=Ie[Gt];for(;xn=Gt+"_"+Tn,Tn++,Me.has(xn););Me.add(xn),ke[kt]=xn,Ie[Gt]++,tt=!0,(U=U===null?{}:U)[xn]=Gt}else Ie[Gt]=1,ke[kt]=Gt;Me.add(Gt)}tt&&console.warn("Duplicate headers found and renamed."),V=!0}return{data:se,errors:le,meta:{delimiter:A,linebreak:I,aborted:$,truncated:!!fe,cursor:K+(B||0),renamedHeaders:U}}}function je(){M(Se()),se=[],le=[]}},this.abort=function(){$=!0},this.getCharIndex=function(){return W}}function w(j){var A=j.data,I=o[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=o[j];T(I.userComplete)&&I.userComplete(A),I.terminate(),delete o[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:h)(A)):j.readable===!0&&T(j.read)&&T(j.on)?I=new m(A):(r.File&&j instanceof File||j instanceof Object)&&(I=new p(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++,o[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,V=!1,z=null,H=!1,W=((()=>{if(typeof A=="object"){if(typeof A.delimiter!="string"||u.BAD_DELIMITERS.filter(function(B){return A.delimiter.indexOf(B)!==-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"||(V=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?H=A.escapeFormulae:typeof A.escapeFormulae=="boolean"&&A.escapeFormulae&&(H=/^[=+\-@\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,V);if(typeof j[0]=="object")return $(z||Object.keys(j[0]),j,V)}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||[],V);throw new Error("Unable to serialize unrecognized input");function $(B,R,Q){var G="",J=(typeof B=="string"&&(B=JSON.parse(B)),typeof R=="string"&&(R=JSON.parse(R)),Array.isArray(B)&&0<B.length),re=!Array.isArray(R[0]);if(J&&P){for(var ne=0;ne<B.length;ne++)0<ne&&(G+=M),G+=Z(B[ne],ne);0<R.length&&(G+=F)}for(var se=0;se<R.length;se++){var le=(J?B:R[se]).length,me=!1,K=J?Object.keys(R[se]).length===0:R[se].length===0;if(Q&&!J&&(me=Q==="greedy"?R[se].join("").trim()==="":R[se].length===1&&R[se][0].length===0),Q==="greedy"&&J){for(var ae=[],oe=0;oe<le;oe++){var ve=re?B[oe]:oe;ae.push(R[se][ve])}me=ae.join("").trim()===""}if(!me){for(var de=0;de<le;de++){0<de&&!K&&(G+=M);var ue=J&&re?B[de]:de;G+=Z(R[se][ue],de)}se<R.length-1&&(!Q||0<le&&!K)&&(G+=F)}}return G}function Z(B,R){var Q,G;return B==null?"":B.constructor===Date?JSON.stringify(B).slice(1,25):(G=!1,H&&typeof B=="string"&&H.test(B)&&(B="'"+B,G=!0),Q=B.toString().replace(W,U),(G=G||I===!0||typeof I=="function"&&I(B,R)||Array.isArray(I)&&I[R]||((J,re)=>{for(var ne=0;ne<re.length;ne++)if(-1<J.indexOf(re[ne]))return!0;return!1})(Q,u.BAD_DELIMITERS)||-1<Q.indexOf(M)||Q.charAt(0)===" "||Q.charAt(Q.length-1)===" ")?D+Q+D:Q)}},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=b,u.ParserHandle=g,u.NetworkStreamer=f,u.FileStreamer=p,u.StringStreamer=h,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,V,z=I[0];if(T(j.before)){var H=j.before(z.file,z.inputElem);if(typeof H=="object"){if(H.action==="abort")return F="AbortError",D=z.file,U=z.inputElem,V=H.reason,void(T(j.error)&&j.error({name:F},D,U,V));if(H.action==="skip")return void M();typeof H.config=="object"&&(z.instanceConfig=a.extend(z.instanceConfig,H.config))}else if(H==="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,(p.prototype=Object.create(d.prototype)).constructor=p,(h.prototype=Object.create(h.prototype)).constructor=h,(m.prototype=Object.create(d.prototype)).constructor=m,u})})(G2)),G2.exports}var yer=ver();const nyt=fo(yer);var l5e=1,ber=.9,xer=.8,wer=.17,oJ=.1,lJ=.999,Ser=.9999,Oer=.99,ker=/[\\\/_+.#"@\[\(\{&]/,_er=/[\\\/_+.#"@\[\(\{&]/g,Eer=/[\s-]/,ryt=/[\s-]/g;function Vae(e,t,n,r,a,s,i){if(s===t.length)return a===e.length?l5e:Oer;var o=`${a},${s}`;if(i[o]!==void 0)return i[o];for(var c=r.charAt(s),u=n.indexOf(c,a),d=0,f,p,h,m;u>=0;)f=Vae(e,t,n,r,u+1,s+1,i),f>d&&(u===a?f*=l5e:ker.test(e.charAt(u-1))?(f*=xer,h=e.slice(a,u-1).match(_er),h&&a>0&&(f*=Math.pow(lJ,h.length))):Eer.test(e.charAt(u-1))?(f*=ber,m=e.slice(a,u-1).match(ryt),m&&a>0&&(f*=Math.pow(lJ,m.length))):(f*=wer,a>0&&(f*=Math.pow(lJ,u-a))),e.charAt(u)!==t.charAt(s)&&(f*=Ser)),(f<oJ&&n.charAt(u-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(u-1)!==r.charAt(s))&&(p=Vae(e,t,n,r,u+1,s+2,i),p*oJ>f&&(f=p*oJ)),f>d&&(d=f),u=n.indexOf(c,u+1);return i[o]=d,d}function c5e(e){return e.toLowerCase().replace(ryt," ")}function Cer(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Vae(e,t,c5e(e),c5e(t),0,0,{})}var TC='[cmdk-group=""]',cJ='[cmdk-group-items=""]',jer='[cmdk-group-heading=""]',ayt='[cmdk-item=""]',u5e=`${ayt}:not([aria-disabled="true"])`,Hae="cmdk-item-select",C1="data-value",Ter=(e,t,n)=>Cer(e,t,n),syt=x.createContext(void 0),xR=()=>x.useContext(syt),iyt=x.createContext(void 0),$me=()=>x.useContext(iyt),oyt=x.createContext(void 0),lyt=x.forwardRef((e,t)=>{let n=j1(()=>{var B,R;return{search:"",value:(R=(B=e.value)!=null?B:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=j1(()=>new Set),a=j1(()=>new Map),s=j1(()=>new Map),i=j1(()=>new Set),o=cyt(e),{label:c,children:u,value:d,onValueChange:f,filter:p,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...b}=e,w=Qi(),O=Qi(),k=Qi(),_=x.useRef(null),C=zer();xw(()=>{if(d!==void 0){let B=d.trim();n.current.value=B,T.emit()}},[d]),xw(()=>{C(6,F)},[]);let T=x.useMemo(()=>({subscribe:B=>(i.current.add(B),()=>i.current.delete(B)),snapshot:()=>n.current,setState:(B,R,Q)=>{var G,J,re,ne;if(!Object.is(n.current[B],R)){if(n.current[B]=R,B==="search")M(),I(),C(1,P);else if(B==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(k);se?se.focus():(G=document.getElementById(w))==null||G.focus()}if(C(7,()=>{var se;n.current.selectedItemId=(se=D())==null?void 0:se.id,T.emit()}),Q||C(5,F),((J=o.current)==null?void 0:J.value)!==void 0){let se=R??"";(ne=(re=o.current).onValueChange)==null||ne.call(re,se);return}}T.emit()}},emit:()=>{i.current.forEach(B=>B())}}),[]),j=x.useMemo(()=>({value:(B,R,Q)=>{var G;R!==((G=s.current.get(B))==null?void 0:G.value)&&(s.current.set(B,{value:R,keywords:Q}),n.current.filtered.items.set(B,A(R,Q)),C(2,()=>{I(),T.emit()}))},item:(B,R)=>(r.current.add(B),R&&(a.current.has(R)?a.current.get(R).add(B):a.current.set(R,new Set([B]))),C(3,()=>{M(),I(),n.current.value||P(),T.emit()}),()=>{s.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let Q=D();C(4,()=>{M(),Q?.getAttribute("id")===B&&P(),T.emit()})}),group:B=>(a.current.has(B)||a.current.set(B,new Set),()=>{s.current.delete(B),a.current.delete(B)}),filter:()=>o.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:w,inputId:k,labelId:O,listInnerRef:_}),[]);function A(B,R){var Q,G;let J=(G=(Q=o.current)==null?void 0:Q.filter)!=null?G:Ter;return B?J(B,n.current.search,R):0}function I(){if(!n.current.search||o.current.shouldFilter===!1)return;let B=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(G=>{let J=a.current.get(G),re=0;J.forEach(ne=>{let se=B.get(ne);re=Math.max(se,re)}),R.push([G,re])});let Q=_.current;U().sort((G,J)=>{var re,ne;let se=G.getAttribute("id"),le=J.getAttribute("id");return((re=B.get(le))!=null?re:0)-((ne=B.get(se))!=null?ne:0)}).forEach(G=>{let J=G.closest(cJ);J?J.appendChild(G.parentElement===J?G:G.closest(`${cJ} > *`)):Q.appendChild(G.parentElement===Q?G:G.closest(`${cJ} > *`))}),R.sort((G,J)=>J[1]-G[1]).forEach(G=>{var J;let re=(J=_.current)==null?void 0:J.querySelector(`${TC}[${C1}="${encodeURIComponent(G[0])}"]`);re?.parentElement.appendChild(re)})}function P(){let B=U().find(Q=>Q.getAttribute("aria-disabled")!=="true"),R=B?.getAttribute(C1);T.setState("value",R||void 0)}function M(){var B,R,Q,G;if(!n.current.search||o.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let J=0;for(let re of r.current){let ne=(R=(B=s.current.get(re))==null?void 0:B.value)!=null?R:"",se=(G=(Q=s.current.get(re))==null?void 0:Q.keywords)!=null?G:[],le=A(ne,se);n.current.filtered.items.set(re,le),le>0&&J++}for(let[re,ne]of a.current)for(let se of ne)if(n.current.filtered.items.get(se)>0){n.current.filtered.groups.add(re);break}n.current.filtered.count=J}function F(){var B,R,Q;let G=D();G&&(((B=G.parentElement)==null?void 0:B.firstChild)===G&&((Q=(R=G.closest(TC))==null?void 0:R.querySelector(jer))==null||Q.scrollIntoView({block:"nearest"})),G.scrollIntoView({block:"nearest"}))}function D(){var B;return(B=_.current)==null?void 0:B.querySelector(`${ayt}[aria-selected="true"]`)}function U(){var B;return Array.from(((B=_.current)==null?void 0:B.querySelectorAll(u5e))||[])}function V(B){let R=U()[B];R&&T.setState("value",R.getAttribute(C1))}function z(B){var R;let Q=D(),G=U(),J=G.findIndex(ne=>ne===Q),re=G[J+B];(R=o.current)!=null&&R.loop&&(re=J+B<0?G[G.length-1]:J+B===G.length?G[0]:G[J+B]),re&&T.setState("value",re.getAttribute(C1))}function H(B){let R=D(),Q=R?.closest(TC),G;for(;Q&&!G;)Q=B>0?Ler(Q,TC):Fer(Q,TC),G=Q?.querySelector(u5e);G?T.setState("value",G.getAttribute(C1)):z(B)}let W=()=>V(U().length-1),$=B=>{B.preventDefault(),B.metaKey?W():B.altKey?H(1):z(1)},Z=B=>{B.preventDefault(),B.metaKey?V(0):B.altKey?H(-1):z(-1)};return x.createElement(po.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:B=>{var R;(R=b.onKeyDown)==null||R.call(b,B);let Q=B.nativeEvent.isComposing||B.keyCode===229;if(!(B.defaultPrevented||Q))switch(B.key){case"n":case"j":{v&&B.ctrlKey&&$(B);break}case"ArrowDown":{$(B);break}case"p":case"k":{v&&B.ctrlKey&&Z(B);break}case"ArrowUp":{Z(B);break}case"Home":{B.preventDefault(),V(0);break}case"End":{B.preventDefault(),W();break}case"Enter":{B.preventDefault();let G=D();if(G){let J=new Event(Hae);G.dispatchEvent(J)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:Uer},c),Bz(e,B=>x.createElement(iyt.Provider,{value:T},x.createElement(syt.Provider,{value:j},B))))}),Ner=x.forwardRef((e,t)=>{var n,r;let a=Qi(),s=x.useRef(null),i=x.useContext(oyt),o=xR(),c=cyt(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:i?.forceMount;xw(()=>{if(!u)return o.item(a,i?.id)},[u]);let d=uyt(a,s,[e.value,e.children,s],e.keywords),f=$me(),p=Cb(C=>C.value&&C.value===d.current),h=Cb(C=>u||o.filter()===!1?!0:C.search?C.filtered.items.get(a)>0:!0);x.useEffect(()=>{let C=s.current;if(!(!C||e.disabled))return C.addEventListener(Hae,m),()=>C.removeEventListener(Hae,m)},[h,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(!h)return null;let{disabled:v,value:b,onSelect:w,forceMount:O,keywords:k,..._}=e;return x.createElement(po.div,{ref:om(s,t),..._,id:a,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!p,"data-disabled":!!v,"data-selected":!!p,onPointerMove:v||o.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)}),Aer=x.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...s}=e,i=Qi(),o=x.useRef(null),c=x.useRef(null),u=Qi(),d=xR(),f=Cb(h=>a||d.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);xw(()=>d.group(i),[]),uyt(i,o,[e.value,e.heading,c]);let p=x.useMemo(()=>({id:i,forceMount:a}),[a]);return x.createElement(po.div,{ref:om(o,t),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&x.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Bz(e,h=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},x.createElement(oyt.Provider,{value:p},h))))}),Ier=x.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=x.useRef(null),s=Cb(i=>!i.search);return!n&&!s?null:x.createElement(po.div,{ref:om(a,t),...r,"cmdk-separator":"",role:"separator"})}),Rer=x.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,s=$me(),i=Cb(u=>u.search),o=Cb(u=>u.selectedItemId),c=xR();return x.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),x.createElement(po.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":o,id:c.inputId,type:"text",value:a?e.value:i,onChange:u=>{a||s.setState("search",u.target.value),n?.(u.target.value)}})}),Per=x.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,s=x.useRef(null),i=x.useRef(null),o=Cb(u=>u.selectedItemId),c=xR();return x.useEffect(()=>{if(i.current&&s.current){let u=i.current,d=s.current,f,p=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let h=u.offsetHeight;d.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return p.observe(u),()=>{cancelAnimationFrame(f),p.unobserve(u)}}},[]),x.createElement(po.div,{ref:om(s,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:c.listId},Bz(e,u=>x.createElement("div",{ref:om(i,c.listInnerRef),"cmdk-list-sizer":""},u)))}),Mer=x.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:s,container:i,...o}=e;return x.createElement(s6,{open:n,onOpenChange:r},x.createElement(i6,{container:i},x.createElement(uI,{"cmdk-overlay":"",className:a}),x.createElement(dI,{"aria-label":e.label,"cmdk-dialog":"",className:s},x.createElement(lyt,{ref:t,...o}))))}),Der=x.forwardRef((e,t)=>Cb(n=>n.filtered.count===0)?x.createElement(po.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),$er=x.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...s}=e;return x.createElement(po.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Bz(e,i=>x.createElement("div",{"aria-hidden":!0},i)))}),Ru=Object.assign(lyt,{List:Per,Item:Ner,Input:Rer,Group:Aer,Separator:Ier,Dialog:Mer,Empty:Der,Loading:$er});function Ler(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Fer(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function cyt(e){let t=x.useRef(e);return xw(()=>{t.current=e}),t}var xw=typeof window>"u"?x.useEffect:x.useLayoutEffect;function j1(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function Cb(e){let t=$me(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function uyt(e,t,n,r=[]){let a=x.useRef(),s=xR();return xw(()=>{var i;let o=(()=>{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,o,c),(i=t.current)==null||i.setAttribute(C1,o),a.current=o}),a}var zer=()=>{let[e,t]=x.useState(),n=j1(()=>new Map);return xw(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function Ber(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Bz({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(Ber(t),{ref:t.ref},n(t.props.children)):n(t)}var Uer={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};class ro{constructor(t,n,r,a){this.fromA=t,this.toA=n,this.fromB=r,this.toB=a}offset(t,n=t){return new ro(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}}function ww(e,t,n,r,a,s){if(e==r)return[];let i=Fme(e,t,n,r,a,s),o=zme(e,t+i,n,r,a+i,s);t+=i,n-=o,a+=i,s-=o;let c=n-t,u=s-a;if(!c||!u)return[new ro(t,n,a,s)];if(c>u){let f=e.slice(t,n).indexOf(r.slice(a,s));if(f>-1)return[new ro(t,t+f,a,a),new ro(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 ro(t,t,a,a+f),new ro(n,n,a+f+c,s)]}if(c==1||u==1)return[new ro(t,n,a,s)];let d=pyt(e,t,n,r,a,s);if(d){let[f,p,h]=d;return ww(e,t,f,r,a,p).concat(ww(e,f+h,n,r,p+h,s))}return qer(e,t,n,r,a,s)}let dj=1e9,fj=0,Lme=!1;function qer(e,t,n,r,a,s){let i=n-t,o=s-a;if(dj<1e9&&Math.min(i,o)>dj*16||fj>0&&Date.now()>fj)return Math.min(i,o)>dj*64?[new ro(t,n,a,s)]:d5e(e,t,n,r,a,s);let c=Math.ceil((i+o)/2);uJ.reset(c),dJ.reset(c);let u=(h,m)=>e.charCodeAt(t+h)==r.charCodeAt(a+m),d=(h,m)=>e.charCodeAt(n-h-1)==r.charCodeAt(s-m-1),f=(i-o)%2!=0?dJ:null,p=f?null:uJ;for(let h=0;h<c;h++){if(h>dj||fj>0&&!(h&63)&&Date.now()>fj)return d5e(e,t,n,r,a,s);let m=uJ.advance(h,i,o,c,f,!1,u)||dJ.advance(h,i,o,c,p,!0,d);if(m)return Ver(e,t,n,t+m[0],r,a,s,a+m[1])}return[new ro(t,n,a,s)]}class dyt{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,o){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&&o(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 p=a+(n-r)-c;if(p>=0&&p<this.len&&s.vec[p]!=-1)if(i){let h=s.vec[p];if(h>=n-d)return[h,a+h-p]}else{let h=n-s.vec[p];if(d>=h)return[d,f]}}}return null}}const uJ=new dyt,dJ=new dyt;function Ver(e,t,n,r,a,s,i,o){let c=!1;return!Fk(e,r)&&++r==n&&(c=!0),!Fk(a,o)&&++o==i&&(c=!0),c?[new ro(t,n,s,i)]:ww(e,t,r,a,s,o).concat(ww(e,r,n,a,o,i))}function fyt(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n=n<<1;return n}function Fme(e,t,n,r,a,s){if(t==n||t==s||e.charCodeAt(t)!=r.charCodeAt(a))return 0;let i=fyt(n-t,s-a);for(let o=t,c=a;;){let u=o+i,d=c+i;if(u>n||d>s||e.slice(o,u)!=r.slice(c,d)){if(i==1)return o-t-(Fk(e,o)?0:1);i=i>>1}else{if(u==n||d==s)return u-t;o=u,c=d}}}function zme(e,t,n,r,a,s){if(t==n||a==s||e.charCodeAt(n-1)!=r.charCodeAt(s-1))return 0;let i=fyt(n-t,s-a);for(let o=n,c=s;;){let u=o-i,d=c-i;if(u<t||d<a||e.slice(u,o)!=r.slice(d,c)){if(i==1)return n-o-(Fk(e,o)?0:1);i=i>>1}else{if(u==t||d==a)return n-u;o=u,c=d}}}function Qae(e,t,n,r,a,s,i,o){let c=r.slice(a,s),u=null;for(;;){if(u||i<o)return u;for(let d=t+i;;){Fk(e,d)||d++;let f=d+i;if(Fk(e,f)||(f+=f==d+1?1:-1),f>=n)break;let p=e.slice(d,f),h=-1;for(;(h=c.indexOf(p,h+1))!=-1;){let m=Fme(e,f,n,r,a+h+p.length,s),g=zme(e,t,d,r,a,a+h),v=p.length+m+g;(!u||u[2]<v)&&(u=[d-g,a+h-g,v])}d=f}if(o<0)return u;i=i>>1}}function pyt(e,t,n,r,a,s){let i=n-t,o=s-a;if(i<o){let c=pyt(r,a,s,e,t,n);return c&&[c[1],c[0],c[2]]}return i<4||o*2<i?null:Qae(e,t,n,r,a,s,Math.floor(i/4),-1)}function d5e(e,t,n,r,a,s){Lme=!0;let i=n-t,o=s-a,c;if(i<o){let p=Qae(r,a,s,e,t,n,Math.floor(i/6),50);c=p&&[p[1],p[0],p[2]]}else c=Qae(e,t,n,r,a,s,Math.floor(o/6),50);if(!c)return[new ro(t,n,a,s)];let[u,d,f]=c;return ww(e,t,u,r,a,d).concat(ww(e,u+f,n,r,d+f,s))}function hyt(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 ro(r.fromA,a.toA,r.fromB,a.toB),e.splice(n--,1))}}function Her(e,t,n){for(;;){hyt(n,1);let r=!1;for(let a=0;a<n.length;a++){let s=n[a],i,o;(i=Fme(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=n[a]=new ro(s.fromA+i,s.toA,s.fromB+i,s.toB)),(o=zme(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=n[a]=new ro(s.fromA,s.toA-o,s.fromB,s.toB-o));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 p=c?e.slice(s.fromA,s.toA):t.slice(s.fromB,s.toB);d<=p.length&&e.slice(s.fromA-d,s.fromA)==p.slice(p.length-d)?(n[a]=new ro(s.fromA-d,s.toA-d,s.fromB-d,s.toB-d),r=!0):f<=p.length&&e.slice(s.toA,s.toA+f)==p.slice(0,f)&&(n[a]=new ro(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),r=!0)}if(!r)break}return n}function Qer(e,t,n){for(let r=0,a=0;a<e.length;a++){let s=e[a],i=s.toA-s.fromA,o=s.toB-s.fromB;if(i&&o||i>3||o>3){let c=a==e.length-1?t.length:e[a+1].fromA,u=s.fromA-r,d=c-s.toA,f=p5e(t,s.fromA,u),p=f5e(t,s.toA,d),h=s.fromA-f,m=p-s.toA;if((!i||!o)&&h&&m){let g=Math.max(i,o),[v,b,w]=i?[t,s.fromA,s.toA]:[n,s.fromB,s.toB];g>h&&t.slice(f,s.fromA)==v.slice(w-h,w)?(s=e[a]=new ro(f,f+i,s.fromB-h,s.toB-h),f=s.fromA,p=f5e(t,s.toA,c-s.toA)):g>m&&t.slice(s.toA,p)==v.slice(b,b+m)&&(s=e[a]=new ro(p-i,p,s.fromB+m,s.toB+m),p=s.toA,f=p5e(t,s.fromA,s.fromA-r)),h=s.fromA-f,m=p-s.toA}if(h||m)s=e[a]=new ro(s.fromA-h,s.toA+m,s.fromB-h,s.toB+m);else if(i){if(!o){let g=m5e(t,s.fromA,s.toA),v,b=g<0?-1:h5e(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):b>-1&&(v=s.toA-b)<=u&&t.slice(s.fromA-v,s.fromA)==t.slice(b,s.toA)&&(s=e[a]=s.offset(-v))}}else{let g=m5e(n,s.fromB,s.toB),v,b=g<0?-1:h5e(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):b>-1&&(v=s.toB-b)<=u&&n.slice(s.fromB-v,s.fromB)==n.slice(b,s.toB)&&(s=e[a]=s.offset(-v))}}r=s.toA}return hyt(e,3),e}let _0;try{_0=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function myt(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function gyt(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?myt(n)?1:0:_0?!byt(n)||t==e.length-1?_0.test(String.fromCharCode(n))?1:0:_0.test(e.slice(t,t+2))?2:0:0}function vyt(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?myt(n)?1:0:_0?!xyt(n)||t==1?_0.test(String.fromCharCode(n))?1:0:_0.test(e.slice(t-2,t))?2:0:0}const yyt=8;function f5e(e,t,n){if(t==e.length||!vyt(e,t))return t;for(let r=t,a=t+n,s=0;s<yyt;s++){let i=gyt(e,r);if(!i||r+i>a)return r;r+=i}return t}function p5e(e,t,n){if(!t||!gyt(e,t))return t;for(let r=t,a=t-n,s=0;s<yyt;s++){let i=vyt(e,r);if(!i||r-i<a)return r;r-=i}return t}function h5e(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function m5e(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}const byt=e=>e>=55296&&e<=56319,xyt=e=>e>=56320&&e<=57343;function Fk(e,t){return!t||t==e.length||!byt(e.charCodeAt(t-1))||!xyt(e.charCodeAt(t))}function Wer(e,t,n){var r;let a=n?.override;return a?a(e,t):(dj=((r=n?.scanLimit)!==null&&r!==void 0?r:1e9)>>1,fj=n?.timeout?Date.now()+n.timeout:0,Lme=!1,Her(e,t,ww(e,0,e.length,t,0,t.length)))}function wyt(){return!Lme}function Syt(e,t,n){return Qer(Wer(e,t,n),e,t)}const Lh=Yt.define({combine:e=>e[0]}),Wae=Xn.define(),Ger=Yt.define(),zk=ho.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Wae)&&(e=n.value);for(let n of t.state.facet(Ger))e=n(e,t);return e}});class EO{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 EO(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=Syt(t.toString(),n.toString(),r);return Oyt(a,t,n,0,0,wyt())}static updateA(t,n,r,a,s){return x5e(b5e(t,a,!0,r.length),t,n,r,s)}static updateB(t,n,r,a,s){return x5e(b5e(t,a,!1,n.length),t,n,r,s)}}function g5e(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 v5e(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 Oyt(e,t,n,r,a,s){let i=[];for(let o=0;o<e.length;o++){let c=e[o],[u,d]=g5e(c.fromA+r,c.fromB+a,t,n),[f,p]=v5e(c.toA+r,c.toB+a,t,n),h=[c.offset(-u+r,-d+a)];for(;o<e.length-1;){let m=e[o+1],[g,v]=g5e(m.fromA+r,m.fromB+a,t,n);if(g>f+1&&v>p+1)break;h.push(m.offset(-u+r,-d+a)),[f,p]=v5e(m.toA+r,m.toB+a,t,n),o++}i.push(new EO(h,u,Math.max(u,f),d,Math.max(d,p),s))}return i}const AD=1e3;function y5e(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 p=t-(n?d:f);return[d+p,f+p]}let i=a+s>>1,o=e[i],[c,u]=n?[o.fromA,o.toA]:[o.fromB,o.toB];if(c>t)s=i;else if(u<=t)a=i+1;else return r?[o.fromA,o.fromB]:[o.toA,o.toB]}}function b5e(e,t,n,r){let a=[];return t.iterChangedRanges((s,i,o,c)=>{let u=0,d=n?t.length:r,f=0,p=n?r:t.length;s>AD&&([u,f]=y5e(e,s-AD,n,!0)),i<t.length-AD&&([d,p]=y5e(e,i+AD,n,!1));let h=c-o-(i-s),m,[g,v]=n?[h,0]:[0,h];a.length&&(m=a[a.length-1]).toA>=u?a[a.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:p,diffA:m.diffA+g,diffB:m.diffB+v}:a.push({fromA:u,toA:d,fromB:f,toB:p,diffA:g,diffB:v})}),a}function x5e(e,t,n,r,a){if(!e.length)return t;let s=[];for(let i=0,o=0,c=0,u=0;;i++){let d=i==e.length?null:e[i],f=d?d.fromA+o:n.length,p=d?d.fromB+c:r.length;for(;u<t.length;){let v=t[u];if(d&&(v.toA+o>f||v.toB+c>p))break;s.push(v.offset(o,c)),u++}if(!d)break;let h=d.toA+o+d.diffA,m=d.toB+c+d.diffB,g=Syt(n.sliceString(f,h),r.sliceString(p,m),a);for(let v of Oyt(g,n,r,f,p,wyt()))s.push(v);for(o+=d.diffA,c+=d.diffB;u<t.length;){let v=t[u];if(v.fromA+o>h&&v.fromB+c>m)break;u++}}return s}const Zer={scanLimit:500},kyt=ii.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=O5e(e))}update(e){(e.docChanged||e.viewportChanged||Yer(e.startState,e.state)||Xer(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=O5e(e.view))}},{decorations:e=>e.deco}),ID=Qp.low(wnt({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(kyt))===null||t===void 0?void 0:t.gutter)||Ur.empty}}));function Yer(e,t){return e.field(zk,!1)!=t.field(zk,!1)}function Xer(e,t){return e.facet(Lh)!=t.facet(Lh)}const w5e=nn.line({class:"cm-changedLine"}),Ker=nn.mark({class:"cm-changedText"}),Jer=nn.mark({tagName:"ins",class:"cm-insertedLine"}),etr=nn.mark({tagName:"del",class:"cm-deletedLine"}),S5e=new class extends um{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function ttr(e,t,n,r,a,s){let i=n?e.fromA:e.fromB,o=n?e.toA:e.toB,c=0;if(i!=o){a.add(i,i,w5e),a.add(i,o,n?etr:Jer),s&&s.add(i,i,S5e);for(let u=t.iterRange(i,o-1),d=i;!u.next().done;){if(u.lineBreak){d++,a.add(d,d,w5e),s&&s.add(d,d,S5e);continue}let f=d+u.value.length;if(r)for(;c<e.changes.length;){let p=e.changes[c],h=i+(n?p.fromA:p.fromB),m=i+(n?p.toA:p.toB),g=Math.max(d,h),v=Math.min(f,m);if(g<v&&a.add(g,v,Ker),m<f)c++;else break}d=f}}}function O5e(e){let t=e.state.field(zk),{side:n,highlightChanges:r,markGutter:a,overrideChunk:s}=e.state.facet(Lh),i=n=="a",o=new Su,c=a?new Su: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,o,c))&&ttr(f,e.state.doc,i,r,o,c)}return{deco:o.finish(),gutter:c&&c.finish()}}class RD extends Pd{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 s3=Xn.define({map:(e,t)=>e.map(t)}),pj=ho.define({create:()=>nn.none,update:(e,t)=>{for(let n of t.effects)if(n.is(s3))return n.value;return e.map(t.changes)},provide:e=>gt.decorations.from(e)}),PD=.01;function k5e(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 ntr(e,t,n){let r=new Su,a=new Su,s=e.state.field(pj).iter(),i=t.state.field(pj).iter(),o=0,c=0,u=0,d=0,f=e.viewport,p=t.viewport;for(let v=0;;v++){let b=v<n.length?n[v]:null,w=b?b.fromA:e.state.doc.length,O=b?b.fromB:t.state.doc.length;if(o<w){let k=e.lineBlockAt(o).top+u,_=t.lineBlockAt(c).top+d,C=k-_;C<-PD?(u-=C,r.add(o,o,nn.widget({widget:new RD(-C),block:!0,side:-1}))):C>PD&&(d+=C,a.add(c,c,nn.widget({widget:new RD(C),block:!0,side:-1})))}if(w>o+1e3&&o<f.from&&w>f.from&&c<p.from&&O>p.from){let k=Math.min(f.from-o,p.from-c);o+=k,c+=k,v--}else if(b)o=b.toA,c=b.toB;else break;for(;s.value&&s.from<o;)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 h=e.contentHeight+u-(t.contentHeight+d);h<PD?r.add(e.state.doc.length,e.state.doc.length,nn.widget({widget:new RD(-h),block:!0,side:1})):h>PD&&a.add(t.state.doc.length,t.state.doc.length,nn.widget({widget:new RD(h),block:!0,side:1}));let m=r.finish(),g=a.finish();k5e(m,e.state.field(pj))||e.dispatch({effects:s3.of(m)}),k5e(g,t.state.field(pj))||t.dispatch({effects:s3.of(g)})}const Gae=Xn.define({map:(e,t)=>t.mapPos(e)});class rtr extends Pd{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:Gae.of(a)});let{side:s,sibling:i}=t.state.facet(Lh);i&&i().dispatch({effects:Gae.of(atr(a,t.state.field(zk),s=="a"))})}),n}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function atr(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 str=ho.define({create(e){return nn.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Gae)&&(e=e.update({filter:r=>r!=n.value}));return e},provide:e=>gt.decorations.from(e)});function _5e({margin:e=3,minSize:t=4}){return str.init(n=>itr(n,e,t))}function itr(e,t,n){let r=new Su,a=e.facet(Lh).side=="a",s=e.field(zk),i=1;for(let o=0;;o++){let c=o<s.length?s[o]:null,u=o?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,nn.replace({widget:new rtr(f),block:!0})),!c)break;i=e.doc.lineAt(Math.min(e.doc.length,a?c.toA:c.toB)).number}return r.finish()}const otr=gt.styleModule.of(new Xg({".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"}})),ltr=gt.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"}}),E5e=new b_,MD=new b_;class ctr{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||Zer;let n=[Qp.low(kyt),ltr,otr,pj,gt.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(p=>p.effects.some(h=>h.is(s3)))&&this.measure()})],r=[Lh.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&r.push(ID);let a=Mr.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],gt.editorAttributes.of({class:"cm-merge-a"}),MD.of(r),n]}),s=[Lh.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&s.push(ID);let i=Mr.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],gt.editorAttributes.of({class:"cm-merge-b"}),MD.of(s),n]});this.chunks=EO.build(a.doc,i.doc,this.diffConf);let o=[zk.init(()=>this.chunks),E5e.of(t.collapseUnchanged?_5e(t.collapseUnchanged):[])];a=a.update({effects:Xn.appendConfig.of(o)}).state,i=i.update({effects:Xn.appendConfig.of(o)}).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 gt({state:a,parent:u,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new gt({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,o)=>i.compose(o.changes),to.empty(t[0].startState.doc.length));this.chunks=n==this.a?EO.updateA(this.chunks,r.newDoc,this.b.state.doc,a,this.diffConf):EO.updateB(this.chunks,this.a.state.doc,r.newDoc,a,this.diffConf),n.update([...t,r.state.update({effects:Wae.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:Wae.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,o=this.b.dom.parentNode;i.remove(),o.remove(),this.editorDOM.insertBefore(s?i:o,this.editorDOM.firstChild),this.editorDOM.appendChild(s?o:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in t||"renderRevertControl"in t){let s=!!this.revertDOM,i=this.revertToA,o=this.renderRevert;"revertControls"in t&&(s=!!t.revertControls,i=t.revertControls=="b-to-a"),"renderRevertControl"in t&&(o=t.renderRevertControl),this.setupRevertControls(s,i,o)}let n="highlightChanges"in t,r="gutter"in t,a="collapseUnchanged"in t;if(n||r||a){let s=[],i=[];if(n||r){let o=this.a.state.facet(Lh),c=r?t.gutter!==!1:o.markGutter,u=n?t.highlightChanges!==!1:o.highlightChanges;s.push(MD.reconfigure([Lh.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:c}),c?ID:[]])),i.push(MD.reconfigure([Lh.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:c}),c?ID:[]]))}if(a){let o=E5e.reconfigure(t.collapseUnchanged?_5e(t.collapseUnchanged):[]);s.push(o),i.push(o)}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(){ntr(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 o=this.a.lineBlockAt(i.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=C5e(n);n&&n.dataset.chunk==String(s)?(n.style.top!=o&&(n.style.top=o),n=n.nextSibling):t.insertBefore(this.renderRevertButton(o,s),n)}for(;n;)n=C5e(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,o,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,o-1));i!=o&&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 C5e(e){let t=e.nextSibling;return e.remove(),t}const j5e={modelSettings:{maxRetries:2,maxSteps:5,chatWithGenerateLegacy:!1,chatWithGenerate:!1}};function utr({agentId:e,defaultSettings:t}){const[n,r]=x.useState(t),a=`mastra-agent-store-${e}`;return x.useEffect(()=>{try{const o=localStorage.getItem(a),c=o?JSON.parse(o):{},u={...c,modelSettings:{...j5e.modelSettings,...c?.modelSettings??{},...t?.modelSettings??{}}};r(u)}catch{}},[a,t]),{settings:n,setSettings:o=>{r(c=>({...c,...o})),localStorage.setItem(a,JSON.stringify({...o,agentId:e}))},resetAll:()=>{const o={modelSettings:{...j5e.modelSettings,...t?.modelSettings??{}}};r(o),localStorage.removeItem(a)}}}const _yt=x.createContext({});function Bme({children:e,agentId:t,defaultSettings:n}){const{settings:r,setSettings:a,resetAll:s}=utr({agentId:t,defaultSettings:n});return l.jsx(_yt.Provider,{value:{settings:r,setSettings:a,resetAll:s},children:e})}const Ume=()=>x.useContext(_yt),Fr=vle()(vDt(e=>({requestContext:{},theme:"dark",setRequestContext:t=>e({requestContext:t}),setTheme:t=>e({theme:t})}),{name:"mastra-playground-store"})),Zae=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;function dtr(e){return Zae?.addEventListener("change",e),()=>Zae?.removeEventListener("change",e)}function ftr(){return Zae?.matches??!0}function Uz(){const e=Fr(n=>n.theme),t=x.useSyncExternalStore(dtr,ftr,()=>!0);return e==="system"?t:e==="dark"}const qme=x.createContext(null);function qz({children:e}){const{requestContext:t}=Fr(),[n,r]=x.useState(t),a=i=>r(i),s=()=>{r({})};return l.jsx(qme.Provider,{value:{schemaValues:n,setSchemaValues:a,clearSchemaValues:s},children:e})}function Eyt(){const e=x.useContext(qme);if(!e)throw new Error("useSchemaRequestContext must be used within a SchemaRequestContextProvider");return e}function vo(){const{requestContext:e}=Fr(),n=x.useContext(qme)?.schemaValues??{};return{...e??{},...n}}const Cyt=({threadId:e,agentId:t,memory:n})=>{const r=qe(),{requestContext:a}=Fr();return wt({queryKey:["memory","messages",e,t,"requestContext"],queryFn:async()=>e?await r.listThreadMessages(e,{agentId:t,requestContext:a}):null,enabled:n&&!!e,staleTime:0,gcTime:0,retry:!1,refetchOnWindowFocus:!1})},ptr=({multiple:e=!0,onChange:t}={})=>{const n=jBt(s=>!s.isEditing),r=oI(),a=x.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=o=>{const c=o.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},Ul={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},wR="focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",htr="focus-within:outline-hidden focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",mtr="rounded-md",Vme="bg-surface2 border-2 border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",Hme="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",Qme="disabled:opacity-50 disabled:cursor-not-allowed";function jyt(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=jyt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Tyt(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=jyt(e))&&(r&&(r+=" "),r+=t);return r}const gtr=(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},vtr=(e,t)=>({classGroupId:e,validator:t}),Nyt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),i3="-",T5e=[],ytr="arbitrary..",btr=e=>{const t=wtr(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return xtr(i);const o=i.split(i3),c=o[0]===""&&o.length>1?1:0;return Ayt(o,c,t)},getConflictingClassGroupIds:(i,o)=>{if(o){const c=r[i],u=n[i];return c?u?gtr(u,c):c:u||T5e}return n[i]||T5e}}},Ayt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],s=n.nextPart.get(a);if(s){const u=Ayt(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const o=t===0?e.join(i3):e.slice(t).join(i3),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(o))return d.classGroupId}},xtr=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?ytr+r:void 0})(),wtr=e=>{const{theme:t,classGroups:n}=e;return Str(n,t)},Str=(e,t)=>{const n=Nyt();for(const r in e){const a=e[r];Wme(a,n,r,t)}return n},Wme=(e,t,n,r)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];Otr(i,t,n,r)}},Otr=(e,t,n,r)=>{if(typeof e=="string"){ktr(e,t,n);return}if(typeof e=="function"){_tr(e,t,n,r);return}Etr(e,t,n,r)},ktr=(e,t,n)=>{const r=e===""?t:Iyt(t,e);r.classGroupId=n},_tr=(e,t,n,r)=>{if(Ctr(e)){Wme(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(vtr(n,e))},Etr=(e,t,n,r)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[o,c]=a[i];Wme(c,Iyt(t,o),n,r)}},Iyt=(e,t)=>{let n=e;const r=t.split(i3),a=r.length;for(let s=0;s<a;s++){const i=r[s];let o=n.nextPart.get(i);o||(o=Nyt(),n.nextPart.set(i,o)),n=o}return n},Ctr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,jtr=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)}}},Yae="!",N5e=":",Ttr=[],A5e=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),Ntr=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const s=[];let i=0,o=0,c=0,u;const d=a.length;for(let g=0;g<d;g++){const v=a[g];if(i===0&&o===0){if(v===N5e){s.push(a.slice(c,g)),c=g+1;continue}if(v==="/"){u=g;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=s.length===0?a:a.slice(c);let p=f,h=!1;f.endsWith(Yae)?(p=f.slice(0,-1),h=!0):f.startsWith(Yae)&&(p=f.slice(1),h=!0);const m=u&&u>c?u-c:void 0;return A5e(s,h,p,m)};if(t){const a=t+N5e,s=r;r=i=>i.startsWith(a)?s(i.slice(a.length)):A5e(Ttr,!1,i,void 0,!0)}if(n){const a=r;r=s=>n({className:s,parseClassName:a})}return r},Atr=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],o=i[0]==="[",c=t.has(i);o||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}},Itr=e=>({cache:jtr(e.cacheSize),parseClassName:Ntr(e),sortModifiers:Atr(e),...btr(e)}),Rtr=/\s+/,Ptr=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],o=e.trim().split(Rtr);let c="";for(let u=o.length-1;u>=0;u-=1){const d=o[u],{isExternal:f,modifiers:p,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:g}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let v=!!g,b=r(v?m.substring(0,g):m);if(!b){if(!v){c=d+(c.length>0?" "+c:c);continue}if(b=r(m),!b){c=d+(c.length>0?" "+c:c);continue}v=!1}const w=p.length===0?"":p.length===1?p[0]:s(p).join(":"),O=h?w+Yae:w,k=O+b;if(i.indexOf(k)>-1)continue;i.push(k);const _=a(b,v);for(let C=0;C<_.length;++C){const T=_[C];i.push(O+T)}c=d+(c.length>0?" "+c:c)}return c},Mtr=(...e)=>{let t=0,n,r,a="";for(;t<e.length;)(n=e[t++])&&(r=Ryt(n))&&(a&&(a+=" "),a+=r);return a},Ryt=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Ryt(e[r]))&&(n&&(n+=" "),n+=t);return n},I5e=(e,...t)=>{let n,r,a,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=Itr(u),r=n.cache.get,a=n.cache.set,s=o,o(c)},o=c=>{const u=r(c);if(u)return u;const d=Ptr(c,n);return a(c,d),d};return s=i,(...c)=>s(Mtr(...c))},Dtr=[],wo=e=>{const t=n=>n[e]||Dtr;return t.isThemeGetter=!0,t},Pyt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Myt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,$tr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ltr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ftr=/\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$/,ztr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Btr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Utr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,my=e=>$tr.test(e),Rr=e=>!!e&&!Number.isNaN(Number(e)),gy=e=>!!e&&Number.isInteger(Number(e)),fJ=e=>e.endsWith("%")&&Rr(e.slice(0,-1)),dg=e=>Ltr.test(e),Dyt=()=>!0,qtr=e=>Ftr.test(e)&&!ztr.test(e),Gme=()=>!1,Vtr=e=>Btr.test(e),Htr=e=>Utr.test(e),Qtr=e=>!fn(e)&&!vn(e),Wtr=e=>Zb(e,Fyt,Gme),fn=e=>Pyt.test(e),Px=e=>Zb(e,zyt,qtr),R5e=e=>Zb(e,tnr,Rr),Gtr=e=>Zb(e,Uyt,Dyt),Ztr=e=>Zb(e,Byt,Gme),P5e=e=>Zb(e,$yt,Gme),Ytr=e=>Zb(e,Lyt,Htr),DD=e=>Zb(e,qyt,Vtr),vn=e=>Myt.test(e),NC=e=>lS(e,zyt),Xtr=e=>lS(e,Byt),M5e=e=>lS(e,$yt),Ktr=e=>lS(e,Fyt),Jtr=e=>lS(e,Lyt),$D=e=>lS(e,qyt,!0),enr=e=>lS(e,Uyt,!0),Zb=(e,t,n)=>{const r=Pyt.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},lS=(e,t,n=!1)=>{const r=Myt.exec(e);return r?r[1]?t(r[1]):n:!1},$yt=e=>e==="position"||e==="percentage",Lyt=e=>e==="image"||e==="url",Fyt=e=>e==="length"||e==="size"||e==="bg-size",zyt=e=>e==="length",tnr=e=>e==="number",Byt=e=>e==="family-name",Uyt=e=>e==="number"||e==="weight",qyt=e=>e==="shadow",D5e=()=>{const e=wo("color"),t=wo("font"),n=wo("text"),r=wo("font-weight"),a=wo("tracking"),s=wo("leading"),i=wo("breakpoint"),o=wo("container"),c=wo("spacing"),u=wo("radius"),d=wo("shadow"),f=wo("inset-shadow"),p=wo("text-shadow"),h=wo("drop-shadow"),m=wo("blur"),g=wo("perspective"),v=wo("aspect"),b=wo("ease"),w=wo("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(),vn,fn],C=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[vn,fn,c],A=()=>[my,"full","auto",...j()],I=()=>[gy,"none","subgrid",vn,fn],P=()=>["auto",{span:["full",gy,vn,fn]},gy,vn,fn],M=()=>[gy,"auto",vn,fn],F=()=>["auto","min","max","fr",vn,fn],D=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...j()],z=()=>[my,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],H=()=>[my,"screen","full","dvw","lvw","svw","min","max","fit",...j()],W=()=>[my,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],$=()=>[e,vn,fn],Z=()=>[...k(),M5e,P5e,{position:[vn,fn]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],R=()=>["auto","cover","contain",Ktr,Wtr,{size:[vn,fn]}],Q=()=>[fJ,NC,Px],G=()=>["","none","full",u,vn,fn],J=()=>["",Rr,NC,Px],re=()=>["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"],se=()=>[Rr,fJ,M5e,P5e],le=()=>["","none",m,vn,fn],me=()=>["none",Rr,vn,fn],K=()=>["none",Rr,vn,fn],ae=()=>[Rr,vn,fn],oe=()=>[my,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[dg],breakpoint:[dg],color:[Dyt],container:[dg],"drop-shadow":[dg],ease:["in","out","in-out"],font:[Qtr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[dg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[dg],shadow:[dg],spacing:["px",Rr],text:[dg],"text-shadow":[dg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",my,fn,vn,v]}],container:["container"],columns:[{columns:[Rr,fn,vn,o]}],"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:[gy,"auto",vn,fn]}],basis:[{basis:[my,"full","auto",o,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Rr,my,"auto","initial","none",fn]}],grow:[{grow:["",Rr,vn,fn]}],shrink:[{shrink:["",Rr,vn,fn]}],order:[{order:[gy,"first","last","none",vn,fn]}],"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:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mbs:[{mbs:V()}],mbe:[{mbe:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"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",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[o,"screen",...z()]}],"min-w":[{"min-w":[o,"screen","none",...z()]}],"max-w":[{"max-w":[o,"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,NC,Px]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,enr,Gtr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fJ,fn]}],"font-family":[{font:[Xtr,Ztr,t]}],"font-features":[{"font-features":[fn]}],"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,vn,fn]}],"line-clamp":[{"line-clamp":[Rr,"none",vn,R5e]}],leading:[{leading:[s,...j()]}],"list-image":[{"list-image":["none",vn,fn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",vn,fn]}],"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:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Rr,"from-font","auto",vn,Px]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[Rr,"auto",vn,fn]}],"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",vn,fn]}],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",vn,fn]}],"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:B()}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gy,vn,fn],radial:["",vn,fn],conic:[gy,vn,fn]},Jtr,Ytr]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"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:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"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:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Rr,vn,fn]}],"outline-w":[{outline:["",Rr,NC,Px]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",d,$D,DD]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",f,$D,DD]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[Rr,Px]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",p,$D,DD]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[Rr,vn,fn]}],"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":[Rr]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[vn,fn]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"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":[Rr]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"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:B()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",vn,fn]}],filter:[{filter:["","none",vn,fn]}],blur:[{blur:le()}],brightness:[{brightness:[Rr,vn,fn]}],contrast:[{contrast:[Rr,vn,fn]}],"drop-shadow":[{"drop-shadow":["","none",h,$D,DD]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",Rr,vn,fn]}],"hue-rotate":[{"hue-rotate":[Rr,vn,fn]}],invert:[{invert:["",Rr,vn,fn]}],saturate:[{saturate:[Rr,vn,fn]}],sepia:[{sepia:["",Rr,vn,fn]}],"backdrop-filter":[{"backdrop-filter":["","none",vn,fn]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[Rr,vn,fn]}],"backdrop-contrast":[{"backdrop-contrast":[Rr,vn,fn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Rr,vn,fn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Rr,vn,fn]}],"backdrop-invert":[{"backdrop-invert":["",Rr,vn,fn]}],"backdrop-opacity":[{"backdrop-opacity":[Rr,vn,fn]}],"backdrop-saturate":[{"backdrop-saturate":[Rr,vn,fn]}],"backdrop-sepia":[{"backdrop-sepia":["",Rr,vn,fn]}],"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",vn,fn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Rr,"initial",vn,fn]}],ease:[{ease:["linear","initial",b,vn,fn]}],delay:[{delay:[Rr,vn,fn]}],animate:[{animate:["none",w,vn,fn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,vn,fn]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[vn,fn,"","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",vn,fn]}],"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",vn,fn]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[Rr,NC,Px,R5e]}],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"]}},nnr=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:a={},override:s={}})=>(hj(e,"cacheSize",t),hj(e,"prefix",n),hj(e,"experimentalParseClassName",r),LD(e.theme,s.theme),LD(e.classGroups,s.classGroups),LD(e.conflictingClassGroups,s.conflictingClassGroups),LD(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),hj(e,"orderSensitiveModifiers",s.orderSensitiveModifiers),FD(e.theme,a.theme),FD(e.classGroups,a.classGroups),FD(e.conflictingClassGroups,a.conflictingClassGroups),FD(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Vyt(e,a,"orderSensitiveModifiers"),e),hj=(e,t,n)=>{n!==void 0&&(e[t]=n)},LD=(e,t)=>{if(t)for(const n in t)hj(e,n,t[n])},FD=(e,t)=>{if(t)for(const n in t)Vyt(e,t,n)},Vyt=(e,t,n)=>{const r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},rnr=(e,...t)=>typeof e=="function"?I5e(D5e,e,...t):I5e(()=>nnr(D5e(),e),...t),anr=Object.keys({...M6,...bYt}),snr=Object.keys(_Yt),inr=Object.keys(xYt),onr=Object.keys(wYt),lnr=Object.keys(yYt),Mx=Object.keys(kYt),cnr=Object.keys(SYt).concat(Object.keys(OYt)),unr=rnr({extend:{theme:{color:anr,spacing:snr,radius:lnr,leading:onr,shadow:cnr},classGroups:{"font-size":[{text:inr}],h:[{h:Mx}],w:[{w:Mx}],size:[{size:Mx}],"min-h":[{"min-h":Mx}],"min-w":[{"min-w":Mx}],"max-h":[{"max-h":Mx}],"max-w":[{"max-w":Mx}]}}});function Y(...e){return unr(Tyt(e))}const dnr={sm:`${Ul.sm} text-ui-sm px-[.75em]`,md:`${Ul.md} text-ui-md px-[.75em]`,default:`${Ul.default} text-ui-md px-[.85em] `,lg:`${Ul.lg} text-ui-lg px-[1em] `},fnr={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:Vme,light:"",outline:""},pnr=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",Qme,Hme),hnr={light:"default",outline:"default"};function mnr(e){return hnr[e]??e}function H_(e){const t=mnr(e?.variant||"default"),n=e?.size||"default";return Y(pnr,fnr[t],dnr[n],e?.iconOnly&&"[&>svg]:opacity-75")}function Hyt(e){const t=[];return Ce.Children.forEach(e,n=>{Ce.isValidElement(n)&&n.type===Ce.Fragment?t.push(...Hyt(n.props.children)):t.push(n)}),t}function gnr(e){const t=Hyt(e);return t.length>0&&t.every(n=>Ce.isValidElement(n))}const ye=Ce.forwardRef(({className:e,as:t,size:n="default",variant:r="default",disabled:a,children:s,...i},o)=>{const c=t||"button",u=gnr(s);return l.jsx(c,{ref:o,disabled:a,className:Y(H_({variant:r,size:n,iconOnly:u}),e),...i,children:s})});ye.displayName="Button";const Pc=P6t,ar=M6t,sr=D6t,Jn=x.forwardRef(({className:e,sideOffset:t=4,children:n,...r},a)=>l.jsx($6t,{children:l.jsxs(BWe,{ref:a,sideOffset:t,className:Y("z-50 overflow-hidden rounded-md bg-surface6 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,l.jsx(L6t,{className:"fill-surface6"})]})}));Jn.displayName=BWe.displayName;const Vs=Ce.forwardRef(({tooltipContent:e,...t},n)=>l.jsxs(ar,{children:[l.jsx(sr,{asChild:!0,children:l.jsx(ye,{ref:n,...t})}),e&&l.jsx(Jn,{children:e})]}));Vs.displayName="ButtonWithTooltip";const _r=s6,Qyt=XZe,vnr=i6,Wyt=x.forwardRef(({className:e,...t},n)=>l.jsx(uI,{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}));Wyt.displayName=uI.displayName;const yr=x.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(vnr,{children:[l.jsx(Wyt,{}),l.jsxs(dI,{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-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",e),...n,children:[t,l.jsxs(c6,{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:[l.jsx(ir,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));yr.displayName=dI.displayName;const Er=({className:e,...t})=>l.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});Er.displayName="DialogHeader";const Td=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Td.displayName="DialogFooter";const Dr=({className:e,...t})=>l.jsx("div",{className:Y("overflow-y-auto px-6 max-h-[50vh]",e),...t});Dr.displayName="DialogBody";const br=x.forwardRef(({className:e,...t},n)=>l.jsx(o6,{ref:n,className:Y("text-ui-md font-medium",e),...t}));br.displayName=o6.displayName;const Ga=x.forwardRef(({className:e,...t},n)=>l.jsx(l6,{ref:n,className:Y("sr-only",e),...t}));Ga.displayName=l6.displayName;const $5e=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,L5e=Tyt,SR=(e,t)=>n=>{var r;if(t?.variants==null)return L5e(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 p=$5e(d)||$5e(f);return a[u][p]}),o=n&&Object.entries(n).reduce((u,d)=>{let[f,p]=d;return p===void 0||(u[f]=p),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:p,...h}=d;return Object.entries(h).every(m=>{let[g,v]=m;return Array.isArray(v)?v.includes({...s,...o}[g]):{...s,...o}[g]===v})?[...u,f,p]:u},[]);return L5e(e,i,c,n?.class,n?.className)},ynr=SR(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(Vme,Hme,Qme),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${Ul.sm} text-ui-sm px-[.75em]`,md:`${Ul.md} text-ui-md px-[.75em]`,default:`${Ul.default} text-ui-md px-[.85em]`,lg:`${Ul.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),an=x.forwardRef(({className:e,size:t,testId:n,variant:r,type:a,error:s,...i},o)=>l.jsx("input",{type:a,className:Y(ynr({variant:r,size:t}),s&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":n,ref:o,"aria-invalid":s,...i}));an.displayName="Input";const bnr=SR("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xt=x.forwardRef(({className:e,...t},n)=>l.jsx(met,{ref:n,className:Y(bnr(),e),...t}));xt.displayName=met.displayName;const xnr={"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"},wnr={mono:"font-mono"},ge=({as:e="p",className:t,variant:n="ui-md",font:r,...a})=>l.jsx(e,{className:Y(xnr[n],r&&wnr[r],t),...a}),Ys=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),Snr=e=>l.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"}),l.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"}),l.jsxs("g",{clipPath:"url(#clip0_21421_19519)",children:[l.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"}),l.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"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21421_19519",children:l.jsx("rect",{width:"62.7591",height:"62.7591",fill:"white",transform:"matrix(0.897148 0.441731 -0.897148 0.441731 63.1714 7.24365)"})})})]}),Onr=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),Zme=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),Yme=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),dc=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),Gyt=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:l.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"})}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_22095",children:l.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),Zyt=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[l.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"}),l.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"}),l.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"}),l.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"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_20513",children:l.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),knr={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})=>l.jsx("span",{className:Y("block",knr[n],t),...r,children:e}),_nr=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"}),l.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),Yyt=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),Xme=e=>l.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),Enr=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),No=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),Q_=e=>l.jsx(fYt,{...e}),Jo=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),Cu=e=>l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),Cnr=e=>l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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 CO(e){return l.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:[l.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),l.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),l.jsx("path",{d:"M15 2v2"}),l.jsx("path",{d:"M15 20v2"}),l.jsx("path",{d:"M2 15h2"}),l.jsx("path",{d:"M2 9h2"}),l.jsx("path",{d:"M20 15h2"}),l.jsx("path",{d:"M20 9h2"}),l.jsx("path",{d:"M9 2v2"}),l.jsx("path",{d:"M9 20v2"})]})}const jnr={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"},Tnr=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 jnr[a]}},Nnr=({onOpenChange:e,open:t})=>{const n=oI(),r=ptr({onChange:()=>e(!1)}),a=async s=>{s.preventDefault();const o=new FormData(s.target).get("url-attachment")?.toString();if(o){const c=new File([],o,{type:await Tnr(o)});n.addAttachment(c),e(!1)}};return l.jsx(_r,{onOpenChange:e,open:t,children:l.jsxs(yr,{children:[l.jsxs(Er,{children:[l.jsx(br,{children:"Add attachment"}),l.jsx(Ga,{children:"Add a file attachment via URL or from your computer"})]}),l.jsxs(Dr,{children:[l.jsxs("form",{onSubmit:a,className:"flex flex-row items-end gap-4",children:[l.jsxs("div",{className:"w-full space-y-1",children:[l.jsx(xt,{htmlFor:"url-attachment",className:"text-neutral3 text-ui-md",children:"Public URL"}),l.jsx(an,{type:"text",name:"url-attachment",id:"url-attachment",className:"w-full",placeholder:"https://placehold.co/600x400/png"})]}),l.jsxs(ye,{type:"submit",className:"h-8!",variant:"light",children:[l.jsx(_e,{children:l.jsx(LGt,{})}),"Add"]})]}),l.jsx("hr",{className:"my-2 border border-border1"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ge,{variant:"ui-md",className:"text-neutral3",children:"Or from your computer"}),l.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:[l.jsx(kWt,{className:"size-12"}),l.jsx(ge,{variant:"header-md",children:"Add a local file"})]})]})]})]})})},Anr=e=>{const[t,n]=x.useState(void 0);return x.useEffect(()=>{if(!e){n(void 0);return}const r=URL.createObjectURL(e);return n(r),()=>{URL.revokeObjectURL(r)}},[e]),t},Inr=()=>{const{file:e,src:t}=m2(uZe(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 Anr(e)??t},Rnr=()=>{const e=oI(),[t,n]=x.useState(!1);return x.useEffect(()=>{e.subscribe(()=>{const r=e.getState().attachments;n(r.length>0)})},[e]),t},Pnr=e=>{const[t,n]=x.useState({isLoading:!1,text:""});return x.useEffect(()=>{if(!e)return;(async()=>{n(s=>({...s,isLoading:!0}));const a=await e.text();n(s=>({...s,isLoading:!1,text:a}))})()},[e]),t},o3="h-full w-full flex items-center justify-center",Xyt=({data:e,url:t})=>{const[n,r]=x.useState(!1);return t?l.jsx("a",{href:t,className:o3,target:"_blank",rel:"noreferrer noopener",children:l.jsx(Pf,{className:"text-accent2","aria-label":"View PDF"})}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>r(!0),className:o3,type:"button",children:l.jsx(Pf,{className:"text-accent2","aria-label":"View PDF"})}),l.jsx(Mnr,{data:e,open:n,onOpenChange:r})]})},Mnr=({data:e,open:t,onOpenChange:n})=>l.jsx(_r,{open:t,onOpenChange:n,children:l.jsxs(yr,{className:"max-w-4xl",children:[l.jsxs(Er,{children:[l.jsx(br,{children:"PDF preview"}),l.jsx(Ga,{children:"Preview of the PDF document"})]}),l.jsx(Dr,{children:t&&l.jsx("iframe",{src:e,width:"100%",height:"600px"})})]})}),Kyt=({src:e})=>{const[t,n]=x.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>n(!0),type:"button",className:o3,children:l.jsx("img",{src:e,className:"object-cover aspect-ratio max-h-[140px] max-w-[320px]",alt:"Preview"})}),l.jsx(Dnr,{src:e,open:t,onOpenChange:n})]})},Dnr=({src:e,open:t,onOpenChange:n})=>l.jsx(_r,{open:t,onOpenChange:n,children:l.jsxs(yr,{className:"max-w-4xl",children:[l.jsxs(Er,{children:[l.jsx(br,{children:"Image preview"}),l.jsx(Ga,{children:"Preview of the image"})]}),l.jsx(Dr,{children:t&&l.jsx("img",{src:e,alt:"Image"})})]})}),Jyt=({data:e})=>{const[t,n]=x.useState(!1),r=e.replace(/<attachment[^>]*>/,"").replace(/<\/attachment>/g,"");return l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>n(!0),className:o3,type:"button",children:l.jsx(Pf,{className:"text-neutral3"})}),l.jsx($nr,{data:r,open:t,onOpenChange:n})]})},$nr=({data:e,open:t,onOpenChange:n})=>l.jsx(_r,{open:t,onOpenChange:n,children:l.jsxs(yr,{className:"max-w-4xl h-[80vh]",children:[l.jsxs(Er,{children:[l.jsx(br,{children:"Text preview"}),l.jsx(Ga,{children:"Preview of the text file"})]}),l.jsx(Dr,{children:t&&l.jsx("div",{className:"whitespace-pre-wrap",children:e})})]})}),Lnr={sm:`${Ul.sm} w-form-sm`,md:`${Ul.md} w-form-md`,lg:`${Ul.lg} w-form-lg`,default:`${Ul.default}`},Fnr={sm:"sm",md:"default",lg:"lg",default:"default"},znr={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"},Bnr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",ds=Ce.forwardRef(({className:e,children:t,tooltip:n,size:r="md",variant:a="default",disabled:s,...i},o)=>l.jsxs(ar,{children:[l.jsx(sr,{asChild:!0,children:l.jsx("button",{ref:o,disabled:s,"aria-label":typeof n=="string"?n:void 0,className:Y(Bnr,wR,znr[a],Lnr[r],s&&"active:scale-100",e),...i,children:l.jsx(_e,{size:Fnr[r],children:t})})}),l.jsx(Jn,{children:n})]}));ds.displayName="IconButton";const Unr={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"};function Ft({color:e,className:t,size:n="md"}){return l.jsx("svg",{className:Y("animate-spin",Unr[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:l.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:e||"currentColor",className:"text-accent1"})})}const ebt=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)}),qnr=({document:e})=>{const{isLoading:t,text:n}=Pnr(e.file);return l.jsx("div",{className:"flex items-center justify-center h-full w-full",children:t?l.jsx(Ft,{className:"animate-spin"}):l.jsx(Jyt,{data:n})})},Vnr=({document:e})=>{const[t,n]=x.useState({isLoading:!1,text:""});x.useEffect(()=>{let a=!1;return(async()=>{if(!e.file)return;n(o=>({...o,isLoading:!0}));const i=await ebt(e.file);a||n(o=>({...o,isLoading:!1,text:i}))})(),()=>{a=!0}},[e]);const r=e.file?.name.startsWith("https://");return l.jsx("div",{className:"flex items-center justify-center h-full w-full",children:t.isLoading?l.jsx(Ft,{className:"animate-spin"}):l.jsx(Xyt,{data:t.text,url:r?e.file?.name:void 0})})},Hnr=()=>{const e=m2(i=>i.type==="image"),t=m2(i=>i.type==="document"?i:void 0),n=Inr(),r=m2(i=>i.source!=="message"),s=t?.file?.name.startsWith("https://")?t?.file?.name:n;return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"relative",children:[l.jsx(H5,{children:l.jsxs(ar,{children:[l.jsx(wJe,{children:l.jsx(sr,{asChild:!0,children:l.jsx("div",{className:"overflow-hidden size-16 rounded-lg bg-surface3 border border-border1 ",children:e?l.jsx(Kyt,{src:s??""}):t?.contentType==="application/pdf"?l.jsx(Vnr,{document:t}):t?l.jsx(qnr,{document:t}):null})})}),l.jsx(Jn,{side:"top",children:l.jsx(SJe,{})})]})}),r&&l.jsx(Qnr,{})]})})},Qnr=()=>l.jsx(IHt,{asChild:!0,children:l.jsx(ds,{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:l.jsx(_e,{children:l.jsx(vb,{})})})}),Wnr=()=>Rnr()?l.jsx("div",{className:"flex w-full flex-row items-center gap-4 pb-2",children:l.jsx(mZe,{components:{Attachment:Hnr}})}):null;function Gnr({containerRef:e}){const[t,n]=x.useState([]),[r,a]=x.useState(null),s=x.useRef(""),i=x.useRef(0),o=x.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 p=[];for(let m=0;m<f.length;m++){const g=f[m],v=g.getAttribute("data-om-badge")||"",b=g.getAttribute("data-om-state")||"complete",w=g.getAttribute("data-om-type")||"observation",O=g.getBoundingClientRect();let k;const _=Znr(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||p.push({cycleId:v,omType:w,state:b,top:k,height:j})}const h=JSON.stringify(p);h!==s.current&&(s.current=h,n(p))},[e]);if(x.useEffect(()=>{const u=e.current;if(!u)return;o();const d=new ResizeObserver(()=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(o)});d.observe(u);const f=new MutationObserver(()=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(o)});return f.observe(u,{childList:!0,subtree:!0}),()=>{cancelAnimationFrame(i.current),d.disconnect(),f.disconnect()}},[o,e]),x.useEffect(()=>{const u=e.current;if(!u)return;const d=p=>{const h=p.target.closest("[data-om-badge]");h&&a(h.getAttribute("data-om-badge"))},f=p=>{p.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 l.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,p=r?f:d;return l.jsx(Ynr,{highlight:u,visible:p},u.cycleId)})})}function Znr(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 Ynr({highlight:e,visible:t}){const n=Xnr(e.state),r=e.state.startsWith("buffering");return l.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 Xnr(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 Hn={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"},Yb={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},Knr={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"},Jnr={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},vt=({icon:e,variant:t="default",className:n,children:r,...a})=>l.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",Hn.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":Knr[t],n),...a,children:[e&&l.jsx("span",{className:Jnr[t],children:l.jsx(_e,{children:e})}),r]}),Vz=({children:e,initialCollapsed:t=!0,icon:n,title:r,collapsible:a=!0,extraInfo:s,"data-testid":i})=>{const[o,c]=x.useState(t);return x.useEffect(()=>{c(t)},[t]),l.jsxs("div",{className:"mb-4","data-testid":i,children:[l.jsxs("div",{className:"flex flex-row gap-2 items-center justify-between",children:[l.jsxs("button",{onClick:a?()=>c(u=>!u):void 0,className:"flex items-center gap-2 disabled:cursor-not-allowed",disabled:!a,type:"button",children:[l.jsx(_e,{children:l.jsx(Bb,{className:Y("transition-all",o?"rotate-90":"rotate-180")})}),l.jsx(vt,{icon:n,children:r})]}),s]}),!o&&l.jsx("div",{className:"pt-2",children:l.jsx("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:e})})]})};function err(e,t=5){if(!e?.properties)return[];const n=[];function r(a,s,i){if(i>t)return;const o=Array.isArray(a.type)?a.type.join(" | "):a.type;if(n.push({path:s,label:s,description:a.description??a.title,type:o}),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 trr(e){const t=err(e);return trt({override:[nrr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function nrr(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 o=i.map(c=>({label:c.path,displayLabel:c.path,detail:c.type,info:c.description,apply:(u,d,f,p)=>{const g=u.state.sliceDoc(p,p+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:f,to:p,insert:g},selection:{anchor:f+g.length}})}}));return{from:s,options:o,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const rrr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,arr=nn.mark({class:"cm-variable-highlight"}),F5e=new vnt({regexp:rrr,decoration:()=>arr}),srr=ii.fromClass(class{decorations;constructor(e){this.decorations=F5e.createDeco(e)}update(e){this.decorations=F5e.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),irr=srr,orr={duration:5e3,cancel:{label:l.jsx(_e,{children:l.jsx(ir,{})}),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 bd(e){const{classNames:t,...n}=orr,{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 De=(e,t={})=>{if(Array.isArray(e))return e.forEach(n=>Hl(n,bd(t)));if(Ce.isValidElement(e))return Hl(e,bd(t));if(typeof e=="string")return Hl(e,bd(t));throw new Error("Invalid message type")};De.success=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent1 shrink-0",children:l.jsx(aue,{})}),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 Hl.success(e,bd(n));case"object":return e.forEach(r=>Hl.success(r,bd(n)))}};De.error=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent2 shrink-0",children:l.jsx(vb,{})}),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 Hl.error(e,bd(n));case"object":return e.forEach(r=>Hl.error(r,bd(n)))}};De.warning=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent6 shrink-0",children:l.jsx(Tp,{})}),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 Hl.warning(e,bd(n));case"object":return e.forEach(r=>Hl.warning(r,bd(n)))}};De.info=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent3 shrink-0",children:l.jsx(Fl,{})}),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 Hl.info(e,bd(n));case"object":return e.forEach(r=>Hl.info(r,bd(n)))}};De.custom=(e,t={})=>Hl(e,bd(t));De.dismiss=e=>{e&&Hl.dismiss(e)};De.promise=({myPromise:e,loadingMessage:t,successMessage:n,errorMessage:r,onSuccess:a,onError:s,options:i={}})=>Hl.promise(e,{loading:t??"Loading...",success:o=>(a?.(o),n),error:o=>(s?.(o),r||o?.message||"Error..."),...bd(i)});function Ff({text:e,copyMessage:t="Copied to clipboard!"}){const[n,r]=x.useState(!1),a=x.useRef(null),s=x.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{De.success(t),r(!0),a.current&&(clearTimeout(a.current),a.current=null),a.current=setTimeout(()=>{r(!1)},2e3)}).catch(()=>{De.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:n,handleCopy:s}}function pi({content:e,copyMessage:t,tooltip:n="Copy to clipboard",size:r="sm",className:a}){const[s,i]=x.useState(!1),{handleCopy:o}=Ff({text:e,copyMessage:t}),c=()=>{o(),i(!0),setTimeout(()=>i(!1),2e3)};return l.jsxs(ar,{children:[l.jsx(sr,{asChild:!0,children:l.jsx(ye,{onClick:c,type:"button",size:r,className:a,"aria-label":s?"Copied!":n,children:s?l.jsx(ha,{}):l.jsx(Wl,{})})}),l.jsx(Jn,{children:s?"Copied!":n})]})}function lrr(){const e=AI({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:[ie.className,ie.propertyName],color:"var(--neutral6)"},{tag:ie.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ie.heading1,ie.heading2,ie.heading3,ie.heading4,ie.heading5,ie.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:ie.emphasis,fontStyle:"italic",color:"var(--neutral6)"},{tag:ie.strong,fontWeight:"bold",color:"var(--neutral6)"},{tag:ie.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ie.url,color:"var(--accent3)"},{tag:ie.monospace,color:"var(--neutral6)"},{tag:ie.strikethrough,textDecoration:"line-through"},{tag:ie.quote,fontStyle:"italic",color:"var(--neutral2)"}]}),t=gt.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 crr(){const e=gt.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=Tm.define([{tag:[ie.comment,ie.bracket],color:"var(--neutral2)"},{tag:[ie.string,ie.meta,ie.regexp],color:"var(--accent1)"},{tag:[ie.atom,ie.bool,ie.special(ie.variableName)],color:"var(--accent6)"},{tag:[ie.keyword,ie.operator,ie.tagName],color:"var(--accent2)"},{tag:[ie.function(ie.propertyName),ie.propertyName],color:"var(--accent5)"},{tag:[ie.definition(ie.variableName),ie.function(ie.variableName),ie.className,ie.attributeName],color:"var(--accent3)"},{tag:[ie.variableName,ie.number],color:"var(--accent5)"},{tag:[ie.name,ie.quote],color:"var(--accent1)"},{tag:ie.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ie.heading1,ie.heading2,ie.heading3,ie.heading4,ie.heading5,ie.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:[ie.emphasis],fontStyle:"italic",color:"var(--neutral6)"},{tag:[ie.strong],fontWeight:"bold",color:"var(--neutral6)"},{tag:ie.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ie.url,color:"var(--accent3)"},{tag:ie.monospace,color:"var(--neutral6)"},{tag:ie.strikethrough,textDecoration:"line-through"},{tag:[ie.deleted],color:"var(--accent2)"},{tag:ie.invalid,color:"var(--error)"},{tag:[ie.standard(ie.tagName)],color:"var(--accent1)"}]);return[e,Ww(t)]}const Cv=()=>{const e=Uz();return x.useMemo(()=>e?lrr():crr(),[e])},ls=x.forwardRef(({data:e,value:t,onChange:n,showCopyButton:r=!0,className:a,language:s="json",highlightVariables:i=!1,placeholder:o,schema:c,autoFocus:u,lineNumbers:d=!0,...f},p)=>{const h=Cv(),m=e?JSON.stringify(e,null,2):t??"",g=x.useMemo(()=>{const v=[];return s==="json"?v.push(md):s==="markdown"&&(v.push(bde({base:ew,codeLanguages:Oat})),v.push(gt.lineWrapping)),i&&s==="markdown"&&v.push(irr),c&&s==="markdown"&&v.push(trr(c)),v},[s,i,c]);return l.jsxs("div",{className:Y("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",a),...f,children:[r&&l.jsx(pi,{content:m,className:"absolute top-2 right-2 z-20"}),l.jsx(ku,{ref:p,value:m,theme:h,extensions:g,onChange:n,"aria-label":"Code editor",placeholder:o,height:"100%",style:{height:"100%"},autoFocus:u,basicSetup:{lineNumbers:d}})]})});async function urr(e,t){const{codeToTokens:n,bundledLanguages:r}=await We(async()=>{const{codeToTokens:s,bundledLanguages:i}=await import("./index-BeJj5mk-.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 drr=({selectionReason:e,open:t,onOpenChange:n,input:r})=>{let a=null;if(r)try{a=typeof r=="object"?l.jsx(ls,{data:r}):l.jsx(ls,{data:JSON.parse(r)})}catch{a=l.jsx("pre",{className:"whitespace-pre-wrap",children:r})}return l.jsx(_r,{open:t,onOpenChange:n,children:l.jsxs(yr,{children:[l.jsxs(Er,{children:[l.jsx(br,{children:"Agent Network Metadata"}),l.jsx(Ga,{children:"View the metadata of the agent's network choice."})]}),l.jsxs(Dr,{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ge,{className:"text-neutral3",children:"Selection Reason"}),l.jsx("div",{className:"text-neutral6 text-ui-md",children:e})]}),a&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(ge,{className:"text-neutral3",children:"Input"}),l.jsx("div",{className:"text-neutral6 text-ui-md",children:a})]})]})]})})},Kme=({selectionReason:e,input:t})=>{const[n,r]=x.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(ds,{variant:"light",size:"md",tooltip:"Show selection reason",onClick:()=>r(a=>!a),children:l.jsx($Zt,{className:"text-neutral3 size-5"})}),l.jsx(drr,{selectionReason:e||"",open:n,onOpenChange:r,input:t})]})},tbt=x.createContext(void 0);function frr({children:e,approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:c,networkToolCallApprovals:u}){return l.jsx(tbt.Provider,{value:{approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:c,networkToolCallApprovals:u},children:e})}function prr(){const e=x.useContext(tbt);if(!e)throw new Error("useToolCall must be used within a ToolCallProvider");return e}const OR=({toolCalled:e,toolCallId:t,toolApprovalMetadata:n,toolName:r,isNetwork:a,isGenerateMode:s})=>{const{approveToolcall:i,declineToolcall:o,approveToolcallGenerate:c,declineToolcallGenerate:u,isRunning:d,toolCallApprovals:f,approveNetworkToolcall:p,declineNetworkToolcall:h,networkToolCallApprovals:m}=prr(),g=()=>{a?p(r,n?.runId):s?c(t):i(t)},v=()=>{a?h(r,n?.runId):s?u(t):o(t)},b=a?m?.[n?.runId?`${n.runId}-${r}`:r]?.status:f?.[t]?.status;return n&&!e?l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Approval required"}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsxs(ye,{onClick:g,disabled:d||!!b,className:b==="approved"?"text-accent1!":"",children:[l.jsx(_e,{children:l.jsx(ha,{})}),"Approve"]}),l.jsxs(ye,{onClick:v,disabled:d||!!b,className:b==="declined"?"text-accent2!":"",children:[l.jsx(_e,{children:l.jsx(ir,{})}),"Decline"]})]})]}):null},hrr=({agentId:e,messages:t=[],metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:o,toolCalled:c,isComplete:u=!1})=>{const d=n?.mode==="network"?n.selectionReason:void 0,f=n?.mode==="network"?n.agentInput:void 0,p=n?.mode==="stream"||n?.mode==="network"||n?.mode==="generate"?n?.requireApprovalMetadata:void 0,h=n?.mode==="stream"||n?.mode==="network"||n?.mode==="generate"?n?.suspendedTools:void 0,m=t.length>0&&t.every(b=>b.type==="text"?!0:b.toolOutput!==void 0);let g=m;i&&(g=c??m);let v=typeof o=="string"?l.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:o}):l.jsx(ls,{data:o,"data-testid":"tool-suspend-payload"});return l.jsxs(Vz,{"data-testid":"agent-badge",icon:l.jsx(Ys,{className:"text-accent1"}),title:e,initialCollapsed:u&&!a,extraInfo:n?.mode==="network"&&l.jsx(Kme,{selectionReason:d??"",input:f}),children:[t.map((b,w)=>{if(b.type==="text")return l.jsx(Uet,{children:b.content},w);let O;try{O=typeof b.toolOutput=="string"?JSON.parse(b.toolOutput):b.toolOutput}catch{O=b.toolOutput}return l.jsx(Ce.Fragment,{children:l.jsx(Pbt,{toolName:b.toolName,argsText:typeof b.args=="string"?b.args:JSON.stringify(b.args),result:O,args:b.args,status:{type:"complete"},type:"tool-call",toolCallId:b.toolCallId,addResult:()=>{},resume:()=>{},metadata:{mode:"stream",requireApprovalMetadata:p,suspendedTools:h}})},w)}),v!==void 0&&o&&l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Agent suspend payload"}),v]}),l.jsx(OR,{toolCalled:g,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,isGenerateMode:n?.mode==="generate"})]})};function Tr({className:e,...t}){return l.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 Jme=()=>l.jsx(Vz,{icon:l.jsx(Ft,{color:M6.neutral3}),title:l.jsx(Tr,{className:"ml-2 w-12 h-2"}),collapsible:!1}),mrr=({agentId:e,result:t,metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:o,toolCalled:c,isComplete:u})=>{const{data:d,isLoading:f}=Cyt({threadId:t?.subAgentThreadId,agentId:e,memory:!0});if(f)return l.jsx(Jme,{});const p=d?.messages?JHe(d.messages):[];let h=t?.childMessages?.length?t.childMessages:void 0;if(!h&&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}),h=m}return h||(h=FFt(p)),l.jsx(hrr,{agentId:e,messages:h??[],metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:o,toolCalled:c,isComplete:u})},Hz=({copiedDuration:e=1500}={})=>{const[t,n]=x.useState(!1);return{isCopied:t,copyToClipboard:a=>{a&&navigator.clipboard.writeText(a).then(()=>{n(!0),setTimeout(()=>n(!1),e)})}}},nbt=x.createContext({Link:x.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:()=>""}}),rbt=({children:e,Link:t,navigate:n,paths:r})=>l.jsx(nbt.Provider,{value:{Link:t,navigate:n,paths:r},children:e}),en=()=>{const e=x.useContext(nbt);if(!e)throw new Error("useLinkComponent must be used within a LinkComponentProvider");return e},grr=({toolName:e,args:t,result:n,toolCallId:r,toolApprovalMetadata:a,isNetwork:s,toolCalled:i})=>{const[o,c]=x.useState(!a),{isCopied:u,copyToClipboard:d}=Hz();x.useEffect(()=>{c(!a)},[a]);const{Link:f}=en();let p={path:"."};try{p=typeof t=="object"?t:JSON.parse(t)}catch{}const{path:h=".",maxDepth:m,showHidden:g,dirsOnly:v,exclude:b,extension:w}=p,O=[];m!==void 0&&m!==3&&O.push(`depth: ${m}`),g&&O.push("hidden"),v&&O.push("dirs only"),b&&O.push(`exclude: ${b}`),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=b,u.ParserHandle=g,u.NetworkStreamer=f,u.FileStreamer=p,u.StringStreamer=h,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,V,z=I[0];if(T(j.before)){var H=j.before(z.file,z.inputElem);if(typeof H=="object"){if(H.action==="abort")return F="AbortError",D=z.file,U=z.inputElem,V=H.reason,void(T(j.error)&&j.error({name:F},D,U,V));if(H.action==="skip")return void M();typeof H.config=="object"&&(z.instanceConfig=a.extend(z.instanceConfig,H.config))}else if(H==="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,(p.prototype=Object.create(d.prototype)).constructor=p,(h.prototype=Object.create(h.prototype)).constructor=h,(m.prototype=Object.create(d.prototype)).constructor=m,u})})(G2)),G2.exports}var yer=ver();const nyt=fo(yer);var l5e=1,ber=.9,xer=.8,wer=.17,oJ=.1,lJ=.999,Ser=.9999,Oer=.99,ker=/[\\\/_+.#"@\[\(\{&]/,_er=/[\\\/_+.#"@\[\(\{&]/g,Eer=/[\s-]/,ryt=/[\s-]/g;function Vae(e,t,n,r,a,s,i){if(s===t.length)return a===e.length?l5e:Oer;var o=`${a},${s}`;if(i[o]!==void 0)return i[o];for(var c=r.charAt(s),u=n.indexOf(c,a),d=0,f,p,h,m;u>=0;)f=Vae(e,t,n,r,u+1,s+1,i),f>d&&(u===a?f*=l5e:ker.test(e.charAt(u-1))?(f*=xer,h=e.slice(a,u-1).match(_er),h&&a>0&&(f*=Math.pow(lJ,h.length))):Eer.test(e.charAt(u-1))?(f*=ber,m=e.slice(a,u-1).match(ryt),m&&a>0&&(f*=Math.pow(lJ,m.length))):(f*=wer,a>0&&(f*=Math.pow(lJ,u-a))),e.charAt(u)!==t.charAt(s)&&(f*=Ser)),(f<oJ&&n.charAt(u-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(u-1)!==r.charAt(s))&&(p=Vae(e,t,n,r,u+1,s+2,i),p*oJ>f&&(f=p*oJ)),f>d&&(d=f),u=n.indexOf(c,u+1);return i[o]=d,d}function c5e(e){return e.toLowerCase().replace(ryt," ")}function Cer(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Vae(e,t,c5e(e),c5e(t),0,0,{})}var TC='[cmdk-group=""]',cJ='[cmdk-group-items=""]',jer='[cmdk-group-heading=""]',ayt='[cmdk-item=""]',u5e=`${ayt}:not([aria-disabled="true"])`,Hae="cmdk-item-select",C1="data-value",Ter=(e,t,n)=>Cer(e,t,n),syt=x.createContext(void 0),xR=()=>x.useContext(syt),iyt=x.createContext(void 0),$me=()=>x.useContext(iyt),oyt=x.createContext(void 0),lyt=x.forwardRef((e,t)=>{let n=j1(()=>{var B,R;return{search:"",value:(R=(B=e.value)!=null?B:e.defaultValue)!=null?R:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=j1(()=>new Set),a=j1(()=>new Map),s=j1(()=>new Map),i=j1(()=>new Set),o=cyt(e),{label:c,children:u,value:d,onValueChange:f,filter:p,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...b}=e,w=Qi(),O=Qi(),k=Qi(),_=x.useRef(null),C=zer();xw(()=>{if(d!==void 0){let B=d.trim();n.current.value=B,T.emit()}},[d]),xw(()=>{C(6,F)},[]);let T=x.useMemo(()=>({subscribe:B=>(i.current.add(B),()=>i.current.delete(B)),snapshot:()=>n.current,setState:(B,R,Q)=>{var G,J,re,ne;if(!Object.is(n.current[B],R)){if(n.current[B]=R,B==="search")M(),I(),C(1,P);else if(B==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let se=document.getElementById(k);se?se.focus():(G=document.getElementById(w))==null||G.focus()}if(C(7,()=>{var se;n.current.selectedItemId=(se=D())==null?void 0:se.id,T.emit()}),Q||C(5,F),((J=o.current)==null?void 0:J.value)!==void 0){let se=R??"";(ne=(re=o.current).onValueChange)==null||ne.call(re,se);return}}T.emit()}},emit:()=>{i.current.forEach(B=>B())}}),[]),j=x.useMemo(()=>({value:(B,R,Q)=>{var G;R!==((G=s.current.get(B))==null?void 0:G.value)&&(s.current.set(B,{value:R,keywords:Q}),n.current.filtered.items.set(B,A(R,Q)),C(2,()=>{I(),T.emit()}))},item:(B,R)=>(r.current.add(B),R&&(a.current.has(R)?a.current.get(R).add(B):a.current.set(R,new Set([B]))),C(3,()=>{M(),I(),n.current.value||P(),T.emit()}),()=>{s.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let Q=D();C(4,()=>{M(),Q?.getAttribute("id")===B&&P(),T.emit()})}),group:B=>(a.current.has(B)||a.current.set(B,new Set),()=>{s.current.delete(B),a.current.delete(B)}),filter:()=>o.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:w,inputId:k,labelId:O,listInnerRef:_}),[]);function A(B,R){var Q,G;let J=(G=(Q=o.current)==null?void 0:Q.filter)!=null?G:Ter;return B?J(B,n.current.search,R):0}function I(){if(!n.current.search||o.current.shouldFilter===!1)return;let B=n.current.filtered.items,R=[];n.current.filtered.groups.forEach(G=>{let J=a.current.get(G),re=0;J.forEach(ne=>{let se=B.get(ne);re=Math.max(se,re)}),R.push([G,re])});let Q=_.current;U().sort((G,J)=>{var re,ne;let se=G.getAttribute("id"),le=J.getAttribute("id");return((re=B.get(le))!=null?re:0)-((ne=B.get(se))!=null?ne:0)}).forEach(G=>{let J=G.closest(cJ);J?J.appendChild(G.parentElement===J?G:G.closest(`${cJ} > *`)):Q.appendChild(G.parentElement===Q?G:G.closest(`${cJ} > *`))}),R.sort((G,J)=>J[1]-G[1]).forEach(G=>{var J;let re=(J=_.current)==null?void 0:J.querySelector(`${TC}[${C1}="${encodeURIComponent(G[0])}"]`);re?.parentElement.appendChild(re)})}function P(){let B=U().find(Q=>Q.getAttribute("aria-disabled")!=="true"),R=B?.getAttribute(C1);T.setState("value",R||void 0)}function M(){var B,R,Q,G;if(!n.current.search||o.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let J=0;for(let re of r.current){let ne=(R=(B=s.current.get(re))==null?void 0:B.value)!=null?R:"",se=(G=(Q=s.current.get(re))==null?void 0:Q.keywords)!=null?G:[],le=A(ne,se);n.current.filtered.items.set(re,le),le>0&&J++}for(let[re,ne]of a.current)for(let se of ne)if(n.current.filtered.items.get(se)>0){n.current.filtered.groups.add(re);break}n.current.filtered.count=J}function F(){var B,R,Q;let G=D();G&&(((B=G.parentElement)==null?void 0:B.firstChild)===G&&((Q=(R=G.closest(TC))==null?void 0:R.querySelector(jer))==null||Q.scrollIntoView({block:"nearest"})),G.scrollIntoView({block:"nearest"}))}function D(){var B;return(B=_.current)==null?void 0:B.querySelector(`${ayt}[aria-selected="true"]`)}function U(){var B;return Array.from(((B=_.current)==null?void 0:B.querySelectorAll(u5e))||[])}function V(B){let R=U()[B];R&&T.setState("value",R.getAttribute(C1))}function z(B){var R;let Q=D(),G=U(),J=G.findIndex(ne=>ne===Q),re=G[J+B];(R=o.current)!=null&&R.loop&&(re=J+B<0?G[G.length-1]:J+B===G.length?G[0]:G[J+B]),re&&T.setState("value",re.getAttribute(C1))}function H(B){let R=D(),Q=R?.closest(TC),G;for(;Q&&!G;)Q=B>0?Ler(Q,TC):Fer(Q,TC),G=Q?.querySelector(u5e);G?T.setState("value",G.getAttribute(C1)):z(B)}let W=()=>V(U().length-1),$=B=>{B.preventDefault(),B.metaKey?W():B.altKey?H(1):z(1)},Z=B=>{B.preventDefault(),B.metaKey?V(0):B.altKey?H(-1):z(-1)};return x.createElement(po.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:B=>{var R;(R=b.onKeyDown)==null||R.call(b,B);let Q=B.nativeEvent.isComposing||B.keyCode===229;if(!(B.defaultPrevented||Q))switch(B.key){case"n":case"j":{v&&B.ctrlKey&&$(B);break}case"ArrowDown":{$(B);break}case"p":case"k":{v&&B.ctrlKey&&Z(B);break}case"ArrowUp":{Z(B);break}case"Home":{B.preventDefault(),V(0);break}case"End":{B.preventDefault(),W();break}case"Enter":{B.preventDefault();let G=D();if(G){let J=new Event(Hae);G.dispatchEvent(J)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:j.inputId,id:j.labelId,style:Uer},c),Bz(e,B=>x.createElement(iyt.Provider,{value:T},x.createElement(syt.Provider,{value:j},B))))}),Ner=x.forwardRef((e,t)=>{var n,r;let a=Qi(),s=x.useRef(null),i=x.useContext(oyt),o=xR(),c=cyt(e),u=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:i?.forceMount;xw(()=>{if(!u)return o.item(a,i?.id)},[u]);let d=uyt(a,s,[e.value,e.children,s],e.keywords),f=$me(),p=Cb(C=>C.value&&C.value===d.current),h=Cb(C=>u||o.filter()===!1?!0:C.search?C.filtered.items.get(a)>0:!0);x.useEffect(()=>{let C=s.current;if(!(!C||e.disabled))return C.addEventListener(Hae,m),()=>C.removeEventListener(Hae,m)},[h,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(!h)return null;let{disabled:v,value:b,onSelect:w,forceMount:O,keywords:k,..._}=e;return x.createElement(po.div,{ref:om(s,t),..._,id:a,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!p,"data-disabled":!!v,"data-selected":!!p,onPointerMove:v||o.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)}),Aer=x.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...s}=e,i=Qi(),o=x.useRef(null),c=x.useRef(null),u=Qi(),d=xR(),f=Cb(h=>a||d.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);xw(()=>d.group(i),[]),uyt(i,o,[e.value,e.heading,c]);let p=x.useMemo(()=>({id:i,forceMount:a}),[a]);return x.createElement(po.div,{ref:om(o,t),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&x.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Bz(e,h=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},x.createElement(oyt.Provider,{value:p},h))))}),Ier=x.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=x.useRef(null),s=Cb(i=>!i.search);return!n&&!s?null:x.createElement(po.div,{ref:om(a,t),...r,"cmdk-separator":"",role:"separator"})}),Rer=x.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,s=$me(),i=Cb(u=>u.search),o=Cb(u=>u.selectedItemId),c=xR();return x.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),x.createElement(po.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":o,id:c.inputId,type:"text",value:a?e.value:i,onChange:u=>{a||s.setState("search",u.target.value),n?.(u.target.value)}})}),Per=x.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,s=x.useRef(null),i=x.useRef(null),o=Cb(u=>u.selectedItemId),c=xR();return x.useEffect(()=>{if(i.current&&s.current){let u=i.current,d=s.current,f,p=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let h=u.offsetHeight;d.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return p.observe(u),()=>{cancelAnimationFrame(f),p.unobserve(u)}}},[]),x.createElement(po.div,{ref:om(s,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:c.listId},Bz(e,u=>x.createElement("div",{ref:om(i,c.listInnerRef),"cmdk-list-sizer":""},u)))}),Mer=x.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:s,container:i,...o}=e;return x.createElement(s6,{open:n,onOpenChange:r},x.createElement(i6,{container:i},x.createElement(uI,{"cmdk-overlay":"",className:a}),x.createElement(dI,{"aria-label":e.label,"cmdk-dialog":"",className:s},x.createElement(lyt,{ref:t,...o}))))}),Der=x.forwardRef((e,t)=>Cb(n=>n.filtered.count===0)?x.createElement(po.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),$er=x.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...s}=e;return x.createElement(po.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},Bz(e,i=>x.createElement("div",{"aria-hidden":!0},i)))}),Ru=Object.assign(lyt,{List:Per,Item:Ner,Input:Rer,Group:Aer,Separator:Ier,Dialog:Mer,Empty:Der,Loading:$er});function Ler(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Fer(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function cyt(e){let t=x.useRef(e);return xw(()=>{t.current=e}),t}var xw=typeof window>"u"?x.useEffect:x.useLayoutEffect;function j1(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function Cb(e){let t=$me(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function uyt(e,t,n,r=[]){let a=x.useRef(),s=xR();return xw(()=>{var i;let o=(()=>{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,o,c),(i=t.current)==null||i.setAttribute(C1,o),a.current=o}),a}var zer=()=>{let[e,t]=x.useState(),n=j1(()=>new Map);return xw(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function Ber(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Bz({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(Ber(t),{ref:t.ref},n(t.props.children)):n(t)}var Uer={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};class ro{constructor(t,n,r,a){this.fromA=t,this.toA=n,this.fromB=r,this.toB=a}offset(t,n=t){return new ro(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}}function ww(e,t,n,r,a,s){if(e==r)return[];let i=Fme(e,t,n,r,a,s),o=zme(e,t+i,n,r,a+i,s);t+=i,n-=o,a+=i,s-=o;let c=n-t,u=s-a;if(!c||!u)return[new ro(t,n,a,s)];if(c>u){let f=e.slice(t,n).indexOf(r.slice(a,s));if(f>-1)return[new ro(t,t+f,a,a),new ro(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 ro(t,t,a,a+f),new ro(n,n,a+f+c,s)]}if(c==1||u==1)return[new ro(t,n,a,s)];let d=pyt(e,t,n,r,a,s);if(d){let[f,p,h]=d;return ww(e,t,f,r,a,p).concat(ww(e,f+h,n,r,p+h,s))}return qer(e,t,n,r,a,s)}let dj=1e9,fj=0,Lme=!1;function qer(e,t,n,r,a,s){let i=n-t,o=s-a;if(dj<1e9&&Math.min(i,o)>dj*16||fj>0&&Date.now()>fj)return Math.min(i,o)>dj*64?[new ro(t,n,a,s)]:d5e(e,t,n,r,a,s);let c=Math.ceil((i+o)/2);uJ.reset(c),dJ.reset(c);let u=(h,m)=>e.charCodeAt(t+h)==r.charCodeAt(a+m),d=(h,m)=>e.charCodeAt(n-h-1)==r.charCodeAt(s-m-1),f=(i-o)%2!=0?dJ:null,p=f?null:uJ;for(let h=0;h<c;h++){if(h>dj||fj>0&&!(h&63)&&Date.now()>fj)return d5e(e,t,n,r,a,s);let m=uJ.advance(h,i,o,c,f,!1,u)||dJ.advance(h,i,o,c,p,!0,d);if(m)return Ver(e,t,n,t+m[0],r,a,s,a+m[1])}return[new ro(t,n,a,s)]}class dyt{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,o){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&&o(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 p=a+(n-r)-c;if(p>=0&&p<this.len&&s.vec[p]!=-1)if(i){let h=s.vec[p];if(h>=n-d)return[h,a+h-p]}else{let h=n-s.vec[p];if(d>=h)return[d,f]}}}return null}}const uJ=new dyt,dJ=new dyt;function Ver(e,t,n,r,a,s,i,o){let c=!1;return!Fk(e,r)&&++r==n&&(c=!0),!Fk(a,o)&&++o==i&&(c=!0),c?[new ro(t,n,s,i)]:ww(e,t,r,a,s,o).concat(ww(e,r,n,a,o,i))}function fyt(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n=n<<1;return n}function Fme(e,t,n,r,a,s){if(t==n||t==s||e.charCodeAt(t)!=r.charCodeAt(a))return 0;let i=fyt(n-t,s-a);for(let o=t,c=a;;){let u=o+i,d=c+i;if(u>n||d>s||e.slice(o,u)!=r.slice(c,d)){if(i==1)return o-t-(Fk(e,o)?0:1);i=i>>1}else{if(u==n||d==s)return u-t;o=u,c=d}}}function zme(e,t,n,r,a,s){if(t==n||a==s||e.charCodeAt(n-1)!=r.charCodeAt(s-1))return 0;let i=fyt(n-t,s-a);for(let o=n,c=s;;){let u=o-i,d=c-i;if(u<t||d<a||e.slice(u,o)!=r.slice(d,c)){if(i==1)return n-o-(Fk(e,o)?0:1);i=i>>1}else{if(u==t||d==a)return n-u;o=u,c=d}}}function Qae(e,t,n,r,a,s,i,o){let c=r.slice(a,s),u=null;for(;;){if(u||i<o)return u;for(let d=t+i;;){Fk(e,d)||d++;let f=d+i;if(Fk(e,f)||(f+=f==d+1?1:-1),f>=n)break;let p=e.slice(d,f),h=-1;for(;(h=c.indexOf(p,h+1))!=-1;){let m=Fme(e,f,n,r,a+h+p.length,s),g=zme(e,t,d,r,a,a+h),v=p.length+m+g;(!u||u[2]<v)&&(u=[d-g,a+h-g,v])}d=f}if(o<0)return u;i=i>>1}}function pyt(e,t,n,r,a,s){let i=n-t,o=s-a;if(i<o){let c=pyt(r,a,s,e,t,n);return c&&[c[1],c[0],c[2]]}return i<4||o*2<i?null:Qae(e,t,n,r,a,s,Math.floor(i/4),-1)}function d5e(e,t,n,r,a,s){Lme=!0;let i=n-t,o=s-a,c;if(i<o){let p=Qae(r,a,s,e,t,n,Math.floor(i/6),50);c=p&&[p[1],p[0],p[2]]}else c=Qae(e,t,n,r,a,s,Math.floor(o/6),50);if(!c)return[new ro(t,n,a,s)];let[u,d,f]=c;return ww(e,t,u,r,a,d).concat(ww(e,u+f,n,r,d+f,s))}function hyt(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 ro(r.fromA,a.toA,r.fromB,a.toB),e.splice(n--,1))}}function Her(e,t,n){for(;;){hyt(n,1);let r=!1;for(let a=0;a<n.length;a++){let s=n[a],i,o;(i=Fme(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=n[a]=new ro(s.fromA+i,s.toA,s.fromB+i,s.toB)),(o=zme(e,s.fromA,s.toA,t,s.fromB,s.toB))&&(s=n[a]=new ro(s.fromA,s.toA-o,s.fromB,s.toB-o));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 p=c?e.slice(s.fromA,s.toA):t.slice(s.fromB,s.toB);d<=p.length&&e.slice(s.fromA-d,s.fromA)==p.slice(p.length-d)?(n[a]=new ro(s.fromA-d,s.toA-d,s.fromB-d,s.toB-d),r=!0):f<=p.length&&e.slice(s.toA,s.toA+f)==p.slice(0,f)&&(n[a]=new ro(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),r=!0)}if(!r)break}return n}function Qer(e,t,n){for(let r=0,a=0;a<e.length;a++){let s=e[a],i=s.toA-s.fromA,o=s.toB-s.fromB;if(i&&o||i>3||o>3){let c=a==e.length-1?t.length:e[a+1].fromA,u=s.fromA-r,d=c-s.toA,f=p5e(t,s.fromA,u),p=f5e(t,s.toA,d),h=s.fromA-f,m=p-s.toA;if((!i||!o)&&h&&m){let g=Math.max(i,o),[v,b,w]=i?[t,s.fromA,s.toA]:[n,s.fromB,s.toB];g>h&&t.slice(f,s.fromA)==v.slice(w-h,w)?(s=e[a]=new ro(f,f+i,s.fromB-h,s.toB-h),f=s.fromA,p=f5e(t,s.toA,c-s.toA)):g>m&&t.slice(s.toA,p)==v.slice(b,b+m)&&(s=e[a]=new ro(p-i,p,s.fromB+m,s.toB+m),p=s.toA,f=p5e(t,s.fromA,s.fromA-r)),h=s.fromA-f,m=p-s.toA}if(h||m)s=e[a]=new ro(s.fromA-h,s.toA+m,s.fromB-h,s.toB+m);else if(i){if(!o){let g=m5e(t,s.fromA,s.toA),v,b=g<0?-1:h5e(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):b>-1&&(v=s.toA-b)<=u&&t.slice(s.fromA-v,s.fromA)==t.slice(b,s.toA)&&(s=e[a]=s.offset(-v))}}else{let g=m5e(n,s.fromB,s.toB),v,b=g<0?-1:h5e(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):b>-1&&(v=s.toB-b)<=u&&n.slice(s.fromB-v,s.fromB)==n.slice(b,s.toB)&&(s=e[a]=s.offset(-v))}}r=s.toA}return hyt(e,3),e}let _0;try{_0=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function myt(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function gyt(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?myt(n)?1:0:_0?!byt(n)||t==e.length-1?_0.test(String.fromCharCode(n))?1:0:_0.test(e.slice(t,t+2))?2:0:0}function vyt(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?myt(n)?1:0:_0?!xyt(n)||t==1?_0.test(String.fromCharCode(n))?1:0:_0.test(e.slice(t-2,t))?2:0:0}const yyt=8;function f5e(e,t,n){if(t==e.length||!vyt(e,t))return t;for(let r=t,a=t+n,s=0;s<yyt;s++){let i=gyt(e,r);if(!i||r+i>a)return r;r+=i}return t}function p5e(e,t,n){if(!t||!gyt(e,t))return t;for(let r=t,a=t-n,s=0;s<yyt;s++){let i=vyt(e,r);if(!i||r-i<a)return r;r-=i}return t}function h5e(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function m5e(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}const byt=e=>e>=55296&&e<=56319,xyt=e=>e>=56320&&e<=57343;function Fk(e,t){return!t||t==e.length||!byt(e.charCodeAt(t-1))||!xyt(e.charCodeAt(t))}function Wer(e,t,n){var r;let a=n?.override;return a?a(e,t):(dj=((r=n?.scanLimit)!==null&&r!==void 0?r:1e9)>>1,fj=n?.timeout?Date.now()+n.timeout:0,Lme=!1,Her(e,t,ww(e,0,e.length,t,0,t.length)))}function wyt(){return!Lme}function Syt(e,t,n){return Qer(Wer(e,t,n),e,t)}const Lh=Yt.define({combine:e=>e[0]}),Wae=Xn.define(),Ger=Yt.define(),zk=ho.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Wae)&&(e=n.value);for(let n of t.state.facet(Ger))e=n(e,t);return e}});class EO{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 EO(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=Syt(t.toString(),n.toString(),r);return Oyt(a,t,n,0,0,wyt())}static updateA(t,n,r,a,s){return x5e(b5e(t,a,!0,r.length),t,n,r,s)}static updateB(t,n,r,a,s){return x5e(b5e(t,a,!1,n.length),t,n,r,s)}}function g5e(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 v5e(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 Oyt(e,t,n,r,a,s){let i=[];for(let o=0;o<e.length;o++){let c=e[o],[u,d]=g5e(c.fromA+r,c.fromB+a,t,n),[f,p]=v5e(c.toA+r,c.toB+a,t,n),h=[c.offset(-u+r,-d+a)];for(;o<e.length-1;){let m=e[o+1],[g,v]=g5e(m.fromA+r,m.fromB+a,t,n);if(g>f+1&&v>p+1)break;h.push(m.offset(-u+r,-d+a)),[f,p]=v5e(m.toA+r,m.toB+a,t,n),o++}i.push(new EO(h,u,Math.max(u,f),d,Math.max(d,p),s))}return i}const AD=1e3;function y5e(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 p=t-(n?d:f);return[d+p,f+p]}let i=a+s>>1,o=e[i],[c,u]=n?[o.fromA,o.toA]:[o.fromB,o.toB];if(c>t)s=i;else if(u<=t)a=i+1;else return r?[o.fromA,o.fromB]:[o.toA,o.toB]}}function b5e(e,t,n,r){let a=[];return t.iterChangedRanges((s,i,o,c)=>{let u=0,d=n?t.length:r,f=0,p=n?r:t.length;s>AD&&([u,f]=y5e(e,s-AD,n,!0)),i<t.length-AD&&([d,p]=y5e(e,i+AD,n,!1));let h=c-o-(i-s),m,[g,v]=n?[h,0]:[0,h];a.length&&(m=a[a.length-1]).toA>=u?a[a.length-1]={fromA:m.fromA,fromB:m.fromB,toA:d,toB:p,diffA:m.diffA+g,diffB:m.diffB+v}:a.push({fromA:u,toA:d,fromB:f,toB:p,diffA:g,diffB:v})}),a}function x5e(e,t,n,r,a){if(!e.length)return t;let s=[];for(let i=0,o=0,c=0,u=0;;i++){let d=i==e.length?null:e[i],f=d?d.fromA+o:n.length,p=d?d.fromB+c:r.length;for(;u<t.length;){let v=t[u];if(d&&(v.toA+o>f||v.toB+c>p))break;s.push(v.offset(o,c)),u++}if(!d)break;let h=d.toA+o+d.diffA,m=d.toB+c+d.diffB,g=Syt(n.sliceString(f,h),r.sliceString(p,m),a);for(let v of Oyt(g,n,r,f,p,wyt()))s.push(v);for(o+=d.diffA,c+=d.diffB;u<t.length;){let v=t[u];if(v.fromA+o>h&&v.fromB+c>m)break;u++}}return s}const Zer={scanLimit:500},kyt=ii.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=O5e(e))}update(e){(e.docChanged||e.viewportChanged||Yer(e.startState,e.state)||Xer(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=O5e(e.view))}},{decorations:e=>e.deco}),ID=Qp.low(wnt({class:"cm-changeGutter",markers:e=>{var t;return((t=e.plugin(kyt))===null||t===void 0?void 0:t.gutter)||Ur.empty}}));function Yer(e,t){return e.field(zk,!1)!=t.field(zk,!1)}function Xer(e,t){return e.facet(Lh)!=t.facet(Lh)}const w5e=nn.line({class:"cm-changedLine"}),Ker=nn.mark({class:"cm-changedText"}),Jer=nn.mark({tagName:"ins",class:"cm-insertedLine"}),etr=nn.mark({tagName:"del",class:"cm-deletedLine"}),S5e=new class extends um{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function ttr(e,t,n,r,a,s){let i=n?e.fromA:e.fromB,o=n?e.toA:e.toB,c=0;if(i!=o){a.add(i,i,w5e),a.add(i,o,n?etr:Jer),s&&s.add(i,i,S5e);for(let u=t.iterRange(i,o-1),d=i;!u.next().done;){if(u.lineBreak){d++,a.add(d,d,w5e),s&&s.add(d,d,S5e);continue}let f=d+u.value.length;if(r)for(;c<e.changes.length;){let p=e.changes[c],h=i+(n?p.fromA:p.fromB),m=i+(n?p.toA:p.toB),g=Math.max(d,h),v=Math.min(f,m);if(g<v&&a.add(g,v,Ker),m<f)c++;else break}d=f}}}function O5e(e){let t=e.state.field(zk),{side:n,highlightChanges:r,markGutter:a,overrideChunk:s}=e.state.facet(Lh),i=n=="a",o=new Su,c=a?new Su: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,o,c))&&ttr(f,e.state.doc,i,r,o,c)}return{deco:o.finish(),gutter:c&&c.finish()}}class RD extends Pd{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 s3=Xn.define({map:(e,t)=>e.map(t)}),pj=ho.define({create:()=>nn.none,update:(e,t)=>{for(let n of t.effects)if(n.is(s3))return n.value;return e.map(t.changes)},provide:e=>gt.decorations.from(e)}),PD=.01;function k5e(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 ntr(e,t,n){let r=new Su,a=new Su,s=e.state.field(pj).iter(),i=t.state.field(pj).iter(),o=0,c=0,u=0,d=0,f=e.viewport,p=t.viewport;for(let v=0;;v++){let b=v<n.length?n[v]:null,w=b?b.fromA:e.state.doc.length,O=b?b.fromB:t.state.doc.length;if(o<w){let k=e.lineBlockAt(o).top+u,_=t.lineBlockAt(c).top+d,C=k-_;C<-PD?(u-=C,r.add(o,o,nn.widget({widget:new RD(-C),block:!0,side:-1}))):C>PD&&(d+=C,a.add(c,c,nn.widget({widget:new RD(C),block:!0,side:-1})))}if(w>o+1e3&&o<f.from&&w>f.from&&c<p.from&&O>p.from){let k=Math.min(f.from-o,p.from-c);o+=k,c+=k,v--}else if(b)o=b.toA,c=b.toB;else break;for(;s.value&&s.from<o;)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 h=e.contentHeight+u-(t.contentHeight+d);h<PD?r.add(e.state.doc.length,e.state.doc.length,nn.widget({widget:new RD(-h),block:!0,side:1})):h>PD&&a.add(t.state.doc.length,t.state.doc.length,nn.widget({widget:new RD(h),block:!0,side:1}));let m=r.finish(),g=a.finish();k5e(m,e.state.field(pj))||e.dispatch({effects:s3.of(m)}),k5e(g,t.state.field(pj))||t.dispatch({effects:s3.of(g)})}const Gae=Xn.define({map:(e,t)=>t.mapPos(e)});class rtr extends Pd{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:Gae.of(a)});let{side:s,sibling:i}=t.state.facet(Lh);i&&i().dispatch({effects:Gae.of(atr(a,t.state.field(zk),s=="a"))})}),n}ignoreEvent(t){return t instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function atr(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 str=ho.define({create(e){return nn.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Gae)&&(e=e.update({filter:r=>r!=n.value}));return e},provide:e=>gt.decorations.from(e)});function _5e({margin:e=3,minSize:t=4}){return str.init(n=>itr(n,e,t))}function itr(e,t,n){let r=new Su,a=e.facet(Lh).side=="a",s=e.field(zk),i=1;for(let o=0;;o++){let c=o<s.length?s[o]:null,u=o?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,nn.replace({widget:new rtr(f),block:!0})),!c)break;i=e.doc.lineAt(Math.min(e.doc.length,a?c.toA:c.toB)).number}return r.finish()}const otr=gt.styleModule.of(new Xg({".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"}})),ltr=gt.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"}}),E5e=new b_,MD=new b_;class ctr{constructor(t){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=t.diffConfig||Zer;let n=[Qp.low(kyt),ltr,otr,pj,gt.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(p=>p.effects.some(h=>h.is(s3)))&&this.measure()})],r=[Lh.of({side:"a",sibling:()=>this.b,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&r.push(ID);let a=Mr.create({doc:t.a.doc,selection:t.a.selection,extensions:[t.a.extensions||[],gt.editorAttributes.of({class:"cm-merge-a"}),MD.of(r),n]}),s=[Lh.of({side:"b",sibling:()=>this.a,highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1})];t.gutter!==!1&&s.push(ID);let i=Mr.create({doc:t.b.doc,selection:t.b.selection,extensions:[t.b.extensions||[],gt.editorAttributes.of({class:"cm-merge-b"}),MD.of(s),n]});this.chunks=EO.build(a.doc,i.doc,this.diffConf);let o=[zk.init(()=>this.chunks),E5e.of(t.collapseUnchanged?_5e(t.collapseUnchanged):[])];a=a.update({effects:Xn.appendConfig.of(o)}).state,i=i.update({effects:Xn.appendConfig.of(o)}).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 gt({state:a,parent:u,root:t.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new gt({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,o)=>i.compose(o.changes),to.empty(t[0].startState.doc.length));this.chunks=n==this.a?EO.updateA(this.chunks,r.newDoc,this.b.state.doc,a,this.diffConf):EO.updateB(this.chunks,this.a.state.doc,r.newDoc,a,this.diffConf),n.update([...t,r.state.update({effects:Wae.of(this.chunks)})]);let s=n==this.a?this.b:this.a;s.update([s.state.update({effects:Wae.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,o=this.b.dom.parentNode;i.remove(),o.remove(),this.editorDOM.insertBefore(s?i:o,this.editorDOM.firstChild),this.editorDOM.appendChild(s?o:i),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in t||"renderRevertControl"in t){let s=!!this.revertDOM,i=this.revertToA,o=this.renderRevert;"revertControls"in t&&(s=!!t.revertControls,i=t.revertControls=="b-to-a"),"renderRevertControl"in t&&(o=t.renderRevertControl),this.setupRevertControls(s,i,o)}let n="highlightChanges"in t,r="gutter"in t,a="collapseUnchanged"in t;if(n||r||a){let s=[],i=[];if(n||r){let o=this.a.state.facet(Lh),c=r?t.gutter!==!1:o.markGutter,u=n?t.highlightChanges!==!1:o.highlightChanges;s.push(MD.reconfigure([Lh.of({side:"a",sibling:()=>this.b,highlightChanges:u,markGutter:c}),c?ID:[]])),i.push(MD.reconfigure([Lh.of({side:"b",sibling:()=>this.a,highlightChanges:u,markGutter:c}),c?ID:[]]))}if(a){let o=E5e.reconfigure(t.collapseUnchanged?_5e(t.collapseUnchanged):[]);s.push(o),i.push(o)}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(){ntr(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 o=this.a.lineBlockAt(i.fromA).top+"px";for(;n&&+n.dataset.chunk<s;)n=C5e(n);n&&n.dataset.chunk==String(s)?(n.style.top!=o&&(n.style.top=o),n=n.nextSibling):t.insertBefore(this.renderRevertButton(o,s),n)}for(;n;)n=C5e(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,o,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,o-1));i!=o&&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 C5e(e){let t=e.nextSibling;return e.remove(),t}const j5e={modelSettings:{maxRetries:2,maxSteps:5,chatWithGenerateLegacy:!1,chatWithGenerate:!1}};function utr({agentId:e,defaultSettings:t}){const[n,r]=x.useState(t),a=`mastra-agent-store-${e}`;return x.useEffect(()=>{try{const o=localStorage.getItem(a),c=o?JSON.parse(o):{},u={...c,modelSettings:{...j5e.modelSettings,...c?.modelSettings??{},...t?.modelSettings??{}}};r(u)}catch{}},[a,t]),{settings:n,setSettings:o=>{r(c=>({...c,...o})),localStorage.setItem(a,JSON.stringify({...o,agentId:e}))},resetAll:()=>{const o={modelSettings:{...j5e.modelSettings,...t?.modelSettings??{}}};r(o),localStorage.removeItem(a)}}}const _yt=x.createContext({});function Bme({children:e,agentId:t,defaultSettings:n}){const{settings:r,setSettings:a,resetAll:s}=utr({agentId:t,defaultSettings:n});return l.jsx(_yt.Provider,{value:{settings:r,setSettings:a,resetAll:s},children:e})}const Ume=()=>x.useContext(_yt),Fr=vle()(vDt(e=>({requestContext:{},theme:"dark",setRequestContext:t=>e({requestContext:t}),setTheme:t=>e({theme:t})}),{name:"mastra-playground-store"})),Zae=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;function dtr(e){return Zae?.addEventListener("change",e),()=>Zae?.removeEventListener("change",e)}function ftr(){return Zae?.matches??!0}function Uz(){const e=Fr(n=>n.theme),t=x.useSyncExternalStore(dtr,ftr,()=>!0);return e==="system"?t:e==="dark"}const qme=x.createContext(null);function qz({children:e}){const{requestContext:t}=Fr(),[n,r]=x.useState(t),a=i=>r(i),s=()=>{r({})};return l.jsx(qme.Provider,{value:{schemaValues:n,setSchemaValues:a,clearSchemaValues:s},children:e})}function Eyt(){const e=x.useContext(qme);if(!e)throw new Error("useSchemaRequestContext must be used within a SchemaRequestContextProvider");return e}function vo(){const{requestContext:e}=Fr(),n=x.useContext(qme)?.schemaValues??{};return{...e??{},...n}}const Cyt=({threadId:e,agentId:t,memory:n})=>{const r=qe(),{requestContext:a}=Fr();return wt({queryKey:["memory","messages",e,t,"requestContext"],queryFn:async()=>e?await r.listThreadMessages(e,{agentId:t,requestContext:a}):null,enabled:n&&!!e,staleTime:0,gcTime:0,retry:!1,refetchOnWindowFocus:!1})},ptr=({multiple:e=!0,onChange:t}={})=>{const n=jBt(s=>!s.isEditing),r=oI(),a=x.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=o=>{const c=o.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},Ul={sm:"h-form-sm",md:"h-form-md",default:"h-form-default",lg:"h-form-lg"},wR="focus:outline-hidden focus:ring-1 focus:ring-accent1 focus:shadow-focus-ring transition-shadow duration-normal",htr="focus-within:outline-hidden focus-within:ring-1 focus-within:ring-accent1 focus-within:shadow-focus-ring transition-shadow duration-normal",mtr="rounded-md",Vme="bg-surface2 border-2 border-border1 text-neutral5 hover:text-neutral6 hover:border-border2 rounded-lg",Hme="outline-hidden focus-visible:outline-hidden focus-visible:border-accent1 focus-visible:ring-1 focus-visible:ring-accent1/40",Qme="disabled:opacity-50 disabled:cursor-not-allowed";function jyt(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=jyt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Tyt(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=jyt(e))&&(r&&(r+=" "),r+=t);return r}const gtr=(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},vtr=(e,t)=>({classGroupId:e,validator:t}),Nyt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),i3="-",T5e=[],ytr="arbitrary..",btr=e=>{const t=wtr(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return xtr(i);const o=i.split(i3),c=o[0]===""&&o.length>1?1:0;return Ayt(o,c,t)},getConflictingClassGroupIds:(i,o)=>{if(o){const c=r[i],u=n[i];return c?u?gtr(u,c):c:u||T5e}return n[i]||T5e}}},Ayt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const a=e[t],s=n.nextPart.get(a);if(s){const u=Ayt(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const o=t===0?e.join(i3):e.slice(t).join(i3),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(o))return d.classGroupId}},xtr=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?ytr+r:void 0})(),wtr=e=>{const{theme:t,classGroups:n}=e;return Str(n,t)},Str=(e,t)=>{const n=Nyt();for(const r in e){const a=e[r];Wme(a,n,r,t)}return n},Wme=(e,t,n,r)=>{const a=e.length;for(let s=0;s<a;s++){const i=e[s];Otr(i,t,n,r)}},Otr=(e,t,n,r)=>{if(typeof e=="string"){ktr(e,t,n);return}if(typeof e=="function"){_tr(e,t,n,r);return}Etr(e,t,n,r)},ktr=(e,t,n)=>{const r=e===""?t:Iyt(t,e);r.classGroupId=n},_tr=(e,t,n,r)=>{if(Ctr(e)){Wme(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(vtr(n,e))},Etr=(e,t,n,r)=>{const a=Object.entries(e),s=a.length;for(let i=0;i<s;i++){const[o,c]=a[i];Wme(c,Iyt(t,o),n,r)}},Iyt=(e,t)=>{let n=e;const r=t.split(i3),a=r.length;for(let s=0;s<a;s++){const i=r[s];let o=n.nextPart.get(i);o||(o=Nyt(),n.nextPart.set(i,o)),n=o}return n},Ctr=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,jtr=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)}}},Yae="!",N5e=":",Ttr=[],A5e=(e,t,n,r,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),Ntr=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const s=[];let i=0,o=0,c=0,u;const d=a.length;for(let g=0;g<d;g++){const v=a[g];if(i===0&&o===0){if(v===N5e){s.push(a.slice(c,g)),c=g+1;continue}if(v==="/"){u=g;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=s.length===0?a:a.slice(c);let p=f,h=!1;f.endsWith(Yae)?(p=f.slice(0,-1),h=!0):f.startsWith(Yae)&&(p=f.slice(1),h=!0);const m=u&&u>c?u-c:void 0;return A5e(s,h,p,m)};if(t){const a=t+N5e,s=r;r=i=>i.startsWith(a)?s(i.slice(a.length)):A5e(Ttr,!1,i,void 0,!0)}if(n){const a=r;r=s=>n({className:s,parseClassName:a})}return r},Atr=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],o=i[0]==="[",c=t.has(i);o||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}},Itr=e=>({cache:jtr(e.cacheSize),parseClassName:Ntr(e),sortModifiers:Atr(e),...btr(e)}),Rtr=/\s+/,Ptr=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],o=e.trim().split(Rtr);let c="";for(let u=o.length-1;u>=0;u-=1){const d=o[u],{isExternal:f,modifiers:p,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:g}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let v=!!g,b=r(v?m.substring(0,g):m);if(!b){if(!v){c=d+(c.length>0?" "+c:c);continue}if(b=r(m),!b){c=d+(c.length>0?" "+c:c);continue}v=!1}const w=p.length===0?"":p.length===1?p[0]:s(p).join(":"),O=h?w+Yae:w,k=O+b;if(i.indexOf(k)>-1)continue;i.push(k);const _=a(b,v);for(let C=0;C<_.length;++C){const T=_[C];i.push(O+T)}c=d+(c.length>0?" "+c:c)}return c},Mtr=(...e)=>{let t=0,n,r,a="";for(;t<e.length;)(n=e[t++])&&(r=Ryt(n))&&(a&&(a+=" "),a+=r);return a},Ryt=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Ryt(e[r]))&&(n&&(n+=" "),n+=t);return n},I5e=(e,...t)=>{let n,r,a,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=Itr(u),r=n.cache.get,a=n.cache.set,s=o,o(c)},o=c=>{const u=r(c);if(u)return u;const d=Ptr(c,n);return a(c,d),d};return s=i,(...c)=>s(Mtr(...c))},Dtr=[],wo=e=>{const t=n=>n[e]||Dtr;return t.isThemeGetter=!0,t},Pyt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Myt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,$tr=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ltr=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ftr=/\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$/,ztr=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Btr=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Utr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,my=e=>$tr.test(e),Rr=e=>!!e&&!Number.isNaN(Number(e)),gy=e=>!!e&&Number.isInteger(Number(e)),fJ=e=>e.endsWith("%")&&Rr(e.slice(0,-1)),dg=e=>Ltr.test(e),Dyt=()=>!0,qtr=e=>Ftr.test(e)&&!ztr.test(e),Gme=()=>!1,Vtr=e=>Btr.test(e),Htr=e=>Utr.test(e),Qtr=e=>!fn(e)&&!vn(e),Wtr=e=>Zb(e,Fyt,Gme),fn=e=>Pyt.test(e),Px=e=>Zb(e,zyt,qtr),R5e=e=>Zb(e,tnr,Rr),Gtr=e=>Zb(e,Uyt,Dyt),Ztr=e=>Zb(e,Byt,Gme),P5e=e=>Zb(e,$yt,Gme),Ytr=e=>Zb(e,Lyt,Htr),DD=e=>Zb(e,qyt,Vtr),vn=e=>Myt.test(e),NC=e=>lS(e,zyt),Xtr=e=>lS(e,Byt),M5e=e=>lS(e,$yt),Ktr=e=>lS(e,Fyt),Jtr=e=>lS(e,Lyt),$D=e=>lS(e,qyt,!0),enr=e=>lS(e,Uyt,!0),Zb=(e,t,n)=>{const r=Pyt.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},lS=(e,t,n=!1)=>{const r=Myt.exec(e);return r?r[1]?t(r[1]):n:!1},$yt=e=>e==="position"||e==="percentage",Lyt=e=>e==="image"||e==="url",Fyt=e=>e==="length"||e==="size"||e==="bg-size",zyt=e=>e==="length",tnr=e=>e==="number",Byt=e=>e==="family-name",Uyt=e=>e==="number"||e==="weight",qyt=e=>e==="shadow",D5e=()=>{const e=wo("color"),t=wo("font"),n=wo("text"),r=wo("font-weight"),a=wo("tracking"),s=wo("leading"),i=wo("breakpoint"),o=wo("container"),c=wo("spacing"),u=wo("radius"),d=wo("shadow"),f=wo("inset-shadow"),p=wo("text-shadow"),h=wo("drop-shadow"),m=wo("blur"),g=wo("perspective"),v=wo("aspect"),b=wo("ease"),w=wo("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(),vn,fn],C=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],j=()=>[vn,fn,c],A=()=>[my,"full","auto",...j()],I=()=>[gy,"none","subgrid",vn,fn],P=()=>["auto",{span:["full",gy,vn,fn]},gy,vn,fn],M=()=>[gy,"auto",vn,fn],F=()=>["auto","min","max","fr",vn,fn],D=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],V=()=>["auto",...j()],z=()=>[my,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],H=()=>[my,"screen","full","dvw","lvw","svw","min","max","fit",...j()],W=()=>[my,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],$=()=>[e,vn,fn],Z=()=>[...k(),M5e,P5e,{position:[vn,fn]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],R=()=>["auto","cover","contain",Ktr,Wtr,{size:[vn,fn]}],Q=()=>[fJ,NC,Px],G=()=>["","none","full",u,vn,fn],J=()=>["",Rr,NC,Px],re=()=>["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"],se=()=>[Rr,fJ,M5e,P5e],le=()=>["","none",m,vn,fn],me=()=>["none",Rr,vn,fn],K=()=>["none",Rr,vn,fn],ae=()=>[Rr,vn,fn],oe=()=>[my,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[dg],breakpoint:[dg],color:[Dyt],container:[dg],"drop-shadow":[dg],ease:["in","out","in-out"],font:[Qtr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[dg],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[dg],shadow:[dg],spacing:["px",Rr],text:[dg],"text-shadow":[dg],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",my,fn,vn,v]}],container:["container"],columns:[{columns:[Rr,fn,vn,o]}],"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:[gy,"auto",vn,fn]}],basis:[{basis:[my,"full","auto",o,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Rr,my,"auto","initial","none",fn]}],grow:[{grow:["",Rr,vn,fn]}],shrink:[{shrink:["",Rr,vn,fn]}],order:[{order:[gy,"first","last","none",vn,fn]}],"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:V()}],mx:[{mx:V()}],my:[{my:V()}],ms:[{ms:V()}],me:[{me:V()}],mbs:[{mbs:V()}],mbe:[{mbe:V()}],mt:[{mt:V()}],mr:[{mr:V()}],mb:[{mb:V()}],ml:[{ml:V()}],"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",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...W()]}],"min-block-size":[{"min-block":["auto",...W()]}],"max-block-size":[{"max-block":["none",...W()]}],w:[{w:[o,"screen",...z()]}],"min-w":[{"min-w":[o,"screen","none",...z()]}],"max-w":[{"max-w":[o,"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,NC,Px]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,enr,Gtr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fJ,fn]}],"font-family":[{font:[Xtr,Ztr,t]}],"font-features":[{"font-features":[fn]}],"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,vn,fn]}],"line-clamp":[{"line-clamp":[Rr,"none",vn,R5e]}],leading:[{leading:[s,...j()]}],"list-image":[{"list-image":["none",vn,fn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",vn,fn]}],"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:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Rr,"from-font","auto",vn,Px]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[Rr,"auto",vn,fn]}],"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",vn,fn]}],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",vn,fn]}],"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:B()}],"bg-size":[{bg:R()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gy,vn,fn],radial:["",vn,fn],conic:[gy,vn,fn]},Jtr,Ytr]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"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:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"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:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Rr,vn,fn]}],"outline-w":[{outline:["",Rr,NC,Px]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",d,$D,DD]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",f,$D,DD]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[Rr,Px]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",p,$D,DD]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[Rr,vn,fn]}],"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":[Rr]}],"mask-image-linear-from-pos":[{"mask-linear-from":se()}],"mask-image-linear-to-pos":[{"mask-linear-to":se()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":se()}],"mask-image-t-to-pos":[{"mask-t-to":se()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":se()}],"mask-image-r-to-pos":[{"mask-r-to":se()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":se()}],"mask-image-b-to-pos":[{"mask-b-to":se()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":se()}],"mask-image-l-to-pos":[{"mask-l-to":se()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":se()}],"mask-image-x-to-pos":[{"mask-x-to":se()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":se()}],"mask-image-y-to-pos":[{"mask-y-to":se()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[vn,fn]}],"mask-image-radial-from-pos":[{"mask-radial-from":se()}],"mask-image-radial-to-pos":[{"mask-radial-to":se()}],"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":[Rr]}],"mask-image-conic-from-pos":[{"mask-conic-from":se()}],"mask-image-conic-to-pos":[{"mask-conic-to":se()}],"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:B()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",vn,fn]}],filter:[{filter:["","none",vn,fn]}],blur:[{blur:le()}],brightness:[{brightness:[Rr,vn,fn]}],contrast:[{contrast:[Rr,vn,fn]}],"drop-shadow":[{"drop-shadow":["","none",h,$D,DD]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",Rr,vn,fn]}],"hue-rotate":[{"hue-rotate":[Rr,vn,fn]}],invert:[{invert:["",Rr,vn,fn]}],saturate:[{saturate:[Rr,vn,fn]}],sepia:[{sepia:["",Rr,vn,fn]}],"backdrop-filter":[{"backdrop-filter":["","none",vn,fn]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[Rr,vn,fn]}],"backdrop-contrast":[{"backdrop-contrast":[Rr,vn,fn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Rr,vn,fn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Rr,vn,fn]}],"backdrop-invert":[{"backdrop-invert":["",Rr,vn,fn]}],"backdrop-opacity":[{"backdrop-opacity":[Rr,vn,fn]}],"backdrop-saturate":[{"backdrop-saturate":[Rr,vn,fn]}],"backdrop-sepia":[{"backdrop-sepia":["",Rr,vn,fn]}],"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",vn,fn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Rr,"initial",vn,fn]}],ease:[{ease:["linear","initial",b,vn,fn]}],delay:[{delay:[Rr,vn,fn]}],animate:[{animate:["none",w,vn,fn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,vn,fn]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[vn,fn,"","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",vn,fn]}],"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",vn,fn]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[Rr,NC,Px,R5e]}],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"]}},nnr=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:a={},override:s={}})=>(hj(e,"cacheSize",t),hj(e,"prefix",n),hj(e,"experimentalParseClassName",r),LD(e.theme,s.theme),LD(e.classGroups,s.classGroups),LD(e.conflictingClassGroups,s.conflictingClassGroups),LD(e.conflictingClassGroupModifiers,s.conflictingClassGroupModifiers),hj(e,"orderSensitiveModifiers",s.orderSensitiveModifiers),FD(e.theme,a.theme),FD(e.classGroups,a.classGroups),FD(e.conflictingClassGroups,a.conflictingClassGroups),FD(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Vyt(e,a,"orderSensitiveModifiers"),e),hj=(e,t,n)=>{n!==void 0&&(e[t]=n)},LD=(e,t)=>{if(t)for(const n in t)hj(e,n,t[n])},FD=(e,t)=>{if(t)for(const n in t)Vyt(e,t,n)},Vyt=(e,t,n)=>{const r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},rnr=(e,...t)=>typeof e=="function"?I5e(D5e,e,...t):I5e(()=>nnr(D5e(),e),...t),anr=Object.keys({...M6,...bYt}),snr=Object.keys(_Yt),inr=Object.keys(xYt),onr=Object.keys(wYt),lnr=Object.keys(yYt),Mx=Object.keys(kYt),cnr=Object.keys(SYt).concat(Object.keys(OYt)),unr=rnr({extend:{theme:{color:anr,spacing:snr,radius:lnr,leading:onr,shadow:cnr},classGroups:{"font-size":[{text:inr}],h:[{h:Mx}],w:[{w:Mx}],size:[{size:Mx}],"min-h":[{"min-h":Mx}],"min-w":[{"min-w":Mx}],"max-h":[{"max-h":Mx}],"max-w":[{"max-w":Mx}]}}});function Y(...e){return unr(Tyt(e))}const dnr={sm:`${Ul.sm} text-ui-sm px-[.75em]`,md:`${Ul.md} text-ui-md px-[.75em]`,default:`${Ul.default} text-ui-md px-[.85em] `,lg:`${Ul.lg} text-ui-lg px-[1em] `},fnr={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:Vme,light:"",outline:""},pnr=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",Qme,Hme),hnr={light:"default",outline:"default"};function mnr(e){return hnr[e]??e}function H_(e){const t=mnr(e?.variant||"default"),n=e?.size||"default";return Y(pnr,fnr[t],dnr[n],e?.iconOnly&&"[&>svg]:opacity-75")}function Hyt(e){const t=[];return Ce.Children.forEach(e,n=>{Ce.isValidElement(n)&&n.type===Ce.Fragment?t.push(...Hyt(n.props.children)):t.push(n)}),t}function gnr(e){const t=Hyt(e);return t.length>0&&t.every(n=>Ce.isValidElement(n))}const ye=Ce.forwardRef(({className:e,as:t,size:n="default",variant:r="default",disabled:a,children:s,...i},o)=>{const c=t||"button",u=gnr(s);return l.jsx(c,{ref:o,disabled:a,className:Y(H_({variant:r,size:n,iconOnly:u}),e),...i,children:s})});ye.displayName="Button";const Pc=P6t,ar=M6t,sr=D6t,Jn=x.forwardRef(({className:e,sideOffset:t=4,children:n,...r},a)=>l.jsx($6t,{children:l.jsxs(BWe,{ref:a,sideOffset:t,className:Y("z-50 overflow-hidden rounded-md bg-surface6 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,l.jsx(L6t,{className:"fill-surface6"})]})}));Jn.displayName=BWe.displayName;const Vs=Ce.forwardRef(({tooltipContent:e,...t},n)=>l.jsxs(ar,{children:[l.jsx(sr,{asChild:!0,children:l.jsx(ye,{ref:n,...t})}),e&&l.jsx(Jn,{children:e})]}));Vs.displayName="ButtonWithTooltip";const _r=s6,Qyt=XZe,vnr=i6,Wyt=x.forwardRef(({className:e,...t},n)=>l.jsx(uI,{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}));Wyt.displayName=uI.displayName;const yr=x.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(vnr,{children:[l.jsx(Wyt,{}),l.jsxs(dI,{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-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",e),...n,children:[t,l.jsxs(c6,{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:[l.jsx(ir,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));yr.displayName=dI.displayName;const Er=({className:e,...t})=>l.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});Er.displayName="DialogHeader";const Td=({className:e,...t})=>l.jsx("div",{className:Y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Td.displayName="DialogFooter";const Dr=({className:e,...t})=>l.jsx("div",{className:Y("overflow-y-auto px-6 max-h-[50vh]",e),...t});Dr.displayName="DialogBody";const br=x.forwardRef(({className:e,...t},n)=>l.jsx(o6,{ref:n,className:Y("text-ui-md font-medium",e),...t}));br.displayName=o6.displayName;const Ga=x.forwardRef(({className:e,...t},n)=>l.jsx(l6,{ref:n,className:Y("sr-only",e),...t}));Ga.displayName=l6.displayName;const $5e=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,L5e=Tyt,SR=(e,t)=>n=>{var r;if(t?.variants==null)return L5e(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 p=$5e(d)||$5e(f);return a[u][p]}),o=n&&Object.entries(n).reduce((u,d)=>{let[f,p]=d;return p===void 0||(u[f]=p),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:p,...h}=d;return Object.entries(h).every(m=>{let[g,v]=m;return Array.isArray(v)?v.includes({...s,...o}[g]):{...s,...o}[g]===v})?[...u,f,p]:u},[]);return L5e(e,i,c,n?.class,n?.className)},ynr=SR(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(Vme,Hme,Qme),unstyled:"border-0 bg-transparent shadow-none focus:shadow-none focus:ring-0"},size:{sm:`${Ul.sm} text-ui-sm px-[.75em]`,md:`${Ul.md} text-ui-md px-[.75em]`,default:`${Ul.default} text-ui-md px-[.85em]`,lg:`${Ul.lg} text-ui-lg px-[.85em]`}},defaultVariants:{variant:"default",size:"default"}}),an=x.forwardRef(({className:e,size:t,testId:n,variant:r,type:a,error:s,...i},o)=>l.jsx("input",{type:a,className:Y(ynr({variant:r,size:t}),s&&"border-error focus:ring-error focus:shadow-glow-accent2",e),"data-testid":n,ref:o,"aria-invalid":s,...i}));an.displayName="Input";const bnr=SR("text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xt=x.forwardRef(({className:e,...t},n)=>l.jsx(met,{ref:n,className:Y(bnr(),e),...t}));xt.displayName=met.displayName;const xnr={"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"},wnr={mono:"font-mono"},ge=({as:e="p",className:t,variant:n="ui-md",font:r,...a})=>l.jsx(e,{className:Y(xnr[n],r&&wnr[r],t),...a}),Ys=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),Snr=e=>l.jsxs("svg",{width:"126",height:"85",viewBox:"0 0 126 85",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"}),l.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"}),l.jsxs("g",{clipPath:"url(#clip0_21421_19519)",children:[l.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"}),l.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"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21421_19519",children:l.jsx("rect",{width:"62.7591",height:"62.7591",fill:"white",transform:"matrix(0.897148 0.441731 -0.897148 0.441731 63.1714 7.24365)"})})})]}),Onr=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),Zme=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),Yme=e=>l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),dc=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),Gyt=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsx("g",{clipPath:"url(#clip0_21999_22095)",children:l.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"})}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_22095",children:l.jsx("rect",{width:"14",height:"14",fill:"currentColor",transform:"translate(0.5 0.75)"})})})]}),Zyt=e=>l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.jsxs("g",{clipPath:"url(#clip0_21999_20513)",children:[l.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"}),l.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"}),l.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"}),l.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"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_21999_20513",children:l.jsx("rect",{width:"12.2487",height:"12.2487",fill:"white",transform:"translate(1.375 1.28516)"})})})]}),knr={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})=>l.jsx("span",{className:Y("block",knr[n],t),...r,children:e}),_nr=e=>l.jsxs("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"}),l.jsx("rect",{x:"7.92188",y:"6.46759",width:"1.41089",height:"1.56773",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"10.4258",y:"4.35107",width:"1.41089",height:"3.72998",rx:"0.705445",fill:"currentColor"}),l.jsx("rect",{x:"12.9287",y:"2.23419",width:"1.41089",height:"5.75781",rx:"0.705445",fill:"currentColor"})]}),Yyt=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),Xme=e=>l.jsx("svg",{width:"17",height:"18",viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),Enr=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{d:"M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z",fill:"currentColor"})}),No=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),Q_=e=>l.jsx(fYt,{...e}),Jo=e=>l.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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"})}),Cu=e=>l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[l.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"}),l.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"})]}),Cnr=e=>l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:l.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 CO(e){return l.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:[l.jsx("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),l.jsx("rect",{width:"6",height:"6",x:"9",y:"9",rx:"1"}),l.jsx("path",{d:"M15 2v2"}),l.jsx("path",{d:"M15 20v2"}),l.jsx("path",{d:"M2 15h2"}),l.jsx("path",{d:"M2 9h2"}),l.jsx("path",{d:"M20 15h2"}),l.jsx("path",{d:"M20 9h2"}),l.jsx("path",{d:"M9 2v2"}),l.jsx("path",{d:"M9 20v2"})]})}const jnr={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"},Tnr=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 jnr[a]}},Nnr=({onOpenChange:e,open:t})=>{const n=oI(),r=ptr({onChange:()=>e(!1)}),a=async s=>{s.preventDefault();const o=new FormData(s.target).get("url-attachment")?.toString();if(o){const c=new File([],o,{type:await Tnr(o)});n.addAttachment(c),e(!1)}};return l.jsx(_r,{onOpenChange:e,open:t,children:l.jsxs(yr,{children:[l.jsxs(Er,{children:[l.jsx(br,{children:"Add attachment"}),l.jsx(Ga,{children:"Add a file attachment via URL or from your computer"})]}),l.jsxs(Dr,{children:[l.jsxs("form",{onSubmit:a,className:"flex flex-row items-end gap-4",children:[l.jsxs("div",{className:"w-full space-y-1",children:[l.jsx(xt,{htmlFor:"url-attachment",className:"text-neutral3 text-ui-md",children:"Public URL"}),l.jsx(an,{type:"text",name:"url-attachment",id:"url-attachment",className:"w-full",placeholder:"https://placehold.co/600x400/png"})]}),l.jsxs(ye,{type:"submit",className:"h-8!",variant:"light",children:[l.jsx(_e,{children:l.jsx(LGt,{})}),"Add"]})]}),l.jsx("hr",{className:"my-2 border border-border1"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(ge,{variant:"ui-md",className:"text-neutral3",children:"Or from your computer"}),l.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:[l.jsx(kWt,{className:"size-12"}),l.jsx(ge,{variant:"header-md",children:"Add a local file"})]})]})]})]})})},Anr=e=>{const[t,n]=x.useState(void 0);return x.useEffect(()=>{if(!e){n(void 0);return}const r=URL.createObjectURL(e);return n(r),()=>{URL.revokeObjectURL(r)}},[e]),t},Inr=()=>{const{file:e,src:t}=m2(uZe(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 Anr(e)??t},Rnr=()=>{const e=oI(),[t,n]=x.useState(!1);return x.useEffect(()=>{e.subscribe(()=>{const r=e.getState().attachments;n(r.length>0)})},[e]),t},Pnr=e=>{const[t,n]=x.useState({isLoading:!1,text:""});return x.useEffect(()=>{if(!e)return;(async()=>{n(s=>({...s,isLoading:!0}));const a=await e.text();n(s=>({...s,isLoading:!1,text:a}))})()},[e]),t},o3="h-full w-full flex items-center justify-center",Xyt=({data:e,url:t})=>{const[n,r]=x.useState(!1);return t?l.jsx("a",{href:t,className:o3,target:"_blank",rel:"noreferrer noopener",children:l.jsx(Pf,{className:"text-accent2","aria-label":"View PDF"})}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>r(!0),className:o3,type:"button",children:l.jsx(Pf,{className:"text-accent2","aria-label":"View PDF"})}),l.jsx(Mnr,{data:e,open:n,onOpenChange:r})]})},Mnr=({data:e,open:t,onOpenChange:n})=>l.jsx(_r,{open:t,onOpenChange:n,children:l.jsxs(yr,{className:"max-w-4xl",children:[l.jsxs(Er,{children:[l.jsx(br,{children:"PDF preview"}),l.jsx(Ga,{children:"Preview of the PDF document"})]}),l.jsx(Dr,{children:t&&l.jsx("iframe",{src:e,width:"100%",height:"600px"})})]})}),Kyt=({src:e})=>{const[t,n]=x.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>n(!0),type:"button",className:o3,children:l.jsx("img",{src:e,className:"object-cover aspect-ratio max-h-[140px] max-w-[320px]",alt:"Preview"})}),l.jsx(Dnr,{src:e,open:t,onOpenChange:n})]})},Dnr=({src:e,open:t,onOpenChange:n})=>l.jsx(_r,{open:t,onOpenChange:n,children:l.jsxs(yr,{className:"max-w-4xl",children:[l.jsxs(Er,{children:[l.jsx(br,{children:"Image preview"}),l.jsx(Ga,{children:"Preview of the image"})]}),l.jsx(Dr,{children:t&&l.jsx("img",{src:e,alt:"Image"})})]})}),Jyt=({data:e})=>{const[t,n]=x.useState(!1),r=e.replace(/<attachment[^>]*>/,"").replace(/<\/attachment>/g,"");return l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>n(!0),className:o3,type:"button",children:l.jsx(Pf,{className:"text-neutral3"})}),l.jsx($nr,{data:r,open:t,onOpenChange:n})]})},$nr=({data:e,open:t,onOpenChange:n})=>l.jsx(_r,{open:t,onOpenChange:n,children:l.jsxs(yr,{className:"max-w-4xl h-[80vh]",children:[l.jsxs(Er,{children:[l.jsx(br,{children:"Text preview"}),l.jsx(Ga,{children:"Preview of the text file"})]}),l.jsx(Dr,{children:t&&l.jsx("div",{className:"whitespace-pre-wrap",children:e})})]})}),Lnr={sm:`${Ul.sm} w-form-sm`,md:`${Ul.md} w-form-md`,lg:`${Ul.lg} w-form-lg`,default:`${Ul.default}`},Fnr={sm:"sm",md:"default",lg:"lg",default:"default"},znr={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"},Bnr="border border-border1 inline-flex items-center justify-center rounded-md transition-all duration-normal ease-out-custom active:scale-[0.98]",ds=Ce.forwardRef(({className:e,children:t,tooltip:n,size:r="md",variant:a="default",disabled:s,...i},o)=>l.jsxs(ar,{children:[l.jsx(sr,{asChild:!0,children:l.jsx("button",{ref:o,disabled:s,"aria-label":typeof n=="string"?n:void 0,className:Y(Bnr,wR,znr[a],Lnr[r],s&&"active:scale-100",e),...i,children:l.jsx(_e,{size:Fnr[r],children:t})})}),l.jsx(Jn,{children:n})]}));ds.displayName="IconButton";const Unr={sm:"w-4 h-4",md:"w-6 h-6",lg:"w-8 h-8"};function Ft({color:e,className:t,size:n="md"}){return l.jsx("svg",{className:Y("animate-spin",Unr[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:l.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:e||"currentColor",className:"text-accent1"})})}const ebt=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)}),qnr=({document:e})=>{const{isLoading:t,text:n}=Pnr(e.file);return l.jsx("div",{className:"flex items-center justify-center h-full w-full",children:t?l.jsx(Ft,{className:"animate-spin"}):l.jsx(Jyt,{data:n})})},Vnr=({document:e})=>{const[t,n]=x.useState({isLoading:!1,text:""});x.useEffect(()=>{let a=!1;return(async()=>{if(!e.file)return;n(o=>({...o,isLoading:!0}));const i=await ebt(e.file);a||n(o=>({...o,isLoading:!1,text:i}))})(),()=>{a=!0}},[e]);const r=e.file?.name.startsWith("https://");return l.jsx("div",{className:"flex items-center justify-center h-full w-full",children:t.isLoading?l.jsx(Ft,{className:"animate-spin"}):l.jsx(Xyt,{data:t.text,url:r?e.file?.name:void 0})})},Hnr=()=>{const e=m2(i=>i.type==="image"),t=m2(i=>i.type==="document"?i:void 0),n=Inr(),r=m2(i=>i.source!=="message"),s=t?.file?.name.startsWith("https://")?t?.file?.name:n;return l.jsx(l.Fragment,{children:l.jsxs("div",{className:"relative",children:[l.jsx(H5,{children:l.jsxs(ar,{children:[l.jsx(wJe,{children:l.jsx(sr,{asChild:!0,children:l.jsx("div",{className:"overflow-hidden size-16 rounded-lg bg-surface3 border border-border1 ",children:e?l.jsx(Kyt,{src:s??""}):t?.contentType==="application/pdf"?l.jsx(Vnr,{document:t}):t?l.jsx(qnr,{document:t}):null})})}),l.jsx(Jn,{side:"top",children:l.jsx(SJe,{})})]})}),r&&l.jsx(Qnr,{})]})})},Qnr=()=>l.jsx(IHt,{asChild:!0,children:l.jsx(ds,{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:l.jsx(_e,{children:l.jsx(vb,{})})})}),Wnr=()=>Rnr()?l.jsx("div",{className:"flex w-full flex-row items-center gap-4 pb-2",children:l.jsx(mZe,{components:{Attachment:Hnr}})}):null;function Gnr({containerRef:e}){const[t,n]=x.useState([]),[r,a]=x.useState(null),s=x.useRef(""),i=x.useRef(0),o=x.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 p=[];for(let m=0;m<f.length;m++){const g=f[m],v=g.getAttribute("data-om-badge")||"",b=g.getAttribute("data-om-state")||"complete",w=g.getAttribute("data-om-type")||"observation",O=g.getBoundingClientRect();let k;const _=Znr(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||p.push({cycleId:v,omType:w,state:b,top:k,height:j})}const h=JSON.stringify(p);h!==s.current&&(s.current=h,n(p))},[e]);if(x.useEffect(()=>{const u=e.current;if(!u)return;o();const d=new ResizeObserver(()=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(o)});d.observe(u);const f=new MutationObserver(()=>{cancelAnimationFrame(i.current),i.current=requestAnimationFrame(o)});return f.observe(u,{childList:!0,subtree:!0}),()=>{cancelAnimationFrame(i.current),d.disconnect(),f.disconnect()}},[o,e]),x.useEffect(()=>{const u=e.current;if(!u)return;const d=p=>{const h=p.target.closest("[data-om-badge]");h&&a(h.getAttribute("data-om-badge"))},f=p=>{p.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 l.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,p=r?f:d;return l.jsx(Ynr,{highlight:u,visible:p},u.cycleId)})})}function Znr(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 Ynr({highlight:e,visible:t}){const n=Xnr(e.state),r=e.state.startsWith("buffering");return l.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 Xnr(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 Hn={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"},Yb={visible:"focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-accent1 focus-visible:shadow-focus-ring"},Knr={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"},Jnr={default:"text-neutral3",success:"text-accent1",error:"text-accent2",info:"text-accent5",warning:"text-accent6"},vt=({icon:e,variant:t="default",className:n,children:r,...a})=>l.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",Hn.colors,e?"pl-2 pr-2.5":"px-2.5",t==="default"&&e?"bg-surface4 text-neutral5":Knr[t],n),...a,children:[e&&l.jsx("span",{className:Jnr[t],children:l.jsx(_e,{children:e})}),r]}),Vz=({children:e,initialCollapsed:t=!0,icon:n,title:r,collapsible:a=!0,extraInfo:s,"data-testid":i})=>{const[o,c]=x.useState(t);return x.useEffect(()=>{c(t)},[t]),l.jsxs("div",{className:"mb-4","data-testid":i,children:[l.jsxs("div",{className:"flex flex-row gap-2 items-center justify-between",children:[l.jsxs("button",{onClick:a?()=>c(u=>!u):void 0,className:"flex items-center gap-2 disabled:cursor-not-allowed",disabled:!a,type:"button",children:[l.jsx(_e,{children:l.jsx(Bb,{className:Y("transition-all",o?"rotate-90":"rotate-180")})}),l.jsx(vt,{icon:n,children:r})]}),s]}),!o&&l.jsx("div",{className:"pt-2",children:l.jsx("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:e})})]})};function err(e,t=5){if(!e?.properties)return[];const n=[];function r(a,s,i){if(i>t)return;const o=Array.isArray(a.type)?a.type.join(" | "):a.type;if(n.push({path:s,label:s,description:a.description??a.title,type:o}),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 trr(e){const t=err(e);return trt({override:[nrr(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function nrr(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 o=i.map(c=>({label:c.path,displayLabel:c.path,detail:c.type,info:c.description,apply:(u,d,f,p)=>{const g=u.state.sliceDoc(p,p+2)==="}}"?d.label:`${d.label}}}`;u.dispatch({changes:{from:f,to:p,insert:g},selection:{anchor:f+g.length}})}}));return{from:s,options:o,validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}const rrr=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,arr=nn.mark({class:"cm-variable-highlight"}),F5e=new vnt({regexp:rrr,decoration:()=>arr}),srr=ii.fromClass(class{decorations;constructor(e){this.decorations=F5e.createDeco(e)}update(e){this.decorations=F5e.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),irr=srr,orr={duration:5e3,cancel:{label:l.jsx(_e,{children:l.jsx(ir,{})}),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 bd(e){const{classNames:t,...n}=orr,{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 De=(e,t={})=>{if(Array.isArray(e))return e.forEach(n=>Hl(n,bd(t)));if(Ce.isValidElement(e))return Hl(e,bd(t));if(typeof e=="string")return Hl(e,bd(t));throw new Error("Invalid message type")};De.success=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent1 shrink-0",children:l.jsx(aue,{})}),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 Hl.success(e,bd(n));case"object":return e.forEach(r=>Hl.success(r,bd(n)))}};De.error=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent2 shrink-0",children:l.jsx(vb,{})}),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 Hl.error(e,bd(n));case"object":return e.forEach(r=>Hl.error(r,bd(n)))}};De.warning=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent6 shrink-0",children:l.jsx(Tp,{})}),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 Hl.warning(e,bd(n));case"object":return e.forEach(r=>Hl.warning(r,bd(n)))}};De.info=(e,t={})=>{const n={...t,icon:l.jsx(_e,{className:"text-accent3 shrink-0",children:l.jsx(Fl,{})}),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 Hl.info(e,bd(n));case"object":return e.forEach(r=>Hl.info(r,bd(n)))}};De.custom=(e,t={})=>Hl(e,bd(t));De.dismiss=e=>{e&&Hl.dismiss(e)};De.promise=({myPromise:e,loadingMessage:t,successMessage:n,errorMessage:r,onSuccess:a,onError:s,options:i={}})=>Hl.promise(e,{loading:t??"Loading...",success:o=>(a?.(o),n),error:o=>(s?.(o),r||o?.message||"Error..."),...bd(i)});function Ff({text:e,copyMessage:t="Copied to clipboard!"}){const[n,r]=x.useState(!1),a=x.useRef(null),s=x.useCallback(()=>{navigator.clipboard.writeText(e).then(()=>{De.success(t),r(!0),a.current&&(clearTimeout(a.current),a.current=null),a.current=setTimeout(()=>{r(!1)},2e3)}).catch(()=>{De.error("Failed to copy to clipboard.")})},[e,t]);return{isCopied:n,handleCopy:s}}function pi({content:e,copyMessage:t,tooltip:n="Copy to clipboard",size:r="sm",className:a}){const[s,i]=x.useState(!1),{handleCopy:o}=Ff({text:e,copyMessage:t}),c=()=>{o(),i(!0),setTimeout(()=>i(!1),2e3)};return l.jsxs(ar,{children:[l.jsx(sr,{asChild:!0,children:l.jsx(ye,{onClick:c,type:"button",size:r,className:a,"aria-label":s?"Copied!":n,children:s?l.jsx(ha,{}):l.jsx(Wl,{})})}),l.jsx(Jn,{children:s?"Copied!":n})]})}function lrr(){const e=AI({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:[ie.className,ie.propertyName],color:"var(--neutral6)"},{tag:ie.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ie.heading1,ie.heading2,ie.heading3,ie.heading4,ie.heading5,ie.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:ie.emphasis,fontStyle:"italic",color:"var(--neutral6)"},{tag:ie.strong,fontWeight:"bold",color:"var(--neutral6)"},{tag:ie.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ie.url,color:"var(--accent3)"},{tag:ie.monospace,color:"var(--neutral6)"},{tag:ie.strikethrough,textDecoration:"line-through"},{tag:ie.quote,fontStyle:"italic",color:"var(--neutral2)"}]}),t=gt.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 crr(){const e=gt.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=Tm.define([{tag:[ie.comment,ie.bracket],color:"var(--neutral2)"},{tag:[ie.string,ie.meta,ie.regexp],color:"var(--accent1)"},{tag:[ie.atom,ie.bool,ie.special(ie.variableName)],color:"var(--accent6)"},{tag:[ie.keyword,ie.operator,ie.tagName],color:"var(--accent2)"},{tag:[ie.function(ie.propertyName),ie.propertyName],color:"var(--accent5)"},{tag:[ie.definition(ie.variableName),ie.function(ie.variableName),ie.className,ie.attributeName],color:"var(--accent3)"},{tag:[ie.variableName,ie.number],color:"var(--accent5)"},{tag:[ie.name,ie.quote],color:"var(--accent1)"},{tag:ie.heading,color:"var(--accent3)",fontWeight:"bold"},{tag:[ie.heading1,ie.heading2,ie.heading3,ie.heading4,ie.heading5,ie.heading6],color:"var(--accent3)",fontWeight:"bold"},{tag:[ie.emphasis],fontStyle:"italic",color:"var(--neutral6)"},{tag:[ie.strong],fontWeight:"bold",color:"var(--neutral6)"},{tag:ie.link,color:"var(--accent3)",textDecoration:"underline"},{tag:ie.url,color:"var(--accent3)"},{tag:ie.monospace,color:"var(--neutral6)"},{tag:ie.strikethrough,textDecoration:"line-through"},{tag:[ie.deleted],color:"var(--accent2)"},{tag:ie.invalid,color:"var(--error)"},{tag:[ie.standard(ie.tagName)],color:"var(--accent1)"}]);return[e,Ww(t)]}const Cv=()=>{const e=Uz();return x.useMemo(()=>e?lrr():crr(),[e])},ls=x.forwardRef(({data:e,value:t,onChange:n,showCopyButton:r=!0,className:a,language:s="json",highlightVariables:i=!1,placeholder:o,schema:c,autoFocus:u,lineNumbers:d=!0,...f},p)=>{const h=Cv(),m=e?JSON.stringify(e,null,2):t??"",g=x.useMemo(()=>{const v=[];return s==="json"?v.push(md):s==="markdown"&&(v.push(bde({base:ew,codeLanguages:Oat})),v.push(gt.lineWrapping)),i&&s==="markdown"&&v.push(irr),c&&s==="markdown"&&v.push(trr(c)),v},[s,i,c]);return l.jsxs("div",{className:Y("rounded-md bg-surface3 p-1 font-mono relative border border-border1 overflow-hidden",a),...f,children:[r&&l.jsx(pi,{content:m,className:"absolute top-2 right-2 z-20"}),l.jsx(ku,{ref:p,value:m,theme:h,extensions:g,onChange:n,"aria-label":"Code editor",placeholder:o,height:"100%",style:{height:"100%"},autoFocus:u,basicSetup:{lineNumbers:d}})]})});async function urr(e,t){const{codeToTokens:n,bundledLanguages:r}=await We(async()=>{const{codeToTokens:s,bundledLanguages:i}=await import("./index-UhzyOq43.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 drr=({selectionReason:e,open:t,onOpenChange:n,input:r})=>{let a=null;if(r)try{a=typeof r=="object"?l.jsx(ls,{data:r}):l.jsx(ls,{data:JSON.parse(r)})}catch{a=l.jsx("pre",{className:"whitespace-pre-wrap",children:r})}return l.jsx(_r,{open:t,onOpenChange:n,children:l.jsxs(yr,{children:[l.jsxs(Er,{children:[l.jsx(br,{children:"Agent Network Metadata"}),l.jsx(Ga,{children:"View the metadata of the agent's network choice."})]}),l.jsxs(Dr,{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(ge,{className:"text-neutral3",children:"Selection Reason"}),l.jsx("div",{className:"text-neutral6 text-ui-md",children:e})]}),a&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(ge,{className:"text-neutral3",children:"Input"}),l.jsx("div",{className:"text-neutral6 text-ui-md",children:a})]})]})]})})},Kme=({selectionReason:e,input:t})=>{const[n,r]=x.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(ds,{variant:"light",size:"md",tooltip:"Show selection reason",onClick:()=>r(a=>!a),children:l.jsx($Zt,{className:"text-neutral3 size-5"})}),l.jsx(drr,{selectionReason:e||"",open:n,onOpenChange:r,input:t})]})},tbt=x.createContext(void 0);function frr({children:e,approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:c,networkToolCallApprovals:u}){return l.jsx(tbt.Provider,{value:{approveToolcall:t,declineToolcall:n,approveToolcallGenerate:r,declineToolcallGenerate:a,approveNetworkToolcall:s,declineNetworkToolcall:i,isRunning:o,toolCallApprovals:c,networkToolCallApprovals:u},children:e})}function prr(){const e=x.useContext(tbt);if(!e)throw new Error("useToolCall must be used within a ToolCallProvider");return e}const OR=({toolCalled:e,toolCallId:t,toolApprovalMetadata:n,toolName:r,isNetwork:a,isGenerateMode:s})=>{const{approveToolcall:i,declineToolcall:o,approveToolcallGenerate:c,declineToolcallGenerate:u,isRunning:d,toolCallApprovals:f,approveNetworkToolcall:p,declineNetworkToolcall:h,networkToolCallApprovals:m}=prr(),g=()=>{a?p(r,n?.runId):s?c(t):i(t)},v=()=>{a?h(r,n?.runId):s?u(t):o(t)},b=a?m?.[n?.runId?`${n.runId}-${r}`:r]?.status:f?.[t]?.status;return n&&!e?l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Approval required"}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsxs(ye,{onClick:g,disabled:d||!!b,className:b==="approved"?"text-accent1!":"",children:[l.jsx(_e,{children:l.jsx(ha,{})}),"Approve"]}),l.jsxs(ye,{onClick:v,disabled:d||!!b,className:b==="declined"?"text-accent2!":"",children:[l.jsx(_e,{children:l.jsx(ir,{})}),"Decline"]})]})]}):null},hrr=({agentId:e,messages:t=[],metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:o,toolCalled:c,isComplete:u=!1})=>{const d=n?.mode==="network"?n.selectionReason:void 0,f=n?.mode==="network"?n.agentInput:void 0,p=n?.mode==="stream"||n?.mode==="network"||n?.mode==="generate"?n?.requireApprovalMetadata:void 0,h=n?.mode==="stream"||n?.mode==="network"||n?.mode==="generate"?n?.suspendedTools:void 0,m=t.length>0&&t.every(b=>b.type==="text"?!0:b.toolOutput!==void 0);let g=m;i&&(g=c??m);let v=typeof o=="string"?l.jsx("pre",{className:"whitespace-pre bg-surface4 p-4 rounded-md overflow-x-auto",children:o}):l.jsx(ls,{data:o,"data-testid":"tool-suspend-payload"});return l.jsxs(Vz,{"data-testid":"agent-badge",icon:l.jsx(Ys,{className:"text-accent1"}),title:e,initialCollapsed:u&&!a,extraInfo:n?.mode==="network"&&l.jsx(Kme,{selectionReason:d??"",input:f}),children:[t.map((b,w)=>{if(b.type==="text")return l.jsx(Uet,{children:b.content},w);let O;try{O=typeof b.toolOutput=="string"?JSON.parse(b.toolOutput):b.toolOutput}catch{O=b.toolOutput}return l.jsx(Ce.Fragment,{children:l.jsx(Pbt,{toolName:b.toolName,argsText:typeof b.args=="string"?b.args:JSON.stringify(b.args),result:O,args:b.args,status:{type:"complete"},type:"tool-call",toolCallId:b.toolCallId,addResult:()=>{},resume:()=>{},metadata:{mode:"stream",requireApprovalMetadata:p,suspendedTools:h}})},w)}),v!==void 0&&o&&l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Agent suspend payload"}),v]}),l.jsx(OR,{toolCalled:g,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,isGenerateMode:n?.mode==="generate"})]})};function Tr({className:e,...t}){return l.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 Jme=()=>l.jsx(Vz,{icon:l.jsx(Ft,{color:M6.neutral3}),title:l.jsx(Tr,{className:"ml-2 w-12 h-2"}),collapsible:!1}),mrr=({agentId:e,result:t,metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:o,toolCalled:c,isComplete:u})=>{const{data:d,isLoading:f}=Cyt({threadId:t?.subAgentThreadId,agentId:e,memory:!0});if(f)return l.jsx(Jme,{});const p=d?.messages?JHe(d.messages):[];let h=t?.childMessages?.length?t.childMessages:void 0;if(!h&&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}),h=m}return h||(h=FFt(p)),l.jsx(hrr,{agentId:e,messages:h??[],metadata:n,toolCallId:r,toolApprovalMetadata:a,toolName:s,isNetwork:i,suspendPayload:o,toolCalled:c,isComplete:u})},Hz=({copiedDuration:e=1500}={})=>{const[t,n]=x.useState(!1);return{isCopied:t,copyToClipboard:a=>{a&&navigator.clipboard.writeText(a).then(()=>{n(!0),setTimeout(()=>n(!1),e)})}}},nbt=x.createContext({Link:x.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:()=>""}}),rbt=({children:e,Link:t,navigate:n,paths:r})=>l.jsx(nbt.Provider,{value:{Link:t,navigate:n,paths:r},children:e}),en=()=>{const e=x.useContext(nbt);if(!e)throw new Error("useLinkComponent must be used within a LinkComponentProvider");return e},grr=({toolName:e,args:t,result:n,toolCallId:r,toolApprovalMetadata:a,isNetwork:s,toolCalled:i})=>{const[o,c]=x.useState(!a),{isCopied:u,copyToClipboard:d}=Hz();x.useEffect(()=>{c(!a)},[a]);const{Link:f}=en();let p={path:"."};try{p=typeof t=="object"?t:JSON.parse(t)}catch{}const{path:h=".",maxDepth:m,showHidden:g,dirsOnly:v,exclude:b,extension:w}=p,O=[];m!==void 0&&m!==3&&O.push(`depth: ${m}`),g&&O.push("hidden"),v&&O.push("dirs only"),b&&O.push(`exclude: ${b}`),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=Gn(M=>M.message),I=x.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 l.jsxs("div",{className:"mb-4","data-testid":"file-tree-badge",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsxs("button",{onClick:()=>c(M=>!M),className:"flex items-center gap-2 min-w-0",type:"button",children:[l.jsx(_e,{children:l.jsx(Bb,{className:Y("transition-all",o?"rotate-90":"rotate-180")})}),l.jsxs(vt,{icon:l.jsx(dGt,{className:"text-accent6",size:16}),children:["List Files ",l.jsx("span",{className:"text-neutral6 font-normal ml-1",children:h}),O.length>0&&l.jsxs("span",{className:"text-neutral4 font-normal ml-1",children:["(",O.join(", "),")"]})]})]}),I?.filesystem&&l.jsxs(f,{href:I.id?`/workspaces/${I.id}?path=${encodeURIComponent(h)}`:"/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:[l.jsx(Dte,{className:"size-3"}),l.jsx("span",{children:I.name||I.filesystem.name})]}),o&&C&&_&&l.jsx("span",{className:"text-neutral6 text-xs",children:_})]}),!o&&l.jsxs("div",{className:"pt-2",children:[a&&!T&&l.jsxs("div",{className:"p-4 rounded-lg bg-surface2 flex flex-col gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-medium pb-2",children:"Tool arguments"}),l.jsx(ls,{data:p,"data-testid":"tool-args"})]}),l.jsx(OR,{toolCalled:T,toolCallId:r,toolApprovalMetadata:a,toolName:e,isNetwork:s})]}),T&&k&&l.jsxs("div",{className:"rounded-md border border-border1 bg-surface2 overflow-hidden",children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border1 bg-surface3",children:[_&&l.jsx("span",{className:"text-neutral6 text-xs",children:_}),l.jsx(ds,{variant:"light",size:"sm",tooltip:"Copy tree",onClick:P,disabled:!k,children:l.jsxs("span",{className:"grid",children:[l.jsx("span",{style:{gridArea:"1/1"},className:Y("transition-transform",u?"scale-100":"scale-0"),children:l.jsx(ha,{size:14})}),l.jsx("span",{style:{gridArea:"1/1"},className:Y("transition-transform",u?"scale-0":"scale-100"),children:l.jsx(Wl,{size:14})})]})})]}),l.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&&l.jsx("div",{className:"rounded-md border border-border1 bg-surface2 px-3 py-2",children:l.jsx("span",{className:"text-xs text-neutral6",children:"Loading..."})})]})]})};function Bk({children:e}){const t=e.replace(/\\n/g,`
464
464
  `);return l.jsx(Uet,{remarkPlugins:[zst],components:yrr,className:"space-y-3",children:t})}const abt=Ce.memo(({children:e,language:t,...n})=>{const[r,a]=x.useState([]);return x.useEffect(()=>{urr(e,t).then(s=>{s&&a(s)})},[e,t]),r.length?l.jsx("pre",{...n,children:l.jsx("code",{children:r.map((s,i)=>l.jsxs(l.Fragment,{children:[l.jsx("span",{children:s.map((o,c)=>{const u=typeof o.htmlStyle=="string"?void 0:o.htmlStyle;return l.jsx("span",{className:"text-shiki-light bg-shiki-light-bg dark:text-shiki-dark dark:bg-shiki-dark-bg",style:u,children:o.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<o.length;c++){var u=o[c];if(!(u.length>1024)){var d=GFe.test(u)?u.replace(GFe,"$1"):u;if(!d.match(/\S*Error: /)){for(var f of n){var p=f(d,e);if(p){i.push(p);break}}if(i.length>=ZFe)break}}}return(function(h){if(!h.length)return[];var m=Array.from(h);return m.reverse(),m.slice(0,ZFe).map((g=>{return Dt({},g,{filename:g.filename||(v=m,v[v.length-1]||{}).filename,function:g.function||Gk});var v}))})(i)}})("web:javascript",kwr,Cwr)}class Twr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var r=ao(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 x3(t,"DOMException")}isDOMError(t){return x3(t,"DOMError")}}class Nwr{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 Awr{constructor(){}match(t){return x3(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 Iwr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Rwr{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(Iwr);return a&&(n=a[1],r=a[2]),[n,r]}}var Pwr=["fatal","error","warning","log","info","debug"];function t1t(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 Mwr{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 Kge(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: "+t1t(t)}isSeverityLevel(t){return ao(t)&&!Dse(t)&&Pwr.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];if(ywr(r))return r}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class Dwr{match(t){return Kge(t)}coerce(t,n){var r,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+t1t(t),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class $wr{match(t){return $St(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 Lwr{match(t){return x3(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Kge(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 $St(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 n1t=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,r={k:function(a){if(Ye&&(sf.DEBUG||Ln.POSTHOG_DEBUG||n)&&!Vt(Ye.console)&&Ye.console){for(var s=("__rrweb_original__"in Ye.console[a])?Ye.console[a].__rrweb_original__:Ye.console[a],i=arguments.length,o=new Array(i>1?i-1:0),c=1;c<i;c++)o[c-1]=arguments[c];s(e,...o)}},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)=>n1t(e+" "+a,s)};return r},Qt=n1t("[PostHog.js]"),gi=Qt.createLogger,Fwr=gi("[ExternalScriptsLoader]"),YFe=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return Fwr.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=Ut?.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 o=()=>{if(!Ut)return n("document not found");var c=Ut.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")Ut.head.appendChild(c);else{var u,d=Ut.querySelectorAll("body > script");d.length>0?(u=d[0].parentNode)==null||u.insertBefore(c,d[0]):Ut.body.appendChild(c)}};Ut!=null&&Ut.body?o():Ut?.addEventListener("DOMContentLoaded",o)};Ln.__PosthogExtensions__=Ln.__PosthogExtensions__||{},Ln.__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);YFe(e,s,n)},Ln.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);YFe(e,r,n)};var S3={};function ab(e,t,n){if(Ta(e)){if(LFe&&e.forEach===LFe)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)===S3)return}}}function Ns(e,t,n){if(!aa(e)){if(Ta(e))return ab(e,t,n);if(rwr(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===S3)return}else for(var a in e)if(DSt.call(e,a)&&t.call(n,e[a],a)===S3)return}}var zi=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 ab(n,(function(a){for(var s in a)a[s]!==void 0&&(e[s]=a[s])})),e},Zk=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 ab(n,(function(a){ab(a,(function(s){e.push(s)}))})),e};function t$(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 XFe=function(e){try{return e()}catch{return}},zwr=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){Qt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Qt.critical(a)}}},rve=function(e){var t={};return Ns(e,(function(n,r){(ao(n)&&n.length>0||wm(n))&&(t[r]=n)})),t};function Bwr(e,t){return n=e,r=s=>ao(s)&&!ah(t)?s.slice(0,t):s,a=new Set,(function s(i,o){return i!==Object(i)?r?r(i,o):i:a.has(i)?void 0:(a.add(i),Ta(i)?(c=[],ab(i,(u=>{c.push(s(u))}))):(c={},Ns(i,((u,d)=>{a.has(u)||(c[d]=s(u,d))}))),c);var c})(n);var n,r,a}var Uwr=["herokuapp.com","vercel.app","netlify.app"];function qwr(e){var t=e?.hostname;if(!ao(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of Uwr)if(n===r)return!1;return!0}function r1t(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function eo(e,t,n,r){var{capture:a=!1,passive:s=!0}=r??{};e?.addEventListener(t,n,{capture:a,passive:s})}function a1t(e){return e.name==="ph_toolbar_internal"}var s1t="$people_distinct_id",bj="__alias",xj="__timers",KFe="$autocapture_disabled_server_side",Bse="$heatmaps_enabled_server_side",JFe="$exception_capture_enabled_server_side",Use="$error_tracking_suppression_rules",eze="$error_tracking_capture_extension_exceptions",tze="$web_vitals_enabled_server_side",i1t="$dead_clicks_enabled_server_side",nze="$product_tours_enabled_server_side",rze="$web_vitals_allowed_metrics",e2="$session_recording_remote_config",O3="$sesid",o1t="$session_is_sampled",J1="$enabled_feature_flags",wj="$early_access_features",qse="$feature_flag_details",Sj="$stored_person_properties",Yx="$stored_group_properties",Vse="$surveys",iT="$flag_call_reported",Hse="$flag_call_reported_session_id",Qse="$feature_flag_errors",k3="$feature_flag_evaluated_at",Ch="$user_state",Wse="$client_session_props",Gse="$capture_rate_limit",Zse="$initial_campaign_params",Yse="$initial_referrer_info",_3="$initial_person_info",E3="$epp",l1t="__POSTHOG_TOOLBAR__",$C="$posthog_cookieless",Vwr=[s1t,bj,"__cmpns",xj,"$session_recording_enabled_server_side",Bse,O3,J1,Use,Ch,wj,qse,Yx,Sj,Vse,iT,Hse,Qse,k3,Wse,Gse,Zse,Yse,E3,_3];Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return wm(e)&&isFinite(e)&&Math.floor(e)===e});var aze="0123456789abcdef";class C3{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 C3(s)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+aze.charAt(this.bytes[n]>>>4)+aze.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 C3(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 Hwr{constructor(){this.P=0,this.T=0,this.R=new Qwr}generate(){var t=this.generateOrAbort();if(Vt(t)){this.P=0;var n=this.generateOrAbort();if(Vt(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 C3.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 sze,c1t=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};Ye&&!Vt(Ye.crypto)&&crypto.getRandomValues&&(c1t=e=>crypto.getRandomValues(e));class Qwr{constructor(){this.C=new Uint32Array(8),this.O=1/0}nextUint32(){return this.O>=this.C.length&&(c1t(this.C),this.O=0),this.C[this.O++]}}var qy=()=>Wwr().toString(),Wwr=()=>(sze||(sze=new Hwr)).generate(),LC="",Gwr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Zwr(e,t){if(t){var n=(function(a,s){if(s===void 0&&(s=Ut),LC)return LC;if(!s||["localhost","127.0.0.1"].includes(a))return"";for(var i=a.split("."),o=Math.min(i.length,8),c="dmn_chk_"+qy();!LC&&o--;){var u=i.slice(o).join("."),d=c+"=1;domain=."+u+";path=/";s.cookie=d+";max-age=3",s.cookie.includes(c)&&(s.cookie=d+";max-age=0",LC=u)}return LC})(e);if(!n){var r=(a=>{var s=a.match(Gwr);return s?s[0]:""})(e);r!==n&&Qt.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Fh={F:()=>!!Ut,M:function(e){Qt.error("cookieStore error: "+e)},A:function(e){if(Ut){try{for(var t=e+"=",n=Ut.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(Fh.A(e))||{}}catch{}return t},L:function(e,t,n,r,a){if(Ut)try{var s="",i="",o=Zwr(Ut.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=/"+o+i;return u.length>3686.4&&Qt.warn("cookieStore warning: large cookie, len="+u.length),Ut.cookie=u,u}catch{return}},j:function(e,t){if(Ut!=null&&Ut.cookie)try{Fh.L(e,"",-1,t)}catch{return}}},ZJ=null,di={F:function(){if(!ah(ZJ))return ZJ;var e=!0;if(Vt(Ye))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||Qt.error("localStorage unsupported; falling back to cookie store"),ZJ=e,e},M:function(e){Qt.error("localStorage error: "+e)},A:function(e){try{return Ye?.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{Ye?.localStorage.setItem(e,JSON.stringify(t))}catch(n){di.M(n)}},j:function(e){try{Ye?.localStorage.removeItem(e)}catch(t){di.M(t)}}},Ywr=["$device_id","distinct_id",O3,o1t,E3,_3,Ch],t2={},Xwr={F:function(){return!0},M:function(e){Qt.error("memoryStorage error: "+e)},A:function(e){return t2[e]||null},D:function(e){return t2[e]||null},L:function(e,t){t2[e]=t},j:function(e){delete t2[e]}},Fx=null,pl={F:function(){if(!ah(Fx))return Fx;if(Fx=!0,Vt(Ye))Fx=!1;else try{var e="__support__";pl.L(e,"xyz"),pl.A(e)!=='"xyz"'&&(Fx=!1),pl.j(e)}catch{Fx=!1}return Fx},M:function(e){Qt.error("sessionStorage error: ",e)},A:function(e){try{return Ye?.sessionStorage.getItem(e)}catch(t){pl.M(t)}return null},D:function(e){try{return JSON.parse(pl.A(e))||null}catch{}return null},L:function(e,t){try{Ye?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){pl.M(n)}},j:function(e){try{Ye?.sessionStorage.removeItem(e)}catch(t){pl.M(t)}}},wg=(function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e})({});class Kwr{constructor(t){this._instance=t}get N(){return this._instance.config}get consent(){return this.U()?wg.DENIED:this.H}isOptedOut(){return this.N.cookieless_mode==="always"||this.consent===wg.DENIED||this.consent===wg.PENDING&&(this.N.opt_out_capturing_by_default||this.N.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===wg.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 QJ(t)?wg.GRANTED:Gr(iwr,t)?wg.DENIED:wg.PENDING}get B(){if(!this.V){var t=this.N.opt_out_capturing_persistence_type;this.V=t==="localStorage"?di:Fh;var n=t==="localStorage"?Fh:di;n.A(this.q)&&(this.V.A(this.q)||this.optInOut(QJ(n.A(this.q))),n.j(this.q,this.N.cross_subdomain_cookie))}return this.V}U(){return!!this.N.respect_dnt&&!!r1t([fd?.doNotTrack,fd?.msDoNotTrack,Ln.doNotTrack],(t=>QJ(t)))}}var n2=gi("[Dead Clicks]"),Jwr=()=>!0,eSr=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(i1t)),r=e.instance.config.capture_dead_clicks;return Vg(r)?r:!!Co(r)||n};class ize{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({[i1t]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.G((()=>{this.Y()})):this.stop()}G(t){var n,r;(n=Ln.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&t(),(r=Ln.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?n2.error("failed to load script",a):t()}))}Y(){var t;if(Ut){if(!this.W&&(t=Ln.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Co(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.W=Ln.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.W.start(Ut),n2.info("starting...")}}else n2.error("`document` not found. Cannot start.")}stop(){this.W&&(this.W.stop(),this.W=void 0,n2.info("stopping..."))}}var YJ=gi("[SegmentIntegration]");function tSr(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()||qy();r.config.get_device_id=u,c.id()&&(r.register({distinct_id:c.id(),$device_id:u()}),r.persistence.set_property(Ch,"identified")),a()},o=s.user();"then"in o&&Pg(o.then)?o.then(i):i(o)})(e,(()=>{n.register((r=>{Promise&&Promise.resolve||YJ.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()||(YJ.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(YJ.info("UserId set, identifying with PostHog"),r.identify(s.event.userId));var o=r.calculateEventProperties(i,s.event.properties);return s.event.properties=Object.assign({},o,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 u1t="posthog-js";function d1t(e,t){var{organization:n,projectId:r,prefix:a,severityAllowList:s=["error"],sendExceptionsToPostHog:i=!0}=t===void 0?{}:t;return o=>{var c,u,d,f,p;if(!(s==="*"||s.includes(o.level))||!e.__loaded)return o;o.tags||(o.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var m,g=((c=o.exception)==null?void 0:c.values)||[],v=g.map((w=>Dt({},w,{stacktrace:w.stacktrace?Dt({},w.stacktrace,{type:"raw",frames:(w.stacktrace.frames||[]).map((O=>Dt({},O,{platform:"web:javascript"})))}):void 0}))),b={$exception_message:((u=g[0])==null?void 0:u.value)||o.message,$exception_type:(d=g[0])==null?void 0:d.type,$exception_level:o.level,$exception_list:v,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((f=g[0])==null?void 0:f.value)||o.message,$sentry_exception_type:(p=g[0])==null?void 0:p.type,$sentry_tags:o.tags};return n&&r&&(b.$sentry_url=(a||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+o.event_id),i&&((m=e.exceptions)==null||m.sendExceptionEvent(b)),o}}class nSr{constructor(t,n,r,a,s,i){this.name=u1t,this.setupOnce=function(o){o(d1t(t,{organization:n,projectId:r,prefix:a,severityAllowList:s,sendExceptionsToPostHog:i==null||i}))}}}class oze{constructor(t){this.J=(n,r,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength)&&(Qt.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=Ye?.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:o,maxScrollY:c,maxContentHeight:u,lastContentY:d,maxContentY:f}=s;if(!(Vt(i)||Vt(o)||Vt(c)||Vt(u)||Vt(d)||Vt(f))){i=Math.ceil(i),o=Math.ceil(o),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d),f=Math.ceil(f);var p=i<=1?1:Jh(o/i,0,1,Qt),h=i<=1?1:Jh(c/i,0,1,Qt),m=u<=1?1:Jh(d/u,0,1,Qt),g=u<=1?1:Jh(f/u,0,1,Qt);a=zi(a,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:h,$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 j3=e=>{var t=Ut?.createElement("a");return Vt(t)?null:(t.href=e,t)},rSr=function(e,t){var n,r;t===void 0&&(t="&");var a=[];return Ns(e,(function(s,i){Vt(s)||Vt(i)||i==="undefined"||(n=encodeURIComponent((o=>o instanceof File)(s)?s.name:s.toString()),r=encodeURIComponent(i),a[a.length]=r+"="+n)})),a.join(t)},T3=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(!Ta(n)||n.length<2)return"";var i=n[1];try{i=decodeURIComponent(i)}catch{Qt.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},_A=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("?"),o=i[1],c=i[0],u=(o||"").split("&"),d=[],f=0;f<u.length;f++){var p=u[f].split("=");Ta(p)&&(t.includes(p[0])?d.push(p[0]+"="+n):d.push(u[f]))}var h=c;return o!=null&&(h+="?"+d.join("&")),s!=null&&(h+="#"+s),h},N3=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},r2="https?://(.*)",Yk=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],aSr=Zk(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Yk),EA="<masked>",sSr=["li_fat_id"];function f1t(e,t,n){if(!Ut)return{};var r,a=t?Zk([],Yk,n||[]):[],s=p1t(_A(Ut.URL,a,EA),e),i=(r={},Ns(sSr,(function(o){var c=Fh.A(o);r[o]=c||null})),r);return zi(i,s)}function p1t(e,t){var n=aSr.concat(t||[]),r={};return Ns(n,(function(a){var s=T3(e,a);r[a]=s||null})),r}function h1t(e){var t=(function(s){return s?s.search(r2+"google.([^/?]*)")===0?"google":s.search(r2+"bing.com")===0?"bing":s.search(r2+"yahoo.com")===0?"yahoo":s.search(r2+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",r={};if(!ah(t)){r.$search_engine=t;var a=Ut?T3(Ut.referrer,n):"";a.length&&(r.ph_keyword=a)}return r}function lze(){return navigator.language||navigator.userLanguage}function m1t(){return Ut?.referrer||"$direct"}function g1t(e,t){var n=e?Zk([],Yk,t||[]):[],r=ml?.href.substring(0,1e3);return{r:m1t().substring(0,1e3),u:r?_A(r,n,EA):void 0}}function v1t(e){var t,{r:n,u:r}=e,a={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=j3(n))==null?void 0:t.host};if(r){a.$current_url=r;var s=j3(r);a.$host=s?.host,a.$pathname=s?.pathname;var i=p1t(r);zi(a,i)}if(n){var o=h1t(n);zi(a,o)}return a}function y1t(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function iSr(){try{return new Date().getTimezoneOffset()}catch{return}}function oSr(e,t){var n,r,a,s;if(!Yc)return{};var i,o,c,u,d,f,p,h,m=e?Zk([],Yk,t||[]):[],[g,v]=(function(b){for(var w=0;w<QFe.length;w++){var[O,k]=QFe[w],_=O.exec(b),C=_&&(Pg(k)?k(_,b):k);if(C)return C}return["",""]})(Yc);return zi(rve({$os:g,$os_version:v,$browser:JSt(Yc,navigator.vendor),$device:WFe(Yc),$device_type:(o=Yc,c={userAgentDataPlatform:(n=navigator)==null||(n=n.userAgentData)==null?void 0:n.platform,maxTouchPoints:(r=navigator)==null?void 0:r.maxTouchPoints,screenWidth:Ye==null||(a=Ye.screen)==null?void 0:a.width,screenHeight:Ye==null||(s=Ye.screen)==null?void 0:s.height,devicePixelRatio:Ye?.devicePixelRatio},h=WFe(o),h===FSt||h===LSt||h==="Kobo"||h==="Kindle Fire"||h===KSt?Qk:h===OA||h===IO||h===kA||h===Lse?"Console":h===BSt?"Wearable":h?xd: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)/((p=c?.devicePixelRatio)!==null&&p!==void 0?p:1)>=600?Qk:xd:"Desktop"),$timezone:y1t(),$timezone_offset:iSr()}),{$current_url:_A(ml?.href,m,EA),$host:ml?.host,$pathname:ml?.pathname,$raw_user_agent:Yc.length>1e3?Yc.substring(0,997)+"...":Yc,$browser_version:vwr(Yc,navigator.vendor),$browser_language:lze(),$browser_language_prefix:(i=lze(),typeof i=="string"?i.split("-")[0]:void 0),$screen_height:Ye?.screen.height,$screen_width:Ye?.screen.width,$viewport_height:Ye?.innerHeight,$viewport_width:Ye?.innerWidth,$lib:sf.LIB_NAME,$lib_version:sf.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var lSr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class XJ{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&&Qt.info("Persistence loaded",t.persistence,Dt({},this.props)),this.update_config(t,t,n),this.save()}isDisabled(){return!!this.st}rt(t){lSr.indexOf(t.persistence.toLowerCase())===-1&&(Qt.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=[...Ywr,...a];return Dt({},di,{D:function(i){try{var o={};try{o=Fh.D(i)||{}}catch{}var c=zi(o,JSON.parse(di.A(i)||"{}"));return di.L(i,c),c}catch{}return null},L:function(i,o,c,u,d,f){try{di.L(i,o,void 0,void 0,f);var p={};s.forEach((h=>{o[h]&&(p[h]=o[h])})),Object.keys(p).length&&Fh.L(i,p,c,u,d,f)}catch(h){di.M(h)}},j:function(i,o){try{Ye?.localStorage.removeItem(i),Fh.j(i,o)}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"&&pl.F()?pl:r==="memory"?Xwr:r==="cookie"?Fh:n.F()?n:Fh}nt(t){var n=t??this.N.feature_flag_cache_ttl_ms;if(!n||n<=0)return!1;var r=this.props[k3];return!r||typeof r!="number"||Date.now()-r>n}properties(){var t={};return Ns(this.props,((n,r)=>{if(r===J1&&Co(n)){if(!this.nt())for(var a=Object.keys(n),s=0;s<a.length;s++)t["$feature/"+a[s]]=n[a[s]]}else o=r,c=!1,(ah(i=Vwr)?c:FFe&&i.indexOf===FFe?i.indexOf(o)!=-1:(Ns(i,(function(u){if(c||(c=u===o))return S3})),c))||(t[r]=n);var i,o,c})),t}load(){if(!this.st){var t=this.B.D(this.et);t&&(this.props=zi({},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(Co(t)){Vt(n)&&(n="None"),this.ot=Vt(r)?this.dt:r;var a=!1;if(Ns(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(Co(t)){this.ot=Vt(n)?this.dt:n;var r=!1;if(Ns(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=f1t(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);K1(rve(t))||this.register(t),this.it=!0}}update_search_keyword(){var t;this.register((t=Ut?.referrer)?h1t(t):{})}update_referrer_info(){var t;this.register_once({$referrer:m1t(),$referring_domain:Ut!=null&&Ut.referrer&&((t=j3(Ut.referrer))==null?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Zse]||this.props[Yse]||this.register_once({[_3]:g1t(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Ns([Yse,Zse],(i=>{var o=this.props[i];o&&Ns(o,(function(c,u){t["$initial_"+Mse(u)]=c}))}));var n,r,a=this.props[_3];if(a){var s=(n=v1t(a),r={},Ns(n,(function(i,o){r["$initial_"+Mse(o)]=i})),r);zi(t,s)}return t}safe_merge(t){return Ns(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,o)=>{if(i.length!==o.length)return!1;var c=[...i].sort(),u=[...o].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[xj]||{};r[t]=n,this.props[xj]=r,this.save()}remove_event_timer(t){var n=(this.props[xj]||{})[t];return Vt(n)||(delete this.props[xj][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var FC={Activation:"events",Cancellation:"cancelEvents"},KJ={Popover:"popover",API:"api",Widget:"widget"},Oj={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},JJ={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Xse={Popover:"popover",Inline:"inline"},cSr=(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})({}),cze=(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})({}),uze=gi("[RateLimiter]");class uSr{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=>{uze.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void uze.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,o=new Date().getTime(),c=(n=(r=this.instance.persistence)==null?void 0:r.get_property(Gse))!==null&&n!==void 0?n:{tokens:s,last:o};c.tokens+=(o-c.last)/1e3*i,c.last=o,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(Gse,c),{isRateLimited:u,remainingTokens:c.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var zC=gi("[RemoteConfig]");class b1t{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Ln._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}vt(t){var n,r;(n=Ln.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Ln.__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()||Ut?.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 jg=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),Af=Uint8Array,hu=Uint16Array,Xk=Uint32Array,ave=new Af([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]),sve=new Af([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]),dze=new Af([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),x1t=function(e,t){for(var n=new hu(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var a=new Xk(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]},w1t=x1t(ave,2),dSr=w1t[0],Kse=w1t[1];dSr[28]=258,Kse[258]=28;for(var fze=x1t(sve,0)[1],S1t=new hu(32768),qs=0;qs<32768;++qs){var zx=(43690&qs)>>>1|(21845&qs)<<1;zx=(61680&(zx=(52428&zx)>>>2|(13107&zx)<<2))>>>4|(3855&zx)<<4,S1t[qs]=((65280&zx)>>>8|(255&zx)<<8)>>>1}var oT=function(e,t,n){for(var r=e.length,a=0,s=new hu(t);a<r;++a)++s[e[a]-1];var i,o=new hu(t);for(a=0;a<t;++a)o[a]=o[a-1]+s[a-1]<<1;for(i=new hu(r),a=0;a<r;++a)i[a]=S1t[o[e[a]-1]++]>>>15-e[a];return i},kw=new Af(288);for(qs=0;qs<144;++qs)kw[qs]=8;for(qs=144;qs<256;++qs)kw[qs]=9;for(qs=256;qs<280;++qs)kw[qs]=7;for(qs=280;qs<288;++qs)kw[qs]=8;var A3=new Af(32);for(qs=0;qs<32;++qs)A3[qs]=5;var fSr=oT(kw,9),pSr=oT(A3,5),O1t=function(e){return(e/8>>0)+(7&e&&1)},k1t=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof hu?hu:e instanceof Xk?Xk:Af)(n-t);return r.set(e.subarray(t,n)),r},hg=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},BC=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},eee=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 Af(0),0];if(a==1){var i=new Af(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 o=n[0],c=n[1],u=0,d=1,f=2;for(n[0]={s:-1,f:o.f+c.f,l:o,r:c};d!=a-1;)o=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:o.f+c.f,l:o,r:c};var p=s[0].s;for(r=1;r<a;++r)s[r].s>p&&(p=s[r].s);var h=new hu(p+1),m=Jse(n[d-1],h,0);if(m>t){r=0;var g=0,v=m-t,b=1<<v;for(s.sort((function(_,C){return h[C.s]-h[_.s]||_.f-C.f}));r<a;++r){var w=s[r].s;if(!(h[w]>t))break;g+=b-(1<<m-h[w]),h[w]=t}for(g>>>=v;g>0;){var O=s[r].s;h[O]<t?g-=1<<t-h[O]++-1:++r}for(;r>=0&&g;--r){var k=s[r].s;h[k]==t&&(--h[k],++g)}m=t}return[new Af(h),m]},Jse=function(e,t,n){return e.s==-1?Math.max(Jse(e.l,t,n+1),Jse(e.r,t,n+1)):t[e.s]=n},pze=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new hu(++t),r=0,a=e[0],s=1,i=function(c){n[r++]=c},o=1;o<=t;++o)if(e[o]==a&&o!=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[o]}return[n.subarray(0,r),t]},UC=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},eie=function(e,t,n){var r=n.length,a=O1t(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,o,c,u,d){hg(t,d++,n),++a[256];for(var f=eee(a,15),p=f[0],h=f[1],m=eee(s,15),g=m[0],v=m[1],b=pze(p),w=b[0],O=b[1],k=pze(g),_=k[0],C=k[1],T=new hu(19),j=0;j<w.length;++j)T[31&w[j]]++;for(j=0;j<_.length;++j)T[31&_[j]]++;for(var A=eee(T,7),I=A[0],P=A[1],M=19;M>4&&!I[dze[M-1]];--M);var F,D,U,V,z=u+5<<3,H=UC(a,kw)+UC(s,A3)+i,W=UC(a,p)+UC(s,g)+i+14+3*M+UC(T,I)+(2*T[16]+3*T[17]+7*T[18]);if(z<=H&&z<=W)return eie(t,d,e.subarray(c,c+u));if(hg(t,d,1+(W<H)),d+=2,W<H){F=oT(p,h),D=p,U=oT(g,v),V=g;var $=oT(I,P);for(hg(t,d,O-257),hg(t,d+5,C-1),hg(t,d+10,M-4),d+=14,j=0;j<M;++j)hg(t,d+3*j,I[dze[j]]);d+=3*M;for(var Z=[w,_],B=0;B<2;++B){var R=Z[B];for(j=0;j<R.length;++j){var Q=31&R[j];hg(t,d,$[Q]),d+=I[Q],Q>15&&(hg(t,d,R[j]>>>5&127),d+=R[j]>>>12)}}}else F=fSr,D=kw,U=pSr,V=A3;for(j=0;j<o;++j)if(r[j]>255){Q=r[j]>>>18&31,BC(t,d,F[Q+257]),d+=D[Q+257],Q>7&&(hg(t,d,r[j]>>>23&31),d+=ave[Q]);var G=31&r[j];BC(t,d,U[G]),d+=V[G],G>3&&(BC(t,d,r[j]>>>5&8191),d+=sve[G])}else BC(t,d,F[r[j]]),d+=D[r[j]];return BC(t,d,F[256]),d+D[256]},hSr=new Xk([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),mSr=(function(){for(var e=new Xk(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),gSr=function(e,t,n,r,a){return(function(s,i,o,c,u,d){var f=s.length,p=new Af(c+f+5*(1+Math.floor(f/7e3))+u),h=p.subarray(c,p.length-u),m=0;if(!i||f<8)for(var g=0;g<=f;g+=65535){var v=g+65535;v<f?m=eie(h,m,s.subarray(g,v)):(h[g]=d,m=eie(h,m,s.subarray(g,f)))}else{for(var b=hSr[i-1],w=b>>>13,O=8191&b,k=(1<<o)-1,_=new hu(32768),C=new hu(k+1),T=Math.ceil(o/3),j=2*T,A=function(ue){return(s[ue]^s[ue+1]<<T^s[ue+2]<<j)&k},I=new Xk(25e3),P=new hu(288),M=new hu(32),F=0,D=0,U=(g=0,0),V=0,z=0;g<f;++g){var H=A(g),W=32767&g,$=C[H];if(_[W]=$,C[H]=W,V<=g){var Z=f-g;if((F>7e3||U>24576)&&Z>423){m=hze(s,h,0,I,P,M,D,U,z,g-z,m),U=F=D=0,z=g;for(var B=0;B<286;++B)P[B]=0;for(B=0;B<30;++B)M[B]=0}var R=2,Q=0,G=O,J=W-$&32767;if(Z>2&&H==A(g-J))for(var re=Math.min(w,Z)-1,ne=Math.min(32767,g),se=Math.min(258,Z);J<=ne&&--G&&W!=$;){if(s[g+R]==s[g+R-J]){for(var le=0;le<se&&s[g+le]==s[g+le-J];++le);if(le>R){if(R=le,Q=J,le>re)break;var me=Math.min(J,le-2),K=0;for(B=0;B<me;++B){var ae=g-J+B+32768&32767,oe=ae-_[ae]+32768&32767;oe>K&&(K=oe,$=ae)}}}J+=(W=$)-($=_[W])+32768&32767}if(Q){I[U++]=268435456|Kse[R]<<18|fze[Q];var ve=31&Kse[R],de=31&fze[Q];D+=ave[ve]+sve[de],++P[257+ve],++M[de],V=g+R,++F}else I[U++]=s[g],++P[s[g]]}}m=hze(s,h,d,I,P,M,D,U,z,g-z,m)}return k1t(p,0,c+O1t(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)},tee=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function vSr(e,t){t===void 0&&(t={});var n=(function(){var o=4294967295;return{p:function(c){for(var u=o,d=0;d<c.length;++d)u=mSr[255&u^c[d]]^u>>>8;o=u},d:function(){return 4294967295^o}}})(),r=e.length;n.p(e);var a,s=gSr(e,t,10+((a=t).filename&&a.filename.length+1||0),8),i=s.length;return(function(o,c){var u=c.filename;if(o[0]=31,o[1]=139,o[2]=8,o[8]=c.level<2?4:c.level==9?2:0,o[9]=3,c.mtime!=0&&tee(o,4,Math.floor(new Date(c.mtime||Date.now())/1e3)),u){o[3]=8;for(var d=0;d<=u.length;++d)o[d+10]=u.charCodeAt(d)}})(s,t),tee(s,i-8,n.d()),tee(s,i-4,r),s}var ySr=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),o=null;i<128?n++:o=i>127&&i<2048?String.fromCharCode(i>>6|192,63&i|128):String.fromCharCode(i>>12|224,i>>6&63|128,63&i|128),ah(o)||(n>t&&(s+=e.substring(t,n)),s+=o,t=n=a+1)}return n>t&&(s+=e.substring(t,e.length)),s},bSr=!!Pse||!!Rse,I3=function(e,t,n){var r;n===void 0&&(n=!0);var[a,s]=e.split("?"),i=Dt({},t),o=(r=s?.split("&").map((u=>{var d,[f,p]=u.split("="),h=n&&(d=i[f])!==null&&d!==void 0?d:p;return delete i[f],f+"="+h})))!==null&&r!==void 0?r:[],c=rSr(i);return c&&o.push(c),a+"?"+o.join("&")},kj=(e,t)=>JSON.stringify(e,((n,r)=>typeof r=="bigint"?r.toString():r),t),nee=e=>{var{data:t,compression:n}=e;if(t){if(n===jg.GZipJS){var r=vSr((function(o,c){var u=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var d=new Af(o.length+(o.length>>>1)),f=0,p=function(v){d[f++]=v},h=0;h<u;++h){if(f+5>d.length){var m=new Af(f+8+(u-h<<1));m.set(d),d=m}var g=o.charCodeAt(h);g<128||c?p(g):g<2048?(p(192|g>>>6),p(128|63&g)):g>55295&&g<57344?(p(240|(g=65536+(1047552&g)|1023&o.charCodeAt(++h))>>>18),p(128|g>>>12&63),p(128|g>>>6&63),p(128|63&g)):(p(224|g>>>12),p(128|g>>>6&63),p(128|63&g))}return k1t(d,0,f)})(kj(t)),{mtime:0});return{contentType:"text/plain",body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===jg.Base64){var a=(function(o){var c,u,d,f,p,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,g=0,v="",b=[];if(!o)return o;o=ySr(o);do c=(p=o.charCodeAt(m++)<<16|o.charCodeAt(m++)<<8|o.charCodeAt(m++))>>18&63,u=p>>12&63,d=p>>6&63,f=63&p,b[g++]=h.charAt(c)+h.charAt(u)+h.charAt(d)+h.charAt(f);while(m<o.length);switch(v=b.join(""),o.length%3){case 1:v=v.slice(0,-2)+"==";break;case 2:v=v.slice(0,-1)+"="}return v})(kj(t)),s=(o=>"data="+encodeURIComponent(typeof o=="string"?o:kj(o)))(a);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var i=kj(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}}},n$=[];Rse&&n$.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:a,estimatedSize:s}=(t=nee(e))!==null&&t!==void 0?t:{},i=new Headers;Ns(e.headers,(function(d,f){i.append(f,d)})),r&&i.append("Content-Type",r);var o=e.url,c=null;if(zFe){var u=new zFe;c={signal:u.signal,timeout:setTimeout((()=>u.abort()),e.timeout)}}Rse(o,Dt({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 p={statusCode:d.status,text:f};if(d.status===200)try{p.json=JSON.parse(f)}catch(h){Qt.error(h)}e.callback==null||e.callback(p)})))).catch((d=>{Qt.error(d),e.callback==null||e.callback({statusCode:0,error:d})})).finally((()=>c?clearTimeout(c.timeout):null))}}),Pse&&n$.push({transport:"XHR",method:e=>{var t,n=new Pse;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:a}=(t=nee(e))!==null&&t!==void 0?t:{};Ns(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)}}),fd!=null&&fd.sendBeacon&&n$.push({transport:"sendBeacon",method:e=>{var t=I3(e.url,{beacon:"1"});try{var n,{contentType:r,body:a}=(n=nee(e))!==null&&n!==void 0?n:{},s=typeof a=="string"?new Blob([a],{type:r}):a;fd.sendBeacon(t,s)}catch{}}});var tie=3e3;class xSr{constructor(t,n){this.wt=!0,this.Et=[],this.St=Jh(n?.flush_interval_ms||tie,250,5e3,Qt.createLogger("flush interval"),tie),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(Dt({},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&&Ta(s.data)&&Ns(s.data,(o=>{o.offset=Math.abs(o.timestamp-i),delete o.timestamp})),t.xt(s)};for(var a in n)r()}}),this.St))}Pt(){clearTimeout(this.$t),this.$t=void 0}Tt(){var t={};return Ns(this.Et,(n=>{var r,a=n,s=(a?a.batchKey:null)||a.url;Vt(t[s])&&(t[s]=Dt({},a,{data:[]})),(r=t[s].data)==null||r.push(a.data)})),this.Et=[],t}}var wSr=["retriesPerformedSoFar"];class SSr{constructor(t){this.Rt=!1,this.It=3e3,this.Et=[],this._instance=t,this.Et=[],this.Ct=!0,!Vt(Ye)&&"onLine"in Ye.navigator&&(this.Ct=Ye.navigator.onLine,this.Ot=()=>{this.Ct=!0,this.Ft()},this.Mt=()=>{this.Ct=!1},eo(Ye,"online",this.Ot),eo(Ye,"offline",this.Mt))}get length(){return this.Et.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,r=PSt(t,wSr);A1(n)&&(r.url=I3(r.url,{retry_count:n})),this._instance._send_request(Dt({},r,{callback:a=>{a.statusCode!==200&&(a.statusCode<400||a.statusCode>=500)&&(n??0)<10?this.At(Dt({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 o=3e3*Math.pow(2,i),c=o/2,u=Math.min(18e5,o),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)"),Qt.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,Vt(Ye)||(this.Ot&&(Ye.removeEventListener("online",this.Ot),this.Ot=void 0),this.Mt&&(Ye.removeEventListener("offline",this.Mt),this.Mt=void 0)),this.Et))try{this._instance._send_request(Dt({},t,{transport:"sendBeacon"}))}catch(n){Qt.error(n)}this.Et=[]}}class OSr{constructor(t){this.jt=()=>{var n,r,a,s;this.Nt||(this.Nt={});var i=this.scrollElement(),o=this.scrollY(),c=i?Math.max(0,i.scrollHeight-i.clientHeight):0,u=o+(i?.clientHeight||0),d=i?.scrollHeight||0;this.Nt.lastScrollY=Math.ceil(o),this.Nt.maxScrollY=Math.max(o,(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(){eo(Ye,"scroll",this.jt,{capture:!0}),eo(Ye,"scrollend",this.jt,{capture:!0}),eo(Ye,"resize",this.jt)}scrollElement(){if(!this._instance.config.scroll_root_selector)return Ye?.document.documentElement;var t=Ta(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=Ye?.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 Ye&&(Ye.scrollY||Ye.pageYOffset||Ye.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return Ye&&(Ye.scrollX||Ye.pageXOffset||Ye.document.documentElement.scrollLeft)||0}}var kSr=e=>g1t(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties);class mze{constructor(t,n,r,a){this.Ut=s=>{var i=this.zt();if(!i||i.sessionId!==s){var o={sessionId:s,props:this.Ht(this._instance)};this.Bt.register({[Wse]:o})}},this._instance=t,this.qt=n,this.Bt=r,this.Ht=a||kSr,this.qt.onSessionId(this.Ut)}zt(){return this.Bt.props[Wse]}getSetOnceProps(){var t,n=(t=this.zt())==null?void 0:t.props;return n?"r"in n?v1t(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 Ns(rve(this.getSetOnceProps()),((n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+Mse(r)]=n})),t}}class ive{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 ree=gi("[SessionId]");class gze{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 ive,this.Jt=(d,f)=>!(!A1(d)||!A1(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||qy,this.Zt=r||qy;var s=this.N.persistence_name||this.N.token,i=this.N.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Jh(i,60,36e3,ree.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 o=pl.D(this.ii),c=pl.D(this.ei);o&&!c?this.Kt=o:pl.j(this.ii),pl.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){ree.error("Invalid sessionID in bootstrap",d)}this.ni()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Vt(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&&pl.F()}oi(t){t!==this.Kt&&(this.Kt=t,this.ri()&&pl.L(this.ii,t))}ai(){return this.Kt?this.Kt:this.ri()?pl.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({[O3]:[n,t,r]}))}li(){var t=this.Bt.props[O3];return Ta(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&&Ye&&(Ye.removeEventListener("beforeunload",this.Yt,{capture:!1}),this.Yt=void 0),this.Gt=[]}ni(){this.Yt=()=>{this.ri()&&pl.j(this.ei)},eo(Ye,"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(),o=this.ai(),c=A1(i)&&Math.abs(r-i)>864e5,u=!1,d=!s,f=!d&&!t&&this.Jt(r,a);d||f||c?(s=this.Qt(),o=this.Zt(),ree.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:c}}),i=r,u=!0):o||(o=this.Zt(),u=!0);var p=A1(a)&&t&&!c?a:r,h=A1(i)?i:new Date().getTime();return this.oi(o),this.si(s,p,h),t||this.ti(),u&&this.Gt.forEach((m=>m(s,o,u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:c}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:h,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 _1t=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&qFe(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((a=>qFe(a?.brand,t))))return!0}catch{}return!!e.webdriver},R3=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 vze(e,t,n){return kj({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var E1t={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=>R3(n,r))))),not_regex:(e,t)=>t.every((n=>e.every((r=>!R3(n,r))))),icontains:(e,t)=>t.map(a2).some((n=>e.map(a2).some((r=>n.includes(r))))),not_icontains:(e,t)=>t.map(a2).every((n=>e.map(a2).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)))}))},a2=e=>e.toLowerCase();function C1t(e,t){return!e||Object.entries(e).every((n=>{var[r,a]=n,s=t?.[r];if(Vt(s)||ah(s))return!1;var i=[String(s)],o=E1t[a.operator];return!!o&&o(a.values,i)}))}var _j=(function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e})({}),yze="i.posthog.com";class _Sr{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("."+yze,".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]=_j.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hi[this.apiHost]=_j.EU:this.hi[this.apiHost]=_j.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===_j.CUSTOM)return this.apiHost+n;var r=yze+n;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var ms=gi("[Surveys]"),j1t="seenSurvey_",ESr=(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},bze=e=>((t,n)=>{var r=""+t+n.id;return n.current_iteration&&n.current_iteration>0&&(r=""+t+n.id+"_"+n.current_iteration),r})(j1t,e),CSr=[KJ.Popover,KJ.Widget,KJ.API],jSr={ignoreConditions:!1,ignoreDelay:!1,displayType:Xse.Popover},TSr=gi("[PostHog ExternalIntegrations]"),NSr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ASr{constructor(t){this._instance=t}G(t,n){var r;(r=Ln.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,(a=>{if(a)return TSr.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(i){var o,c,u;!a||(o=Ln.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[i]||t.G(NSr[i],(()=>{var d;(d=Ln.__PosthogExtensions__)==null||(d=d.integrations)==null||(d=d[i])==null||d.start(t._instance)})),!a&&(c=Ln.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[i]&&((u=Ln.__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 lT={},aee=0,nie=()=>{},I1="posthog",T1t=!bSr&&Yc?.indexOf("MSIE")===-1&&Yc?.indexOf("Mozilla")===-1,xze=e=>{var t;return Dt({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:qwr(Ut?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:nie,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:ml&&ao(ml?.search)&&ml.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:(Ye==null||(t=Ye.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;Qt.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:tie},error_tracking:{},_onCapture:nie,__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))},wze=e=>{var t={};Vt(e.process_person)||(t.person_profiles=e.process_person),Vt(e.xhr_headers)||(t.request_headers=e.xhr_headers),Vt(e.cookie_name)||(t.persistence_name=e.cookie_name),Vt(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Vt(e.store_google)||(t.save_campaign_params=e.store_google),Vt(e.verbose)||(t.debug=e.verbose);var n=zi({},t,e);return Ta(e.property_blacklist)&&(Vt(e.property_denylist)?n.property_denylist=e.property_blacklist:Ta(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Qt.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class ISr{constructor(){this.__forceAllowLocalhost=!1}get di(){return this.__forceAllowLocalhost}set di(t){Qt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class zh{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 ISr,this.fi=!1,this.version=sf.LIB_VERSION,this.pi=new ive,this.ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xze(),this.SentryIntegration=nSr,this.sentryIntegration=r=>(function(a,s){var i=d1t(a,s);return{name:u1t,processEvent:o=>i(o)}})(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 OSr(this),this.pageViewManager=new oze(this),this.rateLimiter=new uSr(this),this.requestRouter=new _Sr(this),this.consent=new Kwr(this),this.externalIntegrations=new ASr(this);var n=(t=zh.__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=ao(r)?{[r]:a}:r;this.setPersonProperties(i),s?.({})},set_once:(r,a,s)=>{var i=ao(r)?{[r]:a}:r;this.setPersonProperties(void 0,i),s?.({})}},this.on("eventCaptured",(r=>Qt.info('send "'+r?.event+'"',r)))}init(t,n,r){if(r&&r!==I1){var a,s=(a=lT[r])!==null&&a!==void 0?a:new zh;return s._init(t,n,r),lT[r]=s,lT[I1][r]=s,s}return this._init(t,n,r)}_init(t,n,r){var a;if(n===void 0&&(n={}),Vt(t)||Dse(t))return Qt.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(zi({},xze(n.defaults),wze(n),{name:r,token:t})),this.config.on_xhr_error&&Qt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:jg.GZipJS;var s=this.xi();this.persistence=new XJ(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new XJ(Dt({},this.config,{persistence:"sessionStorage"}),s);var i=Dt({},this.persistence.props),o=Dt({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.$i=new xSr((m=>this.ki(m)),this.config.request_queue_config),this.Pi=new SSr(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 gze(this),this.sessionPropsManager=new mze(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Qt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ti(c)}),0)):(Qt.info("Initializing extensions synchronously"),this.Ti(c)),sf.DEBUG=sf.DEBUG||this.config.debug,sf.DEBUG&&Qt.info("Starting in debug mode",{this:this,config:n,thisC:Dt({},this.config),p:i,s:o}),((a=n.bootstrap)==null?void 0:a.distinctID)!==void 0){var u,d,f=this.config.get_device_id(qy()),p=(u=n.bootstrap)!=null&&u.isIdentifiedID?f:n.bootstrap.distinctID;this.persistence.set_property(Ch,(d=n.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:p})}if(c)this.register_once({distinct_id:$C,$device_id:null},"");else if(!this.get_distinct_id()){var h=this.config.get_device_id(qy());this.register_once({distinct_id:h,$device_id:h},""),this.persistence.set_property(Ch,"anonymous")}return eo(Ye,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?tSr(this,(()=>this.Ri())):this.Ri(),Pg(this.config._onCapture)&&this.config._onCapture!==nie&&(Qt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(m=>this.config._onCapture(m.event,m)))),this.config.ip&&Qt.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,o,c,u=performance.now(),d=Dt({},zh.__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,eSr)),d.toolbar&&this.ci.push(this.toolbar=(o=this.toolbar)!==null&&o!==void 0?o: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((p=>{p.initialize&&f.push((()=>{p.initialize==null||p.initialize()}))})),f.push((()=>{if(this.Ii){var p=this.Ii;this.Ii=void 0,this.ft(p)}})),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){Qt.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&&Qt.info("PostHog extensions initialized ("+a+"ms)")}ft(t){var n;if(!Ut||!Ut.body)return Qt.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=Gr(t.supportedCompression,jg.GZipJS)?jg.GZipJS:Gr(t.supportedCompression,jg.Base64)?jg.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){Qt.critical("`loaded` function failed",r)}if(this.Oi(),this.config.internal_or_test_user_hostname&&ml!=null&&ml.hostname){var t=ml.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 b1t(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()&&ab(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&&(T1t?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=I3(t.url,{ip:this.config.ip?1:0}),t.headers=Dt({},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=Dt({},n);i.timeout=i.timeout||6e4,i.url=I3(i.url,{_:new Date().getTime().toString(),ver:sf.JS_SDK_VERSION,compression:i.compression});var o=(r=i.transport)!==null&&r!==void 0?r:"fetch",c=n$.filter((d=>!i.disableTransport||!d.transport||!i.disableTransport.includes(d.transport))),u=(a=(s=r1t(c,(d=>d.transport===o)))==null?void 0:s.method)!==null&&a!==void 0?a:c[0].method;if(!u)throw new Error("No available transport method");u(i)})(Dt({},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){aee++;try{var n,r=[],a=[],s=[];ab(t,(o=>{o&&(n=o[0],Ta(n)?s.push(o):Pg(o)?o.call(this):Ta(o)&&n==="alias"?r.push(o):Ta(o)&&n.indexOf("capture")!==-1&&Pg(this[n])?s.push(o):a.push(o))}));var i=function(o,c){ab(o,(function(u){if(Ta(u[0])){var d=c;Ns(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{aee--}}push(t){if(aee>0&&Ta(t)&&ao(t[0])){var n=zh.prototype[t[0]];Pg(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(!Vt(t)&&ao(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&&!ao(n?.$current_url)&&(Qt.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||Qt.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 o=new Date,c=r?.timestamp||o,u=qy(),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,p=t!=="$groupidentify",h=this.Li(r?.$set_once,p);if(h&&(d.$set_once=h),(d=Bwr(d,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=c,Vt(r?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=o),t===Oj.DISMISSED||t===Oj.SENT){var m=n?.[JJ.SURVEY_ID],g=n?.[JJ.SURVEY_ITERATION];f={id:m,current_iteration:g},localStorage.getItem(bze(f))||localStorage.setItem(bze(f),"true"),d.$set=Dt({},d.$set,{[ESr({id:m,current_iteration:g},t===Oj.SENT?"responded":"dismissed")]:!0})}else t===Oj.SHOWN&&(d.$set=Dt({},d.$set,{[JJ.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===cSr.SHOWN){var v=n?.[cze.TOUR_TYPE];v&&(d.$set=Dt({},d.$set,{[cze.TOUR_LAST_SEEN_DATE+"/"+v]:new Date().toISOString()}))}var b=Dt({},d.properties.$set,d.$set);if(K1(b)||this.setPersonPropertiesForFlags(b),!aa(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}Qt.critical("This capture call is ignored due to client rate limiting.")}}else Qt.error("No event name provided to posthog.capture")}else Qt.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),o=Dt({},n);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),t==="$snapshot"){var c=Dt({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=c.distinct_id,(!ao(o.distinct_id)&&!wm(o.distinct_id)||Dse(o.distinct_id))&&Qt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,d=oSr(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());o.$session_id=f,o.$window_id=p}this.sessionPropsManager&&zi(o,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&zi(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(h=this.Pi)==null?void 0:h.length}catch(b){o.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===_j.CUSTOM&&(o.$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),o=zi(o,u),t==="$pageview"&&Ut&&(o.title=Ut.title),!Vt(i)){var m=r.getTime()-i;o.$duration=parseFloat((m/1e3).toFixed(3))}Yc&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=zi({},d,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),Ta(this.config.property_denylist)?Ns(this.config.property_denylist,(function(b){delete o[b]})):Qt.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&&(Qt.error("sanitize_properties is deprecated. Use before_send instead"),o=g(o,t));var v=this.Ni();return o.$process_person_profile=v,v&&!s&&this.Ui("_calculate_event_properties"),o}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=zi({},a,s||{},t||{}),o=this.config.sanitize_properties;return o&&(Qt.error("sanitize_properties is deprecated. Use before_send instead"),i=o(i,"$set_once")),n&&(this.fi=!0),K1(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=jSr),(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 Qt.uninitializedWarning("posthog.identify");if(wm(t)&&(t=t.toString(),Qt.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()))Qt.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!==$C){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(bj)&&(this.unregister(bj),this.register({distinct_id:t}));var i,o=(this.persistence.get_property(Ch)||"anonymous")==="anonymous";t!==a&&o?(this.persistence.set_property(Ch,"identified"),this.setPersonPropertiesForFlags(Dt({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:r||{}}),this.yi=vze(t,n,r),(i=this.featureFlags)==null||i.setAnonymousDistinctId(a)):(n||r)&&this.setPersonProperties(n,r),t!==a&&(this.reloadFeatureFlags(),this.unregister(iT))}}else Qt.critical('The string "'+$C+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Qt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this.Ui("posthog.setPersonProperties")){var r=vze(this.get_distinct_id(),t,n);this.yi!==r?(this.setPersonPropertiesForFlags(Dt({},n||{},t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.yi=r):Qt.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:Dt({},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 Qt.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,o,c;if(Qt.info("reset"),!this.__loaded)return Qt.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(),(o=this.persistence)==null||o.set_property(Ch,"anonymous"),(c=this.sessionManager)==null||c.resetSessionId(),this.yi=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:$C,$device_id:null},"");else{var d=this.config.get_device_id(qy());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(s1t)?(Qt.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ui("posthog.alias")?(Vt(n)&&(n=this.get_distinct_id()),t!==n?(this.zi(bj,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Qt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=Dt({},this.config);if(Co(t)){var r,a,s,i,o,c,u,d,f;zi(this.config,wze(t));var p=this.xi();(r=this.persistence)==null||r.update_config(this.config,n,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new XJ(Dt({},this.config,{persistence:"sessionStorage"}),p);var h=this.wi(this.config.debug);Vg(h)&&(this.config.debug=h),Vg(this.config.debug)&&(this.config.debug?(sf.DEBUG=!0,di.F()&&di.L("ph_debug",!0),Qt.info("set_config",{config:t,oldConfig:n,newConfig:Dt({},this.config)})):(sf.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(),(o=this.heatmaps)==null||o.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){sf.LIB_NAME=t,sf.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,o,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&&((o=this.sessionRecording)==null||o.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(Dt({},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:I1;return n!==I1&&(n=I1+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Ch))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(Ch))==="identified"}Ni(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&K1(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[bj])&&((n=this.persistence)==null||(n=n.props)==null||!n[E3]))}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"?(Qt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.zi(E3,!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,o;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=new gze(this),this.pageViewManager=new oze(this),this.persistence&&(this.sessionPropsManager=new mze(this,this.sessionManager,this.persistence));var c=(s=(i=this.config.__extensionClasses)==null?void 0:i.sessionRecording)!==null&&s!==void 0?s:(o=zh.__defaultExtensionClasses)==null?void 0:o.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()),(Vt(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 Qt.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:$C,$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())):Qt.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===wg.GRANTED?"granted":t===wg.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 fd?_1t(fd,this.config.custom_blocked_useragents):void 0}Fi(){Ut&&(Ut.visibilityState==="visible"?this.gi||(this.gi=!0,this.capture("$pageview",{title:Ut.title},{send_instantly:!0}),this.mi&&(Ut.removeEventListener("visibilitychange",this.mi),this.mi=null)):this.mi||(this.mi=this.Fi.bind(this),eo(Ut,"visibilitychange",this.mi)))}debug(t){t===!1?(Ye?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Ye?.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,o,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?(Qt.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=Qt,i=(n="advanced_disable_flags")in(t=c)&&!aa(t[n]),o=r in t&&!aa(t[r]),i?t[n]:o?(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(aa(this.config.before_send))return t;var n=Ta(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var a of n){if(r=a(r),aa(r)){var s="Event '"+t.event+"' was rejected in beforeSend function";return awr(t.event)?Qt.warn(s+". This can cause unexpected behavior."):Qt.info(s),null}r.properties&&!K1(r.properties)||Qt.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=Vg(t)&&!t,r=di.F()&&di.A("ph_debug")==="true";return!n&&(!!r||t)}}zh.__defaultExtensionClasses={},(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=zwr(e.prototype[t[n]])})(zh,["identify"]);function Sze(e){return e instanceof Element&&(e.id===l1t||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function g8(e){return!!e&&e.nodeType===1}function sb(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function N1t(e){return!!e&&e.nodeType===3}function A1t(e){return!!e&&e.nodeType===11}function ove(e){return e?h8(e).split(/\s+/):[]}function Oze(e){var t=Ye?.location.href;return!!(t&&e&&e.some((n=>t.match(n))))}function P3(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 ove(t)}function I1t(e){return aa(e)?null:h8(e).split(/(\s+)/).filter((t=>CA(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function $R(e){var t="";return rie(e)&&!D1t(e)&&e.childNodes&&e.childNodes.length&&Ns(e.childNodes,(function(n){var r;N1t(n)&&n.textContent&&(t+=(r=I1t(n.textContent))!==null&&r!==void 0?r:"")})),h8(t)}function kze(e){return Vt(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var lve=["a","button","form","input","select","textarea","label"];function R1t(e,t){if(Vt(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 P1t(e){var t=e.parentNode;return!(!t||!g8(t))&&t}var RSr=["next","previous","prev",">","<"],_ze=10,Eze=[".ph-no-rageclick",".ph-no-capture"];function PSr(e,t){if(!Ye||cve(e))return!1;var n,r,a;if(Vg(t)?(n=!!t&&Eze,r=void 0):(n=(a=t?.css_selector_ignorelist)!==null&&a!==void 0?a:Eze,r=t?.content_ignorelist),n===!1)return!1;var{targetElementList:s}=M1t(e,!1);return!(function(i,o){if(i===!1||Vt(i))return!1;var c;if(i===!0)c=RSr;else{if(!Ta(i))return!1;if(i.length>_ze)return Qt.error("[PostHog] content_ignorelist array cannot exceed "+_ze+" items. Use css_selector_ignorelist for more complex matching."),!1;c=i.map((u=>u.toLowerCase()))}return o.some((u=>{var{safeText:d,ariaLabel:f}=u;return c.some((p=>d.includes(p)||f.includes(p)))}))})(r,s.map((i=>{var o;return{safeText:$R(i).toLowerCase(),ariaLabel:((o=i.getAttribute("aria-label"))==null?void 0:o.toLowerCase().trim())||""}})))&&!R1t(s,n)}var cve=e=>!e||sb(e,"html")||!g8(e),M1t=(e,t)=>{if(!Ye||cve(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],a=e;a.parentNode&&!sb(a,"body");)if(A1t(a.parentNode))r.push(a.parentNode.host),a=a.parentNode.host;else{var s=P1t(a);if(!s)break;if(t||lve.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var i=Ye.getComputedStyle(s);i&&i.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(s),a=s}return{parentIsUsefulElement:n,targetElementList:r}};function MSr(e,t,n,r,a){var s,i,o,c;if(n===void 0&&(n=void 0),!Ye||cve(e)||(s=n)!=null&&s.url_allowlist&&!Oze(n.url_allowlist)||(i=n)!=null&&i.url_ignorelist&&Oze(n.url_ignorelist))return!1;if((o=n)!=null&&o.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some((m=>t.type===m)))return!1}var{parentIsUsefulElement:d,targetElementList:f}=M1t(e,r);if(!(function(m,g){var v=g?.element_allowlist;if(Vt(v))return!0;var b,w=function(k){if(v.some((_=>k.tagName.toLowerCase()===_)))return{v:!0}};for(var O of m)if(b=w(O))return b.v;return!1})(f,n)||!R1t(f,(c=n)==null?void 0:c.css_selector_allowlist))return!1;var p=Ye.getComputedStyle(e);if(p&&p.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var h=e.tagName.toLowerCase();switch(h){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&&(lve.indexOf(h)>-1||e.getAttribute("contenteditable")==="true")}}function rie(e){for(var t=e;t.parentNode&&!sb(t,"body");t=t.parentNode){var n=P3(t);if(Gr(n,"ph-sensitive")||Gr(n,"ph-no-capture"))return!1}if(Gr(P3(e),"ph-include"))return!0;var r=e.type||"";if(ao(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var a=e.name||e.id||"";return!(ao(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 D1t(e){return!!(sb(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||sb(e,"select")||sb(e,"textarea")||e.getAttribute("contenteditable")==="true")}var $1t="(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})",DSr=new RegExp("^(?:"+$1t+")$"),$Sr=new RegExp($1t),L1t="\\d{3}-?\\d{2}-?\\d{4}",LSr=new RegExp("^("+L1t+")$"),FSr=new RegExp("("+L1t+")");function CA(e,t){return t===void 0&&(t=!0),!(aa(e)||ao(e)&&(e=h8(e),(t?DSr:$Sr).test((e||"").replace(/[- ]/g,""))||(t?LSr:FSr).test(e)))}function F1t(e){var t=$R(e);return CA(t=(t+" "+z1t(e)).trim())?t:""}function z1t(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Ns(e.childNodes,(function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var a=$R(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+z1t(n)).trim())}catch(s){Qt.error("[AutoCapture]",s)}})),t}function zSr(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 o of(r.attr_class.sort(),r.attr_class))i+="."+o.replace(/"/g,"");var c=Dt({},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 t$(c).sort(((d,f)=>{var[p]=d,[h]=f;return p.localeCompare(h)})).forEach((d=>{var[f,p]=d;return u[Cze(f.toString())]=Cze(p.toString())})),i+=":",i+=t$(u).map((d=>{var[f,p]=d;return f+'="'+p+'"'})).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:BSr(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return t$(n).filter((i=>{var[o]=i;return o.indexOf("attr__")===0})).forEach((i=>{var[o,c]=i;return s.attributes[o]=c})),s}))})(e))}function Cze(e){return e.replace(/"|\\"/g,'\\"')}function BSr(e){var t=e.attr__class;return t?Ta(t)?t:ove(t):void 0}class jze{constructor(t){this.disabled=t===!1;var n=Co(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 see="$copy_autocapture",Tze=gi("[AutoCapture]");function iee(e,t){return t.length>e?t.slice(0,e)+"...":t}function USr(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!g8(t));return t}function qSr(e,t,n,r){var a=e.tagName.toLowerCase(),s={tag_name:a};lve.indexOf(a)>-1&&!n&&(a.toLowerCase()==="a"||a.toLowerCase()==="button"?s.$el_text=iee(1024,F1t(e)):s.$el_text=iee(1024,$R(e)));var i=P3(e);i.length>0&&(s.classes=i.filter((function(d){return d!==""}))),Ns(e.attributes,(function(d){var f;if((!D1t(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(r==null||!r.includes(d.name))&&!t&&CA(d.value)&&(f=d.name,!ao(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var p=d.value;d.name==="class"&&(p=ove(p).join(" ")),s["attr__"+d.name]=iee(1024,p)}}));for(var o=1,c=1,u=e;u=USr(u);)o++,u.tagName===e.tagName&&c++;return s.nth_child=o,s.nth_of_type=c,s}function VSr(e,t){for(var n,r,{e:a,maskAllElementAttributes:s,maskAllText:i,elementAttributeIgnoreList:o,elementsChainAsString:c}=t,u=[e],d=e;d.parentNode&&!sb(d,"body");)A1t(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var f,p=[],h={},m=!1,g=!1;if(Ns(u,(k=>{var _=rie(k);k.tagName.toLowerCase()==="a"&&(m=k.getAttribute("href"),m=_&&m&&CA(m)&&m),Gr(P3(k),"ph-no-capture")&&(g=!0),p.push(qSr(k,s,i,o));var C=(function(T){if(!rie(T))return{};var j={};return Ns(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&&CA(P)&&(j[I]=P)}})),j})(k);zi(h,C)})),g)return{props:{},explicitNoCapture:g};if(i||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?p[0].$el_text=F1t(e):p[0].$el_text=$R(e)),m){var v,b;p[0].attr__href=m;var w=(v=j3(m))==null?void 0:v.host,O=Ye==null||(b=Ye.location)==null?void 0:b.host;w&&O&&w!==O&&(f=m)}return{props:zi({$event_type:a.type,$ce_version:1},c?{}:{$elements:p},{$elements_chain:zSr(p)},(n=p[0])!=null&&n.$el_text?{$el_text:(r=p[0])==null?void 0:r.$el_text}:{},f&&a.type==="click"?{$external_click_url:f}:{},h)}}var qC=gi("[ExceptionAutocapture]");function Nze(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],a=n(r);return Pg(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=a,()=>{e[t]=r}}catch{return()=>{}}}var HSr=gi("[TracingHeaders]"),vy=gi("[Web Vitals]"),Aze=9e5,Ize="disabled",Rze="lazy_loading",VC="awaiting_config",s2="missing_config";gi("[SessionRecording]");var aie="[SessionRecording]",Bx=gi(aie),QSr=gi("[Heatmaps]");function Pze(e){return Co(e)&&"clientX"in e&&"clientY"in e&&wm(e.clientX)&&wm(e.clientY)}var Mze=gi("[Product Tours]"),oee="ph_product_tours",WSr=["$set_once","$set"],yy=gi("[SiteApps]");function g1(e,t,n){if(aa(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 GSr{constructor(t){this.Bi=new ive,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(!Vt((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(!Vt((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((i=>{var o,c;(o=this.Ki)==null||o.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 o;(o=i.steps)==null||o.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"||!g1(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((o=>g1(o.href,n.href,n.href_matching||"exact")));var s,i=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!i&&g1((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=>g1(u.text,n.text,n.text_matching||"exact")||g1(u.$el_text,n.text,n.text_matching||"exact")));var s,i,o,c=(t==null||(r=t.properties)==null?void 0:r.$elements_chain)||"";return!!c&&(s=(function(u){for(var d,f=[],p=/(?::|")text="(.*?)"/g;!aa(d=p.exec(u));)f.includes(d[1])||f.push(d[1]);return f})(c),i=n.text,o=n.text_matching||"exact",s.some((u=>g1(u,i,o))))}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||C1t(n.properties.reduce(((r,a)=>{var s=Ta(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 ZSr{constructor(t){this._instance=t,this.re=new Map,this.se=new Map,this.ne=new Map}oe(t,n){return!!t&&C1t(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 o=r.get(i.name)||[];o.push(a.id),r.set(i.name,o)}}))})),r}le(t,n,r){var a=(r===FC.Activation?this.re:this.se).get(t),s=[];return this.ue((i=>{s=i.filter((o=>a?.includes(o.id)))})),s.filter((i=>{var o,c=(o=i.conditions)==null||(o=o[r])==null||(o=o.values)==null?void 0:o.find((u=>u.name===t));return this.oe(c,n)}))}register(t){var n;Vt((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 GSr(this._instance),this.ve.init(),this.ve.Qi((r=>{this.onAction(r)}))),n.forEach((r=>{var a,s,i,o,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&&((o=this.ve)==null||o.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,o;return((i=s.conditions)==null?void 0:i.events)&&((o=s.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0})),a=t.filter((s=>{var i,o;return((i=s.conditions)==null?void 0:i.cancelEvents)&&((o=s.conditions)==null||(o=o.cancelEvents)==null||(o=o.values)==null?void 0:o.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,FC.Activation),this.se=this.ae(t,FC.Cancellation))}onEvent(t,n){var r,a=this.ce(),s=this.fe(),i=this.pe(),o=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[s])||[];if(i===t&&n&&o.length>0){var c,u;a.info("event matched, removing item from activated items",{event:t,eventPayload:n,existingActivatedItems:o});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=o.indexOf(d);f>=0&&(o.splice(f,1),this._e(o))}}else{if(this.se.has(t)){var p=this.le(t,n,FC.Cancellation);p.length>0&&(a.info("cancel event matched, cancelling items",{event:t,itemsToCancel:p.map((m=>m.id))}),p.forEach((m=>{var g=o.indexOf(m.id);g>=0&&o.splice(g,1),this.ge(m.id)})),this._e(o))}if(this.re.has(t)){a.info("event name matched",{event:t,eventPayload:n,items:this.re.get(t)});var h=this.le(t,n,FC.Activation);this._e(o.concat(h.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 YSr extends ZSr{constructor(t){super(t)}fe(){return"$surveys_activated"}pe(){return Oj.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 ms}me(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var XSr=Ye!=null&&Ye.location?N3(Ye.location.hash,"__posthog")||N3(location.hash,"state"):null,Dze="_postHogToolbarParams",$ze=gi("[Toolbar]"),Sy=(function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e})(Sy||{}),Wc=gi("[FeatureFlags]"),HC=gi("[FeatureFlags]",{debugEnabled:!0}),KSr="errors_while_computing_flags",JSr="flag_missing",e1r="quota_limited",t1r="timeout",n1r="connection_error",r1r="unknown_error",a1r=e=>"api_error_"+e,lee="$active_feature_flags",v1="$override_feature_flags",Lze="$feature_flag_payloads",QC="$override_feature_flag_payloads",Fze="$feature_flag_request_id",zze=e=>{var t={};for(var[n,r]of t$(e||{}))r&&(t[n]=r);return t},s1r=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]})))):Wc.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e},i1r=(function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e})({}),cee=gi("[Error tracking]"),o1r={icontains:(e,t)=>!!Ye&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!Ye&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!Ye&&R3(t.href,e),not_regex:(e,t)=>!!Ye&&!R3(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Tl{constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments((a=>{Tl.ye("retrieved web experiments from the server"),n.we=new Map,a.forEach((s=>{if(s.feature_flag_key){var i;n.we&&(Tl.ye("setting flag key ",s.feature_flag_key," to web experiment ",s),(i=n.we)==null||i.set(s.feature_flag_key,s));var o=n._instance.getFeatureFlag(s.feature_flag_key);ao(o)&&s.variants[o]&&n.Ee(s.name,o,s.variants[o].transforms)}else if(s.variants)for(var c in s.variants){var u=s.variants[c];Tl.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())Tl.ye("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(aa(this.we))return this.we=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Tl.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=Tl.getWindowLocation();if(t!=null&&t.search){var n=T3(t?.search,"__experiment_id"),r=T3(t?.search,"__experiment_variant");n&&r&&(Tl.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&&(Tl.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!aa(t.conditions)&&Tl.$e(t)&&Tl.ke(t)}static $e(t){var n;if(aa(t.conditions)||aa((n=t.conditions)==null?void 0:n.url))return!0;var r,a,s,i=Tl.getWindowLocation();return!!i&&((r=t.conditions)==null||!r.url||o1r[(a=(s=t.conditions)==null?void 0:s.urlMatchType)!==null&&a!==void 0?a:"icontains"](t.conditions.url,i))}static getWindowLocation(){return Ye?.location}static ke(t){var n;if(aa(t.conditions)||aa((n=t.conditions)==null?void 0:n.utm))return!0;var r=f1t();if(r.utm_source){var a,s,i,o,c,u,d,f,p=(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,h=(i=t.conditions)==null||(i=i.utm)==null||!i.utm_source||((o=t.conditions)==null||(o=o.utm)==null?void 0:o.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 p&&m&&g&&h}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];Qt.info("[WebExperiments] "+t,r)}Ee(t,n,r){this._is_bot()?Tl.ye("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach((a=>{if(a.selector){var s;Tl.ye("applying transform of variant "+n+" for experiment "+t+" ",a);var i=(s=document)==null?void 0:s.querySelectorAll(a.selector);i?.forEach((o=>{var c=o;a.html&&(c.innerHTML=a.html),a.css&&c.setAttribute("style",a.css)}))}})):Tl.ye("Control variants leave the page unmodified.")}_is_bot(){return fd&&this._instance?_1t(fd,this._instance.config.custom_blocked_useragents):void 0}}var nf=gi("[Conversations]"),v8={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,Wc.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||(Wc.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||Wc.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:{},o=Object.keys(r).filter((u=>!!r[u])).reduce(((u,d)=>(u[d]=r[d]||!1,u)),{}),c=Object.keys(i).filter((u=>o[u])).reduce(((u,d)=>(i[d]&&(u[d]=i[d]),u)),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:c})}}updateFlags(e,t,n){var r=n!=null&&n.merge?this.getFlagVariants():{},a=n!=null&&n.merge?this.getFlagPayloads():{},s=Dt({},r,e),i=Dt({},a,t),o={};for(var[c,u]of Object.entries(s)){var d=typeof u=="string";o[c]={key:c,enabled:!!d||!!u,variant:d?u:void 0,reason:void 0,metadata:Vt(i?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:i[c]}}}this.receivedFeatureFlags({flags:o})}get hasLoadedFlags(){return this.Te}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(qse),t=this._instance.get_property(v1),n=this._instance.get_property(QC);if(!n&&!t)return e||{};var r=zi({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var s of a){var i,o,c=r[s],u=t?.[s],d=Vt(u)?(i=c?.enabled)!==null&&i!==void 0&&i:!!u,f=Vt(u)?c.variant:typeof u=="string"?u:void 0,p=n?.[s],h=Dt({},c,{enabled:d,variant:d?f??c?.variant:void 0});d!==c?.enabled&&(h.original_enabled=c?.enabled),f!==c?.variant&&(h.original_variant=c?.variant),p&&(h.metadata=Dt({},c?.metadata,{payload:p,original_payload:c==null||(o=c.metadata)==null?void 0:o.payload})),r[s]=h}return this.Pe||(Wc.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.Pe=!0),r}getFlagVariants(){var e=this._instance.get_property(J1),t=this._instance.get_property(v1);if(!t)return e||{};for(var n=zi({},e),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.Pe||(Wc.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Pe=!0),n}getFlagPayloads(){var e=this._instance.get_property(Lze),t=this._instance.get_property(QC);if(!t)return e||{};for(var n=zi({},e||{}),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.Pe||(Wc.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:Dt({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(Sj)||{}),group_properties:this._instance.get_property(Yx),timezone:y1t()};ah(r)||Vt(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:jg.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:o=>{var c,u,d,f=!0;if(o.statusCode===200&&(this.Ce||(this.$anon_distinct_id=void 0),f=!1),this.Re=!1,!a.disable_flags||this.Ce){this.Oe=!f;var p=[];o.error?o.error instanceof Error?p.push(o.error.name==="AbortError"?t1r:n1r):p.push(r1r):o.statusCode!==200&&p.push(a1r(o.statusCode)),(c=o.json)!=null&&c.errorsWhileComputingFlags&&p.push(KSr);var h=!((u=o.json)==null||(u=u.quotaLimited)==null||!u.includes(i1r.FeatureFlags));if(h&&p.push(e1r),(d=this._instance.persistence)==null||d.register({[Qse]:p}),h)Wc.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=o.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 Wc.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),o=this._instance.get_property(Fze)||void 0,c=this._instance.get_property(k3)||void 0,u=this._instance.get_property(iT)||{};if(this._instance.config.advanced_feature_flags_dedup_per_session){var d,f=this._instance.get_session_id(),p=this._instance.get_property(Hse);f&&f!==p&&(u={},(d=this._instance.persistence)==null||d.register({[iT]:u,[Hse]:f}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(i))){var h,m,g,v,b,w,O,k,_,C;Ta(u[e])?u[e].push(i):u[e]=[i],(h=this._instance.persistence)==null||h.register({[iT]:u});var T=this.getFeatureFlagDetails(e),j=[...(m=this._instance.get_property(Qse))!==null&&m!==void 0?m:[]];Vt(a)&&j.push(JSr);var A={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:s||null,$feature_flag_request_id:o,$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};Vt(T==null||(b=T.metadata)==null?void 0:b.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),Vt(T?.original_variant)&&Vt(T?.original_enabled)||(A.$feature_flag_original_response=Vt(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(!Vt(s))try{M=JSON.parse(s)}catch{}return{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:M}}}}else Wc.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:jg.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 Vt(n)?void 0:!!n}Wc.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,o,c,u){o===void 0&&(o={}),c===void 0&&(c={}),u===void 0&&(u={});var d=s1r(s),f=d.flags,p=d.featureFlags,h=d.featureFlagPayloads;if(p){var m=s.requestId,g=s.evaluatedAt;if(Ta(p)){Wc.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(p)for(var b=0;b<p.length;b++)v[p[b]]=!0;i&&i.register({[lee]:p,[J1]:v})}else{var w=p,O=h,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=Dt({},o,Object.fromEntries(Object.entries(w).filter((C=>{var[T]=C;return _.has(T)})))),O=Dt({},c,Object.fromEntries(Object.entries(O||{}).filter((C=>{var[T]=C;return _.has(T)})))),k=Dt({},u,Object.fromEntries(Object.entries(k||{}).filter((C=>{var[T]=C;return _.has(T)}))))}else w=Dt({},o,w),O=Dt({},c,O),k=Dt({},u,k);i&&i.register(Dt({[lee]:Object.keys(zze(w)),[J1]:w||{},[Lze]:O||{},[qse]:k||{}},m?{[Fze]:m}:{},g?{[k3]:g}:{}))}}})(e,this._instance.persistence,n,r,a),t||(this.Me=!1),this.He(t)}}override(e,t){t===void 0&&(t=!1),Wc.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Wc.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(v1),this._instance.persistence.unregister(QC),this.He(),HC.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(v1),HC.info("Flag overrides cleared");else if(n.flags){if(Ta(n.flags)){for(var r={},a=0;a<n.flags.length;a++)r[n.flags[a]]=!0;this._instance.persistence.register({[v1]:r})}else this._instance.persistence.register({[v1]:n.flags});HC.info("Flag overrides set",{flags:n.flags})}}return"payloads"in n&&(n.payloads===!1?(this._instance.persistence.unregister(QC),HC.info("Payload overrides cleared")):n.payloads&&(this._instance.persistence.register({[QC]:n.payloads}),HC.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(wj)||[]).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 o=Dt({},this.getFlagVariants(),{[e]:t});(r=this._instance.persistence)==null||r.register({[lee]:Object.keys(zze(o)),[J1]:o}),this.He()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(wj),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,o;if(s.json){var c=s.json.earlyAccessFeatures;return(i=this._instance.persistence)==null||i.unregister(wj),(o=this._instance.persistence)==null||o.register({[wj]: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(Sj)||{};this._instance.register({[Sj]:Dt({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Sj)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(Yx)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((r=>{n[r]=Dt({},n[r],e[r]),delete e[r]})),this._instance.register({[Yx]:Dt({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Yx)||{};this._instance.register({[Yx]:Dt({},t,{[e]:{}})})}else this._instance.unregister(Yx)}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}}},l1r={sessionRecording:class{get started(){var e;return!((e=this.qe)==null||!e.isStarted)}get status(){var e,t;return this.Ve===VC||this.Ve===s2?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=Ize,this.We=void 0,this._instance=e,!this._instance.sessionManager)throw Bx.error("started without valid sessionManager"),new Error(aie+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(aie+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ge(){var e,t=!((e=this._instance.get_property(e2))==null||!e.enabled),n=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return Ye&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!this.Ge||(t=this.qe)==null||!t.isStarted){var n=!Vt(Object.assign)&&!Vt(Array.from);this.Ge&&n?(this.Ye(e),Bx.info("starting")):(this.Ve=Ize,this.stopRecording())}}Ye(e){var t,n,r;this.Ge&&(this.Ve!==VC&&this.Ve!==s2&&(this.Ve=Rze),Ln!=null&&(t=Ln.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Ln.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Je(e):(r=Ln.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Ke,(a=>{if(a)return Bx.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(o1t)}Ze(e,t){if(aa(e))return null;var n,r=wm(e)?e:parseFloat(e);return typeof(n=r)=="number"&&Number.isFinite(n)&&n>=0&&n<=1?r:(Bx.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,o=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=o??c;aa(u)&&this.Qe();var d=i?.minimumDurationMilliseconds;r.register({[e2]:Dt({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:Dt({capturePerformance:e.capturePerformance},i?.networkPayloadCapture),canvasRecording:{enabled:i?.recordCanvas,fps:i?.canvasFps,quality:i?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:Vt(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===VC&&(this.Ve=s2,Bx.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):Bx.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(e2);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}ir(){var e,t=this._instance.get_property(e2);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=Ln.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");if(this.qe||(this.qe=(n=Ln.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.qe._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ir())return this.Ve===s2||this.Ve===VC?void 0:(this.Ve=VC,Bx.info("persisted remote config is stale, requesting fresh config before starting"),void new b1t(this._instance).load());this.Ve=Rze,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))}}},c1r={autocapture:class{constructor(e){this.er=!1,this.rr=null,this.sr=!1,this.instance=e,this.rageclicks=new jze(e.config.rageclick),this.nr=null}initialize(){this.startIfEnabled()}get N(){var e,t,n=Co(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(Ye&&Ut){var e=n=>{n=n||Ye?.event;try{this.lr(n)}catch(r){Tze.error("Failed to capture event",r)}};if(eo(Ut,"submit",e,{capture:!0}),eo(Ut,"change",e,{capture:!0}),eo(Ut,"click",e,{capture:!0}),this.N.capture_copied_text){var t=n=>{n=n||Ye?.event,this.lr(n,see)};eo(Ut,"copy",t,{capture:!0}),eo(Ut,"cut",t,{capture:!0})}}}else Tze.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({[KFe]:!!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=Ut?.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[KFe],r=this.rr;if(ah(r)&&!Vg(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=kze(e);N1t(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())&&PSr(r,this.instance.config.rageclick)&&this.lr(e,"$rageclick");var a=t===see;if(r&&MSr(r,e,this.N,a,a?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:i}=VSr(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 o=this.getElementSelectors(r);if(o&&o.length>0&&(s.$element_selectors=o),t===see){var c,u=I1t(Ye==null||(c=Ye.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 Pg(Ut?.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.ur=(Ye==null||(t=Ye.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Qt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.hr&&this.hr(),this.hr=void 0,Qt.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(Ye&&Ye.history){var n=this;(e=Ye.history.pushState)!=null&&e.__posthog_wrapped__||Nze(Ye.history,"pushState",(r=>function(a,s,i){r.call(this,a,s,i),n.dr("pushState")})),(t=Ye.history.replaceState)!=null&&t.__posthog_wrapped__||Nze(Ye.history,"replaceState",(r=>function(a,s,i){r.call(this,a,s,i),n.dr("replaceState")})),this.vr()}}dr(e){try{var t,n=Ye==null||(t=Ye.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){Qt.error("Error capturing "+e+" pageview",r)}}vr(){if(!this.hr){var e=()=>{this.dr("popstate")};eo(Ye,"popstate",e),this.hr=()=>{Ye&&Ye.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[Bse]),this.rageclicks=new jze(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Co(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 aa(this.instance.config.capture_heatmaps)?aa(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;QSr.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({[Bse]: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"})(Ut)?setInterval(this.Ft.bind(this),this.flushIntervalMilliseconds):null}_r(){Ye&&Ut&&(this.wr=this.Ft.bind(this),eo(Ye,"beforeunload",this.wr),this.Er=e=>this.yr(e||Ye?.event),eo(Ut,"click",this.Er,{capture:!0}),this.Sr=e=>this.$r(e||Ye?.event),eo(Ut,"mousemove",this.Sr,{capture:!0}),this.kr=new ize(this.instance,Jwr,this.br.bind(this)),this.kr.startIfEnabledOrStop(),this.Pr=this.gr.bind(this),eo(Ut,"visibilitychange",this.Pr),this.er=!0)}mr(){var e;Ye&&Ut&&(this.wr&&Ye.removeEventListener("beforeunload",this.wr),this.Er&&Ut.removeEventListener("click",this.Er,{capture:!0}),this.Sr&&Ut.removeEventListener("mousemove",this.Sr,{capture:!0}),this.Pr&&Ut.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,o,c){for(var u=i;u&&g8(u)&&!sb(u,"body");){if(u===c)return!1;if(Gr(o,Ye?.getComputedStyle(u).position))return!0;u=P1t(u)}return!1})(kze(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"),!Sze(e.target)&&Pze(e)){var r=this.Rr(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Ir(Dt({},r,{type:"rageclick"})),this.Ir(r)}}$r(e){!Sze(e.target)&&Pze(e)&&(clearTimeout(this.Tr),this.Tr=setTimeout((()=>{this.Ir(this.Rr(e,"mousemove"))}),500))}Ir(e){if(Ye){var t=Ye.location.href,n=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,a=n?Zk([],Yk,r||[]):[],s=_A(t,a,EA);this.C=this.C||{},this.C[s]||(this.C[s]=[]),this.C[s].push(e)}}Ft(){this.C&&!K1(this.C)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:ize,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)=>Dt({},n,{["$web_vitals_"+r.name+"_event"]:Dt({},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(Vt(a))vy.error("Could not read session ID. Dropping metrics!");else{this.C=this.C||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.Mr();Vt(s)||(aa(n?.name)||aa(n?.value)?vy.error("Invalid metric received",n):this.Ar&&n.value>=this.Ar?vy.error("Ignoring metric with value >= "+this.Ar,n):(this.C.url!==s&&(this.Cr(),this.Or=setTimeout(this.Cr,this.flushToCaptureTimeoutMs)),Vt(this.C.url)&&(this.C.url=s),this.C.firstMetricTimestamp=Vt(this.C.firstMetricTimestamp)?Date.now():this.C.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.C.metrics.push(Dt({},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=Ln.__PosthogExtensions__;Vt(i)||Vt(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):vy.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.cr=!((t=this._instance.persistence)==null||!t.props[tze]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=Co(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return aa(n)?((t=this._instance.persistence)==null?void 0:t.props[rze])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(Co(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Co(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Ar(){var e=Co(this._instance.config.capture_performance)&&wm(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Aze;return 0<e&&e<=6e4?Aze:e}get isEnabled(){var e=ml?.protocol;if(e!=="http:"&&e!=="https:")return vy.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Co(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Vg(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Vg(t)?t:this.cr}startIfEnabled(){this.isEnabled&&!this.er&&(vy.info("enabled, starting..."),this.G(this.Dr))}onRemoteConfig(e){if("capturePerformance"in e){var t=Co(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=Co(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[tze]:t}),this._instance.persistence.register({[rze]:n})),this.cr=t,this.startIfEnabled()}}G(e){var t,n;if((t=Ln.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var r=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(n=Ln.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,r,(a=>{a?vy.error("failed to load script",a):e()}))}}Mr(){var e=Ye?Ye.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?Zk([],Yk,n||[]):[];return _A(e,r,EA)}vy.error("Could not determine current URL")}}},u1r={exceptionObserver:class{constructor(e){var t,n,r;this.Dr=()=>{var a;if(Ye&&this.isEnabled&&(a=Ln.__PosthogExtensions__)!=null&&a.errorWrappingFunctions){var s=Ln.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Ln.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=Ln.__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=o(this.captureException.bind(this)))}catch(c){qC.error("failed to start",c),this.Ur()}}},this._instance=e,this.zr=!((t=this._instance.persistence)==null||!t.props[JFe]),this.Hr=new owr({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:qC}),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 Co(e)?t=Dt({},t,e):(Vt(e)?this.zr:e)&&(t=Dt({},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?(qC.info("enabled"),this.Ur(),this.G(this.Dr)):this.Ur()}G(e){var t,n;(t=Ln.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=Ln.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return qC.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({[JFe]: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)?qC.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 xwr([new Twr,new Lwr,new Awr,new Nwr,new Dwr,new Mwr,new Rwr,new $wr],jwr()),this._instance=e,this.qr=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Use))!==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({[Use]:this.qr,[eze]:s})}}get Wr(){var e,t=!!this._instance.get_property(eze),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 cee.info("Skipping exception capture because a suppression rule matched");if(!this.Wr&&this.Jr(t))return void cee.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Kr(t))return void cee.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 ao(a)&&a.length>0&&n.$exception_types.push(a),ao(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=E1t[a.operator],o=Ta(a.value)?a.value:[a.value],c=(s=t[a.key])!==null&&s!==void 0?s:[];return o.length>0&&i(o,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!aa(e)&&Ta(e)}}},d1r=Dt({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({[nze]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Xr||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(nze)||this.G((()=>this.Zr()))}G(e){var t,n;(t=Ln.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Ln.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(r=>{r?Mze.error("Could not load product tours script",r):e()}))}Zr(){var e;!this.Xr&&(e=Ln.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Xr=Ln.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Ta(this.Qr)||t){var n=this._instance.persistence;if(n){var r=n.props[oee];if(Ta(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 Mze.error(i),void e([],{isLoaded:!1,error:i})}var o=Ta(a.json.product_tours)?a.json.product_tours:[];this.Qr=o,n&&n.register({[oee]:o}),e(o,{isLoaded:!0})}})}else e(this.Qr,{isLoaded:!0})}getActiveProductTours(e){aa(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(oee)}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)}}},v8),f1r={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=Ln._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,o;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,p]of Object.entries(d))c[f]={id:u[f],type:f,properties:p};var{$set_once:h,$set:m}=e;return{event:Dt({},PSt(e,WSr),{properties:Dt({},e.properties,m?{$set:Dt({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},m)}:{},h?{$set_once:Dt({},(r=(a=e.properties)==null?void 0:a.$set_once)!==null&&r!==void 0?r:{},h)}:{}),elements_chain:(s=(i=e.properties)==null?void 0:i.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(o=e.properties)==null?void 0:o.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&&(yy.info("Processing "+this.ts.length+" events for site app with id "+e.id),this.ts.forEach((o=>t.processEvent==null?void 0:t.processEvent(o))),t.processedBuffer=!0),Object.values(this.apps).every((o=>o.processedBuffer||o.errored))&&((i=this.rs)==null||i.call(this))},r=!1,a=i=>{t.errored=!i,t.loaded=!0,yy.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){yy.error("Error while initializing PostHog app with config id "+e.id,i),a(!1)}if(r&&t.loaded)try{n()}catch(i){yy.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){yy.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 yy.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;Ln["__$$ph_site_app_"+c]=a._instance,(u=Ln.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(a._instance,o,(d=>{if(d)return yy.error("Error while initializing PostHog app with config id "+c,d)}))};for(var{id:i,url:o}of e.siteApps)s(i)}else yy.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},p1r={tracingHeaders:class{constructor(e){this.os=void 0,this.ls=void 0,this.Dr=()=>{var t,n;Vt(this.os)&&((t=Ln.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Vt(this.ls)&&((n=Ln.__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=Ln.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=Ln.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return HSr.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)}}},h1r=Dt({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(aa(t))return ms.warn("Flags not loaded yet. Not loading surveys.");var n=Ta(t);this.us=n?t.length>0:t,ms.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(j1t)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach((r=>localStorage.removeItem(r)))}loadIfEnabled(){if(!this._surveyManager)if(this.hs)ms.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)ms.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())ms.info("Not loading surveys in cookieless mode without consent.");else{var e=Ln?.__PosthogExtensions__;if(e){if(!Vt(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 ms.error("PostHog Extensions not found.")}}cs(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new YSr(this._instance),ms.info("Surveys loaded successfully"),this.ps({isLoaded:!0})}fs(e,t){ms.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 ms.info("Disabled. Not loading surveys."),e([]);var n,r=this._instance.get_property(Vse);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 o="Surveys API could not be loaded, status: "+i;ms.error(o);var c={isLoaded:!1,error:o};return e([],c),void(n==null||n({surveys:[],context:c}))}var u,d=a.json.surveys||[],f=d.filter((h=>(function(m){return!(!m.start_date||m.end_date)})(h)&&((function(m){var g;return!((g=m.conditions)==null||(g=g.events)==null||(g=g.values)==null||!g.length)})(h)||(function(m){var g;return!((g=m.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(h))));f.length>0&&((u=this._surveyEventReceiver)==null||u.register(f)),(s=this._instance.persistence)==null||s.register({[Vse]:d});var p={isLoaded:!0};e(d,p),n?.({surveys:d,context:p})}}))}ps(e){for(var t of this.ds)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){ms.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!aa(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);ms.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(aa(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(aa(this._surveyManager))return ms.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 aa(this._surveyManager)?(ms.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((o=>o.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(aa(this._surveyManager))ms.warn("init was not called");else{var a=typeof e=="string"?this._s(e):e;if(a!=null&&a.id)if(CSr.includes(a.type)){var s=Ut?.querySelector(t);if(s)return(r=a.appearance)!=null&&r.surveyPopupDelaySeconds?(ms.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var i,o;ms.info("Rendering survey "+a.id+" with delay of "+((i=a.appearance)==null?void 0:i.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(a,s,n),ms.info("Survey "+a.id+" rendered")}),1e3*a.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(a,s,n);ms.warn("Survey element not found")}else ms.warn("Surveys of type "+a.type+" cannot be rendered in the app");else ms.warn("Survey not found")}}displaySurvey(e,t){var n;if(aa(this._surveyManager))ms.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=Dt({},r,{appearance:Dt({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Xse.Popover&&t.initialResponses&&ms.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 ms.warn("Survey is not eligible to be displayed: ",s.disabledReason)}t.displayType!==Xse.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}else ms.warn("Survey not found")}}cancelPendingSurvey(e){aa(this._surveyManager)?ms.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},v8),m1r={toolbar:class{constructor(e){this.instance=e}bs(e){Ln.ph_toolbar_state=e}ys(){var e;return(e=Ln.ph_toolbar_state)!==null&&e!==void 0?e:Sy.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),a1t(this.instance.config)||!Ye||!Ut)return!1;e=e??Ye.location,n=n??Ye.history;try{if(!t){try{Ye.localStorage.setItem("test","test"),Ye.localStorage.removeItem("test")}catch{return!1}t=Ye?.localStorage}var r,a=XSr||N3(e.hash,"__posthog")||N3(e.hash,"state"),s=a?XFe((()=>JSON.parse(atob(decodeURIComponent(a)))))||XFe((()=>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(Dze)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch{return!1}}ws(e){var t=Ln.ph_load_toolbar||Ln.ph_load_editor;!aa(t)&&Pg(t)?t(e,this.instance):$ze.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ut==null||!Ut.getElementById(l1t));if(!Ye||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=Dt({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(Ye.localStorage.setItem(Dze,JSON.stringify(Dt({},r,{source:void 0}))),this.ys()===Sy.LOADED)this.ws(r);else if(this.ys()===Sy.UNINITIALIZED){var a;this.bs(Sy.LOADING),(a=Ln.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(s=>{if(s)return $ze.error("[Toolbar] Failed to load",s),void this.bs(Sy.UNINITIALIZED);this.bs(Sy.LOADED),this.ws(r)})),eo(Ye,"turbolinks:load",(()=>{this.bs(Sy.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)}}},g1r=Dt({experiments:Tl},v8),v1r={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;aa(t)||(Vg(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||a1t(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Ln?.__PosthogExtensions__;if(e&&!Vt(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 nf.error("Conversations enabled but missing token in remote config.")}}ks(e){if(this.$s)try{this._conversationsManager=e(this.$s,this._instance),nf.info("Conversations loaded successfully")}catch(t){this.Ps("Error completing conversations initialization",t)}else nf.error("Cannot complete initialization: remote config is null")}Ps(e,t){nf.error(e,t),this._conversationsManager=null,this.xs=!1}show(){this._conversationsManager?this._conversationsManager.show():nf.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ss===!0&&!ah(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 xg((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(nf.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var n=this;return xg((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(nf.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return xg((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(nf.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return xg((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(nf.warn("Conversations not available yet."),null)}))()}requestRestoreLink(e){var t=this;return xg((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(nf.warn("Conversations not available yet."),null)}))()}restoreFromToken(e){var t=this;return xg((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(nf.warn("Conversations not available yet."),null)}))()}restoreFromUrlToken(){var e=this;return xg((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(nf.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}}},y1r={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;!aa(n)&&n&&(this.Ts=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Ts&&!this.Rs){var e=gi("[logs]"),t=Ln?.__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.")}}}},b1r=Dt({},v8,l1r,c1r,u1r,d1r,f1r,h1r,p1r,m1r,g1r,v1r,y1r);zh.__defaultExtensionClasses=Dt({},b1r);var Bze,Tg=(Bze=lT[I1]=new zh,(function(){function e(){e.done||(e.done=!0,T1t=!1,Ns(lT,(function(t){t._dom_loaded()})))}Ut!=null&&Ut.addEventListener?Ut.readyState==="complete"?e():eo(Ut,"DOMContentLoaded",e,{capture:!1}):Ye&&Qt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),Bze),B1t=x.createContext({client:Tg,bootstrap:void 0});function U1t(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 o=i[s];if(!a.includes(o)||!U1t(e[o],t[o],n))return!1}return!0}function x1r(e){var t,n,r=e.children,a=e.client,s=e.apiKey,i=e.options,o=x.useRef(null),c=x.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."),Tg)},[a,s,JSON.stringify(i)]);return x.useEffect(function(){if(!a){var u=o.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&&!U1t(i,u.options)&&Tg.set_config(i),o.current={apiKey:s,options:i??{}}):(Tg.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),Tg.init(s,i),o.current={apiKey:s,options:i??{}})}},[a,s,JSON.stringify(i)]),Ce.createElement(B1t.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 uee=function(e){return typeof e=="function"},sie=function(e,t){return sie=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])},sie(e,t)};function w1r(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");sie(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var S1r={componentStack:null,exceptionEvent:null,error:null},O1r={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){w1r(t,e);function t(n){var r=e.call(this,n)||this;return r.state=S1r,r}return t.prototype.componentDidCatch=function(n,r){var a=this.props.additionalProperties,s;uee(a)?s=a(n):typeof a=="object"&&(s=a);var i=this.context.client,o=i.captureException(n,s),c=r.componentStack;this.setState({error:n,componentStack:c??null,exceptionEvent:o})},t.prototype.render=function(){var n=this.props,r=n.children,a=n.fallback,s=this.state;if(s.componentStack==null)return uee(r)?r():r;var i=uee(a)?Ce.createElement(a,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent}):a;return Ce.isValidElement(i)?i:(console.warn(O1r.INVALID_FALLBACK),Ce.createElement(Ce.Fragment,null))},t.contextType=B1t,t})(Ce.Component);function k1r({children:e}){return x.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}Tg.init("phc_SBLpZVAB6jmHOct9CABq3PF0Yn5FU3G2FgT4xUr2XrT",{api_host:"https://us.posthog.com"}),Tg.register({mastraSource:"playground"})},[]),l.jsx(x1r,{client:Tg,children:e})}const _1r=["/swagger-ui","/openapi.json"],q1t=x.forwardRef(({children:e,href:t,...n},r)=>t&&_1r.some(s=>t.startsWith(s))?l.jsx("a",{ref:r,href:t,...n,children:e}):l.jsx(Wt,{ref:r,to:t,viewTransition:!0,...n,children:e}));function E1r(){const{data:e={},isLoading:t,error:n}=nh(),[r,a]=x.useState(""),{canCreateAgent:s}=axt(),{Link:i,paths:o}=en(),c=o.cmsAgentCreateLink(),u=s&&!!c;return l.jsxs(za,{children:[l.jsxs(za.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:t,children:[l.jsx(Ys,{})," Agents"]})}),l.jsxs(dt.Column,{className:"flex justify-end gap-2",children:[u&&l.jsx(Vs,{as:i,to:c,tooltipContent:"Create an agent",children:l.jsx(LQe,{})}),l.jsx(Vs,{as:"a",href:"https://mastra.ai/en/docs/agents/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Agents documentation",children:l.jsx(ql,{})})]})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(Jb,{onSearch:a,label:"Filter agents",placeholder:"Filter by name or instructions"})})]}),l.jsx(Xfr,{agents:e,isLoading:t,error:n,search:r})]})}function C1r({agentId:e,threadId:t,threads:n,isLoading:r}){const{mutateAsync:a}=xir(),{paths:s,navigate:i}=en(),o=async c=>{await a({threadId:c,agentId:e}),c===t&&i(s.agentNewThreadLink(e))};return l.jsx(klr,{resourceId:e,resourceType:"agent",threads:n||[],isLoading:r,threadId:t,onDelete:o})}function Uze(){const{agentId:e,threadId:t}=ps(),[n]=Wi(),{data:r,isLoading:a,error:s}=Dd(e),{data:i}=Z_(e),o=Dc(),c=t==="new",u=x.useMemo(()=>qi(),[t]),d=!!i?.result,{data:f,isLoading:p,refetch:h}=nxt({agentId:e,isMemoryEnabled:d,resourceId:e});x.useEffect(()=>{t||o(`/agents/${e}/chat/new`)},[t,e,o]);const m=n.get("messageId")??void 0,g=x.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&&Ja(s))return l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"agents"})});if(a)return null;if(!r)return l.jsx("div",{className:"text-center py-4",children:"Agent not found"});if(!t)return null;const v=c?u:t,b=async()=>{await h(),c&&o(`/agents/${e}/chat/${u}`)};return l.jsx(ege,{entityId:e,entityType:"agent",children:l.jsx(Bme,{agentId:e,defaultSettings:g,children:l.jsx(Wbt,{agentId:e,threadId:v,resourceId:e,children:l.jsx(Ubt,{children:l.jsx(Ybt,{children:l.jsx(Ibt,{children:l.jsx(Glr,{agentId:e,leftSlot:d&&l.jsx(C1r,{agentId:e,threadId:v,threads:f||[],isLoading:p}),rightSlot:l.jsx(Hlr,{agentId:e,threadId:v}),children:l.jsx(dge,{agentId:e,agentName:r?.name,modelVersion:r?.modelVersion,threadId:v,memory:d,refreshThreadList:b,modelList:r?.modelList,messageId:m,isNewThread:c},v)})},`${e}-${v}`)})})})})})}const i2="__custom__",j1r=()=>{const e=jbt(),{requestContext:t,setRequestContext:n}=Fr(),r=x.useMemo(()=>{if(!e)return i2;const s=JSON.stringify(t??{});for(const[i,o]of Object.entries(e))if(JSON.stringify(o)===s)return i;return i2},[e,t]),a=s=>{if(s===i2){n({});return}if(!e)return;const i=e[s];i&&n(i)};return l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(rb,{className:"h-5 w-8 shrink-0"}),"Mastra Studio",l.jsx(jse,{})]}),e&&Object.keys(e).length>0&&l.jsx(Ui,{children:l.jsxs(Qs,{value:r,onValueChange:a,children:[l.jsx(Is,{size:"sm",className:"w-[200px]",children:l.jsx(Ws,{placeholder:"Select a preset..."})}),l.jsxs(Rs,{children:[l.jsx(Xr,{value:i2,children:"Custom"}),Object.keys(e).map(s=>l.jsx(Xr,{value:s,children:s},s))]})]})})]})};function qze(){const{agentId:e,threadId:t}=ps(),[n]=Wi(),{data:r,isLoading:a}=Dd(e),{data:s}=Z_(e),i=Dc(),o=t==="new",c=x.useMemo(()=>qi(),[t]),u=!!s?.result,{refetch:d}=nxt({resourceId:e,agentId:e,isMemoryEnabled:u});x.useEffect(()=>{u&&(t||i(`/agents/${e}/session/new`))},[u,t,e,i]);const f=n.get("messageId")??void 0,p=x.useMemo(()=>{if(!r)return{modelSettings:{}};const g=r.defaultOptions,{maxOutputTokens:v,...b}=g?.modelSettings??{};return{modelSettings:{...b,...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 l.jsx("div",{className:"text-center py-4",children:"Agent not found"});const h=o?c:t??c,m=async()=>{await d(),o&&i(`/agents/${e}/session/${c}`)};return l.jsx(ege,{entityId:e,entityType:"agent",children:l.jsx(Bme,{agentId:e,defaultSettings:p,children:l.jsx(qz,{children:l.jsx(Wbt,{agentId:e,threadId:h,resourceId:e,children:l.jsx(Ubt,{children:l.jsx(Ybt,{children:l.jsx(Ibt,{children:l.jsxs(zn,{children:[l.jsx(j1r,{}),l.jsx("div",{className:"grid overflow-y-auto relative bg-surface1 h-full pt-6",children:l.jsx(dge,{agentId:e,agentName:r?.name,modelVersion:r?.modelVersion,threadId:h,memory:u,refreshThreadList:m,modelList:r?.modelList,messageId:f,isNewThread:o,hideModelSwitcher:!0},h)})]})})})})})})})})}function T1r(){const{agentId:e}=ps(),{navigate:t}=en(),{data:n,isLoading:r,error:a}=Dd(e),{data:s,isLoading:i}=vge(e,{status:"draft"}),o=n?.source==="code",c=r||i,u=x.useMemo(()=>s||(n?Oge(n):{}),[s,n]),{form:d,handlePublish:f,handleSaveDraft:p,isSubmitting:h,isSavingDraft:m}=i8({mode:"edit",agentId:e??"",dataSource:u,isCodeAgentOverride:o,hasStoredOverride:o&&!!s,onSuccess:()=>{}}),[g,v]=x.useState(()=>{const b=sessionStorage.getItem(`pending-scorer-items-${e}`);if(b){sessionStorage.removeItem(`pending-scorer-items-${e}`);try{return JSON.parse(b)}catch{return null}}return null});return a&&Ja(a)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"agents"})}):c?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ft,{className:"h-6 w-6"})}):n?l.jsx(cge,{form:d,mode:"edit",agentId:e,isSubmitting:h,isSavingDraft:m,handlePublish:f,handleSaveDraft:p,isCodeAgentOverride:o,readOnly:!1,children:l.jsx(Cfr,{agentId:e,onSwitchToReview:()=>t(`/agents/${e}/review`),pendingScorerItems:g,onPendingScorerItemsConsumed:()=>v(null)})}):l.jsx("div",{className:"text-center py-4",children:"Agent not found"})}function N1r(){const{agentId:e}=ps(),[t,n]=x.useState(null),{data:r,isLoading:a,error:s}=Dd(e),{data:i,isLoading:o}=vge(e,{status:"draft"}),{data:c}=Z_(e),u=r?.source==="code",d=a||o,f=!!c?.result,{data:p}=zxt({agentId:e??"",versionId:t??""}),{data:h}=pS({agentId:e??"",params:{sortDirection:"DESC"}}),m=i?.activeVersionId,g=h?.versions?.[0],v=!!(g&&g.id!==m),b=!!t&&!!p,w=b&&t!==g?.id,O=x.useMemo(()=>b&&p?p:i||(r?Oge(r):{}),[b,p,i,r]),{form:k,handlePublish:_,handleSaveDraft:C,isSubmitting:T,isSavingDraft:j,isDirty:A}=i8({mode:"edit",agentId:e??"",dataSource:O,isCodeAgentOverride:u,hasStoredOverride:u&&!!i,onSuccess:()=>{}}),I=x.useCallback(P=>{P===g?.id?n(null):n(P)},[g?.id]);return s&&Ja(s)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"agents"})}):d?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ft,{className:"h-6 w-6"})}):r?l.jsx(cge,{form:k,mode:"edit",agentId:e,isSubmitting:T,isSavingDraft:j,handlePublish:_,handleSaveDraft:C,isCodeAgentOverride:u,readOnly:w,children:l.jsx(Tdr,{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:_})}):l.jsx("div",{className:"text-center py-4",children:"Agent not found"})}function A1r(){const{agentId:e}=ps(),{navigate:t}=en(),{data:n,isLoading:r,error:a}=Dd(e);if(a&&Ja(a))return l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"agents"})});if(r)return l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ft,{className:"h-6 w-6"})});if(!n)return l.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 l.jsx(Rfr,{agentId:e,onCreateScorer:s})}function I1r(){const{agentId:e}=ps();return l.jsx(Zfr,{agentId:e})}function R1r(){return l.jsx(vur,{})}function P1r(){const{navigate:e,paths:t}=en(),n=Mc(),{form:r,handlePublish:a,isSubmitting:s,canPublish:i}=i8({mode:"create",onSuccess:o=>e(t.agentLink(o))});return l.jsxs(zn,{children:[l.jsxs(rr,{className:"bg-surface1",children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(Ys,{})}),"Create an agent"]}),l.jsx(Ui,{children:l.jsx(ye,{variant:"primary",onClick:a,disabled:s||!i,className:"w-full",children:s?l.jsxs(l.Fragment,{children:[l.jsx(Ft,{className:"h-4 w-4"}),"Creating..."]}):l.jsxs(l.Fragment,{children:[l.jsx(_e,{children:l.jsx(IQe,{})}),"Create agent"]})})})]}),l.jsx(G0t,{form:r,mode:"create",isSubmitting:s,handlePublish:a,basePath:"/cms/agents/create",currentPath:n.pathname,children:l.jsx(Hk,{})})]})}function Vze({agentId:e,selectedVersionId:t,versionData:n,readOnly:r=!1,form:a,handlePublish:s,handleSaveDraft:i,isSubmitting:o,isSavingDraft:c,onVersionSelect:u,activeVersionId:d,latestVersionId:f,hideVersionPanel:p=!1,isCodeAgentOverride:h=!1}){const[,m]=Wi(),g=Mc(),w=!!t&&!!n&&t!==f?l.jsxs(Tf,{variant:"info",className:"mb-4",children:[l.jsx(Nf,{children:"This is a previous version"}),l.jsx(cv,{as:"p",children:"You are seeing a specific version of the agent."}),l.jsx("div",{className:"pt-2",children:l.jsx(ye,{type:"button",variant:"light",size:"sm",onClick:()=>m({}),children:"View latest version"})})]}):void 0,O=p?void 0:l.jsx(mdr,{agentId:e,selectedVersionId:t??void 0,onVersionSelect:u,activeVersionId:d});return l.jsx(G0t,{form:a,mode:"edit",agentId:e,isSubmitting:o,isSavingDraft:c,handlePublish:s,handleSaveDraft:i,readOnly:r,isCodeAgentOverride:h,basePath:`/cms/agents/${e}/edit`,currentPath:g.pathname,banner:w,versionId:t??void 0,rightPanel:O,children:l.jsx(Hk,{})})}function M1r(){const{agentId:e}=ps(),{navigate:t,paths:n}=en(),r=Dc(),a=Mc(),[s,i]=Wi(),o=s.get("versionId"),{data:c,isLoading:u}=Dd(e),{data:d,isLoading:f}=vge(e,{status:"draft"}),p=c?.source==="code",h=d??null,m=u||f,g=`/cms/agents/${e}/edit`,v=a.pathname===g||a.pathname===`${g}/`;x.useEffect(()=>{p&&v&&r(`${g}/instruction-blocks${a.search}${a.hash}`,{replace:!0})},[p,v,r,g,a.search,a.hash]);const{data:b}=zxt({agentId:e??"",versionId:o??""}),{data:w}=pS({agentId:e??"",params:{sortDirection:"DESC"}}),O=h?.activeVersionId,k=w?.versions?.[0],_=!!(k&&k.id!==O),C=!!o&&!!b,T=x.useMemo(()=>C&&b?b:h||(c?Oge(c):{}),[C,b,h,c]),j=h?.name??c?.name,{form:A,handlePublish:I,handleSaveDraft:P,isSubmitting:M,isSavingDraft:F,isDirty:D}=i8({mode:"edit",agentId:e??"",dataSource:T,isCodeAgentOverride:p,hasStoredOverride:p&&!!d,onSuccess:H=>t(n.agentLink(H))}),U=x.useCallback(H=>{i(H?{versionId:H}:{})},[i]),V=!m&&!h&&!c,z=!m&&!!e&&(!!h||!!c);return l.jsxs(zn,{children:[l.jsxs(rr,{className:"bg-surface1",children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(Ys,{})}),m&&l.jsx(Tr,{className:"h-6 w-[200px]"}),V&&"Agent not found",z&&`Edit agent: ${j}`,z&&_&&l.jsx(vt,{variant:"info",children:"Unpublished changes"})]}),z&&l.jsxs(Ui,{children:[l.jsx(ye,{onClick:P,disabled:!D||F||M,children:F?l.jsxs(l.Fragment,{children:[l.jsx(Ft,{className:"h-4 w-4"}),"Saving..."]}):l.jsxs(l.Fragment,{children:[l.jsx(B4t,{}),"Save"]})}),l.jsx(ye,{variant:"primary",onClick:I,disabled:!_&&!D||M||F,children:M?l.jsxs(l.Fragment,{children:[l.jsx(Ft,{className:"h-4 w-4"}),"Publishing..."]}):l.jsxs(l.Fragment,{children:[l.jsx(IQe,{}),"Publish"]})})]})]}),V?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Agent not found"}),l.jsx("div",{className:"hidden",children:l.jsx(Vze,{agentId:e??"",selectedVersionId:o,versionData:b,readOnly:!0,form:A,handlePublish:I,handleSaveDraft:P,isSubmitting:M,isSavingDraft:F,onVersionSelect:U,activeVersionId:O,latestVersionId:k?.id})})]}):l.jsx(Vze,{agentId:e??"",selectedVersionId:o,versionData:b,form:A,handlePublish:I,handleSaveDraft:P,isSubmitting:M,isSavingDraft:F,onVersionSelect:U,activeVersionId:O,latestVersionId:k?.id,hideVersionPanel:p&&!d,isCodeAgentOverride:p})]})}function D1r(){return l.jsx(eur,{})}function $1r(){return l.jsx(y0t,{})}function L1r(){return l.jsx(wur,{})}function F1r(){return l.jsx(yur,{})}function z1r(){return l.jsx(sdr,{})}function B1r(){return l.jsx(w0t,{})}function U1r(){return l.jsx(Tur,{})}function q1r(){return l.jsx(xur,{})}function V1r(){const{navigate:e,paths:t}=en();return l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(ql,{})}),"Create a prompt block"]})}),l.jsx(Ocr,{onSuccess:n=>e(t.cmsPromptBlockEditLink(n.id))})]})}function Hze(e){return{name:e.name,description:e.description||void 0,content:e.content,rules:e.rules||void 0,requestContextSchema:e.variables||void 0}}function H1r({block:e,blockId:t,selectedVersionId:n,hasDraft:r}){const a=qe(),s=es(),{navigate:i,paths:o}=en(),{updateStoredPromptBlock:c}=e8(t),[u,d]=x.useState(!1),[f,p]=x.useState(!1),{data:h}=kcr({blockId:t,versionId:n??""}),m=!!n&&!!h,g=m?h:e,v=x.useMemo(()=>({name:g.name||"",description:g.description||"",content:g.content||"",rules:g.rules,variables:g.requestContextSchema}),[g]),{form:b}=n0t({initialValues:v}),[w,O]=x.useState(0);x.useEffect(()=>{v&&!b.formState.isDirty&&(b.reset(v),O(C=>C+1))},[v,b]);const k=x.useCallback(async()=>{if(!await b.trigger()){De.error("Please fill in all required fields");return}p(!0);try{const T=Hze(b.getValues());await c.mutateAsync(T),b.reset(b.getValues()),De.success("Draft saved")}catch(T){De.error(`Failed to save draft: ${T instanceof Error?T.message:"Unknown error"}`)}finally{p(!1)}},[b,c]),_=x.useCallback(async()=>{if(!await b.trigger()){De.error("Please fill in all required fields");return}d(!0);try{const T=Hze(b.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]}),De.success("Prompt block published"),i(o.promptBlocksLink())}catch(T){De.error(`Failed to publish: ${T instanceof Error?T.message:"Unknown error"}`)}finally{d(!1)}},[b,c,a,t,i,o,s]);return l.jsxs(Nb,{leftSlot:l.jsx(t0t,{form:b,onPublish:_,onSaveDraft:k,isSubmitting:u,isSavingDraft:f,isDirty:b.formState.isDirty,hasDraft:r,formResetKey:w,mode:"edit",blockId:t}),children:[m&&l.jsxs(Tf,{variant:"info",className:"m-4 mb-0",children:[l.jsx(Nf,{children:"This is a previous version"}),l.jsx(cv,{as:"p",children:"You are seeing a specific version of the prompt block."})]}),l.jsx("form",{className:"h-full",children:l.jsx(Vxt,{form:b})})]})}function Q1r(){const{promptBlockId:e}=ps(),[t,n]=Wi(),r=t.get("versionId"),{data:a,isLoading:s}=qxt(e,{status:"draft"}),{data:i}=r0t({blockId:e??"",params:{sortDirection:"DESC"}}),o=a?.activeVersionId,c=i?.versions?.[0],u=!!(c&&(!o||c.id!==o)),d=x.useCallback(f=>{n(f?{versionId:f}:{})},[n]);return s?l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(ql,{})}),l.jsx(Tr,{className:"h-6 w-[200px]"})]})}),l.jsx(Nb,{leftSlot:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Ft,{className:"h-8 w-8"})}),children:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Ft,{className:"h-8 w-8"})})})]}):!a||!e?l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(ql,{})}),"Prompt block not found"]})}),l.jsx(Nb,{leftSlot:l.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Prompt block not found"}),children:l.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Prompt block not found"})})]}):l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(ql,{})}),"Edit prompt block: ",a.name,u&&l.jsx(vt,{variant:"info",children:"Unpublished changes"})]}),l.jsx(Ui,{children:l.jsx(Ecr,{blockId:e,value:r??"",onValueChange:d,activeVersionId:o})})]}),l.jsx(H1r,{block:a,blockId:e,selectedVersionId:r,hasDraft:u})]})}function W1r(){const{navigate:e,paths:t}=en();return l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(v0,{})}),"Create a scorer"]})}),l.jsx(olr,{onSuccess:n=>e(t.scorerLink(n.id))})]})}function Qze(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 G1r({scorer:e,scorerId:t,selectedVersionId:n}){const r=qe(),a=es(),{navigate:s,paths:i}=en(),{updateStoredScorer:o}=mge(t),[c,u]=x.useState(!1),[d,f]=x.useState(!1),p=x.useRef(null),{data:h}=clr({scorerId:t,versionId:n??""}),m=!!n&&!!h,g=m?h:e,v=x.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:b}=Ext({initialValues:v});x.useEffect(()=>{v&&b.reset(v)},[v,b]);const w=x.useCallback(async()=>{if(!await b.trigger()){De.error("Please fill in all required fields");return}f(!0);try{const _=Qze(b.getValues());await o.mutateAsync(_),De.success("Draft saved")}catch(_){De.error(`Failed to save draft: ${_ instanceof Error?_.message:"Unknown error"}`)}finally{f(!1)}},[b,o]),O=x.useCallback(async()=>{if(!await b.trigger()){De.error("Please fill in all required fields");return}u(!0);try{const _=Qze(b.getValues());await o.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"]}),De.success("Scorer published"),s(i.scorerLink(t))}catch(_){De.error(`Failed to publish scorer: ${_ instanceof Error?_.message:"Unknown error"}`)}finally{u(!1)}},[b,o,r,t,s,i,a]);return l.jsxs(Nb,{leftSlot:l.jsx(kxt,{form:b,onPublish:O,onSaveDraft:w,isSubmitting:c,isSavingDraft:d,formRef:p,mode:"edit"}),children:[m&&l.jsxs(Tf,{variant:"info",className:"m-4 mb-0",children:[l.jsx(Nf,{children:"This is a previous version"}),l.jsx(cv,{as:"p",children:"You are seeing a specific version of the scorer."})]}),l.jsx("form",{ref:p,className:"h-full",children:l.jsx(_xt,{form:b})})]})}function Z1r(){const{scorerId:e}=ps(),[t,n]=Wi(),r=t.get("versionId"),{data:a,isLoading:s}=ilr(e,{status:"draft"}),{data:i}=Cxt({scorerId:e??"",params:{sortDirection:"DESC"}}),o=a?.activeVersionId,c=i?.versions?.[0],u=!!(c&&o&&c.id!==o),d=x.useCallback(f=>{n(f?{versionId:f}:{})},[n]);return s?l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(v0,{})}),l.jsx(Tr,{className:"h-6 w-[200px]"})]})}),l.jsx(Nb,{leftSlot:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Ft,{className:"h-8 w-8"})}),children:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Ft,{className:"h-8 w-8"})})})]}):!a||!e?l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(v0,{})}),"Scorer not found"]})}),l.jsx(Nb,{leftSlot:l.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Scorer not found"}),children:l.jsx("div",{className:"flex items-center justify-center h-full text-neutral3",children:"Scorer not found"})})]}):l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(v0,{})}),"Edit scorer: ",a.name,u&&l.jsx(vt,{variant:"info",children:"Unpublished changes"})]}),l.jsx(Ui,{children:l.jsx(dlr,{scorerId:e,value:r??"",onValueChange:d,variant:"outline",activeVersionId:o})})]}),l.jsx(G1r,{scorer:a,scorerId:e,selectedVersionId:r})]})}const Y1r=new Set(["items","experiments","review"]);function X1r(){const{datasetId:e}=ps(),t=Dc(),[n,r]=Wi(),a=n.get("tab"),s=a&&Y1r.has(a)?a:"items",i=C=>{r(C==="items"?{}:{tab:C},{replace:!0})},[o,c]=x.useState(!1),[u,d]=x.useState(!1),[f,p]=x.useState(!1),[h,m]=x.useState(!1),[g,v]=x.useState(null),{data:b,error:w}=$m(e??"");if(!e)return l.jsx(zn,{children:l.jsx(Nc,{children:l.jsx("div",{className:"text-neutral3 p-4",children:"Dataset not found"})})});if(w&&Ja(w))return l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"datasets"})})});const O=C=>{t(`/evaluation/datasets/${e}/experiments/${C}`)},k=()=>{t("/evaluation?tab=datasets")},_=C=>{v(C?.version??null)};return l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(Sd,{})}),"Datasets"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:l.jsx(Ghr,{value:e,variant:"ghost"})})]})}),l.jsxs(Nc,{className:"content-stretch",children:[l.jsx(agr,{datasetId:e,onAddItemClick:()=>d(!0),onEditClick:()=>p(!0),onDeleteClick:()=>m(!0),activeDatasetVersion:g,onVersionSelect:_,initialTab:s,onTabChange:i,experimentTriggerSlot:l.jsxs(ye,{variant:"primary",onClick:()=>c(!0),children:[l.jsx(L4t,{}),g!=null?`Run on v${g}`:"Run Experiment"]})}),l.jsx(ugr,{datasetId:e,version:g??void 0,open:o,onOpenChange:c,onSuccess:O}),l.jsx(igr,{datasetId:e,open:u,onOpenChange:d}),b&&l.jsx(Qhr,{open:f,onOpenChange:p,dataset:{id:b.id,name:b.name,description:b?.description||"",inputSchema:b.inputSchema,groundTruthSchema:b.groundTruthSchema}}),b&&l.jsx(Whr,{open:h,onOpenChange:m,datasetId:b.id,datasetName:b.name,onSuccess:k})]})]})}function K1r(){const{datasetId:e,experimentId:t}=ps(),{data:n}=$m(e??""),{data:r,isLoading:a,error:s}=bse(e,t),{data:i,isLoading:o,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d}=kge({datasetId:e,experimentId:t,experimentStatus:r?.status});return!e||!t?null:a?l.jsx(zn,{children:l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx(Ft,{})})}):s&&Ja(s)?l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"datasets"})})}):s||!r?l.jsx(zn,{children:l.jsxs("div",{className:"text-red-500 p-4",children:["Error loading experiment: ",s instanceof Error?s.message:"Unknown error"]})}):l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(Sd,{})}),"Datasets"]}),l.jsx(kn,{as:Wt,to:`/evaluation/datasets/${e}`,children:n?.name}),l.jsx(kn,{isCurrent:!0,as:"span",children:"Experiment"})]})}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:"grid gap-1 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsx(Agr,{experimentId:t,experiment:r}),l.jsx(jgr,{experimentId:t,experimentStatus:r?.status,results:i??[],isLoading:o,setEndOfListElement:c,isFetchingNextPage:u,hasNextPage:d})]})})]})}function J1r(){const{datasetId:e}=ps(),[t,n]=Wi(),{data:r,error:a}=$m(e??""),s=t.get("baseline")??"",i=t.get("contender")??"";return a&&Ja(a)?l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"datasets"})})}):!e||!s||!i?l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(Sd,{})}),"Datasets"]}),l.jsxs(kn,{isCurrent:!0,as:"span",children:[l.jsx(_e,{children:l.jsx(Tj,{})}),"Compare Experiments"]})]})}),l.jsx(Nc,{children:l.jsxs("div",{className:"text-neutral4 text-center py-8",children:[l.jsx("p",{children:"Select two experiments to compare."}),l.jsxs("p",{className:"text-sm mt-2",children:["Use the URL format: /datasets/","{datasetId}","/experiments?baseline=","{experimentIdA}","&contender=","{experimentIdB}"]})]})})]}):l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(Sd,{})}),"Datasets"]}),l.jsx(kn,{as:Wt,to:`/evaluation/datasets/${e}`,children:r?.name??e?.slice(0,8)}),l.jsxs(kn,{isCurrent:!0,as:"span",children:[l.jsx(_e,{children:l.jsx(Tj,{})}),"Experiments Comparison"]})]})}),l.jsx(Nc,{children:l.jsxs("div",{className:"max-w-[100rem] w-full px-12 mx-auto grid content-start ",children:[l.jsxs(dt,{children:[l.jsxs(dt.Column,{children:[l.jsxs(dt.Title,{children:[l.jsx(Tj,{})," Dataset Experiments Comparison"]}),l.jsxs(dt.Description,{children:["Comparing"," ",l.jsx(Wt,{to:`/datasets/${e}/experiments/${s}`,children:s.slice(0,8)})," vs"," ",l.jsx(Wt,{to:`/datasets/${e}/experiments/${i}`,children:i.slice(0,8)})]})]}),l.jsx(dt.Column,{children:l.jsxs(ye,{as:Wt,to:`/evaluation/datasets/${e}`,children:[l.jsx(YO,{}),"Back to Dataset"]})})]}),l.jsx(Mgr,{datasetId:e,experimentIdA:s,experimentIdB:i,onSwap:()=>{n({baseline:i,contender:s})}})]})})]})}function eOr(){const{datasetId:e,itemId:t}=ps(),{Link:n}=en(),r=Dc(),{data:a,isLoading:s,error:i}=Age(e??"",t??""),{updateItem:o,deleteItem:c}=Ms(),{data:u}=$m(e??""),d=a?.[0]??null,f=d?.isDeleted??!1,[p,h]=x.useState(null),m=x.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,b]=x.useState(!1),[w,O]=x.useState(m.input),[k,_]=x.useState(m.groundTruth),[C,T]=x.useState(m.metadata),[j,A]=x.useState(g);g!==j&&(A(g),O(m.input),_(m.groundTruth),T(m.metadata));const[I,P]=x.useState(!1),M=B=>{h(f?B:B.isLatest?null:B)},F=()=>{h(null)},D=!f&&p!=null,U=()=>{D||b(!0)},V=()=>{D||P(!0)},z=async()=>{if(!e||!t)return;let B;try{B=JSON.parse(w)}catch{De.error("Input must be valid JSON");return}let R;if(k.trim())try{R=JSON.parse(k)}catch{De.error("Ground Truth must be valid JSON");return}let Q;if(C.trim())try{Q=JSON.parse(C)}catch{De.error("Metadata must be valid JSON");return}try{await o.mutateAsync({datasetId:e,itemId:t,input:B,groundTruth:R,metadata:Q}),De.success("Item updated successfully"),b(!1)}catch(G){De.error(`Failed to update item: ${G instanceof Error?G.message:"Unknown error"}`)}},H=()=>{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):"")),b(!1)},W=async()=>{if(!(!e||!t))try{await c.mutateAsync({datasetId:e,itemId:t}),De.success("Item deleted successfully"),P(!1),r(`/evaluation/datasets/${e}`)}catch(B){De.error(`Failed to delete item: ${B instanceof Error?B.message:"Unknown error"}`)}},$=p??d,Z=$?{id:t??"",datasetId:e??"",datasetVersion:$.datasetVersion,input:$.input,groundTruth:$.groundTruth,metadata:$.metadata,createdAt:$.createdAt,updatedAt:$.updatedAt}:null;return i&&Ja(i)?l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"datasets"})})}):s?null:!e||!t||!a||a.length===0?l.jsx(zn,{children:l.jsx(Nc,{children:l.jsx("div",{className:"text-neutral3 p-4",children:"Item not found"})})}):l.jsxs(l.Fragment,{children:[l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(Sd,{})}),"Datasets"]}),l.jsx(kn,{as:Wt,to:`/evaluation/datasets/${e}`,children:u?.name}),l.jsx(kn,{isCurrent:!0,as:"span",children:"Item"})]})}),l.jsx("div",{className:"h-full overflow-hidden px-6 pb-4",children:l.jsxs("div",{className:"grid gap-6 max-w-[60rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsxs(dt,{children:[l.jsxs(dt.Column,{children:[l.jsxs(dt.Title,{children:[l.jsx(y4t,{}),t," ",l.jsx(pi,{content:t})]}),l.jsx(dt.Description,{children:l.jsxs(da,{children:["Item of ",l.jsx(Sd,{})," ",u?.name]})}),l.jsxs(dt.Description,{children:[l.jsxs(da,{children:[l.jsx(t4t,{})," Created at"," ",d?.createdAt?Dn(new Date(d.createdAt),"MMM d, yyyy"):""]}),l.jsxs(da,{children:[l.jsx(M5,{})," Latest version v",d?.datasetVersion??""]})]})]}),l.jsx(dt.Column,{children:!v&&!f&&l.jsxs(cs,{children:[l.jsxs(ye,{onClick:U,disabled:D,title:D?"Return to latest version to edit":void 0,children:[l.jsx(P4t,{})," Edit"]}),l.jsxs(ye,{onClick:V,disabled:D,title:D?"Return to latest version to delete":void 0,children:[l.jsx(X4t,{})," Delete"]})]})})]}),l.jsxs(ex,{className:v?"grid-cols-1":"grid-cols-[1fr_auto]",children:[l.jsxs(Ar,{withRightSeparator:!v,children:[f&&d&&l.jsxs(Vo,{variant:"destructive",children:[l.jsx(Kee,{}),l.jsxs(Vo.Message,{children:["This item was deleted at version v",d.datasetVersion]})]}),!f&&D&&p&&l.jsx(l.Fragment,{children:l.jsxs(Vo,{variant:"warning",children:[l.jsx(Kee,{}),l.jsxs(Vo.Message,{children:["Viewing version v",p.datasetVersion]}),l.jsxs(Vo.Button,{onClick:F,children:[l.jsx(WLt,{})," Return to the latest version"]})]})}),v?l.jsx(bwt,{inputValue:w,setInputValue:O,groundTruthValue:k,setGroundTruthValue:_,metadataValue:C,setMetadataValue:T,validationErrors:null,onSave:z,onCancel:H,isSaving:o.isPending}):Z?l.jsx(c8,{item:Z,Link:n}):l.jsx("div",{className:"text-neutral4 text-sm",children:"Item data not available"})]}),!v&&l.jsx(Ar,{children:l.jsx(Dgr,{datasetId:e,itemId:t,onClose:()=>{},onVersionSelect:M,onCompareVersionsClick:B=>{r(`/evaluation/datasets/${e}/items/${t}/versions?ids=${B.join(",")}`)},activeVersion:p?.datasetVersion??null})})]})]})})]}),l.jsx(Ht,{open:I,onOpenChange:P,children:l.jsxs(Ht.Content,{children:[l.jsxs(Ht.Header,{children:[l.jsx(Ht.Title,{children:"Delete Item"}),l.jsx(Ht.Description,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),l.jsxs(Ht.Footer,{children:[l.jsx(Ht.Cancel,{children:"Cancel"}),l.jsx(Ht.Action,{onClick:W,children:c.isPending?"Deleting...":"Delete"})]})]})})]})}function Wze(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function tOr(){const{datasetId:e}=ps(),[t,n]=Wi(),r=t.get("items")?.split(",").filter(Boolean)??[],{data:a,error:s}=$m(e??""),{Link:i}=en(),[o,c]=x.useState(!1),{data:u}=wse(e??"",r[0]??""),{data:d}=wse(e??"",r[1]??"");return s&&Ja(s)?l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"datasets"})})}):!e||r.length<2?l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(Sd,{})}),"Datasets"]}),l.jsx(kn,{isCurrent:!0,as:"span",children:"Compare Items"})]})}),l.jsx(Nc,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two items to compare."})})})]}):l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(Sd,{})}),"Datasets"]}),l.jsx(kn,{as:Wt,to:`/evaluation/datasets/${e}`,children:a?.name||e?.slice(0,8)}),l.jsx(kn,{isCurrent:!0,as:"span",children:"Compare Items"})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:`/evaluation/datasets/${e}`,variant:"outline",children:[l.jsx(_e,{children:l.jsx(YO,{})}),"Back to Dataset"]})})]}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:Y("grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",{"grid-rows-[auto_auto_1fr]":o}),children:[l.jsxs(dt,{children:[l.jsxs(dt.Column,{children:[l.jsxs(dt.Title,{children:[l.jsx(Tj,{}),"Compare Dataset Items"]}),l.jsx(dt.Description,{children:l.jsxs(da,{children:["Comparing ",r.length," items of"," ",l.jsx(Wt,{to:`/evaluation/datasets/${e}`,className:"text-info1 hover:underline",children:a?.name||e?.slice(0,8)})]})})]}),l.jsx(dt.Column,{children:l.jsxs(cs,{children:[l.jsxs(ye,{as:Wt,to:`/evaluation/datasets/${e}`,children:[l.jsx(YO,{}),"Back to Dataset"]}),l.jsx(ye,{variant:"primary",onClick:()=>c(f=>!f),children:o?l.jsxs(l.Fragment,{children:[l.jsx(RQe,{})," Default View"]}):l.jsxs(l.Fragment,{children:[l.jsx(f4t,{})," Diff View"]})})]})})]}),l.jsx(ex,{className:"grid-cols-[1fr_3vw_1fr]",children:r.map((f,p)=>l.jsxs(x.Fragment,{children:[l.jsx(nOr,{datasetId:e,itemId:f,Link:i,idx:p,itemIds:r,showContent:!o,onItemChange:h=>{const m=[...r];m[p]=h,n({items:m.join(",")})}}),p==0&&l.jsx("div",{className:Y("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},f))}),o&&u&&d&&l.jsx(qwt,{codeA:Wze(u),codeB:Wze(d)})]})})]})}function nOr({datasetId:e,itemId:t,Link:n,idx:r,itemIds:a,onItemChange:s,showContent:i=!0}){const{data:o,isLoading:c}=wse(e,t),{data:u}=Uk(e),d=new Set(a.filter((p,h)=>h!==r)),f=(u??[]).map(p=>({value:p.id,label:p.id,disabled:d.has(p.id)}));return l.jsxs(Ar,{children:[l.jsxs(Ar.Toolbar,{className:"flex gap-4",children:[l.jsx(Jz,{label:"Item",name:`compare-item-${r}`,value:t,onValueChange:s,options:f,placeholder:"Select item",labelIsHidden:!0}),l.jsxs(ye,{as:n,to:`/datasets/${e}/items/${t}`,children:[l.jsx(M5,{}),"Versions"]})]}),i&&l.jsx(Ar.Content,{children:c?l.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):o?l.jsxs(l.Fragment,{children:[l.jsx(xwt,{item:o}),l.jsx(c8,{item:o,Link:n})]}):l.jsxs("div",{className:"text-neutral4 text-sm",children:["Item ",t.slice(0,8)," not found"]})})]})}function Gze(e){return JSON.stringify({input:e.input??null,groundTruth:e.groundTruth??null,metadata:e.metadata??null},null,2)}function rOr(){const{datasetId:e,itemId:t}=ps(),[n,r]=Wi(),[a,s]=x.useState(!1),i=n.get("ids")?.split(",").map(Number).filter(h=>!isNaN(h)&&h>0)??[],{data:o,error:c}=$m(e??""),{Link:u}=en(),{data:d}=Age(e??"",t??""),{data:f}=Ese(e??"",t??"",i[0]??0,o?.version),{data:p}=Ese(e??"",t??"",i[1]??0,o?.version);return c&&Ja(c)?l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"datasets"})})}):!e||!t||i.length<2?l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(Sd,{})}),"Datasets"]}),l.jsx(kn,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),l.jsx(Nc,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two versions to compare."})})})]}):l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(Sd,{})}),"Datasets"]}),l.jsx(kn,{as:Wt,to:`/evaluation/datasets/${e}`,children:o?.name}),l.jsx(kn,{as:Wt,to:`/datasets/${e}/items/${t}`,children:"Item"}),l.jsx(kn,{isCurrent:!0,as:"span",children:"Compare Versions"})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:`/datasets/${e}/items/${t}`,variant:"outline",children:[l.jsx(_e,{children:l.jsx(YO,{})}),"Back to Item"]})})]}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.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:[l.jsxs(dt,{children:[l.jsxs(dt.Column,{children:[l.jsxs(dt.Title,{children:[l.jsx(Tj,{}),"Compare Dataset Item Versions"]}),l.jsx(dt.Description,{children:l.jsxs(da,{children:["Comparing ",i.length," versions of"," ",l.jsx(Wt,{to:`/datasets/${e}/items/${t}`,className:"text-info1 hover:underline",children:t})]})})]}),l.jsx(dt.Column,{children:l.jsxs(cs,{children:[l.jsxs(ye,{as:Wt,to:`/datasets/${e}/items/${t}`,children:[l.jsx(YO,{}),"Back to Item"]}),l.jsx(ye,{variant:"primary",onClick:()=>s(h=>!h),children:a?l.jsxs(l.Fragment,{children:[l.jsx(RQe,{})," Default View"]}):l.jsxs(l.Fragment,{children:[l.jsx(_4t,{})," Diff View"]})})]})})]}),l.jsx(ex,{className:"grid-cols-[1fr_3vw_1fr]",children:i.map((h,m)=>l.jsxs(x.Fragment,{children:[l.jsx(aOr,{datasetId:e,itemId:t,datasetVersion:h,latestVersion:o?.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&&l.jsx("div",{className:Y("bg-surface5 w-[3px] shrink-0 mx-[1.5vw]")})]},h))}),a&&f&&p&&l.jsx(qwt,{codeA:Gze(f),codeB:Gze(p)})]})})]})}function aOr({datasetId:e,itemId:t,datasetVersion:n,latestVersion:r,allVersions:a,versionNumbers:s,Link:i,idx:o,showContent:c=!0,onVersionChange:u}){const{data:d,isLoading:f}=Ese(e,t,n,r),p=new Set(s.filter((g,v)=>v!==o)),h=a.map(g=>{const v=typeof g.updatedAt=="string"?new Date(g.updatedAt):g.updatedAt;return{value:String(g.datasetVersion),label:l.jsxs(l.Fragment,{children:[l.jsxs("b",{children:["v. ",g.datasetVersion]})," - ",Dn(v,"MMM d, yyyy h:mm a"),g.isLatest?l.jsx(Ei,{color:"blue",size:"small",children:"Latest"}):null]}),disabled:p.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 l.jsxs(Ar,{children:[l.jsxs(Ar.Toolbar,{className:"grid gap-4 grid-cols-[auto_1fr]",children:[l.jsx(M5,{className:"w-6 h-6 opacity-50"}),l.jsx(Jz,{label:"Version",name:`compare-version-${o}`,value:String(n),onValueChange:g=>u(Number(g)),options:h,placeholder:"Select version",labelIsHidden:!0,className:"w-full"})]}),c&&l.jsx(Ar.Content,{children:f?l.jsx("div",{className:"text-neutral4 text-sm",children:"Loading..."}):!d||!m?l.jsxs("div",{className:"text-neutral4 text-sm",children:["Version ",n," not found"]}):l.jsx(c8,{item:m,Link:i})})]})}function sOr(){const{datasetId:e}=ps(),[t]=Wi(),n=t.get("ids")?.split(",").map(Number).filter(g=>!isNaN(g)&&g>0)??[],r=Dc(),{data:a,error:s}=$m(e??""),i=Uk(e??"",void 0,n[0]??null),o=Uk(e??"",void 0,n[1]??null),c=x.useMemo(()=>i.data??[],[i.data]),u=x.useMemo(()=>o.data??[],[o.data]),d=x.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,b)=>b.createdAt.getTime()-v.createdAt.getTime())},[c,u]),f=x.useMemo(()=>new Map(c.map(g=>[g.id,g])),[c]),p=x.useMemo(()=>new Map(u.map(g=>[g.id,g])),[u]);if(s&&Ja(s))return l.jsx(zn,{children:l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"datasets"})})});if(!e||n.length<2)return l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(Sd,{})}),"Datasets"]}),l.jsx(kn,{isCurrent:!0,as:"span",children:"Compare Versions"})]})}),l.jsx(Nc,{children:l.jsx("div",{className:"text-neutral4 text-center py-8",children:l.jsx("p",{children:"Select at least two versions to compare."})})})]});const h=(g,v,b)=>{r(`/datasets/${e}/items/${g}/versions?ids=${v?.datasetVersion??""},${b?.datasetVersion??""}`)},m=(g,v)=>{r(`/evaluation/datasets/${e}/versions?ids=${g},${v}`,{replace:!0})};return l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=datasets",children:[l.jsx(_e,{children:l.jsx(Sd,{})}),"Datasets"]}),l.jsx(kn,{as:Wt,to:`/evaluation/datasets/${e}`,children:a?.name||e?.slice(0,8)}),l.jsxs(kn,{isCurrent:!0,as:"span",children:[l.jsx(_e,{children:l.jsx(lSe,{})}),"Compare Versions"]})]})}),l.jsx("div",{className:"h-full overflow-hidden px-[3vw] pb-4",children:l.jsxs("div",{className:"grid gap-6 max-w-[140rem] mx-auto grid-rows-[auto_1fr] h-full",children:[l.jsxs(dt,{children:[l.jsxs(dt.Column,{children:[l.jsxs(dt.Title,{children:[l.jsx(lSe,{})," Compare Dataset Versions"]}),l.jsx(dt.Description,{children:l.jsxs(da,{children:[l.jsx(M5,{})," Comparing ",n.length," versions of"," ",a?.name||e?.slice(0,8)]})})]}),l.jsx(dt.Column,{children:l.jsxs(ye,{as:Wt,to:`/evaluation/datasets/${e}`,children:[l.jsx(YO,{}),"Back to Dataset"]})})]}),l.jsx(ex,{children:l.jsxs(Ar,{children:[l.jsx(Fgr,{datasetId:e,versionA:String(n[0]),versionB:String(n[1]),onVersionChange:m}),l.jsx(qgr,{datasetId:e,versionA:n[0],versionB:n[1],allItems:d,itemsAMap:f,itemsBMap:p,onItemClick:h})]})})]})})]})}const iOr="tab",oOr=["overview","scorers","datasets","experiments"];function lOr(){const[e]=Wi(),t=e.get(iOr),n=t&&oOr.includes(t)?t:"overview";return l.jsxs(za,{children:[l.jsx(za.Top,{children:l.jsx(dt,{withMargins:!1,children:l.jsx(dt.Column,{children:l.jsxs(dt.Title,{children:[l.jsx(w4t,{})," Evaluation"]})})})}),l.jsx("div",{className:"px-4 pt-2 overflow-y-auto",children:l.jsx(vyr,{activeTab:n})})]})}function cOr(){const[e]=Wi(),t=Dc(),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 l.jsx(eSt,{redirectUri:n,onSuccess:i,initialMode:a,errorMessage:s})}const uOr=20;function dOr(e,t,n){if(e?.pagination?.hasMore)return n+1}function fOr(e){return e.pages.flatMap(t=>t.logs??[])}const pOr=({filters:e}={})=>{const t=qe(),{inView:n,setRef:r}=W_(),a=Dw({queryKey:["logs",e],queryFn:({pageParam:c})=>t.listLogsVNext({pagination:{page:c,perPage:uOr},filters:e,orderBy:{field:"timestamp",direction:"DESC"}}),initialPageParam:0,getNextPageParam:dOr,select:fOr,retry:!1,refetchInterval:3e3}),{hasNextPage:s,isFetchingNextPage:i,fetchNextPage:o}=a;return x.useEffect(()=>{n&&s&&!i&&o()},[n,s,i,o]),{...a,data:a.data,setEndOfListElement:r}},dee="period",Zze="logId",Yze="traceId",Xze="spanId",hOr={"24h":1440*60*1e3,"3d":4320*60*1e3,"7d":10080*60*1e3,"14d":336*60*60*1e3,"30d":720*60*60*1e3};function mOr(){const[e,t]=Wi(),n=e.get(dee),r=Vvr(n)?n:"24h",a=e.get(Zze),s=e.get(Yze),i=e.get(Xze),o=x.useCallback(A=>{t(I=>{const P=new URLSearchParams(I);return A==="24h"?P.delete(dee):P.set(dee,A),P},{replace:!0})},[t]),c=x.useCallback(A=>{t(I=>{const P=new URLSearchParams(I);for(const[M,F]of Object.entries(A)){const D=M==="logId"?Zze:M==="traceId"?Yze:Xze;F?P.set(D,F):P.delete(D)}return P},{replace:!0})},[t]),u=x.useMemo(()=>{const A=hOr[r];if(A)return{timestamp:{start:new Date(Date.now()-A)}}},[r]),{data:d=[],isLoading:f,error:p,isFetchingNextPage:h,hasNextPage:m,setEndOfListElement:g}=pOr({filters:u}),{searchQuery:v,setSearchQuery:b,filterGroups:w,filterColumns:O,toggleComparator:k,removeFilterGroup:_,clearAllFilters:C,updateFilterGroups:T,filteredLogs:j}=Uvr(d);return l.jsxs(za,{className:"max-w-none",children:[l.jsxs(za.Top,{children:[l.jsx(dt,{withMargins:!1,children:l.jsx(dt.Column,{children:l.jsxs(dt.Title,{children:[l.jsx(DQe,{})," Logs"]})})}),l.jsx(zvr,{onSearchChange:b,datePreset:r,onDatePresetChange:o,filterGroups:w,filterColumns:O,onToggleComparator:k,onRemoveFilterGroup:_,onClearAllFilters:C,onFilterGroupsChange:T,onReset:()=>{b(""),C(),o("24h")},isLoading:f,hasActiveFilters:v.length>0||w.length>0||r!=="24h"})]}),l.jsx(Mvr,{logs:j,isLoading:f,isFetchingNextPage:h,hasNextPage:m,setEndOfListElement:g,error:p instanceof Error?p:null,hasActiveFilters:v.length>0||w.length>0,featuredLogId:a,featuredTraceId:s,featuredSpanId:i,onFeaturedChange:c})]})}const gOr=()=>{const{data:e=[],isLoading:t,error:n}=NR(),[r,a]=x.useState("");return l.jsxs(za,{children:[l.jsxs(za.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:t,children:[l.jsx(Cu,{})," MCP Servers"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Vs,{as:"a",href:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to MCP documentation",children:l.jsx(ql,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(Jb,{onSearch:a,label:"Filter MCP servers",placeholder:"Filter by name"})})]}),l.jsx(qyr,{mcpServers:e,isLoading:t,error:n,search:r,onSearch:a})]})},vOr=()=>{const{serverId:e}=ps(),{data:t=[],isLoading:n}=NR(),r=t.find(a=>a.id===e);return l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/mcps",children:[l.jsx(_e,{children:l.jsx(Cu,{})}),"MCP Servers"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:l.jsx(b0t,{value:e,variant:"ghost"})})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"MCP documentation"]})})]}),l.jsx(Qyr,{isLoading:n,server:r})]})},yOr=()=>{const{data:e}=NR(),{serverId:t,toolId:n}=ps(),{data:r,isLoading:a}=Hwt(t,n),s=e?.find(c=>c.id===t),i=r?.name,o=s?.name||"";return a||!r?null:l.jsxs("div",{className:"h-full w-full bg-surface2 overflow-y-hidden",children:[l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/mcps",children:[l.jsx(_e,{children:l.jsx(Cu,{})}),"MCP Servers"]}),l.jsx(kn,{as:Wt,to:`/mcps/${t}`,children:o}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:i})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/tools-mcp/mcp-overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"MCP documentation"]})})]}),l.jsx(Hyr,{toolId:n,serverId:t})]})},fee="period";function bOr(){const[e,t]=Wi(),n=e.get(fee),r=Epr(n)?n:"24h",a=x.useCallback(s=>{t(i=>{const o=new URLSearchParams(i);return s==="24h"?o.delete(fee):o.set(fee,s),o},{replace:!0})},[t]);return l.jsx(Apr,{initialPreset:r,onPresetChange:a,children:l.jsxs("div",{className:"w-full px-[3vw] mx-auto grid h-full grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsxs(dt,{withMargins:!1,className:"mt-6 mb-4",children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{children:[l.jsx(kle,{})," Metrics"]})}),l.jsxs(dt.Column,{className:"flex justify-end gap-2",children:[l.jsx(vhr,{}),l.jsx(Vs,{as:"a",href:"https://mastra.ai/en/docs/observability/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Metrics documentation",children:l.jsx(ql,{})})]})]}),l.jsx(mhr,{})]})})}const xOr=(e,t)=>{const n=qe();return wt({queryKey:["trace",e],queryFn:async()=>{if(!e)throw new Error("Trace ID is required");return await n.getTrace(e)},enabled:!!e,refetchInterval:3e3,...t})},wOr=async({client:e,page:t,perPage:n,filters:r})=>e.listTraces({pagination:{page:t,perPage:n},filters:r}),SOr=25;function OOr(e,t,n){if(e?.pagination?.hasMore)return n+1}function kOr(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 _Or=({filters:e})=>{const t=qe(),{inView:n,setRef:r}=W_(),a=Dw({queryKey:["traces",e],queryFn:({pageParam:c})=>wOr({client:t,page:c,perPage:SOr,filters:e}),initialPageParam:0,getNextPageParam:OOr,select:kOr,placeholderData:JFt,retry:!1,refetchInterval:c=>Ja(c.state.error)?!1:3e3}),{hasNextPage:s,isFetchingNextPage:i,fetchNextPage:o}=a;return x.useEffect(()=>{n&&s&&!i&&o()},[n,s,i,o]),{...a,setEndOfListElement:r}};function EOr(){const e=Dc(),[t,n]=Wi(),[r,a]=x.useState(),[s,i]=x.useState({value:"all",label:"All",type:"all"}),[o,c]=x.useState(()=>new Date(Date.now()-1440*60*1e3)),[u,d]=x.useState(void 0),[f,p]=x.useState(!1),[h,m]=x.useState(!1),[g,v]=x.useState(""),[b,w]=x.useState([]),[O,k]=x.useState(!1),[_,C]=x.useState({}),[T,j]=x.useState("last-24h"),[A,I]=x.useState({}),{data:P={},isLoading:M}=nh(),{data:F,isLoading:D}=Av(),{data:U={},isLoading:V}=rh(),{data:z=[]}=jhr(),{data:H=[]}=Thr(),{data:W=[]}=Nhr(),{data:$,isLoading:Z}=xOr(r,{enabled:!!r}),B=t.get("traceId"),R=t.get("spanId"),Q=t.get("tab"),G=t.get("scoreId"),J=x.useMemo(()=>{if(Object.keys(_).length!==0)return _},[_]),{data:re,isLoading:ne,isFetchingNextPage:se,hasNextPage:le,setEndOfListElement:me,error:K,isError:ae}=_Or({filters:{...s?.type!=="all"&&{entityId:s?.value,entityType:s?.type},...o&&{startedAt:{start:o}},...u&&{endedAt:{end:u}},...b.length>0&&{tags:b},...O&&{status:"error"},...J&&{metadata:J},...Object.fromEntries(Object.entries(A).filter(([,Ze])=>Ze.trim()))}}),oe=x.useMemo(()=>re?.spans??[],[re?.spans]),ve=x.useDeferredValue(g),de=x.useMemo(()=>{if(!ve.trim())return oe;const Ze=ve.trim().toLowerCase();return oe.filter(Ke=>{if(Ke.traceId?.toLowerCase().includes(Ze)||Ke.name?.toLowerCase().includes(Ze)||Ke.entityId?.toLowerCase().includes(Ze)||Ke.entityName?.toLowerCase().includes(Ze))return!0;const yt=Ke.metadata;if(yt&&typeof yt=="object"){for(const ot of Object.values(yt))if(String(ot).toLowerCase().includes(Ze))return!0}return!1})},[oe,ve]),ue=re?.threadTitles??{},be=x.useRef({}),ce=x.useRef({}),we=x.useMemo(()=>{let Ze=!1;const Ke=be.current;for(const ot of oe){const Mn=ot.metadata;if(Mn&&typeof Mn=="object")for(const[Qn,et]of Object.entries(Mn)){if(et==null)continue;Ke[Qn]||(Ke[Qn]=new Set,Ze=!0);const Zt=String(et);Ke[Qn].has(Zt)||(Ke[Qn].add(Zt),Ze=!0)}}if(!Ze)return ce.current;const yt=Object.fromEntries(Object.entries(Ke).map(([ot,Mn])=>[ot,[...Mn].sort()]));return ce.current=yt,yt},[oe]),ee=x.useRef({}),X=x.useRef({}),pe=x.useMemo(()=>{let Ze=!1;const Ke=ee.current;for(const ot of oe)for(const Mn of vwt){const Qn=ot[Mn];Qn!=null&&typeof Qn=="string"&&Qn.trim()&&(Ke[Mn]||(Ke[Mn]=new Set,Ze=!0),Ke[Mn].has(Qn)||(Ke[Mn].add(Qn),Ze=!0))}for(const ot of H)Ke.environment||(Ke.environment=new Set,Ze=!0),Ke.environment.has(ot)||(Ke.environment.add(ot),Ze=!0);for(const ot of W)Ke.serviceName||(Ke.serviceName=new Set,Ze=!0),Ke.serviceName.has(ot)||(Ke.serviceName.add(ot),Ze=!0);if(!Ze)return X.current;const yt=Object.fromEntries(Object.entries(Ke).map(([ot,Mn])=>[ot,[...Mn].sort()]));return X.current=yt,yt},[oe,H,W]);B&&B!==r&&(a(B),m(!0));const Se=x.useMemo(()=>(Object.entries(P)||[]).map(([Ze,Ke])=>({value:Ke.id,label:Ke.name,type:Fp.AGENT})),[P]),je=x.useMemo(()=>(Object.entries(F||{})||[]).map(([,Ze])=>({value:Ze.name,label:Ze.name,type:Fp.WORKFLOW_RUN})),[F]),fe=x.useMemo(()=>[{value:"all",label:"All",type:"all"},...Se,...je],[Se,je]),ke=t.get("entity"),Ie=fe.find(Ze=>Ze.value===ke);Ie&&Ie.value!==s?.value&&i(Ie);const Me=()=>{a(void 0),n({entity:"all",traceId:""}),m(!1),c(void 0),d(void 0),p(!1),v(""),w([]),k(!1),C({}),j("last-24h"),I({}),be.current={},ce.current={},ee.current={},X.current={}},tt=(Ze,Ke)=>{if(Ke==="from")return c(Ze);d(Ze)},kt=Ze=>{Ze?.value&&n({entity:Ze.value})},Gt=Ze=>{if(Ze===r)return a(void 0);a(Ze),m(!0)},xn=ae?$yr(K):void 0,Tn=x.useMemo(()=>{if(!f)return de.map(ot=>({id:ot.traceId}));const{groups:Ze,ungrouped:Ke}=gwt(de),yt=[];for(const ot of Ze)for(const Mn of ot.traces)yt.push({id:Mn.traceId});for(const ot of Ke)yt.push({id:ot.traceId});return yt},[de,f]);if(K&&Ja(K))return l.jsxs(za,{children:[l.jsx(za.Top,{children:l.jsxs(dt,{withMargins:!1,children:[l.jsxs(dt.Column,{children:[l.jsxs(dt.Title,{children:[l.jsx(XO,{})," Observability"]}),l.jsx(dt.Description,{children:"Explore observability traces for your entities"})]}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Vs,{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:l.jsx(ql,{})})})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"traces"})})]});const zt=s?.value!=="all"||o||u||g.trim()||b.length>0||O||Object.keys(_).length>0||Object.values(A).some(Ze=>Ze.trim()),rt=Yz({entries:Tn,id:r,update:a}),Ge=Xz({entries:Tn,id:r,update:a});return l.jsxs(l.Fragment,{children:[l.jsxs(za,{className:"grid-rows-[auto_1fr] overflow-y-auto",children:[l.jsxs(za.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsxs(dt.Column,{children:[l.jsxs(dt.Title,{isLoading:ne,children:[l.jsx(XO,{})," Observability"]}),l.jsx(dt.Description,{children:"Explore observability traces for your entities"})]}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Vs,{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:l.jsx(ql,{})})})]}),l.jsx(whr,{onEntityChange:kt,onReset:Me,selectedEntity:s,entityOptions:fe,onDateChange:tt,selectedDateFrom:o,selectedDateTo:u,isLoading:ne||M||D,groupByThread:f,onGroupByThreadChange:p,searchQuery:g,onSearchChange:v,selectedTags:b,availableTags:z,onTagsChange:w,errorOnly:O,onErrorOnlyChange:k,selectedMetadata:_,availableMetadata:we,onMetadataChange:C,datePreset:T,onDatePresetChange:j,contextFilters:A,availableContextValues:pe,onContextFiltersChange:I})]}),ne?l.jsx(fxt,{columns:l8}):l.jsx(khr,{traces:de,selectedTraceId:r,onTraceClick:Gt,errorMsg:xn?.error,setEndOfListElement:me,filtersApplied:!!zt,isFetchingNextPage:se,hasNextPage:le,groupByThread:f,threadTitles:ue})]}),l.jsx(_ge,{traceSpans:$?.spans,traceId:r,initialSpanId:R||void 0,initialSpanTab:Q==="scores"?"scores":"details",initialScoreId:G||void 0,traceDetails:de.find(Ze=>Ze.traceId===r),isOpen:h,onClose:()=>{e("/observability"),m(!1)},onNext:rt,onPrevious:Ge,isLoadingSpans:Z,computeTraceLink:(Ze,Ke)=>`/observability?traceId=${Ze}${Ke?`&spanId=${Ke}`:""}`,scorers:U,isLoadingScorers:V})]})}const COr=[{title:"Metrics",description:"View system performance metrics, request latencies, and throughput across your agents and workflows.",icon:kle,href:"/metrics"},{title:"Traces",description:"Explore distributed traces to debug and understand the execution flow of your AI operations.",icon:XO,href:"/observability"}];function jOr(){return l.jsxs(za,{children:[l.jsx(za.Top,{children:l.jsx(dt,{withMargins:!1,children:l.jsx(dt.Column,{children:l.jsxs(dt.Title,{children:[l.jsx(XO,{})," Observability"]})})})}),l.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:COr.map(e=>l.jsxs(Wt,{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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),l.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),l.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}const TOr=[{title:"Agents",description:"Create and manage AI agents with tools, memory, and custom instructions.",icon:Ys,href:"/agents"},{title:"Prompts",description:"Design and version reusable prompt templates for your agents.",icon:eI,href:"/prompts"},{title:"Workflows",description:"Build step-based execution flows with suspend, resume, and branching.",icon:Jo,href:"/workflows"},{title:"Processors",description:"Configure data processors for transforming and routing information.",icon:PQe,href:"/processors"},{title:"MCP Servers",description:"Connect to Model Context Protocol servers for external tool access.",icon:Cu,href:"/mcps"},{title:"Tools",description:"Browse and test the tools available to your agents and workflows.",icon:No,href:"/tools"},{title:"Workspaces",description:"Organize your projects and resources into isolated workspaces.",icon:up,href:"/workspaces"},{title:"Request Context",description:"Inspect request-scoped context propagation for dynamic configuration.",icon:_le,href:"/request-context"}];function NOr(){return l.jsxs(za,{children:[l.jsx(za.Top,{children:l.jsx(dt,{withMargins:!1,children:l.jsx(dt.Column,{children:l.jsx(dt.Title,{children:"Primitives"})})})}),l.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 max-w-5xl",children:TOr.map(e=>l.jsxs(Wt,{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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),l.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title})]}),l.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function AOr(){const{paths:e}=en(),{data:t,isLoading:n}=Uxt(),{isCmsAvailable:r}=hge(),[a,s]=x.useState(""),i=t?.promptBlocks??[];return l.jsxs(za,{children:[l.jsxs(za.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:n,children:[l.jsx(eI,{})," Prompts"]})}),l.jsxs(dt.Column,{className:"flex justify-end gap-2",children:[l.jsx(Vs,{as:"a",href:"https://mastra.ai/en/docs/agents/agent-instructions#prompt-blocks",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Prompts documentation",children:l.jsx(ql,{})}),r&&l.jsxs(ye,{as:Wt,to:e.cmsPromptBlockCreateLink(),variant:"primary",children:[l.jsx(LQe,{}),"Create Prompt"]})]})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(Jb,{onSearch:s,label:"Filter prompts",placeholder:"Filter by name or description"})})]}),l.jsx(jcr,{promptBlocks:i,isLoading:n,search:a,onSearch:s})]})}function IOr(){return l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(_le,{})}),"Request Context"]})}),l.jsx(Nc,{children:l.jsx(zir,{children:l.jsx(sxt,{})})})]})}const ROr=[{title:"Mastra APIs",description:"Explore and test the available REST API endpoints with the interactive Swagger UI.",icon:h4t,href:"/swagger-ui",external:!1},{title:"Documentation",description:"Read the official Mastra documentation for guides, references, and tutorials.",icon:ql,href:"https://mastra.ai/en/docs",external:!0},{title:"Github",description:"Browse the source code, report issues, and contribute to the Mastra project.",icon:MQe,href:"https://github.com/mastra-ai/mastra",external:!0},{title:"Community",description:"Join the Mastra Discord community for help, discussion, and collaboration.",icon:A4t,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:o4t,href:"https://mastra.ai/cloud",external:!0}];function POr(){return l.jsxs(za,{children:[l.jsx(za.Top,{children:l.jsx(dt,{withMargins:!1,children:l.jsx(dt.Column,{children:l.jsxs(dt.Title,{children:[l.jsx(ql,{})," Resources"]})})})}),l.jsx("div",{className:"px-6 pt-6 overflow-y-auto",children:l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 max-w-3xl",children:ROr.map(e=>l.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:[l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx(e.icon,{className:"h-5 w-5 text-icon3 group-hover:text-accent1 transition-colors"}),l.jsx("span",{className:"text-ui-md font-medium text-text1",children:e.title}),e.external&&l.jsx(MQe,{className:"h-3.5 w-3.5 text-icon3 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]}),l.jsx("p",{className:"text-ui-sm text-text3 leading-relaxed",children:e.description})]},e.href))})})]})}function MOr(){const{scorerId:e}=ps(),[t,n]=Wi(),[r,a]=x.useState(),[s,i]=x.useState(0),[o,c]=x.useState(!1),[u,d]=x.useState({value:"all",label:"All Entities",type:"ALL"}),{scorer:f,isLoading:p,error:h}=xor(e),{data:m={},isLoading:g,error:v}=nh(),{data:b,isLoading:w,error:O}=Av(),{data:k,isLoading:_,error:C}=bor({scorerId:e,page:s,entityId:u?.value==="all"?void 0:u?.value,entityType:u?.type==="ALL"?void 0:u?.type}),T=x.useMemo(()=>f?.agentIds?.filter(B=>m[B]).map(B=>({value:B,label:m[B].name,type:"AGENT"}))||[],[f?.agentIds,m]),j=x.useMemo(()=>f?.workflowIds?.map(B=>({value:B,label:B,type:"WORKFLOW"}))||[],[f?.workflowIds]),A=x.useMemo(()=>[{value:"all",label:"All Entities",type:"ALL"},...T,...j],[T,j]),I=t.get("entity"),P=A.find(B=>B.value===I);if(P&&P.value!==u?.value&&d(P),x.useEffect(()=>{if(h){const B=h instanceof Error?h.message:"Failed to load scorer";De.error(`Error loading scorer: ${B}`)}},[h]),x.useEffect(()=>{if(v){const B=v instanceof Error?v.message:"Failed to load agents";De.error(`Error loading agents: ${B}`)}},[v]),x.useEffect(()=>{if(O){const B=O instanceof Error?O.message:"Failed to load workflows";De.error(`Error loading workflows: ${B}`)}},[O]),h&&Ja(h))return l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=scorers",children:[l.jsx(_e,{children:l.jsx(v0,{})}),"Scorers"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"scorers"})})]});if(p||h||v||O)return null;const M=f?.agentIds?.map(B=>({name:B,id:Object.entries(m).find(([,R])=>R.name===B)?.[0]}))||[],F=f?.workflowIds?.map(B=>({name:B,id:Object.entries(b||{}).find(([,R])=>R.name===B)?.[0]}))||[],U=[{key:"entities",label:"Entities",value:([...M.map(B=>({id:B.id,name:B.name,type:"AGENT"})),...F.map(B=>({id:B.id,name:B.name,type:"WORKFLOW"}))]||[]).map(B=>({id:B.id,name:B.name||B.id,path:`${B.type==="AGENT"?"/agents":"/workflows"}/${B.name}`}))}],V=B=>{B?.value&&n({entity:B.value})},z=k?.scores||[],H=k?.pagination,W=B=>{a(B),c(!0)},$=Yz({entries:z,id:r,update:a}),Z=Xz({entries:z,id:r,update:a});return l.jsxs(l.Fragment,{children:[l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/evaluation?tab=scorers",children:[l.jsx(_e,{children:l.jsx(v0,{})}),"Scorers"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:l.jsx(wor,{value:e,variant:"ghost"})})]}),l.jsxs(Ui,{children:[f?.scorer?.source==="stored"&&l.jsxs(ye,{variant:"light",as:Wt,to:`/cms/scorers/${e}/edit`,children:[l.jsx(_e,{children:l.jsx(D4t,{})}),"Edit"]}),l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/evals/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Scorers documentation"]})]})]}),l.jsx("div",{className:Y("grid overflow-y-auto h-full"),children:l.jsxs("div",{className:Y("max-w-[100rem] w-full px-12 mx-auto grid content-start gap-8 h-full"),children:[l.jsx(X2,{title:f?.scorer?.config?.name||"loading",description:f?.scorer?.config?.description||"loading",icon:l.jsx(v0,{})}),l.jsx(Kb,{data:U,LinkComponent:Wt,isLoading:g||w}),l.jsx(yor,{selectedEntity:u,entityOptions:A,onEntityChange:V,onReset:()=>n({entity:"all"}),isLoading:_||g||w}),_?l.jsx("div",{className:"h-full w-full flex items-center justify-center",children:l.jsx(Ft,{})}):l.jsx(Jir,{scores:z,selectedScoreId:r,pagination:{total:H?.total||0,hasMore:H?.hasMore||!1,perPage:H?.perPage||0,page:H?.page||0},onScoreClick:W,onPageChange:i,errorMsg:C?.message})]})})]}),l.jsx(mxt,{scorerName:f?.scorer?.config?.name,score:DOr(z.find(B=>B.id===r)),isOpen:o,onClose:()=>c(!1),onNext:$,onPrevious:Z,computeTraceLink:(B,R)=>`/observability?traceId=${B}${R?`&spanId=${R}`:""}`})]})}const DOr=e=>{if(e)return{...e,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt)}},$Or=[{value:"dark",label:"Dark"},{value:"light",label:"Light"},{value:"system",label:"System"}],LOr=()=>{const{baseUrl:e,headers:t,apiPrefix:n}=pge(),{theme:r,setTheme:a}=Fr(),[s,i]=x.useState(r),o=x.useRef(r);return x.useEffect(()=>{i(r),o.current=r},[r]),l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(Xme,{})}),"Settings"]})}),l.jsx(Nc,{children:l.jsxs("div",{className:"max-w-2xl mx-auto w-full mt-8 space-y-8",children:[l.jsx("section",{className:"rounded-lg border border-border1 bg-surface3 p-4",children:l.jsxs("div",{className:"space-y-3",children:[l.jsx("h2",{className:"text-icon6 font-medium",children:"Theme"}),l.jsx(Jz,{name:"theme",label:"Theme mode",value:s,onValueChange:c=>{const u=c;o.current=u,i(u)},options:$Or.map(c=>({...c}))})]})}),l.jsx(Oxt,{initialConfig:{baseUrl:e,headers:t,apiPrefix:n},onSave:()=>{a(o.current)}})]})})]})};function FOr(){const[e]=Wi(),t=Dc(),n=e.get("redirect")||"/",r=()=>{n.startsWith("http")?window.location.href=n:t(n,{replace:!0})};return l.jsx(eSt,{redirectUri:n,onSuccess:r,initialMode:"signup"})}async function V1t(){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 zOr({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 BOr({repoOrSlug:e,owner:t}){const{templates:n}=await V1t(),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 zOr({repo:e,owner:t});if(a)return a;throw new Error(`Template ${e} not found`)}return r}async function UOr({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((o,c)=>{if(!c||c.startsWith("#"))return o;const[u,d]=c.split("=");return u&&(o[u]=d?.split("")?.every(f=>f==="*")?"":d?.replaceAll('"',"")),o},{}):{}}const qOr=()=>wt({queryKey:["mastra-templates"],queryFn:V1t}),VOr=({repoOrSlug:e,owner:t})=>wt({queryKey:["template-repo",e,t],queryFn:()=>BOr({repoOrSlug:e,owner:t})}),HOr=({repo:e,owner:t,branch:n})=>wt({queryKey:["template-repo-env-vars",e,t,n],queryFn:()=>UOr({repo:e,owner:t,branch:n})}),QOr=()=>{const e=qe();return wt({queryKey:["agent-builder-workflow"],queryFn:async()=>await e.getAgentBuilderAction("merge-template").details()})},WOr=()=>{const e=qe();return qn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").createRun({runId:t})})},GOr=()=>{const e=qe();return qn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").runById(t)})},Kze=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)},Jze=(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(([o,c])=>{s[o]={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,o=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"&&o){const c=Kze(o);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=Kze(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}},ZOr=(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)}},H1t=(e,t)=>{const[n,r]=x.useState({}),[a,s]=x.useState(!1);return{streamResult:n,isStreaming:a,processStream:async(o,c)=>{if(s(!0),r({}),!o)throw new Error("No stream returned");const u=o.getReader();let d={runId:c||t,eventTimestamp:new Date().toISOString(),phase:"running",payload:{workflowState:{steps:{}},currentStep:null}};try{for(;;){const{done:f,value:p}=await u.read();if(f)break;const{newState:h}=Jze(p,d,e);if(d=h,r(h),p.runId||c||t){const m=p.runId||c||t;ZOr(m,h)}}}catch(f){console.error("💥 [processStream] Error processing template installation stream:",f);const{newState:p}=Jze({type:"error",payload:{error:f instanceof Error?f.message:"Unknown error"}},d,e);r(p)}finally{s(!1),u.releaseLock()}}}},YOr=e=>{const t=qe(),{streamResult:n,isStreaming:r,processStream:a}=H1t(e);return{streamInstall:qn({mutationFn:async({inputData:i,selectedModel:o,runId:c})=>{for(let d=1;d<=3;d++)try{const f=t.getAgentBuilderAction("merge-template"),p=new ZO;p.set("selectedModel",o);const h=await f.stream({inputData:i,requestContext:p},c);await a(h,c);return}catch(f){console.error(`💥 [streamInstall] Attempt ${d} failed:`,f);const p=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),p){const h=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:",h),new Error(h)}throw console.error("❌ [streamInstall] Non-network error or max retries reached, throwing:",f),f}}}),streamResult:n,isStreaming:r}},XOr=e=>{const t=qe(),{streamResult:n,isStreaming:r,processStream:a}=H1t(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(p=>setTimeout(p,2e3));continue}throw console.error("❌ [observeInstall] Non-network error or max retries reached, throwing:",d),d}}}),streamResult:n,isStreaming:r}};function KOr(){const{data:e,isLoading:t}=qOr(),{templates:n,tags:r,providers:a}=e??{templates:[],tags:[],providers:[]},[s,i]=x.useState("all"),[o,c]=x.useState("all"),[u,d]=x.useState(""),f=[{value:"all",label:"Any tag"}];(r||[]).forEach(w=>{f.push({value:w,label:w})});const p=[{value:"all",label:"Any provider"}];(a||[]).forEach(w=>{p.push({value:w,label:w})});const h=(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)||o!=="all"&&!w.supportedProviders.includes(o))),b=u||s!=="all"||o!=="all";return l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx($Qe,{})}),"Templates"]})}),l.jsxs("div",{className:Y("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[l.jsx(ppr,{selectedTag:s,onTagChange:w=>h(w,"tag"),tagOptions:f,selectedProvider:o,onProviderChange:w=>h(w,"provider"),providerOptions:p,searchTerm:u,onSearchChange:m,onReset:b?g:void 0,className:"max-w-[80rem]",isLoading:t}),l.jsx(mpr,{templates:v,linkComponent:Wt,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const JOr="1.21.0-alpha.2";function ekr(){const{templateSlug:e}=ps(),[t,n]=Wi(),[r,a]=x.useState(""),[s,i]=x.useState(""),[o,c]=x.useState(""),[u,d]=x.useState({}),[f,p]=x.useState([]),[h,m]=x.useState(null),[g,v]=x.useState(!1),[b,w]=x.useState(""),[O,k]=x.useState(!1),[_,C]=x.useState(!1),[T,j]=x.useState([]),{data:A,isLoading:I}=VOr({repoOrSlug:e,owner:"mastra-ai"}),M=JOr?.includes("beta")??!1?"beta":"main",{data:F,isLoading:D}=HOr({repo:A?.githubUrl?new URL(A.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:M}),{data:U,isLoading:V}=QOr(),{mutateAsync:z,isPending:H}=WOr(),{mutateAsync:W}=GOr(),{streamInstall:$,streamResult:Z,isStreaming:B}=YOr(U),{observeInstall:R,streamResult:Q,isStreaming:G}=XOr(U);x.useEffect(()=>{const ae=t.get("runId");ae&&!g&&!h&&!B&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:ae}),w(ae),W({runId:ae}).then(oe=>{const ve=oe.snapshot;if(ve?.status==="success"&&ve?.result?.success)v(!0);else if(ve?.result?.success===!1)if(ve?.result?.validationResults&&!ve?.result?.validationResults?.valid&&ve?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ue,errors:be}=ve.result.validationResults,ce=`Template installation completed but ${ue} validation issue${ue>1?"s":""} remain unresolved.`;m(ce),j(be||[])}else{const ue=ve?.result?.message||ve?.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,h,B,G,W]),x.useEffect(()=>{const ae=t.get("runId"),oe=t.get("resume"),ve=t.get("provider");if(ae&&oe==="true"&&ve&&!B&&!G&&!O&&!_&&U){w(ae),k(!0);try{W({runId:ae}).then(de=>{if(de.snapshot?.status==="running")return R.mutateAsync({runId:ae})}).then(()=>{n(de=>{const ue=new URLSearchParams(de);return ue.delete("resume"),ue})}).catch(de=>{console.error("❌ Failed to resume template installation:",de),de.message?.includes("404")||de.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(de){console.error("❌ Auto-resume failed with error:",de),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,B,G,O,_,U,W,R,n]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],re=[{key:"tools",label:"Tools",value:A?.tools?.length?A.tools.map(ae=>ae).join(", "):"n/a",icon:l.jsx(No,{})},{key:"agents",label:"Agents",value:A?.agents?.length?A.agents.map(ae=>ae).join(", "):"n/a",icon:l.jsx(Ys,{})},{key:"workflows",label:"Workflows",value:A?.workflows?.length?A.workflows.map(ae=>ae).join(", "):"n/a",icon:l.jsx(t3t,{})},{key:"providers",label:"Providers",value:A?.supportedProviders?.length?A.supportedProviders.join(", "):"n/a",icon:l.jsx(JLt,{})},{key:"tags",label:"Tags",value:A?.tags?.length?A.tags.join(", "):"n/a",icon:l.jsx(W4t,{})}],ne=[{...re[0]},{...re[1]},{...re[2]}].filter(ae=>ae.value!=="n/a");x.useEffect(()=>{F&&d(F)},[F]),x.useEffect(()=>{const ae=Z||Q;ae?.phase==="error"&&ae?.error&&m(typeof ae.error=="string"?ae.error:String(ae.error))},[Z?.phase,Z?.error,Q?.phase,Q?.error]);const se=ae=>{a(ae)},le=async ae=>(i(ae.provider),c(ae.modelId),{message:"Model updated successfully"}),me=async()=>{const ae=Object.entries(u).reduce((oe,[ve,de])=>(de===""&&oe.push(ve),oe),[]);if(ae.length>0){p(ae);return}if(A){m(null),v(!1),w(""),C(!0);try{const ve={repo:A.githubUrl||`https://github.com/mastra-ai/template-${A.slug}`,ref:M,slug:A.slug,variables:u},{runId:de}=await z({});w(de),n(ue=>{const be=new URLSearchParams(ue);return be.set("runId",de),be.set("resume","true"),be.set("provider",r||"openai"),be}),await $.mutateAsync({inputData:ve,selectedModel:{provider:s,modelId:o},runId:de})}catch(oe){C(!1),m(oe?.message||"Template installation failed"),console.error("Template installation failed",oe)}}},K=ae=>{const{name:oe,value:ve}=ae.target;ve.trim()===""?p(de=>[...de,oe]):p(de=>de.filter(ue=>ue!==oe)),d(de=>({...de,[oe]:ve}))};return l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/templates",children:[l.jsx(_e,{children:l.jsx($Qe,{})}),"Templates"]}),l.jsx(kn,{as:Wt,to:`/templates/${A?.slug}`,isCurrent:!0,children:A?.title&&A.title})]})}),l.jsx("div",{className:Y("w-full lg:px-12 h-full overflow-y-scroll"),children:l.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[l.jsx(gpr,{isLoading:I,title:A?.title,description:A?.longDescription,imageURL:A?.imageURL,githubUrl:A?.githubUrl,infoData:re,templateSlug:e}),A&&l.jsxs(l.Fragment,{children:[(B||G)&&l.jsx(Spr,{name:A.title,streamResult:G?Q:Z,runId:b,workflowInfo:U}),g&&l.jsx(Opr,{name:A.title,installedEntities:ne,linkComponent:Wt}),h&&l.jsx(kpr,{errorMsg:h,validationErrors:T.length>0?T:Z?.validationResults?.errors||Q?.validationResults?.errors}),!B&&!G&&!g&&!h&&l.jsx(vpr,{providerOptions:J,selectedProvider:r,onProviderChange:se,variables:u,setVariables:d,errors:f,setErrors:p,handleInstallTemplate:me,handleVariableChange:K,isLoadingEnvVars:D||V,isInstalling:H,defaultModelProvider:s,defaultModelId:o,onModelUpdate:le})]})]})})]})}const tkr=()=>{const{toolId:e,agentId:t}=ps();return l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/agents",children:[l.jsx(_e,{children:l.jsx(Ys,{})}),"Agents"]}),l.jsx(kn,{as:Wt,to:`/agents/${t}/chat`,children:t}),l.jsx(kn,{as:Wt,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[l.jsx(_e,{children:l.jsx(dc,{})}),"Tools documentation"]})})]}),l.jsx(Mlr,{toolId:e,agentId:t})]})},nkr=()=>{const{toolId:e}=ps();return l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/tools",children:[l.jsx(_e,{children:l.jsx(No,{})}),"Tools"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:l.jsx(fpr,{value:e,variant:"ghost"})})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Tools documentation"]})})]}),l.jsx(dpr,{toolId:e})]})};function rkr(){const{data:e,isLoading:t,error:n}=Av(),[r,a]=x.useState("");return l.jsxs(za,{children:[l.jsxs(za.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:t,children:[l.jsx(Jo,{})," Workflows"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Vs,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workflows documentation",children:l.jsx(ql,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(Jb,{onSearch:a,label:"Filter workflows",placeholder:"Filter by name or description"})})]}),l.jsx(psr,{workflows:e||{},isLoading:t,error:n,search:r,onSearch:a})]})}const e8e=()=>{const{workflowId:e}=ps(),{data:t,isLoading:n,error:r}=kR(e);return r&&Ja(r)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"workflows"})}):l.jsx(Obt,{workflowId:e,workflow:t??void 0,isLoading:n})};function t8e(){const{workspaceId:e}=ps(),[t,n]=Wi(),r=Dc(),[a,s]=x.useState(!1),[i,o]=x.useState(!1),[c,u]=x.useState(!1),[d,f]=x.useState(null),[p,h]=x.useState(null),[m,g]=x.useState(!1),v=t.get("file"),b=t.get("tab"),{data:w,error:O,isLoading:k}=z0t(),_=w?.workspaces??[],C=e??_[0]?.id,{data:T,isLoading:j,error:A}=zur(C),I=Ja(O)||Ja(A),P=t.get("path")||".",M=Ure(O)||Ure(A),F=C?_.find(rt=>rt.id===C):void 0,D=rt=>{const Ge=new URLSearchParams(t);for(const[Ze,Ke]of Object.entries(rt))Ke===null?Ge.delete(Ze):Ge.set(Ze,Ke);n(Ge)},U=rt=>{g(!1),s(!1),r(`/workspaces/${rt}`)},V=rt=>{D({path:rt==="."||rt===""?null:rt,file:null})},z=rt=>{D({file:rt})},H=rt=>{D({tab:rt})},W=P,$=v,{data:Z,isLoading:B,error:R,refetch:Q}=Bur(W,{enabled:T?.isWorkspaceConfigured&&T?.capabilities?.hasFilesystem,workspaceId:C}),G=qur(),J=Vur(),{data:re,isLoading:ne}=B0t($??"",{enabled:!!$,workspaceId:C}),{data:se,isLoading:le,refetch:me}=Qur({workspaceId:C}),K=Jur(),ae=edr(),oe=tdr(),ve=T?.isWorkspaceConfigured??!1,de=T?.capabilities?.hasFilesystem??!1,ue=T?.capabilities?.hasSkills??!1,be=T?.capabilities?.canBM25??!1,ce=T?.capabilities?.canVector??!1,we=F?.safety?.readOnly??!1,ee=de&&!we,X=T?.mounts,pe=X?.filter(rt=>!rt.readOnly).map(rt=>({path:rt.path,displayName:rt.displayName,icon:rt.icon,provider:rt.provider,name:rt.name})),Se=X&&X.length>1?X.map(rt=>rt.path):void 0,je=x.useCallback(rt=>{C&&K.mutate({...rt,workspaceId:C},{onSuccess:async Ge=>{if(Ge.success){u(!1);const{data:Ze,error:Ke}=await me();if(Ke||!Ze){De.success(`Skill "${Ge.skillName}" installed successfully (${Ge.filesWritten} files)`);return}Ze.skills.some(ot=>ot.name===Ge.skillName)?De.success(`Skill "${Ge.skillName}" installed successfully (${Ge.filesWritten} files)`):(g(!0),De.warning(`Skill "${Ge.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else De.error("Failed to install skill")},onError:Ge=>{De.error(`Failed to install skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}})},[C,K,me]),fe=x.useCallback(rt=>{C&&(h(rt),ae.mutate({workspaceId:C,skillName:rt},{onSuccess:Ge=>{if(h(null),Ge.updated.length>0){const Ze=Ge.updated[0];Ze.success?(De.success(`Skill "${rt}" updated successfully (${Ze.filesWritten} files)`),me()):De.error(`Failed to update skill: ${Ze.error??"Unknown error"}`)}else De.error("Failed to update skill: No update result returned")},onError:Ge=>{h(null),De.error(`Failed to update skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}}))},[C,ae,me]),ke=x.useCallback(rt=>{C&&(f(rt),oe.mutate({workspaceId:C,skillName:rt},{onSuccess:Ge=>{f(null),Ge.success?(De.success(`Skill "${Ge.skillName}" removed successfully`),me()):De.error(`Failed to remove skill "${Ge.skillName}"`)},onError:Ge=>{f(null),De.error(`Failed to remove skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}}))},[C,oe,me]),Me=b==="files"&&de?"files":b==="skills"&&ue?"skills":de?"files":ue?"skills":"files",tt=se?.skills??[],kt=se?.isSkillsConfigured??!1,Gt=Z?.entries??[],xn=de&&(be||ce),Tn=ue&&kt&&tt.length>0,zt=xn||Tn;return I?l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"workspaces"})})]}):M?l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[l.jsx(X2,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(up,{})}),l.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[l.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-amber-500/10 mb-6",children:l.jsx(Kee,{className:"h-8 w-8 text-amber-500"})}),l.jsx("h2",{className:"text-xl font-semibold text-neutral6 mb-2",children:"Workspace Not Supported"}),l.jsxs("p",{className:"text-neutral4 max-w-md mb-6",children:["The workspace feature requires a newer version of ",l.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),". Please upgrade your dependencies to enable workspace functionality."]}),l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[l.jsx(_e,{children:l.jsx(dc,{})}),"Learn More"]})]})]})})]}):k?l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(_e,{children:l.jsx(dc,{})}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ft,{})})]}):!j&&!k&&!ve?l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[l.jsx(X2,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(up,{})}),l.jsx(nbr,{})]})})]}):l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(Ui,{children:[zt&&l.jsxs(ye,{variant:"light",onClick:()=>s(!a),children:[l.jsx(_e,{children:l.jsx(V4t,{className:"h-4 w-4"})}),"Search"]}),l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(_e,{children:l.jsx(dc,{})}),"Workspaces documentation"]})]})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start gap-6 h-full w-full",children:[l.jsx(X2,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(up,{})}),_.length>1&&l.jsxs("div",{className:"relative",children:[l.jsxs("button",{onClick:()=>o(!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:[F?.source==="agent"?l.jsx(u2,{className:"h-4 w-4 text-accent1"}):l.jsx(WB,{className:"h-4 w-4 text-neutral4"}),l.jsxs("span",{className:"flex-1 text-left truncate",children:[F?.name??"Select workspace",F?.source==="agent"&&F.agentName&&l.jsxs("span",{className:"text-neutral4 ml-1",children:["(",F.agentName,")"]})]}),l.jsx(s4t,{className:`h-4 w-4 text-neutral4 transition-transform ${i?"rotate-180":""}`})]}),i&&l.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(rt=>l.jsxs("button",{onClick:()=>{U(rt.id),o(!1)},className:`flex items-center gap-3 px-3 py-2 w-full text-left hover:bg-surface3 transition-colors ${F?.id===rt.id?"bg-surface3":""}`,children:[rt.source==="agent"?l.jsx(u2,{className:"h-4 w-4 text-accent1 flex-shrink-0"}):l.jsx(WB,{className:"h-4 w-4 text-neutral4 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm font-medium text-neutral6 truncate",children:rt.name}),l.jsx("div",{className:"text-xs text-neutral4 truncate",children:rt.source==="agent"?`Agent: ${rt.agentName}`:"Global workspace"})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[rt.safety?.readOnly&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"}),rt.capabilities.hasFilesystem&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"FS"}),rt.capabilities.hasSandbox&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Sandbox"}),rt.capabilities.hasSkills&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Skills"})]})]},rt.id))})]}),_.length===1&&F&&l.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral4",children:[F.source==="agent"?l.jsx(u2,{className:"h-4 w-4 text-accent1"}):l.jsx(WB,{className:"h-4 w-4"}),l.jsx("span",{children:F.name}),F.source==="agent"&&F.agentName&&l.jsxs("span",{className:"text-neutral3",children:["(",F.agentName,")"]}),we&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),a&&zt&&C&&l.jsx(akr,{workspaceId:C,canSearchFiles:xn,canSearchSkills:Tn,canBM25:be,canVector:ce,showInitWarning:!j&&T?.status!=="ready",onViewFileResult:rt=>{D({file:rt,tab:"files"})},onViewSkillResult:(rt,Ge)=>{C&&r(`/workspaces/${C}/skills/${encodeURIComponent(rt)}?path=${encodeURIComponent(Ge)}`)}},C),l.jsxs("div",{className:"flex gap-2 border-b border-border1",children:[de&&l.jsxs("button",{onClick:()=>H("files"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Me==="files"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(eI,{className:"h-4 w-4"}),"Files"]}),ue&&l.jsxs("button",{onClick:()=>H("skills"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Me==="skills"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(T$,{className:"h-4 w-4"}),"Skills",kt&&tt.length>0&&l.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:tt.length})]})]}),l.jsxs("div",{className:"pb-8",children:[Me==="files"&&de&&l.jsx("div",{className:"space-y-4",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[l.jsx(Kyr,{entries:Gt,currentPath:W,isLoading:B,error:R,onNavigate:V,onFileSelect:z,onRefresh:()=>Q(),onCreateDirectory:we?void 0:rt=>J.mutate({path:rt,workspaceId:C}),onDelete:we?void 0:rt=>G.mutate({path:rt,recursive:!0,force:!0,workspaceId:C})}),$&&l.jsx(tbr,{path:$,content:re?.content??"",isLoading:ne,mimeType:re?.mimeType,onClose:()=>z(null)})]})}),Me==="skills"&&ue&&l.jsx(dbr,{skills:tt,isLoading:le,isSkillsConfigured:kt,hasUndiscoveredAgentSkills:m,basePath:C?`/workspaces/${C}/skills`:"/workspaces",onAddSkill:ee?()=>u(!0):void 0,onUpdateSkill:ee?fe:void 0,onRemoveSkill:ee?ke:void 0,updatingSkillName:p??void 0,removingSkillName:d??void 0,mountPaths:Se}),!de&&!ue&&l.jsx("div",{className:"py-12 text-center text-neutral4",children:l.jsx("p",{children:"No workspace capabilities are configured."})})]})]})}),C&&ee&&l.jsx(vbr,{open:c,onOpenChange:u,workspaceId:C,onInstall:je,isInstalling:K.isPending,installedSkillIds:tt.filter(rt=>rt.skillsShSource).map(rt=>`${rt.skillsShSource.owner}/${rt.skillsShSource.repo}/${rt.name}`),installedSkillNames:tt.filter(rt=>!rt.skillsShSource).map(rt=>rt.name),writableMounts:pe,installedSkillPaths:Object.fromEntries(tt.filter(rt=>rt.path).map(rt=>[rt.name,rt.path]))})]})}function akr({workspaceId:e,canSearchFiles:t,canSearchSkills:n,canBM25:r,canVector:a,showInitWarning:s,onViewFileResult:i,onViewSkillResult:o}){const c=Hur(),u=Zur();return l.jsxs("div",{className:"border border-border1 rounded-lg p-4 bg-surface2 space-y-4",children:[t&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(eI,{className:"h-4 w-4"}),"Search Indexed Files"]}),s&&l.jsxs("p",{className:"text-xs text-amber-400 mb-3",children:["File search requires ",l.jsx("code",{className:"text-amber-300",children:"workspace.init()"})," to index files from your configured ",l.jsx("code",{className:"text-amber-300",children:"autoIndexPaths"}),"."]}),l.jsx(rbr,{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&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(T$,{className:"h-4 w-4"}),"Search Skills"]}),l.jsx(sbr,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>o(d.skillName,d.skillPath)})]})]})}function skr(e,t){return e==null||t==null?null:e in t?e:null}function ikr(){const{skillName:e,workspaceId:t}=ps(),[n]=Wi(),r=es(),a=e?decodeURIComponent(e):"",s=n.get("path"),i=s?decodeURIComponent(s):void 0,o=n.get("agentId"),c=o?decodeURIComponent(o):null,d=r.getQueriesData({queryKey:["agents"]})?.[0]?.[1]??null,f=skr(c,d),p=f?`/agents/${f}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[h,m]=x.useState(null),{data:g,isLoading:v,error:b}=Wur(a,{workspaceId:t,path:i}),{data:w}=B0t(g?.path?`${g.path}/SKILL.md`:"",{enabled:!!g?.path,workspaceId:t}),{data:O,isLoading:k}=Gur(a,h??"",{enabled:!!h,workspaceId:t,path:i}),_=C=>f?l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:p,children:[l.jsx(_e,{children:l.jsx(u2,{className:"h-4 w-4"})}),f]}),l.jsxs(kn,{as:"span",to:"",isCurrent:!0,children:[l.jsx(_e,{children:l.jsx(T$,{className:"h-4 w-4"})}),C]})]}):l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:p,children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(kn,{as:Wt,to:p,children:[l.jsx(_e,{children:l.jsx(T$,{className:"h-4 w-4"})}),"Skills"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:C})]});return v?l.jsxs(zn,{children:[l.jsx(rr,{children:_("Loading...")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsx("div",{className:"h-8 w-8 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})})]}):b&&Ja(b)?l.jsxs(zn,{children:[l.jsx(rr,{children:_("Permission Denied")}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"workspaces"})})]}):b||!g?l.jsxs(zn,{children:[l.jsx(rr,{children:_("Error")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load skill"}),l.jsx("p",{className:"text-sm text-neutral3",children:b?.message??"Skill not found"})]})})]}):l.jsxs(zn,{children:[l.jsxs(rr,{children:[_(g.name),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[l.jsx(_e,{children:l.jsx(dc,{})}),"Documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto overflow-x-hidden h-full",children:l.jsx("div",{className:"max-w-[100rem] px-[3rem] mx-auto py-8 h-full w-full overflow-x-hidden",children:l.jsx(mbr,{skill:g,rawSkillMd:w?.content,onReferenceClick:m})})}),l.jsx(gbr,{open:!!h,onOpenChange:C=>!C&&m(null),skillName:g.name,referencePath:h??"",content:O?.content,isLoading:k})]})}const okr=[{key:"primitives",title:"Primitives",href:"/primitives",links:[{name:"Agents",url:"/agents",icon:l.jsx(Ys,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"agents:read"},{name:"Prompts",url:"/prompts",icon:l.jsx(eI,{}),isOnMastraPlatform:!0,indent:!0},{name:"Workflows",url:"/workflows",icon:l.jsx(Jo,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workflows:read"},{name:"Processors",url:"/processors",icon:l.jsx(PQe,{}),isOnMastraPlatform:!1,indent:!0,requiredPermission:"processors:read"},{name:"MCP Servers",url:"/mcps",icon:l.jsx(Cu,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"mcps:read"},{name:"Tools",url:"/tools",icon:l.jsx(No,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"tools:read"},{name:"Workspaces",url:"/workspaces",icon:l.jsx(up,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workspaces:read"},{name:"Request Context",url:"/request-context",icon:l.jsx(_le,{}),isOnMastraPlatform:!0,indent:!0}]},{key:"evaluation",title:"Evaluation",href:"/evaluation",links:[{name:"Scorers",url:"/evaluation?tab=scorers",icon:l.jsx(ZLt,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"scorers:read"},{name:"Datasets",url:"/evaluation?tab=datasets",icon:l.jsx(Sd,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]},{name:"Experiments",url:"/evaluation?tab=experiments",icon:l.jsx(Z4t,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]}]},{key:"observability",title:"Observability",href:"/observability-overview",links:[{name:"Metrics",url:"/metrics",icon:l.jsx(kle,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Traces",url:"/observability",icon:l.jsx(XO,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Logs",url:"/logs",icon:l.jsx(DQe,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"}]},{key:"bottom",separator:!0,links:[{name:"Settings",url:"/settings",icon:l.jsx(Xme,{}),isOnMastraPlatform:!1},{name:"Resources",url:"/resources",icon:l.jsx(ql,{}),isOnMastraPlatform:!0}]}],lkr={scorers:"/evaluation/scorers",datasets:"/evaluation/datasets"};function n8e(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 o=lkr[s];if(o&&(t===o||t.startsWith(o+"/")))return!0}return!1}return t===e.url||t.startsWith(e.url+"/")}function ckr(){const{state:e}=Uwt(),t=Mc(),n=t.pathname,{isMastraPlatform:r}=Xwt(),{data:a}=G_(),{isCmsAvailable:s,isLoading:i}=hge(),{hasPermission:o,hasAnyPermission:c,rbacEnabled:u,isAuthenticated:d,isLoading:f}=jv(),p=a&&CR(a),h=new Set(["/prompts"]),m=g=>h.has(g.url)&&!s&&!i||r&&!g.isOnMastraPlatform?!1:u&&d&&f?!0:!(g.requiredPermission&&!o(g.requiredPermission)||g.requiredAnyPermission&&!c(g.requiredAnyPermission));return l.jsxs(pg,{children:[l.jsx("div",{className:"pt-3 mb-4 -ml-0.5 sticky top-0 bg-surface1 z-10",children:e==="collapsed"?l.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[l.jsx(rb,{className:"h-[1.5rem] w-[1.5rem] shrink-0 ml-3"}),p&&l.jsx(jse,{})]}):p?l.jsxs("span",{className:"flex items-center justify-between pl-3 pr-2",children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(rb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]}),l.jsx(jse,{})]}):l.jsxs("span",{className:"flex items-center gap-2 pl-3",children:[l.jsx(rb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]})}),l.jsx(pg.Nav,{children:okr.map(g=>{const v=g.links.filter(m),b=v.length>0&&g?.separator,w=v.some(k=>n8e(k,n,t.search)),O=!!(g.href&&n===g.href&&!w);return l.jsxs(pg.NavSection,{children:[g?.title?l.jsx(pg.NavHeader,{state:e,href:g.href,isActive:O,children:g.title}):l.jsx(l.Fragment,{children:b&&l.jsx(pg.NavSeparator,{})}),l.jsx(pg.NavList,{children:v.map(k=>{const _=n8e(k,n,t.search);return l.jsx(pg.NavLink,{state:e,link:k,isActive:_},k.name)})})]},g.key)})}),l.jsx(pg.Bottom,{children:e!=="collapsed"&&l.jsxs(l.Fragment,{children:[l.jsx(pg.NavSeparator,{}),l.jsx(Kor,{collapsed:!1})]})})]})}const ukr=x.createContext({theme:"dark",setTheme:()=>null}),dkr=e=>e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";function Q1t({children:e}){const t=Fr(a=>a.theme),n=Fr(a=>a.setTheme),r=t==="light"||t==="system"?t:"dark";return x.useEffect(()=>{const a=window.document.documentElement,s=c=>{const u=dkr(c);a.classList.remove("light","dark"),a.classList.add(u)};if(s(r),r!=="system")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>s("system");return i.addEventListener("change",o),()=>{i.removeEventListener("change",o)}},[r]),l.jsx(ukr.Provider,{value:{theme:r,setTheme:n},children:e})}const W1t="experimental-ui:",G1t="current",fkr=Ce.createContext(null);function pkr(e,t){const n=window.localStorage.getItem(W1t+e);return n&&t.has(n)?n:G1t}function hkr({experiments:e,children:t}){const n=Ce.useMemo(()=>new Map(e.map(c=>[c.key,new Set(c.variants.map(u=>u.value))])),[e]),[r,a]=Ce.useState({});Ce.useLayoutEffect(()=>{const c={};for(const u of e){const d=n.get(u.key);c[u.key]=pkr(u.key,d)}a(c)},[e,n]);const s=Ce.useCallback(c=>r[c]??G1t,[r]),i=Ce.useCallback((c,u)=>{window.localStorage.setItem(W1t+c,u),a(d=>({...d,[c]:u}))},[]),o=Ce.useMemo(()=>({experiments:e,getVariant:s,setVariant:i}),[e,s,i]);return l.jsx(fkr.Provider,{value:o,children:t})}const mkr=[{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"}]}],gkr=()=>({experimentalUIEnabled:typeof window<"u"&&window.MASTRA_EXPERIMENTAL_UI==="true"});function vkr({children:e}){const{data:t,isFetched:n}=G_(),r=n&&t?.enabled&&!CR(t),a=n&&!r;return l.jsxs(l.Fragment,{children:[l.jsx(_br,{}),l.jsxs("div",{className:a?"grid h-full grid-cols-[auto_1fr]":"h-full",children:[a&&l.jsx(ckr,{}),l.jsx("div",{className:Y("bg-transparent overflow-y-auto",{"h-[calc(100%-1.5rem)]":r}),children:l.jsx(tSt,{children:e})})]})]})}const ykr=({children:e})=>{const{experimentalUIEnabled:t}=gkr();return l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(gst,{position:"bottom-right"}),l.jsx(Q1t,{defaultTheme:"dark",attribute:"class",children:l.jsx(Pc,{delayDuration:0,children:l.jsx(hkr,{experiments:t?mkr:[],children:l.jsx(Ayr,{children:l.jsx(vkr,{children:e})})})})})]})},bkr=({children:e})=>l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(gst,{position:"bottom-right"}),l.jsx(Q1t,{defaultTheme:"dark",attribute:"class",children:l.jsx(Pc,{delayDuration:0,children:l.jsx("div",{className:"h-full overflow-y-auto",children:l.jsx(tSt,{children:e})})})})]});function xkr({agentId:e}){return l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/agents",children:[l.jsx(_e,{children:l.jsx(Ys,{})}),"Agents"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:l.jsx(Nlr,{value:e,variant:"ghost"})})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Agents documentation"]})})]})}const wkr=({children:e})=>{const{agentId:t}=ps(),n=Mc(),{isCmsAvailable:r}=hge(),{hasObservability:a}=nlr(),s=iie.has("datasets"),i=r&&s,o=a&&s,{data:c}=Dd(t),u=xc(c?.provider??""),d=c?.modelId??"",f=c?.requestContextSchema,p=n.pathname.includes("/editor")?"versions":n.pathname.includes("/evaluate")?"evaluate":n.pathname.includes("/review")?"review":n.pathname.includes("/traces")?"traces":"chat",h=(p==="versions"||p==="evaluate"||p==="review")&&(i||o),m=l.jsxs(zn,{className:"grid-rows-[auto_auto_1fr]",children:[l.jsx(xkr,{agentId:t}),l.jsx(Pfr,{agentId:t,activeTab:p,showPlayground:i,showObservability:o,rightSlot:h?l.jsx(Mfr,{requestContextSchema:f}):void 0}),e]});return l.jsx(qz,{children:l.jsx(vir,{defaultProvider:u,defaultModel:d,children:l.jsx(Ofr,{children:l.jsx(yir,{children:m})})})})};function Skr(){const{data:e={},isLoading:t,error:n}=jge(),[r,a]=x.useState("");return l.jsxs(za,{children:[l.jsxs(za.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:t,children:[l.jsx(CO,{})," Processors"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Vs,{as:"a",href:"https://mastra.ai/en/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Processors documentation",children:l.jsx(ql,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(Jb,{onSearch:a,label:"Filter processors",placeholder:"Filter by name"})})]}),l.jsx(epr,{processors:e,isLoading:t,error:n,search:r,onSearch:a})]})}function Okr(){const{processorId:e}=ps(),{data:t,isLoading:n,error:r}=cwt(e);return r&&Ja(r)?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(CO,{})}),"Processors"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"processors"})})]}):!n&&t?.isWorkflow?l.jsx(h0r,{to:`/workflows/${e}/graph`,replace:!0}):n?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(CO,{})}),"Processors"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:l.jsx(Tr,{className:"h-6 w-32"})})]})}),l.jsxs("div",{className:"p-6",children:[l.jsx(Tr,{className:"h-8 w-48 mb-4"}),l.jsx(Tr,{className:"h-32 w-full"})]})]}):l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(CO,{})}),"Processors"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:l.jsx(ipr,{value:e,variant:"ghost"})})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Processors documentation"]})})]}),l.jsx(rpr,{processorId:e})]})}function kkr(){const{data:e={},isLoading:t}=nh(),{data:n={},isLoading:r,error:a}=a8(),[s,i]=x.useState(""),o=t||r;return l.jsxs(za,{children:[l.jsxs(za.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:o,children:[l.jsx(No,{})," Tools"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Vs,{as:"a",href:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Tools documentation",children:l.jsx(ql,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(Jb,{onSearch:i,label:"Filter tools",placeholder:"Filter by name"})})]}),l.jsx(cpr,{tools:n,agents:e,isLoading:o,error:a,search:s,onSearch:i})]})}const Z1t={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}`},_kr=()=>{const e=Dc(),t=n=>e(n,{viewTransition:!0});return l.jsx(rbt,{Link:q1t,navigate:t,paths:Z1t,children:l.jsx(ykr,{children:l.jsx(Hk,{})})})},Ekr=()=>{const e=Dc(),t=n=>e(n,{viewTransition:!0});return l.jsx(rbt,{Link:q1t,navigate:t,paths:Z1t,children:l.jsx(bkr,{children:l.jsx(Hk,{})})})},Ckr=!!window.MASTRA_CLOUD_API_ENDPOINT,r8e=iie.has("datasets"),a8e=[{index:!0,element:l.jsx(D1r,{})},{path:"instruction-blocks",element:l.jsx($1r,{})},{path:"tools",element:l.jsx(B1r,{})},{path:"agents",element:l.jsx(R1r,{})},{path:"scorers",element:l.jsx(F1r,{})},{path:"workflows",element:l.jsx(q1r,{})},{path:"skills",element:l.jsx(z1r,{})},{path:"memory",element:l.jsx(L1r,{})},{path:"variables",element:l.jsx(U1r,{})}],jkr=[{path:"/login",element:l.jsx(cOr,{})},{path:"/signup",element:l.jsx(FOr,{})},{element:l.jsx(Ekr,{}),children:[{path:"/agents/:agentId/session",element:l.jsx(qze,{})},{path:"/agents/:agentId/session/:threadId",element:l.jsx(qze,{})}]},{element:l.jsx(_kr,{}),children:[...Ckr?[]:[{path:"/settings",element:l.jsx(LOr,{})},{path:"/templates",element:l.jsx(KOr,{})},{path:"/templates/:templateSlug",element:l.jsx(ekr,{})}],{path:"/logs",element:l.jsx(mOr,{})},{path:"/primitives",element:l.jsx(NOr,{})},{path:"/evaluation",element:l.jsx(lOr,{})},{path:"/evaluation/scorers/:scorerId",element:l.jsx(MOr,{})},{path:"/metrics",element:l.jsx(bOr,{})},{path:"/observability-overview",element:l.jsx(jOr,{})},{path:"/observability",element:l.jsx(EOr,{})},{path:"/resources",element:l.jsx(POr,{})},{path:"/agents",element:l.jsx(E1r,{})},{path:"/cms/agents/create",element:l.jsx(P1r,{}),children:a8e},{path:"/cms/agents/:agentId/edit",element:l.jsx(M1r,{}),children:a8e},{path:"/cms/scorers/create",element:l.jsx(W1r,{})},{path:"/cms/scorers/:scorerId/edit",element:l.jsx(Z1r,{})},{path:"/prompts",element:l.jsx(AOr,{})},{path:"/cms/prompts/create",element:l.jsx(V1r,{})},{path:"/cms/prompts/:promptBlockId/edit",element:l.jsx(Q1r,{})},{path:"/agents/:agentId/tools/:toolId",element:l.jsx(tkr,{})},{path:"/agents/:agentId",element:l.jsx(wkr,{children:l.jsx(Hk,{})}),children:[{index:!0,loader:({params:e})=>BJ(`/agents/${e.agentId}/chat`)},{path:"chat",element:l.jsx(Uze,{})},{path:"chat/:threadId",element:l.jsx(Uze,{})},...r8e?[{path:"editor",element:l.jsx(N1r,{})},{path:"evaluate",element:l.jsx(T1r,{})},{path:"review",element:l.jsx(A1r,{})}]:[],{path:"traces",element:l.jsx(I1r,{})}]},{path:"/tools",element:l.jsx(kkr,{})},{path:"/tools/:toolId",element:l.jsx(nkr,{})},{path:"/processors",element:l.jsx(Skr,{})},{path:"/processors/:processorId",element:l.jsx(Okr,{})},{path:"/mcps",element:l.jsx(gOr,{})},{path:"/mcps/:serverId",element:l.jsx(vOr,{})},{path:"/mcps/:serverId/tools/:toolId",element:l.jsx(yOr,{})},{path:"/workspaces",element:l.jsx(t8e,{})},{path:"/workspaces/:workspaceId",element:l.jsx(t8e,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:l.jsx(ikr,{})},{path:"/workflows",element:l.jsx(rkr,{})},{path:"/workflows/:workflowId",element:l.jsx(J0r,{children:l.jsx(Hk,{})}),children:[{index:!0,loader:({params:e})=>BJ(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:l.jsx(e8e,{})},{path:"graph/:runId",element:l.jsx(e8e,{})}]},...r8e?[{path:"/evaluation/datasets/:datasetId",element:l.jsx(X1r,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId",element:l.jsx(eOr,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId/versions",element:l.jsx(rOr,{})},{path:"/evaluation/datasets/:datasetId/experiments/:experimentId",element:l.jsx(K1r,{})},{path:"/evaluation/datasets/:datasetId/experiments",element:l.jsx(J1r,{})},{path:"/evaluation/datasets/:datasetId/items",element:l.jsx(tOr,{})},{path:"/evaluation/datasets/:datasetId/versions",element:l.jsx(sOr,{})}]:[],{index:!0,loader:()=>BJ("/agents")},{path:"/request-context",element:l.jsx(IOr,{})}]}];function Tkr(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:n,apiPrefix:r,isLoading:a}=pge();if(a)return null;if(!t)return l.jsx(tlr,{});const s=z0r(jkr,{basename:e});return l.jsx(RFt,{baseUrl:t,headers:n,apiPrefix:r,children:l.jsx(k1r,{children:l.jsx(d0r,{router:s})})})}function Nkr(){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 l.jsx(Dyr,{children:l.jsx(Qor,{endpoint:i,defaultApiPrefix:r,children:l.jsx(Tkr,{})})})}i_t.createRoot(document.getElementById("root")).render(l.jsx(x.StrictMode,{children:l.jsx(Nkr,{})}));const z_r=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{Get as A,zrt as B,Yet as C,Fnt as D,Rd as E,Cf as F,Ikr as G,f_t as H,$a as I,z_r as J,Z0 as L,Wet as N,M3 as _,F6t as a,tFt as b,f_r as c,LSe as d,X0 as e,X6t as f,hO as g,eFt as h,Hw as i,Qw as j,Vw as k,Nan as l,Qnt as m,H0 as n,fs as o,Hrn as p,Vrn as q,Hue as r,zle as s,ie as t,sL as u,Gc as v,V6t as w,gt as x,nt as y,cat as z};
516
+ `).reduce((o,c)=>{if(!c||c.startsWith("#"))return o;const[u,d]=c.split("=");return u&&(o[u]=d?.split("")?.every(f=>f==="*")?"":d?.replaceAll('"',"")),o},{}):{}}const qOr=()=>wt({queryKey:["mastra-templates"],queryFn:V1t}),VOr=({repoOrSlug:e,owner:t})=>wt({queryKey:["template-repo",e,t],queryFn:()=>BOr({repoOrSlug:e,owner:t})}),HOr=({repo:e,owner:t,branch:n})=>wt({queryKey:["template-repo-env-vars",e,t,n],queryFn:()=>UOr({repo:e,owner:t,branch:n})}),QOr=()=>{const e=qe();return wt({queryKey:["agent-builder-workflow"],queryFn:async()=>await e.getAgentBuilderAction("merge-template").details()})},WOr=()=>{const e=qe();return qn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").createRun({runId:t})})},GOr=()=>{const e=qe();return qn({mutationFn:async({runId:t})=>await e.getAgentBuilderAction("merge-template").runById(t)})},Kze=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)},Jze=(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(([o,c])=>{s[o]={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,o=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"&&o){const c=Kze(o);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=Kze(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}},ZOr=(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)}},H1t=(e,t)=>{const[n,r]=x.useState({}),[a,s]=x.useState(!1);return{streamResult:n,isStreaming:a,processStream:async(o,c)=>{if(s(!0),r({}),!o)throw new Error("No stream returned");const u=o.getReader();let d={runId:c||t,eventTimestamp:new Date().toISOString(),phase:"running",payload:{workflowState:{steps:{}},currentStep:null}};try{for(;;){const{done:f,value:p}=await u.read();if(f)break;const{newState:h}=Jze(p,d,e);if(d=h,r(h),p.runId||c||t){const m=p.runId||c||t;ZOr(m,h)}}}catch(f){console.error("💥 [processStream] Error processing template installation stream:",f);const{newState:p}=Jze({type:"error",payload:{error:f instanceof Error?f.message:"Unknown error"}},d,e);r(p)}finally{s(!1),u.releaseLock()}}}},YOr=e=>{const t=qe(),{streamResult:n,isStreaming:r,processStream:a}=H1t(e);return{streamInstall:qn({mutationFn:async({inputData:i,selectedModel:o,runId:c})=>{for(let d=1;d<=3;d++)try{const f=t.getAgentBuilderAction("merge-template"),p=new ZO;p.set("selectedModel",o);const h=await f.stream({inputData:i,requestContext:p},c);await a(h,c);return}catch(f){console.error(`💥 [streamInstall] Attempt ${d} failed:`,f);const p=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),p){const h=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:",h),new Error(h)}throw console.error("❌ [streamInstall] Non-network error or max retries reached, throwing:",f),f}}}),streamResult:n,isStreaming:r}},XOr=e=>{const t=qe(),{streamResult:n,isStreaming:r,processStream:a}=H1t(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(p=>setTimeout(p,2e3));continue}throw console.error("❌ [observeInstall] Non-network error or max retries reached, throwing:",d),d}}}),streamResult:n,isStreaming:r}};function KOr(){const{data:e,isLoading:t}=qOr(),{templates:n,tags:r,providers:a}=e??{templates:[],tags:[],providers:[]},[s,i]=x.useState("all"),[o,c]=x.useState("all"),[u,d]=x.useState(""),f=[{value:"all",label:"Any tag"}];(r||[]).forEach(w=>{f.push({value:w,label:w})});const p=[{value:"all",label:"Any provider"}];(a||[]).forEach(w=>{p.push({value:w,label:w})});const h=(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)||o!=="all"&&!w.supportedProviders.includes(o))),b=u||s!=="all"||o!=="all";return l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx($Qe,{})}),"Templates"]})}),l.jsxs("div",{className:Y("overflow-y-auto w-full h-full px-8 pb-12 z-10"),children:[l.jsx(ppr,{selectedTag:s,onTagChange:w=>h(w,"tag"),tagOptions:f,selectedProvider:o,onProviderChange:w=>h(w,"provider"),providerOptions:p,searchTerm:u,onSearchChange:m,onReset:b?g:void 0,className:"max-w-[80rem]",isLoading:t}),l.jsx(mpr,{templates:v,linkComponent:Wt,className:"max-w-[80rem] mx-auto",isLoading:t})]})]})}const JOr="1.21.0";function ekr(){const{templateSlug:e}=ps(),[t,n]=Wi(),[r,a]=x.useState(""),[s,i]=x.useState(""),[o,c]=x.useState(""),[u,d]=x.useState({}),[f,p]=x.useState([]),[h,m]=x.useState(null),[g,v]=x.useState(!1),[b,w]=x.useState(""),[O,k]=x.useState(!1),[_,C]=x.useState(!1),[T,j]=x.useState([]),{data:A,isLoading:I}=VOr({repoOrSlug:e,owner:"mastra-ai"}),M=JOr?.includes("beta")??!1?"beta":"main",{data:F,isLoading:D}=HOr({repo:A?.githubUrl?new URL(A.githubUrl).pathname.split("/")[2]:`template-${e}`,owner:"mastra-ai",branch:M}),{data:U,isLoading:V}=QOr(),{mutateAsync:z,isPending:H}=WOr(),{mutateAsync:W}=GOr(),{streamInstall:$,streamResult:Z,isStreaming:B}=YOr(U),{observeInstall:R,streamResult:Q,isStreaming:G}=XOr(U);x.useEffect(()=>{const ae=t.get("runId");ae&&!g&&!h&&!B&&!G&&(console.info("🔄 Checking completed run after hot reload:",{runId:ae}),w(ae),W({runId:ae}).then(oe=>{const ve=oe.snapshot;if(ve?.status==="success"&&ve?.result?.success)v(!0);else if(ve?.result?.success===!1)if(ve?.result?.validationResults&&!ve?.result?.validationResults?.valid&&ve?.result?.validationResults?.remainingErrors>0){const{remainingErrors:ue,errors:be}=ve.result.validationResults,ce=`Template installation completed but ${ue} validation issue${ue>1?"s":""} remain unresolved.`;m(ce),j(be||[])}else{const ue=ve?.result?.message||ve?.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,h,B,G,W]),x.useEffect(()=>{const ae=t.get("runId"),oe=t.get("resume"),ve=t.get("provider");if(ae&&oe==="true"&&ve&&!B&&!G&&!O&&!_&&U){w(ae),k(!0);try{W({runId:ae}).then(de=>{if(de.snapshot?.status==="running")return R.mutateAsync({runId:ae})}).then(()=>{n(de=>{const ue=new URLSearchParams(de);return ue.delete("resume"),ue})}).catch(de=>{console.error("❌ Failed to resume template installation:",de),de.message?.includes("404")||de.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(de){console.error("❌ Auto-resume failed with error:",de),m("Failed to resume template installation. Please refresh and try again.")}}},[t,e,B,G,O,_,U,W,R,n]);const J=[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"groq",label:"Groq"},{value:"google",label:"Google"}],re=[{key:"tools",label:"Tools",value:A?.tools?.length?A.tools.map(ae=>ae).join(", "):"n/a",icon:l.jsx(No,{})},{key:"agents",label:"Agents",value:A?.agents?.length?A.agents.map(ae=>ae).join(", "):"n/a",icon:l.jsx(Ys,{})},{key:"workflows",label:"Workflows",value:A?.workflows?.length?A.workflows.map(ae=>ae).join(", "):"n/a",icon:l.jsx(t3t,{})},{key:"providers",label:"Providers",value:A?.supportedProviders?.length?A.supportedProviders.join(", "):"n/a",icon:l.jsx(JLt,{})},{key:"tags",label:"Tags",value:A?.tags?.length?A.tags.join(", "):"n/a",icon:l.jsx(W4t,{})}],ne=[{...re[0]},{...re[1]},{...re[2]}].filter(ae=>ae.value!=="n/a");x.useEffect(()=>{F&&d(F)},[F]),x.useEffect(()=>{const ae=Z||Q;ae?.phase==="error"&&ae?.error&&m(typeof ae.error=="string"?ae.error:String(ae.error))},[Z?.phase,Z?.error,Q?.phase,Q?.error]);const se=ae=>{a(ae)},le=async ae=>(i(ae.provider),c(ae.modelId),{message:"Model updated successfully"}),me=async()=>{const ae=Object.entries(u).reduce((oe,[ve,de])=>(de===""&&oe.push(ve),oe),[]);if(ae.length>0){p(ae);return}if(A){m(null),v(!1),w(""),C(!0);try{const ve={repo:A.githubUrl||`https://github.com/mastra-ai/template-${A.slug}`,ref:M,slug:A.slug,variables:u},{runId:de}=await z({});w(de),n(ue=>{const be=new URLSearchParams(ue);return be.set("runId",de),be.set("resume","true"),be.set("provider",r||"openai"),be}),await $.mutateAsync({inputData:ve,selectedModel:{provider:s,modelId:o},runId:de})}catch(oe){C(!1),m(oe?.message||"Template installation failed"),console.error("Template installation failed",oe)}}},K=ae=>{const{name:oe,value:ve}=ae.target;ve.trim()===""?p(de=>[...de,oe]):p(de=>de.filter(ue=>ue!==oe)),d(de=>({...de,[oe]:ve}))};return l.jsxs(zn,{children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/templates",children:[l.jsx(_e,{children:l.jsx($Qe,{})}),"Templates"]}),l.jsx(kn,{as:Wt,to:`/templates/${A?.slug}`,isCurrent:!0,children:A?.title&&A.title})]})}),l.jsx("div",{className:Y("w-full lg:px-12 h-full overflow-y-scroll"),children:l.jsxs("div",{className:"p-6 w-full max-w-[80rem] mx-auto grid gap-y-4",children:[l.jsx(gpr,{isLoading:I,title:A?.title,description:A?.longDescription,imageURL:A?.imageURL,githubUrl:A?.githubUrl,infoData:re,templateSlug:e}),A&&l.jsxs(l.Fragment,{children:[(B||G)&&l.jsx(Spr,{name:A.title,streamResult:G?Q:Z,runId:b,workflowInfo:U}),g&&l.jsx(Opr,{name:A.title,installedEntities:ne,linkComponent:Wt}),h&&l.jsx(kpr,{errorMsg:h,validationErrors:T.length>0?T:Z?.validationResults?.errors||Q?.validationResults?.errors}),!B&&!G&&!g&&!h&&l.jsx(vpr,{providerOptions:J,selectedProvider:r,onProviderChange:se,variables:u,setVariables:d,errors:f,setErrors:p,handleInstallTemplate:me,handleVariableChange:K,isLoadingEnvVars:D||V,isInstalling:H,defaultModelProvider:s,defaultModelId:o,onModelUpdate:le})]})]})})]})}const tkr=()=>{const{toolId:e,agentId:t}=ps();return l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/agents",children:[l.jsx(_e,{children:l.jsx(Ys,{})}),"Agents"]}),l.jsx(kn,{as:Wt,to:`/agents/${t}/chat`,children:t}),l.jsx(kn,{as:Wt,to:`/tools/${t}/${e}`,isCurrent:!0,children:e})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",children:[l.jsx(_e,{children:l.jsx(dc,{})}),"Tools documentation"]})})]}),l.jsx(Mlr,{toolId:e,agentId:t})]})},nkr=()=>{const{toolId:e}=ps();return l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/tools",children:[l.jsx(_e,{children:l.jsx(No,{})}),"Tools"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:l.jsx(fpr,{value:e,variant:"ghost"})})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Tools documentation"]})})]}),l.jsx(dpr,{toolId:e})]})};function rkr(){const{data:e,isLoading:t,error:n}=Av(),[r,a]=x.useState("");return l.jsxs(za,{children:[l.jsxs(za.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:t,children:[l.jsx(Jo,{})," Workflows"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Vs,{as:"a",href:"https://mastra.ai/en/docs/workflows/overview",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Workflows documentation",children:l.jsx(ql,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(Jb,{onSearch:a,label:"Filter workflows",placeholder:"Filter by name or description"})})]}),l.jsx(psr,{workflows:e||{},isLoading:t,error:n,search:r,onSearch:a})]})}const e8e=()=>{const{workflowId:e}=ps(),{data:t,isLoading:n,error:r}=kR(e);return r&&Ja(r)?l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"workflows"})}):l.jsx(Obt,{workflowId:e,workflow:t??void 0,isLoading:n})};function t8e(){const{workspaceId:e}=ps(),[t,n]=Wi(),r=Dc(),[a,s]=x.useState(!1),[i,o]=x.useState(!1),[c,u]=x.useState(!1),[d,f]=x.useState(null),[p,h]=x.useState(null),[m,g]=x.useState(!1),v=t.get("file"),b=t.get("tab"),{data:w,error:O,isLoading:k}=z0t(),_=w?.workspaces??[],C=e??_[0]?.id,{data:T,isLoading:j,error:A}=zur(C),I=Ja(O)||Ja(A),P=t.get("path")||".",M=Ure(O)||Ure(A),F=C?_.find(rt=>rt.id===C):void 0,D=rt=>{const Ge=new URLSearchParams(t);for(const[Ze,Ke]of Object.entries(rt))Ke===null?Ge.delete(Ze):Ge.set(Ze,Ke);n(Ge)},U=rt=>{g(!1),s(!1),r(`/workspaces/${rt}`)},V=rt=>{D({path:rt==="."||rt===""?null:rt,file:null})},z=rt=>{D({file:rt})},H=rt=>{D({tab:rt})},W=P,$=v,{data:Z,isLoading:B,error:R,refetch:Q}=Bur(W,{enabled:T?.isWorkspaceConfigured&&T?.capabilities?.hasFilesystem,workspaceId:C}),G=qur(),J=Vur(),{data:re,isLoading:ne}=B0t($??"",{enabled:!!$,workspaceId:C}),{data:se,isLoading:le,refetch:me}=Qur({workspaceId:C}),K=Jur(),ae=edr(),oe=tdr(),ve=T?.isWorkspaceConfigured??!1,de=T?.capabilities?.hasFilesystem??!1,ue=T?.capabilities?.hasSkills??!1,be=T?.capabilities?.canBM25??!1,ce=T?.capabilities?.canVector??!1,we=F?.safety?.readOnly??!1,ee=de&&!we,X=T?.mounts,pe=X?.filter(rt=>!rt.readOnly).map(rt=>({path:rt.path,displayName:rt.displayName,icon:rt.icon,provider:rt.provider,name:rt.name})),Se=X&&X.length>1?X.map(rt=>rt.path):void 0,je=x.useCallback(rt=>{C&&K.mutate({...rt,workspaceId:C},{onSuccess:async Ge=>{if(Ge.success){u(!1);const{data:Ze,error:Ke}=await me();if(Ke||!Ze){De.success(`Skill "${Ge.skillName}" installed successfully (${Ge.filesWritten} files)`);return}Ze.skills.some(ot=>ot.name===Ge.skillName)?De.success(`Skill "${Ge.skillName}" installed successfully (${Ge.filesWritten} files)`):(g(!0),De.warning(`Skill "${Ge.skillName}" installed to .agents/skills but not discovered. Add .agents/skills to your workspace skills paths.`))}else De.error("Failed to install skill")},onError:Ge=>{De.error(`Failed to install skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}})},[C,K,me]),fe=x.useCallback(rt=>{C&&(h(rt),ae.mutate({workspaceId:C,skillName:rt},{onSuccess:Ge=>{if(h(null),Ge.updated.length>0){const Ze=Ge.updated[0];Ze.success?(De.success(`Skill "${rt}" updated successfully (${Ze.filesWritten} files)`),me()):De.error(`Failed to update skill: ${Ze.error??"Unknown error"}`)}else De.error("Failed to update skill: No update result returned")},onError:Ge=>{h(null),De.error(`Failed to update skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}}))},[C,ae,me]),ke=x.useCallback(rt=>{C&&(f(rt),oe.mutate({workspaceId:C,skillName:rt},{onSuccess:Ge=>{f(null),Ge.success?(De.success(`Skill "${Ge.skillName}" removed successfully`),me()):De.error(`Failed to remove skill "${Ge.skillName}"`)},onError:Ge=>{f(null),De.error(`Failed to remove skill: ${Ge instanceof Error?Ge.message:"Unknown error"}`)}}))},[C,oe,me]),Me=b==="files"&&de?"files":b==="skills"&&ue?"skills":de?"files":ue?"skills":"files",tt=se?.skills??[],kt=se?.isSkillsConfigured??!1,Gt=Z?.entries??[],xn=de&&(be||ce),Tn=ue&&kt&&tt.length>0,zt=xn||Tn;return I?l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"workspaces"})})]}):M?l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[l.jsx(X2,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(up,{})}),l.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[l.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-amber-500/10 mb-6",children:l.jsx(Kee,{className:"h-8 w-8 text-amber-500"})}),l.jsx("h2",{className:"text-xl font-semibold text-neutral6 mb-2",children:"Workspace Not Supported"}),l.jsxs("p",{className:"text-neutral4 max-w-md mb-6",children:["The workspace feature requires a newer version of ",l.jsx("code",{className:"text-neutral5",children:"@mastra/core"}),". Please upgrade your dependencies to enable workspace functionality."]}),l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",children:[l.jsx(_e,{children:l.jsx(dc,{})}),"Learn More"]})]})]})})]}):k?l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(_e,{children:l.jsx(dc,{})}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ft,{})})]}):!j&&!k&&!ve?l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Workspaces documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start h-full w-full",children:[l.jsx(X2,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(up,{})}),l.jsx(nbr,{})]})})]}):l.jsxs(zn,{children:[l.jsxs(rr,{children:[l.jsxs(Bi,{children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(Ui,{children:[zt&&l.jsxs(ye,{variant:"light",onClick:()=>s(!a),children:[l.jsx(_e,{children:l.jsx(V4t,{className:"h-4 w-4"})}),"Search"]}),l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(_e,{children:l.jsx(dc,{})}),"Workspaces documentation"]})]})]}),l.jsx("div",{className:"grid overflow-y-auto h-full",children:l.jsxs("div",{className:"max-w-[100rem] px-[3rem] mx-auto grid content-start gap-6 h-full w-full",children:[l.jsx(X2,{title:"Workspace",description:"Manage files, skills, and search your workspace",icon:l.jsx(up,{})}),_.length>1&&l.jsxs("div",{className:"relative",children:[l.jsxs("button",{onClick:()=>o(!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:[F?.source==="agent"?l.jsx(u2,{className:"h-4 w-4 text-accent1"}):l.jsx(WB,{className:"h-4 w-4 text-neutral4"}),l.jsxs("span",{className:"flex-1 text-left truncate",children:[F?.name??"Select workspace",F?.source==="agent"&&F.agentName&&l.jsxs("span",{className:"text-neutral4 ml-1",children:["(",F.agentName,")"]})]}),l.jsx(s4t,{className:`h-4 w-4 text-neutral4 transition-transform ${i?"rotate-180":""}`})]}),i&&l.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(rt=>l.jsxs("button",{onClick:()=>{U(rt.id),o(!1)},className:`flex items-center gap-3 px-3 py-2 w-full text-left hover:bg-surface3 transition-colors ${F?.id===rt.id?"bg-surface3":""}`,children:[rt.source==="agent"?l.jsx(u2,{className:"h-4 w-4 text-accent1 flex-shrink-0"}):l.jsx(WB,{className:"h-4 w-4 text-neutral4 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-sm font-medium text-neutral6 truncate",children:rt.name}),l.jsx("div",{className:"text-xs text-neutral4 truncate",children:rt.source==="agent"?`Agent: ${rt.agentName}`:"Global workspace"})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[rt.safety?.readOnly&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"}),rt.capabilities.hasFilesystem&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"FS"}),rt.capabilities.hasSandbox&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Sandbox"}),rt.capabilities.hasSkills&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:"Skills"})]})]},rt.id))})]}),_.length===1&&F&&l.jsxs("div",{className:"flex items-center gap-2 text-sm text-neutral4",children:[F.source==="agent"?l.jsx(u2,{className:"h-4 w-4 text-accent1"}):l.jsx(WB,{className:"h-4 w-4"}),l.jsx("span",{children:F.name}),F.source==="agent"&&F.agentName&&l.jsxs("span",{className:"text-neutral3",children:["(",F.agentName,")"]}),we&&l.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-400",children:"Read-only"})]}),a&&zt&&C&&l.jsx(akr,{workspaceId:C,canSearchFiles:xn,canSearchSkills:Tn,canBM25:be,canVector:ce,showInitWarning:!j&&T?.status!=="ready",onViewFileResult:rt=>{D({file:rt,tab:"files"})},onViewSkillResult:(rt,Ge)=>{C&&r(`/workspaces/${C}/skills/${encodeURIComponent(rt)}?path=${encodeURIComponent(Ge)}`)}},C),l.jsxs("div",{className:"flex gap-2 border-b border-border1",children:[de&&l.jsxs("button",{onClick:()=>H("files"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Me==="files"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(eI,{className:"h-4 w-4"}),"Files"]}),ue&&l.jsxs("button",{onClick:()=>H("skills"),className:`flex items-center gap-2 px-4 py-2 text-sm font-medium border-b-2 transition-colors ${Me==="skills"?"border-accent1 text-neutral6":"border-transparent text-neutral4 hover:text-neutral5"}`,children:[l.jsx(T$,{className:"h-4 w-4"}),"Skills",kt&&tt.length>0&&l.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-surface4 text-neutral4",children:tt.length})]})]}),l.jsxs("div",{className:"pb-8",children:[Me==="files"&&de&&l.jsx("div",{className:"space-y-4",children:l.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[l.jsx(Kyr,{entries:Gt,currentPath:W,isLoading:B,error:R,onNavigate:V,onFileSelect:z,onRefresh:()=>Q(),onCreateDirectory:we?void 0:rt=>J.mutate({path:rt,workspaceId:C}),onDelete:we?void 0:rt=>G.mutate({path:rt,recursive:!0,force:!0,workspaceId:C})}),$&&l.jsx(tbr,{path:$,content:re?.content??"",isLoading:ne,mimeType:re?.mimeType,onClose:()=>z(null)})]})}),Me==="skills"&&ue&&l.jsx(dbr,{skills:tt,isLoading:le,isSkillsConfigured:kt,hasUndiscoveredAgentSkills:m,basePath:C?`/workspaces/${C}/skills`:"/workspaces",onAddSkill:ee?()=>u(!0):void 0,onUpdateSkill:ee?fe:void 0,onRemoveSkill:ee?ke:void 0,updatingSkillName:p??void 0,removingSkillName:d??void 0,mountPaths:Se}),!de&&!ue&&l.jsx("div",{className:"py-12 text-center text-neutral4",children:l.jsx("p",{children:"No workspace capabilities are configured."})})]})]})}),C&&ee&&l.jsx(vbr,{open:c,onOpenChange:u,workspaceId:C,onInstall:je,isInstalling:K.isPending,installedSkillIds:tt.filter(rt=>rt.skillsShSource).map(rt=>`${rt.skillsShSource.owner}/${rt.skillsShSource.repo}/${rt.name}`),installedSkillNames:tt.filter(rt=>!rt.skillsShSource).map(rt=>rt.name),writableMounts:pe,installedSkillPaths:Object.fromEntries(tt.filter(rt=>rt.path).map(rt=>[rt.name,rt.path]))})]})}function akr({workspaceId:e,canSearchFiles:t,canSearchSkills:n,canBM25:r,canVector:a,showInitWarning:s,onViewFileResult:i,onViewSkillResult:o}){const c=Hur(),u=Zur();return l.jsxs("div",{className:"border border-border1 rounded-lg p-4 bg-surface2 space-y-4",children:[t&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(eI,{className:"h-4 w-4"}),"Search Indexed Files"]}),s&&l.jsxs("p",{className:"text-xs text-amber-400 mb-3",children:["File search requires ",l.jsx("code",{className:"text-amber-300",children:"workspace.init()"})," to index files from your configured ",l.jsx("code",{className:"text-amber-300",children:"autoIndexPaths"}),"."]}),l.jsx(rbr,{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&&l.jsxs("div",{children:[l.jsxs("h3",{className:"text-sm font-medium text-neutral5 mb-3 flex items-center gap-2",children:[l.jsx(T$,{className:"h-4 w-4"}),"Search Skills"]}),l.jsx(sbr,{onSearch:d=>u.mutate({...d,workspaceId:e}),results:u.data?.results??[],isSearching:u.isPending,onResultClick:d=>o(d.skillName,d.skillPath)})]})]})}function skr(e,t){return e==null||t==null?null:e in t?e:null}function ikr(){const{skillName:e,workspaceId:t}=ps(),[n]=Wi(),r=es(),a=e?decodeURIComponent(e):"",s=n.get("path"),i=s?decodeURIComponent(s):void 0,o=n.get("agentId"),c=o?decodeURIComponent(o):null,d=r.getQueriesData({queryKey:["agents"]})?.[0]?.[1]??null,f=skr(c,d),p=f?`/agents/${f}`:t?`/workspaces/${t}?tab=skills`:"/workspaces",[h,m]=x.useState(null),{data:g,isLoading:v,error:b}=Wur(a,{workspaceId:t,path:i}),{data:w}=B0t(g?.path?`${g.path}/SKILL.md`:"",{enabled:!!g?.path,workspaceId:t}),{data:O,isLoading:k}=Gur(a,h??"",{enabled:!!h,workspaceId:t,path:i}),_=C=>f?l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:p,children:[l.jsx(_e,{children:l.jsx(u2,{className:"h-4 w-4"})}),f]}),l.jsxs(kn,{as:"span",to:"",isCurrent:!0,children:[l.jsx(_e,{children:l.jsx(T$,{className:"h-4 w-4"})}),C]})]}):l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:p,children:[l.jsx(_e,{children:l.jsx(up,{className:"h-4 w-4"})}),"Workspace"]}),l.jsxs(kn,{as:Wt,to:p,children:[l.jsx(_e,{children:l.jsx(T$,{className:"h-4 w-4"})}),"Skills"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:C})]});return v?l.jsxs(zn,{children:[l.jsx(rr,{children:_("Loading...")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsx("div",{className:"h-8 w-8 border-2 border-accent1 border-t-transparent rounded-full animate-spin"})})]}):b&&Ja(b)?l.jsxs(zn,{children:[l.jsx(rr,{children:_("Permission Denied")}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"workspaces"})})]}):b||!g?l.jsxs(zn,{children:[l.jsx(rr,{children:_("Error")}),l.jsx("div",{className:"grid place-items-center h-full",children:l.jsxs("div",{className:"text-center",children:[l.jsx("p",{className:"text-red-400 mb-2",children:"Failed to load skill"}),l.jsx("p",{className:"text-sm text-neutral3",children:b?.message??"Skill not found"})]})})]}):l.jsxs(zn,{children:[l.jsxs(rr,{children:[_(g.name),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/workspace/skills",target:"_blank",children:[l.jsx(_e,{children:l.jsx(dc,{})}),"Documentation"]})})]}),l.jsx("div",{className:"grid overflow-y-auto overflow-x-hidden h-full",children:l.jsx("div",{className:"max-w-[100rem] px-[3rem] mx-auto py-8 h-full w-full overflow-x-hidden",children:l.jsx(mbr,{skill:g,rawSkillMd:w?.content,onReferenceClick:m})})}),l.jsx(gbr,{open:!!h,onOpenChange:C=>!C&&m(null),skillName:g.name,referencePath:h??"",content:O?.content,isLoading:k})]})}const okr=[{key:"primitives",title:"Primitives",href:"/primitives",links:[{name:"Agents",url:"/agents",icon:l.jsx(Ys,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"agents:read"},{name:"Prompts",url:"/prompts",icon:l.jsx(eI,{}),isOnMastraPlatform:!0,indent:!0},{name:"Workflows",url:"/workflows",icon:l.jsx(Jo,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workflows:read"},{name:"Processors",url:"/processors",icon:l.jsx(PQe,{}),isOnMastraPlatform:!1,indent:!0,requiredPermission:"processors:read"},{name:"MCP Servers",url:"/mcps",icon:l.jsx(Cu,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"mcps:read"},{name:"Tools",url:"/tools",icon:l.jsx(No,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"tools:read"},{name:"Workspaces",url:"/workspaces",icon:l.jsx(up,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"workspaces:read"},{name:"Request Context",url:"/request-context",icon:l.jsx(_le,{}),isOnMastraPlatform:!0,indent:!0}]},{key:"evaluation",title:"Evaluation",href:"/evaluation",links:[{name:"Scorers",url:"/evaluation?tab=scorers",icon:l.jsx(ZLt,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"scorers:read"},{name:"Datasets",url:"/evaluation?tab=datasets",icon:l.jsx(Sd,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]},{name:"Experiments",url:"/evaluation?tab=experiments",icon:l.jsx(Z4t,{}),isOnMastraPlatform:!0,indent:!0,requiredAnyPermission:["datasets:read"]}]},{key:"observability",title:"Observability",href:"/observability-overview",links:[{name:"Metrics",url:"/metrics",icon:l.jsx(kle,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Traces",url:"/observability",icon:l.jsx(XO,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"},{name:"Logs",url:"/logs",icon:l.jsx(DQe,{}),isOnMastraPlatform:!0,indent:!0,requiredPermission:"observability:read"}]},{key:"bottom",separator:!0,links:[{name:"Settings",url:"/settings",icon:l.jsx(Xme,{}),isOnMastraPlatform:!1},{name:"Resources",url:"/resources",icon:l.jsx(ql,{}),isOnMastraPlatform:!0}]}],lkr={scorers:"/evaluation/scorers",datasets:"/evaluation/datasets"};function n8e(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 o=lkr[s];if(o&&(t===o||t.startsWith(o+"/")))return!0}return!1}return t===e.url||t.startsWith(e.url+"/")}function ckr(){const{state:e}=Uwt(),t=Mc(),n=t.pathname,{isMastraPlatform:r}=Xwt(),{data:a}=G_(),{isCmsAvailable:s,isLoading:i}=hge(),{hasPermission:o,hasAnyPermission:c,rbacEnabled:u,isAuthenticated:d,isLoading:f}=jv(),p=a&&CR(a),h=new Set(["/prompts"]),m=g=>h.has(g.url)&&!s&&!i||r&&!g.isOnMastraPlatform?!1:u&&d&&f?!0:!(g.requiredPermission&&!o(g.requiredPermission)||g.requiredAnyPermission&&!c(g.requiredAnyPermission));return l.jsxs(pg,{children:[l.jsx("div",{className:"pt-3 mb-4 -ml-0.5 sticky top-0 bg-surface1 z-10",children:e==="collapsed"?l.jsxs("div",{className:"flex flex-col gap-3 items-center",children:[l.jsx(rb,{className:"h-[1.5rem] w-[1.5rem] shrink-0 ml-3"}),p&&l.jsx(jse,{})]}):p?l.jsxs("span",{className:"flex items-center justify-between pl-3 pr-2",children:[l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(rb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]}),l.jsx(jse,{})]}):l.jsxs("span",{className:"flex items-center gap-2 pl-3",children:[l.jsx(rb,{className:"h-[1.5rem] w-[1.5rem] shrink-0"}),l.jsx("span",{className:"font-serif text-sm",children:"Mastra Studio"})]})}),l.jsx(pg.Nav,{children:okr.map(g=>{const v=g.links.filter(m),b=v.length>0&&g?.separator,w=v.some(k=>n8e(k,n,t.search)),O=!!(g.href&&n===g.href&&!w);return l.jsxs(pg.NavSection,{children:[g?.title?l.jsx(pg.NavHeader,{state:e,href:g.href,isActive:O,children:g.title}):l.jsx(l.Fragment,{children:b&&l.jsx(pg.NavSeparator,{})}),l.jsx(pg.NavList,{children:v.map(k=>{const _=n8e(k,n,t.search);return l.jsx(pg.NavLink,{state:e,link:k,isActive:_},k.name)})})]},g.key)})}),l.jsx(pg.Bottom,{children:e!=="collapsed"&&l.jsxs(l.Fragment,{children:[l.jsx(pg.NavSeparator,{}),l.jsx(Kor,{collapsed:!1})]})})]})}const ukr=x.createContext({theme:"dark",setTheme:()=>null}),dkr=e=>e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";function Q1t({children:e}){const t=Fr(a=>a.theme),n=Fr(a=>a.setTheme),r=t==="light"||t==="system"?t:"dark";return x.useEffect(()=>{const a=window.document.documentElement,s=c=>{const u=dkr(c);a.classList.remove("light","dark"),a.classList.add(u)};if(s(r),r!=="system")return;const i=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>s("system");return i.addEventListener("change",o),()=>{i.removeEventListener("change",o)}},[r]),l.jsx(ukr.Provider,{value:{theme:r,setTheme:n},children:e})}const W1t="experimental-ui:",G1t="current",fkr=Ce.createContext(null);function pkr(e,t){const n=window.localStorage.getItem(W1t+e);return n&&t.has(n)?n:G1t}function hkr({experiments:e,children:t}){const n=Ce.useMemo(()=>new Map(e.map(c=>[c.key,new Set(c.variants.map(u=>u.value))])),[e]),[r,a]=Ce.useState({});Ce.useLayoutEffect(()=>{const c={};for(const u of e){const d=n.get(u.key);c[u.key]=pkr(u.key,d)}a(c)},[e,n]);const s=Ce.useCallback(c=>r[c]??G1t,[r]),i=Ce.useCallback((c,u)=>{window.localStorage.setItem(W1t+c,u),a(d=>({...d,[c]:u}))},[]),o=Ce.useMemo(()=>({experiments:e,getVariant:s,setVariant:i}),[e,s,i]);return l.jsx(fkr.Provider,{value:o,children:t})}const mkr=[{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"}]}],gkr=()=>({experimentalUIEnabled:typeof window<"u"&&window.MASTRA_EXPERIMENTAL_UI==="true"});function vkr({children:e}){const{data:t,isFetched:n}=G_(),r=n&&t?.enabled&&!CR(t),a=n&&!r;return l.jsxs(l.Fragment,{children:[l.jsx(_br,{}),l.jsxs("div",{className:a?"grid h-full grid-cols-[auto_1fr]":"h-full",children:[a&&l.jsx(ckr,{}),l.jsx("div",{className:Y("bg-transparent overflow-y-auto",{"h-[calc(100%-1.5rem)]":r}),children:l.jsx(tSt,{children:e})})]})]})}const ykr=({children:e})=>{const{experimentalUIEnabled:t}=gkr();return l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(gst,{position:"bottom-right"}),l.jsx(Q1t,{defaultTheme:"dark",attribute:"class",children:l.jsx(Pc,{delayDuration:0,children:l.jsx(hkr,{experiments:t?mkr:[],children:l.jsx(Ayr,{children:l.jsx(vkr,{children:e})})})})})]})},bkr=({children:e})=>l.jsxs("div",{className:"bg-surface1 font-sans h-screen",children:[l.jsx(gst,{position:"bottom-right"}),l.jsx(Q1t,{defaultTheme:"dark",attribute:"class",children:l.jsx(Pc,{delayDuration:0,children:l.jsx("div",{className:"h-full overflow-y-auto",children:l.jsx(tSt,{children:e})})})})]});function xkr({agentId:e}){return l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/agents",children:[l.jsx(_e,{children:l.jsx(Ys,{})}),"Agents"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:l.jsx(Nlr,{value:e,variant:"ghost"})})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/en/docs/agents/overview",target:"_blank",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Agents documentation"]})})]})}const wkr=({children:e})=>{const{agentId:t}=ps(),n=Mc(),{isCmsAvailable:r}=hge(),{hasObservability:a}=nlr(),s=iie.has("datasets"),i=r&&s,o=a&&s,{data:c}=Dd(t),u=xc(c?.provider??""),d=c?.modelId??"",f=c?.requestContextSchema,p=n.pathname.includes("/editor")?"versions":n.pathname.includes("/evaluate")?"evaluate":n.pathname.includes("/review")?"review":n.pathname.includes("/traces")?"traces":"chat",h=(p==="versions"||p==="evaluate"||p==="review")&&(i||o),m=l.jsxs(zn,{className:"grid-rows-[auto_auto_1fr]",children:[l.jsx(xkr,{agentId:t}),l.jsx(Pfr,{agentId:t,activeTab:p,showPlayground:i,showObservability:o,rightSlot:h?l.jsx(Mfr,{requestContextSchema:f}):void 0}),e]});return l.jsx(qz,{children:l.jsx(vir,{defaultProvider:u,defaultModel:d,children:l.jsx(Ofr,{children:l.jsx(yir,{children:m})})})})};function Skr(){const{data:e={},isLoading:t,error:n}=jge(),[r,a]=x.useState("");return l.jsxs(za,{children:[l.jsxs(za.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:t,children:[l.jsx(CO,{})," Processors"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Vs,{as:"a",href:"https://mastra.ai/en/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Processors documentation",children:l.jsx(ql,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(Jb,{onSearch:a,label:"Filter processors",placeholder:"Filter by name"})})]}),l.jsx(epr,{processors:e,isLoading:t,error:n,search:r,onSearch:a})]})}function Okr(){const{processorId:e}=ps(),{data:t,isLoading:n,error:r}=cwt(e);return r&&Ja(r)?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(CO,{})}),"Processors"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:e})]})}),l.jsx("div",{className:"flex h-full items-center justify-center",children:l.jsx(Ks,{resource:"processors"})})]}):!n&&t?.isWorkflow?l.jsx(h0r,{to:`/workflows/${e}/graph`,replace:!0}):n?l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsx(rr,{children:l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(CO,{})}),"Processors"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:l.jsx(Tr,{className:"h-6 w-32"})})]})}),l.jsxs("div",{className:"p-6",children:[l.jsx(Tr,{className:"h-8 w-48 mb-4"}),l.jsx(Tr,{className:"h-32 w-full"})]})]}):l.jsxs("div",{className:"h-full w-full overflow-y-hidden",children:[l.jsxs(rr,{children:[l.jsxs(Gs,{children:[l.jsxs(kn,{as:Wt,to:"/processors",children:[l.jsx(_e,{children:l.jsx(CO,{})}),"Processors"]}),l.jsx(kn,{as:"span",to:"",isCurrent:!0,children:l.jsx(ipr,{value:e,variant:"ghost"})})]}),l.jsx(Ui,{children:l.jsxs(ye,{as:Wt,to:"https://mastra.ai/docs/agents/processors",target:"_blank",rel:"noopener noreferrer",variant:"ghost",size:"md",children:[l.jsx(dc,{}),"Processors documentation"]})})]}),l.jsx(rpr,{processorId:e})]})}function kkr(){const{data:e={},isLoading:t}=nh(),{data:n={},isLoading:r,error:a}=a8(),[s,i]=x.useState(""),o=t||r;return l.jsxs(za,{children:[l.jsxs(za.Top,{children:[l.jsxs(dt,{withMargins:!1,children:[l.jsx(dt.Column,{children:l.jsxs(dt.Title,{isLoading:o,children:[l.jsx(No,{})," Tools"]})}),l.jsx(dt.Column,{className:"flex justify-end gap-2",children:l.jsx(Vs,{as:"a",href:"https://mastra.ai/en/docs/agents/using-tools-and-mcp",target:"_blank",rel:"noopener noreferrer",tooltipContent:"Go to Tools documentation",children:l.jsx(ql,{})})})]}),l.jsx("div",{className:"max-w-120",children:l.jsx(Jb,{onSearch:i,label:"Filter tools",placeholder:"Filter by name"})})]}),l.jsx(cpr,{tools:n,agents:e,isLoading:o,error:a,search:s,onSearch:i})]})}const Z1t={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}`},_kr=()=>{const e=Dc(),t=n=>e(n,{viewTransition:!0});return l.jsx(rbt,{Link:q1t,navigate:t,paths:Z1t,children:l.jsx(ykr,{children:l.jsx(Hk,{})})})},Ekr=()=>{const e=Dc(),t=n=>e(n,{viewTransition:!0});return l.jsx(rbt,{Link:q1t,navigate:t,paths:Z1t,children:l.jsx(bkr,{children:l.jsx(Hk,{})})})},Ckr=!!window.MASTRA_CLOUD_API_ENDPOINT,r8e=iie.has("datasets"),a8e=[{index:!0,element:l.jsx(D1r,{})},{path:"instruction-blocks",element:l.jsx($1r,{})},{path:"tools",element:l.jsx(B1r,{})},{path:"agents",element:l.jsx(R1r,{})},{path:"scorers",element:l.jsx(F1r,{})},{path:"workflows",element:l.jsx(q1r,{})},{path:"skills",element:l.jsx(z1r,{})},{path:"memory",element:l.jsx(L1r,{})},{path:"variables",element:l.jsx(U1r,{})}],jkr=[{path:"/login",element:l.jsx(cOr,{})},{path:"/signup",element:l.jsx(FOr,{})},{element:l.jsx(Ekr,{}),children:[{path:"/agents/:agentId/session",element:l.jsx(qze,{})},{path:"/agents/:agentId/session/:threadId",element:l.jsx(qze,{})}]},{element:l.jsx(_kr,{}),children:[...Ckr?[]:[{path:"/settings",element:l.jsx(LOr,{})},{path:"/templates",element:l.jsx(KOr,{})},{path:"/templates/:templateSlug",element:l.jsx(ekr,{})}],{path:"/logs",element:l.jsx(mOr,{})},{path:"/primitives",element:l.jsx(NOr,{})},{path:"/evaluation",element:l.jsx(lOr,{})},{path:"/evaluation/scorers/:scorerId",element:l.jsx(MOr,{})},{path:"/metrics",element:l.jsx(bOr,{})},{path:"/observability-overview",element:l.jsx(jOr,{})},{path:"/observability",element:l.jsx(EOr,{})},{path:"/resources",element:l.jsx(POr,{})},{path:"/agents",element:l.jsx(E1r,{})},{path:"/cms/agents/create",element:l.jsx(P1r,{}),children:a8e},{path:"/cms/agents/:agentId/edit",element:l.jsx(M1r,{}),children:a8e},{path:"/cms/scorers/create",element:l.jsx(W1r,{})},{path:"/cms/scorers/:scorerId/edit",element:l.jsx(Z1r,{})},{path:"/prompts",element:l.jsx(AOr,{})},{path:"/cms/prompts/create",element:l.jsx(V1r,{})},{path:"/cms/prompts/:promptBlockId/edit",element:l.jsx(Q1r,{})},{path:"/agents/:agentId/tools/:toolId",element:l.jsx(tkr,{})},{path:"/agents/:agentId",element:l.jsx(wkr,{children:l.jsx(Hk,{})}),children:[{index:!0,loader:({params:e})=>BJ(`/agents/${e.agentId}/chat`)},{path:"chat",element:l.jsx(Uze,{})},{path:"chat/:threadId",element:l.jsx(Uze,{})},...r8e?[{path:"editor",element:l.jsx(N1r,{})},{path:"evaluate",element:l.jsx(T1r,{})},{path:"review",element:l.jsx(A1r,{})}]:[],{path:"traces",element:l.jsx(I1r,{})}]},{path:"/tools",element:l.jsx(kkr,{})},{path:"/tools/:toolId",element:l.jsx(nkr,{})},{path:"/processors",element:l.jsx(Skr,{})},{path:"/processors/:processorId",element:l.jsx(Okr,{})},{path:"/mcps",element:l.jsx(gOr,{})},{path:"/mcps/:serverId",element:l.jsx(vOr,{})},{path:"/mcps/:serverId/tools/:toolId",element:l.jsx(yOr,{})},{path:"/workspaces",element:l.jsx(t8e,{})},{path:"/workspaces/:workspaceId",element:l.jsx(t8e,{})},{path:"/workspaces/:workspaceId/skills/:skillName",element:l.jsx(ikr,{})},{path:"/workflows",element:l.jsx(rkr,{})},{path:"/workflows/:workflowId",element:l.jsx(J0r,{children:l.jsx(Hk,{})}),children:[{index:!0,loader:({params:e})=>BJ(`/workflows/${e.workflowId}/graph`)},{path:"graph",element:l.jsx(e8e,{})},{path:"graph/:runId",element:l.jsx(e8e,{})}]},...r8e?[{path:"/evaluation/datasets/:datasetId",element:l.jsx(X1r,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId",element:l.jsx(eOr,{})},{path:"/evaluation/datasets/:datasetId/items/:itemId/versions",element:l.jsx(rOr,{})},{path:"/evaluation/datasets/:datasetId/experiments/:experimentId",element:l.jsx(K1r,{})},{path:"/evaluation/datasets/:datasetId/experiments",element:l.jsx(J1r,{})},{path:"/evaluation/datasets/:datasetId/items",element:l.jsx(tOr,{})},{path:"/evaluation/datasets/:datasetId/versions",element:l.jsx(sOr,{})}]:[],{index:!0,loader:()=>BJ("/agents")},{path:"/request-context",element:l.jsx(IOr,{})}]}];function Tkr(){const e=window.MASTRA_STUDIO_BASE_PATH||"",{baseUrl:t,headers:n,apiPrefix:r,isLoading:a}=pge();if(a)return null;if(!t)return l.jsx(tlr,{});const s=z0r(jkr,{basename:e});return l.jsx(RFt,{baseUrl:t,headers:n,apiPrefix:r,children:l.jsx(k1r,{children:l.jsx(d0r,{router:s})})})}function Nkr(){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 l.jsx(Dyr,{children:l.jsx(Qor,{endpoint:i,defaultApiPrefix:r,children:l.jsx(Tkr,{})})})}i_t.createRoot(document.getElementById("root")).render(l.jsx(x.StrictMode,{children:l.jsx(Nkr,{})}));const z_r=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));export{Get as A,zrt as B,Yet as C,Fnt as D,Rd as E,Cf as F,Ikr as G,f_t as H,$a as I,z_r as J,Z0 as L,Wet as N,M3 as _,F6t as a,tFt as b,f_r as c,LSe as d,X0 as e,X6t as f,hO as g,eFt as h,Hw as i,Qw as j,Vw as k,Nan as l,Qnt as m,H0 as n,fs as o,Hrn as p,Vrn as q,Hue as r,zle as s,ie as t,sL as u,Gc as v,V6t as w,gt as x,nt as y,cat as z};